index.php                                                                                           0000755 0023422 0004734 00000000615 11016355432 013427  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require('./wp-blog-header.php');
?>                                                                                                                   license.txt                                                                                         0000755 0023422 0004734 00000036062 11116426770 014004  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 		    GNU GENERAL PUBLIC LICENSE
		       Version 2, June 1991

 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 
              51 Franklin St, Fifth Floor, Boston, MA 02110, USA

 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

			    Preamble

  The licenses for most software are designed to take away your
freedom to share and change it.  By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users.  This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it.  (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.)  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.

  To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have.  You must make sure that they, too, receive or can get the
source code.  And you must show them these terms so they know their
rights.

  We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.

  Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software.  If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.

  Finally, any free program is threatened constantly by software
patents.  We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary.  To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.

  The precise terms and conditions for copying, distribution and
modification follow.

		    GNU GENERAL PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License.  The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language.  (Hereinafter, translation is included without limitation in
the term "modification".)  Each licensee is addressed as "you".

Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope.  The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.

  1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.

You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.

  2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:

    a) You must cause the modified files to carry prominent notices
    stating that you changed the files and the date of any change.

    b) You must cause any work that you distribute or publish, that in
    whole or in part contains or is derived from the Program or any
    part thereof, to be licensed as a whole at no charge to all third
    parties under the terms of this License.

    c) If the modified program normally reads commands interactively
    when run, you must cause it, when started running for such
    interactive use in the most ordinary way, to print or display an
    announcement including an appropriate copyright notice and a
    notice that there is no warranty (or else, saying that you provide
    a warranty) and that users may redistribute the program under
    these conditions, and telling the user how to view a copy of this
    License.  (Exception: if the Program itself is interactive but
    does not normally print such an announcement, your work based on
    the Program is not required to print an announcement.)

These requirements apply to the modified work as a whole.  If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works.  But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.

In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.

  3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:

    a) Accompany it with the complete corresponding machine-readable
    source code, which must be distributed under the terms of Sections
    1 and 2 above on a medium customarily used for software interchange; or,

    b) Accompany it with a written offer, valid for at least three
    years, to give any third party, for a charge no more than your
    cost of physically performing source distribution, a complete
    machine-readable copy of the corresponding source code, to be
    distributed under the terms of Sections 1 and 2 above on a medium
    customarily used for software interchange; or,

    c) Accompany it with the information you received as to the offer
    to distribute corresponding source code.  (This alternative is
    allowed only for noncommercial distribution and only if you
    received the program in object code or executable form with such
    an offer, in accord with Subsection b above.)

The source code for a work means the preferred form of the work for
making modifications to it.  For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable.  However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.

If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.

  4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License.  Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.

  5. You are not required to accept this License, since you have not
signed it.  However, nothing else grants you permission to modify or
distribute the Program or its derivative works.  These actions are
prohibited by law if you do not accept this License.  Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.

  6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions.  You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.

  7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all.  For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.

It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.

  8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded.  In such case, this License incorporates
the limitation as if written in the body of this License.

  9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

Each version is given a distinguishing version number.  If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation.  If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.

  10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission.  For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this.  Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.

			    NO WARRANTY

  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.

  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

		     END OF TERMS AND CONDITIONS

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              liesmich.html                                                                                       0000755 0023422 0004734 00000024012 11144365474 014300  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>WordPress &rsaquo; liesmich</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" href="wp-admin/css/install.css" type="text/css" />
</head>
<body>
<h1 id="logo" style="text-align: center">
	<img alt="WordPress" src="wp-admin/images/wordpress-logo.png" />
	<br />Version 2.7.1
</h1>
<p style="text-align: center"> WordPress ist eine zeitgem&auml;sse Plattform zum Ver&ouml;ffentlichen pers&ouml;nlicher Beitr&auml;ge - den Schwerpunkt bilden &Auml;sthetik, Webstandards und Benutzerfreundlichkeit.  </p>
<h1>Eins nach dem anderen</h1>
<p>Willkommen. WordPress ist ein ganz besonderes Projekt f&uuml;r mich. Jeder Entwickler und Mitwirkende f&uuml;gt dieser Mischung etwas einmaliges bei, und zusammen erschaffen wir etwas so wunderbares, dass ich stolz bin, ein Teil davon zu sein. Tausende von Stunden flossen in WordPress ein und wir sind uns darin einig,  es t&auml;glich ein bisschen besser zu machen. Vielen Dank dass Du es zu einem Teil Deiner Welt gemacht hast.</p>
<p style="text-align: right;">&#8212; Matt Mullenweg </p>

<h1 id="installation">Installation: Die ber&uuml;hmte 5-Minuten Installation</h1>
<ol>
	<li>Entpacke die Datei in ein leeres Verzeichnis</li>
	<li>&ouml;ffne die Datei <strong><code>wp-config-sample.php</code></strong> mit einem reinen Texteditor, wie WordPad oder &auml;hnliches (nicht Word!) und trage Deine Datenbankdetails ein.</li>
	<li>Speichere die Datei jetzt als <strong><code>wp-config.php</code></strong> ab.</li>
	<li>Lade alles auf den Server hoch.</li>
	<li>Gehe mit Deinem Browser zu <span class="file"><a href="wp-admin/install.php">/wp-admin/install.php</a></span>. Das sollte jetzt die Tabellen erstellen, die Du f&uuml;r Dein Weblog ben&ouml;tigst. Wenn es eine Fehlermeldung gibt &uuml;berpr&uuml;fe nochmals ganz genau Deine <span class="file">wp-config.php</span> und versuche es erneut. Wenn es wieder nicht funktioniert, dann gehe bitte mit so viel Informationen, wie m&ouml;glich, zu den <a href="http://forum.wordpress-deutschland.org">Support-Foren</a> <a href="http://wordpress.org/support/">(eng.)</a>.</li>
	<li><strong>Merke Dir das Passwort, das Du bekommst.</strong></li>
	<li>Das Installationsskript schickt Dich anschlie&szlig;end zur <a href="wp-login.php">Anmeldeseite</a>. Gebe als Benutzernamen <code>admin</code> ein und darunter das Passwort, dass das Skript f&uuml;r Dich inzwischen generiert hat. Nach der Anmeldung kannst Du auf  <strong>Benutzer/ Dein Profil</strong> klicken um das Passwort &auml;ndern zu k&ouml;nnen.</li>
</ol>

<h1>Upgrade</h1>
<p>Bevor Du &uuml;berhaupt irgend etwas aktualisierst, vergewissere Dich, dass Du von allen Dateien und von der Datenbank ein vollst&auml;ndiges Backup angelegt hast.</p>
<h2>Upgrade von jeder beliebigen fr&uuml;heren Version auf 2.7:</h2>
<ol>
	<li>L&ouml;sche Die alten WP Dateien, sichere aber diejenigen, die Du ver&auml;ndert hast. </li>
	<li>Lade die neuen Dateien hoch</li>
	<li>Gehe mit Deinem Browser zu <span class="file"><a href="wp-admin/upgrade.php">/wp-admin/upgrade.php</a></span></li>
	<li>Du willst mehr? ...das war&#39;s aber schon!</li>
</ol>
<h2>Template-Ver&auml;nderungen</h2>
<p>Wenn Du Deine Templates selber hergestellt hast, wirst Du m&ouml;glicherweise manche Ver&auml;nderung an ihnen durchf&uuml;hren m&uuml;ssen. Wenn Du also Deine Templates der Version 1.2, oder fr&uuml;her umwandeln mu&szlig;t, dann <a href="http://codex.wordpress.org/Upgrade_1.2_to_1.5">h&auml;tten wir hier eine Anleitung f&uuml;r Dich (eng.)</a>. </p>
<h1>Online-Ressourcen</h1>
<p>Wenn Du Fragen hast, die in diesem Dokument nicht ersch&ouml;pfend behandelt werden, dann bediene Dich bei einer, der unz&auml;hligen Online-Ressourcen:</p>
<dl>
	<dt><a href="http://codex.wordpress.org/">WordPress Codex </a></dt>
	<dd>Das Codex ist die gro&szlig;e englischsprachige WordPress-Enzyklop&auml;die. Es ist die ergiebigste WordPress-Informationsquelle, die es gibt. </dd>
	<dt><a href="http://wordpress-deutschland.org/">WordPress Deutschland</a></dt>
	<dd>Die deutsche WordPress Community mit Forum, Wiki, Channel und Weblog. Die beste und umfangreichste deutschsprachige Quelle weit und breit.</dd>
	<dt><a href="http://wordpress.org/development/">Das Entwickler Blog</a></dt>
	<dd>Hier findest Du die aktuellsten Updates und Neuigkeiten rund um WordPress. Freaks sollten die Seite nicht nur oft besuchen, sondern auch zu den Favoriten legen.</dd>
	<dt><a href="http://planet.wordpress.org/">WordPress Planet </a></dt>
	<dd>WordPress Planet ist ein Newsaggregator, der die unterschiedlichsten WordPress Beitr&auml;ge aus dem ganzen Web, auf einer Seite sammelt. </dd>
	<dt><a href="http://wordpress.org/support/">WordPress Support Forums</a></dt>
	<dd>Wenn Du schon &uuml;berall nachgeschaut hast und immer noch zu keiner Antwort gekommen bist, dann sind die Support Foren etwas f&uuml;r Dich. Sie sind sehr aktiv und haben eine gro&szlig;e Gemeinschaft, die gerne bereit ist, Dir zu helfen. Um ihnen die Hilfe zu erleichtern, solltest Du einen aussagekr&auml;ftigen Titel f&uuml;r Deine Frage finden, die Du bitte auch so detailliert stellen m&ouml;chtest, wie Dir nur irgend m&ouml;glich ist. </dd>
	<dt><a href="http://codex.wordpress.org/IRC">WordPress IRC Channel</a></dt>
	<dd>Zum Schlu&szlig;, haben wir hier noch einen Chatkanal, der von Menschen f&uuml;r Diskussionen rund um WordPress und gelegentliche Supportthemen genutzt wird. Die oben erw&auml;hnte WikiSeite (Codex)  kann Dir dabei auch helfen. (irc.freenode.net #wordpresss) </dd>
</dl>

<h1 id="requirements">System-Anforderungen</h1>
<ul>
	<li>PHP Version <strong>4.3</strong> oder h&ouml;her</li>
	<li>MySQL Version <strong>4.0</strong> oder h&ouml;her</li>
	<li>... und ein Link zu <a href="http://wordpress.org">http://wordpress.org</a> auf Deiner Seite.</li>
</ul>
<p>WordPress ist die offizielle Fortsetzung des <a href="http://cafelog.com/">b2/caf&eacute;log</a>-Projekts, dass von Michael V. stammt. Die Arbeit wurde von den <a href="http://wordpress.org/about/">WordPress-Entwicklern (eng.)</a> fortgef&uuml;hrt. Wenn Du WordPress unterst&uuml;tzen willst, kannst Du ja mal &uuml;ber eine <a href="http://wordpress.org/donate/">Spende (eng.)</a> nachdenken. </p>

<h1>Upgrade von anderen Systemen</h1>
<p>WordPress kann eine <a href="http://codex.wordpress.org/Importing_from_other_blogging_software">ganze Reihe (eng.)</a> von anderen Weblog-Systemen importieren. Zun&auml;chst sollte man aber WordPress, wie oben beschrieben installieren und am laufen haben.</p>

<h1 id="templates">XMLRPC-Interface</h1>
<p>Du kannst jetzt mit vielen Programmen, Artikel in deinem Weblog ver&ouml;ffentlichen, wie beispielsweise <a href="http://ecto.kung-foo.tv/">Ecto</a>, <a href="http://blogbuddy.sourceforge.net">BlogBuddy</a>, <a href="http://bloggar.com/">Bloggar</a>, <a href="http://www.ubique.ch/wapblogger/">WapBlogger</a> (mit einem Wap-f&auml;higem Handy posten!) <a href="http://radio.userland.com">Radio Userland</a> (womit das Radio Userland eMail-zum-Blog Feature gemeit ist) <a href="http://www.zempt.com/">Zempt</a>, <a href="http://www.newzcrawler.com/">NewzCrawler</a>, und andere Programme, die die Blogger API's unterst&uuml;tzen! :) Mehr zum Thema XML-RPC Unterst&uuml;tzung <a href="http://codex.wordpress.org/XML-RPC_Support">findest Du im Codex</a> (engl.)</p>

<h1>Ver&ouml;ffentlichen via Email</h1>
<p>Du kannst mit einem beliebigen eMail-Programm Beitr&auml;ge ver&ouml;ffentlichen! Dazu loggst Du Dich ein und gehst zu den Optionen -> schreiben, wo Du die Details der geheimen POP3 Verbindung eingibst. Dann mu&szlig;t Du die Datei wp-mail.php einrichten, damit in regelm&auml;&szlig;igen Abst&auml;nden die mailbox auf neue Beitr&auml;gen gepr&uuml;ft wird. Du kannst das mit Cron-jobs machen, oder falls Dein Hoster/Provider das nicht unterst&uuml;tzt, durch einen check Deiner wp-mail.php Adresse mittels diverser Website-monitoring-service Unternehmen durchf&uuml;hren lassen. </p>
<p> Das Posten ist einfach: Jede eMail, die in dieser speziellen Mailbox landet, wird ver&ouml;ffentlicht und zwar mit dem Subjekt als Titel. Es liegt also auf der Hand,  diese Adresse m&ouml;glichst diskret zu behandeln. Das Skript <i>l&ouml;scht</i> &uuml;brigens umgehend jede erfolgreich ver&ouml;ffentliche eMail. </p>
<h1 id="notes">Benutzerrollen</h1>
<p>Wir haben in WordPress 2.0 die alten Benutzerlevel durch wesentlich flexiblere Benutzerrollen ersetzt. Du kannst n&auml;heres dar&uuml;ber im <a href="http://codex.wordpress.org/Roles_and_Capabilities">Codex (eng.)</a> nachlesen.</p>

<h1>Schlu&szlig;bemerkungen</h1>
<ul>
	<li>Wenn Du irgendwelche Vorschl&auml;ge, Ideen, Kommentare lswerden m&ouml;chtest, oder Du hast (hechel!) einen Fehler gefunden, komm zu uns ins <a href="http://forum.wordpress-deutschland.org">Support-Forum</a> (<a href="http://wordpress.org/support/">eng.</a>).</li>
	<li>WordPress hat eine robuste Plugin-API, die das erweitern des Codes einfach macht. Wenn Du ein Entwickler bist, der daran interessiert ist, sich das zunutze zu machen, sieh Dir doch mal die <a href="http://codex.wordpress.org/Plugin_API">Plugin Dokumentation im Codex (eng.)</a> an. In den allermeisten F&auml;llen wirst Du nicht irgendeinen CoreCode &auml;ndern m&uuml;ssen.</li>
</ul>

<h1>Gib die Liebe weiter</h1>
<p>WordPress hat keine multi-Millionen-Dollar Marketing-Kampagne, oder namhafte Sponsoren, aber wir haben etwas viel besseres--Dich! Wenn Dir WordPress also gef&auml;llt, dann erw&auml;ge es doch bitte, einem Freund davon zu erz&auml;hlen, oder jemanden WordPress zu installieren, der ein geringeres Knowhow hat, als Du. Vielleicht kannst Du das auch einem Fachjournalisten erz&auml;hlen, der sich uns dann mal n&auml;her anschauen m&ouml;chte.</p>

<h1>Copyright</h1>
<p>WordPress steht unter der <abbr title="GNU Public License">GPL</abbr>-Lizenz (siehe: <a href="license.txt">license.txt</a>)
<br /><small>Deutsche Bearbeitung: <a href="http://wp-pro.net">Olaf A. Schmitz</a></small></p>
</body>
</html>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      readme.html                                                                                         0000755 0023422 0004734 00000017055 11144365476 013753  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>WordPress &rsaquo; ReadMe</title>
	<link rel="stylesheet" href="wp-admin/css/install.css" type="text/css" />
</head>
<body>
<h2><a href="liesmich.html">&laquo; Deutsche &Uuml;bersetzung dieser Hilfe.</a></h2>
<h1 id="logo" style="text-align: center">
	<img alt="WordPress" src="wp-admin/images/wordpress-logo.png" />
	<br /> Version 2.7.1
</h1>
<p style="text-align: center">Semantic Personal Publishing Platform</p>

<h1>First Things First</h1>
<p>Welcome. WordPress is a very special project to me. Every developer and contributor adds something unique to the mix, and together we create something beautiful that I'm proud to be a part of. Thousands of hours have gone into WordPress, and we're dedicated to making it better every day. Thank you for making it part of your world.</p>
<p style="text-align: right;">&#8212; Matt Mullenweg</p>

<h1>Installation: Famous 5-minute install</h1>
<ol>
	<li>Unzip the package in an empty directory.</li>
	<li>Open up <code>wp-config-sample.php</code> with a text editor like WordPad or similar and fill in your database connection details.</li>
	<li>Save the file as <code>wp-config.php</code></li>
	<li>Upload everything.</li>
	<li>Open <span class="file"><a href="wp-admin/install.php">/wp-admin/install.php</a></span> in your browser. This should setup the tables needed for your blog. If there is an error, double check your <span class="file">wp-config.php</span> file, and try again. If it fails again, please go to the <a href="http://wordpress.org/support/">support forums</a> with as much data as you can gather.</li>
	<li><strong>Note the password given to you.</strong></li>
	<li> The install script should then send you to the <a href="wp-login.php">login page</a>. Sign in with the username <code>admin</code> and the password generated during the installation. You can then click on 'Profile' to change the password.</li>
</ol>

<h1>Upgrading</h1>
<p>Before you upgrade anything, make sure you have backup copies of any files you may have modified such as <code>index.php</code>.</p>
<h2>Upgrading from any previous WordPress to 2.7:</h2>
<ol>
	<li>Delete your old WP files, saving ones you've modified.</li>
	<li>Upload the new files.</li>
	<li>Point your browser to <span class="file"><a href="wp-admin/upgrade.php">/wp-admin/upgrade.php</a>.</span></li>
	<li>You wanted more, perhaps? That's it!</li>
</ol>
<h2>Template Changes</h2>
<p>If you have customized your templates you will probably have to make some changes to them. If you're converting your 1.2 or earlier templates, <a href="http://codex.wordpress.org/Upgrade_1.2_to_1.5">we've created a special guide for you</a>. </p>

<h1>Online Resources</h1>
<p>If you have any questions that aren't addressed in this document, please take advantage of WordPress' numerous online resources:</p>
<dl>
	<dt><a href="http://codex.wordpress.org/">The WordPress Codex </a></dt>
		<dd>The Codex is the encyclopedia of all things WordPress. It is the most comprehensive source of information for WordPress available.</dd>
	<dt><a href="http://wordpress.org/development/">The Development Blog</a></dt>
		<dd>This is where you'll find the latest updates and news related to WordPress. Bookmark and check often.</dd>
	<dt><a href="http://planet.wordpress.org/">WordPress Planet </a></dt>
		<dd>The WordPress Planet is a news aggregator that brings together posts from WordPress blogs around the web.</dd>
	<dt><a href="http://wordpress.org/support/">WordPress Support Forums</a></dt>
		<dd>If you've looked everywhere and still can't find an answer, the support forums are very active and have a large community ready to help. To help them help you be sure to use a descriptive thread title and describe your question in as much detail as possible.</dd>
	<dt><a href="http://codex.wordpress.org/IRC">WordPress IRC Channel</a></dt>
		<dd>Finally, there is an online chat channel that is used for discussion among people who use WordPress and occasionally support topics. The above wiki page should point you in the right direction. (<a href="irc://irc.freenode.net/wordpress">irc.freenode.net #wordpress</a>)</dd>
</dl>

<h1>System Recommendations</h1>
<ul>
	<li>PHP version <strong>4.3</strong> or higher.</li>
	<li>MySQL version <strong>4.0</strong> or higher.</li>
	<li>... and a link to <a href="http://wordpress.org/">http://wordpress.org</a> on your site.</li>
</ul>
<p>WordPress is the official continuation of <a href="http://cafelog.com/">b2/caf&eacute;log</a>, which came from Michel V. The work has been continued by the <a href="http://wordpress.org/about/">WordPress developers</a>. If you would like to support WordPress, please consider <a href="http://wordpress.org/donate/">donating</a>.</p>

<h1>Upgrading from another system</h1>
<p>WordPress can <a href="http://codex.wordpress.org/Importing_Content">import from a number of systems</a>. First you need to get WordPress installed and working as described above.</p>

<h1>XML-RPC and Atom Interface</h1>
<p>You can now post to your WordPress blog with tools like <a href="http://windowslivewriter.spaces.live.com/">Windows Live Writer</a>, <a href="http://ecto.kung-foo.tv/">Ecto</a>, <a href="http://bloggar.com/">Bloggar</a>, <a href="http://radio.userland.com">Radio Userland</a> (which means you can use Radio's email-to-blog feature), <a href="http://www.newzcrawler.com/">NewzCrawler</a>, and other tools that support the Blogging APIs! :) You can read more about <a href="http://codex.wordpress.org/XML-RPC_Support">XML-RPC support on the Codex</a>.</p>

<h1>Post via Email</h1>
<p>You can post from an email client! To set this up go to your &quot;Writing&quot; options screen and fill in the connection details for your secret POP3 account. Then you need to set up <code>wp-mail.php</code> to execute periodically to check the mailbox for new posts. You can do it with Cron-jobs, or if your host doesn't support it you can look into the various website-monitoring services, and make them check your <code>wp-mail.php</code> URL.</p>
<p>Posting is easy: Any email sent to the address you specify will be posted, with the subject as the title. It is best to keep the address discrete. The script will <em>delete</em> emails that are successfully posted.</p>

<h1>User Roles</h1>
<p>We've eliminated user levels in order to make way for the much more flexible roles system introduced in 2.0. You can <a href="http://codex.wordpress.org/Roles_and_Capabilities">read more about Roles and Capabilities on the Codex</a>.</p>

<h1> Final notes</h1>
<ul>
	<li>If you have any suggestions, ideas, comments, or if you (gasp!) found a bug, join us in the <a href="http://wordpress.org/support/">Support Forums</a>.</li>
	<li>WordPress now has a robust plugin API that makes extending the code easy. If you are a developer interested in utilizing this see the <a href="http://codex.wordpress.org/Plugin_API">plugin documentation in the Codex</a>. In most all cases you shouldn't modify any of the core code.</li>
</ul>

<h1>Share the Love</h1>
<p>WordPress has no multi-million dollar marketing campaign or celebrity sponsors, but we do have something even better&#8212;you. If you enjoy WordPress please consider telling a friend, setting it up for someone less knowledgable than yourself, or writing the author of a media article that overlooks us.</p>

<h1>Copyright</h1>
<p>WordPress is released under the <abbr title="GNU Public License">GPL</abbr> (see <a href="license.txt">license.txt</a>).</p>

</body>
</html>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   sitemap.xml                                                                                         0000644 0023422 0004733 00000014664 10765770325 014217  0                                                                                                    ustar   tuttibambide                    psaserv                                                                                                                                                                                                                <?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="http://tuttibambi.de/wp-content/plugins/google-sitemap-generator/sitemap.xsl"?><!-- generator="wordpress/2.3.3" --><!-- sitemap-generator-url="http://www.arnebrachhold.de" sitemap-generator-version="3.0.2.1" --><!-- generated-on="12. March 2008 16:03" --><!-- Debug: Total comment count: 10 --><urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">	<url>
		<loc>http://tuttibambi.de/</loc>
		<lastmod>2008-03-12T15:03:49+00:00</lastmod>
		<changefreq>daily</changefreq>
		<priority>1.0</priority>
	</url>
<!-- Debug: Start Postings --><!-- Debug: Priority report of postID 44: Comments: 0 of 10 = 0 points -->	<url>
		<loc>http://tuttibambi.de/44-makita-144-volt-oder-18-volt</loc>
		<lastmod>2008-03-12T15:03:49+00:00</lastmod>
		<changefreq>monthly</changefreq>
		<priority>0.2</priority>
	</url>
	<url>
		<loc>http://tuttibambi.de/datenschutz</loc>
		<lastmod>2008-03-12T11:33:56+00:00</lastmod>
		<changefreq>weekly</changefreq>
		<priority>0.6</priority>
	</url>
<!-- Debug: Priority report of postID 42: Comments: 0 of 10 = 0 points -->	<url>
		<loc>http://tuttibambi.de/42-angrillen-mit-karcher-schubumkehr</loc>
		<lastmod>2008-03-08T19:12:13+00:00</lastmod>
		<changefreq>monthly</changefreq>
		<priority>0.2</priority>
	</url>
<!-- Debug: Priority report of postID 40: Comments: 0 of 10 = 0 points -->	<url>
		<loc>http://tuttibambi.de/40-bosch-akkuschrauber-144</loc>
		<lastmod>2008-03-01T20:56:21+00:00</lastmod>
		<changefreq>monthly</changefreq>
		<priority>0.2</priority>
	</url>
<!-- Debug: Priority report of postID 39: Comments: 0 of 10 = 0 points -->	<url>
		<loc>http://tuttibambi.de/39-preissenkung-fur-karcher-a-2604</loc>
		<lastmod>2008-02-29T13:28:07+00:00</lastmod>
		<changefreq>monthly</changefreq>
		<priority>0.2</priority>
	</url>
<!-- Debug: Priority report of postID 34: Comments: 3 of 10 = 0.3 points -->	<url>
		<loc>http://tuttibambi.de/34-karcher-a-2604-nass-trockensauger-saugen-wie-ein-profi</loc>
		<lastmod>2008-02-28T08:40:52+00:00</lastmod>
		<changefreq>monthly</changefreq>
		<priority>0.3</priority>
	</url>
<!-- Debug: Priority report of postID 30: Comments: 0 of 10 = 0 points -->	<url>
		<loc>http://tuttibambi.de/30-die-mannerbibel</loc>
		<lastmod>2008-02-23T21:42:41+00:00</lastmod>
		<changefreq>monthly</changefreq>
		<priority>0.2</priority>
	</url>
<!-- Debug: Priority report of postID 25: Comments: 1 of 10 = 0.1 points -->	<url>
		<loc>http://tuttibambi.de/25-holzunterstand-selbst-bauen</loc>
		<lastmod>2008-02-23T21:21:50+00:00</lastmod>
		<changefreq>monthly</changefreq>
		<priority>0.2</priority>
	</url>
<!-- Debug: Priority report of postID 24: Comments: 0 of 10 = 0 points -->	<url>
		<loc>http://tuttibambi.de/24-sageketten-online-bestellen</loc>
		<lastmod>2008-02-19T21:50:04+00:00</lastmod>
		<changefreq>monthly</changefreq>
		<priority>0.2</priority>
	</url>
<!-- Debug: Priority report of postID 19: Comments: 4 of 10 = 0.4 points -->	<url>
		<loc>http://tuttibambi.de/19-stihl-ms-170-erfahrungsbericht</loc>
		<lastmod>2008-02-16T19:04:51+00:00</lastmod>
		<changefreq>monthly</changefreq>
		<priority>0.4</priority>
	</url>
<!-- Debug: Priority report of postID 18: Comments: 0 of 10 = 0 points -->	<url>
		<loc>http://tuttibambi.de/18-schnittschutzhose-und-sicherheitsstiefel-von-plus</loc>
		<lastmod>2008-02-15T11:49:27+00:00</lastmod>
		<changefreq>monthly</changefreq>
		<priority>0.2</priority>
	</url>
<!-- Debug: Priority report of postID 16: Comments: 0 of 10 = 0 points -->	<url>
		<loc>http://tuttibambi.de/16-grillen-ist-mannersache</loc>
		<lastmod>2008-02-10T13:19:23+00:00</lastmod>
		<changefreq>monthly</changefreq>
		<priority>0.2</priority>
	</url>
<!-- Debug: Priority report of postID 14: Comments: 0 of 10 = 0 points -->	<url>
		<loc>http://tuttibambi.de/14-der-elektro-hacksler-fur-das-kleinzeug</loc>
		<lastmod>2008-02-10T13:13:42+00:00</lastmod>
		<changefreq>monthly</changefreq>
		<priority>0.2</priority>
	</url>
<!-- Debug: Priority report of postID 12: Comments: 0 of 10 = 0 points -->	<url>
		<loc>http://tuttibambi.de/12-brennholz-mit-dem-stihl-spalthammer</loc>
		<lastmod>2008-02-07T20:30:45+00:00</lastmod>
		<changefreq>monthly</changefreq>
		<priority>0.2</priority>
	</url>
<!-- Debug: Priority report of postID 11: Comments: 0 of 10 = 0 points -->	<url>
		<loc>http://tuttibambi.de/11-bosch-dominiert-heimwerker-top-10</loc>
		<lastmod>2008-02-06T11:07:31+00:00</lastmod>
		<changefreq>monthly</changefreq>
		<priority>0.2</priority>
	</url>
<!-- Debug: Priority report of postID 10: Comments: 0 of 10 = 0 points -->	<url>
		<loc>http://tuttibambi.de/10-was-haben-kettensagen-und-fusball-gemeinsam</loc>
		<lastmod>2008-02-06T10:06:23+00:00</lastmod>
		<changefreq>monthly</changefreq>
		<priority>0.2</priority>
	</url>
	<url>
		<loc>http://tuttibambi.de/eine-seite</loc>
		<lastmod>2008-02-05T19:49:12+00:00</lastmod>
		<changefreq>weekly</changefreq>
		<priority>0.6</priority>
	</url>
<!-- Debug: Priority report of postID 8: Comments: 0 of 10 = 0 points -->	<url>
		<loc>http://tuttibambi.de/8-makita-18v-li-ion-ein-traum-von-einem-akkuschrauber</loc>
		<lastmod>2008-02-05T19:36:24+00:00</lastmod>
		<changefreq>monthly</changefreq>
		<priority>0.2</priority>
	</url>
<!-- Debug: Priority report of postID 6: Comments: 0 of 10 = 0 points -->	<url>
		<loc>http://tuttibambi.de/6-nichts-geht-uber-einen-hilti-bohrhammer</loc>
		<lastmod>2008-02-04T13:03:13+00:00</lastmod>
		<changefreq>monthly</changefreq>
		<priority>0.2</priority>
	</url>
<!-- Debug: Priority report of postID 4: Comments: 2 of 10 = 0.2 points -->	<url>
		<loc>http://tuttibambi.de/4-ms-181-leichte-kettensage-von-stihl</loc>
		<lastmod>2008-02-03T16:13:52+00:00</lastmod>
		<changefreq>monthly</changefreq>
		<priority>0.2</priority>
	</url>
<!-- Debug: Priority report of postID 1: Comments: 0 of 10 = 0 points -->	<url>
		<loc>http://tuttibambi.de/1-hallo-welt</loc>
		<lastmod>2008-02-03T13:21:13+00:00</lastmod>
		<changefreq>monthly</changefreq>
		<priority>0.2</priority>
	</url>
	<url>
		<loc>http://tuttibambi.de/uber-mich</loc>
		<lastmod>2008-02-03T13:17:43+00:00</lastmod>
		<changefreq>weekly</changefreq>
		<priority>0.6</priority>
	</url>
<!-- Debug: End Postings --><!-- Debug: Start Custom Pages --><!-- Debug: End Custom Pages --><!-- Debug: Start additional URLs --><!-- Debug: End additional URLs --></urlset>                                                                            sitemap.xml.gz                                                                                      0000644 0023422 0004733 00000002563 10765770325 014631  0                                                                                                    ustar   tuttibambide                    psaserv                                                                                                                                                                                                                      YM8=,U	4D4sٕVZ;Wbج4ށiq)z~L>W*IozOzsSH}	$p>kqNҊM~ű9r/DYh/ת^J1K%I/*rols[7ozcŬ^DP[g"|^FU/=IY(ˈ20#|y̢\EsSUp"J18"eN>t]85ۼD Q\1n3ݲ\3vkLc<(!'{Woz5N?\]MOc[|ei@H dݐ0|^r+\I|p%X[iS$$p5zs[<퉵{)bmpYDk(M6.HIok#ofzi
_Iρ;<BXGU6PzFݍ\c{4Kl0<͍@=LgKX7	cR)VA0cV ge49kL0H7`.jUuț-#ȅыB; V&ЫZ/aQ=%8!9	6$c\_'ZԲ~25K4w5
a)@H虅<Eh4#,Eưc^>nvLBW\e.TғYʲ;w
=}= Ѕ=#B׉ 'T<ŀGkT=',=+zTRȅ"0q QzQX@YRA^vK*갊y[BJl@n7]bjJF8u !Tb!BMUp31e
6HDy=8Ca$V;tJ+R]hn$
)|r
/Qp+Q˳`SA!}r+ᅨvj\c~҉3 bUOStSI-Qm]!MY]ц@5B5}71Y7Es2
nuQ+gOǫvXb^"3, -jGPA鹽-v7p?݁]M౻ -IlI0uM!`ҷtT^4ڥ H2'hhG"4`7li,f?D-wR6Bgkƃ~x50eA^g9@s)ySEXK~9)OB{_NrlH8?   Q>"                                                                                                                                               wp-admin/                                                                                           0000755 0023422 0004734 00000000000 11154152677 013327  5                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 wp-admin/admin-ajax.php                                                                             0000755 0023422 0004734 00000073033 11142137730 016050  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress AJAX Process Execution.
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * Executing AJAX process.
 *
 * @since unknown
 */
define('DOING_AJAX', true);
define('WP_ADMIN', true);

require_once('../wp-load.php');
require_once('includes/admin.php');

if ( ! is_user_logged_in() ) {

	if ( $_POST['action'] == 'autosave' ) {
		$id = isset($_POST['post_ID'])? (int) $_POST['post_ID'] : 0;

		if ( ! $id )
			die('-1');

		$message = sprintf( __('<strong>ALERT: You are logged out!</strong> Could not save draft. <a href="%s" target="blank">Please log in again.</a>'), wp_login_url() );
			$x = new WP_Ajax_Response( array(
				'what' => 'autosave',
				'id' => $id,
				'data' => $message
			) );
			$x->send();
	}

	die('-1');
}

if ( isset( $_GET['action'] ) ) :
switch ( $action = $_GET['action'] ) :
case 'ajax-tag-search' :
	if ( !current_user_can( 'manage_categories' ) )
		die('-1');

	$s = $_GET['q']; // is this slashed already?

	if ( false !== strpos( $s, ',' ) ) {
		$s = explode( ',', $s );
		$s = $s[count( $s ) - 1];
	}
	$s = trim( $s );
	if ( strlen( $s ) < 2 )
		die; // require 2 chars for matching
	$results = $wpdb->get_col( "SELECT t.name FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = 'post_tag' AND t.name LIKE ('%". $s . "%')" );
	echo join( $results, "\n" );
	die;
	break;
default :
	do_action( 'wp_ajax_' . $_GET['action'] );
	die('0');
	break;
endswitch;
endif;

$id = isset($_POST['id'])? (int) $_POST['id'] : 0;
switch ( $action = $_POST['action'] ) :
case 'delete-comment' :
	check_ajax_referer( "delete-comment_$id" );
	if ( !$comment = get_comment( $id ) )
		die('1');
	if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
		die('-1');

	if ( isset($_POST['spam']) && 1 == $_POST['spam'] ) {
		if ( 'spam' == wp_get_comment_status( $comment->comment_ID ) )
			die('1');
		$r = wp_set_comment_status( $comment->comment_ID, 'spam' );
	} else {
		$r = wp_delete_comment( $comment->comment_ID );
	}

	die( $r ? '1' : '0' );
	break;
case 'delete-cat' :
	check_ajax_referer( "delete-category_$id" );
	if ( !current_user_can( 'manage_categories' ) )
		die('-1');

	$cat = get_category( $id );
	if ( !$cat || is_wp_error( $cat ) )
		die('1');

	if ( wp_delete_category( $id ) )
		die('1');
	else
		die('0');
	break;
case 'delete-tag' :
	check_ajax_referer( "delete-tag_$id" );
	if ( !current_user_can( 'manage_categories' ) )
		die('-1');

	$tag = get_term( $id, 'post_tag' );
	if ( !$tag || is_wp_error( $tag ) )
		die('1');

	if ( wp_delete_term($id, 'post_tag'))
		die('1');
	else
		die('0');
	break;
case 'delete-link-cat' :
	check_ajax_referer( "delete-link-category_$id" );
	if ( !current_user_can( 'manage_categories' ) )
		die('-1');

	$cat = get_term( $id, 'link_category' );
	if ( !$cat || is_wp_error( $cat ) )
		die('1');

	$cat_name = get_term_field('name', $id, 'link_category');

	// Don't delete the default cats.
	if ( $id == get_option('default_link_category') ) {
		$x = new WP_AJAX_Response( array(
			'what' => 'link-cat',
			'id' => $id,
			'data' => new WP_Error( 'default-link-cat', sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name) )
		) );
		$x->send();
	}

	$r = wp_delete_term($id, 'link_category');
	if ( !$r )
		die('0');
	if ( is_wp_error($r) ) {
		$x = new WP_AJAX_Response( array(
			'what' => 'link-cat',
			'id' => $id,
			'data' => $r
		) );
		$x->send();
	}
	die('1');
	break;
case 'delete-link' :
	check_ajax_referer( "delete-bookmark_$id" );
	if ( !current_user_can( 'manage_links' ) )
		die('-1');

	$link = get_bookmark( $id );
	if ( !$link || is_wp_error( $link ) )
		die('1');

	if ( wp_delete_link( $id ) )
		die('1');
	else
		die('0');
	break;
case 'delete-meta' :
	check_ajax_referer( "delete-meta_$id" );
	if ( !$meta = get_post_meta_by_id( $id ) )
		die('1');

	if ( !current_user_can( 'edit_post', $meta->post_id ) )
		die('-1');
	if ( delete_meta( $meta->meta_id ) )
		die('1');
	die('0');
	break;
case 'delete-post' :
	check_ajax_referer( "{$action}_$id" );
	if ( !current_user_can( 'delete_post', $id ) )
		die('-1');

	if ( !get_post( $id ) )
		die('1');

	if ( wp_delete_post( $id ) )
		die('1');
	else
		die('0');
	break;
case 'delete-page' :
	check_ajax_referer( "{$action}_$id" );
	if ( !current_user_can( 'delete_page', $id ) )
		die('-1');

	if ( !get_page( $id ) )
		die('1');

	if ( wp_delete_post( $id ) )
		die('1');
	else
		die('0');
	break;
case 'dim-comment' :
	if ( !$comment = get_comment( $id ) )
		die('0');

	if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
		die('-1');
	if ( !current_user_can( 'moderate_comments' ) )
		die('-1');

	$current = wp_get_comment_status( $comment->comment_ID );
	if ( $_POST['new'] == $current )
		die('1');

	if ( in_array( $current, array( 'unapproved', 'spam' ) ) ) {
		check_ajax_referer( "approve-comment_$id" );
		if ( wp_set_comment_status( $comment->comment_ID, 'approve' ) )
			die('1');
	} else {
		check_ajax_referer( "unapprove-comment_$id" );
		if ( wp_set_comment_status( $comment->comment_ID, 'hold' ) )
			die('1');
	}
	die('0');
	break;
case 'add-category' : // On the Fly
	check_ajax_referer( $action );
	if ( !current_user_can( 'manage_categories' ) )
		die('-1');
	$names = explode(',', $_POST['newcat']);
	if ( 0 > $parent = (int) $_POST['newcat_parent'] )
		$parent = 0;
	$post_category = isset($_POST['post_category'])? (array) $_POST['post_category'] : array();
	$checked_categories = array_map( 'absint', (array) $post_category );
	$popular_ids = isset( $_POST['popular_ids'] ) ?
			array_map( 'absint', explode( ',', $_POST['popular_ids'] ) ) :
			false;

	$x = new WP_Ajax_Response();
	foreach ( $names as $cat_name ) {
		$cat_name = trim($cat_name);
		$category_nicename = sanitize_title($cat_name);
		if ( '' === $category_nicename )
			continue;
		$cat_id = wp_create_category( $cat_name, $parent );
		$checked_categories[] = $cat_id;
		if ( $parent ) // Do these all at once in a second
			continue;
		$category = get_category( $cat_id );
		ob_start();
			wp_category_checklist( 0, $cat_id, $checked_categories, $popular_ids );
		$data = ob_get_contents();
		ob_end_clean();
		$x->add( array(
			'what' => 'category',
			'id' => $cat_id,
			'data' => $data,
			'position' => -1
		) );
	}
	if ( $parent ) { // Foncy - replace the parent and all its children
		$parent = get_category( $parent );
		ob_start();
			dropdown_categories( 0, $parent );
		$data = ob_get_contents();
		ob_end_clean();
		$x->add( array(
			'what' => 'category',
			'id' => $parent->term_id,
			'old_id' => $parent->term_id,
			'data' => $data,
			'position' => -1
		) );

	}
	$x->send();
	break;
case 'add-link-category' : // On the Fly
	check_ajax_referer( $action );
	if ( !current_user_can( 'manage_categories' ) )
		die('-1');
	$names = explode(',', $_POST['newcat']);
	$x = new WP_Ajax_Response();
	foreach ( $names as $cat_name ) {
		$cat_name = trim($cat_name);
		$slug = sanitize_title($cat_name);
		if ( '' === $slug )
			continue;
		if ( !$cat_id = is_term( $cat_name, 'link_category' ) ) {
			$cat_id = wp_insert_term( $cat_name, 'link_category' );
		}
		$cat_id = $cat_id['term_id'];
		$cat_name = wp_specialchars(stripslashes($cat_name));
		$x->add( array(
			'what' => 'link-category',
			'id' => $cat_id,
			'data' => "<li id='link-category-$cat_id'><label for='in-link-category-$cat_id' class='selectit'><input value='$cat_id' type='checkbox' checked='checked' name='link_category[]' id='in-link-category-$cat_id'/> $cat_name</label></li>",
			'position' => -1
		) );
	}
	$x->send();
	break;
case 'add-cat' : // From Manage->Categories
	check_ajax_referer( 'add-category' );
	if ( !current_user_can( 'manage_categories' ) )
		die('-1');

	if ( '' === trim($_POST['cat_name']) ) {
		$x = new WP_Ajax_Response( array(
			'what' => 'cat',
			'id' => new WP_Error( 'cat_name', __('You did not enter a category name.') )
		) );
		$x->send();
	}

	if ( category_exists( trim( $_POST['cat_name'] ) ) ) {
		$x = new WP_Ajax_Response( array(
			'what' => 'cat',
			'id' => new WP_Error( 'cat_exists', __('The category you are trying to create already exists.'), array( 'form-field' => 'cat_name' ) ),
		) );
		$x->send();
	}

	$cat = wp_insert_category( $_POST, true );

	if ( is_wp_error($cat) ) {
		$x = new WP_Ajax_Response( array(
			'what' => 'cat',
			'id' => $cat
		) );
		$x->send();
	}

	if ( !$cat || (!$cat = get_category( $cat )) )
		die('0');

	$level = 0;
	$cat_full_name = $cat->name;
	$_cat = $cat;
	while ( $_cat->parent ) {
		$_cat = get_category( $_cat->parent );
		$cat_full_name = $_cat->name . ' &#8212; ' . $cat_full_name;
		$level++;
	}
	$cat_full_name = attribute_escape($cat_full_name);

	$x = new WP_Ajax_Response( array(
		'what' => 'cat',
		'id' => $cat->term_id,
		'position' => -1,
		'data' => _cat_row( $cat, $level, $cat_full_name ),
		'supplemental' => array('name' => $cat_full_name, 'show-link' => sprintf(__( 'Category <a href="#%s">%s</a> added' ), "cat-$cat->term_id", $cat_full_name))
	) );
	$x->send();
	break;
case 'add-link-cat' : // From Blogroll -> Categories
	check_ajax_referer( 'add-link-category' );
	if ( !current_user_can( 'manage_categories' ) )
		die('-1');

	if ( '' === trim($_POST['name']) ) {
		$x = new WP_Ajax_Response( array(
			'what' => 'link-cat',
			'id' => new WP_Error( 'name', __('You did not enter a category name.') )
		) );
		$x->send();
	}

	$r = wp_insert_term($_POST['name'], 'link_category', $_POST );
	if ( is_wp_error( $r ) ) {
		$x = new WP_AJAX_Response( array(
			'what' => 'link-cat',
			'id' => $r
		) );
		$x->send();
	}

	extract($r, EXTR_SKIP);

	if ( !$link_cat = link_cat_row( $term_id ) )
		die('0');

	$x = new WP_Ajax_Response( array(
		'what' => 'link-cat',
		'id' => $term_id,
		'position' => -1,
		'data' => $link_cat
	) );
	$x->send();
	break;
case 'add-tag' : // From Manage->Tags
	check_ajax_referer( 'add-tag' );
	if ( !current_user_can( 'manage_categories' ) )
		die('-1');

	if ( '' === trim($_POST['name']) ) {
		$x = new WP_Ajax_Response( array(
			'what' => 'tag',
			'id' => new WP_Error( 'name', __('You did not enter a tag name.') )
		) );
		$x->send();
	}

	$tag = wp_insert_term($_POST['name'], 'post_tag', $_POST );

	if ( is_wp_error($tag) ) {
		$x = new WP_Ajax_Response( array(
			'what' => 'tag',
			'id' => $tag
		) );
		$x->send();
	}

	if ( !$tag || (!$tag = get_term( $tag['term_id'], 'post_tag' )) )
		die('0');

	$tag_full_name = $tag->name;
	$tag_full_name = attribute_escape($tag_full_name);

	$x = new WP_Ajax_Response( array(
		'what' => 'tag',
		'id' => $tag->term_id,
		'position' => '-1',
		'data' => _tag_row( $tag ),
		'supplemental' => array('name' => $tag_full_name, 'show-link' => sprintf(__( 'Tag <a href="#%s">%s</a> added' ), "tag-$tag->term_id", $tag_full_name))
	) );
	$x->send();
	break;
case 'get-tagcloud' :
	if ( !current_user_can( 'manage_categories' ) )
		die('-1');

	$tags = get_tags( array( 'number' => 45, 'orderby' => 'count', 'order' => 'DESC' ) );

	if ( empty( $tags ) )
		die( __('No tags found!') );

	if ( is_wp_error($tags) )
		die($tags->get_error_message());

	foreach ( $tags as $key => $tag ) {
		$tags[ $key ]->link = '#';
		$tags[ $key ]->id = $tag->term_id;
	}

	$return = wp_generate_tag_cloud( $tags );

	if ( empty($return) )
		die('0');

	echo $return;

	exit;
	break;
case 'add-comment' :
	check_ajax_referer( $action );
	if ( !current_user_can( 'edit_post', $id ) )
		die('-1');
	$search = isset($_POST['s']) ? $_POST['s'] : false;
	$start = isset($_POST['page']) ? intval($_POST['page']) * 25 - 1: 24;
	$status = isset($_POST['comment_status']) ? $_POST['comment_status'] : false;
	$mode = isset($_POST['mode']) ? $_POST['mode'] : 'detail';
	$p = isset($_POST['p']) ? $_POST['p'] : 0;
	$comment_type = isset($_POST['comment_type']) ? $_POST['comment_type'] : '';
	list($comments, $total) = _wp_get_comment_list( $status, $search, $start, 1, $p, $comment_type );

	if ( get_option('show_avatars') )
		add_filter( 'comment_author', 'floated_admin_avatar' );

	if ( !$comments )
		die('1');
	$x = new WP_Ajax_Response();
	foreach ( (array) $comments as $comment ) {
		get_comment( $comment );
		ob_start();
			_wp_comment_row( $comment->comment_ID, $mode, $status, true, true );
			$comment_list_item = ob_get_contents();
		ob_end_clean();
		$x->add( array(
			'what' => 'comment',
			'id' => $comment->comment_ID,
			'data' => $comment_list_item
		) );
	}
	$x->send();
	break;
case 'get-comments' :
	check_ajax_referer( $action );

	$post_ID = (int) $_POST['post_ID'];
	if ( !current_user_can( 'edit_post', $post_ID ) )
		die('-1');

	$start = isset($_POST['start']) ? intval($_POST['start']) : 0;
	$num = isset($_POST['num']) ? intval($_POST['num']) : 10;

	list($comments, $total) = _wp_get_comment_list( false, false, $start, $num, $post_ID );

	if ( !$comments )
		die('1');

	$comment_list_item = '';
	$x = new WP_Ajax_Response();
	foreach ( (array) $comments as $comment ) {
		get_comment( $comment );
		ob_start();
			_wp_comment_row( $comment->comment_ID, 'single', false, false );
			$comment_list_item .= ob_get_contents();
		ob_end_clean();
	}
	$x->add( array(
		'what' => 'comments',
		'data' => $comment_list_item
	) );
	$x->send();
	break;
case 'replyto-comment' :
	check_ajax_referer( $action );

	$comment_post_ID = (int) $_POST['comment_post_ID'];
	if ( !current_user_can( 'edit_post', $comment_post_ID ) )
		die('-1');

	$status = $wpdb->get_var( $wpdb->prepare("SELECT post_status FROM $wpdb->posts WHERE ID = %d", $comment_post_ID) );

	if ( empty($status) )
		die('1');
	elseif ( in_array($status, array('draft', 'pending') ) )
		die( __('Error: you are replying to a comment on a draft post.') );

	$user = wp_get_current_user();
	if ( $user->ID ) {
		$comment_author       = $wpdb->escape($user->display_name);
		$comment_author_email = $wpdb->escape($user->user_email);
		$comment_author_url   = $wpdb->escape($user->user_url);
		$comment_content      = trim($_POST['content']);
		if ( current_user_can('unfiltered_html') ) {
			if ( wp_create_nonce('unfiltered-html-comment_' . $comment_post_ID) != $_POST['_wp_unfiltered_html_comment'] ) {
				kses_remove_filters(); // start with a clean slate
				kses_init_filters(); // set up the filters
			}
		}
	} else {
		die( __('Sorry, you must be logged in to reply to a comment.') );
	}

	if ( '' == $comment_content )
		die( __('Error: please type a comment.') );

	$comment_parent = absint($_POST['comment_ID']);
	$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID');

	$comment_id = wp_new_comment( $commentdata );
	$comment = get_comment($comment_id);
	if ( ! $comment ) die('1');

	$modes = array( 'single', 'detail', 'dashboard' );
	$mode = isset($_POST['mode']) && in_array( $_POST['mode'], $modes ) ? $_POST['mode'] : 'detail';
	$position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1';
	$checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0;

	if ( get_option('show_avatars') && 'single' != $mode )
		add_filter( 'comment_author', 'floated_admin_avatar' );

	$x = new WP_Ajax_Response();

	ob_start();
		if ( 'dashboard' == $mode ) {
			require_once( ABSPATH . 'wp-admin/includes/dashboard.php' );
			_wp_dashboard_recent_comments_row( $comment, false );
		} else {
			_wp_comment_row( $comment->comment_ID, $mode, false, $checkbox );
		}
		$comment_list_item = ob_get_contents();
	ob_end_clean();

	$x->add( array(
		'what' => 'comment',
		'id' => $comment->comment_ID,
		'data' => $comment_list_item,
		'position' => $position
	));

	$x->send();
	break;
case 'edit-comment' :
	check_ajax_referer( 'replyto-comment' );

	$comment_post_ID = (int) $_POST['comment_post_ID'];
	if ( ! current_user_can( 'edit_post', $comment_post_ID ) )
		die('-1');

	if ( '' == $_POST['content'] )
		die( __('Error: please type a comment.') );

	$comment_id = (int) $_POST['comment_ID'];
	$_POST['comment_status'] = $_POST['status'];
	edit_comment();

	$mode = ( isset($_POST['mode']) && 'single' == $_POST['mode'] ) ? 'single' : 'detail';
	$position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1';
	$checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0;

	if ( get_option('show_avatars') && 'single' != $mode )
		add_filter( 'comment_author', 'floated_admin_avatar' );

	$x = new WP_Ajax_Response();

	ob_start();
		_wp_comment_row( $comment_id, $mode, true, $checkbox );
		$comment_list_item = ob_get_contents();
	ob_end_clean();

	$x->add( array(
		'what' => 'edit_comment',
		'id' => $comment->comment_ID,
		'data' => $comment_list_item,
		'position' => $position
	));

	$x->send();
	break;
case 'add-meta' :
	check_ajax_referer( 'add-meta' );
	$c = 0;
	$pid = (int) $_POST['post_id'];
	if ( isset($_POST['metakeyselect']) || isset($_POST['metakeyinput']) ) {
		if ( !current_user_can( 'edit_post', $pid ) )
			die('-1');
		if ( '#NONE#' == $_POST['metakeyselect'] && empty($_POST['metakeyinput']) )
			die('1');
		if ( $pid < 0 ) {
			$now = current_time('timestamp', 1);
			if ( $pid = wp_insert_post( array(
				'post_title' => sprintf('Draft created on %s at %s', date(get_option('date_format'), $now), date(get_option('time_format'), $now))
			) ) ) {
				if ( is_wp_error( $pid ) ) {
					$x = new WP_Ajax_Response( array(
						'what' => 'meta',
						'data' => $pid
					) );
					$x->send();
				}
				$mid = add_meta( $pid );
			} else {
				die('0');
			}
		} else if ( !$mid = add_meta( $pid ) ) {
			die('0');
		}

		$meta = get_post_meta_by_id( $mid );
		$pid = (int) $meta->post_id;
		$meta = get_object_vars( $meta );
		$x = new WP_Ajax_Response( array(
			'what' => 'meta',
			'id' => $mid,
			'data' => _list_meta_row( $meta, $c ),
			'position' => 1,
			'supplemental' => array('postid' => $pid)
		) );
	} else {
		$mid = (int) array_pop(array_keys($_POST['meta']));
		$key = $_POST['meta'][$mid]['key'];
		$value = $_POST['meta'][$mid]['value'];
		if ( !$meta = get_post_meta_by_id( $mid ) )
			die('0'); // if meta doesn't exist
		if ( !current_user_can( 'edit_post', $meta->post_id ) )
			die('-1');
		if ( !$u = update_meta( $mid, $key, $value ) )
			die('1'); // We know meta exists; we also know it's unchanged (or DB error, in which case there are bigger problems).
		$key = stripslashes($key);
		$value = stripslashes($value);
		$x = new WP_Ajax_Response( array(
			'what' => 'meta',
			'id' => $mid, 'old_id' => $mid,
			'data' => _list_meta_row( array(
				'meta_key' => $key,
				'meta_value' => $value,
				'meta_id' => $mid
			), $c ),
			'position' => 0,
			'supplemental' => array('postid' => $meta->post_id)
		) );
	}
	$x->send();
	break;
case 'add-user' :
	check_ajax_referer( $action );
	if ( !current_user_can('create_users') )
		die('-1');
	require_once(ABSPATH . WPINC . '/registration.php');
	if ( !$user_id = add_user() )
		die('0');
	elseif ( is_wp_error( $user_id ) ) {
		$x = new WP_Ajax_Response( array(
			'what' => 'user',
			'id' => $user_id
		) );
		$x->send();
	}
	$user_object = new WP_User( $user_id );

	$x = new WP_Ajax_Response( array(
		'what' => 'user',
		'id' => $user_id,
		'data' => user_row( $user_object, '', $user_object->roles[0] ),
		'supplemental' => array(
			'show-link' => sprintf(__( 'User <a href="#%s">%s</a> added' ), "user-$user_id", $user_object->user_login),
			'role' => $user_object->roles[0]
		)
	) );
	$x->send();
	break;
case 'autosave' : // The name of this action is hardcoded in edit_post()
	define( 'DOING_AUTOSAVE', true );

	$nonce_age = check_ajax_referer( 'autosave', 'autosavenonce' );
	global $current_user;

	$_POST['post_category'] = explode(",", $_POST['catslist']);
	$_POST['tags_input'] = explode(",", $_POST['tags_input']);
	if($_POST['post_type'] == 'page' || empty($_POST['post_category']))
		unset($_POST['post_category']);

	$do_autosave = (bool) $_POST['autosave'];
	$do_lock = true;

	$data = '';
	$message = sprintf( __('Draft Saved at %s.'), date_i18n( __('g:i:s a') ) );

	$supplemental = array();

	$id = $revision_id = 0;
	if($_POST['post_ID'] < 0) {
		$_POST['post_status'] = 'draft';
		$_POST['temp_ID'] = $_POST['post_ID'];
		if ( $do_autosave ) {
			$id = wp_write_post();
			$data = $message;
		}
	} else {
		$post_ID = (int) $_POST['post_ID'];
		$_POST['ID'] = $post_ID;
		$post = get_post($post_ID);

		if ( $last = wp_check_post_lock( $post->ID ) ) {
			$do_autosave = $do_lock = false;

			$last_user = get_userdata( $last );
			$last_user_name = $last_user ? $last_user->display_name : __( 'Someone' );
			$data = new WP_Error( 'locked', sprintf(
				$_POST['post_type'] == 'page' ? __( 'Autosave disabled: %s is currently editing this page.' ) : __( 'Autosave disabled: %s is currently editing this post.' ),
				wp_specialchars( $last_user_name )
			) );

			$supplemental['disable_autosave'] = 'disable';
		}

		if ( 'page' == $post->post_type ) {
			if ( !current_user_can('edit_page', $post_ID) )
				die(__('You are not allowed to edit this page.'));
		} else {
			if ( !current_user_can('edit_post', $post_ID) )
				die(__('You are not allowed to edit this post.'));
		}

		if ( $do_autosave ) {
			// Drafts are just overwritten by autosave
			if ( 'draft' == $post->post_status ) {
				$id = edit_post();
			} else { // Non drafts are not overwritten.  The autosave is stored in a special post revision.
				$revision_id = wp_create_post_autosave( $post->ID );
				if ( is_wp_error($revision_id) )
					$id = $revision_id;
				else
					$id = $post->ID;
			}
			$data = $message;
		} else {
			$id = $post->ID;
		}
	}

	if ( $do_lock && $id && is_numeric($id) )
		wp_set_post_lock( $id );

	if ( $nonce_age == 2 ) {
		$supplemental['replace-autosavenonce'] = wp_create_nonce('autosave');
		$supplemental['replace-getpermalinknonce'] = wp_create_nonce('getpermalink');
		$supplemental['replace-samplepermalinknonce'] = wp_create_nonce('samplepermalink');
		$supplemental['replace-closedpostboxesnonce'] = wp_create_nonce('closedpostboxes');
		if ( $id ) {
			if ( $_POST['post_type'] == 'post' )
				$supplemental['replace-_wpnonce'] = wp_create_nonce('update-post_' . $id);
			elseif ( $_POST['post_type'] == 'page' )
				$supplemental['replace-_wpnonce'] = wp_create_nonce('update-page_' . $id);
		}
	}

	$x = new WP_Ajax_Response( array(
		'what' => 'autosave',
		'id' => $id,
		'data' => $id ? $data : '',
		'supplemental' => $supplemental
	) );
	$x->send();
	break;
case 'autosave-generate-nonces' :
	check_ajax_referer( 'autosave', 'autosavenonce' );
	$ID = (int) $_POST['post_ID'];
	if($_POST['post_type'] == 'post') {
		if(current_user_can('edit_post', $ID))
			die(wp_create_nonce('update-post_' . $ID));
	}
	if($_POST['post_type'] == 'page') {
		if(current_user_can('edit_page', $ID)) {
			die(wp_create_nonce('update-page_' . $ID));
		}
	}
	die('0');
break;
case 'closed-postboxes' :
	check_ajax_referer( 'closedpostboxes', 'closedpostboxesnonce' );
	$closed = isset( $_POST['closed'] )? $_POST['closed'] : '';
	$closed = explode( ',', $_POST['closed'] );
	$hidden = isset( $_POST['hidden'] )? $_POST['hidden'] : '';
	$hidden = explode( ',', $_POST['hidden'] );
	$page = isset( $_POST['page'] )? $_POST['page'] : '';
	if ( !preg_match( '/^[a-z-_]+$/', $page ) ) {
		die(-1);
	}
	$current_user = wp_get_current_user();
	if ( is_array($closed) )
		update_usermeta($current_user->ID, 'closedpostboxes_'.$page, $closed);
	if ( is_array($hidden) )
		update_usermeta($current_user->ID, 'meta-box-hidden_'.$page, $hidden);
break;
case 'hidden-columns' :
	check_ajax_referer( 'hiddencolumns', 'hiddencolumnsnonce' );
	$hidden = isset( $_POST['hidden'] )? $_POST['hidden'] : '';
	$hidden = explode( ',', $_POST['hidden'] );
	$page = isset( $_POST['page'] )? $_POST['page'] : '';
	if ( !preg_match( '/^[a-z-_]+$/', $page ) ) {
		die(-1);
	}
	$current_user = wp_get_current_user();
	if ( is_array($hidden) )
		update_usermeta($current_user->ID, "manage-$page-columns-hidden", $hidden);
break;
case 'get-permalink':
	check_ajax_referer( 'getpermalink', 'getpermalinknonce' );
	$post_id = isset($_POST['post_id'])? intval($_POST['post_id']) : 0;
	die(add_query_arg(array('preview' => 'true'), get_permalink($post_id)));
break;
case 'sample-permalink':
	check_ajax_referer( 'samplepermalink', 'samplepermalinknonce' );
	$post_id = isset($_POST['post_id'])? intval($_POST['post_id']) : 0;
	$title = isset($_POST['new_title'])? $_POST['new_title'] : '';
	$slug = isset($_POST['new_slug'])? $_POST['new_slug'] : '';
	die(get_sample_permalink_html($post_id, $title, $slug));
break;
case 'inline-save':
	check_ajax_referer( 'inlineeditnonce', '_inline_edit' );

	if ( ! isset($_POST['post_ID']) || ! ( $post_ID = (int) $_POST['post_ID'] ) )
		exit;

	if ( 'page' == $_POST['post_type'] ) {
		if ( ! current_user_can( 'edit_page', $post_ID ) )
			die( __('You are not allowed to edit this page.') );
	} else {
		if ( ! current_user_can( 'edit_post', $post_ID ) )
			die( __('You are not allowed to edit this post.') );
	}

	if ( $last = wp_check_post_lock( $post_ID ) ) {
		$last_user = get_userdata( $last );
		$last_user_name = $last_user ? $last_user->display_name : __( 'Someone' );
		printf( $_POST['post_type'] == 'page' ? __( 'Saving is disabled: %s is currently editing this page.' ) : __( 'Saving is disabled: %s is currently editing this post.' ),	wp_specialchars( $last_user_name ) );
		exit;
	}

	$data = &$_POST;
	$post = get_post( $post_ID, ARRAY_A );
	$data['content'] = $post['post_content'];
	$data['excerpt'] = $post['post_excerpt'];

	// rename
	$data['user_ID'] = $GLOBALS['user_ID'];

	if ( isset($data['post_parent']) )
		$data['parent_id'] = $data['post_parent'];

	// status
	if ( isset($data['keep_private']) && 'private' == $data['keep_private'] )
		$data['post_status'] = 'private';
	else
		$data['post_status'] = $data['_status'];

	if ( empty($data['comment_status']) )
		$data['comment_status'] = 'closed';
	if ( empty($data['ping_status']) )
		$data['ping_status'] = 'closed';

	// update the post
	$_POST = $data;
	edit_post();

	$post = array();
	if ( 'page' == $_POST['post_type'] ) {
		$post[] = get_post($_POST['post_ID']);
		page_rows($post);
	} elseif ( 'post' == $_POST['post_type'] ) {
		$mode = $_POST['post_view'];
		$post[] = get_post($_POST['post_ID']);
		post_rows($post);
	}

	exit;
	break;
case 'inline-save-tax':
	check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' );

	if ( ! current_user_can('manage_categories') )
		die( __('Cheatin&#8217; uh?') );

	if ( ! isset($_POST['tax_ID']) || ! ( $id = (int) $_POST['tax_ID'] ) )
		die(-1);

	switch ($_POST['tax_type']) {
		case 'cat' :
			$data = array();
			$data['cat_ID'] = $id;
			$data['cat_name'] = $_POST['name'];
			$data['category_nicename'] = $_POST['slug'];
			if ( isset($_POST['parent']) && (int) $_POST['parent'] > 0 )
				$data['category_parent'] = $_POST['parent'];

			$cat = get_category($id, ARRAY_A);
			$data['category_description'] = $cat['category_description'];

			$updated = wp_update_category($data);

			if ( $updated && !is_wp_error($updated) )
				echo _cat_row( $updated, 0 );
			else
				die( __('Category not updated.') );

			break;
		case 'link-cat' :
			$updated = wp_update_term($id, 'link_category', $_POST);

			if ( $updated && !is_wp_error($updated) )
				echo link_cat_row($updated['term_id']);
			else
				die( __('Category not updated.') );

			break;
		case 'tag' :
			$updated = wp_update_term($id, 'post_tag', $_POST);
			if ( $updated && !is_wp_error($updated) ) {
				$tag = get_term( $updated['term_id'], 'post_tag' );
				if ( !$tag || is_wp_error( $tag ) )
					die( __('Tag not updated.') );

				echo _tag_row($tag);
			} else {
				die( __('Tag not updated.') );
			}

			break;
	}

	exit;
	break;
case 'meta-box-order':
	check_ajax_referer( 'meta-box-order' );
	update_user_option( $GLOBALS['current_user']->ID, "meta-box-order_$_POST[page]", $_POST['order'] );
	die('1');
	break;
case 'find_posts':
	check_ajax_referer( 'find-posts' );

	if ( empty($_POST['ps']) )
		exit;

	$what = isset($_POST['pages']) ? 'page' : 'post';
	$s = stripslashes($_POST['ps']);
	preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches);
	$search_terms = array_map(create_function('$a', 'return trim($a, "\\"\'\\n\\r ");'), $matches[0]);

	$searchand = $search = '';
	foreach( (array) $search_terms as $term) {
		$term = addslashes_gpc($term);
		$search .= "{$searchand}(($wpdb->posts.post_title LIKE '%{$term}%') OR ($wpdb->posts.post_content LIKE '%{$term}%'))";
		$searchand = ' AND ';
	}
	$term = $wpdb->escape($s);
	if ( count($search_terms) > 1 && $search_terms[0] != $s )
		$search .= " OR ($wpdb->posts.post_title LIKE '%{$term}%') OR ($wpdb->posts.post_content LIKE '%{$term}%')";

	$posts = $wpdb->get_results( "SELECT ID, post_title, post_status, post_date FROM $wpdb->posts WHERE post_type = '$what' AND $search ORDER BY post_date_gmt DESC LIMIT 50" );

	if ( ! $posts )
		exit( __('No posts found.') );

	$html = '<table class="widefat"><thead><tr><th class="found-radio"><br /></th><th>'.__('Title').'</th><th>'.__('Time').'</th><th>'.__('Status').'</th></tr></thead><tbody>';
	foreach ( $posts as $post ) {

		switch ( $post->post_status ) {
			case 'publish' :
			case 'private' :
				$stat = __('Published');
				break;
			case 'future' :
				$stat = __('Scheduled');
				break;
			case 'pending' :
				$stat = __('Pending Review');
				break;
			case 'draft' :
				$stat = __('Unpublished');
				break;
		}

		if ( '0000-00-00 00:00:00' == $post->post_date ) {
			$time = '';
		} else {
			$time = mysql2date(__('Y/m/d'), $post->post_date);
		}

		$html .= '<tr class="found-posts"><td class="found-radio"><input type="radio" id="found-'.$post->ID.'" name="found_post_id" value="'.$post->ID.'"></td>';
		$html .= '<td><label for="found-'.$post->ID.'">'.wp_specialchars($post->post_title, true).'</label></td><td>'.wp_specialchars($time, true).'</td><td>'.wp_specialchars($stat, true).'</td></tr>'."\n\n";
	}
	$html .= '</tbody></table>';

	$x = new WP_Ajax_Response();
	$x->add( array(
		'what' => $what,
		'data' => $html
	));
	$x->send();

	break;
default :
	do_action( 'wp_ajax_' . $_POST['action'] );
	die('0');
	break;
endswitch;
?>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     wp-admin/admin-footer.php                                                                           0000755 0023422 0004734 00000001740 11114262462 016417  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress Administration Template Footer
 *
 * @package WordPress
 * @subpackage Administration
 */
?>

<div class="clear"></div></div><!-- wpbody-content -->
<div class="clear"></div></div><!-- wpbody -->
<div class="clear"></div></div><!-- wpcontent -->
</div><!-- wpwrap -->

<div id="footer">
<p id="footer-left" class="alignleft"><?php
do_action( 'in_admin_footer' );
$upgrade = apply_filters( 'update_footer', '' );
echo '<span id="footer-thankyou">' . __('Thank you for creating with <a href="http://wordpress.org/">WordPress</a>.').'</span> | '.__('<a href="http://codex.wordpress.org/">Documentation</a>').' | '.__('<a href="http://wordpress.org/support/forum/4">Feedback</a>'); ?>
</p>
<?php // if ( $is_IE ) browse_happy(); ?>
<p id="footer-upgrade" class="alignright"><?php echo $upgrade; ?></p>
<div class="clear"></div>
</div>
<?php do_action('admin_footer', ''); ?>
<script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>
</body>
</html>                                wp-admin/admin-functions.php                                                                        0000755 0023422 0004734 00000000623 11050127210 017116  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Administration Functions
 *
 * This file is deprecated, use 'wp-admin/includes/admin.php' instead.
 *
 * @deprecated 2.5
 * @package WordPress
 * @subpackage Administration
 */

_deprecated_file( basename(__FILE__), '2.5', 'wp-admin/includes/admin.php' );

/** WordPress Administration API: Includes all Administration functions. */
require_once(ABSPATH . 'wp-admin/includes/admin.php');
?>                                                                                                             wp-admin/admin-header.php                                                                           0000755 0023422 0004734 00000010003 11120002330 016320  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress Administration Template Header
 *
 * @package WordPress
 * @subpackage Administration
 */

@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
if (!isset($_GET["page"])) require_once('admin.php');

get_admin_page_title();
$title = wp_specialchars( strip_tags( $title ) );
wp_user_settings();
?>
<!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" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
<head>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
<title><?php bloginfo('name') ?> &rsaquo; <?php echo $title; ?> &#8212; WordPress</title>
<?php

wp_admin_css( 'css/global' );
wp_admin_css();
wp_admin_css( 'css/colors' );
wp_admin_css( 'css/ie' );

?>
<script type="text/javascript">
//<![CDATA[
addLoadEvent = function(func) {if (typeof jQuery != "undefined") jQuery(document).ready(func); else if (typeof wpOnload!='function'){wpOnload=func;} else {var oldonload=wpOnload; wpOnload=function(){oldonload();func();}}};

function convertEntities(o) {
	var c = function(s) {
		if (/&[^;]+;/.test(s)) {
			var e = document.createElement("div");
			e.innerHTML = s;
			return !e.firstChild ? s : e.firstChild.nodeValue;
		}
		return s;
	}

	if ( typeof o === 'string' )
		return c(o);
	else if ( typeof o === 'object' )
		for (var v in o) {
			if ( typeof o[v] === 'string' )
				o[v] = c(o[v]);
		}
	return o;
};
//]]>
</script>
<?php

if ( in_array( $pagenow, array('post.php', 'post-new.php', 'page.php', 'page-new.php') ) ) {
	add_action( 'admin_head', 'wp_tiny_mce' );
}

$hook_suffix = '';
if ( isset($page_hook) )
	$hook_suffix = "$page_hook";
else if ( isset($plugin_page) )
	$hook_suffix = "$plugin_page";
else if ( isset($pagenow) )
	$hook_suffix = "$pagenow";

do_action("admin_print_styles-$hook_suffix");
do_action('admin_print_styles');
do_action("admin_print_scripts-$hook_suffix");
do_action('admin_print_scripts');
do_action("admin_head-$hook_suffix");
do_action('admin_head');

if ( $is_iphone ) { ?>
<style type="text/css">.row-actions{visibility:visible;}</style>
<?php } ?>
</head>
<body class="wp-admin <?php echo apply_filters( 'admin_body_class', '' ); ?>">

<div id="wpwrap">
<div id="wpcontent">
<div id="wphead">
<?php
$blog_name = get_bloginfo('name', 'display');
if ( '' == $blog_name ) {
	$blog_name = '&nbsp;';
} else {
	$blog_name_excerpt = wp_html_excerpt($blog_name, 40);
	if ( $blog_name != $blog_name_excerpt )
		$blog_name_excerpt = trim($blog_name_excerpt) . '&hellip;';
	$blog_name = $blog_name_excerpt;
}
$title_class = '';
if ( function_exists('mb_strlen') ) {
	if ( mb_strlen($blog_name, 'UTF-8') > 30 )
		$title_class = 'class="long-title"';
} else {
	if ( strlen($blog_name) > 30 )
		$title_class = 'class="long-title"';
}
?>

<img id="header-logo" src="../wp-includes/images/blank.gif" alt="" width="32" height="32" /> <h1 <?php echo $title_class ?>><a href="<?php echo trailingslashit( get_bloginfo('url') ); ?>" title="<?php _e('Visit site') ?>"><?php echo $blog_name ?> <span>&larr; <?php _e('Visit site') ?></span></a></h1>

<div id="wphead-info">
<div id="user_info">
<p><?php printf(__('Howdy, <a href="%1$s" title="Edit your profile">%2$s</a>'), 'profile.php', $user_identity) ?>
<?php if ( ! $is_opera ) { ?><span class="turbo-nag hidden"> | <a href="tools.php"><?php _e('Turbo') ?></a></span><?php } ?> |
<a href="<?php echo wp_logout_url() ?>" title="<?php _e('Log Out') ?>"><?php _e('Log Out'); ?></a></p>
</div>

<?php favorite_actions(); ?>
</div>
</div>

<?php if ( get_user_setting('mfold') == 'f' ) { ?>
<script type="text/javascript">jQuery('#wpcontent').addClass('folded');</script>
<?php } ?>

<div id="wpbody">
<?php require(ABSPATH . 'wp-admin/menu-header.php'); ?>

<div id="wpbody-content">
<?php
screen_meta($hook_suffix);

do_action('admin_notices');

if ( $parent_file == 'options-general.php' ) {
	require(ABSPATH . 'wp-admin/options-head.php');
}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             wp-admin/admin.php                                                                                  0000755 0023422 0004734 00000007531 11130450234 015121  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress Administration Bootstrap
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * In WordPress Administration Panels
 *
 * @since unknown
 */
define('WP_ADMIN', TRUE);

if ( defined('ABSPATH') )
	require_once(ABSPATH . 'wp-load.php');
else
	require_once('../wp-load.php');

if ( get_option('db_version') != $wp_db_version ) {
	wp_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI']))));
	exit;
}

require_once(ABSPATH . 'wp-admin/includes/admin.php');

auth_redirect();

nocache_headers();

update_category_cache();

$posts_per_page = get_option('posts_per_page');
$what_to_show = get_option('what_to_show');
$date_format = get_option('date_format');
$time_format = get_option('time_format');

wp_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'popuptitle', 'popupurl', 'text', 'trackback', 'pingback'));

wp_admin_css_color('classic', __('Blue'), admin_url("css/colors-classic.css"), array('#073447', '#21759B', '#EAF3FA', '#BBD8E7'));
wp_admin_css_color('fresh', __('Gray'), admin_url("css/colors-fresh.css"), array('#464646', '#6D6D6D', '#F1F1F1', '#DFDFDF'));

wp_enqueue_script( 'common' );
wp_enqueue_script( 'jquery-color' );

$editing = false;

if (isset($_GET['page'])) {
	$plugin_page = stripslashes($_GET['page']);
	$plugin_page = plugin_basename($plugin_page);
}

require(ABSPATH . 'wp-admin/menu.php');

do_action('admin_init');

// Handle plugin admin pages.
if (isset($plugin_page)) {
	if( ! $page_hook = get_plugin_page_hook($plugin_page, $pagenow) ) {
		$page_hook = get_plugin_page_hook($plugin_page, $plugin_page);
		// backwards compatibility for plugins using add_management_page
		if ( empty( $page_hook ) && 'edit.php' == $pagenow && '' != get_plugin_page_hook($plugin_page, 'tools.php') ) {
			// There could be plugin specific params on the URL, so we need the whole query string
			if ( !empty($_SERVER[ 'QUERY_STRING' ]) )
				$query_string = $_SERVER[ 'QUERY_STRING' ];
			else
				$query_string = 'page=' . $plugin_page;
			wp_redirect( 'tools.php?' . $query_string );
			exit;
		}
	}

	if ( $page_hook ) {
		do_action('load-' . $page_hook);
		if (! isset($_GET['noheader']))
			require_once(ABSPATH . 'wp-admin/admin-header.php');

		do_action($page_hook);
	} else {
		if ( validate_file($plugin_page) ) {
			wp_die(__('Invalid plugin page'));
		}

		if (! ( file_exists(WP_PLUGIN_DIR . "/$plugin_page") && is_file(WP_PLUGIN_DIR . "/$plugin_page") ) )
			wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page)));

		do_action('load-' . $plugin_page);

		if (! isset($_GET['noheader']))
			require_once(ABSPATH . 'wp-admin/admin-header.php');

		include(WP_PLUGIN_DIR . "/$plugin_page");
	}

	include(ABSPATH . 'wp-admin/admin-footer.php');

	exit();
} else if (isset($_GET['import'])) {

	$importer = $_GET['import'];

	if ( ! current_user_can('import') )
		wp_die(__('You are not allowed to import.'));

	if ( validate_file($importer) ) {
		wp_die(__('Invalid importer.'));
	}

	// Allow plugins to define importers as well
	if ( !isset($wp_importers) || !isset($wp_importers[$importer]) || ! is_callable($wp_importers[$importer][2]))
	{
		if (! file_exists(ABSPATH . "wp-admin/import/$importer.php"))
		{
			wp_die(__('Cannot load importer.'));
		}
		include(ABSPATH . "wp-admin/import/$importer.php");
	}

	$parent_file = 'tools.php';
	$submenu_file = 'import.php';
	$title = __('Import');

	if (! isset($_GET['noheader']))
		require_once(ABSPATH . 'wp-admin/admin-header.php');

	require_once(ABSPATH . 'wp-admin/includes/upgrade.php');

	define('WP_IMPORTING', true);

	call_user_func($wp_importers[$importer][2]);

	include(ABSPATH . 'wp-admin/admin-footer.php');

	// Make sure rules are flushed
	global $wp_rewrite;
	$wp_rewrite->flush_rules();

	exit();
} else {
	do_action("load-$pagenow");
}

if ( !empty($_REQUEST['action']) )
	do_action('admin_action_' . $_REQUEST['action']);

?>
                                                                                                                                                                       wp-admin/async-upload.php                                                                           0000755 0023422 0004734 00000003265 11107401474 016436  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Accepts file uploads from swfupload or other asynchronous upload methods.
 *
 * @package WordPress
 * @subpackage Administration
 */

if ( defined('ABSPATH') )
	require_once(ABSPATH . 'wp-load.php');
else
	require_once('../wp-load.php');

// Flash often fails to send cookies with the POST or upload, so we need to pass it in GET or POST instead
if ( is_ssl() && empty($_COOKIE[SECURE_AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
	$_COOKIE[SECURE_AUTH_COOKIE] = $_REQUEST['auth_cookie'];
elseif ( empty($_COOKIE[AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
	$_COOKIE[AUTH_COOKIE] = $_REQUEST['auth_cookie'];
unset($current_user);
require_once('admin.php');

header('Content-Type: text/plain; charset=' . get_option('blog_charset'));

if ( !current_user_can('upload_files') )
	wp_die(__('You do not have permission to upload files.'));

// just fetch the detail form for that attachment
if ( isset($_REQUEST['attachment_id']) && ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) {
	if ( 2 == $_REQUEST['fetch'] ) {
		add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
		echo get_media_item($id, array( 'send' => false, 'delete' => false ));
	} else {
		echo get_media_item($id);
	}
	exit;
}

check_admin_referer('media-form');

$id = media_handle_upload('async-upload', $_REQUEST['post_id']);
if (is_wp_error($id)) {
	echo '<div id="media-upload-error">'.wp_specialchars($id->get_error_message()).'</div>';
	exit;
}

if ( $_REQUEST['short'] ) {
	// short form response - attachment ID only
	echo $id;
}
else {
	// long form response - big chunk o html
	$type = $_REQUEST['type'];
	echo apply_filters("async_upload_{$type}", $id);
}

?>                                                                                                                                                                                                                                                                                                                                           wp-admin/bookmarklet.php                                                                            0000755 0023422 0004734 00000004436 10762576512 016366  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
$mode = 'bookmarklet';
require_once('admin.php');

if ( ! current_user_can('edit_posts') )
	wp_die(__('Cheatin&#8217; uh?'));

if ('b' == $a):
?><!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>
<script type="text/javascript">
<!--
window.close()
-->
</script>
</head>
<body></body>
</html>
<?php
exit;
endif;

$post = get_default_post_to_edit();

$popuptitle = wp_specialchars(stripslashes($popuptitle));
$text       = wp_specialchars(stripslashes(urldecode($text)));

$popuptitle = funky_javascript_fix($popuptitle);
$text       = funky_javascript_fix($text);

$post_title = wp_specialchars($_REQUEST['post_title']);
if (!empty($post_title))
	$post->post_title =  stripslashes($post_title);
else
	$post->post_title = $popuptitle;


$content  = wp_specialchars($_REQUEST['content']);
$popupurl = clean_url($_REQUEST['popupurl']);
if ( !empty($content) ) {
	$post->post_content = wp_specialchars( stripslashes($_REQUEST['content']) );
} else {
	$post->post_content = '<a href="'.$popupurl.'">'.$popuptitle.'</a>'."\n$text";
}

/* /big funky fixes */

?><!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><?php bloginfo('name') ?> &rsaquo; Bookmarklet &#8212; WordPress</title>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
<?php
wp_admin_css( 'css/global' );
wp_admin_css();
?>

<style type="text/css">
<!--

#wpbookmarklet textarea,input,select {
	border-width: 1px;
	border-color: #cccccc;
	border-style: solid;
	padding: 2px;
	margin: 1px;
}

#wpbookmarklet .checkbox {
	background-color: #ffffff;
	border-width: 0px;
	padding: 0px;
	margin: 0px;
}

#wpbookmarklet textarea {
	font-family: Verdana, Geneva, Arial, Helvetica;
	font-size: 0.9em;
}

#wpbookmarklet .wrap {
	border: 0px;
}

#wpbookmarklet #postdiv {
	margin-bottom: 0.5em;
}

#wpbookmarklet #titlediv {
	margin-bottom: 1em;
}

-->
</style>
</head>
<body id="wpbookmarklet">
<div id="wphead">
<h1><?php bloginfo('name') ?></h1>
</div>

<?php require('edit-form.php'); ?>

<?php do_action('admin_footer', ''); ?>

</body>
</html>
                                                                                                                                                                                                                                  wp-admin/categories.php                                                                             0000755 0023422 0004734 00000022201 11116051144 016146  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Categories Management Panel
 *
 * @package WordPress
 * @subpackage Administration
 */

/** Load WordPress Bootstrap */
require_once('admin.php');

$title = __('Categories');

wp_reset_vars( array('action', 'cat') );

if ( isset( $_GET['action'] ) && isset($_GET['delete']) && ( 'delete' == $_GET['action'] || 'delete' == $_GET['action2'] ) )
	$action = 'bulk-delete';

switch($action) {

case 'addcat':

	check_admin_referer('add-category');

	if ( !current_user_can('manage_categories') )
		wp_die(__('Cheatin&#8217; uh?'));

	if( wp_insert_category($_POST ) ) {
		wp_redirect('categories.php?message=1#addcat');
	} else {
		wp_redirect('categories.php?message=4#addcat');
	}
	exit;
break;

case 'delete':
	$cat_ID = (int) $_GET['cat_ID'];
	check_admin_referer('delete-category_' .  $cat_ID);

	if ( !current_user_can('manage_categories') )
		wp_die(__('Cheatin&#8217; uh?'));

	$cat_name = get_catname($cat_ID);

	// Don't delete the default cats.
    if ( $cat_ID == get_option('default_category') )
		wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name));

	wp_delete_category($cat_ID);

	wp_redirect('categories.php?message=2');
	exit;

break;

case 'bulk-delete':
	check_admin_referer('bulk-categories');

	if ( !current_user_can('manage_categories') )
		wp_die( __('You are not allowed to delete categories.') );

	foreach ( (array) $_GET['delete'] as $cat_ID ) {
		$cat_name = get_catname($cat_ID);

		// Don't delete the default cats.
		if ( $cat_ID == get_option('default_category') )
			wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name));

		wp_delete_category($cat_ID);
	}

	$sendback = wp_get_referer();

	wp_redirect($sendback);
	exit();

break;
case 'edit':

	$title = __('Edit Category');

	require_once ('admin-header.php');
	$cat_ID = (int) $_GET['cat_ID'];
	$category = get_category_to_edit($cat_ID);
	include('edit-category-form.php');

break;

case 'editedcat':
	$cat_ID = (int) $_POST['cat_ID'];
	check_admin_referer('update-category_' . $cat_ID);

	if ( !current_user_can('manage_categories') )
		wp_die(__('Cheatin&#8217; uh?'));

	$location = 'categories.php';
	if ( $referer = wp_get_original_referer() ) {
		if ( false !== strpos($referer, 'categories.php') )
			$location = $referer;
	}

	if ( wp_update_category($_POST) )
		$location = add_query_arg('message', 3, $location);
	else
		$location = add_query_arg('message', 5, $location);

	wp_redirect($location);

	exit;
break;

default:

if ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
	 wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
	 exit;
}

wp_enqueue_script('admin-categories');
if ( current_user_can('manage_categories') )
	wp_enqueue_script('inline-edit-tax');

require_once ('admin-header.php');

$messages[1] = __('Category added.');
$messages[2] = __('Category deleted.');
$messages[3] = __('Category updated.');
$messages[4] = __('Category not added.');
$messages[5] = __('Category not updated.');
?>

<div class="wrap nosubsub">
<?php screen_icon(); ?>
<h2><?php echo wp_specialchars( $title );
if ( isset($_GET['s']) && $_GET['s'] )
	printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', wp_specialchars( stripslashes($_GET['s']) ) ); ?>
</h2>

<?php
if ( isset($_GET['message']) && ( $msg = (int) $_GET['message'] ) ) : ?>
<div id="message" class="updated fade"><p><?php echo $messages[$msg]; ?></p></div>
<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
endif; ?>

<form class="search-form topmargin" action="" method="get">
<p class="search-box">
	<label class="hidden" for="category-search-input"><?php _e('Search Categories'); ?>:</label>
	<input type="text" class="search-input" id="category-search-input" name="s" value="<?php _admin_search_query(); ?>" />
	<input type="submit" value="<?php _e( 'Search Categories' ); ?>" class="button" />
</p>
</form>
<br class="clear" />

<div id="col-container">

<div id="col-right">
<div class="col-wrap">
<form id="posts-filter" action="" method="get">
<div class="tablenav">

<?php
$pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;
if ( empty($pagenum) )
	$pagenum = 1;
if( ! isset( $catsperpage ) || $catsperpage < 0 )
	$catsperpage = 20;

$page_links = paginate_links( array(
	'base' => add_query_arg( 'pagenum', '%#%' ),
	'format' => '',
	'prev_text' => __('&laquo;'),
	'next_text' => __('&raquo;'),
	'total' => ceil(wp_count_terms('category') / $catsperpage),
	'current' => $pagenum
));

if ( $page_links )
	echo "<div class='tablenav-pages'>$page_links</div>";
?>

<div class="alignleft actions">
<select name="action">
<option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
<option value="delete"><?php _e('Delete'); ?></option>
</select>
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
<?php wp_nonce_field('bulk-categories'); ?>
</div>

<br class="clear" />
</div>

<div class="clear"></div>

<table class="widefat fixed" cellspacing="0">
	<thead>
	<tr>
<?php print_column_headers('categories'); ?>
	</tr>
	</thead>

	<tfoot>
	<tr>
<?php print_column_headers('categories', false); ?>
	</tr>
	</tfoot>

	<tbody id="the-list" class="list:cat">
<?php
cat_rows(0, 0, 0, $pagenum, $catsperpage);
?>
	</tbody>
</table>

<div class="tablenav">
<?php
if ( $page_links )
	echo "<div class='tablenav-pages'>$page_links</div>";
?>

<div class="alignleft actions">
<select name="action2">
<option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
<option value="delete"><?php _e('Delete'); ?></option>
</select>
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
<?php wp_nonce_field('bulk-categories'); ?>
</div>

<br class="clear" />
</div>

</form>

<div class="form-wrap">
<p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the category <strong>%s</strong>.'), apply_filters('the_category', get_catname(get_option('default_category')))) ?></p>
<p><?php printf(__('Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.'), 'admin.php?import=wp-cat2tag') ?></p>
</div>

</div>
</div><!-- /col-right -->

<div id="col-left">
<div class="col-wrap">

<?php if ( current_user_can('manage_categories') ) { ?>
<?php $category = (object) array(); $category->parent = 0; do_action('add_category_form_pre', $category); ?>

<div class="form-wrap">
<h3><?php _e('Add Category'); ?></h3>
<div id="ajax-response"></div>
<form name="addcat" id="addcat" method="post" action="categories.php" class="add:the-list: validate">
<input type="hidden" name="action" value="addcat" />
<?php wp_original_referer_field(true, 'previous'); wp_nonce_field('add-category'); ?>

<div class="form-field form-required">
	<label for="cat_name"><?php _e('Category Name') ?></label>
	<input name="cat_name" id="cat_name" type="text" value="" size="40" aria-required="true" />
    <p><?php _e('The name is used to identify the category almost everywhere, for example under the post or in the category widget.'); ?></p>
</div>

<div class="form-field">
	<label for="category_nicename"><?php _e('Category Slug') ?></label>
	<input name="category_nicename" id="category_nicename" type="text" value="" size="40" />
    <p><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p>
</div>

<div class="form-field">
	<label for="category_parent"><?php _e('Category Parent') ?></label>
	<?php wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'category_parent', 'orderby' => 'name', 'selected' => $category->parent, 'hierarchical' => true, 'show_option_none' => __('None'))); ?>
    <p><?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?></p>
</div>

<div class="form-field">
	<label for="category_description"><?php _e('Description') ?></label>
	<textarea name="category_description" id="category_description" rows="5" cols="40"></textarea>
    <p><?php _e('The description is not prominent by default, however some themes may show it.'); ?></p>
</div>

<p class="submit"><input type="submit" class="button" name="submit" value="<?php _e('Add Category'); ?>" /></p>
<?php do_action('edit_category_form', $category); ?>
</form></div>

<?php } ?>

</div>
</div><!-- /col-left -->

</div><!-- /col-container -->
</div><!-- /wrap -->

<script type="text/javascript">
/* <![CDATA[ */
(function($){
	$(document).ready(function(){
		$('#doaction, #doaction2').click(function(){
			if ( $('select[name^="action"]').val() == 'delete' ) {
				var m = '<?php echo js_escape(__("You are about to delete the selected categories.\n  'Cancel' to stop, 'OK' to delete.")); ?>';
				return showNotice.warn(m);
			}
		});
	});
})(jQuery);
/* ]]> */
</script>

<?php
inline_edit_term_row('categories');

break;
}

include('admin-footer.php');

?>
                                                                                                                                                                                                                                                                                                                                                                                               wp-admin/comment.php                                                                                0000755 0023422 0004734 00000016102 11117531364 015476  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Comment Management Panel
 *
 * @package WordPress
 * @subpackage Administration
 */

/** Load WordPress Bootstrap */
require_once('admin.php');

$parent_file = 'edit-comments.php';
$submenu_file = 'edit-comments.php';

wp_reset_vars( array('action') );

if ( isset( $_POST['deletecomment'] ) )
	$action = 'deletecomment';

/**
 * Display error message at bottom of comments.
 *
 * @param string $msg Error Message. Assumed to contain HTML and be sanitized.
 */
function comment_footer_die( $msg ) {  //
	echo "<div class='wrap'><p>$msg</p></div>";
	include('admin-footer.php');
	die;
}

switch( $action ) {

case 'editcomment' :
	$title = __('Edit Comment');

	wp_enqueue_script('comment');
	require_once('admin-header.php');

	$comment_id = absint( $_GET['c'] );

	if ( !$comment = get_comment( $comment_id ) )
		comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' <a href="%s">'.__('Go back').'</a>!', 'javascript:history.go(-1)') );

	if ( !current_user_can('edit_post', $comment->comment_post_ID) )
		comment_footer_die( __('You are not allowed to edit comments on this post.') );

	$comment = get_comment_to_edit( $comment_id );

	include('edit-form-comment.php');

	break;

case 'cdc' :
case 'mac' :

	require_once('admin-header.php');

	$comment_id = absint( $_GET['c'] );
	$formaction = 'cdc' == $action ? 'deletecomment' : 'approvecomment';
	$nonce_action = 'cdc' == $action ? 'delete-comment_' : 'approve-comment_';
	$nonce_action .= $comment_id;

	if ( !$comment = get_comment_to_edit( $comment_id ) )
		comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit.php') );

	if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
		comment_footer_die( 'cdc' == $action ? __('You are not allowed to delete comments on this post.') : __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
?>
<div class='wrap'>

<div class="narrow">
<?php
if ( 'spam' == $_GET['dt'] ) {
	$caution_msg = __('You are about to mark the following comment as spam:');
	$button = __('Spam Comment');
} elseif ( 'cdc' == $action ) {
	$caution_msg = __('You are about to delete the following comment:');
	$button = __('Delete Comment');
} else {
	$caution_msg = __('You are about to approve the following comment:');
	$button = __('Approve Comment');
}
?>

<p><strong><?php _e('Caution:'); ?></strong> <?php echo $caution_msg; ?></p>

<p><?php _e('Are you sure you want to do that?'); ?></p>

<form action='comment.php' method='get'>

<table width="100%">
<tr>
<td><input type='button' class="button" value='<?php _e('No'); ?>' onclick="self.location='<?php echo admin_url('edit-comments.php'); ?>" /></td>
<td class="textright"><input type='submit' class="button" value='<?php echo $button; ?>' /></td>
</tr>
</table>

<?php wp_nonce_field( $nonce_action ); ?>
<input type='hidden' name='action' value='<?php echo $formaction; ?>' />
<?php if ( 'spam' == $_GET['dt'] ) { ?>
<input type='hidden' name='dt' value='spam' />
<?php } ?>
<input type='hidden' name='p' value='<?php echo $comment->comment_post_ID; ?>' />
<input type='hidden' name='c' value='<?php echo $comment->comment_ID; ?>' />
<input type='hidden' name='noredir' value='1' />
</form>

<table class="form-table" cellpadding="5">
<tr class="alt">
<th scope="row"><?php _e('Author'); ?></th>
<td><?php echo $comment->comment_author; ?></td>
</tr>
<?php if ( $comment->comment_author_email ) { ?>
<tr>
<th scope="row"><?php _e('E-mail'); ?></th>
<td><?php echo $comment->comment_author_email; ?></td>
</tr>
<?php } ?>
<?php if ( $comment->comment_author_url ) { ?>
<tr>
<th scope="row"><?php _e('URL'); ?></th>
<td><a href='<?php echo $comment->comment_author_url; ?>'><?php echo $comment->comment_author_url; ?></a></td>
</tr>
<?php } ?>
<tr>
<th scope="row" valign="top"><?php echo _c('Comment|noun'); ?></th>
<td><?php echo $comment->comment_content; ?></td>
</tr>
</table>

</div>
</div>
<?php
	break;

case 'deletecomment' :
	$comment_id = absint( $_REQUEST['c'] );
	check_admin_referer( 'delete-comment_' . $comment_id );

	if ( isset( $_REQUEST['noredir'] ) )
		$noredir = true;
	else
		$noredir = false;

	if ( !$comment = get_comment( $comment_id ) )
		comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit-comments.php') );

	if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
		comment_footer_die( __('You are not allowed to edit comments on this post.') );

	if ( 'spam' == $_REQUEST['dt'] )
		wp_set_comment_status( $comment->comment_ID, 'spam' );
	else
		wp_delete_comment( $comment->comment_ID );

	if ( '' != wp_get_referer() && false == $noredir && false === strpos(wp_get_referer(), 'comment.php' ) )
		wp_redirect( wp_get_referer() );
	else if ( '' != wp_get_original_referer() && false == $noredir )
		wp_redirect( wp_get_original_referer() );
	else
		wp_redirect( admin_url('edit-comments.php') );

	die;
	break;

case 'unapprovecomment' :
	$comment_id = absint( $_GET['c'] );
	check_admin_referer( 'unapprove-comment_' . $comment_id );

	if ( isset( $_GET['noredir'] ) )
		$noredir = true;
	else
		$noredir = false;

	if ( !$comment = get_comment( $comment_id ) )
		comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit.php') );

	if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
		comment_footer_die( __('You are not allowed to edit comments on this post, so you cannot disapprove this comment.') );

	wp_set_comment_status( $comment->comment_ID, 'hold' );

	if ( '' != wp_get_referer() && false == $noredir )
		wp_redirect( wp_get_referer() );
	else
		wp_redirect( admin_url('edit-comments.php?p=' . absint( $comment->comment_post_ID ) . '#comments') );

	exit();
	break;

case 'approvecomment' :
	$comment_id = absint( $_GET['c'] );
	check_admin_referer( 'approve-comment_' . $comment_id );

	if ( isset( $_GET['noredir'] ) )
		$noredir = true;
	else
		$noredir = false;

	if ( !$comment = get_comment( $comment_id ) )
		comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit.php') );

	if ( !current_user_can('edit_post', $comment->comment_post_ID) )
		comment_footer_die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );

	wp_set_comment_status( $comment->comment_ID, 'approve' );

	if ( '' != wp_get_referer() && false == $noredir )
		wp_redirect( wp_get_referer() );
	else
		wp_redirect( admin_url('edit-comments.php?p=' . absint( $comment->comment_post_ID ) . '#comments') );

	exit();
	break;

case 'editedcomment' :

	$comment_id = absint( $_POST['comment_ID'] );
	$comment_post_id = absint( $_POST['comment_post_id'] );

	check_admin_referer( 'update-comment_' . $comment_id );

	edit_comment();

	$location = ( empty( $_POST['referredby'] ) ? "edit-comments.php?p=$comment_post_id" : $_POST['referredby'] ) . '#comment-' . $comment_id;
	$location = apply_filters( 'comment_edit_redirect', $location, $comment_id );
	wp_redirect( $location );

	exit();
	break;

default:
	wp_die( __('Unknown action.') );
	break;

} // end switch

include('admin-footer.php');

?>                                                                                                                                                                                                                                                                                                                                                                                                                                                              wp-admin/css/                                                                                       0000755 0023422 0004734 00000000000 11154152575 014114  5                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 wp-admin/css/colors-classic-rtl.css                                                                 0000755 0023422 0004734 00000004720 11115571550 020346  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 .bar {
	border-right-color: transparent;
	border-left-color: #99d;
}

.plugins .togl {
	border-right-color: transparent;
	border-left-color: #ccc;
}

.post-com-count {
	background-image: url(../images/bubble_bg-rtl.gif);
}
.tablenav .tablenav-pages a {
	background: #eee url('../images/menu-bits-rtl.gif') repeat-x scroll right -379px;
}
#upload-menu li.current {
	border-right-color: transparent;
	border-left-color: #448abd;
}

#adminmenu .wp-submenu .current a.current {
	background: transparent url(../images/menu-bits-rtl.gif) no-repeat scroll  right -289px;
}

#adminmenu li.wp-menu-separator {
	background: transparent url(../images/menu-arrows.gif) no-repeat scroll right -34px;
}

.folded #adminmenu li.wp-menu-separator {
	background: transparent url(../images/menu-arrows.gif) no-repeat scroll left 5px;
}

#adminmenu li.wp-has-current-submenu .wp-menu-toggle,
#adminmenu li.wp-has-current-submenu:hover .wp-menu-toggle {
	background: transparent url(../images/menu-bits-rtl.gif) repeat-x scroll right -207px;
}

#adminmenu .wp-has-current-submenu ul li a.current {
	background: url(../images/menu-dark-rtl.gif) top right no-repeat !important;
}

#adminmenu li.wp-has-current-submenu a.wp-has-current-submenu,
#adminmenu .menu-top .current {
	background: url(../images/menu-bits-rtl.gif) top right repeat-x;
}

#adminmenu li.wp-has-current-submenu ul li a {
	background: url(../images/menu-dark-rtl.gif) bottom right no-repeat !important;
}

#adminmenu li.wp-has-current-submenu.wp-menu-open .wp-menu-toggle, #adminmenu li.wp-has-current-submenu:hover .wp-menu-toggle {
	background: transparent url(../images/menu-bits-rtl.gif) no-repeat right -207px;
}

#adminmenu .wp-has-submenu:hover .wp-menu-toggle,
#adminmenu .wp-menu-open .wp-menu-toggle {
	background: transparent url(../images/menu-bits-rtl.gif) repeat-x scroll right -109px;
}

#adminmenu a.wp-has-submenu {
	background: #f1f1f1 url(../images/menu-bits-rtl.gif) repeat-x scroll right -379px;
}

#adminmenu .wp-submenu a {
	background: #FFFFFF url(../images/menu-bits-rtl.gif) no-repeat scroll right -310px;
}

#adminmenu li.current a,
#adminmenu .wp-submenu a:hover {
	background: transparent url(../images/menu-bits-rtl.gif) no-repeat scroll  right -289px;
}

#adminmenu li.wp-has-current-submenu a.wp-has-submenu {
	background: #b5b5b5 url(../images/menu-bits-rtl.gif) repeat-x scroll right top;
}

.meta-box-sortables .postbox:hover .handlediv {
	background: transparent url(../images/menu-bits-rtl.gif) no-repeat scroll right -111px;
}
                                                wp-admin/css/colors-classic.css                                                                     0000755 0023422 0004734 00000074115 11131054732 017550  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 html {
	background-color: #F5FCFD;
}

.find-box-search {
	border-color: #dfdfdf;
	background-color: #f1f1f1;
}

.find-box {
	background-color: #f1f1f1;
}

.find-box-inside {
	background-color: #fff;
}

a.page-numbers:hover {
	border-color: #999;
}

body,
#wpbody,
.form-table .pre {
	color: #333;
}

body > #upload-menu {
	border-bottom-color: #fff;
}

kbd, code {
	background: #eaeaea;
}

div#current-widgets,
#postcustomstuff table,
#your-profile fieldset,
#rightnow,
div.dashboard-widget,
#dashboard-widgets p.dashboard-widget-links,
#replyrow #ed_reply_toolbar input {
	border-color: #ccc;
}

#poststuff .inside label.spam {
	color: red;
}

#poststuff .inside label.waiting {
	color: orange;
}

#poststuff .inside label.approved {
	color: green;
}

#postcustomstuff table {
	border-color: #dfdfdf;
	background-color: #F9F9F9;
}

#postcustomstuff thead th {
	background-color: #F1F1F1;
}

#postcustomstuff table input,
#postcustomstuff table textarea {
	border-color: #dfdfdf;
	background-color: #fff;
}

.widefat {
	border-color: #BBD8E7;
	background-color: #fff;
}

div.dashboard-widget-error {
	background-color: #c43;
}

div.dashboard-widget-notice {
	background-color: #cfe1ef;
}

div.dashboard-widget-submit,
ul.widget-control-list div.widget-control-actions {
	border-top-color: #ccc;
}

div.ui-tabs-panel {
	border-color: #f1f1f1;
}

ul#category-tabs li.ui-tabs-selected {
	background-color: #f1f1f1;
}

input.disabled,
textarea.disabled {
	background-color: #ccc;
}
/* #upload-menu li a.upload-tab-link, */
li.widget-list-control-item h4.widget-title a:hover,
li.widget-list-control-item h4.widget-title a,
#dragHelper li.widget-list-control-item h4.widget-title a,
#draghelper li.widget-list-control-item h4.widget-title a:visited,
.login #backtoblog a:hover,
#plugin-information .action-button a,
#plugin-information .action-button a:hover,
#plugin-information .action-button a:visited {
	color: #fff;
}

li.widget-list-control-item div.widget-control {
	background-color: #fff;
	border-color: #dfdfdf;
}

.metabox-holder .postbox h3,
#poststuff .postbox h3,
#poststuff .stuffbox h3 {
	background: #dfdfdf url("../images/blue-grad.png") repeat-x left top;
	text-shadow: #fff 0 1px 0;
}

.form-table th,
.form-wrap label {
	color: #222;
	text-shadow: #fff 0 1px 0;
}

.setting-description, .form-wrap p {
	color: #666;
}

select {
	background-color: #fff;
	border-color: #8CBDD5;
}

strong .post-com-count span {
	background-color: #21759b;
}

ul#widget-list li.widget-list-item h4.widget-title {
	background-color: #f0f0f0;
	color: #000;
}

.sorthelper {
	background-color: #ccf3fa;
}

.ac_match, .subsubsub a.current {
	color: #000;
}

.wrap h2 {
	color: #093E56;
}

.ac_over {
	background-color: #f0f0b8;
}

.ac_results {
	background-color: #fff;
	border-color: #808080;
}

.ac_results li {
	color: #101010;
}

.alternate, .alt {
	background-color: #EDFBFC;
}

.available-theme a.screenshot {
	background-color: #f1f1f1;
	border-color: #ddd;
}

.bar {
	background-color: #e8e8e8;
	border-right-color: #99d;
}

#media-upload {
	background: #fff;
}
#media-upload .slidetoggle {
	border-top-color: #dfdfdf;
}

.error, #login #login_error {
	background-color: #ffebe8;
	border-color: #c00;
}

.error a {
	color: #c00;
}

.form-invalid {
	background-color: #ffebe8 !important;
}

.form-invalid input {
	border-color: #c00 !important;
}

.form-table input,
.form-table textarea,
.search-input,
.form-field input,
.form-field textarea,
.submit {
	border-color: #8CBDD5;
}

.highlight {
	background-color: #e4f2fd;
	color: #d54e21;
}

.howto,
.nonessential,
#edit-slug-box,
.form-input-tip,
.rss-widget span.rss-date,
.subsubsub {
	color: #666;
}

.media-item {
	border-bottom-color: #dfdfdf;
}

#wpbody-content #media-items .describe {
	border-top-color: #dfdfdf;
}

.describe input[type="text"],
.describe textarea {
	border-color: #dfdfdf;
}

.media-upload-form label.form-help,
td.help {
	color: #9a9a9a;
}

.post-com-count {
	background-image: url(../images/bubble_bg.gif);
	color: #fff;
}

.post-com-count span {
	background-color: #bbb;
	color: #fff;
}

.post-com-count:hover span {
	background-color: #d54e21;
}

.quicktags, .search {
	background-color: #ccc;
	color: #000;
}

.side-info h5, .bordertitle {
	border-bottom-color: #dadada;
}

.side-info ul, .widget-description {
	color: #666;
}

.button,
.button-secondary,
.submit input,
input[type=button],
input[type=submit] {
	border-color: #8CBDD5;
	color: #093E56;
}

.button:hover,
.button-secondary:hover,
.submit input:hover,
input[type=button]:hover,
input[type=submit]:hover {
	color: #000;
	border-color: #21759B;
}

.button,
.submit input,
.button-secondary {
	background: #f2f2f2 url(../images/white-grad.png) repeat-x scroll left top;
}

.button:active,
.submit input:active,
.button-secondary:active {
	background: #eee url(../images/white-grad-active.png) repeat-x scroll left top;
}

.button-primary,
.submit .button-primary,
#login form .submit input {
	border-color: #298cba !important;
	font-weight: bold;
	color: #FFF !important;
	background: #21759B url(../images/button-grad.png) repeat-x scroll left top;
}

.button-primary:active,
#login form .submit input:active {
	background: #21759b url(../images/button-grad-active.png) repeat-x scroll left top !important;
}

.button[disabled],
.button:disabled,
.button-secondary[disabled],
.button-secondary:disabled,
a.button.disabled {
	color: #ccc !important;
	border-color: #ccc;
}

.button-primary[disabled],
.button-primary:disabled {
	color: #2fa0d5 !important;
}

a:active,
a:focus {
	color: #d54e21;
}

a:hover,
#wphead #viewsite a:hover,
#adminmenu a:hover,
#adminmenu ul.wp-submenu a:hover,
#the-comment-list .comment a:hover,
#rightnow a:hover,
.subsubsub a:hover,
.subsubsub a.current:hover,
#login form .submit input:hover,
div.dashboard-widget-submit input:hover,
#media-upload a.del-link:hover,
.ui-tabs-nav a:hover {
	color: #d54e21;
}

#the-comment-list .comment-item,
#dashboard-widgets #dashboard_quick_press form p.submit {
	border-color: #dfdfdf;
}

.button-primary:hover,
#login form .submit input:hover {
	border-color: #13455b !important;
	color: #EAF2FA !important;
}

#side-info-column #category-tabs .ui-tabs-selected a {
	color: #333;
}

#rightnow .rbutton {
	background-color: #ebebeb;
	color: #264761;
}

.submitbox .submit {
	background-color: #464646;
	color: #ccc;
}

.submitbox .submitdelete, a.delete {
	color: #f00;
	border-bottom-color: #f00;
}

.submitbox .submitdelete:hover,
#media-upload a.delete:hover {
	color: #fff;
	background-color: #f00;
	border-bottom-color: #f00;
}

#normal-sortables .submitbox .submitdelete:hover {
	color: #000;
	background-color: #f00;
	border-bottom-color: #f00;
}

.tablenav .dots {
	border-color: transparent;
}

.tablenav .next,
.tablenav .prev {
	border-color: transparent;
	color: #21759b;
}

.tablenav .next:hover,
.tablenav .prev:hover {
	border-color: transparent;
	color: #d54e21;
}

.updated,
.login #login_error,
.login .message {
	background-color: #ffffe0;
	border-color: #e6db55;
}

a.page-numbers {
	border-bottom-color: #B8D3E2;
}

div#available-widgets-filter,
ul#widget-list li.widget-list-item,
.commentlist li {
	border-bottom-color: #ccc;
}

.widefat td,
.widefat th {
	border-bottom-color: #BBD8E7;
}

.widefat th {
	text-shadow: rgba(255,255,255,0.8) 0 1px 0;
}

.widefat thead tr th,
.widefat tfoot tr th,
h3.dashboard-widget-title,
h3.dashboard-widget-title span,
h3.dashboard-widget-title small,
.find-box-head {
	color: #333;
	background: #dfdfdf url(../images/blue-grad.png) repeat-x scroll left top;
}

h3.dashboard-widget-title small a {
	color: #d7d7d7;
}

h3.dashboard-widget-title small a:hover {
	color: #fff;
}

#adminmenu a,
#poststuff #edButtonPreview,
#poststuff #edButtonHTML,
#the-comment-list p.comment-author strong a,
#media-upload a.del-link,
#media-upload a.delete,
.ui-tabs-nav a, a {
	color: #1C6280;
}

/* Because we don't want visited on these links */
body.press-this .ui-tabs-selected a,
body.press-this .ui-tabs-selected a:hover {
	background-color: #fff;
	border-color: #c6d9e9;
	border-bottom-color: #fff;
	color: #d54e21;
}

#adminmenu #awaiting-mod,
#adminmenu .update-plugins,
#sidemenu a .update-plugins,
#rightnow .reallynow,
#plugin-information .action-button {
	background-color: #d54e21;
	color: #fff;
}

#adminmenu li a:hover #awaiting-mod,
#adminmenu li a:hover .update-plugins,
#sidemenu li a:hover .update-plugins {
	background-color: #264761;
	color: #fff;
}

#adminmenu li.current a #awaiting-mod,
#adminmenu li.current a .update-plugins,
#adminmenu li.wp-has-current-submenu a .update-plugins,
#adminmenu li.wp-has-current-submenu a .update-plugins {
	background-color: #ddd;
	color: #000;
	text-shadow: none;
	-moz-box-shadow: rgba(0,0,0,0.2) 0px -1px 0px;
	-khtml-box-shadow: rgba(0,0,0,0.2) 0px -1px 0px;
	-webkit-box-shadow: rgba(0,0,0,0.2) 0px -1px 0px;
	box-shadow: rgba(0,0,0,0.2) 0px -1px 0px;
}

#adminmenu li.current a:hover #awaiting-mod,
#adminmenu li.current a:hover .update-plugins,
#adminmenu li.wp-has-current-submenu a:hover #awaiting-mod,
#adminmenu li.wp-has-current-submenu a:hover .update-plugins {
	background-color: #264761;
	color: #fff;
}

div#media-upload-header {
	background-color: #f9f9f9;
	border-bottom-color: #dfdfdf;
}

div#plugin-information-header {
	background-color: #e4f2fd;
	border-bottom-color: #c6d9e9;
}

#currenttheme img {
	border-color: #666;
}

#current-widgets .drop-widget-here {
	background-color: #ffc;
}

#dashboard_secondary div.dashboard-widget-content ul li a {
	background-color: #f9f9f9;
}

input.readonly, textarea.readonly {
	background-color: #ddd;
}

#dragHelper h4.widget-title,
li.widget-list-control-item h4,
#dragHelper li.widget-list-control-item h4 {
	background-color: #2683ae;
	color: #fff;
}

#ed_toolbar input,
#ed_reply_toolbar input {
	background: #fff url("../images/fade-butt.png") repeat-x 0 -2px;
}

#editable-post-name {
	background-color: #fffbcc;
}

#edit-slug-box strong,
.tablenav .displaying-num,
#submitted-on {
	color: #777;
}

.login #nav a {
	color: #21759b !important;
}

.login #nav a:hover {
	color: #d54e21 !important;
}

#footer,
#footer-upgrade {
	background: #073447;
	color: #999;
}

#media-items {
	border-color: #dfdfdf;
}

#pass-strength-result {
	background-color: #eee;
	border-color: #ddd !important;
}

#pass-strength-result.bad {
	background-color: #ffb78c;
	border-color: #ff853c !important;
}

#pass-strength-result.good {
	background-color: #ffec8b;
	border-color: #fc0 !important;
}

#pass-strength-result.short {
	background-color: #ffa0a0;
	border-color: #f04040 !important;
}

#pass-strength-result.strong {
	background-color: #c3ff88;
	border-color: #8dff1c !important;
}

.checkbox,
.side-info,
#your-profile #rich_editing {
	background-color: #fff;
}

.plugins .active,
.plugins .active th,
.plugins .active td {
	background-color: #e7f7d3;
}

#the-comment-list .unapproved,
#the-comment-list .unapproved th,
#the-comment-list .unapproved td {
	background-color: #ffffe0;
}

#the-comment-list .approve a {
	color: #006505;
}

#the-comment-list .unapprove a {
	color: #d98500;
}

#the-comment-list .delete a {
	color: #bc0b0b;
}

.plugins tr {
	background-color: #fff;
}

.metabox-holder .postbox,
#poststuff .postbox,
#titlediv,
#poststuff .postarea,
#poststuff .stuffbox,
.postbox input[type="text"],
.postbox textarea,
.stuffbox input[type="text"],
.stuffbox textarea {
	border-color: #BBD8E7;
}

.metabox-holder .postbox,
#poststuff .postbox {
	background-color: #FFF;
}

.ui-sortable .postbox h3 {
	color: #093E56;
}

.ui-sortable .postbox h3:hover {
	color: #000;
}

.curtime #timestamp {
	background-image: url(../images/date-button.gif);
}

#quicktags #ed_link {
	color: #00f;
}

#rightnow .youhave {
	background-color: #f0f6fb;
}

#rightnow a {
	color: #448abd;
}

#tagchecklist span a,
#bulk-titles div a {
	background: url(../images/xit.gif) no-repeat;
}

#tagchecklist span a:hover,
#bulk-titles div a:hover {
	background: url(../images/xit.gif) no-repeat -10px 0;
}

#update-nag, .plugin-update {
	background-color: #fffeeb;
	border-bottom-color: #ccc;
	border-top-color: #ccc;
	color: #555;
}

.login #backtoblog a {
	color: #ccc;
}

#wphead {
	background-color: #073447;
}

body.login {
	border-top-color: #093E56;
}

#wphead h1 a {
	color: #fff;
}

#login form input {
	color: #555;
}

#wphead h1 a:hover {
	text-decoration: underline;
}

#user_info {
	color: #999;
}

#user_info a:link, #user_info a:visited, #footer a:link, #footer a:visited {
	color: #ccc;
	text-decoration: none;
}

#user_info a:hover, #footer a:hover {
	color: #fff;
	text-decoration: underline !important;
}

#user_info a:active, #footer a:active {
	color: #ccc !important;
}

div#media-upload-error,
.file-error,
abbr.required,
.widget-control-remove:hover,
.delete a:hover {
	color: #f00;
}

#media-upload a.delete {
	color: #888;
}

/* editors */
#quicktags {
	border-color: #dfdfdf;
	background-color: #dfdfdf;
}

#ed_toolbar input {
	border-color: #C3C3C3;
}

#ed_toolbar input:hover {
	border-color: #aaa;
	background: #ddd;
}

#poststuff .wp_themeSkin .mceStatusbar {
	border-color: #EDEDED;
}

#poststuff #edButtonPreview,
#poststuff #edButtonHTML {
	background-color: #f1f1f1;
	border-color: #dfdfdf;
	color: #999;
}

#poststuff #editor-toolbar .active {
	border-bottom-color: #e9e9e9;
	background-color: #e9e9e9;
	color: #333;
}

/* TinyMCE */
#post-status-info {
	background-color: #EDEDED;
}

.wp_themeSkin *,
.wp_themeSkin a:hover,
.wp_themeSkin a:link,
.wp_themeSkin a:visited,
.wp_themeSkin a:active {
	 color: #000;
}

/* Containers */
.wp_themeSkin iframe {
	background: #fff;
}

/* Layout */
.wp_themeSkin .mceStatusbar {
	color: #000;
	background-color: #f5f5f5;
}

/* Button */
.wp_themeSkin .mceButton {
	background-color: #e9e8e8;
	border-color: #B2B2B2;
}

.wp_themeSkin a.mceButtonEnabled:hover,
.wp_themeSkin a.mceButtonActive,
.wp_themeSkin a.mceButtonSelected {
	background-color: #d5d5d5;
	border-color: #777 !important;
}

.wp_themeSkin .mceButtonDisabled {
	border-color: #ccc !important;
}

/* ListBox */
.wp_themeSkin .mceListBox .mceText,
.wp_themeSkin .mceListBox .mceOpen  {
	border-color: #B2B2B2;
	background-color: #d5d5d5;
}

.wp_themeSkin table.mceListBoxEnabled:hover .mceOpen,
.wp_themeSkin .mceListBoxHover .mceOpen,
.wp_themeSkin .mceListBoxSelected .mceOpen,
.wp_themeSkin .mceListBoxSelected .mceText {
	border-color: #777 !important;
	background-color: #d5d5d5;
}

.wp_themeSkin table.mceListBoxEnabled:hover .mceText,
.wp_themeSkin .mceListBoxHover .mceText {
	border-color: #777 !important;
}

.wp_themeSkin select.mceListBox {
	border-color: #B2B2B2;
	background-color: #fff;
}

/* SplitButton */
.wp_themeSkin .mceSplitButton a.mceAction,
.wp_themeSkin .mceSplitButton a.mceOpen {
	background-color: #e8e8e8;
	border-color: #B2B2B2;
}

.wp_themeSkin .mceSplitButton a.mceOpen:hover,
.wp_themeSkin .mceSplitButtonSelected a.mceOpen,
.wp_themeSkin table.mceSplitButtonEnabled:hover a.mceAction,
.wp_themeSkin .mceSplitButton a.mceAction:hover {
	background-color: #d5d5d5;
	border-color: #777 !important;
}

.wp_themeSkin .mceSplitButtonActive {
	background-color: #B2B2B2;
}

/* ColorSplitButton */
.wp_themeSkin div.mceColorSplitMenu table {
	background-color: #ebebeb;
	border-color: #B2B2B2;
}

.wp_themeSkin .mceColorSplitMenu a {
	border-color: #B2B2B2;
}

.wp_themeSkin .mceColorSplitMenu a.mceMoreColors {
	border-color: #fff;
}

.wp_themeSkin .mceColorSplitMenu a.mceMoreColors:hover {
	border-color: #0A246A;
	background-color: #B6BDD2;
}

.wp_themeSkin a.mceMoreColors:hover {
	border-color: #0A246A;
}

/* Menu */
.wp_themeSkin .mceMenu {
	border-color: #ddd;
}

.wp_themeSkin .mceMenu table {
	background-color: #ebeaeb;
}

.wp_themeSkin .mceMenu .mceText {
	color: #000;
}

.wp_themeSkin .mceMenu .mceMenuItemEnabled a:hover,
.wp_themeSkin .mceMenu .mceMenuItemActive {
	background-color: #f5f5f5;
}
.wp_themeSkin td.mceMenuItemSeparator {
	background-color: #aaa;
}
.wp_themeSkin .mceMenuItemTitle a {
	background-color: #ccc;
	border-bottom-color: #aaa;
}
.wp_themeSkin .mceMenuItemTitle span.mceText {
	color: #000;
}
.wp_themeSkin .mceMenuItemDisabled .mceText {
	color: #888;
}

.wp_themeSkin tr.mceFirst td.mceToolbar {
	background-color: #dfdfdf;
	border-color: #dfdfdf;
}

.wp-admin #mceModalBlocker {
	background: #000;
}

.wp-admin .clearlooks2 .mceFocus .mceTop .mceLeft {
	background: #444444;
	border-left: 1px solid #999;
	border-top: 1px solid #999;
	-moz-border-radius: 4px 0 0 0;
	-webkit-border-top-left-radius: 4px;
	-khtml-border-top-left-radius: 4px;
	border-top-left-radius: 4px;
}

.wp-admin .clearlooks2 .mceFocus .mceTop .mceRight {
	background: #444444;
	border-right: 1px solid #999;
	border-top: 1px solid #999;
	border-top-right-radius: 4px;
	-khtml-border-top-right-radius: 4px;
	-webkit-border-top-right-radius: 4px;
	-moz-border-radius: 0 4px 0 0;
}

.wp-admin .clearlooks2 .mceMiddle .mceLeft {
	background: #f1f1f1;
	border-left: 1px solid #999;
}

.wp-admin .clearlooks2 .mceMiddle .mceRight {
	background: #f1f1f1;
	border-right: 1px solid #999;
}

.wp-admin .clearlooks2 .mceBottom {
	background: #f1f1f1;
	border-bottom: 1px solid #999;
}

.wp-admin .clearlooks2 .mceBottom .mceLeft {
	background: #f1f1f1;
	border-bottom: 1px solid #999;
	border-left: 1px solid #999;
}

.wp-admin .clearlooks2 .mceBottom .mceCenter {
	background: #f1f1f1;
	border-bottom: 1px solid #999;
}

.wp-admin .clearlooks2 .mceBottom .mceRight {
	background: #f1f1f1;
	border-bottom: 1px solid #999;
	border-right: 1px solid #999;
}

.wp-admin .clearlooks2 .mceFocus .mceTop span {
	color: #e5e5e5;
}
/* end TinyMCE */

#editorcontainer,
#post-status-info,
#titlediv #title {
	border-color: #dfdfdf;
}

#titlediv #title {
	background-color: #fff;
}

#tTips p#tTips_inside {
	background-color: #ddd;
	color: #333;
}

#timestampdiv input,
#namediv input,
#tagsdiv #the-tagcloud {
	border-color: #ddd;
}

/* menu */
#adminmenu * {
	border-color: #BBD8E7;
}

#adminmenu li.wp-menu-separator {
	background: transparent url(../images/menu-arrows.gif) no-repeat scroll left 5px;
}

.folded #adminmenu li.wp-menu-separator {
	background: transparent url(../images/menu-arrows.gif) no-repeat scroll right -34px;
}

#adminmenu li.wp-has-current-submenu.wp-menu-open .wp-menu-toggle,
#adminmenu li.wp-has-current-submenu:hover .wp-menu-toggle {
	background: transparent url(../images/menu-bits.gif) no-repeat scroll left -207px;
}

#adminmenu .wp-has-submenu:hover .wp-menu-toggle,
#adminmenu .wp-menu-open .wp-menu-toggle {
	background: transparent url(../images/menu-bits.gif) no-repeat scroll left -109px;
}

#adminmenu a.menu-top {
	background: #EAF3FA url(../images/menu-bits.gif) repeat-x scroll left -379px;
}

#adminmenu .wp-submenu a {
	background: #FFFFFF url(../images/menu-bits.gif) no-repeat scroll 0 -310px;
}

#adminmenu .wp-has-current-submenu ul li a {
	background: none;
}

#adminmenu .wp-has-current-submenu ul li a.current {
	background: url(../images/menu-dark.gif) top left no-repeat !important;
}

#adminmenu li.wp-has-current-submenu a.wp-has-current-submenu,
#adminmenu .menu-top .current {
	background: #6d6d6d url(../images/menu-bits.gif) top left repeat-x;
	border-color: #6d6d6d;
	color: #fff;
	text-shadow: rgba(0,0,0,0.4) 0px -1px 0px;
}

#adminmenu li.wp-has-current-submenu .wp-submenu,
#adminmenu li.wp-has-current-submenu ul li a {
	border-color: #aaa !important;
}

#adminmenu li.wp-has-current-submenu ul li a {
	background: url(../images/menu-dark.gif) bottom left no-repeat !important;
}

#adminmenu li.wp-has-current-submenu ul {
	border-bottom-color: #aaa;
}

#adminmenu li.menu-top .current:hover {
	border-color: #B5B5B5;
}

#adminmenu .wp-submenu .current a.current {
	background: transparent url(../images/menu-bits.gif) no-repeat scroll  0 -289px;
}

#adminmenu .wp-submenu a:hover {
	background-color: #EAF2FA !important;
	color: #333 !important;
}

#adminmenu .wp-submenu li.current,
#adminmenu .wp-submenu li.current a,
#adminmenu .wp-submenu li.current a:hover {
	color: #333;
	background-color: #f5f5f5;
	background-image: none;
	border-color: #e3e3e3;
	text-shadow: rgba(255,255,255,1) 0px 1px 0px;
}

#adminmenu .wp-submenu ul {
	background-color: #fff;
}

.folded #adminmenu li.menu-top,
#adminmenu .wp-submenu .wp-submenu-head {
	background-color: #EAF2FA;
}

.folded #adminmenu li.wp-has-current-submenu,
.folded #adminmenu li.menu-top.current {
	background-color: #BBD8E7;
}

#adminmenu .wp-has-current-submenu .wp-submenu .wp-submenu-head {
	background-color: #BBD8E7;
	border-color: #8CBDD5;
}

#adminmenu div.wp-submenu {
	background-color: transparent;
}

/* menu icons */
#adminmenu #menu-dashboard div.wp-menu-image {
	background: transparent url("../images/menu-vs.png") no-repeat scroll -61px -33px;
}

#adminmenu #menu-dashboard:hover div.wp-menu-image,
#adminmenu  #menu-dashboard.wp-has-current-submenu div.wp-menu-image,
#adminmenu  #menu-dashboard.current div.wp-menu-image {
	background: transparent url("../images/menu-vs.png") no-repeat scroll -61px -1px;
}

#adminmenu #menu-posts div.wp-menu-image {
	background: transparent url("../images/menu-vs.png") no-repeat scroll -272px -33px;
}

#adminmenu #menu-posts:hover div.wp-menu-image,
#adminmenu #menu-posts.wp-has-current-submenu div.wp-menu-image {
	background: transparent url("../images/menu-vs.png") no-repeat scroll -272px -1px;
}

#adminmenu #menu-media div.wp-menu-image {
	background: transparent url("../images/menu-vs.png") no-repeat scroll -121px -33px;
}

#adminmenu #menu-media:hover div.wp-menu-image,
#adminmenu #menu-media.wp-has-current-submenu div.wp-menu-image {
	background: transparent url("../images/menu-vs.png") no-repeat scroll -121px -1px;
}

#adminmenu #menu-links div.wp-menu-image {
	background: transparent url("../images/menu-vs.png") no-repeat scroll -91px -33px;
}

#adminmenu #menu-links:hover div.wp-menu-image,
#adminmenu #menu-links.wp-has-current-submenu div.wp-menu-image {
	background: transparent url("../images/menu-vs.png") no-repeat scroll -91px -1px;
}

#adminmenu #menu-pages div.wp-menu-image {
	background: transparent url("../images/menu-vs.png") no-repeat scroll -151px -33px;
}

#adminmenu #menu-pages:hover div.wp-menu-image,
#adminmenu #menu-pages.wp-has-current-submenu div.wp-menu-image {
	background: transparent url("../images/menu-vs.png") no-repeat scroll -151px -1px;
}

#adminmenu #menu-comments div.wp-menu-image {
	background: transparent url("../images/menu-vs.png") no-repeat scroll -31px -33px;
}

#adminmenu #menu-comments:hover div.wp-menu-image,
#adminmenu #menu-comments.wp-has-current-submenu div.wp-menu-image,
#adminmenu #menu-comments.current div.wp-menu-image {
	background: transparent url("../images/menu-vs.png") no-repeat scroll -31px -1px;
}

#adminmenu #menu-appearance div.wp-menu-image {
	background: transparent url("../images/menu-vs.png") no-repeat scroll -1px -33px;
}

#adminmenu #menu-appearance:hover div.wp-menu-image,
#adminmenu #menu-appearance.wp-has-current-submenu div.wp-menu-image {
	background: transparent url("../images/menu-vs.png") no-repeat scroll -1px -1px;
}

#adminmenu #menu-plugins div.wp-menu-image {
	background: transparent url("../images/menu-vs.png") no-repeat scroll -181px -33px;
}

#adminmenu #menu-plugins:hover div.wp-menu-image,
#adminmenu #menu-plugins.wp-has-current-submenu div.wp-menu-image {
	background: transparent url("../images/menu-vs.png") no-repeat scroll -181px -1px;
}

#adminmenu #menu-users div.wp-menu-image {
	background: transparent url("../images/menu-vs.png") no-repeat scroll -301px -33px;
}

#adminmenu #menu-users:hover div.wp-menu-image,
#adminmenu #menu-users.wp-has-current-submenu div.wp-menu-image {
	background: transparent url("../images/menu-vs.png") no-repeat scroll -301px -1px;
}

#adminmenu #menu-tools div.wp-menu-image {
	background: transparent url("../images/menu-vs.png") no-repeat scroll -211px -33px;
}

#adminmenu #menu-tools:hover div.wp-menu-image,
#adminmenu #menu-tools.wp-has-current-submenu div.wp-menu-image {
	background: transparent url("../images/menu-vs.png") no-repeat scroll -211px -1px;
}

#adminmenu #menu-settings div.wp-menu-image {
	background: transparent url("../images/menu-vs.png") no-repeat scroll -241px -33px;
}

#adminmenu #menu-settings:hover div.wp-menu-image,
#adminmenu #menu-settings.wp-has-current-submenu div.wp-menu-image {
	background: transparent url("../images/menu-vs.png") no-repeat scroll -241px -1px;
}
/* end menu */


/* Diff */
table.diff .diff-deletedline {
	background-color: #ffdddd;
}
table.diff .diff-deletedline del {
	background-color: #ff9999;
}
table.diff .diff-addedline {
	background-color: #ddffdd;
}
table.diff .diff-addedline ins {
	background-color: #99ff99;
}

#att-info {
	background-color: #E4F2FD;
}

/* edit image */
#sidemenu a {
	background-color: #f9f9f9;
	border-color: #f9f9f9;
	border-bottom-color: #dfdfdf;
}

#sidemenu a.current {
	background-color: #fff;
	border-color: #dfdfdf #dfdfdf #fff;
	color: #D54E21;
}


#screen-options-wrap,
#contextual-help-wrap {
	background-color: #f1f1f1;
	border-color: #dfdfdf;
}

#screen-meta-links a.show-settings {
	color: #606060;
}

#screen-meta-links a.show-settings:hover {
	color: #000;
}

#replysubmit {
	background-color: #f1f1f1;
	border-top-color: #ddd;
}

#replyerror {
	border-color: #ddd;
	background-color: #f9f9f9;
}

#edithead,
#replyhead {
	background-color: #f1f1f1;
}

#ed_reply_toolbar {
	background-color: #e9e9e9;
}

/* table vim shortcuts */
.vim-current {
	background-color: #E4F2FD !important;
}

/* Install Plugins */
.star-average,
.star.star-rating {
	background-color: #fc0;
}

div.star.select:hover {
	background-color: #d00;
}

#plugin-information .fyi ul {
	background-color: #eaf3fa;
}

#plugin-information .fyi h2.mainheader {
	background-color: #cee1ef;
}

#plugin-information pre,
#plugin-information code {
	background-color: #ededff;
}

#plugin-information pre {
	border: 1px solid #ccc;
}

/* inline editor */
.inline-edit-row fieldset input[type="text"],
.inline-edit-row fieldset textarea,
#bulk-titles,
#replyrow input {
	border-color: #ddd;
}

.inline-editor div.title {
	background-color: #EAF3FA;
}

.inline-editor ul.cat-checklist {
	background-color: #FFFFFF;
	border-color: #ddd;
}

.inline-edit-row p.submit {
	background-color: #f1f1f1;
}

.inline-editor .categories .catshow,
.inline-editor .categories .cathide {
	color: #21759b;
}

.inline-editor .quick-edit-save {
	background-color: #f1f1f1;
}

#replyrow #ed_reply_toolbar input:hover {
	border-color: #aaa;
	background: #ddd;
}

fieldset.inline-edit-col-right .inline-edit-col {
	border-color: #dfdfdf;
}

.attention {
	color: #D54E21;
}

.meta-box-sortables .postbox:hover .handlediv {
	background: transparent url(../images/menu-bits.gif) no-repeat scroll left -111px;
}

#major-publishing-actions {
	background: #eaf2fa;
}

.tablenav .tablenav-pages {
	color: #555;
}

.tablenav .tablenav-pages a {
	border-color: #e3e3e3;
	background: #eee url('../images/menu-bits.gif') repeat-x scroll left -379px;
}

.tablenav .tablenav-pages a:hover {
	color: #d54e21;
	border-color: #d54321;
}

.tablenav .tablenav-pages a:active {
	color: #fff !important;
}

.tablenav .tablenav-pages .current {
	background: #dfdfdf;
	border-color: #d3d3d3;
}

#availablethemes,
#availablethemes td {
	border-color: #ddd;
}

#current-theme img {
	border-color: #999;
}

#TB_window #TB_title a.tb-theme-preview-link,
#TB_window #TB_title a.tb-theme-preview-link:visited {
	color: #999;
}

#TB_window #TB_title a.tb-theme-preview-link:hover,
#TB_window #TB_title a.tb-theme-preview-link:focus {
	color: #ccc;
}

.misc-pub-section {
	border-bottom-color: #eee;
}

#minor-publishing {
	border-bottom-color: #ddd;
}

#post-body .misc-pub-section {
	border-right-color: #eee;
}

.post-com-count span {
	background-color: #bbb;
}

.form-table .color-palette td {
	border-color: #fff;
}

.sortable-placeholder {
	border-color: #bbb;
	background-color: #f5f5f5;
}

#post-body ul#category-tabs li.ui-tabs-selected a {
	color: #333;
}

#wp_editimgbtn,
#wp_delimgbtn,
#wp_editgallery,
#wp_delgallery {
	border-color: #999;
	background-color: #eee;
}

#wp_editimgbtn:hover,
#wp_delimgbtn:hover,
#wp_editgallery:hover,
#wp_delgallery:hover {
	border-color: #555;
	background-color: #ccc;
}

#favorite-first {
	background: #797979 url(../images/fav.png) repeat-x 0 center;
	border-color: #777 !important;
	border-bottom-color: #666 !important;
}

#favorite-inside {
	border-color: #797979;
	background-color: #797979;
}

#favorite-toggle {
	background: transparent url(../images/fav-arrow.gif) no-repeat 0 -4px;
}

#favorite-actions a {
	color: #ddd;
}

#favorite-actions a:hover {
	color: #fff;
}

#favorite-inside a:hover {
	text-decoration: underline;
}

#favorite-actions .slide-down {
	border-bottom-color: #626262;
}

.submit input,
.button,
.button-primary,
.button-secondary,
.button-highlighted,
#postcustomstuff .submit input {
	text-shadow: rgba(255,255,255,1) 0 1px 0;
}

.button-primary,
.submit .button-primary {
	text-shadow: rgba(0,0,0,0.3) 0 -1px 0;
}

#screen-meta a.show-settings {
	background-color: transparent;
	text-shadow: rgba(255,255,255,0.7) 0 1px 0;
}

#icon-edit,
#icon-post {
	background: transparent url(../images/icons32-vs.png) no-repeat -552px -5px;
}

#icon-index {
	background: transparent url(../images/icons32-vs.png) no-repeat -137px -5px;
}

#icon-upload {
	background: transparent url(../images/icons32-vs.png) no-repeat -251px -5px;
}

#icon-link-manager,
#icon-link,
#icon-link-category {
	background: transparent url(../images/icons32-vs.png) no-repeat -190px -5px;
}

#icon-edit-pages,
#icon-page {
	background: transparent url(../images/icons32-vs.png) no-repeat -312px -5px;
}

#icon-edit-comments {
	background: transparent url(../images/icons32-vs.png) no-repeat -72px -5px;
}

#icon-themes {
	background: transparent url(../images/icons32-vs.png) no-repeat -11px -5px;
}

#icon-plugins {
	background: transparent url(../images/icons32-vs.png) no-repeat -370px -5px;
}

#icon-users,
#icon-user-edit {
	background: transparent url(../images/icons32-vs.png) no-repeat -600px -5px;
}

#icon-tools,
#icon-admin {
	background: transparent url(../images/icons32-vs.png) no-repeat -432px -5px;
}

#icon-options-general {
	background: transparent url(../images/icons32-vs.png) no-repeat -492px -5px;
}

.view-switch #view-switch-list {
	background: transparent url(../images/list-vs.png) no-repeat 0 0;
}

.view-switch #view-switch-list.current {
	background: transparent url(../images/list-vs.png) no-repeat -40px 0;
}

.view-switch #view-switch-excerpt {
	background: transparent url(../images/list-vs.png) no-repeat -20px 0;
}

.view-switch #view-switch-excerpt.current {
	background: transparent url(../images/list-vs.png) no-repeat -60px 0;
}

#header-logo {
	background: transparent url(../images/wp-logo.gif) no-repeat scroll center center;
}
                                                                                                                                                                                                                                                                                                                                                                                                                                                   wp-admin/css/colors-fresh-rtl.css                                                                   0000755 0023422 0004734 00000005065 11117202036 020027  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 .bar {
	border-right-color: transparent;
	border-left-color: #99d;
}

.plugins .togl {
	border-right-color: transparent;
	border-left-color: #ccc;
}

.post-com-count {
	background-image: url(../images/bubble_bg-rtl.gif);
}
.tablenav .tablenav-pages a {
	background: #eee url('../images/menu-bits-rtl.gif') repeat-x scroll right -379px;
}
#upload-menu li.current {
	border-right-color: transparent;
	border-left-color: #448abd;
}

#adminmenu .wp-submenu .current a.current {
	background: transparent url(../images/menu-bits-rtl.gif) no-repeat scroll  right -289px;
}

#adminmenu li.wp-menu-separator {
	background: transparent url(../images/menu-arrows.gif) no-repeat scroll right -34px;
}

.folded #adminmenu li.wp-menu-separator {
	background: transparent url(../images/menu-arrows.gif) no-repeat scroll left 5px;
}

#adminmenu li.wp-has-current-submenu .wp-menu-toggle,
#adminmenu li.wp-has-current-submenu:hover .wp-menu-toggle {
	background: transparent url(../images/menu-bits-rtl.gif) repeat-x scroll right -207px;
}

#adminmenu .wp-has-current-submenu ul li a.current {
	background: url(../images/menu-dark-rtl.gif) top right no-repeat !important;
}

#adminmenu li.wp-has-current-submenu a.wp-has-current-submenu,
#adminmenu .menu-top .current {
	background: url(../images/menu-bits-rtl.gif) top right repeat-x;
}

#adminmenu li.wp-has-current-submenu ul li a {
	background: url(../images/menu-dark-rtl.gif) bottom right no-repeat !important;
}

#adminmenu li.wp-has-current-submenu.wp-menu-open .wp-menu-toggle, #adminmenu li.wp-has-current-submenu:hover .wp-menu-toggle {
	background: transparent url(../images/menu-bits-rtl.gif) no-repeat right -207px;
}

#adminmenu .wp-has-submenu:hover .wp-menu-toggle,
#adminmenu .wp-menu-open .wp-menu-toggle {
	background: transparent url(../images/menu-bits-rtl.gif) repeat-x scroll right -109px;
}

#adminmenu a.wp-has-submenu {
	background: #f1f1f1 url(../images/menu-bits-rtl.gif) repeat-x scroll right -379px;
}

#adminmenu .wp-submenu a {
	background: #FFFFFF url(../images/menu-bits-rtl.gif) no-repeat scroll right -310px;
}

#adminmenu li.current a,
#adminmenu .wp-submenu a:hover {
	background: transparent url(../images/menu-bits-rtl.gif) no-repeat scroll  right -289px;
}

#adminmenu li.wp-has-current-submenu a.wp-has-submenu {
	background: #b5b5b5 url(../images/menu-bits-rtl.gif) repeat-x scroll right top;
}

.meta-box-sortables .postbox:hover .handlediv {
	background: transparent url(../images/menu-bits-rtl.gif) no-repeat scroll right -111px;
}
#favorite-toggle {
	background: transparent url(../images/fav-arrow-rtl.gif) no-repeat right -4px;
}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                           wp-admin/css/colors-fresh.css                                                                       0000755 0023422 0004734 00000073716 11131054732 017244  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 html {
	background-color: #f9f9f9;
}

.find-box-search {
	border-color: #dfdfdf;
	background-color: #f1f1f1;
}

.find-box {
	background-color: #f1f1f1;
}

.find-box-inside {
	background-color: #fff;
}

a.page-numbers:hover {
	border-color: #999;
}

body,
#wpbody,
.form-table .pre {
	color: #333;
}

body > #upload-menu {
	border-bottom-color: #fff;
}

kbd, code {
	background: #eaeaea;
}

div#current-widgets,
#postcustomstuff table,
#your-profile fieldset,
#rightnow,
div.dashboard-widget,
#dashboard-widgets p.dashboard-widget-links,
#replyrow #ed_reply_toolbar input {
	border-color: #ccc;
}

#poststuff .inside label.spam {
	color: red;
}

#poststuff .inside label.waiting {
	color: orange;
}

#poststuff .inside label.approved {
	color: green;
}

#postcustomstuff table {
	border-color: #dfdfdf;
	background-color: #F9F9F9;
}

#postcustomstuff thead th {
	background-color: #F1F1F1;
}

#postcustomstuff table input,
#postcustomstuff table textarea {
	border-color: #dfdfdf;
	background-color: #fff;
}

.widefat {
	border-color: #dfdfdf;
	background-color: #fff;
}

div.dashboard-widget-error {
	background-color: #c43;
}

div.dashboard-widget-notice {
	background-color: #cfe1ef;
}

div.dashboard-widget-submit,
ul.widget-control-list div.widget-control-actions {
	border-top-color: #ccc;
}

div.ui-tabs-panel {
	border-color: #f1f1f1;
}

ul#category-tabs li.ui-tabs-selected {
	background-color: #f1f1f1;
}

input.disabled,
textarea.disabled {
	background-color: #ccc;
}
/* #upload-menu li a.upload-tab-link, */
li.widget-list-control-item h4.widget-title a:hover,
li.widget-list-control-item h4.widget-title a,
#dragHelper li.widget-list-control-item h4.widget-title a,
#draghelper li.widget-list-control-item h4.widget-title a:visited,
.login #backtoblog a:hover,
#plugin-information .action-button a,
#plugin-information .action-button a:hover,
#plugin-information .action-button a:visited {
	color: #fff;
}

li.widget-list-control-item div.widget-control {
	background-color: #fff;
	border-color: #dfdfdf;
}

.metabox-holder .postbox h3,
#poststuff .postbox h3,
#poststuff .stuffbox h3 {
	background: #dfdfdf url("../images/gray-grad.png") repeat-x left top;
	text-shadow: #fff 0 1px 0;
}

.form-table th,
.form-wrap label {
	color: #222;
	text-shadow: #fff 0 1px 0;
}

.setting-description, .form-wrap p {
	color: #666;
}

select {
	background-color: #fff;
	border-color: #ddd;
}

strong .post-com-count span {
	background-color: #21759b;
}

ul#widget-list li.widget-list-item h4.widget-title {
	background-color: #f0f0f0;
	color: #000;
}

.sorthelper {
	background-color: #ccf3fa;
}

.ac_match, .subsubsub a.current {
	color: #000;
}

.wrap h2 {
	color: #464646;
}

.ac_over {
	background-color: #f0f0b8;
}

.ac_results {
	background-color: #fff;
	border-color: #808080;
}

.ac_results li {
	color: #101010;
}

.alternate, .alt {
	background-color: #f9f9f9;
}

.available-theme a.screenshot {
	background-color: #f1f1f1;
	border-color: #ddd;
}

.bar {
	background-color: #e8e8e8;
	border-right-color: #99d;
}

#media-upload {
	background: #fff;
}
#media-upload .slidetoggle {
	border-top-color: #dfdfdf;
}

.error, #login #login_error {
	background-color: #ffebe8;
	border-color: #c00;
}

.error a {
	color: #c00;
}

.form-invalid {
	background-color: #ffebe8 !important;
}

.form-invalid input {
	border-color: #c00 !important;
}

.form-table input,
.form-table textarea,
.search-input,
.form-field input,
.form-field textarea,
.submit {
	border-color: #DFDFDF;
}

.highlight {
	background-color: #e4f2fd;
	color: #d54e21;
}

.howto,
.nonessential,
#edit-slug-box,
.form-input-tip,
.rss-widget span.rss-date,
.subsubsub {
	color: #666;
}

.media-item {
	border-bottom-color: #dfdfdf;
}

#wpbody-content #media-items .describe {
	border-top-color: #dfdfdf;
}

.describe input[type="text"],
.describe textarea {
	border-color: #dfdfdf;
}

.media-upload-form label.form-help,
td.help {
	color: #9a9a9a;
}

.post-com-count {
	background-image: url(../images/bubble_bg.gif);
	color: #fff;
}

.post-com-count span {
	background-color: #bbb;
	color: #fff;
}

.post-com-count:hover span {
	background-color: #d54e21;
}

.quicktags, .search {
	background-color: #ccc;
	color: #000;
}

.side-info h5, .bordertitle {
	border-bottom-color: #dadada;
}

.side-info ul, .widget-description {
	color: #666;
}

.button,
.button-secondary,
.submit input,
input[type=button],
input[type=submit] {
	border-color: #bbb;
	color: #464646;
}

.button:hover,
.button-secondary:hover,
.submit input:hover,
input[type=button]:hover,
input[type=submit]:hover {
	color: #000;
	border-color: #666;
}

.button,
.submit input,
.button-secondary {
	background: #f2f2f2 url(../images/white-grad.png) repeat-x scroll left top;
}

.button:active,
.submit input:active,
.button-secondary:active {
	background: #eee url(../images/white-grad-active.png) repeat-x scroll left top;
}

.button-primary,
.submit .button-primary,
#login form .submit input {
	border-color: #298cba !important;
	font-weight: bold;
	color: #FFF !important;
	background: #21759B url(../images/button-grad.png) repeat-x scroll left top;
}

.button-primary:active,
#login form .submit input:active {
	background: #21759b url(../images/button-grad-active.png) repeat-x scroll left top !important;
}

.button[disabled],
.button:disabled,
.button-secondary[disabled],
.button-secondary:disabled,
a.button.disabled {
	color: #ccc !important;
	border-color: #ccc;
}

.button-primary[disabled],
.button-primary:disabled {
	color: #2fa0d5 !important;
}

a:active,
a:focus {
	color: #d54e21;
}

a:hover,
#wphead #viewsite a:hover,
#adminmenu a:hover,
#adminmenu ul.wp-submenu a:hover,
#the-comment-list .comment a:hover,
#rightnow a:hover,
.subsubsub a:hover,
.subsubsub a.current:hover,
#login form .submit input:hover,
div.dashboard-widget-submit input:hover,
#media-upload a.del-link:hover,
.ui-tabs-nav a:hover {
	color: #d54e21;
}

#the-comment-list .comment-item,
#dashboard-widgets #dashboard_quick_press form p.submit {
	border-color: #dfdfdf;
}

.button-primary:hover,
#login form .submit input:hover {
	border-color: #13455b !important;
	color: #EAF2FA !important;
}

#side-info-column #category-tabs .ui-tabs-selected a {
	color: #333;
}

#rightnow .rbutton {
	background-color: #ebebeb;
	color: #264761;
}

.submitbox .submit {
	background-color: #464646;
	color: #ccc;
}

.submitbox .submitdelete, a.delete {
	color: #f00;
	border-bottom-color: #f00;
}

.submitbox .submitdelete:hover,
#media-upload a.delete:hover {
	color: #fff;
	background-color: #f00;
	border-bottom-color: #f00;
}

#normal-sortables .submitbox .submitdelete:hover {
	color: #000;
	background-color: #f00;
	border-bottom-color: #f00;
}

.tablenav .dots {
	border-color: transparent;
}

.tablenav .next,
.tablenav .prev {
	border-color: transparent;
	color: #21759b;
}

.tablenav .next:hover,
.tablenav .prev:hover {
	border-color: transparent;
	color: #d54e21;
}

.updated,
.login #login_error,
.login .message {
	background-color: #ffffe0;
	border-color: #e6db55;
}

a.page-numbers {
	border-bottom-color: #B8D3E2;
}

div#available-widgets-filter,
ul#widget-list li.widget-list-item,
.commentlist li {
	border-bottom-color: #ccc;
}

.widefat td,
.widefat th {
	border-color: #dfdfdf;
}

.widefat th {
	text-shadow: rgba(255,255,255,0.8) 0 1px 0;
}

.widefat thead tr th,
.widefat tfoot tr th,
h3.dashboard-widget-title,
h3.dashboard-widget-title span,
h3.dashboard-widget-title small,
.find-box-head {
	color: #333;
	background: #dfdfdf url(../images/gray-grad.png) repeat-x scroll left top;
}

h3.dashboard-widget-title small a {
	color: #d7d7d7;
}

h3.dashboard-widget-title small a:hover {
	color: #fff;
}

#adminmenu a,
#poststuff #edButtonPreview,
#poststuff #edButtonHTML,
#the-comment-list p.comment-author strong a,
#media-upload a.del-link,
#media-upload a.delete,
.ui-tabs-nav a, a {
	color: #21759b;
}

/* Because we don't want visited on these links */
body.press-this .ui-tabs-selected a,
body.press-this .ui-tabs-selected a:hover {
	background-color: #fff;
	border-color: #c6d9e9;
	border-bottom-color: #fff;
	color: #d54e21;
}

#adminmenu #awaiting-mod,
#adminmenu .update-plugins,
#sidemenu a .update-plugins,
#rightnow .reallynow,
#plugin-information .action-button {
	background-color: #d54e21;
	color: #fff;
}

#adminmenu li a:hover #awaiting-mod,
#adminmenu li a:hover .update-plugins,
#sidemenu li a:hover .update-plugins {
	background-color: #264761;
	color: #fff;
}

#adminmenu li.current a #awaiting-mod,
#adminmenu li.current a .update-plugins,
#adminmenu li.wp-has-current-submenu a .update-plugins,
#adminmenu li.wp-has-current-submenu a .update-plugins {
	background-color: #ddd;
	color: #000;
	text-shadow: none;
	-moz-box-shadow: rgba(0,0,0,0.2) 0px -1px 0px;
	-khtml-box-shadow: rgba(0,0,0,0.2) 0px -1px 0px;
	-webkit-box-shadow: rgba(0,0,0,0.2) 0px -1px 0px;
	box-shadow: rgba(0,0,0,0.2) 0px -1px 0px;
}

#adminmenu li.current a:hover #awaiting-mod,
#adminmenu li.current a:hover .update-plugins,
#adminmenu li.wp-has-current-submenu a:hover #awaiting-mod,
#adminmenu li.wp-has-current-submenu a:hover .update-plugins {
	background-color: #264761;
	color: #fff;
}

div#media-upload-header {
	background-color: #f9f9f9;
	border-bottom-color: #dfdfdf;
}

div#plugin-information-header {
	background-color: #e4f2fd;
	border-bottom-color: #c6d9e9;
}

#currenttheme img {
	border-color: #666;
}

#current-widgets .drop-widget-here {
	background-color: #ffc;
}

#dashboard_secondary div.dashboard-widget-content ul li a {
	background-color: #f9f9f9;
}

input.readonly, textarea.readonly {
	background-color: #ddd;
}

#dragHelper h4.widget-title,
li.widget-list-control-item h4,
#dragHelper li.widget-list-control-item h4 {
	background-color: #2683ae;
	color: #fff;
}

#ed_toolbar input,
#ed_reply_toolbar input {
	background: #fff url("../images/fade-butt.png") repeat-x 0 -2px;
}

#editable-post-name {
	background-color: #fffbcc;
}

#edit-slug-box strong,
.tablenav .displaying-num,
#submitted-on {
	color: #777;
}

.login #nav a {
	color: #21759b !important;
}

.login #nav a:hover {
	color: #d54e21 !important;
}

#footer,
#footer-upgrade {
	background: #464646;
	color: #999;
}

#media-items {
	border-color: #dfdfdf;
}

#pass-strength-result {
	background-color: #eee;
	border-color: #ddd !important;
}

#pass-strength-result.bad {
	background-color: #ffb78c;
	border-color: #ff853c !important;
}

#pass-strength-result.good {
	background-color: #ffec8b;
	border-color: #fc0 !important;
}

#pass-strength-result.short {
	background-color: #ffa0a0;
	border-color: #f04040 !important;
}

#pass-strength-result.strong {
	background-color: #c3ff88;
	border-color: #8dff1c !important;
}

.checkbox,
.side-info,
#your-profile #rich_editing {
	background-color: #fff;
}

.plugins .active,
.plugins .active th,
.plugins .active td {
	background-color: #e7f7d3;
}

#the-comment-list .unapproved,
#the-comment-list .unapproved th,
#the-comment-list .unapproved td {
	background-color: #ffffe0;
}

#the-comment-list .approve a {
	color: #006505;
}

#the-comment-list .unapprove a {
	color: #d98500;
}

#the-comment-list .delete a {
	color: #bc0b0b;
}

.plugins tr {
	background-color: #fff;
}

.metabox-holder .postbox,
#poststuff .postbox,
#titlediv,
#poststuff .postarea,
#poststuff .stuffbox,
.postbox input[type="text"],
.postbox textarea,
.stuffbox input[type="text"],
.stuffbox textarea {
	border-color: #dfdfdf;
}

.metabox-holder .postbox,
#poststuff .postbox {
	background-color: #FFF;
}

.ui-sortable .postbox h3 {
	color: #464646;
}

.ui-sortable .postbox h3:hover {
	color: #000;
}

.curtime #timestamp {
	background-image: url(../images/date-button.gif);
}

#quicktags #ed_link {
	color: #00f;
}

#rightnow .youhave {
	background-color: #f0f6fb;
}

#rightnow a {
	color: #448abd;
}

#tagchecklist span a,
#bulk-titles div a {
	background: url(../images/xit.gif) no-repeat;
}

#tagchecklist span a:hover,
#bulk-titles div a:hover {
	background: url(../images/xit.gif) no-repeat -10px 0;
}

#update-nag, .plugin-update {
	background-color: #fffeeb;
	border-bottom-color: #ccc;
	border-top-color: #ccc;
	color: #555;
}

.login #backtoblog a {
	color: #ccc;
}

#wphead {
	background-color: #464646;
}

body.login {
	border-top-color: #464646;
}

#wphead h1 a {
	color: #fff;
}

#login form input {
	color: #555;
}

#wphead h1 a:hover {
	text-decoration: underline;
}

#user_info {
	color: #999;
}

#user_info a:link, #user_info a:visited, #footer a:link, #footer a:visited {
	color: #ccc;
	text-decoration: none;
}

#user_info a:hover, #footer a:hover {
	color: #fff;
	text-decoration: underline !important;
}

#user_info a:active, #footer a:active {
	color: #ccc !important;
}

div#media-upload-error,
.file-error,
abbr.required,
.widget-control-remove:hover,
.delete a:hover {
	color: #f00;
}

#media-upload a.delete {
	color: #888;
}

/* editors */
#quicktags {
	border-color: #dfdfdf;
	background-color: #dfdfdf;
}

#ed_toolbar input {
	border-color: #C3C3C3;
}

#ed_toolbar input:hover {
	border-color: #aaa;
	background: #ddd;
}

#poststuff .wp_themeSkin .mceStatusbar {
	border-color: #EDEDED;
}

#poststuff #edButtonPreview,
#poststuff #edButtonHTML {
	background-color: #f1f1f1;
	border-color: #dfdfdf;
	color: #999;
}

#poststuff #editor-toolbar .active {
	border-bottom-color: #e9e9e9;
	background-color: #e9e9e9;
	color: #333;
}

/* TinyMCE */
#post-status-info {
	background-color: #EDEDED;
}

.wp_themeSkin *,
.wp_themeSkin a:hover,
.wp_themeSkin a:link,
.wp_themeSkin a:visited,
.wp_themeSkin a:active {
	 color: #000;
}

/* Containers */
.wp_themeSkin iframe {
	background: #fff;
}

/* Layout */
.wp_themeSkin .mceStatusbar {
	color: #000;
	background-color: #f5f5f5;
}

/* Button */
.wp_themeSkin .mceButton {
	background-color: #e9e8e8;
	border-color: #B2B2B2;
}

.wp_themeSkin a.mceButtonEnabled:hover,
.wp_themeSkin a.mceButtonActive,
.wp_themeSkin a.mceButtonSelected {
	background-color: #d5d5d5;
	border-color: #777 !important;
}

.wp_themeSkin .mceButtonDisabled {
	border-color: #ccc !important;
}

/* ListBox */
.wp_themeSkin .mceListBox .mceText,
.wp_themeSkin .mceListBox .mceOpen  {
	border-color: #B2B2B2;
	background-color: #d5d5d5;
}

.wp_themeSkin table.mceListBoxEnabled:hover .mceOpen,
.wp_themeSkin .mceListBoxHover .mceOpen,
.wp_themeSkin .mceListBoxSelected .mceOpen,
.wp_themeSkin .mceListBoxSelected .mceText {
	border-color: #777 !important;
	background-color: #d5d5d5;
}

.wp_themeSkin table.mceListBoxEnabled:hover .mceText,
.wp_themeSkin .mceListBoxHover .mceText {
	border-color: #777 !important;
}

.wp_themeSkin select.mceListBox {
	border-color: #B2B2B2;
	background-color: #fff;
}

/* SplitButton */
.wp_themeSkin .mceSplitButton a.mceAction,
.wp_themeSkin .mceSplitButton a.mceOpen {
	background-color: #e8e8e8;
	border-color: #B2B2B2;
}

.wp_themeSkin .mceSplitButton a.mceOpen:hover,
.wp_themeSkin .mceSplitButtonSelected a.mceOpen,
.wp_themeSkin table.mceSplitButtonEnabled:hover a.mceAction,
.wp_themeSkin .mceSplitButton a.mceAction:hover {
	background-color: #d5d5d5;
	border-color: #777 !important;
}

.wp_themeSkin .mceSplitButtonActive {
	background-color: #B2B2B2;
}

/* ColorSplitButton */
.wp_themeSkin div.mceColorSplitMenu table {
	background-color: #ebebeb;
	border-color: #B2B2B2;
}

.wp_themeSkin .mceColorSplitMenu a {
	border-color: #B2B2B2;
}

.wp_themeSkin .mceColorSplitMenu a.mceMoreColors {
	border-color: #fff;
}

.wp_themeSkin .mceColorSplitMenu a.mceMoreColors:hover {
	border-color: #0A246A;
	background-color: #B6BDD2;
}

.wp_themeSkin a.mceMoreColors:hover {
	border-color: #0A246A;
}

/* Menu */
.wp_themeSkin .mceMenu {
	border-color: #ddd;
}

.wp_themeSkin .mceMenu table {
	background-color: #ebeaeb;
}

.wp_themeSkin .mceMenu .mceText {
	color: #000;
}

.wp_themeSkin .mceMenu .mceMenuItemEnabled a:hover,
.wp_themeSkin .mceMenu .mceMenuItemActive {
	background-color: #f5f5f5;
}
.wp_themeSkin td.mceMenuItemSeparator {
	background-color: #aaa;
}
.wp_themeSkin .mceMenuItemTitle a {
	background-color: #ccc;
	border-bottom-color: #aaa;
}
.wp_themeSkin .mceMenuItemTitle span.mceText {
	color: #000;
}
.wp_themeSkin .mceMenuItemDisabled .mceText {
	color: #888;
}

.wp_themeSkin tr.mceFirst td.mceToolbar {
	background-color: #dfdfdf;
	border-color: #dfdfdf;
}

.wp-admin #mceModalBlocker {
	background: #000;
}

.wp-admin .clearlooks2 .mceFocus .mceTop .mceLeft {
	background: #444444;
	border-left: 1px solid #999;
	border-top: 1px solid #999;
	-moz-border-radius: 4px 0 0 0;
	-webkit-border-top-left-radius: 4px;
	-khtml-border-top-left-radius: 4px;
	border-top-left-radius: 4px;
}

.wp-admin .clearlooks2 .mceFocus .mceTop .mceRight {
	background: #444444;
	border-right: 1px solid #999;
	border-top: 1px solid #999;
	border-top-right-radius: 4px;
	-khtml-border-top-right-radius: 4px;
	-webkit-border-top-right-radius: 4px;
	-moz-border-radius: 0 4px 0 0;
}

.wp-admin .clearlooks2 .mceMiddle .mceLeft {
	background: #f1f1f1;
	border-left: 1px solid #999;
}

.wp-admin .clearlooks2 .mceMiddle .mceRight {
	background: #f1f1f1;
	border-right: 1px solid #999;
}

.wp-admin .clearlooks2 .mceBottom {
	background: #f1f1f1;
	border-bottom: 1px solid #999;
}

.wp-admin .clearlooks2 .mceBottom .mceLeft {
	background: #f1f1f1;
	border-bottom: 1px solid #999;
	border-left: 1px solid #999;
}

.wp-admin .clearlooks2 .mceBottom .mceCenter {
	background: #f1f1f1;
	border-bottom: 1px solid #999;
}

.wp-admin .clearlooks2 .mceBottom .mceRight {
	background: #f1f1f1;
	border-bottom: 1px solid #999;
	border-right: 1px solid #999;
}

.wp-admin .clearlooks2 .mceFocus .mceTop span {
	color: #e5e5e5;
}
/* end TinyMCE */

#editorcontainer,
#post-status-info,
#titlediv #title {
	border-color: #dfdfdf;
}

#titlediv #title {
	background-color: #fff;
}

#tTips p#tTips_inside {
	background-color: #ddd;
	color: #333;
}

#timestampdiv input,
#namediv input,
#tagsdiv #the-tagcloud {
	border-color: #ddd;
}

/* menu */
#adminmenu * {
	border-color: #e3e3e3;
}

#adminmenu li.wp-menu-separator {
	background: transparent url(../images/menu-arrows.gif) no-repeat scroll left 5px;
}

.folded #adminmenu li.wp-menu-separator {
	background: transparent url(../images/menu-arrows.gif) no-repeat scroll right -34px;
}

#adminmenu li.wp-has-current-submenu.wp-menu-open .wp-menu-toggle,
#adminmenu li.wp-has-current-submenu:hover .wp-menu-toggle {
	background: transparent url(../images/menu-bits.gif) no-repeat scroll left -207px;
}

#adminmenu .wp-has-submenu:hover .wp-menu-toggle,
#adminmenu .wp-menu-open .wp-menu-toggle {
	background: transparent url(../images/menu-bits.gif) no-repeat scroll left -109px;
}

#adminmenu a.menu-top {
	background: #f1f1f1 url(../images/menu-bits.gif) repeat-x scroll left -379px;
}

#adminmenu .wp-submenu a {
	background: #FFFFFF url(../images/menu-bits.gif) no-repeat scroll 0 -310px;
}

#adminmenu .wp-has-current-submenu ul li a {
	background: none;
}

#adminmenu .wp-has-current-submenu ul li a.current {
	background: url(../images/menu-dark.gif) top left no-repeat !important;
}

#adminmenu li.wp-has-current-submenu a.wp-has-current-submenu,
#adminmenu .menu-top .current {
	background: #6d6d6d url(../images/menu-bits.gif) top left repeat-x;
	border-color: #6d6d6d;
	color: #fff;
	text-shadow: rgba(0,0,0,0.4) 0px -1px 0px;
}

#adminmenu li.wp-has-current-submenu .wp-submenu,
#adminmenu li.wp-has-current-submenu ul li a {
	border-color: #aaa !important;
}

#adminmenu li.wp-has-current-submenu ul li a {
	background: url(../images/menu-dark.gif) bottom left no-repeat !important;
}

#adminmenu li.wp-has-current-submenu ul {
	border-bottom-color: #aaa;
}

#adminmenu li.menu-top .current:hover {
	border-color: #B5B5B5;
}

#adminmenu .wp-submenu .current a.current {
	background: transparent url(../images/menu-bits.gif) no-repeat scroll  0 -289px;
}

#adminmenu .wp-submenu a:hover {
	background-color: #EAF2FA !important;
	color: #333 !important;
}

#adminmenu .wp-submenu li.current,
#adminmenu .wp-submenu li.current a,
#adminmenu .wp-submenu li.current a:hover {
	color: #333;
	background-color: #f5f5f5;
	background-image: none;
	border-color: #e3e3e3;
	text-shadow: rgba(255,255,255,1) 0px 1px 0px;
}

#adminmenu .wp-submenu ul {
	background-color: #fff;
}

.folded #adminmenu li.menu-top,
#adminmenu .wp-submenu .wp-submenu-head {
	background-color: #F1F1F1;
}

.folded #adminmenu li.wp-has-current-submenu,
.folded #adminmenu li.menu-top.current {
	background-color: #e6e6e6;
}

#adminmenu .wp-has-current-submenu .wp-submenu .wp-submenu-head {
	background-color: #EAEAEA;
	border-color: #aaa;
}

#adminmenu div.wp-submenu {
	background-color: transparent;
}

/* menu icons */
#adminmenu #menu-dashboard div.wp-menu-image {
	background: transparent url("../images/menu.png") no-repeat scroll -61px -33px;
}

#adminmenu #menu-dashboard:hover div.wp-menu-image,
#adminmenu  #menu-dashboard.wp-has-current-submenu div.wp-menu-image,
#adminmenu  #menu-dashboard.current div.wp-menu-image {
	background: transparent url("../images/menu.png") no-repeat scroll -61px -1px;
}

#adminmenu #menu-posts div.wp-menu-image {
	background: transparent url("../images/menu.png") no-repeat scroll -272px -33px;
}

#adminmenu #menu-posts:hover div.wp-menu-image,
#adminmenu #menu-posts.wp-has-current-submenu div.wp-menu-image {
	background: transparent url("../images/menu.png") no-repeat scroll -272px -1px;
}

#adminmenu #menu-media div.wp-menu-image {
	background: transparent url("../images/menu.png") no-repeat scroll -121px -33px;
}

#adminmenu #menu-media:hover div.wp-menu-image,
#adminmenu #menu-media.wp-has-current-submenu div.wp-menu-image {
	background: transparent url("../images/menu.png") no-repeat scroll -121px -1px;
}

#adminmenu #menu-links div.wp-menu-image {
	background: transparent url("../images/menu.png") no-repeat scroll -91px -33px;
}

#adminmenu #menu-links:hover div.wp-menu-image,
#adminmenu #menu-links.wp-has-current-submenu div.wp-menu-image {
	background: transparent url("../images/menu.png") no-repeat scroll -91px -1px;
}

#adminmenu #menu-pages div.wp-menu-image {
	background: transparent url("../images/menu.png") no-repeat scroll -151px -33px;
}

#adminmenu #menu-pages:hover div.wp-menu-image,
#adminmenu #menu-pages.wp-has-current-submenu div.wp-menu-image {
	background: transparent url("../images/menu.png") no-repeat scroll -151px -1px;
}

#adminmenu #menu-comments div.wp-menu-image {
	background: transparent url("../images/menu.png") no-repeat scroll -31px -33px;
}

#adminmenu #menu-comments:hover div.wp-menu-image,
#adminmenu #menu-comments.wp-has-current-submenu div.wp-menu-image,
#adminmenu #menu-comments.current div.wp-menu-image {
	background: transparent url("../images/menu.png") no-repeat scroll -31px -1px;
}

#adminmenu #menu-appearance div.wp-menu-image {
	background: transparent url("../images/menu.png") no-repeat scroll -1px -33px;
}

#adminmenu #menu-appearance:hover div.wp-menu-image,
#adminmenu #menu-appearance.wp-has-current-submenu div.wp-menu-image {
	background: transparent url("../images/menu.png") no-repeat scroll -1px -1px;
}

#adminmenu #menu-plugins div.wp-menu-image {
	background: transparent url("../images/menu.png") no-repeat scroll -181px -33px;
}

#adminmenu #menu-plugins:hover div.wp-menu-image,
#adminmenu #menu-plugins.wp-has-current-submenu div.wp-menu-image {
	background: transparent url("../images/menu.png") no-repeat scroll -181px -1px;
}

#adminmenu #menu-users div.wp-menu-image {
	background: transparent url("../images/menu.png") no-repeat scroll -301px -33px;
}

#adminmenu #menu-users:hover div.wp-menu-image,
#adminmenu #menu-users.wp-has-current-submenu div.wp-menu-image {
	background: transparent url("../images/menu.png") no-repeat scroll -301px -1px;
}

#adminmenu #menu-tools div.wp-menu-image {
	background: transparent url("../images/menu.png") no-repeat scroll -211px -33px;
}

#adminmenu #menu-tools:hover div.wp-menu-image,
#adminmenu #menu-tools.wp-has-current-submenu div.wp-menu-image {
	background: transparent url("../images/menu.png") no-repeat scroll -211px -1px;
}

#adminmenu #menu-settings div.wp-menu-image {
	background: transparent url("../images/menu.png") no-repeat scroll -241px -33px;
}

#adminmenu #menu-settings:hover div.wp-menu-image,
#adminmenu #menu-settings.wp-has-current-submenu div.wp-menu-image {
	background: transparent url("../images/menu.png") no-repeat scroll -241px -1px;
}
/* end menu */


/* Diff */
table.diff .diff-deletedline {
	background-color: #ffdddd;
}
table.diff .diff-deletedline del {
	background-color: #ff9999;
}
table.diff .diff-addedline {
	background-color: #ddffdd;
}
table.diff .diff-addedline ins {
	background-color: #99ff99;
}

#att-info {
	background-color: #E4F2FD;
}

/* edit image */
#sidemenu a {
	background-color: #f9f9f9;
	border-color: #f9f9f9;
	border-bottom-color: #dfdfdf;
}

#sidemenu a.current {
	background-color: #fff;
	border-color: #dfdfdf #dfdfdf #fff;
	color: #D54E21;
}


#screen-options-wrap,
#contextual-help-wrap {
	background-color: #f1f1f1;
	border-color: #dfdfdf;
}

#screen-meta-links a.show-settings {
	color: #606060;
}

#screen-meta-links a.show-settings:hover {
	color: #000;
}

#replysubmit {
	background-color: #f1f1f1;
	border-top-color: #ddd;
}

#replyerror {
	border-color: #ddd;
	background-color: #f9f9f9;
}

#edithead,
#replyhead {
	background-color: #f1f1f1;
}

#ed_reply_toolbar {
	background-color: #e9e9e9;
}

/* table vim shortcuts */
.vim-current {
	background-color: #E4F2FD !important;
}

/* Install Plugins */
.star-average,
.star.star-rating {
	background-color: #fc0;
}

div.star.select:hover {
	background-color: #d00;
}

#plugin-information .fyi ul {
	background-color: #eaf3fa;
}

#plugin-information .fyi h2.mainheader {
	background-color: #cee1ef;
}

#plugin-information pre,
#plugin-information code {
	background-color: #ededff;
}

#plugin-information pre {
	border: 1px solid #ccc;
}

/* inline editor */
.inline-edit-row fieldset input[type="text"],
.inline-edit-row fieldset textarea,
#bulk-titles,
#replyrow input {
	border-color: #ddd;
}

.inline-editor div.title {
	background-color: #EAF3FA;
}

.inline-editor ul.cat-checklist {
	background-color: #FFFFFF;
	border-color: #ddd;
}

.inline-edit-row p.submit {
	background-color: #f1f1f1;
}

.inline-editor .categories .catshow,
.inline-editor .categories .cathide {
	color: #21759b;
}

.inline-editor .quick-edit-save {
	background-color: #f1f1f1;
}

#replyrow #ed_reply_toolbar input:hover {
	border-color: #aaa;
	background: #ddd;
}

fieldset.inline-edit-col-right .inline-edit-col {
	border-color: #dfdfdf;
}

.attention {
	color: #D54E21;
}

.meta-box-sortables .postbox:hover .handlediv {
	background: transparent url(../images/menu-bits.gif) no-repeat scroll left -111px;
}

#major-publishing-actions {
	background: #eaf2fa;
}

.tablenav .tablenav-pages {
	color: #555;
}

.tablenav .tablenav-pages a {
	border-color: #e3e3e3;
	background: #eee url('../images/menu-bits.gif') repeat-x scroll left -379px;
}

.tablenav .tablenav-pages a:hover {
	color: #d54e21;
	border-color: #d54321;
}

.tablenav .tablenav-pages a:active {
	color: #fff !important;
}

.tablenav .tablenav-pages .current {
	background: #dfdfdf;
	border-color: #d3d3d3;
}

#availablethemes,
#availablethemes td {
	border-color: #ddd;
}

#current-theme img {
	border-color: #999;
}

#TB_window #TB_title a.tb-theme-preview-link,
#TB_window #TB_title a.tb-theme-preview-link:visited {
	color: #999;
}

#TB_window #TB_title a.tb-theme-preview-link:hover,
#TB_window #TB_title a.tb-theme-preview-link:focus {
	color: #ccc;
}

.misc-pub-section {
	border-bottom-color: #eee;
}

#minor-publishing {
	border-bottom-color: #ddd;
}

#post-body .misc-pub-section {
	border-right-color: #eee;
}

.post-com-count span {
	background-color: #bbb;
}

.form-table .color-palette td {
	border-color: #fff;
}

.sortable-placeholder {
	border-color: #bbb;
	background-color: #f5f5f5;
}

#post-body ul#category-tabs li.ui-tabs-selected a {
	color: #333;
}

#wp_editimgbtn,
#wp_delimgbtn,
#wp_editgallery,
#wp_delgallery {
	border-color: #999;
	background-color: #eee;
}

#wp_editimgbtn:hover,
#wp_delimgbtn:hover,
#wp_editgallery:hover,
#wp_delgallery:hover {
	border-color: #555;
	background-color: #ccc;
}

#favorite-first {
	background: #797979 url(../images/fav.png) repeat-x left center;
	border-color: #777 !important;
	border-bottom-color: #666 !important;
}

#favorite-inside {
	border-color: #797979;
	background-color: #797979;
}

#favorite-toggle {
	background: transparent url(../images/fav-arrow.gif) no-repeat 0 -4px;
}

#favorite-actions a {
	color: #ddd;
}

#favorite-actions a:hover {
	color: #fff;
}

#favorite-inside a:hover {
	text-decoration: underline;
}

#favorite-actions .slide-down {
	border-bottom-color: #626262;
}

.submit input,
.button,
.button-primary,
.button-secondary,
.button-highlighted,
#postcustomstuff .submit input {
	text-shadow: rgba(255,255,255,1) 0 1px 0;
}

.button-primary,
.submit .button-primary {
	text-shadow: rgba(0,0,0,0.3) 0 -1px 0;
}

#screen-meta a.show-settings {
	background-color: transparent;
	text-shadow: rgba(255,255,255,0.7) 0 1px 0;
}

#icon-edit,
#icon-post {
	background: transparent url(../images/icons32.png) no-repeat -552px -5px;
}

#icon-index {
	background: transparent url(../images/icons32.png) no-repeat -137px -5px;
}

#icon-upload {
	background: transparent url(../images/icons32.png) no-repeat -251px -5px;
}

#icon-link-manager,
#icon-link,
#icon-link-category {
	background: transparent url(../images/icons32.png) no-repeat -190px -5px;
}

#icon-edit-pages,
#icon-page {
	background: transparent url(../images/icons32.png) no-repeat -312px -5px;
}

#icon-edit-comments {
	background: transparent url(../images/icons32.png) no-repeat -72px -5px;
}

#icon-themes {
	background: transparent url(../images/icons32.png) no-repeat -11px -5px;
}

#icon-plugins {
	background: transparent url(../images/icons32.png) no-repeat -370px -5px;
}

#icon-users,
#icon-user-edit {
	background: transparent url(../images/icons32.png) no-repeat -600px -5px;
}

#icon-tools,
#icon-admin {
	background: transparent url(../images/icons32.png) no-repeat -432px -5px;
}

#icon-options-general {
	background: transparent url(../images/icons32.png) no-repeat -492px -5px;
}

.view-switch #view-switch-list {
	background: transparent url(../images/list.png) no-repeat 0 0;
}

.view-switch #view-switch-list.current {
	background: transparent url(../images/list.png) no-repeat -40px 0;
}

.view-switch #view-switch-excerpt {
	background: transparent url(../images/list.png) no-repeat -20px 0;
}

.view-switch #view-switch-excerpt.current {
	background: transparent url(../images/list.png) no-repeat -60px 0;
}

#header-logo {
	background: transparent url(../images/wp-logo.gif) no-repeat scroll center center;
}
                                                  wp-admin/css/dashboard-rtl.css                                                                      0000755 0023422 0004734 00000004034 11117526244 017355  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 #dashboard-widgets-wrap .has-sidebar {
	margin-right: 0;
	margin-left: -51%;
}
#dashboard-widgets-wrap .has-sidebar .has-sidebar-content {
	margin-right: 0;
	margin-left: 51%;
}
.view-all {
	right: auto;
	left: 0;
}
#dashboard_right_now p.sub, #dashboard-widgets h4, #dashboard_quick_press h4, a.rsswidget, #dashboard_plugins h4, #dashboard_plugins h5, #dashboard_recent_comments .comment-meta .approve {
	font-family: Tahoma, Arial;
}
#dashboard_right_now td.b {
	padding-right: 0;
	padding-left: 6px;
	text-align: left;
	font-family: Tahoma, Arial;
}
#dashboard_right_now .t {
	padding-right: 0;
	padding-left: 12px;
}
#dashboard_right_now .versions a {
	font-family: Tahoma, Arial;
}
#dashboard_right_now a.button {
	float: left;
	clear: left;
}
#dashboard-widgets h3 .postbox-title-action {
	right: auto;
	left: 30px;
}
#the-comment-list .pingback {
	padding-left: 0 !important;
	padding-right: 9px !important;
}
/* Recent Comments */
#the-comment-list .comment-item {
	padding: 1em 70px 1em 10px;
}
#the-comment-list .comment-item .avatar {
	float: right;
	margin-left: 0;
	margin-right: -60px;
}
/* Feeds */
.rss-widget cite {
	text-align: left;
}
.rss-widget span.rss-date {
	font-family: Tahoma, Arial;
	margin-left: 0;
	margin-right: 3px;
}
/* QuickPress */
#dashboard_quick_press h4 {
	float: right;
	text-align: left;
}
#dashboard_quick_press h4 label {
	margin-right: 0;
	margin-left: 10px;
}
#dashboard_quick_press .input-text-wrap, #dashboard_quick_press .textarea-wrap {
	margin: 0 5em 1em 0;
}
#dashboard_quick_press #media-buttons {
	margin: 0 5em .5em 0;
	padding: 0 10px 0 0;
}
#dashboard-widgets #dashboard_quick_press form p.submit {
	margin-left: 0;
	margin-right: 4.6em;
}
#dashboard-widgets #dashboard_quick_press form p.submit input {
	float: right;
}
#dashboard-widgets #dashboard_quick_press form p.submit #save-post {
	margin: 0 10px 0 1em;
}
#dashboard-widgets #dashboard_quick_press form p.submit #publish {
	float: left;
}
/* Recent Drafts */
#dashboard_recent_drafts h4 abbr {
	font-family: Tahoma, Arial;
	margin-left:0;
	margin-right: 3px;
}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    wp-admin/css/dashboard.css                                                                          0000755 0023422 0004734 00000015244 11117651534 016564  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 .postbox p, .postbox ul, .postbox ol, .postbox blockquote, #wp-version-message { font-size: 11px; }

.edit-box {
	display: none;
}

h3:hover .edit-box {
	display: inline;
}

form .input-text-wrap {
	border-style: solid;
	border-width: 1px;
	padding: 2px 3px;
	border-color: #ccc;
}

#dashboard-widgets form .input-text-wrap input {
	border: 0 none;
	outline: none;
	margin: 0;
	padding: 0;
	width: 99%;
	color: #333;
}

form .textarea-wrap {
	border-style: solid;
	border-width: 1px;
	padding: 2px;
	border-color: #ccc;
}

#dashboard-widgets form .textarea-wrap textarea {
	border: 0 none;
	padding: 0;
	outline: none;
	width: 99%;
	-moz-box-sizing: border-box;
	-webkit-box-sizing: border-box;
	box-sizing: border-box;
}

#dashboard-widgets .postbox form .submit {
	float: none;
	margin: .5em 0 0;
	padding: 0;
	border: none;
}

#dashboard-widgets-wrap #dashboard-widgets .postbox form .submit input {
	margin: 0;
}

#dashboard-widgets-wrap #dashboard-widgets .postbox form .submit #publish {
	min-width: 0;
}

#dashboard-widgets-wrap .has-sidebar {
	margin-right: -51%;
}

#dashboard-widgets-wrap .inner-sidebar {
	width: 49%;
}

#dashboard-widgets-wrap .has-sidebar .has-sidebar-content {
	margin-right: 51%;
}

div.postbox div.inside {
	margin: 10px;
	position: relative;
}

#dashboard-widgets a {
	text-decoration: none;
}

#dashboard-widgets h3 a {
	text-decoration: underline;
}

#dashboard-widgets h3 .postbox-title-action {
	position: absolute;
	right: 30px;
	padding: 0;
}

#dashboard-widgets h4 {
	font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
	font-size: 13px;
	margin: 0 0 .2em;
	padding: 0;
}

/* Right Now */

#dashboard_right_now p.sub,
#dashboard_right_now .table, #dashboard_right_now .versions {
	margin: -12px;
}

#dashboard_right_now .inside {
	font-size: 12px;
}

#dashboard_right_now p.sub {
	font-style: italic;
	font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
	padding: 5px 10px 15px;
	color: #777;
	font-size: 13px;
}

#dashboard_right_now .table {
	background: #f9f9f9;
	border-top: #ececec 1px solid;
	border-bottom: #ececec 1px solid;
	margin: 0 -9px 10px;
	padding: 0 10px;
}

#dashboard_right_now table {
	width: 100%;
}

#dashboard_right_now table  td {
	border-top: #ececec 1px solid;
	padding: 3px 0;
	white-space: nowrap;
}

#dashboard_right_now table tr.first td {
	border-top: none;
}

#dashboard_right_now td.b {
	padding-right: 6px;
	text-align: right;
	font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
	font-size: 14px;
}

#dashboard_right_now td.b a {
	font-size: 18px;
}

#dashboard_right_now td.b a:hover {
	color: #d54e21;
}

#dashboard_right_now .t {
	font-size: 12px;
	padding-right: 12px;
	padding-top: 6px;
	color: #777;
}

#dashboard_right_now td.first,
#dashboard_right_now td.last {
	width: 1px;
}

#dashboard_right_now .spam {
	color: red;
}

#dashboard_right_now .waiting {
	color: orange;
}

#dashboard_right_now .approved {
	color: green;
}

#dashboard_right_now .versions {
	padding: 6px 10px 12px;
}

#dashboard_right_now .versions .b {
	font-weight: bold;
}

#dashboard_right_now a.button {
	float: right;
	clear: right;
	position: relative;
	top: -5px;
}

/* Recent Comments */

#dashboard_recent_comments h3 {
	margin-bottom: 0;
}

#dashboard_recent_comments .inside {
	margin-top: 0;
}

#dashboard_recent_comments .comment-meta .approve {
	font-style: italic;
	font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
	font-size: 10px;
}

#the-comment-list {
	position: relative;
}

#the-comment-list .comment-item {
	padding: 1em 10px 1em 70px;
	border-top: 1px solid;
}

#the-comment-list .pingback {
	padding-left: 9px !important;
}

#the-comment-list .comment-item,
#the-comment-list #replyrow {
	margin: 0 -10px;
}

#the-comment-list .comment-item:first-child {
	border-top: none;
}

#the-comment-list .comment-item .avatar {
	float: left;
	margin-left: -60px;
}

#the-comment-list .comment-item h4 {
	line-height: 1.4;
	margin-top: -.2em;
	font-weight: normal;
	color: #999;
}

#the-comment-list .comment-item h4 cite {
	font-style: normal;
	font-weight: normal;
}

#the-comment-list .comment-item blockquote,
#the-comment-list .comment-item blockquote p {
	margin: 0;
	padding: 0;
	display: inline;
}

#dashboard_recent_comments #the-comment-list .trackback blockquote,
#dashboard_recent_comments #the-comment-list .pingback blockquote {
	display: block;
}

#the-comment-list .comment-item p.row-actions {
	margin: 3px 0 0;
	padding: 0;
	font-size: 10px;
}

/* QuickPress */

#dashboard_quick_press h4 {
	font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
	float: left;
	width: 5.5em;
	clear: both;
	font-weight: normal;
	text-align: right;
	padding-top: 5px;
	font-size: 12px;
}

#dashboard_quick_press h4 label {
	margin-right: 10px;
}

#dashboard_quick_press .input-text-wrap,
#dashboard_quick_press .textarea-wrap {
	margin: 0 0 1em 5em;
}

#dashboard_quick_press #media-buttons {
	margin: 0 0 .5em 5em;
	padding: 0 0 0 10px;
	font-size: 11px;
}

#dashboard_quick_press #media-buttons a {
	vertical-align: bottom;
}

#dashboard-widgets #dashboard_quick_press form p.submit {
	margin-left: 4.6em;
}

#dashboard-widgets #dashboard_quick_press form p.submit input {
	float: left;
}

#dashboard-widgets #dashboard_quick_press form p.submit #save-post {
	margin: 0 1em 0 10px;
}

#dashboard-widgets #dashboard_quick_press form p.submit #publish {
	float: right;
}

/* Recent Drafts */
#dashboard_recent_drafts ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

#dashboard_recent_drafts ul li {
	margin-bottom: 0.6em;
}

#dashboard_recent_drafts h4 {
	font-weight: normal;
}

#dashboard_recent_drafts h4 abbr {
	font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
	font-size: 11px;
	color: #999;
	margin-left: 3px;
}

#dashboard_recent_drafts p {
	margin: 0;
	padding: 0;
}

/* Feeds */

.rss-widget ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

a.rsswidget {
	font-size: 13px;
	font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
	line-height: 1.7em;
}

.rss-widget ul li {
	line-height: 1.5em;
	margin-bottom: 12px;
}

.rss-widget span.rss-date {
	margin-left: 3px;
}

.rss-widget cite {
	display: block;
	text-align: right;
	margin: 0 0 1em;
	padding: 0;
}

.rss-widget cite:before {
	content: '\2014';
}

/* Plugins */

#dashboard_plugins h4 {
	font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
}

#dashboard_plugins h5 {
	font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
	font-size: 13px !important;
	margin: 0;
	display: inline;
	line-height: 1.4em;
}

#dashboard_plugins h5 a {
	font-weight: normal;
	line-height: 1.7em;
}

#dashboard_plugins p {
	margin: 0 0 1.4em;
	line-height: 1.4em;
}
                                                                                                                                                                                                                                                                                                                                                            wp-admin/css/global.css                                                                             0000755 0023422 0004734 00000014641 11117531364 016073  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 /* http://meyerweb.com/eric/tools/css/reset/ */
/* v1.0 | 20080212 */

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
	margin: 0;
	padding: 0;
	border: 0;
	outline: 0;
/*	font-size: 100%;
	vertical-align: baseline; */
	background: transparent;
}
body {
	line-height: 1;
}
ol, ul {
	list-style: none;
}
blockquote, q {
	quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
	content: '';
	content: none;
}

/* remember to define focus styles! */
/*
:focus {
	outline: 0;
}
*/
/* remember to highlight inserts somehow! */
ins {
	text-decoration: none;
}
del {
	text-decoration: line-through;
}

/* tables still need 'cellspacing="0"' in the markup */
/*
table {
	border-collapse: collapse;
	border-spacing: 0;
}
*/
/* end reset css */


/* 2 column liquid layout */
#wpwrap {
	height: auto;
	min-height: 100%;
	width: 100%;
}

#wpcontent {
	height: 100%;
	padding-bottom: 50px;
}

#wpbody {
	clear: both;
	margin-left: 175px;
}

.folded #wpbody {
	margin-left: 60px;
}

#wpbody-content {
	float: left;
	width: 100%;
}

#adminmenu {
	float: left;
	clear: left;
	width: 145px;
	margin-top: 15px;
	margin-right: 5px;
	margin-bottom: 15px;
	margin-left: -160px;
	position: relative;
	padding: 0;
	list-style: none;
}

.folded #adminmenu {
	margin-left: -45px;
}

.folded #adminmenu,
.folded #adminmenu li.menu-top {
	width: 28px;
}

#footer {
	clear: both;
	position: relative;
	width: 100%;
}

/* inner 2 column liquid layout */

.inner-sidebar {
	float: right;
	clear: right;
	width: 280px;
	position: relative;
}

.has-sidebar {
	float: left;
	clear: left;
	width: 100%;
	margin-right: -340px;
}

.has-sidebar .has-sidebar-content {
	margin-right: 305px;
}

/* 2 columns main area */

#col-container {
	overflow: hidden;
	padding: 0;
	margin: 0;
}

#col-left {
	padding: 0;
	margin: 0;
	overflow: hidden;
	width: 39%;
}

#col-right {
	float: right;
	clear: right;
	overflow: hidden;
	padding: 0;
	margin: 0;
	width: 59%;
}

/* utility classes */
.alignleft {
	float: left;
}

.alignright {
	float: right;
}

.textleft {
	text-align: left;
}

.textright {
	text-align: right;
}

.clear {
	clear: both;
}

.hidden,
.closed .inside,
.hide-if-no-js {
	display: none;
}

/* include margin and padding in the width calculation of input and textarea */
input[type="text"],
textarea {
	-moz-box-sizing: border-box;
	-webkit-box-sizing: border-box;
	-ms-box-sizing: border-box; /* ie8 only */
	box-sizing: border-box;
}

input[type="checkbox"],
input[type="radio"] {
	vertical-align: text-top;
}

/* styles for use by people extending the WordPress interface */
html,
body {
	height: 100%;
}

body,
td {
	font: 13px "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
}

p {
	margin: 1em 0;
}

blockquote {
	margin: 1em;
}

label {
	cursor: pointer;
}

li,
dd {
	margin-bottom: 6px;
}

p,
li,
dl,
dd,
dt {
	line-height: 140%;
}

textarea,
input,
select {
	font: 13px/19px "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
	margin: 1px;
	padding: 3px;
}

h1 {
  display: block;
  font-size: 2em;
  font-weight: bold;
  margin: .67em 0;
}

h2 {
  display: block;
  font-size: 1.5em;
  font-weight: bold;
  margin: .83em 0;
}

h3 {
  display: block;
  font-size: 1.17em;
  font-weight: bold;
  margin: 1em 0;
}

h4 {
  display: block;
  font-weight: bold;
  margin: 1.33em 0;
}

h5 {
  display: block;
  font-size: 0.83em;
  font-weight: bold;
  margin: 1.67em 0;
}

h6 {
  display: block;
  font-size: 0.67em;
  font-weight: bold;
  margin: 2.33em 0;
}

.subsubsub {
	list-style: none;
	margin: 8px 0 5px;
	padding: 0;
	white-space: nowrap;
	font-size: 11px;
	float: left;
}

.subsubsub a {
	line-height: 2;
	padding: .2em;
	text-decoration: none;
}

.subsubsub a .count, .subsubsub a.current .count {
	color: #999;
	font-weight: normal;
}

.subsubsub a.current {
	font-weight: bold;
	background: none;
	border: none;
}

.subsubsub li {
	display: inline;
	margin: 0;
	padding: 0;
}

.widefat {
	border-width: 1px;
	border-style: solid;
	border-collapse: separate;
	border-spacing: 0;
	width: 100%;
	clear: both;
	margin: 0;
	-moz-border-radius: 4px;
	-khtml-border-radius: 4px;
	-webkit-border-radius: 4px;
	border-radius: 4px;
}

.widefat * {
	word-wrap: break-word;
}

.widefat a {
	text-decoration: none;
}

.widefat td,
.widefat th {
	border-bottom-width: 1px;
	border-bottom-style: solid;
	font-size: 11px;
	vertical-align: text-top;
}

.widefat td {
	padding: 7px 7px 5px;
	vertical-align: top;
}

.widefat thead tr th:first {
	-moz-border-radius-topleft: 4px;
	-webkit-border-top-left-radius: 4px;
	-khtml-border-top-left-radius: 4px;
	border-top-left-radius: 4px;
}

.widefat thead tr th:last {
	-moz-border-radius-topright: 4px;
	-webkit-border-top-right-radius: 4px;
	-khtml-border-top-right-radius: 4px;
	border-top-right-radius: 4px;
}

.widefat tfoot tr th:first {
	-moz-border-radius-bottomleft: 4px;
	-webkit-border-bottom-left-radius: 4px;
	-khtml-border-bottom-left-radius: 4px;
	border-bottom-left-radius: 4px;
}

.widefat tfoot tr th:last {
	-moz-border-radius-bottomright: 4px;
	-webkit-border-bottom-right-radius: 4px;
	-khtml-border-bottom-right-radius: 4px;
	border-bottom-right-radius: 4px;
}

.widefat td p {
	font-size: 11px;
}

.widefat th {
	padding: 7px 7px 8px;
	text-align: left;
	line-height: 1.3em;
}

.widefat th input {
	margin: 0 0 0 8px;
	padding: 0;
	vertical-align: text-top;
}

.widefat .check-column {
	width: 2.2em;
	padding: 0;

}

.widefat tbody th.check-column {
	padding: 7px 0 22px;
}

.widefat .num,
.column-comments,
.column-links,
.column-posts,
.column-parent {
	text-align: center;
}

.widefat th#comments {
	vertical-align: middle;
}

.wrap {
	margin: 0 15px 0 5px;
}

.updated,
.error {
	border-width: 1px;
	border-style: solid;
	padding: 0 0.6em;
	margin: 5px 15px 2px;
	-moz-border-radius: 3px;
	-khtml-border-radius: 3px;
	-webkit-border-radius: 3px;
	border-radius: 3px;
}

.updated p,
.error p {
	margin: 0.5em 0;
	line-height: 1;
	padding: 2px;
}

.wrap .updated,
.wrap .error {
	margin: 5px 0;
}

.wrap h2 {
	font: italic normal normal 24px/29px Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
	margin: 0;
	padding: 14px 15px 3px 0;
	line-height: 35px;
	text-shadow: rgba(255,255,255,1) 0px 1px 0px;
}

.wrap h2.long-header {
	padding-right: 0;
}
                                                                                               wp-admin/css/ie-rtl.css                                                                             0000755 0023422 0004734 00000003362 11117531364 016025  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 * html #wpcontent #adminmenu .wp-has-submenu .wp-menu-toggle {
	background: url(../images/menu-bits-rtl.gif) no-repeat scroll right -109px;
}

* html #wpcontent #adminmenu li.wp-has-current-submenu .wp-menu-toggle {
	background: url(../images/menu-bits-rtl.gif) no-repeat scroll right -206px;
}
* html #adminmenu {
	margin-left:0;
	margin-right: -80px;
}
* html div.folded #adminmenu {
	margin-left: 0;
	margin-right: -22px;
}
#wpcontent #adminmenu .wp-submenu li.wp-submenu-head {
	padding: 3px 10px 4px 4px;
}
.inline-edit-row fieldset label span.title {
	float: right;
}
.inline-edit-row fieldset label span.input-text-wrap {
	margin-right: 0;
}
p.search-box {
	float: left;
}
* html #poststuff h2 {
	margin-right: 0;
}
#bh {
	margin: 7px 10px 0 0;
	float: left;
}
#user_info + div#favorite-actions {
	right: auto;
	left: 15px;
}
#wphead-info {
	float: left;
}
/* without this dashboard widgets appear in one column for some screen widths */
div#dashboard-widgets {
	padding-right: 0;
	padding-left: 1px;
}
#tagchecklist span a {
	margin: 4px -9px 0 0;
}
.widefat th input {
	margin: 0 5px 0 0;
}
/* ---------- add by navid */
#TB_window {
	width: 670px;
	position: absolute;
	top: 50%;
	left: 50%;
	margin-right: 335px !important;
}
#dashboard_plugins {
	direction: ltr;
}
#dashboard_plugins h3.hndle {
	direction: rtl;
}
#dashboard_incoming_links ul li,
#dashboard_secondary ul li,
#dashboard_primary ul li,
p.row-actions {
	width: 100%;
}
#favorite-inside {
	position: absolute;
	right:0;
}
#post-status-info {
	height: 25px;
}
#screen-meta {
	position: static;
}
p.submit { /* quick edit and reply in edit-comments.php */
	height:22px;
}
.inner-sidebar { /* fix edit single comment */
	position: static;
}
form#widgets-filter { /* fix widget page */
	position: static;
}
                                                                                                                                                                                                                                                                              wp-admin/css/ie.css                                                                                 0000755 0023422 0004734 00000012342 11130113044 015206  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 /* Fixes for IE bugs */

input.button,
input.button-secondary,
input.button-highlighted {
	padding: 0;
}

#minor-publishing-actions input,
#major-publishing-actions input,
#minor-publishing-actions .preview {
	min-width: auto;
	padding-left: 0;
	padding-right: 0;
}

#wpbody-content .postbox {
	border: 1px solid #dfdfdf;
}

#wpbody-content .postbox h3 {
	margin-bottom: -1px;
}

* html #side-info-column {
	height: auto;
}

* html #wpbody-content #screen-options-link-wrap {
	display: inline-block;
	width: 150px;
	text-align: center;
}

* html #wpbody-content #contextual-help-link-wrap {
	display: inline-block;
	width: 100px;
	text-align: center;
}

/*
* html body.minwidth {
	_width: expression(document.documentElement.clientWidth < 810 ? "808px" : "99.9%");
}

* html #wpbody {
	_width: expression(document.documentElement.clientWidth > 982 ? "980px" : "99.9%");
}
*/

* html #adminmenu {
	margin-left: -80px;
}

* html div.folded #adminmenu {
	margin-left: -22px;
}

* html #wpcontent #adminmenu li.menu-top {
	display: inline;
	padding: 0;
	margin: 0;
}

#wpcontent.folded #adminmenu li.menu-top {
	display: block;
}

ul#adminmenu {
	z-index: 99;
}

#adminmenu li.menu-top a.menu-top {
	min-width: auto;
	width: auto;
}

#wpcontent #adminmenu li.wp-has-current-submenu a.wp-has-submenu {
	font-style: normal;
}

* html #wpcontent #adminmenu .wp-menu-open .wp-menu-toggle {
	background: none;
}

* html #wpcontent #adminmenu .wp-has-submenu .wp-menu-toggle {
	background: url(../images/menu-bits.gif) no-repeat scroll left -109px;
}

* html #wpcontent #adminmenu li.wp-has-current-submenu .wp-menu-toggle {
	background: url(../images/menu-bits.gif) no-repeat scroll left -206px;
}

* html #adminmenu div.wp-menu-image {
	height: 29px;
}

#wpcontent #adminmenu .wp-submenu li {
	padding: 0;
}

#adminmenu,
.wp-submenu,
.wp-submenu li,
.wp-menu-toggle {
	zoom: 100%;
}

#wpcontent.folded #adminmenu li.wp-menu-separator {
	width: 28px;
}

#wpcontent #adminmenu .wp-submenu li.wp-submenu-head {
	padding: 3px 4px 4px 10px;
	zoom: 100%;
}

#wpcontent.folded #adminmenu .menu-top {
	height: 30px;
}

.folded #adminmenu .wp-submenu {
	margin: -1px 0 0 0;
}

#template,
#template div,
#editcat,
#addcat {
	zoom: 100%;
}

.submitbox {
	margin-top: 10px;
}

/* Inline Editor */
#wpbody-content .quick-edit-row-post .inline-edit-col-left {
	width: 39%;
}

#wpbody-content .inline-edit-row-post .inline-edit-col-center {
	width: 19%;
}

#wpbody-content .quick-edit-row-page .inline-edit-col-left {
	width: 49%;
}

#wpbody-content .bulk-edit-row .inline-edit-col-left {
	width: 29%;
}

.inline-edit-row p.submit {
	zoom: 100%;
}

.inline-edit-row fieldset label span.title {
	display: block;
	float: left;
	width: 5em;
}

.inline-edit-row fieldset label span.input-text-wrap {
	margin-left: 0;
	zoom: 100%;
}

#wpbody-content .inline-edit-row fieldset label span.input-text-wrap input {
	line-height: 130%;
}

#wpbody-content .inline-edit-row .input-text-wrap input {
	width: 95%;
}

#wpbody-content .inline-edit-row .input-text-wrap input.inline-edit-password-input {
	width: 8em;
}
/* end Inline Editor */

input {
	line-height: 1;
}

* html .row-actions {
	visibility: visible;
}

#dashboard-widgets h3 a {
	height: 20px;
	line-height: 20px;
}

#the-comment-list .comment-item,
ul#widget-list li.widget-list-item {
	zoom: 100%;
}

#wphead-info {
	float: right;
}

#titlediv #title {
	width: 98%;
}

a.button {
	line-height: 1.4em;
	margin: 1px;
}

* html div.widget-liquid-left-holder,
* html div.widget-liquid-right {
	display: block;
	position: relative;
}

#screen-options-wrap {
	overflow: hidden;
}

#favorite-actions {
	z-index: 12;
}

#favorite-inside,
#favorite-inside a,
.favorite-action {
	zoom: 100%;
}

#post-status-info,
#wpwrap,
#wpcontent,
#post,
#wrap,
#postdivrich,
#postdiv,
#poststuff,
.metabox-holder,
#titlediv,
#post-body,
#editorcontainer,
.tablenav,
.widget-control-list,
li.widget-list-control-item,
#dragHelper,
li.widget-list-control-item h4,
.widget-sortable,
.widget-control-actions,
#tagchecklist,
#col-container,
#col-left,
#col-right {
	display: block;
	zoom: 100%;
}

p.search-box {
	position: static;
	float: right;
	margin: -3px 0 4px;
}

* html #editorcontainer {
	padding: 0;
}

#editorcontainer #content {
	overflow: auto;
	margin: auto;
	width: 98%;
}

form#template div {
	width: 100%;
}

#ed_toolbar input,
#ed_reply_toolbar input {
	overflow: visible;
	padding: 0 4px;
}

#poststuff h2 {
	font-size: 1.6em;
}

* html #poststuff h2 {
	margin-left: 0;
}

#bh {
	margin: 7px 10px 0 0;
	float: right;
}

/* without this dashboard widgets appear in one column for some screen widths */
div#dashboard-widgets {
	padding-right: 1px;
}

#tagchecklist span, #tagchecklist span a {
	display: inline-block;
	display: block;
}

#tagchecklist span a {
	margin: 4px 0 0 -9px;
}

.tablenav .button-secondary, .nav .button-secondary {
	padding: 0 1px;
	vertical-align: middle;
}

.tablenav select {
	font-size: 13px;
	display: inline-block;
	vertical-align: top;
	margin-top: 2px;
}

table.ie-fixed {
	table-layout: fixed;
}

.widefat tr, .widefat th {
	margin-bottom: 0;
	border-spacing: 0;
}

.widefat th input {
	margin: 0 0 0 5px;
}

.widefat .check-column {
	padding: 6px 0 2px;
}

.widefat tbody th.check-column {
	padding: 4px 0 22px;
}

.tablenav a.button-secondary {
	display: inline-block;
	padding: 2px 5px;
}
                                                                                                                                                                                                                                                                                              wp-admin/css/install-rtl.css                                                                        0000755 0023422 0004734 00000000443 11103734150 017064  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 body {
	font-family: Tahoma, arial;
}
h1 {
	font-family: arial;
	margin: 5px -4px 0 0;
}
ul, ol { padding: 5px 22px 5px 5px; }
.step, th { text-align: right; }
.submit input, .button, .button-secondary {
	font-family: Tahoma, arial;
	margin-right:0;
}
.form-table th {
	text-align: right;
}
                                                                                                                                                                                                                             wp-admin/css/install.css                                                                            0000755 0023422 0004734 00000004770 11115034212 016267  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 html { background: #f7f7f7; }

body {
	background: #fff;
	color: #333;
	font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
	margin: 2em auto 0 auto;
	width: 700px;
	padding: 1em 2em;
	-moz-border-radius: 11px;
	-khtml-border-radius: 11px;
	-webkit-border-radius: 11px;
	border-radius: 11px;
	border: 1px solid #dfdfdf;
}

a { color: #2583ad; text-decoration: none; }

a:hover { color: #d54e21; }

h1 {
	border-bottom: 1px solid #dadada;
	clear: both;
	color: #666;
	font: 24px Georgia, "Times New Roman", Times, serif;
	margin: 5px 0 0 -4px;
	padding: 0;
	padding-bottom: 7px;
}

h2 { font-size: 16px; }

p, li {
	padding-bottom: 2px;
	font-size: 12px;
	line-height: 18px;
}

code { font-size: 13px; }

ul, ol { padding: 5px 5px 5px 22px; }

#logo { margin: 6px 0 14px 0; border-bottom: none;}

.step {
	margin: 20px 0 15px;
}

.step, th { text-align: left; padding: 0; }

.submit input, .button, .button-secondary {
	font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
	text-decoration: none;
	font-size: 14px !important;
	line-height: 16px;
	padding: 6px 12px;
	cursor: pointer;
	border: 1px solid #bbb;
	color: #464646;
	-moz-border-radius: 15px;
	-khtml-border-radius: 15px;
	-webkit-border-radius: 15px;
	border-radius: 15px;
	-moz-box-sizing: content-box;
	-webkit-box-sizing: content-box;
	-khtml-box-sizing: content-box;
	box-sizing: content-box;
}

.button:hover, .button-secondary:hover, .submit input:hover {
	color: #000;
	border-color: #666;
}

.button, .submit input, .button-secondary {
	background: #f2f2f2 url(../images/white-grad.png) repeat-x scroll left top;
}

.button:active, .submit input:active, .button-secondary:active {
	background: #eee url(../images/white-grad-active.png) repeat-x scroll left top;
}

.form-table {
	border-collapse: collapse;
	margin-top: 1em;
	width: 100%;
}

.form-table td {
	margin-bottom: 9px;
	padding: 10px;
	border-bottom: 8px solid #fff;
	font-size: 12px;
}

.form-table th {
	font-size: 13px;
	text-align: left;
	padding: 16px 10px 10px 10px;
	border-bottom: 8px solid #fff;
	width: 110px;
	vertical-align: top;
}

.form-table tr {
	background: #f3f3f3;
}

.form-table code {
	line-height: 18px;
	font-size: 18px;
}

.form-table p {
	margin: 4px 0 0 0;
	font-size: 11px;
}

.form-table input {
	line-height: 20px;
	font-size: 15px;
	padding: 2px;
}

#error-page { margin-top: 50px; }

#error-page p {
	font-size: 12px;
	line-height: 18px;
	margin: 25px 0 20px;
}

#error-page code { font-family: Consolas, Monaco, Courier, monospace; }
        wp-admin/css/login-rtl.css                                                                          0000755 0023422 0004734 00000000714 11117526244 016537  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 body {
	font-family: Tahoma, arial;
}
form {
	margin-right: 8px;
	margin-left: 0;
}
form .forgetmenot {
	float: right;
}
#login form .submit input {
	font-family: Tahoma, arial;
}
form .submit { float: left; }
#backtoblog a {
	left: auto;
	right: 15px;
}
#login_error, .message {
	margin: 0 8px 16px 0;
}
#nav { margin: 0 8px 0 0; }
#user_pass, #user_login, #user_email {
	margin-left: 6px;
	margin-right: 0;
	direction:ltr;
}
h1 a {
	text-decoration: none;
}
                                                    wp-admin/css/login.css                                                                              0000755 0023422 0004734 00000004132 11115034212 015721  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 * { margin: 0; padding: 0; }

body {
	border-top-width: 30px;
	border-top-style: solid;
	font: 11px "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
}

form {
	margin-left: 8px;
	padding: 16px 16px 40px 16px;
	font-weight: normal;
	-moz-border-radius: 11px;
	-khtml-border-radius: 11px;
	-webkit-border-radius: 11px;
	border-radius: 5px;
	background: #fff;
	border: 1px solid #e5e5e5;
	-moz-box-shadow: rgba(200,200,200,1) 0 4px 18px;
	-webkit-box-shadow: rgba(200,200,200,1) 0 4px 18px;
	-khtml-box-shadow: rgba(200,200,200,1) 0 4px 18px;
	box-shadow: rgba(200,200,200,1) 0 4px 18px;
}

form .forgetmenot { font-weight: normal; float: left; margin-bottom: 0; }

#login form .submit input {
	font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
	padding: 3px 10px;
	border: none;
	font-size: 12px;
	border-width: 1px;
	border-style: solid;
	-moz-border-radius: 11px;
	-khtml-border-radius: 11px;
	-webkit-border-radius: 11px;
	border-radius: 11px;
	cursor: pointer;
	text-decoration: none;
	margin-top: -3px;
	text-shadow: rgba(0,0,0,0.3) 0 -1px 0;
}

#login form p {
	margin-bottom: 0;
}

label {
	color: #777;
	font-size: 13px;
}

form .forgetmenot label {
	font-size: 11px;
	line-height: 19px;
}

form .submit { float: right; }

form p { margin-bottom: 24px; }

h1 a {
	background: url(../images/logo-login.gif) no-repeat top center;
	width: 326px;
	height: 67px;
	text-indent: -9999px;
	overflow: hidden;
	padding-bottom: 15px;
	display: block;
}

#nav {
	text-shadow: rgba(255,255,255,1) 0 1px 0;
}

#backtoblog a {
	position: absolute;
	top: 7px;
	left: 15px;
	text-decoration: none;
}

#login { width: 320px; margin: 7em auto; }

#login_error, .message {
	margin: 0 0 16px 8px;
	border-width: 1px;
	border-style: solid;
	padding: 12px;
	-moz-border-radius: 3px;
	-khtml-border-radius: 3px;
	-webkit-border-radius: 3px;
	border-radius: 3px;
}

#nav { margin: 0 0 0 8px; padding: 16px; }

#user_pass, #user_login, #user_email {
	font-size: 24px;
	width: 97%;
	padding: 3px;
	margin-top: 2px;
	margin-right: 6px;
	margin-bottom: 16px;
	border: 1px solid #e5e5e5;
	background: #fbfbfb;
}
                                                                                                                                                                                                                                                                                                                                                                                                                                      wp-admin/css/media-rtl.css                                                                          0000755 0023422 0004734 00000003223 11117531364 016503  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 body#media-upload ul#sidemenu {
	left: auto;
	right: 0;
}
#search-filter {
	text-align: left;
}
/* specific to the image upload form */
.align .field label {
	padding: 0 28px 0 0;
	margin: 0 0 0 1em;
}
.image-align-none-label, .image-align-left-label, .image-align-center-label, .image-align-right-label {
	background-position: center right;
}
tr.image-size div.image-size-item {
	float: right;
}
tr.image-size label {
	margin: 0 1em 0 0;
}
.filename.original {
	float: right;
}
.crunching {
	text-align: left;
	margin-right: 0;
	margin-left: 5px;
}
button.dismiss {
	right: auto;
	left: 5px;
}
.file-error {
	margin: 0 50px 5px 0;
}
.progress {
	left: auto;
	right: 0;
}
.describe td {
	padding: 0 0 0 5px;
}
.bar {
	border-right-width: 0;
	border-left-width: 3px;
	border-right-style: none;
	border-left-style: solid;
}
.media-item .pinkynail {
	float: right;
}
.describe-toggle-on,
.describe-toggle-off {
	float: left;
	margin-right: 0;
	margin-left: 20px;
}
/* Specific to Uploader */
#media-upload .media-upload-form p {
	margin: 0 0 1em 1em;
}
.filename {
	float: right;
	margin-left: 0;
	margin-right: 10px;
}
#media-upload .describe th.label {
	text-align: right;
}
.menu_order {
	float: left;
}
.media-upload-form label.form-help, td.help, #media-upload p.help, #media-upload label.help {
	font-family: Tahoma, Arial;
}
#gallery-settings #basic th.label {
	padding: 5px 0 5px 5px;
}
#gallery-settings .title, h3.media-title {
	font-family: Tahoma, Arial;
}
#gallery-settings .describe th.label {
	text-align: right;
}
#gallery-settings label,
#gallery-settings legend {
	margin-right: 0;
	margin-left: 15px;
}
#gallery-settings .align .field label {
	margin: 0 0 0 1.5em;
}
                                                                                                                                                                                                                                                                                                                                                                             wp-admin/css/media.css                                                                              0000755 0023422 0004734 00000014316 11117563736 015721  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 div#media-upload-header {
	margin: 0;
	padding: 0 5px;
	font-weight: bold;
	position: relative;
	border-bottom-width: 1px;
	border-bottom-style: solid;
	height: 2.5em;
}

body#media-upload ul#sidemenu {
	font-weight: normal;
	margin: 0 5px;
	position: absolute;
	left: 0px;
	bottom: -1px;
}

div#media-upload-error {
	margin: 1em;
	font-weight: bold;
}

form {
	margin: 1em;
}

#search-filter {
	text-align: right;
}

.media-upload-form label,
.media-upload-form legend {
	display: block;
	font-weight: bold;
	font-size: 13px;
	margin-bottom: 0.5em;
	margin: 0 0 0.5em 0;
}

th {
	position: relative;
}

.media-upload-form label.form-help, td.help {
	font-family: "Lucida Grande", "Bitstream Vera Sans", Verdana, Arial, sans-serif;
	font-style: italic;
	font-weight: normal;
}

.media-upload-form p.help {
	margin: 0;
	padding: 0;
}

.media-upload-form fieldset {
	width: 100%;
	border: none;
	text-align: justify;
	margin: 0 0 1em 0;
	padding: 0;
}

/* specific to the image upload form */
.align .field label {
	display: inline;
	padding: 0 0 0 28px;
	margin: 0 1em 0 0;
}

.image-align-none-label {
	background: url(../images/align-none.png) no-repeat center left;
}

.image-align-left-label {
	background: url(../images/align-left.png) no-repeat center left;
}

.image-align-center-label {
	background: url(../images/align-center.png) no-repeat center left;
}

.image-align-right-label {
	background: url(../images/align-right.png) no-repeat center left;
}

tr.image-size td {
	width: 460px;
}

tr.image-size div.image-size-item {
	float: left;
	width: 25%;
	margin: 0;
}

tr.image-size label {
	display: inline;
	margin: 0 0 0 1em;
}

.pinkynail {
	max-width: 40px;
	max-height: 40px;
}

.filename.original {
	float: left;
}

.crunching {
	display: block;
	line-height: 32px;
	text-align: right;
	margin-right: 5px;
}

button.dismiss {
	position: absolute;
	top: 7px;
	right: 5px;
	z-index: 4;
	width: 8em;
}

.file-error {
	float: left;
	font-weight: bold;
	padding: 10px;
}

.progress {
	position: absolute;
	top: 0;
	left: 0;
	width: 623px;
	height: 36px;
}

.bar {
	width: 0;
	height: 100%;
	border-right-width: 3px;
	border-right-style: solid;
}

#library-form .progress,
#gallery-form .progress,
#flash-upload-ui,
.insert-gallery,
.describe.startopen,
.describe.startclosed {
	display: none;
}

.media-item .thumbnail {
	max-width: 128px;
	max-height: 128px;
}

.media-item .pinkynail {
	float: left;
	margin: 2px;
	height: 32px;
	max-width: 40px;
}

thead.media-item-info tr {
	background-color: transparent;
}

thead.media-item-info th,
thead.media-item-info td {
	border: none;
	margin: 0;
}

.form-table thead.media-item-info {
	border: 8px solid #fff;
}

abbr.required {
	text-decoration: none;
	border: none;
}

.describe label {
	display: inline;
}

.describe td {
	vertical-align: middle;
	padding: 0 5px 0 0;
}

.describe td.A1 {
	width: 132px;
}

.describe input[type="text"],
.describe textarea {
	width: 460px;
	border-width: 1px;
	border-style: solid;
}

.describe-toggle-on,
.describe-toggle-off {
	display: block;
	line-height: 36px;
	float: right;
	margin-right: 20px;
}

.describe-toggle-off {
	display: none;
}

.hidden {
	height: 0;
	width: 0;
	overflow: hidden;
	border: none;
}

/* Specific to Uploader */

#media-upload .media-upload-form p {
	margin: 0 1em 1em 0;
}

#media-upload .media-upload-form p.ml-submit {
	padding: 1em 0;
}

#media-upload p.help,
#media-upload label.help {
	font-family: "Lucida Grande", "Bitstream Vera Sans", Verdana, Arial, sans-serif;
	font-style: italic;
	font-weight: normal;
}

#media-upload tr.image-size td.field {
	text-align: center;
}

#media-upload #media-items {
	border-width: 1px;
	border-style: solid;
	border-bottom: none;
	width: 623px;
}

#media-upload .media-item {
	position: relative;
	border-bottom-width: 1px;
	border-bottom-style: solid;
	min-height: 36px;
	width: 100%;
}

#media-upload .ui-sortable .media-item {
	cursor: move;
}

.filename {
	float: left;
	line-height: 36px;
	margin-left: 10px;
	overflow: hidden;
	max-width: 430px;
}

#media-upload .describe {
	padding: 5px;
	width: 100%;
	clear: both;
	cursor: default;
}

#media-upload .slidetoggle {
	border-top-width: 1px;
	border-top-style: solid;
}

#media-upload .describe th.label {
	padding-top: .5em;
	text-align: left;
	min-width: 120px;
}

#media-upload tr.align td.field {
	text-align: center;
}

#media-upload tr.image-size {
	margin-bottom: 1em;
	height: 3em;
}

#media-upload #filter {
	width: 623px;
}

#media-upload #filter .subsubsub {
	margin: 8px 0;
}

#filter .tablenav select {
	border-style: solid;
	border-width: 1px;
	padding: 2px;
	vertical-align: top;
	width: auto;
}

#media-upload a.delete,
#media-upload a.del-link {
	padding: 0 3px 1px;
}

#media-upload .del-attachment {
	display: none;
	margin: 5px 0;
}

.menu_order {
	float: right;
	font-size: 11px;
	margin: 10px 10px 0;
}

.menu_order_input {
	border: 1px solid #ddd;
	font-size: 10px;
	padding: 1px;
	width: 23px;
}

.ui-sortable-helper {
	background-color: #fff;
	border: 1px solid #aaa;
	opacity: 0.6;
	filter: alpha(opacity=60);
}

#media-upload th.order-head {
	width: 25%;
	text-align: center;
}

#media-upload .widefat {
	width: 626px;
	border-style: solid solid none;
}

.sorthelper {
	z-index: -1;
}

#gallery-settings th.label {
	width: 160px;
}

#gallery-settings #basic th.label {
	padding: 5px 5px 5px 0;
}

#gallery-settings .title {
	clear: both;
	padding: 0 0 3px;
	border-bottom-style: solid;
	border-bottom-width: 1px;
	font-family: Georgia,"Times New Roman",Times,serif;
	font-size: 1.6em;
	border-bottom-color: #DADADA;
	color: #5A5A5A;
}

h3.media-title  {
	color: #5A5A5A;
	font-family: Georgia,"Times New Roman",Times,serif;
	font-size: 1.6em;
	font-weight: normal;
}

#gallery-settings .describe td {
	vertical-align: middle;
	height: 3.5em;
}

#gallery-settings .describe th.label {
	padding-top: .5em;
	text-align: left;
}

#gallery-settings .describe {
	padding: 5px;
	width: 615px;
	clear: both;
	cursor: default;
}

#gallery-settings .describe select {
	width: 15em;
	border: 1px solid #dfdfdf;
}

#gallery-settings label,
#gallery-settings legend {
	font-size: 13px;
	color: #464646;
	margin-right: 15px;
}

#gallery-settings .align .field label {
	margin: 0 1.5em 0 0;
}

#gallery-settings p.ml-submit {
	border-top: 1px solid #dfdfdf;
}

#gallery-settings select#columns {
	width: 6em;
}
                                                                                                                                                                                                                                                                                                                  wp-admin/css/theme-editor-rtl.css                                                                   0000755 0023422 0004734 00000000240 11103734150 017777  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 #templateside {
	float: left;
}
#themeselector {
	padding-right: 0;
	padding-left: 5px;
	float: left;
}
div.tablenav {
	margin-right: 0;
	margin-left: 210px;
}
                                                                                                                                                                                                                                                                                                                                                                wp-admin/css/theme-editor.css                                                                       0000755 0023422 0004734 00000001441 11113505074 017206  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 #template textarea {
	font-family: Consolas, Monaco, Courier, monospace;
	font-size: 12px;
	width: 97%;
}

#template p {
	width: 97%;
}

#templateside {
	float: right;
	width: 190px;
}

#templateside h3, #postcustomstuff p.submit {
	margin: 0;
}

h3#bordertitle {
	margin-bottom: 10px;
}

#templateside h4 {
	margin-bottom: 0;
}

#templateside ol, #templateside ul {
	list-style: none;
	margin: .5em;
	padding: 0;
}

#templateside ol li, #templateside ul li {
	margin: 1px 0;
}

#themeselector {
	padding-right: 5px;
	float: right;
	position: relative;
	bottom: 25px;
	top:20px;
}

#themeselector select {
	margin: 0;
	padding: 0;
}

.nonessential {
	font-size: small;
}

.highlight {
	padding: 1px;
}

div.bordertitle h2 {
	border: none;
	padding-bottom: 0;
}

div.tablenav {
	margin-right: 210px;
}
                                                                                                                                                                                                                               wp-admin/css/upload-rtl.css                                                                         0000755 0023422 0004734 00000000203 10771235414 016705  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 html {
	direction: ltr;
	}
#uploadoptions, table {
	direction: rtl;
	}
td {
	padding: 1px 6px 0;
	}
.submit {
	text-align: left;
	}                                                                                                                                                                                                                                                                                                                                                                                             wp-admin/css/widgets-rtl.css                                                                        0000755 0023422 0004734 00000001117 11117526244 017073  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 h4.widget-title span {
	float: right;
}
h4.widget-title a {
	float: left;
	margin-left: 0;
	margin-right: 1em;
}
ul#widget-list li.widget-list-item h4.widget-title {
	float: right;
}
ul#widget-list li.widget-list-item div.widget-description {
	margin: 0 200px 0 0;
	padding: 0 4em 0 0;
}
.widget-control-save,
.widget-control-remove {
	margin-right: 0;
	margin-left: 8px;
	float: right;
}
li.widget-list-control-item h4.widget-title a,
#dragHelper li.widget-list-control-item h4.widget-title a,
#draghelper li.widget-list-control-item h4.widget-title a:visited {
	right: auto;
	left: 1em;
}
                                                                                                                                                                                                                                                                                                                                                                                                                                                 wp-admin/css/widgets.css                                                                            0000755 0023422 0004734 00000005721 11113746712 016301  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 /* 2 column liquid layout */
div.widget-liquid-left-holder {
	float: left;
	clear: left;
	width: 100%;
	margin-right: -310px;
}

div.widget-liquid-left {
	margin-right: 320px;
}

div.widget-liquid-right {
	float: right;
	clear: right;
	width: 300px;
	position: relative;
}

/* pasitioning etc. */
form#widgets-filter {
	position: relative;
}

div#available-widgets-filter {
	border-bottom-width: 1px;
	border-bottom-style: solid;
}

ul#widget-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

ul#widget-list li.widget-list-item {
	padding: .7em 0.9em;
	margin: 0;
	border-bottom-width: 1px;
	border-bottom-style: solid;
	line-height: 1;
}

h4.widget-title span {
	float: left;
}

h4.widget-title a {
	float: right;
	text-decoration: underline;
	border-bottom: none;
	margin-left: 1em;
}

ul#widget-list li.widget-list-item h4.widget-title {
	position: relative;
	margin: 0;
	padding: .5em 1em;
	width: 200px;
	float: left;
	font-size: 13px;
	-moz-border-radius: 3px;
	-khtml-border-radius: 3px;
	-webkit-border-radius: 3px;
	border-radius: 3px;
}

#dragHelper h4.widget-title {
	padding: .5em 1em;
	margin: 0;
}

ul#widget-list li.widget-list-item div.widget-description {
	display: block;
	margin: 0 0 0 200px;
	padding: 0 0 0 4em;
	font-size: 11px;
}

ul#widget-list li.widget-list-item ul.widget-control-info {
	display: none;
}

div#sidebar-info {
	padding: 0 1em;
	margin-bottom: 1em;
	font-size: 11px;
}

ul.widget-control-list {
	list-style: none;
	margin: 0;
	padding: 0 1em;
}

div#current-widgets p.submit {
	padding: 1em;
}

li.widget-list-control-item {
	margin: 1em 0;
	-moz-border-radius: 3px;
	-khtml-border-radius: 3px;
	-webkit-border-radius: 3px;
	border-radius: 3px;
}

li.widget-list-control-item h4,
#dragHelper li.widget-list-control-item h4,
li.widget-sortable h4 {
	margin: 0;
	cursor: move;
	font-size: 13px;
	padding: 0.4em 0.8em;
	position: relative;
	-moz-border-radius: 3px;
	-khtml-border-radius: 3px;
	-webkit-border-radius: 3px;
	border-radius: 3px;
}

.widget-control-save,
.widget-control-remove {
	margin-right: 8px;
	float: left;
	text-decoration: none;
}

li.widget-list-control-item h4.widget-title a,
#dragHelper li.widget-list-control-item h4.widget-title a,
#draghelper li.widget-list-control-item h4.widget-title a:visited {
	right: 1em;
}

li.widget-list-control-item h4.widget-title a:hover {
	text-decoration: none;
	border-bottom: none;
}

li.widget-list-control-item div.widget-control {
	border-width: 0 1px 1px;
	border-style: none solid solid;
	display: none;
	padding: 15px;
	font-size: 11px;
	position: relative;
}

li.widget-list-control-item div.widget-control p {
	margin: 0 0 1em;
	padding: 0;
}

ul.widget-control-list div.widget-control-actions {
	padding: 0.5em 0 0;
}

.widget-control-edit {
	font-size: 10px;
	font-weight: normal;
}

div#current-widgets {
	padding-top: 1em;
	border-width: 1px 0 0;
	border-style: solid none none;
}

#widget-controls .widefat {
	width: 92%;
	padding: 3px;
}

#widget-controls select.widefat {
	width: auto;
	display: block;
}
                                               wp-admin/css/global-rtl.css                                                                         0000755 0023422 0004734 00000002126 11116025722 016660  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 /* 2 column liquid layout */
#adminmenu {
	float: right;
	clear: right;
	margin-right:-160px;
	margin-left: 5px;
}
div.folded #adminmenu {
	margin-left: 0;
	margin-right: -45px;
}
/* inner 2 column liquid layout */
.inner-sidebar {
	float: left;
	clear: left;
}
.has-sidebar {
	float: right;
	clear: right;
	margin-right: 0;
	margin-left: -340px;
}
.has-sidebar .has-sidebar-content {
	margin-right: 0;
	margin-left: 305px;
}
#wpbody {
	margin-left:0;
	margin-right: 175px;
}
.folded #wpbody {
	margin-left: 0;
	margin-right: 60px;
}
#wpbody-content {
	float: right;
}
/* 2 columns main area */
#col-right {
	float: left;
	clear: left;
}
.wrap {
	margin: 0 5px 0 15px;
}
/* styles for use by people extending the WordPress interface */
body, td, textarea, input, select {
	font-family: Tahoma, arial;
}
.alignleft {
	float: right;
}
.alignright {
	float: left;
}
.subsubsub {
	float: right;
}
.widefat th {
	text-align: right;
}
.widefat th input {
	margin: 0 8px 0 0;
}
.wrap h2 {
	font-family: arial;
	padding: 14px 0 3px 15px;
}
.wrap h2.long-header {
	padding-left: 0;
}
.updated, .error {
	clear: both;
}
                                                                                                                                                                                                                                                                                                                                                                                                                                          wp-admin/css/press-this-ie-rtl.css                                                                  0000755 0023422 0004734 00000000044 11050373536 020117  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 .ui-tabs-nav {
 	margin-right: 0;
}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            wp-admin/css/press-this-ie.css                                                                      0000755 0023422 0004734 00000000150 11052304632 017307  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 #posting {
 	position: static !important;
}
 .ui-tabs-nav {
 	margin-left: 0;
 	border: 0 !important;
}
                                                                                                                                                                                                                                                                                                                                                                                                                        wp-admin/css/press-this-rtl.css                                                                     0000755 0023422 0004734 00000003046 11116025722 017523  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 body {
	font-family: Tahoma, Arial;
}
#poststuff #edButtonPreview,
#poststuff #edButtonHTML {
	margin: 0px 0 0 5px;
	float: right;
}
/* Editor/Main Column */
div#poststuff {
	padding-left: 0;
	padding-right: 10px;
}
.posting {
	margin-right: 0;
	margin-left: 228px;
	left:auto;
	right: 0;
}
#side-info-column {
	float: left;
	right: auto;
	left: 0;
	margin-right: 0;
	margin-left: 10px;
}
#side-info-column .sleeve {
	padding-left: 0;
	padding-right: 10px;
}
h3.tb {
	margin-left: 0;
	margin-right: 5px;
}
#actions {
	float: left;
}
#extra_fields #actions {
	right: auto;
	left: 4px;
}
#actions li {
	float: right;
	margin-right: 0;
	margin-left: 10px;
}
#extra_fields .button {
	margin-right: 0;
	margin-left: 5px;
}
/* Photo Styles */
#img_container a {
	float: right;
}
#category-add input, #category-add select {
	font-family: Tahoma, Arial;
}
#categorydiv ul.categorychecklist ul {
	margin-left: 0;
	margin-right: 18px;
}
/* Tags */
#tagsdiv #newtag {
	margin-right: 0;
	margin-left: 5px;
}
#tagadd {
	margin-left: 0;
	margin-right: 3px;
}
#tagchecklist span {
	margin-left: .5em;
	margin-right: 10px;
	float: right;
}
#tagchecklist span a {
	margin: 6px -9px 0 0;
	float: right;
}
#content {
	margin-left: 0;
	margin-right: 1%;
}
.submit input,
.button,
.button-primary,
.button-secondary,
.button-highlighted,
#postcustomstuff .submit input {
	font-family: tahoma;
}
.ac_results li {
	text-align: right;
}
#TB_ajaxContent #options {
	right: auto;
	left: 25px;
}
#post_status {
	margin-left: 0;
	margin-right: 10px;
}
/* Footer */
#footer {
	padding: 10px 60px 0 0;
}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          wp-admin/css/press-this.css                                                                         0000755 0023422 0004734 00000020734 11122513642 016727  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 body {
	font: 13px "Lucida Grande", "Bitstream Vera Sans", Verdana, Arial, sans-serif;
	color: #333;
	margin: 0;
	padding: 0;
}

img {
	border: none;
}

/* Header */
#wphead {
	border-top: none;
	padding-top: 4px;
	background: #444 !important;
}

#poststuff #edButtonPreview,
#poststuff #edButtonHTML {
	-moz-border-radius-bottomleft: 0;
	-moz-border-radius-bottomright: 0;
	-moz-border-radius-topleft: 3px;
	-moz-border-radius-topright: 3px;
	-khtml-border-radius-bottomleft: 0;
	-khtml-border-radius-bottomright: 0;
	-khtml-border-radius-topleft: 3px;
	-khtml-border-radius-topright: 3px;
	-webkit-border-radius-bottomleft: 0;
	-webkit-border-radius-bottomright: 0;
	-webkit-border-radius-topleft: 3px;
	-webkit-border-radius-topright: 3px;
	border-radius-bottomleft: 0;
	border-radius-bottomright: 0;
	border-radius-topleft: 3px;
	border-radius-topright: 3px;
	border-style: solid;
	border-width: 1px;
	cursor: pointer;
	display: block;
	height: 18px;
	margin: 0px 5px 0 0;
	padding: 0px 5px 0px;
	background-color: #E9E9E9;
	border-bottom-color: #E9E9E9;
	color: #333333;
	font-size: 10px;
	line-height: 18px;
	float: left;
}

.howto {
	margin-top: 2px;
	margin-bottom: 3px;
	font-size: 11px;
	font-style: italic;
	display: block;
}

input.text {
	outline-color: -moz-use-text-color;
	outline-style: none;
	outline-width: medium;
	width: 100%;
}

#message {
	-moz-border-radius: 6px;
	-khtml-border-radius: 6px;
	-webkit-border-radius: 6px;
	border-radius: 6px;
}

/* Editor/Main Column */
div#poststuff {
	padding-left: 10px;
	margin-top: 10px;
}

div.zerosize {
	border: 0 none;
	height: 0;
	margin: 0;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 0;
}

#poststuff #edButtonPreview.active,
#poststuff #edButtonHTML.active {
	display: none;
}

.posting {
	margin-right: 228px;
	position: relative;
	left: 0;
}

#side-info-column {
	float: right;
	width: 218px;
	position: absolute;
	right: 0;
	margin-right: 10px;
}

#side-info-column .sleeve {
	padding-left: 10px;
}

#poststuff .inside {
	font-size: 11px;
	margin: 0 12px 12px;
}

#poststuff h2, #poststuff h3 {
	font-size: 14px;
	font-weight: bold;
	padding: 7px;
	margin: 0 0 10px;
	background: #dfdfdf url("../images/gray-grad.png") repeat-x left top;
	font-size: 12px;
	font-weight: bold;
	line-height: 1;
	margin: 0 0 10px;
	padding: 7px 9px;
	text-shadow: 0 1px 0 #FFFFFF;
}

h3.tb {
	text-shadow: 0 1px 0 #FFFFFF;
	font-weight: bold;
	font-size: 12px;
	margin-left: 5px;
}

#TB_window {
	border: 1px solid #333;
	-moz-border-radius: 6px;
	-khtml-border-radius: 6px;
	-webkit-border-radius: 6px;
	border-radius: 6px;
}

.metabox-holder .postbox,
.postbox,
.stuffbox {
	margin-bottom: 10px;
	border-width: 1px;
	border-style: solid;
	line-height: 1;
	-moz-border-radius: 6px;
	-khtml-border-radius: 6px;
	-webkit-border-radius: 6px;
	border-radius: 6px;
	border-color: #DFDFDF;
}

.titlediv {
	border-color: #DFDFDF;
}

#title, .tbtitle {
	-moz-border-radius: 6px;
	-khtml-border-radius: 6px;
	-webkit-border-radius: 6px;
	border-radius: 6px;
	border-style: solid;
	border-width: 1px;
	font-size: 1.7em;
	outline: none;
	padding: 3px 4px;
	border-color: #DFDFDF;
}

.tbtitle {
	font-size: 12px;
	padding: 3px;
}

#title {
	width: 98%;
}

.postbox h2 {
	background-image: url(../images/postbox-bg.gif);
	background-position: left top;
	background-repeat: repeat-x;
	background-color: #DFDFDF;
}

.editor-container {
	-moz-border-radius: 6px;
	-khtml-border-radius: 6px;
	-webkit-border-radius: 6px;
	border-radius: 6px;
	border-collapse: separate;
	border-style: solid;
	border-width: 1px;
	border-color: #DFDFDF;
}

.postdivrich {
	position: relative;
	padding-top: 25px;
}

#actions {
	clear: both;
	float: right;
	margin-top: -19px;
	position: relative;
}
#extra_fields #actions {
	clear: both;
	position: absolute;
	right: 4px;
	top: 6px;
	margin: 0;
}

#actions li {
	float: left;
	list-style: none;
	margin-right: 10px;
}
#extra_fields .button {
	margin-right: 5px;
}

/* Photo Styles */
.photolist {
	margin-top: -10px;
}

#photo_saving {
	margin: 0 8px 8px;
	vertical-align: middle;
}

#img_container {
	background-color: #fff;
	height: 101px;
	width: 100%;
}

#extra_fields {
	margin-top: 10px;
	position: relative;
}

#extra_fields .postbox {
	margin-bottom: 5px;
}

#extra_fields .titlewrap {
	padding: 0;
	overflow: auto;
	height: 100px;
}

#img_container {
	position: relative;
}

#img_container a {
	display: block;
	float: left;
	overflow: hidden;
	vertical-align: center;
}

#img_container img, #img_container a {
	width: 68px;
	height: 68px;
}

#img_container img {
	width: 68px;
	height: 68px;
	border: none;
	background-color: #f4f4f4;
	cursor: pointer;
}

#img_container a,
#img_container a:link,
#img_container a:visited {
	border: 1px solid #ccc;
	display: block;
	position: relative;
}

#img_container a:hover,
#img_container a:active {
	border-color: #000;
	z-index: 1000;
	border-width: 2px;
	margin: -1px;
}

/* Video */
#embed-code {
	width: 100%;
	height: 98px;
}

/* Submit Column */
#viewsite {
	padding: 0;
	margin: 0 0 20px 0;
	font-size: 10px;
	clear: both;
}

#viewsite .button {
	margin: 0 0 0px 0;
	display: block;
}

.wp-hidden-children .wp-hidden-child {
	display: none;
}

#category-adder {
	padding: 4px 0;
}

#category-adder h4 {
	margin: 0 0 8px;
}

#category-add input {
	width: 94%;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 13px;
	margin: 1px;
	padding: 3px;
}

#category-add select {
	width: 70%;
	-x-system-font: none;
	border-style: solid;
	border-width: 1px;
	font-family: "Lucida Grande", "Bitstream Vera Sans", Verdana, Arial, sans-serif;
	font-size: 12px;
	height: 2em;
	line-height: 20px;
	padding: 2px;
	margin: 1px;
	vertical-align: top;
}

#category-add input#category-add-sumbit {
	width: auto;
}

/* Categories */
#categorydiv ul, #linkcategorydiv ul {
	list-style: none;
	padding: 0;
	margin: 0;
}

#categorydiv ul.categorychecklist ul {
	margin-left: 18px;
}

#categorydiv div.ui-tabs-panel {
	height: 150px;
	overflow: auto;
}

ul.categorychecklist li {
	margin: 0;
	padding: 0;
	line-height: 19px;
}

/* Tags */
#tagsdiv #newtag {
	padding: 3px;
	margin-right: 5px;
	width: 16em;
}

#jaxtag {
	clear: both;
	margin: 0;
}

#tagadd {
	margin-left: 3px;
}

#tagchecklist {
	margin-top: 3px;
	margin-bottom: 1em;
	font-size: 12px;
	overflow: auto;
}

#tagchecklist strong {
	position: absolute;
	font-size: .75em;
}

#tagchecklist span {
	margin-right: .5em;
	margin-left: 10px;
	display: block;
	float: left;
	font-size: 11px;
	line-height: 1.8em;
	white-space: nowrap;
	cursor: default;
}

#tagchecklist span a {
	margin: 6px 0 0 -9px;
	cursor: pointer;
	width: 10px;
	height: 10px;
	display: block;
	float: left;
	text-indent: -9999px;
	overflow: hidden;
	position: absolute;
}

#content {
	width: 96% !important;
	margin-left: 1%;
	margin-bottom: 10px;
	border: 1px solid #f1f1f1;
}

/* Submit */

#saving {
	display: inline;
}

.submit input,
.button,
.button-primary,
.button-secondary,
.button-highlighted,
#postcustomstuff .submit input {
	font-family: "Lucida Grande", "Bitstream Vera Sans", Verdana, Arial, sans-serif;
	text-decoration: none;
	font-size: 11px !important;
	line-height: 16px;
	padding: 2px 8px;
	cursor: pointer;
	border-width: 1px;
	border-style: solid;
	-moz-border-radius: 11px;
	-khtml-border-radius: 11px;
	-webkit-border-radius: 11px;
	border-radius: 11px;
}

.button-primary {
	background: #21759B url(../images/button-grad.png) repeat-x scroll left top;
	border-color: #21759B;
	color: #FFFFFF;
}

.ac_results {
	padding: 0;
	margin: 0;
	list-style: none;
	position: absolute;
	z-index: 10000;
	display: none;
	border-width: 1px;
	border-style: solid;
}

.ac_results li {
	padding: 2px 5px;
	white-space: nowrap;
	text-align: left;
}

.ac_over {
	cursor: pointer;
}

.ac_match {
	text-decoration: underline;
}

#TB_ajaxContent #options {
	position: absolute;
	top: 20px;
	right: 25px;
	padding: 5px;
}

#TB_ajaxContent h3 {
	margin-bottom: .25em;
}

.updated {
	margin: 10px 0;
	padding: 0;
	border-width: 1px;
	border-style: solid;
	width: 99%;
}

.updated p,
.error p {
	margin: 0.6em 0;
	padding: 0 0.6em;
}

.error a {
	text-decoration: underline;
}

.updated a {
	text-decoration: none;
	padding-bottom: 2px;
}

#post_status {
	margin-left: 10px;
	margin-bottom: 1em;
	display: block;
}

/* Footer */
#footer {
	height: 65px;
	display: block;
	width: 640px;
	padding: 10px 0 0 60px;
	margin: 0;
	position: absolute;
	bottom: 0;
	font-size: 12px;
}

#footer p {
	margin: 0;
	padding: 7px 0;
}

#footer p a {
	text-decoration: none;
}
#footer p a:hover {
	text-decoration: underline;
}

/* Utility Classes */
.centered {
	text-align: center;
}

.hidden {
	display: none;
}
                                    wp-admin/css/farbtastic-rtl.css                                                                     0000755 0023422 0004734 00000000174 11103734150 017541  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 .farbtastic .color, .farbtastic .overlay {
	left: 0;
	right: 47px;
}
.farbtastic .marker {
	margin: -8px -8px 0 0;
}
                                                                                                                                                                                                                                                                                                                                                                                                    wp-admin/css/farbtastic.css                                                                         0000755 0023422 0004734 00000001133 11117531364 016745  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 .farbtastic {
  position: relative;
}
.farbtastic * {
  position: absolute;
  cursor: crosshair;
}
.farbtastic, .farbtastic .wheel {
  width: 195px;
  height: 195px;
}
.farbtastic .color, .farbtastic .overlay {
  top: 47px;
  left: 47px;
  width: 101px;
  height: 101px;
}
.farbtastic .wheel {
  background: url(../images/wheel.png) no-repeat;
  width: 195px;
  height: 195px;
}
.farbtastic .overlay {
  background: url(../images/mask.png) no-repeat;
}
.farbtastic .marker {
  width: 17px;
  height: 17px;
  margin: -8px 0 0 -8px;
  overflow: hidden;
  background: url(../images/marker.png) no-repeat;
}                                                                                                                                                                                                                                                                                                                                                                                                                                     wp-admin/css/plugin-install-rtl.css                                                                 0000755 0023422 0004734 00000001403 11117530276 020365  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 div.star {
	left: auto;
	right: 0;
	letter-spacing: 0;
}
.star img, div.star a, div.star a:hover, div.star a:visited {
	right: auto;
	left: 0;
}
#plugin-information ul#sidemenu {
	left: auto;
	right: 0;
}
#plugin-information h2 {
	margin-right: 0;
	margin-left: 200px;
}
#plugin-information .fyi {
	margin-left: 5px;
	margin-right: 20px;
}
#plugin-information .fyi h2 {
	margin-left: 0;
}
#plugin-information .fyi ul {
	padding: 10px 7px 10px 5px;
}
#plugin-information #section-screenshots li p {
	padding-left: 0;
	padding-right: 20px;
}
#plugin-information .updated,
#plugin-information pre {
	margin-right: 0;
	margin-left: 215px;
}
#plugin-information .updated, #plugin-information .error {
	clear: none;
	direction: rtl;
}
#section-description {
	direction: ltr;
}
                                                                                                                                                                                                                                                             wp-admin/css/plugin-install.css                                                                     0000755 0023422 0004734 00000005436 11107330114 017564  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 /* NOTE: the following CSS rules(.star*) are taken more or less straight from the bbPress rating plugin. */
div.star-holder {
	position: relative;
	height: 19px;
	width: 100px;
	font-size: 19px;
}

div.star {
	height: 100%;
	position: absolute;
	top: 0;
	left: 0;
	background-color: transparent;
	letter-spacing: 1ex;
	border: none;
}

.star1 { width: 20%; }
.star2 { width: 40%; }
.star3 { width: 60%; }
.star4 { width: 80%; }
.star5 { width: 100%; }

.star img, div.star a, div.star a:hover, div.star a:visited {
	display: block;
	position: absolute;
	right: 0;
	border: none;
	text-decoration: none;
}

div.star img {
	width: 19px;
	height: 19px;
	border-left: 1px solid #fff;
	border-right: 1px solid #fff;
}

/* Start custom CSS */
/* Header on thickbox */
#plugin-information-header {
	margin: 0;
	padding: 0 5px;
	font-weight: bold;
	position: relative;
	border-bottom-width: 1px;
	border-bottom-style: solid;
	height: 2.5em;
}
#plugin-information ul#sidemenu {
	font-weight: normal;
	margin: 0 5px;
	position: absolute;
	left: 0;
	bottom: -1px;
}

/* Install sidemenu */
#plugin-information p.action-button {
	width: 100%;
	padding-bottom: 0;
	margin-bottom: 0;
	margin-top: 10px;
	-moz-border-radius: 3px 0 0 3px;
	-webkit-border-top-left-radius: 3px;
	-khtml-border-top-left-radius: 3px;
	border-top-left-radius: 3px;
	-webkit-border-bottom-left-radius: 3px;
	-khtml-border-bottom-left-radius: 3px;
	border-top-bottom-radius: 3px;
}

#plugin-information .action-button a {
	text-align: center;
	font-weight: bold;
	text-decoration: none;
	display: block;
	line-height: 2em;
}

#plugin-information h2 {
	clear: none !important;
	margin-right: 200px;
}

#plugin-information .fyi {
	margin-left: 10px;
	margin-bottom: 50px;
	width: 210px;
}

#plugin-information .fyi h2 {
	font-size: 0.9em;
	margin-bottom: 0;
	margin-right: 0;
}

#plugin-information .fyi h2.mainheader {
	padding: 5px;
	-moz-border-radius-topleft: 3px;
	-webkit-border-top-left-radius: 3px;
	-khtml-border-top-left-radius: 3px;
	border-top-left-radius: 3px;
}

#plugin-information .fyi ul {
	padding: 10px 5px 10px 7px;
	margin: 0;
	list-style: none;
	-moz-border-radius-bottomleft: 3px;
	-webkit-border-bottom-left-radius: 3px;
	-khtml-border-bottom-left-radius: 3px;
	border-top-bottom-radius: 3px;
}

#plugin-information .fyi li {
	margin-right: 0;
}

#plugin-information #section-holder {
	padding: 10px;
}

#plugin-information .section ul,
#plugin-information .section ol {
	margin-left: 16px;
	list-style-type: square;
	list-style-image: none;
}

#plugin-information #section-screenshots li img {
	vertical-align: text-top;
}

#plugin-information #section-screenshots li p {
	font-style: italic;
	padding-left: 20px;
	padding-bottom: 2em;
}

#plugin-information .updated,
#plugin-information pre {
	margin-right: 215px;
}

#plugin-information pre {
	padding: 7px;
}                                                                                                                                                                                                                                  wp-admin/custom-header.php                                                                          0000755 0023422 0004734 00000031561 11117531364 016602  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * The custom header image script.
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * The custom header image class.
 *
 * @since unknown
 * @package WordPress
 * @subpackage Administration
 */
class Custom_Image_Header {

	/**
	 * Callback for administration header.
	 *
	 * @var callback
	 * @since unknown
	 * @access private
	 */
	var $admin_header_callback;

	/**
	 * PHP4 Constructor - Register administration header callback.
	 *
	 * @since unknown
	 * @param callback $admin_header_callback
	 * @return Custom_Image_Header
	 */
	function Custom_Image_Header($admin_header_callback) {
		$this->admin_header_callback = $admin_header_callback;
	}

	/**
	 * Setup the hooks for the Custom Header admin page.
	 *
	 * @since unknown
	 */
	function init() {
		$page = add_theme_page(__('Custom Image Header'), __('Custom Image Header'), 'edit_themes', 'custom-header', array(&$this, 'admin_page'));

		add_action("admin_print_scripts-$page", array(&$this, 'js_includes'));
		add_action("admin_print_styles-$page", array(&$this, 'css_includes'));
		add_action("admin_head-$page", array(&$this, 'take_action'), 50);
		add_action("admin_head-$page", array(&$this, 'js'), 50);
		add_action("admin_head-$page", $this->admin_header_callback, 51);
	}

	/**
	 * Get the current step.
	 *
	 * @since unknown
	 *
	 * @return int Current step
	 */
	function step() {
		if ( ! isset( $_GET['step'] ) )
			return 1;

		$step = (int) $_GET['step'];
		if ( $step < 1 || 3 < $step )
			$step = 1;

		return $step;
	}

	/**
	 * Setup the enqueue for the JavaScript files.
	 *
	 * @since unknown
	 */
	function js_includes() {
		$step = $this->step();

		if ( 1 == $step )
			wp_enqueue_script('farbtastic');
		elseif ( 2 == $step )
			wp_enqueue_script('cropper');
	}

	/**
	 * Setup the enqueue for the CSS files
	 *
	 * @since 2.7
	 */
	function css_includes() {
		$step = $this->step();

		if ( 1 == $step ) {
			wp_enqueue_style('farbtastic');
		}
	}

	/**
	 * Execute custom header modification.
	 *
	 * @since unknown
	 */
	function take_action() {
		if ( isset( $_POST['textcolor'] ) ) {
			check_admin_referer('custom-header');
			if ( 'blank' == $_POST['textcolor'] ) {
				set_theme_mod('header_textcolor', 'blank');
			} else {
				$color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['textcolor']);
				if ( strlen($color) == 6 || strlen($color) == 3 )
					set_theme_mod('header_textcolor', $color);
			}
		}
		if ( isset($_POST['resetheader']) ) {
			check_admin_referer('custom-header');
			remove_theme_mods();
		}
	}

	/**
	 * Execute Javascript depending on step.
	 *
	 * @since unknown
	 */
	function js() {
		$step = $this->step();
		if ( 1 == $step )
			$this->js_1();
		elseif ( 2 == $step )
			$this->js_2();
	}

	/**
	 * Display Javascript based on Step 1.
	 *
	 * @since unknown
	 */
	function js_1() { ?>
<script type="text/javascript">
	var buttons = ['#name', '#desc', '#pickcolor', '#defaultcolor'];
	var farbtastic;

	function pickColor(color) {
		jQuery('#name').css('color', color);
		jQuery('#desc').css('color', color);
		jQuery('#textcolor').val(color);
		farbtastic.setColor(color);
	}

	jQuery(document).ready(function() {
		jQuery('#pickcolor').click(function() {
			jQuery('#colorPickerDiv').show();
		});

		jQuery('#hidetext').click(function() {
			toggle_text();
		});

		farbtastic = jQuery.farbtastic('#colorPickerDiv', function(color) { pickColor(color); });
		pickColor('#<?php echo get_theme_mod('header_textcolor', HEADER_TEXTCOLOR); ?>');

		<?php if ( 'blank' == get_theme_mod('header_textcolor', HEADER_TEXTCOLOR) ) { ?>
		toggle_text();
		<?php } ?>
	});

	jQuery(document).mousedown(function(){
		// Make the picker disappear, since we're using it in an independant div
		hide_picker();
	});

	function colorDefault() {
		pickColor('#<?php echo HEADER_TEXTCOLOR; ?>');
	}

	function hide_picker(what) {
		var update = false;
		jQuery('#colorPickerDiv').each(function(){
			var id = jQuery(this).attr('id');
			if (id == what) {
				return;
			}
			var display = jQuery(this).css('display');
			if (display == 'block') {
				jQuery(this).fadeOut(2);
			}
		});
	}

	function toggle_text(force) {
		if(jQuery('#textcolor').val() == 'blank') {
			//Show text
			jQuery( buttons.toString() ).show();
			jQuery('#textcolor').val('<?php echo HEADER_TEXTCOLOR; ?>');
			jQuery('#hidetext').val('<?php _e('Hide Text'); ?>');
		}
		else {
			//Hide text
			jQuery( buttons.toString() ).hide();
			jQuery('#textcolor').val('blank');
			jQuery('#hidetext').val('<?php _e('Show Text'); ?>');
		}
	}



</script>
<?php
	}

	/**
	 * Display Javascript based on Step 2.
	 *
	 * @since unknown
	 */
	function js_2() { ?>
<script type="text/javascript">
	function onEndCrop( coords, dimensions ) {
		jQuery( '#x1' ).val(coords.x1);
		jQuery( '#y1' ).val(coords.y1);
		jQuery( '#x2' ).val(coords.x2);
		jQuery( '#y2' ).val(coords.y2);
		jQuery( '#width' ).val(dimensions.width);
		jQuery( '#height' ).val(dimensions.height);
	}

	// with a supplied ratio
	jQuery(document).ready(function() {
		var xinit = <?php echo HEADER_IMAGE_WIDTH; ?>;
		var yinit = <?php echo HEADER_IMAGE_HEIGHT; ?>;
		var ratio = xinit / yinit;
		var ximg = jQuery('#upload').width();
		var yimg = jQuery('#upload').height();
		if ( yimg < yinit || ximg < xinit ) {
			if ( ximg / yimg > ratio ) {
				yinit = yimg;
				xinit = yinit * ratio;
			} else {
				xinit = ximg;
				yinit = xinit / ratio;
			}
		}
		new Cropper.Img(
			'upload',
			{
				ratioDim: { x: xinit, y: yinit },
				displayOnInit: true,
				onEndCrop: onEndCrop
			}
		)
	});
</script>
<?php
	}

	/**
	 * Display first step of custom header image page.
	 *
	 * @since unknown
	 */
	function step_1() {
		if ( $_GET['updated'] ) { ?>
<div id="message" class="updated fade">
<p><?php _e('Header updated.') ?></p>
</div>
		<?php } ?>

<div class="wrap">
<?php screen_icon(); ?>
<h2><?php _e('Your Header Image'); ?></h2>
<p><?php _e('This is your header image. You can change the text color or upload and crop a new image.'); ?></p>

<div id="headimg" style="background-image: url(<?php clean_url(header_image()) ?>);">
<h1><a onclick="return false;" href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>" id="name"><?php bloginfo('name'); ?></a></h1>
<div id="desc"><?php bloginfo('description');?></div>
</div>
<?php if ( !defined( 'NO_HEADER_TEXT' ) ) { ?>
<form method="post" action="<?php echo admin_url('themes.php?page=custom-header&amp;updated=true') ?>">
<input type="button" value="<?php _e('Hide Text'); ?>" onclick="hide_text()" id="hidetext" />
<input type="button" value="<?php _e('Select a Text Color'); ?>" id="pickcolor" /><input type="button" value="<?php _e('Use Original Color'); ?>" onclick="colorDefault()" id="defaultcolor" />
<?php wp_nonce_field('custom-header') ?>
<input type="hidden" name="textcolor" id="textcolor" value="#<?php attribute_escape(header_textcolor()) ?>" /><input name="submit" type="submit" value="<?php _e('Save Changes'); ?>" /></form>
<?php } ?>

<div id="colorPickerDiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"> </div>
</div>
<div class="wrap">
<h2><?php _e('Upload New Header Image'); ?></h2><p><?php _e('Here you can upload a custom header image to be shown at the top of your blog instead of the default one. On the next screen you will be able to crop the image.'); ?></p>
<p><?php printf(__('Images of exactly <strong>%1$d x %2$d pixels</strong> will be used as-is.'), HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT); ?></p>

<form enctype="multipart/form-data" id="uploadForm" method="POST" action="<?php echo attribute_escape(add_query_arg('step', 2)) ?>" style="margin: auto; width: 50%;">
<label for="upload"><?php _e('Choose an image from your computer:'); ?></label><br /><input type="file" id="upload" name="import" />
<input type="hidden" name="action" value="save" />
<?php wp_nonce_field('custom-header') ?>
<p class="submit">
<input type="submit" value="<?php _e('Upload'); ?>" />
</p>
</form>

</div>

		<?php if ( get_theme_mod('header_image') || get_theme_mod('header_textcolor') ) : ?>
<div class="wrap">
<h2><?php _e('Reset Header Image and Color'); ?></h2>
<p><?php _e('This will restore the original header image and color. You will not be able to retrieve any customizations.') ?></p>
<form method="post" action="<?php echo attribute_escape(add_query_arg('step', 1)) ?>">
<?php wp_nonce_field('custom-header'); ?>
<input type="submit" name="resetheader" value="<?php _e('Restore Original Header'); ?>" />
</form>
</div>
		<?php endif;

	}

	/**
	 * Display second step of custom header image page.
	 *
	 * @since unknown
	 */
	function step_2() {
		check_admin_referer('custom-header');
		$overrides = array('test_form' => false);
		$file = wp_handle_upload($_FILES['import'], $overrides);

		if ( isset($file['error']) )
		die( $file['error'] );

		$url = $file['url'];
		$type = $file['type'];
		$file = $file['file'];
		$filename = basename($file);

		// Construct the object array
		$object = array(
		'post_title' => $filename,
		'post_content' => $url,
		'post_mime_type' => $type,
		'guid' => $url);

		// Save the data
		$id = wp_insert_attachment($object, $file);

		list($width, $height, $type, $attr) = getimagesize( $file );

		if ( $width == HEADER_IMAGE_WIDTH && $height == HEADER_IMAGE_HEIGHT ) {
			// Add the meta-data
			wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );

			set_theme_mod('header_image', clean_url($url));
			do_action('wp_create_file_in_uploads', $file, $id); // For replication
			return $this->finished();
		} elseif ( $width > HEADER_IMAGE_WIDTH ) {
			$oitar = $width / HEADER_IMAGE_WIDTH;
			$image = wp_crop_image($file, 0, 0, $width, $height, HEADER_IMAGE_WIDTH, $height / $oitar, false, str_replace(basename($file), 'midsize-'.basename($file), $file));
			$image = apply_filters('wp_create_file_in_uploads', $image, $id); // For replication

			$url = str_replace(basename($url), basename($image), $url);
			$width = $width / $oitar;
			$height = $height / $oitar;
		} else {
			$oitar = 1;
		}
		?>

<div class="wrap">

<form method="POST" action="<?php echo attribute_escape(add_query_arg('step', 3)) ?>">

<p><?php _e('Choose the part of the image you want to use as your header.'); ?></p>
<div id="testWrap" style="position: relative">
<img src="<?php echo $url; ?>" id="upload" width="<?php echo $width; ?>" height="<?php echo $height; ?>" />
</div>

<p class="submit">
<input type="hidden" name="x1" id="x1" />
<input type="hidden" name="y1" id="y1" />
<input type="hidden" name="x2" id="x2" />
<input type="hidden" name="y2" id="y2" />
<input type="hidden" name="width" id="width" />
<input type="hidden" name="height" id="height" />
<input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo $id; ?>" />
<input type="hidden" name="oitar" id="oitar" value="<?php echo $oitar; ?>" />
<?php wp_nonce_field('custom-header') ?>
<input type="submit" value="<?php _e('Crop Header'); ?>" />
</p>

</form>
</div>
		<?php
	}

	/**
	 * Display third step of custom header image page.
	 *
	 * @since unknown
	 */
	function step_3() {
		check_admin_referer('custom-header');
		if ( $_POST['oitar'] > 1 ) {
			$_POST['x1'] = $_POST['x1'] * $_POST['oitar'];
			$_POST['y1'] = $_POST['y1'] * $_POST['oitar'];
			$_POST['width'] = $_POST['width'] * $_POST['oitar'];
			$_POST['height'] = $_POST['height'] * $_POST['oitar'];
		}

		$original = get_attached_file( $_POST['attachment_id'] );

		$cropped = wp_crop_image($_POST['attachment_id'], $_POST['x1'], $_POST['y1'], $_POST['width'], $_POST['height'], HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT);
		$cropped = apply_filters('wp_create_file_in_uploads', $cropped, $_POST['attachment_id']); // For replication

		$parent = get_post($_POST['attachment_id']);
		$parent_url = $parent->guid;
		$url = str_replace(basename($parent_url), basename($cropped), $parent_url);

		// Construct the object array
		$object = array(
			'ID' => $_POST['attachment_id'],
			'post_title' => basename($cropped),
			'post_content' => $url,
			'post_mime_type' => 'image/jpeg',
			'guid' => $url
		);

		// Update the attachment
		wp_insert_attachment($object, $cropped);
		wp_update_attachment_metadata( $_POST['attachment_id'], wp_generate_attachment_metadata( $_POST['attachment_id'], $cropped ) );

		set_theme_mod('header_image', $url);

		// cleanup
		$medium = str_replace(basename($original), 'midsize-'.basename($original), $original);
		@unlink( apply_filters( 'wp_delete_file', $medium ) );
		@unlink( apply_filters( 'wp_delete_file', $original ) );

		return $this->finished();
	}

	/**
	 * Display last step of custom header image page.
	 *
	 * @since unknown
	 */
	function finished() {
		?>
<div class="wrap">
<h2><?php _e('Header complete!'); ?></h2>

<p><?php _e('Visit your site and you should see the new header now.'); ?></p>

</div>
		<?php
	}

	/**
	 * Display the page based on the current step.
	 *
	 * @since unknown
	 */
	function admin_page() {
		$step = $this->step();
		if ( 1 == $step )
			$this->step_1();
		elseif ( 2 == $step )
			$this->step_2();
		elseif ( 3 == $step )
			$this->step_3();
	}

}
?>
                                                                                                                                               wp-admin/edit-attachment-rows.php                                                                   0000755 0023422 0004734 00000014566 11117531364 020113  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Edit attachments table for inclusion in administration panels.
 *
 * @package WordPress
 * @subpackage Administration
 */

if ( ! defined('ABSPATH') ) die();

if ( have_posts() ) { ?>
<table class="widefat fixed" cellspacing="0">
	<thead>
	<tr>
<?php print_column_headers('upload'); ?>
	</tr>
	</thead>

	<tfoot>
	<tr>
<?php print_column_headers('upload', false); ?>
	</tr>
	</tfoot>

	<tbody id="the-list" class="list:post">
<?php
add_filter('the_title','wp_specialchars');
$alt = '';
$posts_columns = get_column_headers('upload');
$hidden = get_hidden_columns('upload');
while (have_posts()) : the_post();
$alt = ( 'alternate' == $alt ) ? '' : 'alternate';
global $current_user;
$post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
$att_title = _draft_or_post_title();

?>
	<tr id='post-<?php echo $id; ?>' class='<?php echo trim( $alt . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>' valign="top">

<?php
foreach ($posts_columns as $column_name => $column_display_name ) {
	$class = "class=\"$column_name column-$column_name\"";

	$style = '';
	if ( in_array($column_name, $hidden) )
		$style = ' style="display:none;"';

	$attributes = "$class$style";

	switch($column_name) {

	case 'cb':
		?>
		<th scope="row" class="check-column"><input type="checkbox" name="media[]" value="<?php the_ID(); ?>" /></th>
		<?php
		break;

	case 'icon':
		$attributes = 'class="column-icon media-icon"' . $style;
		?>
		<td <?php echo $attributes ?>><?php
			if ( $thumb = wp_get_attachment_image( $post->ID, array(80, 60), true ) ) {
?>

				<a href="media.php?action=edit&amp;attachment_id=<?php the_ID(); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $att_title)); ?>">
					<?php echo $thumb; ?>
				</a>

<?php			}
		?></td>
		<?php
		// TODO
		break;

	case 'media':
		?>
		<td <?php echo $attributes ?>><strong><a href="<?php echo get_edit_post_link( $post->ID ); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $att_title)); ?>"><?php echo $att_title; ?></a></strong><br />
		<?php echo strtoupper(preg_replace('/^.*?\.(\w+)$/', '$1', get_attached_file($post->ID))); ?>
		<p>
		<?php
		$actions = array();
		if ( current_user_can('edit_post', $post->ID) )
			$actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '">' . __('Edit') . '</a>';
		if ( current_user_can('delete_post', $post->ID) )
			$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this attachment '%s'\n  'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this attachment '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
		$actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . attribute_escape(sprintf(__('View "%s"'), $title)) . '" rel="permalink">' . __('View') . '</a>';
		$action_count = count($actions);
		$i = 0;
		echo '<div class="row-actions">';
		foreach ( $actions as $action => $link ) {
			++$i;
			( $i == $action_count ) ? $sep = '' : $sep = ' | ';
			echo "<span class='$action'>$link$sep</span>";
		}
		echo '</div>';
		?></p></td>
		<?php
		break;

	case 'author':
		?>
		<td <?php echo $attributes ?>><?php the_author() ?></td>
		<?php
		break;

	case 'tags':
		?>
		<td <?php echo $attributes ?>><?php
		$tags = get_the_tags();
		if ( !empty( $tags ) ) {
			$out = array();
			foreach ( $tags as $c )
				$out[] = "<a href='edit.php?tag=$c->slug'> " . wp_specialchars(sanitize_term_field('name', $c->name, $c->term_id, 'post_tag', 'display')) . "</a>";
			echo join( ', ', $out );
		} else {
			_e('No Tags');
		}
		?></td>
		<?php
		break;

	case 'desc':
		?>
		<td <?php echo $attributes ?>><?php echo has_excerpt() ? $post->post_excerpt : ''; ?></td>
		<?php
		break;

	case 'date':
		if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) {
			$t_time = $h_time = __('Unpublished');
		} else {
			$t_time = get_the_time(__('Y/m/d g:i:s A'));
			$m_time = $post->post_date;
			$time = get_post_time( 'G', true, $post );
			if ( ( abs($t_diff = time() - $time) ) < 86400 ) {
				if ( $t_diff < 0 )
					$h_time = sprintf( __('%s from now'), human_time_diff( $time ) );
				else
					$h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
			} else {
				$h_time = mysql2date(__('Y/m/d'), $m_time);
			}
		}
		?>
		<td <?php echo $attributes ?>><?php echo $h_time ?></td>
		<?php
		break;

	case 'parent':
		if ( $post->post_parent > 0 ) {
			if ( get_post($post->post_parent) ) {
				$title =_draft_or_post_title($post->post_parent);
			}
			?>
			<td <?php echo $attributes ?>><strong><a href="<?php echo get_edit_post_link( $post->post_parent ); ?>"><?php echo $title ?></a></strong>, <?php echo get_the_time(__('Y/m/d')); ?></td>
			<?php
		} else {
			?>
			<td <?php echo $attributes ?>>&nbsp;</td>
			<?php
		}

		break;

	case 'comments':
		$attributes = 'class="comments column-comments num"' . $style;
		?>
		<td <?php echo $attributes ?>><div class="post-com-count-wrapper">
		<?php
		$left = get_pending_comments_num( $post->ID );
		$pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
		if ( $left )
			echo '<strong>';
		comments_number("<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('0') . '</span></a>', "<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('1') . '</span></a>', "<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('%') . '</span></a>');
		if ( $left )
			echo '</strong>';
		?>
		</div></td>
		<?php
		break;

	case 'actions':
		?>
		<td <?php echo $attributes ?>>
		<a href="media.php?action=edit&amp;attachment_id=<?php the_ID(); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $att_title)); ?>"><?php _e('Edit'); ?></a> |
		<a href="<?php the_permalink(); ?>"><?php _e('Get permalink'); ?></a>
		</td>
		<?php
		break;

	default:
		?>
		<td <?php echo $attributes ?>><?php do_action('manage_media_custom_column', $column_name, $id); ?></td>
		<?php
		break;
	}
}
?>
	</tr>
<?php endwhile; ?>
	</tbody>
</table>
<?php } else { ?>

<p><?php _e('No posts found.') ?></p>

<?php
} // end if ( have_posts() )
?>

                                                                                                                                          wp-admin/edit-category-form.php                                                                     0000755 0023422 0004734 00000006425 11117432530 017537  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Edit category form for inclusion in administration panels.
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * @var object
 */
if ( ! isset( $category ) )
	$category = (object) array();

/**
 * @ignore
 * @since 2.7
 * @internal Used to prevent errors in page when no category is being edited.
 *
 * @param object $category
 */
function _fill_empty_category(&$category) {
	if ( ! isset( $category->name ) )
		$category->name = '';

	if ( ! isset( $category->slug ) )
		$category->slug = '';

	if ( ! isset( $category->parent ) )
		$category->parent = '';

	if ( ! isset( $category->description ) )
		$category->description = '';
}

do_action('edit_category_form_pre', $category);

_fill_empty_category($category);
?>

<div class="wrap">
<?php screen_icon(); ?>
<h2><?php _e('Edit Category'); ?></h2>
<div id="ajax-response"></div>
<form name="editcat" id="editcat" method="post" action="categories.php" class="validate">
<input type="hidden" name="action" value="editedcat" />
<input type="hidden" name="cat_ID" value="<?php echo $category->term_id ?>" />
<?php wp_original_referer_field(true, 'previous'); wp_nonce_field('update-category_' . $cat_ID); ?>
	<table class="form-table">
		<tr class="form-field form-required">
			<th scope="row" valign="top"><label for="cat_name"><?php _e('Category Name') ?></label></th>
			<td><input name="cat_name" id="cat_name" type="text" value="<?php echo attribute_escape($category->name); ?>" size="40" aria-required="true" /><br />
            <?php _e('The name is used to identify the category almost everywhere, for example under the post or in the category widget.'); ?></td>
		</tr>
		<tr class="form-field">
			<th scope="row" valign="top"><label for="category_nicename"><?php _e('Category Slug') ?></label></th>
			<td><input name="category_nicename" id="category_nicename" type="text" value="<?php echo attribute_escape(apply_filters('editable_slug', $category->slug)); ?>" size="40" /><br />
            <?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></td>
		</tr>
		<tr class="form-field">
			<th scope="row" valign="top"><label for="category_parent"><?php _e('Category Parent') ?></label></th>
			<td>
	  			<?php wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'category_parent', 'orderby' => 'name', 'selected' => $category->parent, 'hierarchical' => true, 'show_option_none' => __('None'))); ?><br />
                <?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?>
	  		</td>
		</tr>
		<tr class="form-field">
			<th scope="row" valign="top"><label for="category_description"><?php _e('Description') ?></label></th>
			<td><textarea name="category_description" id="category_description" rows="5" cols="50" style="width: 97%;"><?php echo wp_specialchars($category->description); ?></textarea><br />
            <?php _e('The description is not prominent by default, however some themes may show it.'); ?></td>
		</tr>
	</table>
<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php _e('Update Category'); ?>" /></p>
<?php do_action('edit_category_form', $category); ?>
</form>
</div>
                                                                                                                                                                                                                                           wp-admin/edit-comments.php                                                                          0000755 0023422 0004734 00000034153 11137216206 016607  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Edit Comments Administration Panel.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** WordPress Administration Bootstrap */
require_once('admin.php');

wp_enqueue_script('admin-comments');
enqueue_comment_hotkeys_js();

$post_id = isset($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0;

if ( ( isset( $_REQUEST['delete_all_spam'] ) || isset( $_REQUEST['delete_all_spam2'] ) ) && !empty( $_REQUEST['pagegen_timestamp'] ) ) {
	check_admin_referer('bulk-spam-delete', '_spam_nonce');

	$delete_time = $wpdb->escape( $_REQUEST['pagegen_timestamp'] );
	if ( current_user_can('moderate_comments')) {
		$deleted_spam = $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam' AND '$delete_time' > comment_date_gmt" );
	} else {
		$deleted_spam = 0;
	}
	$redirect_to = 'edit-comments.php?comment_status=spam&deleted=' . (int) $deleted_spam;
	if ( $post_id )
		$redirect_to = add_query_arg( 'p', absint( $post_id ), $redirect_to );
	wp_redirect( $redirect_to );
} elseif ( isset($_REQUEST['delete_comments']) && isset($_REQUEST['action']) && ( -1 != $_REQUEST['action'] || -1 != $_REQUEST['action2'] ) ) {
	check_admin_referer('bulk-comments');
	$doaction = ( -1 != $_REQUEST['action'] ) ? $_REQUEST['action'] : $_REQUEST['action2'];

	$deleted = $approved = $unapproved = $spammed = 0;
	foreach ( (array) $_REQUEST['delete_comments'] as $comment_id) : // Check the permissions on each
		$comment_id = (int) $comment_id;
		$_post_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d", $comment_id) );

		if ( !current_user_can('edit_post', $_post_id) )
			continue;

		switch( $doaction ) {
			case 'markspam' :
				wp_set_comment_status($comment_id, 'spam');
				$spammed++;
				break;
			case 'delete' :
				wp_set_comment_status($comment_id, 'delete');
				$deleted++;
				break;
			case 'approve' :
				wp_set_comment_status($comment_id, 'approve');
				$approved++;
				break;
			case 'unapprove' :
				wp_set_comment_status($comment_id, 'hold');
				$unapproved++;
				break;
		}
	endforeach;

	$redirect_to = 'edit-comments.php?deleted=' . $deleted . '&approved=' . $approved . '&spam=' . $spammed . '&unapproved=' . $unapproved;
	if ( $post_id )
		$redirect_to = add_query_arg( 'p', absint( $post_id ), $redirect_to );
	if ( isset($_REQUEST['apage']) )
		$redirect_to = add_query_arg( 'apage', absint($_REQUEST['apage']), $redirect_to );
	if ( !empty($_REQUEST['mode']) )
		$redirect_to = add_query_arg('mode', $_REQUEST['mode'], $redirect_to);
	if ( !empty($_REQUEST['comment_status']) )
		$redirect_to = add_query_arg('comment_status', $_REQUEST['comment_status'], $redirect_to);
	if ( !empty($_REQUEST['s']) )
		$redirect_to = add_query_arg('s', $_REQUEST['s'], $redirect_to);
	wp_redirect( $redirect_to );
} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
	 wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
	 exit;
}

if ( $post_id )
	$title = sprintf(__('Edit Comments on &#8220;%s&#8221;'), wp_html_excerpt(_draft_or_post_title($post_id), 50));
else
	$title = __('Edit Comments');

require_once('admin-header.php');

$mode = ( ! isset($_GET['mode']) || empty($_GET['mode']) ) ? 'detail' : attribute_escape($_GET['mode']);

$comment_status = !empty($_GET['comment_status']) ? attribute_escape($_GET['comment_status']) : '';

$comment_type = !empty($_GET['comment_type']) ? attribute_escape($_GET['comment_type']) : '';

$search_dirty = ( isset($_GET['s']) ) ? $_GET['s'] : '';
$search = attribute_escape( $search_dirty ); ?>

<div class="wrap">
<?php screen_icon(); ?>
<h2><?php echo wp_specialchars( $title );
if ( isset($_GET['s']) && $_GET['s'] )
	printf( '<span class="subtitle">' . sprintf( __( 'Search results for &#8220;%s&#8221;' ), wp_html_excerpt( wp_specialchars( stripslashes( $_GET['s'] ) ), 50 ) ) . '</span>' ); ?>
</h2>

<?php
if ( isset( $_GET['approved'] ) || isset( $_GET['deleted'] ) || isset( $_GET['spam'] ) ) {
	$approved = isset( $_GET['approved'] ) ? (int) $_GET['approved'] : 0;
	$deleted = isset( $_GET['deleted'] ) ? (int) $_GET['deleted'] : 0;
	$spam = isset( $_GET['spam'] ) ? (int) $_GET['spam'] : 0;

	if ( $approved > 0 || $deleted > 0 || $spam > 0 ) {
		echo '<div id="moderated" class="updated fade"><p>';

		if ( $approved > 0 ) {
			printf( __ngettext( '%s comment approved', '%s comments approved', $approved ), $approved );
			echo '<br />';
		}

		if ( $deleted > 0 ) {
			printf( __ngettext( '%s comment deleted', '%s comments deleted', $deleted ), $deleted );
			echo '<br />';
		}

		if ( $spam > 0 ) {
			printf( __ngettext( '%s comment marked as spam', '%s comments marked as spam', $spam ), $spam );
			echo '<br />';
		}

		echo '</p></div>';
	}
}
?>

<form id="comments-form" action="" method="get">
<ul class="subsubsub">
<?php
$status_links = array();
$num_comments = ( $post_id ) ? wp_count_comments( $post_id ) : wp_count_comments();
//, number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"),
//, number_format_i18n($num_comments->spam) ), "<span class='spam-comment-count'>" . number_format_i18n($num_comments->spam) . "</span>")
$stati = array(
		'all' => __ngettext_noop('All', 'All'), // singular not used
		'moderated' => __ngettext_noop('Pending (<span class="pending-count">%s</span>)', 'Pending (<span class="pending-count">%s</span>)'),
		'approved' => __ngettext_noop('Approved', 'Approved'), // singular not used
		'spam' => __ngettext_noop('Spam (<span class="spam-count">%s</span>)', 'Spam (<span class="spam-count">%s</span>)')
	);
$class = ( '' === $comment_status ) ? ' class="current"' : '';
// $status_links[] = "<li><a href='edit-comments.php'$class>" . __( 'All' ) . '</a>';
$link = 'edit-comments.php';
if ( !empty($comment_type) && 'all' != $comment_type )
	$link = add_query_arg( 'comment_type', $comment_type, $link );
foreach ( $stati as $status => $label ) {
	$class = '';

	if ( str_replace( 'all', '', $status ) == $comment_status )
		$class = ' class="current"';
	if ( !isset( $num_comments->$status ) )
		$num_comments->$status = 10;
	if ( 'all' != $status )
		$link = add_query_arg( 'comment_status', $status, $link );
	if ( $post_id )
		$link = add_query_arg( 'p', absint( $post_id ), $link );
	/*
	// I toyed with this, but decided against it. Leaving it in here in case anyone thinks it is a good idea. ~ Mark
	if ( !empty( $_GET['s'] ) )
		$link = add_query_arg( 's', attribute_escape( stripslashes( $_GET['s'] ) ), $link );
	*/
	$status_links[] = "<li class='$status'><a href='$link'$class>" . sprintf(
		__ngettext( $label[0], $label[1], $num_comments->$status ),
		number_format_i18n( $num_comments->$status )
	) . '</a>';
}

$status_links = apply_filters( 'comment_status_links', $status_links );

echo implode( " |</li>\n", $status_links) . '</li>';
unset($status_links);
?>
</ul>

<p class="search-box">
	<label class="hidden" for="comment-search-input"><?php _e( 'Search Comments' ); ?>:</label>
	<input type="text" class="search-input" id="comment-search-input" name="s" value="<?php _admin_search_query(); ?>" />
	<input type="submit" value="<?php _e( 'Search Comments' ); ?>" class="button" />
</p>

<?php
$comments_per_page = apply_filters('comments_per_page', 20, $comment_status);

if ( isset( $_GET['apage'] ) )
	$page = abs( (int) $_GET['apage'] );
else
	$page = 1;

$start = $offset = ( $page - 1 ) * $comments_per_page;

list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, $comments_per_page + 5, $post_id, $comment_type ); // Grab a few extra

$_comment_post_ids = array();
foreach ( $_comments as $_c ) {
	$_comment_post_ids[] = $_c->comment_post_ID;
}
$_comment_pending_count_temp = (array) get_pending_comments_num($_comment_post_ids);
foreach ( (array) $_comment_post_ids as $_cpid )
	$_comment_pending_count[$_cpid] = isset( $_comment_pending_count_temp[$_cpid] ) ? $_comment_pending_count_temp[$_cpid] : 0;
if ( empty($_comment_pending_count) )
	$_comment_pending_count = array();

$comments = array_slice($_comments, 0, $comments_per_page);
$extra_comments = array_slice($_comments, $comments_per_page);

$page_links = paginate_links( array(
	'base' => add_query_arg( 'apage', '%#%' ),
	'format' => '',
	'prev_text' => __('&laquo;'),
	'next_text' => __('&raquo;'),
	'total' => ceil($total / $comments_per_page),
	'current' => $page
));

?>

<input type="hidden" name="mode" value="<?php echo $mode; ?>" />
<?php if ( $post_id ) : ?>
<input type="hidden" name="p" value="<?php echo intval( $post_id ); ?>" />
<?php endif; ?>
<input type="hidden" name="comment_status" value="<?php echo $comment_status; ?>" />
<input type="hidden" name="pagegen_timestamp" value="<?php echo current_time('mysql', 1); ?>" />

<div class="tablenav">

<?php if ( $page_links ) : ?>
<div class="tablenav-pages"><?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
	number_format_i18n( $start + 1 ),
	number_format_i18n( min( $page * $comments_per_page, $total ) ),
	number_format_i18n( $total ),
	$page_links
); echo $page_links_text; ?></div>
<?php endif; ?>

<div class="alignleft actions">
<select name="action">
<option value="-1" selected="selected"><?php _e('Bulk Actions') ?></option>
<?php if ( empty($comment_status) || 'approved' == $comment_status ): ?>
<option value="unapprove"><?php _e('Unapprove'); ?></option>
<?php endif; ?>
<?php if ( empty($comment_status) || 'moderated' == $comment_status || 'spam' == $comment_status ): ?>
<option value="approve"><?php _e('Approve'); ?></option>
<?php endif; ?>
<?php if ( 'spam' != $comment_status ): ?>
<option value="markspam"><?php _e('Mark as Spam'); ?></option>
<?php endif; ?>
<option value="delete"><?php _e('Delete'); ?></option>
</select>
<input type="submit" name="doaction" id="doaction" value="<?php _e('Apply'); ?>" class="button-secondary apply" />
<?php wp_nonce_field('bulk-comments'); ?>

<?php if ( $comment_status ) echo "<input type='hidden' name='comment_status' value='$comment_status' />\n"; ?>
<select name="comment_type">
	<option value="all"><?php _e('Show all comment types'); ?></option>
<?php
	$comment_types = apply_filters( 'admin_comment_types_dropdown', array(
		'comment' => __('Comments'),
		'pings' => __('Pings'),
	) );

	foreach ( $comment_types as $type => $label ) {
		echo "	<option value='$type'";
		selected( $comment_type, $type );
		echo ">$label</option>\n";
	}
?>
</select>
<input type="submit" id="post-query-submit" value="<?php _e('Filter'); ?>" class="button-secondary" />

<?php if ( isset($_GET['apage']) ) { ?>
	<input type="hidden" name="apage" value="<?php echo absint( $_GET['apage'] ); ?>" />
<?php }

if ( 'spam' == $comment_status ) {
	wp_nonce_field('bulk-spam-delete', '_spam_nonce'); 
        if ( current_user_can ('moderate_comments')) { ?>
		<input type="submit" name="delete_all_spam" value="<?php _e('Delete All Spam'); ?>" class="button-secondary apply" />
<?php	}
} ?>
<?php do_action('manage_comments_nav', $comment_status); ?>
</div>

<br class="clear" />

</div>

<div class="clear"></div>

<?php if ( $comments ) { ?>
<table class="widefat comments fixed" cellspacing="0">
<thead>
	<tr>
<?php print_column_headers('edit-comments'); ?>
	</tr>
</thead>

<tfoot>
	<tr>
<?php print_column_headers('edit-comments', false); ?>
	</tr>
</tfoot>

<tbody id="the-comment-list" class="list:comment">
<?php
	foreach ($comments as $comment)
		_wp_comment_row( $comment->comment_ID, $mode, $comment_status );
?>
</tbody>
<tbody id="the-extra-comment-list" class="list:comment" style="display: none;">
<?php
	foreach ($extra_comments as $comment)
		_wp_comment_row( $comment->comment_ID, $mode, $comment_status );
?>
</tbody>
</table>

<div class="tablenav">
<?php
if ( $page_links )
	echo "<div class='tablenav-pages'>$page_links_text</div>";
?>

<div class="alignleft actions">
<select name="action2">
<option value="-1" selected="selected"><?php _e('Bulk Actions') ?></option>
<?php if ( empty($comment_status) || 'approved' == $comment_status ): ?>
<option value="unapprove"><?php _e('Unapprove'); ?></option>
<?php endif; ?>
<?php if ( empty($comment_status) || 'moderated' == $comment_status || 'spam' == $comment_status ): ?>
<option value="approve"><?php _e('Approve'); ?></option>
<?php endif; ?>
<?php if ( 'spam' != $comment_status ): ?>
<option value="markspam"><?php _e('Mark as Spam'); ?></option>
<?php endif; ?>
<option value="delete"><?php _e('Delete'); ?></option>
</select>
<input type="submit" name="doaction2" id="doaction2" value="<?php _e('Apply'); ?>" class="button-secondary apply" />

<?php if ( 'spam' == $comment_status ) { ?>
<input type="submit" name="delete_all_spam2" value="<?php _e('Delete All Spam'); ?>" class="button-secondary apply" />
<?php } ?>
<?php do_action('manage_comments_nav', $comment_status); ?>
</div>

<br class="clear" />
</div>

</form>

<form id="get-extra-comments" method="post" action="" class="add:the-extra-comment-list:" style="display: none;">
	<input type="hidden" name="s" value="<?php echo $search; ?>" />
	<input type="hidden" name="mode" value="<?php echo $mode; ?>" />
	<input type="hidden" name="comment_status" value="<?php echo $comment_status; ?>" />
	<input type="hidden" name="page" value="<?php echo isset($_REQUEST['page']) ? absint( $_REQUEST['page'] ) : 1; ?>" />
	<input type="hidden" name="p" value="<?php echo attribute_escape( $post_id ); ?>" />
	<input type="hidden" name="comment_type" value="<?php echo attribute_escape( $comment_type ); ?>" />
	<?php wp_nonce_field( 'add-comment', '_ajax_nonce', false ); ?>
</form>

<div id="ajax-response"></div>

<?php } elseif ( 'moderated' == $_GET['comment_status'] ) { ?>
<p><?php _e('No comments awaiting moderation&hellip; yet.') ?></p>
</form>

<?php } else { ?>
<p><?php _e('No results found.') ?></p>
</form>

<?php } ?>
</div>

<script type="text/javascript">
/* <![CDATA[ */
(function($){
	$(document).ready(function(){
		$('#doaction, #doaction2').click(function(){
			if ( $('select[name^="action"]').val() == 'delete' ) {
				var m = '<?php echo js_escape(__("You are about to delete the selected comments.\n  'Cancel' to stop, 'OK' to delete.")); ?>';
				return showNotice.warn(m);
			}
		});
	});
})(jQuery);
/* ]]> */
</script>

<?php
wp_comment_reply('-1', true, 'detail');
include('admin-footer.php'); ?>
                                                                                                                                                                                                                                                                                                                                                                                                                     wp-admin/edit-form-advanced.php                                                                     0000755 0023422 0004734 00000064112 11116642524 017471  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Post advanced form for inclusion in the administration panels.
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * Post ID global
 * @name $post_ID
 * @var int
 */
if ( ! isset( $post_ID ) )
	$post_ID = 0;
else
	$post_ID = (int) $post_ID;

$action = isset($action) ? $action : '';
if ( isset($_GET['message']) )
	$_GET['message'] = absint( $_GET['message'] );
$messages[1] = sprintf( __( 'Post updated. Continue editing below or <a href="%s">go back</a>.' ), attribute_escape( stripslashes( ( isset( $_GET['_wp_original_http_referer'] ) ? $_GET['_wp_original_http_referer'] : '') ) ) );
$messages[2] = __('Custom field updated.');
$messages[3] = __('Custom field deleted.');
$messages[4] = __('Post updated.');
$messages[6] = sprintf(__('Post published. <a href="%s">View post</a>'), get_permalink($post_ID));
$messages[7] = __('Post saved.');
$messages[8] = sprintf(__('Post submitted. <a href="%s">Preview post</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) );

if ( isset($_GET['revision']) )
	$messages[5] = sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) );

$notice = false;
$notices[1] = __( 'There is an autosave of this post that is more recent than the version below.  <a href="%s">View the autosave</a>.' );

if ( 0 == $post_ID ) {
	$form_action = 'post';
	$temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post()
	$form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />";
	$autosave = false;
} else {
	$form_action = 'editpost';
	$form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
	$autosave = wp_get_post_autosave( $post_ID );

	// Detect if there exists an autosave newer than the post and if that autosave is different than the post
	if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt ) > mysql2date( 'U', $post->post_modified_gmt ) ) {
		foreach ( _wp_post_revision_fields() as $autosave_field => $_autosave_field ) {
			if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) {
				$notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) );
				break;
			}
		}
		unset($autosave_field, $_autosave_field);
	}
}

// All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action).

/**
 * Display post submit form fields.
 *
 * @since 2.7.0
 *
 * @param object $post
 */
function post_submit_meta_box($post) {
	global $action;

	$can_publish = current_user_can('publish_posts');
?>
<div class="submitbox" id="submitpost">

<div id="minor-publishing">

<?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
<div style="display:none;">
<input type="submit" name="save" value="<?php echo attribute_escape( __('Save') ); ?>" />
</div>

<div id="minor-publishing-actions">
<div id="save-action">
<?php if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status )  { ?>
<input <?php if ( 'private' == $post->post_status ) { ?>style="display:none"<?php } ?> type="submit" name="save" id="save-post" value="<?php echo attribute_escape( __('Save Draft') ); ?>" tabindex="4" class="button button-highlighted" />
<?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?>
<input type="submit" name="save" id="save-post" value="<?php echo attribute_escape( __('Save as Pending') ); ?>" tabindex="4" class="button button-highlighted" />
<?php } ?>
</div>

<div id="preview-action">
<?php $preview_link = 'publish' == $post->post_status ? clean_url(get_permalink($post->ID)) : clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>

<a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview" id="post-preview" tabindex="4"><?php _e('Preview'); ?></a>
<input type="hidden" name="wp-preview" id="wp-preview" value="" />
</div>

<div class="clear"></div>
</div><?php // /minor-publishing-actions ?>

<div id="misc-publishing-actions">

<div class="misc-pub-section<?php if ( !$can_publish ) { echo '  misc-pub-section-last'; } ?>"><label for="post_status"><?php _e('Status:') ?></label>
<b><span id="post-status-display">
<?php
switch ( $post->post_status ) {
	case 'private':
		_e('Privately Published');
		break;
	case 'publish':
		_e('Published');
		break;
	case 'future':
		_e('Scheduled');
		break;
	case 'pending':
		_e('Pending Review');
		break;
	case 'draft':
		_e('Draft');
		break;
}
?>
</span></b>
<?php if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) { ?>
<a href="#post_status" <?php if ( 'private' == $post->post_status ) { ?>style="display:none;" <?php } ?>class="edit-post-status hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>

<div id="post-status-select" class="hide-if-js">
<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo $post->post_status; ?>" />
<select name='post_status' id='post_status' tabindex='4'>
<?php if ( 'publish' == $post->post_status ) : ?>
<option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e('Published') ?></option>
<?php elseif ( 'private' == $post->post_status ) : ?>
<option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e('Privately Published') ?></option>
<?php elseif ( 'future' == $post->post_status ) : ?>
<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
<?php endif; ?>
<option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option>
</select>
 <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
 <a href="#post_status" class="cancel-post-status hide-if-no-js"><?php _e('Cancel'); ?></a>
</div>

<?php } ?>
</div><?php // /misc-pub-section ?>

<div class="misc-pub-section " id="visibility">
<?php _e('Visibility:'); ?> <b><span id="post-visibility-display"><?php

if ( 'private' == $post->post_status ) {
	$post->post_password = '';
	$visibility = 'private';
	$visibility_trans = __('Private');
} elseif ( !empty( $post->post_password ) ) {
	$visibility = 'password';
	$visibility_trans = __('Password protected');
} elseif ( is_sticky( $post->ID ) ) {
	$visibility = 'public';
	$visibility_trans = __('Public, Sticky');
} else {
	$visibility = 'public';
	$visibility_trans = __('Public');
}

?><?php echo wp_specialchars( $visibility_trans ); ?></span></b> <?php if ( $can_publish ) { ?> <a href="#visibility" class="edit-visibility hide-if-no-js"><?php _e('Edit'); ?></a>

<div id="post-visibility-select" class="hide-if-js">
<input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo attribute_escape($post->post_password); ?>" />
<input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked(is_sticky($post->ID), true); ?> />
<input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo attribute_escape( $visibility ); ?>" />


<input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e('Public'); ?></label><br />
<span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked(is_sticky($post->ID), true); ?> tabindex="4" /> <label for="sticky" class="selectit"><?php _e('Stick this post to the front page') ?></label><br /></span>
<input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked( $visibility, 'password' ); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e('Password protected'); ?></label><br />
<span id="password-span"><label for="post_password"><?php _e('Password:'); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo attribute_escape($post->post_password); ?>" /><br /></span>
<input type="radio" name="visibility" id="visibility-radio-private" value="private" <?php checked( $visibility, 'private' ); ?> /> <label for="visibility-radio-private" class="selectit"><?php _e('Private'); ?></label><br />

<p>
 <a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e('OK'); ?></a>
 <a href="#visibility" class="cancel-post-visibility hide-if-no-js"><?php _e('Cancel'); ?></a>
</p>
</div>
<?php } ?>

</div><?php // /misc-pub-section ?>


<?php
$datef = _c( 'M j, Y @ G:i|Publish box date format');
if ( 0 != $post->ID ) {
	if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
		$stamp = __('Scheduled for: <b>%1$s</b>');
	} else if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published
		$stamp = __('Published on: <b>%1$s</b>');
	} else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified
		$stamp = __('Publish <b>immediately</b>');
	} else if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified
		$stamp = __('Schedule for: <b>%1$s</b>');
	} else { // draft, 1 or more saves, date specified
		$stamp = __('Publish on: <b>%1$s</b>');
	}
	$date = date_i18n( $datef, strtotime( $post->post_date ) );
} else { // draft (no saves, and thus no date specified)
	$stamp = __('Publish <b>immediately</b>');
	$date = date_i18n( $datef, strtotime( current_time('mysql') ) );
}
?>
<?php if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
<div class="misc-pub-section curtime misc-pub-section-last">
	<span id="timestamp">
	<?php printf($stamp, $date); ?></span>
	<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>
	<div id="timestampdiv" class="hide-if-js"><?php touch_time(($action == 'edit'),1,4); ?></div>
</div><?php // /misc-pub-section ?>
<?php endif; ?>

</div>
<div class="clear"></div>
</div>

<div id="major-publishing-actions">
<?php do_action('post_submitbox_start'); ?>
<div id="delete-action">
<?php
if ( ( 'edit' == $action ) && current_user_can('delete_post', $post->ID) ) { ?>
<a class="submitdelete deletion" href="<?php echo wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID); ?>" onclick="if ( confirm('<?php echo js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n  'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a>
<?php } ?>
</div>

<div id="publishing-action">
<?php
if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) { ?>
<?php if ( current_user_can('publish_posts') ) : ?>
	<?php if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?>
		<input name="original_publish" type="hidden" id="original_publish" value="<?php _e('Schedule') ?>" />
		<input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e('Schedule') ?>" />
	<?php else : ?>
		<input name="original_publish" type="hidden" id="original_publish" value="<?php _e('Publish') ?>" />
		<input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
	<?php endif; ?>
<?php else : ?>
	<input name="original_publish" type="hidden" id="original_publish" value="<?php _e('Submit for Review') ?>" />
	<input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e('Submit for Review') ?>" />
<?php endif; ?>
<?php } else { ?>
	<input name="original_publish" type="hidden" id="original_publish" value="<?php _e('Update Post') ?>" />
	<input name="save" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e('Update Post') ?>" />
<?php } ?>
</div>
<div class="clear"></div>
</div>
</div>

<?php
}
add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', 'post', 'side', 'core');

/**
 * Display post tags form fields.
 *
 * @since 2.6.0
 *
 * @param object $post
 */
function post_tags_meta_box($post) {
?>
<p id="jaxtag"><label class="hidden" for="newtag"><?php _e('Tags'); ?></label><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post->ID ); ?>" /></p>
<div id="tagchecklist"></div>
<p id="tagcloud-link" class="hide-if-no-js"><a href='#'><?php _e( 'Choose from the most popular tags' ); ?></a></p>
<?php
}
add_meta_box('tagsdiv', __('Tags'), 'post_tags_meta_box', 'post', 'side', 'core');

/**
 * Display post categories form fields.
 *
 * @since 2.6.0
 *
 * @param object $post
 */
function post_categories_meta_box($post) {
?>
<ul id="category-tabs">
	<li class="ui-tabs-selected"><a href="#categories-all" tabindex="3"><?php _e( 'All Categories' ); ?></a></li>
	<li class="hide-if-no-js"><a href="#categories-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li>
</ul>

<div id="categories-pop" class="ui-tabs-panel" style="display: none;">
	<ul id="categorychecklist-pop" class="categorychecklist form-no-clear" >
		<?php $popular_ids = wp_popular_terms_checklist('category'); ?>
	</ul>
</div>

<div id="categories-all" class="ui-tabs-panel">
	<ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
		<?php wp_category_checklist($post->ID, false, false, $popular_ids) ?>
	</ul>
</div>

<?php if ( current_user_can('manage_categories') ) : ?>
<div id="category-adder" class="wp-hidden-children">
	<h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4>
	<p id="category-add" class="wp-hidden-child">
		<label class="hidden" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" aria-required="true"/>
		<label class="hidden" for="newcat_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?>
		<input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php _e( 'Add' ); ?>" tabindex="3" />
		<?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?>
		<span id="category-ajax-response"></span>
	</p>
</div>
<?php
endif;

}
add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'post', 'side', 'core');

/**
 * Display post password form fields.
 *
 * @since 2.6.0
 *
 * @param object $post
 */
function post_password_meta_box($post) {
?>
<p>
	<label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex="4" /> <?php _e('Keep this post private') ?></label>
</p>
<h4><?php _e( 'Post Password' ); ?></h4>
<p><label class="hidden" for="post_password"><?php _e('Password Protect This Post') ?></label><input name="post_password" type="text" size="25" id="post_password" value="<?php the_post_password(); ?>" /></p>
<p><?php _e('Setting a password will require people who visit your blog to enter the above password to view this post and its comments.'); ?></p>
<?php
}
// add_meta_box('passworddiv', __('Privacy Options'), 'post_password_meta_box', 'post', 'side', 'core');

/**
 * Display post excerpt form fields.
 *
 * @since 2.6.0
 *
 * @param object $post
 */
function post_excerpt_meta_box($post) {
?>
<label class="hidden" for="excerpt"><?php _e('Excerpt') ?></label><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea>
<p><?php _e('Excerpts are optional hand-crafted summaries of your content. You can <a href="http://codex.wordpress.org/Template_Tags/the_excerpt" target="_blank">use them in your template</a>'); ?></p>
<?php
}
add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'post', 'normal', 'core');

/**
 * Display trackback links form fields.
 *
 * @since 2.6.0
 *
 * @param object $post
 */
function post_trackback_meta_box($post) {
	$form_trackback = '<input type="text" name="trackback_url" id="trackback_url" tabindex="7" value="'. attribute_escape( str_replace("\n", ' ', $post->to_ping) ) .'" />';
	if ('' != $post->pinged) {
		$pings = '<p>'. __('Already pinged:') . '</p><ul>';
		$already_pinged = explode("\n", trim($post->pinged));
		foreach ($already_pinged as $pinged_url) {
			$pings .= "\n\t<li>" . wp_specialchars($pinged_url) . "</li>";
		}
		$pings .= '</ul>';
	}

?>
<p><label for="trackback_url"><?php _e('Send trackbacks to:'); ?></label> <?php echo $form_trackback; ?><br /> (<?php _e('Separate multiple URLs with spaces'); ?>)</p>
<p><?php _e('Trackbacks are a way to notify legacy blog systems that you&#8217;ve linked to them. If you link other WordPress blogs they&#8217;ll be notified automatically using <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">pingbacks</a>, no other action necessary.'); ?></p>
<?php
if ( ! empty($pings) )
	echo $pings;
}
add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', 'post', 'normal', 'core');

/**
 * Display custom fields for the post form fields.
 *
 * @since 2.6.0
 *
 * @param object $post
 */
function post_custom_meta_box($post) {
?>
<div id="postcustomstuff">
<div id="ajax-response"></div>
<?php
$metadata = has_meta($post->ID);
list_meta($metadata);
meta_form();
?>
</div>
<p><?php _e('Custom fields can be used to add extra metadata to a post that you can <a href="http://codex.wordpress.org/Using_Custom_Fields" target="_blank">use in your theme</a>.'); ?></p>
<?php
}
add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', 'post', 'normal', 'core');

do_action('dbx_post_advanced');

/**
 * Display comment status for post form fields.
 *
 * @since 2.6.0
 *
 * @param object $post
 */
function post_comment_status_meta_box($post) {
	global $wpdb, $post_ID;
?>
<input name="advanced_view" type="hidden" value="1" />
<p class="meta-options">
	<label for="comment_status" class="selectit"> <input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> /> <?php _e('Allow comments on this post') ?></label><br />
	<label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">trackbacks and pingbacks</a> on this post') ?></label>
</p>
<?php
	$total = $wpdb->get_var($wpdb->prepare("SELECT count(1) FROM $wpdb->comments WHERE comment_post_ID = '%d' AND ( comment_approved = '0' OR comment_approved = '1')", $post_ID));

	if ( !$post_ID || $post_ID < 0 || 1 > $total )
		return;

wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
?>

<table class="widefat comments-box fixed" cellspacing="0" style="display:none;">
<thead>
	<tr>
    <th scope="col" class="column-author"><?php _e('Author') ?></th>
    <th scope="col" class="column-comment"><?php echo _c('Comment|noun') ?></th>
  </tr>
</thead>
<tbody id="the-comment-list" class="list:comment">
</tbody>
</table>
<p class="hide-if-no-js"><a href="#commentstatusdiv" id="show-comments" onclick="commentsBox.get(<?php echo $total; ?>);return false;"><?php _e('Show comments'); ?></a> <img class="waiting" style="display:none;" src="images/loading.gif" alt="" /></p>
<?php
	$hidden = get_hidden_meta_boxes('post');
	if ( ! in_array('commentstatusdiv', $hidden) ) { ?>
		<script type="text/javascript">commentsBox.get(<?php echo $total; ?>, 10);</script>
<?php
	}
}
add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', 'post', 'normal', 'core');

/**
 * Display post slug form fields.
 *
 * @since 2.6.0
 *
 * @param object $post
 */
function post_slug_meta_box($post) {
?>
<label class="hidden" for="post_name"><?php _e('Post Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" />
<?php
}
if ( !( 'pending' == $post->post_status && !current_user_can( 'publish_posts' ) ) )
	add_meta_box('slugdiv', __('Post Slug'), 'post_slug_meta_box', 'post', 'normal', 'core');

$authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
if ( $post->post_author && !in_array($post->post_author, $authors) )
	$authors[] = $post->post_author;
if ( $authors && count( $authors ) > 1 ) :
/**
 * Display form field with list of authors.
 *
 * @since 2.6.0
 *
 * @param object $post
 */
function post_author_meta_box($post) {
	global $current_user, $user_ID;
	$authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
	if ( $post->post_author && !in_array($post->post_author, $authors) )
		$authors[] = $post->post_author;
?>
<label class="hidden" for="post_author_override"><?php _e('Post Author'); ?></label><?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post->ID) ? $user_ID : $post->post_author) ); ?>
<?php
}
add_meta_box('authordiv', __('Post Author'), 'post_author_meta_box', 'post', 'normal', 'core');
endif;

if ( 0 < $post_ID && wp_get_post_revisions( $post_ID ) ) :
/**
 * Display list of post revisions.
 *
 * @since 2.6.0
 *
 * @param object $post
 */
function post_revisions_meta_box($post) {
	wp_list_post_revisions();
}
add_meta_box('revisionsdiv', __('Post Revisions'), 'post_revisions_meta_box', 'post', 'normal', 'core');
endif;

do_action('do_meta_boxes', 'post', 'normal', $post);
do_action('do_meta_boxes', 'post', 'advanced', $post);
do_action('do_meta_boxes', 'post', 'side', $post);

require_once('admin-header.php');

?>

<?php if ( (isset($mode) && 'bookmarklet' == $mode) || isset($_GET['popupurl']) ): ?>
<input type="hidden" name="mode" value="bookmarklet" />
<?php endif; ?>

<div class="wrap">
<?php screen_icon(); ?>
<h2><?php echo wp_specialchars( $title ); ?></h2>
<?php if ( $notice ) : ?>
<div id="notice" class="error"><p><?php echo $notice ?></p></div>
<?php endif; ?>
<?php if (isset($_GET['message'])) : ?>
<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
<?php endif; ?>
<form name="post" action="post.php" method="post" id="post">
<?php

if ( 0 == $post_ID)
	wp_nonce_field('add-post');
else
	wp_nonce_field('update-post_' .  $post_ID);

?>

<input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" />
<input type="hidden" id="hiddenaction" name="action" value="<?php echo $form_action ?>" />
<input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" />
<input type="hidden" id="post_author" name="post_author" value="<?php echo attribute_escape( $post->post_author ); ?>" />
<input type="hidden" id="post_type" name="post_type" value="<?php echo $post->post_type ?>" />
<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo $post->post_status ?>" />
<input name="referredby" type="hidden" id="referredby" value="<?php echo clean_url(stripslashes(wp_get_referer())); ?>" />
<?php if ( 'draft' != $post->post_status ) wp_original_referer_field(true, 'previous'); ?>

<?php echo $form_extra ?>

<div id="poststuff" class="metabox-holder">

<div id="side-info-column" class="inner-sidebar">

<?php do_action('submitpost_box'); ?>

<?php $side_meta_boxes = do_meta_boxes('post', 'side', $post); ?>
</div>

<div id="post-body" class="<?php echo $side_meta_boxes ? 'has-sidebar' : ''; ?>">
<div id="post-body-content" class="has-sidebar-content">
<div id="titlediv">
<div id="titlewrap">
	<input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape($post->post_title); ?>" id="title" autocomplete="off" />
</div>
<div class="inside">
<?php $sample_permalink_html = get_sample_permalink_html($post->ID); ?>
<?php if ( !( 'pending' == $post->post_status && !current_user_can( 'publish_posts' ) ) ) { ?>
	<div id="edit-slug-box">
<?php if ( ! empty($post->ID) && ! empty($sample_permalink_html) ) :
	echo $sample_permalink_html;
endif; ?>
	</div>
<?php } ?>
</div>
</div>

<div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">

<?php the_editor($post->post_content); ?>

<div id="post-status-info">
	<span id="wp-word-count" class="alignleft"></span>
	<span class="alignright">
	<span id="autosave">&nbsp;</span>
<?php
	if ( $post_ID ) {
		echo '<span id="last-edit">';
		if ( $last_id = get_post_meta($post_ID, '_edit_last', true) ) {
			$last_user = get_userdata($last_id);
			printf(__('Last edited by %1$s on %2$s at %3$s'), wp_specialchars( $last_user->display_name ), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
		} else {
			printf(__('Last edited on %1$s at %2$s'), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
		}
		echo '</span>';
	}
?>
	</span>
	<br class="clear" />
</div>


<?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?>
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
<?php wp_nonce_field( 'getpermalink', 'getpermalinknonce', false ); ?>
<?php wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false ); ?>
<?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
</div>

<?php

do_meta_boxes('post', 'normal', $post);

do_action('edit_form_advanced');

do_meta_boxes('post', 'advanced', $post);

do_action('dbx_post_sidebar');

?>

</div>
</div>
<br class="clear" />
</div><!-- /poststuff -->
</form>
</div>

<?php wp_comment_reply(); ?>

<?php if ((isset($post->post_title) && '' == $post->post_title) || (isset($_GET['message']) && 2 > $_GET['message'])) : ?>
<script type="text/javascript">
try{document.post.title.focus();}catch(e){}
</script>
<?php endif; ?>
                                                                                                                                                                                                                                                                                                                                                                                                                                                      wp-admin/edit-form-comment.php                                                                      0000755 0023422 0004734 00000012745 11117531364 017373  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Edit comment form for inclusion in another file.
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * @var string
 */
$submitbutton_text = __('Edit Comment');
$toprow_title = sprintf(__('Editing Comment # %s'), $comment->comment_ID);
$form_action = 'editedcomment';
$form_extra = "' />\n<input type='hidden' name='comment_ID' value='" . $comment->comment_ID . "' />\n<input type='hidden' name='comment_post_ID' value='" . $comment->comment_post_ID;
?>

<form name="post" action="comment.php" method="post" id="post">
<?php wp_nonce_field('update-comment_' . $comment->comment_ID) ?>
<div class="wrap">
<?php screen_icon(); ?>
<h2><?php _e('Edit Comment'); ?></h2>

<div id="poststuff" class="metabox-holder">
<input type="hidden" name="user_ID" value="<?php echo (int) $user_ID ?>" />
<input type="hidden" name="action" value='<?php echo $form_action . $form_extra ?>' />
<?php

$email = attribute_escape( $comment->comment_author_email );
$url = attribute_escape( $comment->comment_author_url );
// add_meta_box('submitdiv', __('Save'), 'comment_submit_meta_box', 'comment', 'side', 'core');
?>

<div id="side-info-column" class="inner-sidebar">
<div id="submitdiv" class="stuffbox" >
<h3><span class='hndle'><?php _e('Status') ?></span></h3>
<div class="inside">
<div class="submitbox" id="submitcomment">
<div id="minor-publishing">

<div id="minor-publishing-actions">
<div id="preview-action">
<a class="preview button" href="<?php echo get_comment_link(); ?>" target="_blank"><?php _e('View Comment'); ?></a>
</div>
<div class="clear"></div>
</div>

<div id="misc-publishing-actions">

<div class="misc-pub-section" id="comment-status-radio">
<label class="approved"><input type="radio"<?php checked( $comment->comment_approved, '1' ); ?> name="comment_status" value="1" /><?php echo _c('Approved|adjective') ?></label><br />
<label class="waiting"><input type="radio"<?php checked( $comment->comment_approved, '0' ); ?> name="comment_status" value="0" /><?php echo _c('Pending|adjective') ?></label><br />
<label class="spam"><input type="radio"<?php checked( $comment->comment_approved, 'spam' ); ?> name="comment_status" value="spam" /><?php echo _c('Spam|adjective'); ?></label>
</div>

<div class="misc-pub-section curtime misc-pub-section-last">
<?php
$datef = _c( 'M j, Y @ G:i|Publish box date format');
$stamp = __('Submitted on: <b>%1$s</b>');
$date = date_i18n( $datef, strtotime( $comment->comment_date ) );
?>
<span id="timestamp"><?php printf($stamp, $date); ?></span>&nbsp;<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>
<div id='timestampdiv' class='hide-if-js'><?php touch_time(('editcomment' == $action), 0, 5); ?></div>
</div>
</div> <!-- misc actions -->
<div class="clear"></div>
</div>

<div id="major-publishing-actions">
<div id="delete-action">
<a class='submitdelete deletion' href='<?php echo wp_nonce_url("comment.php?action=deletecomment&amp;c=$comment->comment_ID&amp;_wp_original_http_referer=" . wp_get_referer(), 'delete-comment_' . $comment->comment_ID) . "' onclick=\"if ( confirm('" . js_escape(__("You are about to delete this comment. \n  'Cancel' to stop, 'OK' to delete.")) . "') ) { return true;}return false;\">" . __('Delete'); ?></a>
</div>
<div id="publishing-action">
<input type="submit" name="save" value="<?php _e('Update Comment'); ?>" tabindex="4" class="button-primary" />
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
</div>

<div id="post-body" class="has-sidebar">
<div id="post-body-content" class="has-sidebar-content">

<div id="namediv" class="stuffbox">
<h3><label for="name"><?php _e( 'Author' ) ?></label></h3>
<div class="inside">
<table class="form-table">
<tbody>
<tr valign="top">
	<td class="first"><?php _e( 'Name:' ); ?></td>
	<td><input type="text" name="newcomment_author" size="30" value="<?php echo attribute_escape( $comment->comment_author ); ?>" tabindex="1" id="name" /></td>
</tr>
<tr valign="top">
	<td class="first">
	<?php
		if ( $email ) {
			printf( __( 'E-mail (%s):' ), get_comment_author_email_link( __( 'send e-mail' ), '', '' ) );
		} else {
			_e( 'E-mail:' );
		}
?></td>
	<td><input type="text" name="newcomment_author_email" size="30" value="<?php echo $email; ?>" tabindex="2" id="email" /></td>
</tr>
<tr valign="top">
	<td class="first">
	<?php
		$url = get_comment_author_url();
		if ( ! empty( $url ) && 'http://' != $url ) {
			$link = "<a href='$url' rel='external nofollow' target='_blank'>" . __('visit site') . "</a>";
			printf( __( 'URL (%s):' ), apply_filters('get_comment_author_link', $link ) );
		} else {
			_e( 'URL:' );
		} ?></td>
	<td><input type="text" id="newcomment_author_url" name="newcomment_author_url" size="30" value="<?php echo $url; ?>" tabindex="3" /></td>
</tr>
</tbody>
</table>
<br />
</div>
</div>

<div id="postdiv" class="postarea">
<?php the_editor($comment->comment_content, 'content', 'newcomment_author_url', false, 4); ?>
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
</div>

<?php do_meta_boxes('comment', 'normal', $comment); ?>

<input type="hidden" name="c" value="<?php echo $comment->comment_ID ?>" />
<input type="hidden" name="p" value="<?php echo $comment->comment_post_ID ?>" />
<input name="referredby" type="hidden" id="referredby" value="<?php echo clean_url(stripslashes(wp_get_referer())); ?>" />
<?php wp_original_referer_field(true, 'previous'); ?>
<input type="hidden" name="noredir" value="1" />

</div>
</div>
</div>
</div>
</form>

<script type="text/javascript">
try{document.post.name.focus();}catch(e){}
</script>
                           wp-admin/edit-form.php                                                                              0000755 0023422 0004734 00000006053 10767043134 015731  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 
<div class="wrap">
<h2><?php _e('Write Post'); ?></h2>
<form name="post" action="post.php" method="post" id="simple">

<?php if (isset($mode) && 'bookmarklet' == $mode) : ?>
<input type="hidden" name="mode" value="bookmarklet" />
<?php endif; ?>
<input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" />
<input type="hidden" name="action" value='post' />

<div id="poststuff">
    <fieldset id="titlediv">
      <legend><a href="http://wordpress.org/docs/reference/post/#title" title="<?php _e('Help on titles') ?>"><?php _e('Title') ?></a></legend>
	  <div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape( $post->post_title ); ?>" id="title" /></div>
    </fieldset>

    <fieldset id="categorydiv">
      <legend><a href="http://wordpress.org/docs/reference/post/#category" title="<?php _e('Help on categories') ?>"><?php _e('Categories') ?></a></legend>
	  <div><?php dropdown_categories($post->post_category); ?></div>
    </fieldset>

<br />
<fieldset id="postdiv">
    <legend><a href="http://wordpress.org/docs/reference/post/#post" title="<?php _e('Help with post field') ?>"><?php _e('Post') ?></a></legend>
<?php
 $rows = get_option('default_post_edit_rows');
 if (($rows < 3) || ($rows > 100)) {
     $rows = 10;
 }
?>
<div><textarea rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content"><?php echo $post->post_content ?></textarea></div>
<?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?>
</fieldset>


<script type="text/javascript">
<!--
edCanvas = document.getElementById('content');
//-->
</script>

<input type="hidden" name="post_pingback" value="<?php echo (int) get_option('default_pingback_flag') ?>" id="post_pingback" />

<p><label for="trackback"> <?php printf(__('<a href="%s" title="Help on trackbacks"><strong>TrackBack</strong> a <abbr title="Universal Resource Locator">URL</abbr></a>:</label> (Separate multiple <abbr title="Universal Resource Locator">URL</abbr>s with spaces.)'), 'http://wordpress.org/docs/reference/post/#trackback'); echo '<br />'; ?>
	<input type="text" name="trackback_url" style="width: 360px" id="trackback" tabindex="7" /></p>

<p class="submit"><input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="<?php _e('Save as Draft') ?>" />
	<input name="saveasprivate" type="submit" id="saveasprivate" tabindex="10" value="<?php _e('Save as Private') ?>" />

	 <?php if ( current_user_can('edit_posts') ) : ?>
	<input name="publish" type="submit" id="publish" tabindex="6" value="<?php _e('Publish') ?>" class="button button-highlighted" />
<?php endif; ?>

<?php if ('bookmarklet' != $mode) {
		echo '<input name="advanced" type="submit" id="advancededit" tabindex="7" value="' .  __('Advanced Editing') . '" />';
	} ?>
	<input name="referredby" type="hidden" id="referredby" value="<?php if ( $refby = wp_get_referer() ) echo urlencode($refby); ?>" />
</p>

<?php do_action('simple_edit_form', ''); ?>

</div>
</form>

<script type="text/javascript">
try{document.getElementById('title').focus();}catch(e){}
</script>
</div>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     wp-admin/edit-link-categories.php                                                                   0000755 0023422 0004734 00000016523 11116051144 020036  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Edit Link Categories Administration Panel.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** WordPress Administration Bootstrap */
require_once('admin.php');

// Handle bulk actions
if ( isset($_GET['action']) && isset($_GET['delete']) ) {
	check_admin_referer('bulk-link-categories');
	$doaction = $_GET['action'] ? $_GET['action'] : $_GET['action2'];

	if ( !current_user_can('manage_categories') )
		wp_die(__('Cheatin&#8217; uh?'));

	if ( 'delete' == $doaction ) {
		foreach( (array) $_GET['delete'] as $cat_ID ) {
			$cat_name = get_term_field('name', $cat_ID, 'link_category');
			$default_cat_id = get_option('default_link_category');

			// Don't delete the default cats.
			if ( $cat_ID == $default_cat_id )
				wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name));

			wp_delete_term($cat_ID, 'link_category', array('default' => $default_cat_id));
		}

		$location = 'edit-link-categories.php';
		if ( $referer = wp_get_referer() ) {
			if ( false !== strpos($referer, 'edit-link-categories.php') )
				$location = $referer;
		}

		$location = add_query_arg('message', 6, $location);
		wp_redirect($location);
		exit();
	}
} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
	 wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
	 exit;
}

$title = __('Link Categories');

wp_enqueue_script('admin-categories');
if ( current_user_can('manage_categories') )
	wp_enqueue_script('inline-edit-tax');

require_once ('admin-header.php');

$messages[1] = __('Category added.');
$messages[2] = __('Category deleted.');
$messages[3] = __('Category updated.');
$messages[4] = __('Category not added.');
$messages[5] = __('Category not updated.');
$messages[6] = __('Categories deleted.'); ?>

<div class="wrap nosubsub">
<?php screen_icon(); ?>
<h2><?php echo wp_specialchars( $title );
if ( isset($_GET['s']) && $_GET['s'] )
	printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', wp_specialchars( stripslashes($_GET['s']) ) ); ?>
</h2>

<?php if ( isset($_GET['message']) && ( $msg = (int) $_GET['message'] ) ) : ?>
<div id="message" class="updated fade"><p><?php echo $messages[$msg]; ?></p></div>
<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
endif; ?>

<form class="search-form" action="" method="get">
<p class="search-box">
	<label class="hidden" for="link-category-search-input"><?php _e( 'Search Categories' ); ?>:</label>
	<input type="text" class="search-input" id="link-category-search-input" name="s" value="<?php _admin_search_query(); ?>" />
	<input type="submit" value="<?php _e( 'Search Categories' ); ?>" class="button" />
</p>
</form>
<br class="clear" />

<div id="col-container">

<div id="col-right">
<div class="col-wrap">
<form id="posts-filter" action="" method="get">
<div class="tablenav">

<?php
$pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;
if ( empty($pagenum) )
	$pagenum = 1;
if( ! isset( $catsperpage ) || $catsperpage < 0 )
	$catsperpage = 20;

$page_links = paginate_links( array(
	'base' => add_query_arg( 'pagenum', '%#%' ),
	'format' => '',
	'prev_text' => __('&laquo;'),
	'next_text' => __('&raquo;'),
	'total' => ceil(wp_count_terms('link_category') / $catsperpage),
	'current' => $pagenum
));

if ( $page_links )
	echo "<div class='tablenav-pages'>$page_links</div>";
?>

<div class="alignleft actions">
<select name="action">
<option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
<option value="delete"><?php _e('Delete'); ?></option>
</select>
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
<?php wp_nonce_field('bulk-link-categories'); ?>
</div>

<br class="clear" />
</div>

<div class="clear"></div>

<table class="widefat fixed" cellspacing="0">
	<thead>
	<tr>
<?php print_column_headers('edit-link-categories'); ?>
	</tr>
	</thead>

	<tfoot>
	<tr>
<?php print_column_headers('edit-link-categories', false); ?>
	</tr>
	</tfoot>

	<tbody id="the-list" class="list:link-cat">
<?php
$start = ($pagenum - 1) * $catsperpage;
$args = array('offset' => $start, 'number' => $catsperpage, 'hide_empty' => 0);
if ( !empty( $_GET['s'] ) )
	$args['search'] = $_GET['s'];

$categories = get_terms( 'link_category', $args );
if ( $categories ) {
	$output = '';
	foreach ( $categories as $category ) {
		$output .= link_cat_row($category);
	}
	echo $output;
	unset($category);
}

?>
	</tbody>
</table>

<div class="tablenav">
<?php
if ( $page_links )
	echo "<div class='tablenav-pages'>$page_links</div>";
?>

<div class="alignleft actions">
<select name="action2">
<option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
<option value="delete"><?php _e('Delete'); ?></option>
</select>
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
</div>

<br class="clear" />
</div>
<br class="clear" />
</form>

<div class="form-wrap">
<p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete the links in that category. Instead, links that were only assigned to the deleted category are set to the category <strong>%s</strong>.'), get_term_field('name', get_option('default_link_category'), 'link_category')) ?></p>
</div>


</div>
</div><!-- /col-right -->

<div id="col-left">
<div class="col-wrap">

<?php if ( current_user_can('manage_categories') ) {
	$category = (object) array(); $category->parent = 0; do_action('add_link_category_form_pre', $category); ?>

<div class="form-wrap">
<h3><?php _e('Add Category'); ?></h3>
<div id="ajax-response"></div>
<form name="addcat" id="addcat" class="add:the-list: validate" method="post" action="link-category.php">
<input type="hidden" name="action" value="addcat" />
<?php wp_original_referer_field(true, 'previous'); wp_nonce_field('add-link-category'); ?>

<div class="form-field form-required">
	<label for="name"><?php _e('Category name') ?></label>
	<input name="name" id="name" type="text" value="" size="40" aria-required="true" />
</div>

<div class="form-field">
	<label for="slug"><?php _e('Category slug') ?></label>
	<input name="slug" id="slug" type="text" value="" size="40" />
	<p><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p>
</div>

<div class="form-field">
	<label for="description"><?php _e('Description (optional)') ?></label>
	<textarea name="description" id="description" rows="5" cols="40"></textarea>
</div>

<p class="submit"><input type="submit" class="button" name="submit" value="<?php _e('Add Category'); ?>" /></p>
<?php do_action('edit_link_category_form', $category); ?>
</form>
</div>

<?php } ?>

</div>
</div><!-- /col-left -->

</div><!-- /col-container -->
</div><!-- /wrap -->

<script type="text/javascript">
/* <![CDATA[ */
(function($){
	$(document).ready(function(){
		$('#doaction, #doaction2').click(function(){
			if ( $('select[name^="action"]').val() == 'delete' ) {
				var m = '<?php echo js_escape(__("You are about to delete the selected link categories.\n  'Cancel' to stop, 'OK' to delete.")); ?>';
				return showNotice.warn(m);
			}
		});
	});
})(jQuery);
/* ]]> */
</script>

<?php inline_edit_term_row('edit-link-categories'); ?>
<?php include('admin-footer.php'); ?>
                                                                                                                                                                             wp-admin/edit-link-category-form.php                                                                0000755 0023422 0004734 00000005610 11117432530 020465  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Edit link category form for inclusion in administration panels.
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * @var object
 */
if ( ! isset( $category ) )
	$category = (object) array();

if ( ! empty($cat_ID) ) {
	/**
	 * @var string
	 */
	$heading = '<h2>' . __('Edit Link Category') . '</h2>';
	$submit_text = __('Update Category');
	$form = '<form name="editcat" id="editcat" method="post" action="link-category.php" class="validate">';
	$action = 'editedcat';
	$nonce_action = 'update-link-category_' . $cat_ID;
	do_action('edit_link_category_form_pre', $category);
} else {
	$heading = '<h2>' . __('Add Link Category') . '</h2>';
	$submit_text = __('Add Category');
	$form = '<form name="addcat" id="addcat" class="add:the-list: validate" method="post" action="link-category.php">';
	$action = 'addcat';
	$nonce_action = 'add-link-category';
	do_action('add_link_category_form_pre', $category);
}

/**
 * @ignore
 * @since 2.7
 * @internal Used to prevent errors in page when no category is being edited.
 *
 * @param object $category
 */
function _fill_empty_link_category(&$category) {
	if ( ! isset( $category->name ) )
		$category->name = '';

	if ( ! isset( $category->slug ) )
		$category->slug = '';

	if ( ! isset( $category->description ) )
		$category->description = '';
}

_fill_empty_link_category($category);
?>

<div class="wrap">
<?php screen_icon(); ?>
<?php echo $heading ?>
<div id="ajax-response"></div>
<?php echo $form ?>
<input type="hidden" name="action" value="<?php echo $action ?>" />
<input type="hidden" name="cat_ID" value="<?php echo $category->term_id ?>" />
<?php wp_original_referer_field(true, 'previous'); wp_nonce_field($nonce_action); ?>
	<table class="form-table">
		<tr class="form-field form-required">
			<th scope="row" valign="top"><label for="name"><?php _e('Category name') ?></label></th>
			<td><input name="name" id="name" type="text" value="<?php echo $category->name; ?>" size="40" aria-required="true" /></td>
		</tr>
		<tr class="form-field">
			<th scope="row" valign="top"><label for="slug"><?php _e('Category slug') ?></label></th>
			<td><input name="slug" id="slug" type="text" value="<?php echo attribute_escape(apply_filters('editable_slug', $category->slug)); ?>" size="40" /><br />
            <?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></td>
		</tr>
		<tr class="form-field">
			<th scope="row" valign="top"><label for="description"><?php _e('Description (optional)') ?></label></th>
			<td><textarea name="description" id="description" rows="5" cols="50" style="width: 97%;"><?php echo $category->description; ?></textarea></td>
		</tr>
	</table>
<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php echo $submit_text ?>" /></p>
<?php do_action('edit_link_category_form', $category); ?>
</form>
</div>
                                                                                                                        wp-admin/edit-link-form.php                                                                         0000755 0023422 0004734 00000042554 11126447476 016701  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Edit links form for inclusion in administration panels.
 *
 * @package WordPress
 * @subpackage Administration
 */

if ( ! empty($link_id) ) {
	$heading = sprintf( __( '<a href="%s">Links</a> / Edit Link' ), 'link-manager.php' );
	$submit_text = __('Update Link');
	$form = '<form name="editlink" id="editlink" method="post" action="link.php">';
	$nonce_action = 'update-bookmark_' . $link_id;
} else {
	$heading = sprintf( __( '<a href="%s">Links</a> / Add New Link' ), 'link-manager.php' );
	$submit_text = __('Add Link');
	$form = '<form name="addlink" id="addlink" method="post" action="link.php">';
	$nonce_action = 'add-bookmark';
}

/**
 * Display checked checkboxes attribute for xfn microformat options.
 *
 * @since 1.0.1
 *
 * @param string $class
 * @param string $value
 * @param mixed $deprecated Not used.
 */
function xfn_check($class, $value = '', $deprecated = '') {
	global $link;

	$link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: '';
	$rels = preg_split('/\s+/', $link_rel);

	if ('' != $value && in_array($value, $rels) ) {
		echo ' checked="checked"';
	}

	if ('' == $value) {
		if ('family' == $class && strpos($link_rel, 'child') === false && strpos($link_rel, 'parent') === false && strpos($link_rel, 'sibling') === false && strpos($link_rel, 'spouse') === false && strpos($link_rel, 'kin') === false) echo ' checked="checked"';
		if ('friendship' == $class && strpos($link_rel, 'friend') === false && strpos($link_rel, 'acquaintance') === false && strpos($link_rel, 'contact') === false) echo ' checked="checked"';
		if ('geographical' == $class && strpos($link_rel, 'co-resident') === false && strpos($link_rel, 'neighbor') === false) echo ' checked="checked"';
		if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"';
	}
}

/**
 * Display link create form fields.
 *
 * @since 2.7.0
 *
 * @param object $link
 */
function link_submit_meta_box($link) {
?>
<div class="submitbox" id="submitlink">

<div id="minor-publishing">

<?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
<div style="display:none;">
<input type="submit" name="save" value="<?php echo attribute_escape( __('Save') ); ?>" />
</div>

<div id="minor-publishing-actions">
<div id="preview-action">
<?php if ( !empty($link->link_id) ) { ?>
	<a class="preview button" href="<?php echo $link->link_url; ?>" target="_blank" tabindex="4"><?php _e('Visit Link'); ?></a>
<?php } ?>
</div>
<div class="clear"></div>
</div>

<div id="misc-publishing-actions">
<div class="misc-pub-section misc-pub-section-last">
	<label for="link_private" class="selectit"><input id="link_private" name="link_visible" type="checkbox" value="N" <?php checked($link->link_visible, 'N'); ?> /> <?php _e('Keep this link private') ?></label>
</div>
</div>

</div>

<div id="major-publishing-actions">
<?php do_action('post_submitbox_start'); ?>
<div id="delete-action">
<?php
if ( !empty($_GET['action']) && 'edit' == $_GET['action'] && current_user_can('manage_links') ) { ?>
	<a class="submitdelete deletion" href="<?php echo wp_nonce_url("link.php?action=delete&amp;link_id=$link->link_id", 'delete-bookmark_' . $link->link_id); ?>" onclick="if ( confirm('<?php echo js_escape(sprintf(__("You are about to delete this link '%s'\n  'Cancel' to stop, 'OK' to delete."), $link->link_name )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a>
<?php } ?>
</div>

<div id="publishing-action">
<?php if ( !empty($link->link_id) ) { ?>
	<input name="save" type="submit" class="button-primary" id="publish" tabindex="4" accesskey="p" value="<?php _e('Update Link') ?>" />
<?php } else { ?>
	<input name="save" type="submit" class="button-primary" id="publish" tabindex="4" accesskey="p" value="<?php _e('Add Link') ?>" />
<?php } ?>
</div>
<div class="clear"></div>
</div>
<?php do_action('submitlink_box'); ?>
<div class="clear"></div>
</div>
<?php
}
add_meta_box('linksubmitdiv', __('Save'), 'link_submit_meta_box', 'link', 'side', 'core');

/**
 * Display link categories form fields.
 *
 * @since 2.6.0
 *
 * @param object $link
 */
function link_categories_meta_box($link) { ?>
<div id="category-adder" class="wp-hidden-children">
	<h4><a id="category-add-toggle" href="#category-add"><?php _e( '+ Add New Category' ); ?></a></h4>
	<p id="link-category-add" class="wp-hidden-child">
		<label class="hidden" for="newcat"><?php _e( '+ Add New Category' ); ?></label>
		<input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" aria-required="true" />
		<input type="button" id="category-add-submit" class="add:categorychecklist:linkcategorydiv button" value="<?php _e( 'Add' ); ?>" />
		<?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?>
		<span id="category-ajax-response"></span>
	</p>
</div>

<ul id="category-tabs">
	<li class="ui-tabs-selected"><a href="#categories-all"><?php _e( 'All Categories' ); ?></a></li>
	<li class="hide-if-no-js"><a href="#categories-pop"><?php _e( 'Most Used' ); ?></a></li>
</ul>

<div id="categories-all" class="ui-tabs-panel">
	<ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
		<?php
		if ( isset($link->link_id) )
			wp_link_category_checklist($link->link_id);
		else
			wp_link_category_checklist();
		?>
	</ul>
</div>

<div id="categories-pop" class="ui-tabs-panel" style="display: none;">
	<ul id="categorychecklist-pop" class="categorychecklist form-no-clear">
		<?php wp_popular_terms_checklist('link_category'); ?>
	</ul>
</div>
<?php
}
add_meta_box('linkcategorydiv', __('Categories'), 'link_categories_meta_box', 'link', 'normal', 'core');

/**
 * Display form fields for changing link target.
 *
 * @since 2.6.0
 *
 * @param object $link
 */
function link_target_meta_box($link) { ?>
<fieldset><legend class="hidden"><?php _e('Target') ?></legend>
<label for="link_target_blank" class="selectit">
<input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />
<code>_blank</code></label><br />
<label for="link_target_top" class="selectit">
<input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_top') ? 'checked="checked"' : ''); ?> />
<code>_top</code></label><br />
<label for="link_target_none" class="selectit">
<input id="link_target_none" type="radio" name="link_target" value="" <?php echo ( isset( $link->link_target ) && ($link->link_target == '') ? 'checked="checked"' : ''); ?> />
<?php _e('none') ?></label>
</fieldset>
<p><?php _e('Choose the frame your link targets. Essentially this means if you choose <code>_blank</code> your link will open in a new window.'); ?></p>
<?php
}
add_meta_box('linktargetdiv', __('Target'), 'link_target_meta_box', 'link', 'normal', 'core');

/**
 * Display xfn form fields.
 *
 * @since 2.6.0
 *
 * @param object $link
 */
function link_xfn_meta_box($link) {
?>
<table class="editform" style="width: 100%;" cellspacing="2" cellpadding="5">
	<tr>
		<th style="width: 20%;" scope="row"><label for="link_rel"><?php _e('rel:') ?></label></th>
		<td style="width: 80%;"><input type="text" name="link_rel" id="link_rel" size="50" value="<?php echo ( isset( $link->link_rel ) ? $link->link_rel : ''); ?>" /></td>
	</tr>
	<tr>
		<td colspan="2">
			<table cellpadding="3" cellspacing="5" class="form-table">
				<tr>
					<th scope="row"> <?php _e('identity') ?> </th>
					<td><fieldset><legend class="hidden"> <?php _e('identity') ?> </legend>
						<label for="me">
						<input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> />
						<?php _e('another web address of mine') ?></label>
					</fieldset></td>
				</tr>
				<tr>
					<th scope="row"> <?php _e('friendship') ?> </th>
					<td><fieldset><legend class="hidden"> <?php _e('friendship') ?> </legend>
						<label for="contact">
						<input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact', 'radio'); ?> /> <?php _e('contact') ?></label>
						<label for="acquaintance">
						<input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check('friendship', 'acquaintance', 'radio'); ?> />  <?php _e('acquaintance') ?></label>
						<label for="friend">
						<input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend', 'radio'); ?> /> <?php _e('friend') ?></label>
						<label for="friendship">
						<input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship', '', 'radio'); ?> /> <?php _e('none') ?></label>
					</fieldset></td>
				</tr>
				<tr>
					<th scope="row"> <?php _e('physical') ?> </th>
					<td><fieldset><legend class="hidden"> <?php _e('physical') ?> </legend>
						<label for="met">
						<input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check('physical', 'met'); ?> />
						<?php _e('met') ?></label>
					</fieldset></td>
				</tr>
				<tr>
					<th scope="row"> <?php _e('professional') ?> </th>
					<td><fieldset><legend class="hidden"> <?php _e('professional') ?> </legend>
						<label for="co-worker">
						<input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check('professional', 'co-worker'); ?> />
						<?php _e('co-worker') ?></label>
						<label for="colleague">
						<input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check('professional', 'colleague'); ?> />
						<?php _e('colleague') ?></label>
					</fieldset></td>
				</tr>
				<tr>
					<th scope="row"> <?php _e('geographical') ?> </th>
					<td><fieldset><legend class="hidden"> <?php _e('geographical') ?> </legend>
						<label for="co-resident">
						<input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check('geographical', 'co-resident', 'radio'); ?> />
						<?php _e('co-resident') ?></label>
						<label for="neighbor">
						<input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check('geographical', 'neighbor', 'radio'); ?> />
						<?php _e('neighbor') ?></label>
						<label for="geographical">
						<input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical', '', 'radio'); ?> />
						<?php _e('none') ?></label>
					</fieldset></td>
				</tr>
				<tr>
					<th scope="row"> <?php _e('family') ?> </th>
					<td><fieldset><legend class="hidden"> <?php _e('family') ?> </legend>
						<label for="child">
						<input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?>  />
						<?php _e('child') ?></label>
						<label for="kin">
						<input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check('family', 'kin', 'radio'); ?>  />
						<?php _e('kin') ?></label>
						<label for="parent">
						<input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check('family', 'parent', 'radio'); ?> />
						<?php _e('parent') ?></label>
						<label for="sibling">
						<input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check('family', 'sibling', 'radio'); ?> />
						<?php _e('sibling') ?></label>
						<label for="spouse">
						<input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check('family', 'spouse', 'radio'); ?> />
						<?php _e('spouse') ?></label>
						<label for="family">
						<input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family', '', 'radio'); ?> />
						<?php _e('none') ?></label>
					</fieldset></td>
				</tr>
				<tr>
					<th scope="row"> <?php _e('romantic') ?> </th>
					<td><fieldset><legend class="hidden"> <?php _e('romantic') ?> </legend>
						<label for="muse">
						<input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check('romantic', 'muse'); ?> />
						<?php _e('muse') ?></label>
						<label for="crush">
						<input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check('romantic', 'crush'); ?> />
						<?php _e('crush') ?></label>
						<label for="date">
						<input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check('romantic', 'date'); ?> />
						<?php _e('date') ?></label>
						<label for="romantic">
						<input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check('romantic', 'sweetheart'); ?> />
						<?php _e('sweetheart') ?></label>
					</fieldset></td>
				</tr>
			</table>
		</td>
	</tr>
</table>
<p><?php _e('If the link is to a person, you can specify your relationship with them using the above form. If you would like to learn more about the idea check out <a href="http://gmpg.org/xfn/">XFN</a>.'); ?></p>
<?php
}
add_meta_box('linkxfndiv', __('Link Relationship (XFN)'), 'link_xfn_meta_box', 'link', 'normal', 'core');

/**
 * Display advanced link options form fields.
 *
 * @since 2.6.0
 *
 * @param object $link
 */
function link_advanced_meta_box($link) {
?>
<table class="form-table" style="width: 100%;" cellspacing="2" cellpadding="5">
	<tr class="form-field">
		<th valign="top"  scope="row"><label for="link_image"><?php _e('Image Address') ?></label></th>
		<td><input type="text" name="link_image" id="link_image" size="50" value="<?php echo ( isset( $link->link_image ) ? $link->link_image : ''); ?>" style="width: 95%" /></td>
	</tr>
	<tr class="form-field">
		<th valign="top"  scope="row"><label for="rss_uri"><?php _e('RSS Address') ?></label></th>
		<td><input name="link_rss" type="text" id="rss_uri" value="<?php echo  ( isset( $link->link_rss ) ? $link->link_rss : ''); ?>" size="50" style="width: 95%" /></td>
	</tr>
	<tr class="form-field">
		<th valign="top"  scope="row"><label for="link_notes"><?php _e('Notes') ?></label></th>
		<td><textarea name="link_notes" id="link_notes" cols="50" rows="10" style="width: 95%"><?php echo  ( isset( $link->link_notes ) ? $link->link_notes : ''); ?></textarea></td>
	</tr>
	<tr class="form-field">
		<th valign="top"  scope="row"><label for="link_rating"><?php _e('Rating') ?></label></th>
		<td><select name="link_rating" id="link_rating" size="1">
		<?php
			for ($r = 0; $r < 10; $r++) {
				echo('            <option value="'.$r.'" ');
				if ( isset($link->link_rating) && $link->link_rating == $r)
					echo 'selected="selected"';
				echo('>'.$r.'</option>');
			}
		?></select>&nbsp;<?php _e('(Leave at 0 for no rating.)') ?>
		</td>
	</tr>
</table>
<?php
}
add_meta_box('linkadvanceddiv', __('Advanced'), 'link_advanced_meta_box', 'link', 'normal', 'core');

do_action('do_meta_boxes', 'link', 'normal', $link);
do_action('do_meta_boxes', 'link', 'advanced', $link);
do_action('do_meta_boxes', 'link', 'side', $link);

require_once ('admin-header.php');

?>


<div class="wrap">
<?php screen_icon(); ?>
<h2><?php echo wp_specialchars( $title ); ?></h2>

<?php if ( isset( $_GET['added'] ) ) : ?>
<div id="message" class="updated fade"><p><?php _e('Link added.'); ?></p></div>
<?php endif; ?>

<?php
if ( !empty($form) )
	echo $form;
if ( !empty($link_added) )
	echo $link_added;

wp_nonce_field( $nonce_action );
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>

<div id="poststuff" class="metabox-holder">

<div id="side-info-column" class="inner-sidebar">
<?php

do_action('submitlink_box');
$side_meta_boxes = do_meta_boxes( 'link', 'side', $link );

?>
</div>

<div id="post-body" class="<?php echo $side_meta_boxes ? 'has-sidebar' : ''; ?>">
<div id="post-body-content" class="has-sidebar-content">
<div id="namediv" class="stuffbox">
<h3><label for="link_name"><?php _e('Name') ?></label></h3>
<div class="inside">
	<input type="text" name="link_name" size="30" tabindex="1" value="<?php echo $link->link_name; ?>" id="link_name" />
    <p><?php _e('Example: Nifty blogging software'); ?></p>
</div>
</div>

<div id="addressdiv" class="stuffbox">
<h3><label for="link_url"><?php _e('Web Address') ?></label></h3>
<div class="inside">
	<input type="text" name="link_url" size="30" tabindex="1" value="<?php echo $link->link_url; ?>" id="link_url" />
    <p><?php _e('Example: <code>http://wordpress.org/</code> &#8212; don&#8217;t forget the <code>http://</code>'); ?></p>
</div>
</div>

<div id="descriptiondiv" class="stuffbox">
<h3><label for="link_description"><?php _e('Description') ?></label></h3>
<div class="inside">
	<input type="text" name="link_description" size="30" tabindex="1" value="<?php echo isset($link->link_description) ? $link->link_description : ''; ?>" id="link_description" />
    <p><?php _e('This will be shown when someone hovers over the link in the blogroll, or optionally below the link.'); ?></p>
</div>
</div>

<?php

do_meta_boxes('link', 'normal', $link);

do_meta_boxes('link', 'advanced', $link);

if ( $link_id ) : ?>
<input type="hidden" name="action" value="save" />
<input type="hidden" name="link_id" value="<?php echo (int) $link_id; ?>" />
<input type="hidden" name="order_by" value="<?php echo attribute_escape($order_by); ?>" />
<input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" />
<?php else: ?>
<input type="hidden" name="action" value="add" />
<?php endif; ?>

</div>
</div>
</div>

</form>
</div>
                                                                                                                                                    wp-admin/edit-page-form.php                                                                         0000755 0023422 0004734 00000051566 11120040446 016637  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Edit page form for inclusion in the administration panels.
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * Post ID global.
 * @name $post_ID
 * @var int
 */
if ( ! isset( $post_ID ) )
	$post_ID = 0;
if ( ! isset( $temp_ID ) )
	$temp_ID = 0;

if ( isset($_GET['message']) )
	$_GET['message'] = absint( $_GET['message'] );
$messages[1] = sprintf( __( 'Page updated. Continue editing below or <a href="%s">go back</a>.' ), attribute_escape( stripslashes( ( isset( $_GET['_wp_original_http_referer'] ) ? $_GET['_wp_original_http_referer'] : '') ) ) );
$messages[2] = __('Custom field updated.');
$messages[3] = __('Custom field deleted.');
$messages[4] = __('Page updated.');
$messages[5] = sprintf(__('Page published. <a href="%s">View page</a>'), get_permalink($post_ID));
$messages[6] = sprintf(__('Page submitted. <a href="%s">Preview page</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) );

if ( isset($_GET['revision']) )
	$messages[5] = sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) );

$notice = false;
$notices[1] = __( 'There is an autosave of this page that is more recent than the version below.  <a href="%s">View the autosave</a>.' );

if ( 0 == $post_ID) {
	$form_action = 'post';
	$nonce_action = 'add-page';
	$temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post()
	$form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />";
} else {
	$post_ID = (int) $post_ID;
	$form_action = 'editpost';
	$nonce_action = 'update-page_' . $post_ID;
	$form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
	$autosave = wp_get_post_autosave( $post_ID );
	if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt ) > mysql2date( 'U', $post->post_modified_gmt ) )
		$notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) );
}

$temp_ID = (int) $temp_ID;
$user_ID = (int) $user_ID;

/**
 * Display submit form fields.
 *
 * @since 2.7.0
 *
 * @param object $post
 */
function page_submit_meta_box($post) {
	global $action;

	$can_publish = current_user_can('publish_pages');
?>
<div class="submitbox" id="submitpage">

<div id="minor-publishing">

<?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
<div style="display:none;">
<input type="submit" name="save" value="<?php echo attribute_escape( __('Save') ); ?>" />
</div>

<div id="minor-publishing-actions">
<div id="save-action">
<?php if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status )  { ?>
<input <?php if ( 'private' == $post->post_status ) { ?>style="display:none"<?php } ?> type="submit" name="save" id="save-post" value="<?php echo attribute_escape( __('Save Draft') ); ?>" tabindex="4" class="button button-highlighted" />
<?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?>
<input type="submit" name="save" id="save-post" value="<?php echo attribute_escape( __('Save as Pending') ); ?>" tabindex="4" class="button button-highlighted" />
<?php } ?>
</div>

<div id="preview-action">
<?php $preview_link = 'publish' == $post->post_status ? clean_url(get_permalink($post->ID)) : clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>

<a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview" id="post-preview" tabindex="4"><?php _e('Preview'); ?></a>
<input type="hidden" name="wp-preview" id="wp-preview" value="" />
</div>

<div class="clear"></div>
</div><?php // /minor-publishing-actions ?>

<div id="misc-publishing-actions">

<div class="misc-pub-section<?php if ( !$can_publish ) { echo ' misc-pub-section-last'; } ?>"><label for="post_status"><?php _e('Status:') ?></label>
<b><span id="post-status-display">
<?php
switch ( $post->post_status ) {
	case 'private':
		_e('Privately Published');
		break;
	case 'publish':
		_e('Published');
		break;
	case 'future':
		_e('Scheduled');
		break;
	case 'pending':
		_e('Pending Review');
		break;
	case 'draft':
		_e('Draft');
		break;
}
?>
</span></b>
<?php if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) { ?>
<a href="#post_status" <?php if ( 'private' == $post->post_status ) { ?>style="display:none;" <?php } ?>class="edit-post-status hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>

<div id="post-status-select" class="hide-if-js">
<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo $post->post_status; ?>" />
<select name='post_status' id='post_status' tabindex='4'>
<?php if ( 'publish' == $post->post_status ) : ?>
<option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e('Published') ?></option>
<?php elseif ( 'private' == $post->post_status ) : ?>
<option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e('Privately Published') ?></option>
<?php elseif ( 'future' == $post->post_status ) : ?>
<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
<?php endif; ?>
<option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option>
</select>

 <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
 <a href="#post_status" class="cancel-post-status hide-if-no-js"><?php _e('Cancel'); ?></a>
</div>

<?php } ?>
</div><?php // /misc-pub-section ?>

<div class="misc-pub-section " id="visibility">
<?php _e('Visibility:'); ?> <b><span id="post-visibility-display"><?php

if ( 'private' == $post->post_status ) {
	$post->post_password = '';
	$visibility = 'private';
	$visibility_trans = __('Private');
} elseif ( !empty( $post->post_password ) ) {
	$visibility = 'password';
	$visibility_trans = __('Password protected');
} else {
	$visibility = 'public';
	$visibility_trans = __('Public');
}

?><?php echo wp_specialchars( $visibility_trans ); ?></span></b> <?php if ( $can_publish ) { ?> <a href="#visibility" class="edit-visibility hide-if-no-js"><?php _e('Edit'); ?></a>

<div id="post-visibility-select" class="hide-if-js">
<input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo attribute_escape($post->post_password); ?>" />
<input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo attribute_escape( $visibility ); ?>" />


<input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e('Public'); ?></label><br />
<input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked( $visibility, 'password' ); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e('Password protected'); ?></label><br />
<span id="password-span"><label for="post_password"><?php _e('Password:'); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo attribute_escape($post->post_password); ?>" /><br /></span>
<input type="radio" name="visibility" id="visibility-radio-private" value="private" <?php checked( $visibility, 'private' ); ?> /> <label for="visibility-radio-private" class="selectit"><?php _e('Private'); ?></label><br />

<p>
 <a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e('OK'); ?></a>
 <a href="#visibility" class="cancel-post-visibility hide-if-no-js"><?php _e('Cancel'); ?></a>
</p>
</div>
<?php } ?>

</div><?php // /misc-pub-section ?>

<?php
$datef = _c( 'M j, Y @ G:i|Publish box date format');
if ( 0 != $post->ID ) {
	if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
		$stamp = __('Scheduled for: <b>%1$s</b>');
	} else if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published
		$stamp = __('Published on: <b>%1$s</b>');
	} else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified
		$stamp = __('Publish <b>immediately</b>');
	} else if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified
		$stamp = __('Schedule for: <b>%1$s</b>');
	} else { // draft, 1 or more saves, date specified
		$stamp = __('Publish on: <b>%1$s</b>');
	}
	$date = date_i18n( $datef, strtotime( $post->post_date ) );
} else { // draft (no saves, and thus no date specified)
	$stamp = __('Publish <b>immediately</b>');
	$date = date_i18n( $datef, strtotime( current_time('mysql') ) );
}
?>
<?php if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
<div class="misc-pub-section curtime misc-pub-section-last">
	<span id="timestamp">
	<?php printf($stamp, $date); ?></span>
	<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>
	<div id="timestampdiv" class="hide-if-js"><?php touch_time(($action == 'edit'),1,4); ?></div>
</div><?php // /misc-pub-section ?>
<?php endif; ?>

</div>
<div class="clear"></div>
</div>

<div id="major-publishing-actions">
<?php do_action('post_submitbox_start'); ?>
<div id="delete-action">
<?php
if ( ( 'edit' == $action ) && current_user_can('delete_page', $post->ID) ) { ?>
<a class="submitdelete deletion" href="<?php echo wp_nonce_url("page.php?action=delete&amp;post=$post->ID", 'delete-page_' . $post->ID); ?>" onclick="if ( confirm('<?php echo js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n  'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this page '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a>
<?php } ?>
</div>

<div id="publishing-action">
<?php
if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) { ?>
<?php if ( $can_publish ) : ?>
	<?php if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?>
		<input name="original_publish" type="hidden" id="original_publish" value="<?php _e('Schedule') ?>" />
		<input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e('Schedule') ?>" />
	<?php else : ?>
		<input name="original_publish" type="hidden" id="original_publish" value="<?php _e('Publish') ?>" />
		<input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
	<?php endif; ?>
<?php else : ?>
	<input name="original_publish" type="hidden" id="original_publish" value="<?php _e('Submit for Review') ?>" />
	<input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e('Submit for Review') ?>" />
<?php endif; ?>
<?php } else { ?>
	<input name="original_publish" type="hidden" id="original_publish" value="<?php _e('Update Page') ?>" />
	<input name="save" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e('Update Page') ?>" />
<?php } ?>
</div>
<div class="clear"></div>
</div>
</div>
<?php
}
add_meta_box('pagesubmitdiv', __('Publish'), 'page_submit_meta_box', 'page', 'side', 'core');

/**
 * Display page password form fields.
 *
 * @since 2.6.0
 *
 * @param object $post
 */
function page_password_meta_box($post){
?>
<p><label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex='4' /> <?php _e('Keep this page private') ?></label></p>
<h4><?php _e( 'Page Password' ); ?></h4>
<p><label class="hidden" for="post_password"><?php _e('Password Protect This Page') ?></label><input name="post_password" type="text" size="25" id="post_password" value="<?php the_post_password(); ?>" /></p>
<p><?php _e('Setting a password will require people who visit your blog to enter the above password to view this page and its comments.'); ?></p>
<?php
}
// add_meta_box('pagepassworddiv', __('Privacy Options'), 'page_password_meta_box', 'page', 'side', 'core');

/**
 * Display page attributes form fields.
 *
 * @since 2.7.0
 *
 * @param object $post
 */
function page_attributes_meta_box($post){
?>
<h5><?php _e('Parent') ?></h5>
<label class="hidden" for="parent_id"><?php _e('Page Parent') ?></label>
<?php wp_dropdown_pages(array('exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('Main Page (no parent)'), 'sort_column'=> 'menu_order, post_title')); ?>
<p><?php _e('You can arrange your pages in hierarchies, for example you could have an &#8220;About&#8221; page that has &#8220;Life Story&#8221; and &#8220;My Dog&#8221; pages under it. There are no limits to how deeply nested you can make pages.'); ?></p>
<?php
	if ( 0 != count( get_page_templates() ) ) {
?>
<h5><?php _e('Template') ?></h5>
<label class="hidden" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template">
<option value='default'><?php _e('Default Template'); ?></option>
<?php page_template_dropdown($post->page_template); ?>
</select>
<p><?php _e('Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you&#8217;ll see them above.'); ?></p>
<?php
	}
?>
<h5><?php _e('Order') ?></h5>
<p><label class="hidden" for="menu_order"><?php _e('Page Order') ?></label><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo $post->menu_order ?>" /></p>
<p><?php _e('Pages are usually ordered alphabetically, but you can put a number above to change the order pages appear in. (We know this is a little janky, it&#8217;ll be better in future releases.)'); ?></p>
<?php
}
add_meta_box('pageparentdiv', __('Attributes'), 'page_attributes_meta_box', 'page', 'side', 'core');

/**
 * Display custom field for page form fields.
 *
 * @since 2.6.0
 *
 * @param object $post
 */
function page_custom_meta_box($post){
?>
<div id="postcustomstuff">
<?php
$metadata = has_meta($post->ID);
list_meta($metadata);
meta_form();
?>
<div id="ajax-response"></div>
</div>
<p><?php _e('Custom fields can be used to add extra metadata to a post that you can <a href="http://codex.wordpress.org/Using_Custom_Fields" target="_blank">use in your theme</a>.'); ?></p>
<?php
}
add_meta_box('pagecustomdiv', __('Custom Fields'), 'page_custom_meta_box', 'page', 'normal', 'core');

/**
 * Display comments status form fields.
 *
 * @since 2.6.0
 *
 * @param object $post
 */
function page_comments_status_meta_box($post){
?>
<input name="advanced_view" type="hidden" value="1" />
<p><label for="comment_status" class="selectit">
<input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> />
<?php _e('Allow Comments') ?></label></p>
<p><label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow Pings') ?></label></p>
<p><?php _e('These settings apply to this page only. &#8220;Pings&#8221; are <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">trackbacks and pingbacks</a>.'); ?></p>
<?php
}
add_meta_box('pagecommentstatusdiv', __('Discussion'), 'page_comments_status_meta_box', 'page', 'normal', 'core');

/**
 * Display page slug form fields.
 *
 * @since 2.6.0
 *
 * @param object $post
 */
function page_slug_meta_box($post){
?>
<label class="hidden" for="post_name"><?php _e('Page Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" />
<?php
}
add_meta_box('pageslugdiv', __('Page Slug'), 'page_slug_meta_box', 'page', 'normal', 'core');

$authors = get_editable_user_ids( $current_user->id, true, 'page' ); // TODO: ROLE SYSTEM
if ( $post->post_author && !in_array($post->post_author, $authors) )
	$authors[] = $post->post_author;
if ( $authors && count( $authors ) > 1 ) {
	/**
	 * Display page author form fields, when more than one author exists.
	 *
	 * @since 2.6.0
	 *
	 * @param object $post
	 */
	function page_author_meta_box($post){
		global $current_user, $user_ID;
		$authors = get_editable_user_ids( $current_user->id, true, 'page' ); // TODO: ROLE SYSTEM
		if ( $post->post_author && !in_array($post->post_author, $authors) )
			$authors[] = $post->post_author;
?>
<label class="hidden" for="post_author_override"><?php _e('Page Author'); ?></label><?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post->ID) ? $user_ID : $post->post_author) ); ?>
<?php
	}
	add_meta_box('pageauthordiv', __('Page Author'), 'page_author_meta_box', 'page', 'normal', 'core');
}

if ( 0 < $post_ID && wp_get_post_revisions( $post_ID ) ) :
/**
 * Display list of page revisions.
 *
 * @since 2.6.0
 *
 * @param object $post
 */
function page_revisions_meta_box($post) {
	wp_list_post_revisions();
}
add_meta_box('revisionsdiv', __('Page Revisions'), 'page_revisions_meta_box', 'page', 'normal', 'core');
endif;

do_action('do_meta_boxes', 'page', 'normal', $post);
do_action('do_meta_boxes', 'page', 'advanced', $post);
do_action('do_meta_boxes', 'page', 'side', $post);

require_once('admin-header.php');
?>

<div class="wrap">
<?php screen_icon(); ?>
<h2><?php echo wp_specialchars( $title ); ?></h2>

<form name="post" action="page.php" method="post" id="post">
<?php if ( $notice ) : ?>
<div id="notice" class="error"><p><?php echo $notice ?></p></div>
<?php endif; ?>
<?php if (isset($_GET['message'])) : ?>
<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
<?php endif; ?>

<?php
wp_nonce_field($nonce_action);

if (isset($mode) && 'bookmarklet' == $mode)
	echo '<input type="hidden" name="mode" value="bookmarklet" />';
?>
<input type="hidden" id="user-id" name="user_ID" value="<?php echo $user_ID ?>" />
<input type="hidden" id="hiddenaction" name="action" value='<?php echo $form_action ?>' />
<input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" />
<input type="hidden" id="post_author" name="post_author" value="<?php echo attribute_escape( $post->post_author ); ?>" />
<?php echo $form_extra ?>
<input type="hidden" id="post_type" name="post_type" value="<?php echo $post->post_type ?>" />
<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo $post->post_status ?>" />
<input name="referredby" type="hidden" id="referredby" value="<?php echo clean_url(stripslashes(wp_get_referer())); ?>" />
<?php if ( 'draft' != $post->post_status ) wp_original_referer_field(true, 'previous'); ?>

<div id="poststuff" class="metabox-holder">

<div id="side-info-column" class="inner-sidebar">

<?php

do_action('submitpage_box');
$side_meta_boxes = do_meta_boxes('page', 'side', $post);

?>
</div>

<div id="post-body" class="<?php echo $side_meta_boxes ? 'has-sidebar' : ''; ?>">
<div id="post-body-content" class="has-sidebar-content">

<div id="titlediv">
<div id="titlewrap">
  <input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape( $post->post_title ); ?>" id="title" autocomplete="off" />
</div>
<div class="inside">
<?php $sample_permalink_html = get_sample_permalink_html($post->ID); ?>
	<div id="edit-slug-box">
<?php if ( ! empty($post->ID) && ! empty($sample_permalink_html) ) :
	echo $sample_permalink_html;
endif; ?>
	</div>
</div>
</div>

<div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">

<?php the_editor($post->post_content); ?>
<div id="post-status-info">
	<span id="wp-word-count" class="alignleft"></span>
	<span class="alignright">
	<span id="autosave">&nbsp;</span>

<?php
	if ($post_ID) {
		if ( $last_id = get_post_meta($post_ID, '_edit_last', true) ) {
			$last_user = get_userdata($last_id);
			printf(__('Last edited by %1$s on %2$s at %3$s'), wp_specialchars( $last_user->display_name ), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
		} else {
			printf(__('Last edited on %1$s at %2$s'), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
		}
	}
?>
	</span>
	<br class="clear" />
</div>

<?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?>
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
<?php wp_nonce_field( 'getpermalink', 'getpermalinknonce', false ); ?>
<?php wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false ); ?>
<?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
</div>

<?php

do_meta_boxes('page', 'normal', $post);
do_action('edit_page_form');
do_meta_boxes('page', 'advanced', $post);

?>

</div>
</div>
</div>

</form>
</div>

<script type="text/javascript">
try{document.post.title.focus();}catch(e){}
</script>
                                                                                                                                          wp-admin/edit-pages.php                                                                             0000755 0023422 0004734 00000026147 11116051144 016060  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Edit Pages Administration Panel.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** WordPress Administration Bootstrap */
require_once('admin.php');

// Handle bulk actions
if ( isset($_GET['action']) && ( -1 != $_GET['action'] || -1 != $_GET['action2'] ) ) {
	$doaction = ( -1 != $_GET['action'] ) ? $_GET['action'] : $_GET['action2'];

	switch ( $doaction ) {
		case 'delete':
			if ( isset($_GET['post']) && ! isset($_GET['bulk_edit']) && (isset($_GET['doaction']) || isset($_GET['doaction2'])) ) {
				check_admin_referer('bulk-pages');
				$deleted = 0;
				foreach( (array) $_GET['post'] as $post_id_del ) {
					$post_del = & get_post($post_id_del);

					if ( !current_user_can('delete_page', $post_id_del) )
						wp_die( __('You are not allowed to delete this page.') );

					if ( $post_del->post_type == 'attachment' ) {
						if ( ! wp_delete_attachment($post_id_del) )
							wp_die( __('Error in deleting...') );
					} else {
						if ( !wp_delete_post($post_id_del) )
							wp_die( __('Error in deleting...') );
					}
					$deleted++;
				}
			}
			break;
		case 'edit':
			if ( isset($_GET['post']) && isset($_GET['bulk_edit']) ) {
				check_admin_referer('bulk-pages');

				if ( -1 == $_GET['_status'] ) {
					$_GET['post_status'] = null;
					unset($_GET['_status'], $_GET['post_status']);
				} else {
					$_GET['post_status'] = $_GET['_status'];
				}

				$done = bulk_edit_posts($_GET);
			}
			break;
	}

	$sendback = wp_get_referer();
	if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('page-new.php');
	elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
	if ( isset($done) ) {
		$done['updated'] = count( $done['updated'] );
		$done['skipped'] = count( $done['skipped'] );
		$done['locked'] = count( $done['locked'] );
		$sendback = add_query_arg( $done, $sendback );
	}
	if ( isset($deleted) )
		$sendback = add_query_arg('deleted', $deleted, $sendback);
	wp_redirect($sendback);
	exit();
} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
	 wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
	 exit;
}

if ( empty($title) )
	$title = __('Edit Pages');
$parent_file = 'edit-pages.php';
wp_enqueue_script('inline-edit-post');

$post_stati  = array(	//	array( adj, noun )
		'publish' => array(__('Published|page'), __('Published pages'), _n_noop('Published <span class="count">(%s)</span>|page', 'Published <span class="count">(%s)</span>')),
		'future' => array(__('Scheduled|page'), __('Scheduled pages'), _n_noop('Scheduled <span class="count">(%s)</span>|page', 'Scheduled <span class="count">(%s)</span>')),
		'pending' => array(__('Pending Review|page'), __('Pending pages'), _n_noop('Pending Review <span class="count">(%s)</span>|page', 'Pending Review <span class="count">(%s)</span>')),
		'draft' => array(__('Draft|page'), _c('Drafts|manage posts header'), _n_noop('Draft <span class="count">(%s)</span>|page', 'Drafts <span class="count">(%s)</span>')),
		'private' => array(__('Private|page'), __('Private pages'), _n_noop('Private <span class="count">(%s)</span>|page', 'Private <span class="count">(%s)</span>'))
	);

$query = array('post_type' => 'page', 'orderby' => 'menu_order title', 'what_to_show' => 'posts',
	'posts_per_page' => -1, 'posts_per_archive_page' => -1, 'order' => 'asc');

$post_status_label = __('Pages');
if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) {
	$post_status_label = $post_stati[$_GET['post_status']][1];
	$query['post_status'] = $_GET['post_status'];
	$query['perm'] = 'readable';
}

$query = apply_filters('manage_pages_query', $query);
wp($query);

if ( is_singular() ) {
	wp_enqueue_script( 'admin-comments' );
	enqueue_comment_hotkeys_js();
}

require_once('admin-header.php'); ?>

<div class="wrap">
<?php screen_icon(); ?>
<h2><?php echo wp_specialchars( $title );
if ( isset($_GET['s']) && $_GET['s'] )
	printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', wp_specialchars( get_search_query() ) ); ?>
</h2>

<?php if ( isset($_GET['locked']) || isset($_GET['skipped']) || isset($_GET['updated']) || isset($_GET['deleted']) ) { ?>
<div id="message" class="updated fade"><p>
<?php if ( isset($_GET['updated']) && (int) $_GET['updated'] ) {
	printf( __ngettext( '%s page updated.', '%s pages updated.', $_GET['updated'] ), number_format_i18n( $_GET['updated'] ) );
	unset($_GET['updated']);
}

if ( isset($_GET['skipped']) && (int) $_GET['skipped'] ) {
	printf( __ngettext( '%s page not updated, invalid parent page specified.', '%s pages not updated, invalid parent page specified.', $_GET['skipped'] ), number_format_i18n( $_GET['skipped'] ) );
	unset($_GET['skipped']);
}

if ( isset($_GET['locked']) && (int) $_GET['locked'] ) {
	printf( __ngettext( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $_GET['locked'] ), number_format_i18n( $_GET['skipped'] ) );
	unset($_GET['locked']);
}

if ( isset($_GET['deleted']) && (int) $_GET['deleted'] ) {
	printf( __ngettext( 'Page deleted.', '%s pages deleted.', $_GET['deleted'] ), number_format_i18n( $_GET['deleted'] ) );
	unset($_GET['deleted']);
}
$_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated', 'deleted'), $_SERVER['REQUEST_URI'] );
?>
</p></div>
<?php } ?>

<?php if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET['posted']; ?>
<div id="message" class="updated fade"><p><strong><?php _e('Your page has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View page'); ?></a> | <a href="<?php echo get_edit_post_link( $_GET['posted'] ); ?>"><?php _e('Edit page'); ?></a></p></div>
<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
endif; ?>

<form id="posts-filter" action="" method="get">
<ul class="subsubsub">
<?php

$avail_post_stati = get_available_post_statuses('page');
if ( empty($locked_post_status) ) :
$status_links = array();
$num_posts = wp_count_posts('page', 'readable');
$total_posts = array_sum( (array) $num_posts );
$class = empty($_GET['post_status']) ? ' class="current"' : '';
$status_links[] = "<li><a href='edit-pages.php'$class>" . sprintf( __ngettext( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts ), number_format_i18n( $total_posts ) ) . '</a>';
foreach ( $post_stati as $status => $label ) {
	$class = '';

	if ( !in_array($status, $avail_post_stati) )
		continue;

	if ( isset( $_GET['post_status'] ) && $status == $_GET['post_status'] )
		$class = ' class="current"';

	$status_links[] = "<li><a href='edit-pages.php?post_status=$status'$class>" . sprintf( _nc( $label[2][0], $label[2][1], $num_posts->$status ), number_format_i18n( $num_posts->$status ) ) . '</a>';
}
echo implode( " |</li>\n", $status_links ) . '</li>';
unset($status_links);
endif;
?>
</ul>

<p class="search-box">
	<label class="hidden" for="page-search-input"><?php _e( 'Search Pages' ); ?>:</label>
	<input type="text" class="search-input" id="page-search-input" name="s" value="<?php _admin_search_query(); ?>" />
	<input type="submit" value="<?php _e( 'Search Pages' ); ?>" class="button" />
</p>

<?php if ( isset($_GET['post_status'] ) ) : ?>
<input type="hidden" name="post_status" value="<?php echo attribute_escape($_GET['post_status']) ?>" />
<?php endif; ?>

<?php if ($posts) { ?>

<div class="tablenav">

<?php
$pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;
if ( empty($pagenum) )
	$pagenum = 1;
if( ! isset( $per_page ) || $per_page < 0 )
	$per_page = 20;

$num_pages = ceil($wp_query->post_count / $per_page);
$page_links = paginate_links( array(
	'base' => add_query_arg( 'pagenum', '%#%' ),
	'format' => '',
	'prev_text' => __('&laquo;'),
	'next_text' => __('&raquo;'),
	'total' => $num_pages,
	'current' => $pagenum
));

if ( $page_links ) : ?>
<div class="tablenav-pages"><?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
	number_format_i18n( ( $pagenum - 1 ) * $per_page + 1 ),
	number_format_i18n( min( $pagenum * $per_page, $wp_query->post_count ) ),
	number_format_i18n( $wp_query->post_count ),
	$page_links
); echo $page_links_text; ?></div>
<?php endif; ?>

<div class="alignleft actions">
<select name="action">
<option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
<option value="edit"><?php _e('Edit'); ?></option>
<option value="delete"><?php _e('Delete'); ?></option>
</select>
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
<?php wp_nonce_field('bulk-pages'); ?>
</div>

<br class="clear" />
</div>

<div class="clear"></div>

<table class="widefat page fixed" cellspacing="0">
  <thead>
  <tr>
<?php print_column_headers('edit-pages'); ?>
  </tr>
  </thead>

  <tfoot>
  <tr>
<?php print_column_headers('edit-pages', false); ?>
  </tr>
  </tfoot>

  <tbody>
  <?php page_rows($posts, $pagenum, $per_page); ?>
  </tbody>
</table>

<div class="tablenav">
<?php
if ( $page_links )
	echo "<div class='tablenav-pages'>$page_links_text</div>";
?>

<div class="alignleft actions">
<select name="action2">
<option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
<option value="edit"><?php _e('Edit'); ?></option>
<option value="delete"><?php _e('Delete'); ?></option>
</select>
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
</div>

<br class="clear" />
</div>

<?php } else { ?>
<div class="clear"></div>
<p><?php _e('No pages found.') ?></p>
<?php
} // end if ($posts)
?>

</form>

<?php inline_edit_row( 'page' ) ?>

<div id="ajax-response"></div>


<?php

if ( 1 == count($posts) && is_singular() ) :

	$comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved != 'spam' ORDER BY comment_date", $id) );
	if ( $comments ) :
		// Make sure comments, post, and post_author are cached
		update_comment_cache($comments);
		$post = get_post($id);
		$authordata = get_userdata($post->post_author);
	?>

<br class="clear" />

<table class="widefat" cellspacing="0">
<thead>
  <tr>
    <th scope="col" class="column-comment"><?php echo _c('Comment|noun') ?></th>
    <th scope="col" class="column-author"><?php _e('Author') ?></th>
    <th scope="col" class="column-date"><?php _e('Submitted') ?></th>
  </tr>
</thead>
<tbody id="the-comment-list" class="list:comment">
<?php
	foreach ($comments as $comment)
		_wp_comment_row( $comment->comment_ID, 'single', false, false );
?>
</tbody>
</table>

<?php
wp_comment_reply();
endif; // comments
endif; // posts;

?>

</div>

<script type="text/javascript">
/* <![CDATA[ */
(function($){
	$(document).ready(function(){
		$('#doaction, #doaction2').click(function(){
			if ( $('select[name^="action"]').val() == 'delete' ) {
				var m = '<?php echo js_escape(__("You are about to delete the selected pages.\n  'Cancel' to stop, 'OK' to delete.")); ?>';
				return showNotice.warn(m);
			}
		});
	});
})(jQuery);
columns.init('edit-pages');
/* ]]> */
</script>

<?php include('admin-footer.php'); ?>
                                                                                                                                                                                                                                                                                                                                                                                                                         wp-admin/edit-post-rows.php                                                                         0000755 0023422 0004734 00000000650 11113115012 016715  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Edit posts rows table for inclusion in administration panels.
 *
 * @package WordPress
 * @subpackage Administration
 */

if ( ! defined('ABSPATH') ) die();
?>
<table class="widefat post fixed" cellspacing="0">
	<thead>
	<tr>
<?php print_column_headers('edit'); ?>
	</tr>
	</thead>

	<tfoot>
	<tr>
<?php print_column_headers('edit', false); ?>
	</tr>
	</tfoot>

	<tbody>
<?php post_rows(); ?>
	</tbody>
</table>                                                                                        wp-admin/edit-tag-form.php                                                                          0000755 0023422 0004734 00000003444 11117432530 016473  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Edit tag form for inclusion in administration panels.
 *
 * @package WordPress
 * @subpackage Administration
 */

if ( empty($tag_ID) ) { ?>
	<div id="message" class="updated fade"><p><strong><?php _e('A tag was not selected for editing.'); ?></strong></p></div>
<?php
	return;
}

do_action('edit_tag_form_pre', $tag); ?>

<div class="wrap">
<?php screen_icon(); ?>
<h2><?php _e('Edit Tag'); ?></h2>
<div id="ajax-response"></div>
<form name="edittag" id="edittag" method="post" action="edit-tags.php" class="validate">
<input type="hidden" name="action" value="editedtag" />
<input type="hidden" name="tag_ID" value="<?php echo $tag->term_id ?>" />
<?php wp_original_referer_field(true, 'previous'); wp_nonce_field('update-tag_' . $tag_ID); ?>
	<table class="form-table">
		<tr class="form-field form-required">
			<th scope="row" valign="top"><label for="name"><?php _e('Tag name') ?></label></th>
			<td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo attribute_escape($tag->name); ?>" size="40" aria-required="true" />
            <p><?php _e('The name is how the tag appears on your site.'); ?></p></td>
		</tr>
		<tr class="form-field">
			<th scope="row" valign="top"><label for="slug"><?php _e('Tag slug') ?></label></th>
			<td><input name="slug" id="slug" type="text" value="<?php if ( isset( $tag->slug ) ) echo attribute_escape(apply_filters('editable_slug', $tag->slug)); ?>" size="40" />
            <p><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td>
		</tr>
	</table>
<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php _e('Update Tag'); ?>" /></p>
<?php do_action('edit_tag_form', $tag); ?>
</form>
</div>
                                                                                                                                                                                                                            wp-admin/edit-tags.php                                                                              0000755 0023422 0004734 00000017157 11117531364 015730  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Edit Tags Administration Panel.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** WordPress Administration Bootstrap */
require_once('admin.php');

$title = __('Tags');

wp_reset_vars( array('action', 'tag') );

if ( isset( $_GET['action'] ) && isset($_GET['delete_tags']) && ( 'delete' == $_GET['action'] || 'delete' == $_GET['action2'] ) )
	$action = 'bulk-delete';

switch($action) {

case 'addtag':

	check_admin_referer('add-tag');

	if ( !current_user_can('manage_categories') )
		wp_die(__('Cheatin&#8217; uh?'));

	$ret = wp_insert_term($_POST['name'], 'post_tag', $_POST);
	if ( $ret && !is_wp_error( $ret ) ) {
		wp_redirect('edit-tags.php?message=1#addtag');
	} else {
		wp_redirect('edit-tags.php?message=4#addtag');
	}
	exit;
break;

case 'delete':
	$tag_ID = (int) $_GET['tag_ID'];
	check_admin_referer('delete-tag_' .  $tag_ID);

	if ( !current_user_can('manage_categories') )
		wp_die(__('Cheatin&#8217; uh?'));

	wp_delete_term( $tag_ID, 'post_tag');

	wp_redirect('edit-tags.php?message=2');
	exit;

break;

case 'bulk-delete':
	check_admin_referer('bulk-tags');

	if ( !current_user_can('manage_categories') )
		wp_die(__('Cheatin&#8217; uh?'));

	$tags = $_GET['delete_tags'];
	foreach( (array) $tags as $tag_ID ) {
		wp_delete_term( $tag_ID, 'post_tag');
	}

	$location = 'edit-tags.php';
	if ( $referer = wp_get_referer() ) {
		if ( false !== strpos($referer, 'edit-tags.php') )
			$location = $referer;
	}

	$location = add_query_arg('message', 6, $location);
	wp_redirect($location);
	exit;

break;

case 'edit':
	$title = __('Edit Tag');

	require_once ('admin-header.php');
	$tag_ID = (int) $_GET['tag_ID'];

	$tag = get_term($tag_ID, 'post_tag', OBJECT, 'edit');
	include('edit-tag-form.php');

break;

case 'editedtag':
	$tag_ID = (int) $_POST['tag_ID'];
	check_admin_referer('update-tag_' . $tag_ID);

	if ( !current_user_can('manage_categories') )
		wp_die(__('Cheatin&#8217; uh?'));

	$ret = wp_update_term($tag_ID, 'post_tag', $_POST);

	$location = 'edit-tags.php';
	if ( $referer = wp_get_original_referer() ) {
		if ( false !== strpos($referer, 'edit-tags.php') )
			$location = $referer;
	}

	if ( $ret && !is_wp_error( $ret ) )
		$location = add_query_arg('message', 3, $location);
	else
		$location = add_query_arg('message', 5, $location);

	wp_redirect($location);
	exit;
break;

default:

if ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
	 wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
	 exit;
}

$can_manage = current_user_can('manage_categories');

wp_enqueue_script('admin-tags');
if ( $can_manage )
	wp_enqueue_script('inline-edit-tax');

require_once ('admin-header.php');

$messages[1] = __('Tag added.');
$messages[2] = __('Tag deleted.');
$messages[3] = __('Tag updated.');
$messages[4] = __('Tag not added.');
$messages[5] = __('Tag not updated.');
$messages[6] = __('Tags deleted.'); ?>

<div class="wrap nosubsub">
<?php screen_icon(); ?>
<h2><?php echo wp_specialchars( $title );
if ( isset($_GET['s']) && $_GET['s'] )
	printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', wp_specialchars( stripslashes($_GET['s']) ) ); ?>
</h2>

<?php if ( isset($_GET['message']) && ( $msg = (int) $_GET['message'] ) ) : ?>
<div id="message" class="updated fade"><p><?php echo $messages[$msg]; ?></p></div>
<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
endif; ?>

<form class="search-form" action="" method="get">
<p class="search-box">
	<label class="hidden" for="tag-search-input"><?php _e( 'Search Tags' ); ?>:</label>
	<input type="text" class="search-input" id="tag-search-input" name="s" value="<?php _admin_search_query(); ?>" />
	<input type="submit" value="<?php _e( 'Search Tags' ); ?>" class="button" />
</p>
</form>
<br class="clear" />

<div id="col-container">

<div id="col-right">
<div class="col-wrap">
<form id="posts-filter" action="" method="get">
<div class="tablenav">
<?php
$pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;
if ( empty($pagenum) )
	$pagenum = 1;

$tagsperpage = apply_filters("tagsperpage",20);

$page_links = paginate_links( array(
	'base' => add_query_arg( 'pagenum', '%#%' ),
	'format' => '',
	'prev_text' => __('&laquo;'),
	'next_text' => __('&raquo;'),
	'total' => ceil(wp_count_terms('post_tag') / $tagsperpage),
	'current' => $pagenum
));

if ( $page_links )
	echo "<div class='tablenav-pages'>$page_links</div>";
?>

<div class="alignleft actions">
<select name="action">
<option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
<option value="delete"><?php _e('Delete'); ?></option>
</select>
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
<?php wp_nonce_field('bulk-tags'); ?>
</div>

<br class="clear" />
</div>

<div class="clear"></div>

<table class="widefat tag fixed" cellspacing="0">
	<thead>
	<tr>
<?php print_column_headers('edit-tags'); ?>
	</tr>
	</thead>

	<tfoot>
	<tr>
<?php print_column_headers('edit-tags', false); ?>
	</tr>
	</tfoot>

	<tbody id="the-list" class="list:tag">
<?php

$searchterms = isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '';

$count = tag_rows( $pagenum, $tagsperpage, $searchterms );
?>
	</tbody>
</table>

<div class="tablenav">
<?php
if ( $page_links )
	echo "<div class='tablenav-pages'>$page_links</div>";
?>

<div class="alignleft actions">
<select name="action2">
<option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
<option value="delete"><?php _e('Delete'); ?></option>
</select>
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
</div>

<br class="clear" />
</div>

<br class="clear" />
</form>
</div>
</div><!-- /col-right -->

<div id="col-left">
<div class="col-wrap">

<div class="tagcloud">
<h3><?php _e('Popular Tags'); ?></h3>
<?php
if ( $can_manage )
	wp_tag_cloud(array('link' => 'edit'));
else
	wp_tag_cloud();
?>
</div>

<?php if ( $can_manage ) {
	do_action('add_tag_form_pre'); ?>

<div class="form-wrap">
<h3><?php _e('Add a New Tag'); ?></h3>
<div id="ajax-response"></div>
<form name="addtag" id="addtag" method="post" action="edit-tags.php" class="add:the-list: validate">
<input type="hidden" name="action" value="addtag" />
<?php wp_original_referer_field(true, 'previous'); wp_nonce_field('add-tag'); ?>

<div class="form-field form-required">
	<label for="name"><?php _e('Tag name') ?></label>
	<input name="name" id="name" type="text" value="" size="40" aria-required="true" />
    <p><?php _e('The name is how the tag appears on your site.'); ?></p>
</div>

<div class="form-field">
	<label for="slug"><?php _e('Tag slug') ?></label>
	<input name="slug" id="slug" type="text" value="" size="40" />
    <p><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p>
</div>

<p class="submit"><input type="submit" class="button" name="submit" value="<?php _e('Add Tag'); ?>" /></p>
<?php do_action('add_tag_form'); ?>
</form></div>
<?php } ?>

</div>
</div><!-- /col-left -->

</div><!-- /col-container -->
</div><!-- /wrap -->

<script type="text/javascript">
/* <![CDATA[ */
(function($){
	$(document).ready(function(){
		$('#doaction, #doaction2').click(function(){
			if ( $('select[name^="action"]').val() == 'delete' ) {
				var m = '<?php echo js_escape(__("You are about to delete the selected tags.\n  'Cancel' to stop, 'OK' to delete.")); ?>';
				return showNotice.warn(m);
			}
		});
	});
})(jQuery);
/* ]]> */
</script>

<?php inline_edit_term_row('edit-tags'); ?>

<?php
break;
}

include('admin-footer.php');

?>
                                                                                                                                                                                                                                                                                                                                                                                                                 wp-admin/edit.php                                                                                   0000755 0023422 0004734 00000025122 11116051144 014753  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Edit Posts Administration Panel.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** WordPress Administration Bootstrap */
require_once('admin.php');

// Back-compat for viewing comments of an entry
if ( $_redirect = intval( max( @$_GET['p'], @$_GET['attachment_id'], @$_GET['page_id'] ) ) ) {
	wp_redirect( admin_url('edit-comments.php?p=' . $_redirect ) );
	exit;
} else {
	unset( $_redirect );
}

// Handle bulk actions
if ( isset($_GET['action']) && ( -1 != $_GET['action'] || -1 != $_GET['action2'] ) ) {
	$doaction = ( -1 != $_GET['action'] ) ? $_GET['action'] : $_GET['action2'];

	switch ( $doaction ) {
		case 'delete':
			if ( isset($_GET['post']) && ! isset($_GET['bulk_edit']) && (isset($_GET['doaction']) || isset($_GET['doaction2'])) ) {
				check_admin_referer('bulk-posts');
				$deleted = 0;
				foreach( (array) $_GET['post'] as $post_id_del ) {
					$post_del = & get_post($post_id_del);

					if ( !current_user_can('delete_post', $post_id_del) )
						wp_die( __('You are not allowed to delete this post.') );

					if ( $post_del->post_type == 'attachment' ) {
						if ( ! wp_delete_attachment($post_id_del) )
							wp_die( __('Error in deleting...') );
					} else {
						if ( !wp_delete_post($post_id_del) )
							wp_die( __('Error in deleting...') );
					}
					$deleted++;
				}
			}
			break;
		case 'edit':
			if ( isset($_GET['post']) && isset($_GET['bulk_edit']) ) {
				check_admin_referer('bulk-posts');

				if ( -1 == $_GET['_status'] ) {
					$_GET['post_status'] = null;
					unset($_GET['_status'], $_GET['post_status']);
				} else {
					$_GET['post_status'] = $_GET['_status'];
				}

				$done = bulk_edit_posts($_GET);
			}
			break;
	}

	$sendback = wp_get_referer();
	if ( strpos($sendback, 'post.php') !== false ) $sendback = admin_url('post-new.php');
	elseif ( strpos($sendback, 'attachments.php') !== false ) $sendback = admin_url('attachments.php');
	if ( isset($done) ) {
		$done['updated'] = count( $done['updated'] );
		$done['skipped'] = count( $done['skipped'] );
		$done['locked'] = count( $done['locked'] );
		$sendback = add_query_arg( $done, $sendback );
	}
	if ( isset($deleted) )
		$sendback = add_query_arg('deleted', $deleted, $sendback);
	wp_redirect($sendback);
	exit();
} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
	 wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
	 exit;
}

if ( empty($title) )
	$title = __('Edit Posts');
$parent_file = 'edit.php';
wp_enqueue_script('inline-edit-post');

list($post_stati, $avail_post_stati) = wp_edit_posts_query();

require_once('admin-header.php');

if ( !isset( $_GET['paged'] ) )
	$_GET['paged'] = 1;

if ( empty($_GET['mode']) )
	$mode = 'list';
else
	$mode = attribute_escape($_GET['mode']); ?>

<div class="wrap">
<?php screen_icon(); ?>
<h2><?php echo wp_specialchars( $title );
if ( isset($_GET['s']) && $_GET['s'] )
	printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', wp_specialchars( get_search_query() ) ); ?>
</h2>

<?php
if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET['posted']; ?>
<div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View post'); ?></a> | <a href="<?php echo get_edit_post_link( $_GET['posted'] ); ?>"><?php _e('Edit post'); ?></a></p></div>
<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
endif; ?>

<?php if ( isset($_GET['locked']) || isset($_GET['skipped']) || isset($_GET['updated']) || isset($_GET['deleted']) ) { ?>
<div id="message" class="updated fade"><p>
<?php if ( isset($_GET['updated']) && (int) $_GET['updated'] ) {
	printf( __ngettext( '%s post updated.', '%s posts updated.', $_GET['updated'] ), number_format_i18n( $_GET['updated'] ) );
	unset($_GET['updated']);
}

if ( isset($_GET['skipped']) && (int) $_GET['skipped'] )
	unset($_GET['skipped']);

if ( isset($_GET['locked']) && (int) $_GET['locked'] ) {
	printf( __ngettext( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $_GET['locked'] ), number_format_i18n( $_GET['locked'] ) );
	unset($_GET['locked']);
}

if ( isset($_GET['deleted']) && (int) $_GET['deleted'] ) {
	printf( __ngettext( 'Post deleted.', '%s posts deleted.', $_GET['deleted'] ), number_format_i18n( $_GET['deleted'] ) );
	unset($_GET['deleted']);
}

$_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated', 'deleted'), $_SERVER['REQUEST_URI'] );
?>
</p></div>
<?php } ?>

<form id="posts-filter" action="" method="get">

<ul class="subsubsub">
<?php
if ( empty($locked_post_status) ) :
$status_links = array();
$num_posts = wp_count_posts( 'post', 'readable' );
$total_posts = array_sum( (array) $num_posts );
$class = empty( $_GET['post_status'] ) ? ' class="current"' : '';
$status_links[] = "<li><a href='edit.php' $class>" . sprintf( __ngettext( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts ), number_format_i18n( $total_posts ) ) . '</a>';


foreach ( $post_stati as $status => $label ) {
	$class = '';

	if ( !in_array( $status, $avail_post_stati ) )
		continue;

	if ( empty( $num_posts->$status ) )
		continue;
	if ( isset($_GET['post_status']) && $status == $_GET['post_status'] )
		$class = ' class="current"';

	$status_links[] = "<li><a href='edit.php?post_status=$status' $class>" . sprintf( __ngettext( $label[2][0], $label[2][1], $num_posts->$status ), number_format_i18n( $num_posts->$status ) ) . '</a>';
}
echo implode( " |</li>\n", $status_links ) . '</li>';
unset( $status_links );
endif;
?>
</ul>

<p class="search-box">
	<label class="hidden" for="post-search-input"><?php _e( 'Search Posts' ); ?>:</label>
	<input type="text" class="search-input" id="post-search-input" name="s" value="<?php the_search_query(); ?>" />
	<input type="submit" value="<?php _e( 'Search Posts' ); ?>" class="button" />
</p>

<?php if ( isset($_GET['post_status'] ) ) : ?>
<input type="hidden" name="post_status" value="<?php echo attribute_escape($_GET['post_status']) ?>" />
<?php endif; ?>
<input type="hidden" name="mode" value="<?php echo $mode; ?>" />

<?php if ( have_posts() ) { ?>

<div class="tablenav">
<?php
$page_links = paginate_links( array(
	'base' => add_query_arg( 'paged', '%#%' ),
	'format' => '',
	'prev_text' => __('&laquo;'),
	'next_text' => __('&raquo;'),
	'total' => $wp_query->max_num_pages,
	'current' => $_GET['paged']
));

?>

<div class="alignleft actions">
<select name="action">
<option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
<option value="edit"><?php _e('Edit'); ?></option>
<option value="delete"><?php _e('Delete'); ?></option>
</select>
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
<?php wp_nonce_field('bulk-posts'); ?>

<?php // view filters
if ( !is_singular() ) {
$arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC";

$arc_result = $wpdb->get_results( $arc_query );

$month_count = count($arc_result);

if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) {
$m = isset($_GET['m']) ? (int)$_GET['m'] : 0;
?>
<select name='m'>
<option<?php selected( $m, 0 ); ?> value='0'><?php _e('Show all dates'); ?></option>
<?php
foreach ($arc_result as $arc_row) {
	if ( $arc_row->yyear == 0 )
		continue;
	$arc_row->mmonth = zeroise( $arc_row->mmonth, 2 );

	if ( $arc_row->yyear . $arc_row->mmonth == $m )
		$default = ' selected="selected"';
	else
		$default = '';

	echo "<option$default value='$arc_row->yyear$arc_row->mmonth'>";
	echo $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear";
	echo "</option>\n";
}
?>
</select>
<?php } ?>

<?php
$dropdown_options = array('show_option_all' => __('View all categories'), 'hide_empty' => 0, 'hierarchical' => 1,
	'show_count' => 0, 'orderby' => 'name', 'selected' => $cat);
wp_dropdown_categories($dropdown_options);
do_action('restrict_manage_posts');
?>
<input type="submit" id="post-query-submit" value="<?php _e('Filter'); ?>" class="button-secondary" />

<?php } ?>
</div>

<?php if ( $page_links ) { ?>
<div class="tablenav-pages"><?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
	number_format_i18n( ( $_GET['paged'] - 1 ) * $wp_query->query_vars['posts_per_page'] + 1 ),
	number_format_i18n( min( $_GET['paged'] * $wp_query->query_vars['posts_per_page'], $wp_query->found_posts ) ),
	number_format_i18n( $wp_query->found_posts ),
	$page_links
); echo $page_links_text; ?></div>
<?php } ?>

<div class="view-switch">
	<a href="<?php echo clean_url(add_query_arg('mode', 'list', $_SERVER['REQUEST_URI'])) ?>"><img <?php if ( 'list' == $mode ) echo 'class="current"'; ?> id="view-switch-list" src="../wp-includes/images/blank.gif" width="20" height="20" title="<?php _e('List View') ?>" alt="<?php _e('List View') ?>" /></a>
	<a href="<?php echo clean_url(add_query_arg('mode', 'excerpt', $_SERVER['REQUEST_URI'])) ?>"><img <?php if ( 'excerpt' == $mode ) echo 'class="current"'; ?> id="view-switch-excerpt" src="../wp-includes/images/blank.gif" width="20" height="20" title="<?php _e('Excerpt View') ?>" alt="<?php _e('Excerpt View') ?>" /></a>
</div>

<div class="clear"></div>
</div>

<div class="clear"></div>

<?php include( 'edit-post-rows.php' ); ?>

<div class="tablenav">

<?php
if ( $page_links )
	echo "<div class='tablenav-pages'>$page_links_text</div>";
?>

<div class="alignleft actions">
<select name="action2">
<option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
<option value="edit"><?php _e('Edit'); ?></option>
<option value="delete"><?php _e('Delete'); ?></option>
</select>
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
<br class="clear" />
</div>
<br class="clear" />
</div>

<?php } else { // have_posts() ?>
<div class="clear"></div>
<p><?php _e('No posts found') ?></p>
<?php } ?>

</form>

<?php inline_edit_row( 'post' ); ?>

<div id="ajax-response"></div>

<br class="clear" />

</div>

<script type="text/javascript">
/* <![CDATA[ */
(function($){
	$(document).ready(function(){
		$('#doaction, #doaction2').click(function(){
			if ( $('select[name^="action"]').val() == 'delete' ) {
				var m = '<?php echo js_escape(__("You are about to delete the selected posts.\n  'Cancel' to stop, 'OK' to delete.")); ?>';
				return showNotice.warn(m);
			}
		});
	});
})(jQuery);
columns.init('edit');
/* ]]> */
</script>

<?php include('admin-footer.php'); ?>
                                                                                                                                                                                                                                                                                                                                                                                                                                              wp-admin/export.php                                                                                 0000755 0023422 0004734 00000003266 11117531364 015364  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress Export Administration Panel
 *
 * @package WordPress
 * @subpackage Administration
 */

/** Load WordPress Bootstrap */
require_once ('admin.php');

/** Load WordPress export API */
require_once('includes/export.php');
$title = __('Export');

if ( isset( $_GET['download'] ) ) {
	$author = isset($_GET['author']) ? $_GET['author'] : 'all';
	export_wp( $author );
	die();
}

require_once ('admin-header.php');
?>

<div class="wrap">
<?php screen_icon(); ?>
<h2><?php echo wp_specialchars( $title ); ?></h2>

<p><?php _e('When you click the button below WordPress will create an XML file for you to save to your computer.'); ?></p>
<p><?php _e('This format, which we call WordPress eXtended RSS or WXR, will contain your posts, pages, comments, custom fields, categories, and tags.'); ?></p>
<p><?php _e('Once you&#8217;ve saved the download file, you can use the Import function on another WordPress blog to import this blog.'); ?></p>
<form action="" method="get">
<h3><?php _e('Options'); ?></h3>

<table class="form-table">
<tr>
<th><label for="author"><?php _e('Restrict Author'); ?></label></th>
<td>
<select name="author" id="author">
<option value="all" selected="selected"><?php _e('All Authors'); ?></option>
<?php
$authors = $wpdb->get_col( "SELECT post_author FROM $wpdb->posts GROUP BY post_author" );
foreach ( $authors as $id ) {
	$o = get_userdata( $id );
	echo "<option value='$o->ID'>$o->display_name</option>";
}
?>
</select>
</td>
</tr>
</table>
<p class="submit"><input type="submit" name="submit" class="button" value="<?php _e('Download Export File'); ?>" />
<input type="hidden" name="download" value="true" />
</p>
</form>
</div>

<?php


include ('admin-footer.php');
?>
                                                                                                                                                                                                                                                                                                                                          wp-admin/images/                                                                                    0000755 0023422 0004734 00000000000 11154152620 014560  5                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 wp-admin/images/align-center.png                                                                    0000755 0023422 0004734 00000001073 10741101146 017640  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR         8<   	pHYs       IDAT(OkAūkgc"݋~®1$Az$%$tUк?+T{	ȗ $%@d($C`f9rQEN,qSڂc雏DU{_VOnp9J~	RsMvEϋp}a8g">=fp'SSe"Oft@9WtvMD9s"]B׮z_xK@2զS7݋1yc@D \TP;^|M& g`}noX"-P j׊tm۶ms s>99Suc AJxQFя:tvvvW?ڇ#t*"MӔ+Ο32pttt7?f @d.%_U= SSz|B9u's;ǫb    IENDB`                                                                                                                                                                                                                                                                                                                                                                                                                                                                     wp-admin/images/align-left.png                                                                      0000755 0023422 0004734 00000001113 10741101146 017305  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR         o?   	pHYs       IDAT(}R=oAMBdj:*"_HAd	:~ -=R9}bHٝٙAKdɞdӨ2LL$U$I3ph+hdo4';@ I	j:Vj4N!o?V7Oj75 "{UUf&v6TU֍OJţ]/4_Ll6 dk>i8D:u]79єc1Oa2IDr"̜s@AoZGmMOk$ql+H  HJ}M֛g{W!D׏_Z_E$EB9l6C	nTfH.*c{3[,Spb$UuZBA5PJH$c$`f!U󜳪P.jrhTu\.I+lJ{#H:ίs뺇YiQdfRl!eHyY    IENDB`                                                                                                                                                                                                                                                                                                                                                                                                                                                     wp-admin/images/align-none.png                                                                      0000755 0023422 0004734 00000000705 10741101146 017320  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR         8<   	pHYs       wIDAT(=nA_!"R+Cp2KDtW=Y&mɥJZWB23I 4*.TyfNӴm.Q%T3]ONxtu]8I=|Ƞjf/47#`.tY1}ڟn|΀(m^_ о37m/ETUO`(PP<37q .?QP T=!xςk[
w"Pv5
r fp7 ="V@xzpo\{^5eEvD~/&Jl9"wX!vK    IENDB`                                                           wp-admin/images/align-right.png                                                                     0000755 0023422 0004734 00000001054 10741101146 017474  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR         o?   	pHYs       IDAT(AnAE=I)RV,8ΐ, Q|
ؒ,tW}EFB`[GSfwgfz 1y&ڥJɸ媞HKQ@wogs/;C
鉈D̦Ry<py+>{'ul-]( 5U`fJD,m.Km8+9b3#eZJ!qTUff曛>OjH3?%dxtr~ODfREȿt1+Ca7nejf93)#!	%#j`f Zkx!l68*-K:BD[kM)3ފȯ?mmZkqԔRDW<cݧ죛dfǙ,R8; cN]Zk8Pl6^Cbޢ(Ow?baO`y    IENDB`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    wp-admin/images/browse-happy.gif                                                                    0000755 0023422 0004734 00000005252 11112371522 017674  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89ax       ڽHHbssskkBBڕ8cc\ә""w,襌QTTe""{{xw?::rm߄4JJoCMM𞡧03304΄߄ZZֽｨy@ssoçkz{yu]&&@ĝXNgLLڡ9w悈**+vkv:}˶|||ݭ

4rxup͓r.s{k                                                                                                                                                                                                                                                                                                                                                                              !  ,    x     j3IȰÇ#JxLYCM5o8v9͛6=z$qG.Y˙kIΗ9}4P Q8 6_@e!BTV#h`/VJ5Xcͦ-[[XٚEڴb1l"\e0*#a62"x,Ɉ+#L0dɝ-YaҖO'`0Hz༶z5o۵R
qŏ(Ώ!=yrգƏ/nkT>ݙxg̐ }g' ]Bq'U2o[n}&C1yPe!{a3Q_%Ha	Ȣxb)(ckqT&\\55&!dobsPRhNFY#4x5$kUaT&xIxk`kXRY}+V餉)x'k,4oQU%:YEXfiin)i
]y%zMbYBFU+>Q*쨟ʇqj*Ɗؤffv莙FŞTkcB[T+!Khk:@vSU ,KF,qoqL!nfjn<6D?,o|ҐFFŨ0ErBFUk0JkB<qQ"ҹn8 1wx`	Zp+
l4T-7sR,2KUJC
h1x= D@ .o
|EZv8 `{mPrT (U{FF  	`c C@$JFW!yq>@=P \0?`_\t`@S+? g(B	 T nYA:ԁJT+@4԰փ
|*(@WLp>]/~9  *.d+ #"`1Á	p2 +ؒ	p,QX \B] an-QM6`
_@
NCİ.&:Q**AqzaKW`¨9qbD9V# :,9uw"8P@ H yhİ< *i8Gp5\ s#RRW-dJ.{n D4S0/`CpFpMAU#k$%|RdO`  hAJ3uK(
tЂܠ
 eX7CL Л@  d  Gwp!/$Plϖw< `5L+p.;aOB7|!Ix PL+C8Pi 	IHV J/ Pd\P &.:!5z t;ʄ@1`pGhCȾ ց8mC ,I* ϨyBXȀl*P\`D[ʊUh%؀n0DFh"X *GQo"M\$xa6-Vj؉%W;c
l&Zu[4 mW*A[ؐ/ȉis% a[."#|kVW4`/T N&YN6J(1A&N *
uYhV6` pH3"Qָε5Dox"NX ;                                                                                                                                                                                                                                                                                                                                                      wp-admin/images/bubble_bg.gif                                                                       0000755 0023422 0004734 00000000613 10771375650 017173  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a d   &GaiN!%꧐𿿿d=3̡jgΠ4SkȺY/@A^uuｬwN                                                                  ! ) ,     d  pH,Ȥrl:ШtJ.X쁙ł]k)f6Ӓ~D L
' MNO PPQ&L#MNOPP!{L$(M	OPIA ;                                                                                                                     wp-admin/images/comment-grey-bubble.png                                                             0000755 0023422 0004734 00000000236 10753530544 021142  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR         a   tEXtSoftware Adobe ImageReadyqe<   PLTEFFFrrrM   tRNS @f   !IDATxb``$6G]=``9H` ( oÚ~    IENDB`                                                                                                                                                                                                                                                                                                                                                                  wp-admin/images/comment-pill.gif                                                                    0000755 0023422 0004734 00000000110 10733147326 017653  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a    N!!    ,       Dkڋ޼צHIʎGj ;                                                                                                                                                                                                                                                                                                                                                                                                                                                        wp-admin/images/comment-stalk-classic.gif                                                           0000755 0023422 0004734 00000002114 10765651012 021453  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a@P  '>N!%&Ga&Ga&Ga&Ga!   ,    @P  0I8ͻ`x	dihlC,tmxq  *l:&oJZgv%p-ޫzr+=~ߚ:sqstww|[Ifk?!MT,9'4Яߝꥺ/dg@L0!KE|X(ĉF<Z|1#%xȑ{V2囕,[Y	SΙpԄSgKzA
СA4R(R^
ԩ Kٳg^uUk]}|ݻs2vܸҽK0 z]C0`^K\Wp*,3N˃)96@{v :hɭKhFCZ]eّhז߮yW1G\YͩCzuc>j_}mѧ.˟{?~F`b2Fa_va]օn]ՅU jP HXJT6]2JL2$hӎ8Ў<^EDDD:"H&YCeQЕSRiN.;WJ!O蔉zWYh2&s9j9geBsbg:~ei&@ڣa)E"#*餎lʨlxЦʧ$ꩨBj:
*j+VjkG++ł+>*=e$Vk-}mt{Ӹʍm>;nꆖﺦkZ;T<Uz1e[AUVD 2[ 5\ Բ/2--r/{͊,rρ\"ݘr M#-Ґ9#Ҷbr6XG7_5_C3ggvavvjm7sv+wmw}7YyG8}/x"_7q~X_9y;7%[~yd.	  ;                                                                                                                                                                                                                                                                                                                                                                                                                                                    wp-admin/images/comment-stalk-fresh.gif                                                             0000755 0023422 0004734 00000002053 10765651012 021143  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a@P  %&GaN!         !   ,    @P  80I8ͻ`xdihlA,tmxq  *l:&oJZgv%p-ޫzr+=~ߚ:sqstww| [Ifk?!MT,9'4Яߝꥺ/dg@L0!KE|X(ĉF<Z|1#%xȑ{V2囕,[Y	SΙpԄSgKzA
СA4R(R^
ԩT|*_
([L؞V-m[xޤ|U,Xb6"?vY2ΕQt\!8tѤe>g`];mڶo:xৃq7+_hzУN]_1s]5g.}.DdxVP(`H*V
"L@MhӄaOf!Gv#8S$S鍣bF0>hэ4Xύ8V#?@2@Nd,ϒ,XK#<Rr#e>R2)JdNuIMRdF&<h=hvX܉̝t։۝My˝YD/j衮$(6h&闒)D2EjiGveZɪZݪ$z*$檫w+ Ev$k1"MѶՎ)|RSj!Ի+Ļ/VnoTN0l^|3k18LK\!r< WD#1#5K52`)j#OZǙ,ܬύ8=4=.9ѾPͤQK݌9R-X5Bz8!jmvhcjK%=޵}I߀Qkz[x ;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     wp-admin/images/comment-stalk-rtl.gif                                                               0000755 0023422 0004734 00000002050 10770226124 020630  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a@P   %&GaN!         !   ,    @P  0I8ͻ`x	dihlC,tmx1QAdj:PGZ3ovʰxh-vnk޸<7zoۀ:opssx }CbglGNU,9'4ͬݚٻEW9<BQz1"qJ;zl2䝔$<)(ʕtRc34ټӗ͝z434(EEd(P:bh ]"I׭Vz-VeEKEڕv݆ׅ];ލ(X0}WL
9ȌoDn-؜f<pZҥeFk]fK,\ioJ:䱓+?$sKKس3=OéW.\K% ZDT[%"%%,1H1mlm!m8I*rHR,W1ʨP+ģFϏ;Џ@DHLLyϔT"de5\fe7\vI`IOdŔ#.rXg0u)g2urgyg@}眖,&9fᨢnr)Fz)ufZUhX+J"oȮJx+/*k:KB);zmںT&ƺWeJn[\+D. :|0 H7\Wara|1Ɛi,*1$^$Er`)O3 3K0;3sc9=_3;@f2m60Ԕ9=QKdҠI}5Hmaڲ]qݸ-	ޗE7	  ;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        wp-admin/images/date-button.gif                                                                     0000755 0023422 0004734 00000000157 10766432270 017515  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a   ǘddd͖!   ,       4x*ۧH!+;'yZ؝ᾰL;_ᆫt\e,$  ;                                                                                                                                                                                                                                                                                                                                                                                                                 wp-admin/images/fade-butt.png                                                                       0000755 0023422 0004734 00000001421 10304144320 017134  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR      (   *   gAMA  7   tEXtSoftware Adobe ImageReadyqe<   PLTE2  IDATxbpP``"uf Rg $`CM888 eueeeuA]_J]JL]_L DE#e@<<@GBGH )f@|||||V| Ġjh(*i*)
 dĤjĤdd288CI bT6UV䔖VV0V4 'AAM{A-AM-A%%M-A% bbbaab KE[ |  *@X @ a  U 
VA *@X @ a  U 
VA *@X @ a  U 
VA  Kv%FU    IENDB`                                                                                                                                                                                                                                               wp-admin/images/logo-ghost.png                                                                      0000755 0023422 0004734 00000001057 11053116730 017356  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR         7uQ   tEXtSoftware Adobe ImageReadyqe<   KPLTELLLYYY___xxxeee~~~RRRkkkqqqrrrSSSlllFFF0&b   tRNS 4
  UIDATxT Ey6F4/]̦-3G(>'˱S}:m!j{o"qnt M&1-CESHxџq@Yň$m){(L<2x"tĢit$c/c<Lj mTЧf\G&y>e4vΓSV]P%D,'jg~XB%$W{ځȴd%8b!zbyX20U8`l%vuEDI%>gXUiA-X=֏%HsP֬XO7!Xs!'ﾧلlG +M    IENDB`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 wp-admin/images/logo-login.gif                                                                      0000755 0023422 0004734 00000012312 11120046724 017317  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a6F  \\\tttsss]]]QQQRRRԢiiiXhhhggg⸸͉K󪪪.}rrr񫫫ۨf<~~~˩ׂ=t/}}}}.~WsXιJڪؚreϋuuuҬ/~ؗ뀯e聰=<XYs̷f=X!uFFF                                                                                                                                                                                                                                                                                                                           !   ,    6F   -	H*\ȰÇ#JHŋ3b G4Iɓ(SjJ0cʬC*sɳϊ<IH'P 
?JJC	b 	b`۷pIb  4+L
;`:0+@܋@`PMZ
lWCgʮ[|ED$ BO\`<eti@-- Q+oN^&!{G㻵 g;W8fKE{  À"+Ơ@'u TB ,X/}h
#u.#C]@(a3 'VRݏPFI#0D2@hoQbDc`)a] e(eA^&n8N)h|#t%	`F*ScdA^!q"騜zUL,tJjii j@ f0] LA걃TiB5@	՜<)®EAɶvۭAYPAxkI+BT"BӑB2ADD@%G
`(ؐAPAjPE|<i&AT"~%[r2y)[R	fdg|u(ATl;DA @pBYIWR8]	1A  ;\{=Sfr%*MP=lAЀL)x[{f/s
[$Xו 䇷Y D8$ƶ2Ld1K@T@ŃYP5y%[[265 C' T%ly	QhAQ  2^3ndk @ˁmA.>YQ	mV2m] QEX Y'8A.D!ѣ75${9bb
H(DafbЅObcU M2 ]SLtgͦ_ay6D :	B
A#K
&ƭ4p w8UXQ q0&ڠ'4m8$b32DT"U@$n?2HSU-#چD3H(a?R6[u" 9-)
;Z/8 a|cAhȤlߎh3^6) w"	d12GZ5c"?m&f<]@ J@`[E 	R@J XT& -=,vy̛qKbca$LW!q¤'E {x~['F>KH
ĤP I8j%2ddH%ҹSdENTH	B \_٭m3
"n xR7n hBO3%c
-&jO (@u\	 wް1AJ$Mh@L2Y1'dsx2
do1\)) 涌V$_n-v3-H%[5 ɭ@9=dYd:ӌ,3&DHKk:?˓
U$u	y(%`	<tkE2n}aXu4knA !@/BcJ\0T`2xI}l	 yj-԰ mD8V٤3y]ɓ[KǭDm=L te%
˹uPA2S1u>o7	=JD@T(I܆:K(pa" VhM!,<X;Ȩe`nX	9rܼ ++j7a)-<ڱ	96`d ۝@|VPB+( snw](7` C pLg	AzY@,bД	:DM-[-óރsOwIT%R`:M \$M1_a6]s^K훕X#	zXBmu oIOعnm!1?<  Оh<#	($ H	Ԗs]"_>g6k'AfOf
]f^o&# zv-v+[tL*(
 ꖉ Jv"0^nm6j7.@h}rg#.4
3ƿn |AIi=%b_sKE Wh0AbUO+`ejqxB'OvtD&V|u"gQu݂g!ph"_5p7GiM$1A5h	U s	q> (5>Q09RSy[05QaG|G&G	4=J'BmpbpaX#-7t-6Pm>S 0ZȗEHtGW!LH?cM 5֔IVhV5VWH}2a}Qf)y}uxgQkJ`_wXp{vX~Nf8x8Sdc,5POTfvLS<%'6y$S\01H8tgp-$HXނ^Qےa -q56XO3cV!;C87 RfA9!/A{*3X,	\4ABTa\#]k>d]X]-('h=ϓ]s`=$AVҀz!%to1QIx,`3?7%?hs o1:0#c	!#fvh.;@ුsyq-{%sKRZG	`\@Kyv$K
%V85Qw+ROY	h	:e'S:)8؅D3q}th-X@^PYWe0`i-$ELDyJ-t Auju%3aC2/8V8 BRwSsf";Rt pqY"'k*iX	dy
kjb04`IK%`FK@ԊP+0<}7R	aPTV NTB4I wq-s3qxt02 ,3q3(skpmqAx3w P:
f	I )l UfP jDmP	m[&ipg|y7V 8CR	Z3ш*Br9V "bi^0s`Lph4Bӭڭ:H*sẮ13W  2 H3`r?3 DV	X#IoAc1w3ib\3б+ p*XIe>p KǍ@#[jJUb	1)>kMP&4Zr!E>xv&fmR *xc-GW'1;f[ (;b5O[{gC<{vMr׃Ct z[p^[
0"!`@ q @V @3)Y!#TR7 K /0+  !/  /@ k[.@!KPW79A +  F@KJ!;.! 20 {08w)!#P0+;4пqqR;kLL8Or4" 5}Z)  ",;@ `+H  @L   @7l	D,4Xм%QC<Po3APdaHq46l	I,]+;F,7L@k	'%, HT, :	 <|!0\AK[Cfmo
ϛā"L{uܿ<JÂSA#PA+'U!6ã\  {]L+l<1\B,\O	B ۳l	9 B R  !|{lЍ<'9Q`	B	G`[R0ovLL|(T[9 S"0OY<|l	<ԖA\H0H0DKN=Te)4%qK,RۼЋLt;H N )]+il} ;                                                                                                                                                                                                                                                                                                                      wp-admin/images/media-button-gallery.gif                                                            0000755 0023422 0004734 00000000110 10753767306 021310  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a    !     ,       mRp3FB{vUeeR@ ;                                                                                                                                                                                                                                                                                                                                                                                                                                                        wp-admin/images/media-button-image.gif                                                              0000755 0023422 0004734 00000000105 10753776326 020741  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a    !     ,       	˽"3kU"v$%1hjfH ;                                                                                                                                                                                                                                                                                                                                                                                                                                                           wp-admin/images/media-button-music.gif                                                              0000755 0023422 0004734 00000000274 10753776326 021006  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a   穫󟟠ɸ߰                                             !   ,       9 $BJ`<#L	\K$]3ñp<`#6d: ;                                                                                                                                                                                                                                                                                                                                    wp-admin/images/media-button-other.gif                                                              0000755 0023422 0004734 00000000215 10753776326 021002  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a  
 ܷʣ螟            !  
 ,       :PI@،C9K!"	kw"<OA	s-6B9Ua(k ;                                                                                                                                                                                                                                                                                                                                                                                   wp-admin/images/media-button-video.gif                                                              0000755 0023422 0004734 00000000104 10753776326 020764  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a    !     ,       `SVGmr%HnЉT ;                                                                                                                                                                                                                                                                                                                                                                                                                                                            wp-admin/images/media-buttons.gif                                                                   0000755 0023422 0004734 00000001323 10753767306 020045  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89av   贷߰粵Ը                                                                                                                                                                                                                                                                                                                  !   ,    v   

		ȫ  όˮ֓֒L@;P$|!Kle.Z
zǱEUh㤏b=iV3t'4FJaBk>sƌf%;Y*@Tx'1Ss6)ފ5Af(O7o0Z6#}$ɞ7K-[S0bhAE;.h*
<Xe%Q ;                                                                                                                                                                                                                                                                                                             wp-admin/images/tail.gif                                                                            0000755 0023422 0004734 00000000142 10766770400 016212  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a       !  ,       3fsmn}#Y
番gkqfaS<"B D* ;                                                                                                                                                                                                                                                                                                                                                                                                                              wp-admin/images/toggle-arrow-rtl.gif                                                                0000755 0023422 0004734 00000000110 10770235144 020460  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a    %   !   ,       a{lE6)9޷#DA ;                                                                                                                                                                                                                                                                                                                                                                                                                                                        wp-admin/images/toggle-arrow.gif                                                                    0000755 0023422 0004734 00000000107 10741076476 017700  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a   %   !   ,       D	:bt1vKh* ;                                                                                                                                                                                                                                                                                                                                                                                                                                                         wp-admin/images/wordpress-logo.png                                                                  0000755 0023422 0004734 00000013044 11120046724 020261  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR      D   ,(8   tEXtSoftware Adobe ImageReadyqe<  IDATx]^n*ԀZヶ*	**b}2Oo,&rC}P6Z0c"6тI[$Xi7?>L7u:{3\1ý={fΙZ{ʲ,222>DDDDD8I;,9R:t8vXoONNg}vhѢbɒ%lcgr⋅lp̧v~ 6O/.232Im۶#)dV
V 1oXlY&|FMt<ۋ;w֯!vEƑgϞb޽τ^y=8_r@\QlVk?kyOVTd/n;m~sAt8"!/։@lߢ 8Uw5!͛kCDH.WQ'+eP	TƠ:LQ$$G:|ŵ^#׶mʧzl 1,`XlR# &9dJنmQMԕg/QCϹvdvwuW/ldHx,&$''q rCrNΌ?&|o\Ckxʣxm~:+_e.HHs<$uI\/H.SٳgdĈI oIrNΗ5!:)IxgLՖhƨC0ޞڌOfLխ<(qُf>x꧌Mim^sqzu32,)_sS#@K?zh3ؑX=ǅ>B.;YR>_y%ZP|}>Y{)SvĒ/G-e暇Cs2#408}߾}{MlDg^ں՗uɅWwc}D)kbtO~5B|+H> $WK0,1Pr
7Dx'b[s9v;N&ziٟ,8vS9^%9~= :_XId|xט6H jt %O 	ȕuW_4vKtyOVo{q>رOظ #<2&?`D9o@tYJĥK&G/!zMȰbTd&ōNY\׍oxALr4Pd10$FA}>~O*ˢb!|1)*s JЂ_>+̓vAH++P޳^-y]#R;FAKNV	hmڱRtKyعsg	!]ᰘRg/υXyU|.'ț'yo3Uʠ#QPQ
!E;?'yڭں'@Q{wD"~&,X|y=|j/ʠ۬[afgҷmiSIŅΡTM!N@GD!}L#U22t컕XP4\hW_sa"Ië;g %|D*!?ex |zAM:6kw+ŏe?l2C]53{oTS~K}=BP٧"EY9P~+o;gDrFe|}Lp!{)DoRN)x&kbѹul^|_~}=AR  PIbOڸ_O$O`}ǖgO5r/=V]F%ZC$zՎP%{(.)y*_RA[}gPia|}stD%Rrl6^d1<zN7ziSd;Gr!8ާH$φ?}/% 0V>1>+27B1>)Ӆw]m^@I`jSfjP+7)={a
XdGj^hW7E{b]!:mSڇd;TRA6K{3{ƞx5؞ 1Vg貯o̵Kt;+Y@b/>)WtBJU;toӇpO9Wo}G}7ϤW他}}Dc8$#L.wM1%Oa6J͵wY9 }nIMQ!is=>sz ԇuID_|qc7̺&ndXSl^3-tůϾ=g1O@ %w+mz7yٙ\zd/anݺ>DKIDl]
8
o"߅.Z>$ۑk^6pXORGK=R
RlD[r}]g<K[!E?~{m;{F 5HNԳ?5umScvVYX.σK%/O-ij{-Blwx-MJ=G>%<'XOo,6ȩ}7͒R]
[o-d=F{bA0܇Z$755Uc03&t:A&xxFbyL=:.V7Drm1]xJ2WlAَ$M.~AB{$`'"0}ʊJmHxLOOCd>p BxR4!|ŵBqTc̃6r>/Pb B"#"RWqw{HvX'ߛdFE0&$~ْ^7H E(F޴iSo^ܒn<.&8G?paKHt}.evh&+'C|yQԱ羛.O!_0g|F
f콍HK( dI	iP5[k>n)!{9$WcB=գhozHjJpƢ>:I:Ve!_y]#:Jj&Ĥ8>sN=d-4Ctlgjw-Sԁ0bLSrRߴl|.g¶3j9(d#Ő>mC~B b1Bґu6F!}>5dLؠm!K$߅2e}dNWu	=fBJp3NR:jSk{h\</ԧa%W'鏤/,U|ll[ǛH/oJb}dۓc~Յ)BZ6M1m۞6w>bјa}|qѮ&?UsL<Wk}/t
O\Y79D@lM*O}q!Ϊ3(]y伯CsBtTl;Wt;!Z(14cd/KqP7O:{Α}Ƴe<4al߰,w%:j5w\(hdo+X<oB>P!1	!͇ŃElh.b]Ȕؔ!/-Ĉp^bX'ٿd.:ƕvzizxqΙl҆~ea3NfL}IA+<suvNj!x#tСRMroIcw?7^~}y8.sXnNI*.t(uSRYY>蛰bB4=8ܰ.f!i%- {mE ?J"Ig"B]Oc\`W@V$í|Om=;d'&y0lVy1ŗKI]oЭRKrn@fBMJ`s}vgy⦪5~RB˽ZGq咽cc8U!XTƅJ|塣VQ$PE8=\HS.8LrY}ff~bAPÏhqPC56_^)u]WTa3v{sgDmHƇB`W*
P2_(LÅ%m.>䊕IduP>v|)bmƱWZ9?ܷnޜ1nJ"D{lOIQjˆǸ22BD;;#C1TxX,6>J'/g]!Dv챒X, l#<}SٛgdxV`3(]5Q̮PVIr2qo-I6@h,jpWg¸[>ھXmT-=j/Mwl#vmABѭN(7"ڐ13NJ@a-v{-qD)T[hhMvp}))7ҳ&wStLRŃE"$\J.ciӦ1C|;pooV3GGRZGl+Chcf~;<d弾dLCy>KNҹ8=5>oz}0>dg0 DeV1ۜVCaхٷl[gguP]7 (aLޑKGaK5U*X߶@!68!%fg|]tգld30,Pm'{㖑nGfpk['xnWJBb.Ru{uύ*jwJ@ɫ;]iUe`Bv(}ƞlInԟ]/#cHMل;4?"PfwcmTcHxJ<{a)d$w;}w&)H?!3Ă@̻[yF&n^kt{h¤x1x]Rl1#ix^@8_<a#"mv+ZYe$Ǖa<<gDW[JfKRJ)HsdAxk+e	^F%x32"qƄ:z5@|8`ۢ:v7x}=HuHqe 	-Բ @nk2?fHAٮ$bG+#dCBÊŉDbc*rƌZu싊@:/@gL\?՛qCX/5'ɿ	}[ 23223222322N
_ =UcN    IENDB`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            wp-admin/images/xit.gif                                                                             0000755 0023422 0004734 00000000265 10737035624 016073  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a 
            !     ,     
  bb0EJ",d	H00KA(L&BB0DR!$ఓgJVsPH4"sKAn೏1*NJՒP,  ;                                                                                                                                                                                                                                                                                                                                           wp-admin/images/gear.png                                                                            0000755 0023422 0004734 00000040546 11014301614 016212  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR         >a    IDATx}yU餳vH` Y@EM|p8(.83n<EEGa㠠|qIBB Iwz]k?}ߓs+tg{[ԩ.[c;w^ `AUUHY!I @UU aPUeee%	u]L2dcգ`QJȑ#P1MDfC  y ǂjk	ݦ:^`8b{n i6 '<yg+m	XN'NQ{(Vb> 	\k <7L$@v@&IZZZPYYyJuWY/+O7iq˶O>峟\=8$	0  p\JUUP9==7#VV]U*dY(9}! `'-% Ǒى*=$ƛnsOه#Gpeb3!ķ- V a}p@,> #SEO Χ%#c! \ׅ"L^$[tT\$IhkkC:.:7\\+D=%y`ك" i?7xuĶzRc]Ai?FT*//svQJ k[ L[ǝ1ƞR|iUUk.?'8_N<t	^lT
D$Dr]ӦM7>|x>t&LpJ(% ɓ W^Aѣy<sHѲ,CQ#N`8Oz+8~s==rLlll<"z%Smwcc ~-1mڴ'<۰HJB*$Is \}<A]QWWqʴiOW^,f͚uT5.v̙G Lc?þvZkj h3f<8It]ia   ]׹dI&mL$@mm-^z)6m܈{,O={y%sރ s=`ϟz
$>|41cƌﯠoD_̰U@޽>6lXqFfø>L"oL$hiiAww79sdٻ/OPeڬYƹ Q

MJn\	4,`՘>cF(f͚q׮]gY|4~޽}}}e-&!/2G,ܬ#il߾'Oa5k֗5M(  8qj LBQxl6S@V<p ,ꫯ6w#wn4	*LHP1\r%G L78n444\. m޼<̚5W]u.-bHVTҨoؿ?v܉~K/ܹs?V]]}HQUUU8z(z{{WPF)
zI`̙yѷz8EIiqtCk,[o48,x%O<$bݎ׾,_Vĉeuqs$F5M(Hؿ?mۆ#G`ƌ;ppn#""QO⸿G1k,_mݹsg*R$?)L, pO}ݸ[O"nף xd)DP;A]#n(
,XYfaH8|0|߇y<.y  Q^IS`o<i,8oN> RD&n,H}Ghkk?A̙3Y@$5M0"Dǎ9 D%0L8tqB.^))@?݋K.Ļn<3(++Ç?aqN"Itvvv(_|Co?%Eli~ўqymevIԫ5gx< U<r<WT`jClقx<϶HUU[d
pX0qUPH~5mڴOW#(Ņ"w5āUA ahhHp{Dn:apab}H*;h4%_4^gF2	G3aX8E0& 3h$(%r@WVWlX,3dLrϖ {zzՅ!I}N⟤ X,	&`ɈF,eM"(B=O$zVUUqqqLJh :ԜRH
$IOX`%"&yԮ:]]]hooG*aO044.޽9s&LD>?-K"?!eeeྑ.;0 vqk e]V:mp饗>1nܸͶJ4r9:t}}} D}+nDH'EA>k={`Ř2e
|Q?OFԖy(//G,[WXЦ(
dYX/++Þ={ǡiٝNW޽aEsn8po&ϟDMMfQzGG>۶Cs8m?3HǁeYHB:溄a J᷿-.@mS(u1ƾB#"(
^yH]G%af0i{Lf>{kc<qsIN98_755w]]4O+GEss3@BeYp`ܸq͏"H*ܭiGmHR>}:VZݮ#Yeee(//=4.PZ[[ˑFO"$)eH$b
$	D"""8/z8<'~uԩr$=MӰ~=zs=I6(2e
Wɢؾm8|0v؁n` &O`q%)?/ %`/2GؿzIɉir"8o@H'*@dYF2ܶuEz+f̘9@u9r{N |>z̝;Xk$mahh||,0!#pPUe^֭[3\ fΜիWsA,`+=^&I/XIcrxF"$	\{4^Le HFekoo_*"HQ$I0ؽ{wG"޼y9s&WEAww7qrړFcc#NʉnٲeÆ%aرc(zkfׇQ
NkӦMXb  \pp,aOO-Z'bhhiy7|q\ve:u*lۆioN>d|!8z(݋J,Yd2hhh5k~z$Ib1A 0/MMM}eDtA<+z)S9A>/+W䉧T
hT<?ca?>|={c۶h"n7[nEOO(|߇(,Lc̙hjjB:o~̟?\srjkkxꩧf
fY&M.X1144˟Ks"R)l޼~/ L&H$BgЀ
dY.u]GOO:<"yaʔ)fPU;vCaX.Xcc'L𨪪?Ohhh@cc#ZZZvtt;v|lÆhjj9sk.n뺨{0UTT[lU QVV6cp~Di..lJX)p__A<<XC&T}}=f̘˲(
vލV^o~,^wu7x˲oYV8q]VZvc===xאH$L&?#Ncԩ+>TUiݻyRg sn:eYSUP>&{#m3Dt H$044Xuuu,AJc&a|R3f6;vx?<}h%˲#琨 V ~VWWc݈FH&Fd2Xp!&Mĝ5ݻg"L!sPc@c̐$AD|߷ `awyeY_~[[jkk!2zzz8Ӡ?H,477#HW_Eoo/֬YzUU۶rOx
zrˊ^ziSkk+q1?Ǐ,Xp!6o\kommży .t0yq^z/ү 0H11f $I3Ni ϩi H ?5{NN	/"H wa sS&0u7 `ժU*++g.y+q֭f8t.P[[!:ۋqIB`(5-FTncEaedl H 555P 8F:.,Q$	L˄D"]׹@
ԄiLO:]r%??xmau]tww,cgƀ#٧~%cDsE]]EqKs)Ȳ c"y8STQ,SGMDG 2 IL&aLy{E_AKE
YÄ́	nsX$IH$(++mhƕWzrdyR^z}'F-  OۿęR!B@uB/C`6t]G*B}}=t]\hફL&ti ykƍ~``oL&IE	E]|oIBevl xq?Fbٓ%"LrBHqsq	~$ :$ AZL0? lڵky =4˲y۶2UVV|>2},#WpmӘHF:ujc"S)ᚦq(`F&4\I:y M,z&L+WrtX"C,J;zsFõ<[xH4$Ĕ;1:.aOS{v"TU=XJĊu.Ν;aYfϞ]TwJăS xA²gk4p	y@㤪*_3!~(FEqMIDiODB?N"xl'8硩	k֬N>tnr3R&ia8K^j r^lZ.IRqdYfappl'NDKKKQ,~$D1Bit Q9-T*UsJ qF#i%EKT$%)΍$Àip] *l|z֤IpСg9Ey\.z I4*':k i.p|YWXDbnae04GA0Ԛj[+(NOcH&%q ax@4o@@)bZ?qBDpQ߇0J? c,JH1HJt]h ^Dbi/&tq9>(H$}/"4M4y*{,oT?x?dyqT2`p&mGywq?>$L`ؤ	6}G4-4M4CGL&AMRCyy9SE!\|k4"	@Ki`5mx$d /='QYaL`ю>!3@|v|ACpyD"=
DQͶ')!H4iF @YY"H"**kb5"3٨]M$ ç?R0z[ZZ.8:B[i`V%I	)Fee%\ŤIpȑA[3ѢDyA
;:88ȥQ]]Q iG
`\.`321m\>X_|/*[Cp>VQ vHUUU}hHs]555<KZUU*)zIЀC=UЦןA q4R4M۷mC$TVVh%QHR' <q&i0GZ=%o|.%(T1xD7"  Iٵijjj0k,r xt\1ݲd]]ݢ)S@UUchhD1ct]V@,'{뺏N&Glb;4'ԼhY6m.(@ee%͛ד'Oe]UU?>003>N!
"}?<k֬F躎JضݻwCe8)S,H$x<]MBgEBM'䷵rUUu=)Q44UW]ŵy1ca`۶mPӦMeY%=,˯x^NXcu1MS8q"GlmD"9(J~9.\Gjܲip"M܌7b1,ZLr={6@ף\۶}m<RŠi/D"ttt^+2
Eqo߾?Q cq- @/UEGP*Nyyg4a7x+W!tRl޼}}}u۷oGgg',Xj2M'N,%i,Ν;q!+x#PT9t1.@R,/bBqƟid2j!]c쳱X/&]`x;˲x']ױ|r/cǠiL&1a.9d)N<ݶmT
\[2aѣ8p t]?y<AUU-Q9} '&طzm{_P?1cI3d3s{);Dee%fΜɝ.|a+āk.~oKK
Yx%r9#J]ԩSpBIh4l߾(5\~`~С|PG|uq-$sA'xl4w\7OC֭[(
R,ӛ5kjjjo>tttRyPN$0|<^4ROؼy3<ϣPtQ{4mL4	!IR(Eïk[opkb@@.nZʘ.ő_3Җ|ߏ,Ydꫯwڅt:]TX`ZtR444@|Ckk+:;;yRz,4Q[[ɓ'$8.eXd_ƤIe$eI9UM1sog4 J믿j,pi|MT8;~/.]tkնoߎ~	,#"({?>8ёD+xG*B&)
D54M_#ICXǏiӦgu+ h* 	%J"$Y,{1^HloLS@8dPʻE,$D/_>x7j/2$ϸI@J׶mӃŋK .IzH<Gyy	f }G&)_oݺ{5ږe/    IDAT,Xv~
 R ))4#yZ:qn}?jժ}ڦM˃Ab֑؎J$cǎMMM5k/H\Dҁ ̵!PoKKvڅ!vt~,*y*o}
X.0af$8/fH׮]@WW pSUmW_Ů]0{l444 '&'4ڿ?_m7 KsȲ̿?twh=СC*t]Ϟ-Ʀ;4-TZUlٲիWCOO"HN	RIa;wD}}=Ə^&	bZr\/0/paسg|g>̴Ȳ<[ W90&%GݱgŤI)bHFlzdQF'r*Om)M>,ö<A__n8O|E~d#`ppmc y_áCk.#eHd1?FV
:4w	a`5tM(sHSx[ٶ]x?яf78  _j_Q4t+>_oΝΒ-K:~$V}?B6h15Jt@&
H׎r]CCC\lR}~.4:뮻/~?0?F16#f3pE$2vmPţ>q̙7}{`jC/%D"8vvqqƌ<QT\M>Plr5b"K!7`OGGǾ+bɓy&)<ܶv-nf<C~SUUYQ wJ_OiL@&*tnWK_gh4/ٜH$fnٲ?<8nr˿4WN,N!mGww7\mb饗niiKS"w^p7}oe"$͏
<zҘmL $<ϣ@̊pbߞ=6}:7u]G{{;?iڒB/N<~qF1e#)4 ^\.˲qppvŋjĉ9Äs!|ի;MT->HǱmt?l""\/@
oWys=`Z[[y"9|/nSe	bkfF"~+ؼy3Z[[H$8!F5sd9^ ѣؽ{7y^W_cl͟g)MT
G>^ַp},//$fD7tz	 8-[<}ݸKuDֆM6mc-}_&^UUap۶mDM,'.ݍd21F+h}_iӦgx閖qx{ߋu{]YQQwOJ?̑OmӱdM/^o?~---¦MXLs&-  >Z)TX+xgLT$ L&y /Fd46\ulܸK4gw_ױnݺuuug^/rQSEC ",Zh;6y{<_,Qql2ľ}x08<T tBBH:F?|rP^ rGټy3/y{}ݷrܸq_~9><_
.: IPٿiٲe}횦]&g.Bիqu^C8x ^z%[T-L ""H$UVK.̙3~TUQ)(ϯYn݋D⚟'WVVr䟫qd2x PL>я~T.œ	'&U<̞=]w oǾ}xpG }
 B>Gcc#z!lٲB(
:^?4aÆ$'mΧw"L3g%<Sdm+kRF`i.,L&2>GS!Z46狁I\/詤vh*}
EG118RҔ
D/ȱb=!"DFK$Ȋ2\=y?qL>nf-x6A$VrV XEČũ1".2m4b GD	++ Et2/B$Q>V$)L`LӟbPtlN
e'K`!e,"W,S|z!YԂ2+ Oa
C W_=ԧxSi"?Bٲe[ux۶q7cn# c0WkIHM%K  ,Dh]+q"15$5ESy\BGsc {兜F"Qds,x嗋>JeSÉ4@dykkk Ǳj*	<ǝ:GܹW5L+$-=OB	kcH2i'?(qr8f qzİtRDQ"dBϱ7r6oތeURW^'v	m<N!?ᓟ$oAQu]EQShQog0-)t 읣ʝwZ$nl62LQ_~yѠ+ICCCeI!3㮻c(*W]O66kHpQ:8<pǏGwwwQI ̑dNh^1t%2wtGHH$M3w%  'Hj𩪊l6SH͵aΉ}ش9\Q&Mi<r7SE;β5HREZ2eXŏ)KJͰVs/Gh8KB~dْٿ#ۆ Dd%	[B̶m!3K.&\X
+_aAχ8C3~OJJ=>-rFHE$$Irx3eaڴi:?D"xy`N8T?]
/`ݺuEQғ976qȭaBQyu``n(͋>W8S;d!36`!E\ttj[$<"_n: 8iF0p	&8{)q;L`=y^i|~. p<S5Me¤R)-*PXCnZP[J~i.  $
:i`6G T/-N+TVI	.)+t''Ep)`uݍƍ[O~i$D)C%Zoc꫹T3ɤ$"v؁-[`͚5Xz5`&J61zH5ydY'$I'G2IǠr7N#udF$sKOG"#G<sL+q8' K,AF#i"<G*͛3gRR*>!M{{;ETjlN_YSIs.Fx{Jj3,$KI&aٲeȿ/$QsEq2f\
API,lp`$Ip`$B P4]xlF>ǜ9sdy~o8P<x,c^1{"N#jeAT(_>/B)"@ 8.Ei-++,f.\s^: Es󩸟"ӽbrh))!2ZZZ@tD*</nB ^0\4@@ 嘢(eee(|I٥^ɓ'c$%$%LGGl柢&+>6/E# x L+0uu],//G<hjjfxjox,oOO @yy9\E[[}},ow;]/8E "h	__aY_z]Pt]UWWEo>ǌ3H$ZBDo)~~ @ee%c8|0
^iFLD{眏h`ݺu?DRӴ&Mjr9dYL2HR!|a~``B$<xVUUi@$6>|˵]i1c***/a}db<܄	*ۇ#G@UտU)4F/~hmG wsAee%R$빍.N`lp%41m4{0㛚}0}d,o[ ַkjjjjjB<G2Dww7jjj /*#	$"`وF8p ك\.nĉ_>wa^,۞  ~5cƌ5-B$Agg'PYYYH A 4M,\eeehnnƎ;̤Iկ~ك ǥΕ n-Zd(Gرc(///BXWuK.Eee%ZZZ+`߾}/<
C{ꛌ3X/v!B$#t6	(f | ?Dht;̙37JB~*&Ii555ī~zB	@Ai#W3'ܑ~8P
Iq`0˅Ľx	Kq |&Y_~Xh	D{>waĉH&ؼy3<xPTׇ9gH~E8F0#RÉ.L uݖzꝪe]
eDB!o&466"JaƍعsgSO=W  h8Q:&r5!cńΉ{~˨lB&	MUx~(B] ,j~XQɗw]o~~q |F.>455m<sx7'|ry>%E워bą9M(˅Ή}'~yL`J !OD{	Ä10z  D">SO._txi=W^ _=
˲hPq\28r""ÈKKoT (gg
 W
*N$E8/G(&"Q' ip 9 {m'<q1?<<㦛nµw_ׯeY/a8/Rs0&auq]yS{)lĹb"0h:0Q"QR@ @ IR @}}?|Sꗾ%Ȳ#Ga+W> -[裏駟H&y	LIƘ"˲HSͮ9{^x"RzEA Ta/+">FEQTYUY5EQ4YuƘ3 Fc&A1TƘ&I*Ip% $I}ZD)cV:>O ]v?!lƊ+~ w^<ذaw:;;l$IE A
	ba8$$F-IR.1f}߷$Ir]uc ϶mBzPmaLJH</4M	 FPJ]fmR6l088JJAȖe)*1}}-1A3ƔeI ³ dƘBb/>啇~xruuvϟرcG~ww7aÆO%ɖk4MS
$I
F$_e[` X<+(A$I,ˁ(LQOQM$W44MIu-7bP=abn݊gcA1J ĹYԐue J*{{{~9CCCdt:mr9=˙뚶mAAH r뺴wGsG<O++$Qɲ,+ɤ͛w+Vg?~WDaJaa(a뎦ii뾢(i(c8_*'˲(imŬX,f%	'ەN<w+***u=(pa jyQԂ P P8b۶d˲L&r9ݲ,-meA(﫞穮*mmei|^rj6ǖei\NsGm[<O}_<eYY~}ռyK|+_c=sk,u])f{yaHčF^,#H$b1Ou/x$:vh4jGQ7Hči~\Y=YE@!p 4INIM4EQT0H$9WUU0۶%qqTq4˲deihLFd2F&QUU%eQgA Hg$IR |ga |^x!f&x_XoooOuuMӌ磀8^$qMt"SVVF"';DbnYY|00|EQl6i끪aivGuWQWUU0,aa4f8[`pܭ)aXʆaH TTUUU50L";mU-beɲ,+究mk㘎mAg+4VI?`j[?яκk'x"_WWנ
 ,3EQY}EQ<]}UU  }qKUU˶mu]<$:)iXL2Maa8iڊUUͩju]KHI)BbƓZtf,ZTmv|߷t] |719Uu]Ӳ,3tHRF:6t$NG|,Fmf11ɲ,*3TYuYuEQTƘ\VVMӼ_|wޡM,_^竪ꫪ(ji&`1<׶$I9 Y۶sǱ<ϳ=s 1Ke[u[eK$Ku[41fiļ11Crr*0uu۶!0Td2˲b bieY.7#8nyRXa	8\Xi$<tuuYLQ\Piu<YeeYNiQU5zJ!Xu\&1,xvy8i^UU'y`ZTp Jr9y``@*hﲪj$E1u]7***A<-Jyy뺆mێde1۶m۾eYj(
e<m4McHL5M
s5׎vAeYdY*VU5zp4f^.󪪪h4PY伅ϖ8j%S d2)*1<-}Cc,Au2 1{</y^q۶cǉ`۶a۶꺮y aغ[iTU4-jZU+$)%rNYEQ, 9I\ nnYY3MӋFvp	+|>\e)lVfa
Y1u݈QXqD\׍}@@ r,˾,ˎ(+ 9(JVUլi)IdYΫjɲl˲gyi՞idǓh(\D8NQ]8d&|Vu  IDAT>*(XUUu˲ƘQ@|$3]$uT
/8n\Y]I,EQ,EQ,}wc$I^$cnP[[Ӈc؈ꢋ.A@Âgz{$mܹlImˌ11&.
K( /,
"H=EQiA2Dmm-Od2J$ɢ29K!\Lp`M)E	Vm}((EņRp۝%(s<    IENDB`                                                                                                                                                          wp-admin/images/loading-publish.gif                                                                 0000755 0023422 0004734 00000003471 11112650720 020336  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a    333򡡡jjj333yyyOOOBBB666^^^                                             !Created with ajaxload.info ! 
   !NETSCAPE2.0   ,       w  	!DBAH¬aD@ ^AXP@"UQ#	B\;1o:2$v@
$|,3
_# d53"s5e! ! 
  ,       v  i@e9DAA/`ph$Ca%@ pHxFuSx#.݄YfL_"
p
3BW]|L\6{|z87[7! ! 
  ,       x  e9DE"2r,qP j`8@8bH, *0-mFW9LPE3+
(B"f{*BW_/@_$~Kr7Ar7! ! 
  ,       v  4e9!H"*Q/@-4ép4R+-pȧ`P(6᠝U/ 	*,)(+/]"lO/*AkK]A~666! ! 
  ,       l  ie9"* -80H=N;TEqeUoK2_WZ݌V1jgWe@tuH//w`?f~#6#! ! 
  ,       ~  ,e9"*
;pR%#0` 'c(J@@/1i4`VBVu}"caNi/]))- Lel	mi} me[+! ! 
  ,       y  Ie9"M6*¨"7E͖@G((L&pqj@Z %@wZ) pl(
ԭqu*R&c	`))(s_J>_\'Gm7$+! ! 
  ,       w  Ie9*, (*(B5[1 ZIah!GexzJ0e6@V|U4Dm%$͛p
	\G x		} @+|=+
1-	Ea5l)+! ! 
  ,       y  )䨞'AKڍ,E\(l&;5 5D03a0--ÃpH4V	%i
p[R"|	#
	6iZwcw*! ! 
 	 ,       y  )䨞,K*0a;׋аY8b`4n¨Bb bx,(	Ƚ %
>
2*i*	/:+$v*! ! 
 
 ,       u  )䨞l[$
Jq[q3`Q[5:IX!0rAD8CvHPfii QAP@pC%D PQ46iciNj0w)#! ! 
  ,       y  ).q
,GJ r(J8C*B,&<
hW~-`,	,>;
8RN<,<1T]
c'qk$
@)#! ;                                                                                                                                                                                                                wp-admin/images/loading.gif                                                                         0000755 0023422 0004734 00000004742 11012420612 016666  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a     !NETSCAPE2.0 !  ,      ///vvvd	uBz4q@ 2,,F@(;cKJ0(&$`fj0PhQ(B+Q\%Sr=0(FS	
A	GKv	E	Z$T0#]#Z !  ,      ===sssu귂z4=L# 0	6D#0@ Ƣ0hp.`0M$c{j3@XJI1 L'G4LB	U
	}NxO	X`	]c54Y#`#F] !  ,      999$uzA0=
<H	6DC`P  F.2
  pm:チ@(|6B`0z[@RNe@Bw	RzAnA(	Zrf1T	'TbZ !  ,      :::}}}uzC4=Q<ʐ8a8,   48B#3
48,@P}6&`m֚b@xj.3@	u	|O
66	Ye#	'#bS !  ,      AAAooo$2u
{4C=aS|ʠ8[À`("hpB#3 cx,L]ubJ
M1 8'r@		grN
n%+	Z!,e2n!#&#aS !  ,      <<<$2u
{4=aă|ʠ̀X( FfD2Dfr8L.gXZB!Yށ	CƋМ8 &?:	   M
1	 	[$!l21!'#[ !  ,      @@@kkk$2u
{4=aă|ʠ̀X(1
0 &DfrYg #Jq 1?:T
	JL
1U r7[$ 	'1   +#Q !  ,      555ggg$2u
{4=aă|ʠ̀X(1
M$\Ϧq0BaUFBkN s?O
07L
1 -XZ  & &'#Q !  ,      %%%ddd$2u
{4=aă|ʠ̀X(1
M$\Ϧq0 TށVJ q)z		H%  		Zxv[ +;#Q !  ,      >>>ooo$2u
{4=aă|ʠ̀X(1
M$ n8؀pTۂVJ0S<|_		H l	 o5]ZjNb]#NQ !  ,      ???sss$2u
{4=aăv2. FX(Eax,  Ii L @o=:D( ND?A*t	H.:
CYa	^]-WOa#f#u^ !  ,      ...ooo$2u z4= ă@5F X( H &qb 3I$&ش!((A,	
	H._	W(	\$! 1!#_#\ ;                              wp-admin/images/logo.gif                                                                            0000755 0023422 0004734 00000002411 11054212046 016206  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89aA B   FFFfff蹹RRRttt]]]                                          !  ,    A B  `$di1Kágmx`Q8rȤ(P a:UV`ASzI,R*D8tফ}9p8	thsB?fS'
 v~gY
`>TBS ?TBS>	o^>?U>HR? Λ
>H 1TYn0`46YA
!@H c^h=tBGk&Vx),\,H0` ! jB'G*p"G%qR, jCT	ͭ  SXFѲ栁1o.IZ/Ӽr̂ME A3w=W;-$D'B+ .&N C2d?
O,J HZ)Gg* D% P	Ё-1M.D7WƉMLBS vfiQu@v=;xg,t]V^m&|p@Е-!G@
 ݡ -܈ `T.2ҊA(SHM$Q3tc(vLIᏗշK7TwL	+Wq`Phg3	%#х% )(ři`g(٘yzBQgnH)rjG]OA#taeKޔ3lߨԍipDg)SP}W	ډ"0S(!!,@mŊ'D.r*^i\	ߣ' #n"EzUhʉMA{'pBQ%5"4kQKT&T%m-`(v!#gYXC-3	- 		aGqnDK+.74Cq,
2huCC"*[! FÊfcR5mkû9|S;NMˁ]sIR7?(ʲFq,uq	h+_w6Ě@_|, T&xG IN^BTpiG;?FїF#7" 0 ݷD 	!S$ 󤏄}M7@1 . ;                                                                                                                                                                                                                                                       wp-admin/images/no.png                                                                              0000755 0023422 0004734 00000001430 11035312360 015700  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR         a  IDAT8o?߷?nkiv3K)M71QC? O:cQF4`DD?Fu]}۾=xIsx<GT#1ćq`&Jqy'~;;_o hj~ſx\o 8w87'jpс-?'_!OM5,ٶLL9<s2'lF7]]ױ\/\w_c:yƃ{xiP-|ň ýT2f|b=QJoM=#97GRIa-&b	 )#Q<B2@oVAA`~ZvvuNw \mT.ŇpF|VM׹+g0}V=]b	s{nK.{b7f(&pr|2(5Ug:nsuǡ.S+Ί! ־Uޏ'ͼ X(FnQT0F!Ǟa:061R@nY,1i-G1FO?kv&%U?a=]_t7(ZB;||]Nwμǭnz%ӬϽC(pU+^m>]^pPTDijĆ!AEal_* \1qPϹSʀq9
C|>"8"fb>xY    IENDB`                                                                                                                                                                                                                                        wp-admin/images/required.gif                                                                        0000755 0023422 0004734 00000000076 11035312360 017072  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a      !  ,       Jgg~{H& ;                                                                                                                                                                                                                                                                                                                                                                                                                                                                  wp-admin/images/tab.png                                                                             0000755 0023422 0004734 00000001756 11012074630 016045  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR  ,      e,g   sBITO   ~PLTE׾ԼεЮѮƢ~rhzcz\rOh|QfyH_qE^rD_t<Wl?Uj<Ukvc   	pHYs  
  
B4   tEXtSoftware Macromedia Fireworks 8hx   tEXtCreation Time 17.03.2007+E^  IDATxRAFVF i/hͬ\=;]oI*ХtbJplk(<e/hHb,Է2`,E(c)X@U{Eԃn6#1RLl_`?϶Cex9V(c0`,X c0`,X c0`,X/5fxů/W;e/hS|ВmX c0`,O'd,XmZb,X c0`,X c0`,X c0`,Xp!óV!v_bg\Xs4Xؽ5{*0drsjUzɚ4,닱&X5{*nd5,vUfbkU0~t0`,X c0`,X c0`,X cu!go*{ACv^$g,X c08O<Y ߆߆q߆q0`,X c0`,X c0`,X cB~p4P    IENDB`                  wp-admin/images/yes.png                                                                             0000755 0023422 0004734 00000001144 11035312360 016066  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR         a  +IDAT8]HSa98[jDb4JֈĺK$(ҺꪏnBȆ6-Ksu,)6t45u;{Dl\'ZHtPn_2gVvv!c$kD2d߭Í:%!'p?x< _Fr'*a}=2>WU忉Op1Y/&f* ԒLG{`C!Փ?%:~4ހ^-!G#hlD}Q.KեզŤ'YqWS=tHYs䲭=:B#$&8 pL8
?,QOѪsg/=poL;A.K J4Ovj/1btMIK[ؑ bx	Wj"o!M`2t\}̩\?P<OJqv=vYobf$RWqjyxQ2{K§Y_+5K	RwH9]doi:R6dI?    IENDB`                                                                                                                                                                                                                                                                                                                                                                                                                            wp-admin/images/archive-link.png                                                                    0000755 0023422 0004734 00000000205 11053116730 017642  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR         (   tEXtSoftware Adobe ImageReadyqe<   PLTEެ   IDATxb`D(`r - Mra    IENDB`                                                                                                                                                                                                                                                                                                                                                                                           wp-admin/images/blue-grad.png                                                                       0000755 0023422 0004734 00000000362 11114507346 017141  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR         /"   sBIT|d   	pHYs  
  
B4   tEXtCreation Time 10/24/08)   !tEXtSoftware Macromedia Fireworks 4.0&'u   EIDATxc4.6A,bWI$#v"C(u6ۉ5 ʉBH    IENDB`                                                                                                                                                                                                                                                                              wp-admin/images/bubble_bg-rtl.gif                                                                   0000755 0023422 0004734 00000000620 11103734150 017750  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a d   &GaiN!%꧐𿿿d=3̡jgΠ4SkȺY/@A^uuｬwN                                                                  !  ) ,     d  pH,Ȥrl:ШtJl	nYxs}6N,4c~ LK
 L'MNNONQU&L#KLMMONOQ!|L$K(LM'NM	MPPHA ;                                                                                                                wp-admin/images/button-grad-active.png                                                              0000755 0023422 0004734 00000000434 11111736316 020774  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR         Ӡ$   tEXtSoftware Adobe ImageReadyqe<   cPLTE#y#v"s)( m&e!p%}#w%~$|'((h'!o&ic!r&)"t lj$zff$zky   OIDATx$BP  ѱDQx^Fq1m%>b;XD!QIbeCx^<St"?` @t*.    IENDB`                                                                                                                                                                                                                                    wp-admin/images/button-grad.png                                                                     0000755 0023422 0004734 00000000363 11110330534 017513  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR         ~Խ   sBIT|d   	pHYs    ~   !tEXtSoftware Macromedia Fireworks 4.0&'u   tEXtCreation Time 11/17/08luq   FIDATxc0c` ?lTf&VZDZIT?J|JLA KwSx2    IENDB`                                                                                                                                                                                                                                                                             wp-admin/images/ed-bg.gif                                                                           0000755 0023422 0004734 00000000276 11101570216 016232  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a %               !  ,     %  kIk8ͻ&dihl;p,tmL|p+Ȥrl:tJZجv=xxL.h/bn|N~
 ;                                                                                                                                                                                                                                                                                                                                  wp-admin/images/fav-arrow-rtl.gif                                                                   0000755 0023422 0004734 00000000646 11117202036 017757  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a   ' RRRSSSVVVWWWXXXYYYZZZ\\\^^^```bbbdddfffhhhiiijjjkkklllnnnppprrrtttvvvwww{{{~~~                                                                           !ICCRGBG1012H  HLino  mntrRGB XYZ   	  1  acspMSFT    IEC sRGB              !  ' ,        kpH,0L2't9Vjvz-^a%|'i)%i>(#j>Ns%M' &PB#[DBS
CU	ddddddaA ;                                                                                          wp-admin/images/fav-arrow.gif                                                                       0000755 0023422 0004734 00000000516 11117202036 017154  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a   ' RRRSSSVVVWWWXXXYYYZZZ\\\^^^```bbbdddfffhhhiiijjjkkklllnnnppprrrtttvvvwww{{{~~~                                                                           !  ' ,        k@iH,O£r\"4ʤTlb-Z
xH&f2DjGȲc9dN%u'Q& zQ#C
Tr'	VDffcfcfcA ;                                                                                                                                                                                  wp-admin/images/fav-top.png                                                                         0000755 0023422 0004734 00000000240 11076421306 016644  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR         UPY   $PLTE|||yyyF   7IDATx^ @lL]_EQdI
kȉZټb[M    IENDB`                                                                                                                                                                                                                                                                                                                                                                wp-admin/images/fav.png                                                                             0000755 0023422 0004734 00000000326 11076421306 016051  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR          2   EPLTEccc~~~}}}wwwtttrrrooommmjjjhhhfffeeedddyyy   LIDATx^uG
1 j?u#_s(ZcZK=!bxQJJk;c本{sދ    IENDB`                                                                                                                                                                                                                                                                                                          wp-admin/images/generic.png                                                                         0000755 0023422 0004734 00000006774 11114127066 016725  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR         a   	pHYs       
OiCCPPhotoshop ICC profile  xڝSgTS=BKKoR RB&*!	J!QEEȠQ,
!{kּ>H3Q5B.@
$p d!s# ~<<+" x M0B\t8K @zB @F&S  `cb P- `' { [!  eD h; VE X0 fK9 - 0IWfH    0Q) { `##x  FW<+*  x<$9E[-qWW.(I+6aa@.y24  x6_-"bbϫp@  t~,/;m%h^uf@ Wp~<<EJB[aW}g_Wl~<$2]GLϒ	bG"IbX*QqD2"B)%d,>5 j>{-]cK'Xt  o(hw?G% fIq  ^D$.Tʳ?  D*A,`6B$BB
dr`)B(Ͱ*`/@4Qhp.U=pa(	Aa!ڈbX#!H$ ɈQ"K5H1RT UH=r9\F; 2G1Q=C7Fdt1r=6Ыhڏ>C03l0.B8,	c˱"VcϱwE	6wB aAHXLXNH $4	7	Q'"K&b21XH,#/{C7$C2'ITFnR#,4H#dk9, +ȅ3![
b@qS(RjJ4e2AURݨT5ZBRQ4u9̓IKhhitݕNWGwǈg(gwLӋT071oUX**|
J&*/TުUUT^S}FU3S	ԖUPSSg;goT?~YYLOCQ_ cx,!ku5&|v*=9C3J3WRf?qtN	(~))4L1e\kXHQG6EYAJ'\'GgSSݧ
M=:.kDwn^Loy}/TmGX$<5qo</QC]@Caaᄑ<FFi\$mmƣ&&!&KMMRM);L;L֙͢5=12כ߷`ZxZ,eIZYnZ9YXUZ]F%ֻNNgðɶۮm}agbgŮ}}=Z~sr:V:ޚΜ?}/gX3)iSGggs󈋉K.>.ȽJtq]zۯ6iܟ4)Y3sCQ?0k߬~OCOg#/c/Wװwa>>r><72Y_7ȷOo_C#dz %gA[z|!?:eAAA!h쐭!ΑiP~aa~'W?pX15wCsDDDޛg1O9-J5*>.j<74?.fYXXIlK9.*6nl{/]py.,:@LN8A*%w%
yg"/6шC\*NH*Mz쑼5y$3,幄'LLݛ:v m2=:1qB!Mggfvˬen/kY-
BTZ(*geWf͉9+̳ې7ᒶKW-X潬j9<qy
+V<*mOW~&zMk^ʂkU
}]OX/Yߵa>(xoʿܔĹdff-[nڴVE/(ۻC<e;?TTTT6ݵan{4[>ɾUUMfeI?m]Nmq#׹=TR+Gw-6U#pDy	:v{vg/jBFS[b[O>zG4<YyJTiӓgό}~.`ۢ{cjotE;;\tWW:_mt<Oǻ\kz{f7y՞9=ݽzo~r'˻w'O_@AC݇?[jwGCˆ8>99?rCd&ˮ/~јѡ򗓿m|x31^VwwO| (hSЧc3-   gAMA  |Q    cHRM  z%        u0  `  :  o_F  IDATxtRklS=vcJ9`lE$c 0BL`LH8( FP!"ujha#1:bq׽sKN89_H7nޱ5$Vl'y}O~uyw7*LBM]dK'ޘΟ}o9'r{u$,R첈w)+/yjNz @Kĝttk=w8H|DqBsZ'F<!SQ\A(P5 tMϟD3˪*ʴA$RڮBE6zT$cKkhá/<wvl0Wohs#hleu{<zCqvӯ4g/ÕZqa%/d/<}e)UC,l6lUX)Z,&։Ny^#r岪|&Qg,5$MoزfuUvșeBE1e< B.0z=ݷ1xtr㗍tkluz;?';3p.+ctɫY"P(?Ep^i  DQІ0} NN sm	BحŒ#,Bձ1r^mE4+ L'V1r׏I22UǡvOwRw7k\7 'kkP0 B@x-    IENDB`    wp-admin/images/gray-grad.png                                                                       0000755 0023422 0004734 00000000325 11100420472 017140  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR         @O   sBITO   	pHYs    ~   !tEXtSoftware Macromedia Fireworks 4.0&'u   tEXtCreation Time 10/24/08)   )IDATxc|-`?2]T-OyV ;,	¼    IENDB`                                                                                                                                                                                                                                                                                                           wp-admin/images/icons32-vs.png                                                                      0000755 0023422 0004734 00000041555 11114377260 017216  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR     -   )J   sBIT|d   	pHYs  
  
B4   !tEXtSoftware Macromedia Fireworks 4.0&'u    IDATxw|u_S&Е""b',zg/agД tRImlݐ@!||<mv3;3y}PJ$H A	$n@ A	$H$(	$H AtIP(	$H A钠P$H A	%A$H A	KB1H A	$H~/x#PR5=5HkJH|ayU=򩶹;U`*FJi2^J)Hg{Og BB}fcw&ezX.zx°jwΡ 敼xnXbSEPVdYQ 
$E)ey߯d*x~v_jgUU;=U(-/u*! 7 UG/UU?{Ks$z  , t T v 6 "Ս㼿 @jl" Lp1(O))ݮeeAmw+:UV(.<Y{p3NY(Zj~nk	uޅSܓYtEGuXo{{iey3~ֳZTxEm6nʭW.2ś' V(2FQG<s^1&p輰:
Gӊa${c
z.};5W8jbhJ3iVR(Sf=gԧ&~~=7Qa eA9b9UQr:PԆU(\YՍ{vlkXGA|nĉ8X4B8<қu6WJY_6ޝ؃  /1[On//f72F=sՠ͎e*2^77x,W};z߸^1Hǲ  )*}wNiC~_7vp:Bǡao#YGto0$-):`uGtᒍoM{'gX*asi묐`Wvz}ˎ3Z 0̋RՏ>%Z%E?12 jmnTXI3̆/</)5&2(U0Ť\=$)2Llc龃3V<Okmt'9,`@)m'쬂Qz{t !)!ۜi׾6iK?f`oba͚)~1{ڴi.~I2@.~fIa,}񷕼xSl*[]üsbRf"Jz?s`}tsNBlOUGg$ZLNCslhCؔ{?^{#yV(R_۟UcτHH%0<΍=S9S)8xÒ~)ߞ180򽨯};)  L~k)xIVph(#l_ӺqOiyWm&R S-}>#6z;otDJ)$D^u^$Qmt7}Y Vxj<4o<"B( ,C$H6Mvl.Eמ!4Ѣ9Km6jMҾܡͥ`yӯ^K`+OQH}Ove"ǜ:C~}=3=#z>%(QM-Ce̸dФG䧷d[﫾jv߸N~}>z@F>$-yBY $YwtX" dUzCZrn[)ūnB@!dꨴ3)UB!)*"Bh}4 u7aAyw[7-cG ͥu~r 駦,?z^ri%"pҲ"NM]4iW_i1'zνco^?H`1*b:xzk2YbhR^2&O`8#APY&ddYfgLp9q	Kv%Z\t{,_{1J	J@/`@r.i^xP:ObD   IA1>dESdp,k3גhΥR.g9 *vl
=4260-yΝ;hǎܐ8,^^Ϟ nIA(BUPows1d'QUA'θed-zN\xzgPEDD
r0uw"}7Lvr+%ZPT)lp_6gAnck e=Ť&'y/AixL8*T0cRҳ=k{`rtCs%՛fh`WZ&OtLҭ<x$s R_ F nѩlu1>[Ybom+ֶ#HPT>ְ$HVz.Q#\ԄA)?is!'Wn=P+DUAejbW	cbB,~n6G_bU(ZYֻO=;6@u=s͹^h-+ܜ{)5!!ZV	acЁwg|f[gdVGC~aϞ={\~-!|>]ִ:>:
 0xx$L8Q$&j,=01,y{
$I<8 (ub(4o{ZE3	!$DWX4CQ%`x^ m ?ŏmyj1IGhvQ+ /]5D'(ISGN)(?X_PcmT 
Uh}nQoxxÚ2+xe,$Gb*EΑ0 @$;ቌJ)Yxb@YSQT,Cס{z"ڳG@I.8e%YBE5hB܅޺ul>-sq?M$6VV2w(QNpߟw.l N]CK۠⪺93Ž0~)nw#@ unN<0R.
!>TQi1Tlli=3|):l
0(a0&{^B÷1(JIYnOeTnIF(SrEuO87Fot)Oi a@(3BK)jkD%,шp@9Yu她Rg$MLVVXZ+K4ϗ|'<1]A ,T`h;?>n`Y=obBhr
dq0xLٍ&Fk{e1*񔅢v#<еBQQUH dHd@Q$ +PU(+!`<X=S6<ٺ]v/gXoDl8k+;Z{l =U7Z.?vzdDB6'8^}mܸHߑ<nt3<.t-~{e3mv;Tiųo~<*/D%2)Qp,a 0P	^~$E{ǳhy'k!ڗ(O7I
Yp{@wzZ %*\ַ ŞPwANܰ'{se#|;U֠h4"""aaay]t:cx|~(bT[{oÌ@  Y<ZꚬҊ\hN" ܂0qd! Pl]O+,}͎ͻ
pqخ/nFZ1Fn[;8/./\;QZ,X9ce'=쬂q Xߴ
-
(U-Po]W-D)iɝsU(8Зc=( 2 *D@Qۜtt3wr?Y[˯E(՟0&㷍_gS?}c9q
y㦛`KbiڒsmƬ<NW"aЎ9.5}@Dvy>ܷqF 9*0455

wFrFgbN5cDGgY
8f,ˈq,Ţ tN?~t)A 3Bt4\g%@Z-R7eۢAziinw;JF޺1`f3,BCC1|20fNg |:<łT݈ܿ>5mȧt-0A,z xUz EUϼ;Š;l`xY˳/{FQ76/_˅+Gа.bFLxZ>[SRe	*KhkswNAjby}{PnNOMU͆Sc:"n>v~f~	$&椏(*
Ȁh^
E|,DEEGSTL:x0J)bMU~h^k69[dI3ܱ)vQe[QIV/g}%32ymw2:KW|fЦ=s\>tcvN}uG" .I|l83մ?;2.!瘗Cau6uP0>I n{pbBd:U)RmK	~!"qNݢH(d;[tU\A)$x&Y)JkWH)ڒbXus ""f!	u 4O,r~5ȣy?U4͘Wnҟy<<VVf)K.zQ#x ?S$I݇M:{K6X쎍콞t:vc3lnb,Lfb㰹Uյ(r1E:\ciWAe8\ ~]#.>ջȊ?}*%'']fQt*ܲC
eqȈ	m9r7JzgYtv7^zzkb1$9V$)l\wV<wrR 锐޾= =ee37vԕ4;5{UR]5-]NfBǱ(n8+lYL8P@_L/vX L>?(ȐdIQ 08ͰqqDIBؤ镎ouWa 'f!n*}nthP%)hv
DTT;mFp=H^DNy1y6q{  .J_S
ӲѢH8[>+tb}que{mZ1uֳ(Exx8 xP^IAX38!!uwKɫ("7rV՜+&|A_č/~+r$z;żK7lVTf;]U͸KPh,EI3D@QU8t ,CDDǱD(Bk!v=wE(=n(u@@A(p(REImB($ai5w]567XP?@>#{Ůp/꺫hhӻwa\ýꗜ}/*/# @:%̾}Ͽwe[wauԥOvWⳳB$<9q(XSTpqi`0w<<2XxB1C@ԏi/psW^	GD|TLW0j DUB '~2E\lZbӳÀP
Zvۑcv#鹞K-gHܴOw!hn2o6G.7tv}ݝO̽7l(MKq>@XX,0`XqP$a0ޞ~΂,uJV3%icY& 5yCLF=9<
*V!)1+F=;漾!Gz<t-?[c|V>U%ǄaAүYP	A,RUG/ւޑ!8v#MV d .$jSQ~~>y;掜EQV:#*B;EQe,+EKS|%Hy$hvqB\.W	'aQf><֔'g-|>&ӗ<zMXdH_eev%|-{XR?~5C]q,,:㼯ϲez{dIa %h{S)!,(1kd5YC)O	W<|})3p*|l[Ԙ(ZDY`2
FoJn߉Zw. ꜁_[OPU6f[mm؛Vkʻp=~fǱw잓8'ĈmEVrO**RPѿ5䆥XRmjٴ\3V~U:apE߅	]xLP0x\^q^]m40{?>=`9C<0Jg ?piP 78Qֆ?msGخj~U>+, KGAo0Apۤ058(%a_Bb'wE頪Z7"G#gbQȀ
^787OB`d$<t1[oU_/ò̷W<bT(&2,Y?q8'gѿӗ̼'mϧbUE^͗gHϸ	7~uňz\/}^O_ /3?6.a g`}qUR^y흢JZ$Bk>Jv=
+ǏKNHOHLJDD`0b羂\ҝmw{y~2Eo?->Sz5cJ54+׭oݰfsӖh@7WI9-葴}lo9En{GXNk-+pK
$%0,1>>[r-w5Fb~UjdNo F	hBqV``1F!!q ]^~{^nE-}O%EPVdYQ 
$E}J @~M+%y{hZR]ބp6yWIgu꺺.gJHh{|'P ǭQ2y&3IWܔ8E_c`iHNe3vVhNvCC>R']oc*TzX<7(cBQ!)$&r]@XĄ!kŸ7]UyY>eCt{,DQ6p\\wߧ8N2,ܷ7%z"z;	eU7nY"=8oMJ4#HuiL@:.I2NcǦCS "Q%@݅6[{WQgߴe4wg)4NfFQm+/oNB(oKm]f*HI!z\vgmּˡ[Fr=-w*nTEQ:lV6;"Ĩ#N:_IKnP%)i    IDAT s-v,~!ۻg_'Mxr,pLe'ʔ;?fGðx=FfĿf}^KsweyabcBM&A+lwa{I9)ѩ鉬["]ӂT47Y)D6A*!Wb 5.~t`0Fn4xo0yp0P_A}!Q;#S0ahjѼip.,x<޺vw4+c;P"w_sh 43fཱུ:Cյg}t"QnVuݺuL}uUU5k~%UؿzϥҪʃ=՟"梻&͚G3xb,ڏc3"-o,P
ZЌ:
BL($e#0<=P<Ia:Y"Ձz9e re! Zb
VfSwD-3ޞ;.cȷtzC,p;Xk]Pn'P9	koeB~ew4,j{0>-]o;Je5CɈV@CoJxD`WP>|"#+2-({2* SlX3xPi/|P σ<YKe<~[,Z%E?12 jmnTXeHMODS,]UUߘbm)z#`
-:Aϖs XhvAo4d6?9o?l[ )2ňz{*rMNU	/U\VTm͎˩ꑢ0,C%(Mס>䉶hu2B`Ա0t1kGQQ
bƍSrsskt}cB2{zOȘnxrDY[gmb{^3|vZW,Q5{__7{2r^/\*yHNN=¢苛(!vU]>0::Y
q|M-v)./\0S<g?
h}5M$McBxk_}ˮp91ש6$
p\Py!!`9uvw+sSr=:x;ȇ8oy^̴sΗXyhA}Y*hoYnIUM9M{32*^$<<NAPP	 pAK0ubU:wiCQh#6k%˲ZUߘFH,(!K,ojwf3<_0	*f \ǁa9xd[2Tðp2dĠeN2	ƍ
Yֲu:=B`]J8<}	,jy;r"gUU5J+7n ˒Mi	Pe,C	z]MNNgv6B 1b|;ۛΝoa`ml^_?➫BSo}K͈sSߐo[4_nw׋h&b%*;چ*I.}oiIU7E<k??a~]j	"cPxev7FTos#ܾpL|&]$RJ}ř 3 ܹ.Y$ڪJw:]B~SDt\a+*됒uzX"B7bP$s'gլnOk
?Kxo9śx2(0|+r%Ó,f.z3f=H<˂R%)hspgio&[I߫Kv=P3xҞ
 ; 'NaA|Y]Xnս[9I=/9hS_YS[@vAiYq/euUZ}TtZll `X{|DRT	(C&"Q 2,\7}	(3:* D
Qe4;[8{rG&tLjvD:*pu]yKb$˟>r(:x	RE$IXCw87<7E1d(%$$"NBv*!zvCzNiWgggCY3cx?
h.Pxۍ͘uvcbfCetDAl_J8B ĺ'WTMc_^c"P^M6^$TXY+,\{p`&lWW"񌱺>aF !)>p\t:BBB`0QiubBk}jj]^}t'8M׳yYr@RNV(*E ~=?⇆g/NdzB,U¤8y<GF[#A!\_G(hs8ErZwܐ|	4we E
ux~<dmg/CcNpz=\4Ց
|!ghQ=09:!9ޒwS~Aq[{%/}HSb򃡠, ѓnW:CU! eTaȐ>Rhev[Q]*dYF?UG~F_@6v<r K^zp'ޚa9}`
	k+m/sG/+߮|OQ:,'H`?j$UM-]0byڵ<-^|z+;$WfΌIX{/`bG'VIQvJ1kET	Y@/д`Nm_;Qes}e,(4LiAf}5⁽Ų]Y8#bĈNS,|oDU>/Vm˃$x0_FbY +ЉBi=-&)-}&)*0wuvŐQL1Y^Eh?]p2\AQ0kEB8ߔX(zvݺVh= Za[&:}c[ŏk1jzMp:'4udh (iE;Vo޶Z97dĠ\8$P߱G,F ,ݴm<2Kwj\٢t; =?o_ݎ-9,p;U[nJqtGQ#Z׺ >x<X\W7'ѣG]((f{,Ϙ|õazp-!gEA5&#[ЪWKqswlͿ8+Wy_d7iXlf䍏uG'):/X_>.}ѽXW! В)tܸqY?~E/s5cA&	 `PQW|`,ߋGٮ
H>1aG|ԲB (*ҰfJMu9vl.V	Cc,yx*NW.Zh|M3}K;(pZ%{.]+f?Upc'}~dY Jt:2ǲ`YQ0_A IS-Um.mmR nh2_ohuC%ޘĳof}V&}j_ۭ Zjܛt0ss hn&q&͢x:yWS=:h޲JHH	Xv˲M*UuݩR0`'hn̅z"`"DC
B'£[,3tW$j,E̓UEH2\aQ[޻G]|  e'rpsN_^xU:c̈kBXܷU4kcoI㡈6Z+*{oy5ϲ3!%"ԲƺuL;**vUc_-'BD+
!`/a޺" H IV:׃J6sD¢MtGo4G}BCEd9vߜԒi?gֹ0LB-w搷nښ;4][}" 1,ywޗSclȅ!fBTEAmC+P^]kFmh0eX, a2`^JkA,zcN	uMVWiEU.4Kb' *%ƞ?]5m[ZpzՑze[r'Ф(Cci1EHxP:rШf0렉S^oVWYBL6wȲSU!J\-bj?I%Gձe]>%lR_jY,7ˬjuG<MfUU]Uy5MH=ɲ<[n$3jhsaeq<Uuoy B۟_U	̞S^x]:]p/2" 7C/bp	Z1˂1Kk09)Ǟ{akGlhQY?v'w^k	fh7	$3KT.IShlzN iߟN+d9H:&iB΍U/{b @OQQjҽe 8ϖ>fe~Or䃣MMpuyNCnA1n؆.`2<1}㰯#,]ғw B GP%Y`=\$^̻Szޱ5[\q< N`MY]5Cj]Y	q{lJ V Cddlp5(q
pN8x%44iwN7XYZ:,*pv	Pw9cQ,i&|Sſ}&Yg\{GĆ6V 呰ooO uhJ)eF߬];~+oLǂfMoJ,VnyEc
6U߄FaظA<|8k-rb ?7';*
Eyns|=!c63H2<уqy(+WXR*x<nDw1KT *Dt[\'ʩzYnmn	*E{wm/_17h&@ũ%Ź="P͝sScmfL5fsLF#8c5plu.A׳G<1F:]|Lt"sN~)$C&Q=҆YmvGO~iI	3wޭ?PZPڷnX[SIozռ(	0㸣SFh4ڗ!PG)=_8ѹO(~(}c&5gN`Ky"qugS]fŚߗh!}bѱY;;1oN_^xK:uЉwÅ8&>̄AQ:O驦u'W6?j-~E{翛
cf=xgBdH/=:PEB%B ;GH {oO](h;%bW@'dw?dշUgAѲ;Dq{<rڬ-M(eNAF]v.&M&ca@[v&bXmm==XXjO3&coᤫ]x䉲&IDwߧ'eN1<`յN{7{w
ͼ+)Ysǐ *,M($}6Uz sޔ+} ~휤bq?Ղz~N;uK@CK}RvLSUVvQ%Aq\MPWtHܲ)l]]B%Xtf4+Ocg6}9"fckρt/bO@O{n^Nrx˖-׸nઢ_ǧz#}ŦPYjEy<n2 CYq(N&= BAσnG-1ax뇅Y3~	!JoK)EC<NlEU!R)ؘgm,/ά%JV6dYH5s hsxb*KP|5%f0e\x.vA;zkm/NJ4c3mF=ύ9oé<`my,ϲ;]ˡ͸e@Ny5Ь۾Zcy晔-X{biu)˛(J	Et:
.wr]l\?>YdIZi_×{\Q**ހzm
YQP>À("xEV	v4\ހd3[¦Φ U Z?.2kQq#/O7NP7ڲ RcMڛJXz_l.Gsqɹip同ɉΝ;d \/s7lܹo.^z~sO7A(E!Ǿ*D,,X Ipyض	B)X6KQSaQTU8]2W׬ʭYhDrtۓ+== $Y+ګml.57Ir9a2PK8!˓XUU0ӣ91럍N,QniN?`5mmcF?Wq{튪A\g@_Mfi]eC;Κ7Gs&9.>&˲-駣RFXI}Ǻ[b#qQVs?=*^GQN9]nU5#Ra]Tbw@KXk:QO,7>+WUq~1?lָqHC8H0TIaI8o|\@ dswr%c+d,h6a횃mкl"ےvYlٽwD\#l^.h]Zyk+ߵ0 2(WeY(Z/go/)趯뎶h2
 YMkUY#7wE[Y!XQU^hՁGtAUIgFx(Ea IR
lv~^b>ϵf1[m2ϒuu[]nh7g Mwtnoiiqv%ф"$44,ӹ%؏p w{f~ĄPt,sglEQ\yY㰡&)QچF5gnuNZ$EϖEvԭ˹I)R_8DDo@\VY`_/¨+Hwv<RAݷwo~iiihA;C4,~ bբv.hၨ'ԩB`x$x	ކnħSg|?ޘ
pS)Jb^|gZt޷nRgEQhQ2WC8M1lGe3=|3w $UDHVd9VV)n5`ъULnv<?\t<m;v (kjX-w
!4QeHIQp{\I@Ѵ?+cNljkk8óidYs3o[գBcxc=X?şνUQ>5G
sGoD{:Xdiuf+V)lܖ'4wID>(m
iZI  IDATh3 5-pJg%O'W-[3ܔonڲ:EQ8TM?*h"G-Ngޣ*"DQ $	(A$Q 
dY,+UQ!2 @\JYOpA3c&@:m	bpR귋xYpiMj RH0Zqi# {IvbvǏy<I ڨ@/%Hkz{hφeC۷RzVVa3GΕur4at "ѡq~p}O* -&Em.VZ#Q+0TzJHU=tOgSz3}?ڲ\jiRPPP O8TH>ThnnL~NW(u=f.A+/1aR(M<=prco	a߾18T]6*;L1gqƾaxhtc. Nc7z:'@kq a  Y6{RڣəlEKr+wx<.o[D2T@_w}/i	 Ak-6C64.	$ȩA	$H Aį)LA	$H AP$H A	%A$H A	KB1H A	$H?nueʣ    IENDB`                                                                                                                                                   wp-admin/images/icons32.png                                                                         0000755 0023422 0004734 00000027711 11113252136 016557  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR     -      tEXtSoftware Adobe ImageReadyqe<  /kIDATx	x'K BA6AYܨ`,b[_7T*-AeQRR
ȦMA l|I˽ɽIsÜ<Lܙ|ZyGyGyxxGyGyD<#<#
DxQ4tаwȐ!#<yTҀ.\#<#">|{^zzꩨ~~;DDv}ek'[s:ٲd{U Fo4233rg}uJh~/z'ԯ_ɓcf^,H6@sHh{Ҧ*UX>`\i#ee7211VZY_|_*W{~mUVQ/IxQIpPMvՀn޼Û6mZ.˵8l2W_}ew_L(,@  C 㽔pעr7X`LOKg~@\ e^fFsޥ.$	Di3aTڵk_߽{wrg}_V-nښ?CWX&r'( [ǎ+UP]_uUѣ:++k ~HX2ׯ_;uT^/<:dPd_\ݵk*I@Xǹq=al+/S$
@QFn֔. /)VXjj}Iխ˗}O8?dLy7nˊ}2 m۶ 	Oиs=QRrrrթS{:t7X?HLL*Ud5lJNN:ue(UA<KBZ֭[K̚8i$W'D2Fs?-!ن_z;ϩ71!!رžjժ	{%_o.<qUv3,f  1E~䩿'Am۶])Zn!̵~?۹S'Ø̝˵gQѣΜ9sd"zLgaÆ] ϭ[PA3V\cǎ!,x8{? Moeff>/2@,ڵ?{
4@ bIɓ'SNY}k2wo]E1]́ _
N^y}>LOO[n |IIIڵk*K&e˖dbOfM2%o|}.~D9`|~xKO6\{VX@4
2wڵ8^lh~,]tM*P$ZF~͸e`VaG([+ْa+/Vl7t*6XkԨ1k׮v22 q[$ڵk*Px{.C XP;
/edd4oABȅѣG\u]wISvEYYYYY͗/_>_2."/kezZZha N2@;.lzWB{ս{qcƺq
/@!Pv[oe׿v5H9tkV;0 L2,E9Om<tЫԩc,W^yeŋ_"@ awPQ XyG?c٬Y3kΝa
N7a(Dꪫ^pQ~d<Wm׮%̙cYnSwiVZq҇ yc7E(v D&Sƕ-[6_K[<*2@#EN 02"]T{/m<'Aȹn4x7Dxuj	x3|tg'Xt~^V37jq+H jf);".?g`	Qm#
>j6;vѹsQ{ӧ3ޗSz
T!h9â
 ! C'gFJJ,[#ks씹q NW,M4)wϞ=G_ angG9 L  HJʳIXn]`H^n9Gr
S@, і-[iѢ3?1[FO+<iӦ k'|b1\	P>L(fvK;?_Ș0@QuDk M%K:(`㮻2N$=$Jg5D~(  aPT bZZ4~}v5d;z327*d t?0`@%bցKjՍVd۷@*4u񙝝U;k,+_YxWϚ*T ~3Z:wK %cЀ`آm[l1RyD9̂֬gQ&YhĢok4V`KRͭʕR\mڴaAn޼y>U|w1%Z~,[  $Iim&ag~L_h+V<VZ[nD(
^H3ǔ CPfxi͚5u& ,ILLtpN$ZjIce˖ aȾ@qVtȑliEJ&cc/帤Sg>YTƤcfV',ѹ0e,gDC:̝ ):w3b@Y  W_}Ӎ7(zF8%  ă={5F4E~3iӦ$p#K6{}@ Nܦ%rlwK+a\w2esC_&2>,\/^֤I@OZxq>DqĲw˝F8ܘ7t(+Ơ;$`0_u%H$$Vc0,)*MfA"x?P={iݭ䌛$  }iLV"Xg
PM'>}lF3A|A"Ppɳ-LЇ@bJ94O%~E\3 Q-ϼ"-ƴD@pǎ8h͚5
qʚ8|G>zN"Х^%X4vȐ!\		0àA6 K-[_~MH<Ww	@TQ&\B?2좆?]C=KQ D{_(K@s8̹SG-û*~@d*bn@xu qƌ]:jf QO	TͶdr. hTi+cZh(2z6{ m6H-	ݲeK\T=z?g
x@wÆ v0xf_k"$Z*?v-KUbWd4WPG}<TO]@Ѫ(;u? 8O"q[;oS>sSqCSsdeqx} [IXu!nP "(oVvE(`
7?K_mdPeX+(
Gri$.Y$bŊ]qFƲ1י95%K4,@Q~sǧ~zQFrƼ08[V]~(:wĳ<{sZcݠ	G;-ll "9(N6tbAHFhړhsdwѣsիSk?K03ʀX<H>T&.W*\%:vu3DvNFfD2L\k#YsOnǜ(k " 5gY_~ 2>o@% Ӭ~*e8x.ulvkH1($qqEP-֩!IcKC4 Q{"mśEX xUo٢cˋ)Ţ>*DB>c7oxRP?Q77$dcx(m	HpXP&s	z-Dts5#pgS5Y\\!RA ]g҇3e#[*, dLƱ!3%QD'էO"c!kT_	3f)
A>SH)VSC{YH$ 1UvC,@OcADh=]YXpW;">[W	( uD?{['dM*QnfK1w /*c'gۧOusQ@ͳTQN7+ȴ/IBJ\RRQnjW;_ <Is`Ϟ=S>`Qou%Sơ-TDAۈn%u;kJ(fQ'g--&I1c\Ź.W
cv\I 4iғ(N0X%yFSoioc%K"}t78ʕ+a)>HqM8}PA"DUkRev/u;2(?W%B㏭뮻._|ͳcEoNf=L+QeTv0%lJ߱cDX3hrM
p7;Ab {yf̙3-ߥ(yGW\~yLYxM7e.bukg]3Go~UUCZQ|-_'ܹOV{LȆk֬M,</s*kYUF%t´Ds-Ht&
&%=O ƂY9 pށee@BkhBBkH(MW%ڽ}x0lm|/.JAʂEK@XvܣO<
M Hp	g|-}i6ӀH$p.`Xo2}&B
U0*p;,
:}Kz#گ5q	W @@8`<{,ĺS2q1.pO&.Wd
{UvKbnaD FV  x[Dq%B(<G8bAق C1m$	 naȒ!o|!֧|9cixEREߠAtqժU+(Z"0۷owzQb悴xʽ$v-HTKD`l[Z@0X )CH9e7W4s=WV(?0aq'<;vhNw   ֯_??%`>8b 
*Vs[۹nzf~zq7`ҴiyuyŶu=SGQnzA@k;&s YWn0%\_[)@u6}6"lI,< MQFv9+  R@)Ƭm۷/zp9 Ēn Eiii
Xx)v0<&LG9sJdn&}M`
,x=w%PHClnLQi	Ԡ5aiIt~Eh#_,$i{ s_]844(_F=8{*PϊHVI&5kŪlL@ '!L(1l0ڃ_|%nwc}vdΟL,hhYyv<Zo]Y\\]ZIO.+ϳITbzLHo3CU JӬ翉wHw<5a($
4of(p%џ-;pXg۲%SY_RF⬬cwKǽVg̘qO<y&Rϥtʂھ}}2R:^\w}7Erm)>#}_1V d%bIT-َ@vb(Ts%Q`_I!CsF5@T@u}7ڮѣG3>!iA" b2ev|sg/֯"}y<99ygu]x܊AzGMju5'%nvݿsjD
ImOb= \HskDˬ]>`1b_Pz]|XJg\0QxT6 4Q'$:-c$`l('AQhP	̡E=B{Qd^-:Xi$/AtiK?\|uDeƲ%Q_-xq:UD_׳xD3("$= @,'7_5$0sXQIA(j@ GrÜ*9D5hذa`2 "|ĉ H  !$M0u_(c6;~hf|T-.n:Xz b5Z6u!Ao,+5/^-(Nal[Pġɓ&aebn366hVN"[/cQ{MLj߱Qx4H$Cᔍ: XuضmۄO?(qz$jUsVlAڹ0^6][;<vT3 Q0 DH5k`C a,YӧOGfw!C	EwÂhk[M	 bAMH31P=@_!PHG|&馡:GwY΂:_hzlr<Y* EzBPA.w@3qvcB&,~_D`]L GBx]VR1"Ү2v$τOȜx-&ssP:n6@/q(Zߖ R.Pde?&`@"7D@QrHc7ԯ#LB5:	[ٹnl^߈!z'fAJ;}f|]yԩ{	'VD"Hޗ~yߔOۉ IZزeKP~3ǢJ_|X|cYz
)3 ;s).we=\[|f
AXzdQ
."]_ɏY^Sk#eIܽg`4w<^jItZ|ߍ5KorF3ɘFciA"1Xa=Dk~ܹu $:ZQɜ|&&x{IWјwk6R65]Ӟ(-uҥ#<8ee5|0vcqiKwy3fOHjpرAW^uU<Bk	osny^ҷ_H_f1/ c`,oV"c1~ИZ춶u`ߵ$g2Q؈;ڈY?3W9эXDYXaž Qߟ[-N(DmӦwVuWn+(mݾxFߋ9WPewI bȓ "9LlVWC*Q^MyH=_.u߾}iu)D&X=kV6JJ*/^
*N 0ܐDV^DQSbŻ\|V(- QxaM8;t0%%8hZjPWV,Ģjd'۪'^8E>`#G|jp@Cxg#LrP/ikd7I>4\YyG+h:ۮQp@%$Ezf9,J
يbt#Hw$>JI/t_5	?П'8+\
	ZB89@L9q}(ܖ;5
0̞;wnCC7n\ƍǩոXK*c<үe4;ڢe r,>*R{,[]oI,*t#HcǜxqbE9,h曭2p}iPbSXZt-R6oi(LJ8u18p z,$=ZI(;c$
hW^h-ZXN>MVs<2J1$CZS|iڵk[#H^	 E
YD(EɊ2)^<Ѯhb,m  |h"{1TF=مܹ 1M zb@"Iu2;׿~<B$1OVG@D]
"OΝ/||ʕMd>&WP8'g Dg%spӋyʺVUʜ|AdeTW$@q V2wq?H$?D
N_	t]DQ<c_1"'N|޽	!AޔBʊ5(ײ^YW^3αx$B[ɣHw'D%ZT]Vf6C`+qc-(BX :OQdƚjs%1!36SWZ +OgAU\1tcbZ.SXV>E٣,#*hJdia~,gS3vZB^[r\$	⥏V%X,@f͚%|g+[;oG8ȍA6ko琀ȡy?(1d`GybT]IXl Dxb)ڽ{w1cz:}zIINNܻL;S"GdBo޼3!̜9shz}zzz.69W\qE\,a/&`6c,\goYi1X)͛gu coBb PJiĒ$RR7K,jXE Qڔ^	#v^i7	@2]hI׺uk÷Q! r{Y!K?HR{%ExJ'
4^V 7,Wj̠
Hl
l C(ZuLW}7dǧ L~lcFn) qL6ۀ-D0W{gwH&*p:HMaAp[-<0X!B-l[%;;x@M?b59{lbAb1
qK.XeuZ[7e+:Z }m[~l9JlmKı15o2h]4GP[ΌQ *$2 vMj)0׀2e0$؆fE;O>eb".ۤX2@B(bXb8q\pNII|ٲW]uU<n\FGw+n&̚{]*g$/>Y!  mǹN"QsiIDk,!ʄ)%Ў4D2)dRGlذ ,P+yXd8X(E/}XٴXUJD4we/{O2u%FwiMc:pʂj=7amdΎBmSi_99:6e&PT	4MH__BBR :0Y
C8n-P,m W"	wGF缹s;um+
GS\O*q\Uo2?'̱J?=/2;%3ɡh`DpqG}C\Ѻtg	,X J5jLFOcAbX ng
3HiL>%n7N7'N  ߮]A(
Cq7k]U'fk$
m`4Pt{ٶB+˳,#^e׃Tn%_mZJɕX.~+rY0KZDٿE0fr%4z6mDi3"ˡ/Q&Y?8 p۝B2eAD
@nP΍鲘bggob
+$R!o޼s6PJHk׮ye2v7ܪmH!+㟾ԸPV RKT?Z7gN~gxcQT#@4W1' Ğ={:u4ۺu}5d]tum֬YTb&c_@3f̸QT)car[y:V(jDc/W~^zk(
VRǟzhooq={;fD^&2璒$''u9`
&f\QqҾf͚mN	5J(@ rjj_=ư/$ɩW8n<
"HlRPs	ΚŝuVTǄhb&̢Xn]yMƕ٩S'䅓'OlرHj8pPǂ:駟~>|A.cJ:cby :PP]Z wW	/8w*P^~eRXY"/˗u6ujcՄ9HPIut3%V#ǵ܁vG9]}59"B|Os FX7(`r=.4=5k8dȐ!</aPB,]qŒ8eb4=[|"*<)Sfa?9iPՒF,Ãu;iFJש]9mڴ?6Xk:zBb"V"g޽~Rx"Dy0Lܑ3d+SÊX~Ĉ,z?%sz:qq^g\RD>΍=!iX*:Di-ʽJkfNH/zj"ޟė	y.).H$F2έ<SnOf͚c~[?C1ynGPkqq'c9[Uz3ΰ:ָ`ƾߌ+W|BKҚ(BHRff&|*[V)Yz$$G.ba[>wԩ8,e2Rr1Nٳ{7|wM*Uʰf<u]@]Ei9Xj<LZT9|&Vhѭ;Z+Ⱦǧ>\رc/>}JժUPB@L@*nٲľnݺ+VHvqN?o$.JJĉI6H*c/0Z$2ggg?)@U;)_hӪd
L~+5+
Кի ym8uF`xhԨQ%r7DWe1[UܹBGdǸqJ2F-\p ͱEζe5@fܬ>PQ#9&Ħ<<E@Gyq	!7x<l8<yGyGC+#<#<yGyGy #<#<ȣ0 |    IENDB`                                                       wp-admin/images/list-vs.png                                                                         0000755 0023422 0004734 00000002177 11115635302 016701  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR   P      غ   sBIT|d   	pHYs    ~   tEXtCreation Time 12/03/08Y   !tEXtSoftware Macromedia Fireworks 4.0&'u  IDATxݘkU?މlpu
U?
K+&P! PKTEEC)Qk4U!a	ҥda2ٽ;D_9{{޽h57[@iGBY [|	O\MJju`&
ܯJʏܾmc`ҢNIӗCbtTrYJ%ݵV<+8l\.mضT<"Ēu]!`-K)6i/ {oGO}nb s->^ 2l6Xj xɦ0)5'7׉eDUփ :šcT*2Ll[1)kJ`ʏˉ{|wg)WF ŀ㷰n]581Ւg8^O š<05x#_aZndn)%]@ >B,q]&GGqW_9]=
%utWġx`J</[UZtf]C9u(OSVHEuةo2\ץVQy_^P(Z՚X=<v{SXX'uRJVO(xmiQ@oOnf`sPwn0#\0N6y&F}XRJꕭ}	у<1Wj`Ey&F>η8ۓF[21ÒR%`W[~0P7v#rd Ѿ
~ωl})E ?2TB&w71}^6Ⱦ};Z"*Ώ3׼([tv)k-n-/p?J#.NP4y;>i\'vXJMOk]p*w"(|B    IENDB`                                                                                                                                                                                                                                                                                                                                                                                                 wp-admin/images/list.png                                                                            0000755 0023422 0004734 00000002120 11117344500 016236  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR   P      غ   tEXtSoftware Adobe ImageReadyqe<  IDATxXKK$1Ό[T^<{Mθ.\PDaU@eo2*zУ=./&iTw:MKGB.)ߩjocc(B8t2⵶H$?pQ<g{rxxȨşB!/w>KKKm???:&c&-9>>hёe<q	RfZXImoָ?yhT9>&K+%L<(!r&NLL8|uD vO+8<<LŶx<2a~i([^
eC ։Q&&p_P^^ه$f>,`ƍ'Z\<@/ƓddD9>⢀d9_8Ivf]\푶6fZ&JB2(Y^^fd/--{ء7@^~UuvR?gv%xkR1os ĠU%??E6T*#oE X\\Toll	z9pts]eggs'PʻNYXsssYɳ.;99Dt6&;3'[>cԗ-·2333Fb#36hU?OkxeeeĳFE`Qu6
/,pNNNI<\D2/֌Y@jkkc~prKa`G(P~MZѺ+`e<+h&~^UUWz yssSÇ4R\\Lp}N^MMMIQ	(01f?=Ͼ   #~ct    IENDB`                                                                                                                                                                                                                                                                                                                                                                                                                                                wp-admin/images/marker.png                                                                          0000755 0023422 0004734 00000001214 11055570616 016561  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR         ;mG   +tEXtCreation Time vr 14 jul 2006 13:31:23 +0100Cg   tIME %   	pHYs  ."  ."ݒ   gAMA  a  IDATxڭK*Qd*`H
!t!E-t-6 ڴ*p*ByQA"-ȍ$6*9{
C:	сs{cҰ$,X@W\HU,?T	^AlqÛ`3>RE*ˬ^3YY(b>{`kVQX`0_LCzvt&=(A+
rN	`V0d2IN=^d{jJ>eXr	")nbT")7cccbQj݈eZg"fꖅF1p8kE/Rj8fN^.DWzOdp*R)BHOXx<J |lOh4(kf~gQ6eYFz)P&!q.'nyhph4kF>Qb#O^ǈ    IENDB`                                                                                                                                                                                                                                                                                                                                                                                    wp-admin/images/mask.png                                                                            0000755 0023422 0004734 00000003744 11055570616 016245  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR   e   e   T|-   tIME37  IDATx]R:l	
d8TQ7[7; }^c)qRj/4_Dw+\F]hztG;J:\F>vpcnd`±sVsɵǁD$h'=]as'BfOWd Leds(L׊GWHBרVFa]W6Ev&xM,8O1};Bc 
JvY_#eTW	ʴd>*Q<ZL̛q)'5Y|=iWOYXѵ؋I0GQW5ذD8F֊c(X%KIFu]ڲxZ&[Qp&NxCꚲyI%&JH#YtŖ˪'@zU%zI	V%9 :'_2˂*%C',"#
/a×gYVh˴d*,ߐ:YD}A8H#zr1*kwѰ%%~T )
<f!V@bx,A}R}&8:SIR< dIDY	
@2rf<#TM(SŔMURB/w]DJ@ M/|	fSFD1wTckINrȜk!
N#?pT/Bp4I	Zq)O1b*_(|!|ؔ>C	cUҰJaq|# ~!{hi~gxLdt#+{| ~#:̣)-QUU8VVː&A#;U=Pz241:9N\*
AB#Q1q'Ò'y!'Q0_5S{NvGgWyH!'c.'Sqs2MsclV + a0N&?)o	Z6`9Y٨9x*@ʎ	"0~aPO,)(ZƮ̔r1˛ՒC?& #坨l9QuꬬkRS*+p)7g&P;3GH	vVy
htT(vme0w.xRp)V}iin
S-1{'w<}m!`q|	U#SS VhxA}˺Ҝ&N d7Q碝+Rޓ!k		?=H¡URnDqq
$cPAdbqP,(4"T?&;H@P(0{^^Gtg/O^1FR P%.c|B=0&7F! ^6viBҚT%);QX*']OA;V|MKB N)yS)/i &\ThBHơ i4En Jݣ\^DFA،'D wYjS!?sQJwM1}_K\~$bVr7zJjۊ3|zJb(2`J
DW]ǀȮ#|]Dkg#h $X!lkgR"
fWUUy?#z a!'Xi0}vegTkc>Q
/2Rd^yJE<zJe+O<"|Tڲh ~LfA `w8*|])a@߱ڧn0;> K}9se5[    IENDB`                            wp-admin/images/menu-arrows.gif                                                                     0000755 0023422 0004734 00000000512 11100203170 017513  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a 2   Ĺܥ               ! 
 ,     2  P)Fͻ`(dihjZ*tmqpSel: 0@جg xL.zni\u-d=C<?.*՛/ڗ܋ߙE	G/pd^ RsBc=ltM$  ;                                                                                                                                                                                      wp-admin/images/menu-bits-rtl.gif                                                                   0000755 0023422 0004734 00000002424 11110722640 017753  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a< |7 |||mmm[[[rrrwww~~~nnnyyyvvvpppqqqoootttzzzsss硡凇It                        !  7 ,    < | @pH,Ȥh:ШtJZجvzxLzn|N~KJ aH*\hÇ#JHň
2jȱǏ Cr@ɓ(S\򤄗0cʜI͛2)ɳ@
ѣH*]ʴ)PJJիXjʵ+`[KٳhӪ]˶۷pʝKݻx˷߿LÈ+^̸ǐ#KL˘3k̹ϠCMӨS^ͺװc˞M۸sͻYxq♍'GYys旝GnYzuꕭgNY{w/Y|y6 @U,g7X{a'`!g Z
v5{%j]qhH~8!藍}ȗ{񨗏ywiu!Is1)qA	oQ閕lqj!9%y)p矀*蠄F ()(9)IZ)Y)i)y*Z***+Z+뮼e+`

Y@h5	
BZ
pm'b*nb"aoaV㢛ۯ[2<×BğR<ŧbƯr<Ƿؽm%|r,Z#pf3k g7o8<,tDc@
 ^,|e)PB
ROM	"Ԗp __6C	& 6f+`CЙ\7ݘٝ7ޗ7ߖ8	^88)899I^9Y9i9y:草^:錙:ꋩ:늹;^1;ٞ;;<	_<7f1 Wog}A  ;                                                                                                                                                                                                                                            wp-admin/images/menu-bits.gif                                                                       0000755 0023422 0004734 00000002252 11110722640 017153  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a< |5 |||mmmrrrwwwqqqvvvoooppptttnnnyyysss~~~zzzꇇ                              !  5 ,    < | @pH,Ȥ(h:ШtJZجzxLzn|N~KJ
 AH*\hЂÇ#JHň	2jȱǏ Crd@ɓ(S\䃗0cʜI͛2ɳ@
ѣH*]ʴ)PJJիXjʵ+`[KٳhӪ]˶۷pʝKݻx˷߿LÈ+^̸ǐ#KL˘3k̹ϠCMӨS^ͺװc˞M۸s;őǜ͡?ձ_?Сx!Dcnu ~	%_a58ehqҁhڑ蝉hhn(c3~Xc7c;c?dCX$oH&L6䓀@fRR9fUbyefYr%f]ea9eeyfei&emdq9duygdy'd}ce`衈2V"g
(#4	Xf X#J	
j0`*:z򺫚;"{2BR;b{-v-{Ǚ[;Xl	%Đ!& e#<C%TV1  `ɰ
-dr01;5{9=A;E{IϻMQ;U{Yﻵ]a7/cg/bk'6boasVxޓ-߀.nxA  ;                                                                                                                                                                                                                                                                                                                                                      wp-admin/images/menu-dark-rtl.gif                                                                   0000755 0023422 0004734 00000001666 11110722732 017744  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a d  ᴴڼ                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              !   ,     d   -h TPa
ha L0p 
 H@2HXǕ-PpP@q6PϞ@)(ѣM:RM>ԝNJj+֭YÂUlY_ϪMVWfV{.Zk};W߾} ;                                                                          wp-admin/images/menu-dark.gif                                                                       0000755 0023422 0004734 00000000365 11110722640 017136  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a d  ᴴڼ                           !   ,     d  r `%㉪%KZ1aLȂbD{TF핐f&,,;znx5d9^_eZަSq\_߹}_{v~y! ;                                                                                                                                                                                                                                                                           wp-admin/images/menu-vs.png                                                                         0000755 0023422 0004734 00000033346 11114507346 016701  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR  J   @   |>   sBIT|d   	pHYs  
  
B4   !tEXtSoftware Macromedia Fireworks 4.0&'u    IDATxwxTE=@EA4A""
J<*YPAz@ tBٔ9c@ ]{\׹9e3|=30Rhhhhh;PjhhhԀ&5	FhBQPjhhhԀ&5`i7x+N7 (w,V]񿪪Pe5kIpBHgB!Pre@$Ȳ&rk?[5n§w9"~DB&	 d(d0iy;ymeQ&b/VHY>ո/ :^ۖ4Iϟsż (
J2$Q,I	(.ED! 
.+L!JHW/s?~|#G9ԤIuCG 1o޼u n67xcN _PUu:ڼ_~y '˲|x_r[罞$0Ax^rpfx`uw2vL ԓe5_rbщNyꊳ߯LyػײO8hejdd$m qRR(togνyDY'\ދI{ѢEKf}]
Ξ=&&&.U/y?v}sW;x!-O6Wja"<zgubIKK0j(/			}e;v,^ԩSKǌC'Lpcǎ8Nk{+رcdYYs>S^*U22e}D)kIU"\A.|j]>W5zR̚UV=:2y1!uCz}:Ǝ}ټ(e$0;(Gos&,eJYYYӦ1<c_G~v.׺7RY~fHL!Ms}҄ 6zastt7ӁBJQRRA)EN`X`4$u.g$
1:*QA(2qk;uǲ 
@!t\ǖow!*x^KT|6c$8AS`ϽǏ3gW^>}̝9s `F d"~O?䉩 ^;={YYYG۶m!I,Ks$~H퐨!Q/iqÂ#Ih&)thb%+-)Uf+fak?=D'TAЙZt spwKr=:={xt(CMFB d(:x}MO65*@0 y'~3 _c+V0Ƽ2Ux$0aJi+k87ؾ_؉K$^6w)kҦ֛	!U_[RR24nF~~>D#U՞ֿ~Xf:w =A#!DݎGیB㘛Pl?cf"ݻwg[͛v\\~xw״~̙3+Ers?>h4.?> \t	-[ɓ'ѱcG#//ڵkaЦMsڧv:<e1Ϛ8ӗ[
Œ12$NEs!6.42
(s8usTU\*+edO~$2PqϢkv" #pL~Fp`L&ԪUǺ0p@5n	0Kիv rq\طz{ڶ=󏪶R]o(
\.8hDHH -Z@+fYx ڷo;vUV^	hCrrRZ&6iIq8֫ݷRI9"3!2Lpݪ.=[_F=Sa?-Z`X2^W0$ A.{ĉW̝;w< ee˖ ݅丫	!f7Iu$K\DCh٩eq_٘gSlH,]@f!*J H!\Ե j7CuY` wtK("P/0QUf
וSG٥ 
*^3urW~7%sFd2!i̘1߬_ƍcwXeA5Zqp .olWubشI&
+nh먬\bk7˲ݎz
VB\\aX)o0͈J(=||K[vrgIޝ˂g]6U8i*NyEKXWSRRiӦٻ Nt /9sn۶~xiuo\lа[is~#ĉ#F9sT$z=*>&	AAA  шbӦM8t&OsAE&r(yu61Ɋ͉mE1O?髷Rx$3X؝V;8v+qom&VH99(|Ͷ.ݮrWK(*{7mlC :JBG)!6,c%TBީzb£'Ν={O>00Ѩ| JAU@DEF`̛c"k7n| !QpR1'^i3L]{lM-["!! `Y1tL Yp8*Y,q+I!ңt*J{`q<n]GWIB8A>{Hto߾aݻ{jm6~i>PuW}&IwfʠFmZ$+V)))>,}eYw_z<*/3/j*;5	0z' uy*Vu!D7Q ޽<=~p`Cنkl2l<=csaOdY۹]p_Bmd۪oYؒoņ~wi+ j($@E{A$EP)[Y`'AAAA0EG <:*S]  Ua`Pc o߾%x) ѝE w?8#E~~~PU]vUePPRSSԣ\5k֠~}ecR(wQ[3=Y 	."gz!tq*nd`۴v͆>qqq  @2 <J 5jz>ĉm?.="Ṙ~_wgH*hذ!VZaEQ<vpC$Ħ @lX'nta9Fqӟ
]?rU1v~S{vˏ=ߧa
-e3X8zZ<T-t.bN^ڊ{O)w6=qvLI>4Ҩ20DJڤ-v 5ZEn	D .٠G?}~v(zj ăsD_gãJ/@L8\2sZEN8vf ^٭-B`IE˖-f?7nM/}m
JT3=I*D"8gKݍ:¬*A^  -K~DQTjL0aysDQ[7ȯؤ"m~tU<#19g%RpvmۢQFp"P+?s$͖]ԩBs5^)|rl	 ;E`1ç
G*2-q@Djw/Ӡ~.X,G<߮ 4r: ܵF"reԣ!4y?c`D DvL*+ WqY7ndГ#ЏxP>}6m܆@<3;FU I&"D 9?AGNMRO}<rp׉zT3:f̘Ӈjr+<rQ`ZyG?r劋s8*AEBDκtY@TY̯XOqe:=rPJ!Iqϡ;P5 lm,A$j ʢ(~-mڏCXR
YPPT	O[oy!^=Y&r"#}* `uZW.{_Ѿ[۰(1rٜcJ-mt͛[?pXe,K28nݺ$""cttt$IhҤ	(Ec٣7BY!vcئSUpҝbXQz*c6mȴ#)$I_7gx;|e=r 23̰gq?T7QbD_s m{IHOOc'*I\{Q]PZM.1>"W): C>Q m9VK.\xMeDm2cƌk:TE NO,U <TEdIUޟeHYVH
ӧp]on0AG}}A DQ([eUg	0f˭C2zfyaN 17Ȇ&""%)a]EAXydCXHѲeK(Ff0_bbcanp v_`蟐~zLo8r䈒i,˨Pq:`&/}{WY?6!zU+yQ+<MO >]&av N?99}-$q+eLnѽCL8Z}l"BC+uqv-(0,N=;(Hee@A~׮]@`ػ{p{ա̳HP2k++v?y[kKYì7 OߺXtu 24mB(?\~y c^64LWqTAsrڂ1MMP%8I߈eTݺ͚5#jS.'0ӑSO~^1{ᰘ1FFa]0㞭N$A@DD!%%&	T
nGII	Wu|y|! P.z;]ށ;tz sW![x@>j0[0lf\Y- HOOG]r!*p t"¹xݚ(#CrZ'0[Ytֵklwv, \. (zUyW.]PJh4UUQz1(6.e9/]V&(;d+(ѣO޸qc|||(PBe{kYް(A$(YBUg.Rv_N[Qv 7 :uQD$>2H/1+oܸ ``Ώ<RfUwa@ԩSٳ90.x		6X`Z+;J1l())lFnn.nVHeaTWuqaaH
t
ЩUp:(z/<p8SwZϕ[k\̸t+ٹ-ʄGlvWG2|op9f[l|&s3T;u[w1հzeʓpt	~OM:@f%2o:mW sB%=
QdqYQȡ}u,n?~aڴi$UqWD@Zɿ;E7v: 
aT&vU7B(9R^=x1(PVtzn%pԩ簾>{`ٲe 8(20$E,]*))q{ KeQZk4V:eeeL:ʦ&;<]\o/ag-. dYsZHC{^ї;z!K2Y_3U!p^HR{v:Ai*z-!@>f:8Q?ަ/j+"Zvh(^YdI ѣ7˲HN]b[ÿtb۶lPPda3wǏ۪|~(aj<xp*nЬZVRRZʈaLLr:XE$?^v5jTݻwb0,[l Xa cwѳf6a6Q\\\Ctx"q\$I˲y,WLMbֻw BaԪ{۲2==ݣanePA')=ݡ8/|x: j]wP*pzS!G	,?RĶN. O0L!C=zbAݷo޼yԻxf%AlS>t{(5Q,#DQTȍJ)} F~Wvz~:DfDsӗo0kzr坹-N)^z}ٿBoBA I P}xcBw5444j@JЄRCCC4ШM(5444j@JЄRCCC4ШM(5444j@JЄRCCC4ШM(5444j@JЄRCCCjٔ_1z  TUU/UU@%ͅPeqe==0\U΄a@!Jr@4YQ}k6OlĨ>[cvpLa^Έ^]:'P=l;Va(E14?ͫ<W\g @v_WȲ\1g{I$i(&o4'=&V1c}^`!m6Lm_~Yx*{3Vf9:ܲ~XT(ڊC/{vWyw%(+|9AFv8UI>%)/<([3I$E1LEgVM(0$oWJsONVNC Þtsk~w;s./}[Ҫl\ƈũOCYs*bqA|u/&}0|9vul>=q"BBz]~=Ǻ3'yo";5T/,\ٱ_ 'BI)aχj|^aυ!q7b0'$daߙ+eOe3yͺ~OKu0o{/8F?6aw7ʢ׼&<QYuޙu0w^R/z.7Ia qpqOΚ=#yT}>d
\iE~|k&|(yգviSUu%  *Scfl0op:XKh<Yg2ځΡ ?{_ث|ݣu\g9\-u#x#oݙEZge$\8OO(HRG/l ~s!@OBiәlDQK
BܞesSm<ֲ!xPx8?=8$6N<^)ExyR2I>2Ҕu!1qu5aoO ry;yG=~v}> sH.AuB$|3㽠\^1^1jaFIkQdr:1:Nե{Ni_N4D  OIDATƃ} /mZ:unǼL5
%U	?f ͶwEQ:DT#Ykc
F SNpts7fТd̻/f  )hN{iL䅛o9yu(I悢?=ezTWdqyVVmG π=z-pSP*D+(=?Plerl;GĀ8=kGH=v-yyEPdѽ}+4[r;~_3/×ݺslиf/tzKڢiO\"bgrFtH^諂}нq$vgWzui7JUߎbqؼrIvIڹ6c5p/KIfy,,POCV">unn3TD:ˆ
QQSVu>5xveιkuBTHkL2 L&ԪUR>ƈ1DRχN>aFxbtj,M';BiDV$}SPvWoɲ`4k%<_f;	ZǢ_WBÞ!8t(%CU9yQ֋AQ$y-R|R(+/)@8[YQXXׯe-[^NU )){I,[uµKS嚣AwaI ^wvo,YU$7to	 բ pJ> {4$ [Cdwii^gᄑS^6ϏIm#t0?:!rW`xbj[ҫf$NhPTڔx6,ˣ@p^37ȇc3z&	]rndǊq}ar*N>F%Rp]/ujP_12//|gӗ\%[7鋒ݎWڣAÆG߀vaqԎz#OL)maχ"OthgD&xT&Gׂ EkEם@E	VRX4\Ou͟}RJj?6/Af|1!$q=D8_0Q_T$P⠏n &НǞtY}aSJ>DIDk9쇗{l=uYW%e9tj][77H(mΛݭbh;PrLVQ\LpK2'.\fa(EUwnl/eJ DÂ=(%q>TR(*Qi|=ᫍG.z#NFXD-0|=}@ j׉a=o 0⋙ !VD,xֆoȈ/-vz~|ϬÆGXxDY_'~=>e.DU!B)_B@)u?A 8 ^*fqsҡaTTAlEZ I=~y뀁.XN _p204Ain&q	z4)>INg H}LVz^Nec,G!!AZ`+I:aB.vܢ1Lb]mޛֽ[V|u؉t=.PjRټ*F! VwPdJ=([<JIwiVTYBP.I=z@ 1`
zGoAacz[qsᗀCdE	oݭu<V; o_R߼?ss876yAKuD):uDcKXk?Nӷñn^_*/!{PQ!"DEP Bܡl,A.EN,Z"  @DK8do3KM#'FoצJP	 ޗ"	t8n瑆Q%ĉJWl.9 аQ): D?F\tRaYD2~2\ԞX`zGZ5GpXn'N޸J}JP{}e)9ʿ<wd+Q?	܇PD"+PI
$EE(ZM] be%Vp0=@Q;n8Q)
l,^X[5 ?`WLˎt:""QD:@V')
 _7,4C]ӱ^]Gv]uݹLP.) 5&~*2t@>x5Ĉ]Ơs8o
=AJB!һ,C"$CQPr<(/{A_Y_y+RpO(Pd٩Yee)I(Ԕ7_Y1s$IS/:ү]X9v*e;bATUJ|N)%	Tu8^Czn	k\$;P N(%n0a8_`љ-N_|pnٕɮc[ 8ߋ;FoJ=8R skz3?0YaNϱd	QZX5{mb(]=8QxQ<k.}md@?8x	NLH t#kͺgAN ޼M. ԯ_ǫPUb0H4 @VU` BnĽ?_wz%B xXÄl#4pqB0^QbC:в1.^uN9O
 EY!;܎()	eoX y~=Z?aN) E:#- Ep_c	s {(IcFx.u=hۢ1<L{#<IUһX DEEZc#l6$^]L	f4RGGʉ󓃧%la-ÐSjgXK^ֱr6`wfQ[ >yA.6j'J;+ؼCccJ)DA᳙cw<WBIBt˪NJ.x(.Jm*v,cŤ2O(q2Y+z@tڮܝewzd Tg
Q+]x^y5QSW. TKqsu!@3{ɳ#N_c0q lU$QQ&5#,C+i܂rsdvAP*BV>G~ fP=:oӦm۷0B%;_,F$	,/E%ׇ"Hz,K=siA/G7QENLDwѻcL8"*p\<ڪ5h9gjᡳ̧DAj/G2]/vJWb"Qył,wKwy̎yUnIJwÊ	% &av ҭJrܸ*ܞ$M'&xۘl+]2쏁OtBP!{O!@#Ì'w2F+H̂vW6X._@-,? |?3]"һ	w$t:luB3={5XYzPYas"
eY/gf^ФJ(+( v	#rf8f}B9 Z_@? 
)QFNNlRGbTc0˶׍!mgloTa=0K/gGı^PF74`5/n
hܗ9EP ݁SG`a*N%Xm/n_I)NEOp*ϰ_Up|Jw
uv}{{J|ftkm-/˺!e>mgBWXj!,/D^^|ㅞWK]vN8Q^)tv\~6ro	 PH)n<.z2l~vJR n2@W"esZ7@!!;^A)G^qJAIf1QF^V )*uWtRE_sݫ:J<І2~?ru~H.Ǝۜsv  }D	U)"'&˂/}8Ag+OGo:vr+a<kwo^'p:D?NC"b+9 w\>H"J]
J·.f ){}euDQT+M V_ lu;>"	 9$EeAyrovP>7j+f  0$BWRKf0?Tm!@yoa由O%ǔ65ynZVΞj+`c--TŜřq 9{?_b2j@P#/j=U=j<Y$bǹ\qȆ[7;6.a?e,%N?:yˮB(9p7w1NLU-85n9vjࠔÜZSe)^<dkWb Eu3IP ,rӁB0Aws wQvU[+ŨF;Q/ݾaq\x  ee˿Z5˱mV¹܁'taPBSU7GN*T־^HV#y]3QM9ATg`vJaub%؋F(3E9#,[1̺,kS X{׶u~?2QI##I8K>K,wzװ,}i4/ظiayc_۪|~(aϗȢsU޹S.\-!޼MF^?X1ٖRtޗy?+`Öu 42 dY_+5sV)@ڿgW1+<ϻu߽Ү٣o^:iUVnMCQgEoq۹țMJaf-: j]w₻>/$9E-	2nz[;<g6Ri6ɷ'7 )øO6׃~V˲9z!UQ,)ܞu'M$+( ~^S(+;N[0kWAvuώw7P? **-]>Ü.N`y @%EwD|ޙ4gF8ШM(5444j@JЄRCCC4ШM(5444j@J?QP^    IENDB`                                                                                                                                                                                                                                                                                          wp-admin/images/menu.png                                                                            0000755 0023422 0004734 00000026517 11117651534 016257  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR  h   @   7m:   tEXtSoftware Adobe ImageReadyqe<  ,IDATx]XW>KHSEc.bXb!cI&$#FgML=[Ćc7,-A@i˲?gvf֥\yy>3{-}Ϲe:dȐ!C9dȐ!C&h2dȐ!2d-C2J	Vr}٢{sn9d_!j0{\6"OCuW?k6JcwJ|V!Q<kIP=qw0}_YU|'2	
Zvu0#^f{Hx/f|_"?K8~'&d@}O2?Ҷn5ڬ{jUI~ƞu>dW;2d06:K7ΫA;wʺZAT<O!$၆nW
#V$qF񦈞'fVVVzTAC˗.n߲^$mXiӕ>yTTÅ~jpfe"9Vx>I#I=VU'`ݽ;D/U+`hkwj'Ne`c*(խҳRm7ZKA^elVjQ-J19)=gӔn$+W^ՠ!< 83ff9oU?f>HF|'zR,dkaiݪݛOȹ(EI]!boGrqqy欏w833SΘ>\ eFpNgB]B9ooz,N_Eە1#:k˲|7R_)d?m;wip~˳ʉLD1v͚_׏͍[,t2BWM3f.սb66K*<|ӭܨ#QWrA{WT>}Z?H{TɠA_~ܳ'::e"3gΝƍx+Ʈ`եXݨapU(JUK{dgukn:tS$RT0hZ:k:Θ**L)fV1@WH~	yy.kߙi"ff rvrTQRCHPimąp?gb{mw/5o}+X}w f 1\]\t>fy`B5iGBʳT`'DGgWa]U2OH%hm)11>Þ.9-z)JbƑxoH"8֓4)S'PQ2%M΀1:zr&2g3cN\l9)%=]cH~MY׬C~>},敳!s0$aጇ6-dw91cG-xwT**,,ŝtU`P6Dmu6Zf~)آE7b-y{87lҞ_ zrp%o R_p>Roqi9YXkNSX[Z
چjEf^}IݯWY+LO>MLtR^;*JK)-r<G<@R`<ir/_/}JelG=hPvsD349yUicjsXd9\xՇc>HХV'oWgs琛[[k.I2ku#wwW.53a?s/_f	9\-SyCc0kw|A|0)r7qwK&h^={.{m[*97T~g_`&꼯;F=$\"%rbev6K_͑[9qa:qVUhݬgҵPƫLwSGA+0AMdrT(qTO$ynRT:$^eO:T,R'a{KL6	Ag@K㿚%-w֝s4	m(٭Ӫ\Dg~ޣU,ѣ?Z?hC|W2\\v9;;;;TW }@ c紤Tù8-+3*z{x8ixFAR*A)pU(_|/.:9+s>dk/~G!ۑT	a}<d%;ws=*ѣG`ky35qFv60!S\WXzVx]{86`2j
C*\+5rsI.=GҤCZ<cYFgÖV5,<mӆLJՉ4;uV.GtLA|=Xs!EM㶳Q%$>Up'^1wO3y5mt@?xBRR]vKa}04{̹Уe-6unՇ`_d~;l)|Ba#`TeqkԮM ef'N;;KCI[\Yƃ 3]jW<=kV-_pvZmrJkӖ-#F粟/ZN\~5o٠dnKK{miv9X5p-Q<GboaKk+KLkc頦t.&b6|!6zd?̐Ґx222u)>qI$-L֫SN8yryղ%ir}@O`9ZĬ%ʕ}_]X7XFǊN	5}r_jRnvOUDaVQ-ZA`.@u+|7PBe泴1:7m-mP
5<4`,qP1}NWJ#:7 H>g}s9{D\8kgѽew[f׮=qEtλ?l@/U^唔vp*z9Cçz~:5B6**-Lk[$G.&m2t529;-@f,U% ֚5"_́$$gn*豓j,i+|=}.Y֩;\L=Æ[`uPF-{KظSlt&y\a#YܸVW{WNΆuG-)Xl8D:ILYN~aS8s$jRD..Q,(92V¯{~[z28yre5prus~lŶM+ۿ@$J-xM{4kr&y(2x̄3נO||kMT}߸y3g߾]vnj֚RR
4(iu (0sJmqqyjƫ --rr!O[F'I?]g,,\ʔ)VzL}G'82}Qx`龝zEbUɗnJ/7)@$-;p%pQV:slX;~ %w@n{ob	t4ШꞨjV-/qї!6"iOsŨL?n9|MK_ؾ`7ờz^NWX[8˾ȁy)*T}R\nxHٴq]Y*z@Rte5j׮<L	5jz_2P^=.Dn^?** tc$+iKD[;G@oNF} a;Q\5ҿT YsW:mekShzurcCƍHez:`Zut,K}6}s矸E#7m"~	4Ϲf͝gMJGF#XaI*ü~iY$.n<(՚Wj|CMu_R;;Kjd6ܾ}rۊ0UGD$])1D],W: Y%ʾs;px!jmm[a<UMvw/W9;?>yb(K8|Х*VJn	Kl[;ʱRcBչ}B~ڴj<8,,tӹJ"hamemSdzp)Wn_hnÆCrׅ%T96.t1G/Wg-xi*ݰ"PJt`(QrVnXP|ݧϙB}UMWsYoY*.X>uԩ{=;<>oHۡM	9Lehڵ'/[xNq<2Tϴ*:õx9}ssn@1Dzch#ygf]Z*UHH}-4(1Ag?%ޣưvCgpx?﷫'E-dklvg?^zWAk-,Se&Ѡ,Lw5I{ר  N37G-_=lGϝ9}71zDN[T:c{qXe.k	Wݛ #}6:~Phz~/sɹBrXǹaϧtڋc뉘7g&IEuri-
y36Vqis-ub] h[ܭZ*~~TDxC̰U8wxβb*~3s899t}823_3Z/ٚVE`,h>jpC^b_*y9˖dG$=HO3{be-A^tGQV	ɀF!b~I?MSh@|,|6oMئ#cN];&MI&uD_^Y9*njVSw{<SaT]|c6$Ҵ.do.llm$,ߐoRv+ s#nQXd"I4:ljpuv';;XC{y~N^\]]aٺc\Q˗/!-ⓞ?N:UD=bBdD2QQI$'ڻm\!f]ٕ]|`<*лM֮_V|7pӺU֯Z"s:֋?gHn\C*Sj(xê,
XZ|B,)4M.9կץ*󽿓2fݹyنG(}ペ3"@Qt?pm1 6j]
w/||Iaw~qkشIާIIpa8|H֋/"0<)ʾ-[iWkHv$n:Tj5e+3e+vk<^H(wZo+
;ߥM
qSmPkԠtj̝ǈ`.P},b(a\6$?]X+:cw۠($l,]ԟG$ȩ/iF{nk{vt4o+WrZ(C4OmP3k\Wti+g+ULL)%U2+V_b鏓--uju)t׍=<`w<y$ڣvTBRsk>5J/ڎnݺV_M&4K326){~4ŎY:sOFЃ}8o׋8XSɋO;qDRFUxcbbӰ(8ZYCwC_HRs~x_kԞg>dgg֟,Q,W:N^(RxS$,
IP9ߚ<bI@
WH/7m|`
 3N<$OW^0@ʔ9ET75VL\2dȐ!㟅2dȐ!2dȐ	Z2d!C2Aː!CL2dȐ!C&h2dȐ!2d-C2X@^bĉ%匓!'M͓sp!	3fӦM+=>7rvv~#ebLb2~r1]iW\)3gߛ<y2C릚Qg0|P.a/(yMBj'X$?oxx8|x$++:XjE{JDb4A
y0%V$i|oE;լY{[|	ƊM7`)VPbLK,ELu}0a^
Ih9ȹG_0` ؼysi3eelfRf~:vRLQ¦kZUܼ׆0>j-UGп)4hPbŊ-<==(RRR=zt˷Yt$UV-޻w/J$H)"V] 
H>JBo rΝ\aEQQQ.n)n
@\뢤0nܸQ?:Tw<9'^y":["r'O|g3梭)vmY>xN/¹Wi6l027cD@@ם;_o߾o߿OoafViٲ)StGvտWRǏsFիWf>}Z?Hd04	$Y-ZҺ5888ŅM|bɓ6X_5P# -		qȀC%}}ݨQz{)*Aaɚ`J1S'eʔdӿ#{i~?}>O DGGñcǠ{9o߾\:T#$1zHÃ;y9婘(jm5W#33ӭ~3[l6#Gxhٲe`N/q=3ϛ7o8+nԨQnkܸF3I"W?__ߐ&M?NH%hسg q|Ai$FFI0I
S%srF䞑K.'Bӈ+PU7ǂ>9Eo>z(5H]VTƊ1՝ʕM7"q,3?nݺe jժ+e֭[aѢE~~~			R;Uz2Ph rrrG9k>*4jS"
OógP:y$w<@V*A;[r[}WCS~fx/F/"x1R~;/w*GرDԔ6NׯߗDƾEg4Za40}Ң gRW:t"Y`A
lXD }Cݍ7RSC{.%fB9r>|5vq]J|7(D2!))F*>]s޸zʇg;w8w7o'և͛G|fw;ΐDMw>fvիאnݺvPuRGEׂzrގN,XRJaZ%2Y.\ (}||g}PaO$GASa^:_\̙3&ӓT*9M^S~)Sq"۷o7wI6r<k֬^ʕ<x0W/^h"*T$&xX"D a6m.]"?GXBLyOT
BJYGbb=pHyժU:uPԸ###SrqDV]
) Yƿ/4HC'ų$h]9#:88xo8)[ IES^S'yA^nKz9ʇ|\2xRC2PV	B
еkWnp|U*Cnu{qf48"ԻCC\PzVB@H)eU"
D*)')n"dj/_.6hIw$te˖@rV9߸qbccs&N	M\*6>1***_Wx&B,#cCR駟V\9Q,]#il(@޽{\gHλ[c$Ϝ_q:A)w\]\ !E0uTù^p|`ީSpRDZ!+2*\rd¶ԌAWG8{ݺu
;k\ݎHɂAX=ZYLOONsJ*k.C!FΟ?YޑlRd>A @XcqR"J?.[IDD^:mD3əJʉ
zbA99aN'e9Aӑ^rБXvqsԫWpΊN;\QSgKH4*f(_<ט8BeՓId<M|$-e)đ5L8ut֍#P"ɫΉ8"}ׯ8kgm֝,1AXܑSxcǎ?wa/$)))/[ҷmf۷C&MgϞ\F_zFfԀK oz@rkPOM5"iJ+MCBv"$"!7XbCQZ,T":r$~L~3ܑQC'U4Y?D"~~~{IPCRqHDt?cdY۱HADЮ&.Eiӆ;9vX0Im	|CBBL)-n+Vh_DqpȐ!DDZ)3={P4  nVM6xĉ(°v1wM&2*,{ =/XdH;:IMn߿Y3F9@5NVѣGh, ¦̦L|#2w.]RɕbuQ!9)?0Aj4=@VdBpp0r8DIae)tA'3@b
$FʑʐNl2Pxm)\P4D*%r 9K^p=*X;Ԟ9w!ӜRQdDdeYfg).y} Tc$+i +wm`+Ya6mxcč=QZL>hS>-ffÇu.<8|_0  93z	[d*/]J?p͛_lY&{FKSw>˚J˺%ѣ=OM5_?{4AAAcÈ4*Gua:-&&!Gpi0(`_0Bf>[}*oRY2e$ȓhBZź@)ւ:OOfɓ9oʠ<ӧAЀ$5ZPź+}ЅXϘa~X0CǎО6I4gUTY&Uuj\W=quzqJG
dFC)!"""ڵk: @Bf,XAS$Yrfƍ!rlI׮]q֝8ll伽4wtADb.AS0O1Sϰ3UarLTgh@5#qә[
n@9}̙f͚mGBJTΞ=.rF|a}ߍ߽+,$)HUUV@?n]~_ i2'xdY$.EuDh:Q4;[͇2l*1D{q(LX$eʕڵk`+ʢ).HЩYl49sB{qtƍ3AJ?͝;7HR/_~YNB{`ަw|a_R{Nqvfd`̣' z(hS9dS:::V:$h"$*r#+x)b'Xq}hHq5>s<١;xr2ԁ}"ҼF.O W0*SO\	'stw2GbRxD+$Sq\j/ȉ,&jL
N<HD`.AS8@.\FAqm,QXY%0ɹD
i4'ȑZp!QȔVLSZso($$'nGQKh!l>y1D=bJ5QHH &iF@ӧ2_È,_*<-QѰٳg7׿ 22V[7n;Gk$`sH鳊?jXʥ-g6oQO	aѣu)СC0Rr
'y2z:gt!e]3ZnOaC~m7PJoZCkӽcPgUFGZ浆>ؾ±}XNvn˳gfi%m^sV	Dxzz@w:b#x̴]?~<XʼU4b+
;ߥM\q2`҄Bp޵1t`fcd@x8UrkojN:]ݻwf*NT;ww^v|dx%eښ˸(0O5S4ť,2LRqi#LđӭQCWT](x,Y[xtãig,>i#uL4ZU~m	,$ȑN~8姁K^^^#{`ַI3-KoތFHj&Y0!,44tƃۓS}=s{%z7_-U gQp;OK=f"|Ț8~a$`7V'ǻ[!uD)UZ_ۄڂ ު"^IXJ7J+
1(yR(h+{ko~fʔfo}՛$5(JRo-C2Aː!C@2d!C2Aː!CL2dȐ! pT{"    IENDB`                                                                                                                                                                                 wp-admin/images/resize.gif                                                                          0000755 0023422 0004734 00000000107 11101570216 016546  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a       !  ,       מ˂BmX ;                                                                                                                                                                                                                                                                                                                                                                                                                                                         wp-admin/images/screen-options-left.gif                                                             0000755 0023422 0004734 00000001200 11100330604 021132  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a                                  !     ,       `$dihlp,t=Wx|pH,Ȥrl:ШtJ جvzxL.zV|N~ 
H@*\ȰÇ#JHŋ3jܘсǏ CIɓ(S\ɲ˗0cL@͛8sɳϟ@
JѣE(]ʴӧPJJիXjʵ`ÊKٳhӪ]˶۷pʝWݻx˷߿LÈǐ#KL˘3k̹ϝMӨS^ͺװc˞MsͻNȓ+_\УKNسkνËӫ_Ͼ˟O/Pa (h`|!  ;                                                                                                                                                                                                                                                                                                                                                                                                wp-admin/images/screen-options-right-up.gif                                                         0000755 0023422 0004734 00000000426 11100430444 021753  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a    ڻٽо!     ,       `%dI~hlY,lxSfH,r\RШ4*Zr)B|߁a~@1'$zx}s! ;                                                                                                                                                                                                                                          wp-admin/images/screen-options-right.gif                                                            0000755 0023422 0004734 00000000424 11100330604 021324  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a    ޻߽;ȿ   !     ,       $dIzhlX,\xP_fH,r\JШ4Zka$`Z9x`v>Xoz 
! ;                                                                                                                                                                                                                                            wp-admin/images/se.png                                                                              0000755 0023422 0004734 00000000177 11054212046 015703  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR   
   
   ]   PLTEě:   tRNS @f   'IDATx^A	  .u2ְ1Yh/n>9..(+    IENDB`                                                                                                                                                                                                                                                                                                                                                                                                 wp-admin/images/star.gif                                                                            0000755 0023422 0004734 00000000155 11045700660 016226  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a             !
  ,       >|Q'YU@]Vvº/(7mo9j&nUD9
 4Q  ;                                                                                                                                                                                                                                                                                                                                                                                                                   wp-admin/images/wheel.png                                                                           0000755 0023422 0004734 00000026725 11055570616 016422  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR         ?   tIME2(S  -IDATxyEUgf2CBأI ʢ
n'Eԋ܋"Ԉʢ,FA+BD@EP@eK@$tW}33gzLӧޥު,e)KYR,eqQނ	Be:AOhruӓAhD
V0&BҁĠXj$+Q@:W,E`ʻ]0^6m0~0;A3!	z1E߯ lHC<Je)ah+mA3 z;p|m4@ˑ<܃aTj) 'iaş܁6Zx[*(aH` f@fW*~v<p"y	on֖`0  fDGB.0.CSUC@$+P܂:{q3J6ICaa?z_ЕBNE:ŕq7a	È7=Npqpw`]ϫ<vb	Q"ZI\DG	È6h@e 0؀(ޔ4D%H.%J~k#ݷ#!8ɠS_{?B8'Ck0N+\N,#CL<ÀޣOL$&>>/6<`
"̑Y
mg	TKY>p}Vs)Y[Bp	gJ	ð`h'0g>rE}Z}CT Id1"L׾sbk^,d.Gr[S@  ou$sm`n94oI[(x،[9mG0Id\ȱґt pI0.=oksCp/=m(a4sm.y=Ag"y	=(_=7h+aho@~rt]0Yy6H15lOͅl[~L tV
AU^[$^)#TB ? w(HnE59HvnI3[9\@*j{֔·}o6@7	mokj뀮ZuEIAJ3Swn/3_5nb!DGW(@ܱ/_D!\z-D z!' z꬞zB@+
dQ'`SFhCN@ ؿBcNdP&[`/apͮ/h7.@'Yuh5DO@ 'yKbx*ld:fxwJX*;$%2%7kPOg	;Z$a VG3I~wAL!oL;(GJ 4@P_\tqK`}o@@өѴl :^пܳjؚPTMHޅb˄J˂$Ip3ϊR	C/7>UM|$(( D@tnX\f8 \vG1 M3|{??@a05:}buq#dFAn;7ac؉VD2L-=b	GM<0?g3R^!AW=/X1CQj)W /&1}C5NN#̢,f@?eulḅdӱIwmr$g/~;@.`
{E2Es&~$'"RAP0G=g`8:P^+d zy{,I2CiHvG[X̣ts	//v7a0 i<
ׂķgg53"9[{{> !+C#j?BM09)f]3R3<o3Dў8R;=Obύ= 47\|Rs>(@6T§G:vsaN̘d
fU-og,g+ZǠϐ=TJ3O-; n-hDR[	OX:|$MF} 8e.4oX\
~zWgD5߀
wg{97CVK|mFA`;]>!+_|RT	Lg8E[bR-]4zds@0&~	<w!<NP.A"e%/E$g y#ۧǷ'LGӤa/ xeW%<WSт-s"+ǦRrwe؛I[,iiurN(rMq6QIͥ0EE0bA0jVrY_J@n ut}aiYcHEb
,%XNLzPGIuWցt.a܍hb@z}ͦ.0L2s{cMYQ2)  )*t?"L$聝p_Bnŀ`X}9cO!s.|VO1Y"< D1 !(;FUDʾ`B4>l 0`9>γ	A_";1k8\P~ 0Sj$[[p9ҵW#K+Tol>0ۅ?vjuG6Ƭk#߼{ GŸUEb*\{ՠ5*r`0]}[شHn14aCJ?S<IS .YK=Da}yL#-a 
v|ƬpMb!>6DLgERpbo.-S5amZ^gZH <J4V>F[2>̆vNa.Y8E<#gfOmPa,&	_W+XӸ@'8/4ps|gEYI0 I+QlA  $8Bs܊ZwJػ'ݼeN;$F1K2O Qf	(. RZ$c\~BANNBs&k䂡s$S3K`3^H<7*"'|E	^s,;Epr-b ,P,
g"VXwVeQ)2ilKb#9A`"u}֧Izb-܂b gVkv浶ބ0u TE]ғAQ
bq9\LKh*y+51)uo'ڬd$F1XL()`*]%e|J
'=1澌 k^3<%2gMsw3-ngi8ՀjK]V^ui:!D?Yyg¬ނqMJOi,C4{4~`10,H'jX e:ھ;ˀ\-76.iVAd~{O:nxL!Xi8FL&~
fOj&-d!-YvdHfgޘ[q/*+2$R7~Hn
V@8RW[ǁ&8Pq.ML}Z!!
}V!08Ƭ,=4_!Ό`<B^RmӆvY/aڻX5$W79[fy[,Ne)>+c0\cDyB6y=\bUg,!'U5ш!mއu[c߶u'.s@]Y3CZZL:׆3h>O,MYwq\`e=fɺ }r6ZޛgYO(9;<z-
1,=ȦjV>MxCfғq0L_' V
,󼬷^F
Ï+ITBぁ g4d&E0WC2:A}V{םcK3wRLrE97)R̥	?V4S$IZgq6zʭF<
βpk#)efKi}[Ў:um]@Pb!cNh<Bǒ@G40]sE4 1^Oo
եNңB{ـ0ySL#O5hr@pTn"8L@7ԿlMatuy/Nlҹ!i6p0L.	!~Sv
s4T f}Nqg$`0l{ZEY[""/2C/L:0tAM
#1M!l`Z %l`=t&Q&Ȭ{"7xú3>u2#x~+.s84{Τu$, -/k"80kΐ1a肽qq-zFw@Q=c]-˘#hv˘0qN*<7jQ#ZɁ`}8IX0%_]$INڰ v@%@%KfKiof8&f.Rxh+xpi~Xf\B<3z%P:Y4}kqq^uB'+#-O2f|eia vGLukxg/~vI·}xwa HhԹ_[+
_
Ǿ6sf2:ڻlr~e:@v{hhsk2G4фƣFZ~{bZ}m ڡlBobNntN'd-p oPC=X!W:޾]	5	lU[-")%#KEZFRjHr-XZt5ا)ڠ!s3n^,mkRGg#^"͐}:$ұsMZ}c	zmh(fӧ;5{9ѐ\<vEqU,pI(#3! KZ/-cR) '%fƿk7a$F]RaXc9I>m?5,pF &x
sdˁ&]7=(  3Z}P~DaG]wӴHA@䨂`䊔۷yu-Ȕ$pU55i$(ҾiPp_$׎?VWs&2R̩$i,ZT?".9t,IOV`H`K+:MMB̷v10^7buu%CCE]~͜GA IEeqS0bੰakɡf.03릟,tH,8V1$;3)I̤F5D^]PޙN?iF¬Z۶0hn<ht5ft9W!Y"Ci$E:"ېL,I $iK?UP]W=鄛 az"LOZ i~A9X	W}̟F⤥K}ֱkW6t.yIZqH:%bz5LdXlOu[a)fq"!@ְ@
x(${0g5lPhKIIAEIxTtxQUѝoc<=I%Ӂ͕G'oNsZ?C-i7ÐlF !*z/'6s5!Q]`RM|%	PǕE;sp9Ǘ6ڤ{(	qG7KaInwfJx0t'1|:MYu>fI>؄PUvܚ!)Y@ ``c	efR4s89q2Dk^-ܤ|ڟI0%x6ߌ3Ȍ§Nyr\YwU7YqK6{GAJzjeLfh~B]BIiyG;_ 2B`
a郈w z[dRv'Qm1םzV#3)gZ4m,c #	IiX,346;1	1FC#@hQYĴ\2R}VuPDuu[|ƽAցiD&voѤEhX;`h4()Z:չ 1 KX"Li,QaVam72g(i*1ʺ&
76p&g\69tҖ)!Si"jw}[RKˠ-4*k̤Pe)G]}U3\;BR`]̟YU;lI03~BzNmT>- kfh cR}Fy%e)0QUc!cd,D2&Du0$arV8a0":#%e)hH,$܂c6H^ϒ1n(b c>kQYl.LOa,i!f[V8ab7}N[ +cY
r~{S_Q"x>go ,xϢg4 @9@	 0|ei| a:Ccaj?X>ʲ4ZBEZ5A̐@,x9 NHF4qղlV4Ag3fkCl2Z#I{ ,c->C6n$SH-=hzes{ڴ@,qm!r 4հFR_-j(E-K޲/a3=4jFcnbqjǼGZ%whX;ppԙtRZMy',axZ^Y6Yսv;,8]{ZB|z3݋ja-<EW-ɖ%kZɧu)f+ú?!z;0[,%FЖ71GxPuoғ7?y4)oY2HJȒ3dL;
<<Z!j	ŷ ihψ°k:cƗ,>Eq)MtJ~	_`?_iX`(sYØ$5-00& :=D)0|eI*px[eq=ٿQ3 nЭ=BX<fn.K,4A%O[/I_a,FB?5J/Dw0;KN\Tی~7\F9QoL+{Yl%khIvG lpiKZ'j8|eַ!zD0G[QsJFpT/KwF0>v\Bb^hڴI?cY|e f1"Sr3d08}OR_p$6+|I,u|!,ea9bu6Q\T_,Š,vֱNq̞}`+>AW+MEi?}OcYJ&<fRk)xP'4,Nr^|{-`R*6բu((A͞ўօ&í."`aQ^uQeҦ&@Fկ
ljPDSM''$)fY`(cS+cU[~(4p^REC0a.xEDL_/6%0_@;(U5ŀLt	f;%Mý	DzwN. D	Z`)%'@@MA8	6.8'iN1C!PFL/PR]ͥUNwDn{\&:f@Xͤ·R3Rև\y$J
E¨ADwgk=sCz_\[k(`"]	y 2}PdlqkUp{W}1JI .`VPf4 -ayBC05|~8tHDg+C)E#O &llaCu`x"]tt
w#0L)icww9	 u	SM`_P@p^K&t Ea6R6ֲ| $AjRx])=t6`}H>4V
Ʀ޳?C0.NNj5SCBuKrAW #8d׫ t!9x\tR1sӓsK{6دobzDO4wJ}!pSb2ESh2uc a]3Pou2vi	O"Ņހ9ehH+oP-5pwAP0\ڢnXq(LV~cN7T
@$? X_Jp		?T GhQv%̲ sn5e7K|EG)C~z[#:3|Q#&ueX$$=
?32BRAr-\~ 1,/fc9zw$87HhJ05|[ųdY
 4'կo]>N wD,{Kib"igs~#~l@&w:X =Y-yf(Q2VBxq9
LEkf `7^CRn(#MS臠H0l )xꚢͣ`KQL+1ى*	`@]5ty
/D#uio' O%6$bXrLu T~BӪ٧ykrV3APsHu)-%n:AUbR)͍h1s!:AK<>4P>\+}8T7QDa`F</[tgyl_j#!jO^wZjoi#|n0.upUN5B;%;AU"w[)i|m<~79mAd<`ЀY"`]1i1|)0$0(^Erp!*:諠w]IkxO/Bt{҇ff<p	9>1#e(e"^)!dD>"q{DC7Ďfc*z Cxe~˛Z`_/DcY</r>Y}	PTgOʦ$Xωk\ɉ≑A
	9"$J3:\m20 nwnKl$'ֆx҆Tw\NX3ws$Aπo<BR(_nBס=cM;9ɩ(*e;t<[hZź j&t \w=" %ɺ=ѱ[5|fT'|qUԌ, o:/pn U{>w[wŴ,fm[t3l,a!:̦o49e(>=A
 i[F'Tx ]<qB8]	w'Ds@Oh\ˊg:4|qE\]\b޴Hj:]o xsYQx`;z{nX*5{1b|!Nb7|'=l(8_)ootcm|!H&BIu^e(U(ޠ$DTX5ڪ3INpD3 t5:$Yèye9qC4Dnxr}ig4'!93 |Sk	T[) sڹRS+; `D	Bs,_=\p|X(>]9hqX`4Nَl2q׍M=B;A0  "~&nE?!Щ+ˌ;W/
,7'޺gA΃NE\j3j"O#4WSǄ-MȐFdLj3XDsތ{H߸F]!: A襩iZ$ 'Ȭ,m>7<X}<GUVF8$R.KP|QNmL΢!d!0k˫(&I@C0 ^scw|b_7p.5v>n8
N{7ᙓh7激ٵlQ(aX~{2X
q([ǾϐdZdV1>I~y|.KPZGqWϲWg*.<iK~ٌf"*=R4$eoEɗ`HET^ęz$^gyigQd$A:|aaK!_{%Ba#M>(ژ>(NBrPm tiIZ	OZD$ga	Kaݕd14`"`sv§yLM\WZrIBIM2݀]zA]5:~&ŦCo18#(ajKZ 4|H&`D?q%<q&7&
C](d#QCd)dV`G+ uP=u(0ԗLJfQߐ\\T<M:l}{ "w֎t_aKHnb
A1<`)0xO`n`c0{(%*aIl$Q(Z
" Aѽ`aسlK9KiePDHvD2AdDj{,2Dρ~
(+Gj?@	jb-c*0Vb2B2BІ`ym ZQ'D^
ЯC
-ClW],e)KYR(!j    IENDB`                                           wp-admin/images/white-grad-active.png                                                               0000755 0023422 0004734 00000000337 11111736316 020603  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR         Ӡ$   tEXtSoftware Adobe ImageReadyqe<   9PLTE=   <IDATxL90 0sx* ڻ+?bUŦ\Ţ<*bVDQ>Ť' Yk/    IENDB`                                                                                                                                                                                                                                                                                                 wp-admin/images/white-grad.png                                                                      0000755 0023422 0004734 00000000322 11110330534 017313  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 PNG

   IHDR         ~Խ   sBIT|d   	pHYs    ~   !tEXtSoftware Macromedia Fireworks 4.0&'u   tEXtCreation Time 11/17/08luq   %IDATxc4.E!v}s :&K4A    IENDB`                                                                                                                                                                                                                                                                                                              wp-admin/images/wp-logo.gif                                                                         0000755 0023422 0004734 00000002110 11113676324 016637  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 GIF89a  ] TTTSSSJJJBBBiii>>>777eee@@@CCClll999\\\KKKmmmdddrrrVVVQQQWWWEEEIII:::sssjjjzzz111ZZZ]]]nnn===333fff{{{aaa___cccFFFooottt222888kkk666000AAA}}}[[[DDDNNNwwwGGGRRRhhhqqqUUU444LLLuuugggXXXbbbOOOyyy|||^^^vvvDDD                                                                                                      !  ] ,       ]?Q+DD>Q?+M0	FF0M+4*!!*4"	3CC3	" @@ ʑ33ݐO 9%O]& ^` Hࠁ7r0@ `^X!!*tb]qc1c~h hv A!
, hW]bUA!"t)BH	jѕR]yaB!6"$	PTw8I"( AUбUDH8A*exLcP	0Y@c{A7hk"FQvNҎ@"jX8	9Gx֒JUg
]T@BPSL@{@.Oᅅ) UR0
P/ta@h>IZ#,"PԅB0 cu1	E	- 0եT-.   	&A-4 H	$4@F, )&=&(Hf'8'vyQP>ЅTj	J`d
HH 
d 2tL0ȀWJA5dH| ;                                                                                                                                                                                                                                                                                                                                                                                                                                                        wp-admin/import/                                                                                    0000755 0023422 0004734 00000000000 11154152624 014631  5                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 wp-admin/import/blogger.php                                                                         0000755 0023422 0004734 00000111273 11135660264 016776  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Blogger Importer
 *
 * @package WordPress
 * @subpackage Importer
 */

/**
 * How many records per GData query
 *
 * @package WordPress
 * @subpackage Blogger_Import
 * @var int
 * @since unknown
 */
define( 'MAX_RESULTS',        50 );

/**
 * How many seconds to let the script run
 *
 * @package WordPress
 * @subpackage Blogger_Import
 * @var int
 * @since unknown
 */
define( 'MAX_EXECUTION_TIME', 20 );

/**
 * How many seconds between status bar updates
 *
 * @package WordPress
 * @subpackage Blogger_Import
 * @var int
 * @since unknown
 */
define( 'STATUS_INTERVAL',     3 );

/**
 * Blogger Importer class
 *
 * @since unknown
 */
class Blogger_Import {

	// Shows the welcome screen and the magic auth link.
	function greet() {
		$next_url = get_option('siteurl') . '/wp-admin/index.php?import=blogger&amp;noheader=true';
		$auth_url = "https://www.google.com/accounts/AuthSubRequest";
		$title = __('Import Blogger');
		$welcome = __('Howdy! This importer allows you to import posts and comments from your Blogger account into your WordPress blog.');
		$prereqs = __('To use this importer, you must have a Google account and an upgraded (New, was Beta) blog hosted on blogspot.com or a custom domain (not FTP).');
		$stepone = __('The first thing you need to do is tell Blogger to let WordPress access your account. You will be sent back here after providing authorization.');
		$auth = __('Authorize');

		echo "
		<div class='wrap'>
		".screen_icon()."
		<h2>$title</h2>
		<p>$welcome</p><p>$prereqs</p><p>$stepone</p>
			<form action='$auth_url' method='get'>
				<p class='submit' style='text-align:left;'>
					<input type='submit' class='button' value='$auth' />
					<input type='hidden' name='scope' value='http://www.blogger.com/feeds/' />
					<input type='hidden' name='session' value='1' />
					<input type='hidden' name='secure' value='0' />
					<input type='hidden' name='next' value='$next_url' />
				</p>
			</form>
		</div>\n";
	}

	function uh_oh($title, $message, $info) {
		echo "<div class='wrap'>";
		screen_icon();
		echo "<h2>$title</h2><p>$message</p><pre>$info</pre></div>";
	}

	function auth() {
		// We have a single-use token that must be upgraded to a session token.
		$token = preg_replace( '/[^-_0-9a-zA-Z]/', '', $_GET['token'] );
		$headers = array(
			"GET /accounts/AuthSubSessionToken HTTP/1.0",
			"Authorization: AuthSub token=\"$token\""
		);
		$request = join( "\r\n", $headers ) . "\r\n\r\n";
		$sock = $this->_get_auth_sock( );
		if ( ! $sock ) return false;
		$response = $this->_txrx( $sock, $request );
		preg_match( '/token=([-_0-9a-z]+)/i', $response, $matches );
		if ( empty( $matches[1] ) ) {
			$this->uh_oh(
				__( 'Authorization failed' ),
				__( 'Something went wrong. If the problem persists, send this info to support:' ),
				htmlspecialchars($response)
			);
			return false;
		}
		$this->token = $matches[1];

		wp_redirect( remove_query_arg( array( 'token', 'noheader' ) ) );
	}

	function get_token_info() {
		$headers = array(
			"GET /accounts/AuthSubTokenInfo  HTTP/1.0",
			"Authorization: AuthSub token=\"$this->token\""
		);
		$request = join( "\r\n", $headers ) . "\r\n\r\n";
		$sock = $this->_get_auth_sock( );
		if ( ! $sock ) return;
		$response = $this->_txrx( $sock, $request );
		return $this->parse_response($response);
	}

	function token_is_valid() {
		$info = $this->get_token_info();

		if ( $info['code'] == 200 )
			return true;

		return false;
	}

	function show_blogs($iter = 0) {
		if ( empty($this->blogs) ) {
			$headers = array(
				"GET /feeds/default/blogs HTTP/1.0",
				"Host: www.blogger.com",
				"Authorization: AuthSub token=\"$this->token\""
			);
			$request = join( "\r\n", $headers ) . "\r\n\r\n";
			$sock = $this->_get_blogger_sock( );
			if ( ! $sock ) return;
			$response = $this->_txrx( $sock, $request );

			// Quick and dirty XML mining.
			list( $headers, $xml ) = explode( "\r\n\r\n", $response );
			$p = xml_parser_create();
			xml_parse_into_struct($p, $xml, $vals, $index);
			xml_parser_free($p);

			$this->title = $vals[$index['TITLE'][0]]['value'];

			// Give it a few retries... this step often flakes out the first time.
			if ( empty( $index['ENTRY'] ) ) {
				if ( $iter < 3 ) {
					return $this->show_blogs($iter + 1);
				} else {
					$this->uh_oh(
						__('Trouble signing in'),
						__('We were not able to gain access to your account. Try starting over.'),
						''
					);
					return false;
				}
			}

			foreach ( $index['ENTRY'] as $i ) {
				$blog = array();
				while ( ( $tag = $vals[$i] ) && ! ( $tag['tag'] == 'ENTRY' && $tag['type'] == 'close' ) ) {
					if ( $tag['tag'] == 'TITLE' ) {
						$blog['title'] = $tag['value'];
					} elseif ( $tag['tag'] == 'SUMMARY' ) {
						$blog['summary'] == $tag['value'];
					} elseif ( $tag['tag'] == 'LINK' ) {
						if ( $tag['attributes']['REL'] == 'alternate' && $tag['attributes']['TYPE'] == 'text/html' ) {
							$parts = parse_url( $tag['attributes']['HREF'] );
							$blog['host'] = $parts['host'];
						} elseif ( $tag['attributes']['REL'] == 'edit' )
							$blog['gateway'] = $tag['attributes']['HREF'];
					}
					++$i;
				}
				if ( ! empty ( $blog ) ) {
					$blog['total_posts'] = $this->get_total_results('posts', $blog['host']);
					$blog['total_comments'] = $this->get_total_results('comments', $blog['host']);
					$blog['mode'] = 'init';
					$this->blogs[] = $blog;
				}
			}

			if ( empty( $this->blogs ) ) {
				$this->uh_oh(
					__('No blogs found'),
					__('We were able to log in but there were no blogs. Try a different account next time.'),
					''
				);
				return false;
			}
		}
//echo '<pre>'.print_r($this,1).'</pre>';
		$start    = js_escape( __('Import') );
		$continue = js_escape( __('Continue') );
		$stop     = js_escape( __('Importing...') );
		$authors  = js_escape( __('Set Authors') );
		$loadauth = js_escape( __('Preparing author mapping form...') );
		$authhead = js_escape( __('Final Step: Author Mapping') );
		$nothing  = js_escape( __('Nothing was imported. Had you already imported this blog?') );
		$title    = __('Blogger Blogs');
		$name     = __('Blog Name');
		$url      = __('Blog URL');
		$action   = __('The Magic Button');
		$posts    = __('Posts');
		$comments = __('Comments');
		$noscript = __('This feature requires Javascript but it seems to be disabled. Please enable Javascript and then reload this page. Don\'t worry, you can turn it back off when you\'re done.');

		$interval = STATUS_INTERVAL * 1000;

		foreach ( $this->blogs as $i => $blog ) {
			if ( $blog['mode'] == 'init' )
				$value = $start;
			elseif ( $blog['mode'] == 'posts' || $blog['mode'] == 'comments' )
				$value = $continue;
			else
				$value = $authors;
			$blogtitle = js_escape( $blog['title'] );
			$pdone = isset($blog['posts_done']) ? (int) $blog['posts_done'] : 0;
			$cdone = isset($blog['comments_done']) ? (int) $blog['comments_done'] : 0;
			$init .= "blogs[$i]=new blog($i,'$blogtitle','{$blog['mode']}'," . $this->get_js_status($i) . ');';
			$pstat = "<div class='ind' id='pind$i'>&nbsp;</div><div id='pstat$i' class='stat'>$pdone/{$blog['total_posts']}</div>";
			$cstat = "<div class='ind' id='cind$i'>&nbsp;</div><div id='cstat$i' class='stat'>$cdone/{$blog['total_comments']}</div>";
			$rows .= "<tr id='blog$i'><td class='blogtitle'>$blogtitle</td><td class='bloghost'>{$blog['host']}</td><td class='bar'>$pstat</td><td class='bar'>$cstat</td><td class='submit'><input type='submit' class='button' id='submit$i' value='$value' /><input type='hidden' name='blog' value='$i' /></td></tr>\n";
		}

		echo "<div class='wrap'><h2>$title</h2><noscript>$noscript</noscript><table cellpadding='5px'><thead><tr><td>$name</td><td>$url</td><td>$posts</td><td>$comments</td><td>$action</td></tr></thead>\n$rows</table></div>";
		echo "
		<script type='text/javascript'>
		/* <![CDATA[ */
			var strings = {cont:'$continue',stop:'$stop',stopping:'$stopping',authors:'$authors',nothing:'$nothing'};
			var blogs = {};
			function blog(i, title, mode, status){
				this.blog   = i;
				this.mode   = mode;
				this.title  = title;
				this.status = status;
				this.button = document.getElementById('submit'+this.blog);
			};
			blog.prototype = {
				start: function() {
					this.cont = true;
					this.kick();
					this.check();
				},
				kick: function() {
					++this.kicks;
					var i = this.blog;
					jQuery.post('admin.php?import=blogger&noheader=true',{blog:this.blog},function(text,result){blogs[i].kickd(text,result)});
				},
				check: function() {
					++this.checks;
					var i = this.blog;
					jQuery.post('admin.php?import=blogger&noheader=true&status=true',{blog:this.blog},function(text,result){blogs[i].checkd(text,result)});
				},
				kickd: function(text, result) {
					if ( result == 'error' ) {
						// TODO: exception handling
						if ( this.cont )
							setTimeout('blogs['+this.blog+'].kick()', 1000);
					} else {
						if ( text == 'done' ) {
							this.stop();
							this.done();
						} else if ( text == 'nothing' ) {
							this.stop();
							this.nothing();
						} else if ( text == 'continue' ) {
							this.kick();
						} else if ( this.mode = 'stopped' )
							jQuery(this.button).attr('value', strings.cont);
					}
					--this.kicks;
				},
				checkd: function(text, result) {
					if ( result == 'error' ) {
						// TODO: exception handling
					} else {
						eval('this.status='+text);
						jQuery('#pstat'+this.blog).empty().append(this.status.p1+'/'+this.status.p2);
						jQuery('#cstat'+this.blog).empty().append(this.status.c1+'/'+this.status.c2);
						this.update();
						if ( this.cont || this.kicks > 0 )
							setTimeout('blogs['+this.blog+'].check()', $interval);
					}
					--this.checks;
				},
				update: function() {
					jQuery('#pind'+this.blog).width(((this.status.p1>0&&this.status.p2>0)?(this.status.p1/this.status.p2*jQuery('#pind'+this.blog).parent().width()):1)+'px');
					jQuery('#cind'+this.blog).width(((this.status.c1>0&&this.status.c2>0)?(this.status.c1/this.status.c2*jQuery('#cind'+this.blog).parent().width()):1)+'px');
				},
				stop: function() {
					this.cont = false;
				},
				done: function() {
					this.mode = 'authors';
					jQuery(this.button).attr('value', strings.authors);
				},
				nothing: function() {
					this.mode = 'nothing';
					jQuery(this.button).remove();
					alert(strings.nothing);
				},
				getauthors: function() {
					if ( jQuery('div.wrap').length > 1 )
						jQuery('div.wrap').gt(0).remove();
					jQuery('div.wrap').empty().append('<h2>$authhead</h2><h3>' + this.title + '</h3>');
					jQuery('div.wrap').append('<p id=\"auth\">$loadauth</p>');
					jQuery('p#auth').load('index.php?import=blogger&noheader=true&authors=1',{blog:this.blog});
				},
				init: function() {
					this.update();
					var i = this.blog;
					jQuery(this.button).bind('click', function(){return blogs[i].click();});
					this.kicks = 0;
					this.checks = 0;
				},
				click: function() {
					if ( this.mode == 'init' || this.mode == 'stopped' || this.mode == 'posts' || this.mode == 'comments' ) {
						this.mode = 'started';
						this.start();
						jQuery(this.button).attr('value', strings.stop);
					} else if ( this.mode == 'started' ) {
						return false; // let it run...
						this.mode = 'stopped';
						this.stop();
						if ( this.checks > 0 || this.kicks > 0 ) {
							this.mode = 'stopping';
							jQuery(this.button).attr('value', strings.stopping);
						} else {
							jQuery(this.button).attr('value', strings.cont);
						}
					} else if ( this.mode == 'authors' ) {
						document.location = 'index.php?import=blogger&authors=1&blog='+this.blog;
						//this.mode = 'authors2';
						//this.getauthors();
					}
					return false;
				}
			};
			$init
			jQuery.each(blogs, function(i, me){me.init();});
		/* ]]> */
		</script>\n";
	}

	// Handy function for stopping the script after a number of seconds.
	function have_time() {
		global $importer_started;
		if ( time() - $importer_started > MAX_EXECUTION_TIME )
			die('continue');
		return true;
	}

	function get_total_results($type, $host) {
		$headers = array(
			"GET /feeds/$type/default?max-results=1&start-index=2 HTTP/1.0",
			"Host: $host",
			"Authorization: AuthSub token=\"$this->token\""
		);
		$request = join( "\r\n", $headers ) . "\r\n\r\n";
		$sock = $this->_get_blogger_sock( $host );
		if ( ! $sock ) return;
		$response = $this->_txrx( $sock, $request );
		$response = $this->parse_response( $response );
		$parser = xml_parser_create();
		xml_parse_into_struct($parser, $response['body'], $struct, $index);
		xml_parser_free($parser);
		$total_results = $struct[$index['OPENSEARCH:TOTALRESULTS'][0]]['value'];
		return (int) $total_results;
	}

	function import_blog($blogID) {
		global $importing_blog;
		$importing_blog = $blogID;

		if ( isset($_GET['authors']) )
			return print($this->get_author_form());

		header('Content-Type: text/plain');

		if ( isset($_GET['status']) )
			die($this->get_js_status());

		if ( isset($_GET['saveauthors']) )
			die($this->save_authors());

		$blog = $this->blogs[$blogID];
		$total_results = $this->get_total_results('posts', $blog['host']);
		$this->blogs[$importing_blog]['total_posts'] = $total_results;

		$start_index = $total_results - MAX_RESULTS + 1;

		if ( isset( $this->blogs[$importing_blog]['posts_start_index'] ) )
			$start_index = (int) $this->blogs[$importing_blog]['posts_start_index'];
		elseif ( $total_results > MAX_RESULTS )
			$start_index = $total_results - MAX_RESULTS + 1;
		else
			$start_index = 1;

		// This will be positive until we have finished importing posts
		if ( $start_index > 0 ) {
			// Grab all the posts
			$this->blogs[$importing_blog]['mode'] = 'posts';
			$query = "start-index=$start_index&max-results=" . MAX_RESULTS;
			do {
				$index = $struct = $entries = array();
				$headers = array(
					"GET /feeds/posts/default?$query HTTP/1.0",
					"Host: {$blog['host']}",
					"Authorization: AuthSub token=\"$this->token\""
				);
				$request = join( "\r\n", $headers ) . "\r\n\r\n";
				$sock = $this->_get_blogger_sock( $blog['host'] );
				if ( ! $sock ) return; // TODO: Error handling
				$response = $this->_txrx( $sock, $request );

				$response = $this->parse_response( $response );

				// Extract the entries and send for insertion
				preg_match_all( '/<entry[^>]*>.*?<\/entry>/s', $response['body'], $matches );
				if ( count( $matches[0] ) ) {
					$entries = array_reverse($matches[0]);
					foreach ( $entries as $entry ) {
						$entry = "<feed>$entry</feed>";
						$AtomParser = new AtomParser();
						$AtomParser->parse( $entry );
						$result = $this->import_post($AtomParser->entry);
						if ( is_wp_error( $result ) )
							return $result;
						unset($AtomParser);
					}
				} else break;

				// Get the 'previous' query string which we'll use on the next iteration
				$query = '';
				$links = preg_match_all('/<link([^>]*)>/', $response['body'], $matches);
				if ( count( $matches[1] ) )
					foreach ( $matches[1] as $match )
						if ( preg_match('/rel=.previous./', $match) )
							$query = html_entity_decode( preg_replace('/^.*href=[\'"].*\?(.+)[\'"].*$/', '$1', $match) );

				if ( $query ) {
					parse_str($query, $q);
					$this->blogs[$importing_blog]['posts_start_index'] = (int) $q['start-index'];
				} else
					$this->blogs[$importing_blog]['posts_start_index'] = 0;
				$this->save_vars();
			} while ( !empty( $query ) && $this->have_time() );
		}

		$total_results = $this->get_total_results( 'comments', $blog['host'] );
		$this->blogs[$importing_blog]['total_comments'] = $total_results;

		if ( isset( $this->blogs[$importing_blog]['comments_start_index'] ) )
			$start_index = (int) $this->blogs[$importing_blog]['comments_start_index'];
		elseif ( $total_results > MAX_RESULTS )
			$start_index = $total_results - MAX_RESULTS + 1;
		else
			$start_index = 1;

		if ( $start_index > 0 ) {
			// Grab all the comments
			$this->blogs[$importing_blog]['mode'] = 'comments';
			$query = "start-index=$start_index&max-results=" . MAX_RESULTS;
			do {
				$index = $struct = $entries = array();
				$headers = array(
					"GET /feeds/comments/default?$query HTTP/1.0",
					"Host: {$blog['host']}",
					"Authorization: AuthSub token=\"$this->token\""
				);
				$request = join( "\r\n", $headers ) . "\r\n\r\n";
				$sock = $this->_get_blogger_sock( $blog['host'] );
				if ( ! $sock ) return; // TODO: Error handling
				$response = $this->_txrx( $sock, $request );

				$response = $this->parse_response( $response );

				// Extract the comments and send for insertion
				preg_match_all( '/<entry[^>]*>.*?<\/entry>/s', $response['body'], $matches );
				if ( count( $matches[0] ) ) {
					$entries = array_reverse( $matches[0] );
					foreach ( $entries as $entry ) {
						$entry = "<feed>$entry</feed>";
						$AtomParser = new AtomParser();
						$AtomParser->parse( $entry );
						$this->import_comment($AtomParser->entry);
						unset($AtomParser);
					}
				}

				// Get the 'previous' query string which we'll use on the next iteration
				$query = '';
				$links = preg_match_all('/<link([^>]*)>/', $response['body'], $matches);
				if ( count( $matches[1] ) )
					foreach ( $matches[1] as $match )
						if ( preg_match('/rel=.previous./', $match) )
							$query = html_entity_decode( preg_replace('/^.*href=[\'"].*\?(.+)[\'"].*$/', '$1', $match) );

				parse_str($query, $q);

				$this->blogs[$importing_blog]['comments_start_index'] = (int) $q['start-index'];
				$this->save_vars();
			} while ( !empty( $query ) && $this->have_time() );
		}
		$this->blogs[$importing_blog]['mode'] = 'authors';
		$this->save_vars();
		if ( !$this->blogs[$importing_blog]['posts_done'] && !$this->blogs[$importing_blog]['comments_done'] )
			die('nothing');
		do_action('import_done', 'blogger');
		die('done');
	}

	function convert_date( $date ) {
	    preg_match('#([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:\.[0-9]+)?(Z|[\+|\-][0-9]{2,4}){0,1}#', $date, $date_bits);
	    $offset = iso8601_timezone_to_offset( $date_bits[7] );
		$timestamp = gmmktime($date_bits[4], $date_bits[5], $date_bits[6], $date_bits[2], $date_bits[3], $date_bits[1]);
		$timestamp -= $offset; // Convert from Blogger local time to GMT
		$timestamp += get_option('gmt_offset') * 3600; // Convert from GMT to WP local time
		return gmdate('Y-m-d H:i:s', $timestamp);
	}

	function no_apos( $string ) {
		return str_replace( '&apos;', "'", $string);
	}

	function min_whitespace( $string ) {
		return preg_replace( '|\s+|', ' ', $string );
	}

	function import_post( $entry ) {
		global $importing_blog;

		// The old permalink is all Blogger gives us to link comments to their posts.
		if ( isset( $entry->draft ) )
			$rel = 'self';
		else
			$rel = 'alternate';
		foreach ( $entry->links as $link ) {
			if ( $link['rel'] == $rel ) {
				$parts = parse_url( $link['href'] );
				$entry->old_permalink = $parts['path'];
				break;
			}
		}

		$post_date    = $this->convert_date( $entry->published );
		$post_content = trim( addslashes( $this->no_apos( html_entity_decode( $entry->content ) ) ) );
		$post_title   = trim( addslashes( $this->no_apos( $this->min_whitespace( $entry->title ) ) ) );
		$post_status  = isset( $entry->draft ) ? 'draft' : 'publish';

		// Clean up content
		$post_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $post_content);
		$post_content = str_replace('<br>', '<br />', $post_content);
		$post_content = str_replace('<hr>', '<hr />', $post_content);

		// Checks for duplicates
		if ( isset( $this->blogs[$importing_blog]['posts'][$entry->old_permalink] ) ) {
			++$this->blogs[$importing_blog]['posts_skipped'];
		} elseif ( $post_id = post_exists( $post_title, $post_content, $post_date ) ) {
			$this->blogs[$importing_blog]['posts'][$entry->old_permalink] = $post_id;
			++$this->blogs[$importing_blog]['posts_skipped'];
		} else {
			$post = compact('post_date', 'post_content', 'post_title', 'post_status');

			$post_id = wp_insert_post($post);
			if ( is_wp_error( $post_id ) )
				return $post_id;

			wp_create_categories( array_map( 'addslashes', $entry->categories ), $post_id );

			$author = $this->no_apos( strip_tags( $entry->author ) );

			add_post_meta( $post_id, 'blogger_blog', $this->blogs[$importing_blog]['host'], true );
			add_post_meta( $post_id, 'blogger_author', $author, true );
			add_post_meta( $post_id, 'blogger_permalink', $entry->old_permalink, true );

			$this->blogs[$importing_blog]['posts'][$entry->old_permalink] = $post_id;
			++$this->blogs[$importing_blog]['posts_done'];
		}
		$this->save_vars();
		return;
	}

	function import_comment( $entry ) {
		global $importing_blog;

		// Drop the #fragment and we have the comment's old post permalink.
		foreach ( $entry->links as $link ) {
			if ( $link['rel'] == 'alternate' ) {
				$parts = parse_url( $link['href'] );
				$entry->old_permalink = $parts['fragment'];
				$entry->old_post_permalink = $parts['path'];
				break;
			}
		}

		$comment_post_ID = (int) $this->blogs[$importing_blog]['posts'][$entry->old_post_permalink];
		preg_match('#<name>(.+?)</name>.*(?:\<uri>(.+?)</uri>)?#', $entry->author, $matches);
		$comment_author  = addslashes( $this->no_apos( strip_tags( (string) $matches[1] ) ) );
		$comment_author_url = addslashes( $this->no_apos( strip_tags( (string) $matches[2] ) ) );
		$comment_date    = $this->convert_date( $entry->updated );
		$comment_content = addslashes( $this->no_apos( html_entity_decode( $entry->content ) ) );

		// Clean up content
		$comment_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $comment_content);
		$comment_content = str_replace('<br>', '<br />', $comment_content);
		$comment_content = str_replace('<hr>', '<hr />', $comment_content);

		// Checks for duplicates
		if (
			isset( $this->blogs[$importing_blog]['comments'][$entry->old_permalink] ) ||
			comment_exists( $comment_author, $comment_date )
		) {
			++$this->blogs[$importing_blog]['comments_skipped'];
		} else {
			$comment = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_date', 'comment_content');

			$comment_id = wp_insert_comment($comment);

			$this->blogs[$importing_blog]['comments'][$entry->old_permalink] = $comment_id;

			++$this->blogs[$importing_blog]['comments_done'];
		}
		$this->save_vars();
	}

	function get_js_status($blog = false) {
		global $importing_blog;
		if ( $blog === false )
			$blog = $this->blogs[$importing_blog];
		else
			$blog = $this->blogs[$blog];
		$p1 = isset( $blog['posts_done'] ) ? (int) $blog['posts_done'] : 0;
		$p2 = isset( $blog['total_posts'] ) ? (int) $blog['total_posts'] : 0;
		$c1 = isset( $blog['comments_done'] ) ? (int) $blog['comments_done'] : 0;
		$c2 = isset( $blog['total_comments'] ) ? (int) $blog['total_comments'] : 0;
		return "{p1:$p1,p2:$p2,c1:$c1,c2:$c2}";
	}

	function get_author_form($blog = false) {
		global $importing_blog, $wpdb, $current_user;
		if ( $blog === false )
			$blog = & $this->blogs[$importing_blog];
		else
			$blog = & $this->blogs[$blog];

		if ( !isset( $blog['authors'] ) ) {
			$post_ids = array_values($blog['posts']);
			$authors = (array) $wpdb->get_col("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = 'blogger_author' AND post_id IN (" . join( ',', $post_ids ) . ")");
			$blog['authors'] = array_map(null, $authors, array_fill(0, count($authors), $current_user->ID));
			$this->save_vars();
		}

		$directions = __('All posts were imported with the current user as author. Use this form to move each Blogger user\'s posts to a different WordPress user. You may <a href="users.php">add users</a> and then return to this page and complete the user mapping. This form may be used as many times as you like until you activate the "Restart" function below.');
		$heading = __('Author mapping');
		$blogtitle = "{$blog['title']} ({$blog['host']})";
		$mapthis = __('Blogger username');
		$tothis = __('WordPress login');
		$submit = js_escape( __('Save Changes') );

		foreach ( $blog['authors'] as $i => $author )
			$rows .= "<tr><td><label for='authors[$i]'>{$author[0]}</label></td><td><select name='authors[$i]' id='authors[$i]'>" . $this->get_user_options($author[1]) . "</select></td></tr>";

		return "<div class='wrap'><h2>$heading</h2><h3>$blogtitle</h3><p>$directions</p><form action='index.php?import=blogger&amp;noheader=true&saveauthors=1' method='post'><input type='hidden' name='blog' value='$importing_blog' /><table cellpadding='5'><thead><td>$mapthis</td><td>$tothis</td></thead>$rows<tr><td></td><td class='submit'><input type='submit' class='button authorsubmit' value='$submit' /></td></tr></table></form></div>";
	}

	function get_user_options($current) {
		global $importer_users;
		if ( ! isset( $importer_users ) )
			$importer_users = (array) get_users_of_blog();

		foreach ( $importer_users as $user ) {
			$sel = ( $user->user_id == $current ) ? " selected='selected'" : '';
			$options .= "<option value='$user->user_id'$sel>$user->display_name</option>";
		}

		return $options;
	}

	function save_authors() {
		global $importing_blog, $wpdb;
		$authors = (array) $_POST['authors'];

		$host = $this->blogs[$importing_blog]['host'];

		// Get an array of posts => authors
		$post_ids = (array) $wpdb->get_col( $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'blogger_blog' AND meta_value = %s", $host) );
		$post_ids = join( ',', $post_ids );
		$results = (array) $wpdb->get_results("SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = 'blogger_author' AND post_id IN ($post_ids)");
		foreach ( $results as $row )
			$authors_posts[$row->post_id] = $row->meta_value;

		foreach ( $authors as $author => $user_id ) {
			$user_id = (int) $user_id;

			// Skip authors that haven't been changed
			if ( $user_id == $this->blogs[$importing_blog]['authors'][$author][1] )
				continue;

			// Get a list of the selected author's posts
			$post_ids = (array) array_keys( $authors_posts, $this->blogs[$importing_blog]['authors'][$author][0] );
			$post_ids = join( ',', $post_ids);

			$wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_author = %d WHERE id IN ($post_ids)", $user_id) );
			$this->blogs[$importing_blog]['authors'][$author][1] = $user_id;
		}
		$this->save_vars();

		wp_redirect('edit.php');
	}

	function _get_auth_sock() {
		// Connect to https://www.google.com
		if ( !$sock = @ fsockopen('ssl://www.google.com', 443, $errno, $errstr) ) {
			$this->uh_oh(
				__('Could not connect to https://www.google.com'),
				__('There was a problem opening a secure connection to Google. This is what went wrong:'),
				"$errstr ($errno)"
			);
			return false;
		}
		return $sock;
	}

	function _get_blogger_sock($host = 'www2.blogger.com') {
		if ( !$sock = @ fsockopen($host, 80, $errno, $errstr) ) {
			$this->uh_oh(
				sprintf( __('Could not connect to %s'), $host ),
				__('There was a problem opening a connection to Blogger. This is what went wrong:'),
				"$errstr ($errno)"
			);
			return false;
		}
		return $sock;
	}

	function _txrx( $sock, $request ) {
		fwrite( $sock, $request );
		while ( ! feof( $sock ) )
			$response .= @ fread ( $sock, 8192 );
		fclose( $sock );
		return $response;
	}

	function revoke($token) {
		$headers = array(
			"GET /accounts/AuthSubRevokeToken HTTP/1.0",
			"Authorization: AuthSub token=\"$token\""
		);
		$request = join( "\r\n", $headers ) . "\r\n\r\n";
		$sock = $this->_get_auth_sock( );
		if ( ! $sock ) return false;
		$this->_txrx( $sock, $request );
	}

	function restart() {
		global $wpdb;
		$options = get_option( 'blogger_importer' );

		if ( isset( $options['token'] ) )
			$this->revoke( $options['token'] );

		delete_option('blogger_importer');
		$wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_key = 'blogger_author'");
		wp_redirect('?import=blogger');
	}

	// Returns associative array of code, header, cookies, body. Based on code from php.net.
	function parse_response($this_response) {
		// Split response into header and body sections
		list($response_headers, $response_body) = explode("\r\n\r\n", $this_response, 2);
		$response_header_lines = explode("\r\n", $response_headers);

		// First line of headers is the HTTP response code
		$http_response_line = array_shift($response_header_lines);
		if(preg_match('@^HTTP/[0-9]\.[0-9] ([0-9]{3})@',$http_response_line, $matches)) { $response_code = $matches[1]; }

		// put the rest of the headers in an array
		$response_header_array = array();
		foreach($response_header_lines as $header_line) {
			list($header,$value) = explode(': ', $header_line, 2);
			$response_header_array[$header] .= $value."\n";
		}

		$cookie_array = array();
		$cookies = explode("\n", $response_header_array["Set-Cookie"]);
		foreach($cookies as $this_cookie) { array_push($cookie_array, "Cookie: ".$this_cookie); }

		return array("code" => $response_code, "header" => $response_header_array, "cookies" => $cookie_array, "body" => $response_body);
	}

	// Step 9: Congratulate the user
	function congrats() {
		$blog = (int) $_GET['blog'];
		echo '<h1>'.__('Congratulations!').'</h1><p>'.__('Now that you have imported your Blogger blog into WordPress, what are you going to do? Here are some suggestions:').'</p><ul><li>'.__('That was hard work! Take a break.').'</li>';
		if ( count($this->import['blogs']) > 1 )
			echo '<li>'.__('In case you haven\'t done it already, you can import the posts from your other blogs:'). $this->show_blogs() . '</li>';
		if ( $n = count($this->import['blogs'][$blog]['newusers']) )
			echo '<li>'.sprintf(__('Go to <a href="%s" target="%s">Authors &amp; Users</a>, where you can modify the new user(s) or delete them. If you want to make all of the imported posts yours, you will be given that option when you delete the new authors.'), 'users.php', '_parent').'</li>';
		echo '<li>'.__('For security, click the link below to reset this importer.').'</li>';
		echo '</ul>';
	}

	// Figures out what to do, then does it.
	function start() {
		if ( isset($_POST['restart']) )
			$this->restart();

		$options = get_option('blogger_importer');

		if ( is_array($options) )
			foreach ( $options as $key => $value )
				$this->$key = $value;

		if ( isset( $_REQUEST['blog'] ) ) {
			$blog = is_array($_REQUEST['blog']) ? array_shift( $keys = array_keys( $_REQUEST['blog'] ) ) : $_REQUEST['blog'];
			$blog = (int) $blog;
			$result = $this->import_blog( $blog );
			if ( is_wp_error( $result ) )
				echo $result->get_error_message();
		} elseif ( isset($_GET['token']) )
			$this->auth();
		elseif ( isset($this->token) && $this->token_is_valid() )
			$this->show_blogs();
		else
			$this->greet();

		$saved = $this->save_vars();

		if ( $saved && !isset($_GET['noheader']) ) {
			$restart = __('Restart');
			$message = __('We have saved some information about your Blogger account in your WordPress database. Clearing this information will allow you to start over. Restarting will not affect any posts you have already imported. If you attempt to re-import a blog, duplicate posts and comments will be skipped.');
			$submit = __('Clear account information');
			echo "<div class='wrap'><h2>$restart</h2><p>$message</p><form method='post' action='?import=blogger&amp;noheader=true'><p class='submit' style='text-align:left;'><input type='submit' class='button' value='$submit' name='restart' /></p></form></div>";
		}
	}

	function save_vars() {
		$vars = get_object_vars($this);
		update_option( 'blogger_importer', $vars );

		return !empty($vars);
	}

	function admin_head() {
?>
<style type="text/css">
td { text-align: center; line-height: 2em;}
thead td { font-weight: bold; }
.bar {
	width: 200px;
	text-align: left;
	line-height: 2em;
	padding: 0px;
}
.ind {
	position: absolute;
	background-color: #83B4D8;
	width: 1px;
	z-index: 9;
}
.stat {
	z-index: 10;
	position: relative;
	text-align: center;
}
</style>
<?php
	}

	function Blogger_Import() {
		global $importer_started;
		$importer_started = time();
		if ( isset( $_GET['import'] ) && $_GET['import'] == 'blogger' ) {
			wp_enqueue_script('jquery');
			add_action('admin_head', array(&$this, 'admin_head'));
		}
	}
}

$blogger_import = new Blogger_Import();

register_importer('blogger', __('Blogger'), __('Import posts, comments, and users from a Blogger blog.'), array ($blogger_import, 'start'));

class AtomEntry {
	var $links = array();
	var $categories = array();
}

class AtomParser {

	var $ATOM_CONTENT_ELEMENTS = array('content','summary','title','subtitle','rights');
	var $ATOM_SIMPLE_ELEMENTS = array('id','updated','published','draft','author');

	var $depth = 0;
	var $indent = 2;
	var $in_content;
	var $ns_contexts = array();
	var $ns_decls = array();
	var $is_xhtml = false;
	var $skipped_div = false;

	var $entry;

	function AtomParser() {

		$this->entry = new AtomEntry();
		$this->map_attrs_func = create_function('$k,$v', 'return "$k=\"$v\"";');
		$this->map_xmlns_func = create_function('$p,$n', '$xd = "xmlns"; if(strlen($n[0])>0) $xd .= ":{$n[0]}"; return "{$xd}=\"{$n[1]}\"";');
	}

	function parse($xml) {

		global $app_logging;
		array_unshift($this->ns_contexts, array());

		$parser = xml_parser_create_ns();
		xml_set_object($parser, $this);
		xml_set_element_handler($parser, "start_element", "end_element");
		xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
		xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,0);
		xml_set_character_data_handler($parser, "cdata");
		xml_set_default_handler($parser, "_default");
		xml_set_start_namespace_decl_handler($parser, "start_ns");
		xml_set_end_namespace_decl_handler($parser, "end_ns");

		$contents = "";

		xml_parse($parser, $xml);

		xml_parser_free($parser);

		return true;
	}

	function start_element($parser, $name, $attrs) {

		$tag = array_pop(split(":", $name));

		array_unshift($this->ns_contexts, $this->ns_decls);

		$this->depth++;

		if(!empty($this->in_content)) {
			$attrs_prefix = array();

			// resolve prefixes for attributes
			foreach($attrs as $key => $value) {
				$attrs_prefix[$this->ns_to_prefix($key)] = $this->xml_escape($value);
			}
			$attrs_str = join(' ', array_map($this->map_attrs_func, array_keys($attrs_prefix), array_values($attrs_prefix)));
			if(strlen($attrs_str) > 0) {
				$attrs_str = " " . $attrs_str;
			}

			$xmlns_str = join(' ', array_map($this->map_xmlns_func, array_keys($this->ns_contexts[0]), array_values($this->ns_contexts[0])));
			if(strlen($xmlns_str) > 0) {
				$xmlns_str = " " . $xmlns_str;
			}

			// handle self-closing tags (case: a new child found right-away, no text node)
			if(count($this->in_content) == 2) {
				array_push($this->in_content, ">");
			}

			array_push($this->in_content, "<". $this->ns_to_prefix($name) ."{$xmlns_str}{$attrs_str}");
		} else if(in_array($tag, $this->ATOM_CONTENT_ELEMENTS) || in_array($tag, $this->ATOM_SIMPLE_ELEMENTS)) {
			$this->in_content = array();
			$this->is_xhtml = $attrs['type'] == 'xhtml';
			array_push($this->in_content, array($tag,$this->depth));
		} else if($tag == 'link') {
			array_push($this->entry->links, $attrs);
		} else if($tag == 'category') {
			array_push($this->entry->categories, $attrs['term']);
		}

		$this->ns_decls = array();
	}

	function end_element($parser, $name) {

		$tag = array_pop(split(":", $name));

		if(!empty($this->in_content)) {
			if($this->in_content[0][0] == $tag &&
			$this->in_content[0][1] == $this->depth) {
				array_shift($this->in_content);
				if($this->is_xhtml) {
					$this->in_content = array_slice($this->in_content, 2, count($this->in_content)-3);
				}
				$this->entry->$tag = join('',$this->in_content);
				$this->in_content = array();
			} else {
				$endtag = $this->ns_to_prefix($name);
				if (strpos($this->in_content[count($this->in_content)-1], '<' . $endtag) !== false) {
					array_push($this->in_content, "/>");
				} else {
					array_push($this->in_content, "</$endtag>");
				}
			}
		}

		array_shift($this->ns_contexts);

		#print str_repeat(" ", $this->depth * $this->indent) . "end_element('$name')" ."\n";

		$this->depth--;
	}

	function start_ns($parser, $prefix, $uri) {
		#print str_repeat(" ", $this->depth * $this->indent) . "starting: " . $prefix . ":" . $uri . "\n";
		array_push($this->ns_decls, array($prefix,$uri));
	}

	function end_ns($parser, $prefix) {
		#print str_repeat(" ", $this->depth * $this->indent) . "ending: #" . $prefix . "#\n";
	}

	function cdata($parser, $data) {
		#print str_repeat(" ", $this->depth * $this->indent) . "data: #" . $data . "#\n";
		if(!empty($this->in_content)) {
			// handle self-closing tags (case: text node found, need to close element started)
			if (strpos($this->in_content[count($this->in_content)-1], '<') !== false) {
				array_push($this->in_content, ">");
			}
			array_push($this->in_content, $this->xml_escape($data));
		}
	}

	function _default($parser, $data) {
		# when does this gets called?
	}


	function ns_to_prefix($qname) {
		$components = split(":", $qname);
		$name = array_pop($components);

		if(!empty($components)) {
			$ns = join(":",$components);
			foreach($this->ns_contexts as $context) {
				foreach($context as $mapping) {
					if($mapping[1] == $ns && strlen($mapping[0]) > 0) {
						return "$mapping[0]:$name";
					}
				}
			}
		}
		return $name;
	}

	function xml_escape($string)
	{
			 return str_replace(array('&','"',"'",'<','>'),
				array('&amp;','&quot;','&apos;','&lt;','&gt;'),
				$string );
	}
}

?>
                                                                                                                                                                                                                                                                                                                                     wp-admin/import/blogware.php                                                                        0000755 0023422 0004734 00000014701 11135660264 017155  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Blogware XML Importer
 *
 * @package WordPress
 * @subpackage Importer
 * @author Shayne Sweeney
 * @link http://www.theshayne.com/
 */

/**
 * Blogware XML Importer class
 *
 * Extract posts from Blogware XML export file into your blog.
 *
 * @since unknown
 */
class BW_Import {

	var $file;

	function header() {
		echo '<div class="wrap">';
		screen_icon();
		echo '<h2>'.__('Import Blogware').'</h2>';
	}

	function footer() {
		echo '</div>';
	}

	function unhtmlentities($string) { // From php.net for < 4.3 compat
		$trans_tbl = get_html_translation_table(HTML_ENTITIES);
		$trans_tbl = array_flip($trans_tbl);
		return strtr($string, $trans_tbl);
	}

	function greet() {
		echo '<div class="narrow">';
		echo '<p>'.__('Howdy! This importer allows you to extract posts from Blogware XML export file into your blog.  Pick a Blogware file to upload and click Import.').'</p>';
		wp_import_upload_form("admin.php?import=blogware&amp;step=1");
		echo '</div>';
	}

	function import_posts() {
		global $wpdb, $current_user;

		set_magic_quotes_runtime(0);
		$importdata = file($this->file); // Read the file into an array
		$importdata = implode('', $importdata); // squish it
		$importdata = str_replace(array ("\r\n", "\r"), "\n", $importdata);

		preg_match_all('|(<item[^>]+>(.*?)</item>)|is', $importdata, $posts);
		$posts = $posts[1];
		unset($importdata);
		echo '<ol>';
		foreach ($posts as $post) {
			flush();
			preg_match('|<item type=\"(.*?)\">|is', $post, $post_type);
			$post_type = $post_type[1];
			if($post_type == "photo") {
				preg_match('|<photoFilename>(.*?)</photoFilename>|is', $post, $post_title);
			} else {
				preg_match('|<title>(.*?)</title>|is', $post, $post_title);
			}
			$post_title = $wpdb->escape(trim($post_title[1]));

			preg_match('|<pubDate>(.*?)</pubDate>|is', $post, $post_date);
			$post_date = strtotime($post_date[1]);
			$post_date = gmdate('Y-m-d H:i:s', $post_date);

			preg_match_all('|<category>(.*?)</category>|is', $post, $categories);
			$categories = $categories[1];

			$cat_index = 0;
			foreach ($categories as $category) {
				$categories[$cat_index] = $wpdb->escape($this->unhtmlentities($category));
				$cat_index++;
			}

			if(strcasecmp($post_type, "photo") === 0) {
				preg_match('|<sizedPhotoUrl>(.*?)</sizedPhotoUrl>|is', $post, $post_content);
				$post_content = '<img src="'.trim($post_content[1]).'" />';
				$post_content = $this->unhtmlentities($post_content);
			} else {
				preg_match('|<body>(.*?)</body>|is', $post, $post_content);
				$post_content = str_replace(array ('<![CDATA[', ']]>'), '', trim($post_content[1]));
				$post_content = $this->unhtmlentities($post_content);
			}

			// Clean up content
			$post_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $post_content);
			$post_content = str_replace('<br>', '<br />', $post_content);
			$post_content = str_replace('<hr>', '<hr />', $post_content);
			$post_content = $wpdb->escape($post_content);

			$post_author = $current_user->ID;
			preg_match('|<postStatus>(.*?)</postStatus>|is', $post, $post_status);
			$post_status = trim($post_status[1]);

			echo '<li>';
			if ($post_id = post_exists($post_title, $post_content, $post_date)) {
				printf(__('Post <em>%s</em> already exists.'), stripslashes($post_title));
			} else {
				printf(__('Importing post <em>%s</em>...'), stripslashes($post_title));
				$postdata = compact('post_author', 'post_date', 'post_content', 'post_title', 'post_status');
				$post_id = wp_insert_post($postdata);
				if ( is_wp_error( $post_id ) ) {
					return $post_id;
				}
				if (!$post_id) {
					_e("Couldn't get post ID");
					echo '</li>';
					break;
				}
				if(0 != count($categories))
					wp_create_categories($categories, $post_id);
			}

			preg_match_all('|<comment>(.*?)</comment>|is', $post, $comments);
			$comments = $comments[1];

			if ( $comments ) {
				$comment_post_ID = (int) $post_id;
				$num_comments = 0;
				foreach ($comments as $comment) {
					preg_match('|<body>(.*?)</body>|is', $comment, $comment_content);
					$comment_content = str_replace(array ('<![CDATA[', ']]>'), '', trim($comment_content[1]));
					$comment_content = $this->unhtmlentities($comment_content);

					// Clean up content
					$comment_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $comment_content);
					$comment_content = str_replace('<br>', '<br />', $comment_content);
					$comment_content = str_replace('<hr>', '<hr />', $comment_content);
					$comment_content = $wpdb->escape($comment_content);

					preg_match('|<pubDate>(.*?)</pubDate>|is', $comment, $comment_date);
					$comment_date = trim($comment_date[1]);
					$comment_date = date('Y-m-d H:i:s', strtotime($comment_date));

					preg_match('|<author>(.*?)</author>|is', $comment, $comment_author);
					$comment_author = $wpdb->escape(trim($comment_author[1]));

					$comment_author_email = NULL;

					$comment_approved = 1;
					// Check if it's already there
					if (!comment_exists($comment_author, $comment_date)) {
						$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_date', 'comment_content', 'comment_approved');
						$commentdata = wp_filter_comment($commentdata);
						wp_insert_comment($commentdata);
						$num_comments++;
					}
				}
			}
			if ( $num_comments ) {
				echo ' ';
				printf( __ngettext('%s comment', '%s comments', $num_comments), $num_comments );
			}
			echo '</li>';
			flush();
			ob_flush();
		}
		echo '</ol>';
	}

	function import() {
		$file = wp_import_handle_upload();
		if ( isset($file['error']) ) {
			echo $file['error'];
			return;
		}

		$this->file = $file['file'];
		$result = $this->import_posts();
		if ( is_wp_error( $result ) )
			return $result;
		wp_import_cleanup($file['id']);
		do_action('import_done', 'blogware');
		echo '<h3>';
		printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home'));
		echo '</h3>';
	}

	function dispatch() {
		if (empty ($_GET['step']))
			$step = 0;
		else
			$step = (int) $_GET['step'];

		$this->header();

		switch ($step) {
			case 0 :
				$this->greet();
				break;
			case 1 :
				$result = $this->import();
				if ( is_wp_error( $result ) )
					$result->get_error_message();
				break;
		}

		$this->footer();
	}

	function BW_Import() {
		// Nothing.
	}
}

$blogware_import = new BW_Import();

register_importer('blogware', __('Blogware'), __('Import posts from Blogware.'), array ($blogware_import, 'dispatch'));
?>
                                                               wp-admin/import/btt.php                                                                             0000755 0023422 0004734 00000007276 11113252136 016144  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * BunnyTags Plugin Tag Importer
 *
 * @package WordPress
 * @subpackage Importer
 */

/**
 * BunnyTags Plugin tag converter
 *
 * This will process the BunnyTags plugin tags and convert them to the WordPress
 * 2.3 taxonomy.
 *
 * @since unknown
 */
class BunnyTags_Import {

	function header() {
		echo '<div class="wrap">';
		screen_icon();
		echo '<h2>'.__('Import Bunny&#8217;s Technorati Tags').'</h2>';
		echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'<br /><br /></p>';
	}

	function footer() {
		echo '</div>';
	}

	function greet() {
		echo '<div class="narrow">';
		echo '<p>'.__('Howdy! This imports tags from Bunny&#8217;s Technorati Tags into WordPress tags.').'</p>';
		echo '<p>'.__('This is suitable for Bunny&#8217;s Technorati Tags version 0.6.').'</p>';
		echo '<p><strong>'.__('All existing Bunny&#8217;s Technorati Tags will be removed after import.').'</strong></p>';
		echo '<p><strong>'.__('Don&#8217;t be stupid - backup your database before proceeding!').'</strong></p>';
		echo '<form action="admin.php?import=btt&amp;step=1" method="post">';
		wp_nonce_field('import-btt');
		echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Import Tags').'" /></p>';
		echo '</form>';
		echo '</div>';
	}

	function dispatch() {
		if ( empty($_GET['step']) )
			$step = 0;
		else
			$step = absint($_GET['step']);

		// load the header
		$this->header();

		switch ( $step ) {
			case 0 :
				$this->greet();
				break;
			case 1 :
				check_admin_referer('import-btt');
				$this->check_post_keyword( true );
				break;
			case 2 :
				check_admin_referer('import-btt');
				$this->check_post_keyword( false );
				break;
			case 3:
				$this->done();
				break;
		}

		// load the footer
		$this->footer();
	}

	function check_post_keyword($precheck = true) {
		global $wpdb;

		echo '<div class="narrow">';
		echo '<p><h3>'.__('Reading Bunny&#8217;s Technorati Tags&#8230;').'</h3></p>';

		// import Bunny's Keywords tags
		$metakeys = $wpdb->get_results("SELECT post_id, meta_id, meta_key, meta_value FROM $wpdb->postmeta WHERE $wpdb->postmeta.meta_key = 'tags'");
		if ( !is_array($metakeys)) {
			echo '<p>' . __('No Tags Found!') . '</p>';
			return false;
		} else {
			$count = count($metakeys);
			echo '<p>' . sprintf( __ngettext('Done! <strong>%s</strong> post with tags were read.', 'Done! <strong>%s</strong> posts with tags were read.', $count), $count ) . '<br /></p>';
			echo '<ul>';
			foreach ( $metakeys as $post_meta ) {
				if ( $post_meta->meta_value != '' ) {
					$post_keys = explode(' ', $post_meta->meta_value);
					foreach ( $post_keys as $keyword ) {
						$keyword = addslashes(trim(str_replace('+',' ',$keyword)));
						if ( '' != $keyword ) {
							echo '<li>' . $post_meta->post_id . '&nbsp;-&nbsp;' . $keyword . '</li>';
							if ( !$precheck )
								wp_add_post_tags($post_meta->post_id, $keyword);
						}
					}
				}
				if ( !$precheck )
					delete_post_meta($post_meta->post_id, 'tags');
			}
			echo '</ul>';
		}

		echo '<form action="admin.php?import=btt&amp;step='.($precheck? 2:3).'" method="post">';
		wp_nonce_field('import-btt');
		echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Next').'" /></p>';
		echo '</form>';
		echo '</div>';
	}

	function done() {
		echo '<div class="narrow">';
		echo '<p><h3>'.__('Import Complete!').'</h3></p>';
		echo '</div>';
	}

	function BunnyTags_Import() {
	}

}

// create the import object
$btt_import = new BunnyTags_Import();

// add it to the import page!
register_importer('btt', 'Bunny&#8217;s Technorati Tags', __('Import Bunny&#8217;s Technorati Tags into WordPress tags.'), array($btt_import, 'dispatch'));

?>
                                                                                                                                                                                                                                                                                                                                  wp-admin/import/dotclear.php                                                                        0000755 0023422 0004734 00000060336 11113651624 017151  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * DotClear Importer
 *
 * @package WordPress
 * @subpackage Importer
 * @author Thomas Quinot
 * @link http://thomas.quinot.org/
 */

/**
	Add These Functions to make our lives easier
**/

if(!function_exists('get_comment_count'))
{
	/**
	 * Get the comment count for posts.
	 *
	 * @package WordPress
	 * @subpackage Dotclear_Import
	 *
	 * @param int $post_ID Post ID
	 * @return int
	 */
	function get_comment_count($post_ID)
	{
		global $wpdb;
		return $wpdb->get_var( $wpdb->prepare("SELECT count(*) FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) );
	}
}

if(!function_exists('link_exists'))
{
	/**
	 * Check whether link already exists.
	 *
	 * @package WordPress
	 * @subpackage Dotclear_Import
	 *
	 * @param string $linkname
	 * @return int
	 */
	function link_exists($linkname)
	{
		global $wpdb;
		return $wpdb->get_var( $wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_name = %s", $linkname) );
	}
}

/*
 Identify UTF-8 text
 Taken from http://www.php.net/manual/fr/function.mb-detect-encoding.php#50087
*/
//
//    utf8 encoding validation developed based on Wikipedia entry at:
//    http://en.wikipedia.org/wiki/UTF-8
//
//    Implemented as a recursive descent parser based on a simple state machine
//    copyright 2005 Maarten Meijer
//
//    This cries out for a C-implementation to be included in PHP core
//

/**
 * @package WordPress
 * @subpackage Dotclear_Import
 *
 * @param string $char
 * @return string
 */
function valid_1byte($char) {
	if(!is_int($char)) return false;
		return ($char & 0x80) == 0x00;
}

/**
 * @package WordPress
 * @subpackage Dotclear_Import
 *
 * @param string $char
 * @return string
 */
function valid_2byte($char) {
	if(!is_int($char)) return false;
		return ($char & 0xE0) == 0xC0;
}

/**
 * @package WordPress
 * @subpackage Dotclear_Import
 *
 * @param string $char
 * @return string
 */
function valid_3byte($char) {
	if(!is_int($char)) return false;
		return ($char & 0xF0) == 0xE0;
}

/**
 * @package WordPress
 * @subpackage Dotclear_Import
 *
 * @param string $char
 * @return string
 */
function valid_4byte($char) {
	if(!is_int($char)) return false;
		return ($char & 0xF8) == 0xF0;
}

/**
 * @package WordPress
 * @subpackage Dotclear_Import
 *
 * @param string $char
 * @return string
 */
function valid_nextbyte($char) {
	if(!is_int($char)) return false;
		return ($char & 0xC0) == 0x80;
}

/**
 * @package WordPress
 * @subpackage Dotclear_Import
 *
 * @param string $string
 * @return string
 */
function valid_utf8($string) {
	$len = strlen($string);
	$i = 0;
	while( $i < $len ) {
		$char = ord(substr($string, $i++, 1));
		if(valid_1byte($char)) {    // continue
			continue;
		} else if(valid_2byte($char)) { // check 1 byte
			if(!valid_nextbyte(ord(substr($string, $i++, 1))))
				return false;
		} else if(valid_3byte($char)) { // check 2 bytes
			if(!valid_nextbyte(ord(substr($string, $i++, 1))))
				return false;
			if(!valid_nextbyte(ord(substr($string, $i++, 1))))
				return false;
		} else if(valid_4byte($char)) { // check 3 bytes
			if(!valid_nextbyte(ord(substr($string, $i++, 1))))
				return false;
			if(!valid_nextbyte(ord(substr($string, $i++, 1))))
				return false;
			if(!valid_nextbyte(ord(substr($string, $i++, 1))))
				return false;
		} // goto next char
	}
	return true; // done
}

/**
 * @package WordPress
 * @subpackage Dotclear_Import
 *
 * @param string $s
 * @return string
 */
function csc ($s) {
	if (valid_utf8 ($s)) {
		return $s;
	} else {
		return iconv(get_option ("dccharset"),"UTF-8",$s);
	}
}

/**
 * @package WordPress
 * @subpackage Dotclear_Import
 *
 * @param string $s
 * @return string
 */
function textconv ($s) {
	return csc (preg_replace ('|(?<!<br />)\s*\n|', ' ', $s));
}

/**
 * Dotclear Importer class
 *
 * Will process the WordPress eXtended RSS files that you upload from the export
 * file.
 *
 * @package WordPress
 * @subpackage Importer
 *
 * @since unknown
 */
class Dotclear_Import {

	function header()
	{
		echo '<div class="wrap">';
		screen_icon();
		echo '<h2>'.__('Import DotClear').'</h2>';
		echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'</p>';
	}

	function footer()
	{
		echo '</div>';
	}

	function greet()
	{
		echo '<div class="narrow"><p>'.__('Howdy! This importer allows you to extract posts from a DotClear database into your blog.  Mileage may vary.').'</p>';
		echo '<p>'.__('Your DotClear Configuration settings are as follows:').'</p>';
		echo '<form action="admin.php?import=dotclear&amp;step=1" method="post">';
		wp_nonce_field('import-dotclear');
		$this->db_form();
		echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.attribute_escape(__('Import Categories')).'" /></p>';
		echo '</form></div>';
	}

	function get_dc_cats()
	{
		global $wpdb;
		// General Housekeeping
		$dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
		set_magic_quotes_runtime(0);
		$dbprefix = get_option('dcdbprefix');

		// Get Categories
		return $dcdb->get_results('SELECT * FROM '.$dbprefix.'categorie', ARRAY_A);
	}

	function get_dc_users()
	{
		global $wpdb;
		// General Housekeeping
		$dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
		set_magic_quotes_runtime(0);
		$dbprefix = get_option('dcdbprefix');

		// Get Users

		return $dcdb->get_results('SELECT * FROM '.$dbprefix.'user', ARRAY_A);
	}

	function get_dc_posts()
	{
		// General Housekeeping
		$dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
		set_magic_quotes_runtime(0);
		$dbprefix = get_option('dcdbprefix');

		// Get Posts
		return $dcdb->get_results('SELECT '.$dbprefix.'post.*, '.$dbprefix.'categorie.cat_libelle_url AS post_cat_name
						FROM '.$dbprefix.'post INNER JOIN '.$dbprefix.'categorie
						ON '.$dbprefix.'post.cat_id = '.$dbprefix.'categorie.cat_id', ARRAY_A);
	}

	function get_dc_comments()
	{
		global $wpdb;
		// General Housekeeping
		$dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
		set_magic_quotes_runtime(0);
		$dbprefix = get_option('dcdbprefix');

		// Get Comments
		return $dcdb->get_results('SELECT * FROM '.$dbprefix.'comment', ARRAY_A);
	}

	function get_dc_links()
	{
		//General Housekeeping
		$dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
		set_magic_quotes_runtime(0);
		$dbprefix = get_option('dcdbprefix');

		return $dcdb->get_results('SELECT * FROM '.$dbprefix.'link ORDER BY position', ARRAY_A);
	}

	function cat2wp($categories='')
	{
		// General Housekeeping
		global $wpdb;
		$count = 0;
		$dccat2wpcat = array();
		// Do the Magic
		if(is_array($categories))
		{
			echo '<p>'.__('Importing Categories...').'<br /><br /></p>';
			foreach ($categories as $category)
			{
				$count++;
				extract($category);

				// Make Nice Variables
				$name = $wpdb->escape($cat_libelle_url);
				$title = $wpdb->escape(csc ($cat_libelle));
				$desc = $wpdb->escape(csc ($cat_desc));

				if($cinfo = category_exists($name))
				{
					$ret_id = wp_insert_category(array('cat_ID' => $cinfo, 'category_nicename' => $name, 'cat_name' => $title, 'category_description' => $desc));
				}
				else
				{
					$ret_id = wp_insert_category(array('category_nicename' => $name, 'cat_name' => $title, 'category_description' => $desc));
				}
				$dccat2wpcat[$id] = $ret_id;
			}

			// Store category translation for future use
			add_option('dccat2wpcat',$dccat2wpcat);
			echo '<p>'.sprintf(__ngettext('Done! <strong>%1$s</strong> category imported.', 'Done! <strong>%1$s</strong> categories imported.', $count), $count).'<br /><br /></p>';
			return true;
		}
		echo __('No Categories to Import!');
		return false;
	}

	function users2wp($users='')
	{
		// General Housekeeping
		global $wpdb;
		$count = 0;
		$dcid2wpid = array();

		// Midnight Mojo
		if(is_array($users))
		{
			echo '<p>'.__('Importing Users...').'<br /><br /></p>';
			foreach($users as $user)
			{
				$count++;
				extract($user);

				// Make Nice Variables
				$name = $wpdb->escape(csc ($name));
				$RealName = $wpdb->escape(csc ($user_pseudo));

				if($uinfo = get_userdatabylogin($name))
				{

					$ret_id = wp_insert_user(array(
								'ID'		=> $uinfo->ID,
								'user_login'	=> $user_id,
								'user_nicename'	=> $Realname,
								'user_email'	=> $user_email,
								'user_url'	=> 'http://',
								'display_name'	=> $Realname)
								);
				}
				else
				{
					$ret_id = wp_insert_user(array(
								'user_login'	=> $user_id,
								'user_nicename'	=> csc ($user_pseudo),
								'user_email'	=> $user_email,
								'user_url'	=> 'http://',
								'display_name'	=> $Realname)
								);
				}
				$dcid2wpid[$user_id] = $ret_id;

				// Set DotClear-to-WordPress permissions translation

				// Update Usermeta Data
				$user = new WP_User($ret_id);
				$wp_perms = $user_level + 1;
				if(10 == $wp_perms) { $user->set_role('administrator'); }
				else if(9  == $wp_perms) { $user->set_role('editor'); }
				else if(5  <= $wp_perms) { $user->set_role('editor'); }
				else if(4  <= $wp_perms) { $user->set_role('author'); }
				else if(3  <= $wp_perms) { $user->set_role('contributor'); }
				else if(2  <= $wp_perms) { $user->set_role('contributor'); }
				else                     { $user->set_role('subscriber'); }

				update_usermeta( $ret_id, 'wp_user_level', $wp_perms);
				update_usermeta( $ret_id, 'rich_editing', 'false');
				update_usermeta( $ret_id, 'first_name', csc ($user_prenom));
				update_usermeta( $ret_id, 'last_name', csc ($user_nom));
			}// End foreach($users as $user)

			// Store id translation array for future use
			add_option('dcid2wpid',$dcid2wpid);


			echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> users imported.'), $count).'<br /><br /></p>';
			return true;
		}// End if(is_array($users)

		echo __('No Users to Import!');
		return false;

	}// End function user2wp()

	function posts2wp($posts='')
	{
		// General Housekeeping
		global $wpdb;
		$count = 0;
		$dcposts2wpposts = array();
		$cats = array();

		// Do the Magic
		if(is_array($posts))
		{
			echo '<p>'.__('Importing Posts...').'<br /><br /></p>';
			foreach($posts as $post)
			{
				$count++;
				extract($post);

				// Set DotClear-to-WordPress status translation
				$stattrans = array(0 => 'draft', 1 => 'publish');
				$comment_status_map = array (0 => 'closed', 1 => 'open');

				//Can we do this more efficiently?
				$uinfo = ( get_userdatabylogin( $user_id ) ) ? get_userdatabylogin( $user_id ) : 1;
				$authorid = ( is_object( $uinfo ) ) ? $uinfo->ID : $uinfo ;

				$Title = $wpdb->escape(csc ($post_titre));
				$post_content = textconv ($post_content);
				$post_excerpt = "";
				if ($post_chapo != "") {
					$post_excerpt = textconv ($post_chapo);
					$post_content = $post_excerpt ."\n<!--more-->\n".$post_content;
				}
				$post_excerpt = $wpdb->escape ($post_excerpt);
				$post_content = $wpdb->escape ($post_content);
				$post_status = $stattrans[$post_pub];

				// Import Post data into WordPress

				if($pinfo = post_exists($Title,$post_content))
				{
					$ret_id = wp_insert_post(array(
							'ID'			=> $pinfo,
							'post_author'		=> $authorid,
							'post_date'		=> $post_dt,
							'post_date_gmt'		=> $post_dt,
							'post_modified'		=> $post_upddt,
							'post_modified_gmt'	=> $post_upddt,
							'post_title'		=> $Title,
							'post_content'		=> $post_content,
							'post_excerpt'		=> $post_excerpt,
							'post_status'		=> $post_status,
							'post_name'		=> $post_titre_url,
							'comment_status'	=> $comment_status_map[$post_open_comment],
							'ping_status'		=> $comment_status_map[$post_open_tb],
							'comment_count'		=> $post_nb_comment + $post_nb_trackback)
							);
					if ( is_wp_error( $ret_id ) )
						return $ret_id;
				}
				else
				{
					$ret_id = wp_insert_post(array(
							'post_author'		=> $authorid,
							'post_date'		=> $post_dt,
							'post_date_gmt'		=> $post_dt,
							'post_modified'		=> $post_modified_gmt,
							'post_modified_gmt'	=> $post_modified_gmt,
							'post_title'		=> $Title,
							'post_content'		=> $post_content,
							'post_excerpt'		=> $post_excerpt,
							'post_status'		=> $post_status,
							'post_name'		=> $post_titre_url,
							'comment_status'	=> $comment_status_map[$post_open_comment],
							'ping_status'		=> $comment_status_map[$post_open_tb],
							'comment_count'		=> $post_nb_comment + $post_nb_trackback)
							);
					if ( is_wp_error( $ret_id ) )
						return $ret_id;
				}
				$dcposts2wpposts[$post_id] = $ret_id;

				// Make Post-to-Category associations
				$cats = array();
				$category1 = get_category_by_slug($post_cat_name);
				$category1 = $category1->term_id;

				if($cat1 = $category1) { $cats[1] = $cat1; }

				if(!empty($cats)) { wp_set_post_categories($ret_id, $cats); }
			}
		}
		// Store ID translation for later use
		add_option('dcposts2wpposts',$dcposts2wpposts);

		echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> posts imported.'), $count).'<br /><br /></p>';
		return true;
	}

	function comments2wp($comments='')
	{
		// General Housekeeping
		global $wpdb;
		$count = 0;
		$dccm2wpcm = array();
		$postarr = get_option('dcposts2wpposts');

		// Magic Mojo
		if(is_array($comments))
		{
			echo '<p>'.__('Importing Comments...').'<br /><br /></p>';
			foreach($comments as $comment)
			{
				$count++;
				extract($comment);

				// WordPressify Data
				$comment_ID = (int) ltrim($comment_id, '0');
				$comment_post_ID = (int) $postarr[$post_id];
				$comment_approved = "$comment_pub";
				$name = $wpdb->escape(csc ($comment_auteur));
				$email = $wpdb->escape($comment_email);
				$web = "http://".$wpdb->escape($comment_site);
				$message = $wpdb->escape(textconv ($comment_content));

				if($cinfo = comment_exists($name, $comment_dt))
				{
					// Update comments
					$ret_id = wp_update_comment(array(
							'comment_ID'		=> $cinfo,
							'comment_post_ID'	=> $comment_post_ID,
							'comment_author'	=> $name,
							'comment_author_email'	=> $email,
							'comment_author_url'	=> $web,
							'comment_author_IP'	=> $comment_ip,
							'comment_date'		=> $comment_dt,
							'comment_date_gmt'	=> $comment_dt,
							'comment_content'	=> $message,
							'comment_approved'	=> $comment_approved)
							);
				}
				else
				{
					// Insert comments
					$ret_id = wp_insert_comment(array(
							'comment_post_ID'	=> $comment_post_ID,
							'comment_author'	=> $name,
							'comment_author_email'	=> $email,
							'comment_author_url'	=> $web,
							'comment_author_IP'	=> $comment_ip,
							'comment_date'		=> $comment_dt,
							'comment_date_gmt'	=> $comment_dt,
							'comment_content'	=> $message,
							'comment_approved'	=> $comment_approved)
							);
				}
				$dccm2wpcm[$comment_ID] = $ret_id;
			}
			// Store Comment ID translation for future use
			add_option('dccm2wpcm', $dccm2wpcm);

			// Associate newly formed categories with posts
			get_comment_count($ret_id);


			echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> comments imported.'), $count).'<br /><br /></p>';
			return true;
		}
		echo __('No Comments to Import!');
		return false;
	}

	function links2wp($links='')
	{
		// General Housekeeping
		global $wpdb;
		$count = 0;

		// Deal with the links
		if(is_array($links))
		{
			echo '<p>'.__('Importing Links...').'<br /><br /></p>';
			foreach($links as $link)
			{
				$count++;
				extract($link);

				if ($title != "") {
					if ($cinfo = is_term(csc ($title), 'link_category')) {
						$category = $cinfo['term_id'];
					} else {
						$category = wp_insert_term($wpdb->escape (csc ($title)), 'link_category');
						$category = $category['term_id'];
					}
				} else {
					$linkname = $wpdb->escape(csc ($label));
					$description = $wpdb->escape(csc ($title));

					if($linfo = link_exists($linkname)) {
						$ret_id = wp_insert_link(array(
									'link_id'		=> $linfo,
									'link_url'		=> $href,
									'link_name'		=> $linkname,
									'link_category'		=> $category,
									'link_description'	=> $description)
									);
					} else {
						$ret_id = wp_insert_link(array(
									'link_url'		=> $url,
									'link_name'		=> $linkname,
									'link_category'		=> $category,
									'link_description'	=> $description)
									);
					}
					$dclinks2wplinks[$link_id] = $ret_id;
				}
			}
			add_option('dclinks2wplinks',$dclinks2wplinks);
			echo '<p>';
			printf(__ngettext('Done! <strong>%s</strong> link or link category imported.', 'Done! <strong>%s</strong> links or link categories imported.', $count), $count);
			echo '<br /><br /></p>';
			return true;
		}
		echo __('No Links to Import!');
		return false;
	}

	function import_categories()
	{
		// Category Import
		$cats = $this->get_dc_cats();
		$this->cat2wp($cats);
		add_option('dc_cats', $cats);



		echo '<form action="admin.php?import=dotclear&amp;step=2" method="post">';
		wp_nonce_field('import-dotclear');
		printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Import Users')));
		echo '</form>';

	}

	function import_users()
	{
		// User Import
		$users = $this->get_dc_users();
		$this->users2wp($users);

		echo '<form action="admin.php?import=dotclear&amp;step=3" method="post">';
		wp_nonce_field('import-dotclear');
		printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Import Posts')));
		echo '</form>';
	}

	function import_posts()
	{
		// Post Import
		$posts = $this->get_dc_posts();
		$result = $this->posts2wp($posts);
		if ( is_wp_error( $result ) )
			return $result;

		echo '<form action="admin.php?import=dotclear&amp;step=4" method="post">';
		wp_nonce_field('import-dotclear');
		printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Import Comments')));
		echo '</form>';
	}

	function import_comments()
	{
		// Comment Import
		$comments = $this->get_dc_comments();
		$this->comments2wp($comments);

		echo '<form action="admin.php?import=dotclear&amp;step=5" method="post">';
		wp_nonce_field('import-dotclear');
		printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Import Links')));
		echo '</form>';
	}

	function import_links()
	{
		//Link Import
		$links = $this->get_dc_links();
		$this->links2wp($links);
		add_option('dc_links', $links);

		echo '<form action="admin.php?import=dotclear&amp;step=6" method="post">';
		wp_nonce_field('import-dotclear');
		printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Finish')));
		echo '</form>';
	}

	function cleanup_dcimport()
	{
		delete_option('dcdbprefix');
		delete_option('dc_cats');
		delete_option('dcid2wpid');
		delete_option('dccat2wpcat');
		delete_option('dcposts2wpposts');
		delete_option('dccm2wpcm');
		delete_option('dclinks2wplinks');
		delete_option('dcuser');
		delete_option('dcpass');
		delete_option('dcname');
		delete_option('dchost');
		delete_option('dccharset');
		do_action('import_done', 'dotclear');
		$this->tips();
	}

	function tips()
	{
		echo '<p>'.__('Welcome to WordPress.  We hope (and expect!) that you will find this platform incredibly rewarding!  As a new WordPress user coming from DotClear, there are some things that we would like to point out.  Hopefully, they will help your transition go as smoothly as possible.').'</p>';
		echo '<h3>'.__('Users').'</h3>';
		echo '<p>'.sprintf(__('You have already setup WordPress and have been assigned an administrative login and password.  Forget it.  You didn\'t have that login in DotClear, why should you have it here?  Instead we have taken care to import all of your users into our system.  Unfortunately there is one downside.  Because both WordPress and DotClear uses a strong encryption hash with passwords, it is impossible to decrypt it and we are forced to assign temporary passwords to all your users.  <strong>Every user has the same username, but their passwords are reset to password123.</strong>  So <a href="%1$s">Login</a> and change it.'), '/wp-login.php').'</p>';
		echo '<h3>'.__('Preserving Authors').'</h3>';
		echo '<p>'.__('Secondly, we have attempted to preserve post authors.  If you are the only author or contributor to your blog, then you are safe.  In most cases, we are successful in this preservation endeavor.  However, if we cannot ascertain the name of the writer due to discrepancies between database tables, we assign it to you, the administrative user.').'</p>';
		echo '<h3>'.__('Textile').'</h3>';
		echo '<p>'.__('Also, since you\'re coming from DotClear, you probably have been using Textile to format your comments and posts.  If this is the case, we recommend downloading and installing <a href="http://www.huddledmasses.org/category/development/wordpress/textile/">Textile for WordPress</a>.  Trust me... You\'ll want it.').'</p>';
		echo '<h3>'.__('WordPress Resources').'</h3>';
		echo '<p>'.__('Finally, there are numerous WordPress resources around the internet.  Some of them are:').'</p>';
		echo '<ul>';
		echo '<li>'.__('<a href="http://www.wordpress.org">The official WordPress site</a>').'</li>';
		echo '<li>'.__('<a href="http://wordpress.org/support/">The WordPress support forums</a>').'</li>';
		echo '<li>'.__('<a href="http://codex.wordpress.org">The Codex (In other words, the WordPress Bible)</a>').'</li>';
		echo '</ul>';
		echo '<p>'.sprintf(__('That\'s it! What are you waiting for? Go <a href="%1$s">login</a>!'), '../wp-login.php').'</p>';
	}

	function db_form()
	{
		echo '<table class="form-table">';
		printf('<tr><th><label for="dbuser">%s</label></th><td><input type="text" name="dbuser" id="dbuser" /></td></tr>', __('DotClear Database User:'));
		printf('<tr><th><label for="dbpass">%s</label></th><td><input type="password" name="dbpass" id="dbpass" /></td></tr>', __('DotClear Database Password:'));
		printf('<tr><th><label for="dbname">%s</label></th><td><input type="text" name="dbname" id="dbname" /></td></tr>', __('DotClear Database Name:'));
		printf('<tr><th><label for="dbhost">%s</label></th><td><input type="text" name="dbhost" id="dbhost" value="localhost" /></td></tr>', __('DotClear Database Host:'));
		printf('<tr><th><label for="dbprefix">%s</label></th><td><input type="text" name="dbprefix" id="dbprefix" value="dc_"/></td></tr>', __('DotClear Table prefix:'));
		printf('<tr><th><label for="dccharset">%s</label></th><td><input type="text" name="dccharset" id="dccharset" value="ISO-8859-15"/></td></tr>', __('Originating character set:'));
		echo '</table>';
	}

	function dispatch()
	{

		if (empty ($_GET['step']))
			$step = 0;
		else
			$step = (int) $_GET['step'];
		$this->header();

		if ( $step > 0 )
		{
			check_admin_referer('import-dotclear');

			if($_POST['dbuser'])
			{
				if(get_option('dcuser'))
					delete_option('dcuser');
				add_option('dcuser', sanitize_user($_POST['dbuser'], true));
			}
			if($_POST['dbpass'])
			{
				if(get_option('dcpass'))
					delete_option('dcpass');
				add_option('dcpass', sanitize_user($_POST['dbpass'], true));
			}

			if($_POST['dbname'])
			{
				if(get_option('dcname'))
					delete_option('dcname');
				add_option('dcname', sanitize_user($_POST['dbname'], true));
			}
			if($_POST['dbhost'])
			{
				if(get_option('dchost'))
					delete_option('dchost');
				add_option('dchost', sanitize_user($_POST['dbhost'], true));
			}
			if($_POST['dccharset'])
			{
				if(get_option('dccharset'))
					delete_option('dccharset');
				add_option('dccharset', sanitize_user($_POST['dccharset'], true));
			}
			if($_POST['dbprefix'])
			{
				if(get_option('dcdbprefix'))
					delete_option('dcdbprefix');
				add_option('dcdbprefix', sanitize_user($_POST['dbprefix'], true));
			}


		}

		switch ($step)
		{
			default:
			case 0 :
				$this->greet();
				break;
			case 1 :
				$this->import_categories();
				break;
			case 2 :
				$this->import_users();
				break;
			case 3 :
				$result = $this->import_posts();
				if ( is_wp_error( $result ) )
					echo $result->get_error_message();
				break;
			case 4 :
				$this->import_comments();
				break;
			case 5 :
				$this->import_links();
				break;
			case 6 :
				$this->cleanup_dcimport();
				break;
		}

		$this->footer();
	}

	function Dotclear_Import()
	{
		// Nothing.
	}
}

$dc_import = new Dotclear_Import();

register_importer('dotclear', __('DotClear'), __('Import categories, users, posts, comments, and links from a DotClear blog.'), array ($dc_import, 'dispatch'));

?>
                                                                                                                                                                                                                                                                                                  wp-admin/import/greymatter.php                                                                      0000755 0023422 0004734 00000025637 11113651624 017544  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * GreyMatter Importer
 *
 * @package WordPress
 * @subpackage Importer
 */

/**
 * GreyMatter Importer class
 *
 * Basic GreyMatter to WordPress importer, will import posts, comments, and
 * posts karma.
 *
 * @since unknown
 */
class GM_Import {

	var $gmnames = array ();

	function header() {
		echo '<div class="wrap">';
		screen_icon();
		echo '<h2>'.__('Import GreyMatter').'</h2>';
	}

	function footer() {
		echo '</div>';
	}

	function greet() {
		$this->header();
?>
<p><?php _e('This is a basic GreyMatter to WordPress import script.') ?></p>
<p><?php _e('What it does:') ?></p>
<ul>
<li><?php _e('Parses gm-authors.cgi to import (new) authors. Everyone is imported at level 1.') ?></li>
<li><?php _e('Parses the entries cgi files to import posts, comments, and karma on posts (although karma is not used on WordPress yet).<br />If authors are found not to be in gm-authors.cgi, imports them at level 0.') ?></li>
<li><?php _e("Detects duplicate entries or comments. If you don't import everything the first time, or this import should fail in the middle, duplicate entries will not be made when you try again.") ?></li>
</ul>
<p><?php _e('What it does not:') ?></p>
<ul>
<li><?php _e('Parse gm-counter.cgi, gm-banlist.cgi, gm-cplog.cgi (you can make a CP log hack if you really feel like it, but I question the need of a CP log).') ?></li>
<li><?php _e('Import gm-templates.') ?></li>
<li><?php _e("Doesn't keep entries on top.")?></li>
</ul>
<p>&nbsp;</p>

<form name="stepOne" method="get" action="">
<input type="hidden" name="import" value="greymatter" />
<input type="hidden" name="step" value="1" />
<?php wp_nonce_field('import-greymatter'); ?>
<h3><?php _e('Second step: GreyMatter details:') ?></h3>
<table class="form-table">
<tr>
<td><label for="gmpath"><?php _e('Path to GM files:') ?></label></td>
<td><input type="text" style="width:300px" name="gmpath" id="gmpath" value="/home/my/site/cgi-bin/greymatter/" /></td>
</tr>
<tr>
<td><label for="archivespath"><?php _e('Path to GM entries:') ?></label></td>
<td><input type="text" style="width:300px" name="archivespath" id="archivespath" value="/home/my/site/cgi-bin/greymatter/archives/" /></td>
</tr>
<tr>
<td><label for="lastentry"><?php _e("Last entry's number:") ?></label></td>
<td><input type="text" name="lastentry" id="lastentry" value="00000001" /><br />
	<?php _e("This importer will search for files 00000001.cgi to 000-whatever.cgi,<br />so you need to enter the number of the last GM post here.<br />(if you don't know that number, just log into your FTP and look it out<br />in the entries' folder)") ?></td>
</tr>
</table>
<p class="submit"><input type="submit" name="submit" class="button" value="<?php _e('Start Importing') ?>" /></p>
</form>
<?php
		$this->footer();
	}



	function gm2autobr($string) { // transforms GM's |*| into b2's <br />\n
		$string = str_replace("|*|","<br />\n",$string);
		return($string);
	}

	function import() {
		global $wpdb;

		$wpvarstoreset = array('gmpath', 'archivespath', 'lastentry');
		for ($i=0; $i<count($wpvarstoreset); $i += 1) {
			$wpvar = $wpvarstoreset[$i];
			if (!isset($$wpvar)) {
				if (empty($_POST["$wpvar"])) {
					if (empty($_GET["$wpvar"])) {
						$$wpvar = '';
					} else {
						$$wpvar = $_GET["$wpvar"];
					}
				} else {
					$$wpvar = $_POST["$wpvar"];
				}
			}
		}

		if (!chdir($archivespath))
			wp_die(__("Wrong path, the path to the GM entries does not exist on the server"));

		if (!chdir($gmpath))
			wp_die(__("Wrong path, the path to the GM files does not exist on the server"));

		$lastentry = (int) $lastentry;

		$this->header();
?>
<p><?php _e('The importer is running...') ?></p>
<ul>
<li><?php _e('importing users...') ?><ul><?php

	chdir($gmpath);
	$userbase = file("gm-authors.cgi");

	foreach($userbase as $user) {
		$userdata=explode("|", $user);

		$user_ip="127.0.0.1";
		$user_domain="localhost";
		$user_browser="server";

		$s=$userdata[4];
		$user_joindate=substr($s,6,4)."-".substr($s,0,2)."-".substr($s,3,2)." 00:00:00";

		$user_login=$wpdb->escape($userdata[0]);
		$pass1=$wpdb->escape($userdata[1]);
		$user_nickname=$wpdb->escape($userdata[0]);
		$user_email=$wpdb->escape($userdata[2]);
		$user_url=$wpdb->escape($userdata[3]);
		$user_joindate=$wpdb->escape($user_joindate);

		$user_id = username_exists($user_login);
		if ($user_id) {
			printf('<li>'.__('user %s').'<strong>'.__('Already exists').'</strong></li>', "<em>$user_login</em>");
			$this->gmnames[$userdata[0]] = $user_id;
			continue;
		}

		$user_info = array("user_login"=>"$user_login", "user_pass"=>"$pass1", "user_nickname"=>"$user_nickname", "user_email"=>"$user_email", "user_url"=>"$user_url", "user_ip"=>"$user_ip", "user_domain"=>"$user_domain", "user_browser"=>"$user_browser", "dateYMDhour"=>"$user_joindate", "user_level"=>"1", "user_idmode"=>"nickname");
		$user_id = wp_insert_user($user_info);
		$this->gmnames[$userdata[0]] = $user_id;

		printf('<li>'.__('user %s...').' <strong>'.__('Done').'</strong></li>', "<em>$user_login</em>");
	}

?></ul><strong><?php _e('Done') ?></strong></li>
<li><?php _e('importing posts, comments, and karma...') ?><br /><ul><?php

	chdir($archivespath);

	for($i = 0; $i <= $lastentry; $i = $i + 1) {

		$entryfile = "";

		if ($i<10000000) {
			$entryfile .= "0";
			if ($i<1000000) {
				$entryfile .= "0";
				if ($i<100000) {
					$entryfile .= "0";
					if ($i<10000) {
						$entryfile .= "0";
						if ($i<1000) {
							$entryfile .= "0";
							if ($i<100) {
								$entryfile .= "0";
								if ($i<10) {
									$entryfile .= "0";
		}}}}}}}

		$entryfile .= "$i";

		if (is_file($entryfile.".cgi")) {

			$entry=file($entryfile.".cgi");
			$postinfo=explode("|",$entry[0]);
			$postmaincontent=$this->gm2autobr($entry[2]);
			$postmorecontent=$this->gm2autobr($entry[3]);

			$post_author=trim($wpdb->escape($postinfo[1]));

			$post_title=$this->gm2autobr($postinfo[2]);
			printf('<li>'.__('entry # %s : %s : by %s'), $entryfile, $post_title, $postinfo[1]);
			$post_title=$wpdb->escape($post_title);

			$postyear=$postinfo[6];
			$postmonth=zeroise($postinfo[4],2);
			$postday=zeroise($postinfo[5],2);
			$posthour=zeroise($postinfo[7],2);
			$postminute=zeroise($postinfo[8],2);
			$postsecond=zeroise($postinfo[9],2);

			if (($postinfo[10]=="PM") && ($posthour!="12"))
				$posthour=$posthour+12;

			$post_date="$postyear-$postmonth-$postday $posthour:$postminute:$postsecond";

			$post_content=$postmaincontent;
			if (strlen($postmorecontent)>3)
				$post_content .= "<!--more--><br /><br />".$postmorecontent;
			$post_content=$wpdb->escape($post_content);

			$post_karma=$postinfo[12];

			$post_status = 'publish'; //in greymatter, there are no drafts
			$comment_status = 'open';
			$ping_status = 'closed';

			if ($post_ID = post_exists($post_title, '', $post_date)) {
				echo ' ';
				_e('(already exists)');
			} else {
				//just so that if a post already exists, new users are not created by checkauthor
				// we'll check the author is registered, or if it's a deleted author
				$user_id = username_exists($post_author);
				if (!$user_id) {	// if deleted from GM, we register the author as a level 0 user
					$user_ip="127.0.0.1";
					$user_domain="localhost";
					$user_browser="server";
					$user_joindate="1979-06-06 00:41:00";
					$user_login=$wpdb->escape($post_author);
					$pass1=$wpdb->escape("password");
					$user_nickname=$wpdb->escape($post_author);
					$user_email=$wpdb->escape("user@deleted.com");
					$user_url=$wpdb->escape("");
					$user_joindate=$wpdb->escape($user_joindate);

					$user_info = array("user_login"=>$user_login, "user_pass"=>$pass1, "user_nickname"=>$user_nickname, "user_email"=>$user_email, "user_url"=>$user_url, "user_ip"=>$user_ip, "user_domain"=>$user_domain, "user_browser"=>$user_browser, "dateYMDhour"=>$user_joindate, "user_level"=>0, "user_idmode"=>"nickname");
					$user_id = wp_insert_user($user_info);
					$this->gmnames[$postinfo[1]] = $user_id;

					echo ': ';
					printf(__('registered deleted user %s at level 0 '), "<em>$user_login</em>");
				}

				if (array_key_exists($postinfo[1], $this->gmnames)) {
					$post_author = $this->gmnames[$postinfo[1]];
				} else {
					$post_author = $user_id;
				}

				$postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_excerpt', 'post_status', 'comment_status', 'ping_status', 'post_modified', 'post_modified_gmt');
				$post_ID = wp_insert_post($postdata);
				if ( is_wp_error( $post_ID ) )
					return $post_ID;
			}

			$c=count($entry);
			if ($c>4) {
				$numAddedComments = 0;
				$numComments = 0;
				for ($j=4;$j<$c;$j++) {
					$entry[$j]=$this->gm2autobr($entry[$j]);
					$commentinfo=explode("|",$entry[$j]);
					$comment_post_ID=$post_ID;
					$comment_author=$wpdb->escape($commentinfo[0]);
					$comment_author_email=$wpdb->escape($commentinfo[2]);
					$comment_author_url=$wpdb->escape($commentinfo[3]);
					$comment_author_IP=$wpdb->escape($commentinfo[1]);

					$commentyear=$commentinfo[7];
					$commentmonth=zeroise($commentinfo[5],2);
					$commentday=zeroise($commentinfo[6],2);
					$commenthour=zeroise($commentinfo[8],2);
					$commentminute=zeroise($commentinfo[9],2);
					$commentsecond=zeroise($commentinfo[10],2);
					if (($commentinfo[11]=="PM") && ($commenthour!="12"))
						$commenthour=$commenthour+12;
					$comment_date="$commentyear-$commentmonth-$commentday $commenthour:$commentminute:$commentsecond";

					$comment_content=$wpdb->escape($commentinfo[12]);

					if (!comment_exists($comment_author, $comment_date)) {
						$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_author_IP', 'comment_date', 'comment_content', 'comment_approved');
						$commentdata = wp_filter_comment($commentdata);
						wp_insert_comment($commentdata);
						$numAddedComments++;
					}
					$numComments++;
				}
				if ($numAddedComments > 0) {
					echo ': ';
				printf( __ngettext('imported %s comment', 'imported %s comments', $numAddedComments) , $numAddedComments);
				}
				$preExisting = $numComments - numAddedComments;
				if ($preExisting > 0) {
					echo ' ';
					printf( __ngettext( 'ignored %s pre-existing comment', 'ignored %s pre-existing comments', $preExisting ) , $preExisting);
				}
			}
			echo '... <strong>'.__('Done').'</strong></li>';
		}
	}
	do_action('import_done', 'greymatter');
	?>
</ul><strong><?php _e('Done') ?></strong></li></ul>
<p>&nbsp;</p>
<p><?php _e('Completed GreyMatter import!') ?></p>
<?php
	$this->footer();
	return;
	}

	function dispatch() {
		if (empty ($_GET['step']))
			$step = 0;
		else
			$step = (int) $_GET['step'];

		switch ($step) {
			case 0 :
				$this->greet();
				break;
			case 1:
				check_admin_referer('import-greymatter');
				$result = $this->import();
				if ( is_wp_error( $result ) )
					echo $result->get_error_message();
				break;
		}
	}

	function GM_Import() {
		// Nothing.
	}
}

$gm_import = new GM_Import();

register_importer('greymatter', __('GreyMatter'), __('Import users, posts, and comments from a Greymatter blog.'), array ($gm_import, 'dispatch'));
?>
                                                                                                 wp-admin/import/jkw.php                                                                             0000755 0023422 0004734 00000014206 11113252136 016135  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Jeromes Keyword Plugin Importer
 *
 * @package WordPress
 * @subpackage Importer
 */

/**
 * Jeromes Keyword Plugin Importer class
 *
 * Will convert Jeromes Keyword Plugin tags to WordPress taxonomy tags.
 *
 * @since 2.3
 */
class JeromesKeyword_Import {

	function header() {
		echo '<div class="wrap">';
		screen_icon();
		echo '<h2>'.__('Import Jerome&#8217;s Keywords').'</h2>';
		echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'<br /><br /></p>';
	}

	function footer() {
		echo '</div>';
	}

	function greet() {
		echo '<div class="narrow">';
		echo '<p>'.__('Howdy! This imports tags from Jerome&#8217;s Keywords into WordPress tags.').'</p>';
		echo '<p>'.__('This is suitable for Jerome&#8217;s Keywords version 1.x and 2.0a.').'</p>';
		echo '<p><strong>'.__('All existing Jerome&#8217;s Keywords will be removed after import.').'</strong></p>';
		echo '<p><strong>'.__('Don&#8217;t be stupid - backup your database before proceeding!').'</strong></p>';
		echo '<form action="admin.php?import=jkw&amp;step=1" method="post">';
		wp_nonce_field('import-jkw');
		echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Import Version 1.x').'" /></p>';
		echo '</form>';
		echo '<form action="admin.php?import=jkw&amp;step=3" method="post">';
		wp_nonce_field('import-jkw');
		echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Import Version 2.0a').'" /></p>';
		echo '</form>';
		echo '</div>';
	}

	function dispatch() {
		if ( empty($_GET['step']) )
			$step = 0;
		else
			$step = absint($_GET['step']);

		// load the header
		$this->header();

		switch ( $step ) {
			case 0 :
				$this->greet();
				break;
			case 1 :
				check_admin_referer('import-jkw');
				$this->check_V1_post_keyword( true );
				break;
			case 2 :
				check_admin_referer('import-jkw');
				$this->check_V1_post_keyword( false );
				break;
			case 3 :
				check_admin_referer('import-jkw');
				$this->check_V2_post_keyword( true );
				break;
			case 4 :
				check_admin_referer('import-jkw');
				$this->check_V2_post_keyword( false );
				break;
			case 5:
				check_admin_referer('import-jkw');
				$this->cleanup_V2_import();
				break;
			case 6:
				$this->done();
				break;
		}

		// load the footer
		$this->footer();
	}

	function check_V1_post_keyword($precheck = true) {
		global $wpdb;

		echo '<div class="narrow">';
		echo '<p><h3>'.__('Reading Jerome&#8217;s Keywords Tags&#8230;').'</h3></p>';

		// import Jerome's Keywords tags
		$metakeys = $wpdb->get_results("SELECT post_id, meta_id, meta_key, meta_value FROM $wpdb->postmeta WHERE $wpdb->postmeta.meta_key = 'keywords'");
		if ( !is_array($metakeys)) {
			echo '<p>' . __('No Tags Found!') . '</p>';
			return false;
		} else {
			$count = count($metakeys);
			echo '<p>' . sprintf( __ngettext('Done! <strong>%s</strong> post with tags were read.', 'Done! <strong>%s</strong> posts with tags were read.', $count), $count ) . '<br /></p>';
			echo '<ul>';
			foreach ( $metakeys as $post_meta ) {
				if ( $post_meta->meta_value != '' ) {
					$post_keys = explode(',', $post_meta->meta_value);
					foreach ( $post_keys as $keyword ) {
						$keyword = addslashes(trim($keyword));
						if ( '' != $keyword ) {
							echo '<li>' . $post_meta->post_id . '&nbsp;-&nbsp;' . $keyword . '</li>';
							if ( !$precheck )
								wp_add_post_tags($post_meta->post_id, $keyword);
						}
					}
				}
				if ( !$precheck )
					delete_post_meta($post_meta->post_id, 'keywords');
			}
			echo '</ul>';
		}

		echo '<form action="admin.php?import=jkw&amp;step='.($precheck? 2:6).'" method="post">';
		wp_nonce_field('import-jkw');
		echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Next').'" /></p>';
		echo '</form>';
		echo '</div>';
	}

	function check_V2_post_keyword($precheck = true) {
		global $wpdb;

		echo '<div class="narrow">';
		echo '<p><h3>'.__('Reading Jerome&#8217;s Keywords Tags&#8230;').'</h3></p>';

		// import Jerome's Keywords tags
		$tablename = $wpdb->prefix . substr(get_option('jkeywords_keywords_table'), 1, -1);
		$metakeys = $wpdb->get_results("SELECT post_id, tag_name FROM $tablename");
		if ( !is_array($metakeys) ) {
			echo '<p>' . __('No Tags Found!') . '</p>';
			return false;
		} else {
			$count = count($metakeys);
			echo '<p>' . sprintf( __ngettext('Done! <strong>%s</strong> tag were read.', 'Done! <strong>%s</strong> tags were read.', $count), $count ) . '<br /></p>';
			echo '<ul>';
			foreach ( $metakeys as $post_meta ) {
				$keyword = addslashes(trim($post_meta->tag_name));
				if ( $keyword != '' ) {
					echo '<li>' . $post_meta->post_id . '&nbsp;-&nbsp;' . $keyword . '</li>';
					if ( !$precheck )
						wp_add_post_tags($post_meta->post_id, $keyword);
				}
			}
		echo '</ul>';
		}
		echo '<form action="admin.php?import=jkw&amp;step='.($precheck? 4:5).'" method="post">';
		wp_nonce_field('import-jkw');
		echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Next').'" /></p>';
		echo '</form>';
		echo '</div>';
	}

	function cleanup_V2_import() {
		global $wpdb;

		/* options from V2.0a (jeromes-keywords.php) */
		$options = array('version', 'keywords_table', 'query_varname', 'template', 'meta_always_include', 'meta_includecats', 'meta_autoheader', 'search_strict', 'use_feed_cats', 'post_linkformat', 'post_tagseparator', 'post_includecats', 'post_notagstext', 'cloud_linkformat', 'cloud_tagseparator', 'cloud_includecats', 'cloud_sortorder', 'cloud_displaymax', 'cloud_displaymin', 'cloud_scalemax', 'cloud_scalemin');

		$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . substr(get_option('jkeywords_keywords_table'), 1, -1));

		foreach ( $options as $o )
			delete_option('jkeywords_' . $o);

		$this->done();
	}

	function done() {
		echo '<div class="narrow">';
		echo '<p><h3>'.__('Import Complete!').'</h3></p>';
		echo '</div>';
	}

	function JeromesKeyword_Import() {
	}

}

// create the import object
$jkw_import = new JeromesKeyword_Import();

// add it to the import page!
register_importer('jkw', 'Jerome&#8217;s Keywords', __('Import Jerome&#8217;s Keywords into WordPress tags.'), array($jkw_import, 'dispatch'));

?>
                                                                                                                                                                                                                                                                                                                                                                                          wp-admin/import/livejournal.php                                                                     0000755 0023422 0004734 00000013532 11135660264 017706  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * LiveJournal Importer
 *
 * @package WordPress
 * @subpackage Importer
 */

/**
 * LiveJournal Importer class
 *
 * Imports your LiveJournal XML exported file into WordPress.
 *
 * @since unknown
 */
class LJ_Import {

	var $file;

	function header() {
		echo '<div class="wrap">';
		screen_icon();
		echo '<h2>'.__('Import LiveJournal').'</h2>';
	}

	function footer() {
		echo '</div>';
	}

	function unhtmlentities($string) { // From php.net for < 4.3 compat
		$trans_tbl = get_html_translation_table(HTML_ENTITIES);
		$trans_tbl = array_flip($trans_tbl);
		return strtr($string, $trans_tbl);
	}

	function greet() {
		echo '<div class="narrow">';
		echo '<p>'.__('Howdy! Upload your LiveJournal XML export file and we&#8217;ll import the posts into this blog.').'</p>';
		echo '<p>'.__('Choose a LiveJournal XML file to upload, then click Upload file and import.').'</p>';
		wp_import_upload_form("admin.php?import=livejournal&amp;step=1");
		echo '</div>';
	}

	function import_posts() {
		global $wpdb, $current_user;

		set_magic_quotes_runtime(0);
		$importdata = file($this->file); // Read the file into an array
		$importdata = implode('', $importdata); // squish it
		$importdata = str_replace(array ("\r\n", "\r"), "\n", $importdata);

		preg_match_all('|<entry>(.*?)</entry>|is', $importdata, $posts);
		$posts = $posts[1];
		unset($importdata);
		echo '<ol>';
		foreach ($posts as $post) {
			preg_match('|<subject>(.*?)</subject>|is', $post, $post_title);
			$post_title = $wpdb->escape(trim($post_title[1]));
			if ( empty($post_title) ) {
				preg_match('|<itemid>(.*?)</itemid>|is', $post, $post_title);
				$post_title = $wpdb->escape(trim($post_title[1]));
			}

			preg_match('|<eventtime>(.*?)</eventtime>|is', $post, $post_date);
			$post_date = strtotime($post_date[1]);
			$post_date = date('Y-m-d H:i:s', $post_date);

			preg_match('|<event>(.*?)</event>|is', $post, $post_content);
			$post_content = str_replace(array ('<![CDATA[', ']]>'), '', trim($post_content[1]));
			$post_content = $this->unhtmlentities($post_content);

			// Clean up content
			$post_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $post_content);
			$post_content = str_replace('<br>', '<br />', $post_content);
			$post_content = str_replace('<hr>', '<hr />', $post_content);
			$post_content = $wpdb->escape($post_content);

			$post_author = $current_user->ID;
			$post_status = 'publish';

			echo '<li>';
			if ($post_id = post_exists($post_title, $post_content, $post_date)) {
				printf(__('Post <em>%s</em> already exists.'), stripslashes($post_title));
			} else {
				printf(__('Importing post <em>%s</em>...'), stripslashes($post_title));
				$postdata = compact('post_author', 'post_date', 'post_content', 'post_title', 'post_status');
				$post_id = wp_insert_post($postdata);
				if ( is_wp_error( $post_id ) )
					return $post_id;
				if (!$post_id) {
					_e("Couldn't get post ID");
					echo '</li>';
					break;
				}
			}

			preg_match_all('|<comment>(.*?)</comment>|is', $post, $comments);
			$comments = $comments[1];

			if ( $comments ) {
				$comment_post_ID = (int) $post_id;
				$num_comments = 0;
				foreach ($comments as $comment) {
					preg_match('|<event>(.*?)</event>|is', $comment, $comment_content);
					$comment_content = str_replace(array ('<![CDATA[', ']]>'), '', trim($comment_content[1]));
					$comment_content = $this->unhtmlentities($comment_content);

					// Clean up content
					$comment_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $comment_content);
					$comment_content = str_replace('<br>', '<br />', $comment_content);
					$comment_content = str_replace('<hr>', '<hr />', $comment_content);
					$comment_content = $wpdb->escape($comment_content);

					preg_match('|<eventtime>(.*?)</eventtime>|is', $comment, $comment_date);
					$comment_date = trim($comment_date[1]);
					$comment_date = date('Y-m-d H:i:s', strtotime($comment_date));

					preg_match('|<name>(.*?)</name>|is', $comment, $comment_author);
					$comment_author = $wpdb->escape(trim($comment_author[1]));

					preg_match('|<email>(.*?)</email>|is', $comment, $comment_author_email);
					$comment_author_email = $wpdb->escape(trim($comment_author_email[1]));

					$comment_approved = 1;
					// Check if it's already there
					if (!comment_exists($comment_author, $comment_date)) {
						$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_date', 'comment_content', 'comment_approved');
						$commentdata = wp_filter_comment($commentdata);
						wp_insert_comment($commentdata);
						$num_comments++;
					}
				}
			}
			if ( $num_comments ) {
				echo ' ';
				printf(__ngettext('(%s comment)', '(%s comments)', $num_comments), $num_comments);
			}
			echo '</li>';
		}
		echo '</ol>';
	}

	function import() {
		$file = wp_import_handle_upload();
		if ( isset($file['error']) ) {
			echo $file['error'];
			return;
		}

		$this->file = $file['file'];
		$result = $this->import_posts();
		if ( is_wp_error( $result ) )
			return $result;
		wp_import_cleanup($file['id']);
		do_action('import_done', 'livejournal');

		echo '<h3>';
		printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home'));
		echo '</h3>';
	}

	function dispatch() {
		if (empty ($_GET['step']))
			$step = 0;
		else
			$step = (int) $_GET['step'];

		$this->header();

		switch ($step) {
			case 0 :
				$this->greet();
				break;
			case 1 :
				check_admin_referer('import-upload');
				$result = $this->import();
				if ( is_wp_error( $result ) )
					echo $result->get_error_message();
				break;
		}

		$this->footer();
	}

	function LJ_Import() {
		// Nothing.
	}
}

$livejournal_import = new LJ_Import();

register_importer('livejournal', __('LiveJournal'), __('Import posts from a LiveJournal XML export file.'), array ($livejournal_import, 'dispatch'));
?>
                                                                                                                                                                      wp-admin/import/mt.php                                                                              0000755 0023422 0004734 00000037301 11136575140 015773  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Movable Type and Typepad Importer
 *
 * @package WordPress
 * @subpackage Importer
 */

/**
 * Moveable Type and Typepad Importer class
 *
 * Upload your exported Movable Type or Typepad entries into WordPress.
 *
 * @since unknown
 */
class MT_Import {

	var $posts = array ();
	var $file;
	var $id;
	var $mtnames = array ();
	var $newauthornames = array ();
	var $j = -1;

	function header() {
		echo '<div class="wrap">';
		screen_icon();
		echo '<h2>'.__('Import Movable Type or TypePad').'</h2>';
	}

	function footer() {
		echo '</div>';
	}

	function greet() {
		$this->header();
?>
<div class="narrow">
<p><?php _e('Howdy! We&#8217;re about to begin importing all of your Movable Type or Typepad entries into WordPress. To begin, either choose a file to upload and click "Upload file and import," or use FTP to upload your MT export file as <code>mt-export.txt</code> in your <code>/wp-content/</code> directory and then click "Import mt-export.txt"'); ?></p>

<?php wp_import_upload_form( add_query_arg('step', 1) ); ?>
<form method="post" action="<?php echo add_query_arg('step', 1); ?>" class="import-upload-form">

<?php wp_nonce_field('import-upload'); ?>
<p>
	<input type="hidden" name="upload_type" value="ftp" />
<?php _e('Or use <code>mt-export.txt</code> in your <code>/wp-content/</code> directory'); ?></p>
<p class="submit">
<input type="submit" class="button" value="<?php echo attribute_escape(__('Import mt-export.txt')); ?>" />
</p>
</form>
<p><?php _e('The importer is smart enough not to import duplicates, so you can run this multiple times without worry if&#8212;for whatever reason&#8212;it doesn\'t finish. If you get an <strong>out of memory</strong> error try splitting up the import file into pieces.'); ?> </p>
</div>
<?php
		$this->footer();
	}

	function users_form($n) {
		global $wpdb;
		$users = $wpdb->get_results("SELECT * FROM $wpdb->users ORDER BY ID");
?><select name="userselect[<?php echo $n; ?>]">
	<option value="#NONE#"><?php _e('- Select -') ?></option>
	<?php


		foreach ($users as $user) {
			echo '<option value="'.$user->user_login.'">'.$user->user_login.'</option>';
		}
?>
	</select>
	<?php

	}

	function has_gzip() {
		return is_callable('gzopen');
	}

	function fopen($filename, $mode='r') {
		if ( $this->has_gzip() )
			return gzopen($filename, $mode);
		return fopen($filename, $mode);
	}

	function feof($fp) {
		if ( $this->has_gzip() )
			return gzeof($fp);
		return feof($fp);
	}

	function fgets($fp, $len=8192) {
		if ( $this->has_gzip() )
			return gzgets($fp, $len);
		return fgets($fp, $len);
	}

	function fclose($fp) {
		if ( $this->has_gzip() )
			return gzclose($fp);
		return fclose($fp);
 	}

	//function to check the authorname and do the mapping
	function checkauthor($author) {
		//mtnames is an array with the names in the mt import file
		$pass = wp_generate_password();
		if (!(in_array($author, $this->mtnames))) { //a new mt author name is found
			++ $this->j;
			$this->mtnames[$this->j] = $author; //add that new mt author name to an array
			$user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user
			if (!$user_id) { //banging my head against the desk now.
				if ($this->newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname
					$user_id = wp_create_user($author, $pass);
					$this->newauthornames[$this->j] = $author; //now we have a name, in the place of left_blank.
				} else {
					$user_id = wp_create_user($this->newauthornames[$this->j], $pass);
				}
			} else {
				return $user_id; // return pre-existing wp username if it exists
			}
		} else {
			$key = array_search($author, $this->mtnames); //find the array key for $author in the $mtnames array
			$user_id = username_exists($this->newauthornames[$key]); //use that key to get the value of the author's name from $newauthornames
		}

		return $user_id;
	}

	function get_mt_authors() {
		$temp = array();
		$authors = array();

		$handle = $this->fopen($this->file, 'r');
		if ( $handle == null )
			return false;

		$in_comment = false;
		while ( $line = $this->fgets($handle) ) {
			$line = trim($line);

			if ( 'COMMENT:' == $line )
				$in_comment = true;
			else if ( '-----' == $line )
				$in_comment = false;

			if ( $in_comment || 0 !== strpos($line,"AUTHOR:") )
				continue;

			$temp[] = trim( substr($line, strlen("AUTHOR:")) );
		}

		//we need to find unique values of author names, while preserving the order, so this function emulates the unique_value(); php function, without the sorting.
		$authors[0] = array_shift($temp);
		$y = count($temp) + 1;
		for ($x = 1; $x < $y; $x ++) {
			$next = array_shift($temp);
			if (!(in_array($next, $authors)))
				array_push($authors, "$next");
		}

		$this->fclose($handle);

		return $authors;
	}

	function get_authors_from_post() {
		$formnames = array ();
		$selectnames = array ();

		foreach ($_POST['user'] as $key => $line) {
			$newname = trim(stripslashes($line));
			if ($newname == '')
				$newname = 'left_blank'; //passing author names from step 1 to step 2 is accomplished by using POST. left_blank denotes an empty entry in the form.
			array_push($formnames, "$newname");
		} // $formnames is the array with the form entered names

		foreach ($_POST['userselect'] as $user => $key) {
			$selected = trim(stripslashes($key));
			array_push($selectnames, "$selected");
		}

		$count = count($formnames);
		for ($i = 0; $i < $count; $i ++) {
			if ($selectnames[$i] != '#NONE#') { //if no name was selected from the select menu, use the name entered in the form
				array_push($this->newauthornames, "$selectnames[$i]");
			} else {
				array_push($this->newauthornames, "$formnames[$i]");
			}
		}
	}

	function mt_authors_form() {
?>
<div class="wrap">
<?php screen_icon(); ?>
<h2><?php _e('Assign Authors'); ?></h2>
<p><?php _e('To make it easier for you to edit and save the imported posts and drafts, you may want to change the name of the author of the posts. For example, you may want to import all the entries as admin\'s entries.'); ?></p>
<p><?php _e('Below, you can see the names of the authors of the MovableType posts in <em>italics</em>. For each of these names, you can either pick an author in your WordPress installation from the menu, or enter a name for the author in the textbox.'); ?></p>
<p><?php _e('If a new user is created by WordPress, a password will be randomly generated. Manually change the user\'s details if necessary.'); ?></p>
	<?php


		$authors = $this->get_mt_authors();
		echo '<ol id="authors">';
		echo '<form action="?import=mt&amp;step=2&amp;id=' . $this->id . '" method="post">';
		wp_nonce_field('import-mt');
		$j = -1;
		foreach ($authors as $author) {
			++ $j;
			echo '<li><label>'.__('Current author:').' <strong>'.$author.'</strong><br />'.sprintf(__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user[]'.'" maxlength="30"> <br />');
			$this->users_form($j);
			echo '</label></li>';
		}

		echo '<p class="submit"><input type="submit" class="button" value="'.__('Submit').'"></p>'.'<br />';
		echo '</form>';
		echo '</ol></div>';

	}

	function select_authors() {
		if ( $_POST['upload_type'] === 'ftp' ) {
			$file['file'] = WP_CONTENT_DIR . '/mt-export.txt';
			if ( !file_exists($file['file']) )
				$file['error'] = __('<code>mt-export.txt</code> does not exist');
		} else {
			$file = wp_import_handle_upload();
		}
		if ( isset($file['error']) ) {
			$this->header();
			echo '<p>'.__('Sorry, there has been an error').'.</p>';
			echo '<p><strong>' . $file['error'] . '</strong></p>';
			$this->footer();
			return;
		}
		$this->file = $file['file'];
		$this->id = (int) $file['id'];

		$this->mt_authors_form();
	}

	function save_post(&$post, &$comments, &$pings) {
		// Reset the counter
		set_time_limit(30);
		$post = get_object_vars($post);
		$post = add_magic_quotes($post);
		$post = (object) $post;

		if ( $post_id = post_exists($post->post_title, '', $post->post_date) ) {
			echo '<li>';
			printf(__('Post <em>%s</em> already exists.'), stripslashes($post->post_title));
		} else {
			echo '<li>';
			printf(__('Importing post <em>%s</em>...'), stripslashes($post->post_title));

			if ( '' != trim( $post->extended ) )
					$post->post_content .= "\n<!--more-->\n$post->extended";

			$post->post_author = $this->checkauthor($post->post_author); //just so that if a post already exists, new users are not created by checkauthor
			$post_id = wp_insert_post($post);
			if ( is_wp_error( $post_id ) )
				return $post_id;

			// Add categories.
			if ( 0 != count($post->categories) ) {
				wp_create_categories($post->categories, $post_id);
			}

			 // Add tags or keywords
			if ( 1 < strlen($post->post_keywords) ) {
			 	// Keywords exist.
				printf(__('<br />Adding tags <i>%s</i>...'), stripslashes($post->post_keywords));
				wp_add_post_tags($post_id, $post->post_keywords);
			}
		}

		$num_comments = 0;
		foreach ( $comments as $comment ) {
			$comment = get_object_vars($comment);
			$comment = add_magic_quotes($comment);

			if ( !comment_exists($comment['comment_author'], $comment['comment_date'])) {
				$comment['comment_post_ID'] = $post_id;
				$comment = wp_filter_comment($comment);
				wp_insert_comment($comment);
				$num_comments++;
			}
		}

		if ( $num_comments )
			printf(' '.__ngettext('(%s comment)', '(%s comments)', $num_comments), $num_comments);

		$num_pings = 0;
		foreach ( $pings as $ping ) {
			$ping = get_object_vars($ping);
			$ping = add_magic_quotes($ping);

			if ( !comment_exists($ping['comment_author'], $ping['comment_date'])) {
				$ping['comment_content'] = "<strong>{$ping['title']}</strong>\n\n{$ping['comment_content']}";
				$ping['comment_post_ID'] = $post_id;
				$ping = wp_filter_comment($ping);
				wp_insert_comment($ping);
				$num_pings++;
			}
		}

		if ( $num_pings )
			printf(' '.__ngettext('(%s ping)', '(%s pings)', $num_pings), $num_pings);

		echo "</li>";
		//ob_flush();flush();
	}

	function process_posts() {
		global $wpdb;

		$handle = $this->fopen($this->file, 'r');
		if ( $handle == null )
			return false;

		$context = '';
		$post = new StdClass();
		$comment = new StdClass();
		$comments = array();
		$ping = new StdClass();
		$pings = array();

		echo "<div class='wrap'><ol>";

		while ( $line = $this->fgets($handle) ) {
			$line = trim($line);

			if ( '-----' == $line ) {
				// Finishing a multi-line field
				if ( 'comment' == $context ) {
					$comments[] = $comment;
					$comment = new StdClass();
				} else if ( 'ping' == $context ) {
					$pings[] = $ping;
					$ping = new StdClass();
				}
				$context = '';
			} else if ( '--------' == $line ) {
				// Finishing a post.
				$context = '';
				$result = $this->save_post($post, $comments, $pings);
				if ( is_wp_error( $result ) )
					return $result;
				$post = new StdClass;
				$comment = new StdClass();
				$ping = new StdClass();
				$comments = array();
				$pings = array();
			} else if ( 'BODY:' == $line ) {
				$context = 'body';
			} else if ( 'EXTENDED BODY:' == $line ) {
				$context = 'extended';
			} else if ( 'EXCERPT:' == $line ) {
				$context = 'excerpt';
			} else if ( 'KEYWORDS:' == $line ) {
				$context = 'keywords';
			} else if ( 'COMMENT:' == $line ) {
				$context = 'comment';
			} else if ( 'PING:' == $line ) {
				$context = 'ping';
			} else if ( 0 === strpos($line, "AUTHOR:") ) {
				$author = trim( substr($line, strlen("AUTHOR:")) );
				if ( '' == $context )
					$post->post_author = $author;
				else if ( 'comment' == $context )
					 $comment->comment_author = $author;
			} else if ( 0 === strpos($line, "TITLE:") ) {
				$title = trim( substr($line, strlen("TITLE:")) );
				if ( '' == $context )
					$post->post_title = $title;
				else if ( 'ping' == $context )
					$ping->title = $title;
			} else if ( 0 === strpos($line, "STATUS:") ) {
				$status = trim( strtolower( substr($line, strlen("STATUS:")) ) );
				if ( empty($status) )
					$status = 'publish';
				$post->post_status = $status;
			} else if ( 0 === strpos($line, "ALLOW COMMENTS:") ) {
				$allow = trim( substr($line, strlen("ALLOW COMMENTS:")) );
				if ( $allow == 1 )
					$post->comment_status = 'open';
				else
					$post->comment_status = 'closed';
			} else if ( 0 === strpos($line, "ALLOW PINGS:") ) {
				$allow = trim( substr($line, strlen("ALLOW PINGS:")) );
				if ( $allow == 1 )
					$post->ping_status = 'open';
				else
					$post->ping_status = 'closed';
			} else if ( 0 === strpos($line, "CATEGORY:") ) {
				$category = trim( substr($line, strlen("CATEGORY:")) );
				if ( '' != $category )
					$post->categories[] = $category;
			} else if ( 0 === strpos($line, "PRIMARY CATEGORY:") ) {
				$category = trim( substr($line, strlen("PRIMARY CATEGORY:")) );
				if ( '' != $category )
					$post->categories[] = $category;
			} else if ( 0 === strpos($line, "DATE:") ) {
				$date = trim( substr($line, strlen("DATE:")) );
				$date = strtotime($date);
				$date = date('Y-m-d H:i:s', $date);
				$date_gmt = get_gmt_from_date($date);
				if ( '' == $context ) {
					$post->post_modified = $date;
					$post->post_modified_gmt = $date_gmt;
					$post->post_date = $date;
					$post->post_date_gmt = $date_gmt;
				} else if ( 'comment' == $context ) {
					$comment->comment_date = $date;
				} else if ( 'ping' == $context ) {
					$ping->comment_date = $date;
				}
			} else if ( 0 === strpos($line, "EMAIL:") ) {
				$email = trim( substr($line, strlen("EMAIL:")) );
				if ( 'comment' == $context )
					$comment->comment_author_email = $email;
				else
					$ping->comment_author_email = '';
			} else if ( 0 === strpos($line, "IP:") ) {
				$ip = trim( substr($line, strlen("IP:")) );
				if ( 'comment' == $context )
					$comment->comment_author_IP = $ip;
				else
					$ping->comment_author_IP = $ip;
			} else if ( 0 === strpos($line, "URL:") ) {
				$url = trim( substr($line, strlen("URL:")) );
				if ( 'comment' == $context )
					$comment->comment_author_url = $url;
				else
					$ping->comment_author_url = $url;
			} else if ( 0 === strpos($line, "BLOG NAME:") ) {
				$blog = trim( substr($line, strlen("BLOG NAME:")) );
				$ping->comment_author = $blog;
			} else {
				// Processing multi-line field, check context.
				
				if( !empty($line) )
					$line .= "\n";
					
				if ( 'body' == $context ) {
					$post->post_content .= $line;
				} else if ( 'extended' ==  $context ) {
					$post->extended .= $line;
				} else if ( 'excerpt' == $context ) {
					$post->post_excerpt .= $line;
				} else if ( 'keywords' == $context ) {
					$post->post_keywords .= $line;
				} else if ( 'comment' == $context ) {
					$comment->comment_content .= $line;
				} else if ( 'ping' == $context ) {
					$ping->comment_content .= $line;
				}
			}
		}

		$this->fclose($handle);

		echo '</ol>';

		wp_import_cleanup($this->id);
		do_action('import_done', 'mt');

		echo '<h3>'.sprintf(__('All done. <a href="%s">Have fun!</a>'), get_option('home')).'</h3></div>';
	}

	function import() {
		$this->id = (int) $_GET['id'];
		if ( $this->id == 0 )
			$this->file = WP_CONTENT_DIR . '/mt-export.txt';
		else
			$this->file = get_attached_file($this->id);
		$this->get_authors_from_post();
		$result = $this->process_posts();
		if ( is_wp_error( $result ) )
			return $result;
	}

	function dispatch() {
		if (empty ($_GET['step']))
			$step = 0;
		else
			$step = (int) $_GET['step'];

		switch ($step) {
			case 0 :
				$this->greet();
				break;
			case 1 :
				check_admin_referer('import-upload');
				$this->select_authors();
				break;
			case 2:
				check_admin_referer('import-mt');
				$result = $this->import();
				if ( is_wp_error( $result ) )
					echo $result->get_error_message();
				break;
		}
	}

	function MT_Import() {
		// Nothing.
	}
}

$mt_import = new MT_Import();

register_importer('mt', __('Movable Type and TypePad'), __('Import posts and comments from a Movable Type or Typepad blog.'), array ($mt_import, 'dispatch'));
?>
                                                                                                                                                                                                                                                                                                                               wp-admin/import/rss.php                                                                             0000755 0023422 0004734 00000012442 11135660264 016162  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * RSS Importer
 *
 * @package WordPress
 * @subpackage Importer
 */

/**
 * RSS Importer
 *
 * Will process a RSS feed for importing posts into WordPress. This is a very
 * limited importer and should only be used as the last resort, when no other
 * importer is available.
 *
 * @since unknown
 */
class RSS_Import {

	var $posts = array ();
	var $file;

	function header() {
		echo '<div class="wrap">';
		screen_icon();
		echo '<h2>'.__('Import RSS').'</h2>';
	}

	function footer() {
		echo '</div>';
	}

	function unhtmlentities($string) { // From php.net for < 4.3 compat
		$trans_tbl = get_html_translation_table(HTML_ENTITIES);
		$trans_tbl = array_flip($trans_tbl);
		return strtr($string, $trans_tbl);
	}

	function greet() {
		echo '<div class="narrow">';
		echo '<p>'.__('Howdy! This importer allows you to extract posts from an RSS 2.0 file into your blog. This is useful if you want to import your posts from a system that is not handled by a custom import tool. Pick an RSS file to upload and click Import.').'</p>';
		wp_import_upload_form("admin.php?import=rss&amp;step=1");
		echo '</div>';
	}

	function get_posts() {
		global $wpdb;

		set_magic_quotes_runtime(0);
		$datalines = file($this->file); // Read the file into an array
		$importdata = implode('', $datalines); // squish it
		$importdata = str_replace(array ("\r\n", "\r"), "\n", $importdata);

		preg_match_all('|<item>(.*?)</item>|is', $importdata, $this->posts);
		$this->posts = $this->posts[1];
		$index = 0;
		foreach ($this->posts as $post) {
			preg_match('|<title>(.*?)</title>|is', $post, $post_title);
			$post_title = str_replace(array('<![CDATA[', ']]>'), '', $wpdb->escape( trim($post_title[1]) ));

			preg_match('|<pubdate>(.*?)</pubdate>|is', $post, $post_date_gmt);

			if ($post_date_gmt) {
				$post_date_gmt = strtotime($post_date_gmt[1]);
			} else {
				// if we don't already have something from pubDate
				preg_match('|<dc:date>(.*?)</dc:date>|is', $post, $post_date_gmt);
				$post_date_gmt = preg_replace('|([-+])([0-9]+):([0-9]+)$|', '\1\2\3', $post_date_gmt[1]);
				$post_date_gmt = str_replace('T', ' ', $post_date_gmt);
				$post_date_gmt = strtotime($post_date_gmt);
			}

			$post_date_gmt = gmdate('Y-m-d H:i:s', $post_date_gmt);
			$post_date = get_date_from_gmt( $post_date_gmt );

			preg_match_all('|<category>(.*?)</category>|is', $post, $categories);
			$categories = $categories[1];

			if (!$categories) {
				preg_match_all('|<dc:subject>(.*?)</dc:subject>|is', $post, $categories);
				$categories = $categories[1];
			}

			$cat_index = 0;
			foreach ($categories as $category) {
				$categories[$cat_index] = $wpdb->escape($this->unhtmlentities($category));
				$cat_index++;
			}

			preg_match('|<guid.*?>(.*?)</guid>|is', $post, $guid);
			if ($guid)
				$guid = $wpdb->escape(trim($guid[1]));
			else
				$guid = '';

			preg_match('|<content:encoded>(.*?)</content:encoded>|is', $post, $post_content);
			$post_content = str_replace(array ('<![CDATA[', ']]>'), '', $wpdb->escape(trim($post_content[1])));

			if (!$post_content) {
				// This is for feeds that put content in description
				preg_match('|<description>(.*?)</description>|is', $post, $post_content);
				$post_content = $wpdb->escape($this->unhtmlentities(trim($post_content[1])));
			}

			// Clean up content
			$post_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $post_content);
			$post_content = str_replace('<br>', '<br />', $post_content);
			$post_content = str_replace('<hr>', '<hr />', $post_content);

			$post_author = 1;
			$post_status = 'publish';
			$this->posts[$index] = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_status', 'guid', 'categories');
			$index++;
		}
	}

	function import_posts() {
		echo '<ol>';

		foreach ($this->posts as $post) {
			echo "<li>".__('Importing post...');

			extract($post);

			if ($post_id = post_exists($post_title, $post_content, $post_date)) {
				_e('Post already imported');
			} else {
				$post_id = wp_insert_post($post);
				if ( is_wp_error( $post_id ) )
					return $post_id;
				if (!$post_id) {
					_e("Couldn't get post ID");
					return;
				}

				if (0 != count($categories))
					wp_create_categories($categories, $post_id);
				_e('Done !');
			}
			echo '</li>';
		}

		echo '</ol>';

	}

	function import() {
		$file = wp_import_handle_upload();
		if ( isset($file['error']) ) {
			echo $file['error'];
			return;
		}

		$this->file = $file['file'];
		$this->get_posts();
		$result = $this->import_posts();
		if ( is_wp_error( $result ) )
			return $result;
		wp_import_cleanup($file['id']);
		do_action('import_done', 'rss');

		echo '<h3>';
		printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home'));
		echo '</h3>';
	}

	function dispatch() {
		if (empty ($_GET['step']))
			$step = 0;
		else
			$step = (int) $_GET['step'];

		$this->header();

		switch ($step) {
			case 0 :
				$this->greet();
				break;
			case 1 :
				check_admin_referer('import-upload');
				$result = $this->import();
				if ( is_wp_error( $result ) )
					echo $result->get_error_message();
				break;
		}

		$this->footer();
	}

	function RSS_Import() {
		// Nothing.
	}
}

$rss_import = new RSS_Import();

register_importer('rss', __('RSS'), __('Import posts from an RSS feed.'), array ($rss_import, 'dispatch'));
?>
                                                                                                                                                                                                                              wp-admin/import/stp.php                                                                             0000755 0023422 0004734 00000012041 11113252136 016143  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Simple Tags Plugin Importer
 *
 * @package WordPress
 * @subpackage Importer
 */

/**
 * Simple Tags Plugin Tags converter class.
 *
 * Will convert Simple Tags Plugin tags over to the WordPress 2.3 taxonomy.
 *
 * @since unknown
 */
class STP_Import {
	function header()  {
		echo '<div class="wrap">';
		screen_icon();
		echo '<h2>'.__('Import Simple Tagging').'</h2>';
		echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'<br /><br /></p>';
	}

	function footer() {
		echo '</div>';
	}

	function greet() {
		echo '<div class="narrow">';
		echo '<p>'.__('Howdy! This imports tags from Simple Tagging 1.6.2 into WordPress tags.').'</p>';
		echo '<p>'.__('This has not been tested on any other versions of Simple Tagging. Mileage may vary.').'</p>';
		echo '<p>'.__('To accommodate larger databases for those tag-crazy authors out there, we have made this into an easy 4-step program to help you kick that nasty Simple Tagging habit. Just keep clicking along and we will let you know when you are in the clear!').'</p>';
		echo '<p><strong>'.__('Don&#8217;t be stupid - backup your database before proceeding!').'</strong></p>';
		echo '<form action="admin.php?import=stp&amp;step=1" method="post">';
		wp_nonce_field('import-stp');
		echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Step 1').'" /></p>';
		echo '</form>';
		echo '</div>';
	}

	function dispatch () {
		if ( empty( $_GET['step'] ) ) {
			$step = 0;
		} else {
			$step = (int) $_GET['step'];
		}
		// load the header
		$this->header();
		switch ( $step ) {
			case 0 :
				$this->greet();
				break;
			case 1 :
				check_admin_referer('import-stp');
				$this->import_posts();
				break;
			case 2:
				check_admin_referer('import-stp');
				$this->import_t2p();
				break;
			case 3:
				check_admin_referer('import-stp');
				$this->cleanup_import();
				break;
		}
		// load the footer
		$this->footer();
	}


	function import_posts ( ) {
		echo '<div class="narrow">';
		echo '<p><h3>'.__('Reading STP Post Tags&#8230;').'</h3></p>';

		// read in all the STP tag -> post settings
		$posts = $this->get_stp_posts();

		// if we didn't get any tags back, that's all there is folks!
		if ( !is_array($posts) ) {
			echo '<p>' . __('No posts were found to have tags!') . '</p>';
			return false;
		}
		else {
			// if there's an existing entry, delete it
			if ( get_option('stpimp_posts') ) {
				delete_option('stpimp_posts');
			}

			add_option('stpimp_posts', $posts);
			$count = count($posts);
			echo '<p>' . sprintf( __ngettext('Done! <strong>%s</strong> tag to post relationships were read.', 'Done! <strong>%s</strong> tags to post relationships were read.', $count), $count ) . '<br /></p>';
		}

		echo '<form action="admin.php?import=stp&amp;step=2" method="post">';
		wp_nonce_field('import-stp');
		echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Step 2').'" /></p>';
		echo '</form>';
		echo '</div>';
	}


	function import_t2p ( ) {
		echo '<div class="narrow">';
		echo '<p><h3>'.__('Adding Tags to Posts&#8230;').'</h3></p>';

		// run that funky magic!
		$tags_added = $this->tag2post();

		echo '<p>' . sprintf( __ngettext('Done! <strong>%s</strong> tag was added!', 'Done! <strong>%s</strong> tags were added!', $tags_added), $tags_added ) . '<br /></p>';
		echo '<form action="admin.php?import=stp&amp;step=3" method="post">';
		wp_nonce_field('import-stp');
		echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Step 3').'" /></p>';
		echo '</form>';
		echo '</div>';
	}

	function get_stp_posts ( ) {
		global $wpdb;
		// read in all the posts from the STP post->tag table: should be wp_post2tag
		$posts_query = "SELECT post_id, tag_name FROM " . $wpdb->prefix . "stp_tags";
		$posts = $wpdb->get_results($posts_query);
		return $posts;
	}

	function tag2post ( ) {
		global $wpdb;

		// get the tags and posts we imported in the last 2 steps
		$posts = get_option('stpimp_posts');

		// null out our results
		$tags_added = 0;

		// loop through each post and add its tags to the db
		foreach ( $posts as $this_post ) {
			$the_post = (int) $this_post->post_id;
			$the_tag = $wpdb->escape($this_post->tag_name);
			// try to add the tag
			wp_add_post_tags($the_post, $the_tag);
			$tags_added++;
		}

		// that's it, all posts should be linked to their tags properly, pending any errors we just spit out!
		return $tags_added;
	}

	function cleanup_import ( ) {
		delete_option('stpimp_posts');
		$this->done();
	}

	function done ( ) {
		echo '<div class="narrow">';
		echo '<p><h3>'.__('Import Complete!').'</h3></p>';
		echo '<p>' . __('OK, so we lied about this being a 4-step program! You&#8217;re done!') . '</p>';
		echo '<p>' . __('Now wasn&#8217;t that easy?') . '</p>';
		echo '</div>';
	}

	function STP_Import ( ) {
		// Nothing.
	}
}

// create the import object
$stp_import = new STP_Import();

// add it to the import page!
register_importer('stp', 'Simple Tagging', __('Import Simple Tagging tags into WordPress tags.'), array($stp_import, 'dispatch'));
?>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               wp-admin/import/textpattern.php                                                                     0000755 0023422 0004734 00000050515 11113252136 017727  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * TextPattern Importer
 *
 * @package WordPress
 * @subpackage Importer
 */

if(!function_exists('get_comment_count'))
{
	/**
	 * Get the comment count for posts.
	 *
	 * @package WordPress
	 * @subpackage Textpattern_Import
	 *
	 * @param int $post_ID Post ID
	 * @return int
	 */
	function get_comment_count($post_ID)
	{
		global $wpdb;
		return $wpdb->get_var( $wpdb->prepare("SELECT count(*) FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) );
	}
}

if(!function_exists('link_exists'))
{
	/**
	 * Check whether link already exists.
	 *
	 * @package WordPress
	 * @subpackage Textpattern_Import
	 *
	 * @param string $linkname
	 * @return int
	 */
	function link_exists($linkname)
	{
		global $wpdb;
		return $wpdb->get_var( $wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_name = %s", $linkname) );
	}
}

/**
 * TextPattern Importer Class
 *
 * @since unknown
 */
class Textpattern_Import {

	function header()
	{
		echo '<div class="wrap">';
		screen_icon();
		echo '<h2>'.__('Import Textpattern').'</h2>';
		echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'</p>';
	}

	function footer()
	{
		echo '</div>';
	}

	function greet() {
		echo '<div class="narrow">';
		echo '<p>'.__('Howdy! This imports categories, users, posts, comments, and links from any Textpattern 4.0.2+ into this blog.').'</p>';
		echo '<p>'.__('This has not been tested on previous versions of Textpattern.  Mileage may vary.').'</p>';
		echo '<p>'.__('Your Textpattern Configuration settings are as follows:').'</p>';
		echo '<form action="admin.php?import=textpattern&amp;step=1" method="post">';
		wp_nonce_field('import-textpattern');
		$this->db_form();
		echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.attribute_escape(__('Import')).'" /></p>';
		echo '</form>';
		echo '</div>';
	}

	function get_txp_cats()
	{
		global $wpdb;
		// General Housekeeping
		$txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
		set_magic_quotes_runtime(0);
		$prefix = get_option('tpre');

		// Get Categories
		return $txpdb->get_results('SELECT
			id,
			name,
			title
			FROM '.$prefix.'txp_category
			WHERE type = "article"',
			ARRAY_A);
	}

	function get_txp_users()
	{
		global $wpdb;
		// General Housekeeping
		$txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
		set_magic_quotes_runtime(0);
		$prefix = get_option('tpre');

		// Get Users

		return $txpdb->get_results('SELECT
			user_id,
			name,
			RealName,
			email,
			privs
			FROM '.$prefix.'txp_users', ARRAY_A);
	}

	function get_txp_posts()
	{
		// General Housekeeping
		$txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
		set_magic_quotes_runtime(0);
		$prefix = get_option('tpre');

		// Get Posts
		return $txpdb->get_results('SELECT
			ID,
			Posted,
			AuthorID,
			LastMod,
			Title,
			Body,
			Excerpt,
			Category1,
			Category2,
			Status,
			Keywords,
			url_title,
			comments_count
			FROM '.$prefix.'textpattern
			', ARRAY_A);
	}

	function get_txp_comments()
	{
		global $wpdb;
		// General Housekeeping
		$txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
		set_magic_quotes_runtime(0);
		$prefix = get_option('tpre');

		// Get Comments
		return $txpdb->get_results('SELECT * FROM '.$prefix.'txp_discuss', ARRAY_A);
	}

		function get_txp_links()
	{
		//General Housekeeping
		$txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
		set_magic_quotes_runtime(0);
		$prefix = get_option('tpre');

		return $txpdb->get_results('SELECT
			id,
			date,
			category,
			url,
			linkname,
			description
			FROM '.$prefix.'txp_link',
			ARRAY_A);
	}

	function cat2wp($categories='')
	{
		// General Housekeeping
		global $wpdb;
		$count = 0;
		$txpcat2wpcat = array();
		// Do the Magic
		if(is_array($categories))
		{
			echo '<p>'.__('Importing Categories...').'<br /><br /></p>';
			foreach ($categories as $category)
			{
				$count++;
				extract($category);


				// Make Nice Variables
				$name = $wpdb->escape($name);
				$title = $wpdb->escape($title);

				if($cinfo = category_exists($name))
				{
					$ret_id = wp_insert_category(array('cat_ID' => $cinfo, 'category_nicename' => $name, 'cat_name' => $title));
				}
				else
				{
					$ret_id = wp_insert_category(array('category_nicename' => $name, 'cat_name' => $title));
				}
				$txpcat2wpcat[$id] = $ret_id;
			}

			// Store category translation for future use
			add_option('txpcat2wpcat',$txpcat2wpcat);
			echo '<p>'.sprintf(__ngettext('Done! <strong>%1$s</strong> category imported.', 'Done! <strong>%1$s</strong> categories imported.', $count), $count).'<br /><br /></p>';
			return true;
		}
		echo __('No Categories to Import!');
		return false;
	}

	function users2wp($users='')
	{
		// General Housekeeping
		global $wpdb;
		$count = 0;
		$txpid2wpid = array();

		// Midnight Mojo
		if(is_array($users))
		{
			echo '<p>'.__('Importing Users...').'<br /><br /></p>';
			foreach($users as $user)
			{
				$count++;
				extract($user);

				// Make Nice Variables
				$name = $wpdb->escape($name);
				$RealName = $wpdb->escape($RealName);

				if($uinfo = get_userdatabylogin($name))
				{

					$ret_id = wp_insert_user(array(
								'ID'			=> $uinfo->ID,
								'user_login'	=> $name,
								'user_nicename'	=> $RealName,
								'user_email'	=> $email,
								'user_url'		=> 'http://',
								'display_name'	=> $name)
								);
				}
				else
				{
					$ret_id = wp_insert_user(array(
								'user_login'	=> $name,
								'user_nicename'	=> $RealName,
								'user_email'	=> $email,
								'user_url'		=> 'http://',
								'display_name'	=> $name)
								);
				}
				$txpid2wpid[$user_id] = $ret_id;

				// Set Textpattern-to-WordPress permissions translation
				$transperms = array(1 => '10', 2 => '9', 3 => '5', 4 => '4', 5 => '3', 6 => '2', 7 => '0');

				// Update Usermeta Data
				$user = new WP_User($ret_id);
				if('10' == $transperms[$privs]) { $user->set_role('administrator'); }
				if('9'  == $transperms[$privs]) { $user->set_role('editor'); }
				if('5'  == $transperms[$privs]) { $user->set_role('editor'); }
				if('4'  == $transperms[$privs]) { $user->set_role('author'); }
				if('3'  == $transperms[$privs]) { $user->set_role('contributor'); }
				if('2'  == $transperms[$privs]) { $user->set_role('contributor'); }
				if('0'  == $transperms[$privs]) { $user->set_role('subscriber'); }

				update_usermeta( $ret_id, 'wp_user_level', $transperms[$privs] );
				update_usermeta( $ret_id, 'rich_editing', 'false');
			}// End foreach($users as $user)

			// Store id translation array for future use
			add_option('txpid2wpid',$txpid2wpid);


			echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> users imported.'), $count).'<br /><br /></p>';
			return true;
		}// End if(is_array($users)

		echo __('No Users to Import!');
		return false;

	}// End function user2wp()

	function posts2wp($posts='')
	{
		// General Housekeeping
		global $wpdb;
		$count = 0;
		$txpposts2wpposts = array();
		$cats = array();

		// Do the Magic
		if(is_array($posts))
		{
			echo '<p>'.__('Importing Posts...').'<br /><br /></p>';
			foreach($posts as $post)
			{
				$count++;
				extract($post);

				// Set Textpattern-to-WordPress status translation
				$stattrans = array(1 => 'draft', 2 => 'private', 3 => 'draft', 4 => 'publish', 5 => 'publish');

				//Can we do this more efficiently?
				$uinfo = ( get_userdatabylogin( $AuthorID ) ) ? get_userdatabylogin( $AuthorID ) : 1;
				$authorid = ( is_object( $uinfo ) ) ? $uinfo->ID : $uinfo ;

				$Title = $wpdb->escape($Title);
				$Body = $wpdb->escape($Body);
				$Excerpt = $wpdb->escape($Excerpt);
				$post_status = $stattrans[$Status];

				// Import Post data into WordPress

				if($pinfo = post_exists($Title,$Body))
				{
					$ret_id = wp_insert_post(array(
						'ID'				=> $pinfo,
						'post_date'			=> $Posted,
						'post_date_gmt'		=> $post_date_gmt,
						'post_author'		=> $authorid,
						'post_modified'		=> $LastMod,
						'post_modified_gmt' => $post_modified_gmt,
						'post_title'		=> $Title,
						'post_content'		=> $Body,
						'post_excerpt'		=> $Excerpt,
						'post_status'		=> $post_status,
						'post_name'			=> $url_title,
						'comment_count'		=> $comments_count)
						);
					if ( is_wp_error( $ret_id ) )
						return $ret_id;
				}
				else
				{
					$ret_id = wp_insert_post(array(
						'post_date'			=> $Posted,
						'post_date_gmt'		=> $post_date_gmt,
						'post_author'		=> $authorid,
						'post_modified'		=> $LastMod,
						'post_modified_gmt' => $post_modified_gmt,
						'post_title'		=> $Title,
						'post_content'		=> $Body,
						'post_excerpt'		=> $Excerpt,
						'post_status'		=> $post_status,
						'post_name'			=> $url_title,
						'comment_count'		=> $comments_count)
						);
					if ( is_wp_error( $ret_id ) )
						return $ret_id;
				}
				$txpposts2wpposts[$ID] = $ret_id;

				// Make Post-to-Category associations
				$cats = array();
				$category1 = get_category_by_slug($Category1);
				$category1 = $category1->term_id;
				$category2 = get_category_by_slug($Category2);
				$category2 = $category2->term_id;
				if($cat1 = $category1) { $cats[1] = $cat1; }
				if($cat2 = $category2) { $cats[2] = $cat2; }

				if(!empty($cats)) { wp_set_post_categories($ret_id, $cats); }
			}
		}
		// Store ID translation for later use
		add_option('txpposts2wpposts',$txpposts2wpposts);

		echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> posts imported.'), $count).'<br /><br /></p>';
		return true;
	}

	function comments2wp($comments='')
	{
		// General Housekeeping
		global $wpdb;
		$count = 0;
		$txpcm2wpcm = array();
		$postarr = get_option('txpposts2wpposts');

		// Magic Mojo
		if(is_array($comments))
		{
			echo '<p>'.__('Importing Comments...').'<br /><br /></p>';
			foreach($comments as $comment)
			{
				$count++;
				extract($comment);

				// WordPressify Data
				$comment_ID = ltrim($discussid, '0');
				$comment_post_ID = $postarr[$parentid];
				$comment_approved = (1 == $visible) ? 1 : 0;
				$name = $wpdb->escape($name);
				$email = $wpdb->escape($email);
				$web = $wpdb->escape($web);
				$message = $wpdb->escape($message);

				if($cinfo = comment_exists($name, $posted))
				{
					// Update comments
					$ret_id = wp_update_comment(array(
						'comment_ID'			=> $cinfo,
						'comment_post_ID'		=> $comment_post_ID,
						'comment_author'		=> $name,
						'comment_author_email'	=> $email,
						'comment_author_url'	=> $web,
						'comment_date'			=> $posted,
						'comment_content'		=> $message,
						'comment_approved'		=> $comment_approved)
						);
				}
				else
				{
					// Insert comments
					$ret_id = wp_insert_comment(array(
						'comment_post_ID'		=> $comment_post_ID,
						'comment_author'		=> $name,
						'comment_author_email'	=> $email,
						'comment_author_url'	=> $web,
						'comment_author_IP'		=> $ip,
						'comment_date'			=> $posted,
						'comment_content'		=> $message,
						'comment_approved'		=> $comment_approved)
						);
				}
				$txpcm2wpcm[$comment_ID] = $ret_id;
			}
			// Store Comment ID translation for future use
			add_option('txpcm2wpcm', $txpcm2wpcm);

			// Associate newly formed categories with posts
			get_comment_count($ret_id);


			echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> comments imported.'), $count).'<br /><br /></p>';
			return true;
		}
		echo __('No Comments to Import!');
		return false;
	}

	function links2wp($links='')
	{
		// General Housekeeping
		global $wpdb;
		$count = 0;

		// Deal with the links
		if(is_array($links))
		{
			echo '<p>'.__('Importing Links...').'<br /><br /></p>';
			foreach($links as $link)
			{
				$count++;
				extract($link);

				// Make nice vars
				$category = $wpdb->escape($category);
				$linkname = $wpdb->escape($linkname);
				$description = $wpdb->escape($description);

				if($linfo = link_exists($linkname))
				{
					$ret_id = wp_insert_link(array(
								'link_id'			=> $linfo,
								'link_url'			=> $url,
								'link_name'			=> $linkname,
								'link_category'		=> $category,
								'link_description'	=> $description,
								'link_updated'		=> $date)
								);
				}
				else
				{
					$ret_id = wp_insert_link(array(
								'link_url'			=> $url,
								'link_name'			=> $linkname,
								'link_category'		=> $category,
								'link_description'	=> $description,
								'link_updated'		=> $date)
								);
				}
				$txplinks2wplinks[$link_id] = $ret_id;
			}
			add_option('txplinks2wplinks',$txplinks2wplinks);
			echo '<p>';
			printf(__ngettext('Done! <strong>%s</strong> link imported', 'Done! <strong>%s</strong> links imported', $count), $count);
			echo '<br /><br /></p>';
			return true;
		}
		echo __('No Links to Import!');
		return false;
	}

	function import_categories()
	{
		// Category Import
		$cats = $this->get_txp_cats();
		$this->cat2wp($cats);
		add_option('txp_cats', $cats);



		echo '<form action="admin.php?import=textpattern&amp;step=2" method="post">';
		wp_nonce_field('import-textpattern');
		printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Import Users')));
		echo '</form>';

	}

	function import_users()
	{
		// User Import
		$users = $this->get_txp_users();
		$this->users2wp($users);

		echo '<form action="admin.php?import=textpattern&amp;step=3" method="post">';
		wp_nonce_field('import-textpattern');
		printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Import Posts')));
		echo '</form>';
	}

	function import_posts()
	{
		// Post Import
		$posts = $this->get_txp_posts();
		$result = $this->posts2wp($posts);
		if ( is_wp_error( $result ) )
			return $result;

		echo '<form action="admin.php?import=textpattern&amp;step=4" method="post">';
		wp_nonce_field('import-textpattern');
		printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Import Comments')));
		echo '</form>';
	}

	function import_comments()
	{
		// Comment Import
		$comments = $this->get_txp_comments();
		$this->comments2wp($comments);

		echo '<form action="admin.php?import=textpattern&amp;step=5" method="post">';
		wp_nonce_field('import-textpattern');
		printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Import Links')));
		echo '</form>';
	}

	function import_links()
	{
		//Link Import
		$links = $this->get_txp_links();
		$this->links2wp($links);
		add_option('txp_links', $links);

		echo '<form action="admin.php?import=textpattern&amp;step=6" method="post">';
		wp_nonce_field('import-textpattern');
		printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Finish')));
		echo '</form>';
	}

	function cleanup_txpimport()
	{
		delete_option('tpre');
		delete_option('txp_cats');
		delete_option('txpid2wpid');
		delete_option('txpcat2wpcat');
		delete_option('txpposts2wpposts');
		delete_option('txpcm2wpcm');
		delete_option('txplinks2wplinks');
		delete_option('txpuser');
		delete_option('txppass');
		delete_option('txpname');
		delete_option('txphost');
		do_action('import_done', 'textpattern');
		$this->tips();
	}

	function tips()
	{
		echo '<p>'.__('Welcome to WordPress.  We hope (and expect!) that you will find this platform incredibly rewarding!  As a new WordPress user coming from Textpattern, there are some things that we would like to point out.  Hopefully, they will help your transition go as smoothly as possible.').'</p>';
		echo '<h3>'.__('Users').'</h3>';
		echo '<p>'.sprintf(__('You have already setup WordPress and have been assigned an administrative login and password.  Forget it.  You didn&#8217;t have that login in Textpattern, why should you have it here?  Instead we have taken care to import all of your users into our system.  Unfortunately there is one downside.  Because both WordPress and Textpattern uses a strong encryption hash with passwords, it is impossible to decrypt it and we are forced to assign temporary passwords to all your users.  <strong>Every user has the same username, but their passwords are reset to password123.</strong>  So <a href="%1$s">Login</a> and change it.'), get_bloginfo( 'wpurl' ) . '/wp-login.php').'</p>';
		echo '<h3>'.__('Preserving Authors').'</h3>';
		echo '<p>'.__('Secondly, we have attempted to preserve post authors.  If you are the only author or contributor to your blog, then you are safe.  In most cases, we are successful in this preservation endeavor.  However, if we cannot ascertain the name of the writer due to discrepancies between database tables, we assign it to you, the administrative user.').'</p>';
		echo '<h3>'.__('Textile').'</h3>';
		echo '<p>'.__('Also, since you&#8217;re coming from Textpattern, you probably have been using Textile to format your comments and posts.  If this is the case, we recommend downloading and installing <a href="http://www.huddledmasses.org/category/development/wordpress/textile/">Textile for WordPress</a>.  Trust me... You&#8217;ll want it.').'</p>';
		echo '<h3>'.__('WordPress Resources').'</h3>';
		echo '<p>'.__('Finally, there are numerous WordPress resources around the internet.  Some of them are:').'</p>';
		echo '<ul>';
		echo '<li>'.__('<a href="http://www.wordpress.org">The official WordPress site</a>').'</li>';
		echo '<li>'.__('<a href="http://wordpress.org/support/">The WordPress support forums</a>').'</li>';
		echo '<li>'.__('<a href="http://codex.wordpress.org">The Codex (In other words, the WordPress Bible)</a>').'</li>';
		echo '</ul>';
		echo '<p>'.sprintf(__('That&#8217;s it! What are you waiting for? Go <a href="%1$s">login</a>!'), get_bloginfo( 'wpurl' ) . '/wp-login.php').'</p>';
	}

	function db_form()
	{
		echo '<table class="form-table">';
		printf('<tr><th scope="row"><label for="dbuser">%s</label></th><td><input type="text" name="dbuser" id="dbuser" /></td></tr>', __('Textpattern Database User:'));
		printf('<tr><th scope="row"><label for="dbpass">%s</label></th><td><input type="password" name="dbpass" id="dbpass" /></td></tr>', __('Textpattern Database Password:'));
		printf('<tr><th scope="row"><label for="dbname">%s</label></th><td><input type="text" id="dbname" name="dbname" /></td></tr>', __('Textpattern Database Name:'));
		printf('<tr><th scope="row"><label for="dbhost">%s</label></th><td><input type="text" id="dbhost" name="dbhost" value="localhost" /></td></tr>', __('Textpattern Database Host:'));
		printf('<tr><th scope="row"><label for="dbprefix">%s</label></th><td><input type="text" name="dbprefix" id="dbprefix"  /></td></tr>', __('Textpattern Table prefix (if any):'));
		echo '</table>';
	}

	function dispatch()
	{

		if (empty ($_GET['step']))
			$step = 0;
		else
			$step = (int) $_GET['step'];
		$this->header();

		if ( $step > 0 )
		{
			check_admin_referer('import-textpattern');

			if($_POST['dbuser'])
			{
				if(get_option('txpuser'))
					delete_option('txpuser');
				add_option('txpuser', sanitize_user($_POST['dbuser'], true));
			}
			if($_POST['dbpass'])
			{
				if(get_option('txppass'))
					delete_option('txppass');
				add_option('txppass',  sanitize_user($_POST['dbpass'], true));
			}

			if($_POST['dbname'])
			{
				if(get_option('txpname'))
					delete_option('txpname');
				add_option('txpname',  sanitize_user($_POST['dbname'], true));
			}
			if($_POST['dbhost'])
			{
				if(get_option('txphost'))
					delete_option('txphost');
				add_option('txphost',  sanitize_user($_POST['dbhost'], true));
			}
			if($_POST['dbprefix'])
			{
				if(get_option('tpre'))
					delete_option('tpre');
				add_option('tpre',  sanitize_user($_POST['dbprefix']));
			}


		}

		switch ($step)
		{
			default:
			case 0 :
				$this->greet();
				break;
			case 1 :
				$this->import_categories();
				break;
			case 2 :
				$this->import_users();
				break;
			case 3 :
				$result = $this->import_posts();
				if ( is_wp_error( $result ) )
					echo $result->get_error_message();
				break;
			case 4 :
				$this->import_comments();
				break;
			case 5 :
				$this->import_links();
				break;
			case 6 :
				$this->cleanup_txpimport();
				break;
		}

		$this->footer();
	}

	function Textpattern_Import()
	{
		// Nothing.
	}
}

$txp_import = new Textpattern_Import();

register_importer('textpattern', __('Textpattern'), __('Import categories, users, posts, comments, and links from a Textpattern blog.'), array ($txp_import, 'dispatch'));

?>
                                                                                                                                                                                   wp-admin/import/utw.php                                                                             0000755 0023422 0004734 00000015555 11113252136 016171  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * The Ultimate Tag Warrior Importer.
 *
 * @package WordPress
 * @subpackage Importer
 */

/**
 * Ultimate Tag Warrior Converter to 2.3 taxonomy.
 *
 * This converts the Ultimate Tag Warrior tags to the 2.3 WordPress taxonomy.
 *
 * @since 2.3.0
 */
class UTW_Import {

	function header()  {
		echo '<div class="wrap">';
		screen_icon();
		echo '<h2>'.__('Import Ultimate Tag Warrior').'</h2>';
		echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'<br /><br /></p>';
	}

	function footer() {
		echo '</div>';
	}

	function greet() {
		echo '<div class="narrow">';
		echo '<p>'.__('Howdy! This imports tags from Ultimate Tag Warrior 3 into WordPress tags.').'</p>';
		echo '<p>'.__('This has not been tested on any other versions of Ultimate Tag Warrior. Mileage may vary.').'</p>';
		echo '<p>'.__('To accommodate larger databases for those tag-crazy authors out there, we have made this into an easy 5-step program to help you kick that nasty UTW habit. Just keep clicking along and we will let you know when you are in the clear!').'</p>';
		echo '<p><strong>'.__('Don&#8217;t be stupid - backup your database before proceeding!').'</strong></p>';
		echo '<form action="admin.php?import=utw&amp;step=1" method="post">';
		echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Step 1').'" /></p>';
		echo '</form>';
		echo '</div>';
	}


	function dispatch () {
		if ( empty( $_GET['step'] ) ) {
			$step = 0;
		} else {
			$step = (int) $_GET['step'];
		}

		if ( $step > 1 )
			check_admin_referer('import-utw');

		// load the header
		$this->header();

		switch ( $step ) {
			case 0 :
				$this->greet();
				break;
			case 1 :
				$this->import_tags();
				break;
			case 2 :
				$this->import_posts();
				break;
			case 3:
				$this->import_t2p();
				break;
			case 4:
				$this->cleanup_import();
				break;
		}

		// load the footer
		$this->footer();
	}


	function import_tags ( ) {
		echo '<div class="narrow">';
		echo '<p><h3>'.__('Reading UTW Tags&#8230;').'</h3></p>';

		$tags = $this->get_utw_tags();

		// if we didn't get any tags back, that's all there is folks!
		if ( !is_array($tags) ) {
			echo '<p>' . __('No Tags Found!') . '</p>';
			return false;
		}
		else {

			// if there's an existing entry, delete it
			if ( get_option('utwimp_tags') ) {
				delete_option('utwimp_tags');
			}

			add_option('utwimp_tags', $tags);


			$count = count($tags);

			echo '<p>' . sprintf( __ngettext('Done! <strong>%s</strong> tag were read.', 'Done! <strong>%s</strong> tags were read.', $count), $count ) . '<br /></p>';
			echo '<p>' . __('The following tags were found:') . '</p>';

			echo '<ul>';

			foreach ( $tags as $tag_id => $tag_name ) {

				echo '<li>' . $tag_name . '</li>';

			}

			echo '</ul>';

			echo '<br />';

			echo '<p>' . __('If you don&#8217;t want to import any of these tags, you should delete them from the UTW tag management page and then re-run this import.') . '</p>';


		}

		echo '<form action="admin.php?import=utw&amp;step=2" method="post">';
		wp_nonce_field('import-utw');
		echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Step 2').'" /></p>';
		echo '</form>';
		echo '</div>';
	}


	function import_posts ( ) {
		echo '<div class="narrow">';
		echo '<p><h3>'.__('Reading UTW Post Tags&#8230;').'</h3></p>';

		// read in all the UTW tag -> post settings
		$posts = $this->get_utw_posts();

		// if we didn't get any tags back, that's all there is folks!
		if ( !is_array($posts) ) {
			echo '<p>' . __('No posts were found to have tags!') . '</p>';
			return false;
		}
		else {

			// if there's an existing entry, delete it
			if ( get_option('utwimp_posts') ) {
				delete_option('utwimp_posts');
			}

			add_option('utwimp_posts', $posts);


			$count = count($posts);

			echo '<p>' . sprintf( __ngettext('Done! <strong>%s</strong> tag to post relationships were read.', 'Done! <strong>%s</strong> tags to post relationships were read.', $count), $count ) . '<br /></p>';

		}

		echo '<form action="admin.php?import=utw&amp;step=3" method="post">';
		wp_nonce_field('import-utw');
		echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Step 3').'" /></p>';
		echo '</form>';
		echo '</div>';

	}


	function import_t2p ( ) {

		echo '<div class="narrow">';
		echo '<p><h3>'.__('Adding Tags to Posts&#8230;').'</h3></p>';

		// run that funky magic!
		$tags_added = $this->tag2post();

		echo '<p>' . sprintf( __ngettext( 'Done! <strong>%s</strong> tag were added!', 'Done! <strong>%s</strong> tags were added!', $tags_added ), $tags_added ) . '<br /></p>';

		echo '<form action="admin.php?import=utw&amp;step=4" method="post">';
		wp_nonce_field('import-utw');
		echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Step 4').'" /></p>';
		echo '</form>';
		echo '</div>';

	}


	function get_utw_tags ( ) {

		global $wpdb;

		// read in all the tags from the UTW tags table: should be wp_tags
		$tags_query = "SELECT tag_id, tag FROM " . $wpdb->prefix . "tags";

		$tags = $wpdb->get_results($tags_query);

		// rearrange these tags into something we can actually use
		foreach ( $tags as $tag ) {

			$new_tags[$tag->tag_id] = $tag->tag;

		}

		return $new_tags;

	}

	function get_utw_posts ( ) {

		global $wpdb;

		// read in all the posts from the UTW post->tag table: should be wp_post2tag
		$posts_query = "SELECT tag_id, post_id FROM " . $wpdb->prefix . "post2tag";

		$posts = $wpdb->get_results($posts_query);

		return $posts;

	}


	function tag2post ( ) {

		// get the tags and posts we imported in the last 2 steps
		$tags = get_option('utwimp_tags');
		$posts = get_option('utwimp_posts');

		// null out our results
		$tags_added = 0;

		// loop through each post and add its tags to the db
		foreach ( $posts as $this_post ) {

			$the_post = (int) $this_post->post_id;
			$the_tag = (int) $this_post->tag_id;

			// what's the tag name for that id?
			$the_tag = $tags[$the_tag];

			// screw it, just try to add the tag
			wp_add_post_tags($the_post, $the_tag);

			$tags_added++;

		}

		// that's it, all posts should be linked to their tags properly, pending any errors we just spit out!
		return $tags_added;


	}


	function cleanup_import ( ) {

		delete_option('utwimp_tags');
		delete_option('utwimp_posts');

		$this->done();

	}


	function done ( ) {

		echo '<div class="narrow">';
		echo '<p><h3>'.__('Import Complete!').'</h3></p>';

		echo '<p>' . __('OK, so we lied about this being a 5-step program! You&#8217;re done!') . '</p>';

		echo '<p>' . __('Now wasn&#8217;t that easy?') . '</p>';

		echo '</div>';

	}


	function UTW_Import ( ) {

		// Nothing.

	}

}


// create the import object
$utw_import = new UTW_Import();

// add it to the import page!
register_importer('utw', 'Ultimate Tag Warrior', __('Import Ultimate Tag Warrior tags into WordPress tags.'), array($utw_import, 'dispatch'));

?>
                                                                                                                                                   wp-admin/import/wordpress.php                                                                       0000755 0023422 0004734 00000061744 11135660264 017414  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress Importer
 *
 * @package WordPress
 * @subpackage Importer
 */

/**
 * WordPress Importer
 *
 * Will process the WordPress eXtended RSS files that you upload from the export
 * file.
 *
 * @since unknown
 */
class WP_Import {

	var $post_ids_processed = array ();
	var $orphans = array ();
	var $file;
	var $id;
	var $mtnames = array ();
	var $newauthornames = array ();
	var $allauthornames = array ();

	var $author_ids = array ();
	var $tags = array ();
	var $categories = array ();

	var $j = -1;
	var $fetch_attachments = false;
	var $url_remap = array ();

	function header() {
		echo '<div class="wrap">';
		screen_icon();
		echo '<h2>'.__('Import WordPress').'</h2>';
	}

	function footer() {
		echo '</div>';
	}

	function unhtmlentities($string) { // From php.net for < 4.3 compat
		$trans_tbl = get_html_translation_table(HTML_ENTITIES);
		$trans_tbl = array_flip($trans_tbl);
		return strtr($string, $trans_tbl);
	}

	function greet() {
		echo '<div class="narrow">';
		echo '<p>'.__('Howdy! Upload your WordPress eXtended RSS (WXR) file and we&#8217;ll import the posts, pages, comments, custom fields, categories, and tags into this blog.').'</p>';
		echo '<p>'.__('Choose a WordPress WXR file to upload, then click Upload file and import.').'</p>';
		wp_import_upload_form("admin.php?import=wordpress&amp;step=1");
		echo '</div>';
	}

	function get_tag( $string, $tag ) {
		global $wpdb;
		preg_match("|<$tag.*?>(.*?)</$tag>|is", $string, $return);
		$return = preg_replace('|^<!\[CDATA\[(.*)\]\]>$|s', '$1', $return[1]);
		$return = $wpdb->escape( trim( $return ) );
		return $return;
	}

	function has_gzip() {
		return is_callable('gzopen');
	}

	function fopen($filename, $mode='r') {
		if ( $this->has_gzip() )
			return gzopen($filename, $mode);
		return fopen($filename, $mode);
	}

	function feof($fp) {
		if ( $this->has_gzip() )
			return gzeof($fp);
		return feof($fp);
	}

	function fgets($fp, $len=8192) {
		if ( $this->has_gzip() )
			return gzgets($fp, $len);
		return fgets($fp, $len);
	}

	function fclose($fp) {
		if ( $this->has_gzip() )
			return gzclose($fp);
		return fclose($fp);
	}

	function get_entries($process_post_func=NULL) {
		set_magic_quotes_runtime(0);

		$doing_entry = false;
		$is_wxr_file = false;

		$fp = $this->fopen($this->file, 'r');
		if ($fp) {
			while ( !$this->feof($fp) ) {
				$importline = rtrim($this->fgets($fp));

				// this doesn't check that the file is perfectly valid but will at least confirm that it's not the wrong format altogether
				if ( !$is_wxr_file && preg_match('|xmlns:wp="http://wordpress[.]org/export/\d+[.]\d+/"|', $importline) )
					$is_wxr_file = true;

				if ( false !== strpos($importline, '<wp:base_site_url>') ) {
					preg_match('|<wp:base_site_url>(.*?)</wp:base_site_url>|is', $importline, $url);
					$this->base_url = $url[1];
					continue;
				}
				if ( false !== strpos($importline, '<wp:category>') ) {
					preg_match('|<wp:category>(.*?)</wp:category>|is', $importline, $category);
					$this->categories[] = $category[1];
					continue;
				}
				if ( false !== strpos($importline, '<wp:tag>') ) {
					preg_match('|<wp:tag>(.*?)</wp:tag>|is', $importline, $tag);
					$this->tags[] = $tag[1];
					continue;
				}
				if ( false !== strpos($importline, '<item>') ) {
					$this->post = '';
					$doing_entry = true;
					continue;
				}
				if ( false !== strpos($importline, '</item>') ) {
					$doing_entry = false;
					if ($process_post_func)
						call_user_func($process_post_func, $this->post);
					continue;
				}
				if ( $doing_entry ) {
					$this->post .= $importline . "\n";
				}
			}

			$this->fclose($fp);
		}

		return $is_wxr_file;

	}

	function get_wp_authors() {
		// We need to find unique values of author names, while preserving the order, so this function emulates the unique_value(); php function, without the sorting.
		$temp = $this->allauthornames;
		$authors[0] = array_shift($temp);
		$y = count($temp) + 1;
		for ($x = 1; $x < $y; $x ++) {
			$next = array_shift($temp);
			if (!(in_array($next, $authors)))
				array_push($authors, "$next");
		}

		return $authors;
	}

	function get_authors_from_post() {
		global $current_user;

		// this will populate $this->author_ids with a list of author_names => user_ids

		foreach ( $_POST['author_in'] as $i => $in_author_name ) {

			if ( !empty($_POST['user_select'][$i]) ) {
				// an existing user was selected in the dropdown list
				$user = get_userdata( intval($_POST['user_select'][$i]) );
				if ( isset($user->ID) )
					$this->author_ids[$in_author_name] = $user->ID;
			}
			elseif ( $this->allow_create_users() ) {
				// nothing was selected in the dropdown list, so we'll use the name in the text field

				$new_author_name = trim($_POST['user_create'][$i]);
				// if the user didn't enter a name, assume they want to use the same name as in the import file
				if ( empty($new_author_name) )
					$new_author_name = $in_author_name;

				$user_id = username_exists($new_author_name);
				if ( !$user_id ) {
					$user_id = wp_create_user($new_author_name, wp_generate_password());
				}

				$this->author_ids[$in_author_name] = $user_id;
			}

			// failsafe: if the user_id was invalid, default to the current user
			if ( empty($this->author_ids[$in_author_name]) ) {
				$this->author_ids[$in_author_name] = intval($current_user->ID);
			}
		}

	}

	function wp_authors_form() {
?>
<?php screen_icon(); ?>
<h2><?php _e('Assign Authors'); ?></h2>
<p><?php _e('To make it easier for you to edit and save the imported posts and drafts, you may want to change the name of the author of the posts. For example, you may want to import all the entries as <code>admin</code>s entries.'); ?></p>
<?php
	if ( $this->allow_create_users() ) {
		echo '<p>'.__('If a new user is created by WordPress, a password will be randomly generated. Manually change the user\'s details if necessary.')."</p>\n";
	}


		$authors = $this->get_wp_authors();
		echo '<form action="?import=wordpress&amp;step=2&amp;id=' . $this->id . '" method="post">';
		wp_nonce_field('import-wordpress');
		echo '<ol id="authors">';
		$j = -1;
		foreach ($authors as $author) {
			++ $j;
			echo '<li>'.__('Import author:').' <strong>'.$author.'</strong><br />';
			$this->users_form($j, $author);
			echo '</li>';
		}

		if ( $this->allow_fetch_attachments() ) {
?>
</ol>
<?php screen_icon(); ?>
<h2><?php _e('Import Attachments'); ?></h2>
<p>
	<input type="checkbox" value="1" name="attachments" id="import-attachments" />
	<label for="import-attachments"><?php _e('Download and import file attachments') ?></label>
</p>

<?php
		}

		echo '<p class="submit">';
		echo '<input type="submit" class="button" value="'.attribute_escape( __('Submit') ).'" />'.'<br />';
		echo '</p>';
		echo '</form>';

	}

	function users_form($n, $author) {

		if ( $this->allow_create_users() ) {
			printf('<label>'.__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user_create['.intval($n).']'.'" maxlength="30" /></label> <br />');
		}
		else {
			echo __('Map to existing').'<br />';
		}

		// keep track of $n => $author name
		echo '<input type="hidden" name="author_in['.intval($n).']" value="'.htmlspecialchars($author).'" />';

		$users = get_users_of_blog();
?><select name="user_select[<?php echo $n; ?>]">
	<option value="0"><?php _e('- Select -'); ?></option>
	<?php
		foreach ($users as $user) {
			echo '<option value="'.$user->user_id.'">'.$user->user_login.'</option>';
		}
?>
	</select>
	<?php
	}

	function select_authors() {
		$is_wxr_file = $this->get_entries(array(&$this, 'process_author'));
		if ( $is_wxr_file ) {
			$this->wp_authors_form();
		}
		else {
			echo '<h2>'.__('Invalid file').'</h2>';
			echo '<p>'.__('Please upload a valid WXR (WordPress eXtended RSS) export file.').'</p>';
		}
	}

	// fetch the user ID for a given author name, respecting the mapping preferences
	function checkauthor($author) {
		global $current_user;

		if ( !empty($this->author_ids[$author]) )
			return $this->author_ids[$author];

		// failsafe: map to the current user
		return $current_user->ID;
	}



	function process_categories() {
		global $wpdb;

		$cat_names = (array) get_terms('category', 'fields=names');

		while ( $c = array_shift($this->categories) ) {
			$cat_name = trim($this->get_tag( $c, 'wp:cat_name' ));

			// If the category exists we leave it alone
			if ( in_array($cat_name, $cat_names) )
				continue;

			$category_nicename	= $this->get_tag( $c, 'wp:category_nicename' );
			$posts_private		= (int) $this->get_tag( $c, 'wp:posts_private' );
			$links_private		= (int) $this->get_tag( $c, 'wp:links_private' );

			$parent = $this->get_tag( $c, 'wp:category_parent' );

			if ( empty($parent) )
				$category_parent = '0';
			else
				$category_parent = category_exists($parent);

			$catarr = compact('category_nicename', 'category_parent', 'posts_private', 'links_private', 'posts_private', 'cat_name');

			$cat_ID = wp_insert_category($catarr);
		}
	}

	function process_tags() {
		global $wpdb;

		$tag_names = (array) get_terms('post_tag', 'fields=names');

		while ( $c = array_shift($this->tags) ) {
			$tag_name = trim($this->get_tag( $c, 'wp:tag_name' ));

			// If the category exists we leave it alone
			if ( in_array($tag_name, $tag_names) )
				continue;

			$slug = $this->get_tag( $c, 'wp:tag_slug' );
			$description = $this->get_tag( $c, 'wp:tag_description' );

			$tagarr = compact('slug', 'description');

			$tag_ID = wp_insert_term($tag_name, 'post_tag', $tagarr);
		}
	}

	function process_author($post) {
		$author = $this->get_tag( $post, 'dc:creator' );
		if ($author)
			$this->allauthornames[] = $author;
	}

	function process_posts() {
		echo '<ol>';

		$this->get_entries(array(&$this, 'process_post'));

		echo '</ol>';

		wp_import_cleanup($this->id);
		do_action('import_done', 'wordpress');

		echo '<h3>'.sprintf(__('All done.').' <a href="%s">'.__('Have fun!').'</a>', get_option('home')).'</h3>';
	}

	function process_post($post) {
		global $wpdb;

		$post_ID = (int) $this->get_tag( $post, 'wp:post_id' );
  		if ( $post_ID && !empty($this->post_ids_processed[$post_ID]) ) // Processed already
			return 0;

		set_time_limit( 60 );

		// There are only ever one of these
		$post_title     = $this->get_tag( $post, 'title' );
		$post_date      = $this->get_tag( $post, 'wp:post_date' );
		$post_date_gmt  = $this->get_tag( $post, 'wp:post_date_gmt' );
		$comment_status = $this->get_tag( $post, 'wp:comment_status' );
		$ping_status    = $this->get_tag( $post, 'wp:ping_status' );
		$post_status    = $this->get_tag( $post, 'wp:status' );
		$post_name      = $this->get_tag( $post, 'wp:post_name' );
		$post_parent    = $this->get_tag( $post, 'wp:post_parent' );
		$menu_order     = $this->get_tag( $post, 'wp:menu_order' );
		$post_type      = $this->get_tag( $post, 'wp:post_type' );
		$post_password  = $this->get_tag( $post, 'wp:post_password' );
		$guid           = $this->get_tag( $post, 'guid' );
		$post_author    = $this->get_tag( $post, 'dc:creator' );

		$post_excerpt = $this->get_tag( $post, 'excerpt:encoded' );
		$post_excerpt = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $post_excerpt);
		$post_excerpt = str_replace('<br>', '<br />', $post_excerpt);
		$post_excerpt = str_replace('<hr>', '<hr />', $post_excerpt);

		$post_content = $this->get_tag( $post, 'content:encoded' );
		$post_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $post_content);
		$post_content = str_replace('<br>', '<br />', $post_content);
		$post_content = str_replace('<hr>', '<hr />', $post_content);

		preg_match_all('|<category domain="tag">(.*?)</category>|is', $post, $tags);
		$tags = $tags[1];

		$tag_index = 0;
		foreach ($tags as $tag) {
			$tags[$tag_index] = $wpdb->escape($this->unhtmlentities(str_replace(array ('<![CDATA[', ']]>'), '', $tag)));
			$tag_index++;
		}

		preg_match_all('|<category>(.*?)</category>|is', $post, $categories);
		$categories = $categories[1];

		$cat_index = 0;
		foreach ($categories as $category) {
			$categories[$cat_index] = $wpdb->escape($this->unhtmlentities(str_replace(array ('<![CDATA[', ']]>'), '', $category)));
			$cat_index++;
		}

		$post_exists = post_exists($post_title, '', $post_date);

		if ( $post_exists ) {
			echo '<li>';
			printf(__('Post <em>%s</em> already exists.'), stripslashes($post_title));
			$comment_post_ID = $post_id = $post_exists;
		} else {

			// If it has parent, process parent first.
			$post_parent = (int) $post_parent;
			if ($post_parent) {
				// if we already know the parent, map it to the local ID
				if ( $parent = $this->post_ids_processed[$post_parent] ) {
					$post_parent = $parent;  // new ID of the parent
				}
				else {
					// record the parent for later
					$this->orphans[intval($post_ID)] = $post_parent;
				}
			}

			echo '<li>';

			$post_author = $this->checkauthor($post_author); //just so that if a post already exists, new users are not created by checkauthor

			$postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_excerpt', 'post_title', 'post_status', 'post_name', 'comment_status', 'ping_status', 'guid', 'post_parent', 'menu_order', 'post_type', 'post_password');
			$postdata['import_id'] = $post_ID;
			if ($post_type == 'attachment') {
				$remote_url = $this->get_tag( $post, 'wp:attachment_url' );
				if ( !$remote_url )
					$remote_url = $guid;

				$comment_post_ID = $post_id = $this->process_attachment($postdata, $remote_url);
				if ( !$post_id or is_wp_error($post_id) )
					return $post_id;
			}
			else {
				printf(__('Importing post <em>%s</em>...'), stripslashes($post_title));
				$comment_post_ID = $post_id = wp_insert_post($postdata);
			}

			if ( is_wp_error( $post_id ) )
				return $post_id;

			// Memorize old and new ID.
			if ( $post_id && $post_ID ) {
				$this->post_ids_processed[intval($post_ID)] = intval($post_id);
			}

			// Add categories.
			if (count($categories) > 0) {
				$post_cats = array();
				foreach ($categories as $category) {
					if ( '' == $category )
						continue;
					$slug = sanitize_term_field('slug', $category, 0, 'category', 'db');
					$cat = get_term_by('slug', $slug, 'category');
					$cat_ID = 0;
					if ( ! empty($cat) )
						$cat_ID = $cat->term_id;
					if ($cat_ID == 0) {
						$category = $wpdb->escape($category);
						$cat_ID = wp_insert_category(array('cat_name' => $category));
						if ( is_wp_error($cat_ID) )
							continue;
					}
					$post_cats[] = $cat_ID;
				}
				wp_set_post_categories($post_id, $post_cats);
			}

			// Add tags.
			if (count($tags) > 0) {
				$post_tags = array();
				foreach ($tags as $tag) {
					if ( '' == $tag )
						continue;
					$slug = sanitize_term_field('slug', $tag, 0, 'post_tag', 'db');
					$tag_obj = get_term_by('slug', $slug, 'post_tag');
					$tag_id = 0;
					if ( ! empty($tag_obj) )
						$tag_id = $tag_obj->term_id;
					if ( $tag_id == 0 ) {
						$tag = $wpdb->escape($tag);
						$tag_id = wp_insert_term($tag, 'post_tag');
						if ( is_wp_error($tag_id) )
							continue;
						$tag_id = $tag_id['term_id'];
					}
					$post_tags[] = intval($tag_id);
				}
				wp_set_post_tags($post_id, $post_tags);
			}
		}

		// Now for comments
		preg_match_all('|<wp:comment>(.*?)</wp:comment>|is', $post, $comments);
		$comments = $comments[1];
		$num_comments = 0;
		if ( $comments) { foreach ($comments as $comment) {
			$comment_author       = $this->get_tag( $comment, 'wp:comment_author');
			$comment_author_email = $this->get_tag( $comment, 'wp:comment_author_email');
			$comment_author_IP    = $this->get_tag( $comment, 'wp:comment_author_IP');
			$comment_author_url   = $this->get_tag( $comment, 'wp:comment_author_url');
			$comment_date         = $this->get_tag( $comment, 'wp:comment_date');
			$comment_date_gmt     = $this->get_tag( $comment, 'wp:comment_date_gmt');
			$comment_content      = $this->get_tag( $comment, 'wp:comment_content');
			$comment_approved     = $this->get_tag( $comment, 'wp:comment_approved');
			$comment_type         = $this->get_tag( $comment, 'wp:comment_type');
			$comment_parent       = $this->get_tag( $comment, 'wp:comment_parent');

			// if this is a new post we can skip the comment_exists() check
			if ( !$post_exists || !comment_exists($comment_author, $comment_date) ) {
				$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_author_IP', 'comment_date', 'comment_date_gmt', 'comment_content', 'comment_approved', 'comment_type', 'comment_parent');
				wp_insert_comment($commentdata);
				$num_comments++;
			}
		} }

		if ( $num_comments )
			printf(' '.__ngettext('(%s comment)', '(%s comments)', $num_comments), $num_comments);

		// Now for post meta
		preg_match_all('|<wp:postmeta>(.*?)</wp:postmeta>|is', $post, $postmeta);
		$postmeta = $postmeta[1];
		if ( $postmeta) { foreach ($postmeta as $p) {
			$key   = $this->get_tag( $p, 'wp:meta_key' );
			$value = $this->get_tag( $p, 'wp:meta_value' );
			$value = stripslashes($value); // add_post_meta() will escape.

			$this->process_post_meta($post_id, $key, $value);

		} }

		do_action('import_post_added', $post_id);
		print "</li>\n";
	}

	function process_post_meta($post_id, $key, $value) {
		// the filter can return false to skip a particular metadata key
		$_key = apply_filters('import_post_meta_key', $key);
		if ( $_key ) {
			add_post_meta( $post_id, $_key, $value );
			do_action('import_post_meta', $post_id, $_key, $value);
		}
	}

	function process_attachment($postdata, $remote_url) {
		if ($this->fetch_attachments and $remote_url) {
			printf( __('Importing attachment <em>%s</em>... '), htmlspecialchars($remote_url) );

			// If the URL is absolute, but does not contain http, upload it assuming the base_site_url variable
			if ( preg_match('/^\/[\w\W]+$/', $remote_url) )
				$remote_url = rtrim($this->base_url,'/').$remote_url;

			$upload = $this->fetch_remote_file($postdata, $remote_url);
			if ( is_wp_error($upload) ) {
				printf( __('Remote file error: %s'), htmlspecialchars($upload->get_error_message()) );
				return $upload;
			}
			else {
				print '('.size_format(filesize($upload['file'])).')';
			}

			if ( $info = wp_check_filetype($upload['file']) ) {
				$postdata['post_mime_type'] = $info['type'];
			}
			else {
				print __('Invalid file type');
				return;
			}

			$postdata['guid'] = $upload['url'];

			// as per wp-admin/includes/upload.php
			$post_id = wp_insert_attachment($postdata, $upload['file']);
			wp_update_attachment_metadata( $post_id, wp_generate_attachment_metadata( $post_id, $upload['file'] ) );

			// remap the thumbnail url.  this isn't perfect because we're just guessing the original url.
			if ( preg_match('@^image/@', $info['type']) && $thumb_url = wp_get_attachment_thumb_url($post_id) ) {
				$parts = pathinfo($remote_url);
				$ext = $parts['extension'];
				$name = basename($parts['basename'], ".{$ext}");
				$this->url_remap[$parts['dirname'] . '/' . $name . '.thumbnail.' . $ext] = $thumb_url;
			}

			return $post_id;
		}
		else {
			printf( __('Skipping attachment <em>%s</em>'), htmlspecialchars($remote_url) );
		}
	}

	function fetch_remote_file($post, $url) {
		$upload = wp_upload_dir($post['post_date']);

		// extract the file name and extension from the url
		$file_name = basename($url);

		// get placeholder file in the upload dir with a unique sanitized filename
		$upload = wp_upload_bits( $file_name, 0, '', $post['post_date']);
		if ( $upload['error'] ) {
			echo $upload['error'];
			return new WP_Error( 'upload_dir_error', $upload['error'] );
		}

		// fetch the remote url and write it to the placeholder file
		$headers = wp_get_http($url, $upload['file']);

		//Request failed
		if ( ! $headers ) {
			@unlink($upload['file']);
			return new WP_Error( 'import_file_error', __('Remote server did not respond') );
		}

		// make sure the fetch was successful
		if ( $headers['response'] != '200' ) {
			@unlink($upload['file']);
			return new WP_Error( 'import_file_error', sprintf(__('Remote file returned error response %1$d %2$s'), $headers['response'], get_status_header_desc($headers['response']) ) );
		}
		elseif ( isset($headers['content-length']) && filesize($upload['file']) != $headers['content-length'] ) {
			@unlink($upload['file']);
			return new WP_Error( 'import_file_error', __('Remote file is incorrect size') );
		}

		$max_size = $this->max_attachment_size();
		if ( !empty($max_size) and filesize($upload['file']) > $max_size ) {
			@unlink($upload['file']);
			return new WP_Error( 'import_file_error', sprintf(__('Remote file is too large, limit is %s', size_format($max_size))) );
		}

		// keep track of the old and new urls so we can substitute them later
		$this->url_remap[$url] = $upload['url'];
		// if the remote url is redirected somewhere else, keep track of the destination too
		if ( $headers['x-final-location'] != $url )
			$this->url_remap[$headers['x-final-location']] = $upload['url'];

		return $upload;

	}

	// sort by strlen, longest string first
	function cmpr_strlen($a, $b) {
		return strlen($b) - strlen($a);
	}

	// update url references in post bodies to point to the new local files
	function backfill_attachment_urls() {

		// make sure we do the longest urls first, in case one is a substring of another
		uksort($this->url_remap, array(&$this, 'cmpr_strlen'));

		global $wpdb;
		foreach ($this->url_remap as $from_url => $to_url) {
			// remap urls in post_content
			$wpdb->query( $wpdb->prepare("UPDATE {$wpdb->posts} SET post_content = REPLACE(post_content, '%s', '%s')", $from_url, $to_url) );
			// remap enclosure urls
			$result = $wpdb->query( $wpdb->prepare("UPDATE {$wpdb->postmeta} SET meta_value = REPLACE(meta_value, '%s', '%s') WHERE meta_key='enclosure'", $from_url, $to_url) );
		}
	}

	// update the post_parent of orphans now that we know the local id's of all parents
	function backfill_parents() {
		global $wpdb;

		foreach ($this->orphans as $child_id => $parent_id) {
			$local_child_id = $this->post_ids_processed[$child_id];
			$local_parent_id = $this->post_ids_processed[$parent_id];
			if ($local_child_id and $local_parent_id) {
				$wpdb->query( $wpdb->prepare("UPDATE {$wpdb->posts} SET post_parent = %d WHERE ID = %d", $local_parent_id, $local_child_id));
			}
		}
	}

	function is_valid_meta_key($key) {
		// skip _wp_attached_file metadata since we'll regenerate it from scratch
		if ( $key == '_wp_attached_file' )
			return false;
		return $key;
	}

	// give the user the option of creating new users to represent authors in the import file?
	function allow_create_users() {
		return apply_filters('import_allow_create_users', true);
	}

	// give the user the option of downloading and importing attached files
	function allow_fetch_attachments() {
		return apply_filters('import_allow_fetch_attachments', true);
	}

	function max_attachment_size() {
		// can be overridden with a filter - 0 means no limit
		return apply_filters('import_attachment_size_limit', 0);
	}

	function import_start() {
		wp_defer_term_counting(true);
		wp_defer_comment_counting(true);
		do_action('import_start');
	}

	function import_end() {
		do_action('import_end');

		// clear the caches after backfilling
		foreach ($this->post_ids_processed as $post_id)
			clean_post_cache($post_id);

		wp_defer_term_counting(false);
		wp_defer_comment_counting(false);
	}

	function import($id, $fetch_attachments = false) {
		$this->id = (int) $id;
		$this->fetch_attachments = ($this->allow_fetch_attachments() && (bool) $fetch_attachments);

		add_filter('import_post_meta_key', array($this, 'is_valid_meta_key'));
		$file = get_attached_file($this->id);
		$this->import_file($file);
	}

	function import_file($file) {
		$this->file = $file;

		$this->import_start();
		$this->get_authors_from_post();
		wp_suspend_cache_invalidation(true);
		$this->get_entries();
		$this->process_categories();
		$this->process_tags();
		$result = $this->process_posts();
		wp_suspend_cache_invalidation(false);
		$this->backfill_parents();
		$this->backfill_attachment_urls();
		$this->import_end();

		if ( is_wp_error( $result ) )
			return $result;
	}

	function handle_upload() {
		$file = wp_import_handle_upload();
		if ( isset($file['error']) ) {
			echo '<p>'.__('Sorry, there has been an error.').'</p>';
			echo '<p><strong>' . $file['error'] . '</strong></p>';
			return false;
		}
		$this->file = $file['file'];
		$this->id = (int) $file['id'];
		return true;
	}

	function dispatch() {
		if (empty ($_GET['step']))
			$step = 0;
		else
			$step = (int) $_GET['step'];

		$this->header();
		switch ($step) {
			case 0 :
				$this->greet();
				break;
			case 1 :
				check_admin_referer('import-upload');
				if ( $this->handle_upload() )
					$this->select_authors();
				break;
			case 2:
				check_admin_referer('import-wordpress');
				$result = $this->import( $_GET['id'], $_POST['attachments'] );
				if ( is_wp_error( $result ) )
					echo $result->get_error_message();
				break;
		}
		$this->footer();
	}

	function WP_Import() {
		// Nothing.
	}
}

/**
 * Register WordPress Importer
 *
 * @since unknown
 * @var WP_Import
 * @name $wp_import
 */
$wp_import = new WP_Import();

register_importer('wordpress', 'WordPress', __('Import <strong>posts, pages, comments, custom fields, categories, and tags</strong> from a WordPress export file.'), array ($wp_import, 'dispatch'));

?>
                            wp-admin/import/wp-cat2tag.php                                                                      0000755 0023422 0004734 00000041632 11113252136 017316  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress Categories to Tags Converter.
 *
 * @package WordPress
 * @subpackage Importer
 */

/**
 * WordPress categories to tags converter class.
 *
 * Will convert WordPress categories to tags, removing the category after the
 * process is complete and updating all posts to switch to the tag.
 *
 * @since unknown
 */
class WP_Categories_to_Tags {
	var $categories_to_convert = array();
	var $all_categories = array();
	var $tags_to_convert = array();
	var $all_tags = array();
	var $hybrids_ids = array();

	function header() {
		echo '<div class="wrap">';
		if ( ! current_user_can('manage_categories') ) {
			echo '<div class="narrow">';
			echo '<p>' . __('Cheatin&#8217; uh?') . '</p>';
			echo '</div>';
		} else { ?>
			<div class="tablenav"><p style="margin:4px"><a style="display:inline;" class="button-secondary" href="admin.php?import=wp-cat2tag"><?php _e( "Categories to Tags" ); ?></a>
			<a style="display:inline;" class="button-secondary" href="admin.php?import=wp-cat2tag&amp;step=3"><?php _e( "Tags to Categories" ); ?></a></p></div>
<?php	}
	}

	function footer() {
		echo '</div>';
	}

	function populate_cats() {

		$categories = get_categories('get=all');
		foreach ( $categories as $category ) {
			$this->all_categories[] = $category;
			if ( is_term( $category->slug, 'post_tag' ) )
				$this->hybrids_ids[] = $category->term_id;
		}
	}

	function populate_tags() {

		$tags = get_terms( array('post_tag'), 'get=all' );
		foreach ( $tags as $tag ) {
			$this->all_tags[] = $tag;
			if ( is_term( $tag->slug, 'category' ) )
				$this->hybrids_ids[] = $tag->term_id;
		}
	}

	function categories_tab() {
		$this->populate_cats();
		$cat_num = count($this->all_categories);

		echo '<br class="clear" />';

		if ( $cat_num > 0 ) {
			screen_icon();
			echo '<h2>' . sprintf( __ngettext( 'Convert Category to Tag.', 'Convert Categories (%d) to Tags.', $cat_num ), $cat_num ) . '</h2>';
			echo '<div class="narrow">';
			echo '<p>' . __('Hey there. Here you can selectively convert existing categories to tags. To get started, check the categories you wish to be converted, then click the Convert button.') . '</p>';
			echo '<p>' . __('Keep in mind that if you convert a category with child categories, the children become top-level orphans.') . '</p></div>';

			$this->categories_form();
		} else {
			echo '<p>'.__('You have no categories to convert!').'</p>';
		}
	}

	function categories_form() { ?>

<script type="text/javascript">
/* <![CDATA[ */
var checkflag = "false";
function check_all_rows() {
	field = document.catlist;
	if ( 'false' == checkflag ) {
		for ( i = 0; i < field.length; i++ ) {
			if ( 'cats_to_convert[]' == field[i].name )
				field[i].checked = true;
		}
		checkflag = 'true';
		return '<?php _e('Uncheck All') ?>';
	} else {
		for ( i = 0; i < field.length; i++ ) {
			if ( 'cats_to_convert[]' == field[i].name )
				field[i].checked = false;
		}
		checkflag = 'false';
		return '<?php _e('Check All') ?>';
	}
}
/* ]]> */
</script>

<form name="catlist" id="catlist" action="admin.php?import=wp-cat2tag&amp;step=2" method="post">
<p><input type="button" class="button-secondary" value="<?php _e('Check All'); ?>" onclick="this.value=check_all_rows()" />
<?php wp_nonce_field('import-cat2tag'); ?></p>
<ul style="list-style:none">

<?php	$hier = _get_term_hierarchy('category');

		foreach ($this->all_categories as $category) {
			$category = sanitize_term( $category, 'category', 'display' );

			if ( (int) $category->parent == 0 ) { ?>

	<li><label><input type="checkbox" name="cats_to_convert[]" value="<?php echo intval($category->term_id); ?>" /> <?php echo $category->name . ' (' . $category->count . ')'; ?></label><?php

				 if ( in_array( intval($category->term_id),  $this->hybrids_ids ) )
				 	echo ' <a href="#note"> * </a>';

				if ( isset($hier[$category->term_id]) )
					$this->_category_children($category, $hier); ?></li>
<?php		}
		} ?>
</ul>

<?php	if ( ! empty($this->hybrids_ids) )
			echo '<p><a name="note"></a>' . __('* This category is also a tag. Converting it will add that tag to all posts that are currently in the category.') . '</p>'; ?>

<p class="submit"><input type="submit" name="submit" class="button" value="<?php _e('Convert Categories to Tags'); ?>" /></p>
</form>

<?php }

	function tags_tab() {
		$this->populate_tags();
		$tags_num = count($this->all_tags);

		echo '<br class="clear" />';

		if ( $tags_num > 0 ) {
			screen_icon();
			echo '<h2>' . sprintf( __ngettext( 'Convert Tag to Category.', 'Convert Tags (%d) to Categories.', $tags_num ), $tags_num ) . '</h2>';
			echo '<div class="narrow">';
			echo '<p>' . __('Here you can selectively converts existing tags to categories. To get started, check the tags you wish to be converted, then click the Convert button.') . '</p>';
			echo '<p>' . __('The newly created categories will still be associated with the same posts.') . '</p></div>';

			$this->tags_form();
		} else {
			echo '<p>'.__('You have no tags to convert!').'</p>';
		}
	}

	function tags_form() { ?>

<script type="text/javascript">
/* <![CDATA[ */
var checktags = "false";
function check_all_tagrows() {
	field = document.taglist;
	if ( 'false' == checktags ) {
		for ( i = 0; i < field.length; i++ ) {
			if ( 'tags_to_convert[]' == field[i].name )
				field[i].checked = true;
		}
		checktags = 'true';
		return '<?php _e('Uncheck All') ?>';
	} else {
		for ( i = 0; i < field.length; i++ ) {
			if ( 'tags_to_convert[]' == field[i].name )
				field[i].checked = false;
		}
		checktags = 'false';
		return '<?php _e('Check All') ?>';
	}
}
/* ]]> */
</script>

<form name="taglist" id="taglist" action="admin.php?import=wp-cat2tag&amp;step=4" method="post">
<p><input type="button" class="button-secondary" value="<?php _e('Check All'); ?>" onclick="this.value=check_all_tagrows()" />
<?php wp_nonce_field('import-cat2tag'); ?></p>
<ul style="list-style:none">

<?php	foreach ( $this->all_tags as $tag ) { ?>
	<li><label><input type="checkbox" name="tags_to_convert[]" value="<?php echo intval($tag->term_id); ?>" /> <?php echo attribute_escape($tag->name) . ' (' . $tag->count . ')'; ?></label><?php if ( in_array( intval($tag->term_id),  $this->hybrids_ids ) ) echo ' <a href="#note"> * </a>'; ?></li>

<?php	} ?>
</ul>

<?php	if ( ! empty($this->hybrids_ids) )
			echo '<p><a name="note"></a>' . __('* This tag is also a category. When converted, all posts associated with the tag will also be in the category.') . '</p>'; ?>

<p class="submit"><input type="submit" name="submit_tags" class="button" value="<?php _e('Convert Tags to Categories'); ?>" /></p>
</form>

<?php }

	function _category_children($parent, $hier) { ?>

		<ul style="list-style:none">
<?php	foreach ($hier[$parent->term_id] as $child_id) {
			$child =& get_category($child_id); ?>
		<li><label><input type="checkbox" name="cats_to_convert[]" value="<?php echo intval($child->term_id); ?>" /> <?php echo $child->name . ' (' . $child->count . ')'; ?></label><?php

			if ( in_array( intval($child->term_id), $this->hybrids_ids ) )
				echo ' <a href="#note"> * </a>';

			if ( isset($hier[$child->term_id]) )
				$this->_category_children($child, $hier); ?></li>
<?php	} ?>
		</ul><?php
	}

	function _category_exists($cat_id) {
		$cat_id = (int) $cat_id;

		$maybe_exists = category_exists($cat_id);

		if ( $maybe_exists ) {
			return true;
		} else {
			return false;
		}
	}

	function convert_categories() {
		global $wpdb;

		if ( (!isset($_POST['cats_to_convert']) || !is_array($_POST['cats_to_convert'])) && empty($this->categories_to_convert)) { ?>
			<div class="narrow">
			<p><?php printf(__('Uh, oh. Something didn&#8217;t work. Please <a href="%s">try again</a>.'), 'admin.php?import=wp-cat2tag'); ?></p>
			</div>
<?php		return;
		}

		if ( empty($this->categories_to_convert) )
			$this->categories_to_convert = $_POST['cats_to_convert'];

		$hier = _get_term_hierarchy('category');
		$hybrid_cats = $clear_parents = $parents = false;
		$clean_term_cache = $clean_cat_cache = array();
		$default_cat = get_option('default_category');

		echo '<ul>';

		foreach ( (array) $this->categories_to_convert as $cat_id) {
			$cat_id = (int) $cat_id;

			if ( ! $this->_category_exists($cat_id) ) {
				echo '<li>' . sprintf( __('Category %s doesn\'t exist!'),  $cat_id ) . "</li>\n";
			} else {
				$category =& get_category($cat_id);
				echo '<li>' . sprintf(__('Converting category <strong>%s</strong> ... '),  $category->name);

				// If the category is the default, leave category in place and create tag.
				if ( $default_cat == $category->term_id ) {

					if ( ! ($id = is_term( $category->slug, 'post_tag' ) ) )
						$id = wp_insert_term($category->name, 'post_tag', array('slug' => $category->slug));

					$id = $id['term_taxonomy_id'];
					$posts = get_objects_in_term($category->term_id, 'category');
					$term_order = 0;

					foreach ( $posts as $post ) {
						$values[] = $wpdb->prepare( "(%d, %d, %d)", $post, $id, $term_order);
						clean_post_cache($post);
					}

					if ( $values ) {
						$wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . join(',', $values) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)");

						$wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET count = %d WHERE term_id = %d AND taxonomy = 'post_tag'", $category->count, $category->term_id) );
					}

					echo __('Converted successfully.') . "</li>\n";
					continue;
				}

				// if tag already exists, add it to all posts in the category
				if ( $tag_ttid = $wpdb->get_var( $wpdb->prepare("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'post_tag'", $category->term_id) ) ) {
					$objects_ids = get_objects_in_term($category->term_id, 'category');
					$tag_ttid = (int) $tag_ttid;
					$term_order = 0;

					foreach ( $objects_ids as $object_id )
						$values[] = $wpdb->prepare( "(%d, %d, %d)", $object_id, $tag_ttid, $term_order);

					if ( $values ) {
						$wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . join(',', $values) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)");

						$count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $tag_ttid) );
						$wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET count = %d WHERE term_id = %d AND taxonomy = 'post_tag'", $count, $category->term_id) );
					}
					echo __('Tag added to all posts in this category.') . " *</li>\n";

					$hybrid_cats = true;
					$clean_term_cache[] = $category->term_id;
					$clean_cat_cache[] = $category->term_id;

					continue;
				}

				$tt_ids = $wpdb->get_col( $wpdb->prepare("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'category'", $category->term_id) );
				if ( $tt_ids ) {
					$posts = $wpdb->get_col("SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id IN (" . join(',', $tt_ids) . ") GROUP BY object_id");
					foreach ( (array) $posts as $post )
						clean_post_cache($post);
				}

				// Change the category to a tag.
				$wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET taxonomy = 'post_tag' WHERE term_id = %d AND taxonomy = 'category'", $category->term_id) );

				// Set all parents to 0 (root-level) if their parent was the converted tag
				$parents = $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET parent = 0 WHERE parent = %d AND taxonomy = 'category'", $category->term_id) );

				if ( $parents ) $clear_parents = true;
				$clean_cat_cache[] = $category->term_id;
				echo __('Converted successfully.') . "</li>\n";
			}
		}
		echo '</ul>';

		if ( ! empty($clean_term_cache) ) {
			$clean_term_cache = array_unique(array_values($clean_term_cache));
			foreach ( $clean_term_cache as $id )
				wp_cache_delete($id, 'post_tag');
		}

		if ( ! empty($clean_cat_cache) ) {
			$clean_cat_cache = array_unique(array_values($clean_cat_cache));
			foreach ( $clean_cat_cache as $id )
				wp_cache_delete($id, 'category');
		}

		if ( $clear_parents ) delete_option('category_children');

		if ( $hybrid_cats )
			echo '<p>' . sprintf( __('* This category is also a tag. The converter has added that tag to all posts currently in the category. If you want to remove it, please confirm that all tags were added successfully, then delete it from the <a href="%s">Manage Categories</a> page.'), 'categories.php') . '</p>';
		echo '<p>' . sprintf( __('We&#8217;re all done here, but you can always <a href="%s">convert more</a>.'), 'admin.php?import=wp-cat2tag' ) . '</p>';
	}

	function convert_tags() {
		global $wpdb;

		if ( (!isset($_POST['tags_to_convert']) || !is_array($_POST['tags_to_convert'])) && empty($this->tags_to_convert)) {
			echo '<div class="narrow">';
			echo '<p>' . sprintf(__('Uh, oh. Something didn&#8217;t work. Please <a href="%s">try again</a>.'), 'admin.php?import=wp-cat2tag&amp;step=3') . '</p>';
			echo '</div>';
			return;
		}

		if ( empty($this->tags_to_convert) )
			$this->tags_to_convert = $_POST['tags_to_convert'];

		$hybrid_tags = $clear_parents = false;
		$clean_cat_cache = $clean_term_cache = array();
		$default_cat = get_option('default_category');
		echo '<ul>';

		foreach ( (array) $this->tags_to_convert as $tag_id) {
			$tag_id = (int) $tag_id;

			if ( $tag = get_term( $tag_id, 'post_tag' ) ) {
				printf('<li>' . __('Converting tag <strong>%s</strong> ... '),  $tag->name);

				if ( $cat_ttid = $wpdb->get_var( $wpdb->prepare("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'category'", $tag->term_id) ) ) {
					$objects_ids = get_objects_in_term($tag->term_id, 'post_tag');
					$cat_ttid = (int) $cat_ttid;
					$term_order = 0;

					foreach ( $objects_ids as $object_id ) {
						$values[] = $wpdb->prepare( "(%d, %d, %d)", $object_id, $cat_ttid, $term_order);
						clean_post_cache($object_id);
					}

					if ( $values ) {
						$wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . join(',', $values) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)");

						if ( $default_cat != $tag->term_id ) {
							$count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $tag->term_id) );
							$wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET count = %d WHERE term_id = %d AND taxonomy = 'category'", $count, $tag->term_id) );
						}
					}

					$hybrid_tags = true;
					$clean_term_cache[] = $tag->term_id;
					$clean_cat_cache[] = $tag->term_id;
					echo __('All posts were added to the category with the same name.') . " *</li>\n";

					continue;
				}

				// Change the tag to a category.
				$parent = $wpdb->get_var( $wpdb->prepare("SELECT parent FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'post_tag'", $tag->term_id) );
				if ( 0 == $parent || (0 < (int) $parent && $this->_category_exists($parent)) ) {
					$reset_parent = '';
					$clear_parents = true;
				} else
					$reset_parent = ", parent = '0'";

				$wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET taxonomy = 'category' $reset_parent WHERE term_id = %d AND taxonomy = 'post_tag'", $tag->term_id) );

				$clean_term_cache[] = $tag->term_id;
				$clean_cat_cache[] = $cat['term_id'];
				echo __('Converted successfully.') . "</li>\n";

			} else {
				printf( '<li>' . __('Tag #%s doesn\'t exist!') . "</li>\n",  $tag_id );
			}
		}

		if ( ! empty($clean_term_cache) ) {
			$clean_term_cache = array_unique(array_values($clean_term_cache));
			foreach ( $clean_term_cache as $id )
				wp_cache_delete($id, 'post_tag');
		}

		if ( ! empty($clean_cat_cache) ) {
			$clean_cat_cache = array_unique(array_values($clean_cat_cache));
			foreach ( $clean_cat_cache as $id )
				wp_cache_delete($id, 'category');
		}

		if ( $clear_parents ) delete_option('category_children');

		echo '</ul>';
		if ( $hybrid_tags )
			echo '<p>' . sprintf( __('* This tag is also a category. The converter has added all posts from it to the category. If you want to remove it, please confirm that all posts were added successfully, then delete it from the <a href="%s">Manage Tags</a> page.'), 'edit-tags.php') . '</p>';
		echo '<p>' . sprintf( __('We&#8217;re all done here, but you can always <a href="%s">convert more</a>.'), 'admin.php?import=wp-cat2tag&amp;step=3' ) . '</p>';
	}

	function init() {

		$step = (isset($_GET['step'])) ? (int) $_GET['step'] : 1;

		$this->header();

		if ( current_user_can('manage_categories') ) {

			switch ($step) {
				case 1 :
					$this->categories_tab();
				break;

				case 2 :
					check_admin_referer('import-cat2tag');
					$this->convert_categories();
				break;

				case 3 :
					$this->tags_tab();
				break;

				case 4 :
					check_admin_referer('import-cat2tag');
					$this->convert_tags();
				break;
			}
		}

		$this->footer();
	}

	function WP_Categories_to_Tags() {
		// Do nothing.
	}
}

$wp_cat2tag_importer = new WP_Categories_to_Tags();

register_importer('wp-cat2tag', __('Categories and Tags Converter'), __('Convert existing categories to tags or tags to categories, selectively.'), array(&$wp_cat2tag_importer, 'init'));

?>
                                                                                                      wp-admin/import/opml.php                                                                            0000755 0023422 0004734 00000010761 11120006740 016307  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Links Import Administration Panel.
 *
 * @copyright 2002 Mike Little <mike@zed1.com>
 * @author Mike Little <mike@zed1.com>
 * @package WordPress
 * @subpackage Administration
 */

/** Load WordPress Administration Bootstrap */
$parent_file = 'tools.php';
$submenu_file = 'import.php';
$title = __('Import Blogroll');

class OPML_Import {

	function dispatch() {
		global $wpdb, $user_ID;
$step = $_POST['step'];
if (!$step) $step = 0;
?>
<?php
switch ($step) {
	case 0: {
		include_once('admin-header.php');
		if ( !current_user_can('manage_links') )
			wp_die(__('Cheatin&#8217; uh?'));

		$opmltype = 'blogrolling'; // default.
?>

<div class="wrap">
<?php screen_icon(); ?>
<h2><?php _e('Import your blogroll from another system') ?> </h2>
<form enctype="multipart/form-data" action="admin.php?import=opml" method="post" name="blogroll">
<?php wp_nonce_field('import-bookmarks') ?>

<p><?php _e('If a program or website you use allows you to export your links or subscriptions as OPML you may import them here.'); ?></p>
<div style="width: 70%; margin: auto; height: 8em;">
<input type="hidden" name="step" value="1" />
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
<div style="width: 48%;" class="alignleft">
<h3><label for="opml_url"><?php _e('Specify an OPML URL:'); ?></label></h3>
<input type="text" name="opml_url" id="opml_url" size="50" style="width: 90%;" value="http://" />
</div>

<div style="width: 48%;" class="alignleft">
<h3><label for="userfile"><?php _e('Or choose from your local disk:'); ?></label></h3>
<input id="userfile" name="userfile" type="file" size="30" />
</div>

</div>

<p style="clear: both; margin-top: 1em;"><label for="cat_id"><?php _e('Now select a category you want to put these links in.') ?></label><br />
<?php _e('Category:') ?> <select name="cat_id" id="cat_id">
<?php
$categories = get_terms('link_category', 'get=all');
foreach ($categories as $category) {
?>
<option value="<?php echo $category->term_id; ?>"><?php echo wp_specialchars(apply_filters('link_category', $category->name)); ?></option>
<?php
} // end foreach
?>
</select></p>

<p class="submit"><input type="submit" name="submit" value="<?php _e('Import OPML File') ?>" /></p>
</form>

</div>
<?php
		break;
	} // end case 0

	case 1: {
		check_admin_referer('import-bookmarks');

		include_once('admin-header.php');
		if ( !current_user_can('manage_links') )
			wp_die(__('Cheatin&#8217; uh?'));
?>
<div class="wrap">

<h2><?php _e('Importing...') ?></h2>
<?php
		$cat_id = abs( (int) $_POST['cat_id'] );
		if ( $cat_id < 1 )
			$cat_id  = 1;

		$opml_url = $_POST['opml_url'];
		if ( isset($opml_url) && $opml_url != '' && $opml_url != 'http://' ) {
			$blogrolling = true;
		} else { // try to get the upload file.
			$overrides = array('test_form' => false, 'test_type' => false);
			$file = wp_handle_upload($_FILES['userfile'], $overrides);

			if ( isset($file['error']) )
				wp_die($file['error']);

			$url = $file['url'];
			$opml_url = $file['file'];
			$blogrolling = false;
		}

		global $opml, $updated_timestamp, $all_links, $map, $names, $urls, $targets, $descriptions, $feeds;
		if ( isset($opml_url) && $opml_url != '' ) {
			if ( $blogrolling === true ) {
				$opml = wp_remote_fopen($opml_url);
			} else {
				$opml = file_get_contents($opml_url);
			}

			/** Load OPML Parser */
			include_once('link-parse-opml.php');

			$link_count = count($names);
			for ( $i = 0; $i < $link_count; $i++ ) {
				if ('Last' == substr($titles[$i], 0, 4))
					$titles[$i] = '';
				if ( 'http' == substr($titles[$i], 0, 4) )
					$titles[$i] = '';
				$link = array( 'link_url' => $urls[$i], 'link_name' => $wpdb->escape($names[$i]), 'link_category' => array($cat_id), 'link_description' => $wpdb->escape($descriptions[$i]), 'link_owner' => $user_ID, 'link_rss' => $feeds[$i]);
				wp_insert_link($link);
				echo sprintf('<p>'.__('Inserted <strong>%s</strong>').'</p>', $names[$i]);
			}
?>

<p><?php printf(__('Inserted %1$d links into category %2$s. All done! Go <a href="%3$s">manage those links</a>.'), $link_count, $cat_id, 'link-manager.php') ?></p>

<?php
} // end if got url
else
{
	echo "<p>" . __("You need to supply your OPML url. Press back on your browser and try again") . "</p>\n";
} // end else

if ( ! $blogrolling )
	do_action( 'wp_delete_file', $opml_url);
	@unlink($opml_url);
?>
</div>
<?php
		break;
	} // end case 1
} // end switch
	}

	function OPML_Import() {}
}

$opml_importer = new OPML_Import();

register_importer('opml', __('Blogroll'), __('Import links in OPML format.'), array(&$opml_importer, 'dispatch'));

?>
               wp-admin/import.php                                                                                 0000755 0023422 0004734 00000003151 11117531364 015346  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Import WordPress Administration Panel
 *
 * @package WordPress
 * @subpackage Administration
 */

/** Load WordPress Bootstrap */
require_once ('admin.php');
$title = __('Import');
require_once ('admin-header.php');
$parent_file = 'tools.php';
?>

<div class="wrap">
<?php screen_icon(); ?>
<h2><?php echo wp_specialchars( $title ); ?></h2>
<p><?php _e('If you have posts or comments in another system, WordPress can import those into this blog. To get started, choose a system to import from below:'); ?></p>

<?php

// Load all importers so that they can register.
$import_loc = 'wp-admin/import';
$import_root = ABSPATH.$import_loc;
$imports_dir = @ opendir($import_root);
if ($imports_dir) {
	while (($file = readdir($imports_dir)) !== false) {
		if ($file{0} == '.') {
			continue;
		} elseif (substr($file, -4) == '.php') {
			require_once($import_root . '/' . $file);
		}
	}
}
@closedir($imports_dir);

$importers = get_importers();

if (empty ($importers)) {
	echo '<p>'.__('No importers are available.').'</p>'; // TODO: make more helpful
} else {
?>
<table class="widefat" cellspacing="0">

<?php
	$style = '';
	foreach ($importers as $id => $data) {
		$style = ('class="alternate"' == $style || 'class="alternate active"' == $style) ? '' : 'alternate';
		$action = "<a href='admin.php?import=$id' title='".wptexturize(strip_tags($data[1]))."'>{$data[0]}</a>";

		if ($style != '')
			$style = 'class="'.$style.'"';
		echo "
			<tr $style>
				<td class='import-system row-title'>$action</td>
				<td class='desc'>{$data[1]}</td>
			</tr>";
	}
?>

</table>
<?php
}
?>

</div>

<?php

include ('admin-footer.php');
?>

                                                                                                                                                                                                                                                                                                                                                                                                                       wp-admin/includes/                                                                                  0000755 0023422 0004734 00000000000 11154152650 015124  5                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 wp-admin/includes/admin.php                                                                         0000755 0023422 0004734 00000003113 11050127210 016713  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Includes all of the WordPress Administration API files.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** WordPress Bookmark Administration API */
require_once(ABSPATH . 'wp-admin/includes/bookmark.php');

/** WordPress Comment Administration API */
require_once(ABSPATH . 'wp-admin/includes/comment.php');

/** WordPress Administration File API */
require_once(ABSPATH . 'wp-admin/includes/file.php');

/** WordPress Image Administration API */
require_once(ABSPATH . 'wp-admin/includes/image.php');

/** WordPress Media Administration API */
require_once(ABSPATH . 'wp-admin/includes/media.php');

/** WordPress Import Administration API */
require_once(ABSPATH . 'wp-admin/includes/import.php');

/** WordPress Misc Administration API */
require_once(ABSPATH . 'wp-admin/includes/misc.php');

/** WordPress Plugin Administration API */
require_once(ABSPATH . 'wp-admin/includes/plugin.php');

/** WordPress Post Administration API */
require_once(ABSPATH . 'wp-admin/includes/post.php');

/** WordPress Taxonomy Administration API */
require_once(ABSPATH . 'wp-admin/includes/taxonomy.php');

/** WordPress Template Administration API */
require_once(ABSPATH . 'wp-admin/includes/template.php');

/** WordPress Theme Administration API */
require_once(ABSPATH . 'wp-admin/includes/theme.php');

/** WordPress User Administration API */
require_once(ABSPATH . 'wp-admin/includes/user.php');

/** WordPress Update Administration API */
require_once(ABSPATH . 'wp-admin/includes/update.php');

/** WordPress Registration API */
require_once(ABSPATH . WPINC . '/registration.php');

?>                                                                                                                                                                                                                                                                                                                                                                                                                                                     wp-admin/includes/bookmark.php                                                                      0000755 0023422 0004734 00000015113 11136164604 017450  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress Bookmark Administration API
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @return unknown
 */
function add_link() {
	return edit_link();
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $link_id
 * @return unknown
 */
function edit_link( $link_id = '' ) {
	if (!current_user_can( 'manage_links' ))
		wp_die( __( 'Cheatin&#8217; uh?' ));

	$_POST['link_url'] = wp_specialchars( $_POST['link_url'] );
	$_POST['link_url'] = clean_url($_POST['link_url']);
	$_POST['link_name'] = wp_specialchars( $_POST['link_name'] );
	$_POST['link_image'] = wp_specialchars( $_POST['link_image'] );
	$_POST['link_rss'] = clean_url($_POST['link_rss']);
	if ( !isset($_POST['link_visible']) || 'N' != $_POST['link_visible'] )
		$_POST['link_visible'] = 'Y';

	if ( !empty( $link_id ) ) {
		$_POST['link_id'] = $link_id;
		return wp_update_link( $_POST);
	} else {
		return wp_insert_link( $_POST);
	}
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @return unknown
 */
function get_default_link_to_edit() {
	if ( isset( $_GET['linkurl'] ) )
		$link->link_url = clean_url( $_GET['linkurl']);
	else
		$link->link_url = '';

	if ( isset( $_GET['name'] ) )
		$link->link_name = attribute_escape( $_GET['name']);
	else
		$link->link_name = '';

	$link->link_visible = 'Y';

	return $link;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $link_id
 * @return unknown
 */
function wp_delete_link( $link_id ) {
	global $wpdb;

	do_action( 'delete_link', $link_id );

	wp_delete_object_term_relationships( $link_id, 'link_category' );

	$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->links WHERE link_id = %d", $link_id ) );

	do_action( 'deleted_link', $link_id );

	clean_bookmark_cache( $link_id );

	return true;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $link_id
 * @return unknown
 */
function wp_get_link_cats( $link_id = 0 ) {

	$cats = wp_get_object_terms( $link_id, 'link_category', 'fields=ids' );

	return array_unique( $cats );
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $link_id
 * @return unknown
 */
function get_link_to_edit( $link_id ) {
	return get_bookmark( $link_id, OBJECT, 'edit' );
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $linkdata
 * @return unknown
 */
function wp_insert_link( $linkdata, $wp_error = false ) {
	global $wpdb, $current_user;

	$defaults = array( 'link_id' => 0, 'link_name' => '', 'link_url' => '', 'link_rating' => 0 );

	$linkdata = wp_parse_args( $linkdata, $defaults );
	$linkdata = sanitize_bookmark( $linkdata, 'db' );

	extract( stripslashes_deep( $linkdata ), EXTR_SKIP );

	$update = false;

	if ( !empty( $link_id ) )
		$update = true;

	if ( trim( $link_name ) == '' ) {
		if ( trim( $link_url ) != '' ) {
			$link_name = $link_url;
		} else {
			return 0;
		}
	}

	if ( trim( $link_url ) == '' )
		return 0;

	if ( empty( $link_rating ) )
		$link_rating = 0;

	if ( empty( $link_image ) )
		$link_image = '';

	if ( empty( $link_target ) )
		$link_target = '';

	if ( empty( $link_visible ) )
		$link_visible = 'Y';

	if ( empty( $link_owner ) )
		$link_owner = $current_user->id;

	if ( empty( $link_notes ) )
		$link_notes = '';

	if ( empty( $link_description ) )
		$link_description = '';

	if ( empty( $link_rss ) )
		$link_rss = '';

	if ( empty( $link_rel ) )
		$link_rel = '';

	// Make sure we set a valid category
	if ( ! isset( $link_category ) ||0 == count( $link_category ) || !is_array( $link_category ) ) {
		$link_category = array( get_option( 'default_link_category' ) );
	}

	if ( $update ) {
		if ( false === $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->links SET link_url = %s,
			link_name = %s, link_image = %s, link_target = %s,
			link_visible = %s, link_description = %s, link_rating = %s,
			link_rel = %s, link_notes = %s, link_rss = %s
			WHERE link_id = %s", $link_url, $link_name, $link_image, $link_target, $link_visible, $link_description, $link_rating, $link_rel, $link_notes, $link_rss, $link_id ) ) ) {
			if ( $wp_error )
				return new WP_Error( 'db_update_error', __( 'Could not update link in the database' ), $wpdb->last_error );
			else
				return 0;
		}
	} else {
		if ( false === $wpdb->query( $wpdb->prepare( "INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
		$link_url,$link_name, $link_image, $link_target, $link_description, $link_visible, $link_owner, $link_rating, $link_rel, $link_notes, $link_rss ) ) ) {
			if ( $wp_error )
				return new WP_Error( 'db_insert_error', __( 'Could not insert link into the database' ), $wpdb->last_error );
			else
				return 0;
		}
		$link_id = (int) $wpdb->insert_id;
	}

	wp_set_link_cats( $link_id, $link_category );

	if ( $update )
		do_action( 'edit_link', $link_id );
	else
		do_action( 'add_link', $link_id );

	clean_bookmark_cache( $link_id );

	return $link_id;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $link_id
 * @param unknown_type $link_categories
 */
function wp_set_link_cats( $link_id = 0, $link_categories = array() ) {
	// If $link_categories isn't already an array, make it one:
	if ( !is_array( $link_categories ) || 0 == count( $link_categories ) )
		$link_categories = array( get_option( 'default_link_category' ) );

	$link_categories = array_map( 'intval', $link_categories );
	$link_categories = array_unique( $link_categories );

	wp_set_object_terms( $link_id, $link_categories, 'link_category' );

	clean_bookmark_cache( $link_id );
}	// wp_set_link_cats()

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $linkdata
 * @return unknown
 */
function wp_update_link( $linkdata ) {
	$link_id = (int) $linkdata['link_id'];

	$link = get_link( $link_id, ARRAY_A );

	// Escape data pulled from DB.
	$link = add_magic_quotes( $link );

	// Passed link category list overwrites existing category list if not empty.
	if ( isset( $linkdata['link_category'] ) && is_array( $linkdata['link_category'] )
			 && 0 != count( $linkdata['link_category'] ) )
		$link_cats = $linkdata['link_category'];
	else
		$link_cats = $link['link_category'];

	// Merge old and new fields with new fields overwriting old ones.
	$linkdata = array_merge( $link, $linkdata );
	$linkdata['link_category'] = $link_cats;

	return wp_insert_link( $linkdata );
}

?>
                                                                                                                                                                                                                                                                                                                                                                                                                                                     wp-admin/includes/class-ftp-pure.php                                                                0000755 0023422 0004734 00000012561 11050757436 020522  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * PemFTP - A Ftp implementation in pure PHP
 *
 * @package PemFTP
 * @since 2.5
 *
 * @version 1.0
 * @copyright Alexey Dotsenko
 * @author Alexey Dotsenko
 * @link http://www.phpclasses.org/browse/package/1743.html Site
 * @license LGPL License http://www.opensource.org/licenses/lgpl-license.html
 */

/**
 * FTP implementation using fsockopen to connect.
 *
 * @package PemFTP
 * @subpackage Pure
 * @since 2.5
 *
 * @version 1.0
 * @copyright Alexey Dotsenko
 * @author Alexey Dotsenko
 * @link http://www.phpclasses.org/browse/package/1743.html Site
 * @license LGPL License http://www.opensource.org/licenses/lgpl-license.html
 */
class ftp extends ftp_base {

	function ftp($verb=FALSE, $le=FALSE) {
		$this->__construct($verb, $le);
	}

	function __construct($verb=FALSE, $le=FALSE) {
		parent::__construct(false, $verb, $le);
	}

// <!-- --------------------------------------------------------------------------------------- -->
// <!--       Private functions                                                                 -->
// <!-- --------------------------------------------------------------------------------------- -->

	function _settimeout($sock) {
		if(!@stream_set_timeout($sock, $this->_timeout)) {
			$this->PushError('_settimeout','socket set send timeout');
			$this->_quit();
			return FALSE;
		}
		return TRUE;
	}

	function _connect($host, $port) {
		$this->SendMSG("Creating socket");
		$sock = @fsockopen($host, $port, $errno, $errstr, $this->_timeout);
		if (!$sock) {
			$this->PushError('_connect','socket connect failed', $errstr." (".$errno.")");
			return FALSE;
		}
		$this->_connected=true;
		return $sock;
	}

	function _readmsg($fnction="_readmsg"){
		if(!$this->_connected) {
			$this->PushError($fnction, 'Connect first');
			return FALSE;
		}
		$result=true;
		$this->_message="";
		$this->_code=0;
		$go=true;
		do {
			$tmp=@fgets($this->_ftp_control_sock, 512);
			if($tmp===false) {
				$go=$result=false;
				$this->PushError($fnction,'Read failed');
			} else {
				$this->_message.=$tmp;
				if(preg_match("/^([0-9]{3})(-(.*[".CRLF."]{1,2})+\\1)? [^".CRLF."]+[".CRLF."]{1,2}$/", $this->_message, $regs)) $go=false;
			}
		} while($go);
		if($this->LocalEcho) echo "GET < ".rtrim($this->_message, CRLF).CRLF;
		$this->_code=(int)$regs[1];
		return $result;
	}

	function _exec($cmd, $fnction="_exec") {
		if(!$this->_ready) {
			$this->PushError($fnction,'Connect first');
			return FALSE;
		}
		if($this->LocalEcho) echo "PUT > ",$cmd,CRLF;
		$status=@fputs($this->_ftp_control_sock, $cmd.CRLF);
		if($status===false) {
			$this->PushError($fnction,'socket write failed');
			return FALSE;
		}
		$this->_lastaction=time();
		if(!$this->_readmsg($fnction)) return FALSE;
		return TRUE;
	}

	function _data_prepare($mode=FTP_ASCII) {
		if(!$this->_settype($mode)) return FALSE;
		if($this->_passive) {
			if(!$this->_exec("PASV", "pasv")) {
				$this->_data_close();
				return FALSE;
			}
			if(!$this->_checkCode()) {
				$this->_data_close();
				return FALSE;
			}
			$ip_port = explode(",", ereg_replace("^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*".CRLF."$", "\\1", $this->_message));
			$this->_datahost=$ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3];
            $this->_dataport=(((int)$ip_port[4])<<8) + ((int)$ip_port[5]);
			$this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport);
			$this->_ftp_data_sock=@fsockopen($this->_datahost, $this->_dataport, $errno, $errstr, $this->_timeout);
			if(!$this->_ftp_data_sock) {
				$this->PushError("_data_prepare","fsockopen fails", $errstr." (".$errno.")");
				$this->_data_close();
				return FALSE;
			}
			else $this->_ftp_data_sock;
		} else {
			$this->SendMSG("Only passive connections available!");
			return FALSE;
		}
		return TRUE;
	}

	function _data_read($mode=FTP_ASCII, $fp=NULL) {
		if(is_resource($fp)) $out=0;
		else $out="";
		if(!$this->_passive) {
			$this->SendMSG("Only passive connections available!");
			return FALSE;
		}
		while (!feof($this->_ftp_data_sock)) {
			$block=fread($this->_ftp_data_sock, $this->_ftp_buff_size);
			if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_local], $block);
			if(is_resource($fp)) $out+=fwrite($fp, $block, strlen($block));
			else $out.=$block;
		}
		return $out;
	}

	function _data_write($mode=FTP_ASCII, $fp=NULL) {
		if(is_resource($fp)) $out=0;
		else $out="";
		if(!$this->_passive) {
			$this->SendMSG("Only passive connections available!");
			return FALSE;
		}
		if(is_resource($fp)) {
			while(!feof($fp)) {
				$block=fread($fp, $this->_ftp_buff_size);
				if(!$this->_data_write_block($mode, $block)) return false;
			}
		} elseif(!$this->_data_write_block($mode, $fp)) return false;
		return TRUE;
	}

	function _data_write_block($mode, $block) {
		if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_remote], $block);
		do {
			if(($t=@fwrite($this->_ftp_data_sock, $block))===FALSE) {
				$this->PushError("_data_write","Can't write to socket");
				return FALSE;
			}
			$block=substr($block, $t);
		} while(!empty($block));
		return true;
	}

	function _data_close() {
		@fclose($this->_ftp_data_sock);
		$this->SendMSG("Disconnected data from remote host");
		return TRUE;
	}

	function _quit($force=FALSE) {
		if($this->_connected or $force) {
			@fclose($this->_ftp_control_sock);
			$this->_connected=false;
			$this->SendMSG("Socket closed");
		}
	}
}

?>
                                                                                                                                               wp-admin/includes/class-ftp-sockets.php                                                             0000755 0023422 0004734 00000020540 11050757436 021216  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * PemFTP - A Ftp implementation in pure PHP
 *
 * @package PemFTP
 * @since 2.5
 *
 * @version 1.0
 * @copyright Alexey Dotsenko
 * @author Alexey Dotsenko
 * @link http://www.phpclasses.org/browse/package/1743.html Site
 * @license LGPL License http://www.opensource.org/licenses/lgpl-license.html
 */

/**
 * Socket Based FTP implementation
 *
 * @package PemFTP
 * @subpackage Socket
 * @since 2.5
 *
 * @version 1.0
 * @copyright Alexey Dotsenko
 * @author Alexey Dotsenko
 * @link http://www.phpclasses.org/browse/package/1743.html Site
 * @license LGPL License http://www.opensource.org/licenses/lgpl-license.html
 */
class ftp extends ftp_base {

	function ftp($verb=FALSE, $le=FALSE) {
		$this->__construct($verb, $le);
	}

	function __construct($verb=FALSE, $le=FALSE) {
		parent::__construct(true, $verb, $le);
	}

// <!-- --------------------------------------------------------------------------------------- -->
// <!--       Private functions                                                                 -->
// <!-- --------------------------------------------------------------------------------------- -->

	function _settimeout($sock) {
		if(!@socket_set_option($sock, SOL_SOCKET, SO_RCVTIMEO, array("sec"=>$this->_timeout, "usec"=>0))) {
			$this->PushError('_connect','socket set receive timeout',socket_strerror(socket_last_error($sock)));
			@socket_close($sock);
			return FALSE;
		}
		if(!@socket_set_option($sock, SOL_SOCKET , SO_SNDTIMEO, array("sec"=>$this->_timeout, "usec"=>0))) {
			$this->PushError('_connect','socket set send timeout',socket_strerror(socket_last_error($sock)));
			@socket_close($sock);
			return FALSE;
		}
		return true;
	}

	function _connect($host, $port) {
		$this->SendMSG("Creating socket");
		if(!($sock = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP))) {
			$this->PushError('_connect','socket create failed',socket_strerror(socket_last_error($sock)));
			return FALSE;
		}
		if(!$this->_settimeout($sock)) return FALSE;
		$this->SendMSG("Connecting to \"".$host.":".$port."\"");
		if (!($res = @socket_connect($sock, $host, $port))) {
			$this->PushError('_connect','socket connect failed',socket_strerror(socket_last_error($sock)));
			@socket_close($sock);
			return FALSE;
		}
		$this->_connected=true;
		return $sock;
	}

	function _readmsg($fnction="_readmsg"){
		if(!$this->_connected) {
			$this->PushError($fnction,'Connect first');
			return FALSE;
		}
		$result=true;
		$this->_message="";
		$this->_code=0;
		$go=true;
		do {
			$tmp=@socket_read($this->_ftp_control_sock, 4096, PHP_BINARY_READ);
			if($tmp===false) {
				$go=$result=false;
				$this->PushError($fnction,'Read failed', socket_strerror(socket_last_error($this->_ftp_control_sock)));
			} else {
				$this->_message.=$tmp;
				$go = !preg_match("/^([0-9]{3})(-.+\\1)? [^".CRLF."]+".CRLF."$/Us", $this->_message, $regs);
			}
		} while($go);
		if($this->LocalEcho) echo "GET < ".rtrim($this->_message, CRLF).CRLF;
		$this->_code=(int)$regs[1];
		return $result;
	}

	function _exec($cmd, $fnction="_exec") {
		if(!$this->_ready) {
			$this->PushError($fnction,'Connect first');
			return FALSE;
		}
		if($this->LocalEcho) echo "PUT > ",$cmd,CRLF;
		$status=@socket_write($this->_ftp_control_sock, $cmd.CRLF);
		if($status===false) {
			$this->PushError($fnction,'socket write failed', socket_strerror(socket_last_error($this->stream)));
			return FALSE;
		}
		$this->_lastaction=time();
		if(!$this->_readmsg($fnction)) return FALSE;
		return TRUE;
	}

	function _data_prepare($mode=FTP_ASCII) {
		if(!$this->_settype($mode)) return FALSE;
		$this->SendMSG("Creating data socket");
		$this->_ftp_data_sock = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
		if ($this->_ftp_data_sock < 0) {
			$this->PushError('_data_prepare','socket create failed',socket_strerror(socket_last_error($this->_ftp_data_sock)));
			return FALSE;
		}
		if(!$this->_settimeout($this->_ftp_data_sock)) {
			$this->_data_close();
			return FALSE;
		}
		if($this->_passive) {
			if(!$this->_exec("PASV", "pasv")) {
				$this->_data_close();
				return FALSE;
			}
			if(!$this->_checkCode()) {
				$this->_data_close();
				return FALSE;
			}
			$ip_port = explode(",", ereg_replace("^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*".CRLF."$", "\\1", $this->_message));
			$this->_datahost=$ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3];
            $this->_dataport=(((int)$ip_port[4])<<8) + ((int)$ip_port[5]);
			$this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport);
			if(!@socket_connect($this->_ftp_data_sock, $this->_datahost, $this->_dataport)) {
				$this->PushError("_data_prepare","socket_connect", socket_strerror(socket_last_error($this->_ftp_data_sock)));
				$this->_data_close();
				return FALSE;
			}
			else $this->_ftp_temp_sock=$this->_ftp_data_sock;
		} else {
			if(!@socket_getsockname($this->_ftp_control_sock, $addr, $port)) {
				$this->PushError("_data_prepare","can't get control socket information", socket_strerror(socket_last_error($this->_ftp_control_sock)));
				$this->_data_close();
				return FALSE;
			}
			if(!@socket_bind($this->_ftp_data_sock,$addr)){
				$this->PushError("_data_prepare","can't bind data socket", socket_strerror(socket_last_error($this->_ftp_data_sock)));
				$this->_data_close();
				return FALSE;
			}
			if(!@socket_listen($this->_ftp_data_sock)) {
				$this->PushError("_data_prepare","can't listen data socket", socket_strerror(socket_last_error($this->_ftp_data_sock)));
				$this->_data_close();
				return FALSE;
			}
			if(!@socket_getsockname($this->_ftp_data_sock, $this->_datahost, $this->_dataport)) {
				$this->PushError("_data_prepare","can't get data socket information", socket_strerror(socket_last_error($this->_ftp_data_sock)));
				$this->_data_close();
				return FALSE;
			}
			if(!$this->_exec('PORT '.str_replace('.',',',$this->_datahost.'.'.($this->_dataport>>8).'.'.($this->_dataport&0x00FF)), "_port")) {
				$this->_data_close();
				return FALSE;
			}
			if(!$this->_checkCode()) {
				$this->_data_close();
				return FALSE;
			}
		}
		return TRUE;
	}

	function _data_read($mode=FTP_ASCII, $fp=NULL) {
		$NewLine=$this->_eol_code[$this->OS_local];
		if(is_resource($fp)) $out=0;
		else $out="";
		if(!$this->_passive) {
			$this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport);
			$this->_ftp_temp_sock=socket_accept($this->_ftp_data_sock);
			if($this->_ftp_temp_sock===FALSE) {
				$this->PushError("_data_read","socket_accept", socket_strerror(socket_last_error($this->_ftp_temp_sock)));
				$this->_data_close();
				return FALSE;
			}
		}

		while(($block=@socket_read($this->_ftp_temp_sock, $this->_ftp_buff_size, PHP_BINARY_READ))!==false) {
			if($block==="") break;
			if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_local], $block);
			if(is_resource($fp)) $out+=fwrite($fp, $block, strlen($block));
			else $out.=$block;
		}
		return $out;
	}

	function _data_write($mode=FTP_ASCII, $fp=NULL) {
		$NewLine=$this->_eol_code[$this->OS_local];
		if(is_resource($fp)) $out=0;
		else $out="";
		if(!$this->_passive) {
			$this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport);
			$this->_ftp_temp_sock=socket_accept($this->_ftp_data_sock);
			if($this->_ftp_temp_sock===FALSE) {
				$this->PushError("_data_write","socket_accept", socket_strerror(socket_last_error($this->_ftp_temp_sock)));
				$this->_data_close();
				return false;
			}
		}
		if(is_resource($fp)) {
			while(!feof($fp)) {
				$block=fread($fp, $this->_ftp_buff_size);
				if(!$this->_data_write_block($mode, $block)) return false;
			}
		} elseif(!$this->_data_write_block($mode, $fp)) return false;
		return true;
	}

	function _data_write_block($mode, $block) {
		if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_remote], $block);
		do {
			if(($t=@socket_write($this->_ftp_temp_sock, $block))===FALSE) {
				$this->PushError("_data_write","socket_write", socket_strerror(socket_last_error($this->_ftp_temp_sock)));
				$this->_data_close();
				return FALSE;
			}
			$block=substr($block, $t);
		} while(!empty($block));
		return true;
	}

	function _data_close() {
		@socket_close($this->_ftp_temp_sock);
		@socket_close($this->_ftp_data_sock);
		$this->SendMSG("Disconnected data from remote host");
		return TRUE;
	}

	function _quit() {
		if($this->_connected) {
			@socket_close($this->_ftp_control_sock);
			$this->_connected=false;
			$this->SendMSG("Socket closed");
		}
	}
}
?>
                                                                                                                                                                wp-admin/includes/class-ftp.php                                                                     0000755 0023422 0004734 00000063627 11050757436 017562  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * PemFTP - A Ftp implementation in pure PHP
 *
 * @package PemFTP
 * @since 2.5
 *
 * @version 1.0
 * @copyright Alexey Dotsenko
 * @author Alexey Dotsenko
 * @link http://www.phpclasses.org/browse/package/1743.html Site
 * @license LGPL License http://www.opensource.org/licenses/lgpl-license.html
 */

/**
 * Defines the newline characters, if not defined already.
 *
 * This can be redefined.
 *
 * @since 2.5
 * @var string
 */
if(!defined('CRLF')) define('CRLF',"\r\n");

/**
 * Sets whatever to autodetect ASCII mode.
 *
 * This can be redefined.
 *
 * @since 2.5
 * @var int
 */
if(!defined("FTP_AUTOASCII")) define("FTP_AUTOASCII", -1);

/**
 *
 * This can be redefined.
 * @since 2.5
 * @var int
 */
if(!defined("FTP_BINARY")) define("FTP_BINARY", 1);

/**
 *
 * This can be redefined.
 * @since 2.5
 * @var int
 */
if(!defined("FTP_ASCII")) define("FTP_ASCII", 0);

/**
 * Whether to force FTP.
 *
 * This can be redefined.
 *
 * @since 2.5
 * @var bool
 */
if(!defined('FTP_FORCE')) define('FTP_FORCE', true);

/**
 * @since 2.5
 * @var string
 */
define('FTP_OS_Unix','u');

/**
 * @since 2.5
 * @var string
 */
define('FTP_OS_Windows','w');

/**
 * @since 2.5
 * @var string
 */
define('FTP_OS_Mac','m');

/**
 * PemFTP base class
 *
 */
class ftp_base {
	/* Public variables */
	var $LocalEcho;
	var $Verbose;
	var $OS_local;
	var $OS_remote;

	/* Private variables */
	var $_lastaction;
	var $_errors;
	var $_type;
	var $_umask;
	var $_timeout;
	var $_passive;
	var $_host;
	var $_fullhost;
	var $_port;
	var $_datahost;
	var $_dataport;
	var $_ftp_control_sock;
	var $_ftp_data_sock;
	var $_ftp_temp_sock;
	var $_ftp_buff_size;
	var $_login;
	var $_password;
	var $_connected;
	var $_ready;
	var $_code;
	var $_message;
	var $_can_restore;
	var $_port_available;
	var $_curtype;
	var $_features;

	var $_error_array;
	var $AuthorizedTransferMode;
	var $OS_FullName;
	var $_eol_code;
	var $AutoAsciiExt;

	/* Constructor */
	function ftp_base($port_mode=FALSE) {
		$this->__construct($port_mode);
	}

	function __construct($port_mode=FALSE, $verb=FALSE, $le=FALSE) {
		$this->LocalEcho=$le;
		$this->Verbose=$verb;
		$this->_lastaction=NULL;
		$this->_error_array=array();
		$this->_eol_code=array(FTP_OS_Unix=>"\n", FTP_OS_Mac=>"\r", FTP_OS_Windows=>"\r\n");
		$this->AuthorizedTransferMode=array(FTP_AUTOASCII, FTP_ASCII, FTP_BINARY);
		$this->OS_FullName=array(FTP_OS_Unix => 'UNIX', FTP_OS_Windows => 'WINDOWS', FTP_OS_Mac => 'MACOS');
		$this->AutoAsciiExt=array("ASP","BAT","C","CPP","CSS","CSV","JS","H","HTM","HTML","SHTML","INI","LOG","PHP3","PHTML","PL","PERL","SH","SQL","TXT");
		$this->_port_available=($port_mode==TRUE);
		$this->SendMSG("Staring FTP client class".($this->_port_available?"":" without PORT mode support"));
		$this->_connected=FALSE;
		$this->_ready=FALSE;
		$this->_can_restore=FALSE;
		$this->_code=0;
		$this->_message="";
		$this->_ftp_buff_size=4096;
		$this->_curtype=NULL;
		$this->SetUmask(0022);
		$this->SetType(FTP_AUTOASCII);
		$this->SetTimeout(30);
		$this->Passive(!$this->_port_available);
		$this->_login="anonymous";
		$this->_password="anon@ftp.com";
		$this->_features=array();
	    $this->OS_local=FTP_OS_Unix;
		$this->OS_remote=FTP_OS_Unix;
		$this->features=array();
		if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') $this->OS_local=FTP_OS_Windows;
		elseif(strtoupper(substr(PHP_OS, 0, 3)) === 'MAC') $this->OS_local=FTP_OS_Mac;
	}

// <!-- --------------------------------------------------------------------------------------- -->
// <!--       Public functions                                                                  -->
// <!-- --------------------------------------------------------------------------------------- -->

	function parselisting($line) {
		$is_windows = ($this->OS_remote == FTP_OS_Windows);
		if ($is_windows && preg_match("/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|<DIR>) +(.+)/",$line,$lucifer)) {
			$b = array();
			if ($lucifer[3]<70) { $lucifer[3]+=2000; } else { $lucifer[3]+=1900; } // 4digit year fix
			$b['isdir'] = ($lucifer[7]=="<DIR>");
			if ( $b['isdir'] )
				$b['type'] = 'd';
			else
				$b['type'] = 'f';
			$b['size'] = $lucifer[7];
			$b['month'] = $lucifer[1];
			$b['day'] = $lucifer[2];
			$b['year'] = $lucifer[3];
			$b['hour'] = $lucifer[4];
			$b['minute'] = $lucifer[5];
			$b['time'] = @mktime($lucifer[4]+(strcasecmp($lucifer[6],"PM")==0?12:0),$lucifer[5],0,$lucifer[1],$lucifer[2],$lucifer[3]);
			$b['am/pm'] = $lucifer[6];
			$b['name'] = $lucifer[8];
		} else if (!$is_windows && $lucifer=preg_split("/[ ]/",$line,9,PREG_SPLIT_NO_EMPTY)) {
			//echo $line."\n";
			$lcount=count($lucifer);
			if ($lcount<8) return '';
			$b = array();
			$b['isdir'] = $lucifer[0]{0} === "d";
			$b['islink'] = $lucifer[0]{0} === "l";
			if ( $b['isdir'] )
				$b['type'] = 'd';
			elseif ( $b['islink'] )
				$b['type'] = 'l';
			else
				$b['type'] = 'f';
			$b['perms'] = $lucifer[0];
			$b['number'] = $lucifer[1];
			$b['owner'] = $lucifer[2];
			$b['group'] = $lucifer[3];
			$b['size'] = $lucifer[4];
			if ($lcount==8) {
				sscanf($lucifer[5],"%d-%d-%d",$b['year'],$b['month'],$b['day']);
				sscanf($lucifer[6],"%d:%d",$b['hour'],$b['minute']);
				$b['time'] = @mktime($b['hour'],$b['minute'],0,$b['month'],$b['day'],$b['year']);
				$b['name'] = $lucifer[7];
			} else {
				$b['month'] = $lucifer[5];
				$b['day'] = $lucifer[6];
				if (preg_match("/([0-9]{2}):([0-9]{2})/",$lucifer[7],$l2)) {
					$b['year'] = date("Y");
					$b['hour'] = $l2[1];
					$b['minute'] = $l2[2];
				} else {
					$b['year'] = $lucifer[7];
					$b['hour'] = 0;
					$b['minute'] = 0;
				}
				$b['time'] = strtotime(sprintf("%d %s %d %02d:%02d",$b['day'],$b['month'],$b['year'],$b['hour'],$b['minute']));
				$b['name'] = $lucifer[8];
			}
		}

		return $b;
	}

	function SendMSG($message = "", $crlf=true) {
		if ($this->Verbose) {
			echo $message.($crlf?CRLF:"");
			flush();
		}
		return TRUE;
	}

	function SetType($mode=FTP_AUTOASCII) {
		if(!in_array($mode, $this->AuthorizedTransferMode)) {
			$this->SendMSG("Wrong type");
			return FALSE;
		}
		$this->_type=$mode;
		$this->SendMSG("Transfer type: ".($this->_type==FTP_BINARY?"binary":($this->_type==FTP_ASCII?"ASCII":"auto ASCII") ) );
		return TRUE;
	}

	function _settype($mode=FTP_ASCII) {
		if($this->_ready) {
			if($mode==FTP_BINARY) {
				if($this->_curtype!=FTP_BINARY) {
					if(!$this->_exec("TYPE I", "SetType")) return FALSE;
					$this->_curtype=FTP_BINARY;
				}
			} elseif($this->_curtype!=FTP_ASCII) {
				if(!$this->_exec("TYPE A", "SetType")) return FALSE;
				$this->_curtype=FTP_ASCII;
			}
		} else return FALSE;
		return TRUE;
	}

	function Passive($pasv=NULL) {
		if(is_null($pasv)) $this->_passive=!$this->_passive;
		else $this->_passive=$pasv;
		if(!$this->_port_available and !$this->_passive) {
			$this->SendMSG("Only passive connections available!");
			$this->_passive=TRUE;
			return FALSE;
		}
		$this->SendMSG("Passive mode ".($this->_passive?"on":"off"));
		return TRUE;
	}

	function SetServer($host, $port=21, $reconnect=true) {
		if(!is_long($port)) {
	        $this->verbose=true;
    	    $this->SendMSG("Incorrect port syntax");
			return FALSE;
		} else {
			$ip=@gethostbyname($host);
	        $dns=@gethostbyaddr($host);
	        if(!$ip) $ip=$host;
	        if(!$dns) $dns=$host;
			if(ip2long($ip) === -1) {
				$this->SendMSG("Wrong host name/address \"".$host."\"");
				return FALSE;
			}
	        $this->_host=$ip;
	        $this->_fullhost=$dns;
	        $this->_port=$port;
	        $this->_dataport=$port-1;
		}
		$this->SendMSG("Host \"".$this->_fullhost."(".$this->_host."):".$this->_port."\"");
		if($reconnect){
			if($this->_connected) {
				$this->SendMSG("Reconnecting");
				if(!$this->quit(FTP_FORCE)) return FALSE;
				if(!$this->connect()) return FALSE;
			}
		}
		return TRUE;
	}

	function SetUmask($umask=0022) {
		$this->_umask=$umask;
		umask($this->_umask);
		$this->SendMSG("UMASK 0".decoct($this->_umask));
		return TRUE;
	}

	function SetTimeout($timeout=30) {
		$this->_timeout=$timeout;
		$this->SendMSG("Timeout ".$this->_timeout);
		if($this->_connected)
			if(!$this->_settimeout($this->_ftp_control_sock)) return FALSE;
		return TRUE;
	}

	function connect($server=NULL) {
		if(!empty($server)) {
			if(!$this->SetServer($server)) return false;
		}
		if($this->_ready) return true;
	    $this->SendMsg('Local OS : '.$this->OS_FullName[$this->OS_local]);
		if(!($this->_ftp_control_sock = $this->_connect($this->_host, $this->_port))) {
			$this->SendMSG("Error : Cannot connect to remote host \"".$this->_fullhost." :".$this->_port."\"");
			return FALSE;
		}
		$this->SendMSG("Connected to remote host \"".$this->_fullhost.":".$this->_port."\". Waiting for greeting.");
		do {
			if(!$this->_readmsg()) return FALSE;
			if(!$this->_checkCode()) return FALSE;
			$this->_lastaction=time();
		} while($this->_code<200);
		$this->_ready=true;
		$syst=$this->systype();
		if(!$syst) $this->SendMSG("Can't detect remote OS");
		else {
			if(preg_match("/win|dos|novell/i", $syst[0])) $this->OS_remote=FTP_OS_Windows;
			elseif(preg_match("/os/i", $syst[0])) $this->OS_remote=FTP_OS_Mac;
			elseif(preg_match("/(li|u)nix/i", $syst[0])) $this->OS_remote=FTP_OS_Unix;
			else $this->OS_remote=FTP_OS_Mac;
			$this->SendMSG("Remote OS: ".$this->OS_FullName[$this->OS_remote]);
		}
		if(!$this->features()) $this->SendMSG("Can't get features list. All supported - disabled");
		else $this->SendMSG("Supported features: ".implode(", ", array_keys($this->_features)));
		return TRUE;
	}

	function quit($force=false) {
		if($this->_ready) {
			if(!$this->_exec("QUIT") and !$force) return FALSE;
			if(!$this->_checkCode() and !$force) return FALSE;
			$this->_ready=false;
			$this->SendMSG("Session finished");
		}
		$this->_quit();
		return TRUE;
	}

	function login($user=NULL, $pass=NULL) {
		if(!is_null($user)) $this->_login=$user;
		else $this->_login="anonymous";
		if(!is_null($pass)) $this->_password=$pass;
		else $this->_password="anon@anon.com";
		if(!$this->_exec("USER ".$this->_login, "login")) return FALSE;
		if(!$this->_checkCode()) return FALSE;
		if($this->_code!=230) {
			if(!$this->_exec((($this->_code==331)?"PASS ":"ACCT ").$this->_password, "login")) return FALSE;
			if(!$this->_checkCode()) return FALSE;
		}
		$this->SendMSG("Authentication succeeded");
		if(empty($this->_features)) {
			if(!$this->features()) $this->SendMSG("Can't get features list. All supported - disabled");
			else $this->SendMSG("Supported features: ".implode(", ", array_keys($this->_features)));
		}
		return TRUE;
	}

	function pwd() {
		if(!$this->_exec("PWD", "pwd")) return FALSE;
		if(!$this->_checkCode()) return FALSE;
		return ereg_replace("^[0-9]{3} \"(.+)\".+", "\\1", $this->_message);
	}

	function cdup() {
		if(!$this->_exec("CDUP", "cdup")) return FALSE;
		if(!$this->_checkCode()) return FALSE;
		return true;
	}

	function chdir($pathname) {
		if(!$this->_exec("CWD ".$pathname, "chdir")) return FALSE;
		if(!$this->_checkCode()) return FALSE;
		return TRUE;
	}

	function rmdir($pathname) {
		if(!$this->_exec("RMD ".$pathname, "rmdir")) return FALSE;
		if(!$this->_checkCode()) return FALSE;
		return TRUE;
	}

	function mkdir($pathname) {
		if(!$this->_exec("MKD ".$pathname, "mkdir")) return FALSE;
		if(!$this->_checkCode()) return FALSE;
		return TRUE;
	}

	function rename($from, $to) {
		if(!$this->_exec("RNFR ".$from, "rename")) return FALSE;
		if(!$this->_checkCode()) return FALSE;
		if($this->_code==350) {
			if(!$this->_exec("RNTO ".$to, "rename")) return FALSE;
			if(!$this->_checkCode()) return FALSE;
		} else return FALSE;
		return TRUE;
	}

	function filesize($pathname) {
		if(!isset($this->_features["SIZE"])) {
			$this->PushError("filesize", "not supported by server");
			return FALSE;
		}
		if(!$this->_exec("SIZE ".$pathname, "filesize")) return FALSE;
		if(!$this->_checkCode()) return FALSE;
		return ereg_replace("^[0-9]{3} ([0-9]+)".CRLF, "\\1", $this->_message);
	}

	function abort() {
		if(!$this->_exec("ABOR", "abort")) return FALSE;
		if(!$this->_checkCode()) {
			if($this->_code!=426) return FALSE;
			if(!$this->_readmsg("abort")) return FALSE;
			if(!$this->_checkCode()) return FALSE;
		}
		return true;
	}

	function mdtm($pathname) {
		if(!isset($this->_features["MDTM"])) {
			$this->PushError("mdtm", "not supported by server");
			return FALSE;
		}
		if(!$this->_exec("MDTM ".$pathname, "mdtm")) return FALSE;
		if(!$this->_checkCode()) return FALSE;
		$mdtm = ereg_replace("^[0-9]{3} ([0-9]+)".CRLF, "\\1", $this->_message);
		$date = sscanf($mdtm, "%4d%2d%2d%2d%2d%2d");
		$timestamp = mktime($date[3], $date[4], $date[5], $date[1], $date[2], $date[0]);
		return $timestamp;
	}

	function systype() {
		if(!$this->_exec("SYST", "systype")) return FALSE;
		if(!$this->_checkCode()) return FALSE;
		$DATA = explode(" ", $this->_message);
		return array($DATA[1], $DATA[3]);
	}

	function delete($pathname) {
		if(!$this->_exec("DELE ".$pathname, "delete")) return FALSE;
		if(!$this->_checkCode()) return FALSE;
		return TRUE;
	}

	function site($command, $fnction="site") {
		if(!$this->_exec("SITE ".$command, $fnction)) return FALSE;
		if(!$this->_checkCode()) return FALSE;
		return TRUE;
	}

	function chmod($pathname, $mode) {
		if(!$this->site( sprintf('CHMOD %o %s', $mode, $pathname), "chmod")) return FALSE;
		return TRUE;
	}

	function restore($from) {
		if(!isset($this->_features["REST"])) {
			$this->PushError("restore", "not supported by server");
			return FALSE;
		}
		if($this->_curtype!=FTP_BINARY) {
			$this->PushError("restore", "can't restore in ASCII mode");
			return FALSE;
		}
		if(!$this->_exec("REST ".$from, "resore")) return FALSE;
		if(!$this->_checkCode()) return FALSE;
		return TRUE;
	}

	function features() {
		if(!$this->_exec("FEAT", "features")) return FALSE;
		if(!$this->_checkCode()) return FALSE;
		$f=preg_split("/[".CRLF."]+/", preg_replace("/[0-9]{3}[ -].*[".CRLF."]+/", "", $this->_message), -1, PREG_SPLIT_NO_EMPTY);
		$this->_features=array();
		foreach($f as $k=>$v) {
			$v=explode(" ", trim($v));
			$this->_features[array_shift($v)]=$v;;
		}
		return true;
	}

	function rawlist($pathname="", $arg="") {
		return $this->_list(($arg?" ".$arg:"").($pathname?" ".$pathname:""), "LIST", "rawlist");
	}

	function nlist($pathname="") {
		return $this->_list(($arg?" ".$arg:"").($pathname?" ".$pathname:""), "NLST", "nlist");
	}

	function is_exists($pathname) {
		return $this->file_exists($pathname);
	}

	function file_exists($pathname) {
		$exists=true;
		if(!$this->_exec("RNFR ".$pathname, "rename")) $exists=FALSE;
		else {
			if(!$this->_checkCode()) $exists=FALSE;
			$this->abort();
		}
		if($exists) $this->SendMSG("Remote file ".$pathname." exists");
		else $this->SendMSG("Remote file ".$pathname." does not exist");
		return $exists;
	}

	function fget($fp, $remotefile,$rest=0) {
		if($this->_can_restore and $rest!=0) fseek($fp, $rest);
		$pi=pathinfo($remotefile);
		if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII;
		else $mode=FTP_BINARY;
		if(!$this->_data_prepare($mode)) {
			return FALSE;
		}
		if($this->_can_restore and $rest!=0) $this->restore($rest);
		if(!$this->_exec("RETR ".$remotefile, "get")) {
			$this->_data_close();
			return FALSE;
		}
		if(!$this->_checkCode()) {
			$this->_data_close();
			return FALSE;
		}
		$out=$this->_data_read($mode, $fp);
		$this->_data_close();
		if(!$this->_readmsg()) return FALSE;
		if(!$this->_checkCode()) return FALSE;
		return $out;
	}

	function get($remotefile, $localfile=NULL, $rest=0) {
		if(is_null($localfile)) $localfile=$remotefile;
		if (@file_exists($localfile)) $this->SendMSG("Warning : local file will be overwritten");
		$fp = @fopen($localfile, "w");
		if (!$fp) {
			$this->PushError("get","can't open local file", "Cannot create \"".$localfile."\"");
			return FALSE;
		}
		if($this->_can_restore and $rest!=0) fseek($fp, $rest);
		$pi=pathinfo($remotefile);
		if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII;
		else $mode=FTP_BINARY;
		if(!$this->_data_prepare($mode)) {
			fclose($fp);
			return FALSE;
		}
		if($this->_can_restore and $rest!=0) $this->restore($rest);
		if(!$this->_exec("RETR ".$remotefile, "get")) {
			$this->_data_close();
			fclose($fp);
			return FALSE;
		}
		if(!$this->_checkCode()) {
			$this->_data_close();
			fclose($fp);
			return FALSE;
		}
		$out=$this->_data_read($mode, $fp);
		fclose($fp);
		$this->_data_close();
		if(!$this->_readmsg()) return FALSE;
		if(!$this->_checkCode()) return FALSE;
		return $out;
	}

	function fput($remotefile, $fp) {
		if($this->_can_restore and $rest!=0) fseek($fp, $rest);
		$pi=pathinfo($remotefile);
		if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII;
		else $mode=FTP_BINARY;
		if(!$this->_data_prepare($mode)) {
			return FALSE;
		}
		if($this->_can_restore and $rest!=0) $this->restore($rest);
		if(!$this->_exec("STOR ".$remotefile, "put")) {
			$this->_data_close();
			return FALSE;
		}
		if(!$this->_checkCode()) {
			$this->_data_close();
			return FALSE;
		}
		$ret=$this->_data_write($mode, $fp);
		$this->_data_close();
		if(!$this->_readmsg()) return FALSE;
		if(!$this->_checkCode()) return FALSE;
		return $ret;
	}

	function put($localfile, $remotefile=NULL, $rest=0) {
		if(is_null($remotefile)) $remotefile=$localfile;
		if (!file_exists($localfile)) {
			$this->PushError("put","can't open local file", "No such file or directory \"".$localfile."\"");
			return FALSE;
		}
		$fp = @fopen($localfile, "r");

		if (!$fp) {
			$this->PushError("put","can't open local file", "Cannot read file \"".$localfile."\"");
			return FALSE;
		}
		if($this->_can_restore and $rest!=0) fseek($fp, $rest);
		$pi=pathinfo($localfile);
		if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII;
		else $mode=FTP_BINARY;
		if(!$this->_data_prepare($mode)) {
			fclose($fp);
			return FALSE;
		}
		if($this->_can_restore and $rest!=0) $this->restore($rest);
		if(!$this->_exec("STOR ".$remotefile, "put")) {
			$this->_data_close();
			fclose($fp);
			return FALSE;
		}
		if(!$this->_checkCode()) {
			$this->_data_close();
			fclose($fp);
			return FALSE;
		}
		$ret=$this->_data_write($mode, $fp);
		fclose($fp);
		$this->_data_close();
		if(!$this->_readmsg()) return FALSE;
		if(!$this->_checkCode()) return FALSE;
		return $ret;
	}

	function mput($local=".", $remote=NULL, $continious=false) {
		$local=realpath($local);
		if(!@file_exists($local)) {
			$this->PushError("mput","can't open local folder", "Cannot stat folder \"".$local."\"");
			return FALSE;
		}
		if(!is_dir($local)) return $this->put($local, $remote);
		if(empty($remote)) $remote=".";
		elseif(!$this->file_exists($remote) and !$this->mkdir($remote)) return FALSE;
		if($handle = opendir($local)) {
			$list=array();
			while (false !== ($file = readdir($handle))) {
				if ($file != "." && $file != "..") $list[]=$file;
			}
			closedir($handle);
		} else {
			$this->PushError("mput","can't open local folder", "Cannot read folder \"".$local."\"");
			return FALSE;
		}
		if(empty($list)) return TRUE;
		$ret=true;
		foreach($list as $el) {
			if(is_dir($local."/".$el)) $t=$this->mput($local."/".$el, $remote."/".$el);
			else $t=$this->put($local."/".$el, $remote."/".$el);
			if(!$t) {
				$ret=FALSE;
				if(!$continious) break;
			}
		}
		return $ret;

	}

	function mget($remote, $local=".", $continious=false) {
		$list=$this->rawlist($remote, "-lA");
		if($list===false) {
			$this->PushError("mget","can't read remote folder list", "Can't read remote folder \"".$remote."\" contents");
			return FALSE;
		}
		if(empty($list)) return true;
		if(!@file_exists($local)) {
			if(!@mkdir($local)) {
				$this->PushError("mget","can't create local folder", "Cannot create folder \"".$local."\"");
				return FALSE;
			}
		}
		foreach($list as $k=>$v) {
			$list[$k]=$this->parselisting($v);
			if($list[$k]["name"]=="." or $list[$k]["name"]=="..") unset($list[$k]);
		}
		$ret=true;
		foreach($list as $el) {
			if($el["type"]=="d") {
				if(!$this->mget($remote."/".$el["name"], $local."/".$el["name"], $continious)) {
					$this->PushError("mget", "can't copy folder", "Can't copy remote folder \"".$remote."/".$el["name"]."\" to local \"".$local."/".$el["name"]."\"");
					$ret=false;
					if(!$continious) break;
				}
			} else {
				if(!$this->get($remote."/".$el["name"], $local."/".$el["name"])) {
					$this->PushError("mget", "can't copy file", "Can't copy remote file \"".$remote."/".$el["name"]."\" to local \"".$local."/".$el["name"]."\"");
					$ret=false;
					if(!$continious) break;
				}
			}
			@chmod($local."/".$el["name"], $el["perms"]);
			$t=strtotime($el["date"]);
			if($t!==-1 and $t!==false) @touch($local."/".$el["name"], $t);
		}
		return $ret;
	}

	function mdel($remote, $continious=false) {
		$list=$this->rawlist($remote, "-la");
		if($list===false) {
			$this->PushError("mdel","can't read remote folder list", "Can't read remote folder \"".$remote."\" contents");
			return false;
		}

		foreach($list as $k=>$v) {
			$list[$k]=$this->parselisting($v);
			if($list[$k]["name"]=="." or $list[$k]["name"]=="..") unset($list[$k]);
		}
		$ret=true;

		foreach($list as $el) {
			if ( empty($el) )
				continue;

			if($el["type"]=="d") {
				if(!$this->mdel($remote."/".$el["name"], $continious)) {
					$ret=false;
					if(!$continious) break;
				}
			} else {
				if (!$this->delete($remote."/".$el["name"])) {
					$this->PushError("mdel", "can't delete file", "Can't delete remote file \"".$remote."/".$el["name"]."\"");
					$ret=false;
					if(!$continious) break;
				}
			}
		}

		if(!$this->rmdir($remote)) {
			$this->PushError("mdel", "can't delete folder", "Can't delete remote folder \"".$remote."/".$el["name"]."\"");
			$ret=false;
		}
		return $ret;
	}

	function mmkdir($dir, $mode = 0777) {
		if(empty($dir)) return FALSE;
		if($this->is_exists($dir) or $dir == "/" ) return TRUE;
		if(!$this->mmkdir(dirname($dir), $mode)) return false;
		$r=$this->mkdir($dir, $mode);
		$this->chmod($dir,$mode);
		return $r;
	}

	function glob($pattern, $handle=NULL) {
		$path=$output=null;
		if(PHP_OS=='WIN32') $slash='\\';
		else $slash='/';
		$lastpos=strrpos($pattern,$slash);
		if(!($lastpos===false)) {
			$path=substr($pattern,0,-$lastpos-1);
			$pattern=substr($pattern,$lastpos);
		} else $path=getcwd();
		if(is_array($handle) and !empty($handle)) {
			while($dir=each($handle)) {
				if($this->glob_pattern_match($pattern,$dir))
				$output[]=$dir;
			}
		} else {
			$handle=@opendir($path);
			if($handle===false) return false;
			while($dir=readdir($handle)) {
				if($this->glob_pattern_match($pattern,$dir))
				$output[]=$dir;
			}
			closedir($handle);
		}
		if(is_array($output)) return $output;
		return false;
	}

	function glob_pattern_match($pattern,$string) {
		$out=null;
		$chunks=explode(';',$pattern);
		foreach($chunks as $pattern) {
			$escape=array('$','^','.','{','}','(',')','[',']','|');
			while(strpos($pattern,'**')!==false)
				$pattern=str_replace('**','*',$pattern);
			foreach($escape as $probe)
				$pattern=str_replace($probe,"\\$probe",$pattern);
			$pattern=str_replace('?*','*',
				str_replace('*?','*',
					str_replace('*',".*",
						str_replace('?','.{1,1}',$pattern))));
			$out[]=$pattern;
		}
		if(count($out)==1) return($this->glob_regexp("^$out[0]$",$string));
		else {
			foreach($out as $tester)
				if($this->my_regexp("^$tester$",$string)) return true;
		}
		return false;
	}

	function glob_regexp($pattern,$probe) {
		$sensitive=(PHP_OS!='WIN32');
		return ($sensitive?
			ereg($pattern,$probe):
			eregi($pattern,$probe)
		);
	}

	function dirlist($remote) {
		$list=$this->rawlist($remote, "-la");
		if($list===false) {
			$this->PushError("dirlist","can't read remote folder list", "Can't read remote folder \"".$remote."\" contents");
			return false;
		}

		$dirlist = array();
		foreach($list as $k=>$v) {
			$entry=$this->parselisting($v);
			if ( empty($entry) )
				continue;

			if($entry["name"]=="." or $entry["name"]=="..")
				continue;

			$dirlist[$entry['name']] = $entry;
		}

		return $dirlist;
	}
// <!-- --------------------------------------------------------------------------------------- -->
// <!--       Private functions                                                                 -->
// <!-- --------------------------------------------------------------------------------------- -->
	function _checkCode() {
		return ($this->_code<400 and $this->_code>0);
	}

	function _list($arg="", $cmd="LIST", $fnction="_list") {
		if(!$this->_data_prepare()) return false;
		if(!$this->_exec($cmd.$arg, $fnction)) {
			$this->_data_close();
			return FALSE;
		}
		if(!$this->_checkCode()) {
			$this->_data_close();
			return FALSE;
		}
		$out="";
		if($this->_code<200) {
			$out=$this->_data_read();
			$this->_data_close();
			if(!$this->_readmsg()) return FALSE;
			if(!$this->_checkCode()) return FALSE;
			if($out === FALSE ) return FALSE;
			$out=preg_split("/[".CRLF."]+/", $out, -1, PREG_SPLIT_NO_EMPTY);
//			$this->SendMSG(implode($this->_eol_code[$this->OS_local], $out));
		}
		return $out;
	}

// <!-- --------------------------------------------------------------------------------------- -->
// <!-- Partie : gestion des erreurs                                                            -->
// <!-- --------------------------------------------------------------------------------------- -->
// Gnre une erreur pour traitement externe  la classe
	function PushError($fctname,$msg,$desc=false){
		$error=array();
		$error['time']=time();
		$error['fctname']=$fctname;
		$error['msg']=$msg;
		$error['desc']=$desc;
		if($desc) $tmp=' ('.$desc.')'; else $tmp='';
		$this->SendMSG($fctname.': '.$msg.$tmp);
		return(array_push($this->_error_array,$error));
	}

// Rcupre une erreur externe
	function PopError(){
		if(count($this->_error_array)) return(array_pop($this->_error_array));
			else return(false);
	}
}

$mod_sockets=TRUE;
if (!extension_loaded('sockets')) {
	$prefix = (PHP_SHLIB_SUFFIX == 'dll') ? 'php_' : '';
	if(!@dl($prefix . 'sockets.' . PHP_SHLIB_SUFFIX)) $mod_sockets=FALSE;
}

require_once "class-ftp-".($mod_sockets?"sockets":"pure").".php";
?>
                                                                                                         wp-admin/includes/class-pclzip.php                                                                  0000755 0023422 0004734 00000732115 11050757436 020265  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * PhpConcept Library - Zip Module 2.5
 *
 * Presentation :
 *   PclZip is a PHP library that manage ZIP archives.
 *   So far tests show that archives generated by PclZip are readable by
 *   WinZip application and other tools.
 *
 * Warning :
 *   This library and the associated files are non commercial, non professional
 *   work.
 *   It should not have unexpected results. However if any damage is caused by
 *   this software the author can not be responsible.
 *   The use of this software is at the risk of the user.
 *
 * @package External
 * @subpackage PclZip
 *
 * @license License GNU/LGPL
 * @copyright March 2006 Vincent Blavet
 * @author Vincent Blavet
 * @link http://www.phpconcept.net
 * @version $Id: pclzip.lib.php,v 1.44 2006/03/08 21:23:59 vblavet Exp $
 */

/**
 * The read block size for reading zip files.
 *
 * @since 2.5
 */
define( 'PCLZIP_READ_BLOCK_SIZE', 2048 );

/**
 * File list separator
 *
 * In version 1.x of PclZip, the separator for file list is a space(which is not
 * a very smart choice, specifically for windows paths !). A better separator
 * should be a comma (,). This constant gives you the abilty to change that.
 *
 * However notice that changing this value, may have impact on existing scripts,
 * using space separated filenames. Recommanded values for compatibility with
 * older versions :
 * <code>define( 'PCLZIP_SEPARATOR', ' ' );</code>
 * Recommanded values for smart separation of filenames.
 */
define( 'PCLZIP_SEPARATOR', ',' );

/**
 * Error configuration
 *
 * 0 : PclZip Class integrated error handling
 * 1 : PclError external library error handling. By enabling this you must
 *     ensure that you have included PclError library.
 * [2,...] : reserved for future use
 */
define( 'PCLZIP_ERROR_EXTERNAL', 0 );

  // ----- Optional static temporary directory
  //       By default temporary files are generated in the script current
  //       path.
  //       If defined :
  //       - MUST BE terminated by a '/'.
  //       - MUST be a valid, already created directory
  //       Samples :
  // define( 'PCLZIP_TEMPORARY_DIR', '/temp/' );
  // define( 'PCLZIP_TEMPORARY_DIR', 'C:/Temp/' );
  define( 'PCLZIP_TEMPORARY_DIR', '' );

// --------------------------------------------------------------------------------
// ***** UNDER THIS LINE NOTHING NEEDS TO BE MODIFIED *****
// --------------------------------------------------------------------------------

  // ----- Global variables
  $g_pclzip_version = "2.5";

  // ----- Error codes
  //   -1 : Unable to open file in binary write mode
  //   -2 : Unable to open file in binary read mode
  //   -3 : Invalid parameters
  //   -4 : File does not exist
  //   -5 : Filename is too long (max. 255)
  //   -6 : Not a valid zip file
  //   -7 : Invalid extracted file size
  //   -8 : Unable to create directory
  //   -9 : Invalid archive extension
  //  -10 : Invalid archive format
  //  -11 : Unable to delete file (unlink)
  //  -12 : Unable to rename file (rename)
  //  -13 : Invalid header checksum
  //  -14 : Invalid archive size
  define( 'PCLZIP_ERR_USER_ABORTED', 2 );
  define( 'PCLZIP_ERR_NO_ERROR', 0 );
  define( 'PCLZIP_ERR_WRITE_OPEN_FAIL', -1 );
  define( 'PCLZIP_ERR_READ_OPEN_FAIL', -2 );
  define( 'PCLZIP_ERR_INVALID_PARAMETER', -3 );
  define( 'PCLZIP_ERR_MISSING_FILE', -4 );
  define( 'PCLZIP_ERR_FILENAME_TOO_LONG', -5 );
  define( 'PCLZIP_ERR_INVALID_ZIP', -6 );
  define( 'PCLZIP_ERR_BAD_EXTRACTED_FILE', -7 );
  define( 'PCLZIP_ERR_DIR_CREATE_FAIL', -8 );
  define( 'PCLZIP_ERR_BAD_EXTENSION', -9 );
  define( 'PCLZIP_ERR_BAD_FORMAT', -10 );
  define( 'PCLZIP_ERR_DELETE_FILE_FAIL', -11 );
  define( 'PCLZIP_ERR_RENAME_FILE_FAIL', -12 );
  define( 'PCLZIP_ERR_BAD_CHECKSUM', -13 );
  define( 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP', -14 );
  define( 'PCLZIP_ERR_MISSING_OPTION_VALUE', -15 );
  define( 'PCLZIP_ERR_INVALID_OPTION_VALUE', -16 );
  define( 'PCLZIP_ERR_ALREADY_A_DIRECTORY', -17 );
  define( 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION', -18 );
  define( 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION', -19 );
  define( 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE', -20 );
  define( 'PCLZIP_ERR_DIRECTORY_RESTRICTION', -21 );

  // ----- Options values
  define( 'PCLZIP_OPT_PATH', 77001 );
  define( 'PCLZIP_OPT_ADD_PATH', 77002 );
  define( 'PCLZIP_OPT_REMOVE_PATH', 77003 );
  define( 'PCLZIP_OPT_REMOVE_ALL_PATH', 77004 );
  define( 'PCLZIP_OPT_SET_CHMOD', 77005 );
  define( 'PCLZIP_OPT_EXTRACT_AS_STRING', 77006 );
  define( 'PCLZIP_OPT_NO_COMPRESSION', 77007 );
  define( 'PCLZIP_OPT_BY_NAME', 77008 );
  define( 'PCLZIP_OPT_BY_INDEX', 77009 );
  define( 'PCLZIP_OPT_BY_EREG', 77010 );
  define( 'PCLZIP_OPT_BY_PREG', 77011 );
  define( 'PCLZIP_OPT_COMMENT', 77012 );
  define( 'PCLZIP_OPT_ADD_COMMENT', 77013 );
  define( 'PCLZIP_OPT_PREPEND_COMMENT', 77014 );
  define( 'PCLZIP_OPT_EXTRACT_IN_OUTPUT', 77015 );
  define( 'PCLZIP_OPT_REPLACE_NEWER', 77016 );
  define( 'PCLZIP_OPT_STOP_ON_ERROR', 77017 );
  // Having big trouble with crypt. Need to multiply 2 long int
  // which is not correctly supported by PHP ...
  //define( 'PCLZIP_OPT_CRYPT', 77018 );
  define( 'PCLZIP_OPT_EXTRACT_DIR_RESTRICTION', 77019 );

  // ----- File description attributes
  define( 'PCLZIP_ATT_FILE_NAME', 79001 );
  define( 'PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002 );
  define( 'PCLZIP_ATT_FILE_NEW_FULL_NAME', 79003 );

  // ----- Call backs values
  define( 'PCLZIP_CB_PRE_EXTRACT', 78001 );
  define( 'PCLZIP_CB_POST_EXTRACT', 78002 );
  define( 'PCLZIP_CB_PRE_ADD', 78003 );
  define( 'PCLZIP_CB_POST_ADD', 78004 );
  /* For future use
  define( 'PCLZIP_CB_PRE_LIST', 78005 );
  define( 'PCLZIP_CB_POST_LIST', 78006 );
  define( 'PCLZIP_CB_PRE_DELETE', 78007 );
  define( 'PCLZIP_CB_POST_DELETE', 78008 );
  */

  // --------------------------------------------------------------------------------
  // Class : PclZip
  // Description :
  //   PclZip is the class that represent a Zip archive.
  //   The public methods allow the manipulation of the archive.
  // Attributes :
  //   Attributes must not be accessed directly.
  // Methods :
  //   PclZip() : Object creator
  //   create() : Creates the Zip archive
  //   listContent() : List the content of the Zip archive
  //   extract() : Extract the content of the archive
  //   properties() : List the properties of the archive
  // --------------------------------------------------------------------------------
  class PclZip
  {
    // ----- Filename of the zip file
    var $zipname = '';

    // ----- File descriptor of the zip file
    var $zip_fd = 0;

    // ----- Internal error handling
    var $error_code = 1;
    var $error_string = '';

    // ----- Current status of the magic_quotes_runtime
    // This value store the php configuration for magic_quotes
    // The class can then disable the magic_quotes and reset it after
    var $magic_quotes_status;

  // --------------------------------------------------------------------------------
  // Function : PclZip()
  // Description :
  //   Creates a PclZip object and set the name of the associated Zip archive
  //   filename.
  //   Note that no real action is taken, if the archive does not exist it is not
  //   created. Use create() for that.
  // --------------------------------------------------------------------------------
  function PclZip($p_zipname)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::PclZip', "zipname=$p_zipname");

    // ----- Tests the zlib
    if (!function_exists('gzopen'))
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 1, "zlib extension seems to be missing");
      die('Abort '.basename(__FILE__).' : Missing zlib extensions');
    }

    // ----- Set the attributes
    $this->zipname = $p_zipname;
    $this->zip_fd = 0;
    $this->magic_quotes_status = -1;

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 1);
    return;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function :
  //   create($p_filelist, $p_add_dir="", $p_remove_dir="")
  //   create($p_filelist, $p_option, $p_option_value, ...)
  // Description :
  //   This method supports two different synopsis. The first one is historical.
  //   This method creates a Zip Archive. The Zip file is created in the
  //   filesystem. The files and directories indicated in $p_filelist
  //   are added in the archive. See the parameters description for the
  //   supported format of $p_filelist.
  //   When a directory is in the list, the directory and its content is added
  //   in the archive.
  //   In this synopsis, the function takes an optional variable list of
  //   options. See bellow the supported options.
  // Parameters :
  //   $p_filelist : An array containing file or directory names, or
  //                 a string containing one filename or one directory name, or
  //                 a string containing a list of filenames and/or directory
  //                 names separated by spaces.
  //   $p_add_dir : A path to add before the real path of the archived file,
  //                in order to have it memorized in the archive.
  //   $p_remove_dir : A path to remove from the real path of the file to archive,
  //                   in order to have a shorter path memorized in the archive.
  //                   When $p_add_dir and $p_remove_dir are set, $p_remove_dir
  //                   is removed first, before $p_add_dir is added.
  // Options :
  //   PCLZIP_OPT_ADD_PATH :
  //   PCLZIP_OPT_REMOVE_PATH :
  //   PCLZIP_OPT_REMOVE_ALL_PATH :
  //   PCLZIP_OPT_COMMENT :
  //   PCLZIP_CB_PRE_ADD :
  //   PCLZIP_CB_POST_ADD :
  // Return Values :
  //   0 on failure,
  //   The list of the added files, with a status of the add action.
  //   (see PclZip::listContent() for list entry format)
  // --------------------------------------------------------------------------------
  function create($p_filelist)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::create', "filelist='$p_filelist', ...");
    $v_result=1;

    // ----- Reset the error handler
    $this->privErrorReset();

    // ----- Set default values
    $v_options = array();
    $v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE;

    // ----- Look for variable options arguments
    $v_size = func_num_args();
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");

    // ----- Look for arguments
    if ($v_size > 1) {
      // ----- Get the arguments
      $v_arg_list = func_get_args();

      // ----- Remove from the options list the first argument
      array_shift($v_arg_list);
      $v_size--;

      // ----- Look for first arg
      if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options detected");

        // ----- Parse the options
        $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
                                            array (PCLZIP_OPT_REMOVE_PATH => 'optional',
                                                   PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
                                                   PCLZIP_OPT_ADD_PATH => 'optional',
                                                   PCLZIP_CB_PRE_ADD => 'optional',
                                                   PCLZIP_CB_POST_ADD => 'optional',
                                                   PCLZIP_OPT_NO_COMPRESSION => 'optional',
                                                   PCLZIP_OPT_COMMENT => 'optional'
                                                   //, PCLZIP_OPT_CRYPT => 'optional'
                                             ));
        if ($v_result != 1) {
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
          return 0;
        }
      }

      // ----- Look for 2 args
      // Here we need to support the first historic synopsis of the
      // method.
      else {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");

        // ----- Get the first argument
        $v_options[PCLZIP_OPT_ADD_PATH] = $v_arg_list[0];

        // ----- Look for the optional second argument
        if ($v_size == 2) {
          $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
        }
        else if ($v_size > 2) {
          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
		                       "Invalid number / type of arguments");
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
          return 0;
        }
      }
    }

    // ----- Init
    $v_string_list = array();
    $v_att_list = array();
    $v_filedescr_list = array();
    $p_result_list = array();

    // ----- Look if the $p_filelist is really an array
    if (is_array($p_filelist)) {

      // ----- Look if the first element is also an array
      //       This will mean that this is a file description entry
      if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
        $v_att_list = $p_filelist;
      }

      // ----- The list is a list of string names
      else {
        $v_string_list = $p_filelist;
      }
    }

    // ----- Look if the $p_filelist is a string
    else if (is_string($p_filelist)) {
      // ----- Create a list from the string
      $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist);
    }

    // ----- Invalid variable type for $p_filelist
    else {
      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_filelist");
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
      return 0;
    }

    // ----- Reformat the string list
    if (sizeof($v_string_list) != 0) {
      foreach ($v_string_list as $v_string) {
        if ($v_string != '') {
          $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
        }
        else {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Ignore an empty filename");
        }
      }
    }

    // ----- For each file in the list check the attributes
    $v_supported_attributes
    = array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
             ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'
             ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'
						);
    foreach ($v_att_list as $v_entry) {
      $v_result = $this->privFileDescrParseAtt($v_entry,
                                               $v_filedescr_list[],
                                               $v_options,
                                               $v_supported_attributes);
      if ($v_result != 1) {
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
        return 0;
      }
    }

    // ----- Expand the filelist (expand directories)
    $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);
    if ($v_result != 1) {
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
      return 0;
    }

    // ----- Call the create fct
    $v_result = $this->privCreate($v_filedescr_list, $p_result_list, $v_options);
    if ($v_result != 1) {
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
      return 0;
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_result_list);
    return $p_result_list;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function :
  //   add($p_filelist, $p_add_dir="", $p_remove_dir="")
  //   add($p_filelist, $p_option, $p_option_value, ...)
  // Description :
  //   This method supports two synopsis. The first one is historical.
  //   This methods add the list of files in an existing archive.
  //   If a file with the same name already exists, it is added at the end of the
  //   archive, the first one is still present.
  //   If the archive does not exist, it is created.
  // Parameters :
  //   $p_filelist : An array containing file or directory names, or
  //                 a string containing one filename or one directory name, or
  //                 a string containing a list of filenames and/or directory
  //                 names separated by spaces.
  //   $p_add_dir : A path to add before the real path of the archived file,
  //                in order to have it memorized in the archive.
  //   $p_remove_dir : A path to remove from the real path of the file to archive,
  //                   in order to have a shorter path memorized in the archive.
  //                   When $p_add_dir and $p_remove_dir are set, $p_remove_dir
  //                   is removed first, before $p_add_dir is added.
  // Options :
  //   PCLZIP_OPT_ADD_PATH :
  //   PCLZIP_OPT_REMOVE_PATH :
  //   PCLZIP_OPT_REMOVE_ALL_PATH :
  //   PCLZIP_OPT_COMMENT :
  //   PCLZIP_OPT_ADD_COMMENT :
  //   PCLZIP_OPT_PREPEND_COMMENT :
  //   PCLZIP_CB_PRE_ADD :
  //   PCLZIP_CB_POST_ADD :
  // Return Values :
  //   0 on failure,
  //   The list of the added files, with a status of the add action.
  //   (see PclZip::listContent() for list entry format)
  // --------------------------------------------------------------------------------
  function add($p_filelist)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::add', "filelist='$p_filelist', ...");
    $v_result=1;

    // ----- Reset the error handler
    $this->privErrorReset();

    // ----- Set default values
    $v_options = array();
    $v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE;

    // ----- Look for variable options arguments
    $v_size = func_num_args();
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");

    // ----- Look for arguments
    if ($v_size > 1) {
      // ----- Get the arguments
      $v_arg_list = func_get_args();

      // ----- Remove form the options list the first argument
      array_shift($v_arg_list);
      $v_size--;

      // ----- Look for first arg
      if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options detected");

        // ----- Parse the options
        $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
                                            array (PCLZIP_OPT_REMOVE_PATH => 'optional',
                                                   PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
                                                   PCLZIP_OPT_ADD_PATH => 'optional',
                                                   PCLZIP_CB_PRE_ADD => 'optional',
                                                   PCLZIP_CB_POST_ADD => 'optional',
                                                   PCLZIP_OPT_NO_COMPRESSION => 'optional',
                                                   PCLZIP_OPT_COMMENT => 'optional',
                                                   PCLZIP_OPT_ADD_COMMENT => 'optional',
                                                   PCLZIP_OPT_PREPEND_COMMENT => 'optional'
                                                   //, PCLZIP_OPT_CRYPT => 'optional'
												   ));
        if ($v_result != 1) {
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
          return 0;
        }
      }

      // ----- Look for 2 args
      // Here we need to support the first historic synopsis of the
      // method.
      else {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");

        // ----- Get the first argument
        $v_options[PCLZIP_OPT_ADD_PATH] = $v_add_path = $v_arg_list[0];

        // ----- Look for the optional second argument
        if ($v_size == 2) {
          $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
        }
        else if ($v_size > 2) {
          // ----- Error log
          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");

          // ----- Return
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
          return 0;
        }
      }
    }

    // ----- Init
    $v_string_list = array();
    $v_att_list = array();
    $v_filedescr_list = array();
    $p_result_list = array();

    // ----- Look if the $p_filelist is really an array
    if (is_array($p_filelist)) {

      // ----- Look if the first element is also an array
      //       This will mean that this is a file description entry
      if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
        $v_att_list = $p_filelist;
      }

      // ----- The list is a list of string names
      else {
        $v_string_list = $p_filelist;
      }
    }

    // ----- Look if the $p_filelist is a string
    else if (is_string($p_filelist)) {
      // ----- Create a list from the string
      $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist);
    }

    // ----- Invalid variable type for $p_filelist
    else {
      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type '".gettype($p_filelist)."' for p_filelist");
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
      return 0;
    }

    // ----- Reformat the string list
    if (sizeof($v_string_list) != 0) {
      foreach ($v_string_list as $v_string) {
        $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
      }
    }

    // ----- For each file in the list check the attributes
    $v_supported_attributes
    = array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
             ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'
             ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'
						);
    foreach ($v_att_list as $v_entry) {
      $v_result = $this->privFileDescrParseAtt($v_entry,
                                               $v_filedescr_list[],
                                               $v_options,
                                               $v_supported_attributes);
      if ($v_result != 1) {
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
        return 0;
      }
    }

    // ----- Expand the filelist (expand directories)
    $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);
    if ($v_result != 1) {
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
      return 0;
    }

    // ----- Call the create fct
    $v_result = $this->privAdd($v_filedescr_list, $p_result_list, $v_options);
    if ($v_result != 1) {
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
      return 0;
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_result_list);
    return $p_result_list;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : listContent()
  // Description :
  //   This public method, gives the list of the files and directories, with their
  //   properties.
  //   The properties of each entries in the list are (used also in other functions) :
  //     filename : Name of the file. For a create or add action it is the filename
  //                given by the user. For an extract function it is the filename
  //                of the extracted file.
  //     stored_filename : Name of the file / directory stored in the archive.
  //     size : Size of the stored file.
  //     compressed_size : Size of the file's data compressed in the archive
  //                       (without the headers overhead)
  //     mtime : Last known modification date of the file (UNIX timestamp)
  //     comment : Comment associated with the file
  //     folder : true | false
  //     index : index of the file in the archive
  //     status : status of the action (depending of the action) :
  //              Values are :
  //                ok : OK !
  //                filtered : the file / dir is not extracted (filtered by user)
  //                already_a_directory : the file can not be extracted because a
  //                                      directory with the same name already exists
  //                write_protected : the file can not be extracted because a file
  //                                  with the same name already exists and is
  //                                  write protected
  //                newer_exist : the file was not extracted because a newer file exists
  //                path_creation_fail : the file is not extracted because the folder
  //                                     does not exists and can not be created
  //                write_error : the file was not extracted because there was a
  //                              error while writing the file
  //                read_error : the file was not extracted because there was a error
  //                             while reading the file
  //                invalid_header : the file was not extracted because of an archive
  //                                 format error (bad file header)
  //   Note that each time a method can continue operating when there
  //   is an action error on a file, the error is only logged in the file status.
  // Return Values :
  //   0 on an unrecoverable failure,
  //   The list of the files in the archive.
  // --------------------------------------------------------------------------------
  function listContent()
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::listContent', "");
    $v_result=1;

    // ----- Reset the error handler
    $this->privErrorReset();

    // ----- Check archive
    if (!$this->privCheckFormat()) {
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
      return(0);
    }

    // ----- Call the extracting fct
    $p_list = array();
    if (($v_result = $this->privList($p_list)) != 1)
    {
      unset($p_list);
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
      return(0);
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);
    return $p_list;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function :
  //   extract($p_path="./", $p_remove_path="")
  //   extract([$p_option, $p_option_value, ...])
  // Description :
  //   This method supports two synopsis. The first one is historical.
  //   This method extract all the files / directories from the archive to the
  //   folder indicated in $p_path.
  //   If you want to ignore the 'root' part of path of the memorized files
  //   you can indicate this in the optional $p_remove_path parameter.
  //   By default, if a newer file with the same name already exists, the
  //   file is not extracted.
  //
  //   If both PCLZIP_OPT_PATH and PCLZIP_OPT_ADD_PATH aoptions
  //   are used, the path indicated in PCLZIP_OPT_ADD_PATH is append
  //   at the end of the path value of PCLZIP_OPT_PATH.
  // Parameters :
  //   $p_path : Path where the files and directories are to be extracted
  //   $p_remove_path : First part ('root' part) of the memorized path
  //                    (if any similar) to remove while extracting.
  // Options :
  //   PCLZIP_OPT_PATH :
  //   PCLZIP_OPT_ADD_PATH :
  //   PCLZIP_OPT_REMOVE_PATH :
  //   PCLZIP_OPT_REMOVE_ALL_PATH :
  //   PCLZIP_CB_PRE_EXTRACT :
  //   PCLZIP_CB_POST_EXTRACT :
  // Return Values :
  //   0 or a negative value on failure,
  //   The list of the extracted files, with a status of the action.
  //   (see PclZip::listContent() for list entry format)
  // --------------------------------------------------------------------------------
  function extract()
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::extract", "");
    $v_result=1;

    // ----- Reset the error handler
    $this->privErrorReset();

    // ----- Check archive
    if (!$this->privCheckFormat()) {
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
      return(0);
    }

    // ----- Set default values
    $v_options = array();
//    $v_path = "./";
    $v_path = '';
    $v_remove_path = "";
    $v_remove_all_path = false;

    // ----- Look for variable options arguments
    $v_size = func_num_args();
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");

    // ----- Default values for option
    $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;

    // ----- Look for arguments
    if ($v_size > 0) {
      // ----- Get the arguments
      $v_arg_list = func_get_args();

      // ----- Look for first arg
      if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options");

        // ----- Parse the options
        $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
                                            array (PCLZIP_OPT_PATH => 'optional',
                                                   PCLZIP_OPT_REMOVE_PATH => 'optional',
                                                   PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
                                                   PCLZIP_OPT_ADD_PATH => 'optional',
                                                   PCLZIP_CB_PRE_EXTRACT => 'optional',
                                                   PCLZIP_CB_POST_EXTRACT => 'optional',
                                                   PCLZIP_OPT_SET_CHMOD => 'optional',
                                                   PCLZIP_OPT_BY_NAME => 'optional',
                                                   PCLZIP_OPT_BY_EREG => 'optional',
                                                   PCLZIP_OPT_BY_PREG => 'optional',
                                                   PCLZIP_OPT_BY_INDEX => 'optional',
                                                   PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',
                                                   PCLZIP_OPT_EXTRACT_IN_OUTPUT => 'optional',
                                                   PCLZIP_OPT_REPLACE_NEWER => 'optional'
                                                   ,PCLZIP_OPT_STOP_ON_ERROR => 'optional'
                                                   ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional'
												    ));
        if ($v_result != 1) {
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
          return 0;
        }

        // ----- Set the arguments
        if (isset($v_options[PCLZIP_OPT_PATH])) {
          $v_path = $v_options[PCLZIP_OPT_PATH];
        }
        if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {
          $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];
        }
        if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
          $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];
        }
        if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
          // ----- Check for '/' in last path char
          if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) {
            $v_path .= '/';
          }
          $v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
        }
      }

      // ----- Look for 2 args
      // Here we need to support the first historic synopsis of the
      // method.
      else {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");

        // ----- Get the first argument
        $v_path = $v_arg_list[0];

        // ----- Look for the optional second argument
        if ($v_size == 2) {
          $v_remove_path = $v_arg_list[1];
        }
        else if ($v_size > 2) {
          // ----- Error log
          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");

          // ----- Return
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
          return 0;
        }
      }
    }

    // ----- Trace
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "path='$v_path', remove_path='$v_remove_path', remove_all_path='".($v_remove_path?'true':'false')."'");

    // ----- Call the extracting fct
    $p_list = array();
    $v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path,
	                                     $v_remove_all_path, $v_options);
    if ($v_result < 1) {
      unset($p_list);
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
      return(0);
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);
    return $p_list;
  }
  // --------------------------------------------------------------------------------


  // --------------------------------------------------------------------------------
  // Function :
  //   extractByIndex($p_index, $p_path="./", $p_remove_path="")
  //   extractByIndex($p_index, [$p_option, $p_option_value, ...])
  // Description :
  //   This method supports two synopsis. The first one is historical.
  //   This method is doing a partial extract of the archive.
  //   The extracted files or folders are identified by their index in the
  //   archive (from 0 to n).
  //   Note that if the index identify a folder, only the folder entry is
  //   extracted, not all the files included in the archive.
  // Parameters :
  //   $p_index : A single index (integer) or a string of indexes of files to
  //              extract. The form of the string is "0,4-6,8-12" with only numbers
  //              and '-' for range or ',' to separate ranges. No spaces or ';'
  //              are allowed.
  //   $p_path : Path where the files and directories are to be extracted
  //   $p_remove_path : First part ('root' part) of the memorized path
  //                    (if any similar) to remove while extracting.
  // Options :
  //   PCLZIP_OPT_PATH :
  //   PCLZIP_OPT_ADD_PATH :
  //   PCLZIP_OPT_REMOVE_PATH :
  //   PCLZIP_OPT_REMOVE_ALL_PATH :
  //   PCLZIP_OPT_EXTRACT_AS_STRING : The files are extracted as strings and
  //     not as files.
  //     The resulting content is in a new field 'content' in the file
  //     structure.
  //     This option must be used alone (any other options are ignored).
  //   PCLZIP_CB_PRE_EXTRACT :
  //   PCLZIP_CB_POST_EXTRACT :
  // Return Values :
  //   0 on failure,
  //   The list of the extracted files, with a status of the action.
  //   (see PclZip::listContent() for list entry format)
  // --------------------------------------------------------------------------------
  //function extractByIndex($p_index, options...)
  function extractByIndex($p_index)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::extractByIndex", "index='$p_index', ...");
    $v_result=1;

    // ----- Reset the error handler
    $this->privErrorReset();

    // ----- Check archive
    if (!$this->privCheckFormat()) {
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
      return(0);
    }

    // ----- Set default values
    $v_options = array();
//    $v_path = "./";
    $v_path = '';
    $v_remove_path = "";
    $v_remove_all_path = false;

    // ----- Look for variable options arguments
    $v_size = func_num_args();
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");

    // ----- Default values for option
    $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;

    // ----- Look for arguments
    if ($v_size > 1) {
      // ----- Get the arguments
      $v_arg_list = func_get_args();

      // ----- Remove form the options list the first argument
      array_shift($v_arg_list);
      $v_size--;

      // ----- Look for first arg
      if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options");

        // ----- Parse the options
        $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
                                            array (PCLZIP_OPT_PATH => 'optional',
                                                   PCLZIP_OPT_REMOVE_PATH => 'optional',
                                                   PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
                                                   PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',
                                                   PCLZIP_OPT_ADD_PATH => 'optional',
                                                   PCLZIP_CB_PRE_EXTRACT => 'optional',
                                                   PCLZIP_CB_POST_EXTRACT => 'optional',
                                                   PCLZIP_OPT_SET_CHMOD => 'optional',
                                                   PCLZIP_OPT_REPLACE_NEWER => 'optional'
                                                   ,PCLZIP_OPT_STOP_ON_ERROR => 'optional'
                                                   ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional'
												   ));
        if ($v_result != 1) {
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
          return 0;
        }

        // ----- Set the arguments
        if (isset($v_options[PCLZIP_OPT_PATH])) {
          $v_path = $v_options[PCLZIP_OPT_PATH];
        }
        if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {
          $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];
        }
        if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
          $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];
        }
        if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
          // ----- Check for '/' in last path char
          if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) {
            $v_path .= '/';
          }
          $v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
        }
        if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) {
          $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Option PCLZIP_OPT_EXTRACT_AS_STRING not set.");
        }
        else {
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Option PCLZIP_OPT_EXTRACT_AS_STRING set.");
        }
      }

      // ----- Look for 2 args
      // Here we need to support the first historic synopsis of the
      // method.
      else {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");

        // ----- Get the first argument
        $v_path = $v_arg_list[0];

        // ----- Look for the optional second argument
        if ($v_size == 2) {
          $v_remove_path = $v_arg_list[1];
        }
        else if ($v_size > 2) {
          // ----- Error log
          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");

          // ----- Return
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
          return 0;
        }
      }
    }

    // ----- Trace
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "index='$p_index', path='$v_path', remove_path='$v_remove_path', remove_all_path='".($v_remove_path?'true':'false')."'");

    // ----- Trick
    // Here I want to reuse extractByRule(), so I need to parse the $p_index
    // with privParseOptions()
    $v_arg_trick = array (PCLZIP_OPT_BY_INDEX, $p_index);
    $v_options_trick = array();
    $v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick,
                                        array (PCLZIP_OPT_BY_INDEX => 'optional' ));
    if ($v_result != 1) {
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
        return 0;
    }
    $v_options[PCLZIP_OPT_BY_INDEX] = $v_options_trick[PCLZIP_OPT_BY_INDEX];

    // ----- Call the extracting fct
    if (($v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options)) < 1) {
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
        return(0);
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);
    return $p_list;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function :
  //   delete([$p_option, $p_option_value, ...])
  // Description :
  //   This method removes files from the archive.
  //   If no parameters are given, then all the archive is emptied.
  // Parameters :
  //   None or optional arguments.
  // Options :
  //   PCLZIP_OPT_BY_INDEX :
  //   PCLZIP_OPT_BY_NAME :
  //   PCLZIP_OPT_BY_EREG :
  //   PCLZIP_OPT_BY_PREG :
  // Return Values :
  //   0 on failure,
  //   The list of the files which are still present in the archive.
  //   (see PclZip::listContent() for list entry format)
  // --------------------------------------------------------------------------------
  function delete()
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::delete", "");
    $v_result=1;

    // ----- Reset the error handler
    $this->privErrorReset();

    // ----- Check archive
    if (!$this->privCheckFormat()) {
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
      return(0);
    }

    // ----- Set default values
    $v_options = array();

    // ----- Look for variable options arguments
    $v_size = func_num_args();
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");

    // ----- Look for arguments
    if ($v_size > 0) {
      // ----- Get the arguments
      $v_arg_list = func_get_args();

      // ----- Parse the options
      $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
                                        array (PCLZIP_OPT_BY_NAME => 'optional',
                                               PCLZIP_OPT_BY_EREG => 'optional',
                                               PCLZIP_OPT_BY_PREG => 'optional',
                                               PCLZIP_OPT_BY_INDEX => 'optional' ));
      if ($v_result != 1) {
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
          return 0;
      }
    }

    // ----- Magic quotes trick
    $this->privDisableMagicQuotes();

    // ----- Call the delete fct
    $v_list = array();
    if (($v_result = $this->privDeleteByRule($v_list, $v_options)) != 1) {
      $this->privSwapBackMagicQuotes();
      unset($v_list);
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
      return(0);
    }

    // ----- Magic quotes trick
    $this->privSwapBackMagicQuotes();

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_list);
    return $v_list;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : deleteByIndex()
  // Description :
  //   ***** Deprecated *****
  //   delete(PCLZIP_OPT_BY_INDEX, $p_index) should be prefered.
  // --------------------------------------------------------------------------------
  function deleteByIndex($p_index)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::deleteByIndex", "index='$p_index'");

    $p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index);

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);
    return $p_list;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : properties()
  // Description :
  //   This method gives the properties of the archive.
  //   The properties are :
  //     nb : Number of files in the archive
  //     comment : Comment associated with the archive file
  //     status : not_exist, ok
  // Parameters :
  //   None
  // Return Values :
  //   0 on failure,
  //   An array with the archive properties.
  // --------------------------------------------------------------------------------
  function properties()
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::properties", "");

    // ----- Reset the error handler
    $this->privErrorReset();

    // ----- Magic quotes trick
    $this->privDisableMagicQuotes();

    // ----- Check archive
    if (!$this->privCheckFormat()) {
      $this->privSwapBackMagicQuotes();
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
      return(0);
    }

    // ----- Default properties
    $v_prop = array();
    $v_prop['comment'] = '';
    $v_prop['nb'] = 0;
    $v_prop['status'] = 'not_exist';

    // ----- Look if file exists
    if (@is_file($this->zipname))
    {
      // ----- Open the zip file
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
      if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
      {
        $this->privSwapBackMagicQuotes();

        // ----- Error log
        PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');

        // ----- Return
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), 0);
        return 0;
      }

      // ----- Read the central directory informations
      $v_central_dir = array();
      if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
      {
        $this->privSwapBackMagicQuotes();
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
        return 0;
      }

      // ----- Close the zip file
      $this->privCloseFd();

      // ----- Set the user attributes
      $v_prop['comment'] = $v_central_dir['comment'];
      $v_prop['nb'] = $v_central_dir['entries'];
      $v_prop['status'] = 'ok';
    }

    // ----- Magic quotes trick
    $this->privSwapBackMagicQuotes();

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_prop);
    return $v_prop;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : duplicate()
  // Description :
  //   This method creates an archive by copying the content of an other one. If
  //   the archive already exist, it is replaced by the new one without any warning.
  // Parameters :
  //   $p_archive : The filename of a valid archive, or
  //                a valid PclZip object.
  // Return Values :
  //   1 on success.
  //   0 or a negative value on error (error code).
  // --------------------------------------------------------------------------------
  function duplicate($p_archive)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::duplicate", "");
    $v_result = 1;

    // ----- Reset the error handler
    $this->privErrorReset();

    // ----- Look if the $p_archive is a PclZip object
    if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip'))
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The parameter is valid PclZip object '".$p_archive->zipname."'");

      // ----- Duplicate the archive
      $v_result = $this->privDuplicate($p_archive->zipname);
    }

    // ----- Look if the $p_archive is a string (so a filename)
    else if (is_string($p_archive))
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The parameter is a filename '$p_archive'");

      // ----- Check that $p_archive is a valid zip file
      // TBC : Should also check the archive format
      if (!is_file($p_archive)) {
        // ----- Error log
        PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "No file with filename '".$p_archive."'");
        $v_result = PCLZIP_ERR_MISSING_FILE;
      }
      else {
        // ----- Duplicate the archive
        $v_result = $this->privDuplicate($p_archive);
      }
    }

    // ----- Invalid variable
    else
    {
      // ----- Error log
      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add");
      $v_result = PCLZIP_ERR_INVALID_PARAMETER;
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : merge()
  // Description :
  //   This method merge the $p_archive_to_add archive at the end of the current
  //   one ($this).
  //   If the archive ($this) does not exist, the merge becomes a duplicate.
  //   If the $p_archive_to_add archive does not exist, the merge is a success.
  // Parameters :
  //   $p_archive_to_add : It can be directly the filename of a valid zip archive,
  //                       or a PclZip object archive.
  // Return Values :
  //   1 on success,
  //   0 or negative values on error (see below).
  // --------------------------------------------------------------------------------
  function merge($p_archive_to_add)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::merge", "");
    $v_result = 1;

    // ----- Reset the error handler
    $this->privErrorReset();

    // ----- Check archive
    if (!$this->privCheckFormat()) {
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
      return(0);
    }

    // ----- Look if the $p_archive_to_add is a PclZip object
    if ((is_object($p_archive_to_add)) && (get_class($p_archive_to_add) == 'pclzip'))
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The parameter is valid PclZip object");

      // ----- Merge the archive
      $v_result = $this->privMerge($p_archive_to_add);
    }

    // ----- Look if the $p_archive_to_add is a string (so a filename)
    else if (is_string($p_archive_to_add))
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The parameter is a filename");

      // ----- Create a temporary archive
      $v_object_archive = new PclZip($p_archive_to_add);

      // ----- Merge the archive
      $v_result = $this->privMerge($v_object_archive);
    }

    // ----- Invalid variable
    else
    {
      // ----- Error log
      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add");
      $v_result = PCLZIP_ERR_INVALID_PARAMETER;
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------



  // --------------------------------------------------------------------------------
  // Function : errorCode()
  // Description :
  // Parameters :
  // --------------------------------------------------------------------------------
  function errorCode()
  {
    if (PCLZIP_ERROR_EXTERNAL == 1) {
      return(PclErrorCode());
    }
    else {
      return($this->error_code);
    }
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : errorName()
  // Description :
  // Parameters :
  // --------------------------------------------------------------------------------
  function errorName($p_with_code=false)
  {
    $v_name = array ( PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR',
                      PCLZIP_ERR_WRITE_OPEN_FAIL => 'PCLZIP_ERR_WRITE_OPEN_FAIL',
                      PCLZIP_ERR_READ_OPEN_FAIL => 'PCLZIP_ERR_READ_OPEN_FAIL',
                      PCLZIP_ERR_INVALID_PARAMETER => 'PCLZIP_ERR_INVALID_PARAMETER',
                      PCLZIP_ERR_MISSING_FILE => 'PCLZIP_ERR_MISSING_FILE',
                      PCLZIP_ERR_FILENAME_TOO_LONG => 'PCLZIP_ERR_FILENAME_TOO_LONG',
                      PCLZIP_ERR_INVALID_ZIP => 'PCLZIP_ERR_INVALID_ZIP',
                      PCLZIP_ERR_BAD_EXTRACTED_FILE => 'PCLZIP_ERR_BAD_EXTRACTED_FILE',
                      PCLZIP_ERR_DIR_CREATE_FAIL => 'PCLZIP_ERR_DIR_CREATE_FAIL',
                      PCLZIP_ERR_BAD_EXTENSION => 'PCLZIP_ERR_BAD_EXTENSION',
                      PCLZIP_ERR_BAD_FORMAT => 'PCLZIP_ERR_BAD_FORMAT',
                      PCLZIP_ERR_DELETE_FILE_FAIL => 'PCLZIP_ERR_DELETE_FILE_FAIL',
                      PCLZIP_ERR_RENAME_FILE_FAIL => 'PCLZIP_ERR_RENAME_FILE_FAIL',
                      PCLZIP_ERR_BAD_CHECKSUM => 'PCLZIP_ERR_BAD_CHECKSUM',
                      PCLZIP_ERR_INVALID_ARCHIVE_ZIP => 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP',
                      PCLZIP_ERR_MISSING_OPTION_VALUE => 'PCLZIP_ERR_MISSING_OPTION_VALUE',
                      PCLZIP_ERR_INVALID_OPTION_VALUE => 'PCLZIP_ERR_INVALID_OPTION_VALUE',
                      PCLZIP_ERR_UNSUPPORTED_COMPRESSION => 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION',
                      PCLZIP_ERR_UNSUPPORTED_ENCRYPTION => 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION'
                      ,PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE => 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE'
                      ,PCLZIP_ERR_DIRECTORY_RESTRICTION => 'PCLZIP_ERR_DIRECTORY_RESTRICTION'
                    );

    if (isset($v_name[$this->error_code])) {
      $v_value = $v_name[$this->error_code];
    }
    else {
      $v_value = 'NoName';
    }

    if ($p_with_code) {
      return($v_value.' ('.$this->error_code.')');
    }
    else {
      return($v_value);
    }
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : errorInfo()
  // Description :
  // Parameters :
  // --------------------------------------------------------------------------------
  function errorInfo($p_full=false)
  {
    if (PCLZIP_ERROR_EXTERNAL == 1) {
      return(PclErrorString());
    }
    else {
      if ($p_full) {
        return($this->errorName(true)." : ".$this->error_string);
      }
      else {
        return($this->error_string." [code ".$this->error_code."]");
      }
    }
  }
  // --------------------------------------------------------------------------------


// --------------------------------------------------------------------------------
// ***** UNDER THIS LINE ARE DEFINED PRIVATE INTERNAL FUNCTIONS *****
// *****                                                        *****
// *****       THESES FUNCTIONS MUST NOT BE USED DIRECTLY       *****
// --------------------------------------------------------------------------------



  // --------------------------------------------------------------------------------
  // Function : privCheckFormat()
  // Description :
  //   This method check that the archive exists and is a valid zip archive.
  //   Several level of check exists. (futur)
  // Parameters :
  //   $p_level : Level of check. Default 0.
  //              0 : Check the first bytes (magic codes) (default value))
  //              1 : 0 + Check the central directory (futur)
  //              2 : 1 + Check each file header (futur)
  // Return Values :
  //   true on success,
  //   false on error, the error code is set.
  // --------------------------------------------------------------------------------
  function privCheckFormat($p_level=0)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCheckFormat", "");
    $v_result = true;

	// ----- Reset the file system cache
    clearstatcache();

    // ----- Reset the error handler
    $this->privErrorReset();

    // ----- Look if the file exits
    if (!is_file($this->zipname)) {
      // ----- Error log
      PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "Missing archive file '".$this->zipname."'");
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, false, PclZip::errorInfo());
      return(false);
    }

    // ----- Check that the file is readeable
    if (!is_readable($this->zipname)) {
      // ----- Error log
      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to read archive '".$this->zipname."'");
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, false, PclZip::errorInfo());
      return(false);
    }

    // ----- Check the magic code
    // TBC

    // ----- Check the central header
    // TBC

    // ----- Check each file header
    // TBC

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privParseOptions()
  // Description :
  //   This internal methods reads the variable list of arguments ($p_options_list,
  //   $p_size) and generate an array with the options and values ($v_result_list).
  //   $v_requested_options contains the options that can be present and those that
  //   must be present.
  //   $v_requested_options is an array, with the option value as key, and 'optional',
  //   or 'mandatory' as value.
  // Parameters :
  //   See above.
  // Return Values :
  //   1 on success.
  //   0 on failure.
  // --------------------------------------------------------------------------------
  function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options=false)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privParseOptions", "");
    $v_result=1;

    // ----- Read the options
    $i=0;
    while ($i<$p_size) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Looking for table index $i, option = '".PclZipUtilOptionText($p_options_list[$i])."(".$p_options_list[$i].")'");

      // ----- Check if the option is supported
      if (!isset($v_requested_options[$p_options_list[$i]])) {
        // ----- Error log
        PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional parameter '".$p_options_list[$i]."' for this method");

        // ----- Return
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
        return PclZip::errorCode();
      }

      // ----- Look for next option
      switch ($p_options_list[$i]) {
        // ----- Look for options that request a path value
        case PCLZIP_OPT_PATH :
        case PCLZIP_OPT_REMOVE_PATH :
        case PCLZIP_OPT_ADD_PATH :
          // ----- Check the number of parameters
          if (($i+1) >= $p_size) {
            // ----- Error log
            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
            return PclZip::errorCode();
          }

          // ----- Get the value
          $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], false);
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
          $i++;
        break;

        case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION :
          // ----- Check the number of parameters
          if (($i+1) >= $p_size) {
            // ----- Error log
            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
            return PclZip::errorCode();
          }

          // ----- Get the value
          if (   is_string($p_options_list[$i+1])
              && ($p_options_list[$i+1] != '')) {
            $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], false);
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
            $i++;
          }
          else {
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." set with an empty value is ignored.");
          }
        break;

        // ----- Look for options that request an array of string for value
        case PCLZIP_OPT_BY_NAME :
          // ----- Check the number of parameters
          if (($i+1) >= $p_size) {
            // ----- Error log
            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
            return PclZip::errorCode();
          }

          // ----- Get the value
          if (is_string($p_options_list[$i+1])) {
              $v_result_list[$p_options_list[$i]][0] = $p_options_list[$i+1];
          }
          else if (is_array($p_options_list[$i+1])) {
              $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
          }
          else {
            // ----- Error log
            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
            return PclZip::errorCode();
          }
          ////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
          $i++;
        break;

        // ----- Look for options that request an EREG or PREG expression
        case PCLZIP_OPT_BY_EREG :
        case PCLZIP_OPT_BY_PREG :
        //case PCLZIP_OPT_CRYPT :
          // ----- Check the number of parameters
          if (($i+1) >= $p_size) {
            // ----- Error log
            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
            return PclZip::errorCode();
          }

          // ----- Get the value
          if (is_string($p_options_list[$i+1])) {
              $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
          }
          else {
            // ----- Error log
            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
            return PclZip::errorCode();
          }
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
          $i++;
        break;

        // ----- Look for options that takes a string
        case PCLZIP_OPT_COMMENT :
        case PCLZIP_OPT_ADD_COMMENT :
        case PCLZIP_OPT_PREPEND_COMMENT :
          // ----- Check the number of parameters
          if (($i+1) >= $p_size) {
            // ----- Error log
            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE,
			                     "Missing parameter value for option '"
								 .PclZipUtilOptionText($p_options_list[$i])
								 ."'");

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
            return PclZip::errorCode();
          }

          // ----- Get the value
          if (is_string($p_options_list[$i+1])) {
              $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
          }
          else {
            // ----- Error log
            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE,
			                     "Wrong parameter value for option '"
								 .PclZipUtilOptionText($p_options_list[$i])
								 ."'");

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
            return PclZip::errorCode();
          }
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
          $i++;
        break;

        // ----- Look for options that request an array of index
        case PCLZIP_OPT_BY_INDEX :
          // ----- Check the number of parameters
          if (($i+1) >= $p_size) {
            // ----- Error log
            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
            return PclZip::errorCode();
          }

          // ----- Get the value
          $v_work_list = array();
          if (is_string($p_options_list[$i+1])) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Index value is a string '".$p_options_list[$i+1]."'");

              // ----- Remove spaces
              $p_options_list[$i+1] = strtr($p_options_list[$i+1], ' ', '');

              // ----- Parse items
              $v_work_list = explode(",", $p_options_list[$i+1]);
          }
          else if (is_integer($p_options_list[$i+1])) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Index value is an integer '".$p_options_list[$i+1]."'");
              $v_work_list[0] = $p_options_list[$i+1].'-'.$p_options_list[$i+1];
          }
          else if (is_array($p_options_list[$i+1])) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Index value is an array");
              $v_work_list = $p_options_list[$i+1];
          }
          else {
            // ----- Error log
            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Value must be integer, string or array for option '".PclZipUtilOptionText($p_options_list[$i])."'");

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
            return PclZip::errorCode();
          }

          // ----- Reduce the index list
          // each index item in the list must be a couple with a start and
          // an end value : [0,3], [5-5], [8-10], ...
          // ----- Check the format of each item
          $v_sort_flag=false;
          $v_sort_value=0;
          for ($j=0; $j<sizeof($v_work_list); $j++) {
              // ----- Explode the item
              $v_item_list = explode("-", $v_work_list[$j]);
              $v_size_item_list = sizeof($v_item_list);

              // ----- TBC : Here we might check that each item is a
              // real integer ...

              // ----- Look for single value
              if ($v_size_item_list == 1) {
                  // ----- Set the option value
                  $v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0];
                  $v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[0];
              }
              elseif ($v_size_item_list == 2) {
                  // ----- Set the option value
                  $v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0];
                  $v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[1];
              }
              else {
                  // ----- Error log
                  PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Too many values in index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");

                  // ----- Return
                  //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
                  return PclZip::errorCode();
              }

              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extracted index item = [".$v_result_list[$p_options_list[$i]][$j]['start'].",".$v_result_list[$p_options_list[$i]][$j]['end']."]");

              // ----- Look for list sort
              if ($v_result_list[$p_options_list[$i]][$j]['start'] < $v_sort_value) {
                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The list should be sorted ...");
                  $v_sort_flag=true;

                  // ----- TBC : An automatic sort should be writen ...
                  // ----- Error log
                  PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Invalid order of index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");

                  // ----- Return
                  //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
                  return PclZip::errorCode();
              }
              $v_sort_value = $v_result_list[$p_options_list[$i]][$j]['start'];
          }

          // ----- Sort the items
          if ($v_sort_flag) {
              // TBC : To Be Completed
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "List sorting is not yet write ...");
          }

          // ----- Next option
          $i++;
        break;

        // ----- Look for options that request no value
        case PCLZIP_OPT_REMOVE_ALL_PATH :
        case PCLZIP_OPT_EXTRACT_AS_STRING :
        case PCLZIP_OPT_NO_COMPRESSION :
        case PCLZIP_OPT_EXTRACT_IN_OUTPUT :
        case PCLZIP_OPT_REPLACE_NEWER :
        case PCLZIP_OPT_STOP_ON_ERROR :
          $v_result_list[$p_options_list[$i]] = true;
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
        break;

        // ----- Look for options that request an octal value
        case PCLZIP_OPT_SET_CHMOD :
          // ----- Check the number of parameters
          if (($i+1) >= $p_size) {
            // ----- Error log
            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
            return PclZip::errorCode();
          }

          // ----- Get the value
          $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
          $i++;
        break;

        // ----- Look for options that request a call-back
        case PCLZIP_CB_PRE_EXTRACT :
        case PCLZIP_CB_POST_EXTRACT :
        case PCLZIP_CB_PRE_ADD :
        case PCLZIP_CB_POST_ADD :
        /* for futur use
        case PCLZIP_CB_PRE_DELETE :
        case PCLZIP_CB_POST_DELETE :
        case PCLZIP_CB_PRE_LIST :
        case PCLZIP_CB_POST_LIST :
        */
          // ----- Check the number of parameters
          if (($i+1) >= $p_size) {
            // ----- Error log
            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
            return PclZip::errorCode();
          }

          // ----- Get the value
          $v_function_name = $p_options_list[$i+1];
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "call-back ".PclZipUtilOptionText($p_options_list[$i])." = '".$v_function_name."'");

          // ----- Check that the value is a valid existing function
          if (!function_exists($v_function_name)) {
            // ----- Error log
            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Function '".$v_function_name."()' is not an existing function for option '".PclZipUtilOptionText($p_options_list[$i])."'");

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
            return PclZip::errorCode();
          }

          // ----- Set the attribute
          $v_result_list[$p_options_list[$i]] = $v_function_name;
          $i++;
        break;

        default :
          // ----- Error log
          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
		                       "Unknown parameter '"
							   .$p_options_list[$i]."'");

          // ----- Return
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
          return PclZip::errorCode();
      }

      // ----- Next options
      $i++;
    }

    // ----- Look for mandatory options
    if ($v_requested_options !== false) {
      for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {
        // ----- Look for mandatory option
        if ($v_requested_options[$key] == 'mandatory') {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Detect a mandatory option : ".PclZipUtilOptionText($key)."(".$key.")");
          // ----- Look if present
          if (!isset($v_result_list[$key])) {
            // ----- Error log
            PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
            return PclZip::errorCode();
          }
        }
      }
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privFileDescrParseAtt()
  // Description :
  // Parameters :
  // Return Values :
  //   1 on success.
  //   0 on failure.
  // --------------------------------------------------------------------------------
  function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options=false)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrParseAtt", "");
    $v_result=1;

    // ----- For each file in the list check the attributes
    foreach ($p_file_list as $v_key => $v_value) {

      // ----- Check if the option is supported
      if (!isset($v_requested_options[$v_key])) {
        // ----- Error log
        PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file attribute '".$v_key."' for this file");

        // ----- Return
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
        return PclZip::errorCode();
      }

      // ----- Look for attribute
      switch ($v_key) {
        case PCLZIP_ATT_FILE_NAME :
          if (!is_string($v_value)) {
            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
            return PclZip::errorCode();
          }

          $p_filedescr['filename'] = PclZipUtilPathReduction($v_value);
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");

          if ($p_filedescr['filename'] == '') {
            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'");
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
            return PclZip::errorCode();
          }

        break;

        case PCLZIP_ATT_FILE_NEW_SHORT_NAME :
          if (!is_string($v_value)) {
            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
            return PclZip::errorCode();
          }

          $p_filedescr['new_short_name'] = PclZipUtilPathReduction($v_value);
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");

          if ($p_filedescr['new_short_name'] == '') {
            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty short filename for attribute '".PclZipUtilOptionText($v_key)."'");
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
            return PclZip::errorCode();
          }
        break;

        case PCLZIP_ATT_FILE_NEW_FULL_NAME :
          if (!is_string($v_value)) {
            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
            return PclZip::errorCode();
          }

          $p_filedescr['new_full_name'] = PclZipUtilPathReduction($v_value);
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");

          if ($p_filedescr['new_full_name'] == '') {
            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty full filename for attribute '".PclZipUtilOptionText($v_key)."'");
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
            return PclZip::errorCode();
          }
        break;

        default :
          // ----- Error log
          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
		                           "Unknown parameter '".$v_key."'");

          // ----- Return
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
          return PclZip::errorCode();
      }

      // ----- Look for mandatory options
      if ($v_requested_options !== false) {
        for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {
          // ----- Look for mandatory option
          if ($v_requested_options[$key] == 'mandatory') {
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Detect a mandatory option : ".PclZipUtilOptionText($key)."(".$key.")");
            // ----- Look if present
            if (!isset($p_file_list[$key])) {
              PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");
              //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
              return PclZip::errorCode();
            }
          }
        }
      }

    // end foreach
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privFileDescrExpand()
  // Description :
  // Parameters :
  // Return Values :
  //   1 on success.
  //   0 on failure.
  // --------------------------------------------------------------------------------
  function privFileDescrExpand(&$p_filedescr_list, &$p_options)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrExpand", "");
    $v_result=1;

    // ----- Create a result list
    $v_result_list = array();

    // ----- Look each entry
    for ($i=0; $i<sizeof($p_filedescr_list); $i++) {
      // ----- Get filedescr
      $v_descr = $p_filedescr_list[$i];

      // ----- Reduce the filename
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr before reduction :'".$v_descr['filename']."'");
      $v_descr['filename'] = PclZipUtilTranslateWinPath($v_descr['filename']);
      $v_descr['filename'] = PclZipUtilPathReduction($v_descr['filename']);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr after reduction :'".$v_descr['filename']."'");

      // ----- Get type of descr
      if (!file_exists($v_descr['filename'])) {
        // ----- Error log
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v_descr['filename']."' does not exists");
        PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$v_descr['filename']."' does not exists");

        // ----- Return
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
        return PclZip::errorCode();
      }
      if (@is_file($v_descr['filename'])) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "This is a file");
        $v_descr['type'] = 'file';
      }
      else if (@is_dir($v_descr['filename'])) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "This is a folder");
        $v_descr['type'] = 'folder';
      }
      else if (@is_link($v_descr['filename'])) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Unsupported file type : link");
        // skip
        continue;
      }
      else {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Unsupported file type : unknown type");
        // skip
        continue;
      }

      // ----- Calculate the stored filename
      $this->privCalculateStoredFilename($v_descr, $p_options);

      // ----- Add the descriptor in result list
      $v_result_list[sizeof($v_result_list)] = $v_descr;

      // ----- Look for folder
      if ($v_descr['type'] == 'folder') {
        // ----- List of items in folder
        $v_dirlist_descr = array();
        $v_dirlist_nb = 0;
        if ($v_folder_handler = @opendir($v_descr['filename'])) {
          while (($v_item_handler = @readdir($v_folder_handler)) !== false) {
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for '".$v_item_handler."' in the directory");

            // ----- Skip '.' and '..'
            if (($v_item_handler == '.') || ($v_item_handler == '..')) {
                continue;
            }

            // ----- Compose the full filename
            $v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'].'/'.$v_item_handler;

            // ----- Look for different stored filename
            // Because the name of the folder was changed, the name of the
            // files/sub-folders also change
            if ($v_descr['stored_filename'] != $v_descr['filename']) {
              $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'].'/'.$v_item_handler;
            }

            $v_dirlist_nb++;
          }
        }
        else {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to open dir '".$v_descr['filename']."' in read mode. Skipped.");
          // TBC : unable to open folder in read mode
        }

        // ----- Expand each element of the list
        if ($v_dirlist_nb != 0) {
          // ----- Expand
          if (($v_result = $this->privFileDescrExpand($v_dirlist_descr, $p_options)) != 1) {
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
            return $v_result;
          }

          // ----- Concat the resulting list
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Merging result list (size '".sizeof($v_result_list)."') with dirlist (size '".sizeof($v_dirlist_descr)."')");
          $v_result_list = array_merge($v_result_list, $v_dirlist_descr);
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "merged result list is size '".sizeof($v_result_list)."'");
        }
        else {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Nothing in this folder to expand.");
        }

        // ----- Free local array
        unset($v_dirlist_descr);
      }
    }

    // ----- Get the result list
    $p_filedescr_list = $v_result_list;

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privCreate()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privCreate($p_filedescr_list, &$p_result_list, &$p_options)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCreate", "list");
    $v_result=1;
    $v_list_detail = array();

    // ----- Magic quotes trick
    $this->privDisableMagicQuotes();

    // ----- Open the file in write mode
    if (($v_result = $this->privOpenFd('wb')) != 1)
    {
      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
    }

    // ----- Add the list of files
    $v_result = $this->privAddList($p_filedescr_list, $p_result_list, $p_options);

    // ----- Close
    $this->privCloseFd();

    // ----- Magic quotes trick
    $this->privSwapBackMagicQuotes();

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privAdd()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privAdd($p_filedescr_list, &$p_result_list, &$p_options)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAdd", "list");
    $v_result=1;
    $v_list_detail = array();

    // ----- Look if the archive exists or is empty
    if ((!is_file($this->zipname)) || (filesize($this->zipname) == 0))
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive does not exist, or is empty, create it.");

      // ----- Do a create
      $v_result = $this->privCreate($p_filedescr_list, $p_result_list, $p_options);

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
    }
    // ----- Magic quotes trick
    $this->privDisableMagicQuotes();

    // ----- Open the zip file
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
    if (($v_result=$this->privOpenFd('rb')) != 1)
    {
      // ----- Magic quotes trick
      $this->privSwapBackMagicQuotes();

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
    }

    // ----- Read the central directory informations
    $v_central_dir = array();
    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
    {
      $this->privCloseFd();
      $this->privSwapBackMagicQuotes();
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
    }

    // ----- Go to beginning of File
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");
    @rewind($this->zip_fd);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");

    // ----- Creates a temporay file
    $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';

    // ----- Open the temporary file in write mode
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
    if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)
    {
      $this->privCloseFd();
      $this->privSwapBackMagicQuotes();

      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode');

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
      return PclZip::errorCode();
    }

    // ----- Copy the files from the archive to the temporary file
    // TBC : Here I should better append the file and go back to erase the central dir
    $v_size = $v_central_dir['offset'];
    while ($v_size != 0)
    {
      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
      $v_buffer = fread($this->zip_fd, $v_read_size);
      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
      $v_size -= $v_read_size;
    }

    // ----- Swap the file descriptor
    // Here is a trick : I swap the temporary fd with the zip fd, in order to use
    // the following methods on the temporary fil and not the real archive
    $v_swap = $this->zip_fd;
    $this->zip_fd = $v_zip_temp_fd;
    $v_zip_temp_fd = $v_swap;

    // ----- Add the files
    $v_header_list = array();
    if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1)
    {
      fclose($v_zip_temp_fd);
      $this->privCloseFd();
      @unlink($v_zip_temp_name);
      $this->privSwapBackMagicQuotes();

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
    }

    // ----- Store the offset of the central dir
    $v_offset = @ftell($this->zip_fd);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "New offset of central dir : $v_offset");

    // ----- Copy the block of file headers from the old archive
    $v_size = $v_central_dir['size'];
    while ($v_size != 0)
    {
      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
      $v_buffer = @fread($v_zip_temp_fd, $v_read_size);
      @fwrite($this->zip_fd, $v_buffer, $v_read_size);
      $v_size -= $v_read_size;
    }

    // ----- Create the Central Dir files header
    for ($i=0, $v_count=0; $i<sizeof($v_header_list); $i++)
    {
      // ----- Create the file header
      if ($v_header_list[$i]['status'] == 'ok') {
        if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
          fclose($v_zip_temp_fd);
          $this->privCloseFd();
          @unlink($v_zip_temp_name);
          $this->privSwapBackMagicQuotes();

          // ----- Return
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
          return $v_result;
        }
        $v_count++;
      }

      // ----- Transform the header to a 'usable' info
      $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
    }

    // ----- Zip file comment
    $v_comment = $v_central_dir['comment'];
    if (isset($p_options[PCLZIP_OPT_COMMENT])) {
      $v_comment = $p_options[PCLZIP_OPT_COMMENT];
    }
    if (isset($p_options[PCLZIP_OPT_ADD_COMMENT])) {
      $v_comment = $v_comment.$p_options[PCLZIP_OPT_ADD_COMMENT];
    }
    if (isset($p_options[PCLZIP_OPT_PREPEND_COMMENT])) {
      $v_comment = $p_options[PCLZIP_OPT_PREPEND_COMMENT].$v_comment;
    }

    // ----- Calculate the size of the central header
    $v_size = @ftell($this->zip_fd)-$v_offset;

    // ----- Create the central dir footer
    if (($v_result = $this->privWriteCentralHeader($v_count+$v_central_dir['entries'], $v_size, $v_offset, $v_comment)) != 1)
    {
      // ----- Reset the file list
      unset($v_header_list);
      $this->privSwapBackMagicQuotes();

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
    }

    // ----- Swap back the file descriptor
    $v_swap = $this->zip_fd;
    $this->zip_fd = $v_zip_temp_fd;
    $v_zip_temp_fd = $v_swap;

    // ----- Close
    $this->privCloseFd();

    // ----- Close the temporary file
    @fclose($v_zip_temp_fd);

    // ----- Magic quotes trick
    $this->privSwapBackMagicQuotes();

    // ----- Delete the zip file
    // TBC : I should test the result ...
    @unlink($this->zipname);

    // ----- Rename the temporary file
    // TBC : I should test the result ...
    //@rename($v_zip_temp_name, $this->zipname);
    PclZipUtilRename($v_zip_temp_name, $this->zipname);

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privOpenFd()
  // Description :
  // Parameters :
  // --------------------------------------------------------------------------------
  function privOpenFd($p_mode)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privOpenFd", 'mode='.$p_mode);
    $v_result=1;

    // ----- Look if already open
    if ($this->zip_fd != 0)
    {
      // ----- Error log
      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Zip file \''.$this->zipname.'\' already open');

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
      return PclZip::errorCode();
    }

    // ----- Open the zip file
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Open file in '.$p_mode.' mode');
    if (($this->zip_fd = @fopen($this->zipname, $p_mode)) == 0)
    {
      // ----- Error log
      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in '.$p_mode.' mode');

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
      return PclZip::errorCode();
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privCloseFd()
  // Description :
  // Parameters :
  // --------------------------------------------------------------------------------
  function privCloseFd()
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCloseFd", "");
    $v_result=1;

    if ($this->zip_fd != 0)
      @fclose($this->zip_fd);
    $this->zip_fd = 0;

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privAddList()
  // Description :
  //   $p_add_dir and $p_remove_dir will give the ability to memorize a path which is
  //   different from the real path of the file. This is usefull if you want to have PclTar
  //   running in any directory, and memorize relative path from an other directory.
  // Parameters :
  //   $p_list : An array containing the file or directory names to add in the tar
  //   $p_result_list : list of added files with their properties (specially the status field)
  //   $p_add_dir : Path to add in the filename path archived
  //   $p_remove_dir : Path to remove in the filename path archived
  // Return Values :
  // --------------------------------------------------------------------------------
//  function privAddList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options)
  function privAddList($p_filedescr_list, &$p_result_list, &$p_options)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddList", "list");
    $v_result=1;

    // ----- Add the files
    $v_header_list = array();
    if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1)
    {
      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
    }

    // ----- Store the offset of the central dir
    $v_offset = @ftell($this->zip_fd);

    // ----- Create the Central Dir files header
    for ($i=0,$v_count=0; $i<sizeof($v_header_list); $i++)
    {
      // ----- Create the file header
      if ($v_header_list[$i]['status'] == 'ok') {
        if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
          // ----- Return
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
          return $v_result;
        }
        $v_count++;
      }

      // ----- Transform the header to a 'usable' info
      $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
    }

    // ----- Zip file comment
    $v_comment = '';
    if (isset($p_options[PCLZIP_OPT_COMMENT])) {
      $v_comment = $p_options[PCLZIP_OPT_COMMENT];
    }

    // ----- Calculate the size of the central header
    $v_size = @ftell($this->zip_fd)-$v_offset;

    // ----- Create the central dir footer
    if (($v_result = $this->privWriteCentralHeader($v_count, $v_size, $v_offset, $v_comment)) != 1)
    {
      // ----- Reset the file list
      unset($v_header_list);

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privAddFileList()
  // Description :
  // Parameters :
  //   $p_filedescr_list : An array containing the file description
  //                      or directory names to add in the zip
  //   $p_result_list : list of added files with their properties (specially the status field)
  // Return Values :
  // --------------------------------------------------------------------------------
  function privAddFileList($p_filedescr_list, &$p_result_list, &$p_options)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFileList", "filedescr_list");
    $v_result=1;
    $v_header = array();

    // ----- Recuperate the current number of elt in list
    $v_nb = sizeof($p_result_list);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Before add, list have ".$v_nb." elements");

    // ----- Loop on the files
    for ($j=0; ($j<sizeof($p_filedescr_list)) && ($v_result==1); $j++) {
      // ----- Format the filename
      $p_filedescr_list[$j]['filename']
      = PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false);

      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for file '".$p_filedescr_list[$j]['filename']."'");

      // ----- Skip empty file names
      // TBC : Can this be possible ? not checked in DescrParseAtt ?
      if ($p_filedescr_list[$j]['filename'] == "") {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Skip empty filename");
        continue;
      }

      // ----- Check the filename
      if (!file_exists($p_filedescr_list[$j]['filename'])) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$p_filedescr_list[$j]['filename']."' does not exists");
        PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$p_filedescr_list[$j]['filename']."' does not exists");
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
        return PclZip::errorCode();
      }

      // ----- Look if it is a file or a dir with no all path remove option
      if (   (is_file($p_filedescr_list[$j]['filename']))
          || (   is_dir($p_filedescr_list[$j]['filename'])
              && (   !isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])
                  || !$p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) {

        // ----- Add the file
        $v_result = $this->privAddFile($p_filedescr_list[$j], $v_header,
                                       $p_options);
        if ($v_result != 1) {
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
          return $v_result;
        }

        // ----- Store the file infos
        $p_result_list[$v_nb++] = $v_header;
      }
    }
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "After add, list have ".$v_nb." elements");

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privAddFile()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privAddFile($p_filedescr, &$p_header, &$p_options)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFile", "filename='".$p_filedescr['filename']."'");
    $v_result=1;

    // ----- Working variable
    $p_filename = $p_filedescr['filename'];

    // TBC : Already done in the fileAtt check ... ?
    if ($p_filename == "") {
      // ----- Error log
      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file list parameter (invalid or empty list)");

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
      return PclZip::errorCode();
    }

    // ----- Look for a stored different filename
    if (isset($p_filedescr['stored_filename'])) {
      $v_stored_filename = $p_filedescr['stored_filename'];
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'Stored filename is NOT the same "'.$v_stored_filename.'"');
    }
    else {
      $v_stored_filename = $p_filedescr['stored_filename'];
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'Stored filename is the same');
    }

    // ----- Set the file properties
    clearstatcache();
    $p_header['version'] = 20;
    $p_header['version_extracted'] = 10;
    $p_header['flag'] = 0;
    $p_header['compression'] = 0;
    $p_header['mtime'] = filemtime($p_filename);
    $p_header['crc'] = 0;
    $p_header['compressed_size'] = 0;
    $p_header['size'] = filesize($p_filename);
    $p_header['filename_len'] = strlen($p_filename);
    $p_header['extra_len'] = 0;
    $p_header['comment_len'] = 0;
    $p_header['disk'] = 0;
    $p_header['internal'] = 0;
//    $p_header['external'] = (is_file($p_filename)?0xFE49FFE0:0x41FF0010);
    $p_header['external'] = (is_file($p_filename)?0x00000000:0x00000010);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header external extension '".sprintf("0x%X",$p_header['external'])."'");
    $p_header['offset'] = 0;
    $p_header['filename'] = $p_filename;
    $p_header['stored_filename'] = $v_stored_filename;
    $p_header['extra'] = '';
    $p_header['comment'] = '';
    $p_header['status'] = 'ok';
    $p_header['index'] = -1;

    // ----- Look for pre-add callback
    if (isset($p_options[PCLZIP_CB_PRE_ADD])) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$p_options[PCLZIP_CB_PRE_ADD]."()') is defined for the extraction");

      // ----- Generate a local information
      $v_local_header = array();
      $this->privConvertHeader2FileInfo($p_header, $v_local_header);

      // ----- Call the callback
      // Here I do not use call_user_func() because I need to send a reference to the
      // header.
      eval('$v_result = '.$p_options[PCLZIP_CB_PRE_ADD].'(PCLZIP_CB_PRE_ADD, $v_local_header);');
      if ($v_result == 0) {
        // ----- Change the file status
        $p_header['status'] = "skipped";
        $v_result = 1;
      }

      // ----- Update the informations
      // Only some fields can be modified
      if ($p_header['stored_filename'] != $v_local_header['stored_filename']) {
        $p_header['stored_filename'] = PclZipUtilPathReduction($v_local_header['stored_filename']);
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "New stored filename is '".$p_header['stored_filename']."'");
      }
    }

    // ----- Look for empty stored filename
    if ($p_header['stored_filename'] == "") {
      $p_header['status'] = "filtered";
    }

    // ----- Check the path length
    if (strlen($p_header['stored_filename']) > 0xFF) {
      $p_header['status'] = 'filename_too_long';
    }

    // ----- Look if no error, or file not skipped
    if ($p_header['status'] == 'ok') {

      // ----- Look for a file
      if (is_file($p_filename))
      {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$p_filename."' is a file");
        // ----- Open the source file
        if (($v_file = @fopen($p_filename, "rb")) == 0) {
          PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
          return PclZip::errorCode();
        }

        if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be compressed");
          // ----- Read the file content
          $v_content_compressed = @fread($v_file, $p_header['size']);

          // ----- Calculate the CRC
          $p_header['crc'] = @crc32($v_content_compressed);

          // ----- Set header parameters
          $p_header['compressed_size'] = $p_header['size'];
          $p_header['compression'] = 0;
        }
        else {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will be compressed");
          // ----- Read the file content
          $v_content = @fread($v_file, $p_header['size']);

          // ----- Calculate the CRC
          $p_header['crc'] = @crc32($v_content);

          // ----- Compress the file
          $v_content_compressed = @gzdeflate($v_content);

          // ----- Set header parameters
          $p_header['compressed_size'] = strlen($v_content_compressed);
          $p_header['compression'] = 8;
        }

        // ----- Look for encryption
        /*
        if ((isset($p_options[PCLZIP_OPT_CRYPT]))
		    && ($p_options[PCLZIP_OPT_CRYPT] != "")) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File need to be crypted ....");

          // Should be a random header
          $v_header = 'xxxxxxxxxxxx';
	      $v_content_compressed = PclZipUtilZipEncrypt($v_content_compressed,
		                                           $p_header['compressed_size'],
	                                               $v_header,
												   $p_header['crc'],
												   "test");

          $p_header['compressed_size'] += 12;
          $p_header['flag'] = 1;

          // ----- Add the header to the data
          $v_content_compressed = $v_header.$v_content_compressed;
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Size after header : ".strlen($v_content_compressed)."");
        }
        */

        // ----- Call the header generation
        if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
          @fclose($v_file);
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
          return $v_result;
        }

        // ----- Write the compressed (or not) content
        @fwrite($this->zip_fd,
		            $v_content_compressed, $p_header['compressed_size']);

        // ----- Close the file
        @fclose($v_file);
      }

      // ----- Look for a directory
      else {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$p_filename."' is a folder");
        // ----- Look for directory last '/'
        if (@substr($p_header['stored_filename'], -1) != '/') {
          $p_header['stored_filename'] .= '/';
        }

        // ----- Set the file properties
        $p_header['size'] = 0;
        //$p_header['external'] = 0x41FF0010;   // Value for a folder : to be checked
        $p_header['external'] = 0x00000010;   // Value for a folder : to be checked

        // ----- Call the header generation
        if (($v_result = $this->privWriteFileHeader($p_header)) != 1)
        {
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
          return $v_result;
        }
      }
    }

    // ----- Look for post-add callback
    if (isset($p_options[PCLZIP_CB_POST_ADD])) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_ADD]."()') is defined for the extraction");

      // ----- Generate a local information
      $v_local_header = array();
      $this->privConvertHeader2FileInfo($p_header, $v_local_header);

      // ----- Call the callback
      // Here I do not use call_user_func() because I need to send a reference to the
      // header.
      eval('$v_result = '.$p_options[PCLZIP_CB_POST_ADD].'(PCLZIP_CB_POST_ADD, $v_local_header);');
      if ($v_result == 0) {
        // ----- Ignored
        $v_result = 1;
      }

      // ----- Update the informations
      // Nothing can be modified
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privCalculateStoredFilename()
  // Description :
  //   Based on file descriptor properties and global options, this method
  //   calculate the filename that will be stored in the archive.
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privCalculateStoredFilename(&$p_filedescr, &$p_options)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCalculateStoredFilename", "filename='".$p_filedescr['filename']."'");
    $v_result=1;

    // ----- Working variables
    $p_filename = $p_filedescr['filename'];
    if (isset($p_options[PCLZIP_OPT_ADD_PATH])) {
      $p_add_dir = $p_options[PCLZIP_OPT_ADD_PATH];
    }
    else {
      $p_add_dir = '';
    }
    if (isset($p_options[PCLZIP_OPT_REMOVE_PATH])) {
      $p_remove_dir = $p_options[PCLZIP_OPT_REMOVE_PATH];
    }
    else {
      $p_remove_dir = '';
    }
    if (isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
      $p_remove_all_dir = $p_options[PCLZIP_OPT_REMOVE_ALL_PATH];
    }
    else {
      $p_remove_all_dir = 0;
    }

    // ----- Look for full name change
    if (isset($p_filedescr['new_full_name'])) {
      $v_stored_filename = $p_filedescr['new_full_name'];
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Changing full name of '".$p_filename."' for '".$v_stored_filename."'");
    }

    // ----- Look for path and/or short name change
    else {

      // ----- Look for short name change
      if (isset($p_filedescr['new_short_name'])) {
        $v_path_info = pathinfo($p_filename);
        $v_dir = '';
        if ($v_path_info['dirname'] != '') {
          $v_dir = $v_path_info['dirname'].'/';
        }
        $v_stored_filename = $v_dir.$p_filedescr['new_short_name'];
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Changing short name of '".$p_filename."' for '".$v_stored_filename."'");
      }
      else {
        // ----- Calculate the stored filename
        $v_stored_filename = $p_filename;
      }

      // ----- Look for all path to remove
      if ($p_remove_all_dir) {
        $v_stored_filename = basename($p_filename);
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Remove all path selected change '".$p_filename."' for '".$v_stored_filename."'");
      }
      // ----- Look for partial path remove
      else if ($p_remove_dir != "") {
        if (substr($p_remove_dir, -1) != '/')
          $p_remove_dir .= "/";

        if (   (substr($p_filename, 0, 2) == "./")
            || (substr($p_remove_dir, 0, 2) == "./")) {

          if (   (substr($p_filename, 0, 2) == "./")
              && (substr($p_remove_dir, 0, 2) != "./")) {
            $p_remove_dir = "./".$p_remove_dir;
          }
          if (   (substr($p_filename, 0, 2) != "./")
              && (substr($p_remove_dir, 0, 2) == "./")) {
            $p_remove_dir = substr($p_remove_dir, 2);
          }
        }

        $v_compare = PclZipUtilPathInclusion($p_remove_dir,
                                             $v_stored_filename);
        if ($v_compare > 0) {
          if ($v_compare == 2) {
            $v_stored_filename = "";
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Path to remove is the current folder");
          }
          else {
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Remove path '$p_remove_dir' in file '$v_stored_filename'");
            $v_stored_filename = substr($v_stored_filename,
                                        strlen($p_remove_dir));
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Result is '$v_stored_filename'");
          }
        }
      }
      // ----- Look for path to add
      if ($p_add_dir != "") {
        if (substr($p_add_dir, -1) == "/")
          $v_stored_filename = $p_add_dir.$v_stored_filename;
        else
          $v_stored_filename = $p_add_dir."/".$v_stored_filename;
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Add path '$p_add_dir' in file '$p_filename' = '$v_stored_filename'");
      }
    }

    // ----- Filename (reduce the path of stored name)
    $v_stored_filename = PclZipUtilPathReduction($v_stored_filename);
    $p_filedescr['stored_filename'] = $v_stored_filename;
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Stored filename will be '".$p_filedescr['stored_filename']."', strlen ".strlen($p_filedescr['stored_filename']));

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privWriteFileHeader()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privWriteFileHeader(&$p_header)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privWriteFileHeader", 'file="'.$p_header['filename'].'", stored as "'.$p_header['stored_filename'].'"');
    $v_result=1;

    // ----- Store the offset position of the file
    $p_header['offset'] = ftell($this->zip_fd);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'File offset of the header :'.$p_header['offset']);

    // ----- Transform UNIX mtime to DOS format mdate/mtime
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
    $v_date = getdate($p_header['mtime']);
    $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
    $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];

    // ----- Packed data
    $v_binary_data = pack("VvvvvvVVVvv", 0x04034b50,
	                      $p_header['version_extracted'], $p_header['flag'],
                          $p_header['compression'], $v_mtime, $v_mdate,
                          $p_header['crc'], $p_header['compressed_size'],
						  $p_header['size'],
                          strlen($p_header['stored_filename']),
						  $p_header['extra_len']);

    // ----- Write the first 148 bytes of the header in the archive
    fputs($this->zip_fd, $v_binary_data, 30);

    // ----- Write the variable fields
    if (strlen($p_header['stored_filename']) != 0)
    {
      fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename']));
    }
    if ($p_header['extra_len'] != 0)
    {
      fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']);
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privWriteCentralFileHeader()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privWriteCentralFileHeader(&$p_header)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privWriteCentralFileHeader", 'file="'.$p_header['filename'].'", stored as "'.$p_header['stored_filename'].'"');
    $v_result=1;

    // TBC
    //for(reset($p_header); $key = key($p_header); next($p_header)) {
    //  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "header[$key] = ".$p_header[$key]);
    //}

    // ----- Transform UNIX mtime to DOS format mdate/mtime
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
    $v_date = getdate($p_header['mtime']);
    $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
    $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];

    // ----- Packed data
    $v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50,
	                      $p_header['version'], $p_header['version_extracted'],
                          $p_header['flag'], $p_header['compression'],
						  $v_mtime, $v_mdate, $p_header['crc'],
                          $p_header['compressed_size'], $p_header['size'],
                          strlen($p_header['stored_filename']),
						  $p_header['extra_len'], $p_header['comment_len'],
                          $p_header['disk'], $p_header['internal'],
						  $p_header['external'], $p_header['offset']);

    // ----- Write the 42 bytes of the header in the zip file
    fputs($this->zip_fd, $v_binary_data, 46);

    // ----- Write the variable fields
    if (strlen($p_header['stored_filename']) != 0)
    {
      fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename']));
    }
    if ($p_header['extra_len'] != 0)
    {
      fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']);
    }
    if ($p_header['comment_len'] != 0)
    {
      fputs($this->zip_fd, $p_header['comment'], $p_header['comment_len']);
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privWriteCentralHeader()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privWriteCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privWriteCentralHeader", 'nb_entries='.$p_nb_entries.', size='.$p_size.', offset='.$p_offset.', comment="'.$p_comment.'"');
    $v_result=1;

    // ----- Packed data
    $v_binary_data = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries,
	                      $p_nb_entries, $p_size,
						  $p_offset, strlen($p_comment));

    // ----- Write the 22 bytes of the header in the zip file
    fputs($this->zip_fd, $v_binary_data, 22);

    // ----- Write the variable fields
    if (strlen($p_comment) != 0)
    {
      fputs($this->zip_fd, $p_comment, strlen($p_comment));
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privList()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privList(&$p_list)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privList", "list");
    $v_result=1;

    // ----- Magic quotes trick
    $this->privDisableMagicQuotes();

    // ----- Open the zip file
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
    if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
    {
      // ----- Magic quotes trick
      $this->privSwapBackMagicQuotes();

      // ----- Error log
      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
      return PclZip::errorCode();
    }

    // ----- Read the central directory informations
    $v_central_dir = array();
    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
    {
      $this->privSwapBackMagicQuotes();
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
    }

    // ----- Go to beginning of Central Dir
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Offset : ".$v_central_dir['offset']."'");
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position in file : ".ftell($this->zip_fd)."'");
    @rewind($this->zip_fd);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position in file : ".ftell($this->zip_fd)."'");
    if (@fseek($this->zip_fd, $v_central_dir['offset']))
    {
      $this->privSwapBackMagicQuotes();

      // ----- Error log
      PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
      return PclZip::errorCode();
    }
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position in file : ".ftell($this->zip_fd)."'");

    // ----- Read each entry
    for ($i=0; $i<$v_central_dir['entries']; $i++)
    {
      // ----- Read the file header
      if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1)
      {
        $this->privSwapBackMagicQuotes();
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
        return $v_result;
      }
      $v_header['index'] = $i;

      // ----- Get the only interesting attributes
      $this->privConvertHeader2FileInfo($v_header, $p_list[$i]);
      unset($v_header);
    }

    // ----- Close the zip file
    $this->privCloseFd();

    // ----- Magic quotes trick
    $this->privSwapBackMagicQuotes();

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privConvertHeader2FileInfo()
  // Description :
  //   This function takes the file informations from the central directory
  //   entries and extract the interesting parameters that will be given back.
  //   The resulting file infos are set in the array $p_info
  //     $p_info['filename'] : Filename with full path. Given by user (add),
  //                           extracted in the filesystem (extract).
  //     $p_info['stored_filename'] : Stored filename in the archive.
  //     $p_info['size'] = Size of the file.
  //     $p_info['compressed_size'] = Compressed size of the file.
  //     $p_info['mtime'] = Last modification date of the file.
  //     $p_info['comment'] = Comment associated with the file.
  //     $p_info['folder'] = true/false : indicates if the entry is a folder or not.
  //     $p_info['status'] = status of the action on the file.
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privConvertHeader2FileInfo($p_header, &$p_info)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privConvertHeader2FileInfo", "Filename='".$p_header['filename']."'");
    $v_result=1;

    // ----- Get the interesting attributes
    $p_info['filename'] = $p_header['filename'];
    $p_info['stored_filename'] = $p_header['stored_filename'];
    $p_info['size'] = $p_header['size'];
    $p_info['compressed_size'] = $p_header['compressed_size'];
    $p_info['mtime'] = $p_header['mtime'];
    $p_info['comment'] = $p_header['comment'];
    $p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010);
    $p_info['index'] = $p_header['index'];
    $p_info['status'] = $p_header['status'];

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privExtractByRule()
  // Description :
  //   Extract a file or directory depending of rules (by index, by name, ...)
  // Parameters :
  //   $p_file_list : An array where will be placed the properties of each
  //                  extracted file
  //   $p_path : Path to add while writing the extracted files
  //   $p_remove_path : Path to remove (from the file memorized path) while writing the
  //                    extracted files. If the path does not match the file path,
  //                    the file is extracted with its memorized path.
  //                    $p_remove_path does not apply to 'list' mode.
  //                    $p_path and $p_remove_path are commulative.
  // Return Values :
  //   1 on success,0 or less on error (see error code list)
  // --------------------------------------------------------------------------------
  function privExtractByRule(&$p_file_list, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privExtractByRule", "path='$p_path', remove_path='$p_remove_path', remove_all_path='".($p_remove_all_path?'true':'false')."'");
    $v_result=1;

    // ----- Magic quotes trick
    $this->privDisableMagicQuotes();

    // ----- Check the path
    if (   ($p_path == "")
	    || (   (substr($p_path, 0, 1) != "/")
		    && (substr($p_path, 0, 3) != "../")
			&& (substr($p_path,1,2)!=":/")))
      $p_path = "./".$p_path;

    // ----- Reduce the path last (and duplicated) '/'
    if (($p_path != "./") && ($p_path != "/"))
    {
      // ----- Look for the path end '/'
      while (substr($p_path, -1) == "/")
      {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Destination path [$p_path] ends by '/'");
        $p_path = substr($p_path, 0, strlen($p_path)-1);
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Modified to [$p_path]");
      }
    }

    // ----- Look for path to remove format (should end by /)
    if (($p_remove_path != "") && (substr($p_remove_path, -1) != '/'))
    {
      $p_remove_path .= '/';
    }
    $p_remove_path_size = strlen($p_remove_path);

    // ----- Open the zip file
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
    if (($v_result = $this->privOpenFd('rb')) != 1)
    {
      $this->privSwapBackMagicQuotes();
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
    }

    // ----- Read the central directory informations
    $v_central_dir = array();
    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
    {
      // ----- Close the zip file
      $this->privCloseFd();
      $this->privSwapBackMagicQuotes();

      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
    }

    // ----- Start at beginning of Central Dir
    $v_pos_entry = $v_central_dir['offset'];

    // ----- Read each entry
    $j_start = 0;
    for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++)
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Read next file header entry : '$i'");

      // ----- Read next Central dir entry
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Position before rewind : ".ftell($this->zip_fd)."'");
      @rewind($this->zip_fd);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Position after rewind : ".ftell($this->zip_fd)."'");
      if (@fseek($this->zip_fd, $v_pos_entry))
      {
        // ----- Close the zip file
        $this->privCloseFd();
        $this->privSwapBackMagicQuotes();

        // ----- Error log
        PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');

        // ----- Return
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
        return PclZip::errorCode();
      }
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position after fseek : ".ftell($this->zip_fd)."'");

      // ----- Read the file header
      $v_header = array();
      if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1)
      {
        // ----- Close the zip file
        $this->privCloseFd();
        $this->privSwapBackMagicQuotes();

        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
        return $v_result;
      }

      // ----- Store the index
      $v_header['index'] = $i;

      // ----- Store the file position
      $v_pos_entry = ftell($this->zip_fd);

      // ----- Look for the specific extract rules
      $v_extract = false;

      // ----- Look for extract by name rule
      if (   (isset($p_options[PCLZIP_OPT_BY_NAME]))
          && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByName'");

          // ----- Look if the filename is in the list
          for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_extract); $j++) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Compare with file '".$p_options[PCLZIP_OPT_BY_NAME][$j]."'");

              // ----- Look for a directory
              if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The searched item is a directory");

                  // ----- Look if the directory is in the filename path
                  if (   (strlen($v_header['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
                      && (substr($v_header['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
                      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The directory is in the file path");
                      $v_extract = true;
                  }
              }
              // ----- Look for a filename
              elseif ($v_header['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The file is the right one.");
                  $v_extract = true;
              }
          }
      }

      // ----- Look for extract by ereg rule
      else if (   (isset($p_options[PCLZIP_OPT_BY_EREG]))
               && ($p_options[PCLZIP_OPT_BY_EREG] != "")) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract by ereg '".$p_options[PCLZIP_OPT_BY_EREG]."'");

          if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header['stored_filename'])) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
              $v_extract = true;
          }
      }

      // ----- Look for extract by preg rule
      else if (   (isset($p_options[PCLZIP_OPT_BY_PREG]))
               && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByEreg'");

          if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
              $v_extract = true;
          }
      }

      // ----- Look for extract by index rule
      else if (   (isset($p_options[PCLZIP_OPT_BY_INDEX]))
               && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByIndex'");

          // ----- Look if the index is in the list
          for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Look if index '$i' is in [".$p_options[PCLZIP_OPT_BY_INDEX][$j]['start'].",".$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']."]");

              if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Found as part of an index range");
                  $v_extract = true;
              }
              if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Do not look this index range for next loop");
                  $j_start = $j+1;
              }

              if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Index range is greater than index, stop loop");
                  break;
              }
          }
      }

      // ----- Look for no rule, which means extract all the archive
      else {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with no rule (extract all)");
          $v_extract = true;
      }

	  // ----- Check compression method
	  if (   ($v_extract)
	      && (   ($v_header['compression'] != 8)
		      && ($v_header['compression'] != 0))) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unsupported compression method (".$v_header['compression'].")");
          $v_header['status'] = 'unsupported_compression';

          // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
          if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
		      && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");

              $this->privSwapBackMagicQuotes();

              PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION,
			                       "Filename '".$v_header['stored_filename']."' is "
				  	    	  	   ."compressed by an unsupported compression "
				  	    	  	   ."method (".$v_header['compression'].") ");

              //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
              return PclZip::errorCode();
		  }
	  }

	  // ----- Check encrypted files
	  if (($v_extract) && (($v_header['flag'] & 1) == 1)) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unsupported file encryption");
          $v_header['status'] = 'unsupported_encryption';

          // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
          if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
		      && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");

              $this->privSwapBackMagicQuotes();

              PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION,
			                       "Unsupported encryption for "
				  	    	  	   ." filename '".$v_header['stored_filename']
								   ."'");

              //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
              return PclZip::errorCode();
		  }
    }

      // ----- Look for real extraction
      if (($v_extract) && ($v_header['status'] != 'ok')) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "No need for extract");
          $v_result = $this->privConvertHeader2FileInfo($v_header,
		                                        $p_file_list[$v_nb_extracted++]);
          if ($v_result != 1) {
              $this->privCloseFd();
              $this->privSwapBackMagicQuotes();
              //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
              return $v_result;
          }

          $v_extract = false;
      }

      // ----- Look for real extraction
      if ($v_extract)
      {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file '".$v_header['filename']."', index '$i'");

        // ----- Go to the file position
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'");
        @rewind($this->zip_fd);
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'");
        if (@fseek($this->zip_fd, $v_header['offset']))
        {
          // ----- Close the zip file
          $this->privCloseFd();

          $this->privSwapBackMagicQuotes();

          // ----- Error log
          PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');

          // ----- Return
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
          return PclZip::errorCode();
        }
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");

        // ----- Look for extraction as string
        if ($p_options[PCLZIP_OPT_EXTRACT_AS_STRING]) {

          // ----- Extracting the file
          $v_result1 = $this->privExtractFileAsString($v_header, $v_string);
          if ($v_result1 < 1) {
            $this->privCloseFd();
            $this->privSwapBackMagicQuotes();
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result1);
            return $v_result1;
          }

          // ----- Get the only interesting attributes
          if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted])) != 1)
          {
            // ----- Close the zip file
            $this->privCloseFd();
            $this->privSwapBackMagicQuotes();

            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
            return $v_result;
          }

          // ----- Set the file content
          $p_file_list[$v_nb_extracted]['content'] = $v_string;

          // ----- Next extracted file
          $v_nb_extracted++;

          // ----- Look for user callback abort
          if ($v_result1 == 2) {
          	break;
          }
        }
        // ----- Look for extraction in standard output
        elseif (   (isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT]))
		        && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) {
          // ----- Extracting the file in standard output
          $v_result1 = $this->privExtractFileInOutput($v_header, $p_options);
          if ($v_result1 < 1) {
            $this->privCloseFd();
            $this->privSwapBackMagicQuotes();
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result1);
            return $v_result1;
          }

          // ----- Get the only interesting attributes
          if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) {
            $this->privCloseFd();
            $this->privSwapBackMagicQuotes();
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
            return $v_result;
          }

          // ----- Look for user callback abort
          if ($v_result1 == 2) {
          	break;
          }
        }
        // ----- Look for normal extraction
        else {
          // ----- Extracting the file
          $v_result1 = $this->privExtractFile($v_header,
		                                      $p_path, $p_remove_path,
											  $p_remove_all_path,
											  $p_options);
          if ($v_result1 < 1) {
            $this->privCloseFd();
            $this->privSwapBackMagicQuotes();
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result1);
            return $v_result1;
          }

          // ----- Get the only interesting attributes
          if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1)
          {
            // ----- Close the zip file
            $this->privCloseFd();
            $this->privSwapBackMagicQuotes();

            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
            return $v_result;
          }

          // ----- Look for user callback abort
          if ($v_result1 == 2) {
          	break;
          }
        }
      }
    }

    // ----- Close the zip file
    $this->privCloseFd();
    $this->privSwapBackMagicQuotes();

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privExtractFile()
  // Description :
  // Parameters :
  // Return Values :
  //
  // 1 : ... ?
  // PCLZIP_ERR_USER_ABORTED(2) : User ask for extraction stop in callback
  // --------------------------------------------------------------------------------
  function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFile', "path='$p_path', remove_path='$p_remove_path', remove_all_path='".($p_remove_all_path?'true':'false')."'");
    $v_result=1;

    // ----- Read the file header
    if (($v_result = $this->privReadFileHeader($v_header)) != 1)
    {
      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
    }

    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found file '".$v_header['filename']."', size '".$v_header['size']."'");

    // ----- Check that the file header is coherent with $p_entry info
    if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
        // TBC
    }

    // ----- Look for all path to remove
    if ($p_remove_all_path == true) {
        // ----- Look for folder entry that not need to be extracted
        if (($p_entry['external']&0x00000010)==0x00000010) {
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The entry is a folder : need to be filtered");

            $p_entry['status'] = "filtered";

            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
            return $v_result;
        }

        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "All path is removed");
        // ----- Get the basename of the path
        $p_entry['filename'] = basename($p_entry['filename']);
    }

    // ----- Look for path to remove
    else if ($p_remove_path != "")
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Look for some path to remove");
      if (PclZipUtilPathInclusion($p_remove_path, $p_entry['filename']) == 2)
      {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The folder is the same as the removed path '".$p_entry['filename']."'");

        // ----- Change the file status
        $p_entry['status'] = "filtered";

        // ----- Return
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
        return $v_result;
      }

      $p_remove_path_size = strlen($p_remove_path);
      if (substr($p_entry['filename'], 0, $p_remove_path_size) == $p_remove_path)
      {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Found path '$p_remove_path' to remove in file '".$p_entry['filename']."'");

        // ----- Remove the path
        $p_entry['filename'] = substr($p_entry['filename'], $p_remove_path_size);

        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Resulting file is '".$p_entry['filename']."'");
      }
    }

    // ----- Add the path
    if ($p_path != '') {
      $p_entry['filename'] = $p_path."/".$p_entry['filename'];
    }

    // ----- Check a base_dir_restriction
    if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Check the extract directory restriction");
      $v_inclusion
      = PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION],
                                $p_entry['filename']);
      if ($v_inclusion == 0) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_EXTRACT_DIR_RESTRICTION is selected, file is outside restriction");

        PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION,
			                     "Filename '".$p_entry['filename']."' is "
								 ."outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION");

        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
        return PclZip::errorCode();
      }
    }

    // ----- Look for pre-extract callback
    if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$p_options[PCLZIP_CB_PRE_EXTRACT]."()') is defined for the extraction");

      // ----- Generate a local information
      $v_local_header = array();
      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);

      // ----- Call the callback
      // Here I do not use call_user_func() because I need to send a reference to the
      // header.
      eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');
      if ($v_result == 0) {
        // ----- Change the file status
        $p_entry['status'] = "skipped";
        $v_result = 1;
      }

      // ----- Look for abort result
      if ($v_result == 2) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
        // ----- This status is internal and will be changed in 'skipped'
        $p_entry['status'] = "aborted";
      	$v_result = PCLZIP_ERR_USER_ABORTED;
      }

      // ----- Update the informations
      // Only some fields can be modified
      $p_entry['filename'] = $v_local_header['filename'];
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "New filename is '".$p_entry['filename']."'");
    }

    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file (with path) '".$p_entry['filename']."', size '$v_header[size]'");

    // ----- Look if extraction should be done
    if ($p_entry['status'] == 'ok') {

    // ----- Look for specific actions while the file exist
    if (file_exists($p_entry['filename']))
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$p_entry['filename']."' already exists");

      // ----- Look if file is a directory
      if (is_dir($p_entry['filename']))
      {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is a directory");

        // ----- Change the file status
        $p_entry['status'] = "already_a_directory";

        // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
        // For historical reason first PclZip implementation does not stop
        // when this kind of error occurs.
        if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
		    && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");

            PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY,
			                     "Filename '".$p_entry['filename']."' is "
								 ."already used by an existing directory");

            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
            return PclZip::errorCode();
		}
      }
      // ----- Look if file is write protected
      else if (!is_writeable($p_entry['filename']))
      {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is write protected");

        // ----- Change the file status
        $p_entry['status'] = "write_protected";

        // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
        // For historical reason first PclZip implementation does not stop
        // when this kind of error occurs.
        if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
		    && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");

            PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
			                     "Filename '".$p_entry['filename']."' exists "
								 ."and is write protected");

            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
            return PclZip::errorCode();
		}
      }

      // ----- Look if the extracted file is older
      else if (filemtime($p_entry['filename']) > $p_entry['mtime'])
      {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is newer (".date("l dS of F Y h:i:s A", filemtime($p_entry['filename'])).") than the extracted file (".date("l dS of F Y h:i:s A", $p_entry['mtime']).")");
        // ----- Change the file status
        if (   (isset($p_options[PCLZIP_OPT_REPLACE_NEWER]))
		    && ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) {
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_REPLACE_NEWER is selected, file will be replaced");
		}
		else {
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be replaced");
            $p_entry['status'] = "newer_exist";

            // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
            // For historical reason first PclZip implementation does not stop
            // when this kind of error occurs.
            if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
		        && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
                //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");

                PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
			             "Newer version of '".$p_entry['filename']."' exists "
					    ."and option PCLZIP_OPT_REPLACE_NEWER is not selected");

                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
                return PclZip::errorCode();
		    }
		}
      }
      else {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is older than the extrated one - will be replaced by the extracted one (".date("l dS of F Y h:i:s A", filemtime($p_entry['filename'])).") than the extracted file (".date("l dS of F Y h:i:s A", $p_entry['mtime']).")");
      }
    }

    // ----- Check the directory availability and create it if necessary
    else {
      if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/'))
        $v_dir_to_check = $p_entry['filename'];
      else if (!strstr($p_entry['filename'], "/"))
        $v_dir_to_check = "";
      else
        $v_dir_to_check = dirname($p_entry['filename']);

      if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to create path for '".$p_entry['filename']."'");

        // ----- Change the file status
        $p_entry['status'] = "path_creation_fail";

        // ----- Return
        ////--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
        //return $v_result;
        $v_result = 1;
      }
    }
    }

    // ----- Look if extraction should be done
    if ($p_entry['status'] == 'ok') {

      // ----- Do the extraction (if not a folder)
      if (!(($p_entry['external']&0x00000010)==0x00000010))
      {
        // ----- Look for not compressed file
        if ($p_entry['compression'] == 0) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");

		  // ----- Opening destination file
          if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0)
          {
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode");

            // ----- Change the file status
            $p_entry['status'] = "write_error";

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
            return $v_result;
          }

          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Read '".$p_entry['size']."' bytes");

          // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
          $v_size = $p_entry['compressed_size'];
          while ($v_size != 0)
          {
            $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Read $v_read_size bytes");
            $v_buffer = @fread($this->zip_fd, $v_read_size);
            /* Try to speed up the code
            $v_binary_data = pack('a'.$v_read_size, $v_buffer);
            @fwrite($v_dest_file, $v_binary_data, $v_read_size);
            */
            @fwrite($v_dest_file, $v_buffer, $v_read_size);
            $v_size -= $v_read_size;
          }

          // ----- Closing the destination file
          fclose($v_dest_file);

          // ----- Change the file mtime
          touch($p_entry['filename'], $p_entry['mtime']);


        }
        else {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a compressed file (Compression method ".$p_entry['compression'].")");
          // ----- TBC
          // Need to be finished
          if (($p_entry['flag'] & 1) == 1) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File is encrypted");
            /*
              // ----- Read the encryption header
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read 12 encryption header bytes");
              $v_encryption_header = @fread($this->zip_fd, 12);

              // ----- Read the encrypted & compressed file in a buffer
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read '".($p_entry['compressed_size']-12)."' compressed & encrypted bytes");
              $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']-12);

              // ----- Decrypt the buffer
              $this->privDecrypt($v_encryption_header, $v_buffer,
			                     $p_entry['compressed_size']-12, $p_entry['crc']);
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Buffer is '".$v_buffer."'");
              */
          }
          else {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read '".$p_entry['compressed_size']."' compressed bytes");
              // ----- Read the compressed file in a buffer (one shot)
              $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
          }

          // ----- Decompress the file
          $v_file_content = @gzinflate($v_buffer);
          unset($v_buffer);
          if ($v_file_content === FALSE) {
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to inflate compressed file");

            // ----- Change the file status
            // TBC
            $p_entry['status'] = "error";

            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
            return $v_result;
          }

          // ----- Opening destination file
          if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode");

            // ----- Change the file status
            $p_entry['status'] = "write_error";

            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
            return $v_result;
          }

          // ----- Write the uncompressed data
          @fwrite($v_dest_file, $v_file_content, $p_entry['size']);
          unset($v_file_content);

          // ----- Closing the destination file
          @fclose($v_dest_file);

          // ----- Change the file mtime
          @touch($p_entry['filename'], $p_entry['mtime']);
        }

        // ----- Look for chmod option
        if (isset($p_options[PCLZIP_OPT_SET_CHMOD])) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "chmod option activated '".$p_options[PCLZIP_OPT_SET_CHMOD]."'");

          // ----- Change the mode of the file
          @chmod($p_entry['filename'], $p_options[PCLZIP_OPT_SET_CHMOD]);
        }

        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extraction done");
      }
    }

	// ----- Change abort status
	if ($p_entry['status'] == "aborted") {
      $p_entry['status'] = "skipped";
	}

    // ----- Look for post-extract callback
    elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_EXTRACT]."()') is defined for the extraction");

      // ----- Generate a local information
      $v_local_header = array();
      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);

      // ----- Call the callback
      // Here I do not use call_user_func() because I need to send a reference to the
      // header.
      eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);');

      // ----- Look for abort result
      if ($v_result == 2) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
      	$v_result = PCLZIP_ERR_USER_ABORTED;
      }
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privExtractFileInOutput()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privExtractFileInOutput(&$p_entry, &$p_options)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFileInOutput', "");
    $v_result=1;

    // ----- Read the file header
    if (($v_result = $this->privReadFileHeader($v_header)) != 1) {
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
    }

    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found file '".$v_header['filename']."', size '".$v_header['size']."'");

    // ----- Check that the file header is coherent with $p_entry info
    if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
        // TBC
    }

    // ----- Look for pre-extract callback
    if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$p_options[PCLZIP_CB_PRE_EXTRACT]."()') is defined for the extraction");

      // ----- Generate a local information
      $v_local_header = array();
      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);

      // ----- Call the callback
      // Here I do not use call_user_func() because I need to send a reference to the
      // header.
      eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');
      if ($v_result == 0) {
        // ----- Change the file status
        $p_entry['status'] = "skipped";
        $v_result = 1;
      }

      // ----- Look for abort result
      if ($v_result == 2) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
        // ----- This status is internal and will be changed in 'skipped'
        $p_entry['status'] = "aborted";
      	$v_result = PCLZIP_ERR_USER_ABORTED;
      }

      // ----- Update the informations
      // Only some fields can be modified
      $p_entry['filename'] = $v_local_header['filename'];
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "New filename is '".$p_entry['filename']."'");
    }

    // ----- Trace
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file (with path) '".$p_entry['filename']."', size '$v_header[size]'");

    // ----- Look if extraction should be done
    if ($p_entry['status'] == 'ok') {

      // ----- Do the extraction (if not a folder)
      if (!(($p_entry['external']&0x00000010)==0x00000010)) {
        // ----- Look for not compressed file
        if ($p_entry['compressed_size'] == $p_entry['size']) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Reading '".$p_entry['size']."' bytes");

          // ----- Read the file in a buffer (one shot)
          $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);

          // ----- Send the file to the output
          echo $v_buffer;
          unset($v_buffer);
        }
        else {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a compressed file");
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Reading '".$p_entry['size']."' bytes");

          // ----- Read the compressed file in a buffer (one shot)
          $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);

          // ----- Decompress the file
          $v_file_content = gzinflate($v_buffer);
          unset($v_buffer);

          // ----- Send the file to the output
          echo $v_file_content;
          unset($v_file_content);
        }
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extraction done");
      }
    }

	// ----- Change abort status
	if ($p_entry['status'] == "aborted") {
      $p_entry['status'] = "skipped";
	}

    // ----- Look for post-extract callback
    elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_EXTRACT]."()') is defined for the extraction");

      // ----- Generate a local information
      $v_local_header = array();
      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);

      // ----- Call the callback
      // Here I do not use call_user_func() because I need to send a reference to the
      // header.
      eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);');

      // ----- Look for abort result
      if ($v_result == 2) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
      	$v_result = PCLZIP_ERR_USER_ABORTED;
      }
    }

    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privExtractFileAsString()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privExtractFileAsString(&$p_entry, &$p_string)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFileAsString', "p_entry['filename']='".$p_entry['filename']."'");
    $v_result=1;

    // ----- Read the file header
    $v_header = array();
    if (($v_result = $this->privReadFileHeader($v_header)) != 1)
    {
      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
    }

    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found file '".$v_header['filename']."', size '".$v_header['size']."'");

    // ----- Check that the file header is coherent with $p_entry info
    if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
        // TBC
    }

    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file in string (with path) '".$p_entry['filename']."', size '$v_header[size]'");

    // ----- Do the extraction (if not a folder)
    if (!(($p_entry['external']&0x00000010)==0x00000010))
    {
      // ----- Look for not compressed file
//      if ($p_entry['compressed_size'] == $p_entry['size'])
      if ($p_entry['compression'] == 0) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Reading '".$p_entry['size']."' bytes");

        // ----- Reading the file
        $p_string = @fread($this->zip_fd, $p_entry['compressed_size']);
      }
      else {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a compressed file (compression method '".$p_entry['compression']."')");

        // ----- Reading the file
        $v_data = @fread($this->zip_fd, $p_entry['compressed_size']);

        // ----- Decompress the file
        if (($p_string = @gzinflate($v_data)) === FALSE) {
            // TBC
        }
      }

      // ----- Trace
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extraction done");
    }
    else {
        // TBC : error : can not extract a folder in a string
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privReadFileHeader()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privReadFileHeader(&$p_header)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privReadFileHeader", "");
    $v_result=1;

    // ----- Read the 4 bytes signature
    $v_binary_data = @fread($this->zip_fd, 4);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary data is : '".sprintf("%08x", $v_binary_data)."'");
    $v_data = unpack('Vid', $v_binary_data);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary signature is : '".sprintf("0x%08x", $v_data['id'])."'");

    // ----- Check signature
    if ($v_data['id'] != 0x04034b50)
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Invalid File header");

      // ----- Error log
      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
      return PclZip::errorCode();
    }

    // ----- Read the first 42 bytes of the header
    $v_binary_data = fread($this->zip_fd, 26);

    // ----- Look for invalid block size
    if (strlen($v_binary_data) != 26)
    {
      $p_header['filename'] = "";
      $p_header['status'] = "invalid_header";
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Invalid block size : ".strlen($v_binary_data));

      // ----- Error log
      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data));

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
      return PclZip::errorCode();
    }

    // ----- Extract the values
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Header : '".$v_binary_data."'");
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Header (Hex) : '".bin2hex($v_binary_data)."'");
    $v_data = unpack('vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len', $v_binary_data);

    // ----- Get filename
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "File name length : ".$v_data['filename_len']);
    $p_header['filename'] = fread($this->zip_fd, $v_data['filename_len']);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Filename : \''.$p_header['filename'].'\'');

    // ----- Get extra_fields
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extra field length : ".$v_data['extra_len']);
    if ($v_data['extra_len'] != 0) {
      $p_header['extra'] = fread($this->zip_fd, $v_data['extra_len']);
    }
    else {
      $p_header['extra'] = '';
    }
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Extra field : \''.bin2hex($p_header['extra']).'\'');

    // ----- Extract properties
    $p_header['version_extracted'] = $v_data['version'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version need to extract : ('.$p_header['version_extracted'].') \''.($p_header['version_extracted']/10).'.'.($p_header['version_extracted']%10).'\'');
    $p_header['compression'] = $v_data['compression'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compression method : \''.$p_header['compression'].'\'');
    $p_header['size'] = $v_data['size'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size : \''.$p_header['size'].'\'');
    $p_header['compressed_size'] = $v_data['compressed_size'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compressed Size : \''.$p_header['compressed_size'].'\'');
    $p_header['crc'] = $v_data['crc'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'CRC : \''.sprintf("0x%X", $p_header['crc']).'\'');
    $p_header['flag'] = $v_data['flag'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Flag : \''.$p_header['flag'].'\'');
    $p_header['filename_len'] = $v_data['filename_len'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Filename_len : \''.$p_header['filename_len'].'\'');

    // ----- Recuperate date in UNIX format
    $p_header['mdate'] = $v_data['mdate'];
    $p_header['mtime'] = $v_data['mtime'];
    if ($p_header['mdate'] && $p_header['mtime'])
    {
      // ----- Extract time
      $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
      $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
      $v_seconde = ($p_header['mtime'] & 0x001F)*2;

      // ----- Extract date
      $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
      $v_month = ($p_header['mdate'] & 0x01E0) >> 5;
      $v_day = $p_header['mdate'] & 0x001F;

      // ----- Get UNIX date format
      $p_header['mtime'] = mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);

      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
    }
    else
    {
      $p_header['mtime'] = time();
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date is actual : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
    }

    // TBC
    //for(reset($v_data); $key = key($v_data); next($v_data)) {
    //  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Attribut[$key] = ".$v_data[$key]);
    //}

    // ----- Set the stored filename
    $p_header['stored_filename'] = $p_header['filename'];

    // ----- Set the status field
    $p_header['status'] = "ok";

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privReadCentralFileHeader()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privReadCentralFileHeader(&$p_header)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privReadCentralFileHeader", "");
    $v_result=1;

    // ----- Read the 4 bytes signature
    $v_binary_data = @fread($this->zip_fd, 4);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary data is : '".sprintf("%08x", $v_binary_data)."'");
    $v_data = unpack('Vid', $v_binary_data);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary signature is : '".sprintf("0x%08x", $v_data['id'])."'");

    // ----- Check signature
    if ($v_data['id'] != 0x02014b50)
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Invalid Central Dir File signature");

      // ----- Error log
      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
      return PclZip::errorCode();
    }

    // ----- Read the first 42 bytes of the header
    $v_binary_data = fread($this->zip_fd, 42);

    // ----- Look for invalid block size
    if (strlen($v_binary_data) != 42)
    {
      $p_header['filename'] = "";
      $p_header['status'] = "invalid_header";
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Invalid block size : ".strlen($v_binary_data));

      // ----- Error log
      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data));

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
      return PclZip::errorCode();
    }

    // ----- Extract the values
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header : '".$v_binary_data."'");
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header (Hex) : '".bin2hex($v_binary_data)."'");
    $p_header = unpack('vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset', $v_binary_data);

    // ----- Get filename
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "File name length : ".$p_header['filename_len']);
    if ($p_header['filename_len'] != 0)
      $p_header['filename'] = fread($this->zip_fd, $p_header['filename_len']);
    else
      $p_header['filename'] = '';
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Filename : \''.$p_header['filename'].'\'');

    // ----- Get extra
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Extra length : ".$p_header['extra_len']);
    if ($p_header['extra_len'] != 0)
      $p_header['extra'] = fread($this->zip_fd, $p_header['extra_len']);
    else
      $p_header['extra'] = '';
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Extra : \''.$p_header['extra'].'\'');

    // ----- Get comment
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Comment length : ".$p_header['comment_len']);
    if ($p_header['comment_len'] != 0)
      $p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']);
    else
      $p_header['comment'] = '';
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Comment : \''.$p_header['comment'].'\'');

    // ----- Extract properties
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version : \''.($p_header['version']/10).'.'.($p_header['version']%10).'\'');
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version need to extract : \''.($p_header['version_extracted']/10).'.'.($p_header['version_extracted']%10).'\'');
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Size : \''.$p_header['size'].'\'');
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Compressed Size : \''.$p_header['compressed_size'].'\'');
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'CRC : \''.sprintf("0x%X", $p_header['crc']).'\'');
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Flag : \''.$p_header['flag'].'\'');
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Offset : \''.$p_header['offset'].'\'');

    // ----- Recuperate date in UNIX format
    if ($p_header['mdate'] && $p_header['mtime'])
    {
      // ----- Extract time
      $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
      $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
      $v_seconde = ($p_header['mtime'] & 0x001F)*2;

      // ----- Extract date
      $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
      $v_month = ($p_header['mdate'] & 0x01E0) >> 5;
      $v_day = $p_header['mdate'] & 0x001F;

      // ----- Get UNIX date format
      $p_header['mtime'] = mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);

      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
    }
    else
    {
      $p_header['mtime'] = time();
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Date is actual : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
    }

    // ----- Set the stored filename
    $p_header['stored_filename'] = $p_header['filename'];

    // ----- Set default status to ok
    $p_header['status'] = 'ok';

    // ----- Look if it is a directory
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Internal (Hex) : '".sprintf("Ox%04X", $p_header['internal'])."'");
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "External (Hex) : '".sprintf("Ox%04X", $p_header['external'])."' (".(($p_header['external']&0x00000010)==0x00000010?'is a folder':'is a file').')');
    if (substr($p_header['filename'], -1) == '/') {
      //$p_header['external'] = 0x41FF0010;
      $p_header['external'] = 0x00000010;
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Force folder external : \''.sprintf("Ox%04X", $p_header['external']).'\'');
    }

    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Header of filename : \''.$p_header['filename'].'\'');

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privCheckFileHeaders()
  // Description :
  // Parameters :
  // Return Values :
  //   1 on success,
  //   0 on error;
  // --------------------------------------------------------------------------------
  function privCheckFileHeaders(&$p_local_header, &$p_central_header)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCheckFileHeaders", "");
    $v_result=1;

	// ----- Check the static values
	// TBC
	if ($p_local_header['filename'] != $p_central_header['filename']) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "filename" : TBC To Be Completed');
	}
	if ($p_local_header['version_extracted'] != $p_central_header['version_extracted']) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "version_extracted" : TBC To Be Completed');
	}
	if ($p_local_header['flag'] != $p_central_header['flag']) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "flag" : TBC To Be Completed');
	}
	if ($p_local_header['compression'] != $p_central_header['compression']) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "compression" : TBC To Be Completed');
	}
	if ($p_local_header['mtime'] != $p_central_header['mtime']) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "mtime" : TBC To Be Completed');
	}
	if ($p_local_header['filename_len'] != $p_central_header['filename_len']) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "filename_len" : TBC To Be Completed');
	}

	// ----- Look for flag bit 3
	if (($p_local_header['flag'] & 8) == 8) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Purpose bit flag bit 3 set !');
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'File size, compression size and crc found in central header');
        $p_local_header['size'] = $p_central_header['size'];
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size : \''.$p_local_header['size'].'\'');
        $p_local_header['compressed_size'] = $p_central_header['compressed_size'];
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compressed Size : \''.$p_local_header['compressed_size'].'\'');
        $p_local_header['crc'] = $p_central_header['crc'];
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'CRC : \''.sprintf("0x%X", $p_local_header['crc']).'\'');
	}

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privReadEndCentralDir()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privReadEndCentralDir(&$p_central_dir)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privReadEndCentralDir", "");
    $v_result=1;

    // ----- Go to the end of the zip file
    $v_size = filesize($this->zipname);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Size of the file :$v_size");
    @fseek($this->zip_fd, $v_size);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Position at end of zip file : \''.ftell($this->zip_fd).'\'');
    if (@ftell($this->zip_fd) != $v_size)
    {
      // ----- Error log
      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to go to the end of the archive \''.$this->zipname.'\'');

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
      return PclZip::errorCode();
    }

    // ----- First try : look if this is an archive with no commentaries (most of the time)
    // in this case the end of central dir is at 22 bytes of the file end
    $v_found = 0;
    if ($v_size > 26) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Look for central dir with no comment');
      @fseek($this->zip_fd, $v_size-22);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Position after min central position : \''.ftell($this->zip_fd).'\'');
      if (($v_pos = @ftell($this->zip_fd)) != ($v_size-22))
      {
        // ----- Error log
        PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');

        // ----- Return
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
        return PclZip::errorCode();
      }

      // ----- Read for bytes
      $v_binary_data = @fread($this->zip_fd, 4);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Binary data is : '".sprintf("%08x", $v_binary_data)."'");
      $v_data = @unpack('Vid', $v_binary_data);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary signature is : '".sprintf("0x%08x", $v_data['id'])."'");

      // ----- Check signature
      if ($v_data['id'] == 0x06054b50) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found central dir at the default position.");
        $v_found = 1;
      }

      $v_pos = ftell($this->zip_fd);
    }

    // ----- Go back to the maximum possible size of the Central Dir End Record
    if (!$v_found) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Start extended search of end central dir');
      $v_maximum_size = 65557; // 0xFFFF + 22;
      if ($v_maximum_size > $v_size)
        $v_maximum_size = $v_size;
      @fseek($this->zip_fd, $v_size-$v_maximum_size);
      if (@ftell($this->zip_fd) != ($v_size-$v_maximum_size))
      {
        // ----- Error log
        PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');

        // ----- Return
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
        return PclZip::errorCode();
      }
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Position after max central position : \''.ftell($this->zip_fd).'\'');

      // ----- Read byte per byte in order to find the signature
      $v_pos = ftell($this->zip_fd);
      $v_bytes = 0x00000000;
      while ($v_pos < $v_size)
      {
        // ----- Read a byte
        $v_byte = @fread($this->zip_fd, 1);

        // -----  Add the byte
        // Note we mask the old value down such that once shifted we can never end up with more than a 32bit number
        // Otherwise on systems where we have 64bit integers the check below for the magic number will fail.
        $v_bytes = ( ($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte);

        // ----- Compare the bytes
        if ($v_bytes == 0x504b0506)
        {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Found End Central Dir signature at position : \''.ftell($this->zip_fd).'\'');
          $v_pos++;
          break;
        }

        $v_pos++;
      }

      // ----- Look if not found end of central dir
      if ($v_pos == $v_size)
      {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to find End of Central Dir Record signature");

        // ----- Error log
        PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Unable to find End of Central Dir Record signature");

        // ----- Return
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
        return PclZip::errorCode();
      }
    }

    // ----- Read the first 18 bytes of the header
    $v_binary_data = fread($this->zip_fd, 18);

    // ----- Look for invalid block size
    if (strlen($v_binary_data) != 18)
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Invalid End of Central Dir Record size : ".strlen($v_binary_data));

      // ----- Error log
      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid End of Central Dir Record size : ".strlen($v_binary_data));

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
      return PclZip::errorCode();
    }

    // ----- Extract the values
    ////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Central Dir Record : '".$v_binary_data."'");
    ////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Central Dir Record (Hex) : '".bin2hex($v_binary_data)."'");
    $v_data = unpack('vdisk/vdisk_start/vdisk_entries/ventries/Vsize/Voffset/vcomment_size', $v_binary_data);

    // ----- Check the global size
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Comment length : ".$v_data['comment_size']);
    if (($v_pos + $v_data['comment_size'] + 18) != $v_size) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The central dir is not at the end of the archive. Some trailing bytes exists after the archive.");

	  // ----- Removed in release 2.2 see readme file
	  // The check of the file size is a little too strict.
	  // Some bugs where found when a zip is encrypted/decrypted with 'crypt'.
	  // While decrypted, zip has training 0 bytes
	  if (0) {
      // ----- Error log
      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT,
	                       'The central dir is not at the end of the archive.'
						   .' Some trailing bytes exists after the archive.');

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
      return PclZip::errorCode();
	  }
    }

    // ----- Get comment
    if ($v_data['comment_size'] != 0)
      $p_central_dir['comment'] = fread($this->zip_fd, $v_data['comment_size']);
    else
      $p_central_dir['comment'] = '';
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Comment : \''.$p_central_dir['comment'].'\'');

    $p_central_dir['entries'] = $v_data['entries'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Nb of entries : \''.$p_central_dir['entries'].'\'');
    $p_central_dir['disk_entries'] = $v_data['disk_entries'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Nb of entries for this disk : \''.$p_central_dir['disk_entries'].'\'');
    $p_central_dir['offset'] = $v_data['offset'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Offset of Central Dir : \''.$p_central_dir['offset'].'\'');
    $p_central_dir['size'] = $v_data['size'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size of Central Dir : \''.$p_central_dir['size'].'\'');
    $p_central_dir['disk'] = $v_data['disk'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Disk number : \''.$p_central_dir['disk'].'\'');
    $p_central_dir['disk_start'] = $v_data['disk_start'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Start disk number : \''.$p_central_dir['disk_start'].'\'');

    // TBC
    //for(reset($p_central_dir); $key = key($p_central_dir); next($p_central_dir)) {
    //  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "central_dir[$key] = ".$p_central_dir[$key]);
    //}

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privDeleteByRule()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privDeleteByRule(&$p_result_list, &$p_options)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privDeleteByRule", "");
    $v_result=1;
    $v_list_detail = array();

    // ----- Open the zip file
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
    if (($v_result=$this->privOpenFd('rb')) != 1)
    {
      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
    }

    // ----- Read the central directory informations
    $v_central_dir = array();
    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
    {
      $this->privCloseFd();
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
    }

    // ----- Go to beginning of File
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");
    @rewind($this->zip_fd);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");

    // ----- Scan all the files
    // ----- Start at beginning of Central Dir
    $v_pos_entry = $v_central_dir['offset'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'");
    @rewind($this->zip_fd);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'");
    if (@fseek($this->zip_fd, $v_pos_entry))
    {
      // ----- Close the zip file
      $this->privCloseFd();

      // ----- Error log
      PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
      return PclZip::errorCode();
    }
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");

    // ----- Read each entry
    $v_header_list = array();
    $j_start = 0;
    for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++)
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Read next file header entry (index '$i')");

      // ----- Read the file header
      $v_header_list[$v_nb_extracted] = array();
      if (($v_result = $this->privReadCentralFileHeader($v_header_list[$v_nb_extracted])) != 1)
      {
        // ----- Close the zip file
        $this->privCloseFd();

        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
        return $v_result;
      }

      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename (index '$i') : '".$v_header_list[$v_nb_extracted]['stored_filename']."'");

      // ----- Store the index
      $v_header_list[$v_nb_extracted]['index'] = $i;

      // ----- Look for the specific extract rules
      $v_found = false;

      // ----- Look for extract by name rule
      if (   (isset($p_options[PCLZIP_OPT_BY_NAME]))
          && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByName'");

          // ----- Look if the filename is in the list
          for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_found); $j++) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Compare with file '".$p_options[PCLZIP_OPT_BY_NAME][$j]."'");

              // ----- Look for a directory
              if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The searched item is a directory");

                  // ----- Look if the directory is in the filename path
                  if (   (strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
                      && (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
                      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The directory is in the file path");
                      $v_found = true;
                  }
                  elseif (   (($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */
                          && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
                      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The entry is the searched directory");
                      $v_found = true;
                  }
              }
              // ----- Look for a filename
              elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The file is the right one.");
                  $v_found = true;
              }
          }
      }

      // ----- Look for extract by ereg rule
      else if (   (isset($p_options[PCLZIP_OPT_BY_EREG]))
               && ($p_options[PCLZIP_OPT_BY_EREG] != "")) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract by ereg '".$p_options[PCLZIP_OPT_BY_EREG]."'");

          if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
              $v_found = true;
          }
      }

      // ----- Look for extract by preg rule
      else if (   (isset($p_options[PCLZIP_OPT_BY_PREG]))
               && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByEreg'");

          if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
              $v_found = true;
          }
      }

      // ----- Look for extract by index rule
      else if (   (isset($p_options[PCLZIP_OPT_BY_INDEX]))
               && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByIndex'");

          // ----- Look if the index is in the list
          for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); $j++) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Look if index '$i' is in [".$p_options[PCLZIP_OPT_BY_INDEX][$j]['start'].",".$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']."]");

              if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Found as part of an index range");
                  $v_found = true;
              }
              if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Do not look this index range for next loop");
                  $j_start = $j+1;
              }

              if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Index range is greater than index, stop loop");
                  break;
              }
          }
      }
      else {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "No argument mean remove all file");
      	$v_found = true;
      }

      // ----- Look for deletion
      if ($v_found)
      {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v_header_list[$v_nb_extracted]['stored_filename']."', index '$i' need to be deleted");
        unset($v_header_list[$v_nb_extracted]);
      }
      else
      {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v_header_list[$v_nb_extracted]['stored_filename']."', index '$i' will not be deleted");
        $v_nb_extracted++;
      }
    }

    // ----- Look if something need to be deleted
    if ($v_nb_extracted > 0) {

        // ----- Creates a temporay file
        $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';

        // ----- Creates a temporary zip archive
        $v_temp_zip = new PclZip($v_zip_temp_name);

        // ----- Open the temporary zip file in write mode
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary write mode");
        if (($v_result = $v_temp_zip->privOpenFd('wb')) != 1) {
            $this->privCloseFd();

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
            return $v_result;
        }

        // ----- Look which file need to be kept
        for ($i=0; $i<sizeof($v_header_list); $i++) {
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Keep entry index '$i' : '".$v_header_list[$i]['filename']."'");

            // ----- Calculate the position of the header
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset='". $v_header_list[$i]['offset']."'");
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'");
            @rewind($this->zip_fd);
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'");
            if (@fseek($this->zip_fd,  $v_header_list[$i]['offset'])) {
                // ----- Close the zip file
                $this->privCloseFd();
                $v_temp_zip->privCloseFd();
                @unlink($v_zip_temp_name);

                // ----- Error log
                PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');

                // ----- Return
                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
                return PclZip::errorCode();
            }
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");

            // ----- Read the file header
            $v_local_header = array();
            if (($v_result = $this->privReadFileHeader($v_local_header)) != 1) {
                // ----- Close the zip file
                $this->privCloseFd();
                $v_temp_zip->privCloseFd();
                @unlink($v_zip_temp_name);

                // ----- Return
                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
                return $v_result;
            }

            // ----- Check that local file header is same as central file header
            if ($this->privCheckFileHeaders($v_local_header,
			                                $v_header_list[$i]) != 1) {
                // TBC
            }
            unset($v_local_header);

            // ----- Write the file header
            if (($v_result = $v_temp_zip->privWriteFileHeader($v_header_list[$i])) != 1) {
                // ----- Close the zip file
                $this->privCloseFd();
                $v_temp_zip->privCloseFd();
                @unlink($v_zip_temp_name);

                // ----- Return
                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
                return $v_result;
            }
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset for this file is '".$v_header_list[$i]['offset']."'");

            // ----- Read/write the data block
            if (($v_result = PclZipUtilCopyBlock($this->zip_fd, $v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) {
                // ----- Close the zip file
                $this->privCloseFd();
                $v_temp_zip->privCloseFd();
                @unlink($v_zip_temp_name);

                // ----- Return
                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
                return $v_result;
            }
        }

        // ----- Store the offset of the central dir
        $v_offset = @ftell($v_temp_zip->zip_fd);
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "New offset of central dir : $v_offset");

        // ----- Re-Create the Central Dir files header
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Creates the new central directory");
        for ($i=0; $i<sizeof($v_header_list); $i++) {
            // ----- Create the file header
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset of file : ".$v_header_list[$i]['offset']);
            if (($v_result = $v_temp_zip->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
                $v_temp_zip->privCloseFd();
                $this->privCloseFd();
                @unlink($v_zip_temp_name);

                // ----- Return
                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
                return $v_result;
            }

            // ----- Transform the header to a 'usable' info
            $v_temp_zip->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
        }

        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Creates the central directory footer");

        // ----- Zip file comment
        $v_comment = '';
        if (isset($p_options[PCLZIP_OPT_COMMENT])) {
          $v_comment = $p_options[PCLZIP_OPT_COMMENT];
        }

        // ----- Calculate the size of the central header
        $v_size = @ftell($v_temp_zip->zip_fd)-$v_offset;

        // ----- Create the central dir footer
        if (($v_result = $v_temp_zip->privWriteCentralHeader(sizeof($v_header_list), $v_size, $v_offset, $v_comment)) != 1) {
            // ----- Reset the file list
            unset($v_header_list);
            $v_temp_zip->privCloseFd();
            $this->privCloseFd();
            @unlink($v_zip_temp_name);

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
            return $v_result;
        }

        // ----- Close
        $v_temp_zip->privCloseFd();
        $this->privCloseFd();

        // ----- Delete the zip file
        // TBC : I should test the result ...
        @unlink($this->zipname);

        // ----- Rename the temporary file
        // TBC : I should test the result ...
        //@rename($v_zip_temp_name, $this->zipname);
        PclZipUtilRename($v_zip_temp_name, $this->zipname);

        // ----- Destroy the temporary archive
        unset($v_temp_zip);
    }

    // ----- Remove every files : reset the file
    else if ($v_central_dir['entries'] != 0) {
        $this->privCloseFd();

        if (($v_result = $this->privOpenFd('wb')) != 1) {
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
          return $v_result;
        }

        if (($v_result = $this->privWriteCentralHeader(0, 0, 0, '')) != 1) {
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
          return $v_result;
        }

        $this->privCloseFd();
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privDirCheck()
  // Description :
  //   Check if a directory exists, if not it creates it and all the parents directory
  //   which may be useful.
  // Parameters :
  //   $p_dir : Directory path to check.
  // Return Values :
  //    1 : OK
  //   -1 : Unable to create directory
  // --------------------------------------------------------------------------------
  function privDirCheck($p_dir, $p_is_dir=false)
  {
    $v_result = 1;

    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privDirCheck", "entry='$p_dir', is_dir='".($p_is_dir?"true":"false")."'");

    // ----- Remove the final '/'
    if (($p_is_dir) && (substr($p_dir, -1)=='/'))
    {
      $p_dir = substr($p_dir, 0, strlen($p_dir)-1);
    }
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Looking for entry '$p_dir'");

    // ----- Check the directory availability
    if ((is_dir($p_dir)) || ($p_dir == ""))
    {
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, "'$p_dir' is a directory");
      return 1;
    }

    // ----- Extract parent directory
    $p_parent_dir = dirname($p_dir);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Parent directory is '$p_parent_dir'");

    // ----- Just a check
    if ($p_parent_dir != $p_dir)
    {
      // ----- Look for parent directory
      if ($p_parent_dir != "")
      {
        if (($v_result = $this->privDirCheck($p_parent_dir)) != 1)
        {
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
          return $v_result;
        }
      }
    }

    // ----- Create the directory
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Create directory '$p_dir'");
    if (!@mkdir($p_dir, 0777))
    {
      // ----- Error log
      PclZip::privErrorLog(PCLZIP_ERR_DIR_CREATE_FAIL, "Unable to create directory '$p_dir'");

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
      return PclZip::errorCode();
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result, "Directory '$p_dir' created");
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privMerge()
  // Description :
  //   If $p_archive_to_add does not exist, the function exit with a success result.
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privMerge(&$p_archive_to_add)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privMerge", "archive='".$p_archive_to_add->zipname."'");
    $v_result=1;

    // ----- Look if the archive_to_add exists
    if (!is_file($p_archive_to_add->zipname))
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive to add does not exist. End of merge.");

      // ----- Nothing to merge, so merge is a success
      $v_result = 1;

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
    }

    // ----- Look if the archive exists
    if (!is_file($this->zipname))
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive does not exist, duplicate the archive_to_add.");

      // ----- Do a duplicate
      $v_result = $this->privDuplicate($p_archive_to_add->zipname);

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
    }

    // ----- Open the zip file
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
    if (($v_result=$this->privOpenFd('rb')) != 1)
    {
      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
    }

    // ----- Read the central directory informations
    $v_central_dir = array();
    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
    {
      $this->privCloseFd();
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
    }

    // ----- Go to beginning of File
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in zip : ".ftell($this->zip_fd)."'");
    @rewind($this->zip_fd);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in zip : ".ftell($this->zip_fd)."'");

    // ----- Open the archive_to_add file
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open archive_to_add in binary read mode");
    if (($v_result=$p_archive_to_add->privOpenFd('rb')) != 1)
    {
      $this->privCloseFd();

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
    }

    // ----- Read the central directory informations
    $v_central_dir_to_add = array();
    if (($v_result = $p_archive_to_add->privReadEndCentralDir($v_central_dir_to_add)) != 1)
    {
      $this->privCloseFd();
      $p_archive_to_add->privCloseFd();

      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
    }

    // ----- Go to beginning of File
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in archive_to_add : ".ftell($p_archive_to_add->zip_fd)."'");
    @rewind($p_archive_to_add->zip_fd);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in archive_to_add : ".ftell($p_archive_to_add->zip_fd)."'");

    // ----- Creates a temporay file
    $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';

    // ----- Open the temporary file in write mode
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
    if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)
    {
      $this->privCloseFd();
      $p_archive_to_add->privCloseFd();

      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode');

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
      return PclZip::errorCode();
    }

    // ----- Copy the files from the archive to the temporary file
    // TBC : Here I should better append the file and go back to erase the central dir
    $v_size = $v_central_dir['offset'];
    while ($v_size != 0)
    {
      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
      $v_buffer = fread($this->zip_fd, $v_read_size);
      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
      $v_size -= $v_read_size;
    }

    // ----- Copy the files from the archive_to_add into the temporary file
    $v_size = $v_central_dir_to_add['offset'];
    while ($v_size != 0)
    {
      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
      $v_buffer = fread($p_archive_to_add->zip_fd, $v_read_size);
      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
      $v_size -= $v_read_size;
    }

    // ----- Store the offset of the central dir
    $v_offset = @ftell($v_zip_temp_fd);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "New offset of central dir : $v_offset");

    // ----- Copy the block of file headers from the old archive
    $v_size = $v_central_dir['size'];
    while ($v_size != 0)
    {
      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
      $v_buffer = @fread($this->zip_fd, $v_read_size);
      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
      $v_size -= $v_read_size;
    }

    // ----- Copy the block of file headers from the archive_to_add
    $v_size = $v_central_dir_to_add['size'];
    while ($v_size != 0)
    {
      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
      $v_buffer = @fread($p_archive_to_add->zip_fd, $v_read_size);
      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
      $v_size -= $v_read_size;
    }

    // ----- Merge the file comments
    $v_comment = $v_central_dir['comment'].' '.$v_central_dir_to_add['comment'];

    // ----- Calculate the size of the (new) central header
    $v_size = @ftell($v_zip_temp_fd)-$v_offset;

    // ----- Swap the file descriptor
    // Here is a trick : I swap the temporary fd with the zip fd, in order to use
    // the following methods on the temporary fil and not the real archive fd
    $v_swap = $this->zip_fd;
    $this->zip_fd = $v_zip_temp_fd;
    $v_zip_temp_fd = $v_swap;

    // ----- Create the central dir footer
    if (($v_result = $this->privWriteCentralHeader($v_central_dir['entries']+$v_central_dir_to_add['entries'], $v_size, $v_offset, $v_comment)) != 1)
    {
      $this->privCloseFd();
      $p_archive_to_add->privCloseFd();
      @fclose($v_zip_temp_fd);
      $this->zip_fd = null;

      // ----- Reset the file list
      unset($v_header_list);

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
    }

    // ----- Swap back the file descriptor
    $v_swap = $this->zip_fd;
    $this->zip_fd = $v_zip_temp_fd;
    $v_zip_temp_fd = $v_swap;

    // ----- Close
    $this->privCloseFd();
    $p_archive_to_add->privCloseFd();

    // ----- Close the temporary file
    @fclose($v_zip_temp_fd);

    // ----- Delete the zip file
    // TBC : I should test the result ...
    @unlink($this->zipname);

    // ----- Rename the temporary file
    // TBC : I should test the result ...
    //@rename($v_zip_temp_name, $this->zipname);
    PclZipUtilRename($v_zip_temp_name, $this->zipname);

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privDuplicate()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privDuplicate($p_archive_filename)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privDuplicate", "archive_filename='$p_archive_filename'");
    $v_result=1;

    // ----- Look if the $p_archive_filename exists
    if (!is_file($p_archive_filename))
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive to duplicate does not exist. End of duplicate.");

      // ----- Nothing to duplicate, so duplicate is a success.
      $v_result = 1;

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
    }

    // ----- Open the zip file
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
    if (($v_result=$this->privOpenFd('wb')) != 1)
    {
      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
    }

    // ----- Open the temporary file in write mode
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
    if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0)
    {
      $this->privCloseFd();

      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive file \''.$p_archive_filename.'\' in binary write mode');

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
      return PclZip::errorCode();
    }

    // ----- Copy the files from the archive to the temporary file
    // TBC : Here I should better append the file and go back to erase the central dir
    $v_size = filesize($p_archive_filename);
    while ($v_size != 0)
    {
      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read $v_read_size bytes");
      $v_buffer = fread($v_zip_temp_fd, $v_read_size);
      @fwrite($this->zip_fd, $v_buffer, $v_read_size);
      $v_size -= $v_read_size;
    }

    // ----- Close
    $this->privCloseFd();

    // ----- Close the temporary file
    @fclose($v_zip_temp_fd);

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privErrorLog()
  // Description :
  // Parameters :
  // --------------------------------------------------------------------------------
  function privErrorLog($p_error_code=0, $p_error_string='')
  {
    if (PCLZIP_ERROR_EXTERNAL == 1) {
      PclError($p_error_code, $p_error_string);
    }
    else {
      $this->error_code = $p_error_code;
      $this->error_string = $p_error_string;
    }
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privErrorReset()
  // Description :
  // Parameters :
  // --------------------------------------------------------------------------------
  function privErrorReset()
  {
    if (PCLZIP_ERROR_EXTERNAL == 1) {
      PclErrorReset();
    }
    else {
      $this->error_code = 0;
      $this->error_string = '';
    }
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privDecrypt()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privDecrypt($p_encryption_header, &$p_buffer, $p_size, $p_crc)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privDecrypt', "size=".$p_size."");
    $v_result=1;

    // ----- To Be Modified ;-)
    $v_pwd = "test";

    $p_buffer = PclZipUtilZipDecrypt($p_buffer, $p_size, $p_encryption_header,
	                                 $p_crc, $v_pwd);

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privDisableMagicQuotes()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privDisableMagicQuotes()
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privDisableMagicQuotes', "");
    $v_result=1;

    // ----- Look if function exists
    if (   (!function_exists("get_magic_quotes_runtime"))
	    || (!function_exists("set_magic_quotes_runtime"))) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Functions *et_magic_quotes_runtime are not supported");
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
	}

    // ----- Look if already done
    if ($this->magic_quotes_status != -1) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "magic_quote already disabled");
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
	}

	// ----- Get and memorize the magic_quote value
	$this->magic_quotes_status = @get_magic_quotes_runtime();
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Current magic_quotes_runtime status is '".($this->magic_quotes_status==0?'disable':'enable')."'");

	// ----- Disable magic_quotes
	if ($this->magic_quotes_status == 1) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Disable magic_quotes");
	  @set_magic_quotes_runtime(0);
	}

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privSwapBackMagicQuotes()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privSwapBackMagicQuotes()
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privSwapBackMagicQuotes', "");
    $v_result=1;

    // ----- Look if function exists
    if (   (!function_exists("get_magic_quotes_runtime"))
	    || (!function_exists("set_magic_quotes_runtime"))) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Functions *et_magic_quotes_runtime are not supported");
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
	}

    // ----- Look if something to do
    if ($this->magic_quotes_status != -1) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "magic_quote not modified");
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
      return $v_result;
	}

	// ----- Swap back magic_quotes
	if ($this->magic_quotes_status == 1) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Enable back magic_quotes");
  	  @set_magic_quotes_runtime($this->magic_quotes_status);
	}

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  }
  // End of class
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : PclZipUtilPathReduction()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function PclZipUtilPathReduction($p_dir)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilPathReduction", "dir='$p_dir'");
    $v_result = "";

    // ----- Look for not empty path
    if ($p_dir != "") {
      // ----- Explode path by directory names
      $v_list = explode("/", $p_dir);

      // ----- Study directories from last to first
      $v_skip = 0;
      for ($i=sizeof($v_list)-1; $i>=0; $i--) {
        // ----- Look for current path
        if ($v_list[$i] == ".") {
          // ----- Ignore this directory
          // Should be the first $i=0, but no check is done
        }
        else if ($v_list[$i] == "..") {
		  $v_skip++;
        }
        else if ($v_list[$i] == "") {
		  // ----- First '/' i.e. root slash
		  if ($i == 0) {
            $v_result = "/".$v_result;
		    if ($v_skip > 0) {
		        // ----- It is an invalid path, so the path is not modified
		        // TBC
		        $v_result = $p_dir;
                //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Invalid path is unchanged");
                $v_skip = 0;
		    }
		  }
		  // ----- Last '/' i.e. indicates a directory
		  else if ($i == (sizeof($v_list)-1)) {
            $v_result = $v_list[$i];
		  }
		  // ----- Double '/' inside the path
		  else {
            // ----- Ignore only the double '//' in path,
            // but not the first and last '/'
		  }
        }
        else {
		  // ----- Look for item to skip
		  if ($v_skip > 0) {
		    $v_skip--;
		  }
		  else {
            $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:"");
		  }
        }
      }

      // ----- Look for skip
      if ($v_skip > 0) {
        while ($v_skip > 0) {
            $v_result = '../'.$v_result;
            $v_skip--;
        }
      }
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : PclZipUtilPathInclusion()
  // Description :
  //   This function indicates if the path $p_path is under the $p_dir tree. Or,
  //   said in an other way, if the file or sub-dir $p_path is inside the dir
  //   $p_dir.
  //   The function indicates also if the path is exactly the same as the dir.
  //   This function supports path with duplicated '/' like '//', but does not
  //   support '.' or '..' statements.
  // Parameters :
  // Return Values :
  //   0 if $p_path is not inside directory $p_dir
  //   1 if $p_path is inside directory $p_dir
  //   2 if $p_path is exactly the same as $p_dir
  // --------------------------------------------------------------------------------
  function PclZipUtilPathInclusion($p_dir, $p_path)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilPathInclusion", "dir='$p_dir', path='$p_path'");
    $v_result = 1;

    // ----- Look for path beginning by ./
    if (   ($p_dir == '.')
        || ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) {
      $p_dir = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_dir, 1);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Replacing ./ by full path in p_dir '".$p_dir."'");
    }
    if (   ($p_path == '.')
        || ((strlen($p_path) >=2) && (substr($p_path, 0, 2) == './'))) {
      $p_path = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_path, 1);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Replacing ./ by full path in p_path '".$p_path."'");
    }

    // ----- Explode dir and path by directory separator
    $v_list_dir = explode("/", $p_dir);
    $v_list_dir_size = sizeof($v_list_dir);
    $v_list_path = explode("/", $p_path);
    $v_list_path_size = sizeof($v_list_path);

    // ----- Study directories paths
    $i = 0;
    $j = 0;
    while (($i < $v_list_dir_size) && ($j < $v_list_path_size) && ($v_result)) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Working on dir($i)='".$v_list_dir[$i]."' and path($j)='".$v_list_path[$j]."'");

      // ----- Look for empty dir (path reduction)
      if ($v_list_dir[$i] == '') {
        $i++;
        continue;
      }
      if ($v_list_path[$j] == '') {
        $j++;
        continue;
      }

      // ----- Compare the items
      if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ( $v_list_path[$j] != ''))  {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Items ($i,$j) are different");
        $v_result = 0;
      }

      // ----- Next items
      $i++;
      $j++;
    }

    // ----- Look if everything seems to be the same
    if ($v_result) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Look for tie break");
      // ----- Skip all the empty items
      while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) $j++;
      while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) $i++;
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Looking on dir($i)='".($i < $v_list_dir_size?$v_list_dir[$i]:'')."' and path($j)='".($j < $v_list_path_size?$v_list_path[$j]:'')."'");

      if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) {
        // ----- There are exactly the same
        $v_result = 2;
      }
      else if ($i < $v_list_dir_size) {
        // ----- The path is shorter than the dir
        $v_result = 0;
      }
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : PclZipUtilCopyBlock()
  // Description :
  // Parameters :
  //   $p_mode : read/write compression mode
  //             0 : src & dest normal
  //             1 : src gzip, dest normal
  //             2 : src normal, dest gzip
  //             3 : src & dest gzip
  // Return Values :
  // --------------------------------------------------------------------------------
  function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode=0)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilCopyBlock", "size=$p_size, mode=$p_mode");
    $v_result = 1;

    if ($p_mode==0)
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Src offset before read :".(@ftell($p_src)));
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Dest offset before write :".(@ftell($p_dest)));
      while ($p_size != 0)
      {
        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
        $v_buffer = @fread($p_src, $v_read_size);
        @fwrite($p_dest, $v_buffer, $v_read_size);
        $p_size -= $v_read_size;
      }
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Src offset after read :".(@ftell($p_src)));
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Dest offset after write :".(@ftell($p_dest)));
    }
    else if ($p_mode==1)
    {
      while ($p_size != 0)
      {
        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
        $v_buffer = @gzread($p_src, $v_read_size);
        @fwrite($p_dest, $v_buffer, $v_read_size);
        $p_size -= $v_read_size;
      }
    }
    else if ($p_mode==2)
    {
      while ($p_size != 0)
      {
        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
        $v_buffer = @fread($p_src, $v_read_size);
        @gzwrite($p_dest, $v_buffer, $v_read_size);
        $p_size -= $v_read_size;
      }
    }
    else if ($p_mode==3)
    {
      while ($p_size != 0)
      {
        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
        $v_buffer = @gzread($p_src, $v_read_size);
        @gzwrite($p_dest, $v_buffer, $v_read_size);
        $p_size -= $v_read_size;
      }
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : PclZipUtilRename()
  // Description :
  //   This function tries to do a simple rename() function. If it fails, it
  //   tries to copy the $p_src file in a new $p_dest file and then unlink the
  //   first one.
  // Parameters :
  //   $p_src : Old filename
  //   $p_dest : New filename
  // Return Values :
  //   1 on success, 0 on failure.
  // --------------------------------------------------------------------------------
  function PclZipUtilRename($p_src, $p_dest)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilRename", "source=$p_src, destination=$p_dest");
    $v_result = 1;

    // ----- Try to rename the files
    if (!@rename($p_src, $p_dest)) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to rename file, try copy+unlink");

      // ----- Try to copy & unlink the src
      if (!@copy($p_src, $p_dest)) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to copy file");
        $v_result = 0;
      }
      else if (!@unlink($p_src)) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to unlink old filename");
        $v_result = 0;
      }
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : PclZipUtilOptionText()
  // Description :
  //   Translate option value in text. Mainly for debug purpose.
  // Parameters :
  //   $p_option : the option value.
  // Return Values :
  //   The option text value.
  // --------------------------------------------------------------------------------
  function PclZipUtilOptionText($p_option)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilOptionText", "option='".$p_option."'");

    $v_list = get_defined_constants();
    for (reset($v_list); $v_key = key($v_list); next($v_list)) {
	  $v_prefix = substr($v_key, 0, 10);
	  if ((   ($v_prefix == 'PCLZIP_OPT')
         || ($v_prefix == 'PCLZIP_CB_')
         || ($v_prefix == 'PCLZIP_ATT'))
	      && ($v_list[$v_key] == $p_option)) {
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_key);
          return $v_key;
	    }
    }

    $v_result = 'Unknown';

    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    return $v_result;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : PclZipUtilTranslateWinPath()
  // Description :
  //   Translate windows path by replacing '\' by '/' and optionally removing
  //   drive letter.
  // Parameters :
  //   $p_path : path to translate.
  //   $p_remove_disk_letter : true | false
  // Return Values :
  //   The path translated.
  // --------------------------------------------------------------------------------
  function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter=true)
  {
    if (stristr(php_uname(), 'windows')) {
      // ----- Look for potential disk letter
      if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) {
          $p_path = substr($p_path, $v_position+1);
      }
      // ----- Change potential windows directory separator
      if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) {
          $p_path = strtr($p_path, '\\', '/');
      }
    }
    return $p_path;
  }
  // --------------------------------------------------------------------------------


?>
                                                                                                                                                                                                                                                                                                                                                                                                                                                   wp-admin/includes/class-wp-filesystem-direct.php                                                    0000755 0023422 0004734 00000015331 11116052276 023027  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress Direct Filesystem.
 *
 * @package WordPress
 * @subpackage Filesystem
 */

/**
 * WordPress Filesystem Class for direct PHP file and folder manipulation.
 *
 * @since 2.5
 * @package WordPress
 * @subpackage Filesystem
 * @uses WP_Filesystem_Base Extends class
 */
class WP_Filesystem_Direct  extends WP_Filesystem_Base {
	var $permission = null;
	var $errors = array();
	function WP_Filesystem_Direct($arg) {
		$this->method = 'direct';
		$this->errors = new WP_Error();
		$this->permission = umask();
	}
	function connect() {
		return true;
	}
	function setDefaultPermissions($perm) {
		$this->permission = $perm;
	}
	function get_contents($file) {
		return @file_get_contents($file);
	}
	function get_contents_array($file) {
		return @file($file);
	}
	function put_contents($file, $contents, $mode = false, $type = '') {
		if ( ! ($fp = @fopen($file, 'w' . $type)) )
			return false;
		@fwrite($fp, $contents);
		@fclose($fp);
		$this->chmod($file,$mode);
		return true;
	}
	function cwd() {
		return @getcwd();
	}
	function chdir($dir) {
		return @chdir($dir);
	}
	function chgrp($file, $group, $recursive = false) {
		if( ! $this->exists($file) )
			return false;
		if( ! $recursive )
			return @chgrp($file, $group);
		if( ! $this->is_dir($file) )
			return @chgrp($file, $group);
		//Is a directory, and we want recursive
		$file = trailingslashit($file);
		$filelist = $this->dirlist($file);
		foreach($filelist as $filename)
			$this->chgrp($file . $filename, $group, $recursive);

		return true;
	}
	function chmod($file, $mode = false, $recursive = false) {
		if( ! $mode )
			$mode = $this->permission;
		if( ! $this->exists($file) )
			return false;
		if( ! $recursive )
			return @chmod($file,$mode);
		if( ! $this->is_dir($file) )
			return @chmod($file, $mode);
		//Is a directory, and we want recursive
		$file = trailingslashit($file);
		$filelist = $this->dirlist($file);
		foreach($filelist as $filename)
			$this->chmod($file . $filename, $mode, $recursive);

		return true;
	}
	function chown($file, $owner, $recursive = false) {
		if( ! $this->exists($file) )
			return false;
		if( ! $recursive )
			return @chown($file, $owner);
		if( ! $this->is_dir($file) )
			return @chown($file, $owner);
		//Is a directory, and we want recursive
		$filelist = $this->dirlist($file);
		foreach($filelist as $filename){
			$this->chown($file . '/' . $filename, $owner, $recursive);
		}
		return true;
	}
	function owner($file) {
		$owneruid = @fileowner($file);
		if( ! $owneruid )
			return false;
		if( ! function_exists('posix_getpwuid') )
			return $owneruid;
		$ownerarray = posix_getpwuid($owneruid);
		return $ownerarray['name'];
	}
	function getchmod($file) {
		return @fileperms($file);
	}
	function group($file) {
		$gid = @filegroup($file);
		if( ! $gid )
			return false;
		if( ! function_exists('posix_getgrgid') )
			return $gid;
		$grouparray = posix_getgrgid($gid);
		return $grouparray['name'];
	}

	function copy($source, $destination, $overwrite = false) {
		if( ! $overwrite && $this->exists($destination) )
			return false;
		return copy($source, $destination);
	}

	function move($source, $destination, $overwrite = false) {
		//Possible to use rename()?
		if( $this->copy($source, $destination, $overwrite) && $this->exists($destination) ){
			$this->delete($source);
			return true;
		} else {
			return false;
		}
	}

	function delete($file, $recursive = false) {
		$file = str_replace('\\', '/', $file); //for win32, occasional problems deleteing files otherwise

		if( $this->is_file($file) )
			return @unlink($file);
		if( ! $recursive && $this->is_dir($file) )
			return @rmdir($file);

		//At this point its a folder, and we're in recursive mode
		$file = trailingslashit($file);
		$filelist = $this->dirlist($file, true);

		$retval = true;
		if( is_array($filelist) ) //false if no files, So check first.
			foreach($filelist as $filename => $fileinfo)
				if( ! $this->delete($file . $filename, $recursive) )
					$retval = false;

		if( ! @rmdir($file) )
			return false;
		return $retval;
	}

	function exists($file) {
		return @file_exists($file);
	}

	function is_file($file) {
		return @is_file($file);
	}

	function is_dir($path) {
		return @is_dir($path);
	}

	function is_readable($file) {
		return @is_readable($file);
	}

	function is_writable($file) {
		return @is_writable($file);
	}

	function atime($file) {
		return @fileatime($file);
	}

	function mtime($file) {
		return @filemtime($file);
	}
	function size($file) {
		return @filesize($file);
	}

	function touch($file, $time = 0, $atime = 0){
		if($time == 0)
			$time = time();
		if($atime == 0)
			$atime = time();
		return @touch($file, $time, $atime);
	}

	function mkdir($path, $chmod = false, $chown = false, $chgrp = false){
		if( ! $chmod)
			$chmod = $this->permission;

		if( ! @mkdir($path, $chmod) )
			return false;
		if( $chown )
			$this->chown($path, $chown);
		if( $chgrp )
			$this->chgrp($path, $chgrp);
		return true;
	}

	function rmdir($path, $recursive = false) {
		//Currently unused and untested, Use delete() instead.
		if( ! $recursive )
			return @rmdir($path);
		//recursive:
		$filelist = $this->dirlist($path);
		foreach($filelist as $filename => $det) {
			if ( '/' == substr($filename, -1, 1) )
				$this->rmdir($path . '/' . $filename, $recursive);
			@rmdir($filename);
		}
		return @rmdir($path);
	}

	function dirlist($path, $incdot = false, $recursive = false) {
		if( $this->is_file($path) ) {
			$limitFile = basename($path);
			$path = dirname($path);
		} else {
			$limitFile = false;
		}
		if( ! $this->is_dir($path) )
			return false;

		$ret = array();
		$dir = @dir($path);
		if ( ! $dir )
			return false;
		while (false !== ($entry = $dir->read()) ) {
			$struc = array();
			$struc['name'] = $entry;

			if( '.' == $struc['name'] || '..' == $struc['name'] )
				continue; //Do not care about these folders.
			if( '.' == $struc['name'][0] && !$incdot)
				continue;
			if( $limitFile && $struc['name'] != $limitFile)
				continue;

			$struc['perms'] 	= $this->gethchmod($path.'/'.$entry);
			$struc['permsn']	= $this->getnumchmodfromh($struc['perms']);
			$struc['number'] 	= false;
			$struc['owner']    	= $this->owner($path.'/'.$entry);
			$struc['group']    	= $this->group($path.'/'.$entry);
			$struc['size']    	= $this->size($path.'/'.$entry);
			$struc['lastmodunix']= $this->mtime($path.'/'.$entry);
			$struc['lastmod']   = date('M j',$struc['lastmodunix']);
			$struc['time']    	= date('h:i:s',$struc['lastmodunix']);
			$struc['type']		= $this->is_dir($path.'/'.$entry) ? 'd' : 'f';

			if ( 'd' == $struc['type'] ) {
				if( $recursive )
					$struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive);
				else
					$struc['files'] = array();
			}

			$ret[ $struc['name'] ] = $struc;
		}
		$dir->close();
		unset($dir);
		return $ret;
	}
}
?>
                                                                                                                                                                                                                                                                                                       wp-admin/includes/class-wp-filesystem-ftpext.php                                                    0000755 0023422 0004734 00000024240 11117531364 023067  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress FTP Filesystem.
 *
 * @package WordPress
 * @subpackage Filesystem
 */

/**
 * WordPress Filesystem Class for implementing FTP.
 *
 * @since 2.5
 * @package WordPress
 * @subpackage Filesystem
 * @uses WP_Filesystem_Base Extends class
 */
class WP_Filesystem_FTPext extends WP_Filesystem_Base {
	var $link;
	var $timeout = 5;
	var $errors = array();
	var $options = array();

	var $permission = null;

	function WP_Filesystem_FTPext($opt='') {
		$this->method = 'ftpext';
		$this->errors = new WP_Error();

		//Check if possible to use ftp functions.
		if ( ! extension_loaded('ftp') ) {
			$this->errors->add('no_ftp_ext', __('The ftp PHP extension is not available'));
			return false;
		}

		// Set defaults:
		if ( empty($opt['port']) )
			$this->options['port'] = 21;
		else
			$this->options['port'] = $opt['port'];

		if ( empty($opt['hostname']) )
			$this->errors->add('empty_hostname', __('FTP hostname is required'));
		else
			$this->options['hostname'] = $opt['hostname'];

		if ( isset($opt['base']) && ! empty($opt['base']) )
			$this->wp_base = $opt['base'];

		// Check if the options provided are OK.
		if ( empty ($opt['username']) )
			$this->errors->add('empty_username', __('FTP username is required'));
		else
			$this->options['username'] = $opt['username'];

		if ( empty ($opt['password']) )
			$this->errors->add('empty_password', __('FTP password is required'));
		else
			$this->options['password'] = $opt['password'];

		$this->options['ssl'] = false;
		if ( isset($opt['ssl']) )
			$this->options['ssl'] = ( !empty($opt['ssl']) );
		elseif ( isset( $opt['connection_type']) )
			$this->options['ssl'] = ( 'ftps' == $opt['connection_type'] );
	}

	function connect() {
		if ( $this->options['ssl'] && function_exists('ftp_ssl_connect') )
			$this->link = @ftp_ssl_connect($this->options['hostname'], $this->options['port'],$this->timeout);
		else
			$this->link = @ftp_connect($this->options['hostname'], $this->options['port'],$this->timeout);

		if ( ! $this->link ) {
			$this->errors->add('connect', sprintf(__('Failed to connect to FTP Server %1$s:%2$s'), $this->options['hostname'], $this->options['port']));
			return false;
		}

		if ( ! @ftp_login($this->link,$this->options['username'], $this->options['password']) ) {
			$this->errors->add('auth', sprintf(__('Username/Password incorrect for %s'), $this->options['username']));
			return false;
		}

		//Set the Connection to use Passive FTP
		@ftp_pasv( $this->link, true );

		return true;
	}

	function setDefaultPermissions($perm) {
		$this->permission = $perm;
	}

	function get_contents($file, $type = '', $resumepos = 0 ){
		if( empty($type) )
			$type = FTP_BINARY;

		$temp = tmpfile();
		if ( ! $temp )
			return false;

		if( ! @ftp_fget($this->link, $temp, $file, $type, $resumepos) )
			return false;

		fseek($temp, 0); //Skip back to the start of the file being written to
		$contents = '';

		while ( ! feof($temp) )
			$contents .= fread($temp, 8192);

		fclose($temp);
		return $contents;
	}
	function get_contents_array($file) {
		return explode("\n", $this->get_contents($file));
	}
	function put_contents($file, $contents, $type = '' ) {
		if( empty($type) )
			$type = $this->is_binary($contents) ? FTP_BINARY : FTP_ASCII;

		$temp = tmpfile();
		if ( ! $temp )
			return false;

		fwrite($temp, $contents);
		fseek($temp, 0); //Skip back to the start of the file being written to

		$ret = @ftp_fput($this->link, $file, $temp, $type);

		fclose($temp);
		return $ret;
	}
	function cwd() {
		$cwd = @ftp_pwd($this->link);
		if( $cwd )
			$cwd = trailingslashit($cwd);
		return $cwd;
	}
	function chdir($dir) {
		return @ftp_chdir($dir);
	}
	function chgrp($file, $group, $recursive = false ) {
		return false;
	}
	function chmod($file, $mode = false, $recursive = false) {
		if( ! $mode )
			$mode = $this->permission;
		if( ! $mode )
			return false;
		if ( ! $this->exists($file) )
			return false;
		if ( ! $recursive || ! $this->is_dir($file) ) {
			if ( ! function_exists('ftp_chmod') )
				return @ftp_site($this->link, sprintf('CHMOD %o %s', $mode, $file));
			return @ftp_chmod($this->link, $mode, $file);
		}
		//Is a directory, and we want recursive
		$filelist = $this->dirlist($file);
		foreach($filelist as $filename){
			$this->chmod($file . '/' . $filename, $mode, $recursive);
		}
		return true;
	}
	function chown($file, $owner, $recursive = false ) {
		return false;
	}
	function owner($file) {
		$dir = $this->dirlist($file);
		return $dir[$file]['owner'];
	}
	function getchmod($file) {
		$dir = $this->dirlist($file);
		return $dir[$file]['permsn'];
	}
	function group($file) {
		$dir = $this->dirlist($file);
		return $dir[$file]['group'];
	}
	function copy($source, $destination, $overwrite = false ) {
		if( ! $overwrite && $this->exists($destination) )
			return false;
		$content = $this->get_contents($source);
		if( false === $content)
			return false;
		return $this->put_contents($destination, $content);
	}
	function move($source, $destination, $overwrite = false) {
		return ftp_rename($this->link, $source, $destination);
	}

	function delete($file,$recursive=false) {
		if ( $this->is_file($file) )
			return @ftp_delete($this->link, $file);
		if ( !$recursive )
			return @ftp_rmdir($this->link, $file);
		$filelist = $this->dirlist($file);
		foreach ((array) $filelist as $filename => $fileinfo) {
			$this->delete($file . '/' . $filename, $recursive);
		}
		return @ftp_rmdir($this->link, $file);
	}

	function exists($file) {
		$list = ftp_rawlist($this->link, $file, false);
		if( ! $list )
			return false;
		return count($list) == 1 ? true : false;
	}
	function is_file($file) {
		return $this->is_dir($file) ? false : true;
	}
	function is_dir($path) {
		$cwd = $this->cwd();
		$result = @ftp_chdir($this->link, $path);
		if( $result && $path == $this->cwd() || $this->cwd() != $cwd ) {
			@ftp_chdir($this->link, $cwd);
			return true;
		}
		return false;
	}
	function is_readable($file) {
		//Get dir list, Check if the file is writable by the current user??
		return true;
	}
	function is_writable($file) {
		//Get dir list, Check if the file is writable by the current user??
		return true;
	}
	function atime($file) {
		return false;
	}
	function mtime($file) {
		return ftp_mdtm($this->link, $file);
	}
	function size($file) {
		return ftp_size($this->link, $file);
	}
	function touch($file, $time = 0, $atime = 0) {
		return false;
	}
	function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
		if( !@ftp_mkdir($this->link, $path) )
			return false;
		if( $chmod )
			$this->chmod($path, $chmod);
		if( $chown )
			$this->chown($path, $chown);
		if( $chgrp )
			$this->chgrp($path, $chgrp);
		return true;
	}
	function rmdir($path, $recursive = false) {
		if( ! $recursive )
			return @ftp_rmdir($this->link, $path);

		//TODO: Recursive Directory delete, Have to delete files from the folder first.
		//$dir = $this->dirlist($path);
		//foreach($dir as $file)

	}

	function parselisting($line) {
		$is_windows = ($this->OS_remote == FTP_OS_Windows);
		if ($is_windows && preg_match("/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|<DIR>) +(.+)/", $line, $lucifer)) {
			$b = array();
			if ($lucifer[3]<70) { $lucifer[3] +=2000; } else { $lucifer[3]+=1900; } // 4digit year fix
			$b['isdir'] = ($lucifer[7]=="<DIR>");
			if ( $b['isdir'] )
				$b['type'] = 'd';
			else
				$b['type'] = 'f';
			$b['size'] = $lucifer[7];
			$b['month'] = $lucifer[1];
			$b['day'] = $lucifer[2];
			$b['year'] = $lucifer[3];
			$b['hour'] = $lucifer[4];
			$b['minute'] = $lucifer[5];
			$b['time'] = @mktime($lucifer[4]+(strcasecmp($lucifer[6],"PM")==0?12:0),$lucifer[5],0,$lucifer[1],$lucifer[2],$lucifer[3]);
			$b['am/pm'] = $lucifer[6];
			$b['name'] = $lucifer[8];
		} else if (!$is_windows && $lucifer=preg_split("/[ ]/",$line,9,PREG_SPLIT_NO_EMPTY)) {
			//echo $line."\n";
			$lcount=count($lucifer);
			if ($lcount<8) return '';
			$b = array();
			$b['isdir'] = $lucifer[0]{0} === "d";
			$b['islink'] = $lucifer[0]{0} === "l";
			if ( $b['isdir'] )
				$b['type'] = 'd';
			elseif ( $b['islink'] )
				$b['type'] = 'l';
			else
				$b['type'] = 'f';
			$b['perms'] = $lucifer[0];
			$b['number'] = $lucifer[1];
			$b['owner'] = $lucifer[2];
			$b['group'] = $lucifer[3];
			$b['size'] = $lucifer[4];
			if ($lcount==8) {
				sscanf($lucifer[5],"%d-%d-%d",$b['year'],$b['month'],$b['day']);
				sscanf($lucifer[6],"%d:%d",$b['hour'],$b['minute']);
				$b['time'] = @mktime($b['hour'],$b['minute'],0,$b['month'],$b['day'],$b['year']);
				$b['name'] = $lucifer[7];
			} else {
				$b['month'] = $lucifer[5];
				$b['day'] = $lucifer[6];
				if (preg_match("/([0-9]{2}):([0-9]{2})/",$lucifer[7],$l2)) {
					$b['year'] = date("Y");
					$b['hour'] = $l2[1];
					$b['minute'] = $l2[2];
				} else {
					$b['year'] = $lucifer[7];
					$b['hour'] = 0;
					$b['minute'] = 0;
				}
				$b['time'] = strtotime(sprintf("%d %s %d %02d:%02d",$b['day'],$b['month'],$b['year'],$b['hour'],$b['minute']));
				$b['name'] = $lucifer[8];
			}
		}

		return $b;
	}

	function dirlist($path = '.', $incdot = false, $recursive = false) {
		if( $this->is_file($path) ) {
			$limitFile = basename($path);
			$path = dirname($path) . '/';
		} else {
			$limitFile = false;
		}

		$list = @ftp_rawlist($this->link, '-a ' . $path, false);

		if ( $list === false )
			return false;

		$dirlist = array();
		foreach ( $list as $k => $v ) {
			$entry = $this->parselisting($v);
			if ( empty($entry) )
				continue;

			if ( '.' == $entry["name"] || '..' == $entry["name"] )
				continue;

			$dirlist[ $entry['name'] ] = $entry;
		}

		if ( ! $dirlist )
			return false;
		if ( empty($dirlist) )
			return array();

		$ret = array();
		foreach ( $dirlist as $struc ) {

			if ( 'd' == $struc['type'] ) {
				$struc['files'] = array();

				if ( $incdot ){
					//We're including the doted starts
					if( '.' != $struc['name'] && '..' != $struc['name'] ){ //Ok, It isnt a special folder
						if ($recursive)
							$struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive);
					}
				} else { //No dots
					if ($recursive)
						$struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive);
				}
			}
			//File
			$ret[$struc['name']] = $struc;
		}
		return $ret;
	}

	function __destruct(){
		if( $this->link )
			ftp_close($this->link);
	}
}

?>
                                                                                                                                                                                                                                                                                                                                                                wp-admin/includes/class-wp-filesystem-ftpsockets.php                                                0000755 0023422 0004734 00000016605 11067112426 023746  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress FTP Sockets Filesystem.
 *
 * @package WordPress
 * @subpackage Filesystem
 */

/**
 * WordPress Filesystem Class for implementing FTP Sockets.
 *
 * @since 2.5
 * @package WordPress
 * @subpackage Filesystem
 * @uses WP_Filesystem_Base Extends class
 */
class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
	var $ftp = false;
	var $timeout = 5;
	var $errors;
	var $options = array();

	var $permission = null;

	function WP_Filesystem_ftpsockets($opt = '') {
		$this->method = 'ftpsockets';
		$this->errors = new WP_Error();

		//Check if possible to use ftp functions.
		if( ! @include_once ABSPATH . 'wp-admin/includes/class-ftp.php' )
				return false;
		$this->ftp = new ftp();

		//Set defaults:
		if ( empty($opt['port']) )
			$this->options['port'] = 21;
		else
			$this->options['port'] = $opt['port'];

		if ( empty($opt['hostname']) )
			$this->errors->add('empty_hostname', __('FTP hostname is required'));
		else
			$this->options['hostname'] = $opt['hostname'];

		if ( isset($opt['base']) && ! empty($opt['base']) )
			$this->wp_base = $opt['base'];

		// Check if the options provided are OK.
		if ( empty ($opt['username']) )
			$this->errors->add('empty_username', __('FTP username is required'));
		else
			$this->options['username'] = $opt['username'];

		if ( empty ($opt['password']) )
			$this->errors->add('empty_password', __('FTP password is required'));
		else
			$this->options['password'] = $opt['password'];
	}

	function connect() {
		if ( ! $this->ftp )
			return false;

		//$this->ftp->Verbose = true;

		if ( ! $this->ftp->SetServer($this->options['hostname'], $this->options['port']) ) {
			$this->errors->add('connect', sprintf(__('Failed to connect to FTP Server %1$s:%2$s'), $this->options['hostname'], $this->options['port']));
			return false;
		}
		if ( ! $this->ftp->connect() ) {
			$this->errors->add('connect', sprintf(__('Failed to connect to FTP Server %1$s:%2$s'), $this->options['hostname'], $this->options['port']));
			return false;
		}

		if ( ! $this->ftp->login($this->options['username'], $this->options['password']) ) {
			$this->errors->add('auth', sprintf(__('Username/Password incorrect for %s'), $this->options['username']));
			return false;
		}

		$this->ftp->SetType(FTP_AUTOASCII);
		$this->ftp->Passive(true);
		return true;
	}

	function setDefaultPermissions($perm) {
		$this->permission = $perm;
	}

	function get_contents($file, $type = '', $resumepos = 0) {
		if( ! $this->exists($file) )
			return false;

		if( empty($type) )
			$type = FTP_AUTOASCII;
		$this->ftp->SetType($type);

		$temp = wp_tempnam( $file );

		if ( ! $temphandle = fopen($temp, 'w+') )
			return false;

		if ( ! $this->ftp->fget($temphandle, $file) ) {
			fclose($temphandle);
			unlink($temp);
			return ''; //Blank document, File does exist, Its just blank.
		}

		fseek($temphandle, 0); //Skip back to the start of the file being written to
		$contents = '';

		while ( ! feof($temphandle) )
			$contents .= fread($temphandle, 8192);

		fclose($temphandle);
		unlink($temp);
		return $contents;
	}

	function get_contents_array($file) {
		return explode("\n", $this->get_contents($file) );
	}

	function put_contents($file, $contents, $type = '' ) {
		if( empty($type) )
			$type = $this->is_binary($contents) ? FTP_BINARY : FTP_ASCII;

		$this->ftp->SetType($type);

		$temp = wp_tempnam( $file );
		if ( ! $temphandle = fopen($temp, 'w+') ){
			unlink($temp);
			return false;
		}

		fwrite($temphandle, $contents);
		fseek($temphandle, 0); //Skip back to the start of the file being written to

		$ret = $this->ftp->fput($file, $temphandle);

		fclose($temphandle);
		unlink($temp);
		return $ret;
	}

	function cwd() {
		$cwd = $this->ftp->pwd();
		if( $cwd )
			$cwd = trailingslashit($cwd);
		return $cwd;
	}

	function chdir($file) {
		return $this->ftp->chdir($file);
	}

	function chgrp($file, $group, $recursive = false ) {
		return false;
	}

	function chmod($file, $mode = false, $recursive = false ) {
		if( ! $mode )
			$mode = $this->permission;
		if( ! $mode )
			return false;
		//if( ! $this->exists($file) )
		//	return false;
		if( ! $recursive || ! $this->is_dir($file) ) {
			return $this->ftp->chmod($file,$mode);
		}
		//Is a directory, and we want recursive
		$filelist = $this->dirlist($file);
		foreach($filelist as $filename){
			$this->chmod($file . '/' . $filename, $mode, $recursive);
		}
		return true;
	}

	function chown($file, $owner, $recursive = false ) {
		return false;
	}

	function owner($file) {
		$dir = $this->dirlist($file);
		return $dir[$file]['owner'];
	}

	function getchmod($file) {
		$dir = $this->dirlist($file);
		return $dir[$file]['permsn'];
	}

	function group($file) {
		$dir = $this->dirlist($file);
		return $dir[$file]['group'];
	}

	function copy($source, $destination, $overwrite = false ) {
		if( ! $overwrite && $this->exists($destination) )
			return false;

		$content = $this->get_contents($source);
		if ( false === $content )
			return false;

		return $this->put_contents($destination, $content);
	}

	function move($source, $destination, $overwrite = false ) {
		return $this->ftp->rename($source, $destination);
	}

	function delete($file, $recursive = false ) {
		if ( $this->is_file($file) )
			return $this->ftp->delete($file);
		if ( !$recursive )
			return $this->ftp->rmdir($file);

		return $this->ftp->mdel($file);
	}

	function exists($file) {
		return $this->ftp->is_exists($file);
	}

	function is_file($file) {
		return $this->is_dir($file) ? false : true;
	}

	function is_dir($path) {
		$cwd = $this->cwd();
		if ( $this->chdir($path) ) {
			$this->chdir($cwd);
			return true;
		}
		return false;
	}

	function is_readable($file) {
		//Get dir list, Check if the file is writable by the current user??
		return true;
	}

	function is_writable($file) {
		//Get dir list, Check if the file is writable by the current user??
		return true;
	}

	function atime($file) {
		return false;
	}

	function mtime($file) {
		return $this->ftp->mdtm($file);
	}

	function size($file) {
		return $this->ftp->filesize($file);
	}

	function touch($file, $time = 0, $atime = 0 ) {
		return false;
	}

	function mkdir($path, $chmod = false, $chown = false, $chgrp = false ) {
		if( ! $this->ftp->mkdir($path) )
			return false;
		if( $chmod )
			$this->chmod($path, $chmod);
		if( $chown )
			$this->chown($path, $chown);
		if( $chgrp )
			$this->chgrp($path, $chgrp);
		return true;
	}

	function rmdir($path, $recursive = false ) {
		if( ! $recursive )
			return $this->ftp->rmdir($path);

		return $this->ftp->mdel($path);
	}

	function dirlist($path = '.', $incdot = false, $recursive = false ) {
		if( $this->is_file($path) ) {
			$limitFile = basename($path);
			$path = dirname($path) . '/';
		} else {
			$limitFile = false;
		}

		$list = $this->ftp->dirlist($path);
		if( ! $list )
			return false;
		if( empty($list) )
			return array();

		$ret = array();
		foreach ( $list as $struc ) {

			if ( 'd' == $struc['type'] ) {
				$struc['files'] = array();

				if ( $incdot ){
					//We're including the doted starts
					if( '.' != $struc['name'] && '..' != $struc['name'] ){ //Ok, It isnt a special folder
						if ($recursive)
							$struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive);
					}
				} else { //No dots
					if ($recursive)
						$struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive);
				}
			}
			//File
			$ret[$struc['name']] = $struc;
		}
		return $ret;
	}

	function __destruct() {
		$this->ftp->quit();
	}
}

?>
                                                                                                                           wp-admin/includes/comment.php                                                                       0000755 0023422 0004734 00000010273 11075746364 017322  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress Comment Administration API.
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 * @uses $wpdb
 *
 * @param string $comment_author
 * @param string $comment_date
 * @return mixed Comment ID on success.
 */
function comment_exists($comment_author, $comment_date) {
	global $wpdb;

	return $wpdb->get_var( $wpdb->prepare("SELECT comment_post_ID FROM $wpdb->comments
			WHERE comment_author = %s AND comment_date = %s", $comment_author, $comment_date) );
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 */
function edit_comment() {

	$comment_post_ID = (int) $_POST['comment_post_ID'];

	if (!current_user_can( 'edit_post', $comment_post_ID ))
		wp_die( __('You are not allowed to edit comments on this post, so you cannot edit this comment.' ));

	$_POST['comment_author'] = $_POST['newcomment_author'];
	$_POST['comment_author_email'] = $_POST['newcomment_author_email'];
	$_POST['comment_author_url'] = $_POST['newcomment_author_url'];
	$_POST['comment_approved'] = $_POST['comment_status'];
	$_POST['comment_content'] = $_POST['content'];
	$_POST['comment_ID'] = (int) $_POST['comment_ID'];

	foreach ( array ('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) {
		if ( !empty( $_POST['hidden_' . $timeunit] ) && $_POST['hidden_' . $timeunit] != $_POST[$timeunit] ) {
			$_POST['edit_date'] = '1';
			break;
		}
	}

	if (!empty ( $_POST['edit_date'] ) ) {
		$aa = $_POST['aa'];
		$mm = $_POST['mm'];
		$jj = $_POST['jj'];
		$hh = $_POST['hh'];
		$mn = $_POST['mn'];
		$ss = $_POST['ss'];
		$jj = ($jj > 31 ) ? 31 : $jj;
		$hh = ($hh > 23 ) ? $hh -24 : $hh;
		$mn = ($mn > 59 ) ? $mn -60 : $mn;
		$ss = ($ss > 59 ) ? $ss -60 : $ss;
		$_POST['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
	}

	wp_update_comment( $_POST);
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $id
 * @return unknown
 */
function get_comment_to_edit( $id ) {
	if ( !$comment = get_comment($id) )
		return false;

	$comment->comment_ID = (int) $comment->comment_ID;
	$comment->comment_post_ID = (int) $comment->comment_post_ID;

	$comment->comment_content = format_to_edit( $comment->comment_content );
	$comment->comment_content = apply_filters( 'comment_edit_pre', $comment->comment_content);

	$comment->comment_author = format_to_edit( $comment->comment_author );
	$comment->comment_author_email = format_to_edit( $comment->comment_author_email );
	$comment->comment_author_url = clean_url($comment->comment_author_url);
	$comment->comment_author_url = format_to_edit( $comment->comment_author_url );

	return $comment;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 * @uses $wpdb
 *
 * @param int $post_id Post ID
 * @return unknown
 */
function get_pending_comments_num( $post_id ) {
	global $wpdb;

	$single = false;
	if ( !is_array($post_id) ) {
		$post_id = (array) $post_id;
		$single = true;
	}
	$post_id = array_map('intval', $post_id);
	$post_id = "'" . implode("', '", $post_id) . "'";

	$pending = $wpdb->get_results( "SELECT comment_post_ID, COUNT(comment_ID) as num_comments FROM $wpdb->comments WHERE comment_post_ID IN ( $post_id ) AND comment_approved = '0' GROUP BY comment_post_ID", ARRAY_N );

	if ( empty($pending) )
		return 0;

	if ( $single )
		return $pending[0][1];

	$pending_keyed = array();
	foreach ( $pending as $pend )
		$pending_keyed[$pend[0]] = $pend[1];

	return $pending_keyed;
}

/**
 * Add avatars to relevant places in admin, or try to.
 *
 * @since unknown
 * @uses $comment
 *
 * @param string $name User name.
 * @return string Avatar with Admin name.
 */
function floated_admin_avatar( $name ) {
	global $comment;

	$id = $avatar = false;
	if ( $comment->comment_author_email )
		$id = $comment->comment_author_email;
	if ( $comment->user_id )
		$id = $comment->user_id;

	if ( $id )
		$avatar = get_avatar( $id, 32 );

	return "$avatar $name";
}

function enqueue_comment_hotkeys_js() {
	if ( 'true' == get_user_option( 'comment_shortcuts' ) )
		wp_enqueue_script( 'jquery-table-hotkeys' );
}

if ( is_admin() && ('edit-comments.php' == $pagenow || 'edit.php' == $pagenow) ) {
	if ( get_option('show_avatars') )
		add_filter( 'comment_author', 'floated_admin_avatar' );
}

?>
                                                                                                                                                                                                                                                                                                                                     wp-admin/includes/dashboard.php                                                                     0000755 0023422 0004734 00000103777 11130346704 017605  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress Dashboard Widget Administration Panel API
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * Registers dashboard widgets.
 *
 * handles POST data, sets up filters.
 *
 * @since unknown
 */
function wp_dashboard_setup() {
	global $wp_registered_widgets, $wp_registered_widget_controls, $wp_dashboard_control_callbacks;
	$wp_dashboard_control_callbacks = array();

	$update = false;
	$widget_options = get_option( 'dashboard_widget_options' );
	if ( !$widget_options || !is_array($widget_options) )
		$widget_options = array();

	/* Register Widgets and Controls */

	// Right Now
	wp_add_dashboard_widget( 'dashboard_right_now', __( 'Right Now' ), 'wp_dashboard_right_now' );

	// Recent Comments Widget
	$recent_comments_title = __( 'Recent Comments' );
	wp_add_dashboard_widget( 'dashboard_recent_comments', $recent_comments_title, 'wp_dashboard_recent_comments' );

	// Incoming Links Widget
	if ( !isset( $widget_options['dashboard_incoming_links'] ) || !isset( $widget_options['dashboard_incoming_links']['home'] ) || $widget_options['dashboard_incoming_links']['home'] != get_option('home') ) {
		$update = true;
		$widget_options['dashboard_incoming_links'] = array(
			'home' => get_option('home'),
			'link' => apply_filters( 'dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?hl=en&scoring=d&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
			'url' => apply_filters( 'dashboard_incoming_links_feed', 'http://blogsearch.google.com/blogsearch_feeds?hl=en&scoring=d&ie=utf-8&num=10&output=rss&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
			'items' => isset($widget_options['dashboard_incoming_links']['items']) ? $widget_options['dashboard_incoming_links']['items'] : 10,
			'show_date' => isset($widget_options['dashboard_incoming_links']['show_date']) ? $widget_options['dashboard_incoming_links']['show_date'] : false
		);
	}
	wp_add_dashboard_widget( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_incoming_links', 'wp_dashboard_incoming_links_control' );

	// WP Plugins Widget
	if ( current_user_can( 'activate_plugins' ) )
		wp_add_dashboard_widget( 'dashboard_plugins', __( 'Plugins' ), 'wp_dashboard_plugins' );

	// QuickPress Widget
	if ( current_user_can('edit_posts') )
		wp_add_dashboard_widget( 'dashboard_quick_press', __( 'QuickPress' ), 'wp_dashboard_quick_press' );

	// Recent Drafts
	if ( current_user_can('edit_posts') )
		wp_add_dashboard_widget( 'dashboard_recent_drafts', __('Recent Drafts'), 'wp_dashboard_recent_drafts' );

	// Primary feed (Dev Blog) Widget
	if ( !isset( $widget_options['dashboard_primary'] ) ) {
		$update = true;
		$widget_options['dashboard_primary'] = array(
			'link' => apply_filters( 'dashboard_primary_link',  __( 'http://wordpress.org/development/' ) ),
			'url' => apply_filters( 'dashboard_primary_feed',  __( 'http://wordpress.org/development/feed/' ) ),
			'title' => apply_filters( 'dashboard_primary_title', __( 'WordPress Development Blog' ) ),
			'items' => 2,
			'show_summary' => 1,
			'show_author' => 0,
			'show_date' => 1
		);
	}
	wp_add_dashboard_widget( 'dashboard_primary', $widget_options['dashboard_primary']['title'], 'wp_dashboard_primary', 'wp_dashboard_primary_control' );

	// Secondary Feed (Planet) Widget
	if ( !isset( $widget_options['dashboard_secondary'] ) ) {
		$update = true;
		$widget_options['dashboard_secondary'] = array(
			'link' => apply_filters( 'dashboard_secondary_link',  __( 'http://planet.wordpress.org/' ) ),
			'url' => apply_filters( 'dashboard_secondary_feed',  __( 'http://planet.wordpress.org/feed/' ) ),
			'title' => apply_filters( 'dashboard_secondary_title', __( 'Other WordPress News' ) ),
			'items' => 5
		);
	}
	wp_add_dashboard_widget( 'dashboard_secondary', $widget_options['dashboard_secondary']['title'], 'wp_dashboard_secondary', 'wp_dashboard_secondary_control' );

	// Hook to register new widgets
	do_action( 'wp_dashboard_setup' );

	// Filter widget order
	$dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() );

	foreach ( $dashboard_widgets as $widget_id ) {
		$name = empty( $wp_registered_widgets[$widget_id]['all_link'] ) ? $wp_registered_widgets[$widget_id]['name'] : $wp_registered_widgets[$widget_id]['name'] . " <a href='{$wp_registered_widgets[$widget_id]['all_link']}' class='edit-box open-box'>" . __('View all') . '</a>';
		wp_add_dashboard_widget( $widget_id, $name, $wp_registered_widgets[$widget_id]['callback'], $wp_registered_widget_controls[$widget_id]['callback'] );
	}

	if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget_id']) ) {
		ob_start(); // hack - but the same hack wp-admin/widgets.php uses
		wp_dashboard_trigger_widget_control( $_POST['widget_id'] );
		ob_end_clean();
		wp_redirect( remove_query_arg( 'edit' ) );
		exit;
	}

	if ( $update )
		update_option( 'dashboard_widget_options', $widget_options );

	do_action('do_meta_boxes', 'dashboard', 'normal', '');
	do_action('do_meta_boxes', 'dashboard', 'side', '');
}

function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null ) {
	global $wp_dashboard_control_callbacks;
	if ( $control_callback && current_user_can( 'edit_dashboard' ) && is_callable( $control_callback ) ) {
		$wp_dashboard_control_callbacks[$widget_id] = $control_callback;
		if ( isset( $_GET['edit'] ) && $widget_id == $_GET['edit'] ) {
			list($url) = explode( '#', add_query_arg( 'edit', false ), 2 );
			$widget_name .= ' <span class="postbox-title-action"><a href="' . clean_url( $url ) . '">' . __( 'Cancel' ) . '</a></span>';
			add_meta_box( $widget_id, $widget_name, '_wp_dashboard_control_callback', 'dashboard', 'normal', 'core' );
			return;
		}
		list($url) = explode( '#', add_query_arg( 'edit', $widget_id ), 2 );
		$widget_name .= ' <span class="postbox-title-action"><a href="' . clean_url( "$url#$widget_id" ) . '" class="edit-box open-box">' . __( 'Configure' ) . '</a></span>';
	}
	$side_widgets = array('dashboard_quick_press', 'dashboard_recent_drafts', 'dashboard_primary', 'dashboard_secondary');
	$location = 'normal';
	if ( in_array($widget_id, $side_widgets) )
		$location = 'side';
	add_meta_box( $widget_id, $widget_name , $callback, 'dashboard', $location, 'core' );
}

function _wp_dashboard_control_callback( $dashboard, $meta_box ) {
	echo '<form action="" method="post" class="dashboard-widget-control-form">';
	wp_dashboard_trigger_widget_control( $meta_box['id'] );
	echo "<p class='submit'><input type='hidden' name='widget_id' value='$meta_box[id]' /><input type='submit' value='" . __( 'Submit' ) . "' /></p>";

	echo '</form>';
}

/**
 * Displays the dashboard.
 *
 * @since unknown
 */
function wp_dashboard() {
	echo "<div id='dashboard-widgets' class='metabox-holder'>\n\n";

	echo "<div id='side-info-column' class='inner-sidebar'>\n\n";
	$class = do_meta_boxes( 'dashboard', 'side', '' ) ? ' class="has-sidebar"' : '';
	echo "</div>\n\n";

	echo "<div id='post-body'$class>\n\n";
	echo "<div id='dashboard-widgets-main-content' class='has-sidebar-content'>\n\n";
	do_meta_boxes( 'dashboard', 'normal', '' );
	echo "</div>\n\n";
	echo "</div>\n\n";

	echo "<form style='display: none' method='get' action=''>\n<p>\n";
	wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
	wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
	echo "</p>\n</form>\n";

	echo "</div>";
}

/* Dashboard Widgets */

function wp_dashboard_right_now() {
	$num_posts = wp_count_posts( 'post' );
	$num_pages = wp_count_posts( 'page' );

	$num_cats  = wp_count_terms('category');

	$num_tags = wp_count_terms('post_tag');

	$num_comm = wp_count_comments( );

	echo "\n\t".'<p class="sub">' . __('At a Glance') . '</p>';
	echo "\n\t".'<div class="table">'."\n\t".'<table>';
	echo "\n\t".'<tr class="first">';

	// Posts
	$num = number_format_i18n( $num_posts->publish );
	$text = __ngettext( 'Post', 'Posts', intval($num_posts->publish) );
	if ( current_user_can( 'edit_posts' ) ) {
		$num = "<a href='edit.php'>$num</a>";
		$text = "<a href='edit.php'>$text</a>";
	}
	echo '<td class="first b b-posts">' . $num . '</td>';
	echo '<td class="t posts">' . $text . '</td>';
	/* TODO: Show status breakdown on hover
	if ( $can_edit_pages && !empty($num_pages->publish) ) { // how many pages is not exposed in feeds.  Don't show if !current_user_can
		$post_type_texts[] = '<a href="edit-pages.php">'.sprintf( __ngettext( '%s page', '%s pages', $num_pages->publish ), number_format_i18n( $num_pages->publish ) ).'</a>';
	}
	if ( $can_edit_posts && !empty($num_posts->draft) ) {
		$post_type_texts[] = '<a href="edit.php?post_status=draft">'.sprintf( __ngettext( '%s draft', '%s drafts', $num_posts->draft ), number_format_i18n( $num_posts->draft ) ).'</a>';
	}
	if ( $can_edit_posts && !empty($num_posts->future) ) {
		$post_type_texts[] = '<a href="edit.php?post_status=future">'.sprintf( __ngettext( '%s scheduled post', '%s scheduled posts', $num_posts->future ), number_format_i18n( $num_posts->future ) ).'</a>';
	}
	if ( current_user_can('publish_posts') && !empty($num_posts->pending) ) {
		$pending_text = sprintf( __ngettext( 'There is <a href="%1$s">%2$s post</a> pending your review.', 'There are <a href="%1$s">%2$s posts</a> pending your review.', $num_posts->pending ), 'edit.php?post_status=pending', number_format_i18n( $num_posts->pending ) );
	} else {
		$pending_text = '';
	}
	*/

	// Total Comments
	$num = number_format_i18n($num_comm->total_comments);
	$text = __ngettext( 'Comment', 'Comments', $num_comm->total_comments );
	if ( current_user_can( 'moderate_comments' ) ) {
		$num = "<a href='edit-comments.php'>$num</a>";
		$text = "<a href='edit-comments.php'>$text</a>";
	}
	echo '<td class="b b-comments">' . $num . '</td>';
	echo '<td class="last t comments">' . $text . '</td>';

	echo '</tr><tr>';

	// Pages
	$num = number_format_i18n( $num_pages->publish );
	$text = __ngettext( 'Page', 'Pages', $num_pages->publish );
	if ( current_user_can( 'edit_pages' ) ) {
		$num = "<a href='edit-pages.php'>$num</a>";
		$text = "<a href='edit-pages.php'>$text</a>";
	}
	echo '<td class="first b b_pages">' . $num . '</td>';
	echo '<td class="t pages">' . $text . '</td>';

	// Approved Comments
	$num = number_format_i18n($num_comm->approved);
	$text = __ngettext( 'Approved', 'Approved', $num_comm->approved );
	if ( current_user_can( 'moderate_comments' ) ) {
		$num = "<a href='edit-comments.php?comment_status=approved'>$num</a>";
		$text = "<a class='approved' href='edit-comments.php?comment_status=approved'>$text</a>";
	}
	echo '<td class="b b_approved">' . $num . '</td>';
	echo '<td class="last t">' . $text . '</td>';

	echo "</tr>\n\t<tr>";

	// Categories
	$num = number_format_i18n( $num_cats );
	$text = __ngettext( 'Category', 'Categories', $num_cats );
	if ( current_user_can( 'manage_categories' ) ) {
		$num = "<a href='categories.php'>$num</a>";
		$text = "<a href='categories.php'>$text</a>";
	}
	echo '<td class="first b b-cats">' . $num . '</td>';
	echo '<td class="t cats">' . $text . '</td>';

	// Pending Comments
	$num = number_format_i18n($num_comm->moderated);
	$text = __ngettext( 'Pending', 'Pending', $num_comm->moderated );
	if ( current_user_can( 'moderate_comments' ) ) {
		$num = "<a href='edit-comments.php?comment_status=moderated'><span class='pending-count'>$num</span></a>";
		$text = "<a class='waiting' href='edit-comments.php?comment_status=moderated'>$text</a>";
	}
	echo '<td class="b b-waiting">' . $num . '</td>';
	echo '<td class="last t">' . $text . '</td>';

	echo "</tr>\n\t<tr>";

	// Tags
	$num = number_format_i18n( $num_tags );
	$text = __ngettext( 'Tag', 'Tags', $num_tags );
	if ( current_user_can( 'manage_categories' ) ) {
		$num = "<a href='edit-tags.php'>$num</a>";
		$text = "<a href='edit-tags.php'>$text</a>";
	}
	echo '<td class="first b b-tags">' . $num . '</td>';
	echo '<td class="t tags">' . $text . '</td>';

	// Spam Comments
	$num = number_format_i18n($num_comm->spam);
	$text = __ngettext( 'Spam', 'Spam', $num_comm->spam );
	if ( current_user_can( 'moderate_comments' ) ) {
		$num = "<a href='edit-comments.php?comment_status=spam'><span class='spam-count'>$num</span></a>";
		$text = "<a class='spam' href='edit-comments.php?comment_status=spam'>$text</a>";
	}
	echo '<td class="b b-spam">' . $num . '</td>';
	echo '<td class="last t">' . $text . '</td>';

	echo "</tr>";
	do_action('right_now_table_end');
	echo "\n\t</table>\n\t</div>";

	echo "\n\t".'<div class="versions">';
	$ct = current_theme_info();
	$sidebars_widgets = wp_get_sidebars_widgets();
	$num_widgets = array_reduce( $sidebars_widgets, create_function( '$prev, $curr', 'return $prev+count($curr);' ), 0 );
	$num = number_format_i18n( $num_widgets );

	echo "\n\t<p>";
	if ( current_user_can( 'switch_themes' ) ) {
		echo '<a href="themes.php" class="button rbutton">' . __('Change Theme') . '</a>';
		printf(__ngettext('Theme <span class="b"><a href="themes.php">%1$s</a></span> with <span class="b"><a href="widgets.php">%2$s Widget</a></span>', 'Theme <span class="b"><a href="themes.php">%1$s</a></span> with <span class="b"><a href="widgets.php">%2$s Widgets</a></span>', $num_widgets), $ct->title, $num);
	} else {
		printf(__ngettext('Theme <span class="b">%1$s</span> with <span class="b">%2$s Widget</span>', 'Theme <span class="b">%1$s</span> with <span class="b">%2$s Widgets</span>', $num_widgets), $ct->title, $num);
	}

	echo '</p>';

	update_right_now_message();

	echo "\n\t".'<br class="clear" /></div>';
	do_action( 'rightnow_end' );
	do_action( 'activity_box_end' );
}

function wp_dashboard_quick_press() {
	$drafts = false;
	if ( 'post' === strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['action'] ) && 0 === strpos( $_POST['action'], 'post-quickpress' ) && (int) $_POST['post_ID'] ) {
		$view = get_permalink( $_POST['post_ID'] );
		$edit = clean_url( get_edit_post_link( $_POST['post_ID'] ) );
		if ( 'post-quickpress-publish' == $_POST['action'] ) {
			if ( current_user_can('publish_posts') )
				printf( '<div class="message"><p>' . __( 'Post Published. <a href="%s">View post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', clean_url( $view ), $edit );
			else
				printf( '<div class="message"><p>' . __( 'Post submitted. <a href="%s">Preview post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', clean_url( add_query_arg( 'preview', 1, $view ) ), $edit );
		} else {
			printf( '<div class="message"><p>' . __( 'Draft Saved. <a href="%s">Preview post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', clean_url( add_query_arg( 'preview', 1, $view ) ), $edit );
			$drafts_query = new WP_Query( array(
				'post_type' => 'post',
				'what_to_show' => 'posts',
				'post_status' => 'draft',
				'author' => $GLOBALS['current_user']->ID,
				'posts_per_page' => 1,
				'orderby' => 'modified',
				'order' => 'DESC'
			) );

			if ( $drafts_query->posts )
				$drafts =& $drafts_query->posts;
		}
		printf('<p class="textright">' . __('You can also try %s, easy blogging from anywhere on the Web.') . '</p>', '<a href="tools.php">' . __('Press This') . '</a>' );
		$_REQUEST = array(); // hack for get_default_post_to_edit()
	}

	$post = get_default_post_to_edit();
?>

	<form name="post" action="<?php echo clean_url( admin_url( 'post.php' ) ); ?>" method="post" id="quick-press">
		<h4 id="quick-post-title"><label for="title"><?php _e('Title') ?></label></h4>
		<div class="input-text-wrap">
			<input type="text" name="post_title" id="title" tabindex="1" autocomplete="off" value="<?php echo attribute_escape( $post->post_title ); ?>" />
		</div>

		<?php if ( current_user_can( 'upload_files' ) ) : ?>
		<div id="media-buttons" class="hide-if-no-js">
			<?php do_action( 'media_buttons' ); ?>
		</div>
		<?php endif; ?>

		<h4 id="content-label"><label for="content"><?php _e('Content') ?></label></h4>
		<div class="textarea-wrap">
			<textarea name="content" id="content" class="mceEditor" rows="3" cols="15" tabindex="2"><?php echo $post->post_content; ?></textarea>
		</div>

		<script type="text/javascript">edCanvas = document.getElementById('content');edInsertContent = null;</script>

		<h4><label for="tags-input"><?php _e('Tags') ?></label></h4>
		<div class="input-text-wrap">
			<input type="text" name="tags_input" id="tags-input" tabindex="3" value="<?php echo get_tags_to_edit( $post->ID ); ?>" />
		</div>

		<p class="submit">
			<input type="hidden" name="action" id="quickpost-action" value="post-quickpress-save" />
			<input type="hidden" name="quickpress_post_ID" value="<?php echo (int) $post->ID; ?>" />
			<?php wp_nonce_field('add-post'); ?>
			<input type="submit" name="save" id="save-post" class="button" tabindex="4" value="<?php _e('Save Draft'); ?>" />
			<input type="reset" value="<?php _e( 'Cancel' ); ?>" class="cancel" />
			<?php if ( current_user_can('publish_posts') ) { ?>
			<input type="submit" name="publish" id="publish" accesskey="p" tabindex="5" class="button-primary" value="<?php _e('Publish'); ?>" />
			<?php } else { ?>
			<input type="submit" name="publish" id="publish" accesskey="p" tabindex="5" class="button-primary" value="<?php _e('Submit for Review'); ?>" />
			<?php } ?>
			<br class="clear" />
		</p>

	</form>

<?php
	if ( $drafts )
		wp_dashboard_recent_drafts( $drafts );
}

function wp_dashboard_recent_drafts( $drafts = false ) {
	if ( !$drafts ) {
		$drafts_query = new WP_Query( array(
			'post_type' => 'post',
			'what_to_show' => 'posts',
			'post_status' => 'draft',
			'author' => $GLOBALS['current_user']->ID,
			'posts_per_page' => 5,
			'orderby' => 'modified',
			'order' => 'DESC'
		) );
		$drafts =& $drafts_query->posts;
	}

	if ( $drafts && is_array( $drafts ) ) {
		$list = array();
		foreach ( $drafts as $draft ) {
			$url = get_edit_post_link( $draft->ID );
			$title = _draft_or_post_title( $draft->ID );
			$item = "<h4><a href='$url' title='" . sprintf( __( 'Edit "%s"' ), attribute_escape( $title ) ) . "'>$title</a> <abbr title='" . get_the_time(__('Y/m/d g:i:s A'), $draft) . "'>" . get_the_time( get_option( 'date_format' ), $draft ) . '</abbr></h4>';
			if ( $the_content = preg_split( '#\s#', strip_tags( $draft->post_content ), 11, PREG_SPLIT_NO_EMPTY ) )
				$item .= '<p>' . join( ' ', array_slice( $the_content, 0, 10 ) ) . ( 10 < count( $the_content ) ? '&hellip;' : '' ) . '</p>';
			$list[] = $item;
		}
?>
	<ul>
		<li><?php echo join( "</li>\n<li>", $list ); ?></li>
	</ul>
	<p class="textright"><a href="edit.php?post_status=draft" class="button"><?php _e('View all'); ?></a></p>
<?php
	} else {
		_e('There are no drafts at the moment');
	}
}

/**
 * Display recent comments dashboard widget content.
 *
 * @since unknown
 */
function wp_dashboard_recent_comments() {
	global $wpdb;

	if ( current_user_can('edit_posts') )
		$allowed_states = array('0', '1');
	else
		$allowed_states = array('1');

	// Select all comment types and filter out spam later for better query performance.
	$comments = array();
	$start = 0;

	while ( count( $comments ) < 5 && $possible = $wpdb->get_results( "SELECT * FROM $wpdb->comments ORDER BY comment_date_gmt DESC LIMIT $start, 50" ) ) {

		foreach ( $possible as $comment ) {
			if ( count( $comments ) >= 5 )
				break;
			if ( in_array( $comment->comment_approved, $allowed_states ) )
				$comments[] = $comment;
		}

		$start = $start + 50;
	}

	if ( $comments ) :
?>

		<div id="the-comment-list" class="list:comment">
<?php
		foreach ( $comments as $comment )
			_wp_dashboard_recent_comments_row( $comment );
?>

		</div>

<?php
		if ( current_user_can('edit_posts') ) { ?>
			<p class="textright"><a href="edit-comments.php" class="button"><?php _e('View all'); ?></a></p>
<?php	}

		wp_comment_reply( -1, false, 'dashboard', false );

	else :
?>

	<p><?php _e( 'No comments yet.' ); ?></p>

<?php
	endif; // $comments;
}

function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
	$GLOBALS['comment'] =& $comment;

	$comment_post_url = get_edit_post_link( $comment->comment_post_ID );
	$comment_post_title = get_the_title( $comment->comment_post_ID );
	$comment_post_link = "<a href='$comment_post_url'>$comment_post_title</a>";
	$comment_link = '<a class="comment-link" href="' . get_comment_link() . '">#</a>';

	$delete_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
	$approve_url = clean_url( wp_nonce_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "approve-comment_$comment->comment_ID" ) );
	$unapprove_url = clean_url( wp_nonce_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "unapprove-comment_$comment->comment_ID" ) );
	$spam_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );

	$actions = array();

	$actions_string = '';
	if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
		$actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
		$actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
		$actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a>';
		//$actions['quickedit'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$comment->comment_post_ID.'\',\'edit\');return false;" class="vim-q" title="'.__('Quick Edit').'" href="#">' . __('Quick&nbsp;Edit') . '</a>';
		$actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$comment->comment_post_ID.'\');return false;" class="vim-r hide-if-no-js" title="'.__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';
		$actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . __( 'Mark this comment as spam' ) . "'>" . _c( 'Spam|verb' ) . '</a>';
		$actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Delete') . '</a>';

		$actions = apply_filters( 'comment_row_actions', $actions, $comment );

		$i = 0;
		foreach ( $actions as $action => $link ) {
			++$i;
			( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';

			// Reply and quickedit need a hide-if-no-js span
			if ( 'reply' == $action || 'quickedit' == $action )
				$action .= ' hide-if-no-js';

			$actions_string .= "<span class='$action'>$sep$link</span>";
		}
	}

?>

		<div id="comment-<?php echo $comment->comment_ID; ?>" <?php comment_class( array( 'comment-item', wp_get_comment_status($comment->comment_ID) ) ); ?>>
			<?php if ( !$comment->comment_type || 'comment' == $comment->comment_type ) : ?>

			<?php echo get_avatar( $comment, 50 ); ?>
			<h4 class="comment-meta"><?php printf( __( 'From %1$s on %2$s%3$s' ), '<cite class="comment-author">' . get_comment_author_link() . '</cite>', $comment_post_link." ".$comment_link, ' <span class="approve">' . __( '[Pending]' ) . '</span>' ); ?></h4>

			<?php
			else :
				switch ( $comment->comment_type ) :
				case 'pingback' :
					$type = __( 'Pingback' );
					break;
				case 'trackback' :
					$type = __( 'Trackback' );
					break;
				default :
					$type = ucwords( $comment->comment_type );
				endswitch;
				$type = wp_specialchars( $type );
			?>

			<h4 class="comment-meta"><?php printf( __( '%1$s on %2$s' ), "<strong>$type</strong>", $comment_post_link ); ?></h4>
			<p class="comment-author"><?php comment_author_link(); ?></p>

			<?php endif; // comment_type ?>
			<blockquote><p><?php comment_excerpt(); ?></p></blockquote>
			<p class="row-actions"><?php echo $actions_string; ?></p>

			<div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
				<textarea class="comment" rows="3" cols="10"><?php echo $comment->comment_content; ?></textarea>
				<div class="author-email"><?php echo attribute_escape( $comment->comment_author_email ); ?></div>
				<div class="author"><?php echo attribute_escape( $comment->comment_author ); ?></div>
				<div class="author-url"><?php echo attribute_escape( $comment->comment_author_url ); ?></div>
				<div class="comment_status"><?php echo $comment->comment_approved; ?></div>
			</div>

		</div>
<?php
}

function wp_dashboard_incoming_links() {
	wp_dashboard_cached_rss_widget( 'dashboard_incoming_links', 'wp_dashboard_incoming_links_output' );
}

/**
 * Display incoming links dashboard widget content.
 *
 * @since unknown
 */
function wp_dashboard_incoming_links_output() {
	$widgets = get_option( 'dashboard_widget_options' );
	@extract( @$widgets['dashboard_incoming_links'], EXTR_SKIP );
	$rss = @fetch_rss( $url );
	if ( isset($rss->items) && 0 < count($rss->items) )  {

		echo "<ul>\n";

		$rss->items = array_slice($rss->items, 0, $items);
		foreach ( $rss->items as $item ) {
			$publisher = '';
			$site_link = '';
			$link = '';
			$content = '';
			$date = '';
			$link = clean_url( strip_tags( $item['link'] ) );

			if ( isset( $item['author_uri'] ) )
				$site_link = clean_url( strip_tags( $item['author_uri'] ) );

			if ( !$publisher = wp_specialchars( strip_tags( isset($item['dc']['publisher']) ? $item['dc']['publisher'] : $item['author_name'] ) ) )
				$publisher = __( 'Somebody' );
			if ( $site_link )
				$publisher = "<a href='$site_link'>$publisher</a>";
			else
				$publisher = "<strong>$publisher</strong>";

			if ( isset($item['description']) )
				$content = $item['description'];
			elseif ( isset($item['summary']) )
				$content = $item['summary'];
			elseif ( isset($item['atom_content']) )
				$content = $item['atom_content'];
			else
				$content = __( 'something' );
			$content = wp_html_excerpt($content, 50) . ' ...';
			if ( $link )
				$text = _c( '%1$s linked here <a href="%2$s">saying</a>, "%3$s"|feed_display' );
			else
				$text = _c( '%1$s linked here saying, "%3$s"|feed_display' );

			if ( $show_date ) {
				if ( $show_author || $show_summary )
					$text .= _c( ' on %4$s|feed_display' );
				$date = wp_specialchars( strip_tags( isset($item['pubdate']) ? $item['pubdate'] : $item['published'] ) );
				$date = strtotime( $date );
				$date = gmdate( get_option( 'date_format' ), $date );
			}

			echo "\t<li>" . sprintf( _c( "$text|feed_display" ), $publisher, $link, $content, $date ) . "</li>\n";
		}

		echo "</ul>\n";

	} else {
		echo '<p>' . __('This dashboard widget queries <a href="http://blogsearch.google.com/">Google Blog Search</a> so that when another blog links to your site it will show up here. It has found no incoming links&hellip; yet. It&#8217;s okay &#8212; there is no rush.') . "</p>\n";
	}
}

function wp_dashboard_incoming_links_control() {
	wp_dashboard_rss_control( 'dashboard_incoming_links', array( 'title' => false, 'show_summary' => false, 'show_author' => false ) );
}

function wp_dashboard_primary() {
	wp_dashboard_cached_rss_widget( 'dashboard_primary', 'wp_dashboard_rss_output' );
}

function wp_dashboard_primary_control() {
	wp_dashboard_rss_control( 'dashboard_primary' );
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param int $widget_id
 */
function wp_dashboard_rss_output( $widget_id ) {
	$widgets = get_option( 'dashboard_widget_options' );
	echo "<div class='rss-widget'>";
	wp_widget_rss_output( $widgets[$widget_id] );
	echo "</div>";
}

function wp_dashboard_secondary() {
	wp_dashboard_cached_rss_widget( 'dashboard_secondary', 'wp_dashboard_secondary_output' );
}

function wp_dashboard_secondary_control() {
	wp_dashboard_rss_control( 'dashboard_secondary' );
}

/**
 * Display secondary dashboard RSS widget feed.
 *
 * @since unknown
 *
 * @return unknown
 */
function wp_dashboard_secondary_output() {
	$widgets = get_option( 'dashboard_widget_options' );
	@extract( @$widgets['dashboard_secondary'], EXTR_SKIP );
	$rss = @fetch_rss( $url );

	if ( !isset($rss->items) || 0 == count($rss->items) )
		return false;

	$rss->items = array_slice($rss->items, 0, $items);

	if ( 'http://planet.wordpress.org/' == $rss->channel['link'] ) {
		foreach ( array_keys($rss->items) as $i ) {
			list($site, $description) = explode( ':', wp_specialchars($rss->items[$i]['title']), 2 );
			$rss->items[$i]['dc']['creator'] = trim($site);
			$rss->items[$i]['title'] = trim($description);
		}
	}

	echo "<div class='rss-widget'>";
	wp_widget_rss_output( $rss, $widgets['dashboard_secondary'] );
	echo "</div>";
}

function wp_dashboard_plugins() {
	wp_dashboard_cached_rss_widget( 'dashboard_plugins', 'wp_dashboard_plugins_output', array(
		'http://wordpress.org/extend/plugins/rss/browse/popular/',
		'http://wordpress.org/extend/plugins/rss/browse/new/',
		'http://wordpress.org/extend/plugins/rss/browse/updated/'
	) );
}

/**
 * Display plugins most popular, newest plugins, and recently updated widget text.
 *
 * @since unknown
 */
function wp_dashboard_plugins_output() {
	$popular = @fetch_rss( 'http://wordpress.org/extend/plugins/rss/browse/popular/' );
	$new     = @fetch_rss( 'http://wordpress.org/extend/plugins/rss/browse/new/' );
	$updated = @fetch_rss( 'http://wordpress.org/extend/plugins/rss/browse/updated/' );

	foreach ( array( 'popular' => __('Most Popular'), 'new' => __('Newest Plugins'), 'updated' => __('Recently Updated') ) as $feed => $label ) {
		if ( !isset($$feed->items) || 0 == count($$feed->items) )
			continue;

		$$feed->items = array_slice($$feed->items, 0, 5);
		$item_key = array_rand($$feed->items);

		// Eliminate some common badly formed plugin descriptions
		while ( ( null !== $item_key = array_rand($$feed->items) ) && false !== strpos( $$feed->items[$item_key]['description'], 'Plugin Name:' ) )
			unset($$feed->items[$item_key]);

		if ( !isset($$feed->items[$item_key]) )
			continue;

		$item = $$feed->items[$item_key];

		// current bbPress feed item titles are: user on "topic title"
		if ( preg_match( '/"(.*)"/s', $item['title'], $matches ) )
			$title = $matches[1];
		else // but let's make it forward compatible if things change
			$title = $item['title'];
		$title = wp_specialchars( $title );

		$description = wp_specialchars( strip_tags(html_entity_decode($item['description'], ENT_QUOTES)) );

		list($link, $frag) = explode( '#', $item['link'] );

		$link = clean_url($link);
		if( preg_match('|/([^/]+?)/?$|', $link, $matches) )
			$slug = $matches[1];
		else
			$slug = '';

		$ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) .
							'&amp;TB_iframe=true&amp;width=600&amp;height=800';

		echo "<h4>$label</h4>\n";
		echo "<h5><a href='$link'>$title</a></h5>&nbsp;<span>(<a href='$ilink' class='thickbox' title='$title'>" . __( 'Install' ) . "</a>)</span>\n";
		echo "<p>$description</p>\n";
	}
}

/**
 * Checks to see if all of the feed url in $check_urls are cached.
 *
 * If $check_urls is empty, look for the rss feed url found in the dashboard
 * widget optios of $widget_id. If cached, call $callback, a function that
 * echoes out output for this widget. If not cache, echo a "Loading..." stub
 * which is later replaced by AJAX call (see top of /wp-admin/index.php)
 *
 * @since unknown
 *
 * @param int $widget_id
 * @param callback $callback
 * @param array $check_urls RSS feeds
 * @return bool False on failure. True on success.
 */
function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array() ) {
	$loading = '<p class="widget-loading">' . __( 'Loading&#8230;' ) . '</p>';

	if ( empty($check_urls) ) {
		$widgets = get_option( 'dashboard_widget_options' );
		if ( empty($widgets[$widget_id]['url']) ) {
			echo $loading;
			return false;
		}
		$check_urls = array( $widgets[$widget_id]['url'] );
	}


	require_once( ABSPATH . WPINC . '/rss.php' );
	init(); // initialize rss constants

	$cache = new RSSCache( MAGPIE_CACHE_DIR, MAGPIE_CACHE_AGE );

	foreach ( $check_urls as $check_url ) {
		$status = $cache->check_cache( $check_url );
		if ( 'HIT' !== $status ) {
			echo $loading;
			return false;
		}
	}

	if ( $callback && is_callable( $callback ) ) {
		$args = array_slice( func_get_args(), 2 );
		array_unshift( $args, $widget_id );
		call_user_func_array( $callback, $args );
	}

	return true;
}

/* Dashboard Widgets Controls */

// Calls widget_control callback
/**
 * Calls widget control callback.
 *
 * @since unknown
 *
 * @param int $widget_control_id Registered Widget ID.
 */
function wp_dashboard_trigger_widget_control( $widget_control_id = false ) {
	global $wp_dashboard_control_callbacks;

	if ( is_scalar($widget_control_id) && $widget_control_id && isset($wp_dashboard_control_callbacks[$widget_control_id]) && is_callable($wp_dashboard_control_callbacks[$widget_control_id]) ) {
		call_user_func( $wp_dashboard_control_callbacks[$widget_control_id], '', array( 'id' => $widget_control_id, 'callback' => $wp_dashboard_control_callbacks[$widget_control_id] ) );
	}
}

/**
 * The RSS dashboard widget control.
 *
 * Sets up $args to be used as input to wp_widget_rss_form(). Handles POST data
 * from RSS-type widgets.
 *
 * @since unknown
 *
 * @param string widget_id
 * @param array form_inputs
 */
function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) {
	if ( !$widget_options = get_option( 'dashboard_widget_options' ) )
		$widget_options = array();

	if ( !isset($widget_options[$widget_id]) )
		$widget_options[$widget_id] = array();

	$number = 1; // Hack to use wp_widget_rss_form()
	$widget_options[$widget_id]['number'] = $number;

	if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget-rss'][$number]) ) {
		$_POST['widget-rss'][$number] = stripslashes_deep( $_POST['widget-rss'][$number] );
		$widget_options[$widget_id] = wp_widget_rss_process( $_POST['widget-rss'][$number] );
		// title is optional.  If black, fill it if possible
		if ( !$widget_options[$widget_id]['title'] && isset($_POST['widget-rss'][$number]['title']) ) {
			require_once(ABSPATH . WPINC . '/rss.php');
			$rss = fetch_rss($widget_options[$widget_id]['url']);
			$widget_options[$widget_id]['title'] = htmlentities(strip_tags($rss->channel['title']));
		}
		update_option( 'dashboard_widget_options', $widget_options );
	}

	wp_widget_rss_form( $widget_options[$widget_id], $form_inputs );
}

/**
 * Empty function usable by plugins to output empty dashboard widget (to be populated later by JS).
 */
function wp_dashboard_empty() {}

?>
 wp-admin/includes/export.php                                                                        0000755 0023422 0004734 00000026172 11116037270 017167  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress Export Administration API
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * Version number for the export format.
 *
 * Bump this when something changes that might affect compatibility.
 *
 * @since unknown
 * @var string
 */
define('WXR_VERSION', '1.0');

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $author
 */
function export_wp($author='') {
global $wpdb, $post_ids, $post;

do_action('export_wp');

$filename = 'wordpress.' . date('Y-m-d') . '.xml';

header('Content-Description: File Transfer');
header("Content-Disposition: attachment; filename=$filename");
header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);

$where = '';
if ( $author and $author != 'all' ) {
	$author_id = (int) $author;
	$where = $wpdb->prepare(" WHERE post_author = %d ", $author_id);
}

// grab a snapshot of post IDs, just in case it changes during the export
$post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts $where ORDER BY post_date_gmt ASC");

$categories = (array) get_categories('get=all');
$tags = (array) get_tags('get=all');

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $categories
 */
function wxr_missing_parents($categories) {
	if ( !is_array($categories) || empty($categories) )
		return array();

	foreach ( $categories as $category )
		$parents[$category->term_id] = $category->parent;

	$parents = array_unique(array_diff($parents, array_keys($parents)));

	if ( $zero = array_search('0', $parents) )
		unset($parents[$zero]);

	return $parents;
}

while ( $parents = wxr_missing_parents($categories) ) {
	$found_parents = get_categories("include=" . join(', ', $parents));
	if ( is_array($found_parents) && count($found_parents) )
		$categories = array_merge($categories, $found_parents);
	else
		break;
}

// Put them in order to be inserted with no child going before its parent
$pass = 0;
$passes = 1000 + count($categories);
while ( ( $cat = array_shift($categories) ) && ++$pass < $passes ) {
	if ( $cat->parent == 0 || isset($cats[$cat->parent]) ) {
		$cats[$cat->term_id] = $cat;
	} else {
		$categories[] = $cat;
	}
}
unset($categories);

/**
 * Place string in CDATA tag.
 *
 * @since unknown
 *
 * @param string $str String to place in XML CDATA tag.
 */
function wxr_cdata($str) {
	if ( seems_utf8($str) == false )
		$str = utf8_encode($str);

	// $str = ent2ncr(wp_specialchars($str));

	$str = "<![CDATA[$str" . ( ( substr($str, -1) == ']' ) ? ' ' : '') . "]]>";

	return $str;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @return string Site URL.
 */
function wxr_site_url() {
	global $current_site;

	// mu: the base url
	if ( isset($current_site->domain) ) {
		return 'http://'.$current_site->domain.$current_site->path;
	}
	// wp: the blog url
	else {
		return get_bloginfo_rss('url');
	}
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param object $c Category Object
 */
function wxr_cat_name($c) {
	if ( empty($c->name) )
		return;

	echo '<wp:cat_name>' . wxr_cdata($c->name) . '</wp:cat_name>';
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param object $c Category Object
 */
function wxr_category_description($c) {
	if ( empty($c->description) )
		return;

	echo '<wp:category_description>' . wxr_cdata($c->description) . '</wp:category_description>';
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param object $t Tag Object
 */
function wxr_tag_name($t) {
	if ( empty($t->name) )
		return;

	echo '<wp:tag_name>' . wxr_cdata($t->name) . '</wp:tag_name>';
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param object $t Tag Object
 */
function wxr_tag_description($t) {
	if ( empty($t->description) )
		return;

	echo '<wp:tag_description>' . wxr_cdata($t->description) . '</wp:tag_description>';
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 */
function wxr_post_taxonomy() {
	$categories = get_the_category();
	$tags = get_the_tags();
	$the_list = '';
	$filter = 'rss';

	if ( !empty($categories) ) foreach ( (array) $categories as $category ) {
		$cat_name = sanitize_term_field('name', $category->name, $category->term_id, 'category', $filter);
		// for backwards compatibility
		$the_list .= "\n\t\t<category><![CDATA[$cat_name]]></category>\n";
		// forwards compatibility: use a unique identifier for each cat to avoid clashes
		// http://trac.wordpress.org/ticket/5447
		$the_list .= "\n\t\t<category domain=\"category\" nicename=\"{$category->slug}\"><![CDATA[$cat_name]]></category>\n";
	}

	if ( !empty($tags) ) foreach ( (array) $tags as $tag ) {
		$tag_name = sanitize_term_field('name', $tag->name, $tag->term_id, 'post_tag', $filter);
		$the_list .= "\n\t\t<category domain=\"tag\"><![CDATA[$tag_name]]></category>\n";
		// forwards compatibility as above
		$the_list .= "\n\t\t<category domain=\"tag\" nicename=\"{$tag->slug}\"><![CDATA[$tag_name]]></category>\n";
	}

	echo $the_list;
}

echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";

?>
<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your blog. -->
<!-- It contains information about your blog's posts, comments, and categories. -->
<!-- You may use this file to transfer that content from one site to another. -->
<!-- This file is not intended to serve as a complete backup of your blog. -->

<!-- To import this information into a WordPress blog follow these steps. -->
<!-- 1. Log into that blog as an administrator. -->
<!-- 2. Go to Tools: Import in the blog's admin panels (or Manage: Import in older versions of WordPress). -->
<!-- 3. Choose "WordPress" from the list. -->
<!-- 4. Upload this file using the form provided on that page. -->
<!-- 5. You will first be asked to map the authors in this export file to users -->
<!--    on the blog.  For each author, you may choose to map to an -->
<!--    existing user on the blog or to create a new user -->
<!-- 6. WordPress will then import each of the posts, comments, and categories -->
<!--    contained in this file into your blog -->

<?php the_generator('export');?>
<rss version="2.0"
	xmlns:excerpt="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/excerpt/"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:wp="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/"
>

<channel>
	<title><?php bloginfo_rss('name'); ?></title>
	<link><?php bloginfo_rss('url') ?></link>
	<description><?php bloginfo_rss("description") ?></description>
	<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
	<generator>http://wordpress.org/?v=<?php bloginfo_rss('version'); ?></generator>
	<language><?php echo get_option('rss_language'); ?></language>
	<wp:wxr_version><?php echo WXR_VERSION; ?></wp:wxr_version>
	<wp:base_site_url><?php echo wxr_site_url(); ?></wp:base_site_url>
	<wp:base_blog_url><?php bloginfo_rss('url'); ?></wp:base_blog_url>
<?php if ( $cats ) : foreach ( $cats as $c ) : ?>
	<wp:category><wp:category_nicename><?php echo $c->slug; ?></wp:category_nicename><wp:category_parent><?php echo $c->parent ? $cats[$c->parent]->name : ''; ?></wp:category_parent><?php wxr_cat_name($c); ?><?php wxr_category_description($c); ?></wp:category>
<?php endforeach; endif; ?>
<?php if ( $tags ) : foreach ( $tags as $t ) : ?>
	<wp:tag><wp:tag_slug><?php echo $t->slug; ?></wp:tag_slug><?php wxr_tag_name($t); ?><?php wxr_tag_description($t); ?></wp:tag>
<?php endforeach; endif; ?>
	<?php do_action('rss2_head'); ?>
	<?php if ($post_ids) {
		global $wp_query;
		$wp_query->in_the_loop = true;  // Fake being in the loop.
		// fetch 20 posts at a time rather than loading the entire table into memory
		while ( $next_posts = array_splice($post_ids, 0, 20) ) {
			$where = "WHERE ID IN (".join(',', $next_posts).")";
			$posts = $wpdb->get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_date_gmt ASC");
				foreach ($posts as $post) {
			// Don't export revisions.  They bloat the export.
			if ( 'revision' == $post->post_type )
				continue;
			setup_postdata($post); ?>
<item>
<title><?php echo apply_filters('the_title_rss', $post->post_title); ?></title>
<link><?php the_permalink_rss() ?></link>
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
<dc:creator><?php echo wxr_cdata(get_the_author()); ?></dc:creator>
<?php wxr_post_taxonomy() ?>

<guid isPermaLink="false"><?php the_guid(); ?></guid>
<description></description>
<content:encoded><?php echo wxr_cdata( apply_filters('the_content_export', $post->post_content) ); ?></content:encoded>
<excerpt:encoded><?php echo wxr_cdata( apply_filters('the_excerpt_export', $post->post_excerpt) ); ?></excerpt:encoded>
<wp:post_id><?php echo $post->ID; ?></wp:post_id>
<wp:post_date><?php echo $post->post_date; ?></wp:post_date>
<wp:post_date_gmt><?php echo $post->post_date_gmt; ?></wp:post_date_gmt>
<wp:comment_status><?php echo $post->comment_status; ?></wp:comment_status>
<wp:ping_status><?php echo $post->ping_status; ?></wp:ping_status>
<wp:post_name><?php echo $post->post_name; ?></wp:post_name>
<wp:status><?php echo $post->post_status; ?></wp:status>
<wp:post_parent><?php echo $post->post_parent; ?></wp:post_parent>
<wp:menu_order><?php echo $post->menu_order; ?></wp:menu_order>
<wp:post_type><?php echo $post->post_type; ?></wp:post_type>
<wp:post_password><?php echo $post->post_password; ?></wp:post_password>
<?php
if ($post->post_type == 'attachment') { ?>
<wp:attachment_url><?php echo wp_get_attachment_url($post->ID); ?></wp:attachment_url>
<?php } ?>
<?php
$postmeta = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID) );
if ( $postmeta ) {
?>
<?php foreach( $postmeta as $meta ) { ?>
<wp:postmeta>
<wp:meta_key><?php echo $meta->meta_key; ?></wp:meta_key>
<wp:meta_value><?Php echo $meta->meta_value; ?></wp:meta_value>
</wp:postmeta>
<?php } ?>
<?php } ?>
<?php
$comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d", $post->ID) );
if ( $comments ) { foreach ( $comments as $c ) { ?>
<wp:comment>
<wp:comment_id><?php echo $c->comment_ID; ?></wp:comment_id>
<wp:comment_author><?php echo wxr_cdata($c->comment_author); ?></wp:comment_author>
<wp:comment_author_email><?php echo $c->comment_author_email; ?></wp:comment_author_email>
<wp:comment_author_url><?php echo $c->comment_author_url; ?></wp:comment_author_url>
<wp:comment_author_IP><?php echo $c->comment_author_IP; ?></wp:comment_author_IP>
<wp:comment_date><?php echo $c->comment_date; ?></wp:comment_date>
<wp:comment_date_gmt><?php echo $c->comment_date_gmt; ?></wp:comment_date_gmt>
<wp:comment_content><?php echo wxr_cdata($c->comment_content) ?></wp:comment_content>
<wp:comment_approved><?php echo $c->comment_approved; ?></wp:comment_approved>
<wp:comment_type><?php echo $c->comment_type; ?></wp:comment_type>
<wp:comment_parent><?php echo $c->comment_parent; ?></wp:comment_parent>
<wp:comment_user_id><?php echo $c->user_id; ?></wp:comment_user_id>
</wp:comment>
<?php } } ?>
	</item>
<?php } } } ?>
</channel>
</rss>
<?php
}

?>
                                                                                                                                                                                                                                                                                                                                                                                                      wp-admin/includes/file.php                                                                          0000755 0023422 0004734 00000065710 11120533642 016565  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * File contains all the administration image manipulation functions.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** The descriptions for theme files. */
$wp_file_descriptions = array (
	'index.php' => __( 'Main Index Template' ),
	'style.css' => __( 'Stylesheet' ),
	'rtl.css' => __( 'RTL Stylesheet' ),
	'comments.php' => __( 'Comments' ),
	'comments-popup.php' => __( 'Popup Comments' ),
	'footer.php' => __( 'Footer' ),
	'header.php' => __( 'Header' ),
	'sidebar.php' => __( 'Sidebar' ),
	'archive.php' => __( 'Archives' ),
	'category.php' => __( 'Category Template' ),
	'page.php' => __( 'Page Template' ),
	'search.php' => __( 'Search Results' ),
	'searchform.php' => __( 'Search Form' ),
	'single.php' => __( 'Single Post' ),
	'404.php' => __( '404 Template' ),
	'link.php' => __( 'Links Template' ),
	'functions.php' => __( 'Theme Functions' ),
	'attachment.php' => __( 'Attachment Template' ),
	'image.php' => __('Image Attachment Template'),
	'video.php' => __('Video Attachment Template'),
	'audio.php' => __('Audio Attachment Template'),
	'application.php' => __('Application Attachment Template'),
	'my-hacks.php' => __( 'my-hacks.php (legacy hacks support)' ),
	'.htaccess' => __( '.htaccess (for rewrite rules )' ),
	// Deprecated files
	'wp-layout.css' => __( 'Stylesheet' ), 'wp-comments.php' => __( 'Comments Template' ), 'wp-comments-popup.php' => __( 'Popup Comments Template' ));

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $file
 * @return unknown
 */
function get_file_description( $file ) {
	global $wp_file_descriptions;

	if ( isset( $wp_file_descriptions[basename( $file )] ) ) {
		return $wp_file_descriptions[basename( $file )];
	}
	elseif ( file_exists( WP_CONTENT_DIR . $file ) && is_file( WP_CONTENT_DIR . $file ) ) {
		$template_data = implode( '', file( WP_CONTENT_DIR . $file ) );
		if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ))
			return $name[1] . ' Page Template';
	}

	return basename( $file );
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @return unknown
 */
function get_home_path() {
	$home = get_option( 'home' );
	if ( $home != '' && $home != get_option( 'siteurl' ) ) {
		$home_path = parse_url( $home );
		$home_path = $home_path['path'];
		$root = str_replace( $_SERVER["PHP_SELF"], '', $_SERVER["SCRIPT_FILENAME"] );
		$home_path = trailingslashit( $root.$home_path );
	} else {
		$home_path = ABSPATH;
	}

	return $home_path;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $file
 * @return unknown
 */
function get_real_file_to_edit( $file ) {
	if ('index.php' == $file || '.htaccess' == $file ) {
		$real_file = get_home_path() . $file;
	} else {
		$real_file = WP_CONTENT_DIR . $file;
	}

	return $real_file;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param string $folder Optional. Full path to folder
 * @param int $levels Optional. Levels of folders to follow, Default: 100 (PHP Loop limit).
 * @return bool|array
 */
function list_files( $folder = '', $levels = 100 ) {
	if( empty($folder) )
		return false;

	if( ! $levels )
		return false;

	$files = array();
	if ( $dir = @opendir( $folder ) ) {
		while (($file = readdir( $dir ) ) !== false ) {
			if ( in_array($file, array('.', '..') ) )
				continue;
			if ( is_dir( $folder . '/' . $file ) ) {
				$files2 = list_files( $folder . '/' . $file, $levels - 1);
				if( $files2 )
					$files = array_merge($files, $files2 );
				else
					$files[] = $folder . '/' . $file . '/';
			} else {
				$files[] = $folder . '/' . $file;
			}
		}
	}
	@closedir( $dir );
	return $files;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @return unknown
 */
function get_temp_dir() {
	if ( defined('WP_TEMP_DIR') )
		return trailingslashit(WP_TEMP_DIR);

	$temp = WP_CONTENT_DIR . '/';
	if ( is_dir($temp) && is_writable($temp) )
		return $temp;

	if  ( function_exists('sys_get_temp_dir') )
		return trailingslashit(sys_get_temp_dir());

	return '/tmp/';
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $filename
 * @param unknown_type $dir
 * @return unknown
 */
function wp_tempnam($filename = '', $dir = ''){
	if ( empty($dir) )
		$dir = get_temp_dir();
	$filename = basename($filename);
	if ( empty($filename) )
		$filename = time();

	$filename = $dir . wp_unique_filename($dir, $filename);
	touch($filename);
	return $filename;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $file
 * @param unknown_type $allowed_files
 * @return unknown
 */
function validate_file_to_edit( $file, $allowed_files = '' ) {
	$file = stripslashes( $file );

	$code = validate_file( $file, $allowed_files );

	if (!$code )
		return $file;

	switch ( $code ) {
		case 1 :
			wp_die( __('Sorry, can&#8217;t edit files with ".." in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.' ));

		case 2 :
			wp_die( __('Sorry, can&#8217;t call files with their real path.' ));

		case 3 :
			wp_die( __('Sorry, that file cannot be edited.' ));
	}
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param array $file Reference to a single element of $_FILES. Call the function once for each uploaded file.
 * @param array $overrides Optional. An associative array of names=>values to override default variables with extract( $overrides, EXTR_OVERWRITE ).
 * @return array On success, returns an associative array of file attributes. On failure, returns $overrides['upload_error_handler'](&$file, $message ) or array( 'error'=>$message ).
 */
function wp_handle_upload( &$file, $overrides = false, $time = null ) {
	// The default error handler.
	if (! function_exists( 'wp_handle_upload_error' ) ) {
		function wp_handle_upload_error( &$file, $message ) {
			return array( 'error'=>$message );
		}
	}

	// You may define your own function and pass the name in $overrides['upload_error_handler']
	$upload_error_handler = 'wp_handle_upload_error';

	// You may define your own function and pass the name in $overrides['unique_filename_callback']
	$unique_filename_callback = null;

	// $_POST['action'] must be set and its value must equal $overrides['action'] or this:
	$action = 'wp_handle_upload';

	// Courtesy of php.net, the strings that describe the error indicated in $_FILES[{form field}]['error'].
	$upload_error_strings = array( false,
		__( "The uploaded file exceeds the <code>upload_max_filesize</code> directive in <code>php.ini</code>." ),
		__( "The uploaded file exceeds the <em>MAX_FILE_SIZE</em> directive that was specified in the HTML form." ),
		__( "The uploaded file was only partially uploaded." ),
		__( "No file was uploaded." ),
		'',
		__( "Missing a temporary folder." ),
		__( "Failed to write file to disk." ));

	// All tests are on by default. Most can be turned off by $override[{test_name}] = false;
	$test_form = true;
	$test_size = true;

	// If you override this, you must provide $ext and $type!!!!
	$test_type = true;
	$mimes = false;

	// Install user overrides. Did we mention that this voids your warranty?
	if ( is_array( $overrides ) )
		extract( $overrides, EXTR_OVERWRITE );

	// A correct form post will pass this test.
	if ( $test_form && (!isset( $_POST['action'] ) || ($_POST['action'] != $action ) ) )
		return $upload_error_handler( $file, __( 'Invalid form submission.' ));

	// A successful upload will pass this test. It makes no sense to override this one.
	if ( $file['error'] > 0 )
		return $upload_error_handler( $file, $upload_error_strings[$file['error']] );

	// A non-empty file will pass this test.
	if ( $test_size && !($file['size'] > 0 ) )
		return $upload_error_handler( $file, __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini.' ));

	// A properly uploaded file will pass this test. There should be no reason to override this one.
	if (! @ is_uploaded_file( $file['tmp_name'] ) )
		return $upload_error_handler( $file, __( 'Specified file failed upload test.' ));

	// A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter.
	if ( $test_type ) {
		$wp_filetype = wp_check_filetype( $file['name'], $mimes );

		extract( $wp_filetype );

		if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) )
			return $upload_error_handler( $file, __( 'File type does not meet security guidelines. Try another.' ));

		if ( !$ext )
			$ext = ltrim(strrchr($file['name'], '.'), '.');

		if ( !$type )
			$type = $file['type'];
	}

	// A writable uploads dir will pass this test. Again, there's no point overriding this one.
	if ( ! ( ( $uploads = wp_upload_dir($time) ) && false === $uploads['error'] ) )
		return $upload_error_handler( $file, $uploads['error'] );

	$filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback );

	// Move the file to the uploads dir
	$new_file = $uploads['path'] . "/$filename";
	if ( false === @ move_uploaded_file( $file['tmp_name'], $new_file ) ) {
		return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ) );
	}

	// Set correct file permissions
	$stat = stat( dirname( $new_file ));
	$perms = $stat['mode'] & 0000666;
	@ chmod( $new_file, $perms );

	// Compute the URL
	$url = $uploads['url'] . "/$filename";

	$return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) );

	return $return;
}

/**
 * {@internal Missing Short Description}}
 *
 * Pass this function an array similar to that of a $_FILES POST array.
 *
 * @since unknown
 *
 * @param unknown_type $file
 * @param unknown_type $overrides
 * @return unknown
 */
function wp_handle_sideload( &$file, $overrides = false ) {
	// The default error handler.
	if (! function_exists( 'wp_handle_upload_error' ) ) {
		function wp_handle_upload_error( &$file, $message ) {
			return array( 'error'=>$message );
		}
	}

	// You may define your own function and pass the name in $overrides['upload_error_handler']
	$upload_error_handler = 'wp_handle_upload_error';

	// You may define your own function and pass the name in $overrides['unique_filename_callback']
	$unique_filename_callback = null;

	// $_POST['action'] must be set and its value must equal $overrides['action'] or this:
	$action = 'wp_handle_sideload';

	// Courtesy of php.net, the strings that describe the error indicated in $_FILES[{form field}]['error'].
	$upload_error_strings = array( false,
		__( "The file exceeds the <code>upload_max_filesize</code> directive in <code>php.ini</code>." ),
		__( "The file exceeds the <em>MAX_FILE_SIZE</em> directive that was specified in the HTML form." ),
		__( "The file was only partially uploaded." ),
		__( "No file was sent." ),
		__( "Missing a temporary folder." ),
		__( "Failed to write file to disk." ));

	// All tests are on by default. Most can be turned off by $override[{test_name}] = false;
	$test_form = true;
	$test_size = true;

	// If you override this, you must provide $ext and $type!!!!
	$test_type = true;
	$mimes = false;

	// Install user overrides. Did we mention that this voids your warranty?
	if ( is_array( $overrides ) )
		extract( $overrides, EXTR_OVERWRITE );

	// A correct form post will pass this test.
	if ( $test_form && (!isset( $_POST['action'] ) || ($_POST['action'] != $action ) ) )
		return $upload_error_handler( $file, __( 'Invalid form submission.' ));

	// A successful upload will pass this test. It makes no sense to override this one.
	if ( $file['error'] > 0 )
		return $upload_error_handler( $file, $upload_error_strings[$file['error']] );

	// A non-empty file will pass this test.
	if ( $test_size && !(filesize($file['tmp_name']) > 0 ) )
		return $upload_error_handler( $file, __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini.' ));

	// A properly uploaded file will pass this test. There should be no reason to override this one.
	if (! @ is_file( $file['tmp_name'] ) )
		return $upload_error_handler( $file, __( 'Specified file does not exist.' ));

	// A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter.
	if ( $test_type ) {
		$wp_filetype = wp_check_filetype( $file['name'], $mimes );

		extract( $wp_filetype );

		if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) )
			return $upload_error_handler( $file, __( 'File type does not meet security guidelines. Try another.' ));

		if ( !$ext )
			$ext = ltrim(strrchr($file['name'], '.'), '.');

		if ( !$type )
			$type = $file['type'];
	}

	// A writable uploads dir will pass this test. Again, there's no point overriding this one.
	if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) )
		return $upload_error_handler( $file, $uploads['error'] );

	$filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback );

	// Strip the query strings.
	$filename = str_replace('?','-', $filename);
	$filename = str_replace('&','-', $filename);

	// Move the file to the uploads dir
	$new_file = $uploads['path'] . "/$filename";
	if ( false === @ rename( $file['tmp_name'], $new_file ) ) {
		return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ) );
	}

	// Set correct file permissions
	$stat = stat( dirname( $new_file ));
	$perms = $stat['mode'] & 0000666;
	@ chmod( $new_file, $perms );

	// Compute the URL
	$url = $uploads['url'] . "/$filename";

	$return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) );

	return $return;
}

/**
 * Downloads a url to a local file using the Snoopy HTTP Class.
 *
 * @since unknown
 * @todo Transition over to using the new HTTP Request API (jacob).
 *
 * @param string $url the URL of the file to download
 * @return mixed WP_Error on failure, string Filename on success.
 */
function download_url( $url ) {
	//WARNING: The file is not automatically deleted, The script must unlink() the file.
	if ( ! $url )
		return new WP_Error('http_no_url', __('Invalid URL Provided'));

	$tmpfname = wp_tempnam($url);
	if ( ! $tmpfname )
		return new WP_Error('http_no_file', __('Could not create Temporary file'));

	$handle = @fopen($tmpfname, 'wb');
	if ( ! $handle )
		return new WP_Error('http_no_file', __('Could not create Temporary file'));

	$response = wp_remote_get($url, array('timeout' => 30));

	if ( is_wp_error($response) ) {
		fclose($handle);
		unlink($tmpfname);
		return $response;
	}

	if ( $response['response']['code'] != '200' ){
		fclose($handle);
		unlink($tmpfname);
		return new WP_Error('http_404', trim($response['response']['message']));
	}

	fwrite($handle, $response['body']);
	fclose($handle);

	return $tmpfname;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $file
 * @param unknown_type $to
 * @return unknown
 */
function unzip_file($file, $to) {
	global $wp_filesystem;

	if ( ! $wp_filesystem || !is_object($wp_filesystem) )
		return new WP_Error('fs_unavailable', __('Could not access filesystem.'));

	// Unzip uses a lot of memory
	@ini_set('memory_limit', '256M');

	$fs =& $wp_filesystem;

	require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php');

	$archive = new PclZip($file);

	// Is the archive valid?
	if ( false == ($archive_files = $archive->extract(PCLZIP_OPT_EXTRACT_AS_STRING)) )
		return new WP_Error('incompatible_archive', __('Incompatible archive'), $archive->errorInfo(true));

	if ( 0 == count($archive_files) )
		return new WP_Error('empty_archive', __('Empty archive'));

	$path = explode('/', untrailingslashit($to));
	for ( $i = count($path); $i > 0; $i-- ) { //>0 = first element is empty allways for paths starting with '/'
		$tmppath = implode('/', array_slice($path, 0, $i) );
		if ( $fs->is_dir($tmppath) ) { //Found the highest folder that exists, Create from here(ie +1)
			for ( $i = $i + 1; $i <= count($path); $i++ ) {
				$tmppath = implode('/', array_slice($path, 0, $i) );
				if ( ! $fs->mkdir($tmppath, FS_CHMOD_DIR) )
					return new WP_Error('mkdir_failed', __('Could not create directory'), $tmppath);
			}
			break; //Exit main for loop
		}
	}

	$to = trailingslashit($to);
	foreach ($archive_files as $file) {
		$path = $file['folder'] ? $file['filename'] : dirname($file['filename']);
		$path = explode('/', $path);
		for ( $i = count($path); $i >= 0; $i-- ) { //>=0 as the first element contains data
			if ( empty($path[$i]) )
				continue;
			$tmppath = $to . implode('/', array_slice($path, 0, $i) );
			if ( $fs->is_dir($tmppath) ) {//Found the highest folder that exists, Create from here
				for ( $i = $i + 1; $i <= count($path); $i++ ) { //< count() no file component please.
					$tmppath = $to . implode('/', array_slice($path, 0, $i) );
					if ( ! $fs->is_dir($tmppath) && ! $fs->mkdir($tmppath, FS_CHMOD_DIR) )
						return new WP_Error('mkdir_failed', __('Could not create directory'), $tmppath);
				}
				break; //Exit main for loop
			}
		}

		// We've made sure the folders are there, so let's extract the file now:
		if ( ! $file['folder'] ) {
			if ( !$fs->put_contents( $to . $file['filename'], $file['content']) )
				return new WP_Error('copy_failed', __('Could not copy file'), $to . $file['filename']);
			$fs->chmod($to . $file['filename'], FS_CHMOD_FILE);
		}
	}
	return true;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $from
 * @param unknown_type $to
 * @return unknown
 */
function copy_dir($from, $to) {
	global $wp_filesystem;

	$dirlist = $wp_filesystem->dirlist($from);

	$from = trailingslashit($from);
	$to = trailingslashit($to);

	foreach ( (array) $dirlist as $filename => $fileinfo ) {
		if ( 'f' == $fileinfo['type'] ) {
			if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true) ) {
				// If copy failed, chmod file to 0644 and try again.
				$wp_filesystem->chmod($to . $filename, 0644);
				if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true) )
					return new WP_Error('copy_failed', __('Could not copy file'), $to . $filename);
			}
			$wp_filesystem->chmod($to . $filename, FS_CHMOD_FILE);
		} elseif ( 'd' == $fileinfo['type'] ) {
			if ( !$wp_filesystem->is_dir($to . $filename) ) {
				if ( !$wp_filesystem->mkdir($to . $filename, FS_CHMOD_DIR) )
					return new WP_Error('mkdir_failed', __('Could not create directory'), $to . $filename);
			}
			$result = copy_dir($from . $filename, $to . $filename);
			if ( is_wp_error($result) )
				return $result;
		}
	}
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $args
 * @return unknown
 */
function WP_Filesystem( $args = false ) {
	global $wp_filesystem;

	require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php');

	$method = get_filesystem_method($args);

	if ( ! $method )
		return false;

	$abstraction_file = apply_filters('filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method);
	if( ! file_exists($abstraction_file) )
		return;

	require_once($abstraction_file);
	$method = "WP_Filesystem_$method";

	$wp_filesystem = new $method($args);

	if ( $wp_filesystem->errors->get_error_code() )
		return false;

	if ( !$wp_filesystem->connect() )
		return false; //There was an erorr connecting to the server.

	// Set the permission constants if not already set.
	if ( ! defined('FS_CHMOD_DIR') )
		define('FS_CHMOD_DIR', 0755 );
	if ( ! defined('FS_CHMOD_FILE') )
		define('FS_CHMOD_FILE', 0644 );

	return true;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $args
 * @return unknown
 */
function get_filesystem_method($args = array()) {
	$method = false;
	if( function_exists('getmyuid') && function_exists('fileowner') ){
		$temp_file = wp_tempnam();
		if ( getmyuid() == fileowner($temp_file) )
			$method = 'direct';
		unlink($temp_file);
	}

	if ( ! $method && isset($args['connection_type']) && 'ssh' == $args['connection_type'] && extension_loaded('ssh2') ) $method = 'ssh2';
	if ( ! $method && extension_loaded('ftp') ) $method = 'ftpext';
	if ( ! $method && ( extension_loaded('sockets') || function_exists('fsockopen') ) ) $method = 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread
	return apply_filters('filesystem_method', $method);
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $form_post
 * @param unknown_type $type
 * @param unknown_type $error
 * @return unknown
 */
function request_filesystem_credentials($form_post, $type = '', $error = false) {
	$req_cred = apply_filters('request_filesystem_credentials', '', $form_post, $type, $error);
	if ( '' !== $req_cred )
		return $req_cred;

	if ( empty($type) )
		$type = get_filesystem_method();

	if ( 'direct' == $type )
		return true;

	$credentials = get_option('ftp_credentials', array());
	// If defined, set it to that, Else, If POST'd, set it to that, If not, Set it to whatever it previously was(saved details in option)
	$credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? $_POST['hostname'] : $credentials['hostname']);
	$credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? $_POST['username'] : $credentials['username']);
	$credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? $_POST['password'] : $credentials['password']);

	// Check to see if we are setting the public/private keys for ssh
	$credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : (!empty($_POST['public_key']) ? $_POST['public_key'] : $credentials['public_key']);
	$credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : (!empty($_POST['private_key']) ? $_POST['private_key'] : $credentials['private_key']);

	//sanitize the hostname, Some people might pass in odd-data:
	$credentials['hostname'] = preg_replace('|\w+://|', '', $credentials['hostname']); //Strip any schemes off

	if ( strpos($credentials['hostname'], ':') )
		list( $credentials['hostname'], $credentials['port'] ) = explode(':', $credentials['hostname'], 2);
	else
		unset($credentials['port']);

	if ( defined('FTP_SSH') || (isset($_POST['connection_type']) && 'ssh' == $_POST['connection_type']) )
		$credentials['connection_type'] = 'ssh';
	else if ( defined('FTP_SSL') || (isset($_POST['connection_type']) && 'ftps' == $_POST['connection_type']) )
		$credentials['connection_type'] = 'ftps';
	else if ( !isset($credentials['connection_type']) || (isset($_POST['connection_type']) && 'ftp' == $_POST['connection_type']) )
		$credentials['connection_type'] = 'ftp';

	if ( ! $error && !empty($credentials['password']) && !empty($credentials['username']) && !empty($credentials['hostname']) ) {
		$stored_credentials = $credentials;
		if ( !empty($stored_credentials['port']) ) //save port as part of hostname to simplify above code.
			$stored_credentials['hostname'] .= ':' . $stored_credentials['port'];

		unset($stored_credentials['password'], $stored_credentials['port'], $stored_credentials['private_key'], $stored_credentials['public_key']);
		update_option('ftp_credentials', $stored_credentials);
		return $credentials;
	}
	$hostname = '';
	$username = '';
	$password = '';
	$connection_type = '';
	if ( !empty($credentials) )
		extract($credentials, EXTR_OVERWRITE);
	if ( $error ) {
		$error_string = __('<strong>Error:</strong> There was an error connecting to the server, Please verify the settings are correct.');
		if ( is_wp_error($error) )
			$error_string = $error->get_error_message();
		echo '<div id="message" class="error"><p>' . $error_string . '</p></div>';
	}
?>
<script type="text/javascript">
<!--
jQuery(function($){
	jQuery("#ssh").click(function () {
		jQuery("#ssh_keys").show();
	});
	jQuery("#ftp, #ftps").click(function () {
		jQuery("#ssh_keys").hide();
	});
});
-->
</script>
<form action="<?php echo $form_post ?>" method="post">
<div class="wrap">
<h2><?php _e('Connection Information') ?></h2>
<p><?php _e('To perform the requested action, connection information is required.') ?></p>

<table class="form-table">
<tr valign="top">
<th scope="row"><label for="hostname"><?php _e('Hostname') ?></label></th>
<td><input name="hostname" type="text" id="hostname" value="<?php echo attribute_escape($hostname); if ( !empty($port) ) echo ":$port"; ?>"<?php if( defined('FTP_HOST') ) echo ' disabled="disabled"' ?> size="40" /></td>
</tr>

<tr valign="top">
<th scope="row"><label for="username"><?php _e('Username') ?></label></th>
<td><input name="username" type="text" id="username" value="<?php echo attribute_escape($username) ?>"<?php if( defined('FTP_USER') ) echo ' disabled="disabled"' ?> size="40" /></td>
</tr>

<tr valign="top">
<th scope="row"><label for="password"><?php _e('Password') ?></label></th>
<td><input name="password" type="password" id="password" value=""<?php if( defined('FTP_PASS') ) echo ' disabled="disabled"' ?> size="40" /><?php if( defined('FTP_PASS') && !empty($password) ) echo '<em>'.__('(Password not shown)').'</em>'; ?></td>
</tr>

<tr id="ssh_keys" valign="top" style="<?php if ( 'ssh' != $connection_type ) echo 'display:none' ?>">
<th scope="row"><?php _e('Authentication Keys') ?>
<div class="key-labels textright">
<label for="public_key"><?php _e('Public Key:') ?></label ><br />
<label for="private_key"><?php _e('Private Key:') ?></label>
</div></th>
<td><br /><input name="public_key" type="text" id="public_key" value=""<?php if( defined('FTP_PUBKEY') ) echo ' disabled="disabled"' ?> size="40" /><br /><input name="private_key" type="text" id="private_key" value=""<?php if( defined('FTP_PRIKEY') ) echo ' disabled="disabled"' ?> size="40" />
<div><?php _e('Enter the location on the server where the keys are located. If a passphrase is needed, enter that in the password field above.') ?></div></td>
</tr>

<tr valign="top">
<th scope="row"><?php _e('Connection Type') ?></th>
<td>
<fieldset><legend class="hidden"><?php _e('Connection Type') ?></legend>
<label><input id="ftp" name="connection_type"  type="radio" value="ftp" <?php checked('ftp', $connection_type); if ( defined('FTP_SSL') || defined('FTP_SSH') ) echo ' disabled="disabled"'; ?>/> <?php _e('FTP') ?></label><br />
<label><input id="ftps" name="connection_type" type="radio" value="ftps" <?php checked('ftps', $connection_type); if ( defined('FTP_SSH') || defined('FTP_SSH') ) echo ' disabled="disabled"';  ?>/> <?php _e('FTPS (SSL)') ?></label><br />
<?php if ( extension_loaded('ssh2') ) { ?><label><input id="ssh" name="connection_type" type="radio" value="ssh" <?php checked('ssh', $connection_type);  if ( defined('FTP_SSL') || defined('FTP_SSH') ) echo ' disabled="disabled"'; ?>/> <?php _e('SSH') ?></label><?php } ?>
</fieldset>
</td>
</tr>
</table>

<?php if ( isset( $_POST['version'] ) ) : ?>
<input type="hidden" name="version" value="<?php echo attribute_escape($_POST['version']) ?>" />
<?php endif; ?>
<?php if ( isset( $_POST['locale'] ) ) : ?>
<input type="hidden" name="locale" value="<?php echo attribute_escape($_POST['locale']) ?>" />
<?php endif; ?>
<p class="submit">
<input id="upgrade" name="upgrade" type="submit" class="button" value="<?php _e('Proceed'); ?>" />
</p>
</div>
</form>
<?php
	return false;
}

?>
                                                        wp-admin/includes/image.php                                                                         0000755 0023422 0004734 00000024515 11117531364 016733  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * File contains all the administration image manipulation functions.
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * Create a thumbnail from an Image given a maximum side size.
 *
 * This function can handle most image file formats which PHP supports. If PHP
 * does not have the functionality to save in a file of the same format, the
 * thumbnail will be created as a jpeg.
 *
 * @since 1.2.0
 *
 * @param mixed $file Filename of the original image, Or attachment id.
 * @param int $max_side Maximum length of a single side for the thumbnail.
 * @return string Thumbnail path on success, Error string on failure.
 */
function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {
	$thumbpath = image_resize( $file, $max_side, $max_side );
	return apply_filters( 'wp_create_thumbnail', $thumbpath );
}

/**
 * Crop an Image to a given size.
 *
 * @since 2.1.0
 *
 * @param string|int $src_file The source file or Attachment ID.
 * @param int $src_x The start x position to crop from.
 * @param int $src_y The start y position to crop from.
 * @param int $src_w The width to crop.
 * @param int $src_h The height to crop.
 * @param int $dst_w The destination width.
 * @param int $dst_h The destination height.
 * @param int $src_abs Optional. If the source crop points are absolute.
 * @param string $dst_file Optional. The destination file to write to.
 * @return string New filepath on success, String error message on failure.
 */
function wp_crop_image( $src_file, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false ) {
	if ( is_numeric( $src_file ) ) // Handle int as attachment ID
		$src_file = get_attached_file( $src_file );

	$src = wp_load_image( $src_file );

	if ( !is_resource( $src ))
		return $src;

	$dst = imagecreatetruecolor( $dst_w, $dst_h );

	if ( $src_abs ) {
		$src_w -= $src_x;
		$src_h -= $src_y;
	}

	if (function_exists('imageantialias'))
		imageantialias( $dst, true );

	imagecopyresampled( $dst, $src, 0, 0, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h );

	imagedestroy( $src ); // Free up memory

	if ( ! $dst_file )
		$dst_file = str_replace( basename( $src_file ), 'cropped-' . basename( $src_file ), $src_file );

	$dst_file = preg_replace( '/\\.[^\\.]+$/', '.jpg', $dst_file );

	if ( imagejpeg( $dst, $dst_file ) )
		return $dst_file;
	else
		return false;
}

/**
 * Generate post image attachment meta data.
 *
 * @since 2.1.0
 *
 * @param int $attachment_id Attachment Id to process.
 * @param string $file Filepath of the Attached image.
 * @return mixed Metadata for attachment.
 */
function wp_generate_attachment_metadata( $attachment_id, $file ) {
	$attachment = get_post( $attachment_id );

	$metadata = array();
	if ( preg_match('!^image/!', get_post_mime_type( $attachment )) && file_is_displayable_image($file) ) {
		$full_path_file = $file;
		$imagesize = getimagesize( $full_path_file );
		$metadata['width'] = $imagesize[0];
		$metadata['height'] = $imagesize[1];
		list($uwidth, $uheight) = wp_shrink_dimensions($metadata['width'], $metadata['height']);
		$metadata['hwstring_small'] = "height='$uheight' width='$uwidth'";

		// Make the file path relative to the upload dir
		if ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) { // Get upload directory
			if ( 0 === strpos($file, $uploads['basedir']) ) {// Check that the upload base exists in the file path
				$file = str_replace($uploads['basedir'], '', $file); // Remove upload dir from the file path
				$file = ltrim($file, '/');
			}
		}
		$metadata['file'] = $file;

		// make thumbnails and other intermediate sizes
		$sizes = array('thumbnail', 'medium', 'large');
		$sizes = apply_filters('intermediate_image_sizes', $sizes);

		foreach ($sizes as $size) {
			$resized = image_make_intermediate_size( $full_path_file, get_option("{$size}_size_w"), get_option("{$size}_size_h"), get_option("{$size}_crop") );
			if ( $resized )
				$metadata['sizes'][$size] = $resized;
		}

		// fetch additional metadata from exif/iptc
		$image_meta = wp_read_image_metadata( $full_path_file );
		if ($image_meta)
			$metadata['image_meta'] = $image_meta;

	}

	return apply_filters( 'wp_generate_attachment_metadata', $metadata );
}

/**
 * Load an image from a string, if PHP supports it.
 *
 * @since 2.1.0
 *
 * @param string $file Filename of the image to load.
 * @return resource The resulting image resource on success, Error string on failure.
 */
function wp_load_image( $file ) {
	if ( is_numeric( $file ) )
		$file = get_attached_file( $file );

	if ( ! file_exists( $file ) )
		return sprintf(__("File '%s' doesn't exist?"), $file);

	if ( ! function_exists('imagecreatefromstring') )
		return __('The GD image library is not installed.');

	// Set artificially high because GD uses uncompressed images in memory
	@ini_set('memory_limit', '256M');
	$image = imagecreatefromstring( file_get_contents( $file ) );

	if ( !is_resource( $image ) )
		return sprintf(__("File '%s' is not an image."), $file);

	return $image;
}

/**
 * Calculated the new dimentions for a downsampled image.
 *
 * @since 2.0.0
 * @see wp_shrink_dimensions()
 *
 * @param int $width Current width of the image
 * @param int $height Current height of the image
 * @return mixed Array(height,width) of shrunk dimensions.
 */
function get_udims( $width, $height) {
	return wp_shrink_dimensions( $width, $height );
}

/**
 * Calculates the new dimentions for a downsampled image.
 *
 * @since 2.0.0
 * @see wp_constrain_dimensions()
 *
 * @param int $width Current width of the image
 * @param int $height Current height of the image
 * @param int $wmax Maximum wanted width
 * @param int $hmax Maximum wanted height
 * @return mixed Array(height,width) of shrunk dimensions.
 */
function wp_shrink_dimensions( $width, $height, $wmax = 128, $hmax = 96 ) {
	return wp_constrain_dimensions( $width, $height, $wmax, $hmax );
}

/**
 * Convert a fraction string to a decimal.
 *
 * @since 2.5.0
 *
 * @param string $str
 * @return int|float
 */
function wp_exif_frac2dec($str) {
	@list( $n, $d ) = explode( '/', $str );
	if ( !empty($d) )
		return $n / $d;
	return $str;
}

/**
 * Convert the exif date format to a unix timestamp.
 *
 * @since 2.5.0
 *
 * @param string $str
 * @return int
 */
function wp_exif_date2ts($str) {
	@list( $date, $time ) = explode( ' ', trim($str) );
	@list( $y, $m, $d ) = explode( ':', $date );

	return strtotime( "{$y}-{$m}-{$d} {$time}" );
}

/**
 * Get extended image metadata, exif or iptc as available.
 *
 * Retrieves the EXIF metadata aperture, credit, camera, caption, copyright, iso
 * created_timestamp, focal_length, shutter_speed, and title.
 *
 * The IPTC metadata that is retrieved is APP13, credit, byline, created date
 * and time, caption, copyright, and title. Also includes FNumber, Model,
 * DateTimeDigitized, FocalLength, ISOSpeedRatings, and ExposureTime.
 *
 * @todo Try other exif libraries if available.
 * @since 2.5.0
 *
 * @param string $file
 * @return bool|array False on failure. Image metadata array on success.
 */
function wp_read_image_metadata( $file ) {
	if ( !file_exists( $file ) )
		return false;

	list(,,$sourceImageType) = getimagesize( $file );

	// exif contains a bunch of data we'll probably never need formatted in ways
	// that are difficult to use. We'll normalize it and just extract the fields
	// that are likely to be useful.  Fractions and numbers are converted to
	// floats, dates to unix timestamps, and everything else to strings.
	$meta = array(
		'aperture' => 0,
		'credit' => '',
		'camera' => '',
		'caption' => '',
		'created_timestamp' => 0,
		'copyright' => '',
		'focal_length' => 0,
		'iso' => 0,
		'shutter_speed' => 0,
		'title' => '',
	);

	// read iptc first, since it might contain data not available in exif such
	// as caption, description etc
	if ( is_callable('iptcparse') ) {
		getimagesize($file, $info);
		if ( !empty($info['APP13']) ) {
			$iptc = iptcparse($info['APP13']);
			if ( !empty($iptc['2#110'][0]) ) // credit
				$meta['credit'] = utf8_encode(trim($iptc['2#110'][0]));
			elseif ( !empty($iptc['2#080'][0]) ) // byline
				$meta['credit'] = utf8_encode(trim($iptc['2#080'][0]));
			if ( !empty($iptc['2#055'][0]) and !empty($iptc['2#060'][0]) ) // created date and time
				$meta['created_timestamp'] = strtotime($iptc['2#055'][0] . ' ' . $iptc['2#060'][0]);
			if ( !empty($iptc['2#120'][0]) ) // caption
				$meta['caption'] = utf8_encode(trim($iptc['2#120'][0]));
			if ( !empty($iptc['2#116'][0]) ) // copyright
				$meta['copyright'] = utf8_encode(trim($iptc['2#116'][0]));
			if ( !empty($iptc['2#005'][0]) ) // title
				$meta['title'] = utf8_encode(trim($iptc['2#005'][0]));
		 }
	}

	// fetch additional info from exif if available
	if ( is_callable('exif_read_data') && in_array($sourceImageType, apply_filters('wp_read_image_metadata_types', array(IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM)) ) ) {
		$exif = @exif_read_data( $file );
		if (!empty($exif['FNumber']))
			$meta['aperture'] = round( wp_exif_frac2dec( $exif['FNumber'] ), 2 );
		if (!empty($exif['Model']))
			$meta['camera'] = trim( $exif['Model'] );
		if (!empty($exif['DateTimeDigitized']))
			$meta['created_timestamp'] = wp_exif_date2ts($exif['DateTimeDigitized']);
		if (!empty($exif['FocalLength']))
			$meta['focal_length'] = wp_exif_frac2dec( $exif['FocalLength'] );
		if (!empty($exif['ISOSpeedRatings']))
			$meta['iso'] = $exif['ISOSpeedRatings'];
		if (!empty($exif['ExposureTime']))
			$meta['shutter_speed'] = wp_exif_frac2dec( $exif['ExposureTime'] );
	}

	return apply_filters( 'wp_read_image_metadata', $meta, $file, $sourceImageType );

}

/**
 * Validate that file is an image.
 *
 * @since 2.5.0
 *
 * @param string $path File path to test if valid image.
 * @return bool True if valid image, false if not valid image.
 */
function file_is_valid_image($path) {
	$size = @getimagesize($path);
	return !empty($size);
}

/**
 * Validate that file is suitable for displaying within a web page.
 *
 * @since 2.5.0
 * @uses apply_filters() Calls 'file_is_displayable_image' on $result and $path.
 *
 * @param string $path File path to test.
 * @return bool True if suitable, false if not suitable.
 */
function file_is_displayable_image($path) {
	$info = @getimagesize($path);
	if ( empty($info) )
		$result = false;
	elseif ( !in_array($info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG)) )	// only gif, jpeg and png images can reliably be displayed
		$result = false;
	else
		$result = true;

	return apply_filters('file_is_displayable_image', $result, $path);
}

?>
                                                                                                                                                                                   wp-admin/includes/import.php                                                                        0000755 0023422 0004734 00000003521 11073725454 017163  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress Administration Importer API.
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * Retrieve list of importers.
 *
 * @since 2.0.0
 *
 * @return array
 */
function get_importers() {
	global $wp_importers;
	if ( is_array($wp_importers) )
		uasort($wp_importers, create_function('$a, $b', 'return strcmp($a[0], $b[0]);'));
	return $wp_importers;
}

/**
 * Register importer for WordPress.
 *
 * @since 2.0.0
 *
 * @param string $id Importer tag. Used to uniquely identify importer.
 * @param string $name Importer name and title.
 * @param string $description Importer description.
 * @param callback $callback Callback to run.
 * @return WP_Error Returns WP_Error when $callback is WP_Error.
 */
function register_importer( $id, $name, $description, $callback ) {
	global $wp_importers;
	if ( is_wp_error( $callback ) )
		return $callback;
	$wp_importers[$id] = array ( $name, $description, $callback );
}

/**
 * Cleanup importer.
 *
 * Removes attachment based on ID.
 *
 * @since 2.0.0
 *
 * @param string $id Importer ID.
 */
function wp_import_cleanup( $id ) {
	wp_delete_attachment( $id );
}

/**
 * Handle importer uploading and add attachment.
 *
 * @since 2.0.0
 *
 * @return array
 */
function wp_import_handle_upload() {
	$overrides = array( 'test_form' => false, 'test_type' => false );
	$_FILES['import']['name'] .= '.import';
	$file = wp_handle_upload( $_FILES['import'], $overrides );

	if ( isset( $file['error'] ) )
		return $file;

	$url = $file['url'];
	$type = $file['type'];
	$file = addslashes( $file['file'] );
	$filename = basename( $file );

	// Construct the object array
	$object = array( 'post_title' => $filename,
		'post_content' => $url,
		'post_mime_type' => $type,
		'guid' => $url
	);

	// Save the data
	$id = wp_insert_attachment( $object, $file );

	return array( 'file' => $file, 'id' => $id );
}

?>
                                                                                                                                                                               wp-admin/includes/media.php                                                                         0000755 0023422 0004734 00000175154 11136615456 016744  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress Administration Media API.
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @return unknown
 */
function media_upload_tabs() {
	$_default_tabs = array(
		'type' => __('From Computer'), // handler action suffix => tab text
		'type_url' => __('From URL'),
		'gallery' => __('Gallery'),
		'library' => __('Media Library')
	);

	return apply_filters('media_upload_tabs', $_default_tabs);
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $tabs
 * @return unknown
 */
function update_gallery_tab($tabs) {
	global $wpdb;

	if ( !isset($_REQUEST['post_id']) ) {
		unset($tabs['gallery']);
		return $tabs;
	}

	if ( intval($_REQUEST['post_id']) )
		$attachments = intval($wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = %d", $_REQUEST['post_id'])));

	if ( empty($attachments) ) {
		unset($tabs['gallery']);
		return $tabs;
	}

	$tabs['gallery'] = sprintf(__('Gallery (%s)'), "<span id='attachments-count'>$attachments</span>");

	return $tabs;
}
add_filter('media_upload_tabs', 'update_gallery_tab');

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 */
function the_media_upload_tabs() {
	global $redir_tab;
	$tabs = media_upload_tabs();

	if ( !empty($tabs) ) {
		echo "<ul id='sidemenu'>\n";
		if ( isset($redir_tab) && array_key_exists($redir_tab, $tabs) )
			$current = $redir_tab;
		elseif ( isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs) )
			$current = $_GET['tab'];
		else {
			$keys = array_keys($tabs);
			$current = array_shift($keys);
		}
		foreach ( $tabs as $callback => $text ) {
			$class = '';
			if ( $current == $callback )
				$class = " class='current'";
			$href = add_query_arg(array('tab'=>$callback, 's'=>false, 'paged'=>false, 'post_mime_type'=>false, 'm'=>false));
			$link = "<a href='" . clean_url($href) . "'$class>$text</a>";
			echo "\t<li id='" . attribute_escape("tab-$callback") . "'>$link</li>\n";
		}
		echo "</ul>\n";
	}
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $id
 * @param unknown_type $alt
 * @param unknown_type $title
 * @param unknown_type $align
 * @param unknown_type $url
 * @param unknown_type $rel
 * @param unknown_type $size
 * @return unknown
 */
function get_image_send_to_editor($id, $alt, $title, $align, $url='', $rel = false, $size='medium') {

	$htmlalt = ( empty($alt) ) ? $title : $alt;

	$html = get_image_tag($id, $htmlalt, $title, $align, $size);

	$rel = $rel ? ' rel="attachment wp-att-'.attribute_escape($id).'"' : '';

	if ( $url )
		$html = '<a href="' . clean_url($url) . "\"$rel>$html</a>";

	$html = apply_filters( 'image_send_to_editor', $html, $id, $alt, $title, $align, $url, $size );

	return $html;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $html
 * @param unknown_type $id
 * @param unknown_type $alt
 * @param unknown_type $title
 * @param unknown_type $align
 * @param unknown_type $url
 * @param unknown_type $size
 * @return unknown
 */
function image_add_caption( $html, $id, $alt, $title, $align, $url, $size ) {

	if ( empty($alt) || apply_filters( 'disable_captions', '' ) ) return $html;
	$id = ( 0 < (int) $id ) ? 'attachment_' . $id : '';

	preg_match( '/width="([0-9]+)/', $html, $matches );
	if ( ! isset($matches[1]) ) return $html;
	$width = $matches[1];

	$html = preg_replace( '/align[^\s\'"]+\s?/', '', $html );
	if ( empty($align) ) $align = 'none';

	$alt = ! empty($alt) ? addslashes($alt) : '';

	$shcode = '[caption id="' . $id . '" align="align' . $align
	. '" width="' . $width . '" caption="' . $alt . '"]' . $html . '[/caption]';

	return apply_filters( 'image_add_caption_shortcode', $shcode, $html );
}
add_filter( 'image_send_to_editor', 'image_add_caption', 20, 7 );

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $html
 */
function media_send_to_editor($html) {
?>
<script type="text/javascript">
/* <![CDATA[ */
var win = window.dialogArguments || opener || parent || top;
win.send_to_editor('<?php echo addslashes($html); ?>');
/* ]]> */
</script>
	<?php
	exit;
}

/**
 * {@internal Missing Short Description}}
 *
 * This handles the file upload POST itself, creating the attachment post.
 *
 * @since unknown
 *
 * @param unknown_type $file_id
 * @param unknown_type $post_id
 * @param unknown_type $post_data
 * @return unknown
 */
function media_handle_upload($file_id, $post_id, $post_data = array()) {
	$overrides = array('test_form'=>false);

	$time = current_time('mysql');
	if ( $post = get_post($post_id) ) {
		if ( substr( $post->post_date, 0, 4 ) > 0 )
			$time = $post->post_date;
	}

	$file = wp_handle_upload($_FILES[$file_id], $overrides, $time);

	if ( isset($file['error']) )
		return new WP_Error( 'upload_error', $file['error'] );

	$url = $file['url'];
	$type = $file['type'];
	$file = $file['file'];
	$title = preg_replace('/\.[^.]+$/', '', basename($file));
	$content = '';

	// use image exif/iptc data for title and caption defaults if possible
	if ( $image_meta = @wp_read_image_metadata($file) ) {
		if ( trim($image_meta['title']) )
			$title = $image_meta['title'];
		if ( trim($image_meta['caption']) )
			$content = $image_meta['caption'];
	}

	// Construct the attachment array
	$attachment = array_merge( array(
		'post_mime_type' => $type,
		'guid' => $url,
		'post_parent' => $post_id,
		'post_title' => $title,
		'post_content' => $content,
	), $post_data );

	// Save the data
	$id = wp_insert_attachment($attachment, $file, $post_id);
	if ( !is_wp_error($id) ) {
		wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
	}

	return $id;

}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $file_array
 * @param unknown_type $post_id
 * @param unknown_type $desc
 * @param unknown_type $post_data
 * @return unknown
 */
function media_handle_sideload($file_array, $post_id, $desc = null, $post_data = array()) {
	$overrides = array('test_form'=>false);
	$file = wp_handle_sideload($file_array, $overrides);

	if ( isset($file['error']) )
		return new WP_Error( 'upload_error', $file['error'] );

	$url = $file['url'];
	$type = $file['type'];
	$file = $file['file'];
	$title = preg_replace('/\.[^.]+$/', '', basename($file));
	$content = '';

	// use image exif/iptc data for title and caption defaults if possible
	if ( $image_meta = @wp_read_image_metadata($file) ) {
		if ( trim($image_meta['title']) )
			$title = $image_meta['title'];
		if ( trim($image_meta['caption']) )
			$content = $image_meta['caption'];
	}

	$title = @$desc;

	// Construct the attachment array
	$attachment = array_merge( array(
		'post_mime_type' => $type,
		'guid' => $url,
		'post_parent' => $post_id,
		'post_title' => $title,
		'post_content' => $content,
	), $post_data );

	// Save the data
	$id = wp_insert_attachment($attachment, $file, $post_id);
	if ( !is_wp_error($id) ) {
		wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
		return $url;
	}
	return $id;
}

/**
 * {@internal Missing Short Description}}
 *
 * Wrap iframe content (produced by $content_func) in a doctype, html head/body
 * etc any additional function args will be passed to content_func.
 *
 * @since unknown
 *
 * @param unknown_type $content_func
 */
function wp_iframe($content_func /* ... */) {
?>
<!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" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
<head>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
<title><?php bloginfo('name') ?> &rsaquo; <?php _e('Uploads'); ?> &#8212; <?php _e('WordPress'); ?></title>
<?php
wp_enqueue_style( 'global' );
wp_enqueue_style( 'wp-admin' );
wp_enqueue_style( 'colors' );
if ( 0 === strpos( $content_func, 'media' ) )
	wp_enqueue_style( 'media' );

?>
<script type="text/javascript">
//<![CDATA[
function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}else{ var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}
//]]>
</script>
<?php
do_action('admin_print_styles');
do_action('admin_print_scripts');
do_action('admin_head');
if ( is_string($content_func) )
	do_action( "admin_head_{$content_func}" );
?>
</head>
<body<?php if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?>>
<?php
	$args = func_get_args();
	$args = array_slice($args, 1);
	call_user_func_array($content_func, $args);
?>
</body>
</html>
<?php
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 */
function media_buttons() {
	global $post_ID, $temp_ID;
	$uploading_iframe_ID = (int) (0 == $post_ID ? $temp_ID : $post_ID);
	$context = apply_filters('media_buttons_context', __('Upload/Insert %s'));
	$media_upload_iframe_src = "media-upload.php?post_id=$uploading_iframe_ID";
	$media_title = __('Add Media');
	$image_upload_iframe_src = apply_filters('image_upload_iframe_src', "$media_upload_iframe_src&amp;type=image");
	$image_title = __('Add an Image');
	$video_upload_iframe_src = apply_filters('video_upload_iframe_src', "$media_upload_iframe_src&amp;type=video");
	$video_title = __('Add Video');
	$audio_upload_iframe_src = apply_filters('audio_upload_iframe_src', "$media_upload_iframe_src&amp;type=audio");
	$audio_title = __('Add Audio');
	$out = <<<EOF

	<a href="{$image_upload_iframe_src}&amp;TB_iframe=true" id="add_image" class="thickbox" title='$image_title'><img src='images/media-button-image.gif' alt='$image_title' /></a>
	<a href="{$video_upload_iframe_src}&amp;TB_iframe=true" id="add_video" class="thickbox" title='$video_title'><img src='images/media-button-video.gif' alt='$video_title' /></a>
	<a href="{$audio_upload_iframe_src}&amp;TB_iframe=true" id="add_audio" class="thickbox" title='$audio_title'><img src='images/media-button-music.gif' alt='$audio_title' /></a>
	<a href="{$media_upload_iframe_src}&amp;TB_iframe=true" id="add_media" class="thickbox" title='$media_title'><img src='images/media-button-other.gif' alt='$media_title' /></a>

EOF;
	printf($context, $out);
}
add_action( 'media_buttons', 'media_buttons' );
add_action('media_upload_media', 'media_upload_handler');

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @return unknown
 */
function media_upload_form_handler() {
	check_admin_referer('media-form');

	if ( isset($_POST['send']) ) {
		$keys = array_keys($_POST['send']);
		$send_id = (int) array_shift($keys);
	}
	
	if ( !empty($_POST['attachments']) ) foreach ( $_POST['attachments'] as $attachment_id => $attachment ) {
		$post = $_post = get_post($attachment_id, ARRAY_A);
		if ( isset($attachment['post_content']) )
			$post['post_content'] = $attachment['post_content'];
		if ( isset($attachment['post_title']) )
			$post['post_title'] = $attachment['post_title'];
		if ( isset($attachment['post_excerpt']) )
			$post['post_excerpt'] = $attachment['post_excerpt'];
		if ( isset($attachment['menu_order']) )
			$post['menu_order'] = $attachment['menu_order'];
		if ( isset($send_id) && $attachment_id == $send_id ) {
			if ( isset($attachment['post_parent']) )
				$post['post_parent'] = $attachment['post_parent'];
		}

		$post = apply_filters('attachment_fields_to_save', $post, $attachment);

		if ( isset($post['errors']) ) {
			$errors[$attachment_id] = $post['errors'];
			unset($post['errors']);
		}

		if ( $post != $_post )
			wp_update_post($post);

		foreach ( get_attachment_taxonomies($post) as $t )
			if ( isset($attachment[$t]) )
				wp_set_object_terms($attachment_id, array_map('trim', preg_split('/,+/', $attachment[$t])), $t, false);
	}

	if ( isset($_POST['insert-gallery']) || isset($_POST['update-gallery']) ) { ?>
		<script type="text/javascript">
		/* <![CDATA[ */
		var win = window.dialogArguments || opener || parent || top;
		win.tb_remove();
		/* ]]> */
		</script>
		<?php
		exit;
	}

	if ( isset($send_id) ) {
		$attachment = stripslashes_deep( $_POST['attachments'][$send_id] );
		$html = $attachment['post_title'];
		if ( !empty($attachment['url']) ) {
			if ( strpos($attachment['url'], 'attachment_id') || false !== strpos($attachment['url'], get_permalink($_POST['post_id'])) )
				$rel = " rel='attachment wp-att-".attribute_escape($send_id)."'";
			$html = "<a href='{$attachment['url']}'$rel>$html</a>";
		}
		$html = apply_filters('media_send_to_editor', $html, $send_id, $attachment);
		return media_send_to_editor($html);
	}

	return $errors;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @return unknown
 */
function media_upload_image() {
	$errors = array();
	$id = 0;

	if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
		// Upload File button was clicked
		$id = media_handle_upload('async-upload', $_REQUEST['post_id']);
		unset($_FILES);
		if ( is_wp_error($id) ) {
			$errors['upload_error'] = $id;
			$id = false;
		}
	}

	if ( !empty($_POST['insertonlybutton']) ) {
		$src = $_POST['insertonly']['src'];
		if ( !empty($src) && !strpos($src, '://') )
			$src = "http://$src";
		$alt = attribute_escape($_POST['insertonly']['alt']);
		if ( isset($_POST['insertonly']['align']) ) {
			$align = attribute_escape($_POST['insertonly']['align']);
			$class = " class='align$align'";
		}
		if ( !empty($src) )
			$html = "<img src='$src' alt='$alt'$class />";
		return media_send_to_editor($html);
	}

	if ( !empty($_POST) ) {
		$return = media_upload_form_handler();

		if ( is_string($return) )
			return $return;
		if ( is_array($return) )
			$errors = $return;
	}

	if ( isset($_POST['save']) ) {
		$errors['upload_notice'] = __('Saved.');
		return media_upload_gallery();
	}

	if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' )
		return wp_iframe( 'media_upload_type_url_form', 'image', $errors, $id );

	return wp_iframe( 'media_upload_type_form', 'image', $errors, $id );
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $file
 * @param unknown_type $post_id
 * @param unknown_type $desc
 * @return unknown
 */
function media_sideload_image($file, $post_id, $desc = null) {
	if (!empty($file) ) {
		$file_array['name'] = basename($file);
		$tmp = download_url($file);
		$file_array['tmp_name'] = $tmp;
		$desc = @$desc;

		if ( is_wp_error($tmp) ) {
			@unlink($file_array['tmp_name']);
			$file_array['tmp_name'] = '';
		}

		$id = media_handle_sideload($file_array, $post_id, $desc);
		$src = $id;

		if ( is_wp_error($id) ) {
			@unlink($file_array['tmp_name']);
			return $id;
		}
	}

	if ( !empty($src) ) {
		$alt = @$desc;
		$html = "<img src='$src' alt='$alt' />";
		return $html;
	}
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @return unknown
 */
function media_upload_audio() {
	$errors = array();
	$id = 0;

	if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
		// Upload File button was clicked
		$id = media_handle_upload('async-upload', $_REQUEST['post_id']);
		unset($_FILES);
		if ( is_wp_error($id) ) {
			$errors['upload_error'] = $id;
			$id = false;
		}
	}

	if ( !empty($_POST['insertonlybutton']) ) {
		$href = $_POST['insertonly']['href'];
		if ( !empty($href) && !strpos($href, '://') )
			$href = "http://$href";
		$title = attribute_escape($_POST['insertonly']['title']);
		if ( empty($title) )
			$title = basename($href);
		if ( !empty($title) && !empty($href) )
			$html = "<a href='$href' >$title</a>";
		return media_send_to_editor($html);
	}

	if ( !empty($_POST) ) {
		$return = media_upload_form_handler();

		if ( is_string($return) )
			return $return;
		if ( is_array($return) )
			$errors = $return;
	}

	if ( isset($_POST['save']) ) {
		$errors['upload_notice'] = __('Saved.');
		return media_upload_gallery();
	}

	if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' )
		return wp_iframe( 'media_upload_type_url_form', 'audio', $errors, $id );

	return wp_iframe( 'media_upload_type_form', 'audio', $errors, $id );
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @return unknown
 */
function media_upload_video() {
	$errors = array();
	$id = 0;

	if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
		// Upload File button was clicked
		$id = media_handle_upload('async-upload', $_REQUEST['post_id']);
		unset($_FILES);
		if ( is_wp_error($id) ) {
			$errors['upload_error'] = $id;
			$id = false;
		}
	}

	if ( !empty($_POST['insertonlybutton']) ) {
		$href = $_POST['insertonly']['href'];
		if ( !empty($href) && !strpos($href, '://') )
			$href = "http://$href";
		$title = attribute_escape($_POST['insertonly']['title']);
		if ( empty($title) )
			$title = basename($href);
		if ( !empty($title) && !empty($href) )
			$html = "<a href='$href' >$title</a>";
		return media_send_to_editor($html);
	}

	if ( !empty($_POST) ) {
		$return = media_upload_form_handler();

		if ( is_string($return) )
			return $return;
		if ( is_array($return) )
			$errors = $return;
	}

	if ( isset($_POST['save']) ) {
		$errors['upload_notice'] = __('Saved.');
		return media_upload_gallery();
	}

	if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' )
		return wp_iframe( 'media_upload_type_url_form', 'video', $errors, $id );

	return wp_iframe( 'media_upload_type_form', 'video', $errors, $id );
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @return unknown
 */
function media_upload_file() {
	$errors = array();
	$id = 0;

	if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
		// Upload File button was clicked
		$id = media_handle_upload('async-upload', $_REQUEST['post_id']);
		unset($_FILES);
		if ( is_wp_error($id) ) {
			$errors['upload_error'] = $id;
			$id = false;
		}
	}

	if ( !empty($_POST['insertonlybutton']) ) {
		$href = $_POST['insertonly']['href'];
		if ( !empty($href) && !strpos($href, '://') )
			$href = "http://$href";
		$title = attribute_escape($_POST['insertonly']['title']);
		if ( empty($title) )
			$title = basename($href);
		if ( !empty($title) && !empty($href) )
			$html = "<a href='$href' >$title</a>";
		return media_send_to_editor($html);
	}

	if ( !empty($_POST) ) {
		$return = media_upload_form_handler();

		if ( is_string($return) )
			return $return;
		if ( is_array($return) )
			$errors = $return;
	}

	if ( isset($_POST['save']) ) {
		$errors['upload_notice'] = __('Saved.');
		return media_upload_gallery();
	}

	if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' )
		return wp_iframe( 'media_upload_type_url_form', 'file', $errors, $id );

	return wp_iframe( 'media_upload_type_form', 'file', $errors, $id );
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @return unknown
 */
function media_upload_gallery() {
	$errors = array();

	if ( !empty($_POST) ) {
		$return = media_upload_form_handler();

		if ( is_string($return) )
			return $return;
		if ( is_array($return) )
			$errors = $return;
	}

	wp_enqueue_script('admin-gallery');
	return wp_iframe( 'media_upload_gallery_form', $errors );
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @return unknown
 */
function media_upload_library() {
	$errors = array();
	if ( !empty($_POST) ) {
		$return = media_upload_form_handler();

		if ( is_string($return) )
			return $return;
		if ( is_array($return) )
			$errors = $return;
	}

	return wp_iframe( 'media_upload_library_form', $errors );
}

/**
 * Retrieve HTML for the image alignment radio buttons with the specified one checked.
 *
 * @since unknown
 *
 * @param unknown_type $post
 * @param unknown_type $checked
 * @return unknown
 */
function image_align_input_fields($post, $checked='') {

	$alignments = array('none' => 'None', 'left' => 'Left', 'center' => 'Center', 'right' => 'Right');
	if ( !array_key_exists($checked, $alignments) )
		$checked = 'none';

	$out = array();
	foreach ($alignments as $name => $label) {

		$out[] = "<input type='radio' name='attachments[{$post->ID}][align]' id='image-align-{$name}-{$post->ID}' value='$name'".
		 	( $checked == $name ? " checked='checked'" : "" ) .
			" /><label for='image-align-{$name}-{$post->ID}' class='align image-align-{$name}-label'>" . __($label) . "</label>";
	}
	return join("\n", $out);
}

/**
 * Retrieve HTML for the size radio buttons with the specified one checked.
 *
 * @since unknown
 *
 * @param unknown_type $post
 * @param unknown_type $checked
 * @return unknown
 */
function image_size_input_fields($post, $checked='') {

		// get a list of the actual pixel dimensions of each possible intermediate version of this image
		$size_names = array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full size'));

		foreach ( $size_names as $size => $name) {
			$downsize = image_downsize($post->ID, $size);

			// is this size selectable?
			$enabled = ( $downsize[3] || 'full' == $size );
			$css_id = "image-size-{$size}-{$post->ID}";
			// if this size is the default but that's not available, don't select it
			if ( $checked && !$enabled )
				$checked = '';
			// if $checked was not specified, default to the first available size that's bigger than a thumbnail
			if ( !$checked && $enabled && 'thumbnail' != $size )
				$checked = $size;

			$html = "<div class='image-size-item'><input type='radio' ".( $enabled ? '' : "disabled='disabled'")."name='attachments[$post->ID][image-size]' id='{$css_id}' value='{$size}'".( $checked == $size ? " checked='checked'" : '') ." />";

			$html .= "<label for='{$css_id}'>" . __($name). "</label>";
			// only show the dimensions if that choice is available
			if ( $enabled )
				$html .= " <label for='{$css_id}' class='help'>" . sprintf( __("(%d&nbsp;&times;&nbsp;%d)"), $downsize[1], $downsize[2] ). "</label>";

			$html .= '</div>';

			$out[] = $html;
		}

		return array(
			'label' => __('Size'),
			'input' => 'html',
			'html'  => join("\n", $out),
		);
}

/**
 * Retrieve HTML for the Link URL buttons with the default link type as specified.
 *
 * @since unknown
 *
 * @param unknown_type $post
 * @param unknown_type $url_type
 * @return unknown
 */
function image_link_input_fields($post, $url_type='') {

	$file = wp_get_attachment_url($post->ID);
	$link = get_attachment_link($post->ID);

	$url = '';
	if ( $url_type == 'file' )
		$url = $file;
	elseif ( $url_type == 'post' )
		$url = $link;

	return "<input type='text' class='urlfield' name='attachments[$post->ID][url]' value='" . attribute_escape($url) . "' /><br />
				<button type='button' class='button urlnone' title=''>" . __('None') . "</button>
				<button type='button' class='button urlfile' title='" . attribute_escape($file) . "'>" . __('File URL') . "</button>
				<button type='button' class='button urlpost' title='" . attribute_escape($link) . "'>" . __('Post URL') . "</button>
";
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $form_fields
 * @param unknown_type $post
 * @return unknown
 */
function image_attachment_fields_to_edit($form_fields, $post) {
	if ( substr($post->post_mime_type, 0, 5) == 'image' ) {
		$form_fields['post_title']['required'] = true;

		$form_fields['post_excerpt']['label'] = __('Caption');
		$form_fields['post_excerpt']['helps'][] = __('Also used as alternate text for the image');

		$form_fields['post_content']['label'] = __('Description');

		$form_fields['align'] = array(
			'label' => __('Alignment'),
			'input' => 'html',
			'html'  => image_align_input_fields($post, get_option('image_default_align')),
		);

		$form_fields['image-size'] = image_size_input_fields($post, get_option('image_default_size'));
	}
	return $form_fields;
}

add_filter('attachment_fields_to_edit', 'image_attachment_fields_to_edit', 10, 2);

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $form_fields
 * @param unknown_type $post
 * @return unknown
 */
function media_single_attachment_fields_to_edit( $form_fields, $post ) {
	unset($form_fields['url'], $form_fields['align'], $form_fields['image-size']);
	return $form_fields;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $post
 * @param unknown_type $attachment
 * @return unknown
 */
function image_attachment_fields_to_save($post, $attachment) {
	if ( substr($post['post_mime_type'], 0, 5) == 'image' ) {
		if ( strlen(trim($post['post_title'])) == 0 ) {
			$post['post_title'] = preg_replace('/\.\w+$/', '', basename($post['guid']));
			$post['errors']['post_title']['errors'][] = __('Empty Title filled from filename.');
		}
	}

	return $post;
}

add_filter('attachment_fields_to_save', 'image_attachment_fields_to_save', 10, 2);

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $html
 * @param unknown_type $attachment_id
 * @param unknown_type $attachment
 * @return unknown
 */
function image_media_send_to_editor($html, $attachment_id, $attachment) {
	$post =& get_post($attachment_id);
	if ( substr($post->post_mime_type, 0, 5) == 'image' ) {
		$url = $attachment['url'];

		if ( isset($attachment['align']) )
			$align = $attachment['align'];
		else
			$align = 'none';

		if ( !empty($attachment['image-size']) )
			$size = $attachment['image-size'];
		else
			$size = 'medium';

		$rel = ( $url == get_attachment_link($attachment_id) );

		return get_image_send_to_editor($attachment_id, $attachment['post_excerpt'], $attachment['post_title'], $align, $url, $rel, $size);
	}

	return $html;
}

add_filter('media_send_to_editor', 'image_media_send_to_editor', 10, 3);

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $post
 * @param unknown_type $errors
 * @return unknown
 */
function get_attachment_fields_to_edit($post, $errors = null) {
	if ( is_int($post) )
		$post =& get_post($post);
	if ( is_array($post) )
		$post = (object) $post;

	$edit_post = sanitize_post($post, 'edit');

	$form_fields = array(
		'post_title'   => array(
			'label'      => __('Title'),
			'value'      => $edit_post->post_title,
		),
		'post_excerpt' => array(
			'label'      => __('Caption'),
			'value'      => $edit_post->post_excerpt,
		),
		'post_content' => array(
			'label'      => __('Description'),
			'value'      => $edit_post->post_content,
			'input'      => 'textarea',
		),
		'url'          => array(
			'label'      => __('Link URL'),
			'input'      => 'html',
			'html'       => image_link_input_fields($post, get_option('image_default_link_type')),
			'helps'      => __('Enter a link URL or click above for presets.'),
		),
		'menu_order'   => array(
			'label'      => __('Order'),
			'value'      => $edit_post->menu_order
		),
	);

	foreach ( get_attachment_taxonomies($post) as $taxonomy ) {
		$t = (array) get_taxonomy($taxonomy);
		if ( empty($t['label']) )
			$t['label'] = $taxonomy;
		if ( empty($t['args']) )
			$t['args'] = array();

		$terms = get_object_term_cache($post->ID, $taxonomy);
		if ( empty($terms) )
			$terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']);

		$values = array();

		foreach ( $terms as $term )
			$values[] = $term->name;
		$t['value'] = join(', ', $values);

		$form_fields[$taxonomy] = $t;
	}

	// Merge default fields with their errors, so any key passed with the error (e.g. 'error', 'helps', 'value') will replace the default
	// The recursive merge is easily traversed with array casting: foreach( (array) $things as $thing )
	$form_fields = array_merge_recursive($form_fields, (array) $errors);

	$form_fields = apply_filters('attachment_fields_to_edit', $form_fields, $post);

	return $form_fields;
}

/**
 * Retrieve HTML for media items of post gallery.
 *
 * The HTML markup retrieved will be created for the progress of SWF Upload
 * component. Will also create link for showing and hiding the form to modify
 * the image attachment.
 *
 * @since unknown
 *
 * @param int $post_id Optional. Post ID.
 * @param array $errors Errors for attachment, if any.
 * @return string
 */
function get_media_items( $post_id, $errors ) {
	if ( $post_id ) {
		$post = get_post($post_id);
		if ( $post && $post->post_type == 'attachment' )
			$attachments = array($post->ID => $post);
		else
			$attachments = get_children( array( 'post_parent' => $post_id, 'post_type' => 'attachment', 'orderby' => 'menu_order ASC, ID', 'order' => 'DESC') );
	} else {
		if ( is_array($GLOBALS['wp_the_query']->posts) )
			foreach ( $GLOBALS['wp_the_query']->posts as $attachment )
				$attachments[$attachment->ID] = $attachment;
	}

	$output = '';
	foreach ( (array) $attachments as $id => $attachment )
		if ( $item = get_media_item( $id, array( 'errors' => isset($errors[$id]) ? $errors[$id] : null) ) )
			$output .= "\n<div id='media-item-$id' class='media-item child-of-$attachment->post_parent preloaded'><div class='progress'><div class='bar'></div></div><div id='media-upload-error-$id'></div><div class='filename'></div>$item\n</div>";

	return $output;
}

/**
 * Retrieve HTML form for modifying the image attachment.
 *
 * @since unknown
 *
 * @param int $attachment_id Attachment ID for modification.
 * @param string|array $args Optional. Override defaults.
 * @return string HTML form for attachment.
 */
function get_media_item( $attachment_id, $args = null ) {
	global $redir_tab;

	$default_args = array( 'errors' => null, 'send' => true, 'delete' => true, 'toggle' => true, 'show_title' => true );
	$args = wp_parse_args( $args, $default_args );
	extract( $args, EXTR_SKIP );

	global $post_mime_types;
	if ( ( $attachment_id = intval($attachment_id) ) && $thumb_url = get_attachment_icon_src( $attachment_id ) )
		$thumb_url = $thumb_url[0];
	else
		return false;

	$toggle_on = __('Show');
	$toggle_off = __('Hide');

	$post = get_post($attachment_id);

	$filename = basename($post->guid);
	$title = attribute_escape($post->post_title);

	if ( $_tags = get_the_tags($attachment_id) ) {
		foreach ( $_tags as $tag )
			$tags[] = $tag->name;
		$tags = attribute_escape(join(', ', $tags));
	}

	$type = '';
	if ( isset($post_mime_types) ) {
		$keys = array_keys(wp_match_mime_types(array_keys($post_mime_types), $post->post_mime_type));
		$type = array_shift($keys);
		$type = "<input type='hidden' id='type-of-$attachment_id' value='" . attribute_escape( $type ) . "' />";
	}

	$form_fields = get_attachment_fields_to_edit($post, $errors);

	if ( $toggle ) {
		$class = empty($errors) ? 'startclosed' : 'startopen';
		$toggle_links = "
	<a class='toggle describe-toggle-on' href='#'>$toggle_on</a>
	<a class='toggle describe-toggle-off' href='#'>$toggle_off</a>";
	} else {
		$class = 'form-table';
		$toggle_links = '';
	}

	$display_title = ( !empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case
	$display_title = $show_title ? "<div class='filename new'>" . wp_html_excerpt($display_title, 60) . "</div>" : '';

	$gallery = ( (isset($_REQUEST['tab']) && 'gallery' == $_REQUEST['tab']) || (isset($redir_tab) && 'gallery' == $redir_tab) ) ? true : false;
	$order = '';

	foreach ( $form_fields as $key => $val ) {
		if ( 'menu_order' == $key ) {
			if ( $gallery )
				$order = '<div class="menu_order"> <input class="menu_order_input" type="text" id="attachments['.$attachment_id.'][menu_order]" name="attachments['.$attachment_id.'][menu_order]" value="'.$val['value'].'" /></div>';
			else
				$order = '<input type="hidden" name="attachments['.$attachment_id.'][menu_order]" value="'.$val['value'].'" />';

			unset($form_fields['menu_order']);
			break;
		}
	}

	$item = "
	$type
	$toggle_links
	$order
	$display_title
	<table class='slidetoggle describe $class'>
		<thead class='media-item-info'>
		<tr>
			<td class='A1B1' rowspan='4'><img class='thumbnail' src='$thumb_url' alt='' /></td>
			<td>$filename</td>
		</tr>
		<tr><td>$post->post_mime_type</td></tr>
		<tr><td>" . mysql2date($post->post_date, get_option('time_format')) . "</td></tr>
		<tr><td>" . apply_filters('media_meta', '', $post) . "</td></tr>
		</thead>
		<tbody>\n";

	$defaults = array(
		'input'      => 'text',
		'required'   => false,
		'value'      => '',
		'extra_rows' => array(),
	);

	$delete_href = wp_nonce_url("post.php?action=delete-post&amp;post=$attachment_id", 'delete-post_' . $attachment_id);
	if ( $send )
		$send = "<input type='submit' class='button' name='send[$attachment_id]' value='" . attribute_escape( __( 'Insert into Post' ) ) . "' />";
	if ( $delete )
		$delete = "<a href=\"#\" class=\"del-link\" onclick=\"document.getElementById('del_attachment_$attachment_id').style.display='block';return false;\">" . __('Delete') . "</a>";
	if ( ( $send || $delete ) && !isset($form_fields['buttons']) )
		$form_fields['buttons'] = array('tr' => "\t\t<tr class='submit'><td></td><td class='savesend'>$send $delete
		<div id=\"del_attachment_$attachment_id\" class=\"del-attachment\" style=\"display:none;\">" . sprintf(__("You are about to delete <strong>%s</strong>."), $filename) . " <a href=\"$delete_href\" id=\"del[$attachment_id]\" class=\"delete\">" . __('Continue') . "</a>
		<a href=\"#\" class=\"del-link\" onclick=\"this.parentNode.style.display='none';return false;\">" . __('Cancel') . "</a></div></td></tr>\n");

	$hidden_fields = array();

	foreach ( $form_fields as $id => $field ) {
		if ( $id{0} == '_' )
			continue;

		if ( !empty($field['tr']) ) {
			$item .= $field['tr'];
			continue;
		}

		$field = array_merge($defaults, $field);
		$name = "attachments[$attachment_id][$id]";

		if ( $field['input'] == 'hidden' ) {
			$hidden_fields[$name] = $field['value'];
			continue;
		}

		$required = $field['required'] ? '<abbr title="required" class="required">*</abbr>' : '';
		$aria_required = $field['required'] ? " aria-required='true' " : '';
		$class  = $id;
		$class .= $field['required'] ? ' form-required' : '';

		$item .= "\t\t<tr class='$class'>\n\t\t\t<th valign='top' scope='row' class='label'><label for='$name'><span class='alignleft'>{$field['label']}</span><span class='alignright'>$required</span><br class='clear' /></label></th>\n\t\t\t<td class='field'>";
		if ( !empty($field[$field['input']]) )
			$item .= $field[$field['input']];
		elseif ( $field['input'] == 'textarea' ) {
			$item .= "<textarea type='text' id='$name' name='$name'" . $aria_required . ">" . htmlspecialchars( $field['value'] ) . "</textarea>";
		} else {
			$item .= "<input type='text' id='$name' name='$name' value='" . attribute_escape( $field['value'] ) . "'" . $aria_required . "/>";
		}
		if ( !empty($field['helps']) )
			$item .= "<p class='help'>" . join( "</p>\n<p class='help'>", array_unique((array) $field['helps']) ) . '</p>';
		$item .= "</td>\n\t\t</tr>\n";

		$extra_rows = array();

		if ( !empty($field['errors']) )
			foreach ( array_unique((array) $field['errors']) as $error )
				$extra_rows['error'][] = $error;

		if ( !empty($field['extra_rows']) )
			foreach ( $field['extra_rows'] as $class => $rows )
				foreach ( (array) $rows as $html )
					$extra_rows[$class][] = $html;

		foreach ( $extra_rows as $class => $rows )
			foreach ( $rows as $html )
				$item .= "\t\t<tr><td></td><td class='$class'>$html</td></tr>\n";
	}

	if ( !empty($form_fields['_final']) )
		$item .= "\t\t<tr class='final'><td colspan='2'>{$form_fields['_final']}</td></tr>\n";
	$item .= "\t</tbody>\n";
	$item .= "\t</table>\n";

	foreach ( $hidden_fields as $name => $value )
		$item .= "\t<input type='hidden' name='$name' id='$name' value='" . attribute_escape( $value ) . "' />\n";

	if ( $post->post_parent < 1 && (int) $_REQUEST['post_id'] ) {
		$parent = (int) $_REQUEST['post_id'];
		$parent_name = "attachments[$attachment_id][post_parent]";

		$item .= "\t<input type='hidden' name='$parent_name' id='$parent_name' value='" . $parent . "' />\n";
	}

	return $item;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 */
function media_upload_header() {
	?>
	<script type="text/javascript">post_id = <?php echo intval($_REQUEST['post_id']); ?>;</script>
	<div id="media-upload-header">
	<?php the_media_upload_tabs(); ?>
	</div>
	<?php
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $errors
 */
function media_upload_form( $errors = null ) {
	global $type, $tab;

	$flash_action_url = admin_url('async-upload.php');

	// If Mac and mod_security, no Flash. :(
	$flash = true;
	if ( false !== strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'mac') && apache_mod_loaded('mod_security') )
		$flash = false;

	$flash = apply_filters('flash_uploader', $flash);
	$post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;

?>
<div id="media-upload-notice">
<?php if (isset($errors['upload_notice']) ) { ?>
	<?php echo $errors['upload_notice']; ?>
<?php } ?>
</div>
<div id="media-upload-error">
<?php if (isset($errors['upload_error']) && is_wp_error($errors['upload_error'])) { ?>
	<?php echo $errors['upload_error']->get_error_message(); ?>
<?php } ?>
</div>

<?php do_action('pre-upload-ui'); ?>

<?php if ( $flash ) : ?>
<script type="text/javascript">
<!--
SWFUpload.onload = function() {
	swfu = new SWFUpload({
			button_text: '<span class="button"><?php _e('Select Files'); ?></span>',
			button_text_style: '.button { text-align: center; font-weight: bold; font-family:"Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana,sans-serif; }',
			button_height: "24",
			button_width: "132",
			button_image_url: '<?php echo includes_url('images/upload.png'); ?>',
			button_placeholder_id: "flash-browse-button",
			upload_url : "<?php echo attribute_escape( $flash_action_url ); ?>",
			flash_url : "<?php echo includes_url('js/swfupload/swfupload.swf'); ?>",
			file_post_name: "async-upload",
			file_types: "<?php echo apply_filters('upload_file_glob', '*.*'); ?>",
			post_params : {
				"post_id" : "<?php echo $post_id; ?>",
				"auth_cookie" : "<?php if ( is_ssl() ) echo $_COOKIE[SECURE_AUTH_COOKIE]; else echo $_COOKIE[AUTH_COOKIE]; ?>",
				"_wpnonce" : "<?php echo wp_create_nonce('media-form'); ?>",
				"type" : "<?php echo $type; ?>",
				"tab" : "<?php echo $tab; ?>",
				"short" : "1"
			},
			file_size_limit : "<?php echo wp_max_upload_size(); ?>b",
			file_dialog_start_handler : fileDialogStart,
			file_queued_handler : fileQueued,
			upload_start_handler : uploadStart,
			upload_progress_handler : uploadProgress,
			upload_error_handler : uploadError,
			upload_success_handler : uploadSuccess,
			upload_complete_handler : uploadComplete,
			file_queue_error_handler : fileQueueError,
			file_dialog_complete_handler : fileDialogComplete,
			swfupload_pre_load_handler: swfuploadPreLoad,
			swfupload_load_failed_handler: swfuploadLoadFailed,
			custom_settings : {
				degraded_element_id : "html-upload-ui", // id of the element displayed when swfupload is unavailable
				swfupload_element_id : "flash-upload-ui" // id of the element displayed when swfupload is available
			},
			debug: false
		});
};
//-->
</script>

<div id="flash-upload-ui">
<?php do_action('pre-flash-upload-ui'); ?>

	<div><?php _e( 'Choose files to upload' ); ?> <div id="flash-browse-button"></div></div>
<?php do_action('post-flash-upload-ui'); ?>
	<p class="howto"><?php _e('After a file has been uploaded, you can add titles and descriptions.'); ?></p>
</div>

<?php endif; // $flash ?>

<div id="html-upload-ui">
<?php do_action('pre-html-upload-ui'); ?>
	<p id="async-upload-wrap">
	<input type="file" name="async-upload" id="async-upload" /> <input type="submit" class="button" name="html-upload" value="<?php echo attribute_escape(__('Upload')); ?>" /> <a href="#" onclick="return top.tb_remove();"><?php _e('Cancel'); ?></a>
	</p>

	<br class="clear" />
	<?php if ( is_lighttpd_before_150() ): ?>
	<p><?php _e('If you want to use all capabilities of the uploader, like uploading multiple files at once, please upgrade to lighttpd 1.5.'); ?></p>
	<?php endif;?>
<?php do_action('post-html-upload-ui'); ?>
</div>
<?php do_action('post-upload-ui'); ?>
<?php
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $type
 * @param unknown_type $errors
 * @param unknown_type $id
 */
function media_upload_type_form($type = 'file', $errors = null, $id = null) {
	media_upload_header();

	$post_id = intval($_REQUEST['post_id']);

	$form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");
	$form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
?>

<form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form type-form validate" id="<?php echo $type; ?>-form">
<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
<?php wp_nonce_field('media-form'); ?>

<h3 class="media-title"><?php _e('Add media files from your computer'); ?></h3>

<?php media_upload_form( $errors ); ?>

<script type="text/javascript">
<!--
jQuery(function($){
	var preloaded = $(".media-item.preloaded");
	if ( preloaded.length > 0 ) {
		preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
	}
	updateMediaForm();
});
-->
</script>
<div id="media-items">
<?php
if ( $id ) {
	if ( !is_wp_error($id) ) {
		echo get_media_items( $id, $errors );
	} else {
		echo '<div id="media-upload-error">'.wp_specialchars($id->get_error_message()).'</div>';
		exit;
	}
}
?>
</div>
<input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" />
<?php
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $type
 * @param unknown_type $errors
 * @param unknown_type $id
 */
function media_upload_type_url_form($type = 'file', $errors = null, $id = null) {
	media_upload_header();

	$post_id = intval($_REQUEST['post_id']);

	$form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");
	$form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);

	$callback = "type_url_form_$type";
?>

<form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form type-form validate" id="<?php echo $type; ?>-form">
<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
<?php wp_nonce_field('media-form'); ?>

<?php if ( is_callable($callback) ) { ?>

<h3 class="media-title"><?php _e('Add media file from URL'); ?></h3>

<script type="text/javascript">
//<![CDATA[
var addExtImage = {

	width : '',
	height : '',
	align : 'alignnone',

	insert : function() {
		var t = this, html, f = document.forms[0], cls, title = '', alt = '', caption = null;

		if ( '' == f.src.value || '' == t.width ) return false;

		if ( f.title.value ) {
			title = f.title.value.replace(/['"<>]+/g, '');
			title = ' title="'+title+'"';
		}

		if ( f.alt.value ) {
			alt = f.alt.value.replace(/['"<>]+/g, '');
<?php if ( ! apply_filters( 'disable_captions', '' ) ) { ?>
			caption = f.alt.value.replace(/'/g, '&#39;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
<?php } ?>
		}

		cls = caption ? '' : ' class="'+t.align+'"';

		html = '<img alt="'+alt+'" src="'+f.src.value+'"'+title+cls+' width="'+t.width+'" height="'+t.height+'" />';

		if ( f.url.value )
			html = '<a href="'+f.url.value+'">'+html+'</a>';

		if ( caption )
			html = '[caption id="" align="'+t.align+'" width="'+t.width+'" caption="'+caption+'"]'+html+'[/caption]';

		var win = window.dialogArguments || opener || parent || top;
		win.send_to_editor(html);
	},

	resetImageData : function() {
		var t = addExtImage;

		t.width = t.height = '';
		document.getElementById('go_button').style.color = '#bbb';
		if ( ! document.forms[0].src.value )
			document.getElementById('status_img').src = 'images/required.gif';
		else document.getElementById('status_img').src = 'images/no.png';
	},

	updateImageData : function() {
		var t = addExtImage;

		t.width = t.preloadImg.width;
		t.height = t.preloadImg.height;
		document.getElementById('go_button').style.color = '#333';
		document.getElementById('status_img').src = 'images/yes.png';
	},

	getImageData : function() {
		var t = addExtImage, src = document.forms[0].src.value;

		if ( ! src ) {
			t.resetImageData();
			return false;
		}
		document.getElementById('status_img').src = 'images/loading.gif';
		t.preloadImg = new Image();
		t.preloadImg.onload = t.updateImageData;
		t.preloadImg.onerror = t.resetImageData;
		t.preloadImg.src = src;
	}
}
//]]>
</script>

<div id="media-items">
<div class="media-item media-blank">
<?php echo call_user_func($callback); ?>
</div>
</div>
</form>
<?php
	} else {
		wp_die( __('Unknown action.') );
	}
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $errors
 */
function media_upload_gallery_form($errors) {
	global $redir_tab;

	$redir_tab = 'gallery';
	media_upload_header();

	$post_id = intval($_REQUEST['post_id']);
	$form_action_url = admin_url("media-upload.php?type={$GLOBALS['type']}&tab=gallery&post_id=$post_id");
?>

<script type="text/javascript">
<!--
jQuery(function($){
	var preloaded = $(".media-item.preloaded");
	if ( preloaded.length > 0 ) {
		preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
		updateMediaForm();
	}
});
-->
</script>

<form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form validate" id="gallery-form">
<?php wp_nonce_field('media-form'); ?>
<?php //media_upload_form( $errors ); ?>
<table class="widefat" cellspacing="0">
<thead><tr>
<th><?php _e('Media'); ?></th>
<th class="order-head"><?php _e('Order'); ?></th>
</tr></thead>
</table>
<div id="media-items">
<?php echo get_media_items($post_id, $errors); ?>
</div>

<p class="ml-submit">
<input type="submit" class="button savebutton" style="display:none;" name="save" id="save-all" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" />
<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
<input type="hidden" name="type" value="<?php echo attribute_escape( $GLOBALS['type'] ); ?>" />
<input type="hidden" name="tab" value="<?php echo attribute_escape( $GLOBALS['tab'] ); ?>" />
</p>

<div id="gallery-settings" style="display:none;">
<div class="title"><?php _e('Gallery Settings'); ?></div>
<table id="basic" class="describe"><tbody>
	<tr>
	<th scope="row" class="label">
		<label>
		<span class="alignleft"><?php _e('Link thumbnails to:'); ?></span>
		</label>
	</th>
	<td class="field">
		<input type="radio" name="linkto" id="linkto-file" value="file" />
		<label for="linkto-file" class="radio"><?php _e('Image File'); ?></label>

		<input type="radio" checked="checked" name="linkto" id="linkto-post" value="post" />
		<label for="linkto-post" class="radio"><?php _e('Attachment Page'); ?></label>
	</td>
	</tr>

	<tr>
	<th scope="row" class="label">
		<label>
		<span class="alignleft"><?php _e('Order images by:'); ?></span>
		</label>
	</th>
	<td class="field">
		<select id="orderby" name="orderby">
			<option value="menu_order" selected="selected"><?php _e('Menu order'); ?></option>
			<option value="post_name"><?php _e('Name'); ?></option>
			<option value="ID"><?php _e('Date/Time'); ?></option>
		</select>
	</td>
	</tr>

	<tr>
	<th scope="row" class="label">
		<label>
		<span class="alignleft"><?php _e('Order:'); ?></span>
		</label>
	</th>
	<td class="field">
		<input type="radio" checked="checked" name="order" id="order-asc" value="asc" />
		<label for="order-asc" class="radio"><?php _e('Ascending'); ?></label>

		<input type="radio" name="order" id="order-desc" value="desc" />
		<label for="order-desc" class="radio"><?php _e('Descending'); ?></label>
	</td>
	</tr>

	<tr>
	<th scope="row" class="label">
		<label>
		<span class="alignleft"><?php _e('Gallery columns:'); ?></span>
		</label>
	</th>
	<td class="field">
		<select id="columns" name="columns">
			<option value="2"><?php _e('2'); ?></option>
			<option value="3" selected="selected"><?php _e('3'); ?></option>
			<option value="4"><?php _e('4'); ?></option>
			<option value="5"><?php _e('5'); ?></option>
			<option value="6"><?php _e('6'); ?></option>
			<option value="7"><?php _e('7'); ?></option>
			<option value="8"><?php _e('8'); ?></option>
			<option value="9"><?php _e('9'); ?></option>
		</select>
	</td>
	</tr>
</tbody></table>

<p class="ml-submit">
<input type="button" class="button" style="display:none;" onmousedown="wpgallery.update();" name="insert-gallery" id="insert-gallery" value="<?php echo attribute_escape( __( 'Insert gallery' ) ); ?>" />
<input type="button" class="button" style="display:none;" onmousedown="wpgallery.update();" name="update-gallery" id="update-gallery" value="<?php echo attribute_escape( __( 'Update gallery settings' ) ); ?>" />
</p>
</div>
</form>
<?php
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $errors
 */
function media_upload_library_form($errors) {
	global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;

	media_upload_header();

	$post_id = intval($_REQUEST['post_id']);

	$form_action_url = admin_url("media-upload.php?type={$GLOBALS['type']}&tab=library&post_id=$post_id");

	$_GET['paged'] = isset( $_GET['paged'] ) ? intval($_GET['paged']) : 0;
	if ( $_GET['paged'] < 1 )
		$_GET['paged'] = 1;
	$start = ( $_GET['paged'] - 1 ) * 10;
	if ( $start < 1 )
		$start = 0;
	add_filter( 'post_limits', $limit_filter = create_function( '$a', "return 'LIMIT $start, 10';" ) );

	list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();

?>

<form id="filter" action="" method="get">
<input type="hidden" name="type" value="<?php echo attribute_escape( $type ); ?>" />
<input type="hidden" name="tab" value="<?php echo attribute_escape( $tab ); ?>" />
<input type="hidden" name="post_id" value="<?php echo (int) $post_id; ?>" />
<input type="hidden" name="post_mime_type" value="<?php echo attribute_escape( $_GET['post_mime_type'] ); ?>" />

<p id="media-search" class="search-box">
	<label class="hidden" for="media-search-input"><?php _e('Search Media');?>:</label>
	<input type="text" id="media-search-input" class="search-input" name="s" value="<?php the_search_query(); ?>" />
	<input type="submit" value="<?php echo attribute_escape( __( 'Search Media' ) ); ?>" class="button" />
</p>

<ul class="subsubsub">
<?php
$type_links = array();
$_num_posts = (array) wp_count_attachments();
$matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
foreach ( $matches as $_type => $reals )
	foreach ( $reals as $real )
		$num_posts[$_type] += $_num_posts[$real];
// If available type specified by media button clicked, filter by that type
if ( empty($_GET['post_mime_type']) && !empty($num_posts[$type]) ) {
	$_GET['post_mime_type'] = $type;
	list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
}
if ( empty($_GET['post_mime_type']) || $_GET['post_mime_type'] == 'all' )
	$class = ' class="current"';
$type_links[] = "<li><a href='" . clean_url(add_query_arg(array('post_mime_type'=>'all', 'paged'=>false, 'm'=>false))) . "'$class>".__('All Types')."</a>";
foreach ( $post_mime_types as $mime_type => $label ) {
	$class = '';

	if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) )
		continue;

	if ( wp_match_mime_types($mime_type, $_GET['post_mime_type']) )
		$class = ' class="current"';

	$type_links[] = "<li><a href='" . clean_url(add_query_arg(array('post_mime_type'=>$mime_type, 'paged'=>false))) . "'$class>" . sprintf(__ngettext($label[2][0], $label[2][1], $num_posts[$mime_type]), "<span id='$mime_type-counter'>" . number_format_i18n( $num_posts[$mime_type] ) . '</span>') . '</a>';
}
echo implode(' | </li>', $type_links) . '</li>';
unset($type_links);
?>
</ul>

<div class="tablenav">

<?php
$page_links = paginate_links( array(
	'base' => add_query_arg( 'paged', '%#%' ),
	'format' => '',
	'prev_text' => __('&laquo;'),
	'next_text' => __('&raquo;'),
	'total' => ceil($wp_query->found_posts / 10),
	'current' => $_GET['paged']
));

if ( $page_links )
	echo "<div class='tablenav-pages'>$page_links</div>";
?>

<div class="alignleft actions">
<?php

$arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'attachment' ORDER BY post_date DESC";

$arc_result = $wpdb->get_results( $arc_query );

$month_count = count($arc_result);

if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?>
<select name='m'>
<option<?php selected( @$_GET['m'], 0 ); ?> value='0'><?php _e('Show all dates'); ?></option>
<?php
foreach ($arc_result as $arc_row) {
	if ( $arc_row->yyear == 0 )
		continue;
	$arc_row->mmonth = zeroise( $arc_row->mmonth, 2 );

	if ( $arc_row->yyear . $arc_row->mmonth == $_GET['m'] )
		$default = ' selected="selected"';
	else
		$default = '';

	echo "<option$default value='" . attribute_escape( $arc_row->yyear . $arc_row->mmonth ) . "'>";
	echo wp_specialchars( $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear" );
	echo "</option>\n";
}
?>
</select>
<?php } ?>

<input type="submit" id="post-query-submit" value="<?php echo attribute_escape( __( 'Filter &#187;' ) ); ?>" class="button-secondary" />

</div>

<br class="clear" />
</div>
</form>

<form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form validate" id="library-form">

<?php wp_nonce_field('media-form'); ?>
<?php //media_upload_form( $errors ); ?>

<script type="text/javascript">
<!--
jQuery(function($){
	var preloaded = $(".media-item.preloaded");
	if ( preloaded.length > 0 ) {
		preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
		updateMediaForm();
	}
});
-->
</script>

<div id="media-items">
<?php echo get_media_items(null, $errors); ?>
</div>
<p class="ml-submit">
<input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" />
<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
</p>
</form>
<?php
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @return unknown
 */
function type_url_form_image() {

	if ( apply_filters( 'disable_captions', '' ) ) {
		$alt = __('Alternate Text');
		$alt_help = __('Alt text for the image, e.g. "The Mona Lisa"');
	} else {
		$alt = __('Image Caption');
		$alt_help = __('Also used as alternate text for the image');
	}

	$default_align = get_option('image_default_align');
	if ( empty($default_align) )
		$default_align = 'none';

	return '
	<table class="describe"><tbody>
		<tr>
			<th valign="top" scope="row" class="label" style="width:120px;">
				<span class="alignleft"><label for="src">' . __('Image URL') . '</label></span>
				<span class="alignright"><img id="status_img" src="images/required.gif" title="required" alt="required" /></span>
			</th>
			<td class="field"><input id="src" name="src" value="" type="text" aria-required="true" onblur="addExtImage.getImageData()" /></td>
		</tr>

		<tr>
			<th valign="top" scope="row" class="label">
				<span class="alignleft"><label for="title">' . __('Image Title') . '</label></span>
				<span class="alignright"><abbr title="required" class="required">*</abbr></span>
			</th>
			<td class="field"><p><input id="title" name="title" value="" type="text" aria-required="true" /></p></td>
		</tr>

		<tr>
			<th valign="top" scope="row" class="label">
				<span class="alignleft"><label for="alt">' . $alt . '</label></span>
			</th>
			<td class="field"><input id="alt" name="alt" value="" type="text" aria-required="true" />
			<p class="help">' . $alt_help . '</p></td>
		</tr>

		<tr class="align">
			<th valign="top" scope="row" class="label"><p><label for="align">' . __('Alignment') . '</label></p></th>
			<td class="field">
				<input name="align" id="align-none" value="none" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ($default_align == 'none' ? ' checked="checked"' : '').' />
				<label for="align-none" class="align image-align-none-label">' . __('None') . '</label>
				<input name="align" id="align-left" value="left" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ($default_align == 'left' ? ' checked="checked"' : '').' />
				<label for="align-left" class="align image-align-left-label">' . __('Left') . '</label>
				<input name="align" id="align-center" value="center" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ($default_align == 'center' ? ' checked="checked"' : '').' />
				<label for="align-center" class="align image-align-center-label">' . __('Center') . '</label>
				<input name="align" id="align-right" value="right" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ($default_align == 'right' ? ' checked="checked"' : '').' />
				<label for="align-right" class="align image-align-right-label">' . __('Right') . '</label>
			</td>
		</tr>

		<tr>
			<th valign="top" scope="row" class="label">
				<span class="alignleft"><label for="url">' . __('Link Image To:') . '</label></span>
			</th>
			<td class="field"><input id="url" name="url" value="" type="text" /><br />

			<button type="button" class="button" value="" onclick="document.forms[0].url.value=null">' . __('None') . '</button>
			<button type="button" class="button" value="" onclick="document.forms[0].url.value=document.forms[0].src.value">' . __('Link to image') . '</button>
			<p class="help">' . __('Enter a link URL or click above for presets.') . '</p></td>
		</tr>

		<tr>
			<td></td>
			<td>
				<input type="button" class="button" id="go_button" style="color:#bbb;" onclick="addExtImage.insert()" value="' . attribute_escape(__('Insert into Post')) . '" />
			</td>
		</tr>
	</tbody></table>
';

}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @return unknown
 */
function type_url_form_audio() {
	return '
	<table class="describe"><tbody>
		<tr>
			<th valign="top" scope="row" class="label">
				<span class="alignleft"><label for="insertonly[href]">' . __('Audio File URL') . '</label></span>
				<span class="alignright"><abbr title="required" class="required">*</abbr></span>
			</th>
			<td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td>
		</tr>
		<tr>
			<th valign="top" scope="row" class="label">
				<span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span>
				<span class="alignright"><abbr title="required" class="required">*</abbr></span>
			</th>
			<td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
		</tr>
		<tr><td></td><td class="help">' . __('Link text, e.g. "Still Alive by Jonathan Coulton"') . '</td></tr>
		<tr>
			<td></td>
			<td>
				<input type="submit" class="button" name="insertonlybutton" value="' . attribute_escape(__('Insert into Post')) . '" />
			</td>
		</tr>
	</tbody></table>
';
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @return unknown
 */
function type_url_form_video() {
	return '
	<table class="describe"><tbody>
		<tr>
			<th valign="top" scope="row" class="label">
				<span class="alignleft"><label for="insertonly[href]">' . __('Video URL') . '</label></span>
				<span class="alignright"><abbr title="required" class="required">*</abbr></span>
			</th>
			<td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td>
		</tr>
		<tr>
			<th valign="top" scope="row" class="label">
				<span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span>
				<span class="alignright"><abbr title="required" class="required">*</abbr></span>
			</th>
			<td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
		</tr>
		<tr><td></td><td class="help">' . __('Link text, e.g. "Lucy on YouTube"') . '</td></tr>
		<tr>
			<td></td>
			<td>
				<input type="submit" class="button" name="insertonlybutton" value="' . attribute_escape(__('Insert into Post')) . '" />
			</td>
		</tr>
	</tbody></table>
';
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @return unknown
 */
function type_url_form_file() {
	return '
	<table class="describe"><tbody>
		<tr>
			<th valign="top" scope="row" class="label">
				<span class="alignleft"><label for="insertonly[href]">' . __('URL') . '</label></span>
				<span class="alignright"><abbr title="required" class="required">*</abbr></span>
			</th>
			<td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td>
		</tr>
		<tr>
			<th valign="top" scope="row" class="label">
				<span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span>
				<span class="alignright"><abbr title="required" class="required">*</abbr></span>
			</th>
			<td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
		</tr>
		<tr><td></td><td class="help">' . __('Link text, e.g. "Ransom Demands (PDF)"') . '</td></tr>
		<tr>
			<td></td>
			<td>
				<input type="submit" class="button" name="insertonlybutton" value="' . attribute_escape(__('Insert into Post')) . '" />
			</td>
		</tr>
	</tbody></table>
';
}

/**
 * {@internal Missing Short Description}}
 *
 * Support a GET parameter for disabling the flash uploader.
 *
 * @since unknown
 *
 * @param unknown_type $flash
 * @return unknown
 */
function media_upload_use_flash($flash) {
	if ( array_key_exists('flash', $_REQUEST) )
		$flash = !empty($_REQUEST['flash']);
	return $flash;
}

add_filter('flash_uploader', 'media_upload_use_flash');

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 */
function media_upload_flash_bypass() {
	echo '<p class="upload-flash-bypass">';
	printf( __('You are using the Flash uploader.  Problems?  Try the <a href="%s">Browser uploader</a> instead.'), clean_url(add_query_arg('flash', 0)) );
	echo '</p>';
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 */
function media_upload_html_bypass() {
	echo '<p class="upload-html-bypass">';
	if ( array_key_exists('flash', $_REQUEST) )
		// the user manually selected the browser uploader, so let them switch back to Flash
		printf( __('You are using the Browser uploader.  Try the <a href="%s">Flash uploader</a> instead.'), clean_url(add_query_arg('flash', 1)) );
	else
		// the user probably doesn't have Flash
		printf( __('You are using the Browser uploader.') );

	echo '</p>';
}

add_action('post-flash-upload-ui', 'media_upload_flash_bypass');
add_action('post-html-upload-ui', 'media_upload_html_bypass');

/**
 * {@internal Missing Short Description}}
 *
 * Make sure the GET parameter sticks when we submit a form.
 *
 * @since unknown
 *
 * @param unknown_type $url
 * @return unknown
 */
function media_upload_bypass_url($url) {
	if ( array_key_exists('flash', $_REQUEST) )
		$url = add_query_arg('flash', intval($_REQUEST['flash']));
	return $url;
}

add_filter('media_upload_form_url', 'media_upload_bypass_url');



add_filter('async_upload_image', 'get_media_item', 10, 2);
add_filter('async_upload_audio', 'get_media_item', 10, 2);
add_filter('async_upload_video', 'get_media_item', 10, 2);
add_filter('async_upload_file', 'get_media_item', 10, 2);

add_action('media_upload_image', 'media_upload_image');
add_action('media_upload_audio', 'media_upload_audio');
add_action('media_upload_video', 'media_upload_video');
add_action('media_upload_file', 'media_upload_file');

add_filter('media_upload_gallery', 'media_upload_gallery');

add_filter('media_upload_library', 'media_upload_library');

?>
                                                                                                                                                                                                                                                                                                                                                                                                                    wp-admin/includes/misc.php                                                                          0000755 0023422 0004734 00000013256 11076751076 016614  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Misc WordPress Administration API.
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @return unknown
 */
function got_mod_rewrite() {
	$got_rewrite = apache_mod_loaded('mod_rewrite', true);
	return apply_filters('got_rewrite', $got_rewrite);
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $filename
 * @param unknown_type $marker
 * @return array An array of strings from a file (.htaccess ) from between BEGIN and END markers.
 */
function extract_from_markers( $filename, $marker ) {
	$result = array ();

	if (!file_exists( $filename ) ) {
		return $result;
	}

	if ( $markerdata = explode( "\n", implode( '', file( $filename ) ) ));
	{
		$state = false;
		foreach ( $markerdata as $markerline ) {
			if (strpos($markerline, '# END ' . $marker) !== false)
				$state = false;
			if ( $state )
				$result[] = $markerline;
			if (strpos($markerline, '# BEGIN ' . $marker) !== false)
				$state = true;
		}
	}

	return $result;
}

/**
 * {@internal Missing Short Description}}
 *
 * Inserts an array of strings into a file (.htaccess ), placing it between
 * BEGIN and END markers. Replaces existing marked info. Retains surrounding
 * data. Creates file if none exists.
 *
 * @since unknown
 *
 * @param unknown_type $filename
 * @param unknown_type $marker
 * @param unknown_type $insertion
 * @return bool True on write success, false on failure.
 */
function insert_with_markers( $filename, $marker, $insertion ) {
	if (!file_exists( $filename ) || is_writeable( $filename ) ) {
		if (!file_exists( $filename ) ) {
			$markerdata = '';
		} else {
			$markerdata = explode( "\n", implode( '', file( $filename ) ) );
		}

		$f = fopen( $filename, 'w' );
		$foundit = false;
		if ( $markerdata ) {
			$state = true;
			foreach ( $markerdata as $n => $markerline ) {
				if (strpos($markerline, '# BEGIN ' . $marker) !== false)
					$state = false;
				if ( $state ) {
					if ( $n + 1 < count( $markerdata ) )
						fwrite( $f, "{$markerline}\n" );
					else
						fwrite( $f, "{$markerline}" );
				}
				if (strpos($markerline, '# END ' . $marker) !== false) {
					fwrite( $f, "# BEGIN {$marker}\n" );
					if ( is_array( $insertion ))
						foreach ( $insertion as $insertline )
							fwrite( $f, "{$insertline}\n" );
					fwrite( $f, "# END {$marker}\n" );
					$state = true;
					$foundit = true;
				}
			}
		}
		if (!$foundit) {
			fwrite( $f, "\n# BEGIN {$marker}\n" );
			foreach ( $insertion as $insertline )
				fwrite( $f, "{$insertline}\n" );
			fwrite( $f, "# END {$marker}\n" );
		}
		fclose( $f );
		return true;
	} else {
		return false;
	}
}

/**
 * Updates the htaccess file with the current rules if it is writable.
 *
 * Always writes to the file if it exists and is writable to ensure that we
 * blank out old rules.
 *
 * @since unknown
 */
function save_mod_rewrite_rules() {
	global $wp_rewrite;

	$home_path = get_home_path();
	$htaccess_file = $home_path.'.htaccess';

	// If the file doesn't already exists check for write access to the directory and whether of not we have some rules.
	// else check for write access to the file.
	if ((!file_exists($htaccess_file) && is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks()) || is_writable($htaccess_file)) {
		if ( got_mod_rewrite() ) {
			$rules = explode( "\n", $wp_rewrite->mod_rewrite_rules() );
			return insert_with_markers( $htaccess_file, 'WordPress', $rules );
		}
	}

	return false;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $file
 */
function update_recently_edited( $file ) {
	$oldfiles = (array ) get_option( 'recently_edited' );
	if ( $oldfiles ) {
		$oldfiles = array_reverse( $oldfiles );
		$oldfiles[] = $file;
		$oldfiles = array_reverse( $oldfiles );
		$oldfiles = array_unique( $oldfiles );
		if ( 5 < count( $oldfiles ))
			array_pop( $oldfiles );
	} else {
		$oldfiles[] = $file;
	}
	update_option( 'recently_edited', $oldfiles );
}

/**
 * If siteurl or home changed, flush rewrite rules.
 *
 * @since unknown
 *
 * @param unknown_type $old_value
 * @param unknown_type $value
 */
function update_home_siteurl( $old_value, $value ) {
	global $wp_rewrite;

	if ( defined( "WP_INSTALLING" ) )
		return;

	// If home changed, write rewrite rules to new location.
	$wp_rewrite->flush_rules();
}

add_action( 'update_option_home', 'update_home_siteurl', 10, 2 );
add_action( 'update_option_siteurl', 'update_home_siteurl', 10, 2 );

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $url
 * @return unknown
 */
function url_shorten( $url ) {
	$short_url = str_replace( 'http://', '', stripslashes( $url ));
	$short_url = str_replace( 'www.', '', $short_url );
	if ('/' == substr( $short_url, -1 ))
		$short_url = substr( $short_url, 0, -1 );
	if ( strlen( $short_url ) > 35 )
		$short_url = substr( $short_url, 0, 32 ).'...';
	return $short_url;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $vars
 */
function wp_reset_vars( $vars ) {
	for ( $i=0; $i<count( $vars ); $i += 1 ) {
		$var = $vars[$i];
		global $$var;

		if (!isset( $$var ) ) {
			if ( empty( $_POST["$var"] ) ) {
				if ( empty( $_GET["$var"] ) )
					$$var = '';
				else
					$$var = $_GET["$var"];
			} else {
				$$var = $_POST["$var"];
			}
		}
	}
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $message
 */
function show_message($message) {
	if( is_wp_error($message) ){
		if( $message->get_error_data() )
			$message = $message->get_error_message() . ': ' . $message->get_error_data();
		else
			$message = $message->get_error_message();
	}
	echo "<p>$message</p>\n";
}

?>
                                                                                                                                                                                                                                                                                                                                                  wp-admin/includes/plugin.php                                                                        0000755 0023422 0004734 00000102363 11136163200 017134  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress Plugin Administration API
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * Parse the plugin contents to retrieve plugin's metadata.
 *
 * The metadata of the plugin's data searches for the following in the plugin's
 * header. All plugin data must be on its own line. For plugin description, it
 * must not have any newlines or only parts of the description will be displayed
 * and the same goes for the plugin data. The below is formatted for printing.
 *
 * <code>
 * /*
 * Plugin Name: Name of Plugin
 * Plugin URI: Link to plugin information
 * Description: Plugin Description
 * Author: Plugin author's name
 * Author URI: Link to the author's web site
 * Version: Must be set in the plugin for WordPress 2.3+
 * Text Domain: Optional. Unique identifier, should be same as the one used in
 *		plugin_text_domain()
 * Domain Path: Optional. Only useful if the translations are located in a
 *		folder above the plugin's base path. For example, if .mo files are
 *		located in the locale folder then Domain Path will be "/locale/" and
 *		must have the first slash. Defaults to the base folder the plugin is
 *		located in.
 *  * / # Remove the space to close comment
 * </code>
 *
 * Plugin data returned array contains the following:
 *		'Name' - Name of the plugin, must be unique.
 *		'Title' - Title of the plugin and the link to the plugin's web site.
 *		'Description' - Description of what the plugin does and/or notes
 *		from the author.
 *		'Author' - The author's name
 *		'AuthorURI' - The authors web site address.
 *		'Version' - The plugin version number.
 *		'PluginURI' - Plugin web site address.
 *		'TextDomain' - Plugin's text domain for localization.
 *		'DomainPath' - Plugin's relative directory path to .mo files.
 *
 * Some users have issues with opening large files and manipulating the contents
 * for want is usually the first 1kiB or 2kiB. This function stops pulling in
 * the plugin contents when it has all of the required plugin data.
 *
 * The first 8kiB of the file will be pulled in and if the plugin data is not
 * within that first 8kiB, then the plugin author should correct their plugin
 * and move the plugin data headers to the top.
 *
 * The plugin file is assumed to have permissions to allow for scripts to read
 * the file. This is not checked however and the file is only opened for
 * reading.
 *
 * @link http://trac.wordpress.org/ticket/5651 Previous Optimizations.
 * @link http://trac.wordpress.org/ticket/7372 Further and better Optimizations.
 * @since 1.5.0
 *
 * @param string $plugin_file Path to the plugin file
 * @param bool $markup If the returned data should have HTML markup applied
 * @param bool $translate If the returned data should be translated
 * @return array See above for description.
 */
function get_plugin_data( $plugin_file, $markup = true, $translate = true ) {
	// We don't need to write to the file, so just open for reading.
	$fp = fopen($plugin_file, 'r');

	// Pull only the first 8kiB of the file in.
	$plugin_data = fread( $fp, 8192 );

	// PHP will close file handle, but we are good citizens.
	fclose($fp);

	preg_match( '|Plugin Name:(.*)$|mi', $plugin_data, $name );
	preg_match( '|Plugin URI:(.*)$|mi', $plugin_data, $uri );
	preg_match( '|Version:(.*)|i', $plugin_data, $version );
	preg_match( '|Description:(.*)$|mi', $plugin_data, $description );
	preg_match( '|Author:(.*)$|mi', $plugin_data, $author_name );
	preg_match( '|Author URI:(.*)$|mi', $plugin_data, $author_uri );
	preg_match( '|Text Domain:(.*)$|mi', $plugin_data, $text_domain );
	preg_match( '|Domain Path:(.*)$|mi', $plugin_data, $domain_path );

	foreach ( array( 'name', 'uri', 'version', 'description', 'author_name', 'author_uri', 'text_domain', 'domain_path' ) as $field ) {
		if ( !empty( ${$field} ) )
			${$field} = trim(${$field}[1]);
		else
			${$field} = '';
	}

	$plugin_data = array(
				'Name' => $name, 'Title' => $name, 'PluginURI' => $uri, 'Description' => $description,
				'Author' => $author_name, 'AuthorURI' => $author_uri, 'Version' => $version,
				'TextDomain' => $text_domain, 'DomainPath' => $domain_path
				);
	if ( $markup || $translate )
		$plugin_data = _get_plugin_data_markup_translate($plugin_data, $markup, $translate);
	return $plugin_data;
}

function _get_plugin_data_markup_translate($plugin_data, $markup = true, $translate = true) {

	//Translate fields
	if( $translate && ! empty($plugin_data['TextDomain']) ) {
		if( ! empty( $plugin_data['DomainPath'] ) )
			load_plugin_textdomain($plugin_data['TextDomain'], dirname($plugin_file). $plugin_data['DomainPath']);
		else
			load_plugin_textdomain($plugin_data['TextDomain'], dirname($plugin_file));

		foreach ( array('Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version') as $field )
			$plugin_data[ $field ] = translate($plugin_data[ $field ], $plugin_data['TextDomain']);
	}

	//Apply Markup
	if ( $markup ) {
		if ( ! empty($plugin_data['PluginURI']) && ! empty($plugin_data['Name']) )
			$plugin_data['Title'] = '<a href="' . $plugin_data['PluginURI'] . '" title="' . __( 'Visit plugin homepage' ) . '">' . $plugin_data['Name'] . '</a>';
		else
			$plugin_data['Title'] = $plugin_data['Name'];

		if ( ! empty($plugin_data['AuthorURI']) && ! empty($plugin_data['Author']) )
			$plugin_data['Author'] = '<a href="' . $plugin_data['AuthorURI'] . '" title="' . __( 'Visit author homepage' ) . '">' . $plugin_data['Author'] . '</a>';

		$plugin_data['Description'] = wptexturize( $plugin_data['Description'] );
		if( ! empty($plugin_data['Author']) )
			$plugin_data['Description'] .= ' <cite>' . sprintf( __('By %s'), $plugin_data['Author'] ) . '.</cite>';
	}

	$plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array());

	// Sanitize all displayed data
	$plugin_data['Title']       = wp_kses($plugin_data['Title'], $plugins_allowedtags);
	$plugin_data['Version']     = wp_kses($plugin_data['Version'], $plugins_allowedtags);
	$plugin_data['Description'] = wp_kses($plugin_data['Description'], $plugins_allowedtags);
	$plugin_data['Author']      = wp_kses($plugin_data['Author'], $plugins_allowedtags);

	return $plugin_data;
}

/**
 * Check the plugins directory and retrieve all plugin files with plugin data.
 *
 * WordPress only supports plugin files in the base plugins directory
 * (wp-content/plugins) and in one directory above the plugins directory
 * (wp-content/plugins/my-plugin). The file it looks for has the plugin data and
 * must be found in those two locations. It is recommended that do keep your
 * plugin files in directories.
 *
 * The file with the plugin data is the file that will be included and therefore
 * needs to have the main execution for the plugin. This does not mean
 * everything must be contained in the file and it is recommended that the file
 * be split for maintainability. Keep everything in one file for extreme
 * optimization purposes.
 *
 * @since unknown
 *
 * @param string $plugin_folder Optional. Relative path to single plugin folder.
 * @return array Key is the plugin file path and the value is an array of the plugin data.
 */
function get_plugins($plugin_folder = '') {

	if ( ! $cache_plugins = wp_cache_get('plugins', 'plugins') )
		$cache_plugins = array();

	if ( isset($cache_plugins[ $plugin_folder ]) )
		return $cache_plugins[ $plugin_folder ];

	$wp_plugins = array ();
	$plugin_root = WP_PLUGIN_DIR;
	if( !empty($plugin_folder) )
		$plugin_root .= $plugin_folder;

	// Files in wp-content/plugins directory
	$plugins_dir = @ opendir( $plugin_root);
	if ( $plugins_dir ) {
		while (($file = readdir( $plugins_dir ) ) !== false ) {
			if ( substr($file, 0, 1) == '.' )
				continue;
			if ( is_dir( $plugin_root.'/'.$file ) ) {
				$plugins_subdir = @ opendir( $plugin_root.'/'.$file );
				if ( $plugins_subdir ) {
					while (($subfile = readdir( $plugins_subdir ) ) !== false ) {
						if ( substr($subfile, 0, 1) == '.' )
							continue;
						if ( substr($subfile, -4) == '.php' )
							$plugin_files[] = "$file/$subfile";
					}
				}
			} else {
				if ( substr($file, -4) == '.php' )
					$plugin_files[] = $file;
			}
		}
	}
	@closedir( $plugins_dir );
	@closedir( $plugins_subdir );

	if ( !$plugins_dir || !$plugin_files )
		return $wp_plugins;

	foreach ( $plugin_files as $plugin_file ) {
		if ( !is_readable( "$plugin_root/$plugin_file" ) )
			continue;

		$plugin_data = get_plugin_data( "$plugin_root/$plugin_file", false, false ); //Do not apply markup/translate as it'll be cached.

		if ( empty ( $plugin_data['Name'] ) )
			continue;

		$wp_plugins[plugin_basename( $plugin_file )] = $plugin_data;
	}

	uasort( $wp_plugins, create_function( '$a, $b', 'return strnatcasecmp( $a["Name"], $b["Name"] );' ));

	$cache_plugins[ $plugin_folder ] = $wp_plugins;
	wp_cache_set('plugins', $cache_plugins, 'plugins');

	return $wp_plugins;
}

/**
 * Check whether the plugin is active by checking the active_plugins list.
 *
 * @since 2.5.0
 *
 * @param string $plugin Base plugin path from plugins directory.
 * @return bool True, if in the active plugins list. False, not in the list.
 */
function is_plugin_active($plugin) {
	return in_array($plugin, get_option('active_plugins'));
}

/**
 * Attempts activation of plugin in a "sandbox" and redirects on success.
 *
 * A plugin that is already activated will not attempt to be activated again.
 *
 * The way it works is by setting the redirection to the error before trying to
 * include the plugin file. If the plugin fails, then the redirection will not
 * be overwritten with the success message. Also, the options will not be
 * updated and the activation hook will not be called on plugin error.
 *
 * It should be noted that in no way the below code will actually prevent errors
 * within the file. The code should not be used elsewhere to replicate the
 * "sandbox", which uses redirection to work.
 * {@source 13 1}
 *
 * If any errors are found or text is outputted, then it will be captured to
 * ensure that the success redirection will update the error redirection.
 *
 * @since unknown
 *
 * @param string $plugin Plugin path to main plugin file with plugin data.
 * @param string $redirect Optional. URL to redirect to.
 * @return WP_Error|null WP_Error on invalid file or null on success.
 */
function activate_plugin($plugin, $redirect = '') {
	$current = get_option('active_plugins');
	$plugin = plugin_basename(trim($plugin));

	$valid = validate_plugin($plugin);
	if ( is_wp_error($valid) )
		return $valid;

	if ( !in_array($plugin, $current) ) {
		if ( !empty($redirect) )
			wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); // we'll override this later if the plugin can be included without fatal error
		ob_start();
		@include(WP_PLUGIN_DIR . '/' . $plugin);
		$current[] = $plugin;
		sort($current);
		update_option('active_plugins', $current);
		do_action('activate_' . $plugin);
		ob_end_clean();
	}

	return null;
}

/**
 * Deactivate a single plugin or multiple plugins.
 *
 * The deactivation hook is disabled by the plugin upgrader by using the $silent
 * parameter.
 *
 * @since unknown
 *
 * @param string|array $plugins Single plugin or list of plugins to deactivate.
 * @param bool $silent Optional, default is false. Prevent calling deactivate hook.
 */
function deactivate_plugins($plugins, $silent= false) {
	$current = get_option('active_plugins');

	if ( !is_array($plugins) )
		$plugins = array($plugins);

	foreach ( $plugins as $plugin ) {
		$plugin = plugin_basename($plugin);
		if( ! is_plugin_active($plugin) )
			continue;
		array_splice($current, array_search( $plugin, $current), 1 ); // Fixed Array-fu!
		if ( ! $silent ) //Used by Plugin updater to internally deactivate plugin, however, not to notify plugins of the fact to prevent plugin output.
			do_action('deactivate_' . trim( $plugin ));
	}

	update_option('active_plugins', $current);
}

/**
 * Activate multiple plugins.
 *
 * When WP_Error is returned, it does not mean that one of the plugins had
 * errors. It means that one or more of the plugins file path was invalid.
 *
 * The execution will be halted as soon as one of the plugins has an error.
 *
 * @since unknown
 *
 * @param string|array $plugins
 * @param string $redirect Redirect to page after successful activation.
 * @return bool|WP_Error True when finished or WP_Error if there were errors during a plugin activation.
 */
function activate_plugins($plugins, $redirect = '') {
	if ( !is_array($plugins) )
		$plugins = array($plugins);

	$errors = array();
	foreach ( (array) $plugins as $plugin ) {
		if ( !empty($redirect) )
			$redirect = add_query_arg('plugin', $plugin, $redirect);
		$result = activate_plugin($plugin, $redirect);
		if ( is_wp_error($result) )
			$errors[$plugin] = $result;
	}

	if ( !empty($errors) )
		return new WP_Error('plugins_invalid', __('One of the plugins is invalid.'), $errors);

	return true;
}

/**
 * Remove directory and files of a plugin for a single or list of plugin(s).
 *
 * If the plugins parameter list is empty, false will be returned. True when
 * completed.
 *
 * @since unknown
 *
 * @param array $plugins List of plugin
 * @param string $redirect Redirect to page when complete.
 * @return mixed
 */
function delete_plugins($plugins, $redirect = '' ) {
	global $wp_filesystem;

	if( empty($plugins) )
		return false;

	$checked = array();
	foreach( $plugins as $plugin )
		$checked[] = 'checked[]=' . $plugin;

	ob_start();
	$url = wp_nonce_url('plugins.php?action=delete-selected&verify-delete=1&' . implode('&', $checked), 'bulk-manage-plugins');
	if ( false === ($credentials = request_filesystem_credentials($url)) ) {
		$data = ob_get_contents();
		ob_end_clean();
		if( ! empty($data) ){
			include_once( ABSPATH . 'wp-admin/admin-header.php');
			echo $data;
			include( ABSPATH . 'wp-admin/admin-footer.php');
			exit;
		}
		return;
	}

	if ( ! WP_Filesystem($credentials) ) {
		request_filesystem_credentials($url, '', true); //Failed to connect, Error and request again
		$data = ob_get_contents();
		ob_end_clean();
		if( ! empty($data) ){
			include_once( ABSPATH . 'wp-admin/admin-header.php');
			echo $data;
			include( ABSPATH . 'wp-admin/admin-footer.php');
			exit;
		}
		return;
	}

	if ( $wp_filesystem->errors->get_error_code() ) {
		return $wp_filesystem->errors;
	}

	if ( ! is_object($wp_filesystem) )
		return new WP_Error('fs_unavailable', __('Could not access filesystem.'));

	if ( $wp_filesystem->errors->get_error_code() )
		return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors);

	//Get the base plugin folder
	$plugins_dir = $wp_filesystem->wp_plugins_dir();
	if ( empty($plugins_dir) )
		return new WP_Error('fs_no_plugins_dir', __('Unable to locate WordPress Plugin directory.'));

	$plugins_dir = trailingslashit( $plugins_dir );

	$errors = array();

	foreach( $plugins as $plugin_file ) {
		// Run Uninstall hook
		if ( is_uninstallable_plugin( $plugin_file ) )
			uninstall_plugin($plugin_file);

		$this_plugin_dir = trailingslashit( dirname($plugins_dir . $plugin_file) );
		// If plugin is in its own directory, recursively delete the directory.
		if ( strpos($plugin_file, '/') && $this_plugin_dir != $plugins_dir ) //base check on if plugin includes directory seperator AND that its not the root plugin folder
			$deleted = $wp_filesystem->delete($this_plugin_dir, true);
		else
			$deleted = $wp_filesystem->delete($plugins_dir . $plugin_file);

		if ( ! $deleted )
			$errors[] = $plugin_file;
	}

	if ( ! empty($errors) )
		return new WP_Error('could_not_remove_plugin', sprintf(__('Could not fully remove the plugin(s) %s'), implode(', ', $errors)) );

	// Force refresh of plugin update information
	delete_option('update_plugins');

	return true;
}

function validate_active_plugins() {
	$check_plugins = get_option('active_plugins');

	// Sanity check.  If the active plugin list is not an array, make it an
	// empty array.
	if ( !is_array($check_plugins) ) {
		update_option('active_plugins', array());
		return;
	}

	//Invalid is any plugin that is deactivated due to error.
	$invalid = array();

	// If a plugin file does not exist, remove it from the list of active
	// plugins.
	foreach ( $check_plugins as $check_plugin ) {
		$result = validate_plugin($check_plugin);
		if ( is_wp_error( $result ) ) {
			$invalid[$check_plugin] = $result;
			deactivate_plugins( $check_plugin, true);
		}
	}
	return $invalid;
}

/**
 * Validate the plugin path.
 *
 * Checks that the file exists and {@link validate_file() is valid file}.
 *
 * @since unknown
 *
 * @param string $plugin Plugin Path
 * @return WP_Error|int 0 on success, WP_Error on failure.
 */
function validate_plugin($plugin) {
	if ( validate_file($plugin) )
		return new WP_Error('plugin_invalid', __('Invalid plugin path.'));
	if ( ! file_exists(WP_PLUGIN_DIR . '/' . $plugin) )
		return new WP_Error('plugin_not_found', __('Plugin file does not exist.'));

	return 0;
}

/**
 * Whether the plugin can be uninstalled.
 *
 * @since 2.7.0
 *
 * @param string $plugin Plugin path to check.
 * @return bool Whether plugin can be uninstalled.
 */
function is_uninstallable_plugin($plugin) {
	$file = plugin_basename($plugin);

	$uninstallable_plugins = (array) get_option('uninstall_plugins');
	if ( isset( $uninstallable_plugins[$file] ) || file_exists( WP_PLUGIN_DIR . '/' . dirname($file) . '/uninstall.php' ) )
		return true;

	return false;
}

/**
 * Uninstall a single plugin.
 *
 * Calls the uninstall hook, if it is available.
 *
 * @since 2.7.0
 *
 * @param string $plugin Relative plugin path from Plugin Directory.
 */
function uninstall_plugin($plugin) {
	$file = plugin_basename($plugin);

	$uninstallable_plugins = (array) get_option('uninstall_plugins');
	if ( file_exists( WP_PLUGIN_DIR . '/' . dirname($file) . '/uninstall.php' ) ) {
		if ( isset( $uninstallable_plugins[$file] ) ) {
			unset($uninstallable_plugins[$file]);
			update_option('uninstall_plugins', $uninstallable_plugins);
		}
		unset($uninstallable_plugins);

		define('WP_UNINSTALL_PLUGIN', $file);
		include WP_PLUGIN_DIR . '/' . dirname($file) . '/uninstall.php';

		return true;
	}

	if ( isset( $uninstallable_plugins[$file] ) ) {
		$callable = $uninstallable_plugins[$file];
		unset($uninstallable_plugins[$file]);
		update_option('uninstall_plugins', $uninstallable_plugins);
		unset($uninstallable_plugins);

		include WP_PLUGIN_DIR . '/' . $file;

		add_action( 'uninstall_' . $file, $callable );
		do_action( 'uninstall_' . $file );
	}
}

//
// Menu
//

function add_menu_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '' ) {
	global $menu, $admin_page_hooks;

	$file = plugin_basename( $file );

	$admin_page_hooks[$file] = sanitize_title( $menu_title );

	$hookname = get_plugin_page_hookname( $file, '' );
	if (!empty ( $function ) && !empty ( $hookname ))
		add_action( $hookname, $function );

	if ( empty($icon_url) )
		$icon_url = 'images/generic.png';

	$menu[] = array ( $menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url );

	return $hookname;
}

function add_object_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '') {
	global $menu, $admin_page_hooks, $_wp_last_object_menu;

	$file = plugin_basename( $file );

	$admin_page_hooks[$file] = sanitize_title( $menu_title );

	$hookname = get_plugin_page_hookname( $file, '' );
	if (!empty ( $function ) && !empty ( $hookname ))
		add_action( $hookname, $function );

	if ( empty($icon_url) )
		$icon_url = 'images/generic.png';

	$_wp_last_object_menu++;

	$menu[$_wp_last_object_menu] = array ( $menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url );

	return $hookname;
}

function add_utility_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '') {
	global $menu, $admin_page_hooks, $_wp_last_utility_menu;

	$file = plugin_basename( $file );

	$admin_page_hooks[$file] = sanitize_title( $menu_title );

	$hookname = get_plugin_page_hookname( $file, '' );
	if (!empty ( $function ) && !empty ( $hookname ))
		add_action( $hookname, $function );

	if ( empty($icon_url) )
		$icon_url = 'images/generic.png';

	$_wp_last_utility_menu++;

	$menu[$_wp_last_utility_menu] = array ( $menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url );

	return $hookname;
}

function add_submenu_page( $parent, $page_title, $menu_title, $access_level, $file, $function = '' ) {
	global $submenu;
	global $menu;
	global $_wp_real_parent_file;
	global $_wp_submenu_nopriv;

	$file = plugin_basename( $file );

	$parent = plugin_basename( $parent);
	if ( isset( $_wp_real_parent_file[$parent] ) )
		$parent = $_wp_real_parent_file[$parent];

	if ( !current_user_can( $access_level ) ) {
		$_wp_submenu_nopriv[$parent][$file] = true;
		return false;
	}

	// If the parent doesn't already have a submenu, add a link to the parent
	// as the first item in the submenu.  If the submenu file is the same as the
	// parent file someone is trying to link back to the parent manually.  In
	// this case, don't automatically add a link back to avoid duplication.
	if (!isset( $submenu[$parent] ) && $file != $parent  ) {
		foreach ( $menu as $parent_menu ) {
			if ( $parent_menu[2] == $parent && current_user_can( $parent_menu[1] ) )
				$submenu[$parent][] = $parent_menu;
		}
	}

	$submenu[$parent][] = array ( $menu_title, $access_level, $file, $page_title );

	$hookname = get_plugin_page_hookname( $file, $parent);
	if (!empty ( $function ) && !empty ( $hookname ))
		add_action( $hookname, $function );

	return $hookname;
}

/**
 * Add sub menu page to the tools main menu.
 *
 * @param string $page_title
 * @param unknown_type $menu_title
 * @param unknown_type $access_level
 * @param unknown_type $file
 * @param unknown_type $function
 * @return unknown
 */
function add_management_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
	return add_submenu_page( 'tools.php', $page_title, $menu_title, $access_level, $file, $function );
}

function add_options_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
	return add_submenu_page( 'options-general.php', $page_title, $menu_title, $access_level, $file, $function );
}

function add_theme_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
	return add_submenu_page( 'themes.php', $page_title, $menu_title, $access_level, $file, $function );
}

function add_users_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
	if ( current_user_can('edit_users') )
		$parent = 'users.php';
	else
		$parent = 'profile.php';
	return add_submenu_page( $parent, $page_title, $menu_title, $access_level, $file, $function );
}

function add_dashboard_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
	return add_submenu_page( 'index.php', $page_title, $menu_title, $access_level, $file, $function );
}

function add_posts_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
	return add_submenu_page( 'edit.php', $page_title, $menu_title, $access_level, $file, $function );
}

function add_media_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
	return add_submenu_page( 'upload.php', $page_title, $menu_title, $access_level, $file, $function );
}

function add_links_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
	return add_submenu_page( 'link-manager.php', $page_title, $menu_title, $access_level, $file, $function );
}

function add_pages_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
	return add_submenu_page( 'edit-pages.php', $page_title, $menu_title, $access_level, $file, $function );
}

function add_comments_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
	return add_submenu_page( 'edit-comments.php', $page_title, $menu_title, $access_level, $file, $function );
}

//
// Pluggable Menu Support -- Private
//

function get_admin_page_parent( $parent = '' ) {
	global $parent_file;
	global $menu;
	global $submenu;
	global $pagenow;
	global $plugin_page;
	global $_wp_real_parent_file;
	global $_wp_menu_nopriv;
	global $_wp_submenu_nopriv;

	if ( !empty ( $parent ) && 'admin.php' != $parent ) {
		if ( isset( $_wp_real_parent_file[$parent] ) )
			$parent = $_wp_real_parent_file[$parent];
		return $parent;
	}
/*
	if ( !empty ( $parent_file ) ) {
		if ( isset( $_wp_real_parent_file[$parent_file] ) )
			$parent_file = $_wp_real_parent_file[$parent_file];

		return $parent_file;
	}
*/

	if ( $pagenow == 'admin.php' && isset( $plugin_page ) ) {
		foreach ( $menu as $parent_menu ) {
			if ( $parent_menu[2] == $plugin_page ) {
				$parent_file = $plugin_page;
				if ( isset( $_wp_real_parent_file[$parent_file] ) )
					$parent_file = $_wp_real_parent_file[$parent_file];
				return $parent_file;
			}
		}
		if ( isset( $_wp_menu_nopriv[$plugin_page] ) ) {
			$parent_file = $plugin_page;
			if ( isset( $_wp_real_parent_file[$parent_file] ) )
					$parent_file = $_wp_real_parent_file[$parent_file];
			return $parent_file;
		}
	}

	if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) ) {
		$parent_file = $pagenow;
		if ( isset( $_wp_real_parent_file[$parent_file] ) )
			$parent_file = $_wp_real_parent_file[$parent_file];
		return $parent_file;
	}

	foreach (array_keys( $submenu ) as $parent) {
		foreach ( $submenu[$parent] as $submenu_array ) {
			if ( isset( $_wp_real_parent_file[$parent] ) )
				$parent = $_wp_real_parent_file[$parent];
			if ( $submenu_array[2] == $pagenow ) {
				$parent_file = $parent;
				return $parent;
			} else
				if ( isset( $plugin_page ) && ($plugin_page == $submenu_array[2] ) ) {
					$parent_file = $parent;
					return $parent;
				}
		}
	}

	if ( empty($parent_file) )
		$parent_file = '';
	return '';
}

function get_admin_page_title() {
	global $title;
	global $menu;
	global $submenu;
	global $pagenow;
	global $plugin_page;

	if ( isset( $title ) && !empty ( $title ) ) {
		return $title;
	}

	$hook = get_plugin_page_hook( $plugin_page, $pagenow );

	$parent = $parent1 = get_admin_page_parent();

	if ( empty ( $parent) ) {
		foreach ( $menu as $menu_array ) {
			if ( isset( $menu_array[3] ) ) {
				if ( $menu_array[2] == $pagenow ) {
					$title = $menu_array[3];
					return $menu_array[3];
				} else
					if ( isset( $plugin_page ) && ($plugin_page == $menu_array[2] ) && ($hook == $menu_array[3] ) ) {
						$title = $menu_array[3];
						return $menu_array[3];
					}
			} else {
				$title = $menu_array[0];
				return $title;
			}
		}
	} else {
		foreach (array_keys( $submenu ) as $parent) {
			foreach ( $submenu[$parent] as $submenu_array ) {
				if ( isset( $plugin_page ) &&
					($plugin_page == $submenu_array[2] ) &&
					(($parent == $pagenow ) || ($parent == $plugin_page ) || ($plugin_page == $hook ) || (($pagenow == 'admin.php' ) && ($parent1 != $submenu_array[2] ) ) )
					) {
						$title = $submenu_array[3];
						return $submenu_array[3];
					}

				if ( $submenu_array[2] != $pagenow || isset( $_GET['page'] ) ) // not the current page
					continue;

				if ( isset( $submenu_array[3] ) ) {
					$title = $submenu_array[3];
					return $submenu_array[3];
				} else {
					$title = $submenu_array[0];
					return $title;
				}
			}
		}
	}

	return $title;
}

function get_plugin_page_hook( $plugin_page, $parent_page ) {
	$hook = get_plugin_page_hookname( $plugin_page, $parent_page );
	if ( has_action($hook) )
		return $hook;
	else
		return null;
}

function get_plugin_page_hookname( $plugin_page, $parent_page ) {
	global $admin_page_hooks;

	$parent = get_admin_page_parent( $parent_page );

	$page_type = 'admin';
	if ( empty ( $parent_page ) || 'admin.php' == $parent_page || isset( $admin_page_hooks[$plugin_page] ) ) {
		if ( isset( $admin_page_hooks[$plugin_page] ) )
			$page_type = 'toplevel';
		else
			if ( isset( $admin_page_hooks[$parent] ))
				$page_type = $admin_page_hooks[$parent];
	} else if ( isset( $admin_page_hooks[$parent] ) ) {
		$page_type = $admin_page_hooks[$parent];
	}

	$plugin_name = preg_replace( '!\.php!', '', $plugin_page );

	return $page_type.'_page_'.$plugin_name;
}

function user_can_access_admin_page() {
	global $pagenow;
	global $menu;
	global $submenu;
	global $_wp_menu_nopriv;
	global $_wp_submenu_nopriv;
	global $plugin_page;

	$parent = get_admin_page_parent();

	if ( !isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$parent][$pagenow] ) )
		return false;

	if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$parent][$plugin_page] ) )
		return false;

	if ( empty( $parent) ) {
		if ( isset( $_wp_menu_nopriv[$pagenow] ) )
			return false;
		if ( isset( $_wp_submenu_nopriv[$pagenow][$pagenow] ) )
			return false;
		if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) )
			return false;
		foreach (array_keys( $_wp_submenu_nopriv ) as $key ) {
			if ( isset( $_wp_submenu_nopriv[$key][$pagenow] ) )
				return false;
			if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$key][$plugin_page] ) )
			return false;
		}
		return true;
	}

	if ( isset( $submenu[$parent] ) ) {
		foreach ( $submenu[$parent] as $submenu_array ) {
			if ( isset( $plugin_page ) && ( $submenu_array[2] == $plugin_page ) ) {
				if ( current_user_can( $submenu_array[1] ))
					return true;
				else
					return false;
			} else if ( $submenu_array[2] == $pagenow ) {
				if ( current_user_can( $submenu_array[1] ))
					return true;
				else
					return false;
			}
		}
	}

	foreach ( $menu as $menu_array ) {
		if ( $menu_array[2] == $parent) {
			if ( current_user_can( $menu_array[1] ))
				return true;
			else
				return false;
		}
	}

	return true;
}

/* Whitelist functions */

/**
 * Register a setting and its sanitization callback
 *
 * @since 2.7.0
 *
 * @param string $option_group A settings group name.  Can be anything.
 * @param string $option_name The name of an option to sanitize and save.
 * @param unknown_type $sanitize_callback A callback function that sanitizes the option's value.
 * @return unknown
 */
function register_setting($option_group, $option_name, $sanitize_callback = '') {
	return add_option_update_handler($option_group, $option_name, $sanitize_callback);
}

/**
 * Unregister a setting
 *
 * @since 2.7.0
 *
 * @param unknown_type $option_group
 * @param unknown_type $option_name
 * @param unknown_type $sanitize_callback
 * @return unknown
 */
function unregister_setting($option_group, $option_name, $sanitize_callback = '') {
	return remove_option_update_handler($option_group, $option_name, $sanitize_callback);
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $option_group
 * @param unknown_type $option_name
 * @param unknown_type $sanitize_callback
 */
function add_option_update_handler($option_group, $option_name, $sanitize_callback = '') {
	global $new_whitelist_options;
	$new_whitelist_options[ $option_group ][] = $option_name;
	if ( $sanitize_callback != '' )
		add_filter( "sanitize_option_{$option_name}", $sanitize_callback );
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $option_group
 * @param unknown_type $option_name
 * @param unknown_type $sanitize_callback
 */
function remove_option_update_handler($option_group, $option_name, $sanitize_callback = '') {
	global $new_whitelist_options;
	$pos = array_search( $option_name, $new_whitelist_options );
	if ( $pos !== false )
		unset( $new_whitelist_options[ $option_group ][ $pos ] );
	if ( $sanitize_callback != '' )
		remove_filter( "sanitize_option_{$option_name}", $sanitize_callback );
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $options
 * @return unknown
 */
function option_update_filter( $options ) {
	global $new_whitelist_options;

	if ( is_array( $new_whitelist_options ) )
		$options = add_option_whitelist( $new_whitelist_options, $options );

	return $options;
}
add_filter( 'whitelist_options', 'option_update_filter' );

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $new_options
 * @param unknown_type $options
 * @return unknown
 */
function add_option_whitelist( $new_options, $options = '' ) {
	if( $options == '' ) {
		global $whitelist_options;
	} else {
		$whitelist_options = $options;
	}
	foreach( $new_options as $page => $keys ) {
		foreach( $keys as $key ) {
			if ( !isset($whitelist_options[ $page ]) || !is_array($whitelist_options[ $page ]) ) {
				$whitelist_options[ $page ] = array();
				$whitelist_options[ $page ][] = $key;
			} else {
				$pos = array_search( $key, $whitelist_options[ $page ] );
				if ( $pos === false )
					$whitelist_options[ $page ][] = $key;
			}
		}
	}
	return $whitelist_options;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $del_options
 * @param unknown_type $options
 * @return unknown
 */
function remove_option_whitelist( $del_options, $options = '' ) {
	if( $options == '' ) {
		global $whitelist_options;
	} else {
		$whitelist_options = $options;
	}
	foreach( $del_options as $page => $keys ) {
		foreach( $keys as $key ) {
			$pos = array_search( $key, $whitelist_options[ $page ] );
			if( $pos !== false )
				unset( $whitelist_options[ $page ][ $pos ] );
		}
	}
	return $whitelist_options;
}

/**
 * Output nonce, action, and option_page fields for a settings page.
 *
 * @since 2.7.0
 *
 * @param string $option_group A settings group name.  This should match the group name used in register_setting().
 */
function settings_fields($option_group) {
	echo "<input type='hidden' name='option_page' value='$option_group' />";
	echo '<input type="hidden" name="action" value="update" />';
	wp_nonce_field("$option_group-options");
}

?>
                                                                                                                                                                                                                                                                             wp-admin/includes/post.php                                                                          0000755 0023422 0004734 00000121605 11125247160 016631  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress Post Administration API.
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * Rename $_POST data from form names to DB post columns.
 *
 * Manipulates $_POST directly.
 *
 * @package WordPress
 * @since 2.6.0
 *
 * @param bool $update Are we updating a pre-existing post?
 * @param post_data array Array of post data. Defaults to the contents of $_POST.
 * @return object|bool WP_Error on failure, true on success.
 */
function _wp_translate_postdata( $update = false, $post_data = null ) {

	if ( empty($post_data) )
		$post_data = &$_POST;

	if ( $update )
		$post_data['ID'] = (int) $post_data['post_ID'];
	$post_data['post_content'] = isset($post_data['content']) ? $post_data['content'] : '';
	$post_data['post_excerpt'] = isset($post_data['excerpt']) ? $post_data['excerpt'] : '';
	$post_data['post_parent'] = isset($post_data['parent_id'])? $post_data['parent_id'] : '';
	if ( isset($post_data['trackback_url']) )
		$post_data['to_ping'] = $post_data['trackback_url'];

	if (!empty ( $post_data['post_author_override'] ) ) {
		$post_data['post_author'] = (int) $post_data['post_author_override'];
	} else {
		if (!empty ( $post_data['post_author'] ) ) {
			$post_data['post_author'] = (int) $post_data['post_author'];
		} else {
			$post_data['post_author'] = (int) $post_data['user_ID'];
		}
	}

	if ( isset($post_data['user_ID']) && ($post_data['post_author'] != $post_data['user_ID']) ) {
		if ( 'page' == $post_data['post_type'] ) {
			if ( !current_user_can( 'edit_others_pages' ) ) {
				return new WP_Error( 'edit_others_pages', $update ?
					__( 'You are not allowed to edit pages as this user.' ) :
					__( 'You are not allowed to create pages as this user.' )
				);
			}
		} else {
			if ( !current_user_can( 'edit_others_posts' ) ) {
				return new WP_Error( 'edit_others_posts', $update ?
					__( 'You are not allowed to edit posts as this user.' ) :
					__( 'You are not allowed to post as this user.' )
				);
			}
		}
	}

	// What to do based on which button they pressed
	if ( isset($post_data['saveasdraft']) && '' != $post_data['saveasdraft'] )
		$post_data['post_status'] = 'draft';
	if ( isset($post_data['saveasprivate']) && '' != $post_data['saveasprivate'] )
		$post_data['post_status'] = 'private';
	if ( isset($post_data['publish']) && ( '' != $post_data['publish'] ) && ( $post_data['post_status'] != 'private' ) )
		$post_data['post_status'] = 'publish';
	if ( isset($post_data['advanced']) && '' != $post_data['advanced'] )
		$post_data['post_status'] = 'draft';
	if ( isset($post_data['pending']) && '' != $post_data['pending'] )
		$post_data['post_status'] = 'pending';

	$previous_status = get_post_field('post_status',  isset($post_data['ID']) ? $post_data['ID'] : $post_data['temp_ID']);

	// Posts 'submitted for approval' present are submitted to $_POST the same as if they were being published.
	// Change status from 'publish' to 'pending' if user lacks permissions to publish or to resave published posts.
	if ( 'page' == $post_data['post_type'] ) {
		$publish_cap = 'publish_pages';
		$edit_cap = 'edit_published_pages';
	} else {
		$publish_cap = 'publish_posts';
		$edit_cap = 'edit_published_posts';
	}
	if ( isset($post_data['post_status']) && ('publish' == $post_data['post_status'] && !current_user_can( $publish_cap )) )
		if ( $previous_status != 'publish' || !current_user_can( $edit_cap ) )
			$post_data['post_status'] = 'pending';

	if ( ! isset($post_data['post_status']) )
		$post_data['post_status'] = $previous_status;

	if (!isset( $post_data['comment_status'] ))
		$post_data['comment_status'] = 'closed';

	if (!isset( $post_data['ping_status'] ))
		$post_data['ping_status'] = 'closed';

	foreach ( array('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) {
		if ( !empty( $post_data['hidden_' . $timeunit] ) && $post_data['hidden_' . $timeunit] != $post_data[$timeunit] ) {
			$post_data['edit_date'] = '1';
			break;
		}
	}

	if ( !empty( $post_data['edit_date'] ) ) {
		$aa = $post_data['aa'];
		$mm = $post_data['mm'];
		$jj = $post_data['jj'];
		$hh = $post_data['hh'];
		$mn = $post_data['mn'];
		$ss = $post_data['ss'];
		$aa = ($aa <= 0 ) ? date('Y') : $aa;
		$mm = ($mm <= 0 ) ? date('n') : $mm;
		$jj = ($jj > 31 ) ? 31 : $jj;
		$jj = ($jj <= 0 ) ? date('j') : $jj;
		$hh = ($hh > 23 ) ? $hh -24 : $hh;
		$mn = ($mn > 59 ) ? $mn -60 : $mn;
		$ss = ($ss > 59 ) ? $ss -60 : $ss;
		$post_data['post_date'] = sprintf( "%04d-%02d-%02d %02d:%02d:%02d", $aa, $mm, $jj, $hh, $mn, $ss );
		$post_data['post_date_gmt'] = get_gmt_from_date( $post_data['post_date'] );
	}

	return $post_data;
}

/**
 * Update an existing post with values provided in $_POST.
 *
 * @since unknown
 *
 * @param array $post_data Optional.
 * @return int Post ID.
 */
function edit_post( $post_data = null ) {

	if ( empty($post_data) )
		$post_data = &$_POST;

	$post_ID = (int) $post_data['post_ID'];

	if ( 'page' == $post_data['post_type'] ) {
		if ( !current_user_can( 'edit_page', $post_ID ) )
			wp_die( __('You are not allowed to edit this page.' ));
	} else {
		if ( !current_user_can( 'edit_post', $post_ID ) )
			wp_die( __('You are not allowed to edit this post.' ));
	}

	// Autosave shouldn't save too soon after a real save
	if ( 'autosave' == $post_data['action'] ) {
		$post =& get_post( $post_ID );
		$now = time();
		$then = strtotime($post->post_date_gmt . ' +0000');
		$delta = AUTOSAVE_INTERVAL / 2;
		if ( ($now - $then) < $delta )
			return $post_ID;
	}

	$post_data = _wp_translate_postdata( true, $post_data );
	if ( is_wp_error($post_data) )
		wp_die( $post_data->get_error_message() );

	if ( isset($post_data['visibility']) ) {
		switch ( $post_data['visibility'] ) {
			case 'public' :
				$post_data['post_password'] = '';
				break;
			case 'password' :
				unset( $post_data['sticky'] );
				break;
			case 'private' :
				$post_data['post_status'] = 'private';
				$post_data['post_password'] = '';
				unset( $post_data['sticky'] );
				break;
		}
	}

	// Meta Stuff
	if ( isset($post_data['meta']) && $post_data['meta'] ) {
		foreach ( $post_data['meta'] as $key => $value )
			update_meta( $key, $value['key'], $value['value'] );
	}

	if ( isset($post_data['deletemeta']) && $post_data['deletemeta'] ) {
		foreach ( $post_data['deletemeta'] as $key => $value )
			delete_meta( $key );
	}

	add_meta( $post_ID );

	wp_update_post( $post_data );

	// Reunite any orphaned attachments with their parent
	if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) )
		$draft_ids = array();
	if ( $draft_temp_id = (int) array_search( $post_ID, $draft_ids ) )
		_relocate_children( $draft_temp_id, $post_ID );

	// Now that we have an ID we can fix any attachment anchor hrefs
	_fix_attachment_links( $post_ID );

	wp_set_post_lock( $post_ID, $GLOBALS['current_user']->ID );

	if ( current_user_can( 'edit_others_posts' ) ) {
		if ( !empty($post_data['sticky']) )
			stick_post($post_ID);
		else
			unstick_post($post_ID);
	}

	return $post_ID;
}

/**
 * {@internal Missing Short Description}}
 *
 * Updates all bulk edited posts/pages, adding (but not removing) tags and
 * categories. Skips pages when they would be their own parent or child.
 *
 * @since unknown
 *
 * @return array
 */
function bulk_edit_posts( $post_data = null ) {
	global $wpdb;

	if ( empty($post_data) )
		$post_data = &$_POST;

	if ( isset($post_data['post_type']) && 'page' == $post_data['post_type'] ) {
		if ( ! current_user_can( 'edit_pages' ) )
			wp_die( __('You are not allowed to edit pages.') );
	} else {
		if ( ! current_user_can( 'edit_posts' ) )
			wp_die( __('You are not allowed to edit posts.') );
	}

	$post_IDs = array_map( 'intval', (array) $post_data['post'] );

	$reset = array( 'post_author', 'post_status', 'post_password', 'post_parent', 'page_template', 'comment_status', 'ping_status', 'keep_private', 'tags_input', 'post_category', 'sticky' );
	foreach ( $reset as $field ) {
		if ( isset($post_data[$field]) && ( '' == $post_data[$field] || -1 == $post_data[$field] ) )
			unset($post_data[$field]);
	}

	if ( isset($post_data['post_category']) ) {
		if ( is_array($post_data['post_category']) && ! empty($post_data['post_category']) )
			$new_cats = array_map( absint, $post_data['post_category'] );
		else
			unset($post_data['post_category']);
	}

	if ( isset($post_data['tags_input']) ) {
		$new_tags = preg_replace( '/\s*,\s*/', ',', rtrim( trim($post_data['tags_input']), ' ,' ) );
		$new_tags = explode(',', $new_tags);
	}

	if ( isset($post_data['post_parent']) && ($parent = (int) $post_data['post_parent']) ) {
		$pages = $wpdb->get_results("SELECT ID, post_parent FROM $wpdb->posts WHERE post_type = 'page'");
		$children = array();

		for ( $i = 0; $i < 50 && $parent > 0; $i++ ) {
			$children[] = $parent;

			foreach ( $pages as $page ) {
				if ( $page->ID == $parent ) {
					$parent = $page->post_parent;
					break;
				}
			}
		}
	}

	$updated = $skipped = $locked = array();
	foreach ( $post_IDs as $post_ID ) {

		if ( isset($children) && in_array($post_ID, $children) ) {
			$skipped[] = $post_ID;
			continue;
		}

		if ( wp_check_post_lock( $post_ID ) ) {
			$locked[] = $post_ID;
			continue;
		}

		if ( isset($new_cats) ) {
			$cats = (array) wp_get_post_categories($post_ID);
			$post_data['post_category'] = array_unique( array_merge($cats, $new_cats) );
		}

		if ( isset($new_tags) ) {
			$tags = wp_get_post_tags($post_ID, array('fields' => 'names'));
			$post_data['tags_input'] = array_unique( array_merge($tags, $new_tags) );
		}

		$post_data['ID'] = $post_ID;
		$updated[] = wp_update_post( $post_data );

		if ( current_user_can( 'edit_others_posts' ) && isset( $post_data['sticky'] ) ) {
			if ( 'sticky' == $post_data['sticky'] )
				stick_post( $post_ID );
			else
				unstick_post( $post_ID );
		}

	}

	return array( 'updated' => $updated, 'skipped' => $skipped, 'locked' => $locked );
}

/**
 * Default post information to use when populating the "Write Post" form.
 *
 * @since unknown
 *
 * @return unknown
 */
function get_default_post_to_edit() {
	if ( !empty( $_REQUEST['post_title'] ) )
		$post_title = wp_specialchars( stripslashes( $_REQUEST['post_title'] ));
	else if ( !empty( $_REQUEST['popuptitle'] ) ) {
		$post_title = wp_specialchars( stripslashes( $_REQUEST['popuptitle'] ));
		$post_title = funky_javascript_fix( $post_title );
	} else {
		$post_title = '';
	}

	$post_content = '';
	if ( !empty( $_REQUEST['content'] ) )
		$post_content = wp_specialchars( stripslashes( $_REQUEST['content'] ));
	else if ( !empty( $post_title ) ) {
		$text       = wp_specialchars( stripslashes( urldecode( $_REQUEST['text'] ) ) );
		$text       = funky_javascript_fix( $text);
		$popupurl   = clean_url($_REQUEST['popupurl']);
		$post_content = '<a href="'.$popupurl.'">'.$post_title.'</a>'."\n$text";
	}

	if ( !empty( $_REQUEST['excerpt'] ) )
		$post_excerpt = wp_specialchars( stripslashes( $_REQUEST['excerpt'] ));
	else
		$post_excerpt = '';

	$post->ID = 0;
	$post->post_name = '';
	$post->post_author = '';
	$post->post_date = '';
	$post->post_password = '';
	$post->post_status = 'draft';
	$post->post_type = 'post';
	$post->to_ping = '';
	$post->pinged = '';
	$post->comment_status = get_option( 'default_comment_status' );
	$post->ping_status = get_option( 'default_ping_status' );
	$post->post_pingback = get_option( 'default_pingback_flag' );
	$post->post_category = get_option( 'default_category' );
	$post->post_content = apply_filters( 'default_content', $post_content);
	$post->post_title = apply_filters( 'default_title', $post_title );
	$post->post_excerpt = apply_filters( 'default_excerpt', $post_excerpt);
	$post->page_template = 'default';
	$post->post_parent = 0;
	$post->menu_order = 0;

	return $post;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @return unknown
 */
function get_default_page_to_edit() {
	$page = get_default_post_to_edit();
	$page->post_type = 'page';
	return $page;
}

/**
 * Get an existing post and format it for editing.
 *
 * @since unknown
 *
 * @param unknown_type $id
 * @return unknown
 */
function get_post_to_edit( $id ) {

	$post = get_post( $id, OBJECT, 'edit' );

	if ( $post->post_type == 'page' )
		$post->page_template = get_post_meta( $id, '_wp_page_template', true );

	return $post;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $title
 * @param unknown_type $content
 * @param unknown_type $post_date
 * @return unknown
 */
function post_exists($title, $content = '', $post_date = '') {
	global $wpdb;

	$title = stripslashes($title);
	$content = stripslashes($content);
	$post_date = stripslashes($post_date);

	if (!empty ($post_date))
		$post_date = $wpdb->prepare("AND post_date = %s", $post_date);

	if (!empty ($title))
		return $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_title = %s $post_date", $title) );
	else
		if (!empty ($content))
			return $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_content = %s $post_date", $content) );

	return 0;
}

/**
 * Creates a new post from the "Write Post" form using $_POST information.
 *
 * @since unknown
 *
 * @return unknown
 */
function wp_write_post() {
	global $user_ID;

	if ( 'page' == $_POST['post_type'] ) {
		if ( !current_user_can( 'edit_pages' ) )
			return new WP_Error( 'edit_pages', __( 'You are not allowed to create pages on this blog.' ) );
	} else {
		if ( !current_user_can( 'edit_posts' ) )
			return new WP_Error( 'edit_posts', __( 'You are not allowed to create posts or drafts on this blog.' ) );
	}


	// Check for autosave collisions
	$temp_id = false;
	if ( isset($_POST['temp_ID']) ) {
		$temp_id = (int) $_POST['temp_ID'];
		if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) )
			$draft_ids = array();
		foreach ( $draft_ids as $temp => $real )
			if ( time() + $temp > 86400 ) // 1 day: $temp is equal to -1 * time( then )
				unset($draft_ids[$temp]);

		if ( isset($draft_ids[$temp_id]) ) { // Edit, don't write
			$_POST['post_ID'] = $draft_ids[$temp_id];
			unset($_POST['temp_ID']);
			update_user_option( $user_ID, 'autosave_draft_ids', $draft_ids );
			return edit_post();
		}
	}

	$translated = _wp_translate_postdata( false );
	if ( is_wp_error($translated) )
		return $translated;

	if ( isset($_POST['visibility']) ) {
		switch ( $_POST['visibility'] ) {
			case 'public' :
				$_POST['post_password'] = '';
				break;
			case 'password' :
				unset( $_POST['sticky'] );
				break;
			case 'private' :
				$_POST['post_status'] = 'private';
				$_POST['post_password'] = '';
				unset( $_POST['sticky'] );
				break;
		}
	}

	// Create the post.
	$post_ID = wp_insert_post( $_POST );
	if ( is_wp_error( $post_ID ) )
		return $post_ID;

	if ( empty($post_ID) )
		return 0;

	add_meta( $post_ID );

	// Reunite any orphaned attachments with their parent
	if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) )
		$draft_ids = array();
	if ( $draft_temp_id = (int) array_search( $post_ID, $draft_ids ) )
		_relocate_children( $draft_temp_id, $post_ID );
	if ( $temp_id && $temp_id != $draft_temp_id )
		_relocate_children( $temp_id, $post_ID );

	// Update autosave collision detection
	if ( $temp_id ) {
		$draft_ids[$temp_id] = $post_ID;
		update_user_option( $user_ID, 'autosave_draft_ids', $draft_ids );
	}

	// Now that we have an ID we can fix any attachment anchor hrefs
	_fix_attachment_links( $post_ID );

	wp_set_post_lock( $post_ID, $GLOBALS['current_user']->ID );

	return $post_ID;
}

/**
 * Calls wp_write_post() and handles the errors.
 *
 * @since unknown
 *
 * @return unknown
 */
function write_post() {
	$result = wp_write_post();
	if( is_wp_error( $result ) )
		wp_die( $result->get_error_message() );
	else
		return $result;
}

//
// Post Meta
//

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $post_ID
 * @return unknown
 */
function add_meta( $post_ID ) {
	global $wpdb;
	$post_ID = (int) $post_ID;

	$protected = array( '_wp_attached_file', '_wp_attachment_metadata', '_wp_old_slug', '_wp_page_template' );

	$metakeyselect = isset($_POST['metakeyselect']) ? stripslashes( trim( $_POST['metakeyselect'] ) ) : '';
	$metakeyinput = isset($_POST['metakeyinput']) ? stripslashes( trim( $_POST['metakeyinput'] ) ) : '';
	$metavalue = isset($_POST['metavalue']) ? maybe_serialize( stripslashes( trim( $_POST['metavalue'] ) ) ) : '';

	if ( ('0' === $metavalue || !empty ( $metavalue ) ) && ((('#NONE#' != $metakeyselect) && !empty ( $metakeyselect) ) || !empty ( $metakeyinput) ) ) {
		// We have a key/value pair. If both the select and the
		// input for the key have data, the input takes precedence:

 		if ('#NONE#' != $metakeyselect)
			$metakey = $metakeyselect;

		if ( $metakeyinput)
			$metakey = $metakeyinput; // default

		if ( in_array($metakey, $protected) )
			return false;

		wp_cache_delete($post_ID, 'post_meta');

		$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->postmeta (post_id,meta_key,meta_value ) VALUES (%s, %s, %s)", $post_ID, $metakey, $metavalue) );
		return $wpdb->insert_id;
	}
	return false;
} // add_meta

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $mid
 * @return unknown
 */
function delete_meta( $mid ) {
	global $wpdb;
	$mid = (int) $mid;

	$post_id = $wpdb->get_var( $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = %d", $mid) );
	wp_cache_delete($post_id, 'post_meta');

	return $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_id = %d", $mid) );
}

/**
 * Get a list of previously defined keys.
 *
 * @since unknown
 *
 * @return unknown
 */
function get_meta_keys() {
	global $wpdb;

	$keys = $wpdb->get_col( "
			SELECT meta_key
			FROM $wpdb->postmeta
			GROUP BY meta_key
			ORDER BY meta_key" );

	return $keys;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $mid
 * @return unknown
 */
function get_post_meta_by_id( $mid ) {
	global $wpdb;
	$mid = (int) $mid;

	$meta = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->postmeta WHERE meta_id = %d", $mid) );
	if ( is_serialized_string( $meta->meta_value ) )
		$meta->meta_value = maybe_unserialize( $meta->meta_value );
	return $meta;
}

/**
 * {@internal Missing Short Description}}
 *
 * Some postmeta stuff.
 *
 * @since unknown
 *
 * @param unknown_type $postid
 * @return unknown
 */
function has_meta( $postid ) {
	global $wpdb;

	return $wpdb->get_results( $wpdb->prepare("SELECT meta_key, meta_value, meta_id, post_id
			FROM $wpdb->postmeta WHERE post_id = %d
			ORDER BY meta_key,meta_id", $postid), ARRAY_A );

}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $meta_id
 * @param unknown_type $meta_key
 * @param unknown_type $meta_value
 * @return unknown
 */
function update_meta( $meta_id, $meta_key, $meta_value ) {
	global $wpdb;

	$protected = array( '_wp_attached_file', '_wp_attachment_metadata', '_wp_old_slug', '_wp_page_template' );

	if ( in_array($meta_key, $protected) )
		return false;

	$post_id = $wpdb->get_var( $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = %d", $meta_id) );
	wp_cache_delete($post_id, 'post_meta');

	$meta_value = maybe_serialize( stripslashes( $meta_value ));
	$meta_id = (int) $meta_id;

	$data  = compact( 'meta_key', 'meta_value' );
	$where = compact( 'meta_id' );

	return $wpdb->update( $wpdb->postmeta, $data, $where );
}

//
// Private
//

/**
 * Replace hrefs of attachment anchors with up-to-date permalinks.
 *
 * @since unknown
 * @access private
 *
 * @param unknown_type $post_ID
 * @return unknown
 */
function _fix_attachment_links( $post_ID ) {

	$post = & get_post( $post_ID, ARRAY_A );

	$search = "#<a[^>]+rel=('|\")[^'\"]*attachment[^>]*>#ie";

	// See if we have any rel="attachment" links
	if ( 0 == preg_match_all( $search, $post['post_content'], $anchor_matches, PREG_PATTERN_ORDER ) )
		return;

	$i = 0;
	$search = "#[\s]+rel=(\"|')(.*?)wp-att-(\d+)\\1#i";
	foreach ( $anchor_matches[0] as $anchor ) {
		if ( 0 == preg_match( $search, $anchor, $id_matches ) )
			continue;

		$id = (int) $id_matches[3];

		// While we have the attachment ID, let's adopt any orphans.
		$attachment = & get_post( $id, ARRAY_A );
		if ( ! empty( $attachment) && ! is_object( get_post( $attachment['post_parent'] ) ) ) {
			$attachment['post_parent'] = $post_ID;
			// Escape data pulled from DB.
			$attachment = add_magic_quotes( $attachment);
			wp_update_post( $attachment);
		}

		$post_search[$i] = $anchor;
		$post_replace[$i] = preg_replace( "#href=(\"|')[^'\"]*\\1#e", "stripslashes( 'href=\\1' ).get_attachment_link( $id ).stripslashes( '\\1' )", $anchor );
		++$i;
	}

	$post['post_content'] = str_replace( $post_search, $post_replace, $post['post_content'] );

	// Escape data pulled from DB.
	$post = add_magic_quotes( $post);

	return wp_update_post( $post);
}

/**
 * Move child posts to a new parent.
 *
 * @since unknown
 * @access private
 *
 * @param unknown_type $old_ID
 * @param unknown_type $new_ID
 * @return unknown
 */
function _relocate_children( $old_ID, $new_ID ) {
	global $wpdb;
	$old_ID = (int) $old_ID;
	$new_ID = (int) $new_ID;
	return $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = %d WHERE post_parent = %d", $new_ID, $old_ID) );
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $type
 * @return unknown
 */
function get_available_post_statuses($type = 'post') {
	$stati = wp_count_posts($type);

	return array_keys(get_object_vars($stati));
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $q
 * @return unknown
 */
function wp_edit_posts_query( $q = false ) {
	if ( false === $q )
		$q = $_GET;
	$q['m']   = isset($q['m']) ? (int) $q['m'] : 0;
	$q['cat'] = isset($q['cat']) ? (int) $q['cat'] : 0;
	$post_stati  = array(	//	array( adj, noun )
				'publish' => array(__('Published'), __('Published posts'), __ngettext_noop('Published <span class="count">(%s)</span>', 'Published <span class="count">(%s)</span>')),
				'future' => array(__('Scheduled'), __('Scheduled posts'), __ngettext_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>')),
				'pending' => array(__('Pending Review'), __('Pending posts'), __ngettext_noop('Pending Review <span class="count">(%s)</span>', 'Pending Review <span class="count">(%s)</span>')),
				'draft' => array(__('Draft'), _c('Drafts|manage posts header'), __ngettext_noop('Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>')),
				'private' => array(__('Private'), __('Private posts'), __ngettext_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>')),
			);

	$post_stati = apply_filters('post_stati', $post_stati);

	$avail_post_stati = get_available_post_statuses('post');

	$post_status_q = '';
	if ( isset($q['post_status']) && in_array( $q['post_status'], array_keys($post_stati) ) ) {
		$post_status_q = '&post_status=' . $q['post_status'];
		$post_status_q .= '&perm=readable';
	}

	if ( isset($q['post_status']) && 'pending' === $q['post_status'] ) {
		$order = 'ASC';
		$orderby = 'modified';
	} elseif ( isset($q['post_status']) && 'draft' === $q['post_status'] ) {
		$order = 'DESC';
		$orderby = 'modified';
	} else {
		$order = 'DESC';
		$orderby = 'date';
	}

	wp("post_type=post&what_to_show=posts$post_status_q&posts_per_page=15&order=$order&orderby=$orderby");

	return array($post_stati, $avail_post_stati);
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $type
 * @return unknown
 */
function get_available_post_mime_types($type = 'attachment') {
	global $wpdb;

	$types = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT post_mime_type FROM $wpdb->posts WHERE post_type = %s", $type));
	return $types;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $q
 * @return unknown
 */
function wp_edit_attachments_query( $q = false ) {
	if ( false === $q )
		$q = $_GET;

	$q['m']   = isset( $q['m'] ) ? (int) $q['m'] : 0;
	$q['cat'] = isset( $q['cat'] ) ? (int) $q['cat'] : 0;
	$q['post_type'] = 'attachment';
	$q['post_status'] = 'any';
	$q['posts_per_page'] = 15;
	$post_mime_types = array(	//	array( adj, noun )
				'image' => array(__('Images'), __('Manage Images'), __ngettext_noop('Image <span class="count">(%s)</span>', 'Images <span class="count">(%s)</span>')),
				'audio' => array(__('Audio'), __('Manage Audio'), __ngettext_noop('Audio <span class="count">(%s)</span>', 'Audio <span class="count">(%s)</span>')),
				'video' => array(__('Video'), __('Manage Video'), __ngettext_noop('Video <span class="count">(%s)</span>', 'Video <span class="count">(%s)</span>')),
			);
	$post_mime_types = apply_filters('post_mime_types', $post_mime_types);

	$avail_post_mime_types = get_available_post_mime_types('attachment');

	if ( isset($q['post_mime_type']) && !array_intersect( (array) $q['post_mime_type'], array_keys($post_mime_types) ) )
		unset($q['post_mime_type']);

	wp($q);

	return array($post_mime_types, $avail_post_mime_types);
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $id
 * @param unknown_type $page
 * @return unknown
 */
function postbox_classes( $id, $page ) {
	if ( isset( $_GET['edit'] ) && $_GET['edit'] == $id )
		return '';
	$current_user = wp_get_current_user();
	if ( $closed = get_user_option('closedpostboxes_'.$page, 0, false ) ) {
		if ( !is_array( $closed ) ) return '';
		return in_array( $id, $closed )? 'if-js-closed' : '';
	} else {
		return '';
	}
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $id
 * @param unknown_type $title
 * @param unknown_type $name
 * @return unknown
 */
function get_sample_permalink($id, $title=null, $name = null) {
	$post = &get_post($id);
	if (!$post->ID) {
		return array('', '');
	}
	$original_status = $post->post_status;
	$original_date = $post->post_date;
	$original_name = $post->post_name;

	// Hack: get_permalink would return ugly permalink for
	// drafts, so we will fake, that our post is published
	if (in_array($post->post_status, array('draft', 'pending'))) {
		$post->post_status = 'publish';
		$post->post_name = sanitize_title($post->post_name? $post->post_name : $post->post_title, $post->ID);
	}

	// If the user wants to set a new name -- override the current one
	// Note: if empty name is supplied -- use the title instead, see #6072
	if (!is_null($name)) {
		$post->post_name = sanitize_title($name? $name : $title, $post->ID);
	}

	$post->filter = 'sample'; 

	$permalink = get_permalink($post, true);

	// Handle page hierarchy
	if ( 'page' == $post->post_type ) {
		$uri = get_page_uri($post->ID);
		$uri = untrailingslashit($uri);
		$uri = strrev( stristr( strrev( $uri ), '/' ) );
		$uri = untrailingslashit($uri);
		if ( !empty($uri) )
			$uri .='/';
		$permalink = str_replace('%pagename%', "${uri}%pagename%", $permalink);
	}

	$permalink = array($permalink, apply_filters('editable_slug', $post->post_name));
	$post->post_status = $original_status;
	$post->post_date = $original_date;
	$post->post_name = $original_name;
	unset($post->filter);

	return $permalink;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $id
 * @param unknown_type $new_title
 * @param unknown_type $new_slug
 * @return unknown
 */
function get_sample_permalink_html($id, $new_title=null, $new_slug=null) {
	$post = &get_post($id);
	list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
	if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
		return '';
	}
	$title = __('Click to edit this part of the permalink');
	if (function_exists('mb_strlen')) {
		if (mb_strlen($post_name) > 30) {
			$post_name_abridged = mb_substr($post_name, 0, 14). '&hellip;' . mb_substr($post_name, -14);
		} else {
			$post_name_abridged = $post_name;
		}
	} else {
		if (strlen($post_name) > 30) {
			$post_name_abridged = substr($post_name, 0, 14). '&hellip;' . substr($post_name, -14);
		} else {
			$post_name_abridged = $post_name;
		}
	}
	$post_name_html = '<span id="editable-post-name" title="'.$title.'">'.$post_name_abridged.'</span><span id="editable-post-name-full">'.$post_name.'</span>';
	$display_link = str_replace(array('%pagename%','%postname%'), $post_name_html, $permalink);
	$return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink">' . $display_link . "</span>\n";
	$return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button" onclick="edit_permalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
	return $return;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $post_id
 * @return bool|int False: not locked or locked by current user. Int: user ID of user with lock.
 */
function wp_check_post_lock( $post_id ) {
	global $current_user;

	if ( !$post = get_post( $post_id ) )
		return false;

	$lock = get_post_meta( $post->ID, '_edit_lock', true );
	$last = get_post_meta( $post->ID, '_edit_last', true );

	$time_window = apply_filters( 'wp_check_post_lock_window', AUTOSAVE_INTERVAL * 2 );

	if ( $lock && $lock > time() - $time_window && $last != $current_user->ID )
		return $last;
	return false;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $post_id
 * @return unknown
 */
function wp_set_post_lock( $post_id ) {
	global $current_user;
	if ( !$post = get_post( $post_id ) )
		return false;
	if ( !$current_user || !$current_user->ID )
		return false;

	$now = time();

	if ( !add_post_meta( $post->ID, '_edit_lock', $now, true ) )
		update_post_meta( $post->ID, '_edit_lock', $now );
	if ( !add_post_meta( $post->ID, '_edit_last', $current_user->ID, true ) )
		update_post_meta( $post->ID, '_edit_last', $current_user->ID );
}

/**
 * Creates autosave data for the specified post from $_POST data.
 *
 * @package WordPress
 * @subpackage Post_Revisions
 * @since 2.6.0
 *
 * @uses _wp_translate_postdata()
 * @uses _wp_post_revision_fields()
 */
function wp_create_post_autosave( $post_id ) {
	$translated = _wp_translate_postdata( true );
	if ( is_wp_error( $translated ) )
		return $translated;

	// Only store one autosave.  If there is already an autosave, overwrite it.
	if ( $old_autosave = wp_get_post_autosave( $post_id ) ) {
		$new_autosave = _wp_post_revision_fields( $_POST, true );
		$new_autosave['ID'] = $old_autosave->ID;
		return wp_update_post( $new_autosave );
	}

	// Otherwise create the new autosave as a special post revision
	return _wp_put_post_revision( $_POST, true );
}

/**
 * Save draft or manually autosave for showing preview.
 *
 * @package WordPress
 * @since 2.7
 *
 * @uses wp_write_post()
 * @uses edit_post()
 * @uses get_post()
 * @uses current_user_can()
 * @uses wp_create_post_autosave()
 *
 * @return str URL to redirect to show the preview
 */
function post_preview() {

	$post_ID = (int) $_POST['post_ID'];
	if ( $post_ID < 1 )
		wp_die( __('Preview not available. Please save as a draft first.') );

	if ( isset($_POST['catslist']) )
		$_POST['post_category'] = explode(",", $_POST['catslist']);

	if ( isset($_POST['tags_input']) )
		$_POST['tags_input'] = explode(",", $_POST['tags_input']);

	if ( $_POST['post_type'] == 'page' || empty($_POST['post_category']) )
		unset($_POST['post_category']);

	$_POST['ID'] = $post_ID;
	$post = get_post($post_ID);

	if ( 'page' == $post->post_type ) {
		if ( !current_user_can('edit_page', $post_ID) )
			wp_die(__('You are not allowed to edit this page.'));
	} else {
		if ( !current_user_can('edit_post', $post_ID) )
			wp_die(__('You are not allowed to edit this post.'));
	}

	if ( 'draft' == $post->post_status ) {
		$id = edit_post();
	} else { // Non drafts are not overwritten.  The autosave is stored in a special post revision.
		$id = wp_create_post_autosave( $post->ID );
		if ( ! is_wp_error($id) )
			$id = $post->ID;
	}

	if ( is_wp_error($id) )
		wp_die( $id->get_error_message() );

	if ( $_POST['post_status'] == 'draft'  ) {
		$url = add_query_arg( 'preview', 'true', get_permalink($id) );
	} else {
		$nonce = wp_create_nonce('post_preview_' . $id);
		$url = add_query_arg( array( 'preview' => 'true', 'preview_id' => $id, 'preview_nonce' => $nonce ), get_permalink($id) );
	}

	return $url;
}

/**
 * Adds the TinyMCE editor used on the Write and Edit screens.
 *
 * Has option to output a trimmed down version used in Press This.
 *
 * @package WordPress
 * @since 2.7
 */
function wp_tiny_mce( $teeny = false ) {
	if ( ! user_can_richedit() )
		return;

	$baseurl = includes_url('js/tinymce');

	$mce_css = $baseurl . '/wordpress.css';
	$mce_css = apply_filters('mce_css', $mce_css);

	$mce_locale = ( '' == get_locale() ) ? 'en' : strtolower( substr(get_locale(), 0, 2) ); // only ISO 639-1

	/*
	The following filter allows localization scripts to change the languages displayed in the spellchecker's drop-down menu.
	By default it uses Google's spellchecker API, but can be configured to use PSpell/ASpell if installed on the server.
	The + sign marks the default language. More information:
	http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker
	*/
	$mce_spellchecker_languages = apply_filters('mce_spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv');

	if ( $teeny ) {
		$plugins = apply_filters( 'teeny_mce_plugins', array('safari', 'inlinepopups', 'media', 'autosave', 'fullscreen') );
		$ext_plugins = '';
	} else {
		$plugins = array( 'safari', 'inlinepopups', 'autosave', 'spellchecker', 'paste', 'wordpress', 'media', 'fullscreen', 'wpeditimage', 'wpgallery' );

		/*
		The following filter takes an associative array of external plugins for TinyMCE in the form 'plugin_name' => 'url'.
		It adds the plugin's name to TinyMCE's plugins init and the call to PluginManager to load the plugin.
		The url should be absolute and should include the js file name to be loaded. Example:
		array( 'myplugin' => 'http://my-site.com/wp-content/plugins/myfolder/mce_plugin.js' )
		If the plugin uses a button, it should be added with one of the "$mce_buttons" filters.
		*/
		$mce_external_plugins = apply_filters('mce_external_plugins', array());

		$ext_plugins = "\n";
		if ( ! empty($mce_external_plugins) ) {

			/*
			The following filter loads external language files for TinyMCE plugins.
			It takes an associative array 'plugin_name' => 'path', where path is the
			include path to the file. The language file should follow the same format as
			/tinymce/langs/wp-langs.php and should define a variable $strings that
			holds all translated strings.
			When this filter is not used, the function will try to load {mce_locale}.js.
			If that is not found, en.js will be tried next.
			*/
			$mce_external_languages = apply_filters('mce_external_languages', array());

			$loaded_langs = array();
			$strings = '';

			if ( ! empty($mce_external_languages) ) {
				foreach ( $mce_external_languages as $name => $path ) {
					if ( @is_file($path) && @is_readable($path) ) {
						include_once($path);
						$ext_plugins .= $strings . "\n";
						$loaded_langs[] = $name;
					}
				}
			}

			foreach ( $mce_external_plugins as $name => $url ) {

				if ( is_ssl() ) $url = str_replace('http://', 'https://', $url);

				$plugins[] = '-' . $name;

				$plugurl = dirname($url);
				$strings = $str1 = $str2 = '';
				if ( ! in_array($name, $loaded_langs) ) {
					$path = str_replace( WP_PLUGIN_URL, '', $plugurl );
					$path = WP_PLUGIN_DIR . $path . '/langs/';

					if ( function_exists('realpath') )
						$path = trailingslashit( realpath($path) );

					if ( @is_file($path . $mce_locale . '.js') )
						$strings .= @file_get_contents($path . $mce_locale . '.js') . "\n";

					if ( @is_file($path . $mce_locale . '_dlg.js') )
						$strings .= @file_get_contents($path . $mce_locale . '_dlg.js') . "\n";

					if ( 'en' != $mce_locale && empty($strings) ) {
						if ( @is_file($path . 'en.js') ) {
							$str1 = @file_get_contents($path . 'en.js');
							$strings .= preg_replace( '/([\'"])en\./', '$1' . $mce_locale . '.', $str1, 1 ) . "\n";
						}

						if ( @is_file($path . 'en_dlg.js') ) {
							$str2 = @file_get_contents($path . 'en_dlg.js');
							$strings .= preg_replace( '/([\'"])en\./', '$1' . $mce_locale . '.', $str2, 1 ) . "\n";
						}
					}

					if ( ! empty($strings) )
						$ext_plugins .= "\n" . $strings . "\n";
				}

				$ext_plugins .= 'tinyMCEPreInit.load_ext("' . $plugurl . '", "' . $mce_locale . '");' . "\n";
				$ext_plugins .= 'tinymce.PluginManager.load("' . $name . '", "' . $url . '");' . "\n";
			}
		}
	}

	$plugins = implode($plugins, ',');

	if ( $teeny ) {
		$mce_buttons = apply_filters( 'teeny_mce_buttons', array('bold, italic, underline, blockquote, separator, strikethrough, bullist, numlist,justifyleft, justifycenter, justifyright, undo, redo, link, unlink, fullscreen') );
		$mce_buttons = implode($mce_buttons, ',');
		$mce_buttons_2 = $mce_buttons_3 = $mce_buttons_4 = '';
	} else {
		$mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', '|', 'bullist', 'numlist', 'blockquote', '|', 'justifyleft', 'justifycenter', 'justifyright', '|', 'link', 'unlink', 'wp_more', '|', 'spellchecker', 'fullscreen', 'wp_adv' ));
		$mce_buttons = implode($mce_buttons, ',');

		$mce_buttons_2 = apply_filters('mce_buttons_2', array('formatselect', 'underline', 'justifyfull', 'forecolor', '|', 'pastetext', 'pasteword', 'removeformat', '|', 'media', 'charmap', '|', 'outdent', 'indent', '|', 'undo', 'redo', 'wp_help' ));
		$mce_buttons_2 = implode($mce_buttons_2, ',');

		$mce_buttons_3 = apply_filters('mce_buttons_3', array());
		$mce_buttons_3 = implode($mce_buttons_3, ',');

		$mce_buttons_4 = apply_filters('mce_buttons_4', array());
		$mce_buttons_4 = implode($mce_buttons_4, ',');
	}
	$no_captions = ( apply_filters( 'disable_captions', '' ) ) ? true : false;

	// TinyMCE init settings
	$initArray = array (
		'mode' => 'none',
		'onpageload' => 'switchEditors.edInit',
		'width' => '100%',
		'theme' => 'advanced',
		'skin' => 'wp_theme',
		'theme_advanced_buttons1' => "$mce_buttons",
		'theme_advanced_buttons2' => "$mce_buttons_2",
		'theme_advanced_buttons3' => "$mce_buttons_3",
		'theme_advanced_buttons4' => "$mce_buttons_4",
		'language' => "$mce_locale",
		'spellchecker_languages' => "$mce_spellchecker_languages",
		'theme_advanced_toolbar_location' => 'top',
		'theme_advanced_toolbar_align' => 'left',
		'theme_advanced_statusbar_location' => 'bottom',
		'theme_advanced_resizing' => true,
		'theme_advanced_resize_horizontal' => false,
		'dialog_type' => 'modal',
		'relative_urls' => false,
		'remove_script_host' => false,
		'convert_urls' => false,
		'apply_source_formatting' => false,
		'remove_linebreaks' => true,
		'paste_convert_middot_lists' => true,
		'paste_remove_spans' => true,
		'paste_remove_styles' => true,
		'gecko_spellcheck' => true,
		'entities' => '38,amp,60,lt,62,gt',
		'accessibility_focus' => true,
		'tab_focus' => ':prev,:next',
		'content_css' => "$mce_css",
		'save_callback' => 'switchEditors.saveCallback',
		'wpeditimage_disable_captions' => $no_captions,
		'plugins' => "$plugins"
	);

	// For people who really REALLY know what they're doing with TinyMCE
	// You can modify initArray to add, remove, change elements of the config before tinyMCE.init
	// Setting "valid_elements", "invalid_elements" and "extended_valid_elements" can be done through "tiny_mce_before_init".
	// Best is to use the default cleanup by not specifying valid_elements, as TinyMCE contains full set of XHTML 1.0.
	if ( $teeny ) {
		$initArray = apply_filters('teeny_mce_before_init', $initArray);
	} else {
		$initArray = apply_filters('tiny_mce_before_init', $initArray);
	}

	$language = $initArray['language'];

	$ver = apply_filters('tiny_mce_version', '3101');

	if ( 'en' != $language )
		include_once(ABSPATH . WPINC . '/js/tinymce/langs/wp-langs.php');

	$mce_options = '';
	foreach ( $initArray as $k => $v )
	    $mce_options .= $k . ':"' . $v . '", ';

	$mce_options = rtrim( trim($mce_options), '\n\r,' ); ?>

<script type="text/javascript">
/* <![CDATA[ */
tinyMCEPreInit = {
	base : "<?php echo $baseurl; ?>",
	suffix : "",
	query : "ver=<?php echo $ver; ?>",
	mceInit : {<?php echo $mce_options; ?>},

	go : function() {
		var t = this, sl = tinymce.ScriptLoader, ln = t.mceInit.language, th = t.mceInit.theme, pl = t.mceInit.plugins;

		sl.markDone(t.base + '/langs/' + ln + '.js');

		sl.markDone(t.base + '/themes/' + th + '/langs/' + ln + '.js');
		sl.markDone(t.base + '/themes/' + th + '/langs/' + ln + '_dlg.js');

		tinymce.each(pl.split(','), function(n) {
			if (n && n.charAt(0) != '-') {
				sl.markDone(t.base + '/plugins/' + n + '/langs/' + ln + '.js');
				sl.markDone(t.base + '/plugins/' + n + '/langs/' + ln + '_dlg.js');
			}
		});
	},

	load_ext : function(url,lang) {
		var sl = tinymce.ScriptLoader;

		sl.markDone(url + '/langs/' + lang + '.js');
		sl.markDone(url + '/langs/' + lang + '_dlg.js');
	}
};
/* ]]> */
</script>
<script type="text/javascript" src="<?php echo $baseurl; ?>/tiny_mce.js?ver=<?php echo $ver; ?>"></script>
<?php if ( 'en' != $language && isset($lang) ) { ?>
<script type="text/javascript">
<?php echo $lang; ?>
</script>
<?php } else { ?>
<script type="text/javascript" src="<?php echo $baseurl; ?>/langs/wp-langs-en.js?ver=<?php echo $ver; ?>"></script>
<?php } ?>
<script type="text/javascript">
<?php if ( $ext_plugins ) echo $ext_plugins; ?>

// Mark translations as done
tinyMCEPreInit.go();

// Init
tinyMCE.init(tinyMCEPreInit.mceInit);
</script>

<?php
}
?>
                                                                                                                           wp-admin/includes/schema.php                                                                        0000755 0023422 0004734 00000042212 11145234450 017100  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress Administration Scheme API
 *
 * Here we keep the DB structure and option values.
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * The database character collate.
 * @var string
 * @global string
 * @name $charset_collate
 */
$charset_collate = '';

// Declare these as global in case schema.php is included from a function.
global $wpdb, $wp_queries;

if ( $wpdb->has_cap( 'collation' ) ) {
	if ( ! empty($wpdb->charset) )
		$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
	if ( ! empty($wpdb->collate) )
		$charset_collate .= " COLLATE $wpdb->collate";
}

/** Create WordPress database tables SQL */
$wp_queries = "CREATE TABLE $wpdb->terms (
 term_id bigint(20) NOT NULL auto_increment,
 name varchar(200) NOT NULL default '',
 slug varchar(200) NOT NULL default '',
 term_group bigint(10) NOT NULL default 0,
 PRIMARY KEY  (term_id),
 UNIQUE KEY slug (slug),
 KEY name (name)
) $charset_collate;
CREATE TABLE $wpdb->term_taxonomy (
 term_taxonomy_id bigint(20) NOT NULL auto_increment,
 term_id bigint(20) NOT NULL default 0,
 taxonomy varchar(32) NOT NULL default '',
 description longtext NOT NULL,
 parent bigint(20) NOT NULL default 0,
 count bigint(20) NOT NULL default 0,
 PRIMARY KEY  (term_taxonomy_id),
 UNIQUE KEY term_id_taxonomy (term_id,taxonomy)
) $charset_collate;
CREATE TABLE $wpdb->term_relationships (
 object_id bigint(20) NOT NULL default 0,
 term_taxonomy_id bigint(20) NOT NULL default 0,
 term_order int(11) NOT NULL default 0,
 PRIMARY KEY  (object_id,term_taxonomy_id),
 KEY term_taxonomy_id (term_taxonomy_id)
) $charset_collate;
CREATE TABLE $wpdb->comments (
  comment_ID bigint(20) unsigned NOT NULL auto_increment,
  comment_post_ID int(11) NOT NULL default '0',
  comment_author tinytext NOT NULL,
  comment_author_email varchar(100) NOT NULL default '',
  comment_author_url varchar(200) NOT NULL default '',
  comment_author_IP varchar(100) NOT NULL default '',
  comment_date datetime NOT NULL default '0000-00-00 00:00:00',
  comment_date_gmt datetime NOT NULL default '0000-00-00 00:00:00',
  comment_content text NOT NULL,
  comment_karma int(11) NOT NULL default '0',
  comment_approved varchar(20) NOT NULL default '1',
  comment_agent varchar(255) NOT NULL default '',
  comment_type varchar(20) NOT NULL default '',
  comment_parent bigint(20) NOT NULL default '0',
  user_id bigint(20) NOT NULL default '0',
  PRIMARY KEY  (comment_ID),
  KEY comment_approved (comment_approved),
  KEY comment_post_ID (comment_post_ID),
  KEY comment_approved_date_gmt (comment_approved,comment_date_gmt),
  KEY comment_date_gmt (comment_date_gmt)
) $charset_collate;
CREATE TABLE $wpdb->links (
  link_id bigint(20) NOT NULL auto_increment,
  link_url varchar(255) NOT NULL default '',
  link_name varchar(255) NOT NULL default '',
  link_image varchar(255) NOT NULL default '',
  link_target varchar(25) NOT NULL default '',
  link_category bigint(20) NOT NULL default '0',
  link_description varchar(255) NOT NULL default '',
  link_visible varchar(20) NOT NULL default 'Y',
  link_owner int(11) NOT NULL default '1',
  link_rating int(11) NOT NULL default '0',
  link_updated datetime NOT NULL default '0000-00-00 00:00:00',
  link_rel varchar(255) NOT NULL default '',
  link_notes mediumtext NOT NULL,
  link_rss varchar(255) NOT NULL default '',
  PRIMARY KEY  (link_id),
  KEY link_category (link_category),
  KEY link_visible (link_visible)
) $charset_collate;
CREATE TABLE $wpdb->options (
  option_id bigint(20) NOT NULL auto_increment,
  blog_id int(11) NOT NULL default '0',
  option_name varchar(64) NOT NULL default '',
  option_value longtext NOT NULL,
  autoload varchar(20) NOT NULL default 'yes',
  PRIMARY KEY  (option_id,blog_id,option_name),
  KEY option_name (option_name)
) $charset_collate;
CREATE TABLE $wpdb->postmeta (
  meta_id bigint(20) NOT NULL auto_increment,
  post_id bigint(20) NOT NULL default '0',
  meta_key varchar(255) default NULL,
  meta_value longtext,
  PRIMARY KEY  (meta_id),
  KEY post_id (post_id),
  KEY meta_key (meta_key)
) $charset_collate;
CREATE TABLE $wpdb->posts (
  ID bigint(20) unsigned NOT NULL auto_increment,
  post_author bigint(20) NOT NULL default '0',
  post_date datetime NOT NULL default '0000-00-00 00:00:00',
  post_date_gmt datetime NOT NULL default '0000-00-00 00:00:00',
  post_content longtext NOT NULL,
  post_title text NOT NULL,
  post_category int(4) NOT NULL default '0',
  post_excerpt text NOT NULL,
  post_status varchar(20) NOT NULL default 'publish',
  comment_status varchar(20) NOT NULL default 'open',
  ping_status varchar(20) NOT NULL default 'open',
  post_password varchar(20) NOT NULL default '',
  post_name varchar(200) NOT NULL default '',
  to_ping text NOT NULL,
  pinged text NOT NULL,
  post_modified datetime NOT NULL default '0000-00-00 00:00:00',
  post_modified_gmt datetime NOT NULL default '0000-00-00 00:00:00',
  post_content_filtered text NOT NULL,
  post_parent bigint(20) NOT NULL default '0',
  guid varchar(255) NOT NULL default '',
  menu_order int(11) NOT NULL default '0',
  post_type varchar(20) NOT NULL default 'post',
  post_mime_type varchar(100) NOT NULL default '',
  comment_count bigint(20) NOT NULL default '0',
  PRIMARY KEY  (ID),
  KEY post_name (post_name),
  KEY type_status_date (post_type,post_status,post_date,ID),
  KEY post_parent (post_parent)
) $charset_collate;
CREATE TABLE $wpdb->users (
  ID bigint(20) unsigned NOT NULL auto_increment,
  user_login varchar(60) NOT NULL default '',
  user_pass varchar(64) NOT NULL default '',
  user_nicename varchar(50) NOT NULL default '',
  user_email varchar(100) NOT NULL default '',
  user_url varchar(100) NOT NULL default '',
  user_registered datetime NOT NULL default '0000-00-00 00:00:00',
  user_activation_key varchar(60) NOT NULL default '',
  user_status int(11) NOT NULL default '0',
  display_name varchar(250) NOT NULL default '',
  PRIMARY KEY  (ID),
  KEY user_login_key (user_login),
  KEY user_nicename (user_nicename)
) $charset_collate;
CREATE TABLE $wpdb->usermeta (
  umeta_id bigint(20) NOT NULL auto_increment,
  user_id bigint(20) NOT NULL default '0',
  meta_key varchar(255) default NULL,
  meta_value longtext,
  PRIMARY KEY  (umeta_id),
  KEY user_id (user_id),
  KEY meta_key (meta_key)
) $charset_collate;";

/**
 * Create WordPress options and set the default values.
 *
 * @since 1.5.0
 * @uses $wpdb
 * @uses $wp_db_version
 */
function populate_options() {
	global $wpdb, $wp_db_version;

	$guessurl = wp_guess_url();

	do_action('populate_options');

	add_option('siteurl', $guessurl);
	add_option('blogname', __('My Blog'));
	add_option('blogdescription', __('Just another WordPress weblog'));
	add_option('users_can_register', 0);
	add_option('admin_email', 'you@example.com');
	add_option('start_of_week', 1);
	add_option('use_balanceTags', 0);
	add_option('use_smilies', 1);
	add_option('require_name_email', 1);
	add_option('comments_notify', 1);
	add_option('posts_per_rss', 10);
	add_option('rss_excerpt_length', 50);
	add_option('rss_use_excerpt', 0);
	add_option('mailserver_url', 'mail.example.com');
	add_option('mailserver_login', 'login@example.com');
	add_option('mailserver_pass', 'password');
	add_option('mailserver_port', 110);
	add_option('default_category', 1);
	add_option('default_comment_status', 'open');
	add_option('default_ping_status', 'open');
	add_option('default_pingback_flag', 1);
	add_option('default_post_edit_rows', 10);
	add_option('posts_per_page', 10);
	add_option('what_to_show', 'posts');
	add_option('date_format', __('F j, Y'));
	add_option('time_format', __('g:i a'));
	add_option('links_updated_date_format', __('F j, Y g:i a'));
	add_option('links_recently_updated_prepend', '<em>');
	add_option('links_recently_updated_append', '</em>');
	add_option('links_recently_updated_time', 120);
	add_option('comment_moderation', 0);
	add_option('moderation_notify', 1);
	add_option('permalink_structure');
	add_option('gzipcompression', 0);
	add_option('hack_file', 0);
	add_option('blog_charset', 'UTF-8');
	add_option('moderation_keys');
	add_option('active_plugins');
	add_option('home', $guessurl);
	// in case it is set, but blank, update "home"
	if ( !__get_option('home') ) update_option('home', $guessurl);
	add_option('category_base');
	//add_option('ping_sites', 'http://rpc.pingomatic.com/');
	add_option('advanced_edit', 0);
	add_option('comment_max_links', 2);
	add_option('gmt_offset', date('Z') / 3600);
	// 1.5
	add_option('default_email_category', 1);
	add_option('recently_edited');
	add_option('use_linksupdate', 0);
	add_option('template', 'default');
	add_option('stylesheet', 'default');
	add_option('comment_whitelist', 1);
	add_option('page_uris');
	add_option('blacklist_keys');
	add_option('comment_registration', 0);
	add_option('rss_language', 'en');
	add_option('html_type', 'text/html');
	// 1.5.1
	add_option('use_trackback', 0);
	// 2.0
	add_option('default_role', 'subscriber');
	add_option('db_version', $wp_db_version);
	// 2.0.1
	if ( ini_get('safe_mode') ) {
		// Safe mode screws up mkdir(), so we must use a flat structure.
		add_option('uploads_use_yearmonth_folders', 0);
		add_option('upload_path', WP_CONTENT_DIR);
	} else {
		add_option('uploads_use_yearmonth_folders', 1);
		add_option('upload_path', WP_CONTENT_DIR . '/uploads');
	}

	// 2.0.3
	add_option('secret', wp_generate_password(64));

	// 2.1
	add_option('blog_public', '1');
	add_option('default_link_category', 2);
	add_option('show_on_front', 'posts');

	// 2.2
	add_option('tag_base');

	// 2.5
	add_option('show_avatars', '1');
	add_option('avatar_rating', 'G');
	add_option('upload_url_path', '');
	add_option('thumbnail_size_w', 150);
	add_option('thumbnail_size_h', 150);
	add_option('thumbnail_crop', 1);
	add_option('medium_size_w', 300);
	add_option('medium_size_h', 300);

	// 2.6
	add_option('avatar_default', 'mystery');
	add_option('enable_app', 0);
	add_option('enable_xmlrpc', 0);

	// 2.7
	add_option('large_size_w', 1024);
	add_option('large_size_h', 1024);
	add_option('image_default_link_type', 'file');
	add_option('image_default_size', '');
	add_option('image_default_align', '');
	add_option('close_comments_for_old_posts', 0);
	add_option('close_comments_days_old', 14);
	add_option('thread_comments', 0);
	add_option('thread_comments_depth', 5);
	add_option('page_comments', 1);
	add_option('comments_per_page', 50);
	add_option('default_comments_page', 'newest');
	add_option('comment_order', 'asc');
	add_option('use_ssl', 0);
	add_option('sticky_posts', array());
	add_option('widget_categories', array());
	add_option('widget_text', array());
	add_option('widget_rss', array());
	add_option('update_core', array());
	add_option('dismissed_update_core', array());

	// Delete unused options
	$unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins');
	foreach ($unusedoptions as $option) :
		delete_option($option);
	endforeach;

	// Set up a few options not to load by default
	$fatoptions = array( 'moderation_keys', 'recently_edited', 'blacklist_keys' );
	foreach ($fatoptions as $fatoption) :
		$wpdb->query("UPDATE $wpdb->options SET `autoload` = 'no' WHERE option_name = '$fatoption'");
	endforeach;
}

/**
 * Execute WordPress role creation for the various WordPress versions.
 *
 * @since 2.0.0
 */
function populate_roles() {
	populate_roles_160();
	populate_roles_210();
	populate_roles_230();
	populate_roles_250();
	populate_roles_260();
	populate_roles_270();
}

/**
 * Create the roles for WordPress 2.0
 *
 * @since 2.0.0
 */
function populate_roles_160() {
	// Add roles

	// Dummy gettext calls to get strings in the catalog.
	_c('Administrator|User role');
	_c('Editor|User role');
	_c('Author|User role');
	_c('Contributor|User role');
	_c('Subscriber|User role');

	add_role('administrator', 'Administrator|User role');
	add_role('editor', 'Editor|User role');
	add_role('author', 'Author|User role');
	add_role('contributor', 'Contributor|User role');
	add_role('subscriber', 'Subscriber|User role');

	// Add caps for Administrator role
	$role =& get_role('administrator');
	$role->add_cap('switch_themes');
	$role->add_cap('edit_themes');
	$role->add_cap('activate_plugins');
	$role->add_cap('edit_plugins');
	$role->add_cap('edit_users');
	$role->add_cap('edit_files');
	$role->add_cap('manage_options');
	$role->add_cap('moderate_comments');
	$role->add_cap('manage_categories');
	$role->add_cap('manage_links');
	$role->add_cap('upload_files');
	$role->add_cap('import');
	$role->add_cap('unfiltered_html');
	$role->add_cap('edit_posts');
	$role->add_cap('edit_others_posts');
	$role->add_cap('edit_published_posts');
	$role->add_cap('publish_posts');
	$role->add_cap('edit_pages');
	$role->add_cap('read');
	$role->add_cap('level_10');
	$role->add_cap('level_9');
	$role->add_cap('level_8');
	$role->add_cap('level_7');
	$role->add_cap('level_6');
	$role->add_cap('level_5');
	$role->add_cap('level_4');
	$role->add_cap('level_3');
	$role->add_cap('level_2');
	$role->add_cap('level_1');
	$role->add_cap('level_0');

	// Add caps for Editor role
	$role =& get_role('editor');
	$role->add_cap('moderate_comments');
	$role->add_cap('manage_categories');
	$role->add_cap('manage_links');
	$role->add_cap('upload_files');
	$role->add_cap('unfiltered_html');
	$role->add_cap('edit_posts');
	$role->add_cap('edit_others_posts');
	$role->add_cap('edit_published_posts');
	$role->add_cap('publish_posts');
	$role->add_cap('edit_pages');
	$role->add_cap('read');
	$role->add_cap('level_7');
	$role->add_cap('level_6');
	$role->add_cap('level_5');
	$role->add_cap('level_4');
	$role->add_cap('level_3');
	$role->add_cap('level_2');
	$role->add_cap('level_1');
	$role->add_cap('level_0');

	// Add caps for Author role
	$role =& get_role('author');
	$role->add_cap('upload_files');
	$role->add_cap('edit_posts');
	$role->add_cap('edit_published_posts');
	$role->add_cap('publish_posts');
	$role->add_cap('read');
	$role->add_cap('level_2');
	$role->add_cap('level_1');
	$role->add_cap('level_0');

	// Add caps for Contributor role
	$role =& get_role('contributor');
	$role->add_cap('edit_posts');
	$role->add_cap('read');
	$role->add_cap('level_1');
	$role->add_cap('level_0');

	// Add caps for Subscriber role
	$role =& get_role('subscriber');
	$role->add_cap('read');
	$role->add_cap('level_0');
}

/**
 * Create and modify WordPress roles for WordPress 2.1.
 *
 * @since 2.1.0
 */
function populate_roles_210() {
	$roles = array('administrator', 'editor');
	foreach ($roles as $role) {
		$role =& get_role($role);
		if ( empty($role) )
			continue;

		$role->add_cap('edit_others_pages');
		$role->add_cap('edit_published_pages');
		$role->add_cap('publish_pages');
		$role->add_cap('delete_pages');
		$role->add_cap('delete_others_pages');
		$role->add_cap('delete_published_pages');
		$role->add_cap('delete_posts');
		$role->add_cap('delete_others_posts');
		$role->add_cap('delete_published_posts');
		$role->add_cap('delete_private_posts');
		$role->add_cap('edit_private_posts');
		$role->add_cap('read_private_posts');
		$role->add_cap('delete_private_pages');
		$role->add_cap('edit_private_pages');
		$role->add_cap('read_private_pages');
	}

	$role =& get_role('administrator');
	if ( ! empty($role) ) {
		$role->add_cap('delete_users');
		$role->add_cap('create_users');
	}

	$role =& get_role('author');
	if ( ! empty($role) ) {
		$role->add_cap('delete_posts');
		$role->add_cap('delete_published_posts');
	}

	$role =& get_role('contributor');
	if ( ! empty($role) ) {
		$role->add_cap('delete_posts');
	}
}

/**
 * Create and modify WordPress roles for WordPress 2.3.
 *
 * @since 2.3.0
 */
function populate_roles_230() {
	$role =& get_role( 'administrator' );

	if ( !empty( $role ) ) {
		$role->add_cap( 'unfiltered_upload' );
	}
}

/**
 * Create and modify WordPress roles for WordPress 2.5.
 *
 * @since 2.5.0
 */
function populate_roles_250() {
	$role =& get_role( 'administrator' );

	if ( !empty( $role ) ) {
		$role->add_cap( 'edit_dashboard' );
	}
}

/**
 * Create and modify WordPress roles for WordPress 2.6.
 *
 * @since 2.6.0
 */
function populate_roles_260() {
	$role =& get_role( 'administrator' );

	if ( !empty( $role ) ) {
		$role->add_cap( 'update_plugins' );
		$role->add_cap( 'delete_plugins' );
	}
}

/**
 * Create and modify WordPress roles for WordPress 2.7.
 *
 * @since 2.7.0
 */
function populate_roles_270() {
	$role =& get_role( 'administrator' );

	if ( !empty( $role ) ) {
		$role->add_cap( 'install_plugins' );
		$role->add_cap( 'update_themes' );
	}
}

?>                                                                                                                                                                                                                                                                                                                                                                                      wp-admin/includes/taxonomy.php                                                                      0000755 0023422 0004734 00000011401 11103436522 017510  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress Taxonomy Administration API.
 *
 * @package WordPress
 * @subpackage Administration
 */

//
// Category
//

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $cat_name
 * @return unknown
 */
function category_exists($cat_name) {
	$id = is_term($cat_name, 'category');
	if ( is_array($id) )
		$id = $id['term_id'];
	return $id;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $id
 * @return unknown
 */
function get_category_to_edit( $id ) {
	$category = get_category( $id, OBJECT, 'edit' );
	return $category;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $cat_name
 * @param unknown_type $parent
 * @return unknown
 */
function wp_create_category( $cat_name, $parent = 0 ) {
	if ( $id = category_exists($cat_name) )
		return $id;

	return wp_insert_category( array('cat_name' => $cat_name, 'category_parent' => $parent) );
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $categories
 * @param unknown_type $post_id
 * @return unknown
 */
function wp_create_categories($categories, $post_id = '') {
	$cat_ids = array ();
	foreach ($categories as $category) {
		if ($id = category_exists($category))
			$cat_ids[] = $id;
		else
			if ($id = wp_create_category($category))
				$cat_ids[] = $id;
	}

	if ($post_id)
		wp_set_post_categories($post_id, $cat_ids);

	return $cat_ids;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $cat_ID
 * @return unknown
 */
function wp_delete_category($cat_ID) {
	$cat_ID = (int) $cat_ID;
	$default = get_option('default_category');

	// Don't delete the default cat
	if ( $cat_ID == $default )
		return 0;

	return wp_delete_term($cat_ID, 'category', array('default' => $default));
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $catarr
 * @param unknown_type $wp_error
 * @return unknown
 */
function wp_insert_category($catarr, $wp_error = false) {
	$cat_defaults = array('cat_ID' => 0, 'cat_name' => '', 'category_description' => '', 'category_nicename' => '', 'category_parent' => '');
	$catarr = wp_parse_args($catarr, $cat_defaults);
	extract($catarr, EXTR_SKIP);

	if ( trim( $cat_name ) == '' ) {
		if ( ! $wp_error )
			return 0;
		else
			return new WP_Error( 'cat_name', __('You did not enter a category name.') );
	}

	$cat_ID = (int) $cat_ID;

	// Are we updating or creating?
	if ( !empty ($cat_ID) )
		$update = true;
	else
		$update = false;

	$name = $cat_name;
	$description = $category_description;
	$slug = $category_nicename;
	$parent = $category_parent;

	$parent = (int) $parent;
	if ( $parent < 0 )
		$parent = 0;

	if ( empty($parent) || !category_exists( $parent ) || ($cat_ID && cat_is_ancestor_of($cat_ID, $parent) ) )
		$parent = 0;

	$args = compact('name', 'slug', 'parent', 'description');

	if ( $update )
		$cat_ID = wp_update_term($cat_ID, 'category', $args);
	else
		$cat_ID = wp_insert_term($cat_name, 'category', $args);

	if ( is_wp_error($cat_ID) ) {
		if ( $wp_error )
			return $cat_ID;
		else
			return 0;
	}

	return $cat_ID['term_id'];
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $catarr
 * @return unknown
 */
function wp_update_category($catarr) {
	$cat_ID = (int) $catarr['cat_ID'];

	if ( isset($catarr['category_parent']) && ($cat_ID == $catarr['category_parent']) )
		return false;

	// First, get all of the original fields
	$category = get_category($cat_ID, ARRAY_A);

	// Escape data pulled from DB.
	$category = add_magic_quotes($category);

	// Merge old and new fields with new fields overwriting old ones.
	$catarr = array_merge($category, $catarr);

	return wp_insert_category($catarr);
}

//
// Tags
//

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $post_id
 * @return unknown
 */
function get_tags_to_edit( $post_id ) {
	$post_id = (int) $post_id;
	if ( !$post_id )
		return false;

	$tags = wp_get_post_tags($post_id);

	if ( !$tags )
		return false;

	foreach ( $tags as $tag )
		$tag_names[] = $tag->name;
	$tags_to_edit = join( ',', $tag_names );
	$tags_to_edit = attribute_escape( $tags_to_edit );
	$tags_to_edit = apply_filters( 'tags_to_edit', $tags_to_edit );
	return $tags_to_edit;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $tag_name
 * @return unknown
 */
function tag_exists($tag_name) {
	return is_term($tag_name, 'post_tag');
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $tag_name
 * @return unknown
 */
function wp_create_tag($tag_name) {
	if ( $id = tag_exists($tag_name) )
		return $id;

	return wp_insert_term($tag_name, 'post_tag');
}

?>
                                                                                                                                                                                                                                                               wp-admin/includes/template.php                                                                      0000755 0023422 0004734 00000340356 11140123230 017451  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Template WordPress Administration API.
 *
 * A Big Mess. Also some neat functions that are nicely written.
 *
 * @package WordPress
 * @subpackage Administration
 */

// Ugly recursive category stuff.
/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $parent
 * @param unknown_type $level
 * @param unknown_type $categories
 * @param unknown_type $page
 * @param unknown_type $per_page
 */
function cat_rows( $parent = 0, $level = 0, $categories = 0, $page = 1, $per_page = 20 ) {
	$count = 0;
	_cat_rows($categories, $count, $parent, $level, $page, $per_page);
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $categories
 * @param unknown_type $count
 * @param unknown_type $parent
 * @param unknown_type $level
 * @param unknown_type $page
 * @param unknown_type $per_page
 * @return unknown
 */
function _cat_rows( $categories, &$count, $parent = 0, $level = 0, $page = 1, $per_page = 20 ) {
	if ( empty($categories) ) {
		$args = array('hide_empty' => 0);
		if ( !empty($_GET['s']) )
			$args['search'] = $_GET['s'];
		$categories = get_categories( $args );
	}

	if ( !$categories )
		return false;

	$children = _get_term_hierarchy('category');

	$start = ($page - 1) * $per_page;
	$end = $start + $per_page;
	$i = -1;
	ob_start();
	foreach ( $categories as $category ) {
		if ( $count >= $end )
			break;

		$i++;

		if ( $category->parent != $parent )
			continue;

		// If the page starts in a subtree, print the parents.
		if ( $count == $start && $category->parent > 0 ) {
			$my_parents = array();
			while ( $my_parent) {
				$my_parent = get_category($my_parent);
				$my_parents[] = $my_parent;
				if ( !$my_parent->parent )
					break;
				$my_parent = $my_parent->parent;
			}
			$num_parents = count($my_parents);
			while( $my_parent = array_pop($my_parents) ) {
				echo "\t" . _cat_row( $my_parent, $level - $num_parents );
				$num_parents--;
			}
		}

		if ( $count >= $start )
			echo "\t" . _cat_row( $category, $level );

		unset($categories[$i]); // Prune the working set
		$count++;

		if ( isset($children[$category->term_id]) )
			_cat_rows( $categories, $count, $category->term_id, $level + 1, $page, $per_page );

	}

	$output = ob_get_contents();
	ob_end_clean();

	echo $output;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $category
 * @param unknown_type $level
 * @param unknown_type $name_override
 * @return unknown
 */
function _cat_row( $category, $level, $name_override = false ) {
	static $row_class = '';

	$category = get_category( $category, OBJECT, 'display' );

	$default_cat_id = (int) get_option( 'default_category' );
	$pad = str_repeat( '&#8212; ', $level );
	$name = ( $name_override ? $name_override : $pad . ' ' . $category->name );
	$edit_link = "categories.php?action=edit&amp;cat_ID=$category->term_id";
	if ( current_user_can( 'manage_categories' ) ) {
		$edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "'>" . attribute_escape( $name ) . '</a><br />';
		$actions = array();
		$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
		$actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
		if ( $default_cat_id != $category->term_id )
			$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("categories.php?action=delete&amp;cat_ID=$category->term_id", 'delete-category_' . $category->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this category '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
		$action_count = count($actions);
		$i = 0;
		$edit .= '<div class="row-actions">';
		foreach ( $actions as $action => $link ) {
			++$i;
			( $i == $action_count ) ? $sep = '' : $sep = ' | ';
			$edit .= "<span class='$action'>$link$sep</span>";
		}
		$edit .= '</div>';
	} else {
		$edit = $name;
	}

	$row_class = 'alternate' == $row_class ? '' : 'alternate';
	$qe_data = get_category_to_edit($category->term_id);

	$category->count = number_format_i18n( $category->count );
	$posts_count = ( $category->count > 0 ) ? "<a href='edit.php?cat=$category->term_id'>$category->count</a>" : $category->count;
	$output = "<tr id='cat-$category->term_id' class='iedit $row_class'>";

	$columns = get_column_headers('categories');
	$hidden = get_hidden_columns('categories');
	foreach ( $columns as $column_name => $column_display_name ) {
		$class = "class=\"$column_name column-$column_name\"";

		$style = '';
		if ( in_array($column_name, $hidden) )
			$style = ' style="display:none;"';

		$attributes = "$class$style";

		switch ($column_name) {
			case 'cb':
				$output .= "<th scope='row' class='check-column'>";
				if ( $default_cat_id != $category->term_id ) {
					$output .= "<input type='checkbox' name='delete[]' value='$category->term_id' />";
				} else {
					$output .= "&nbsp;";
				}
				$output .= '</th>';
				break;
			case 'name':
				$output .= "<td $attributes>$edit";
				$output .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
				$output .= '<div class="name">' . $qe_data->name . '</div>';
				$output .= '<div class="slug">' . $qe_data->slug . '</div>';
				$output .= '<div class="cat_parent">' . $qe_data->parent . '</div></div></td>';
				break;
			case 'description':
				$output .= "<td $attributes>$category->description</td>";
				break;
			case 'slug':
				$output .= "<td $attributes>$category->slug</td>";
				break;
			case 'posts':
				$attributes = 'class="posts column-posts num"' . $style;
				$output .= "<td $attributes>$posts_count</td>\n";
		}
	}
	$output .= '</tr>';

	return $output;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since 2.7
 *
 * Outputs the HTML for the hidden table rows used in Categories, Link Caregories and Tags quick edit.
 *
 * @param string $type "tag", "category" or "link-category"
 * @return
 */
function inline_edit_term_row($type) {

	if ( ! current_user_can( 'manage_categories' ) )
		return;

	$is_tag = $type == 'edit-tags';
	$columns = get_column_headers($type);
	$hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns($type) ) );
	$col_count = count($columns) - count($hidden);
	?>

<form method="get" action=""><table style="display: none"><tbody id="inlineedit">
	<tr id="inline-edit" class="inline-edit-row" style="display: none"><td colspan="<?php echo $col_count; ?>">

		<fieldset><div class="inline-edit-col">
			<h4><?php _e( 'Quick Edit' ); ?></h4>

			<label>
				<span class="title"><?php _e( 'Name' ); ?></span>
				<span class="input-text-wrap"><input type="text" name="name" class="ptitle" value="" /></span>
			</label>

			<label>
				<span class="title"><?php _e( 'Slug' ); ?></span>
				<span class="input-text-wrap"><input type="text" name="slug" class="ptitle" value="" /></span>
			</label>

<?php if ( 'category' == $type ) : ?>

			<label>
				<span class="title"><?php _e( 'Parent' ); ?></span>
				<?php wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('None'))); ?>
			</label>

<?php endif; // $type ?>

		</div></fieldset>

<?php

	$core_columns = array( 'cb' => true, 'description' => true, 'name' => true, 'slug' => true, 'posts' => true );

	foreach ( $columns as $column_name => $column_display_name ) {
		if ( isset( $core_columns[$column_name] ) )
			continue;
		do_action( 'quick_edit_custom_box', $column_name, $type );
	}

?>

	<p class="inline-edit-save submit">
		<a accesskey="c" href="#inline-edit" title="<?php _e('Cancel'); ?>" class="cancel button-secondary alignleft"><?php _e('Cancel'); ?></a>
		<?php $update_text = ( $is_tag ) ? __( 'Update Tag' ) : __( 'Update Category' ); ?>
		<a accesskey="s" href="#inline-edit" title="<?php echo attribute_escape( $update_text ); ?>" class="save button-primary alignright"><?php echo $update_text; ?></a>
		<img class="waiting" style="display:none;" src="images/loading.gif" alt="" />
		<span class="error" style="display:none;"></span>
		<?php wp_nonce_field( 'taxinlineeditnonce', '_inline_edit', false ); ?>
		<br class="clear" />
	</p>
	</td></tr>
	</tbody></table></form>
<?php
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $category
 * @param unknown_type $name_override
 * @return unknown
 */
function link_cat_row( $category, $name_override = false ) {
	static $row_class = '';

	if ( !$category = get_term( $category, 'link_category', OBJECT, 'display' ) )
		return false;
	if ( is_wp_error( $category ) )
		return $category;

	$default_cat_id = (int) get_option( 'default_link_category' );
	$name = ( $name_override ? $name_override : $category->name );
	$edit_link = "link-category.php?action=edit&amp;cat_ID=$category->term_id";
	if ( current_user_can( 'manage_categories' ) ) {
		$edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "'>$name</a><br />";
		$actions = array();
		$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
		$actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
		if ( $default_cat_id != $category->term_id )
			$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("link-category.php?action=delete&amp;cat_ID=$category->term_id", 'delete-link-category_' . $category->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this category '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
		$action_count = count($actions);
		$i = 0;
		$edit .= '<div class="row-actions">';
		foreach ( $actions as $action => $link ) {
			++$i;
			( $i == $action_count ) ? $sep = '' : $sep = ' | ';
			$edit .= "<span class='$action'>$link$sep</span>";
		}
		$edit .= '</div>';
	} else {
		$edit = $name;
	}

	$row_class = 'alternate' == $row_class ? '' : 'alternate';
	$qe_data = get_term_to_edit($category->term_id, 'link_category');

	$category->count = number_format_i18n( $category->count );
	$count = ( $category->count > 0 ) ? "<a href='link-manager.php?cat_id=$category->term_id'>$category->count</a>" : $category->count;
	$output = "<tr id='link-cat-$category->term_id' class='iedit $row_class'>";
	$columns = get_column_headers('edit-link-categories');
	$hidden = get_hidden_columns('edit-link-categories');
	foreach ( $columns as $column_name => $column_display_name ) {
		$class = "class=\"$column_name column-$column_name\"";

		$style = '';
		if ( in_array($column_name, $hidden) )
			$style = ' style="display:none;"';

		$attributes = "$class$style";

		switch ($column_name) {
			case 'cb':
				$output .= "<th scope='row' class='check-column'>";
				if ( absint( get_option( 'default_link_category' ) ) != $category->term_id ) {
					$output .= "<input type='checkbox' name='delete[]' value='$category->term_id' />";
				} else {
					$output .= "&nbsp;";
				}
				$output .= "</th>";
				break;
			case 'name':
				$output .= "<td $attributes>$edit";
				$output .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
				$output .= '<div class="name">' . $qe_data->name . '</div>';
				$output .= '<div class="slug">' . $qe_data->slug . '</div>';
				$output .= '<div class="cat_parent">' . $qe_data->parent . '</div></div></td>';
				break;
			case 'description':
				$output .= "<td $attributes>$category->description</td>";
				break;
			case 'slug':
				$output .= "<td $attributes>$category->slug</td>";
				break;
			case 'links':
				$attributes = 'class="links column-links num"' . $style;
				$output .= "<td $attributes>$count</td>";
		}
	}
	$output .= '</tr>';

	return $output;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $checked
 * @param unknown_type $current
 */
function checked( $checked, $current) {
	if ( $checked == $current)
		echo ' checked="checked"';
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $selected
 * @param unknown_type $current
 */
function selected( $selected, $current) {
	if ( $selected == $current)
		echo ' selected="selected"';
}

//
// Category Checklists
//

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 * @deprecated Use {@link wp_link_category_checklist()}
 * @see wp_link_category_checklist()
 *
 * @param unknown_type $default
 * @param unknown_type $parent
 * @param unknown_type $popular_ids
 */
function dropdown_categories( $default = 0, $parent = 0, $popular_ids = array() ) {
	global $post_ID;
	wp_category_checklist($post_ID);
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 */
class Walker_Category_Checklist extends Walker {
	var $tree_type = 'category';
	var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this

	function start_lvl(&$output, $depth, $args) {
		$indent = str_repeat("\t", $depth);
		$output .= "$indent<ul class='children'>\n";
	}

	function end_lvl(&$output, $depth, $args) {
		$indent = str_repeat("\t", $depth);
		$output .= "$indent</ul>\n";
	}

	function start_el(&$output, $category, $depth, $args) {
		extract($args);

		$class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : '';
		$output .= "\n<li id='category-$category->term_id'$class>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="post_category[]" id="in-category-' . $category->term_id . '"' . (in_array( $category->term_id, $selected_cats ) ? ' checked="checked"' : "" ) . '/> ' . wp_specialchars( apply_filters('the_category', $category->name )) . '</label>';
	}

	function end_el(&$output, $category, $depth, $args) {
		$output .= "</li>\n";
	}
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $post_id
 * @param unknown_type $descendants_and_self
 * @param unknown_type $selected_cats
 * @param unknown_type $popular_cats
 */
function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null ) {
	if ( empty($walker) || !is_a($walker, 'Walker') )
		$walker = new Walker_Category_Checklist;

	$descendants_and_self = (int) $descendants_and_self;

	$args = array();

	if ( is_array( $selected_cats ) )
		$args['selected_cats'] = $selected_cats;
	elseif ( $post_id )
		$args['selected_cats'] = wp_get_post_categories($post_id);
	else
		$args['selected_cats'] = array();

	if ( is_array( $popular_cats ) )
		$args['popular_cats'] = $popular_cats;
	else
		$args['popular_cats'] = get_terms( 'category', array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) );

	if ( $descendants_and_self ) {
		$categories = get_categories( "child_of=$descendants_and_self&hierarchical=0&hide_empty=0" );
		$self = get_category( $descendants_and_self );
		array_unshift( $categories, $self );
	} else {
		$categories = get_categories('get=all');
	}

	// Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache)
	$checked_categories = array();
	for ( $i = 0; isset($categories[$i]); $i++ ) {
		if ( in_array($categories[$i]->term_id, $args['selected_cats']) ) {
			$checked_categories[] = $categories[$i];
			unset($categories[$i]);
		}
	}

	// Put checked cats on top
	echo call_user_func_array(array(&$walker, 'walk'), array($checked_categories, 0, $args));
	// Then the rest of them
	echo call_user_func_array(array(&$walker, 'walk'), array($categories, 0, $args));
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $taxonomy
 * @param unknown_type $default
 * @param unknown_type $number
 * @param unknown_type $echo
 * @return unknown
 */
function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo = true ) {
	global $post_ID;
	if ( $post_ID )
		$checked_categories = wp_get_post_categories($post_ID);
	else
		$checked_categories = array();
	$categories = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false ) );

	$popular_ids = array();
	foreach ( (array) $categories as $category ) {
		$popular_ids[] = $category->term_id;
		if ( !$echo ) // hack for AJAX use
			continue;
		$id = "popular-category-$category->term_id";
		?>

		<li id="<?php echo $id; ?>" class="popular-category">
			<label class="selectit">
			<input id="in-<?php echo $id; ?>" type="checkbox" value="<?php echo (int) $category->term_id; ?>" />
				<?php echo wp_specialchars( apply_filters( 'the_category', $category->name ) ); ?>
			</label>
		</li>

		<?php
	}
	return $popular_ids;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 * @deprecated Use {@link wp_link_category_checklist()}
 * @see wp_link_category_checklist()
 *
 * @param unknown_type $default
 */
function dropdown_link_categories( $default = 0 ) {
	global $link_id;

	wp_link_category_checklist($link_id);
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $link_id
 */
function wp_link_category_checklist( $link_id = 0 ) {
	$default = 1;

	if ( $link_id ) {
		$checked_categories = wp_get_link_cats($link_id);

		if ( count( $checked_categories ) == 0 ) {
			// No selected categories, strange
			$checked_categories[] = $default;
		}
	} else {
		$checked_categories[] = $default;
	}

	$categories = get_terms('link_category', 'orderby=count&hide_empty=0');

	if ( empty($categories) )
		return;

	foreach ( $categories as $category ) {
		$cat_id = $category->term_id;
		$name = wp_specialchars( apply_filters('the_category', $category->name));
		$checked = in_array( $cat_id, $checked_categories );
		echo '<li id="link-category-', $cat_id, '"><label for="in-link-category-', $cat_id, '" class="selectit"><input value="', $cat_id, '" type="checkbox" name="link_category[]" id="in-link-category-', $cat_id, '"', ($checked ? ' checked="checked"' : "" ), '/> ', $name, "</label></li>";
	}
}

// Tag stuff

// Returns a single tag row (see tag_rows below)
// Note: this is also used in admin-ajax.php!
/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $tag
 * @param unknown_type $class
 * @return unknown
 */
function _tag_row( $tag, $class = '' ) {
		$count = number_format_i18n( $tag->count );
		$count = ( $count > 0 ) ? "<a href='edit.php?tag=$tag->slug'>$count</a>" : $count;

		$name = apply_filters( 'term_name', $tag->name );
		$qe_data = get_term($tag->term_id, 'post_tag', object, 'edit');
		$edit_link = "edit-tags.php?action=edit&amp;tag_ID=$tag->term_id";
		$out = '';
		$out .= '<tr id="tag-' . $tag->term_id . '"' . $class . '>';
		$columns = get_column_headers('edit-tags');
		$hidden = get_hidden_columns('edit-tags');
		foreach ( $columns as $column_name => $column_display_name ) {
			$class = "class=\"$column_name column-$column_name\"";

			$style = '';
			if ( in_array($column_name, $hidden) )
				$style = ' style="display:none;"';

			$attributes = "$class$style";

			switch ($column_name) {
				case 'cb':
					$out .= '<th scope="row" class="check-column"> <input type="checkbox" name="delete_tags[]" value="' . $tag->term_id . '" /></th>';
					break;
				case 'name':
					$out .= '<td ' . $attributes . '><strong><a class="row-title" href="' . $edit_link . '" title="' . attribute_escape(sprintf(__('Edit "%s"'), $name)) . '">' . $name . '</a></strong><br />';
					$actions = array();
					$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
					$actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
					$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("edit-tags.php?action=delete&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this tag '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
					$action_count = count($actions);
					$i = 0;
					$out .= '<div class="row-actions">';
					foreach ( $actions as $action => $link ) {
						++$i;
						( $i == $action_count ) ? $sep = '' : $sep = ' | ';
						$out .= "<span class='$action'>$link$sep</span>";
					}
					$out .= '</div>';
					$out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
					$out .= '<div class="name">' . $qe_data->name . '</div>';
					$out .= '<div class="slug">' . $qe_data->slug . '</div></div></td>';
					break;
				case 'slug':
					$out .= "<td $attributes>$tag->slug</td>";
					break;
				case 'posts':
					$attributes = 'class="posts column-posts num"' . $style;
					$out .= "<td $attributes>$count</td>";
					break;
			}
		}

		$out .= '</tr>';

		return $out;
}

// Outputs appropriate rows for the Nth page of the Tag Management screen,
// assuming M tags displayed at a time on the page
// Returns the number of tags displayed
/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $page
 * @param unknown_type $pagesize
 * @param unknown_type $searchterms
 * @return unknown
 */
function tag_rows( $page = 1, $pagesize = 20, $searchterms = '' ) {

	// Get a page worth of tags
	$start = ($page - 1) * $pagesize;

	$args = array('offset' => $start, 'number' => $pagesize, 'hide_empty' => 0);

	if ( !empty( $searchterms ) ) {
		$args['search'] = $searchterms;
	}

	$tags = get_terms( 'post_tag', $args );

	// convert it to table rows
	$out = '';
	$count = 0;
	foreach( $tags as $tag )
		$out .= _tag_row( $tag, ++$count % 2 ? ' class="iedit alternate"' : ' class="iedit"' );

	// filter and send to screen
	echo $out;
	return $count;
}

// define the columns to display, the syntax is 'internal name' => 'display name'
/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @return unknown
 */
function wp_manage_posts_columns() {
	$posts_columns = array();
	$posts_columns['cb'] = '<input type="checkbox" />';
	$posts_columns['title'] = _c('Post|noun');
	$posts_columns['author'] = __('Author');
	$posts_columns['categories'] = __('Categories');
	$posts_columns['tags'] = __('Tags');
	if ( !isset($_GET['post_status']) || !in_array($_GET['post_status'], array('pending', 'draft', 'future')) )
		$posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="images/comment-grey-bubble.png" /></div>';
	$posts_columns['date'] = __('Date');
	$posts_columns = apply_filters('manage_posts_columns', $posts_columns);

	return $posts_columns;
}

// define the columns to display, the syntax is 'internal name' => 'display name'
/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @return unknown
 */
function wp_manage_media_columns() {
	$posts_columns = array();
	$posts_columns['cb'] = '<input type="checkbox" />';
	$posts_columns['icon'] = '';
	$posts_columns['media'] = _c('File|media column header');
	$posts_columns['author'] = __('Author');
	//$posts_columns['tags'] = _c('Tags|media column header');
	$posts_columns['parent'] = _c('Attached to|media column header');
	$posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="images/comment-grey-bubble.png" /></div>';
	//$posts_columns['comments'] = __('Comments');
	$posts_columns['date'] = _c('Date|media column header');
	$posts_columns = apply_filters('manage_media_columns', $posts_columns);

	return $posts_columns;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @return unknown
 */
function wp_manage_pages_columns() {
	$posts_columns = array();
	$posts_columns['cb'] = '<input type="checkbox" />';
	$posts_columns['title'] = __('Title');
	$posts_columns['author'] = __('Author');
	$post_status = 'all';
	if ( !empty($_GET['post_status']) )
		$post_status = $_GET['post_status'];
	if ( !in_array($post_status, array('pending', 'draft', 'future')) )
		$posts_columns['comments'] = '<div class="vers"><img alt="" src="images/comment-grey-bubble.png" /></div>';
	$posts_columns['date'] = __('Date');
	$posts_columns = apply_filters('manage_pages_columns', $posts_columns);

	return $posts_columns;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $page
 * @return unknown
 */
function get_column_headers($page) {
	global $_wp_column_headers;

	if ( !isset($_wp_column_headers) )
		$_wp_column_headers = array();

	// Store in static to avoid running filters on each call
	if ( isset($_wp_column_headers[$page]) )
		return $_wp_column_headers[$page];

	switch ($page) {
		case 'edit':
			 $_wp_column_headers[$page] = wp_manage_posts_columns();
			 break;
		case 'edit-pages':
			$_wp_column_headers[$page] = wp_manage_pages_columns();
			break;
		case 'edit-comments':
			$_wp_column_headers[$page] = array(
				'cb' => '<input type="checkbox" />',
				'author' => __('Author'),
				'comment' => _c('Comment|noun'),
				//'date' => __('Submitted'),
				'response' => __('In Response To')
			);

			break;
		case 'link-manager':
			$_wp_column_headers[$page] = array(
				'cb' => '<input type="checkbox" />',
				'name' => __('Name'),
				'url' => __('URL'),
				'categories' => __('Categories'),
				'rel' => __('rel'),
				'visible' => __('Visible')
			);

			break;
		case 'upload':
			$_wp_column_headers[$page] = wp_manage_media_columns();
			break;
		case 'categories':
			$_wp_column_headers[$page] = array(
				'cb' => '<input type="checkbox" />',
				'name' => __('Name'),
				'description' => __('Description'),
				'slug' => __('Slug'),
				'posts' => __('Posts')
			);

			break;
		case 'edit-link-categories':
			$_wp_column_headers[$page] = array(
				'cb' => '<input type="checkbox" />',
				'name' => __('Name'),
				'description' => __('Description'),
				'slug' => __('Slug'),
				'links' => __('Links')
			);

			break;
		case 'edit-tags':
			$_wp_column_headers[$page] = array(
				'cb' => '<input type="checkbox" />',
				'name' => __('Name'),
				'slug' => __('Slug'),
				'posts' => __('Posts')
			);

			break;
		case 'users':
			$_wp_column_headers[$page] = array(
				'cb' => '<input type="checkbox" />',
				'username' => __('Username'),
				'name' => __('Name'),
				'email' => __('E-mail'),
				'role' => __('Role'),
				'posts' => __('Posts')
			);
			break;
		default :
			$_wp_column_headers[$page] = array();
	}

	$_wp_column_headers[$page] = apply_filters('manage_' . $page . '_columns', $_wp_column_headers[$page]);
	return $_wp_column_headers[$page];
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $type
 * @param unknown_type $id
 */
function print_column_headers( $type, $id = true ) {
	$type = str_replace('.php', '', $type);
	$columns = get_column_headers( $type );
	$hidden = get_hidden_columns($type);
	$styles = array();
//	$styles['tag']['posts'] = 'width: 90px;';
//	$styles['link-category']['links'] = 'width: 90px;';
//	$styles['category']['posts'] = 'width: 90px;';
//	$styles['link']['visible'] = 'text-align: center;';

	foreach ( $columns as $column_key => $column_display_name ) {
		$class = ' class="manage-column';

		$class .= " column-$column_key";

		if ( 'cb' == $column_key )
			$class .= ' check-column';
		elseif ( in_array($column_key, array('posts', 'comments', 'links')) )
			$class .= ' num';

		$class .= '"';

		$style = '';
		if ( in_array($column_key, $hidden) )
			$style = 'display:none;';

		if ( isset($styles[$type]) && isset($styles[$type][$column_key]) )
			$style .= ' ' . $styles[$type][$column_key];
		$style = ' style="' . $style . '"';
?>
	<th scope="col" <?php echo $id ? "id=\"$column_key\"" : ""; echo $class; echo $style; ?>><?php echo $column_display_name; ?></th>
<?php }
}

/**
 * Register column headers for a particular screen.  The header names will be listed in the Screen Options.
 *
 * @since 2.7.0
 *
 * @param string $screen The handle for the screen to add help to.  This is usually the hook name returned by the add_*_page() functions.
 * @param array $columns An array of columns with column IDs as the keys and translated column names as the values
 * @see get_column_headers(), print_column_headers(), get_hidden_columns()
 */
function register_column_headers($screen, $columns) {
	global $_wp_column_headers;

	if ( !isset($_wp_column_headers) )
		$_wp_column_headers = array();

	$_wp_column_headers[$screen] = $columns;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $page
 */
function get_hidden_columns($page) {
	$page = str_replace('.php', '', $page);
	return (array) get_user_option( 'manage-' . $page . '-columns-hidden', 0, false );
}

/**
 * {@internal Missing Short Description}}
 *
 * Outputs the quick edit and bulk edit table rows for posts and pages
 *
 * @since 2.7
 *
 * @param string $type 'post' or 'page'
 */
function inline_edit_row( $type ) {
	global $current_user, $mode;

	$is_page = 'page' == $type;
	if ( $is_page ) {
		$screen = 'edit-pages';
		$post = get_default_page_to_edit();
	} else {
		$screen = 'edit';
		$post = get_default_post_to_edit();
	}

	$columns = $is_page ? wp_manage_pages_columns() : wp_manage_posts_columns();
	$hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns($screen) ) );
	$col_count = count($columns) - count($hidden);
	$m = ( isset($mode) && 'excerpt' == $mode ) ? 'excerpt' : 'list';
	$can_publish = current_user_can("publish_{$type}s");
	$core_columns = array( 'cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true );

?>

<form method="get" action=""><table style="display: none"><tbody id="inlineedit">
	<?php
	$bulk = 0;
	while ( $bulk < 2 ) { ?>

	<tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="inline-edit-row inline-edit-row-<?php echo "$type ";
		echo $bulk ? "bulk-edit-row bulk-edit-row-$type" : "quick-edit-row quick-edit-row-$type";
	?>" style="display: none"><td colspan="<?php echo $col_count; ?>">

	<fieldset class="inline-edit-col-left"><div class="inline-edit-col">
		<h4><?php echo $bulk ? ( $is_page ? __( 'Bulk Edit Pages' ) : __( 'Bulk Edit Posts' ) ) : __( 'Quick Edit' ); ?></h4>


<?php if ( $bulk ) : ?>
		<div id="bulk-title-div">
			<div id="bulk-titles"></div>
		</div>

<?php else : // $bulk ?>

		<label>
			<span class="title"><?php _e( 'Title' ); ?></span>
			<span class="input-text-wrap"><input type="text" name="post_title" class="ptitle" value="" /></span>
		</label>

<?php endif; // $bulk ?>


<?php if ( !$bulk ) : ?>

		<label>
			<span class="title"><?php _e( 'Slug' ); ?></span>
			<span class="input-text-wrap"><input type="text" name="post_name" value="" /></span>
		</label>

		<label><span class="title"><?php _e( 'Date' ); ?></span></label>
		<div class="inline-edit-date">
			<?php touch_time(1, 1, 4, 1); ?>
		</div>
		<br class="clear" />

<?php endif; // $bulk

		ob_start();
		$authors = get_editable_user_ids( $current_user->id, true, $type ); // TODO: ROLE SYSTEM
		if ( $authors && count( $authors ) > 1 ) :
			$users_opt = array('include' => $authors, 'name' => 'post_author', 'class'=> 'authors', 'multi' => 1);
			if ( $bulk )
				$users_opt['show_option_none'] = __('- No Change -');
?>
		<label>
			<span class="title"><?php _e( 'Author' ); ?></span>
			<?php wp_dropdown_users( $users_opt ); ?>
		</label>

<?php
		endif; // authors
		$authors_dropdown = ob_get_clean();
?>

<?php if ( !$bulk ) : echo $authors_dropdown; ?>

		<div class="inline-edit-group">
			<label class="alignleft">
				<span class="title"><?php _e( 'Password' ); ?></span>
				<span class="input-text-wrap"><input type="text" name="post_password" class="inline-edit-password-input" value="" /></span>
			</label>

			<em style="margin:5px 10px 0 0" class="alignleft"><?php echo _c( '&ndash;OR&ndash;|Between password field and private checkbox on post quick edit interface' ); ?></em>

			<label class="alignleft inline-edit-private">
				<input type="checkbox" name="keep_private" value="private" />
				<span class="checkbox-title"><?php echo $is_page ? __('Private page') : __('Private post'); ?></span>
			</label>
		</div>

<?php endif; ?>

	</div></fieldset>

<?php if ( !$is_page && !$bulk ) : ?>

	<fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col">
		<span class="title inline-edit-categories-label"><?php _e( 'Categories' ); ?>
			<span class="catshow"><?php _e('[more]'); ?></span>
			<span class="cathide" style="display:none;"><?php _e('[less]'); ?></span>
		</span>
		<ul class="cat-checklist">
			<?php wp_category_checklist(); ?>
		</ul>
	</div></fieldset>

<?php endif; // !$is_page && !$bulk ?>

	<fieldset class="inline-edit-col-right"><div class="inline-edit-col">

<?php
	if ( $bulk )
		echo $authors_dropdown;
?>

<?php if ( $is_page ) : ?>

		<label>
			<span class="title"><?php _e( 'Parent' ); ?></span>
<?php
	$dropdown_args = array('selected' => $post->post_parent, 'name' => 'post_parent', 'show_option_none' => __('Main Page (no parent)'), 'option_none_value' => 0, 'sort_column'=> 'menu_order, post_title');
	if ( $bulk )
		$dropdown_args['show_option_no_change'] =  __('- No Change -');
	$dropdown_args = apply_filters('quick_edit_dropdown_pages_args', $dropdown_args);
	wp_dropdown_pages($dropdown_args);
?>
		</label>

<?php	if ( !$bulk ) : ?>

		<label>
			<span class="title"><?php _e( 'Order' ); ?></span>
			<span class="input-text-wrap"><input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order ?>" /></span>
		</label>

<?php	endif; // !$bulk ?>

		<label>
			<span class="title"><?php _e( 'Template' ); ?></span>
			<select name="page_template">
<?php	if ( $bulk ) : ?>
				<option value="-1"><?php _e('- No Change -'); ?></option>
<?php	endif; // $bulk ?>
				<option value="default"><?php _e( 'Default Template' ); ?></option>
				<?php page_template_dropdown() ?>
			</select>
		</label>

<?php elseif ( !$bulk ) : // $is_page ?>

		<label class="inline-edit-tags">
			<span class="title"><?php _e( 'Tags' ); ?></span>
			<textarea cols="22" rows="1" name="tags_input" class="tags_input"></textarea>
		</label>

<?php endif; // $is_page  ?>

<?php if ( $bulk ) : ?>

		<div class="inline-edit-group">
		<label class="alignleft">
			<span class="title"><?php _e( 'Comments' ); ?></span>
			<select name="comment_status">
				<option value=""><?php _e('- No Change -'); ?></option>
				<option value="open"><?php _e('Allow'); ?></option>
				<option value="closed"><?php _e('Do not allow'); ?></option>
			</select>
		</label>

		<label class="alignright">
			<span class="title"><?php _e( 'Pings' ); ?></span>
			<select name="ping_status">
				<option value=""><?php _e('- No Change -'); ?></option>
				<option value="open"><?php _e('Allow'); ?></option>
				<option value="closed"><?php _e('Do not allow'); ?></option>
			</select>
		</label>
		</div>

<?php else : // $bulk ?>

		<div class="inline-edit-group">
			<label class="alignleft">
				<input type="checkbox" name="comment_status" value="open" />
				<span class="checkbox-title"><?php _e( 'Allow Comments' ); ?></span>
			</label>

			<label class="alignleft">
				<input type="checkbox" name="ping_status" value="open" />
				<span class="checkbox-title"><?php _e( 'Allow Pings' ); ?></span>
			</label>
		</div>

<?php endif; // $bulk ?>


		<div class="inline-edit-group">
			<label class="inline-edit-status alignleft">
				<span class="title"><?php _e( 'Status' ); ?></span>
				<select name="_status">
<?php if ( $bulk ) : ?>
					<option value="-1"><?php _e('- No Change -'); ?></option>
<?php endif; // $bulk ?>
				<?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review" ?>
					<option value="publish"><?php _e( 'Published' ); ?></option>
					<option value="future"><?php _e( 'Scheduled' ); ?></option>
<?php if ( $bulk ) : ?>
					<option value="private"><?php _e('Private') ?></option>
<?php endif; // $bulk ?>
				<?php endif; ?>
					<option value="pending"><?php _e( 'Pending Review' ); ?></option>
					<option value="draft"><?php _e( 'Unpublished' ); ?></option>
				</select>
			</label>

<?php if ( !$is_page && $can_publish && current_user_can( 'edit_others_posts' ) ) : ?>

<?php	if ( $bulk ) : ?>

			<label class="alignright">
				<span class="title"><?php _e( 'Sticky' ); ?></span>
				<select name="sticky">
					<option value="-1"><?php _e( '- No Change -' ); ?></option>
					<option value="sticky"><?php _e( 'Sticky' ); ?></option>
					<option value="unsticky"><?php _e( 'Not Sticky' ); ?></option>
				</select>
			</label>

<?php	else : // $bulk ?>

			<label class="alignleft">
				<input type="checkbox" name="sticky" value="sticky" />
				<span class="checkbox-title"><?php _e( 'Make this post sticky' ); ?></span>
			</label>

<?php	endif; // $bulk ?>

<?php endif; // !$is_page && $can_publish && current_user_can( 'edit_others_posts' ) ?>

		</div>

	</div></fieldset>

<?php
	foreach ( $columns as $column_name => $column_display_name ) {
		if ( isset( $core_columns[$column_name] ) )
			continue;
		do_action( $bulk ? 'bulk_edit_custom_box' : 'quick_edit_custom_box', $column_name, $type);
	}
?>
	<p class="submit inline-edit-save">
		<a accesskey="c" href="#inline-edit" title="<?php _e('Cancel'); ?>" class="button-secondary cancel alignleft"><?php _e('Cancel'); ?></a>
		<?php if ( ! $bulk ) {
			wp_nonce_field( 'inlineeditnonce', '_inline_edit', false );
			$update_text = ( $is_page ) ? __( 'Update Page' ) : __( 'Update Post' );
			?>
			<a accesskey="s" href="#inline-edit" title="<?php _e('Update'); ?>" class="button-primary save alignright"><?php echo attribute_escape( $update_text ); ?></a>
			<img class="waiting" style="display:none;" src="images/loading.gif" alt="" />
		<?php } else {
			$update_text = ( $is_page ) ? __( 'Update Pages' ) : __( 'Update Posts' );
		?>
			<input accesskey="s" class="button-primary alignright" type="submit" name="bulk_edit" value="<?php echo attribute_escape( $update_text ); ?>" />
		<?php } ?>
		<input type="hidden" name="post_view" value="<?php echo $m; ?>" />
		<br class="clear" />
	</p>
	</td></tr>
<?php
	$bulk++;
	} ?>
	</tbody></table></form>
<?php
}

// adds hidden fields with the data for use in the inline editor for posts and pages
/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $post
 */
function get_inline_data($post) {

	if ( ! current_user_can('edit_' . $post->post_type, $post->ID) )
		return;

	$title = attribute_escape($post->post_title);

	echo '
<div class="hidden" id="inline_' . $post->ID . '">
	<div class="post_title">' . $title . '</div>
	<div class="post_name">' . $post->post_name . '</div>
	<div class="post_author">' . $post->post_author . '</div>
	<div class="comment_status">' . $post->comment_status . '</div>
	<div class="ping_status">' . $post->ping_status . '</div>
	<div class="_status">' . $post->post_status . '</div>
	<div class="jj">' . mysql2date( 'd', $post->post_date ) . '</div>
	<div class="mm">' . mysql2date( 'm', $post->post_date ) . '</div>
	<div class="aa">' . mysql2date( 'Y', $post->post_date ) . '</div>
	<div class="hh">' . mysql2date( 'H', $post->post_date ) . '</div>
	<div class="mn">' . mysql2date( 'i', $post->post_date ) . '</div>
	<div class="ss">' . mysql2date( 's', $post->post_date ) . '</div>
	<div class="post_password">' . wp_specialchars($post->post_password, 1) . '</div>';

	if( $post->post_type == 'page' )
		echo '
	<div class="post_parent">' . $post->post_parent . '</div>
	<div class="page_template">' . wp_specialchars(get_post_meta( $post->ID, '_wp_page_template', true ), 1) . '</div>
	<div class="menu_order">' . $post->menu_order . '</div>';

	if( $post->post_type == 'post' )
		echo '
	<div class="tags_input">' . wp_specialchars( str_replace( ',', ', ', get_tags_to_edit($post->ID) ), 1) . '</div>
	<div class="post_category">' . implode( ',', wp_get_post_categories( $post->ID ) ) . '</div>
	<div class="sticky">' . (is_sticky($post->ID) ? 'sticky' : '') . '</div>';

	echo '</div>';
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $posts
 */
function post_rows( $posts = array() ) {
	global $wp_query, $post, $mode;

	add_filter('the_title','wp_specialchars');

	// Create array of post IDs.
	$post_ids = array();

	if ( empty($posts) )
		$posts = &$wp_query->posts;

	foreach ( $posts as $a_post )
		$post_ids[] = $a_post->ID;

	$comment_pending_count = get_pending_comments_num($post_ids);
	if ( empty($comment_pending_count) )
		$comment_pending_count = array();

	foreach ( $posts as $post ) {
		if ( empty($comment_pending_count[$post->ID]) )
			$comment_pending_count[$post->ID] = 0;

		_post_row($post, $comment_pending_count[$post->ID], $mode);
	}
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $a_post
 * @param unknown_type $pending_comments
 * @param unknown_type $mode
 */
function _post_row($a_post, $pending_comments, $mode) {
	global $post;
	static $rowclass;

	$global_post = $post;
	$post = $a_post;
	setup_postdata($post);

	$rowclass = 'alternate' == $rowclass ? '' : 'alternate';
	global $current_user;
	$post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
	$edit_link = get_edit_post_link( $post->ID );
	$title = _draft_or_post_title();
?>
	<tr id='post-<?php echo $post->ID; ?>' class='<?php echo trim( $rowclass . ' author-' . $post_owner . ' status-' . $post->post_status ); ?> iedit' valign="top">
<?php
	$posts_columns = get_column_headers('edit');
	$hidden = get_hidden_columns('edit');
	foreach ( $posts_columns as $column_name=>$column_display_name ) {
		$class = "class=\"$column_name column-$column_name\"";

		$style = '';
		if ( in_array($column_name, $hidden) )
			$style = ' style="display:none;"';

		$attributes = "$class$style";

		switch ($column_name) {

		case 'cb':
		?>
		<th scope="row" class="check-column"><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /><?php } ?></th>
		<?php
		break;

		case 'date':
			if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) {
				$t_time = $h_time = __('Unpublished');
			} else {
				$t_time = get_the_time(__('Y/m/d g:i:s A'));
				$m_time = $post->post_date;
				$time = get_post_time('G', true, $post);

				$time_diff = time() - $time;

				if ( ( 'future' == $post->post_status) ) {
					if ( $time_diff <= 0 ) {
						$h_time = sprintf( __('%s from now'), human_time_diff( $time ) );
					} else {
						$h_time = $t_time;
						$missed = true;
					}
				} else {

					if ( $time_diff > 0 && $time_diff < 24*60*60 )
						$h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
					else
						$h_time = mysql2date(__('Y/m/d'), $m_time);
				}
			}

			echo '<td ' . $attributes . '>';
			if ( 'excerpt' == $mode )
				echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode);
			else
				echo '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) . '</abbr>';
			echo '<br />';
			if ( 'publish' == $post->post_status ) {
				_e('Published');
			} elseif ( 'future' == $post->post_status ) {
				if ( isset($missed) )
					echo '<strong class="attention">' . __('Missed schedule') . '</strong>';
				else
					_e('Scheduled');
			} else {
				_e('Last Modified');
			}
			echo '</td>';
		break;

		case 'title':
			$attributes = 'class="post-title column-title"' . $style;
		?>
		<td <?php echo $attributes ?>><strong><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; }; _post_states($post); ?></strong>
		<?php
			if ( 'excerpt' == $mode )
				the_excerpt();

			$actions = array();
			if ( current_user_can('edit_post', $post->ID) ) {
				$actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . attribute_escape(__('Edit this post')) . '">' . __('Edit') . '</a>';
				$actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . attribute_escape(__('Edit this post inline')) . '">' . __('Quick&nbsp;Edit') . '</a>';
				$actions['delete'] = "<a class='submitdelete' title='" . attribute_escape(__('Delete this post')) . "' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
			}
			if ( in_array($post->post_status, array('pending', 'draft')) ) {
				if ( current_user_can('edit_post', $post->ID) )
					$actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . attribute_escape(sprintf(__('Preview "%s"'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
			} else {
				$actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . attribute_escape(sprintf(__('View "%s"'), $title)) . '" rel="permalink">' . __('View') . '</a>';
			}
			$action_count = count($actions);
			$i = 0;
			echo '<div class="row-actions">';
			foreach ( $actions as $action => $link ) {
				++$i;
				( $i == $action_count ) ? $sep = '' : $sep = ' | ';
				echo "<span class='$action'>$link$sep</span>";
			}
			echo '</div>';

			get_inline_data($post);
		?>
		</td>
		<?php
		break;

		case 'categories':
		?>
		<td <?php echo $attributes ?>><?php
			$categories = get_the_category();
			if ( !empty( $categories ) ) {
				$out = array();
				foreach ( $categories as $c )
					$out[] = "<a href='edit.php?category_name=$c->slug'> " . wp_specialchars(sanitize_term_field('name', $c->name, $c->term_id, 'category', 'display')) . "</a>";
					echo join( ', ', $out );
			} else {
				_e('Uncategorized');
			}
		?></td>
		<?php
		break;

		case 'tags':
		?>
		<td <?php echo $attributes ?>><?php
			$tags = get_the_tags($post->ID);
			if ( !empty( $tags ) ) {
				$out = array();
				foreach ( $tags as $c )
					$out[] = "<a href='edit.php?tag=$c->slug'> " . wp_specialchars(sanitize_term_field('name', $c->name, $c->term_id, 'post_tag', 'display')) . "</a>";
				echo join( ', ', $out );
			} else {
				_e('No Tags');
			}
		?></td>
		<?php
		break;

		case 'comments':
		?>
		<td <?php echo $attributes ?>><div class="post-com-count-wrapper">
		<?php
			$pending_phrase = sprintf( __('%s pending'), number_format( $pending_comments ) );
			if ( $pending_comments )
				echo '<strong>';
				comments_number("<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('0') . '</span></a>', "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('1') . '</span></a>', "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('%') . '</span></a>');
				if ( $pending_comments )
				echo '</strong>';
		?>
		</div></td>
		<?php
		break;

		case 'author':
		?>
		<td <?php echo $attributes ?>><a href="edit.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td>
		<?php
		break;

		case 'control_view':
		?>
		<td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e('View'); ?></a></td>
		<?php
		break;

		case 'control_edit':
		?>
		<td><?php if ( current_user_can('edit_post', $post->ID) ) { echo "<a href='$edit_link' class='edit'>" . __('Edit') . "</a>"; } ?></td>
		<?php
		break;

		case 'control_delete':
		?>
		<td><?php if ( current_user_can('delete_post', $post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&amp;post=$id", 'delete-post_' . $post->ID) . "' class='delete'>" . __('Delete') . "</a>"; } ?></td>
		<?php
		break;

		default:
		?>
		<td <?php echo $attributes ?>><?php do_action('manage_posts_custom_column', $column_name, $post->ID); ?></td>
		<?php
		break;
	}
}
?>
	</tr>
<?php
	$post = $global_post;
}

/*
 * display one row if the page doesn't have any children
 * otherwise, display the row and its children in subsequent rows
 */
/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $page
 * @param unknown_type $level
 */
function display_page_row( $page, $level = 0 ) {
	global $post;
	static $rowclass;

	$post = $page;
	setup_postdata($page);

	$page->post_title = wp_specialchars( $page->post_title );
	$pad = str_repeat( '&#8212; ', $level );
	$id = (int) $page->ID;
	$rowclass = 'alternate' == $rowclass ? '' : 'alternate';
	$posts_columns = get_column_headers('edit-pages');
	$hidden = get_hidden_columns('edit-pages');
	$title = _draft_or_post_title();
?>
<tr id="page-<?php echo $id; ?>" class="<?php echo $rowclass; ?> iedit">
<?php

foreach ($posts_columns as $column_name=>$column_display_name) {
	$class = "class=\"$column_name column-$column_name\"";

	$style = '';
	if ( in_array($column_name, $hidden) )
		$style = ' style="display:none;"';

	$attributes = "$class$style";

	switch ($column_name) {

	case 'cb':
		?>
		<th scope="row" class="check-column"><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /></th>
		<?php
		break;
	case 'date':
		if ( '0000-00-00 00:00:00' == $page->post_date && 'date' == $column_name ) {
			$t_time = $h_time = __('Unpublished');
		} else {
			$t_time = get_the_time(__('Y/m/d g:i:s A'));
			$m_time = $page->post_date;
			$time = get_post_time('G', true);

			if ( ( abs(time() - $time) ) < 86400 ) {
				if ( ( 'future' == $page->post_status) )
					$h_time = sprintf( __('%s from now'), human_time_diff( $time ) );
				else
					$h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
			} else {
				$h_time = mysql2date(__('Y/m/d'), $m_time);
			}
		}
		echo '<td ' . $attributes . '>';
		echo '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $page, $column_name, '') . '</abbr>';
		echo '<br />';
		if ( 'publish' == $page->post_status || 'future' == $page->post_status )
			_e('Published');
		else
			_e('Last Modified');
		echo '</td>';
		break;
	case 'title':
		$attributes = 'class="post-title page-title column-title"' . $style;
		$edit_link = get_edit_post_link( $page->ID );
		?>
		<td <?php echo $attributes ?>><strong><?php if ( current_user_can( 'edit_post', $page->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $title)); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states($page); ?></strong>
		<?php
		$actions = array();
		if ( current_user_can('edit_page', $page->ID) ) {
			$actions['edit'] = '<a href="' . $edit_link . '" title="' . attribute_escape(__('Edit this page')) . '">' . __('Edit') . '</a>';
			$actions['inline'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
			$actions['delete'] = "<a class='submitdelete' title='" . attribute_escape(__('Delete this page')) . "' href='" . wp_nonce_url("page.php?action=delete&amp;post=$page->ID", 'delete-page_' . $page->ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $page->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this page '%s'\n 'Cancel' to stop, 'OK' to delete."), $page->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
		}
		if ( in_array($post->post_status, array('pending', 'draft')) ) {
			if ( current_user_can('edit_page', $page->ID) )
				$actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . attribute_escape(sprintf(__('Preview "%s"'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
		} else {
			$actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . attribute_escape(sprintf(__('View "%s"'), $title)) . '" rel="permalink">' . __('View') . '</a>';
		}
		$action_count = count($actions);

		$i = 0;
		echo '<div class="row-actions">';
		foreach ( $actions as $action => $link ) {
			++$i;
			( $i == $action_count ) ? $sep = '' : $sep = ' | ';
			echo "<span class='$action'>$link$sep</span>";
		}
		echo '</div>';

		get_inline_data($post);
		echo '</td>';
		break;

	case 'comments':
		?>
		<td <?php echo $attributes ?>><div class="post-com-count-wrapper">
		<?php
		$left = get_pending_comments_num( $page->ID );
		$pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
		if ( $left )
			echo '<strong>';
		comments_number("<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('0') . '</span></a>', "<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('1') . '</span></a>', "<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('%') . '</span></a>');
		if ( $left )
			echo '</strong>';
		?>
		</div></td>
		<?php
		break;

	case 'author':
		?>
		<td <?php echo $attributes ?>><a href="edit-pages.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td>
		<?php
		break;

	default:
		?>
		<td <?php echo $attributes ?>><?php do_action('manage_pages_custom_column', $column_name, $id); ?></td>
		<?php
		break;
	}
}
?>

</tr>

<?php
}

/*
 * displays pages in hierarchical order with paging support
 */
/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $pages
 * @param unknown_type $pagenum
 * @param unknown_type $per_page
 * @return unknown
 */
function page_rows($pages, $pagenum = 1, $per_page = 20) {
	global $wpdb;

	$level = 0;

	if ( ! $pages ) {
		$pages = get_pages( array('sort_column' => 'menu_order') );

		if ( ! $pages )
			return false;
	}

	/*
	 * arrange pages into two parts: top level pages and children_pages
	 * children_pages is two dimensional array, eg.
	 * children_pages[10][] contains all sub-pages whose parent is 10.
	 * It only takes O(N) to arrange this and it takes O(1) for subsequent lookup operations
	 * If searching, ignore hierarchy and treat everything as top level
	 */
	if ( empty($_GET['s']) ) {

		$top_level_pages = array();
		$children_pages = array();

		foreach ( $pages as $page ) {

			// catch and repair bad pages
			if ( $page->post_parent == $page->ID ) {
				$page->post_parent = 0;
				$wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = '0' WHERE ID = %d", $page->ID) );
				clean_page_cache( $page->ID );
			}

			if ( 0 == $page->post_parent )
				$top_level_pages[] = $page;
			else
				$children_pages[ $page->post_parent ][] = $page;
		}

		$pages = &$top_level_pages;
	}

	$count = 0;
	$start = ($pagenum - 1) * $per_page;
	$end = $start + $per_page;

	foreach ( $pages as $page ) {
		if ( $count >= $end )
			break;

		if ( $count >= $start )
			echo "\t" . display_page_row( $page, $level );

		$count++;

		if ( isset($children_pages) )
			_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
	}

	// if it is the last pagenum and there are orphaned pages, display them with paging as well
	if ( isset($children_pages) && $count < $end ){
		foreach( $children_pages as $orphans ){
			foreach ( $orphans as $op ) {
				if ( $count >= $end )
					break;
				if ( $count >= $start )
					echo "\t" . display_page_row( $op, 0 );
				$count++;
			}
		}
	}
}

/*
 * Given a top level page ID, display the nested hierarchy of sub-pages
 * together with paging support
 */
/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $children_pages
 * @param unknown_type $count
 * @param unknown_type $parent
 * @param unknown_type $level
 * @param unknown_type $pagenum
 * @param unknown_type $per_page
 */
function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) {

	if ( ! isset( $children_pages[$parent] ) )
		return;

	$start = ($pagenum - 1) * $per_page;
	$end = $start + $per_page;

	foreach ( $children_pages[$parent] as $page ) {

		if ( $count >= $end )
			break;

		// If the page starts in a subtree, print the parents.
		if ( $count == $start && $page->post_parent > 0 ) {
			$my_parents = array();
			$my_parent = $page->post_parent;
			while ( $my_parent) {
				$my_parent = get_post($my_parent);
				$my_parents[] = $my_parent;
				if ( !$my_parent->post_parent )
					break;
				$my_parent = $my_parent->post_parent;
			}
			$num_parents = count($my_parents);
			while( $my_parent = array_pop($my_parents) ) {
				echo "\t" . display_page_row( $my_parent, $level - $num_parents );
				$num_parents--;
			}
		}

		if ( $count >= $start )
			echo "\t" . display_page_row( $page, $level );

		$count++;

		_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
	}

	unset( $children_pages[$parent] ); //required in order to keep track of orphans
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $user_object
 * @param unknown_type $style
 * @param unknown_type $role
 * @return unknown
 */
function user_row( $user_object, $style = '', $role = '' ) {
	global $wp_roles;

	$current_user = wp_get_current_user();

	if ( !( is_object( $user_object) && is_a( $user_object, 'WP_User' ) ) )
		$user_object = new WP_User( (int) $user_object );
	$email = $user_object->user_email;
	$url = $user_object->user_url;
	$short_url = str_replace( 'http://', '', $url );
	$short_url = str_replace( 'www.', '', $short_url );
	if ('/' == substr( $short_url, -1 ))
		$short_url = substr( $short_url, 0, -1 );
	if ( strlen( $short_url ) > 35 )
		$short_url = substr( $short_url, 0, 32 ).'...';
	$numposts = get_usernumposts( $user_object->ID );
	if ( current_user_can( 'edit_user', $user_object->ID ) ) {
		if ($current_user->ID == $user_object->ID) {
			$edit_link = 'profile.php';
		} else {
			$edit_link = clean_url( add_query_arg( 'wp_http_referer', urlencode( clean_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), "user-edit.php?user_id=$user_object->ID" ) );
		}
		$edit = "<strong><a href=\"$edit_link\">$user_object->user_login</a></strong><br />";
		$actions = array();
		$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
		if ( $current_user->ID != $user_object->ID )
			$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("users.php?action=delete&amp;user=$user_object->ID", 'bulk-users') . "'>" . __('Delete') . "</a>";
		$action_count = count($actions);
		$i = 0;
		$edit .= '<div class="row-actions">';
		foreach ( $actions as $action => $link ) {
			++$i;
			( $i == $action_count ) ? $sep = '' : $sep = ' | ';
			$edit .= "<span class='$action'>$link$sep</span>";
		}
		$edit .= '</div>';
	} else {
		$edit = '<strong>' . $user_object->user_login . '</strong>';
	}
	$role_name = isset($wp_roles->role_names[$role]) ? translate_with_context($wp_roles->role_names[$role]) : __('None');
	$r = "<tr id='user-$user_object->ID'$style>";
	$columns = get_column_headers('users');
	$hidden = get_hidden_columns('users');
	$avatar = get_avatar( $user_object->user_email, 32 );
	foreach ( $columns as $column_name => $column_display_name ) {
		$class = "class=\"$column_name column-$column_name\"";

		$style = '';
		if ( in_array($column_name, $hidden) )
			$style = ' style="display:none;"';

		$attributes = "$class$style";

		switch ($column_name) {
			case 'cb':
				$r .= "<th scope='row' class='check-column'><input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='$role' value='{$user_object->ID}' /></th>";
				break;
			case 'username':
				$r .= "<td $attributes>$avatar $edit</td>";
				break;
			case 'name':
				$r .= "<td $attributes>$user_object->first_name $user_object->last_name</td>";
				break;
			case 'email':
				$r .= "<td $attributes><a href='mailto:$email' title='" . sprintf( __('e-mail: %s' ), $email ) . "'>$email</a></td>";
				break;
			case 'role':
				$r .= "<td $attributes>$role_name</td>";
				break;
			case 'posts':
				$attributes = 'class="posts column-posts num"' . $style;
				$r .= "<td $attributes>";
				if ( $numposts > 0 ) {
					$r .= "<a href='edit.php?author=$user_object->ID' title='" . __( 'View posts by this author' ) . "' class='edit'>";
					$r .= $numposts;
					$r .= '</a>';
				} else {
					$r .= 0;
				}
				$r .= "</td>";
		}
	}
	$r .= '</tr>';

	return $r;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $status
 * @param unknown_type $s
 * @param unknown_type $start
 * @param unknown_type $num
 * @param unknown_type $post
 * @param unknown_type $type
 * @return unknown
 */
function _wp_get_comment_list( $status = '', $s = false, $start, $num, $post = 0, $type = '' ) {
	global $wpdb;

	$start = abs( (int) $start );
	$num = (int) $num;
	$post = (int) $post;

	if ( 'moderated' == $status )
		$approved = "comment_approved = '0'";
	elseif ( 'approved' == $status )
		$approved = "comment_approved = '1'";
	elseif ( 'spam' == $status )
		$approved = "comment_approved = 'spam'";
	else
		$approved = "( comment_approved = '0' OR comment_approved = '1' )";

	if ( $post ) {
		$post = " AND comment_post_ID = '$post'";
		$orderby = "ORDER BY comment_date_gmt ASC LIMIT $start, $num";
	} else {
		$post = '';
		$orderby = "ORDER BY comment_date_gmt DESC LIMIT $start, $num";
	}

	if ( 'comment' == $type )
		$typesql = "AND comment_type = ''";
	elseif ( 'pingback' == $type )
		$typesql = "AND comment_type = 'pingback'";
	elseif ( 'trackback' == $type )
		$typesql = "AND comment_type = 'trackback'";
	elseif ( 'pings' == $type )
		$typesql = "AND ( comment_type = 'pingback' OR comment_type = 'trackback' )";
	else
		$typesql = '';

	if ( $s ) {
		$s = $wpdb->escape($s);
		$comments = $wpdb->get_results("SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE
			(comment_author LIKE '%$s%' OR
			comment_author_email LIKE '%$s%' OR
			comment_author_url LIKE ('%$s%') OR
			comment_author_IP LIKE ('%$s%') OR
			comment_content LIKE ('%$s%') ) AND
			$approved
			$typesql
			$orderby");
	} else {
		$comments = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE $approved $post $typesql $orderby" );
	}

	update_comment_cache($comments);

	$total = $wpdb->get_var( "SELECT FOUND_ROWS()" );

	return array($comments, $total);
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $comment_id
 * @param unknown_type $mode
 * @param unknown_type $comment_status
 * @param unknown_type $checkbox
 */
function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true, $from_ajax = false ) {
	global $comment, $post, $_comment_pending_count;
	$comment = get_comment( $comment_id );
	$post = get_post($comment->comment_post_ID);
	$the_comment_status = wp_get_comment_status($comment->comment_ID);

	$author_url = get_comment_author_url();
	if ( 'http://' == $author_url )
		$author_url = '';
	$author_url_display = $author_url;
	$author_url_display = str_replace('http://www.', '', $author_url_display);
	$author_url_display = str_replace('http://', '', $author_url_display);
	if ( strlen($author_url_display) > 50 )
		$author_url_display = substr($author_url_display, 0, 49) . '...';

	$ptime = date('G', strtotime( $comment->comment_date ) );
	if ( ( abs(time() - $ptime) ) < 86400 )
		$ptime = sprintf( __('%s ago'), human_time_diff( $ptime ) );
	else
		$ptime = mysql2date(__('Y/m/d \a\t g:i A'), $comment->comment_date );

	$delete_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&p=$post->ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
	$approve_url = clean_url( wp_nonce_url( "comment.php?action=approvecomment&p=$post->ID&c=$comment->comment_ID", "approve-comment_$comment->comment_ID" ) );
	$unapprove_url = clean_url( wp_nonce_url( "comment.php?action=unapprovecomment&p=$post->ID&c=$comment->comment_ID", "unapprove-comment_$comment->comment_ID" ) );
	$spam_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$post->ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );

	echo "<tr id='comment-$comment->comment_ID' class='$the_comment_status'>";
	$columns = get_column_headers('edit-comments');
	$hidden = get_hidden_columns('edit-comments');
	foreach ( $columns as $column_name => $column_display_name ) {
		$class = "class=\"$column_name column-$column_name\"";

		$style = '';
		if ( in_array($column_name, $hidden) )
			$style = ' style="display:none;"';

		$attributes = "$class$style";

		switch ($column_name) {
			case 'cb':
				if ( !$checkbox ) break;
				echo '<th scope="row" class="check-column">';
				if ( current_user_can('edit_post', $post->ID) ) echo "<input type='checkbox' name='delete_comments[]' value='$comment->comment_ID' />";
				echo '</th>';
				break;
			case 'comment':
				echo "<td $attributes>";
				echo '<div id="submitted-on">';
				printf(__('Submitted on <a href="%1$s">%2$s at %3$s</a>'), get_comment_link($comment->comment_ID), get_comment_date(__('Y/m/d')), get_comment_date(__('g:ia')));
				echo '</div>';
				comment_text(); ?>
				<div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
				<textarea class="comment" rows="3" cols="10"><?php echo $comment->comment_content; ?></textarea>
				<div class="author-email"><?php echo attribute_escape( $comment->comment_author_email ); ?></div>
				<div class="author"><?php echo attribute_escape( $comment->comment_author ); ?></div>
				<div class="author-url"><?php echo attribute_escape( $comment->comment_author_url ); ?></div>
				<div class="comment_status"><?php echo $comment->comment_approved; ?></div>
				</div>
				<?php
				$actions = array();

				if ( current_user_can('edit_post', $post->ID) ) {
					$actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
					$actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
					if ( $comment_status ) { // not looking at all comments
						if ( 'approved' == $the_comment_status ) {
							$actions['unapprove'] = "<a href='$unapprove_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=unapproved vim-u vim-destructive' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
							unset($actions['approve']);
						} else {
							$actions['approve'] = "<a href='$approve_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=approved vim-a vim-destructive' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
							unset($actions['unapprove']);
						}
					}
					if ( 'spam' != $the_comment_status )
						$actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . __( 'Mark this comment as spam' ) . "'>" . _c( 'Spam|verb' ) . '</a>';
					$actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Delete') . '</a>';
					$actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a>';
					$actions['quickedit'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\',\'edit\');return false;" class="vim-q" title="'.__('Quick Edit').'" href="#">' . __('Quick&nbsp;Edit') . '</a>';
					if ( 'spam' != $the_comment_status )
						$actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\');return false;" class="vim-r" title="'.__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';

					$actions = apply_filters( 'comment_row_actions', $actions, $comment );

					$i = 0;
					echo '<div class="row-actions">';
					foreach ( $actions as $action => $link ) {
						++$i;
						( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';

						// Reply and quickedit need a hide-if-no-js span when not added with ajax
						if ( ('reply' == $action || 'quickedit' == $action) && ! $from_ajax )
							$action .= ' hide-if-no-js';

						echo "<span class='$action'>$sep$link</span>";
					}
					echo '</div>';
				}

				echo '</td>';
				break;
			case 'author':
				echo "<td $attributes><strong>"; comment_author(); echo '</strong><br />';
				if ( !empty($author_url) )
					echo "<a title='$author_url' href='$author_url'>$author_url_display</a><br />";
				if ( current_user_can( 'edit_post', $post->ID ) ) {
					if ( !empty($comment->comment_author_email) ) {
						comment_author_email_link();
						echo '<br />';
					}
					echo '<a href="edit-comments.php?s=';
					comment_author_IP();
					echo '&amp;mode=detail';
					if ( 'spam' == $comment_status )
						echo '&amp;comment_status=spam';
					echo '">';
					comment_author_IP();
					echo '</a>';
				} //current_user_can
				echo '</td>';
				break;
			case 'date':
				echo "<td $attributes>" . get_comment_date(__('Y/m/d \a\t g:ia')) . '</td>';
				break;
			case 'response':
				if ( 'single' !== $mode ) {
					if ( isset( $_comment_pending_count[$post->ID] ) ) {
						$pending_comments = absint( $_comment_pending_count[$post->ID] );
					} else {
						$_comment_pending_count_temp = (array) get_pending_comments_num( array( $post->ID ) );
						$pending_comments = $_comment_pending_count[$post->ID] = $_comment_pending_count_temp[$post->ID];
					}
					if ( current_user_can( 'edit_post', $post->ID ) ) {
						$post_link = "<a href='" . get_edit_post_link($post->ID) . "'>";
						$post_link .= get_the_title($post->ID) . '</a>';
					} else {
						$post_link = get_the_title($post->ID);
					}
					echo "<td $attributes>\n";
					echo $post_link;

					echo '<div class="response-links"><span class="post-com-count-wrapper">';
					$pending_phrase = sprintf( __('%s pending'), number_format( $pending_comments ) );
					if ( $pending_comments )
						echo '<strong>';
					comments_number("<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('0') . '</span></a>', "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('1') . '</span></a>', "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('%') . '</span></a>');
					if ( $pending_comments )
						echo '</strong>';
					echo '</span> ';
					echo "<a href='" . get_permalink( $post->ID ) . "'>#</a>";
					echo '</div></td>';
				}
		}
	}
	echo "</tr>\n";
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $position
 * @param unknown_type $checkbox
 * @param unknown_type $mode
 */
function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single', $table_row = true) {
	global $current_user;

	// allow plugin to replace the popup content
	$content = apply_filters( 'wp_comment_reply', '', array('position' => $position, 'checkbox' => $checkbox, 'mode' => $mode) );

	if ( ! empty($content) ) {
		echo $content;
		return;
	}

	$columns = get_column_headers('edit-comments');
	$hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns('edit-comments') ) );
	$col_count = count($columns) - count($hidden);

?>
<form method="get" action="">
<?php if ( $table_row ) : ?>
<table style="display:none;"><tbody id="com-reply"><tr id="replyrow"><td colspan="<?php echo $col_count; ?>">
<?php else : ?>
<div id="com-reply" style="display:none;"><div id="replyrow">
<?php endif; ?>
	<div id="replyhead" style="display:none;"><?php _e('Reply to Comment'); ?></div>

	<div id="edithead" style="display:none;">
		<div class="inside">
		<label for="author"><?php _e('Name') ?></label>
		<input type="text" name="newcomment_author" size="50" value="" tabindex="101" id="author" />
		</div>

		<div class="inside">
		<label for="author-email"><?php _e('E-mail') ?></label>
		<input type="text" name="newcomment_author_email" size="50" value="" tabindex="102" id="author-email" />
		</div>

		<div class="inside">
		<label for="author-url"><?php _e('URL') ?></label>
		<input type="text" id="author-url" name="newcomment_author_url" size="103" value="" tabindex="103" />
		</div>
		<div style="clear:both;"></div>
	</div>

	<div id="replycontainer"><textarea rows="8" cols="40" name="replycontent" tabindex="104" id="replycontent"></textarea></div>

	<p id="replysubmit" class="submit">
	<a href="#comments-form" class="cancel button-secondary alignleft" tabindex="106"><?php _e('Cancel'); ?></a>
	<a href="#comments-form" class="save button-primary alignright" tabindex="104">
	<span id="savebtn" style="display:none;"><?php _e('Update Comment'); ?></span>
	<span id="replybtn" style="display:none;"><?php _e('Submit Reply'); ?></span></a>
	<img class="waiting" style="display:none;" src="images/loading.gif" alt="" />
	<span class="error" style="display:none;"></span>
	<br class="clear" />
	</p>

	<input type="hidden" name="user_ID" id="user_ID" value="<?php echo $current_user->ID; ?>" />
	<input type="hidden" name="action" id="action" value="" />
	<input type="hidden" name="comment_ID" id="comment_ID" value="" />
	<input type="hidden" name="comment_post_ID" id="comment_post_ID" value="" />
	<input type="hidden" name="status" id="status" value="" />
	<input type="hidden" name="position" id="position" value="<?php echo $position; ?>" />
	<input type="hidden" name="checkbox" id="checkbox" value="<?php echo $checkbox ? 1 : 0; ?>" />
	<input type="hidden" name="mode" id="mode" value="<?php echo $mode; ?>" />
	<?php wp_nonce_field( 'replyto-comment', '_ajax_nonce', false ); ?>
	<?php wp_comment_form_unfiltered_html_nonce(); ?>
<?php if ( $table_row ) : ?>
</td></tr></tbody></table>
<?php else : ?>
</div></div>
<?php endif; ?>
</form>
<?php
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $currentcat
 * @param unknown_type $currentparent
 * @param unknown_type $parent
 * @param unknown_type $level
 * @param unknown_type $categories
 * @return unknown
 */
function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) {
	if (!$categories )
		$categories = get_categories( array('hide_empty' => 0) );

	if ( $categories ) {
		foreach ( $categories as $category ) {
			if ( $currentcat != $category->term_id && $parent == $category->parent) {
				$pad = str_repeat( '&#8211; ', $level );
				$category->name = wp_specialchars( $category->name );
				echo "\n\t<option value='$category->term_id'";
				if ( $currentparent == $category->term_id )
					echo " selected='selected'";
				echo ">$pad$category->name</option>";
				wp_dropdown_cats( $currentcat, $currentparent, $category->term_id, $level +1, $categories );
			}
		}
	} else {
		return false;
	}
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $meta
 */
function list_meta( $meta ) {
	// Exit if no meta
	if ( ! $meta ) {
		echo '
<table id="list-table" style="display: none;">
	<thead>
	<tr>
		<th class="left">' . __( 'Name' ) . '</th>
		<th>' . __( 'Value' ) . '</th>
	</tr>
	</thead>
	<tbody id="the-list" class="list:meta">
	<tr><td></td></tr>
	</tbody>
</table>'; //TBODY needed for list-manipulation JS
		return;
	}
	$count = 0;
?>
<table id="list-table">
	<thead>
	<tr>
		<th class="left"><?php _e( 'Name' ) ?></th>
		<th><?php _e( 'Value' ) ?></th>
	</tr>
	</thead>
	<tbody id='the-list' class='list:meta'>
<?php
	foreach ( $meta as $entry )
		echo _list_meta_row( $entry, $count );
?>
	</tbody>
</table>
<?php
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $entry
 * @param unknown_type $count
 * @return unknown
 */
function _list_meta_row( $entry, &$count ) {
	static $update_nonce = false;
	if ( !$update_nonce )
		$update_nonce = wp_create_nonce( 'add-meta' );

	$r = '';
	++ $count;
	if ( $count % 2 )
		$style = 'alternate';
	else
		$style = '';
	if ('_' == $entry['meta_key'] { 0 } )
		$style .= ' hidden';

	if ( is_serialized( $entry['meta_value'] ) ) {
		if ( is_serialized_string( $entry['meta_value'] ) ) {
			// this is a serialized string, so we should display it
			$entry['meta_value'] = maybe_unserialize( $entry['meta_value'] );
		} else {
			// this is a serialized array/object so we should NOT display it
			--$count;
			return;
		}
	}

	$entry['meta_key'] = attribute_escape($entry['meta_key']);
	$entry['meta_value'] = htmlspecialchars($entry['meta_value']); // using a <textarea />
	$entry['meta_id'] = (int) $entry['meta_id'];

	$delete_nonce = wp_create_nonce( 'delete-meta_' . $entry['meta_id'] );

	$r .= "\n\t<tr id='meta-{$entry['meta_id']}' class='$style'>";
	$r .= "\n\t\t<td class='left'><label class='hidden' for='meta[{$entry['meta_id']}][key]'>" . __( 'Key' ) . "</label><input name='meta[{$entry['meta_id']}][key]' id='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' size='20' value='{$entry['meta_key']}' />";

	$r .= "\n\t\t<div class='submit'><input name='deletemeta[{$entry['meta_id']}]' type='submit' ";
	$r .= "class='delete:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$delete_nonce deletemeta' tabindex='6' value='".attribute_escape(__( 'Delete' ))."' />";
	$r .= "\n\t\t<input name='updatemeta' type='submit' tabindex='6' value='".attribute_escape(__( 'Update' ))."' class='add:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$update_nonce updatemeta' /></div>";
	$r .= wp_nonce_field( 'change-meta', '_ajax_nonce', false, false );
	$r .= "</td>";

	$r .= "\n\t\t<td><label class='hidden' for='meta[{$entry['meta_id']}][value]'>" . __( 'Value' ) . "</label><textarea name='meta[{$entry['meta_id']}][value]' id='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>\n\t</tr>";
	return $r;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 */
function meta_form() {
	global $wpdb;
	$limit = (int) apply_filters( 'postmeta_form_limit', 30 );
	$keys = $wpdb->get_col( "
		SELECT meta_key
		FROM $wpdb->postmeta
		WHERE meta_key NOT LIKE '\_%'
		GROUP BY meta_key
		ORDER BY meta_id DESC
		LIMIT $limit" );
	if ( $keys )
		natcasesort($keys);
?>
<p><strong><?php _e( 'Add new custom field:' ) ?></strong></p>
<table id="newmeta">
<thead>
<tr>
<th class="left"><label for="metakeyselect"><?php _e( 'Name' ) ?></label></th>
<th><label for="metavalue"><?php _e( 'Value' ) ?></label></th>
</tr>
</thead>

<tbody>
<tr>
<td id="newmetaleft" class="left">
<?php if ( $keys ) { ?>
<select id="metakeyselect" name="metakeyselect" tabindex="7">
<option value="#NONE#"><?php _e( '- Select -' ); ?></option>
<?php

	foreach ( $keys as $key ) {
		$key = attribute_escape( $key );
		echo "\n<option value='$key'>$key</option>";
	}
?>
</select>
<input class="hide-if-js" type="text" id="metakeyinput" name="metakeyinput" tabindex="7" value="" />
<a href="#postcustomstuff" class="hide-if-no-js" onclick="jQuery('#metakeyinput, #metakeyselect, #enternew, #cancelnew').toggle();return false;">
<span id="enternew"><?php _e('Enter new'); ?></span>
<span id="cancelnew" class="hidden"><?php _e('Cancel'); ?></span></a>
<?php } else { ?>
<input type="text" id="metakeyinput" name="metakeyinput" tabindex="7" value="" />
<?php } ?>
</td>
<td><textarea id="metavalue" name="metavalue" rows="2" cols="25" tabindex="8"></textarea></td>
</tr>

<tr><td colspan="2" class="submit">
<input type="submit" id="addmetasub" name="addmeta" class="add:the-list:newmeta" tabindex="9" value="<?php _e( 'Add Custom Field' ) ?>" />
<?php wp_nonce_field( 'add-meta', '_ajax_nonce', false ); ?>
</td></tr>
</tbody>
</table>
<?php

}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $edit
 * @param unknown_type $for_post
 * @param unknown_type $tab_index
 * @param unknown_type $multi
 */
function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
	global $wp_locale, $post, $comment;

	if ( $for_post )
		$edit = ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) ) ? false : true;

	$tab_index_attribute = '';
	if ( (int) $tab_index > 0 )
		$tab_index_attribute = " tabindex=\"$tab_index\"";

	// echo '<label for="timestamp" style="display: block;"><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp"'.$tab_index_attribute.' /> '.__( 'Edit timestamp' ).'</label><br />';

	$time_adj = time() + (get_option( 'gmt_offset' ) * 3600 );
	$post_date = ($for_post) ? $post->post_date : $comment->comment_date;
	$jj = ($edit) ? mysql2date( 'd', $post_date ) : gmdate( 'd', $time_adj );
	$mm = ($edit) ? mysql2date( 'm', $post_date ) : gmdate( 'm', $time_adj );
	$aa = ($edit) ? mysql2date( 'Y', $post_date ) : gmdate( 'Y', $time_adj );
	$hh = ($edit) ? mysql2date( 'H', $post_date ) : gmdate( 'H', $time_adj );
	$mn = ($edit) ? mysql2date( 'i', $post_date ) : gmdate( 'i', $time_adj );
	$ss = ($edit) ? mysql2date( 's', $post_date ) : gmdate( 's', $time_adj );

	$cur_jj = gmdate( 'd', $time_adj );
	$cur_mm = gmdate( 'm', $time_adj );
	$cur_aa = gmdate( 'Y', $time_adj );
	$cur_hh = gmdate( 'H', $time_adj );
	$cur_mn = gmdate( 'i', $time_adj );

	$month = "<select " . ( $multi ? '' : 'id="mm" ' ) . "name=\"mm\"$tab_index_attribute>\n";
	for ( $i = 1; $i < 13; $i = $i +1 ) {
		$month .= "\t\t\t" . '<option value="' . zeroise($i, 2) . '"';
		if ( $i == $mm )
			$month .= ' selected="selected"';
		$month .= '>' . $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) ) . "</option>\n";
	}
	$month .= '</select>';

	$day = '<input type="text" ' . ( $multi ? '' : 'id="jj" ' ) . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
	$year = '<input type="text" ' . ( $multi ? '' : 'id="aa" ' ) . 'name="aa" value="' . $aa . '" size="4" maxlength="5"' . $tab_index_attribute . ' autocomplete="off" />';
	$hour = '<input type="text" ' . ( $multi ? '' : 'id="hh" ' ) . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
	$minute = '<input type="text" ' . ( $multi ? '' : 'id="mn" ' ) . 'name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
	printf(_c('%1$s%2$s, %3$s @ %4$s : %5$s|1: month input, 2: day input, 3: year input, 4: hour input, 5: minute input'), $month, $day, $year, $hour, $minute);

	echo '<input type="hidden" id="ss" name="ss" value="' . $ss . '" />';

	if ( $multi ) return;

	echo "\n\n";
	foreach ( array('mm', 'jj', 'aa', 'hh', 'mn') as $timeunit ) {
		echo '<input type="hidden" id="hidden_' . $timeunit . '" name="hidden_' . $timeunit . '" value="' . $$timeunit . '" />' . "\n";
		$cur_timeunit = 'cur_' . $timeunit;
		echo '<input type="hidden" id="'. $cur_timeunit . '" name="'. $cur_timeunit . '" value="' . $$cur_timeunit . '" />' . "\n";
	}
?>

<input type="hidden" id="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" />

<p>
<a href="#edit_timestamp" class="save-timestamp hide-if-no-js button"><?php _e('OK'); ?></a>
<a href="#edit_timestamp" class="cancel-timestamp hide-if-no-js"><?php _e('Cancel'); ?></a>
</p>
<?php
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $default
 */
function page_template_dropdown( $default = '' ) {
	$templates = get_page_templates();
	ksort( $templates );
	foreach (array_keys( $templates ) as $template )
		: if ( $default == $templates[$template] )
			$selected = " selected='selected'";
		else
			$selected = '';
	echo "\n\t<option value='".$templates[$template]."' $selected>$template</option>";
	endforeach;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $default
 * @param unknown_type $parent
 * @param unknown_type $level
 * @return unknown
 */
function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) {
	global $wpdb, $post_ID;
	$items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent) );

	if ( $items ) {
		foreach ( $items as $item ) {
			// A page cannot be its own parent.
			if (!empty ( $post_ID ) ) {
				if ( $item->ID == $post_ID ) {
					continue;
				}
			}
			$pad = str_repeat( '&nbsp;', $level * 3 );
			if ( $item->ID == $default)
				$current = ' selected="selected"';
			else
				$current = '';

			echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . wp_specialchars($item->post_title) . "</option>";
			parent_dropdown( $default, $item->ID, $level +1 );
		}
	} else {
		return false;
	}
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 */
function browse_happy() {
	$getit = __( 'WordPress recommends a better browser' );
	echo '
		<div id="bh"><a href="http://browsehappy.com/" title="'.$getit.'"><img src="images/browse-happy.gif" alt="Browse Happy" /></a></div>
';
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $id
 * @return unknown
 */
function the_attachment_links( $id = false ) {
	$id = (int) $id;
	$post = & get_post( $id );

	if ( $post->post_type != 'attachment' )
		return false;

	$icon = get_attachment_icon( $post->ID );
	$attachment_data = wp_get_attachment_metadata( $id );
	$thumb = isset( $attachment_data['thumb'] );
?>
<form id="the-attachment-links">
<table>
	<col />
	<col class="widefat" />
	<tr>
		<th scope="row"><?php _e( 'URL' ) ?></th>
		<td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><?php echo wp_get_attachment_url(); ?></textarea></td>
	</tr>
<?php if ( $icon ) : ?>
	<tr>
		<th scope="row"><?php $thumb ? _e( 'Thumbnail linked to file' ) : _e( 'Image linked to file' ); ?></th>
		<td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo wp_get_attachment_url(); ?>"><?php echo $icon ?></a></textarea></td>
	</tr>
	<tr>
		<th scope="row"><?php $thumb ? _e( 'Thumbnail linked to page' ) : _e( 'Image linked to page' ); ?></th>
		<td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link( $post->ID ) ?>" rel="attachment wp-att-<?php echo $post->ID; ?>"><?php echo $icon ?></a></textarea></td>
	</tr>
<?php else : ?>
	<tr>
		<th scope="row"><?php _e( 'Link to file' ) ?></th>
		<td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo wp_get_attachment_url(); ?>" class="attachmentlink"><?php echo basename( wp_get_attachment_url() ); ?></a></textarea></td>
	</tr>
	<tr>
		<th scope="row"><?php _e( 'Link to page' ) ?></th>
		<td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link( $post->ID ) ?>" rel="attachment wp-att-<?php echo $post->ID ?>"><?php the_title(); ?></a></textarea></td>
	</tr>
<?php endif; ?>
</table>
</form>
<?php
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $default
 */
function wp_dropdown_roles( $default = false ) {
	global $wp_roles;
	$p = '';
	$r = '';
	foreach( $wp_roles->role_names as $role => $name ) {
		$name = translate_with_context($name);
		if ( $default == $role ) // Make default first in list
			$p = "\n\t<option selected='selected' value='$role'>$name</option>";
		else
			$r .= "\n\t<option value='$role'>$name</option>";
	}
	echo $p . $r;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $size
 * @return unknown
 */
function wp_convert_hr_to_bytes( $size ) {
	$size = strtolower($size);
	$bytes = (int) $size;
	if ( strpos($size, 'k') !== false )
		$bytes = intval($size) * 1024;
	elseif ( strpos($size, 'm') !== false )
		$bytes = intval($size) * 1024 * 1024;
	elseif ( strpos($size, 'g') !== false )
		$bytes = intval($size) * 1024 * 1024 * 1024;
	return $bytes;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $bytes
 * @return unknown
 */
function wp_convert_bytes_to_hr( $bytes ) {
	$units = array( 0 => 'B', 1 => 'kB', 2 => 'MB', 3 => 'GB' );
	$log = log( $bytes, 1024 );
	$power = (int) $log;
	$size = pow(1024, $log - $power);
	return $size . $units[$power];
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @return unknown
 */
function wp_max_upload_size() {
	$u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) );
	$p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) );
	$bytes = apply_filters( 'upload_size_limit', min($u_bytes, $p_bytes), $u_bytes, $p_bytes );
	return $bytes;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $action
 */
function wp_import_upload_form( $action ) {
	$bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() );
	$size = wp_convert_bytes_to_hr( $bytes );
?>
<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo attribute_escape($action) ?>">
<p>
<?php wp_nonce_field('import-upload'); ?>
<label for="upload"><?php _e( 'Choose a file from your computer:' ); ?></label> (<?php printf( __('Maximum size: %s' ), $size ); ?>)
<input type="file" id="upload" name="import" size="25" />
<input type="hidden" name="action" value="save" />
<input type="hidden" name="max_file_size" value="<?php echo $bytes; ?>" />
</p>
<p class="submit">
<input type="submit" class="button" value="<?php _e( 'Upload file and import' ); ?>" />
</p>
</form>
<?php
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 */
function wp_remember_old_slug() {
	global $post;
	$name = attribute_escape($post->post_name); // just in case
	if ( strlen($name) )
		echo '<input type="hidden" id="wp-old-slug" name="wp-old-slug" value="' . $name . '" />';
}

/**
 * Add a meta box to an edit form.
 *
 * @since 2.5.0
 *
 * @param string $id String for use in the 'id' attribute of tags.
 * @param string $title Title of the meta box.
 * @param string $callback Function that fills the box with the desired content. The function should echo its output.
 * @param string $page The type of edit page on which to show the box (post, page, link).
 * @param string $context The context within the page where the boxes should show ('normal', 'advanced').
 * @param string $priority The priority within the context where the boxes should show ('high', 'low').
 */
function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $priority = 'default') {
	global $wp_meta_boxes;

	if ( !isset($wp_meta_boxes) )
		$wp_meta_boxes = array();
	if ( !isset($wp_meta_boxes[$page]) )
		$wp_meta_boxes[$page] = array();
	if ( !isset($wp_meta_boxes[$page][$context]) )
		$wp_meta_boxes[$page][$context] = array();

	foreach ( array_keys($wp_meta_boxes[$page]) as $a_context ) {
	foreach ( array('high', 'core', 'default', 'low') as $a_priority ) {
		if ( !isset($wp_meta_boxes[$page][$a_context][$a_priority][$id]) )
			continue;

		// If a core box was previously added or removed by a plugin, don't add.
		if ( 'core' == $priority ) {
			// If core box previously deleted, don't add
			if ( false === $wp_meta_boxes[$page][$a_context][$a_priority][$id] )
				return;
			// If box was added with default priority, give it core priority to maintain sort order
			if ( 'default' == $a_priority ) {
				$wp_meta_boxes[$page][$a_context]['core'][$id] = $wp_meta_boxes[$page][$a_context]['default'][$id];
				unset($wp_meta_boxes[$page][$a_context]['default'][$id]);
			}
			return;
		}
		// If no priority given and id already present, use existing priority
		if ( empty($priority) ) {
			$priority = $a_priority;
		// else if we're adding to the sorted priortiy, we don't know the title or callback. Glab them from the previously added context/priority.
		} elseif ( 'sorted' == $priority ) {
			$title = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['title'];
			$callback = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['callback'];
		}
		// An id can be in only one priority and one context
		if ( $priority != $a_priority || $context != $a_context )
			unset($wp_meta_boxes[$page][$a_context][$a_priority][$id]);
	}
	}

	if ( empty($priority) )
		$priority = 'low';

	if ( !isset($wp_meta_boxes[$page][$context][$priority]) )
		$wp_meta_boxes[$page][$context][$priority] = array();

	$wp_meta_boxes[$page][$context][$priority][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback);
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $page
 * @param unknown_type $context
 * @param unknown_type $object
 * @return int number of meta_boxes
 */
function do_meta_boxes($page, $context, $object) {
	global $wp_meta_boxes;
	static $already_sorted = false;

	//do_action('do_meta_boxes', $page, $context, $object);

	$hidden = get_hidden_meta_boxes($page);

	echo "<div id='$context-sortables' class='meta-box-sortables'>\n";

	$i = 0;
	do {
		// Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
		if ( !$already_sorted && $sorted = get_user_option( "meta-box-order_$page", 0, false ) ) {
			foreach ( $sorted as $box_context => $ids )
				foreach ( explode(',', $ids) as $id )
					if ( $id )
						add_meta_box( $id, null, null, $page, $box_context, 'sorted' );
		}
		$already_sorted = true;

		if ( !isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context]) )
			break;

		foreach ( array('high', 'sorted', 'core', 'default', 'low') as $priority ) {
			if ( isset($wp_meta_boxes[$page][$context][$priority]) ) {
				foreach ( (array) $wp_meta_boxes[$page][$context][$priority] as $box ) {
					if ( false == $box || ! $box['title'] )
						continue;
					$i++;
					$style = '';
					if ( in_array($box['id'], $hidden) )
						$style = 'style="display:none;"';
					echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . '" ' . $style . '>' . "\n";
					echo '<div class="handlediv" title="' . __('Click to toggle') . '"><br /></div>';
					echo "<h3 class='hndle'><span>{$box['title']}</span></h3>\n";
					echo '<div class="inside">' . "\n";
					call_user_func($box['callback'], $object, $box);
					echo "</div>\n";
					echo "</div>\n";
				}
			}
		}
	} while(0);

	echo "</div>";

	return $i;

}

/**
 * Remove a meta box from an edit form.
 *
 * @since 2.6.0
 *
 * @param string $id String for use in the 'id' attribute of tags.
 * @param string $page The type of edit page on which to show the box (post, page, link).
 * @param string $context The context within the page where the boxes should show ('normal', 'advanced').
 */
function remove_meta_box($id, $page, $context) {
	global $wp_meta_boxes;

	if ( !isset($wp_meta_boxes) )
		$wp_meta_boxes = array();
	if ( !isset($wp_meta_boxes[$page]) )
		$wp_meta_boxes[$page] = array();
	if ( !isset($wp_meta_boxes[$page][$context]) )
		$wp_meta_boxes[$page][$context] = array();

	foreach ( array('high', 'core', 'default', 'low') as $priority )
		$wp_meta_boxes[$page][$context][$priority][$id] = false;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $page
 */
function meta_box_prefs($page) {
	global $wp_meta_boxes;

	if ( empty($wp_meta_boxes[$page]) )
		return;

	$hidden = get_hidden_meta_boxes($page);

	foreach ( array_keys($wp_meta_boxes[$page]) as $context ) {
		foreach ( array_keys($wp_meta_boxes[$page][$context]) as $priority ) {
			foreach ( $wp_meta_boxes[$page][$context][$priority] as $box ) {
				if ( false == $box || ! $box['title'] )
					continue;
				// Submit box cannot be hidden
				if ( 'submitdiv' == $box['id'] || 'linksubmitdiv' == $box['id'] )
					continue;
				$box_id = $box['id'];
				echo '<label for="' . $box_id . '-hide">';
				echo '<input class="hide-postbox-tog" name="' . $box_id . '-hide" type="checkbox" id="' . $box_id . '-hide" value="' . $box_id . '"' . (! in_array($box_id, $hidden) ? ' checked="checked"' : '') . ' />';
				echo "{$box['title']}</label>\n";
			}
		}
	}
}

function get_hidden_meta_boxes($page) {
	$hidden = (array) get_user_option( "meta-box-hidden_$page", 0, false );

	// Hide slug boxes by default
	if ( empty($hidden[0]) ) {
		if ( 'page' == $page )
			$hidden = array('pageslugdiv');
		elseif ( 'post' == $page )
			$hidden = array('slugdiv');
	}

	return $hidden;
}

/**
 * Add a new section to a settings page.
 *
 * @since 2.7.0
 *
 * @param string $id String for use in the 'id' attribute of tags.
 * @param string $title Title of the section.
 * @param string $callback Function that fills the section with the desired content. The function should echo its output.
 * @param string $page The type of settings page on which to show the section (general, reading, writing, ...).
 */
function add_settings_section($id, $title, $callback, $page) {
	global $wp_settings_sections;

	if ( !isset($wp_settings_sections) )
		$wp_settings_sections = array();
	if ( !isset($wp_settings_sections[$page]) )
		$wp_settings_sections[$page] = array();
	if ( !isset($wp_settings_sections[$page][$id]) )
		$wp_settings_sections[$page][$id] = array();

	$wp_settings_sections[$page][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback);
}

/**
 * Add a new field to a settings page.
 *
 * @since 2.7.0
 *
 * @param string $id String for use in the 'id' attribute of tags.
 * @param string $title Title of the field.
 * @param string $callback Function that fills the field with the desired content. The function should echo its output.
 * @param string $page The type of settings page on which to show the field (general, reading, writing, ...).
 * @param string $section The section of the settingss page in which to show the box (default, ...).
 * @param array $args Additional arguments
 */
function add_settings_field($id, $title, $callback, $page, $section = 'default', $args = array()) {
	global $wp_settings_fields;

	if ( !isset($wp_settings_fields) )
		$wp_settings_fields = array();
	if ( !isset($wp_settings_fields[$page]) )
		$wp_settings_fields[$page] = array();
	if ( !isset($wp_settings_fields[$page][$section]) )
		$wp_settings_fields[$page][$section] = array();

	$wp_settings_fields[$page][$section][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $args);
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $page
 */
function do_settings_sections($page) {
	global $wp_settings_sections, $wp_settings_fields;

	if ( !isset($wp_settings_sections) || !isset($wp_settings_sections[$page]) )
		return;

	foreach ( (array) $wp_settings_sections[$page] as $section ) {
		echo "<h3>{$section['title']}</h3>\n";
		call_user_func($section['callback'], $section);
		if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section['id']]) )
			continue;
		echo '<table class="form-table">';
		do_settings_fields($page, $section['id']);
		echo '</table>';
	}
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $page
 * @param unknown_type $section
 */
function do_settings_fields($page, $section) {
	global $wp_settings_fields;

	if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section]) )
		return;

	foreach ( (array) $wp_settings_fields[$page][$section] as $field ) {
		echo '<tr valign="top">';
		if ( !empty($field['args']['label_for']) )
			echo '<th scope="row"><label for="' . $field['args']['label_for'] . '">' . $field['title'] . '</label></th>';
		else
			echo '<th scope="row">' . $field['title'] . '</th>';
		echo '<td>';
		call_user_func($field['callback']);
		echo '</td>';
		echo '</tr>';
	}
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $page
 */
function manage_columns_prefs($page) {
	$columns = get_column_headers($page);

	$hidden = get_hidden_columns($page);

	foreach ( $columns as $column => $title ) {
		// Can't hide these
		if ( 'cb' == $column || 'title' == $column || 'name' == $column || 'username' == $column || 'media' == $column || 'comment' == $column )
			continue;
		if ( empty($title) )
			continue;

		if ( 'comments' == $column )
			$title = __('Comments');
		$id = "$column-hide";
		echo '<label for="' . $id . '">';
		echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . (! in_array($column, $hidden) ? ' checked="checked"' : '') . ' />';
		echo "$title</label>\n";
	}
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $found_action
 */
function find_posts_div($found_action = '') {
?>
	<div id="find-posts" class="find-box" style="display:none;">
		<div id="find-posts-head" class="find-box-head"><?php _e('Find Posts or Pages'); ?></div>
		<div class="find-box-inside">
			<div class="find-box-search">
				<?php if ( $found_action ) { ?>
					<input type="hidden" name="found_action" value="<?php echo $found_action; ?>" />
				<?php } ?>

				<input type="hidden" name="affected" id="affected" value="" />
				<?php wp_nonce_field( 'find-posts', '_ajax_nonce', false ); ?>
				<label class="hidden" for="find-posts-input"><?php _e( 'Search' ); ?></label>
				<input type="text" id="find-posts-input" class="search-input" name="ps" value="" />
				<input type="button" onclick="findPosts.send();" value="<?php _e( 'Search' ); ?>" class="button" /><br />

				<input type="radio" name="find-posts-what" id="find-posts-posts" checked="checked" value="posts" />
				<label for="find-posts-posts"><?php _e( 'Posts' ); ?></label>
				<input type="radio" name="find-posts-what" id="find-posts-pages" value="pages" />
				<label for="find-posts-pages"><?php _e( 'Pages' ); ?></label>
			</div>
			<div id="find-posts-response"></div>
		</div>
		<div class="find-box-buttons">
			<input type="button" class="button" onclick="findPosts.close();" value="<?php _e('Close'); ?>" />
			<input id="find-posts-submit" type="submit" class="button" value="<?php _e('Select'); ?>" />
		</div>
	</div>
	<script type="text/javascript">
	/* <![CDATA[ */
	(function($){
		findPosts = {
			open : function(af_name, af_val) {
				var st = document.documentElement.scrollTop || $(document).scrollTop();

				if ( af_name && af_val )
					$('#affected').attr('name', af_name).val(af_val);

				$('#find-posts').show().draggable({
					handle: '#find-posts-head'
				}).resizable({
					handles: 'all',
					minHeight: 150,
					minWidth: 280
				}).css({'top':st+'px','left':'50%','marginLeft':'-200px'});

				$('.ui-resizable-handle').css({
					'backgroundColor': '#e5e5e5'
				});

				$('.ui-resizable-se').css({
					'border': '0 none',
					'width': '15px',
					'height': '16px',
					'background': 'transparent url(images/se.png) no-repeat scroll 0 0'
				});

				$('#find-posts-input').focus().keyup(function(e){
					if (e.which == 27) findPosts.close(); // close on Escape
				});

				return false;
			},

			close : function() {
				$('#find-posts-response').html('');
				$('#find-posts').draggable('destroy').resizable('destroy').hide();
			},

			send : function() {
				var post = {};

				post['ps'] = $('#find-posts-input').val();
				post['action'] = 'find_posts';
				post['_ajax_nonce'] = $('#_ajax_nonce').val();

				if ( $('#find-posts-pages:checked').val() )
					post['pages'] = 1;
				else
					post['posts'] = 1;

				$.ajax({
					type : 'POST',
					url : '<?php echo admin_url('admin-ajax.php'); ?>',
					data : post,
					success : function(x) { findPosts.show(x); },
					error : function(r) { findPosts.error(r); }
				});
			},

			show : function(x) {

				if ( typeof(x) == 'string' ) {
					this.error({'responseText': x});
					return;
				}

				var r = wpAjax.parseAjaxResponse(x);

				if ( r.errors )
					this.error({'responseText': wpAjax.broken});

				r = r.responses[0];
				$('#find-posts-response').html(r.data);
			},

			error : function(r) {
				var er = r.statusText;

				if ( r.responseText )
					er = r.responseText.replace( /<.[^<>]*?>/g, '' );

				if ( er )
					$('#find-posts-response').html(er);
			}
		};

		$(document).ready(function(){
			$('#find-posts-submit').click(function(e) {
				if ( '' == $('#find-posts-response').html() )
					e.preventDefault();
			});
		});
	})(jQuery);
	/* ]]> */
	</script>
<?php
}

/**
 * Display the post password.
 *
 * The password is passed through {@link attribute_escape()} to ensure that it
 * is safe for placing in an html attribute.
 *
 * @uses attribute_escape
 * @since 2.7.0
 */
function the_post_password() {
	global $post;
	if ( isset( $post->post_password ) ) echo attribute_escape( $post->post_password );
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 */
function favorite_actions() {
	$actions = array(
		'post-new.php' => array(__('New Post'), 'edit_posts'),
		'edit.php?post_status=draft' => array(__('Drafts'), 'edit_posts'),
		'page-new.php' => array(__('New Page'), 'edit_pages'),
		'media-new.php' => array(__('Upload'), 'upload_files'),
		'edit-comments.php' => array(__('Comments'), 'moderate_comments')
		);

	$actions = apply_filters('favorite_actions', $actions);

	$allowed_actions = array();
	foreach ( $actions as $action => $data ) {
		if ( current_user_can($data[1]) )
			$allowed_actions[$action] = $data[0];
	}

	if ( empty($allowed_actions) )
		return;

	$first = array_keys($allowed_actions);
	$first = $first[0];
	echo '<div id="favorite-actions">';
	echo '<div id="favorite-first"><a href="' . $first . '">' . $allowed_actions[$first] . '</a></div><div id="favorite-toggle"><br /></div>';
	echo '<div id="favorite-inside">';

	array_shift($allowed_actions);

	foreach ( $allowed_actions as $action => $label) {
		echo "<div class='favorite-action'><a href='$action'>";
		echo $label;
		echo "</a></div>\n";
	}
	echo "</div></div>\n";
}

/**
 * Get the post title.
 *
 * The post title is fetched and if it is blank then a default string is
 * returned.
 *
 * @since 2.7.0
 * @param int $id The post id. If not supplied the global $post is used.
 *
 */
function _draft_or_post_title($post_id = 0)
{
	$title = get_the_title($post_id);
	if ( empty($title) )
		$title = __('(no title)');
	return $title;
}

/**
 * Display the search query.
 *
 * A simple wrapper to display the "s" parameter in a GET URI. This function
 * should only be used when {@link the_search_query()} cannot.
 *
 * @uses attribute_escape
 * @since 2.7.0
 *
 */
function _admin_search_query() {
	echo isset($_GET['s']) ? attribute_escape( stripslashes( $_GET['s'] ) ) : '';
}

/**
 * Generic Iframe header for use with Thickbox
 *
 * @since 2.7.0
 * @param string $title Title of the Iframe page.
 * @param bool $limit_styles Limit styles to colour-related styles only (unless others are enqueued).
 *
 */
function iframe_header( $title = '', $limit_styles = false) {
?><!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" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
<head>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
<title><?php bloginfo('name') ?> &rsaquo; <?php echo $title ?> &#8212; <?php _e('WordPress'); ?></title>
<?php
wp_enqueue_style( 'global' );
wp_enqueue_style( 'colors' );
if ( ! $limit_styles )
	wp_enqueue_style( 'wp-admin' );
?>
<script type="text/javascript">
//<![CDATA[
function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}else{ var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}
//]]>
</script>
<?php
do_action('admin_print_styles');
do_action('admin_print_scripts');
do_action('admin_head');
?>
</head>
<body<?php if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?>>
<?php
}

/**
 * Generic Iframe footer for use with Thickbox
 *
 * @since 2.7.0
 *
 */
function iframe_footer() {
	echo '
	</body>
</html>';
}

function _post_states($post) {
	$post_states = array();
	if ( isset($_GET['post_status']) )
		$post_status = $_GET['post_status'];
	else
		$post_status = '';

	if ( !empty($post->post_password) )
		$post_states[] = __('Password protected');
	if ( 'private' == $post->post_status && 'private' != $post_status )
		$post_states[] = __('Private');
	if ( 'draft' == $post->post_status && 'draft' != $post_status )
		$post_states[] = __('Draft');
	if ( 'pending' == $post->post_status && 'pending' != $post_status )
		$post_states[] = __('Pending');

	if ( ! empty($post_states) ) {
		$state_count = count($post_states);
		$i = 0;
		echo ' - ';
		foreach ( $post_states as $state ) {
			++$i;
			( $i == $state_count ) ? $sep = '' : $sep = ', ';
			echo "<span class='post-state'>$state$sep</span>";
		}
	}
}

function screen_meta($screen) {
	global $wp_meta_boxes, $_wp_contextual_help;

	$screen = str_replace('.php', '', $screen);
	$screen = str_replace('-new', '', $screen);
	$screen = str_replace('-add', '', $screen);
	$screen = apply_filters('screen_meta_screen', $screen);

	$column_screens = get_column_headers($screen);
	$meta_screens = array('index' => 'dashboard');

	if ( isset($meta_screens[$screen]) )
		$screen = $meta_screens[$screen];
	$show_screen = false;
	if ( !empty($wp_meta_boxes[$screen]) || !empty($column_screens) )
		$show_screen = true;
?>
<div id="screen-meta">
<?php
	if ( $show_screen ) :
?>
<div id="screen-options-wrap" class="hidden">
	<h5><?php _e('Show on screen') ?></h5>
	<form id="adv-settings" action="" method="get">
	<div class="metabox-prefs">
<?php
	if ( !meta_box_prefs($screen) && isset($column_screens) ) {
		manage_columns_prefs($screen);
		wp_nonce_field( 'hiddencolumns', 'hiddencolumnsnonce', false );
	}
?>
	<br class="clear" />
	</div></form>
</div>

<?php
	endif;

	global $title;

	if ( !isset($_wp_contextual_help) )
		$_wp_contextual_help = array();

	if ( !isset($_wp_contextual_help['post']) ) {
		$help = drag_drop_help();
		$help .= '<p>' . __('<a href="http://codex.wordpress.org/Writing_Posts" target="_blank">Writing Posts</a>') . '</p>';
		$_wp_contextual_help['post'] = $help;
	}

	if ( !isset($_wp_contextual_help['page']) ) {
		$help = drag_drop_help();
		$_wp_contextual_help['page'] = $help;
	}

	if ( !isset($_wp_contextual_help['dashboard']) ) {
		$help = drag_drop_help();
		$_wp_contextual_help['dashboard'] = $help;
	}

	if ( !isset($_wp_contextual_help['link']) ) {
		$help = drag_drop_help();
		$_wp_contextual_help['link'] = $help;
	}

	if ( !isset($_wp_contextual_help['options-general']) )
		$_wp_contextual_help['options-general'] =  __('<a href="http://codex.wordpress.org/Settings_General_SubPanel" target="_blank">General Settings</a>');

	$_wp_contextual_help = apply_filters('contextual_help_list', $_wp_contextual_help, $screen);
	?>
	<div id="contextual-help-wrap" class="hidden">
	<?php
	$contextual_help = '';
	if ( isset($_wp_contextual_help[$screen]) ) {
		if ( !empty($title) )
			$contextual_help .= '<h5>' . sprintf(__('Get help with "%s"'), $title) . '</h5>';
		else
			$contextual_help .= '<h5>' . __('Get help with this page') . '</h5>';
		$contextual_help .= '<div class="metabox-prefs">' . $_wp_contextual_help[$screen] . "</div>\n";

		$contextual_help .= '<h5>' . __('Other Help') . '</h5>';
	} else {
		$contextual_help .= '<h5>' . __('Help') . '</h5>';
	}

	$contextual_help .= '<div class="metabox-prefs">';
	$contextual_help .= __('<a href="http://codex.wordpress.org/" target="_blank">Documentation</a>');
	$contextual_help .= '<br />';
	$contextual_help .= __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>');
	$contextual_help .= "</div>\n";
	echo apply_filters('contextual_help', $contextual_help, $screen);
	?>
	</div>

<div id="screen-meta-links">
<div id="contextual-help-link-wrap" class="hide-if-no-js screen-meta-toggle">
<a href="#contextual-help" id="contextual-help-link" class="show-settings"><?php _e('Help') ?></a>
</div>
<?php if ( $show_screen ) { ?>
<div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle">
<a href="#screen-options" id="show-settings-link" class="show-settings"><?php _e('Screen Options') ?></a>
</div>
<?php } ?>
</div>
</div>
<?php
}

/**
 * Add contextual help text for a page
 *
 * @since 2.7.0
 *
 * @param string $screen The handle for the screen to add help to.  This is usually the hook name returned by the add_*_page() functions.
 * @param string $help Arbitrary help text
 */
function add_contextual_help($screen, $help) {
	global $_wp_contextual_help;

	if ( !isset($_wp_contextual_help) )
		$_wp_contextual_help = array();

	$_wp_contextual_help[$screen] = $help;
}

function drag_drop_help() {
	return '
	<p>' .	__('Most of the modules on this screen can be moved. If you hover your mouse over the title bar of a module you’ll notice the 4 arrow cursor appears to let you know it is movable. Click on it, hold down the mouse button and start dragging the module to a new location. As you drag the module, notice the dotted gray box that also moves. This box indicates where the module will be placed when you release the mouse button.') . '</p>
	<p>' . __('The same modules can be expanded and collapsed by clicking once on their title bar and also completely hidden from the Screen Options tab.') . '</p>
';
}

function screen_icon($name = '') {
	global $parent_file, $hook_suffix;

	if ( empty($name) ) {
		if ( isset($parent_file) && !empty($parent_file) )
			$name = substr($parent_file, 0, -4);
		else
			$name = str_replace(array('.php', '-new', '-add'), '', $hook_suffix);
	}
	unset($hook_suffix);
?>
	<div id="icon-<?php echo $name; ?>" class="icon32"><br /></div>
<?php
}

?>
                                                                                                                                                                                                                                                                                  wp-admin/includes/theme.php                                                                         0000755 0023422 0004734 00000003620 11071025756 016747  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress Theme Administration API
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @return unknown
 */
function current_theme_info() {
	$themes = get_themes();
	$current_theme = get_current_theme();
	$ct->name = $current_theme;
	$ct->title = $themes[$current_theme]['Title'];
	$ct->version = $themes[$current_theme]['Version'];
	$ct->parent_theme = $themes[$current_theme]['Parent Theme'];
	$ct->template_dir = $themes[$current_theme]['Template Dir'];
	$ct->stylesheet_dir = $themes[$current_theme]['Stylesheet Dir'];
	$ct->template = $themes[$current_theme]['Template'];
	$ct->stylesheet = $themes[$current_theme]['Stylesheet'];
	$ct->screenshot = $themes[$current_theme]['Screenshot'];
	$ct->description = $themes[$current_theme]['Description'];
	$ct->author = $themes[$current_theme]['Author'];
	$ct->tags = $themes[$current_theme]['Tags'];
	return $ct;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @return unknown
 */
function get_broken_themes() {
	global $wp_broken_themes;

	get_themes();
	return $wp_broken_themes;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @return unknown
 */
function get_page_templates() {
	$themes = get_themes();
	$theme = get_current_theme();
	$templates = $themes[$theme]['Template Files'];
	$page_templates = array ();

	if ( is_array( $templates ) ) {
		foreach ( $templates as $template ) {
			$template_data = implode( '', file( WP_CONTENT_DIR.$template ));

			$name = '';
			if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ) )
				$name = $name[1];

			$description = '';
			if( preg_match( '|Description:(.*)$|mi', $template_data, $description ) )
				$description = $description[1];

			if ( !empty( $name ) ) {
				$page_templates[trim( $name )] = basename( $template );
			}
		}
	}

	return $page_templates;
}

?>
                                                                                                                wp-admin/includes/update.php                                                                        0000755 0023422 0004734 00000041362 11117531364 017132  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress Administration Update API
 *
 * @package WordPress
 * @subpackage Admin
 */

// The admin side of our 1.1 update system

/**
 * Selects the first update version from the update_core option
 *
 * @return object the response from the API
 */
function get_preferred_from_update_core() {
	$updates = get_core_updates();
	if ( !is_array( $updates ) )
		return false;
	if ( empty( $updates ) )
		return (object)array('response' => 'latest');
	return $updates[0];
}

/**
 * Get available core updates
 *
 * @param array $options Set $options['dismissed'] to true to show dismissed upgrades too,
 * 	set $options['available'] to false to skip not-dimissed updates.
 * @return array Array of the update objects
 */
function get_core_updates( $options = array() ) {
	$options = array_merge( array('available' => true, 'dismissed' => false ), $options );
	$dismissed = get_option( 'dismissed_update_core' );
	if ( !is_array( $dismissed ) ) $dismissed = array();
	$from_api = get_option( 'update_core' );
	if ( empty($from_api) )
		return false;
	if ( !is_array( $from_api->updates ) ) return false;
	$updates = $from_api->updates;
	if ( !is_array( $updates ) ) return false;
	$result = array();
	foreach($updates as $update) {
		if ( array_key_exists( $update->current.'|'.$update->locale, $dismissed ) ) {
			if ( $options['dismissed'] ) {
				$update->dismissed = true;
				$result[]= $update;
			}
		} else {
			if ( $options['available'] ) {
				$update->dismissed = false;
				$result[]= $update;
			}
		}
	}
	return $result;
}

function dismiss_core_update( $update ) {
	$dismissed = get_option( 'dismissed_update_core' );
	$dismissed[ $update->current.'|'.$update->locale ] = true;
	return update_option( 'dismissed_update_core', $dismissed );
}

function undismiss_core_update( $version, $locale ) {
	$dismissed = get_option( 'dismissed_update_core' );
	$key = $version.'|'.$locale;
	if ( !isset( $dismissed[$key] ) ) return false;
	unset( $dismissed[$key] );
	return update_option( 'dismissed_update_core', $dismissed );
}

function find_core_update( $version, $locale ) {
	$from_api = get_option( 'update_core' );
	if ( !is_array( $from_api->updates ) ) return false;
	$updates = $from_api->updates;
	foreach($updates as $update) {
		if ( $update->current == $version && $update->locale == $locale )
			return $update;
	}
	return false;
}

function core_update_footer( $msg = '' ) {
	if ( !current_user_can('manage_options') )
		return sprintf( '| '.__( 'Version %s' ), $GLOBALS['wp_version'] );

	$cur = get_preferred_from_update_core();
	if ( ! isset( $cur->current ) )
		$cur->current = '';

	if ( ! isset( $cur->url ) )
		$cur->url = '';

	if ( ! isset( $cur->response ) )
		$cur->response = '';

	switch ( $cur->response ) {
	case 'development' :
		return sprintf( __( 'You are using a development version (%1$s). Cool! Please <a href="%2$s">stay updated</a>.' ), $GLOBALS['wp_version'], 'update-core.php');
	break;

	case 'upgrade' :
		if ( current_user_can('manage_options') ) {
			return sprintf( '<strong>'.__( '<a href="%1$s">Get Version %2$s</a>' ).'</strong>', 'update-core.php', $cur->current);
			break;
		}

	case 'latest' :
	default :
		return sprintf( __( 'Version %s' ), $GLOBALS['wp_version'] );
	break;
	}
}
add_filter( 'update_footer', 'core_update_footer' );

function update_nag() {
	global $pagenow;

	if ( 'update-core.php' == $pagenow )
		return;

	$cur = get_preferred_from_update_core();

	if ( ! isset( $cur->response ) || $cur->response != 'upgrade' )
		return false;

	if ( current_user_can('manage_options') )
		$msg = sprintf( __('WordPress %1$s is available! <a href="%2$s">Please update now</a>.'), $cur->current, 'update-core.php' );
	else
		$msg = sprintf( __('WordPress %1$s is available! Please notify the site administrator.'), $cur->current );

	echo "<div id='update-nag'>$msg</div>";
}
add_action( 'admin_notices', 'update_nag', 3 );

// Called directly from dashboard
function update_right_now_message() {
	$cur = get_preferred_from_update_core();

	$msg = sprintf( __('You are using <span class="b">WordPress %s</span>.'), $GLOBALS['wp_version'] );
	if ( isset( $cur->response ) && $cur->response == 'upgrade' && current_user_can('manage_options') )
		$msg .= " <a href='update-core.php' class='button'>" . sprintf( __('Update to %s'), $cur->current ? $cur->current : __( 'Latest' ) ) . '</a>';

	echo "<span id='wp-version-message'>$msg</span>";
}

function wp_plugin_update_row( $file, $plugin_data ) {
	$current = get_option( 'update_plugins' );
	if ( !isset( $current->response[ $file ] ) )
		return false;

	$r = $current->response[ $file ];

	$details_url = admin_url('plugin-install.php?tab=plugin-information&plugin=' . $r->slug . '&TB_iframe=true&width=600&height=800');

	echo '<tr><td colspan="5" class="plugin-update">';
	if ( ! current_user_can('update_plugins') )
		printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a>.'), $plugin_data['Name'], $details_url, $r->new_version);
	else if ( empty($r->package) )
		printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a> <em>automatic upgrade unavailable for this plugin</em>.'), $plugin_data['Name'], $details_url, $r->new_version);
	else
		printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a> or <a href="%4$s">upgrade automatically</a>.'), $plugin_data['Name'], $details_url, $r->new_version, wp_nonce_url('update.php?action=upgrade-plugin&amp;plugin=' . $file, 'upgrade-plugin_' . $file) );

	echo '</td></tr>';
}
add_action( 'after_plugin_row', 'wp_plugin_update_row', 10, 2 );

function wp_update_plugin($plugin, $feedback = '') {
	global $wp_filesystem;

	if ( !empty($feedback) )
		add_filter('update_feedback', $feedback);

	// Is an update available?
	$current = get_option( 'update_plugins' );
	if ( !isset( $current->response[ $plugin ] ) )
		return new WP_Error('up_to_date', __('The plugin is at the latest version.'));

	// Is a filesystem accessor setup?
	if ( ! $wp_filesystem || ! is_object($wp_filesystem) )
		WP_Filesystem();

	if ( ! is_object($wp_filesystem) )
		return new WP_Error('fs_unavailable', __('Could not access filesystem.'));

	if ( $wp_filesystem->errors->get_error_code() )
		return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors);

	//Get the base plugin folder
	$plugins_dir = $wp_filesystem->wp_plugins_dir();
	if ( empty($plugins_dir) )
		return new WP_Error('fs_no_plugins_dir', __('Unable to locate WordPress Plugin directory.'));

	//And the same for the Content directory.
	$content_dir = $wp_filesystem->wp_content_dir();
	if( empty($content_dir) )
		return new WP_Error('fs_no_content_dir', __('Unable to locate WordPress Content directory (wp-content).'));

	$plugins_dir = trailingslashit( $plugins_dir );
	$content_dir = trailingslashit( $content_dir );

	// Get the URL to the zip file
	$r = $current->response[ $plugin ];

	if ( empty($r->package) )
		return new WP_Error('no_package', __('Upgrade package not available.'));

	// Download the package
	$package = $r->package;
	apply_filters('update_feedback', sprintf(__('Downloading update from %s'), $package));
	$download_file = download_url($package);

	if ( is_wp_error($download_file) )
		return new WP_Error('download_failed', __('Download failed.'), $download_file->get_error_message());

	$working_dir = $content_dir . 'upgrade/' . basename($plugin, '.php');

	// Clean up working directory
	if ( $wp_filesystem->is_dir($working_dir) )
		$wp_filesystem->delete($working_dir, true);

	apply_filters('update_feedback', __('Unpacking the update'));
	// Unzip package to working directory
	$result = unzip_file($download_file, $working_dir);

	// Once extracted, delete the package
	unlink($download_file);

	if ( is_wp_error($result) ) {
		$wp_filesystem->delete($working_dir, true);
		return $result;
	}

	if ( is_plugin_active($plugin) ) {
		//Deactivate the plugin silently, Prevent deactivation hooks from running.
		apply_filters('update_feedback', __('Deactivating the plugin'));
		deactivate_plugins($plugin, true);
	}

	// Remove the existing plugin.
	apply_filters('update_feedback', __('Removing the old version of the plugin'));
	$this_plugin_dir = trailingslashit( dirname($plugins_dir . $plugin) );

	// If plugin is in its own directory, recursively delete the directory.
	if ( strpos($plugin, '/') && $this_plugin_dir != $plugins_dir ) //base check on if plugin includes directory seperator AND that its not the root plugin folder
		$deleted = $wp_filesystem->delete($this_plugin_dir, true);
	else
		$deleted = $wp_filesystem->delete($plugins_dir . $plugin);

	if ( ! $deleted ) {
		$wp_filesystem->delete($working_dir, true);
		return new WP_Error('delete_failed', __('Could not remove the old plugin'));
	}

	apply_filters('update_feedback', __('Installing the latest version'));
	// Copy new version of plugin into place.
	$result = copy_dir($working_dir, $plugins_dir);
	if ( is_wp_error($result) ) {
		$wp_filesystem->delete($working_dir, true);
		return $result;
	}

	//Get a list of the directories in the working directory before we delete it, We need to know the new folder for the plugin
	$filelist = array_keys( $wp_filesystem->dirlist($working_dir) );

	// Remove working directory
	$wp_filesystem->delete($working_dir, true);

	// Force refresh of plugin update information
	delete_option('update_plugins');

	if( empty($filelist) )
		return false; //We couldnt find any files in the working dir, therefor no plugin installed? Failsafe backup.

	$folder = $filelist[0];
	$plugin = get_plugins('/' . $folder); //Ensure to pass with leading slash
	$pluginfiles = array_keys($plugin); //Assume the requested plugin is the first in the list

	return  $folder . '/' . $pluginfiles[0];
}

function wp_update_theme($theme, $feedback = '') {
	global $wp_filesystem;

	if ( !empty($feedback) )
		add_filter('update_feedback', $feedback);

	// Is an update available?
	$current = get_option( 'update_themes' );
	if ( !isset( $current->response[ $theme ] ) )
		return new WP_Error('up_to_date', __('The theme is at the latest version.'));

	$r = $current->response[ $theme ];

	$themes = get_themes();
	foreach ( (array) $themes as $this_theme ) {
		if ( $this_theme['Stylesheet'] == $theme ) {
			$theme_directory = preg_replace('!^/themes/!i', '', $this_theme['Stylesheet Dir']);
			break;
		}
	}
	unset($themes);

	if ( empty($theme_directory) )
		return new WP_Error('theme_non_existant', __('Theme does not exist.'));

	// Is a filesystem accessor setup?
	if ( ! $wp_filesystem || ! is_object($wp_filesystem) )
		WP_Filesystem();

	if ( ! is_object($wp_filesystem) )
		return new WP_Error('fs_unavailable', __('Could not access filesystem.'));

	if ( $wp_filesystem->errors->get_error_code() )
		return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors);

	//Get the base plugin folder
	$themes_dir = $wp_filesystem->wp_themes_dir();
	if ( empty($themes_dir) )
		return new WP_Error('fs_no_themes_dir', __('Unable to locate WordPress Theme directory.'));

	//And the same for the Content directory.
	$content_dir = $wp_filesystem->wp_content_dir();
	if( empty($content_dir) )
		return new WP_Error('fs_no_content_dir', __('Unable to locate WordPress Content directory (wp-content).'));

	$themes_dir = trailingslashit( $themes_dir );
	$content_dir = trailingslashit( $content_dir );

	if ( empty($r->package) )
		return new WP_Error('no_package', __('Upgrade package not available.'));

	// Download the package
	apply_filters('update_feedback', sprintf(__('Downloading update from %s'), $r['package']));
	$download_file = download_url($r['package']);

	if ( is_wp_error($download_file) )
		return new WP_Error('download_failed', __('Download failed.'), $download_file->get_error_message());

	$working_dir = $content_dir . 'upgrade/' . basename($theme_directory);

	// Clean up working directory
	if ( $wp_filesystem->is_dir($working_dir) )
		$wp_filesystem->delete($working_dir, true);

	apply_filters('update_feedback', __('Unpacking the update'));
	// Unzip package to working directory
	$result = unzip_file($download_file, $working_dir);

	// Once extracted, delete the package
	unlink($download_file);

	if ( is_wp_error($result) ) {
		$wp_filesystem->delete($working_dir, true);
		return $result;
	}

	//TODO: Is theme currently active? If so, set default theme
	/*
	if ( is_plugin_active($plugin) ) {
		//Deactivate the plugin silently, Prevent deactivation hooks from running.
		apply_filters('update_feedback', __('Deactivating the plugin'));
		deactivate_plugins($plugin, true);
	}*/

	// Remove the existing plugin.
	apply_filters('update_feedback', __('Removing the old version of the theme'));
	$deleted = $wp_filesystem->delete($themes_dir . $theme_directory, true);

	if ( ! $deleted ) {
		$wp_filesystem->delete($working_dir, true);
		return new WP_Error('delete_failed', __('Could not remove the old plugin'));
	}

	apply_filters('update_feedback', __('Installing the latest version'));
	// Copy new version of plugin into place.
	$result = copy_dir($working_dir, $themes_dir);
	if ( is_wp_error($result) ) {
		$wp_filesystem->delete($working_dir, true);
		return $result;
	}

	//Get a list of the directories in the working directory before we delete it, We need to know the new folder for the plugin
	//$filelist = array_keys( $wp_filesystem->dirlist($working_dir) );

	// Remove working directory
	$wp_filesystem->delete($working_dir, true);

	// Force refresh of plugin update information
	delete_option('update_themes');

	/*if( empty($filelist) )
		return false; //We couldnt find any files in the working dir, therefor no plugin installed? Failsafe backup.

	$folder = $filelist[0];
	$plugin = get_plugins('/' . $folder); //Ensure to pass with leading slash
	$pluginfiles = array_keys($plugin); //Assume the requested plugin is the first in the list

	return  $folder . '/' . $pluginfiles[0];*/
}


function wp_update_core($current, $feedback = '') {
	global $wp_filesystem;

	@set_time_limit( 300 );

	if ( !empty($feedback) )
		add_filter('update_feedback', $feedback);

	// Is an update available?
	if ( !isset( $current->response ) || $current->response == 'latest' )
		return new WP_Error('up_to_date', __('WordPress is at the latest version.'));

	// Is a filesystem accessor setup?
	if ( ! $wp_filesystem || ! is_object($wp_filesystem) )
		WP_Filesystem();

	if ( ! is_object($wp_filesystem) )
		return new WP_Error('fs_unavailable', __('Could not access filesystem.'));

	if ( $wp_filesystem->errors->get_error_code() )
		return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors);

	// Get the base WP folder
	$wp_dir = $wp_filesystem->abspath();
	if ( empty($wp_dir) )
		return new WP_Error('fs_no_wp_dir', __('Unable to locate WordPress directory.'));

	// And the same for the Content directory.
	$content_dir = $wp_filesystem->wp_content_dir();
	if( empty($content_dir) )
		return new WP_Error('fs_no_content_dir', __('Unable to locate WordPress Content directory (wp-content).'));

	$wp_dir = trailingslashit( $wp_dir );
	$content_dir = trailingslashit( $content_dir );

	// Get the URL to the zip file
	$package = $current->package;

	// Download the package
	apply_filters('update_feedback', sprintf(__('Downloading update from %s'), $package));
	$download_file = download_url($package);

	if ( is_wp_error($download_file) )
		return new WP_Error('download_failed', __('Download failed.'), $download_file->get_error_message());

	$working_dir = $content_dir . 'upgrade/core';
	// Clean up working directory
	if ( $wp_filesystem->is_dir($working_dir) ) {
		$wp_filesystem->delete($working_dir, true);
	}

	apply_filters('update_feedback', __('Unpacking the core update'));
	// Unzip package to working directory
	$result = unzip_file($download_file, $working_dir);
	// Once extracted, delete the package
	unlink($download_file);

	if ( is_wp_error($result) ) {
		$wp_filesystem->delete($working_dir, true);
		return $result;
	}

	// Copy update-core.php from the new version into place.
	if ( !$wp_filesystem->copy($working_dir . '/wordpress/wp-admin/includes/update-core.php', $wp_dir . 'wp-admin/includes/update-core.php', true) ) {
		$wp_filesystem->delete($working_dir, true);
		return new WP_Error('copy_failed', __('Could not copy files'));
	}
	$wp_filesystem->chmod($wp_dir . 'wp-admin/includes/update-core.php', FS_CHMOD_FILE);

	require(ABSPATH . 'wp-admin/includes/update-core.php');

	return update_core($working_dir, $wp_dir);
}

function maintenance_nag() {
	global $upgrading;
	if ( ! isset( $upgrading ) )
		return false;

	if ( current_user_can('manage_options') )
		$msg = sprintf( __('An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.'), 'update-core.php' );
	else
		$msg = __('An automated WordPress update has failed to complete! Please notify the site administrator.');

	echo "<div id='update-nag'>$msg</div>";
}
add_action( 'admin_notices', 'maintenance_nag' );

?>
                                                                                                                                                                                                                                                                              wp-admin/includes/upgrade.php                                                                       0000755 0023422 0004734 00000151157 11120046726 017300  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress Upgrade API
 *
 * Most of the functions are pluggable and can be overwritten 
 *
 * @package WordPress
 * @subpackage Administration
 */

/** Include user install customize script. */
if ( file_exists(WP_CONTENT_DIR . '/install.php') )
	require (WP_CONTENT_DIR . '/install.php');

/** WordPress Administration API */
require_once(ABSPATH . 'wp-admin/includes/admin.php');

/** WordPress Schema API */
require_once(ABSPATH . 'wp-admin/includes/schema.php');

if ( !function_exists('wp_install') ) :
/**
 * {@internal Missing Short Description}}
 *
 * {@internal Missing Long Description}}
 *
 * @since unknown
 *
 * @param string $blog_title Blog title.
 * @param string $user_name User's username.
 * @param string $user_email User's email.
 * @param bool $public Whether blog is public.
 * @param null $deprecated Optional. Not used.
 * @return array Array keys 'url', 'user_id', 'password'.
 */
function wp_install($blog_title, $user_name, $user_email, $public, $deprecated='') {
	global $wp_rewrite;

	wp_check_mysql_version();
	wp_cache_flush();
	make_db_current_silent();
	populate_options();
	populate_roles();

	update_option('blogname', $blog_title);
	update_option('admin_email', $user_email);
	update_option('blog_public', $public);

	$guessurl = wp_guess_url();

	update_option('siteurl', $guessurl);

	// If not a public blog, don't ping.
	if ( ! $public )
		update_option('default_pingback_flag', 0);

	// Create default user.  If the user already exists, the user tables are
	// being shared among blogs.  Just set the role in that case.
	$user_id = username_exists($user_name);
	if ( !$user_id ) {
		$random_password = wp_generate_password();
		$user_id = wp_create_user($user_name, $random_password, $user_email);
	} else {
		$random_password = __('User already exists.  Password inherited.');
	}

	$user = new WP_User($user_id);
	$user->set_role('administrator');

	wp_install_defaults($user_id);

	$wp_rewrite->flush_rules();

	wp_new_blog_notification($blog_title, $guessurl, $user_id, $random_password);

	wp_cache_flush();

	return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $random_password);
}
endif;

if ( !function_exists('wp_install_defaults') ) :
/**
 * {@internal Missing Short Description}}
 *
 * {@internal Missing Long Description}}
 *
 * @since unknown
 *
 * @param int $user_id User ID.
 */
function wp_install_defaults($user_id) {
	global $wpdb;

	// Default category
	$cat_name = $wpdb->escape(__('Uncategorized'));
	$cat_slug = sanitize_title(_c('Uncategorized|Default category slug'));
	$wpdb->query("INSERT INTO $wpdb->terms (name, slug, term_group) VALUES ('$cat_name', '$cat_slug', '0')");
	$wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('1', 'category', '', '0', '1')");

	// Default link category
	$cat_name = $wpdb->escape(__('Blogroll'));
	$cat_slug = sanitize_title(_c('Blogroll|Default link category slug'));
	$wpdb->query("INSERT INTO $wpdb->terms (name, slug, term_group) VALUES ('$cat_name', '$cat_slug', '0')");
	$wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('2', 'link_category', '', '0', '7')");

	// Now drop in some default links
	$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://doku.wordpress-deutschland.org/', 'Dokumentation', 0, '', '');");
	$wpdb->query( "INSERT INTO $wpdb->term_relationships (`object_id`, `term_taxonomy_id`) VALUES (1, 2)" );

	$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://blog.wordpress-deutschland.org/', 'News-Blog', 0, 'http://blog.wordpress-deutschland.org/feed/', '');");
	$wpdb->query( "INSERT INTO $wpdb->term_relationships (`object_id`, `term_taxonomy_id`) VALUES (2, 2)" );

	$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://faq.wordpress-deutschland.org/', 'FAQ', 0, '', '');");
	$wpdb->query( "INSERT INTO $wpdb->term_relationships (`object_id`, `term_taxonomy_id`) VALUES (3, 2)" );

	$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://forum.wordpress-deutschland.org/', 'Support-Forum', 0, '', '');");
	$wpdb->query( "INSERT INTO $wpdb->term_relationships (`object_id`, `term_taxonomy_id`) VALUES (4, 2)" );

	$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://blogmap.wordpress-deutschland.org/', 'Blogmap', 0, '', '');");
	$wpdb->query( "INSERT INTO $wpdb->term_relationships (`object_id`, `term_taxonomy_id`) VALUES (5, 2)" );

	$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://themes.wordpress-deutschland.org/', 'Themepool', 0, '', '');");
	$wpdb->query( "INSERT INTO $wpdb->term_relationships (`object_id`, `term_taxonomy_id`) VALUES (6, 2)" );

	$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://planet.wordpress-deutschland.org/', 'WordPress-Planet', 0, '', '');");
	$wpdb->query( "INSERT INTO $wpdb->term_relationships (`object_id`, `term_taxonomy_id`) VALUES (7, 2)" );

    // Pingdienste
    $wpdb->query("INSERT INTO $wpdb->options VALUES (41, 0, 'ping_sites', 'http://ping.wordblog.de/\r\nhttp://rpc.pingomatic.com/', 'yes');");

	// First post
	$now = date('Y-m-d H:i:s');
	$now_gmt = gmdate('Y-m-d H:i:s');
	$first_post_guid = get_option('home') . '/?p=1';
	$wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, guid, comment_count, to_ping, pinged, post_content_filtered) VALUES ($user_id, '$now', '$now_gmt', '".$wpdb->escape(__('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!'))."', '', '".$wpdb->escape(__('Hello world!'))."', '0', '".$wpdb->escape(_c('hello-world|Default post slug'))."', '$now', '$now_gmt', '$first_post_guid', '1', '', '', '')");
	$wpdb->query( "INSERT INTO $wpdb->term_relationships (`object_id`, `term_taxonomy_id`) VALUES (1, 1)" );

	// Default comment
	$wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_date, comment_date_gmt, comment_content) VALUES ('1', '".$wpdb->escape(__('Mr WordPress'))."', '', 'http://wordpress.org/', '$now', '$now_gmt', '".$wpdb->escape(__('Hi, this is a comment.<br />To delete a comment, just log in and view the post&#039;s comments. There you will have the option to edit or delete them.'))."')");

	// First Page
	$first_post_guid = get_option('home') . '/?page_id=2';
	$wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, guid, post_status, post_type, to_ping, pinged, post_content_filtered) VALUES ($user_id, '$now', '$now_gmt', '".$wpdb->escape(__('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'))."', '', '".$wpdb->escape(__('About'))."', '0', '".$wpdb->escape(_c('about|Default page slug'))."', '$now', '$now_gmt','$first_post_guid', 'publish', 'page', '', '', '')");
}
endif;

if ( !function_exists('wp_new_blog_notification') ) :
/**
 * {@internal Missing Short Description}}
 *
 * {@internal Missing Long Description}}
 *
 * @since unknown
 *
 * @param string $blog_title Blog title.
 * @param string $blog_url Blog url.
 * @param int $user_id User ID.
 * @param string $password User's Password.
 */
function wp_new_blog_notification($blog_title, $blog_url, $user_id, $password) {
	$user = new WP_User($user_id);
	$email = $user->user_email;
	$name = $user->user_login;
	$message_headers = 'From: "' . $blog_title . '" <wordpress@' . $_SERVER['SERVER_NAME'] . '>';
	$message = sprintf(__("Your new WordPress blog has been successfully set up at:

%1\$s

You can log in to the administrator account with the following information:

Username: %2\$s
Password: %3\$s

We hope you enjoy your new blog. Thanks!

--The WordPress Team
http://wordpress.org/
"), $blog_url, $name, $password);

	@wp_mail($email, __('New WordPress Blog'), $message, $message_headers);
}
endif;

if ( !function_exists('wp_upgrade') ) :
/**
 * Run WordPress Upgrade functions.
 *
 * {@internal Missing Long Description}}
 *
 * @since unknown
 *
 * @return null
 */
function wp_upgrade() {
	global $wp_current_db_version, $wp_db_version;

	$wp_current_db_version = __get_option('db_version');

	// We are up-to-date.  Nothing to do.
	if ( $wp_db_version == $wp_current_db_version )
		return;

	if( ! is_blog_installed() )
		return;

	wp_check_mysql_version();
	wp_cache_flush();
	make_db_current_silent();
	upgrade_all();
	wp_cache_flush();
}
endif;

/**
 * Functions to be called in install and upgrade scripts.
 *
 * {@internal Missing Long Description}}
 *
 * @since unknown
 */
function upgrade_all() {
	global $wp_current_db_version, $wp_db_version, $wp_rewrite;
	$wp_current_db_version = __get_option('db_version');

	// We are up-to-date.  Nothing to do.
	if ( $wp_db_version == $wp_current_db_version )
		return;

	// If the version is not set in the DB, try to guess the version.
	if ( empty($wp_current_db_version) ) {
		$wp_current_db_version = 0;

		// If the template option exists, we have 1.5.
		$template = __get_option('template');
		if ( !empty($template) )
			$wp_current_db_version = 2541;
	}

	if ( $wp_current_db_version < 6039 )
		upgrade_230_options_table();

	populate_options();

	if ( $wp_current_db_version < 2541 ) {
		upgrade_100();
		upgrade_101();
		upgrade_110();
		upgrade_130();
	}

	if ( $wp_current_db_version < 3308 )
		upgrade_160();

	if ( $wp_current_db_version < 4772 )
		upgrade_210();

	if ( $wp_current_db_version < 4351 )
		upgrade_old_slugs();

	if ( $wp_current_db_version < 5539 )
		upgrade_230();

	if ( $wp_current_db_version < 6124 )
		upgrade_230_old_tables();

	if ( $wp_current_db_version < 7499 )
		upgrade_250();

	if ( $wp_current_db_version < 7796 )
		upgrade_251();

	if ( $wp_current_db_version < 7935 )
		upgrade_252();

	if ( $wp_current_db_version < 8201 )
		upgrade_260();

	if ( $wp_current_db_version < 8989 )
		upgrade_270();

	maybe_disable_automattic_widgets();

	$wp_rewrite->flush_rules();

	update_option('db_version', $wp_db_version);
}

/**
 * Execute changes made in WordPress 1.0.
 *
 * @since 1.0.0
 */
function upgrade_100() {
	global $wpdb;

	// Get the title and ID of every post, post_name to check if it already has a value
	$posts = $wpdb->get_results("SELECT ID, post_title, post_name FROM $wpdb->posts WHERE post_name = ''");
	if ($posts) {
		foreach($posts as $post) {
			if ('' == $post->post_name) {
				$newtitle = sanitize_title($post->post_title);
				$wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_name = %s WHERE ID = %d", $newtitle, $post->ID) );
			}
		}
	}

	$categories = $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename FROM $wpdb->categories");
	foreach ($categories as $category) {
		if ('' == $category->category_nicename) {
			$newtitle = sanitize_title($category->cat_name);
			$wpdb->query( $wpdb->prepare("UPDATE $wpdb->categories SET category_nicename = %s WHERE cat_ID = %d", $newtitle, $category->cat_ID) );
		}
	}

	$wpdb->query("UPDATE $wpdb->options SET option_value = REPLACE(option_value, 'wp-links/links-images/', 'wp-images/links/')
	WHERE option_name LIKE 'links_rating_image%'
	AND option_value LIKE 'wp-links/links-images/%'");

	$done_ids = $wpdb->get_results("SELECT DISTINCT post_id FROM $wpdb->post2cat");
	if ($done_ids) :
		foreach ($done_ids as $done_id) :
			$done_posts[] = $done_id->post_id;
		endforeach;
		$catwhere = ' AND ID NOT IN (' . implode(',', $done_posts) . ')';
	else:
		$catwhere = '';
	endif;

	$allposts = $wpdb->get_results("SELECT ID, post_category FROM $wpdb->posts WHERE post_category != '0' $catwhere");
	if ($allposts) :
		foreach ($allposts as $post) {
			// Check to see if it's already been imported
			$cat = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->post2cat WHERE post_id = %d AND category_id = %d", $post->ID, $post->post_category) );
			if (!$cat && 0 != $post->post_category) { // If there's no result
				$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->post2cat
					(post_id, category_id)
					VALUES (%s, %s)
					", $post->ID, $post->post_category) );
			}
		}
	endif;
}

/**
 * Execute changes made in WordPress 1.0.1.
 *
 * @since 1.0.1
 */
function upgrade_101() {
	global $wpdb;

	// Clean up indices, add a few
	add_clean_index($wpdb->posts, 'post_name');
	add_clean_index($wpdb->posts, 'post_status');
	add_clean_index($wpdb->categories, 'category_nicename');
	add_clean_index($wpdb->comments, 'comment_approved');
	add_clean_index($wpdb->comments, 'comment_post_ID');
	add_clean_index($wpdb->links , 'link_category');
	add_clean_index($wpdb->links , 'link_visible');
}

/**
 * Execute changes made in WordPress 1.2.
 *
 * @since 1.2.0
 */
function upgrade_110() {
	global $wpdb;

	// Set user_nicename.
	$users = $wpdb->get_results("SELECT ID, user_nickname, user_nicename FROM $wpdb->users");
	foreach ($users as $user) {
		if ('' == $user->user_nicename) {
			$newname = sanitize_title($user->user_nickname);
			$wpdb->query( $wpdb->prepare("UPDATE $wpdb->users SET user_nicename = %s WHERE ID = %d", $newname, $user->ID) );
		}
	}

	$users = $wpdb->get_results("SELECT ID, user_pass from $wpdb->users");
	foreach ($users as $row) {
		if (!preg_match('/^[A-Fa-f0-9]{32}$/', $row->user_pass)) {
			$wpdb->query('UPDATE '.$wpdb->users.' SET user_pass = MD5(\''.$row->user_pass.'\') WHERE ID = \''.$row->ID.'\'');
		}
	}

	// Get the GMT offset, we'll use that later on
	$all_options = get_alloptions_110();

	$time_difference = $all_options->time_difference;

	$server_time = time()+date('Z');
	$weblogger_time = $server_time + $time_difference*3600;
	$gmt_time = time();

	$diff_gmt_server = ($gmt_time - $server_time) / 3600;
	$diff_weblogger_server = ($weblogger_time - $server_time) / 3600;
	$diff_gmt_weblogger = $diff_gmt_server - $diff_weblogger_server;
	$gmt_offset = -$diff_gmt_weblogger;

	// Add a gmt_offset option, with value $gmt_offset
	add_option('gmt_offset', $gmt_offset);

	// Check if we already set the GMT fields (if we did, then
	// MAX(post_date_gmt) can't be '0000-00-00 00:00:00'
	// <michel_v> I just slapped myself silly for not thinking about it earlier
	$got_gmt_fields = ($wpdb->get_var("SELECT MAX(post_date_gmt) FROM $wpdb->posts") == '0000-00-00 00:00:00') ? false : true;

	if (!$got_gmt_fields) {

		// Add or substract time to all dates, to get GMT dates
		$add_hours = intval($diff_gmt_weblogger);
		$add_minutes = intval(60 * ($diff_gmt_weblogger - $add_hours));
		$wpdb->query("UPDATE $wpdb->posts SET post_date_gmt = DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)");
		$wpdb->query("UPDATE $wpdb->posts SET post_modified = post_date");
		$wpdb->query("UPDATE $wpdb->posts SET post_modified_gmt = DATE_ADD(post_modified, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE) WHERE post_modified != '0000-00-00 00:00:00'");
		$wpdb->query("UPDATE $wpdb->comments SET comment_date_gmt = DATE_ADD(comment_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)");
		$wpdb->query("UPDATE $wpdb->users SET user_registered = DATE_ADD(user_registered, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)");
	}

}

/**
 * Execute changes made in WordPress 1.5.
 *
 * @since 1.5.0
 */
function upgrade_130() {
	global $wpdb;

	// Remove extraneous backslashes.
	$posts = $wpdb->get_results("SELECT ID, post_title, post_content, post_excerpt, guid, post_date, post_name, post_status, post_author FROM $wpdb->posts");
	if ($posts) {
		foreach($posts as $post) {
			$post_content = addslashes(deslash($post->post_content));
			$post_title = addslashes(deslash($post->post_title));
			$post_excerpt = addslashes(deslash($post->post_excerpt));
			if ( empty($post->guid) )
				$guid = get_permalink($post->ID);
			else
				$guid = $post->guid;

			$wpdb->query("UPDATE $wpdb->posts SET post_title = '$post_title', post_content = '$post_content', post_excerpt = '$post_excerpt', guid = '$guid' WHERE ID = '$post->ID'");
		}
	}

	// Remove extraneous backslashes.
	$comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_content FROM $wpdb->comments");
	if ($comments) {
		foreach($comments as $comment) {
			$comment_content = addslashes(deslash($comment->comment_content));
			$comment_author = addslashes(deslash($comment->comment_author));
			$wpdb->query("UPDATE $wpdb->comments SET comment_content = '$comment_content', comment_author = '$comment_author' WHERE comment_ID = '$comment->comment_ID'");
		}
	}

	// Remove extraneous backslashes.
	$links = $wpdb->get_results("SELECT link_id, link_name, link_description FROM $wpdb->links");
	if ($links) {
		foreach($links as $link) {
			$link_name = addslashes(deslash($link->link_name));
			$link_description = addslashes(deslash($link->link_description));
			$wpdb->query("UPDATE $wpdb->links SET link_name = '$link_name', link_description = '$link_description' WHERE link_id = '$link->link_id'");
		}
	}

	// The "paged" option for what_to_show is no more.
	if ($wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'what_to_show'") == 'paged') {
		$wpdb->query("UPDATE $wpdb->options SET option_value = 'posts' WHERE option_name = 'what_to_show'");
	}

	$active_plugins = __get_option('active_plugins');

	// If plugins are not stored in an array, they're stored in the old
	// newline separated format.  Convert to new format.
	if ( !is_array( $active_plugins ) ) {
		$active_plugins = explode("\n", trim($active_plugins));
		update_option('active_plugins', $active_plugins);
	}

	// Obsolete tables
	$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optionvalues');
	$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optiontypes');
	$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optiongroups');
	$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optiongroup_options');

	// Update comments table to use comment_type
	$wpdb->query("UPDATE $wpdb->comments SET comment_type='trackback', comment_content = REPLACE(comment_content, '<trackback />', '') WHERE comment_content LIKE '<trackback />%'");
	$wpdb->query("UPDATE $wpdb->comments SET comment_type='pingback', comment_content = REPLACE(comment_content, '<pingback />', '') WHERE comment_content LIKE '<pingback />%'");

	// Some versions have multiple duplicate option_name rows with the same values
	$options = $wpdb->get_results("SELECT option_name, COUNT(option_name) AS dupes FROM `$wpdb->options` GROUP BY option_name");
	foreach ( $options as $option ) {
		if ( 1 != $option->dupes ) { // Could this be done in the query?
			$limit = $option->dupes - 1;
			$dupe_ids = $wpdb->get_col( $wpdb->prepare("SELECT option_id FROM $wpdb->options WHERE option_name = %s LIMIT %d", $option->option_name, $limit) );
			$dupe_ids = join($dupe_ids, ',');
			$wpdb->query("DELETE FROM $wpdb->options WHERE option_id IN ($dupe_ids)");
		}
	}

	make_site_theme();
}

/**
 * Execute changes made in WordPress 2.0.
 *
 * @since 2.0.0
 */
function upgrade_160() {
	global $wpdb, $wp_current_db_version;

	populate_roles_160();

	$users = $wpdb->get_results("SELECT * FROM $wpdb->users");
	foreach ( $users as $user ) :
		if ( !empty( $user->user_firstname ) )
			update_usermeta( $user->ID, 'first_name', $wpdb->escape($user->user_firstname) );
		if ( !empty( $user->user_lastname ) )
			update_usermeta( $user->ID, 'last_name', $wpdb->escape($user->user_lastname) );
		if ( !empty( $user->user_nickname ) )
			update_usermeta( $user->ID, 'nickname', $wpdb->escape($user->user_nickname) );
		if ( !empty( $user->user_level ) )
			update_usermeta( $user->ID, $wpdb->prefix . 'user_level', $user->user_level );
		if ( !empty( $user->user_icq ) )
			update_usermeta( $user->ID, 'icq', $wpdb->escape($user->user_icq) );
		if ( !empty( $user->user_aim ) )
			update_usermeta( $user->ID, 'aim', $wpdb->escape($user->user_aim) );
		if ( !empty( $user->user_msn ) )
			update_usermeta( $user->ID, 'msn', $wpdb->escape($user->user_msn) );
		if ( !empty( $user->user_yim ) )
			update_usermeta( $user->ID, 'yim', $wpdb->escape($user->user_icq) );
		if ( !empty( $user->user_description ) )
			update_usermeta( $user->ID, 'description', $wpdb->escape($user->user_description) );

		if ( isset( $user->user_idmode ) ):
			$idmode = $user->user_idmode;
			if ($idmode == 'nickname') $id = $user->user_nickname;
			if ($idmode == 'login') $id = $user->user_login;
			if ($idmode == 'firstname') $id = $user->user_firstname;
			if ($idmode == 'lastname') $id = $user->user_lastname;
			if ($idmode == 'namefl') $id = $user->user_firstname.' '.$user->user_lastname;
			if ($idmode == 'namelf') $id = $user->user_lastname.' '.$user->user_firstname;
			if (!$idmode) $id = $user->user_nickname;
			$wpdb->query( $wpdb->prepare("UPDATE $wpdb->users SET display_name = %s WHERE ID = %d", $id, $user->ID) );
		endif;

		// FIXME: RESET_CAPS is temporary code to reset roles and caps if flag is set.
		$caps = get_usermeta( $user->ID, $wpdb->prefix . 'capabilities');
		if ( empty($caps) || defined('RESET_CAPS') ) {
			$level = get_usermeta($user->ID, $wpdb->prefix . 'user_level');
			$role = translate_level_to_role($level);
			update_usermeta( $user->ID, $wpdb->prefix . 'capabilities', array($role => true) );
		}

	endforeach;
	$old_user_fields = array( 'user_firstname', 'user_lastname', 'user_icq', 'user_aim', 'user_msn', 'user_yim', 'user_idmode', 'user_ip', 'user_domain', 'user_browser', 'user_description', 'user_nickname', 'user_level' );
	$wpdb->hide_errors();
	foreach ( $old_user_fields as $old )
		$wpdb->query("ALTER TABLE $wpdb->users DROP $old");
	$wpdb->show_errors();

	// populate comment_count field of posts table
	$comments = $wpdb->get_results( "SELECT comment_post_ID, COUNT(*) as c FROM $wpdb->comments WHERE comment_approved = '1' GROUP BY comment_post_ID" );
	if( is_array( $comments ) ) {
		foreach ($comments as $comment) {
			$wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET comment_count = %d WHERE ID = %d", $comment->c, $comment->comment_post_ID) );
		}
	}

	// Some alpha versions used a post status of object instead of attachment and put
	// the mime type in post_type instead of post_mime_type.
	if ( $wp_current_db_version > 2541 && $wp_current_db_version <= 3091 ) {
		$objects = $wpdb->get_results("SELECT ID, post_type FROM $wpdb->posts WHERE post_status = 'object'");
		foreach ($objects as $object) {
			$wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_status = 'attachment',
			post_mime_type = %s,
			post_type = ''
			WHERE ID = %d", $object->post_type, $object->ID) );

			$meta = get_post_meta($object->ID, 'imagedata', true);
			if ( ! empty($meta['file']) )
				update_attached_file( $object->ID, $meta['file'] );
		}
	}
}

/**
 * Execute changes made in WordPress 2.1.
 *
 * @since 2.1.0
 */
function upgrade_210() {
	global $wpdb, $wp_current_db_version;

	if ( $wp_current_db_version < 3506 ) {
		// Update status and type.
		$posts = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts");

		if ( ! empty($posts) ) foreach ($posts as $post) {
			$status = $post->post_status;
			$type = 'post';

			if ( 'static' == $status ) {
				$status = 'publish';
				$type = 'page';
			} else if ( 'attachment' == $status ) {
				$status = 'inherit';
				$type = 'attachment';
			}

			$wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_status = %s, post_type = %s WHERE ID = %d", $status, $type, $post->ID) );
		}
	}

	if ( $wp_current_db_version < 3845 ) {
		populate_roles_210();
	}

	if ( $wp_current_db_version < 3531 ) {
		// Give future posts a post_status of future.
		$now = gmdate('Y-m-d H:i:59');
		$wpdb->query ("UPDATE $wpdb->posts SET post_status = 'future' WHERE post_status = 'publish' AND post_date_gmt > '$now'");

		$posts = $wpdb->get_results("SELECT ID, post_date FROM $wpdb->posts WHERE post_status ='future'");
		if ( !empty($posts) )
			foreach ( $posts as $post )
				wp_schedule_single_event(mysql2date('U', $post->post_date), 'publish_future_post', array($post->ID));
	}
}

/**
 * Execute changes made in WordPress 2.3.
 *
 * @since 2.3.0
 */
function upgrade_230() {
	global $wp_current_db_version, $wpdb;

	if ( $wp_current_db_version < 5200 ) {
		populate_roles_230();
	}

	// Convert categories to terms.
	$tt_ids = array();
	$have_tags = false;
	$categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_ID");
	foreach ($categories as $category) {
		$term_id = (int) $category->cat_ID;
		$name = $category->cat_name;
		$description = $category->category_description;
		$slug = $category->category_nicename;
		$parent = $category->category_parent;
		$term_group = 0;

		// Associate terms with the same slug in a term group and make slugs unique.
		if ( $exists = $wpdb->get_results( $wpdb->prepare("SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug) ) ) {
			$term_group = $exists[0]->term_group;
			$id = $exists[0]->term_id;
			$num = 2;
			do {
				$alt_slug = $slug . "-$num";
				$num++;
				$slug_check = $wpdb->get_var( $wpdb->prepare("SELECT slug FROM $wpdb->terms WHERE slug = %s", $alt_slug) );
			} while ( $slug_check );

			$slug = $alt_slug;

			if ( empty( $term_group ) ) {
				$term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms GROUP BY term_group") + 1;
				$wpdb->query( $wpdb->prepare("UPDATE $wpdb->terms SET term_group = %d WHERE term_id = %d", $term_group, $id) );
			}
		}

		$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->terms (term_id, name, slug, term_group) VALUES
		(%d, %s, %s, %d)", $term_id, $name, $slug, $term_group) );

		$count = 0;
		if ( !empty($category->category_count) ) {
			$count = (int) $category->category_count;
			$taxonomy = 'category';
			$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count) );
			$tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id;
		}

		if ( !empty($category->link_count) ) {
			$count = (int) $category->link_count;
			$taxonomy = 'link_category';
			$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count) );
			$tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id;
		}

		if ( !empty($category->tag_count) ) {
			$have_tags = true;
			$count = (int) $category->tag_count;
			$taxonomy = 'post_tag';
			$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count) );
			$tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id;
		}

		if ( empty($count) ) {
			$count = 0;
			$taxonomy = 'category';
			$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count) );
			$tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id;
		}
	}

	$select = 'post_id, category_id';
	if ( $have_tags )
		$select .= ', rel_type';

	$posts = $wpdb->get_results("SELECT $select FROM $wpdb->post2cat GROUP BY post_id, category_id");
	foreach ( $posts as $post ) {
		$post_id = (int) $post->post_id;
		$term_id = (int) $post->category_id;
		$taxonomy = 'category';
		if ( !empty($post->rel_type) && 'tag' == $post->rel_type)
			$taxonomy = 'tag';
		$tt_id = $tt_ids[$term_id][$taxonomy];
		if ( empty($tt_id) )
			continue;

		$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ( %d, %d)", $post_id, $tt_id) );
	}

	// < 3570 we used linkcategories.  >= 3570 we used categories and link2cat.
	if ( $wp_current_db_version < 3570 ) {
		// Create link_category terms for link categories.  Create a map of link cat IDs
		// to link_category terms.
		$link_cat_id_map = array();
		$default_link_cat = 0;
		$tt_ids = array();
		$link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM " . $wpdb->prefix . 'linkcategories');
		foreach ( $link_cats as $category) {
			$cat_id = (int) $category->cat_id;
			$term_id = 0;
			$name = $wpdb->escape($category->cat_name);
			$slug = sanitize_title($name);
			$term_group = 0;

			// Associate terms with the same slug in a term group and make slugs unique.
			if ( $exists = $wpdb->get_results( $wpdb->prepare("SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug) ) ) {
				$term_group = $exists[0]->term_group;
				$term_id = $exists[0]->term_id;
			}

			if ( empty($term_id) ) {
				$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->terms (name, slug, term_group) VALUES (%s, %s, %d)", $name, $slug, $term_group) );
				$term_id = (int) $wpdb->insert_id;
			}

			$link_cat_id_map[$cat_id] = $term_id;
			$default_link_cat = $term_id;

			$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES (%d, 'link_category', '', '0', '0')", $term_id) );
			$tt_ids[$term_id] = (int) $wpdb->insert_id;
		}

		// Associate links to cats.
		$links = $wpdb->get_results("SELECT link_id, link_category FROM $wpdb->links");
		if ( !empty($links) ) foreach ( $links as $link ) {
			if ( 0 == $link->link_category )
				continue;
			if ( ! isset($link_cat_id_map[$link->link_category]) )
				continue;
			$term_id = $link_cat_id_map[$link->link_category];
			$tt_id = $tt_ids[$term_id];
			if ( empty($tt_id) )
				continue;

			$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ( %d, %d)", $link->link_id, $tt_id) );
		}

		// Set default to the last category we grabbed during the upgrade loop.
		update_option('default_link_category', $default_link_cat);
	} else {
		$links = $wpdb->get_results("SELECT link_id, category_id FROM $wpdb->link2cat GROUP BY link_id, category_id");
		foreach ( $links as $link ) {
			$link_id = (int) $link->link_id;
			$term_id = (int) $link->category_id;
			$taxonomy = 'link_category';
			$tt_id = $tt_ids[$term_id][$taxonomy];
			if ( empty($tt_id) )
				continue;

			$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ( %d, %d)", $link_id, $tt_id) );
		}
	}

	if ( $wp_current_db_version < 4772 ) {
		// Obsolete linkcategories table
		$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'linkcategories');
	}

	// Recalculate all counts
	$terms = $wpdb->get_results("SELECT term_taxonomy_id, taxonomy FROM $wpdb->term_taxonomy");
	foreach ( (array) $terms as $term ) {
		if ( ('post_tag' == $term->taxonomy) || ('category' == $term->taxonomy) )
			$count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status = 'publish' AND post_type = 'post' AND term_taxonomy_id = %d", $term->term_taxonomy_id) );
		else
			$count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term->term_taxonomy_id) );
		$wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET count = %d WHERE term_taxonomy_id = %d", $count, $term->term_taxonomy_id) );
	}
}

/**
 * Remove old options from the database.
 *
 * @since 2.3.0
 */
function upgrade_230_options_table() {
	global $wpdb;
	$old_options_fields = array( 'option_can_override', 'option_type', 'option_width', 'option_height', 'option_description', 'option_admin_level' );
	$wpdb->hide_errors();
	foreach ( $old_options_fields as $old )
		$wpdb->query("ALTER TABLE $wpdb->options DROP $old");
	$wpdb->show_errors();
}

/**
 * Remove old categories, link2cat, and post2cat database tables.
 *
 * @since 2.3.0
 */
function upgrade_230_old_tables() {
	global $wpdb;
	$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'categories');
	$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'link2cat');
	$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'post2cat');
}

/**
 * Upgrade old slugs made in version 2.2.
 *
 * @since 2.2.0
 */
function upgrade_old_slugs() {
	// upgrade people who were using the Redirect Old Slugs plugin
	global $wpdb;
	$wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '_wp_old_slug' WHERE meta_key = 'old_slug'");
}

/**
 * Execute changes made in WordPress 2.5.0.
 *
 * @since 2.5.0
 */
function upgrade_250() {
	global $wp_current_db_version;

	if ( $wp_current_db_version < 6689 ) {
		populate_roles_250();
	}

}

/**
 * Execute changes made in WordPress 2.5.1.
 *
 * @since 2.5.1
 */
function upgrade_251() {
	global $wp_current_db_version;

	// Make the secret longer
	update_option('secret', wp_generate_password(64));
}

/**
 * Execute changes made in WordPress 2.5.2.
 *
 * @since 2.5.2
 */
function upgrade_252() {
	global $wpdb;

	$wpdb->query("UPDATE $wpdb->users SET user_activation_key = ''");
}

/**
 * Execute changes made in WordPress 2.6.
 *
 * @since 2.6.0
 */
function upgrade_260() {
	global $wp_current_db_version;

	if ( $wp_current_db_version < 8000 )
		populate_roles_260();

	if ( $wp_current_db_version < 8201 ) {
		update_option('enable_app', 1);
		update_option('enable_xmlrpc', 1);
	}
}

/**
 * Execute changes made in WordPress 2.7.
 *
 * @since 2.7.0
 */
function upgrade_270() {
	global $wpdb, $wp_current_db_version;

	if ( $wp_current_db_version < 8980 )
		populate_roles_270();

	// Update post_date for unpublished posts with empty timestamp
	if ( $wp_current_db_version < 8921 )
		$wpdb->query( "UPDATE $wpdb->posts SET post_date = post_modified WHERE post_date = '0000-00-00 00:00:00'" );
}


// The functions we use to actually do stuff

// General

/**
 * {@internal Missing Short Description}}
 *
 * {@internal Missing Long Description}}
 *
 * @since unknown
 *
 * @param string $table_name Database table name to create.
 * @param string $create_ddl SQL statement to create table.
 * @return bool If table already exists or was created by function.
 */
function maybe_create_table($table_name, $create_ddl) {
	global $wpdb;
	foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
		if ($table == $table_name) {
			return true;
		}
	}
	//didn't find it try to create it.
	$q = $wpdb->query($create_ddl);
	// we cannot directly tell that whether this succeeded!
	foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
		if ($table == $table_name) {
			return true;
		}
	}
	return false;
}

/**
 * {@internal Missing Short Description}}
 *
 * {@internal Missing Long Description}}
 *
 * @since unknown
 *
 * @param string $table Database table name.
 * @param string $index Index name to drop.
 * @return bool True, when finished.
 */
function drop_index($table, $index) {
	global $wpdb;
	$wpdb->hide_errors();
	$wpdb->query("ALTER TABLE `$table` DROP INDEX `$index`");
	// Now we need to take out all the extra ones we may have created
	for ($i = 0; $i < 25; $i++) {
		$wpdb->query("ALTER TABLE `$table` DROP INDEX `{$index}_$i`");
	}
	$wpdb->show_errors();
	return true;
}

/**
 * {@internal Missing Short Description}}
 *
 * {@internal Missing Long Description}}
 *
 * @since unknown
 *
 * @param string $table Database table name.
 * @param string $index Database table index column.
 * @return bool True, when done with execution.
 */
function add_clean_index($table, $index) {
	global $wpdb;
	drop_index($table, $index);
	$wpdb->query("ALTER TABLE `$table` ADD INDEX ( `$index` )");
	return true;
}

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl) {
	global $wpdb, $debug;
	foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
		if ($debug) echo("checking $column == $column_name<br />");
		if ($column == $column_name) {
			return true;
		}
	}
	//didn't find it try to create it.
	$q = $wpdb->query($create_ddl);
	// we cannot directly tell that whether this succeeded!
	foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
		if ($column == $column_name) {
			return true;
		}
	}
	return false;
}

/**
 * Retrieve all options as it was for 1.2.
 *
 * @since 1.2.0
 *
 * @return array List of options.
 */
function get_alloptions_110() {
	global $wpdb;
	if ($options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options")) {
		foreach ($options as $option) {
			// "When trying to design a foolproof system,
			//  never underestimate the ingenuity of the fools :)" -- Dougal
			if ('siteurl' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
			if ('home' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
			if ('category_base' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
			$all_options->{$option->option_name} = stripslashes($option->option_value);
		}
	}
	return $all_options;
}

/**
 * Version of get_option that is private to install/upgrade.
 *
 * @since unknown
 * @access private
 *
 * @param string $setting Option name.
 * @return mixed
 */
function __get_option($setting) {
	global $wpdb;

	if ( $setting == 'home' && defined( 'WP_HOME' ) ) {
		return preg_replace( '|/+$|', '', constant( 'WP_HOME' ) );
	}

	if ( $setting == 'siteurl' && defined( 'WP_SITEURL' ) ) {
		return preg_replace( '|/+$|', '', constant( 'WP_SITEURL' ) );
	}

	$option = $wpdb->get_var( $wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s", $setting) );

	if ( 'home' == $setting && '' == $option )
		return __get_option('siteurl');

	if ( 'siteurl' == $setting || 'home' == $setting || 'category_base' == $setting )
		$option = preg_replace('|/+$|', '', $option);

	@ $kellogs = unserialize($option);
	if ($kellogs !== FALSE)
		return $kellogs;
	else
		return $option;
}

/**
 * {@internal Missing Short Description}}
 *
 * {@internal Missing Long Description}}
 *
 * @since unknown
 *
 * @param string $content
 * @return string
 */
function deslash($content) {
	// Note: \\\ inside a regex denotes a single backslash.

	// Replace one or more backslashes followed by a single quote with
	// a single quote.
	$content = preg_replace("/\\\+'/", "'", $content);

	// Replace one or more backslashes followed by a double quote with
	// a double quote.
	$content = preg_replace('/\\\+"/', '"', $content);

	// Replace one or more backslashes with one backslash.
	$content = preg_replace("/\\\+/", "\\", $content);

	return $content;
}

/**
 * {@internal Missing Short Description}}
 *
 * {@internal Missing Long Description}}
 *
 * @since unknown
 *
 * @param unknown_type $queries
 * @param unknown_type $execute
 * @return unknown
 */
function dbDelta($queries, $execute = true) {
	global $wpdb;

	// Separate individual queries into an array
	if( !is_array($queries) ) {
		$queries = explode( ';', $queries );
		if('' == $queries[count($queries) - 1]) array_pop($queries);
	}

	$cqueries = array(); // Creation Queries
	$iqueries = array(); // Insertion Queries
	$for_update = array();

	// Create a tablename index for an array ($cqueries) of queries
	foreach($queries as $qry) {
		if(preg_match("|CREATE TABLE ([^ ]*)|", $qry, $matches)) {
			$cqueries[strtolower($matches[1])] = $qry;
			$for_update[$matches[1]] = 'Created table '.$matches[1];
		}
		else if(preg_match("|CREATE DATABASE ([^ ]*)|", $qry, $matches)) {
			array_unshift($cqueries, $qry);
		}
		else if(preg_match("|INSERT INTO ([^ ]*)|", $qry, $matches)) {
			$iqueries[] = $qry;
		}
		else if(preg_match("|UPDATE ([^ ]*)|", $qry, $matches)) {
			$iqueries[] = $qry;
		}
		else {
			// Unrecognized query type
		}
	}

	// Check to see which tables and fields exist
	if($tables = $wpdb->get_col('SHOW TABLES;')) {
		// For every table in the database
		foreach($tables as $table) {
			// If a table query exists for the database table...
			if( array_key_exists(strtolower($table), $cqueries) ) {
				// Clear the field and index arrays
				unset($cfields);
				unset($indices);
				// Get all of the field names in the query from between the parens
				preg_match("|\((.*)\)|ms", $cqueries[strtolower($table)], $match2);
				$qryline = trim($match2[1]);

				// Separate field lines into an array
				$flds = explode("\n", $qryline);

				//echo "<hr/><pre>\n".print_r(strtolower($table), true).":\n".print_r($cqueries, true)."</pre><hr/>";

				// For every field line specified in the query
				foreach($flds as $fld) {
					// Extract the field name
					preg_match("|^([^ ]*)|", trim($fld), $fvals);
					$fieldname = $fvals[1];

					// Verify the found field name
					$validfield = true;
					switch(strtolower($fieldname))
					{
					case '':
					case 'primary':
					case 'index':
					case 'fulltext':
					case 'unique':
					case 'key':
						$validfield = false;
						$indices[] = trim(trim($fld), ", \n");
						break;
					}
					$fld = trim($fld);

					// If it's a valid field, add it to the field array
					if($validfield) {
						$cfields[strtolower($fieldname)] = trim($fld, ", \n");
					}
				}

				// Fetch the table column structure from the database
				$tablefields = $wpdb->get_results("DESCRIBE {$table};");

				// For every field in the table
				foreach($tablefields as $tablefield) {
					// If the table field exists in the field array...
					if(array_key_exists(strtolower($tablefield->Field), $cfields)) {
						// Get the field type from the query
						preg_match("|".$tablefield->Field." ([^ ]*( unsigned)?)|i", $cfields[strtolower($tablefield->Field)], $matches);
						$fieldtype = $matches[1];

						// Is actual field type different from the field type in query?
						if($tablefield->Type != $fieldtype) {
							// Add a query to change the column type
							$cqueries[] = "ALTER TABLE {$table} CHANGE COLUMN {$tablefield->Field} " . $cfields[strtolower($tablefield->Field)];
							$for_update[$table.'.'.$tablefield->Field] = "Changed type of {$table}.{$tablefield->Field} from {$tablefield->Type} to {$fieldtype}";
						}

						// Get the default value from the array
							//echo "{$cfields[strtolower($tablefield->Field)]}<br>";
						if(preg_match("| DEFAULT '(.*)'|i", $cfields[strtolower($tablefield->Field)], $matches)) {
							$default_value = $matches[1];
							if($tablefield->Default != $default_value)
							{
								// Add a query to change the column's default value
								$cqueries[] = "ALTER TABLE {$table} ALTER COLUMN {$tablefield->Field} SET DEFAULT '{$default_value}'";
								$for_update[$table.'.'.$tablefield->Field] = "Changed default value of {$table}.{$tablefield->Field} from {$tablefield->Default} to {$default_value}";
							}
						}

						// Remove the field from the array (so it's not added)
						unset($cfields[strtolower($tablefield->Field)]);
					}
					else {
						// This field exists in the table, but not in the creation queries?
					}
				}

				// For every remaining field specified for the table
				foreach($cfields as $fieldname => $fielddef) {
					// Push a query line into $cqueries that adds the field to that table
					$cqueries[] = "ALTER TABLE {$table} ADD COLUMN $fielddef";
					$for_update[$table.'.'.$fieldname] = 'Added column '.$table.'.'.$fieldname;
				}

				// Index stuff goes here
				// Fetch the table index structure from the database
				$tableindices = $wpdb->get_results("SHOW INDEX FROM {$table};");

				if($tableindices) {
					// Clear the index array
					unset($index_ary);

					// For every index in the table
					foreach($tableindices as $tableindex) {
						// Add the index to the index data array
						$keyname = $tableindex->Key_name;
						$index_ary[$keyname]['columns'][] = array('fieldname' => $tableindex->Column_name, 'subpart' => $tableindex->Sub_part);
						$index_ary[$keyname]['unique'] = ($tableindex->Non_unique == 0)?true:false;
					}

					// For each actual index in the index array
					foreach($index_ary as $index_name => $index_data) {
						// Build a create string to compare to the query
						$index_string = '';
						if($index_name == 'PRIMARY') {
							$index_string .= 'PRIMARY ';
						}
						else if($index_data['unique']) {
							$index_string .= 'UNIQUE ';
						}
						$index_string .= 'KEY ';
						if($index_name != 'PRIMARY') {
							$index_string .= $index_name;
						}
						$index_columns = '';
						// For each column in the index
						foreach($index_data['columns'] as $column_data) {
							if($index_columns != '') $index_columns .= ',';
							// Add the field to the column list string
							$index_columns .= $column_data['fieldname'];
							if($column_data['subpart'] != '') {
								$index_columns .= '('.$column_data['subpart'].')';
							}
						}
						// Add the column list to the index create string
						$index_string .= ' ('.$index_columns.')';
						if(!(($aindex = array_search($index_string, $indices)) === false)) {
							unset($indices[$aindex]);
							//echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">{$table}:<br />Found index:".$index_string."</pre>\n";
						}
						//else echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">{$table}:<br /><b>Did not find index:</b>".$index_string."<br />".print_r($indices, true)."</pre>\n";
					}
				}

				// For every remaining index specified for the table
				foreach ( (array) $indices as $index ) {
					// Push a query line into $cqueries that adds the index to that table
					$cqueries[] = "ALTER TABLE {$table} ADD $index";
					$for_update[$table.'.'.$fieldname] = 'Added index '.$table.' '.$index;
				}

				// Remove the original table creation query from processing
				unset($cqueries[strtolower($table)]);
				unset($for_update[strtolower($table)]);
			} else {
				// This table exists in the database, but not in the creation queries?
			}
		}
	}

	$allqueries = array_merge($cqueries, $iqueries);
	if($execute) {
		foreach($allqueries as $query) {
			//echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">".print_r($query, true)."</pre>\n";
			$wpdb->query($query);
		}
	}

	return $for_update;
}

/**
 * {@internal Missing Short Description}}
 *
 * {@internal Missing Long Description}}
 *
 * @since unknown
 */
function make_db_current() {
	global $wp_queries;

	$alterations = dbDelta($wp_queries);
	echo "<ol>\n";
	foreach($alterations as $alteration) echo "<li>$alteration</li>\n";
	echo "</ol>\n";
}

/**
 * {@internal Missing Short Description}}
 *
 * {@internal Missing Long Description}}
 *
 * @since unknown
 */
function make_db_current_silent() {
	global $wp_queries;

	$alterations = dbDelta($wp_queries);
}

/**
 * {@internal Missing Short Description}}
 *
 * {@internal Missing Long Description}}
 *
 * @since unknown
 *
 * @param unknown_type $theme_name
 * @param unknown_type $template
 * @return unknown
 */
function make_site_theme_from_oldschool($theme_name, $template) {
	$home_path = get_home_path();
	$site_dir = WP_CONTENT_DIR . "/themes/$template";

	if (! file_exists("$home_path/index.php"))
		return false;

	// Copy files from the old locations to the site theme.
	// TODO: This does not copy arbitarary include dependencies.  Only the
	// standard WP files are copied.
	$files = array('index.php' => 'index.php', 'wp-layout.css' => 'style.css', 'wp-comments.php' => 'comments.php', 'wp-comments-popup.php' => 'comments-popup.php');

	foreach ($files as $oldfile => $newfile) {
		if ($oldfile == 'index.php')
			$oldpath = $home_path;
		else
			$oldpath = ABSPATH;

		if ($oldfile == 'index.php') { // Check to make sure it's not a new index
			$index = implode('', file("$oldpath/$oldfile"));
			if (strpos($index, 'WP_USE_THEMES') !== false) {
				if (! @copy(WP_CONTENT_DIR . '/themes/default/index.php', "$site_dir/$newfile"))
					return false;
				continue; // Don't copy anything
				}
		}

		if (! @copy("$oldpath/$oldfile", "$site_dir/$newfile"))
			return false;

		chmod("$site_dir/$newfile", 0777);

		// Update the blog header include in each file.
		$lines = explode("\n", implode('', file("$site_dir/$newfile")));
		if ($lines) {
			$f = fopen("$site_dir/$newfile", 'w');

			foreach ($lines as $line) {
				if (preg_match('/require.*wp-blog-header/', $line))
					$line = '//' . $line;

				// Update stylesheet references.
				$line = str_replace("<?php echo __get_option('siteurl'); ?>/wp-layout.css", "<?php bloginfo('stylesheet_url'); ?>", $line);

				// Update comments template inclusion.
				$line = str_replace("<?php include(ABSPATH . 'wp-comments.php'); ?>", "<?php comments_template(); ?>", $line);

				fwrite($f, "{$line}\n");
			}
			fclose($f);
		}
	}

	// Add a theme header.
	$header = "/*\nTheme Name: $theme_name\nTheme URI: " . __get_option('siteurl') . "\nDescription: A theme automatically created by the upgrade.\nVersion: 1.0\nAuthor: Moi\n*/\n";

	$stylelines = file_get_contents("$site_dir/style.css");
	if ($stylelines) {
		$f = fopen("$site_dir/style.css", 'w');

		fwrite($f, $header);
		fwrite($f, $stylelines);
		fclose($f);
	}

	return true;
}

/**
 * {@internal Missing Short Description}}
 *
 * {@internal Missing Long Description}}
 *
 * @since unknown
 *
 * @param unknown_type $theme_name
 * @param unknown_type $template
 * @return unknown
 */
function make_site_theme_from_default($theme_name, $template) {
	$site_dir = WP_CONTENT_DIR . "/themes/$template";
	$default_dir = WP_CONTENT_DIR . '/themes/default';

	// Copy files from the default theme to the site theme.
	//$files = array('index.php', 'comments.php', 'comments-popup.php', 'footer.php', 'header.php', 'sidebar.php', 'style.css');

	$theme_dir = @ opendir("$default_dir");
	if ($theme_dir) {
		while(($theme_file = readdir( $theme_dir )) !== false) {
			if (is_dir("$default_dir/$theme_file"))
				continue;
			if (! @copy("$default_dir/$theme_file", "$site_dir/$theme_file"))
				return;
			chmod("$site_dir/$theme_file", 0777);
		}
	}
	@closedir($theme_dir);

	// Rewrite the theme header.
	$stylelines = explode("\n", implode('', file("$site_dir/style.css")));
	if ($stylelines) {
		$f = fopen("$site_dir/style.css", 'w');

		foreach ($stylelines as $line) {
			if (strpos($line, 'Theme Name:') !== false) $line = 'Theme Name: ' . $theme_name;
			elseif (strpos($line, 'Theme URI:') !== false) $line = 'Theme URI: ' . __get_option('url');
			elseif (strpos($line, 'Description:') !== false) $line = 'Description: Your theme.';
			elseif (strpos($line, 'Version:') !== false) $line = 'Version: 1';
			elseif (strpos($line, 'Author:') !== false) $line = 'Author: You';
			fwrite($f, $line . "\n");
		}
		fclose($f);
	}

	// Copy the images.
	umask(0);
	if (! mkdir("$site_dir/images", 0777)) {
		return false;
	}

	$images_dir = @ opendir("$default_dir/images");
	if ($images_dir) {
		while(($image = readdir($images_dir)) !== false) {
			if (is_dir("$default_dir/images/$image"))
				continue;
			if (! @copy("$default_dir/images/$image", "$site_dir/images/$image"))
				return;
			chmod("$site_dir/images/$image", 0777);
		}
	}
	@closedir($images_dir);
}

// Create a site theme from the default theme.
/**
 * {@internal Missing Short Description}}
 *
 * {@internal Missing Long Description}}
 *
 * @since unknown
 *
 * @return unknown
 */
function make_site_theme() {
	// Name the theme after the blog.
	$theme_name = __get_option('blogname');
	$template = sanitize_title($theme_name);
	$site_dir = WP_CONTENT_DIR . "/themes/$template";

	// If the theme already exists, nothing to do.
	if ( is_dir($site_dir)) {
		return false;
	}

	// We must be able to write to the themes dir.
	if (! is_writable(WP_CONTENT_DIR . "/themes")) {
		return false;
	}

	umask(0);
	if (! mkdir($site_dir, 0777)) {
		return false;
	}

	if (file_exists(ABSPATH . 'wp-layout.css')) {
		if (! make_site_theme_from_oldschool($theme_name, $template)) {
			// TODO:  rm -rf the site theme directory.
			return false;
		}
	} else {
		if (! make_site_theme_from_default($theme_name, $template))
			// TODO:  rm -rf the site theme directory.
			return false;
	}

	// Make the new site theme active.
	$current_template = __get_option('template');
	if ($current_template == 'default') {
		update_option('template', $template);
		update_option('stylesheet', $template);
	}
	return $template;
}

/**
 * Translate user level to user role name.
 *
 * @since unknown
 *
 * @param int $level User level.
 * @return string User role name.
 */
function translate_level_to_role($level) {
	switch ($level) {
	case 10:
	case 9:
	case 8:
		return 'administrator';
	case 7:
	case 6:
	case 5:
		return 'editor';
	case 4:
	case 3:
	case 2:
		return 'author';
	case 1:
		return 'contributor';
	case 0:
		return 'subscriber';
	}
}

/**
 * {@internal Missing Short Description}}
 *
 * {@internal Missing Long Description}}
 *
 * @since unknown
 */
function wp_check_mysql_version() {
	global $wpdb;
	$result = $wpdb->check_database_version();
	if ( is_wp_error( $result ) )
		die( $result->get_error_message() );
}

/**
 * {@internal Missing Short Description}}
 *
 * {@internal Missing Long Description}}
 *
 * @since unknown
 */
function maybe_disable_automattic_widgets() {
	$plugins = __get_option( 'active_plugins' );

	foreach ( (array) $plugins as $plugin ) {
		if ( basename( $plugin ) == 'widgets.php' ) {
			array_splice( $plugins, array_search( $plugin, $plugins ), 1 );
			update_option( 'active_plugins', $plugins );
			break;
		}
	}
}

?>
                                                                                                                                                                                                                                                                                                                                                                                                                 wp-admin/includes/user.php                                                                          0000755 0023422 0004734 00000046603 11117531364 016631  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress user administration API.
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * Creates a new user from the "Users" form using $_POST information.
 *
 * {@internal Missing Long Description}}
 *
 * @since unknown
 *
 * @param int $user_id Optional. User ID.
 * @return null|WP_Error|int Null when adding user, WP_Error or User ID integer when no parameters.
 */
function add_user() {
	if ( func_num_args() ) { // The hackiest hack that ever did hack
		global $current_user, $wp_roles;
		$user_id = (int) func_get_arg( 0 );

		if ( isset( $_POST['role'] ) ) {
			if( $user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap( 'edit_users' ) ) {
				$user = new WP_User( $user_id );
				$user->set_role( $_POST['role'] );
			}
		}
	} else {
		add_action( 'user_register', 'add_user' ); // See above
		return edit_user();
	}
}

/**
 * {@internal Missing Short Description}}
 *
 * {@internal Missing Long Description}}
 *
 * @since unknown
 *
 * @param int $user_id Optional. User ID.
 * @return unknown
 */
function edit_user( $user_id = 0 ) {
	global $current_user, $wp_roles, $wpdb;
	if ( $user_id != 0 ) {
		$update = true;
		$user->ID = (int) $user_id;
		$userdata = get_userdata( $user_id );
		$user->user_login = $wpdb->escape( $userdata->user_login );
	} else {
		$update = false;
		$user = '';
	}

	if ( isset( $_POST['user_login'] ))
		$user->user_login = wp_specialchars( trim( $_POST['user_login'] ));

	$pass1 = $pass2 = '';
	if ( isset( $_POST['pass1'] ))
		$pass1 = $_POST['pass1'];
	if ( isset( $_POST['pass2'] ))
		$pass2 = $_POST['pass2'];

	if ( isset( $_POST['role'] ) && current_user_can( 'edit_users' ) ) {
		if( $user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap( 'edit_users' ))
			$user->role = $_POST['role'];
	}

	if ( isset( $_POST['email'] ))
		$user->user_email = wp_specialchars( trim( $_POST['email'] ));
	if ( isset( $_POST['url'] ) ) {
		$user->user_url = clean_url( trim( $_POST['url'] ));
		$user->user_url = preg_match('/^(https?|ftps?|mailto|news|irc|gopher|nntp|feed|telnet):/is', $user->user_url) ? $user->user_url : 'http://'.$user->user_url;
	}
	if ( isset( $_POST['first_name'] ))
		$user->first_name = wp_specialchars( trim( $_POST['first_name'] ));
	if ( isset( $_POST['last_name'] ))
		$user->last_name = wp_specialchars( trim( $_POST['last_name'] ));
	if ( isset( $_POST['nickname'] ))
		$user->nickname = wp_specialchars( trim( $_POST['nickname'] ));
	if ( isset( $_POST['display_name'] ))
		$user->display_name = wp_specialchars( trim( $_POST['display_name'] ));
	if ( isset( $_POST['description'] ))
		$user->description = trim( $_POST['description'] );
	if ( isset( $_POST['jabber'] ))
		$user->jabber = wp_specialchars( trim( $_POST['jabber'] ));
	if ( isset( $_POST['aim'] ))
		$user->aim = wp_specialchars( trim( $_POST['aim'] ));
	if ( isset( $_POST['yim'] ))
		$user->yim = wp_specialchars( trim( $_POST['yim'] ));
	if ( !$update )
		$user->rich_editing = 'true';  // Default to true for new users.
	else if ( isset( $_POST['rich_editing'] ) )
		$user->rich_editing = $_POST['rich_editing'];
	else
		$user->rich_editing = 'true';

	$user->comment_shortcuts = isset( $_POST['comment_shortcuts'] )? $_POST['comment_shortcuts'] : '';

	$user->use_ssl = 0;
	if ( !empty($_POST['use_ssl']) )
		$user->use_ssl = 1;

	if ( !$update )
		$user->admin_color = 'fresh';  // Default to fresh for new users.
	else if ( isset( $_POST['admin_color'] ) )
		$user->admin_color = $_POST['admin_color'];
	else
		$user->admin_color = 'fresh';

	$errors = new WP_Error();

	/* checking that username has been typed */
	if ( $user->user_login == '' )
		$errors->add( 'user_login', __( '<strong>ERROR</strong>: Please enter a username.' ));

	/* checking the password has been typed twice */
	do_action_ref_array( 'check_passwords', array ( $user->user_login, & $pass1, & $pass2 ));

	if ( $update ) {
		if ( empty($pass1) && !empty($pass2) )
			$errors->add( 'pass', __( '<strong>ERROR</strong>: You entered your new password only once.' ), array( 'form-field' => 'pass1' ) );
		elseif ( !empty($pass1) && empty($pass2) )
			$errors->add( 'pass', __( '<strong>ERROR</strong>: You entered your new password only once.' ), array( 'form-field' => 'pass2' ) );
	} else {
		if ( empty($pass1) )
			$errors->add( 'pass', __( '<strong>ERROR</strong>: Please enter your password.' ), array( 'form-field' => 'pass1' ) );
		elseif ( empty($pass2) )
			$errors->add( 'pass', __( '<strong>ERROR</strong>: Please enter your password twice.' ), array( 'form-field' => 'pass2' ) );
	}

	/* Check for "\" in password */
	if( strpos( " ".$pass1, "\\" ) )
		$errors->add( 'pass', __( '<strong>ERROR</strong>: Passwords may not contain the character "\\".' ), array( 'form-field' => 'pass1' ) );

	/* checking the password has been typed twice the same */
	if ( $pass1 != $pass2 )
		$errors->add( 'pass', __( '<strong>ERROR</strong>: Please enter the same password in the two password fields.' ), array( 'form-field' => 'pass1' ) );

	if (!empty ( $pass1 ))
		$user->user_pass = $pass1;

	if ( !$update && !validate_username( $user->user_login ) )
		$errors->add( 'user_login', __( '<strong>ERROR</strong>: This username is invalid. Please enter a valid username.' ));

	if (!$update && username_exists( $user->user_login ))
		$errors->add( 'user_login', __( '<strong>ERROR</strong>: This username is already registered. Please choose another one.' ));

	/* checking e-mail address */
	if ( empty ( $user->user_email ) ) {
		$errors->add( 'user_email', __( '<strong>ERROR</strong>: Please enter an e-mail address.' ), array( 'form-field' => 'email' ) );
	} else
		if (!is_email( $user->user_email ) ) {
			$errors->add( 'user_email', __( "<strong>ERROR</strong>: The e-mail address isn't correct." ), array( 'form-field' => 'email' ) );
		}

	if ( $errors->get_error_codes() )
		return $errors;

	if ( $update ) {
		$user_id = wp_update_user( get_object_vars( $user ));
	} else {
		$user_id = wp_insert_user( get_object_vars( $user ));
		wp_new_user_notification( $user_id );
	}
	return $user_id;
}

/**
 * {@internal Missing Short Description}}
 *
 * {@internal Missing Long Description}}
 *
 * @since unknown
 *
 * @return array List of user IDs.
 */
function get_author_user_ids() {
	global $wpdb;
	$level_key = $wpdb->prefix . 'user_level';
	return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key) );
}

/**
 * {@internal Missing Short Description}}
 *
 * {@internal Missing Long Description}}
 *
 * @since unknown
 *
 * @param int $user_id User ID.
 * @return array|bool List of editable authors. False if no editable users.
 */
function get_editable_authors( $user_id ) {
	global $wpdb;

	$editable = get_editable_user_ids( $user_id );

	if( !$editable ) {
		return false;
	} else {
		$editable = join(',', $editable);
		$authors = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($editable) ORDER BY display_name" );
	}

	return apply_filters('get_editable_authors', $authors);
}

/**
 * {@internal Missing Short Description}}
 *
 * {@internal Missing Long Description}}
 *
 * @since unknown
 *
 * @param int $user_id User ID.
 * @param bool $exclude_zeros Optional, default is true. Whether to exclude zeros.
 * @return unknown
 */
function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) {
	global $wpdb;

	$user = new WP_User( $user_id );

	if ( ! $user->has_cap("edit_others_{$post_type}s") ) {
		if ( $user->has_cap("edit_{$post_type}s") || $exclude_zeros == false )
			return array($user->id);
		else
			return false;
	}

	$level_key = $wpdb->prefix . 'user_level';

	$query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key);
	if ( $exclude_zeros )
		$query .= " AND meta_value != '0'";

	return $wpdb->get_col( $query );
}

/**
 * {@internal Missing Short Description}}
 *
 * {@internal Missing Long Description}}
 *
 * @since unknown
 *
 * @return unknown
 */
function get_nonauthor_user_ids() {
	global $wpdb;
	$level_key = $wpdb->prefix . 'user_level';

	return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0'", $level_key) );
}

/**
 * Retrieve editable posts from other users.
 *
 * @since unknown
 *
 * @param int $user_id User ID to not retrieve posts from.
 * @param string $type Optional, defaults to 'any'. Post type to retrieve, can be 'draft' or 'pending'.
 * @return array List of posts from others.
 */
function get_others_unpublished_posts($user_id, $type='any') {
	global $wpdb;

	$editable = get_editable_user_ids( $user_id );

	if ( in_array($type, array('draft', 'pending')) )
		$type_sql = " post_status = '$type' ";
	else
		$type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) ";

	$dir = ( 'pending' == $type ) ? 'ASC' : 'DESC';

	if( !$editable ) {
		$other_unpubs = '';
	} else {
		$editable = join(',', $editable);
		$other_unpubs = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != %d ORDER BY post_modified $dir", $user_id) );
	}

	return apply_filters('get_others_drafts', $other_unpubs);
}

/**
 * Retrieve drafts from other users.
 *
 * @since unknown
 *
 * @param int $user_id User ID.
 * @return array List of drafts from other users.
 */
function get_others_drafts($user_id) {
	return get_others_unpublished_posts($user_id, 'draft');
}

/**
 * Retrieve pending review posts from other users.
 *
 * @since unknown
 *
 * @param int $user_id User ID.
 * @return array List of posts with pending review post type from other users.
 */
function get_others_pending($user_id) {
	return get_others_unpublished_posts($user_id, 'pending');
}

/**
 * Retrieve user data and filter it.
 *
 * @since unknown
 *
 * @param int $user_id User ID.
 * @return object WP_User object with user data.
 */
function get_user_to_edit( $user_id ) {
	$user = new WP_User( $user_id );
	$user->user_login   = attribute_escape($user->user_login);
	$user->user_email   = attribute_escape($user->user_email);
	$user->user_url     = clean_url($user->user_url);
	$user->first_name   = attribute_escape($user->first_name);
	$user->last_name    = attribute_escape($user->last_name);
	$user->display_name = attribute_escape($user->display_name);
	$user->nickname     = attribute_escape($user->nickname);
	$user->aim          = isset( $user->aim ) && !empty( $user->aim ) ? attribute_escape($user->aim) : '';
	$user->yim          = isset( $user->yim ) && !empty( $user->yim ) ? attribute_escape($user->yim) : '';
	$user->jabber       = isset( $user->jabber ) && !empty( $user->jabber ) ? attribute_escape($user->jabber) : '';
	$user->description  = isset( $user->description ) && !empty( $user->description ) ? wp_specialchars($user->description) : '';

	return $user;
}

/**
 * Retrieve the user's drafts.
 *
 * @since unknown
 *
 * @param int $user_id User ID.
 * @return array
 */
function get_users_drafts( $user_id ) {
	global $wpdb;
	$query = $wpdb->prepare("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = %d ORDER BY post_modified DESC", $user_id);
	$query = apply_filters('get_users_drafts', $query);
	return $wpdb->get_results( $query );
}

/**
 * Remove user and optionally reassign posts and links to another user.
 *
 * If the $reassign parameter is not assigned to an User ID, then all posts will
 * be deleted of that user. The action 'delete_user' that is passed the User ID
 * being deleted will be run after the posts are either reassigned or deleted.
 * The user meta will also be deleted that are for that User ID.
 *
 * @since unknown
 *
 * @param int $id User ID.
 * @param int $reassign Optional. Reassign posts and links to new User ID.
 * @return bool True when finished.
 */
function wp_delete_user($id, $reassign = 'novalue') {
	global $wpdb;

	$id = (int) $id;

	if ($reassign == 'novalue') {
		$post_ids = $wpdb->get_col( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id) );

		if ($post_ids) {
			foreach ($post_ids as $post_id)
				wp_delete_post($post_id);
		}

		// Clean links
		$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->links WHERE link_owner = %d", $id) );
	} else {
		$reassign = (int) $reassign;
		$wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_author = %d WHERE post_author = %d", $reassign, $id) );
		$wpdb->query( $wpdb->prepare("UPDATE $wpdb->links SET link_owner = %d WHERE link_owner = %d", $reassign, $id) );
	}

	// FINALLY, delete user
	do_action('delete_user', $id);

	$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->users WHERE ID = %d", $id) );
	$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d", $id) );

	wp_cache_delete($id, 'users');
	wp_cache_delete($user->user_login, 'userlogins');
	wp_cache_delete($user->user_email, 'useremail');

	return true;
}

/**
 * Remove all capabilities from user.
 *
 * @since unknown
 *
 * @param int $id User ID.
 */
function wp_revoke_user($id) {
	$id = (int) $id;

	$user = new WP_User($id);
	$user->remove_all_caps();
}

if ( !class_exists('WP_User_Search') ) :
/**
 * WordPress User Search class.
 *
 * @since unknown
 * @author Mark Jaquith
 */
class WP_User_Search {

	/**
	 * {@internal Missing Description}}
	 *
	 * @since unknown
	 * @access private
	 * @var unknown_type
	 */
	var $results;

	/**
	 * {@internal Missing Description}}
	 *
	 * @since unknown
	 * @access private
	 * @var unknown_type
	 */
	var $search_term;

	/**
	 * Page number.
	 *
	 * @since unknown
	 * @access private
	 * @var int
	 */
	var $page;

	/**
	 * Role name that users have.
	 *
	 * @since unknown
	 * @access private
	 * @var string
	 */
	var $role;

	/**
	 * Raw page number.
	 *
	 * @since unknown
	 * @access private
	 * @var int|bool
	 */
	var $raw_page;

	/**
	 * Amount of users to display per page.
	 *
	 * @since unknown
	 * @access public
	 * @var int
	 */
	var $users_per_page = 50;

	/**
	 * {@internal Missing Description}}
	 *
	 * @since unknown
	 * @access private
	 * @var unknown_type
	 */
	var $first_user;

	/**
	 * {@internal Missing Description}}
	 *
	 * @since unknown
	 * @access private
	 * @var int
	 */
	var $last_user;

	/**
	 * {@internal Missing Description}}
	 *
	 * @since unknown
	 * @access private
	 * @var unknown_type
	 */
	var $query_limit;

	/**
	 * {@internal Missing Description}}
	 *
	 * @since unknown
	 * @access private
	 * @var unknown_type
	 */
	var $query_sort;

	/**
	 * {@internal Missing Description}}
	 *
	 * @since unknown
	 * @access private
	 * @var unknown_type
	 */
	var $query_from_where;

	/**
	 * {@internal Missing Description}}
	 *
	 * @since unknown
	 * @access private
	 * @var int
	 */
	var $total_users_for_query = 0;

	/**
	 * {@internal Missing Description}}
	 *
	 * @since unknown
	 * @access private
	 * @var bool
	 */
	var $too_many_total_users = false;

	/**
	 * {@internal Missing Description}}
	 *
	 * @since unknown
	 * @access private
	 * @var unknown_type
	 */
	var $search_errors;

	/**
	 * {@internal Missing Description}}
	 *
	 * @since unknown
	 * @access private
	 * @var unknown_type
	 */
	var $paging_text;

	/**
	 * PHP4 Constructor - Sets up the object properties.
	 *
	 * @since unknown
	 *
	 * @param string $search_term Search terms string.
	 * @param int $page Optional. Page ID.
	 * @param string $role Role name.
	 * @return WP_User_Search
	 */
	function WP_User_Search ($search_term = '', $page = '', $role = '') {
		$this->search_term = $search_term;
		$this->raw_page = ( '' == $page ) ? false : (int) $page;
		$this->page = (int) ( '' == $page ) ? 1 : $page;
		$this->role = $role;

		$this->prepare_query();
		$this->query();
		$this->prepare_vars_for_template_usage();
		$this->do_paging();
	}

	/**
	 * {@internal Missing Short Description}}
	 *
	 * {@internal Missing Long Description}}
	 *
	 * @since unknown
	 * @access public
	 */
	function prepare_query() {
		global $wpdb;
		$this->first_user = ($this->page - 1) * $this->users_per_page;
		$this->query_limit = $wpdb->prepare(" LIMIT %d, %d", $this->first_user, $this->users_per_page);
		$this->query_sort = ' ORDER BY user_login';
		$search_sql = '';
		if ( $this->search_term ) {
			$searches = array();
			$search_sql = 'AND (';
			foreach ( array('user_login', 'user_nicename', 'user_email', 'user_url', 'display_name') as $col )
				$searches[] = $col . " LIKE '%$this->search_term%'";
			$search_sql .= implode(' OR ', $searches);
			$search_sql .= ')';
		}

		$this->query_from_where = "FROM $wpdb->users";
		if ( $this->role )
			$this->query_from_where .= $wpdb->prepare(" INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id WHERE $wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities' AND $wpdb->usermeta.meta_value LIKE %s", '%' . $this->role . '%');
		else
			$this->query_from_where .= " WHERE 1=1";
		$this->query_from_where .= " $search_sql";

	}

	/**
	 * {@internal Missing Short Description}}
	 *
	 * {@internal Missing Long Description}}
	 *
	 * @since unknown
	 * @access public
	 */
	function query() {
		global $wpdb;
		$this->results = $wpdb->get_col('SELECT ID ' . $this->query_from_where . $this->query_sort . $this->query_limit);

		if ( $this->results )
			$this->total_users_for_query = $wpdb->get_var('SELECT COUNT(ID) ' . $this->query_from_where); // no limit
		else
			$this->search_errors = new WP_Error('no_matching_users_found', __('No matching users were found!'));
	}

	/**
	 * {@internal Missing Short Description}}
	 *
	 * {@internal Missing Long Description}}
	 *
	 * @since unknown
	 * @access public
	 */
	function prepare_vars_for_template_usage() {
		$this->search_term = stripslashes($this->search_term); // done with DB, from now on we want slashes gone
	}

	/**
	 * {@internal Missing Short Description}}
	 *
	 * {@internal Missing Long Description}}
	 *
	 * @since unknown
	 * @access public
	 */
	function do_paging() {
		if ( $this->total_users_for_query > $this->users_per_page ) { // have to page the results
			$args = array();
			if( ! empty($this->search_term) )
				$args['usersearch'] = urlencode($this->search_term);
			if( ! empty($this->role) )
				$args['role'] = urlencode($this->role);

			$this->paging_text = paginate_links( array(
				'total' => ceil($this->total_users_for_query / $this->users_per_page),
				'current' => $this->page,
				'base' => 'users.php?%_%',
				'format' => 'userspage=%#%',
				'add_args' => $args
			) );
			if ( $this->paging_text ) {
				$this->paging_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
					number_format_i18n( ( $this->page - 1 ) * $this->users_per_page + 1 ),
					number_format_i18n( min( $this->page * $this->users_per_page, $this->total_users_for_query ) ),
					number_format_i18n( $this->total_users_for_query ),
					$this->paging_text
				);
			}
		}
	}

	/**
	 * {@internal Missing Short Description}}
	 *
	 * {@internal Missing Long Description}}
	 *
	 * @since unknown
	 * @access public
	 *
	 * @return unknown
	 */
	function get_results() {
		return (array) $this->results;
	}

	/**
	 * Displaying paging text.
	 *
	 * @see do_paging() Builds paging text.
	 *
	 * @since unknown
	 * @access public
	 */
	function page_links() {
		echo $this->paging_text;
	}

	/**
	 * Whether paging is enabled.
	 *
	 * @see do_paging() Builds paging text.
	 *
	 * @since unknown
	 * @access public
	 *
	 * @return bool
	 */
	function results_are_paged() {
		if ( $this->paging_text )
			return true;
		return false;
	}

	/**
	 * Whether there are search terms.
	 *
	 * @since unknown
	 * @access public
	 *
	 * @return bool
	 */
	function is_search() {
		if ( $this->search_term )
			return true;
		return false;
	}
}
endif;

?>
                                                                                                                             wp-admin/includes/widgets.php                                                                       0000755 0023422 0004734 00000025522 11113746712 017317  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress Widgets Administration API
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * Display list of widgets, either all or matching search.
 *
 * The search parameter are search terms separated by spaces.
 *
 * @since unknown
 *
 * @param string $show Optional, default is all. What to display, can be 'all', 'unused', or 'used'.
 * @param string $_search Optional. Search for widgets. Should be unsanitized.
 */
function wp_list_widgets( $show = 'all', $_search = false ) {
	global $wp_registered_widgets, $sidebars_widgets, $wp_registered_widget_controls;
	if ( $_search ) {
		// sanitize
		$search = preg_replace( '/[^\w\s]/', '', $_search );
		// array of terms
		$search_terms = preg_split( '/[\s]/', $search, -1, PREG_SPLIT_NO_EMPTY );
	} else {
		$search_terms = array();
	}

	if ( !in_array( $show, array( 'all', 'unused', 'used' ) ) )
		$show = 'all';
?>

	<ul id='widget-list'>
		<?php
		$no_widgets_shown = true;
		$already_shown = array();
		foreach ( $wp_registered_widgets as $name => $widget ) :
			if ( 'all' == $show && in_array( $widget['callback'], $already_shown ) ) // We already showed this multi-widget
				continue;

			if ( $search_terms ) {
				$hit = false;
				// Simple case-insensitive search.  Boolean OR.
				$search_text = preg_replace( '/[^\w]/', '', $widget['name'] );
				if ( isset($widget['description']) )
					$search_text .= preg_replace( '/[^\w]/', '', $widget['description'] );

				foreach ( $search_terms as $search_term ) {
					if ( stristr( $search_text, $search_term ) ) {
						$hit = true;
						break;
					}
				}
				if ( !$hit )
					continue;
			}

			$sidebar = is_active_widget( $widget['callback'], $widget['id'] );

			if ( ( 'unused' == $show && $sidebar ) || ( 'used' == $show && !$sidebar ) )
				continue;

			if ( ! isset( $widget['params'][0] ) )
				$widget['params'][0] = array();
			ob_start();
			$args = wp_list_widget_controls_dynamic_sidebar( array( 0 => array( 'widget_id' => $widget['id'], 'widget_name' => $widget['name'], '_display' => 'template', '_show' => $show ), 1 => $widget['params'][0] ) );
			$sidebar_args = call_user_func_array( 'wp_widget_control', $args );
			$widget_control_template = ob_get_contents();
			ob_end_clean();

			$widget_id = $widget['id']; // save this for later in case we mess with $widget['id']

			$is_multi = false !== strpos( $widget_control_template, '%i%' );
			if ( !$sidebar || $is_multi ) {
				$add_query = array(
					'sidebar' => $sidebar,
					'key' => false,
					'edit' => false
				);
				if ( 'all' == $show && $is_multi ) {
					// it's a multi-widget.  We only need to show it in the list once.
					$already_shown[] = $widget['callback'];
					$num = (int) array_pop( $ids = explode( '-', $widget['id'] ) );
					$id_base = $wp_registered_widget_controls[$widget['id']]['id_base'];
					// so that we always add a new one when clicking "add"
					while ( isset($wp_registered_widgets["$id_base-$num"]) )
						$num++;
					$widget['id'] = "$id_base-$num";
					$add_query['base'] = $id_base;
					$add_query['key'] = $num;
					$add_query['sidebar'] = $GLOBALS['sidebar'];
				}
				$add_query['add'] = $widget['id'];
				$action = 'add';
				$add_url = clean_url( wp_nonce_url( add_query_arg( $add_query ), "add-widget_$widget[id]" ) );
			} else {
				$action = 'edit';
				$edit_url = clean_url( add_query_arg( array(
					'sidebar' => $sidebar,
					'edit' => $widget['id'],
					'key' => array_search( $widget['id'], $sidebars_widgets[$sidebar] ),
				) ) );

				$widget_control_template = '<textarea rows="1" cols="1">' . htmlspecialchars( $widget_control_template ) . '</textarea>';
			}

			$widget_control_template = $sidebar_args['before_widget'] . $widget_control_template . $sidebar_args['after_widget'];

			$no_widgets_shown = false;


			if ( 'all' != $show && $sidebar_args['_widget_title'] )
				$widget_title = $sidebar_args['_widget_title'];
			else
				$widget_title = $widget['name'];
		?>

		<li id="widget-list-item-<?php echo attribute_escape( $widget['id'] ); ?>" class="widget-list-item">
			<h4 class="widget-title widget-draggable">

				<span><?php echo $widget_title; ?></span>

				<?php if ( 'add' == $action ) : ?>

				<a class="widget-action widget-control-add" href="<?php echo $add_url; ?>"><?php _e( 'Add' ); ?></a>

				<?php elseif ( 'edit' == $action ) :
					// We echo a hidden edit link for the sake of the JS.  Edit links are shown (needlessly?) after a widget is added.
				?>

				<a class="widget-action widget-control-edit" href="<?php echo $edit_url; ?>" style="display: none;"><?php _e( 'Edit' ); ?></a>

				<?php endif; ?>

				<br class="clear" />

			</h4>


			<ul id="widget-control-info-<?php echo $widget['id']; ?>" class="widget-control-info">

				<?php echo $widget_control_template; ?>

			</ul>

			<?php if ( 'add' == $action ) : ?>
			<?php endif; ?>

			<div class="widget-description">
				<?php echo ( $widget_description = wp_widget_description( $widget_id ) ) ? $widget_description : '&nbsp;'; ?>
			</div>

			<br class="clear" />

		</li>

		<?php endforeach; if ( $no_widgets_shown ) : ?>

		<li><?php _e( 'No matching widgets' ); ?></li>

		<?php endif; ?>

	</ul>
<?php
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param string $sidebar
 */
function wp_list_widget_controls( $sidebar ) {
	add_filter( 'dynamic_sidebar_params', 'wp_list_widget_controls_dynamic_sidebar' );
?>

	<ul class="widget-control-list">

		<?php if ( !dynamic_sidebar( $sidebar ) ) echo "<li />"; ?>

	</ul>

<?php
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param array $params
 * @return array
 */
function wp_list_widget_controls_dynamic_sidebar( $params ) {
	global $wp_registered_widgets;
	static $i = 0;
	$i++;

	$widget_id = $params[0]['widget_id'];

	$params[0]['before_widget'] = "<li id='widget-list-control-item-$i-$widget_id' class='widget-list-control-item widget-sortable'>\n";
	$params[0]['after_widget'] = "</li>";
	$params[0]['before_title'] = "%BEG_OF_TITLE%";
	$params[0]['after_title'] = "%END_OF_TITLE%";
	if ( is_callable( $wp_registered_widgets[$widget_id]['callback'] ) ) {
		$wp_registered_widgets[$widget_id]['_callback'] = $wp_registered_widgets[$widget_id]['callback'];
		$wp_registered_widgets[$widget_id]['callback'] = 'wp_widget_control';
	}
	return $params;
}

/**
 * Meta widget used to display the control form for a widget.
 *
 * Called from dynamic_sidebar().
 *
 * @since unknown
 *
 * @param array $sidebar_args
 * @return array
 */
function wp_widget_control( $sidebar_args ) {
	global $wp_registered_widgets, $wp_registered_widget_controls, $sidebars_widgets, $edit_widget;
	$widget_id = $sidebar_args['widget_id'];
	$sidebar_id = isset($sidebar_args['id']) ? $sidebar_args['id'] : false;

	$control = isset($wp_registered_widget_controls[$widget_id]) ? $wp_registered_widget_controls[$widget_id] : 0;
	$widget  = $wp_registered_widgets[$widget_id];

	$key = $sidebar_id ? array_search( $widget_id, $sidebars_widgets[$sidebar_id] ) : 'no-key'; // position of widget in sidebar

	$edit = -1 <  $edit_widget && is_numeric($key) && $edit_widget === $key; // (bool) are we currently editing this widget

	$id_format = $widget['id'];

	if ( ! isset( $sidebar_args['_show'] ) )
		$sidebar_args['_show'] = '';

	if ( ! isset( $sidebar_args['_display'] ) )
		$sidebar_args['_display'] = '';

	// We aren't showing a widget control, we're outputing a template for a mult-widget control
	if ( 'all' == $sidebar_args['_show'] && 'template' == $sidebar_args['_display'] && isset($control['params'][0]['number']) ) {
		// number == -1 implies a template where id numbers are replaced by a generic '%i%'
		$control['params'][0]['number'] = -1;
		// if given, id_base means widget id's should be constructed like {$id_base}-{$id_number}
		if ( isset($control['id_base']) )
			$id_format = $control['id_base'] . '-%i%';
	}

	$widget_title = '';
	// We grab the normal widget output to find the widget's title
	if ( ( 'all' != $sidebar_args['_show'] || 'template' != $sidebar_args['_display'] ) && is_callable( $widget['_callback'] ) ) {
		ob_start();
		$args = func_get_args();
		call_user_func_array( $widget['_callback'], $args );
		$widget_title = ob_get_clean();
		$widget_title = wp_widget_control_ob_filter( $widget_title );
	}
	$wp_registered_widgets[$widget_id]['callback'] = $wp_registered_widgets[$widget_id]['_callback'];
	unset($wp_registered_widgets[$widget_id]['_callback']);

	if ( $widget_title && $widget_title != $sidebar_args['widget_name'] )
		$widget_title = sprintf( _c('%1$s: %2$s|1: widget name, 2: widget title' ), $sidebar_args['widget_name'], $widget_title );
	else
		$widget_title = wp_specialchars( strip_tags( $sidebar_args['widget_name'] ) );

	$sidebar_args['_widget_title'] = $widget_title;

	if ( empty($sidebar_args['_display']) || 'template' != $sidebar_args['_display'] )
		echo $sidebar_args['before_widget'];
?>
		<div class="widget-top">
		<h4 class="widget-title"><span><?php echo $widget_title ?></span>

			<?php if ( $edit ) : ?>

			<a class="widget-action widget-control-edit" href="<?php echo clean_url( remove_query_arg( array( 'edit', 'key' ) ) ); ?>"><?php _e('Cancel'); ?></a>

			<?php else : ?>

			<a class="widget-action widget-control-edit" href="<?php echo clean_url( add_query_arg( array( 'edit' => $id_format, 'key' => $key ) ) ); ?>"><?php _e('Edit'); ?></a>

			<?php endif; ?>

			<br class="clear" />

		</h4></div>

		<div class="widget-control"<?php if ( $edit ) echo ' style="display: block;"'; ?>>

			<?php
			if ( $control )
				call_user_func_array( $control['callback'], $control['params'] );
			else
				echo '<p>' . __('There are no options for this widget.') . '</p>';
			?>

			<input type="hidden" name="widget-id[]" value="<?php echo $id_format; ?>" />
			<input type="hidden" class="widget-width" value="<?php echo $control['width']; ?>" />

			<div class="widget-control-actions">

				<?php if ( $control ) : ?>

				<a class="button widget-action widget-control-save hide-if-no-js edit alignleft" href="#save:<?php echo $id_format; ?>"><?php _e('Done'); ?></a>

				<?php endif; ?>

				<a class="button widget-action widget-control-remove alignright" href="<?php echo clean_url( wp_nonce_url( add_query_arg( array( 'remove' => $id_format, 'key' => $key ) ), "remove-widget_$widget[id]" ) ); ?>"><?php _e('Remove'); ?></a>
				<br class="clear" />
			</div>
		</div>
<?php
	if ( empty($sidebar_args['_display']) || 'template' != $sidebar_args['_display'] )
		echo $sidebar_args['after_widget'];
	return $sidebar_args;
}

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param string $string
 * @return string
 */
function wp_widget_control_ob_filter( $string ) {
	if ( false === $beg = strpos( $string, '%BEG_OF_TITLE%' ) )
		return '';
	if ( false === $end = strpos( $string, '%END_OF_TITLE%' ) )
		return '';
	$string = substr( $string, $beg + 14 , $end - $beg - 14);
	$string = str_replace( '&nbsp;', ' ', $string );
	return trim( wp_specialchars( strip_tags( $string ) ) );
}

?>                                                                                                                                                                              wp-admin/includes/class-wp-filesystem-base.php                                                      0000755 0023422 0004734 00000021725 11117531364 022474  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Base WordPress Filesystem.
 *
 * @package WordPress
 * @subpackage Filesystem
 */

/**
 * Base WordPress Filesystem class for which Filesystem implementations extend
 *
 * @since 2.5
 */
class WP_Filesystem_Base {
	/**
	 * Whether to display debug data for the connection or not.
	 *
	 * @since 2.5
	 * @access public
	 * @var bool
	 */
	var $verbose = false;
	/**
	 * Cached list of local filepaths to maped remote filepaths.
	 *
	 * @since 2.7
	 * @access private
	 * @var array
	 */
	var $cache = array();

	/**
	 * The Access method of the current connection, Set automatically.
	 *
	 * @since 2.5
	 * @access public
	 * @var string
	 */
	var $method = '';

	/**
	 * Returns the path on the remote filesystem of ABSPATH
	 *
	 * @since 2.7
	 * @access public
	 * @return string The location of the remote path.
	 */
	function abspath() {
		if ( defined('FTP_BASE') && strpos($this->method, 'ftp') !== false )
			return FTP_BASE;
		$folder = $this->find_folder(ABSPATH);
		//Perhaps the FTP folder is rooted at the WordPress install, Check for wp-includes folder in root, Could have some false positives, but rare.
		if ( ! $folder && $this->is_dir('/wp-includes') )
			$folder = '/';
		return $folder;
	}
	/**
	 * Returns the path on the remote filesystem of WP_CONTENT_DIR
	 *
	 * @since 2.7
	 * @access public
	 * @return string The location of the remote path.
	 */
	function wp_content_dir() {
		if ( defined('FTP_CONTENT_DIR') && strpos($this->method, 'ftp') !== false )
			return FTP_CONTENT_DIR;
		return $this->find_folder(WP_CONTENT_DIR);
	}
	/**
	 * Returns the path on the remote filesystem of WP_PLUGIN_DIR
	 *
	 * @since 2.7
	 * @access public
	 *
	 * @return string The location of the remote path.
	 */
	function wp_plugins_dir() {
		if ( defined('FTP_PLUGIN_DIR') && strpos($this->method, 'ftp') !== false )
			return FTP_PLUGIN_DIR;
		return $this->find_folder(WP_PLUGIN_DIR);
	}
	/**
	 * Returns the path on the remote filesystem of the Themes Directory
	 *
	 * @since 2.7
	 * @access public
	 *
	 * @return string The location of the remote path.
	 */
	function wp_themes_dir() {
		return $this->wp_content_dir() . '/themes';
	}

	/**
	 * Locates a folder on the remote filesystem.
	 *
	 * Deprecated; use WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir() methods instead.
	 *
	 * @since 2.5
	 * @deprecated 2.7
	 * @access public
	 *
	 * @param string $base The folder to start searching from
	 * @param bool $echo True to display debug information
	 * @return string The location of the remote path.
	 */
	function find_base_dir($base = '.', $echo = false) {
		_deprecated_function(__FUNCTION__, '2.7', 'WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir()' );
		$this->verbose = $echo;
		return $this->abspath();
	}
	/**
	 * Locates a folder on the remote filesystem.
	 *
	 * Deprecated; use WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir() methods instead.
	 *
	 * @since 2.5
	 * @deprecated 2.7
	 * @access public
	 *
	 * @param string $base The folder to start searching from
	 * @param bool $echo True to display debug information
	 * @return string The location of the remote path.
	 */
	function get_base_dir($base = '.', $echo = false) {
		_deprecated_function(__FUNCTION__, '2.7', 'WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir()' );
		$this->verbose = $echo;
		return $this->abspath();
	}

	/**
	 * Locates a folder on the remote filesystem.
	 *
	 * Assumes that on Windows systems, Stripping off the Drive letter is OK
	 * Sanitizes \\ to / in windows filepaths.
	 *
	 * @since 2.7
	 * @access public
	 *
	 * @param string $folder the folder to locate
	 * @return string The location of the remote path.
	 */
	function find_folder($folder) {

		$folder = preg_replace('|^([a-z]{1}):|i', '', $folder); //Strip out windows driveletter if its there.
		$folder = str_replace('\\', '/', $folder); //Windows path sanitiation

		if ( isset($this->cache[ $folder ] ) )
			return $this->cache[ $folder ];

		if ( $this->exists($folder) ) { //Folder exists at that absolute path.
			$this->cache[ $folder ] = $folder;
			return $folder;
		}
		if( $return = $this->search_for_folder($folder) )
			$this->cache[ $folder ] = $return;
		return $return;
	}

	/**
	 * Locates a folder on the remote filesystem.
	 *
	 * Expects Windows sanitized path
	 *
	 * @since 2.7
	 * @access private
	 *
	 * @param string $folder the folder to locate
	 * @param string $base the folder to start searching from
	 * @param bool $loop if the function has recursed, Internal use only
	 * @return string The location of the remote path.
	 */
	function search_for_folder($folder, $base = '.', $loop = false ) {
		if ( empty( $base ) || '.' == $base )
			$base = trailingslashit($this->cwd());

		$folder = untrailingslashit($folder);

		$folder_parts = explode('/', $folder);
		$last_path = $folder_parts[ count($folder_parts) - 1 ];

		$files = $this->dirlist( $base );

		foreach ( $folder_parts as $key ) {
			if ( $key == $last_path )
				continue; //We want this to be caught by the next code block.

			//Working from /home/ to /user/ to /wordpress/ see if that file exists within the current folder,
			// If its found, change into it and follow through looking for it.
			// If it cant find WordPress down that route, it'll continue onto the next folder level, and see if that matches, and so on.
			// If it reaches the end, and still cant find it, it'll return false for the entire function.
			if( isset($files[ $key ]) ){
				//Lets try that folder:
				$newdir = trailingslashit(path_join($base, $key));
				if( $this->verbose )
					printf( __('Changing to %s') . '<br/>', $newdir );
				if( $ret = $this->search_for_folder( $folder, $newdir, $loop) )
					return $ret;
			}
		}

		//Only check this as a last resort, to prevent locating the incorrect install. All above proceeedures will fail quickly if this is the right branch to take.
		if(isset( $files[ $last_path ] ) ) {
			if( $this->verbose )
				printf( __('Found %s') . '<br/>',  $base . $last_path );
			return $base . $last_path;
		}
		if( $loop )
			return false;//Prevent tihs function looping again.
		//As an extra last resort, Change back to / if the folder wasnt found. This comes into effect when the CWD is /home/user/ but WP is at /var/www/.... mainly dedicated setups.
		return $this->search_for_folder($folder, '/', true);

	}

	/**
	 * Returns the *nix style file permissions for a file
	 *
	 * From the PHP documentation page for fileperms()
	 *
	 * @link http://docs.php.net/fileperms
	 * @since 2.5
	 * @access public
	 *
	 * @param string $file string filename
	 * @return int octal representation of permissions
	 */
	function gethchmod($file){
		$perms = $this->getchmod($file);
		if (($perms & 0xC000) == 0xC000) // Socket
			$info = 's';
		elseif (($perms & 0xA000) == 0xA000) // Symbolic Link
			$info = 'l';
		elseif (($perms & 0x8000) == 0x8000) // Regular
			$info = '-';
		elseif (($perms & 0x6000) == 0x6000) // Block special
			$info = 'b';
		elseif (($perms & 0x4000) == 0x4000) // Directory
			$info = 'd';
		elseif (($perms & 0x2000) == 0x2000) // Character special
			$info = 'c';
		elseif (($perms & 0x1000) == 0x1000)// FIFO pipe
			$info = 'p';
		else // Unknown
			$info = 'u';

		// Owner
		$info .= (($perms & 0x0100) ? 'r' : '-');
		$info .= (($perms & 0x0080) ? 'w' : '-');
		$info .= (($perms & 0x0040) ?
					(($perms & 0x0800) ? 's' : 'x' ) :
					(($perms & 0x0800) ? 'S' : '-'));

		// Group
		$info .= (($perms & 0x0020) ? 'r' : '-');
		$info .= (($perms & 0x0010) ? 'w' : '-');
		$info .= (($perms & 0x0008) ?
					(($perms & 0x0400) ? 's' : 'x' ) :
					(($perms & 0x0400) ? 'S' : '-'));

		// World
		$info .= (($perms & 0x0004) ? 'r' : '-');
		$info .= (($perms & 0x0002) ? 'w' : '-');
		$info .= (($perms & 0x0001) ?
					(($perms & 0x0200) ? 't' : 'x' ) :
					(($perms & 0x0200) ? 'T' : '-'));
		return $info;
	}

	/**
	 * Converts *nix style file permissions to a octal number.
	 *
	 * Converts '-rw-r--r--' to 0644
	 * From "info at rvgate dot nl"'s comment on the PHP documentation for chmod()
 	 *
	 * @link http://docs.php.net/manual/en/function.chmod.php#49614
	 * @since 2.5
	 * @access public
	 *
	 * @param string $mode string *nix style file permission
	 * @return int octal representation
	 */
	function getnumchmodfromh($mode) {
		$realmode = '';
		$legal =  array('', 'w', 'r', 'x', '-');
		$attarray = preg_split('//', $mode);

		for($i=0; $i < count($attarray); $i++)
		   if($key = array_search($attarray[$i], $legal))
			   $realmode .= $legal[$key];

		$mode = str_pad($realmode, 9, '-');
		$trans = array('-'=>'0', 'r'=>'4', 'w'=>'2', 'x'=>'1');
		$mode = strtr($mode,$trans);

		$newmode = '';
		$newmode .= $mode[0] + $mode[1] + $mode[2];
		$newmode .= $mode[3] + $mode[4] + $mode[5];
		$newmode .= $mode[6] + $mode[7] + $mode[8];
		return $newmode;
	}

	/**
	 * Determines if the string provided contains binary characters.
	 *
	 * @since 2.7
	 * @access private
	 *
	 * @param string $text String to test against
	 * @return bool true if string is binary, false otherwise
	 */
	function is_binary( $text ) {
		return (bool) preg_match('|[^\x20-\x7E]|', $text); //chr(32)..chr(127)
	}
}

?>
                                           wp-admin/includes/class-wp-filesystem-ssh2.php                                                      0000755 0023422 0004734 00000033634 11117531364 022443  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress SSH2 Filesystem.
 *
 * @package WordPress
 * @subpackage Filesystem
 */

/**
 * WordPress Filesystem Class for implementing SSH2.
 *
 * To use this class you must follow these steps for PHP 5.2.6+
 *
 * @contrib http://kevin.vanzonneveld.net/techblog/article/make_ssh_connections_with_php/ - Installation Notes
 *
 * Complie libssh2 (Note: Only 0.14 is officaly working with PHP 5.2.6+ right now.)
 *
 * cd /usr/src
 * wget http://surfnet.dl.sourceforge.net/sourceforge/libssh2/libssh2-0.14.tar.gz
 * tar -zxvf libssh2-0.14.tar.gz
 * cd libssh2-0.14/
 * ./configure
 * make all install
 *
 * Note: No not leave the directory yet!
 *
 * Enter: pecl install -f ssh2
 *
 * Copy the ssh.so file it creates to your PHP Module Directory.
 * Open up your PHP.INI file and look for where extensions are placed.
 * Add in your PHP.ini file: extension=ssh2.so
 *
 * Restart Apache!
 * Check phpinfo() streams to confirm that: ssh2.shell, ssh2.exec, ssh2.tunnel, ssh2.scp, ssh2.sftp  exist.
 *
 *
 * @since 2.7
 * @package WordPress
 * @subpackage Filesystem
 * @uses WP_Filesystem_Base Extends class
 */
class WP_Filesystem_SSH2 extends WP_Filesystem_Base {

	var $debugtest = false;	//	set this to true only if your a debuging your connection

	var $link = null;
	var $sftp_link = null;
	var $keys = false;
	/*
	 * This is the timeout value for ssh results to comeback.
	 * Slower servers might need this incressed, but this number otherwise should not change.
	 *
	 * @parm $timeout int
	 *
	 */
	var $timeout = 15;
	var $errors = array();
	var $options = array();

	var $permission = 0644;

	function WP_Filesystem_SSH2($opt='') {
		$this->method = 'ssh2';
		$this->errors = new WP_Error();

		//Check if possible to use ssh2 functions.
		if ( ! extension_loaded('ssh2') ) {
			$this->errors->add('no_ssh2_ext', __('The ssh2 PHP extension is not available'));
			return false;
		}

		// Set defaults:
		if ( empty($opt['port']) )
			$this->options['port'] = 22;
		else
			$this->options['port'] = $opt['port'];

		if ( empty($opt['hostname']) )
			$this->errors->add('empty_hostname', __('SSH2 hostname is required'));
		else
			$this->options['hostname'] = $opt['hostname'];

		if ( isset($opt['base']) && ! empty($opt['base']) )
			$this->wp_base = $opt['base'];

		// Check if the options provided are OK.
		if ( empty ($opt['username']) )
			$this->errors->add('empty_username', __('SSH2 username is required'));
		else
			$this->options['username'] = $opt['username'];

		if ( ( !empty ($opt['public_key']) ) && ( !empty ($opt['private_key']) ) ) {
			$this->options['public_key'] = $opt['public_key'];
			$this->options['private_key'] = $opt['private_key'];

			$this->options['hostkey'] = array("hostkey" => "ssh-rsa");

			$this->keys = true;
		}


		if ( empty ($opt['password']) ) {
			if ( !$this->keys )	//	 password can be blank if we are using keys
				$this->errors->add('empty_password', __('SSH2 password is required'));
		} else {
			$this->options['password'] = $opt['password'];
		}

	}

	function connect() {
		$this->debug("connect();");

		if ( ! $this->keys ) {
			$this->link = @ssh2_connect($this->options['hostname'], $this->options['port']);
		} else {
			$this->link = @ssh2_connect($this->options['hostname'], $this->options['port'], $this->options['hostkey']);
		}

		if ( ! $this->link ) {
			$this->errors->add('connect', sprintf(__('Failed to connect to SSH2 Server %1$s:%2$s'), $this->options['hostname'], $this->options['port']));
			return false;
		}

		if ( !$this->keys ) {
			if ( ! @ssh2_auth_password($this->link, $this->options['username'], $this->options['password']) ) {
				$this->errors->add('auth', sprintf(__('Username/Password incorrect for %s'), $this->options['username']));
				return false;
			}
		} else {
			if ( ! @ssh2_auth_pubkey_file($this->link, $this->options['username'], $this->options['public_key'], $this->options['private_key'], $this->options['password'] ) ) {
				$this->errors->add('auth', sprintf(__('Public and Private keys incorrent for %s'), $this->options['username']));
				return false;
			}
		}

		$this->sftp_link = ssh2_sftp($this->link);

		return true;
	}

	function run_command($link, $command, $returnbool = false) {
		$this->debug("run_command();");
		if(!($stream = @ssh2_exec( $link, $command . "; echo \"__COMMAND_FINISHED__\";"))) {
			$this->errors->add('command', sprintf(__('Unable to perform command: %s'), $command));
		} else {
			stream_set_blocking( $stream, true );
			$time_start = time();
			$data = null;
			while( true ) {
				if (strpos($data,"__COMMAND_FINISHED__") !== false){
					break;	//	the command has finshed!
				}
				if( (time()-$time_start) > $this->timeout ){
					$this->errors->add('command', sprintf(__('Connection to the server has timeout after %s seconds.'), $this->timeout));
					unset($this->link);
					unset($this->sftp_link); //	close connections
					return false;
				}
				while( $buf = fread( $stream, strlen($stream) ) )
					$data .= $buf;
			}
			fclose($stream);
			$data = trim(str_replace("__COMMAND_FINISHED__", "", $data));
			if (($returnbool) && ( (int) $data )) {
				return true;
			} elseif (($returnbool) && (! (int) $data )) {
				return false;
			} else {
				return $data;
			}
		}
		return false;
	}

	function debug($text)
	{
		if ($this->debugtest)
		{
			echo "<br/>" . $text . "<br/>";
		}
	}

	function setDefaultPermissions($perm) {
		$this->debug("setDefaultPermissions();");
		if ( $perm )
			$this->permission = $perm;
	}

	function get_contents($file, $type = '', $resumepos = 0 ) {
		$this->debug("get_contents();");
		$tempfile = wp_tempnam( $file );
		if ( ! $tempfile )
			return false;
		if( ! ssh2_scp_recv($this->link, $file, $tempfile) )
			return false;
		$contents = file_get_contents($tempfile);
		unlink($tempfile);
		return $contents;
	}

	function get_contents_array($file) {
		$this->debug("get_contents_array();");
		return explode("\n", $this->get_contents($file));
	}

	function put_contents($file, $contents, $type = '' ) {
		$this->debug("put_contents($file);");
		$tempfile = wp_tempnam( $file );
		$temp = fopen($tempfile, 'w');
		if ( ! $temp )
			return false;
		fwrite($temp, $contents);
		fclose($temp);
		$ret = ssh2_scp_send($this->link, $tempfile, $file, $this->permission);
		unlink($tempfile);
		return $ret;
	}

	function cwd() {
		$this->debug("cwd();");
		$cwd = $this->run_command($this->link, 'pwd');
		if( $cwd )
			$cwd = trailingslashit($cwd);
		return $cwd;
	}

	function chdir($dir) {
		$this->debug("chdir();");
		return $this->run_command($this->link, 'cd ' . $dir, true);
	}

	function chgrp($file, $group, $recursive = false ) {
		$this->debug("chgrp();");
		if ( ! $this->exists($file) )
			return false;
		if ( ! $recursive || ! $this->is_dir($file) )
			return $this->run_command($this->link, sprintf('chgrp %o %s', $mode, $file), true);
		return $this->run_command($this->link, sprintf('chgrp -R %o %s', $mode, $file), true);
	}

	function chmod($file, $mode = false, $recursive = false) {
		$this->debug("chmod();");
		if( ! $mode )
			$mode = $this->permission;
		if( ! $mode )
			return false;
		if ( ! $this->exists($file) )
			return false;
		if ( ! $recursive || ! $this->is_dir($file) )
			return $this->run_command($this->link, sprintf('chmod %o %s', $mode, $file), true);
		return $this->run_command($this->link, sprintf('chmod -R %o %s', $mode, $file), true);
	}

	function chown($file, $owner, $recursive = false ) {
		$this->debug("chown();");
		if ( ! $this->exists($file) )
			return false;
		if ( ! $recursive || ! $this->is_dir($file) )
			return $this->run_command($this->link, sprintf('chown %o %s', $mode, $file), true);
		return $this->run_command($this->link, sprintf('chown -R %o %s', $mode, $file), true);
	}

	function owner($file) {
		$this->debug("owner();");
		$dir = $this->dirlist($file);
		return $dir[$file]['owner'];
	}

	function getchmod($file) {
		$this->debug("getchmod();");
		$dir = $this->dirlist($file);
		return $dir[$file]['permsn'];
	}

	function group($file) {
		$this->debug("group();");
		$dir = $this->dirlist($file);
		return $dir[$file]['group'];
	}

	function copy($source, $destination, $overwrite = false ) {
		$this->debug("copy();");
		if( ! $overwrite && $this->exists($destination) )
			return false;
		$content = $this->get_contents($source);
		if( false === $content)
			return false;
		return $this->put_contents($destination, $content);
	}

	function move($source, $destination, $overwrite = false) {
		$this->debug("move();");
		return @ssh2_sftp_rename($this->link, $source, $destination);
	}

	function delete($file, $recursive = false) {
		$this->debug("delete();");
		if ( $this->is_file($file) )
			return ssh2_sftp_unlink($this->sftp_link, $file);
		if ( ! $recursive )
			 return ssh2_sftp_rmdir($this->sftp_link, $file);
		$filelist = $this->dirlist($file);
		if ( is_array($filelist) ) {
			foreach ( $filelist as $filename => $fileinfo) {
				$this->delete($file . '/' . $filename, $recursive);
			}
		}
		return ssh2_sftp_rmdir($this->sftp_link, $file);
	}

	function exists($file) {
		$this->debug("exists();");
		return $this->run_command($this->link, sprintf('ls -lad %s', $file), true);
	}

	function is_file($file) {
		$this->debug("is_file();");
		//DO NOT RELY ON dirlist()!
		$list = $this->run_command($this->link, sprintf('ls -lad %s', $file));
		$list = $this->parselisting($list);
		if ( ! $list )
			return false;
		else
			return ( !$list['isdir'] && !$list['islink'] ); //ie. not a file or link, yet exists, must be file.
	}

	function is_dir($path) {
		$this->debug("is_dir();");
		//DO NOT RELY ON dirlist()!
		$list = $this->parselisting($this->run_command($this->link, sprintf('ls -lad %s', untrailingslashit($path))));
		if ( ! $list )
			return false;
		else
			return $list['isdir'];
	}

	function is_readable($file) {
		//Not implmented.
	}

	function is_writable($file) {
		//Not implmented.
	}

	function atime($file) {
		//Not implmented.
	}

	function mtime($file) {
		//Not implmented.
	}

	function size($file) {
		//Not implmented.
	}

	function touch($file, $time = 0, $atime = 0) {
		//Not implmented.
	}

	function mkdir($path, $chmod = null, $chown = false, $chgrp = false) {
		$this->debug("mkdir();");
		$path = untrailingslashit($path);
		if( ! ssh2_sftp_mkdir($this->sftp_link, $path, $chmod, true) )
			return false;
		if( $chown )
			$this->chown($path, $chown);
		if( $chgrp )
			$this->chgrp($path, $chgrp);
		return true;
	}

	function rmdir($path, $recursive = false) {
		$this->debug("rmdir();");
		return $this->delete($path, $recursive);
	}

	function parselisting($line) {
	$this->debug("parselisting();");
		$is_windows = ($this->OS_remote == FTP_OS_Windows);
		if ($is_windows && preg_match("/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|<DIR>) +(.+)/", $line, $lucifer)) {
			$b = array();
			if ($lucifer[3]<70) { $lucifer[3] +=2000; } else { $lucifer[3]+=1900; } // 4digit year fix
			$b['isdir'] = ($lucifer[7]=="<DIR>");
			if ( $b['isdir'] )
				$b['type'] = 'd';
			else
				$b['type'] = 'f';
			$b['size'] = $lucifer[7];
			$b['month'] = $lucifer[1];
			$b['day'] = $lucifer[2];
			$b['year'] = $lucifer[3];
			$b['hour'] = $lucifer[4];
			$b['minute'] = $lucifer[5];
			$b['time'] = @mktime($lucifer[4]+(strcasecmp($lucifer[6],"PM")==0?12:0),$lucifer[5],0,$lucifer[1],$lucifer[2],$lucifer[3]);
			$b['am/pm'] = $lucifer[6];
			$b['name'] = $lucifer[8];
		} else if (!$is_windows && $lucifer=preg_split("/[ ]/",$line,9,PREG_SPLIT_NO_EMPTY)) {
			//echo $line."\n";
			$lcount=count($lucifer);
			if ($lcount<8) return '';
			$b = array();
			$b['isdir'] = $lucifer[0]{0} === "d";
			$b['islink'] = $lucifer[0]{0} === "l";
			if ( $b['isdir'] )
				$b['type'] = 'd';
			elseif ( $b['islink'] )
				$b['type'] = 'l';
			else
				$b['type'] = 'f';
			$b['perms'] = $lucifer[0];
			$b['number'] = $lucifer[1];
			$b['owner'] = $lucifer[2];
			$b['group'] = $lucifer[3];
			$b['size'] = $lucifer[4];
			if ($lcount==8) {
				sscanf($lucifer[5],"%d-%d-%d",$b['year'],$b['month'],$b['day']);
				sscanf($lucifer[6],"%d:%d",$b['hour'],$b['minute']);
				$b['time'] = @mktime($b['hour'],$b['minute'],0,$b['month'],$b['day'],$b['year']);
				$b['name'] = $lucifer[7];
			} else {
				$b['month'] = $lucifer[5];
				$b['day'] = $lucifer[6];
				if (preg_match("/([0-9]{2}):([0-9]{2})/",$lucifer[7],$l2)) {
					$b['year'] = date("Y");
					$b['hour'] = $l2[1];
					$b['minute'] = $l2[2];
				} else {
					$b['year'] = $lucifer[7];
					$b['hour'] = 0;
					$b['minute'] = 0;
				}
				$b['time'] = strtotime(sprintf("%d %s %d %02d:%02d",$b['day'],$b['month'],$b['year'],$b['hour'],$b['minute']));
				$b['name'] = $lucifer[8];
			}
		}

		return $b;
	}

	function dirlist($path = '.', $incdot = false, $recursive = false) {
		$this->debug("dirlist();");
		if( $this->is_file($path) ) {
			$limitFile = basename($path);
			$path = trailingslashit(dirname($path));
		} else {
			$limitFile = false;
		}

		$list = $this->run_command($this->link, sprintf('ls -la %s', $path));

		if ( $list === false )
			return false;

		$list = explode("\n", $list);

		$dirlist = array();
		foreach ( (array)$list as $k => $v ) {
			$entry = $this->parselisting($v);
			if ( empty($entry) )
				continue;

			if ( '.' == $entry['name'] || '..' == $entry['name'] )
				continue;

			$dirlist[ $entry['name'] ] = $entry;
		}

		if ( ! $dirlist )
			return false;

		if ( empty($dirlist) )
			return array();

		$ret = array();
		foreach ( $dirlist as $struc ) {

			if ( 'd' == $struc['type'] ) {
				$struc['files'] = array();

				if ( $incdot ){
					//We're including the doted starts
					if( '.' != $struc['name'] && '..' != $struc['name'] ){ //Ok, It isnt a special folder
						if ($recursive)
							$struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive);
					}
				} else { //No dots
					if ( $recursive )
						$struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive);
				}
			}
			//File
			$ret[$struc['name']] = $struc;
		}
		return $ret;
	}
	function __destruct() {
		$this->debug("__destruct();");
		if ( $this->link )
			unset($this->link);
		if ( $this->sftp_link )
			unset($this->sftp_link);
	}
}

?>
                                                                                                    wp-admin/includes/plugin-install.php                                                                0000755 0023422 0004734 00000102572 11120015734 020603  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress Plugin Install Administration API
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * Retrieve plugin installer pages from WordPress Plugins API.
 *
 * It is possible for a plugin to override the Plugin API result with three
 * filters. Assume this is for plugins, which can extend on the Plugin Info to
 * offer more choices. This is very powerful and must be used with care, when
 * overridding the filters.
 *
 * The first filter, 'plugins_api_args', is for the args and gives the action as
 * the second parameter. The hook for 'plugins_api_args' must ensure that an
 * object is returned.
 *
 * The second filter, 'plugins_api', is the result that would be returned.
 *
 * @since 2.7.0
 *
 * @param string $action
 * @param array|object $args Optional. Arguments to serialize for the Plugin Info API.
 * @return mixed
 */
function plugins_api($action, $args = null) {

	if( is_array($args) )
		$args = (object)$args;

	if ( !isset($args->per_page) )
		$args->per_page = 24;

	$args = apply_filters('plugins_api_args', $args, $action); //NOTE: Ensure that an object is returned via this filter.
	$res = apply_filters('plugins_api', false, $action, $args); //NOTE: Allows a plugin to completely override the builtin WordPress.org API.

	if ( ! $res ) {
		$request = wp_remote_post('http://api.wordpress.org/plugins/info/1.0/', array( 'body' => array('action' => $action, 'request' => serialize($args))) );
		if ( is_wp_error($request) ) {
			$res = new WP_Error('plugins_api_failed', __('An Unexpected HTTP Error occured during the API request.</p> <p><a href="?" onclick="document.location.reload(); return false;">Try again</a>'), $request->get_error_message() );
		} else {
			$res = unserialize($request['body']);
			if ( ! $res )
				$res = new WP_Error('plugins_api_failed', __('An unknown error occured'), $request['body']);
		}
	}

	return apply_filters('plugins_api_result', $res, $action, $args);
}

/**
 * Retrieve popular WordPress plugin tags.
 *
 * @since 2.7.0
 *
 * @param array $args
 * @return array
 */
function install_popular_tags( $args = array() ) {
	if ( ! ($cache = wp_cache_get('popular_tags', 'api')) && ! ($cache = get_option('wporg_popular_tags')) )
		add_option('wporg_popular_tags', array(), '', 'no'); ///No autoload.

	if ( $cache && $cache->timeout + 3 * 60 * 60 > time() )
		return $cache->cached;

	$tags = plugins_api('hot_tags', $args);

	if ( is_wp_error($tags) )
		return $tags;

	$cache = (object) array('timeout' => time(), 'cached' => $tags);

	update_option('wporg_popular_tags', $cache);
	wp_cache_set('popular_tags', $cache, 'api');

	return $tags;
}
add_action('install_plugins_search', 'install_search', 10, 1);

/**
 * Display search results and display as tag cloud.
 *
 * @since 2.7.0
 *
 * @param string $page
 */
function install_search($page) {
	$type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
	$term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';

	$args = array();

	switch( $type ){
		case 'tag':
			$args['tag'] = sanitize_title_with_dashes($term);
			break;
		case 'term':
			$args['search'] = $term;
			break;
		case 'author':
			$args['author'] = $term;
			break;
	}

	$args['page'] = $page;

	$api = plugins_api('query_plugins', $args);

	if ( is_wp_error($api) )
		wp_die($api);

	add_action('install_plugins_table_header', 'install_search_form');

	display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);

	return;
}

add_action('install_plugins_dashboard', 'install_dashboard');
function install_dashboard() {
	?>
	<p><?php _e('Plugins extend and expand the functionality of WordPress. You may automatically install plugins from the <a href="http://wordpress.org/extend/plugins/">WordPress Plugin Directory</a> or upload a plugin in .zip format via this page.') ?></p>

	<h4><?php _e('Search') ?></h4>
	<?php install_search_form('<a href="' . add_query_arg('show-help', !isset($_REQUEST['show-help'])) .'" onclick="jQuery(\'#search-help\').toggle(); return false;">' . __('[need help?]') . '</a>') ?>
	<div id="search-help" style="display: <?php echo isset($_REQUEST['show-help']) ? 'block' : 'none'; ?>;">
	<p>	<?php _e('You may search based on 3 criteria:') ?><br />
		<?php _e('<strong>Term:</strong> Searches plugins names and descriptions for the specified term') ?><br />
		<?php _e('<strong>Tag:</strong> Searches for plugins tagged as such') ?><br />
		<?php _e('<strong>Author:</strong> Searches for plugins created by the Author, or which the Author contributed to.') ?></p>
	</div>

	<h4><?php _e('Install a plugin in .zip format') ?></h4>
	<p><?php _e('If you have a plugin in a .zip format, You may install it by uploading it here.') ?></p>
	<form method="post" enctype="multipart/form-data" action="<?php echo admin_url('plugin-install.php?tab=upload') ?>">
		<?php wp_nonce_field( 'plugin-upload') ?>
		<input type="file" name="pluginzip" />
		<input type="submit" class="button" value="<?php _e('Install Now') ?>" />
	</form>

	<h4><?php _e('Popular tags') ?></h4>
	<p><?php _e('You may also browse based on the most popular tags in the Plugin Directory:') ?></p>
	<?php

	$api_tags = install_popular_tags();

	//Set up the tags in a way which can be interprated by wp_generate_tag_cloud()
	$tags = array();
	foreach ( (array)$api_tags as $tag )
		$tags[ $tag['name'] ] = (object) array(
								'link' => clean_url( admin_url('plugin-install.php?tab=search&type=tag&s=' . urlencode($tag['name'])) ),
								'name' => $tag['name'],
								'id' => sanitize_title_with_dashes($tag['name']),
								'count' => $tag['count'] );
	echo wp_generate_tag_cloud($tags, array( 'single_text' => __('%d plugin'), 'multiple_text' => __('%d plugins') ) );
}

/**
 * Display search form for searching plugins.
 *
 * @since 2.7.0
 */
function install_search_form(){
	$type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
	$term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';

	?><form id="search-plugins" method="post" action="<?php echo admin_url('plugin-install.php?tab=search') ?>">
		<select name="type" id="typeselector">
			<option value="term"<?php selected('term', $type) ?>><?php _e('Term') ?></option>
			<option value="author"<?php selected('author', $type) ?>><?php _e('Author') ?></option>
			<option value="tag"<?php selected('tag', $type) ?>><?php _e('Tag') ?></option>
		</select>
		<input type="text" name="s" id="search-field" value="<?php echo attribute_escape($term) ?>" />
		<input type="submit" name="search" value="<?php echo attribute_escape(__('Search')) ?>" class="button" />
	</form><?php
}

add_action('install_plugins_featured', 'install_featured', 10, 1);
/**
 * Display featured plugins.
 *
 * @since 2.7.0
 *
 * @param string $page
 */
function install_featured($page = 1) {
	$args = array('browse' => 'featured', 'page' => $page);
	$api = plugins_api('query_plugins', $args);
	if ( is_wp_error($api) )
		wp_die($api);
	display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);
}

add_action('install_plugins_popular', 'install_popular', 10, 1);
/**
 * Display popular plugins.
 *
 * @since 2.7.0
 *
 * @param string $page
 */
function install_popular($page = 1) {
	$args = array('browse' => 'popular', 'page' => $page);
	$api = plugins_api('query_plugins', $args);
	display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);
}

add_action('install_plugins_new', 'install_new', 10, 1);
/**
 * Display new plugins.
 *
 * @since 2.7.0
 *
 * @param string $page
 */
function install_new($page = 1) {
	$args = array('browse' => 'new', 'page' => $page);
	$api = plugins_api('query_plugins', $args);
	if ( is_wp_error($api) )
		wp_die($api);
	display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);
}
add_action('install_plugins_updated', 'install_updated', 10, 1);


/**
 * Display recently updated plugins.
 *
 * @since 2.7.0
 *
 * @param string $page
 */
function install_updated($page = 1) {
	$args = array('browse' => 'updated', 'page' => $page);
	$api = plugins_api('query_plugins', $args);
	display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);
}

/**
 * Display plugin content based on plugin list.
 *
 * @since 2.7.0
 *
 * @param array $plugins List of plugins.
 * @param string $page
 * @param int $totalpages Number of pages.
 */
function display_plugins_table($plugins, $page = 1, $totalpages = 1){
	$type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
	$term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';

	$plugins_allowedtags = array('a' => array('href' => array(),'title' => array(), 'target' => array()),
								'abbr' => array('title' => array()),'acronym' => array('title' => array()),
								'code' => array(), 'pre' => array(), 'em' => array(),'strong' => array());

?>
	<div class="tablenav">
		<div class="alignleft actions">
		<?php do_action('install_plugins_table_header'); ?>
		</div>
		<?php
			$url = clean_url($_SERVER['REQUEST_URI']);
			if ( ! empty($term) )
				$url = add_query_arg('s', $term, $url);
			if ( ! empty($type) )
				$url = add_query_arg('type', $type, $url);

			$page_links = paginate_links( array(
				'base' => add_query_arg('paged', '%#%', $url),
				'format' => '',
				'prev_text' => __('&laquo;'),
				'next_text' => __('&raquo;'),
				'total' => $totalpages,
				'current' => $page
			));

			if ( $page_links )
				echo "\t\t<div class='tablenav-pages'>$page_links</div>";
?>
		<br class="clear" />
	</div>
	<table class="widefat" id="install-plugins" cellspacing="0">
		<thead>
			<tr>
				<th scope="col" class="name"><?php _e('Name'); ?></th>
				<th scope="col" class="num"><?php _e('Version'); ?></th>
				<th scope="col" class="num"><?php _e('Rating'); ?></th>
				<th scope="col" class="desc"><?php _e('Description'); ?></th>
				<th scope="col" class="action-links"><?php _e('Actions'); ?></th>
			</tr>
		</thead>

		<tfoot>
			<tr>
				<th scope="col" class="name"><?php _e('Name'); ?></th>
				<th scope="col" class="num"><?php _e('Version'); ?></th>
				<th scope="col" class="num"><?php _e('Rating'); ?></th>
				<th scope="col" class="desc"><?php _e('Description'); ?></th>
				<th scope="col" class="action-links"><?php _e('Actions'); ?></th>
			</tr>
		</tfoot>

		<tbody class="plugins">
		<?php
			if( empty($plugins) )
				echo '<tr><td colspan="5">', __('No plugins match your request.'), '</td></tr>';

			foreach( (array) $plugins as $plugin ){
				if ( is_object($plugin) )
					$plugin = (array) $plugin;

				$title = wp_kses($plugin['name'], $plugins_allowedtags);
				$description = wp_kses($plugin['description'], $plugins_allowedtags);
				$version = wp_kses($plugin['version'], $plugins_allowedtags);

				$name = strip_tags($title . ' ' . $version);

				$author = $plugin['author'];
				if( ! empty($plugin['author']) )
					$author = ' <cite>' . sprintf( __('By %s'), $author ) . '.</cite>';

				$author = wp_kses($author, $plugins_allowedtags);

				if( isset($plugin['homepage']) )
					$title = '<a target="_blank" href="' . attribute_escape($plugin['homepage']) . '">' . $title . '</a>';

				$action_links = array();
				$action_links[] = '<a href="' . admin_url('plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin['slug'] .
									'&amp;TB_iframe=true&amp;width=600&amp;height=800') . '" class="thickbox onclick" title="' .
									attribute_escape($name) . '">' . __('Install') . '</a>';

				$action_links = apply_filters('plugin_install_action_links', $action_links, $plugin);
			?>
			<tr>
				<td class="name"><?php echo $title; ?></td>
				<td class="vers"><?php echo $version; ?></td>
				<td class="vers">
					<div class="star-holder" title="<?php printf(__ngettext('(based on %s rating)', '(based on %s ratings)', $plugin['num_ratings']), number_format_i18n($plugin['num_ratings'])) ?>">
						<div class="star star-rating" style="width: <?php echo attribute_escape($plugin['rating']) ?>px"></div>
						<div class="star star5"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('5 stars') ?>" /></div>
						<div class="star star4"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('4 stars') ?>" /></div>
						<div class="star star3"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('3 stars') ?>" /></div>
						<div class="star star2"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('2 stars') ?>" /></div>
						<div class="star star1"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('1 star') ?>" /></div>
					</div>
				</td>
				<td class="desc"><p><?php echo $description, $author; ?></p></td>
				<td class="action-links"><?php if ( !empty($action_links) )	echo implode(' | ', $action_links); ?></td>
			</tr>
			<?php
			}
			?>
		</tbody>
	</table>

	<div class="tablenav">
		<?php if ( $page_links )
				echo "\t\t<div class='tablenav-pages'>$page_links</div>"; ?>
		<br class="clear" />
	</div>

<?php
}

add_action('install_plugins_pre_plugin-information', 'install_plugin_information');

/**
 * Display plugin information in dialog box form.
 *
 * @since 2.7.0
 */
function install_plugin_information() {
	global $tab;

	$api = plugins_api('plugin_information', array('slug' => stripslashes( $_REQUEST['plugin'] ) ));

	if ( is_wp_error($api) )
		wp_die($api);

	$plugins_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => array()),
								'abbr' => array('title' => array()), 'acronym' => array('title' => array()),
								'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(),
								'div' => array(), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(),
								'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(),
								'img' => array('src' => array(), 'class' => array(), 'alt' => array()));
	//Sanitize HTML
	foreach ( (array)$api->sections as $section_name => $content )
		$api->sections[$section_name] = wp_kses($content, $plugins_allowedtags);
	foreach ( array('version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug') as $key )
		$api->$key = wp_kses($api->$key, $plugins_allowedtags);

	$section = isset($_REQUEST['section']) ? stripslashes( $_REQUEST['section'] ) : 'description'; //Default to the Description tab, Do not translate, API returns English.
	if( empty($section) || ! isset($api->sections[ $section ]) )
		$section = array_shift( $section_titles = array_keys((array)$api->sections) );

	iframe_header( __('Plugin Install') );
	echo "<div id='$tab-header'>\n";
	echo "<ul id='sidemenu'>\n";
	foreach ( (array)$api->sections as $section_name => $content ) {

		$title = $section_name;
		$title = ucwords(str_replace('_', ' ', $title));

		$class = ( $section_name == $section ) ? ' class="current"' : '';
		$href = add_query_arg( array('tab' => $tab, 'section' => $section_name) );
		$href = clean_url($href);
		$san_title = attribute_escape(sanitize_title_with_dashes($title));
		echo "\t<li><a name='$san_title' target='' href='$href'$class>$title</a></li>\n";
	}
	echo "</ul>\n";
	echo "</div>\n";
	?>
	<div class="alignright fyi">
		<?php if ( ! empty($api->download_link) ) : ?>
		<p class="action-button">
		<?php
			//Default to a "new" plugin
			$type = 'install';
			//Check to see if this plugin is known to be installed, and has an update awaiting it.
			$update_plugins = get_option('update_plugins');
			foreach ( (array)$update_plugins->response as $file => $plugin ) {
				if ( $plugin->slug === $api->slug ) {
					$type = 'update_available';
					$update_file = $file;
					break;
				}
			}
			if ( 'install' == $type && is_dir( WP_PLUGIN_DIR  . '/' . $api->slug ) ) {
				$installed_plugin = get_plugins('/' . $api->slug);
				if ( ! empty($installed_plugin) ) {
					$key = array_shift( $key = array_keys($installed_plugin) ); //Use the first plugin regardless of the name, Could have issues for multiple-plugins in one directory if they share different version numbers
					if ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '>') ){
						$type = 'latest_installed';
					} elseif ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '<') ) {
						$type = 'newer_installed';
						$newer_version = $installed_plugin[ $key ]['Version'];
					} else {
						//If the above update check failed, Then that probably means that the update checker has out-of-date information, force a refresh
						delete_option('update_plugins');
						$update_file = $api->slug . '/' . $key; //This code branch only deals with a plugin which is in a folder the same name as its slug, Doesnt support plugins which have 'non-standard' names
						$type = 'update_available';
					}
				}
			}

			switch ( $type ) :
				default:
				case 'install':
					if ( current_user_can('install_plugins') ) :
				?><a href="<?php echo wp_nonce_url(admin_url('plugin-install.php?tab=install&plugin=' . $api->slug), 'install-plugin_' . $api->slug) ?>" target="_parent"><?php _e('Install Now') ?></a><?php
					endif;
				break;
				case 'update_available':
					if ( current_user_can('update_plugins') ) :
						?><a href="<?php echo wp_nonce_url(admin_url('update.php?action=upgrade-plugin&plugin=' . $update_file), 'upgrade-plugin_' . $update_file) ?>" target="_parent"><?php _e('Install Update Now') ?></a><?php
					endif;
				break;
				case 'newer_installed':
					if ( current_user_can('install_plugins') || current_user_can('update_plugins') ) :
					?><a><?php printf(__('Newer Version (%s) Installed'), $newer_version) ?></a><?php
					endif;
				break;
				case 'latest_installed':
					if ( current_user_can('install_plugins') || current_user_can('update_plugins') ) :
					?><a><?php _e('Latest Version Installed') ?></a><?php
					endif;
				break;
			endswitch; ?>
		</p>
		<?php endif; ?>
		<h2 class="mainheader"><?php _e('FYI') ?></h2>
		<ul>
<?php if ( ! empty($api->version) ) : ?>
			<li><strong><?php _e('Version:') ?></strong> <?php echo $api->version ?></li>
<?php endif; if ( ! empty($api->author) ) : ?>
			<li><strong><?php _e('Author:') ?></strong> <?php echo links_add_target($api->author, '_blank') ?></li>
<?php endif; if ( ! empty($api->last_updated) ) : ?>
			<li><strong><?php _e('Last Updated:') ?></strong> <span title="<?php echo $api->last_updated ?>"><?php
							printf( __('%s ago'), human_time_diff(strtotime($api->last_updated)) ) ?></span></li>
<?php endif; if ( ! empty($api->requires) ) : ?>
			<li><strong><?php _e('Requires WordPress Version:') ?></strong> <?php printf(__('%s or higher'), $api->requires) ?></li>
<?php endif; if ( ! empty($api->tested) ) : ?>
			<li><strong><?php _e('Compatible up to:') ?></strong> <?php echo $api->tested ?></li>
<?php endif; if ( ! empty($api->downloaded) ) : ?>
			<li><strong><?php _e('Downloaded:') ?></strong> <?php printf(__ngettext('%s time', '%s times', $api->downloaded), number_format_i18n($api->downloaded)) ?></li>
<?php endif; if ( ! empty($api->slug) ) : ?>
			<li><a target="_blank" href="http://wordpress.org/extend/plugins/<?php echo $api->slug ?>/"><?php _e('WordPress.org Plugin Page &#187;') ?></a></li>
<?php endif; if ( ! empty($api->homepage) ) : ?>
			<li><a target="_blank" href="<?php echo $api->homepage ?>"><?php _e('Plugin Homepage  &#187;') ?></a></li>
<?php endif; ?>
		</ul>
		<h2><?php _e('Average Rating') ?></h2>
		<div class="star-holder" title="<?php printf(__ngettext('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings)); ?>">
			<div class="star star-rating" style="width: <?php echo attribute_escape($api->rating) ?>px"></div>
			<div class="star star5"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('5 stars') ?>" /></div>
			<div class="star star4"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('4 stars') ?>" /></div>
			<div class="star star3"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('3 stars') ?>" /></div>
			<div class="star star2"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('2 stars') ?>" /></div>
			<div class="star star1"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('1 star') ?>" /></div>
		</div>
		<small><?php printf(__ngettext('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings)); ?></small>
	</div>
	<div id="section-holder" class="wrap">
	<?php
		if ( version_compare($GLOBALS['wp_version'], $api->tested, '>') )
			echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been tested</strong> with your current version of WordPress.') . '</p></div>';
		else if ( version_compare($GLOBALS['wp_version'], $api->requires, '<') )
			echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has not been marked as <strong>compatible</strong> with your version of WordPress.') . '</p></div>';
		foreach ( (array)$api->sections as $section_name => $content ) {
			$title = $section_name;
			$title[0] = strtoupper($title[0]);
			$title = str_replace('_', ' ', $title);

			$content = links_add_base_url($content, 'http://wordpress.org/extend/plugins/' . $api->slug . '/');
			$content = links_add_target($content, '_blank');

			$san_title = attribute_escape(sanitize_title_with_dashes($title));

			$display = ( $section_name == $section ) ? 'block' : 'none';

			echo "\t<div id='section-{$san_title}' class='section' style='display: {$display};'>\n";
			echo "\t\t<h2 class='long-header'>$title</h2>";
			echo $content;
			echo "\t</div>\n";
		}
	echo "</div>\n";

	iframe_footer();
	exit;
}


add_action('install_plugins_upload', 'upload_plugin');
function upload_plugin() {

	if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) )
		wp_die($uploads['error']);

	if ( !empty($_FILES) )
		$filename = $_FILES['pluginzip']['name'];
	else if ( isset($_GET['package']) )
		$filename = $_GET['package'];

	check_admin_referer('plugin-upload');

	echo '<div class="wrap">';
	echo '<h2>', sprintf( __('Installing Plugin from file: %s'), basename($filename) ), '</h2>';

	//Handle a newly uploaded file, Else assume it was
	if ( !empty($_FILES) ) {
		$filename = wp_unique_filename( $uploads['basedir'], $filename );
		$local_file = $uploads['basedir'] . '/' . $filename;

		// Move the file to the uploads dir
		if ( false === @ move_uploaded_file( $_FILES['pluginzip']['tmp_name'], $local_file) )
			wp_die( sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path']));
	} else {
		$local_file = $uploads['basedir'] . '/' . $filename;
	}

	do_plugin_install_local_package($local_file, $filename);
	echo '</div>';
}

add_action('install_plugins_install', 'install_plugin');

/**
 * Display plugin link and execute install.
 *
 * @since 2.7.0
 */
function install_plugin() {

	$plugin = isset($_REQUEST['plugin']) ? stripslashes( $_REQUEST['plugin'] ) : '';

	check_admin_referer('install-plugin_' . $plugin);
	$api = plugins_api('plugin_information', array('slug' => $plugin, 'fields' => array('sections' => false) ) ); //Save on a bit of bandwidth.

	if ( is_wp_error($api) )
		wp_die($api);

	echo '<div class="wrap">';
	echo '<h2>', sprintf( __('Installing Plugin: %s'), $api->name . ' ' . $api->version ), '</h2>';

	do_plugin_install($api->download_link, $api);
	echo '</div>';

}

/**
 * Retrieve plugin and install.
 *
 * @since 2.7.0
 *
 * @param string $download_url Download URL.
 * @param object $plugin_information Optional. Plugin information
 */
function do_plugin_install($download_url, $plugin_information = null) {
	global $wp_filesystem;

	if ( empty($download_url) ) {
		show_message( __('No plugin Specified') );
		return;
	}

	$plugin = isset($_REQUEST['plugin']) ? stripslashes( $_REQUEST['plugin'] ) : '';

	$url = 'plugin-install.php?tab=install';
	$url = add_query_arg(array('plugin' => $plugin, 'plugin_name' => stripslashes( $_REQUEST['plugin_name'] ), 'download_url' => stripslashes( $_REQUEST['download_url'] ) ), $url);

	$url = wp_nonce_url($url, 'install-plugin_' . $plugin);
	if ( false === ($credentials = request_filesystem_credentials($url)) )
		return;

	if ( ! WP_Filesystem($credentials) ) {
		request_filesystem_credentials($url, '', true); //Failed to connect, Error and request again
		return;
	}

	if ( $wp_filesystem->errors->get_error_code() ) {
		foreach ( $wp_filesystem->errors->get_error_messages() as $message )
			show_message($message);
		return;
	}

	$result = wp_install_plugin( $download_url, 'show_message' );

	if ( is_wp_error($result) ) {
		show_message($result);
		show_message( __('Installation Failed') );
	} else {
		show_message( sprintf(__('Successfully installed the plugin <strong>%s %s</strong>.'), $plugin_information->name, $plugin_information->version) );
		$plugin_file = $result;

		$install_actions = apply_filters('install_plugin_complete_actions', array(
			'activate_plugin' => '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . attribute_escape(__('Activate this plugin')) . '" target="_parent">' . __('Activate Plugin') . '</a>',
			'plugins_page' => '<a href="' . admin_url('plugins.php') . '" title="' . attribute_escape(__('Goto plugins page')) . '" target="_parent">' . __('Return to Plugins page') . '</a>'
							), $plugin_information, $plugin_file);
		if ( ! empty($install_actions) )
			show_message('<strong>' . __('Actions:') . '</strong> ' . implode(' | ', (array)$install_actions));
	}
}

/**
 * Install a plugin from a local file.
 *
 * @since 2.7.0
 *
 * @param string $package Local Plugin zip
 * @param string $filename Optional. Original filename
 * @param object $plugin_information Optional. Plugin information
 */
function do_plugin_install_local_package($package, $filename = '') {
	global $wp_filesystem;

	if ( empty($package) ) {
		show_message( __('No plugin Specified') );
		return;
	}

	if ( empty($filename) )
		$filename = basename($package);

	$url = 'plugin-install.php?tab=upload';
	$url = add_query_arg(array('package' => $filename), $url);

	$url = wp_nonce_url($url, 'plugin-upload');
	if ( false === ($credentials = request_filesystem_credentials($url)) )
		return;

	if ( ! WP_Filesystem($credentials) ) {
		request_filesystem_credentials($url, '', true); //Failed to connect, Error and request again
		return;
	}

	if ( $wp_filesystem->errors->get_error_code() ) {
		foreach ( $wp_filesystem->errors->get_error_messages() as $message )
			show_message($message);
		return;
	}

	$result = wp_install_plugin_local_package( $package, 'show_message' );

	if ( is_wp_error($result) ) {
		show_message($result);
		show_message( __('Installation Failed') );
	} else {
		show_message( __('Successfully installed the plugin.') );
		$plugin_file = $result;

		$install_actions = apply_filters('install_plugin_complete_actions', array(
							'activate_plugin' => '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin') . '" target="_parent">' . __('Activate Plugin') . '</a>',
							'plugins_page' => '<a href="' . admin_url('plugins.php') . '" title="' . __('Goto plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>'
							), array(), $plugin_file);
		if ( ! empty($install_actions) )
			show_message('<strong>' . __('Actions:') . '</strong> ' . implode(' | ', (array)$install_actions));
	}
}

/**
 * Install plugin.
 *
 * @since 2.7.0
 *
 * @param string $package
 * @param string $feedback Optional.
 * @return mixed.
 */
function wp_install_plugin($package, $feedback = '') {
	global $wp_filesystem;

	if ( !empty($feedback) )
		add_filter('install_feedback', $feedback);

	// Is a filesystem accessor setup?
	if ( ! $wp_filesystem || ! is_object($wp_filesystem) )
		WP_Filesystem();

	if ( ! is_object($wp_filesystem) )
		return new WP_Error('fs_unavailable', __('Could not access filesystem.'));

	if ( $wp_filesystem->errors->get_error_code() )
		return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors);

	//Get the base plugin folder
	$plugins_dir = $wp_filesystem->wp_plugins_dir();
	if ( empty($plugins_dir) )
		return new WP_Error('fs_no_plugins_dir', __('Unable to locate WordPress Plugin directory.'));

	//And the same for the Content directory.
	$content_dir = $wp_filesystem->wp_content_dir();
	if( empty($content_dir) )
		return new WP_Error('fs_no_content_dir', __('Unable to locate WordPress Content directory (wp-content).'));

	$plugins_dir = trailingslashit( $plugins_dir );
	$content_dir = trailingslashit( $content_dir );

	if ( empty($package) )
		return new WP_Error('no_package', __('Install package not available.'));

	// Download the package
	apply_filters('install_feedback', sprintf(__('Downloading plugin package from %s'), $package));
	$download_file = download_url($package);

	if ( is_wp_error($download_file) )
		return new WP_Error('download_failed', __('Download failed.'), $download_file->get_error_message());

	$working_dir = $content_dir . 'upgrade/' . basename($package, '.zip');

	// Clean up working directory
	if ( $wp_filesystem->is_dir($working_dir) )
		$wp_filesystem->delete($working_dir, true);

	apply_filters('install_feedback', __('Unpacking the plugin package'));
	// Unzip package to working directory
	$result = unzip_file($download_file, $working_dir);

	// Once extracted, delete the package
	@unlink($download_file);

	if ( is_wp_error($result) ) {
		$wp_filesystem->delete($working_dir, true);
		return $result;
	}

	//Get a list of the directories in the working directory before we delete it, We need to know the new folder for the plugin
	$filelist = array_keys( $wp_filesystem->dirlist($working_dir) );

	if( $wp_filesystem->exists( $plugins_dir . $filelist[0] ) ) {
		$wp_filesystem->delete($working_dir, true);
		return new WP_Error('install_folder_exists', __('Folder already exists.'), $filelist[0] );
	}

	apply_filters('install_feedback', __('Installing the plugin'));
	// Copy new version of plugin into place.
	$result = copy_dir($working_dir, $plugins_dir);
	if ( is_wp_error($result) ) {
		$wp_filesystem->delete($working_dir, true);
		return $result;
	}

	//Get a list of the directories in the working directory before we delete it, We need to know the new folder for the plugin
	$filelist = array_keys( $wp_filesystem->dirlist($working_dir) );

	// Remove working directory
	$wp_filesystem->delete($working_dir, true);

	if( empty($filelist) )
		return false; //We couldnt find any files in the working dir, therefor no plugin installed? Failsafe backup.

	$folder = $filelist[0];
	$plugin = get_plugins('/' . $folder); //Ensure to pass with leading slash
	$pluginfiles = array_keys($plugin); //Assume the requested plugin is the first in the list

	//Return the plugin files name.
	return  $folder . '/' . $pluginfiles[0];
}

/**
 * Install plugin from local package
 *
 * @since 2.7.0
 *
 * @param string $package
 * @param string $feedback Optional.
 * @return mixed.
 */
function wp_install_plugin_local_package($package, $feedback = '') {
	global $wp_filesystem;

	if ( !empty($feedback) )
		add_filter('install_feedback', $feedback);

	// Is a filesystem accessor setup?
	if ( ! $wp_filesystem || ! is_object($wp_filesystem) )
		WP_Filesystem();

	if ( ! is_object($wp_filesystem) )
		return new WP_Error('fs_unavailable', __('Could not access filesystem.'));

	if ( $wp_filesystem->errors->get_error_code() )
		return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors);

	//Get the base plugin folder
	$plugins_dir = $wp_filesystem->wp_plugins_dir();
	if ( empty($plugins_dir) )
		return new WP_Error('fs_no_plugins_dir', __('Unable to locate WordPress Plugin directory.'));

	//And the same for the Content directory.
	$content_dir = $wp_filesystem->wp_content_dir();
	if( empty($content_dir) )
		return new WP_Error('fs_no_content_dir', __('Unable to locate WordPress Content directory (wp-content).'));

	$plugins_dir = trailingslashit( $plugins_dir );
	$content_dir = trailingslashit( $content_dir );

	if ( empty($package) )
		return new WP_Error('no_package', __('Install package not available.'));

	$working_dir = $content_dir . 'upgrade/' . basename($package, '.zip');

	// Clean up working directory
	if ( $wp_filesystem->is_dir($working_dir) )
		$wp_filesystem->delete($working_dir, true);

	apply_filters('install_feedback', __('Unpacking the plugin package'));
	// Unzip package to working directory
	$result = unzip_file($package, $working_dir);

	// Once extracted, delete the package
	unlink($package);

	if ( is_wp_error($result) ) {
		$wp_filesystem->delete($working_dir, true);
		return $result;
	}

	//Get a list of the directories in the working directory before we delete it, We need to know the new folder for the plugin
	$filelist = array_keys( $wp_filesystem->dirlist($working_dir) );

	if( $wp_filesystem->exists( $plugins_dir . $filelist[0] ) ) {
		$wp_filesystem->delete($working_dir, true);
		return new WP_Error('install_folder_exists', __('Folder already exists.'), $filelist[0] );
	}

	apply_filters('install_feedback', __('Installing the plugin'));
	// Copy new version of plugin into place.
	$result = copy_dir($working_dir, $plugins_dir);
	if ( is_wp_error($result) ) {
		$wp_filesystem->delete($working_dir, true);
		return $result;
	}

	//Get a list of the directories in the working directory before we delete it, We need to know the new folder for the plugin
	$filelist = array_keys( $wp_filesystem->dirlist($working_dir) );

	// Remove working directory
	$wp_filesystem->delete($working_dir, true);

	if( empty($filelist) )
		return false; //We couldnt find any files in the working dir, therefor no plugin installed? Failsafe backup.

	$folder = $filelist[0];
	$plugin = get_plugins('/' . $folder); //Ensure to pass with leading slash
	$pluginfiles = array_keys($plugin); //Assume the requested plugin is the first in the list

	//Return the plugin files name.
	return  $folder . '/' . $pluginfiles[0];
}

?>
                                                                                                                                      wp-admin/includes/update-core.php                                                                   0000755 0023422 0004734 00000022221 11116051226 020042  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress core upgrade functionality.
 *
 * @package WordPress
 * @subpackage Administration
 * @since 2.7.0
 */

/**
 * Stores files to be deleted.
 *
 * @since 2.7.0
 * @global array $_old_files
 * @var array
 * @name $_old_files
 */
global $_old_files;

$_old_files = array(
'wp-admin/bookmarklet.php',
'wp-admin/css/upload.css',
'wp-admin/css/upload-rtl.css',
'wp-admin/css/press-this-ie.css',
'wp-admin/css/press-this-ie-rtl.css',
'wp-admin/edit-form.php',
'wp-admin/link-import.php',
'wp-admin/images/box-bg-left.gif',
'wp-admin/images/box-bg-right.gif',
'wp-admin/images/box-bg.gif',
'wp-admin/images/box-butt-left.gif',
'wp-admin/images/box-butt-right.gif',
'wp-admin/images/box-butt.gif',
'wp-admin/images/box-head-left.gif',
'wp-admin/images/box-head-right.gif',
'wp-admin/images/box-head.gif',
'wp-admin/images/heading-bg.gif',
'wp-admin/images/login-bkg-bottom.gif',
'wp-admin/images/login-bkg-tile.gif',
'wp-admin/images/notice.gif',
'wp-admin/images/toggle.gif',
'wp-admin/images/comment-stalk-classic.gif',
'wp-admin/images/comment-stalk-fresh.gif',
'wp-admin/images/comment-stalk-rtl.gif',
'wp-admin/images/comment-pill.gif',
'wp-admin/images/del.png',
'wp-admin/images/media-button-gallery.gif',
'wp-admin/images/media-buttons.gif',
'wp-admin/images/tail.gif',
'wp-admin/images/gear.png',
'wp-admin/images/tab.png',
'wp-admin/images/postbox-bg.gif',
'wp-admin/includes/upload.php',
'wp-admin/js/dbx-admin-key.js',
'wp-admin/js/link-cat.js',
'wp-admin/js/forms.js',
'wp-admin/js/upload.js',
'wp-admin/profile-update.php',
'wp-admin/templates.php',
'wp-includes/images/audio.png',
'wp-includes/images/css.png',
'wp-includes/images/default.png',
'wp-includes/images/doc.png',
'wp-includes/images/exe.png',
'wp-includes/images/html.png',
'wp-includes/images/js.png',
'wp-includes/images/pdf.png',
'wp-includes/images/swf.png',
'wp-includes/images/tar.png',
'wp-includes/images/text.png',
'wp-includes/images/video.png',
'wp-includes/images/zip.png',
'wp-includes/js/dbx.js',
'wp-includes/js/fat.js',
'wp-includes/js/list-manipulation.js',
'wp-includes/js/jquery/jquery.dimensions.min.js',
'wp-includes/js/tinymce/langs/en.js',
'wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js',
'wp-includes/js/tinymce/plugins/autosave/langs',
'wp-includes/js/tinymce/plugins/directionality/images',
'wp-includes/js/tinymce/plugins/directionality/langs',
'wp-includes/js/tinymce/plugins/inlinepopups/css',
'wp-includes/js/tinymce/plugins/inlinepopups/images',
'wp-includes/js/tinymce/plugins/inlinepopups/jscripts',
'wp-includes/js/tinymce/plugins/paste/images',
'wp-includes/js/tinymce/plugins/paste/jscripts',
'wp-includes/js/tinymce/plugins/paste/langs',
'wp-includes/js/tinymce/plugins/spellchecker/classes/HttpClient.class.php',
'wp-includes/js/tinymce/plugins/spellchecker/classes/TinyGoogleSpell.class.php',
'wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspell.class.php',
'wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspellShell.class.php',
'wp-includes/js/tinymce/plugins/spellchecker/css/spellchecker.css',
'wp-includes/js/tinymce/plugins/spellchecker/images',
'wp-includes/js/tinymce/plugins/spellchecker/langs',
'wp-includes/js/tinymce/plugins/spellchecker/tinyspell.php',
'wp-includes/js/tinymce/plugins/wordpress/images',
'wp-includes/js/tinymce/plugins/wordpress/langs',
'wp-includes/js/tinymce/plugins/wordpress/popups.css',
'wp-includes/js/tinymce/plugins/wordpress/wordpress.css',
'wp-includes/js/tinymce/plugins/wphelp',
'wp-includes/js/tinymce/themes/advanced/css',
'wp-includes/js/tinymce/themes/advanced/images',
'wp-includes/js/tinymce/themes/advanced/jscripts',
'wp-includes/js/tinymce/themes/advanced/langs',
'wp-includes/js/tinymce/tiny_mce_gzip.php',
'wp-includes/js/wp-ajax.js',
'wp-admin/admin-db.php',
'wp-admin/cat.js',
'wp-admin/categories.js',
'wp-admin/custom-fields.js',
'wp-admin/dbx-admin-key.js',
'wp-admin/edit-comments.js',
'wp-admin/install-rtl.css',
'wp-admin/install.css',
'wp-admin/upgrade-schema.php',
'wp-admin/upload-functions.php',
'wp-admin/upload-rtl.css',
'wp-admin/upload.css',
'wp-admin/upload.js',
'wp-admin/users.js',
'wp-admin/widgets-rtl.css',
'wp-admin/widgets.css',
'wp-admin/xfn.js',
'wp-includes/js/tinymce/license.html',
'wp-admin/cat-js.php',
'wp-admin/edit-form-ajax-cat.php',
'wp-admin/execute-pings.php',
'wp-admin/import/b2.php',
'wp-admin/inline-uploading.php',
'wp-admin/link-categories.php',
'wp-admin/list-manipulation.js',
'wp-admin/list-manipulation.php',
'wp-includes/comment-functions.php',
'wp-includes/feed-functions.php',
'wp-includes/functions-compat.php',
'wp-includes/functions-formatting.php',
'wp-includes/functions-post.php',
'wp-includes/js/dbx-key.js',
'wp-includes/js/tinymce/plugins/autosave/langs/cs.js',
'wp-includes/js/tinymce/plugins/autosave/langs/sv.js',
'wp-includes/js/tinymce/themes/advanced/editor_template_src.js',
'wp-includes/links.php',
'wp-includes/pluggable-functions.php',
'wp-includes/template-functions-author.php',
'wp-includes/template-functions-category.php',
'wp-includes/template-functions-general.php',
'wp-includes/template-functions-links.php',
'wp-includes/template-functions-post.php',
'wp-includes/wp-l10n.php',
'wp-admin/import-b2.php',
'wp-admin/import-blogger.php',
'wp-admin/import-greymatter.php',
'wp-admin/import-livejournal.php',
'wp-admin/import-mt.php',
'wp-admin/import-rss.php',
'wp-admin/import-textpattern.php',
'wp-admin/quicktags.js',
'wp-images/fade-butt.png',
'wp-images/get-firefox.png',
'wp-images/header-shadow.png',
'wp-images/smilies',
'wp-images/wp-small.png',
'wp-images/wpminilogo.png',
'wp.php',
'wp-content/themes/default/attachment.php',
'wp-content/themes/default/images/kubrickbg.jpg',
'wp-content/plugins/markdown.php',
'wp-content/plugins/textile1.php',
);

/**
 * Upgrade the core of WordPress.
 *
 * This will create a .maintenance file at the base of the WordPress directory
 * to ensure that people can not access the web site, when the files are being
 * copied to their locations.
 *
 * The files in the {@link $_old_files} list will be removed and the new files
 * copied from the zip file after the database is upgraded.
 *
 * The steps for the upgrader for after the new release is downloaded and
 * unzipped is:
 *   1. Test unzipped location for select files to ensure that unzipped worked.
 *   2. Create the .maintenance file in current WordPress base.
 *   3. Copy new WordPress directory over old WordPress files.
 *   4. Upgrade WordPress to new version.
 *   5. Delete new WordPress directory path.
 *   6. Delete .maintenance file.
 *   7. Remove old files.
 *   8. Delete 'update_core' option.
 *
 * There are several areas of failure. For instance if PHP times out before step
 * 6, then you will not be able to access any portion of your site. Also, since
 * the upgrade will not continue where it left off, you will not be able to
 * automatically remove old files and remove the 'update_core' option. This
 * isn't that bad.
 *
 * If the copy of the new WordPress over the old fails, then the worse is that
 * the new WordPress directory will remain.
 *
 * If it is assumed that every file will be copied over, including plugins and
 * themes, then if you edit the default theme, you should rename it, so that
 * your changes remain.
 *
 * @since 2.7.0
 *
 * @param string $from New release unzipped path.
 * @param string $to Path to old WordPress installation.
 * @return WP_Error|null WP_Error on failure, null on success.
 */
function update_core($from, $to) {
	global $wp_filesystem, $_old_files;

	@set_time_limit( 300 );

	// Sanity check the unzipped distribution
	apply_filters('update_feedback', __('Verifying the unpacked files'));
	if ( !$wp_filesystem->exists($from . '/wordpress/wp-settings.php') || !$wp_filesystem->exists($from . '/wordpress/wp-admin/admin.php') ||
		!$wp_filesystem->exists($from . '/wordpress/wp-includes/functions.php') ) {
		$wp_filesystem->delete($from, true);
		return new WP_Error('insane_distro', __('The update could not be unpacked') );
	}

	apply_filters('update_feedback', __('Installing the latest version'));

	// Create maintenance file to signal that we are upgrading
	$maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
	$maintenance_file = $to . '.maintenance';
	$wp_filesystem->delete($maintenance_file);
	$wp_filesystem->put_contents($maintenance_file, $maintenance_string, FS_CHMOD_FILE);

	// Copy new versions of WP files into place.
	$result = copy_dir($from . '/wordpress', $to);
	if ( is_wp_error($result) ) {
		$wp_filesystem->delete($maintenance_file);
		//$wp_filesystem->delete($working_dir, true); //TODO: Uncomment? This DOES mean that the new files are available in the upgrade folder if it fails.
		return $result;
	}

	// Remove old files
	foreach ( $_old_files as $old_file ) {
		$old_file = $to . $old_file;
		if ( !$wp_filesystem->exists($old_file) )
			continue;
		$wp_filesystem->delete($old_file, true);
	}

	// Upgrade DB with separate request
	apply_filters('update_feedback', __('Upgrading database'));
	$db_upgrade_url = admin_url('upgrade.php?step=upgrade_db');
	wp_remote_post($db_upgrade_url, array('timeout' => 60));

	// Remove working directory
	$wp_filesystem->delete($from, true);

	// Force refresh of update information
	delete_option('update_core');

	// Remove maintenance file, we're done.
	$wp_filesystem->delete($maintenance_file);
}

?>
                                                                                                                                                                                                                                                                                                                                                                               wp-admin/index-extra.php                                                                            0000755 0023422 0004734 00000001435 11073250442 016263  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Handle default dashboard widgets options AJAX.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** Load WordPress Bootstrap */
require_once('admin.php');

/** Load WordPress Administration Dashboard API */
require( 'includes/dashboard.php' );

/** Load Magpie RSS API or custom RSS API */
require_once (ABSPATH . WPINC . '/rss.php');

@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));

switch ( $_GET['jax'] ) {

case 'dashboard_incoming_links' :
	wp_dashboard_incoming_links_output();
	break;

case 'dashboard_primary' :
	wp_dashboard_rss_output( 'dashboard_primary' );
	break;

case 'dashboard_secondary' :
	wp_dashboard_secondary_output();
	break;

case 'dashboard_plugins' :
	wp_dashboard_plugins_output();
	break;

}

?>                                                                                                                                                                                                                                   wp-admin/index.php                                                                                  0000755 0023422 0004734 00000001603 11135134360 015136  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Dashboard Administration Panel
 *
 * @package WordPress
 * @subpackage Administration
 */

/** Load WordPress Bootstrap */
require_once('admin.php');

/** Load WordPress dashboard API */
require_once(ABSPATH . 'wp-admin/includes/dashboard.php');

wp_dashboard_setup();

wp_enqueue_script( 'dashboard' );
wp_enqueue_script( 'plugin-install' );
wp_enqueue_script( 'media-upload' );
wp_admin_css( 'dashboard' );
wp_admin_css( 'plugin-install' );
add_thickbox();

$title = __('Dashboard');
$parent_file = 'index.php';
require_once('admin-header.php');

$today = current_time('mysql', 1);
?>

<div class="wrap">
<?php screen_icon(); ?>
<h2><?php echo wp_specialchars( $title ); ?></h2>

<div id="dashboard-widgets-wrap">

<?php wp_dashboard(); ?>

<div class="clear"></div>
</div><!-- dashboard-widgets-wrap -->

</div><!-- wrap -->

<?php require(ABSPATH . 'wp-admin/admin-footer.php'); ?>
                                                                                                                             wp-admin/install-helper.php                                                                         0000755 0023422 0004734 00000014075 11117531364 016766  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Plugins may load this file to gain access to special helper functions for
 * plugin installation. This file is not included by WordPress and it is
 * recommended, to prevent fatal errors, that this file is included using
 * require_once().
 *
 * These functions are not optimized for speed, but they should only be used
 * once in a while, so speed shouldn't be a concern. If it is and you are
 * needing to use these functions a lot, you might experience time outs. If you
 * do, then it is advised to just write the SQL code yourself.
 *
 * You can turn debugging on, by setting $debug to 1 after you include this
 * file.
 *
 * <code>
 * check_column('wp_links', 'link_description', 'mediumtext');
 * if (check_column($wpdb->comments, 'comment_author', 'tinytext'))
 *     echo "ok\n";
 *
 * $error_count = 0;
 * $tablename = $wpdb->links;
 * // check the column
 * if (!check_column($wpdb->links, 'link_description', 'varchar(255)')) {
 *     $ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' ";
 *     $q = $wpdb->query($ddl);
 * }
 *
 * if (check_column($wpdb->links, 'link_description', 'varchar(255)')) {
 *     $res .= $tablename . ' - ok <br />';
 * } else {
 *     $res .= 'There was a problem with ' . $tablename . '<br />';
 *     ++$error_count;
 * }
 * </code>
 *
 * @package WordPress
 * @subpackage Plugin
 */

/**
 * @global bool $wp_only_load_config
 * @name $wp_only_load_config
 * @var bool
 * @since unknown
 */
$wp_only_load_config = true;

/** Load WordPress Bootstrap */
require_once(dirname(dirname(__FILE__)).'/wp-load.php');

/**
 * Turn debugging on or off.
 * @global bool|int $debug
 * @name $debug
 * @var bool|int
 * @since unknown
 */
$debug = 0;

if ( ! function_exists('maybe_create_table') ) :
/**
 * Create database table, if it doesn't already exist.
 *
 * @since unknown
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name.
 * @param string $create_ddl Create database table SQL.
 * @return bool False on error, true if already exists or success.
 */
function maybe_create_table($table_name, $create_ddl) {
	global $wpdb;
	foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
		if ($table == $table_name) {
			return true;
		}
	}
	//didn't find it try to create it.
	$wpdb->query($create_ddl);
	// we cannot directly tell that whether this succeeded!
	foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
		if ($table == $table_name) {
			return true;
		}
	}
	return false;
}
endif;

if ( ! function_exists('maybe_add_column') ) :
/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since unknown
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 * @uses $debug
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl) {
	global $wpdb, $debug;
	foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
		if ($debug) echo("checking $column == $column_name<br />");

		if ($column == $column_name) {
			return true;
		}
	}
	//didn't find it try to create it.
	$wpdb->query($create_ddl);
	// we cannot directly tell that whether this succeeded!
	foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
		if ($column == $column_name) {
			return true;
		}
	}
	return false;
}
endif;

/**
 * Drop column from database table, if it exists.
 *
 * @since unknown
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Table name
 * @param string $column_name Column name
 * @param string $drop_ddl SQL statement to drop column.
 * @return bool False on failure, true on success or doesn't exist.
 */
function maybe_drop_column($table_name, $column_name, $drop_ddl) {
	global $wpdb;
	foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
		if ($column == $column_name) {
			//found it try to drop it.
			$wpdb->query($drop_ddl);
			// we cannot directly tell that whether this succeeded!
			foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
				if ($column == $column_name) {
					return false;
				}
			}
		}
	}
	// else didn't find it
	return true;
}

/**
 * Check column matches criteria.
 *
 * Uses the SQL DESC for retrieving the table info for the column. It will help
 * understand the parameters, if you do more research on what column information
 * is returned by the SQL statement. Pass in null to skip checking that
 * criteria.
 *
 * Column names returned from DESC table are case sensitive and are listed:
 *      Field
 *      Type
 *      Null
 *      Key
 *      Default
 *      Extra
 *
 * @since unknown
 * @package WordPress
 * @subpackage Plugin
 *
 * @param string $table_name Table name
 * @param string $col_name Column name
 * @param string $col_type Column type
 * @param bool $is_null Optional. Check is null.
 * @param mixed $key Optional. Key info.
 * @param mixed $default Optional. Default value.
 * @param mixed $extra Optional. Extra value.
 * @return bool True, if matches. False, if not matching.
 */
function check_column($table_name, $col_name, $col_type, $is_null = null, $key = null, $default = null, $extra = null) {
	global $wpdb, $debug;
	$diffs = 0;
	$results = $wpdb->get_results("DESC $table_name");

	foreach ($results as $row ) {
		if ($debug > 1) print_r($row);

		if ($row->Field == $col_name) {
			// got our column, check the params
			if ($debug) echo ("checking $row->Type against $col_type\n");
			if (($col_type != null) && ($row->Type != $col_type)) {
				++$diffs;
			}
			if (($is_null != null) && ($row->Null != $is_null)) {
				++$diffs;
			}
			if (($key != null) && ($row->Key  != $key)) {
				++$diffs;
			}
			if (($default != null) && ($row->Default != $default)) {
				++$diffs;
			}
			if (($extra != null) && ($row->Extra != $extra)) {
				++$diffs;
			}
			if ($diffs > 0) {
				if ($debug) echo ("diffs = $diffs returning false\n");
				return false;
			}
			return true;
		} // end if found our column
	}
	return false;
}

?>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                   wp-admin/install.php                                                                                0000755 0023422 0004734 00000011170 11106101532 015466  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress Installer
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * We are installing WordPress.
 *
 * @since unknown
 * @var bool
 */
define('WP_INSTALLING', true);

/** Load WordPress Bootstrap */
require_once('../wp-load.php');

/** Load WordPress Administration Upgrade API */
require_once('./includes/upgrade.php');

if (isset($_GET['step']))
	$step = $_GET['step'];
else
	$step = 0;

/**
 * Display install header.
 *
 * @since unknown
 * @package WordPress
 * @subpackage Installer
 */
function display_header() {
header( 'Content-Type: text/html; charset=utf-8' );
?>
<!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" <?php language_attributes(); ?>>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title><?php _e('WordPress &rsaquo; Installation'); ?></title>
	<?php wp_admin_css( 'install', true ); ?>
</head>
<body>
<h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>

<?php
}//end function display_header();

// Let's check to make sure WP isn't already installed.
if ( is_blog_installed() ) {display_header(); die('<h1>'.__('Already Installed').'</h1><p>'.__('You appear to have already installed WordPress. To reinstall please clear your old database tables first.').'</p></body></html>');}

switch($step) {
	case 0:
	case 1: // in case people are directly linking to this
	  display_header();
?>
<h1><?php _e('Welcome'); ?></h1>
<p><?php printf(__('Welcome to the famous five minute WordPress installation process! You may want to browse the <a href="%s">ReadMe documentation</a> at your leisure.  Otherwise, just fill in the information below and you\'ll be on your way to using the most extendable and powerful personal publishing platform in the world.'), '../readme.html'); ?></p>
<!--<h2 class="step"><a href="install.php?step=1"><?php _e('First Step'); ?></a></h2>-->

<h1><?php _e('Information needed'); ?></h1>
<p><?php _e("Please provide the following information.  Don't worry, you can always change these settings later."); ?></p>

<form id="setup" method="post" action="install.php?step=2">
	<table class="form-table">
		<tr>
			<th scope="row"><label for="weblog_title"><?php _e('Blog Title'); ?></label></th>
			<td><input name="weblog_title" type="text" id="weblog_title" size="25" /></td>
		</tr>
		<tr>
			<th scope="row"><label for="admin_email"><?php _e('Your E-mail'); ?></label></th>
			<td><input name="admin_email" type="text" id="admin_email" size="25" /><br />
			<?php _e('Double-check your email address before continuing.'); ?>
		</tr>
		<tr>
			<td colspan="2"><label><input type="checkbox" name="blog_public" value="1" checked="checked" /> <?php _e('Allow my blog to appear in search engines like Google and Technorati.'); ?></label></td>
		</tr>
	</table>
	<p class="step"><input type="submit" name="Submit" value="<?php _e('Install WordPress'); ?>" class="button" /></p>
</form>

<?php
		break;
	case 2:
		if ( !empty($wpdb->error) )
			wp_die($wpdb->error->get_error_message());

		display_header();
		// Fill in the data we gathered
		$weblog_title = isset($_POST['weblog_title']) ? stripslashes($_POST['weblog_title']) : '';
		$admin_email = isset($_POST['admin_email']) ? stripslashes($_POST['admin_email']) : '';
		$public = isset($_POST['blog_public']) ? (int) $_POST['blog_public'] : 0;
		// check e-mail address
		if (empty($admin_email)) {
			// TODO: poka-yoke
			die('<p>'.__("<strong>ERROR</strong>: you must provide an e-mail address.").'</p>');
		} else if (!is_email($admin_email)) {
			// TODO: poka-yoke
			die('<p>'.__('<strong>ERROR</strong>: that isn&#8217;t a valid e-mail address.  E-mail addresses look like: <code>username@example.com</code>').'</p>');
		}

		$wpdb->show_errors();
		$result = wp_install($weblog_title, 'admin', $admin_email, $public);
		extract($result, EXTR_SKIP);
?>

<h1><?php _e('Success!'); ?></h1>

<p><?php printf(__('WordPress has been installed. Were you expecting more steps? Sorry to disappoint.'), ''); ?></p>

<table class="form-table">
	<tr>
		<th><?php _e('Username'); ?></th>
		<td><code>admin</code></td>
	</tr>
	<tr>
		<th><?php _e('Password'); ?></th>
		<td><code><?php echo $password; ?></code><br />
			<?php echo '<p>'.__('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.').'</p>'; ?></td>
	</tr>
</table>

<p class="step"><a href="../wp-login.php" class="button"><?php _e('Log In'); ?></a></p>

<?php
		break;
}
?>
<script type="text/javascript">var t = document.getElementById('weblog_title'); if (t){ t.focus(); }</script>
</body>
</html>
                                                                                                                                                                                                                                                                                                                                                                                                        wp-admin/js/                                                                                        0000755 0023422 0004734 00000000000 11154152657 013741  5                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 wp-admin/js/cat.js                                                                                  0000755 0023422 0004734 00000001054 10712270324 015040  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 jQuery( function($) {
	var myConfirm = function() { return '' !== $('#newcat').val(); };
	$('#jaxcat').prepend('<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" class="add:categorychecklist:jaxcat" id="catadd" value="' + catL10n.add + '"/><input type="hidden"/><input type="hidden"/><span id="howto">' + catL10n.how + '</span></span><span id="cat-ajax-response"></span>')
	$('#categorychecklist').wpList( { alt: '', response: 'cat-ajax-response', confirm: myConfirm } );
} );
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    wp-admin/js/categories.js                                                                           0000755 0023422 0004734 00000001736 11117531364 016431  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 jQuery(function($) {
	var options = false
	if ( document.forms['addcat'].category_parent )
		options = document.forms['addcat'].category_parent.options;

	var addAfter = function( r, settings ) {
		var name = $("<span>" + $('name', r).text() + "</span>").html();
		var id = $('cat', r).attr('id');
		options[options.length] = new Option(name, id);

		addAfter2( r, settings );
	}

	var addAfter2 = function( x, r ) {
		var t = $(r.parsed.responses[0].data);
		if ( t.length == 1 )
			inlineEditTax.addEvents($(t.id));
	}

	var delAfter = function( r, settings ) {
		var id = $('cat', r).attr('id');
		for ( var o = 0; o < options.length; o++ )
			if ( id == options[o].value )
				options[o] = null;
	}

	if ( options )
		$('#the-list').wpList( { addAfter: addAfter, delAfter: delAfter } );
	else
		$('#the-list').wpList({ addAfter: addAfter2 });

	if ( jQuery('#link-category-search-input').size() ) {
		columns.init('edit-link-categories');
	} else {
		columns.init('categories');
	}
});
                                  wp-admin/js/comment.js                                                                              0000755 0023422 0004734 00000002117 11116155026 015734  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 jQuery(document).ready( function($) {
	jQuery('.hide-if-no-js').show();
	jQuery('.hide-if-js').hide();

	var stamp = $('#timestamp').html();
	$('.edit-timestamp').click(function () {
		if ($('#timestampdiv').is(":hidden")) {
			$('#timestampdiv').slideDown("normal");
			$('.edit-timestamp').hide();
		}
		return false;
	});

	$('.cancel-timestamp').click(function() {
		$('#timestampdiv').slideUp("normal");
		$('#mm').val($('#hidden_mm').val());
		$('#jj').val($('#hidden_jj').val());
		$('#aa').val($('#hidden_aa').val());
		$('#hh').val($('#hidden_hh').val());
		$('#mn').val($('#hidden_mn').val());
		$('#timestamp').html(stamp);
		$('.edit-timestamp').show();
		return false;
	});

	$('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels
		$('#timestampdiv').slideUp("normal");
		$('.edit-timestamp').show();
		$('#timestamp').html(
			commentL10n.submittedOn + ' <b>' +
			$( '#mm option[value=' + $('#mm').val() + ']' ).text() + ' ' +
			$('#jj').val() + ', ' +
			$('#aa').val() + ' @ ' +
			$('#hh').val() + ':' +
			$('#mn').val() + '</b> '
		);
		return false;
	});
});                                                                                                                                                                                                                                                                                                                                                                                                                                                 wp-admin/js/common.js                                                                               0000755 0023422 0004734 00000025351 11122773134 015572  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 
var wpCookies = {
// The following functions are from Cookie.js class in TinyMCE, Moxiecode, used under LGPL.

	each : function(o, cb, s) {
		var n, l;

		if (!o)
			return 0;

		s = s || o;

		if (typeof(o.length) != 'undefined') {
			for (n=0, l = o.length; n<l; n++) {
				if (cb.call(s, o[n], n, o) === false)
					return 0;
			}
		} else {
			for (n in o) {
				if (o.hasOwnProperty(n)) {
					if (cb.call(s, o[n], n, o) === false)
						return 0;
				}
			}
		}
		return 1;
	},

	getHash : function(n) {
		var v = this.get(n), h;

		if (v) {
			this.each(v.split('&'), function(v) {
				v = v.split('=');
				h = h || {};
				h[v[0]] = v[1];
			});
		}
		return h;
	},

	setHash : function(n, v, e, p, d, s) {
		var o = '';

		this.each(v, function(v, k) {
			o += (!o ? '' : '&') + k + '=' + v;
		});

		this.set(n, o, e, p, d, s);
	},

	get : function(n) {
		var c = document.cookie, e, p = n + "=", b;

		if (!c)
			return;

		b = c.indexOf("; " + p);

		if (b == -1) {
			b = c.indexOf(p);

			if (b != 0)
				return null;
		} else
			b += 2;

		e = c.indexOf(";", b);

		if (e == -1)
			e = c.length;

		return decodeURIComponent(c.substring(b + p.length, e));
	},

	set : function(n, v, e, p, d, s) {
		document.cookie = n + "=" + encodeURIComponent(v) +
			((e) ? "; expires=" + e.toGMTString() : "") +
			((p) ? "; path=" + p : "") +
			((d) ? "; domain=" + d : "") +
			((s) ? "; secure" : "");
	},

	remove : function(n, p) {
		var d = new Date();

		d.setTime(d.getTime() - 1000);

		this.set(n, '', d, p, d);
	}
};

// Returns the value as string. Second arg or empty string is returned when value is not set.
function getUserSetting( name, def ) {
	var o = getAllUserSettings();

	if ( o.hasOwnProperty(name) )
		return o[name];

	if ( typeof def != 'undefined' )
		return def;

	return '';
}

// Both name and value must be only ASCII letters, numbers or underscore
// and the shorter, the better (cookies can store maximum 4KB). Not suitable to store text.
function setUserSetting( name, value, del ) {
	var c = 'wp-settings-'+userSettings.uid, o = wpCookies.getHash(c) || {}, d = new Date();
	var n = name.toString().replace(/[^A-Za-z0-9_]/, ''), v = value.toString().replace(/[^A-Za-z0-9_]/, '');

	if ( del ) delete o[n];
	else o[n] = v;

	d.setTime( d.getTime() + 31536000000 );
	p = userSettings.url;

	wpCookies.setHash(c, o, d, p );
	wpCookies.set('wp-settings-time-'+userSettings.uid, userSettings.time, d, p );
}

function deleteUserSetting( name ) {
	setUserSetting( name, '', 1 );
}

// Returns all settings as js object.
function getAllUserSettings() {
	return wpCookies.getHash('wp-settings-'+userSettings.uid) || {};
}


jQuery(document).ready( function($) {
	// pulse
	$('.fade').animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300).animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300);

	// show things that should be visible, hide what should be hidden
	$('.hide-if-no-js').removeClass('hide-if-no-js');
	$('.hide-if-js').hide();

	// Basic form validation
	if ( ( 'undefined' != typeof wpAjax ) && $.isFunction( wpAjax.validateForm ) ) {
		$('form.validate').submit( function() { return wpAjax.validateForm( $(this) ); } );
	}

	// Move .updated and .error alert boxes
	$('div.wrap h2 ~ div.updated, div.wrap h2 ~ div.error').addClass('below-h2');
	$('div.updated, div.error').not('.below-h2').insertAfter('div.wrap h2:first');

	// screen settings tab
	$('#show-settings-link').click(function () {
		if ( ! $('#screen-options-wrap').hasClass('screen-options-open') ) {
			$('#contextual-help-link-wrap').addClass('invisible');
		}
		$('#screen-options-wrap').slideToggle('fast', function(){
			if ( $(this).hasClass('screen-options-open') ) {
				$('#show-settings-link').css({'backgroundImage':'url("images/screen-options-right.gif")'});
				$('#contextual-help-link-wrap').removeClass('invisible');
				$(this).removeClass('screen-options-open');

			} else {
				$('#show-settings-link').css({'backgroundImage':'url("images/screen-options-right-up.gif")'});
				$(this).addClass('screen-options-open');
			}
		});
		return false;
	});

	// help tab
	$('#contextual-help-link').click(function () {
		if ( ! $('#contextual-help-wrap').hasClass('contextual-help-open') ) {
			$('#screen-options-link-wrap').addClass('invisible');
		}
		$('#contextual-help-wrap').slideToggle('fast', function(){
			if ( $(this).hasClass('contextual-help-open') ) {
				$('#contextual-help-link').css({'backgroundImage':'url("images/screen-options-right.gif")'});
				$('#screen-options-link-wrap').removeClass('invisible');
				$(this).removeClass('contextual-help-open');
			} else {
				$('#contextual-help-link').css({'backgroundImage':'url("images/screen-options-right-up.gif")'});
				$(this).addClass('contextual-help-open');
			}
		});
		return false;
	});

	// check all checkboxes
	var lastClicked = false;
	$( 'table:visible tbody .check-column :checkbox' ).click( function(e) {
		if ( 'undefined' == e.shiftKey ) { return true; }
		if ( e.shiftKey ) {
			if ( !lastClicked ) { return true; }
			var checks = $( lastClicked ).parents( 'form:first' ).find( ':checkbox' );
			var first = checks.index( lastClicked );
			var last = checks.index( this );
			var checked = $(this).attr('checked');
			if ( 0 < first && 0 < last && first != last ) {
				checks.slice( first, last ).attr( 'checked', function(){
					if ( $(this).parents('tr').is(':visible') )
						return checked ? 'checked' : '';

					return '';
				});
			}
		}
		lastClicked = this;
		return true;
	} );
	$( 'thead :checkbox, tfoot :checkbox' ).click( function(e) {
		var c = $(this).attr('checked');
		if ( 'undefined' == typeof  toggleWithKeyboard)
			toggleWithKeyboard = false;
		var toggle = e.shiftKey || toggleWithKeyboard;
		$(this).parents( 'form:first' ).find( 'table tbody:visible').find( '.check-column :checkbox' ).attr( 'checked', function() {
			if ( $(this).parents('tr').is(':hidden') )
				return '';
			if ( toggle )
				return $(this).attr( 'checked' ) ? '' : 'checked';
			else if (c)
				return 'checked';
			return '';
		});
		$(this).parents( 'form:first' ).find( 'table thead:visible, table tfoot:visible').find( '.check-column :checkbox' ).attr( 'checked', function() {
			if ( toggle )
				return '';
			else if (c)
				return 'checked';
			return '';
		});
	});
});

var showNotice, adminMenu, columns;

// stub for doing better warnings
showNotice = {
	warn : function(text) {
		if ( confirm(text) )
			return true;

		return false;
	},

	note : function(text) {
		alert(text);
	}
};

(function($){
// sidebar admin menu
adminMenu = {

	init : function() {
		$('#adminmenu div.wp-menu-toggle').each( function() {
			if ( $(this).siblings('.wp-submenu').length )
				$(this).click(function(){ adminMenu.toggle( $(this).siblings('.wp-submenu') ); });
			else
				$(this).hide();
		});
		$('#adminmenu li.menu-top .wp-menu-image').click( function() { window.location = $(this).siblings('a.menu-top')[0].href; } );
		this.favorites();

		$('.wp-menu-separator').click(function(){
			if ( $('#wpcontent').hasClass('folded') ) {
				adminMenu.fold(1);
				setUserSetting( 'mfold', 'o' );
			} else {
				adminMenu.fold();
				setUserSetting( 'mfold', 'f' );
			}
		});

		if ( 'f' != getUserSetting( 'mfold' ) ) {
			this.restoreMenuState();
		} else {
			this.fold();
		}
	},

	restoreMenuState : function() {
		$('#adminmenu li.wp-has-submenu').each(function(i, e) {
			var v = getUserSetting( 'm'+i );
			if ( $(e).hasClass('wp-has-current-submenu') ) return true; // leave the current parent open

			if ( 'o' == v ) $(e).addClass('wp-menu-open');
			else if ( 'c' == v ) $(e).removeClass('wp-menu-open');
		});
	},

	toggle : function(el) {

		el['slideToggle'](150, function(){el.css('display','');}).parent().toggleClass( 'wp-menu-open' );

		$('#adminmenu li.wp-has-submenu').each(function(i, e) {
			var v = $(e).hasClass('wp-menu-open') ? 'o' : 'c';
			setUserSetting( 'm'+i, v );
		});

		return false;
	},

	fold : function(off) {
		if (off) {
			$('#wpcontent').removeClass('folded');
			$('#adminmenu li.wp-has-submenu').unbind();
		} else {
			$('#wpcontent').addClass('folded');
			$('#adminmenu li.wp-has-submenu').hoverIntent({
				over: function(e){
					var m = $(this).find('.wp-submenu'), t = e.clientY, H = $(window).height(), h = m.height(), o;

					if ( (t+h+10) > H ) {
						o = (t+h+10) - H;
						m.css({'marginTop':'-'+o+'px'});
					} else if ( m.css('marginTop') ) {
						m.css({'marginTop':''})
					}
					m.addClass('sub-open');
				},
				out: function(){ $(this).find('.wp-submenu').removeClass('sub-open').css({'marginTop':''}); },
				timeout: 220,
				sensitivity: 8,
				interval: 100
			});

		}
	},

	favorites : function() {
		$('#favorite-inside').width($('#favorite-actions').width()-4);
		$('#favorite-toggle, #favorite-inside').bind( 'mouseenter', function(){$('#favorite-inside').removeClass('slideUp').addClass('slideDown'); setTimeout(function(){if ( $('#favorite-inside').hasClass('slideDown') ) { $('#favorite-inside').slideDown(100); $('#favorite-first').addClass('slide-down'); }}, 200) } );

		$('#favorite-toggle, #favorite-inside').bind( 'mouseleave', function(){$('#favorite-inside').removeClass('slideDown').addClass('slideUp'); setTimeout(function(){if ( $('#favorite-inside').hasClass('slideUp') ) { $('#favorite-inside').slideUp(100, function(){ $('#favorite-first').removeClass('slide-down'); } ); }}, 300) } );
	}
};

$(document).ready(function(){adminMenu.init();});
})(jQuery);

(function($){
// show/hide/save table columns
columns = {
	init : function(page) {
		$('.hide-column-tog').click( function() {
			var column = $(this).val();
			var show = $(this).attr('checked');
			if ( show ) {
				$('.column-' + column).show();
			} else {
				$('.column-' + column).hide();
			}
			columns.save_manage_columns_state(page);
		} );
	},

	save_manage_columns_state : function(page) {
		var hidden = $('.manage-column').filter(':hidden').map(function() { return this.id; }).get().join(',');
		$.post('admin-ajax.php', {
			action: 'hidden-columns',
			hidden: hidden,
			hiddencolumnsnonce: $('#hiddencolumnsnonce').val(),
			page: page
		});
	}
}

})(jQuery);


jQuery(document).ready(function($){
	if ( 'undefined' != typeof google && google.gears ) return;

	var gf = false;
	if ( 'undefined' != typeof GearsFactory ) {
		gf = new GearsFactory();
	} else {
		try {
			gf = new ActiveXObject('Gears.Factory');
			if ( factory.getBuildInfo().indexOf('ie_mobile') != -1 )
				gf.privateSetGlobalObject(this);
		} catch (e) {
			if ( ( 'undefined' != typeof navigator.mimeTypes ) && navigator.mimeTypes['application/x-googlegears'] ) {
				gf = document.createElement("object");
				gf.style.display = "none";
				gf.width = 0;
				gf.height = 0;
				gf.type = "application/x-googlegears";
				document.documentElement.appendChild(gf);
			}
		}
	}
	if ( gf && gf.hasPermission )
		return;

	$('.turbo-nag').show();
});
                                                                                                                                                                                                                                                                                       wp-admin/js/custom-fields.js                                                                        0000755 0023422 0004734 00000001710 10762616542 017061  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 jQuery( function($) {
	var before = function() {
		var nonce = $('#newmeta [@name=_ajax_nonce]').val();
		var postId = $('#post_ID').val();
		if ( !nonce || !postId ) { return false; }
		return [nonce,postId];
	}

	var addBefore = function( s ) {
		var b = before();
		if ( !b ) { return false; }
		s.data = s.data.replace(/_ajax_nonce=[a-f0-9]+/, '_ajax_nonce=' + b[0]) + '&post_id=' + b[1];
		return s;
	};

	var addAfter = function( r, s ) {
		var postId = $('postid', r).text();
		if ( !postId ) { return; }
		$('#post_ID').attr( 'name', 'post_ID' ).val( postId );
		var h = $('#hiddenaction');
		if ( 'post' == h.val() ) { h.val( 'postajaxpost' ); }
	};

	var delBefore = function( s ) {
		var b = before(); if ( !b ) return false;
		s.data._ajax_nonce = b[0]; s.data.post_id = b[1];
		return s;
	}

	$('#the-list')
		.wpList( { addBefore: addBefore, addAfter: addAfter, delBefore: delBefore } )
		.find('.updatemeta, .deletemeta').attr( 'type', 'button' );
} );
                                                        wp-admin/js/edit-comments.js                                                                        0000755 0023422 0004734 00000021603 11117531364 017047  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 var theList; var theExtraList;
(function($) {

setCommentsList = function() {
	var dimAfter = function( r, settings ) {
		var c = $('#' + settings.element);

		if ( c.is('.unapproved') )
			c.find('div.comment_status').html('0')
		else
			c.find('div.comment_status').html('1')

		$('span.pending-count').each( function() {
			var a = $(this);
			var n = a.html().replace(/[ ,.]+/g, '');
			n = parseInt(n,10);
			if ( isNaN(n) ) return;
			n = n + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 );
			if ( n < 0 ) { n = 0; }
			$('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
			n = n.toString();
			if ( n.length > 3 )
				n = n.substr(0, n.length-3)+' '+n.substr(-3);
			a.html(n);
		});
	};

	var delAfter = function( r, settings ) {
		$('span.pending-count').each( function() {
			var a = $(this);
			var n = a.html().replace(/[ ,.]+/g, '');
			n = parseInt(n,10);
			if ( isNaN(n) ) return;
			if ( $('#' + settings.element).is('.unapproved') ) { // we deleted a formerly unapproved comment
				n = n - 1;
			} else if ( $(settings.target).parents( 'span.unapprove' ).size() ) { // we "deleted" an approved comment from the approved list by clicking "Unapprove"
				n = n + 1;
			}
			if ( n < 0 ) { n = 0; }
			$('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
			n = n.toString();
			if ( n.length > 3 )
				n = n.substr(0, n.length-3)+' '+n.substr(-3);
			a.html(n);
		});

		$('span.spam-count' ).each( function() {
			var a = $(this);
			var n = a.html().replace(/[ ,.]+/g, '');
			n = parseInt(n,10);
			if ( isNaN(n) ) return;
			if ( $(settings.target).parents( 'span.spam' ).size() ) { // we marked a comment as spam
				n = n + 1;
			} else if ( $('#' + settings.element).is('.spam') ) { // we approved or deleted a comment marked as spam
				n = n - 1;
			}
			if ( n < 0 ) { n = 0; }
			n = n.toString();
			if ( n.length > 3 )
				n = n.substr(0, n.length-3)+' '+n.substr(-3);
			a.html(n);
		});

		if ( theExtraList.size() == 0 || theExtraList.children().size() == 0 ) {
			return;
		}

		theList.get(0).wpList.add( theExtraList.children(':eq(0)').remove().clone() );
		$('#get-extra-comments').submit();
	};

	theExtraList = $('#the-extra-comment-list').wpList( { alt: '', delColor: 'none', addColor: 'none' } );
	theList = $('#the-comment-list').wpList( { alt: '', dimAfter: dimAfter, delAfter: delAfter, addColor: 'none' } );

};

$(document).ready(function(){
	setCommentsList();
});

commentReply = {

	init : function() {
		var row = $('#replyrow');

		$('a.cancel', row).click(function() { return commentReply.revert(); });
		$('a.save', row).click(function() { return commentReply.send(this); });

		// add events
		$('#the-comment-list .column-comment > p').dblclick(function(){
				commentReply.toggle($(this).parent());
			});

		$('#doaction, #doaction2, #post-query-submit').click(function(e){
			if ( $('#the-comment-list #replyrow').length > 0 )
				t.close();
		});

	},

	addEvents : function(r) {
		r.each(function() {
			$(this).find('.column-comment > p').dblclick(function(){
				commentReply.toggle($(this).parent());
			});
		});
	},

	toggle : function(el) {
		if ( $(el).css('display') != 'none' )
			$(el).find('a.vim-q').click();
	},

	revert : function() {

		if ( $('#the-comment-list #replyrow').length < 1 )
			return false;

		$('#replyrow').fadeOut('fast', function(){
			commentReply.close();
		});

		return false;
	},

	close : function() {
		$(this.o).fadeIn('fast').css('backgroundColor', '');
		$('#com-reply').append( $('#replyrow') );
		$('#replycontent').val('');
		$('#edithead input').val('');
		$('#replysubmit .error').html('').hide();
		$('#replysubmit .waiting').hide();
		if ( $.browser.msie )
			$('#replycontainer, #replycontent').css('height', '120px');
		else
			$('#replycontainer').resizable('destroy').css('height', '120px');
	},

	open : function(id, p, a) {
		var t = this;
		t.close();
		t.o = '#comment-'+id;

		$('#replyrow td').attr('colspan', $('.widefat thead th:visible').length);
		var editRow = $('#replyrow'), rowData = $('#inline-'+id);
		var act = t.act = (a == 'edit') ? 'edit-comment' : 'replyto-comment';

		$('#action', editRow).val(act);
		$('#comment_post_ID', editRow).val(p);
		$('#comment_ID', editRow).val(id);

		if ( a == 'edit' ) {
			$('#author', editRow).val( $('div.author', rowData).text() );
			$('#author-email', editRow).val( $('div.author-email', rowData).text() );
			$('#author-url', editRow).val( $('div.author-url', rowData).text() );
			$('#status', editRow).val( $('div.comment_status', rowData).text() );
			$('#replycontent', editRow).val( $('textarea.comment', rowData).val() );
			$('#edithead, #savebtn', editRow).show();
			$('#replyhead, #replybtn', editRow).hide();

			var h = $(t.o).height();
			if ( h > 220 )
				if ( $.browser.msie )
					$('#replycontainer, #replycontent', editRow).height(h-105);
				else
					$('#replycontainer', editRow).height(h-105);

			$(t.o).after(editRow.hide()).fadeOut('fast', function(){
				$('#replyrow').fadeIn('fast');
			});
		} else {
			$('#edithead, #savebtn', editRow).hide();
			$('#replyhead, #replybtn', editRow).show();
			$(t.o).after(editRow);
			$('#replyrow').hide().fadeIn('fast');
		}

		if ( ! $.browser.msie )
			$('#replycontainer').resizable({
				handles : 's',
				axis : 'y',
				minHeight : 80,
				stop : function() {
					$('#replycontainer').width('auto');
				}
			});

		setTimeout(function() {
			var rtop = $('#replyrow').offset().top;
			var rbottom = rtop + $('#replyrow').height();
			var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
			var vp = document.documentElement.clientHeight || self.innerHeight || 0;
			var scrollBottom = scrollTop + vp;

			if ( scrollBottom - 20 < rbottom )
				window.scroll(0, rbottom - vp + 35);
			else if ( rtop - 20 < scrollTop )
				window.scroll(0, rtop - 35);

			$('#replycontent').focus().keyup(function(e){
				if (e.which == 27) commentReply.revert(); // close on Escape
			});
		}, 600);

		return false;
	},

	send : function() {
		var post = {};

		$('#replysubmit .waiting').show();

		$('#replyrow input').each(function() {
			post[ $(this).attr('name') ] = $(this).val();
		});

		post.content = $('#replycontent').val();
		post.id = post.comment_post_ID;

		$.ajax({
			type : 'POST',
			url : wpListL10n.url,
			data : post,
			success : function(x) { commentReply.show(x); },
			error : function(r) { commentReply.error(r); }
		});

		return false;
	},

	show : function(xml) {

		if ( typeof(xml) == 'string' ) {
			this.error({'responseText': xml});
			return false;
		}

		var r = wpAjax.parseAjaxResponse(xml);
		if ( r.errors ) {
			this.error({'responseText': wpAjax.broken});
			return false;
		}

		if ( 'edit-comment' == this.act )
			$(this.o).remove();

		r = r.responses[0];
		var c = r.data;

		$(c).hide()
		$('#replyrow').after(c);
		this.o = id = '#comment-'+r.id;
		$(id+' .hide-if-no-js').removeClass('hide-if-no-js');
		this.revert();
		this.addEvents($(id));
		var bg = $(id).hasClass('unapproved') ? '#ffffe0' : '#fff';

		$(id)
			.animate( { 'backgroundColor':'#CCEEBB' }, 600 )
			.animate( { 'backgroundColor': bg }, 600 );

		$.fn.wpList.process($(id))
	},

	error : function(r) {
		var er = r.statusText;

		$('#replysubmit .waiting').hide();

		if ( r.responseText )
			er = r.responseText.replace( /<.[^<>]*?>/g, '' );

		if ( er )
			$('#replysubmit .error').html(er).show();

	}
};
toggleWithKeyboard = false;
$(document).ready(function(){
	columns.init('edit-comments');
	commentReply.init();

	if ( typeof QTags != 'undefined' )
		ed_reply = new QTags('ed_reply', 'replycontent', 'replycontainer', 'more');

	if ( typeof $.table_hotkeys != 'undefined' ) {
		var make_hotkeys_redirect = function(which) {
			return function() {
				var first_last = 'next' == which? 'first' : 'last';
				var l=$('.'+which+'.page-numbers');
				if (l.length)
					window.location = l[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g, '')+'&hotkeys_highlight_'+first_last+'=1';
			}
		};
		var edit_comment = function(event, current_row) {
			window.location = $('span.edit a', current_row).attr('href');
		};
		var toggle_all = function() {
			toggleWithKeyboard = true;
			var master_checkbox = $('form#comments-form .check-column :checkbox:first');
			master_checkbox.click().attr('checked', '');
			toggleWithKeyboard = false;
		}
		var make_bulk = function(value) {
			return function(event, _) {
				$('option[value='+value+']').attr('selected', 'selected');
				$('form#comments-form')[0].submit();
			}
		};
		$.table_hotkeys($('table.widefat'),['a', 'u', 's', 'd', 'r', 'q', ['e', edit_comment],
				['shift+a', make_bulk('approve')], ['shift+s', make_bulk('markspam')],
				['shift+d', make_bulk('delete')], ['shift+x', toggle_all],
				['shift+u', make_bulk('unapprove')]],
				{highlight_first: adminCommentsL10n.hotkeys_highlight_first, highlight_last: adminCommentsL10n.hotkeys_highlight_last,
				prev_page_link_cb: make_hotkeys_redirect('prev'), next_page_link_cb: make_hotkeys_redirect('next')}
		);
	}
});

})(jQuery);
                                                                                                                             wp-admin/js/editor.js                                                                               0000755 0023422 0004734 00000014155 11122773134 015570  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 
var switchEditors = {

	mode : '',

	I : function(e) {
		return document.getElementById(e);
	},

	edInit : function() {
		var h = tinymce.util.Cookie.getHash("TinyMCE_content_size"), H = this.I('edButtonHTML'), P = this.I('edButtonPreview');

		// Activate TinyMCE if it's the user's default editor
		if ( getUserSetting( 'editor' ) == 'html' ) {
			if ( h )
				try { this.I('content').style.height = h.ch - 30 + 'px'; } catch(e){};
		} else {
			try {
				this.I("quicktags").style.display = "none";
			} catch(e){};
			tinyMCE.execCommand("mceAddControl", false, "content");
		}
	},

	saveCallback : function(el, content, body) {

		if ( tinyMCE.activeEditor.isHidden() )
			content = this.I(el).value;
		else
			content = this.pre_wpautop(content);

		return content;
	},

	pre_wpautop : function(content) {
		// We have a TON of cleanup to do. Line breaks are already stripped.

		// Protect pre|script tags
		content = content.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) {
			a = a.replace(/<br ?\/?>[\r\n]*/g, '<wp_temp>');
			return a.replace(/<\/?p( [^>]*)?>[\r\n]*/g, '<wp_temp>');
		});

		// Pretty it up for the source editor
		var blocklist1 = 'blockquote|ul|ol|li|table|thead|tbody|tr|th|td|div|h[1-6]|p';
		content = content.replace(new RegExp('\\s*</('+blocklist1+')>\\s*', 'mg'), '</$1>\n');
		content = content.replace(new RegExp('\\s*<(('+blocklist1+')[^>]*)>', 'mg'), '\n<$1>');

		// Mark </p> if it has any attributes.
		content = content.replace(new RegExp('(<p [^>]+>.*?)</p>', 'mg'), '$1</p#>');

		// Sepatate <div> containing <p>
		content = content.replace(new RegExp('<div([^>]*)>\\s*<p>', 'mgi'), '<div$1>\n\n');

		// Remove <p> and <br />
		content = content.replace(new RegExp('\\s*<p>', 'mgi'), '');
		content = content.replace(new RegExp('\\s*</p>\\s*', 'mgi'), '\n\n');
		content = content.replace(new RegExp('\\n\\s*\\n', 'mgi'), '\n\n');
		content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n');

		// Fix some block element newline issues
		content = content.replace(new RegExp('\\s*<div', 'mg'), '\n<div');
		content = content.replace(new RegExp('</div>\\s*', 'mg'), '</div>\n');
		content = content.replace(new RegExp('\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*', 'gi'), '\n\n[caption$1[/caption]\n\n');
		content = content.replace(new RegExp('caption\\]\\n\\n+\\[caption', 'g'), 'caption]\n\n[caption');

		var blocklist2 = 'blockquote|ul|ol|li|table|thead|tr|th|td|h[1-6]|pre';
		content = content.replace(new RegExp('\\s*<(('+blocklist2+') ?[^>]*)\\s*>', 'mg'), '\n<$1>');
		content = content.replace(new RegExp('\\s*</('+blocklist2+')>\\s*', 'mg'), '</$1>\n');
		content = content.replace(new RegExp('<li([^>]*)>', 'g'), '\t<li$1>');

		if ( content.indexOf('<object') != -1 ) {
			content = content.replace(new RegExp('\\s*<param([^>]*)>\\s*', 'mg'), "<param$1>");
			content = content.replace(new RegExp('\\s*</embed>\\s*', 'mg'), '</embed>');
		}

		// Unmark special paragraph closing tags
		content = content.replace(new RegExp('</p#>', 'g'), '</p>\n');
		content = content.replace(new RegExp('\\s*(<p [^>]+>.*</p>)', 'mg'), '\n$1');

		// Trim whitespace
		content = content.replace(new RegExp('^\\s*', ''), '');
		content = content.replace(new RegExp('[\\s\\u00a0]*$', ''), '');

		// put back the line breaks in pre|script
		content = content.replace(/<wp_temp>/g, '\n');

		// Hope.
		return content;
	},

	go : function(id, mode) {
		id = id || 'content';
		mode = mode || this.mode || '';

		var ed = tinyMCE.get(id) || false;
		var qt = this.I('quicktags');
		var H = this.I('edButtonHTML');
		var P = this.I('edButtonPreview');
		var ta = this.I(id);

		if ( 'tinymce' == mode ) {

			if ( ed && ! ed.isHidden() )
				return false;

			this.mode = 'html';
			ta.style.color = '#fff';

			P.className = 'active';
			H.className = '';
			edCloseAllTags(); // :-(

			qt.style.display = 'none';

			ta.value = this.wpautop(ta.value);

			if ( ed ) ed.show();
			else tinyMCE.execCommand("mceAddControl", false, id);

			setUserSetting( 'editor', 'tinymce' );
		} else {
			if ( ! ed || ed.isHidden() )
				return false;

			this.mode = 'tinymce';
			H.className = 'active';
			P.className = '';

			ta.style.height = ed.getContentAreaContainer().offsetHeight + 6 + 'px';

			ed.hide();
			qt.style.display = 'block';

			ta.style.color = '';
			setUserSetting( 'editor', 'html' );
		}
		return false;
	},

	wpautop : function(pee) {
		var blocklist = 'table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]';

		pee = pee + "\n\n";
		pee = pee.replace(new RegExp('<br />\\s*<br />', 'gi'), "\n\n");
		pee = pee.replace(new RegExp('(<(?:'+blocklist+')[^>]*>)', 'gi'), "\n$1");
		pee = pee.replace(new RegExp('(</(?:'+blocklist+')>)', 'gi'), "$1\n\n");
		pee = pee.replace(new RegExp("\\r\\n|\\r", 'g'), "\n");
		pee = pee.replace(new RegExp("\\n\\s*\\n+", 'g'), "\n\n");
		pee = pee.replace(new RegExp('([\\s\\S]+?)\\n\\n', 'mg'), "<p>$1</p>\n");
		pee = pee.replace(new RegExp('<p>\\s*?</p>', 'gi'), '');
		pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1");
		pee = pee.replace(new RegExp("<p>(<li.+?)</p>", 'gi'), "$1");
		pee = pee.replace(new RegExp('<p>\\s*<blockquote([^>]*)>', 'gi'), "<blockquote$1><p>");
		pee = pee.replace(new RegExp('</blockquote>\\s*</p>', 'gi'), '</p></blockquote>');
		pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)', 'gi'), "$1");
		pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1");
		pee = pee.replace(new RegExp('\\s*\\n', 'gi'), "<br />\n");
		pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*<br />', 'gi'), "$1");
		pee = pee.replace(new RegExp('<br />(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)', 'gi'), '$1');
		pee = pee.replace(new RegExp('(?:<p>|<br ?/?>)*\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*(?:</p>|<br ?/?>)*', 'gi'), '[caption$1[/caption]');
		// pee = pee.replace(new RegExp('^((?:&nbsp;)*)\\s', 'mg'), '$1&nbsp;');

		// Fix the pre|script tags
		pee = pee.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) {
			a = a.replace(/<br ?\/?>[\r\n]*/g, '\n');
			return a.replace(/<\/?p( [^>]*)?>[\r\n]*/g, '\n');
		});

		return pee;
	}
};
                                                                                                                                                                                                                                                                                                                                                                                                                   wp-admin/js/forms.js                                                                                0000755 0023422 0004734 00000001533 11043675262 015431  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 function checkAll(jQ) { // use attr( checked, fn )
	jQuery(jQ).find( 'tbody:visible :checkbox' ).attr( 'checked', function() {
		return jQuery(this).attr( 'checked' ) ? '' : 'checked';
	} );
}

jQuery( function($) {
	var lastClicked = false;
	$( 'tbody :checkbox' ).click( function(e) {
		if ( 'undefined' == e.shiftKey ) { return true; }
		if ( e.shiftKey ) {
			if ( !lastClicked ) { return true; }
			var checks = $( lastClicked ).parents( 'form:first' ).find( ':checkbox' );
			var first = checks.index( lastClicked );
			var last = checks.index( this );
			if ( 0 < first && 0 < last && first != last ) {
				checks.slice( first, last ).attr( 'checked', $( this ).is( ':checked' ) ? 'checked' : '' );
			}
		}
		lastClicked = this;
		return true;
	} );
	$( 'thead :checkbox' ).click( function() {
		checkAll( $(this).parents( 'form:first' ) );
	} );
} );                                                                                                                                                                     wp-admin/js/link.js                                                                                 0000755 0023422 0004734 00000003713 11126447476 015250  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 jQuery(document).ready( function($) {
	// close postboxes that should be closed
	jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');

	jQuery('#link_name').focus();
	// postboxes
	postboxes.add_postbox_toggles('link');

	// category tabs
	var categoryTabs = jQuery('#category-tabs').tabs();

	// Ajax Cat
	var newCat = jQuery('#newcat').one( 'focus', function() { jQuery(this).val( '' ).removeClass( 'form-input-tip' ) } );
	jQuery('#category-add-submit').click( function() { newCat.focus(); } );
	var noSyncChecks = false; // prophylactic. necessary?
	var syncChecks = function() {
		if ( noSyncChecks )
			return;
		noSyncChecks = true;
		var th = jQuery(this);
		var c = th.is(':checked');
		var id = th.val().toString();
		jQuery('#in-category-' + id + ', #in-popular-category-' + id).attr( 'checked', c );
		noSyncChecks = false;
	};
	var catAddAfter = function( r, s ) {
		jQuery(s.what + ' response_data', r).each( function() {
			var t = jQuery(jQuery(this).text());
			t.find( 'label' ).each( function() {
				var th = jQuery(this);
				var val = th.find('input').val();
				var id = th.find('input')[0].id
				jQuery('#' + id).change( syncChecks );
				var name = jQuery.trim( th.text() );
				var o = jQuery( '<option value="' +  parseInt( val, 10 ) + '"></option>' ).text( name );
			} );
		} );
	};
	jQuery('#categorychecklist').wpList( {
		alt: '',
		what: 'link-category',
		response: 'category-ajax-response',
		addAfter: catAddAfter
	} );

	$('a[href="#categories-all"]').click(function(){deleteUserSetting('cats');});
	$('a[href="#categories-pop"]').click(function(){setUserSetting('cats','pop');});
	if ( 'pop' == getUserSetting('cats') )
		$('a[href="#categories-pop"]').click();

	jQuery('#category-add-toggle').click( function() {
		jQuery(this).parents('div:first').toggleClass( 'wp-hidden-children' );
		categoryTabs.tabsClick( 1 );
		return false;
	} );
	jQuery('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change();
});
                                                     wp-admin/js/media-upload.js                                                                         0000755 0023422 0004734 00000003646 11113132032 016630  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 // send html to the post editor
function send_to_editor(h) {
	if ( typeof tinyMCE != 'undefined' && ( ed = tinyMCE.activeEditor ) && !ed.isHidden() ) {
		ed.focus();
		if (tinymce.isIE)
			ed.selection.moveToBookmark(tinymce.EditorManager.activeEditor.windowManager.bookmark);

		if ( h.indexOf('[caption') === 0 ) {
			if ( ed.plugins.wpeditimage )
				h = ed.plugins.wpeditimage._do_shcode(h);
		} else if ( h.indexOf('[gallery') === 0 ) {
			if ( ed.plugins.wpgallery )
				h = ed.plugins.wpgallery._do_gallery(h);
		}

		ed.execCommand('mceInsertContent', false, h);

	} else if ( typeof edInsertContent == 'function' ) {
		edInsertContent(edCanvas, h);
	} else {
		jQuery( edCanvas ).val( jQuery( edCanvas ).val() + h );
	}

	tb_remove();
}

// thickbox settings
jQuery(function($) {
	tb_position = function() {
		var tbWindow = $('#TB_window');
		var width = $(window).width();
		var H = $(window).height();
		var W = ( 720 < width ) ? 720 : width;

		if ( tbWindow.size() ) {
			tbWindow.width( W - 50 ).height( H - 45 );
			$('#TB_iframeContent').width( W - 50 ).height( H - 75 );
			tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'});
			if ( typeof document.body.style.maxWidth != 'undefined' )
				tbWindow.css({'top':'20px','margin-top':'0'});
			$('#TB_title').css({'background-color':'#222','color':'#cfcfcf'});
		};

		return $('a.thickbox').each( function() {
			var href = $(this).attr('href');
			if ( ! href ) return;
			href = href.replace(/&width=[0-9]+/g, '');
			href = href.replace(/&height=[0-9]+/g, '');
			$(this).attr( 'href', href + '&width=' + ( W - 80 ) + '&height=' + ( H - 85 ) );
		});
	};

	jQuery('a.thickbox').click(function(){
		if ( typeof tinyMCE != 'undefined' &&  tinyMCE.activeEditor ) {
			tinyMCE.get('content').focus();
			tinyMCE.activeEditor.windowManager.bookmark = tinyMCE.activeEditor.selection.getBookmark('simple');
		}
	});

	$(window).resize( function() { tb_position() } );
});

                                                                                          wp-admin/js/page.js                                                                                 0000755 0023422 0004734 00000014401 11114071026 015200  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 jQuery(document).ready( function($) {
	postboxes.add_postbox_toggles('page');
	make_slugedit_clickable();

	// close postboxes that should be closed
	jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');

	jQuery('#title').blur( function() { if ( (jQuery("#post_ID").val() > 0) || (jQuery("#title").val().length == 0) ) return; autosave(); } );

	var stamp = $('#timestamp').html();

	var visibility = $('#post-visibility-display').html();

	function updateVisibility() {
		if ( $('#post-visibility-select input:radio:checked').val() != 'public' ) {
			$('#sticky').attr('checked', false);
			$('#sticky-span').hide();
		} else {
			$('#sticky-span').show();
		}
		if ( $('#post-visibility-select input:radio:checked').val() != 'password' ) {
			$('#password-span').hide();
		} else {
			$('#password-span').show();
		}
	}

	function updateText() {
		var attemptedDate = new Date( $('#aa').val(), $('#mm').val() -1, $('#jj').val(), $('#hh').val(), $('#mn').val());
		var originalDate = new Date( $('#hidden_aa').val(), $('#hidden_mm').val() -1, $('#hidden_jj').val(), $('#hidden_hh').val(), $('#hidden_mn').val());
		var currentDate = new Date( $('#cur_aa').val(), $('#cur_mm').val() -1, $('#cur_jj').val(), $('#cur_hh').val(), $('#cur_mn').val());
		if ( attemptedDate > currentDate && $('#original_post_status').val() != 'future' ) {
			var publishOn = postL10n.publishOnFuture;
			$('#publish').val( postL10n.schedule );
		} else if ( attemptedDate <= currentDate && $('#original_post_status').val() != 'publish' ) {
			var publishOn = postL10n.publishOn;
			$('#publish').val( postL10n.publish );
		} else {
			var publishOn = postL10n.publishOnPast;
			$('#publish').val( postL10n.update );
		}
		if ( originalDate.toUTCString() == attemptedDate.toUTCString() ) { //hack
			$('#timestamp').html(stamp);
		} else {
			$('#timestamp').html(
				publishOn + ' <b>' +
				$( '#mm option[value=' + $('#mm').val() + ']' ).text() + ' ' +
				$('#jj').val() + ', ' +
				$('#aa').val() + ' @ ' +
				$('#hh').val() + ':' +
				$('#mn').val() + '</b> '
			);
		}

		if ( $('#post-visibility-select input:radio:checked').val() == 'private' ) {
			$('#publish').val( postL10n.update );
			if ( $('#post_status option[value=publish]').length == 0 ) {
				$('#post_status').append('<option value="publish">' + postL10n.privatelyPublished + '</option>');
			}
			$('#post_status option[value=publish]').html( postL10n.privatelyPublished );
			$('#post_status option[value=publish]').attr('selected', true);
			$('.edit-post-status').hide();
		} else {
			if ( $('#original_post_status').val() == 'future' || $('#original_post_status').val() == 'draft' ) {
				if ( $('#post_status option[value=publish]').length != 0 ) {
					$('#post_status option[value=publish]').remove();
					$('#post_status').val($('#hidden_post_status').val());
				}
			} else {
				$('#post_status option[value=publish]').html( postL10n.published );
			}
			$('.edit-post-status').show();
		}
		$('#post-status-display').html($('#post_status :selected').text());
		if ( $('#post_status :selected').val() == 'private' || $('#post_status :selected').val() == 'publish' ) {
			$('#save-post').hide();
		} else {
			$('#save-post').show();
			if ( $('#post_status :selected').val() == 'pending' ) {
				$('#save-post').show().val( postL10n.savePending );
			} else {
				$('#save-post').show().val( postL10n.saveDraft );
			}
		}
	}

	$('.edit-visibility').click(function () {
		if ($('#post-visibility-select').is(":hidden")) {
			updateVisibility();
			$('#post-visibility-select').slideDown("normal");
			$('.edit-visibility').hide();
		}
		return false;
	});

	$('.cancel-post-visibility').click(function () {
		$('#post-visibility-select').slideUp("normal");
		$('#visibility-radio-' + $('#hidden-post-visibility').val()).attr('checked', true);
		$('#post_password').val($('#hidden_post_password').val());
		$('#post-visibility-display').html(visibility);
		$('.edit-visibility').show();
		updateText();
		return false;
	});

	$('.save-post-visibility').click(function () { // crazyhorse - multiple ok cancels
		$('#post-visibility-select').slideUp("normal");
		$('.edit-visibility').show();
		updateText();

		$('#post-visibility-display').html(
			postL10n[$('#post-visibility-select input:radio:checked').val()]
		);

		return false;
	});

	$('#post-visibility-select input:radio').change(function() {
		updateVisibility();
	});

	$('.edit-timestamp').click(function () {
		if ($('#timestampdiv').is(":hidden")) {
			$('#timestampdiv').slideDown("normal");
			$('.edit-timestamp').hide();
		}

		return false;
	});

	$('.cancel-timestamp').click(function() {
		$('#timestampdiv').slideUp("normal");
		$('#mm').val($('#hidden_mm').val());
		$('#jj').val($('#hidden_jj').val());
		$('#aa').val($('#hidden_aa').val());
		$('#hh').val($('#hidden_hh').val());
		$('#mn').val($('#hidden_mn').val());
		$('.edit-timestamp').show();

		updateText();
		return false;
	});

	$('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels
		$('#timestampdiv').slideUp("normal");
		$('.edit-timestamp').show();
		updateText();

		return false;
	});

	$('.edit-post-status').click(function() {
		if ($('#post-status-select').is(":hidden")) {
			$('#post-status-select').slideDown("normal");
			$(this).hide();
		}

		return false;
	});

	$('.save-post-status').click(function() {
		$('#post-status-select').slideUp("normal");
		$('.edit-post-status').show();
		updateText();
		return false;
	});

	$('.cancel-post-status').click(function() {
		$('#post-status-select').slideUp("normal");
		$('#post_status').val($('#hidden_post_status').val());
		$('.edit-post-status').show();

		updateText();
		return false;
	});

	// Custom Fields
	jQuery('#the-list').wpList( { addAfter: function( xml, s ) {
		$('table#list-table').show();
		if ( jQuery.isFunction( autosave_update_post_ID ) ) {
			autosave_update_post_ID(s.parsed.responses[0].supplemental.postid);
		}
	}, addBefore: function( s ) {
		s.data += '&post_id=' + jQuery('#post_ID').val();
		return s;
	}
	});

	// preview
	$('#post-preview').click(function(e){
		if ( 1 > $('#post_ID').val() && autosaveFirst ) {
			autosaveDelayPreview = true;
			autosave();
			return false;
		}

		$('input#wp-preview').val('dopreview');
		$('form#post').attr('target', 'wp-preview').submit().attr('target', '');
		$('input#wp-preview').val('');
		return false;
	});
});
                                                                                                                                                                                                                                                               wp-admin/js/password-strength-meter.js                                                              0000755 0023422 0004734 00000001315 11117531364 021105  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 // Password strength meter

function passwordStrength(password,username) {
    var shortPass = 1, badPass = 2, goodPass = 3, strongPass = 4;

	//password < 4
    if (password.length < 4 ) { return shortPass };

    //password == username
    if (password.toLowerCase()==username.toLowerCase()) return badPass;

	var symbolSize = 0;
	if (password.match(/[0-9]/)) symbolSize +=10;
	if (password.match(/[a-z]/)) symbolSize +=26;
	if (password.match(/[A-Z]/)) symbolSize +=26;
	if (password.match(/[^a-zA-Z0-9]/)) symbolSize +=31;

	var natLog = Math.log( Math.pow(symbolSize,password.length) );
	var score = natLog / Math.LN2;
	if (score < 40 )  return badPass
	if (score < 56 )  return goodPass
    return strongPass;
}                                                                                                                                                                                                                                                                                                                   wp-admin/js/post.js                                                                                 0000755 0023422 0004734 00000034420 11117531364 015265  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 // this file contains all the scripts used in the post/edit page

function new_tag_remove_tag() {
	var id = jQuery( this ).attr( 'id' );
	var num = id.substr( 10 );
	var current_tags = jQuery( '#tags-input' ).val().split(',');
	delete current_tags[num];
	var new_tags = [];
	jQuery.each( current_tags, function( key, val ) {
		if ( val && !val.match(/^\s+$/) && '' != val ) {
			new_tags = new_tags.concat( val );
		}
	});
	jQuery( '#tags-input' ).val( new_tags.join( ',' ).replace( /\s*,+\s*/, ',' ).replace( /,+/, ',' ).replace( /,+\s+,+/, ',' ).replace( /,+\s*$/, '' ).replace( /^\s*,+/, '' ) );
	tag_update_quickclicks();
	jQuery('#newtag').focus();
	return false;
}

function tag_update_quickclicks() {
	if ( jQuery( '#tags-input' ).length == 0 )
		return;
	var current_tags = jQuery( '#tags-input' ).val().split(',');
	jQuery( '#tagchecklist' ).empty();
	shown = false;
//	jQuery.merge( current_tags, current_tags ); // this doesn't work anymore, need something to array_unique
	jQuery.each( current_tags, function( key, val ) {
		val = val.replace( /^\s+/, '' ).replace( /\s+$/, '' ); // trim
		if ( !val.match(/^\s+$/) && '' != val ) {
			txt = '<span><a id="tag-check-' + key + '" class="ntdelbutton">X</a>&nbsp;' + val + '</span> ';
			jQuery( '#tagchecklist' ).append( txt );
			jQuery( '#tag-check-' + key ).click( new_tag_remove_tag );
			shown = true;
		}
	});
	if ( shown )
		jQuery( '#tagchecklist' ).prepend( '<strong>'+postL10n.tagsUsed+'</strong><br />' );
}

function tag_flush_to_text(e,a) {
	a = a || false;
	var text = a ? jQuery(a).text() : jQuery('#newtag').val();
	var newtags = jQuery('#tags-input').val();

	var t = text.replace( /\s*([^,]+).*/, '$1,' );
	newtags += ','

	if ( newtags.indexOf(t) != -1 )
		return false;

	newtags += text;

	// massage
	newtags = newtags.replace( /\s+,+\s*/g, ',' ).replace( /,+/g, ',' ).replace( /,+\s+,+/g, ',' ).replace( /,+\s*$/g, '' ).replace( /^\s*,+/g, '' );
	jQuery('#tags-input').val( newtags );
	tag_update_quickclicks();
	if ( ! a ) {
		jQuery('#newtag').val('');
		jQuery('#newtag').focus();
	}
	return false;
}

function tag_save_on_publish() {
	if ( jQuery('#newtag').val() != postL10n.addTag )
		tag_flush_to_text();
}

function tag_press_key( e ) {
	if ( 13 == e.keyCode ) {
		tag_flush_to_text();
		return false;
	}
};

(function($){
	tagCloud = {
		init : function() {
			$('#tagcloud-link').click(function(){tagCloud.get(); $(this).unbind().click(function(){return false;}); return false;});
		},

		get : function() {
			$.post('admin-ajax.php', {'action':'get-tagcloud'}, function(r, stat) {
				if ( 0 == r || 'success' != stat )
					r = wpAjax.broken;

				r = '<p id="the-tagcloud">'+r+'</p>';
				$('#tagcloud-link').after($(r));
				$('#the-tagcloud a').click(function(){
					tag_flush_to_text(0,this);
					return false;
				});
			});
		}
	}
})(jQuery);

jQuery(document).ready( function($) {
	tagCloud.init();

	// close postboxes that should be closed
	jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');

	// postboxes
	postboxes.add_postbox_toggles('post');

	// Editable slugs
	make_slugedit_clickable();

	jQuery('#tags-input').hide();
	tag_update_quickclicks();
	// add the quickadd form
	jQuery('#jaxtag').prepend('<span id="ajaxtag"><input type="text" name="newtag" id="newtag" class="form-input-tip" size="16" autocomplete="off" value="'+postL10n.addTag+'" /><input type="button" class="button" id="tagadd" value="' + postL10n.add + '" tabindex="3" /><input type="hidden"/><input type="hidden"/><span class="howto">'+postL10n.separate+'</span></span>');
	jQuery('#tagadd').click( tag_flush_to_text );
	jQuery('#newtag').focus(function() {
		if ( this.value == postL10n.addTag )
			jQuery(this).val( '' ).removeClass( 'form-input-tip' );
	});
	jQuery('#newtag').blur(function() {
		if ( this.value == '' )
			jQuery(this).val( postL10n.addTag ).addClass( 'form-input-tip' );
	});

	// auto-save tags on post save/publish
	jQuery('#publish').click( tag_save_on_publish );
	jQuery('#save-post').click( tag_save_on_publish );

	jQuery('#title').blur( function() { if ( (jQuery("#post_ID").val() > 0) || (jQuery("#title").val().length == 0) ) return; autosave(); } );

	// auto-suggest stuff
	jQuery('#newtag').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } );
	jQuery('#newtag').keypress( tag_press_key );

	// category tabs
	var categoryTabs =jQuery('#category-tabs').tabs();

	// Ajax Cat
	var newCat = jQuery('#newcat').one( 'focus', function() { jQuery(this).val( '' ).removeClass( 'form-input-tip' ) } );
	jQuery('#category-add-sumbit').click( function() { newCat.focus(); } );
	var newCatParent = false;
	var newCatParentOption = false;
	var noSyncChecks = false; // prophylactic. necessary?
	var syncChecks = function() {
		if ( noSyncChecks )
			return;
		noSyncChecks = true;
		var th = jQuery(this);
		var c = th.is(':checked');
		var id = th.val().toString();
		jQuery('#in-category-' + id + ', #in-popular-category-' + id).attr( 'checked', c );
		noSyncChecks = false;
	};
	var popularCats = jQuery('#categorychecklist-pop :checkbox').map( function() { return parseInt(jQuery(this).val(), 10); } ).get().join(',');
	var catAddBefore = function( s ) {
		s.data += '&popular_ids=' + popularCats + '&' + jQuery( '#categorychecklist :checked' ).serialize();
		return s;
	};
	var catAddAfter = function( r, s ) {
		if ( !newCatParent ) newCatParent = jQuery('#newcat_parent');
		if ( !newCatParentOption ) newCatParentOption = newCatParent.find( 'option[value=-1]' );
		jQuery(s.what + ' response_data', r).each( function() {
			var t = jQuery(jQuery(this).text());
			t.find( 'label' ).each( function() {
				var th = jQuery(this);
				var val = th.find('input').val();
				var id = th.find('input')[0].id
				jQuery('#' + id).change( syncChecks ).change();
				if ( newCatParent.find( 'option[value=' + val + ']' ).size() )
					return;
				var name = jQuery.trim( th.text() );
				var o = jQuery( '<option value="' +  parseInt( val, 10 ) + '"></option>' ).text( name );
				newCatParent.prepend( o );
			} );
			newCatParentOption.attr( 'selected', true );
		} );
	};
	jQuery('#categorychecklist').wpList( {
		alt: '',
		response: 'category-ajax-response',
		addBefore: catAddBefore,
		addAfter: catAddAfter
	} );
	jQuery('#category-add-toggle').click( function() {
		jQuery(this).parents('div:first').toggleClass( 'wp-hidden-children' );
		// categoryTabs.tabs( 'select', '#categories-all' ); // this is broken (in the UI beta?)
		categoryTabs.find( 'a[href="#categories-all"]' ).click();
		jQuery('#newcat').focus();
		return false;
	} );

	$('a[href="#categories-all"]').click(function(){deleteUserSetting('cats');});
	$('a[href="#categories-pop"]').click(function(){setUserSetting('cats','pop');});
	if ( 'pop' == getUserSetting('cats') )
		$('a[href="#categories-pop"]').click();

	jQuery('.categorychecklist .popular-category :checkbox').change( syncChecks ).filter( ':checked' ).change();
	var stamp = $('#timestamp').html();
	var visibility = $('#post-visibility-display').html();
	var sticky = '';

	function updateVisibility() {
		if ( $('#post-visibility-select input:radio:checked').val() != 'public' ) {
			$('#sticky').attr('checked', false);
			$('#sticky-span').hide();
		} else {
			$('#sticky-span').show();
		}
		if ( $('#post-visibility-select input:radio:checked').val() != 'password' ) {
			$('#password-span').hide();
		} else {
			$('#password-span').show();
		}
	}

	function updateText() {
		var attemptedDate = new Date( $('#aa').val(), $('#mm').val() -1, $('#jj').val(), $('#hh').val(), $('#mn').val());
		var originalDate = new Date( $('#hidden_aa').val(), $('#hidden_mm').val() -1, $('#hidden_jj').val(), $('#hidden_hh').val(), $('#hidden_mn').val());
		var currentDate = new Date( $('#cur_aa').val(), $('#cur_mm').val() -1, $('#cur_jj').val(), $('#cur_hh').val(), $('#cur_mn').val());
		if ( attemptedDate > currentDate && $('#original_post_status').val() != 'future' ) {
			var publishOn = postL10n.publishOnFuture;
			$('#publish').val( postL10n.schedule );
		} else if ( attemptedDate <= currentDate && $('#original_post_status').val() != 'publish' ) {
			var publishOn = postL10n.publishOn;
			$('#publish').val( postL10n.publish );
		} else {
			var publishOn = postL10n.publishOnPast;
			$('#publish').val( postL10n.update );
		}
		if ( originalDate.toUTCString() == attemptedDate.toUTCString() ) { //hack
			$('#timestamp').html(stamp);
		} else {
			$('#timestamp').html(
				publishOn + ' <b>' +
				$( '#mm option[value=' + $('#mm').val() + ']' ).text() + ' ' +
				$('#jj').val() + ', ' +
				$('#aa').val() + ' @ ' +
				$('#hh').val() + ':' +
				$('#mn').val() + '</b> '
			);
		}

		if ( $('#post-visibility-select input:radio:checked').val() == 'private' ) {
			$('#publish').val( postL10n.update );
			if ( $('#post_status option[value=publish]').length == 0 ) {
				$('#post_status').append('<option value="publish">' + postL10n.privatelyPublished + '</option>');
			}
			$('#post_status option[value=publish]').html( postL10n.privatelyPublished );
			$('#post_status option[value=publish]').attr('selected', true);
			$('.edit-post-status').hide();
		} else {
			if ( $('#original_post_status').val() == 'future' || $('#original_post_status').val() == 'draft' ) {
				if ( $('#post_status option[value=publish]').length != 0 ) {
					$('#post_status option[value=publish]').remove();
					$('#post_status').val($('#hidden_post_status').val());
				}
			} else {
				$('#post_status option[value=publish]').html( postL10n.published );
			}
			$('.edit-post-status').show();
		}
		$('#post-status-display').html($('#post_status :selected').text());
		if ( $('#post_status :selected').val() == 'private' || $('#post_status :selected').val() == 'publish' ) {
			$('#save-post').hide();
		} else {
			$('#save-post').show();
			if ( $('#post_status :selected').val() == 'pending' ) {
				$('#save-post').show().val( postL10n.savePending );
			} else {
				$('#save-post').show().val( postL10n.saveDraft );
			}
		}
	}

	$('.edit-visibility').click(function () {
		if ($('#post-visibility-select').is(":hidden")) {
			updateVisibility();
			$('#post-visibility-select').slideDown("normal");
			$('.edit-visibility').hide();
		}
		return false;
	});

	$('.cancel-post-visibility').click(function () {
		$('#post-visibility-select').slideUp("normal");
		$('#visibility-radio-' + $('#hidden-post-visibility').val()).attr('checked', true);
		$('#post_password').val($('#hidden_post_password').val());
		$('#sticky').attr('checked', $('#hidden-post-sticky').attr('checked'));
		$('#post-visibility-display').html(visibility);
		$('.edit-visibility').show();
		updateText();
		return false;
	});

	$('.save-post-visibility').click(function () { // crazyhorse - multiple ok cancels
		$('#post-visibility-select').slideUp("normal");
		$('.edit-visibility').show();
		updateText();
		if ( $('#post-visibility-select input:radio:checked').val() != 'public' ) {
			$('#sticky').attr('checked', false);
		}

		if ( true == $('#sticky').attr('checked') ) {
			sticky = 'Sticky';
		} else {
			sticky = '';
		}

		$('#post-visibility-display').html(
			postL10n[$('#post-visibility-select input:radio:checked').val() + sticky]
		);

		return false;
	});

	$('#post-visibility-select input:radio').change(function() {
		updateVisibility();
	});

	$('.edit-timestamp').click(function () {
		if ($('#timestampdiv').is(":hidden")) {
			$('#timestampdiv').slideDown("normal");
			$('.edit-timestamp').hide();
		}

		return false;
	});

	$('.cancel-timestamp').click(function() {
		$('#timestampdiv').slideUp("normal");
		$('#mm').val($('#hidden_mm').val());
		$('#jj').val($('#hidden_jj').val());
		$('#aa').val($('#hidden_aa').val());
		$('#hh').val($('#hidden_hh').val());
		$('#mn').val($('#hidden_mn').val());
		$('.edit-timestamp').show();
		updateText();
		return false;
	});

	$('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels
		$('#timestampdiv').slideUp("normal");
		$('.edit-timestamp').show();
		updateText();

		return false;
	});

	$('.edit-post-status').click(function() {
		if ($('#post-status-select').is(":hidden")) {
			$('#post-status-select').slideDown("normal");
			$(this).hide();
		}

		return false;
	});

	$('.save-post-status').click(function() {
		$('#post-status-select').slideUp("normal");
		$('.edit-post-status').show();
		updateText();
		return false;
	});

	$('.cancel-post-status').click(function() {
		$('#post-status-select').slideUp("normal");
		$('#post_status').val($('#hidden_post_status').val());
		$('.edit-post-status').show();
		updateText();
		return false;
	});

	// Custom Fields
	jQuery('#the-list').wpList( { addAfter: function( xml, s ) {
		$('table#list-table').show();
		if ( jQuery.isFunction( autosave_update_post_ID ) ) {
			autosave_update_post_ID(s.parsed.responses[0].supplemental.postid);
		}
	}, addBefore: function( s ) {
		s.data += '&post_id=' + jQuery('#post_ID').val();
		return s;
	}
	});

	// preview
	$('#post-preview').click(function(e){
		if ( 1 > $('#post_ID').val() && autosaveFirst ) {
			autosaveDelayPreview = true;
			autosave();
			return false;
		}

		$('input#wp-preview').val('dopreview');
		$('form#post').attr('target', 'wp-preview').submit().attr('target', '');
		$('input#wp-preview').val('');
		return false;
	});

});

(function($){
	commentsBox = {
		st : 0,

		get : function(total, num) {
			var st = this.st;
			if ( ! num )
				num = 20;

			this.st += num;
			this.total = total;
			$('.waiting').show();

			var data = {
				'action' : 'get-comments',
				'mode' : 'single',
				'_ajax_nonce' : $('#add_comment_nonce').val(),
				'post_ID' : $('#post_ID').val(),
				'start' : st,
				'num' : num
			};

			$.post('admin-ajax.php', data,
				function(r) {
					var r = wpAjax.parseAjaxResponse(r);
					$('#commentstatusdiv .widefat').show();
					$('.waiting').hide();

					if ( 'object' == typeof r && r.responses[0] ) {
						$('#the-comment-list').append( r.responses[0].data );
						$('#the-comment-list .hide-if-no-js').removeClass('hide-if-no-js');

						theList = theExtraList = null;
						$("a[className*=':']").unbind();
						setCommentsList();

						if ( commentsBox.st > commentsBox.total )
							$('#show-comments').hide();
						else
							$('#show-comments').html(postL10n.showcomm);
						return;
					} else if ( 1 == r ) {
						$('#show-comments').parent().html(postL10n.endcomm);
						return;
					}

					$('#the-comment-list').append('<tr><td colspan="5">'+wpAjax.broken+'</td></tr>');
				}
			);

			return false;
		}
	};

})(jQuery);

                                                                                                                                                                                                                                                wp-admin/js/postbox.js                                                                              0000755 0023422 0004734 00000005731 11115442746 016004  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 (function($) {
	postboxes = {
		add_postbox_toggles : function(page,args) {
			$('.postbox h3, .postbox .handlediv').click( function() {
				$($(this).parent().get(0)).toggleClass('closed');
				postboxes.save_state(page);
			} );
			$('.postbox h3 a').click( function(e) {
				e.stopPropagation();
			} );

			$('.hide-postbox-tog').click( function() {
				var box = jQuery(this).val();
				if ( jQuery(this).attr('checked') ) {
					jQuery('#' + box).show();
					if ( $.isFunction( postboxes.pbshow ) )
						postboxes.pbshow( box );

				} else {
					jQuery('#' + box).hide();
					if ( $.isFunction( postboxes.pbhide ) )
						postboxes.pbhide( box );

				}
				postboxes.save_state(page);
			} );

			this.expandSidebar();
			this.init(page,args);
		},

		expandSidebar : function(doIt) {
			if ( doIt || $('#side-sortables > .postbox:visible').length ) {
				if ( ! $('#post-body').hasClass('has-sidebar') ) {
					$('#post-body').addClass('has-sidebar');
					var h = Math.min( $('#post-body').height(), 300 );
					$('#side-sortables').css({'minHeight':h+'px','height':'auto'});
				}
			} else {
				$('#post-body').removeClass('has-sidebar');
				$('#side-sortables').css({'minHeight':'0'});
				if ( $.browser.msie && $.browser.version.charAt(0) == 7 )
					$('#side-sortables').css({'height':'0'});
			}
		},

		init : function(page, args) {
			$.extend( this, args || {} );
			$('#wpbody-content').css('overflow','hidden');
			$('.meta-box-sortables').sortable( {
				placeholder: 'sortable-placeholder',
				connectWith: [ '.meta-box-sortables' ],
				items: '> .postbox',
				handle: '.hndle',
				distance: 2,
				tolerance: 'pointer',
				toleranceMove: 'tolerance',
				sort: function(e,ui) {
					if ( $(document).width() - e.clientX < 300 ) {
						if ( ! $('#post-body').hasClass('has-sidebar') ) {
							var pos = $('#side-sortables').offset();

							$('#side-sortables').append(ui.item)
							$(ui.placeholder).css({'top':pos.top,'left':pos.left}).width($(ui.item).width())
							postboxes.expandSidebar(1);
						}
					}
				},
				stop: function() {
					var postVars = {
						action: 'meta-box-order',
						_ajax_nonce: $('#meta-box-order-nonce').val(),
						page: page
					}
					$('.meta-box-sortables').each( function() {
						postVars["order[" + this.id.split('-')[0] + "]"] = $(this).sortable( 'toArray' ).join(',');
					} );
					$.post( postboxL10n.requestFile, postVars, function() {
						postboxes.expandSidebar();
					} );
				}
			} );
		},

		save_state : function(page) {
			var closed = $('.postbox').filter('.closed').map(function() { return this.id; }).get().join(',');
			var hidden = $('.postbox').filter(':hidden').map(function() { return this.id; }).get().join(',');
			$.post(postboxL10n.requestFile, {
				action: 'closed-postboxes',
				closed: closed,
				hidden: hidden,
				closedpostboxesnonce: jQuery('#closedpostboxesnonce').val(),
				page: page
			});
			postboxes.expandSidebar();
		},

		/* Callbacks */
		pbshow : false,

		pbhide : false
	};

}(jQuery));
                                       wp-admin/js/slug.js                                                                                 0000755 0023422 0004734 00000003324 11106251336 015245  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 function edit_permalink(post_id) {
	var i, c = 0;
	var e = jQuery('#editable-post-name');
	var revert_e = e.html();
	var real_slug = jQuery('#post_name');
	var revert_slug = real_slug.html();
	var b = jQuery('#edit-slug-buttons');
	var revert_b = b.html();
	var full = jQuery('#editable-post-name-full').html();

	b.html('<a href="" class="save button">'+slugL10n.save+'</a> <a class="cancel" href="">'+slugL10n.cancel+'</a>');
	b.children('.save').click(function() {
		var new_slug = e.children('input').val();
		jQuery.post(slugL10n.requestFile, {
			action: 'sample-permalink',
			post_id: post_id,
			new_slug: new_slug,
			new_title: jQuery('#title').val(),
			samplepermalinknonce: jQuery('#samplepermalinknonce').val()}, function(data) {
				jQuery('#edit-slug-box').html(data);
				b.html(revert_b);
				real_slug.attr('value', new_slug);
				make_slugedit_clickable();
			});
		return false;
	});
	jQuery('#edit-slug-buttons .cancel').click(function() {
		e.html(revert_e);
		b.html(revert_b);
		real_slug.attr('value', revert_slug);
		return false;
	});
	for(i=0; i < full.length; ++i) {
		if ('%' == full.charAt(i)) c++;
	}
	slug_value = (c > full.length/4)? '' : full;
	e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children('input').keypress(function(e){
		var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
		// on enter, just save the new slug, don't save the post
		if (13 == key) {b.children('.save').click();return false;}
		if (27 == key) {b.children('.cancel').click();return false;}
		real_slug.attr('value', this.value)}).focus();
}

function make_slugedit_clickable() {
	jQuery('#editable-post-name').click(function() {jQuery('#edit-slug-buttons').children('.edit-slug').click()});
}

                                                                                                                                                                                                                                                                                                            wp-admin/js/tags.js                                                                                 0000755 0023422 0004734 00000001344 11110341412 015217  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 jQuery(function($) {
	var options = false

	var addAfter = function( r, settings ) {
		var name = $("<span>" + $('name', r).text() + "</span>").html();
		var id = $('tag', r).attr('id');
		options[options.length] = new Option(name, id);

	}

	var addAfter2 = function( x, r ) {
		var t = $(r.parsed.responses[0].data);
		if ( t.length == 1 )
			inlineEditTax.addEvents($(t.id));
	}

	var delAfter = function( r, settings ) {
		var id = $('tag', r).attr('id');
		for ( var o = 0; o < options.length; o++ )
			if ( id == options[o].value )
				options[o] = null;
	}

	if ( options )
		$('#the-list').wpList( { addAfter: addAfter, delAfter: delAfter } );
	else
		$('#the-list').wpList({ addAfter: addAfter2 });

	columns.init('edit-tags');
});                                                                                                                                                                                                                                                                                            wp-admin/js/upload.js                                                                               0000755 0023422 0004734 00000031650 10767043134 015571  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 jQuery(document).ready( function() {
	theFileList = {
		currentImage: {ID: 0},
		nonce: '',
		tab: '',
		postID: 0,

		// cookie create and read functions adapted from http://www.quirksmode.org/js/cookies.html
		createCookie: function(name,value,days) {
			if (days) {
				var date = new Date();
				date.setTime(date.getTime()+(days*24*60*60*1000));
				var expires = "; expires="+date.toGMTString();
			}
			else var expires = "";
			document.cookie = name+"="+value+expires+"; path=/";
		},

		readCookie: function(name) {
			var nameEQ = name + "=";
			var ca = document.cookie.split(';');
			for(var i=0;i < ca.length;i++) {
				var c = ca[i];
				while (c.charAt(0)==' ') c = c.substring(1,c.length);
				if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
			}
			return null;
		},

		assignCookieOnChange: function() {
			jQuery(this).bind("change", function(){
				theFileList.createCookie(jQuery(this).attr('name'),jQuery(this).attr('id'),365);
			});
		},

		checkCookieSetting: function(name, defaultSetting) {
			return this.readCookie(name) ? this.readCookie(name) : defaultSetting;
		},

		toQueryParams: function( s ) {
			var r = {}; if ( !s ) { return r; }
			var q = s.split('?'); if ( q[1] ) { s = q[1]; }
			var pp = s.split('&');
			for ( var i in pp ) {
				var p = pp[i].split('=');
				r[p[0]] = p[1];
			}
			return r;
		},

		toQueryString: function(params) {
			var qryStr = '';
			for ( var key in params )
				qryStr += key + '=' + params[key] + '&';
			return qryStr;
		},

		initializeVars: function() {
			this.urlData  = document.location.href.split('?');
			this.params = this.toQueryParams(this.urlData[1]);
			this.postID = this.params['post_id'];
			this.tab = this.params['tab'];
			this.style = this.params['style'];
			this.ID = this.params['ID'];
			if ( !this.style )
				this.style = 'default';
			var nonceEl = jQuery('#nonce-value');
			if ( nonceEl )
				this.nonce = jQuery(nonceEl).val();
			if ( this.ID ) {
				this.grabImageData( this.ID );
				this.imageView( this.ID );
			}
		},

		initializeLinks: function() {
			if ( this.ID )
				return;
			jQuery('a.file-link').each(function() {
				var id = jQuery(this).attr('id').split('-').pop();
				jQuery(this).attr('href','javascript:void(0)').click(function(e) {
					theFileList[ 'inline' == theFileList.style ? 'imageView' : 'editView' ](id, e);
				});
			});
		},

		grabImageData: function(id) {
			if ( id == this.currentImage.ID )
				return;
			var thumbEl = jQuery('#attachment-thumb-url-' + id);
			if ( thumbEl ) {
				this.currentImage.thumb = ( 0 == id ? '' : jQuery(thumbEl).val() );
				this.currentImage.thumbBase = ( 0 == id ? '' : jQuery('#attachment-thumb-url-base-' + id).val() );
			} else {
				this.currentImage.thumb = false;
			}
			this.currentImage.src = ( 0 == id ? '' : jQuery('#attachment-url-' + id).val() );
			this.currentImage.srcBase = ( 0 == id ? '' : jQuery('#attachment-url-base-' + id).val() );
			this.currentImage.page = ( 0 == id ? '' : jQuery('#attachment-page-url-' + id).val() );
			this.currentImage.title = ( 0 == id ? '' : jQuery('#attachment-title-' + id).val() );
			this.currentImage.description = ( 0 == id ? '' : jQuery('#attachment-description-' + id).val() );
			var widthEl = jQuery('#attachment-width-' + id);
			if ( widthEl ) {
				this.currentImage.width = ( 0 == id ? '' : jQuery(widthEl).val() );
				this.currentImage.height = ( 0 == id ? '' : jQuery('#attachment-height-' + id).val() );
			} else {
				this.currentImage.width = false;
				this.currentImage.height = false;
			}
			this.currentImage.isImage = ( 0 == id ? 0 : jQuery('#attachment-is-image-' + id).val() );
			this.currentImage.ID = id;
		},

		imageView: function(id, e) {
			this.prepView(id);
			var h = '';

			h += "<div id='upload-file'>"
			if ( this.ID ) {
				var params = this.params;
				params.ID = '';
				params.action = '';
				h += "<a href='" + this.urlData[0] + '?' + this.toQueryString(params) + "'";
			} else {
				h += "<a href='#' onclick='return theFileList.cancelView();'";
			}
			h += " title='" + this.browseTitle + "' class='back'>" + this.back + "</a>";
			h += "<div id='file-title'>"
			if ( 0 == this.currentImage.isImage )
				h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>" + this.currentImage.title + "</a></h2>";
			else
				h += "<h2>" + this.currentImage.title + "</h2>";
			h += " &#8212; <span>";
			h += "<a href='#' onclick='return theFileList.editView(" + id + ");'>" + this.edit + "</a>"
			h += "</span>";
			h += '</div>'
			h += "<div id='upload-file-view' class='alignleft'>";
			if ( 1 == this.currentImage.isImage ) {
				h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>";
				h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />";
				h += "</a>";
			} else
				h += '&nbsp;';
			h += "</div>";

			h += "<form name='uploadoptions' id='uploadoptions' class='alignleft'>";
			h += "<table>";
			var display = [];
			var checkedDisplay = 'display-title';
			if ( 1 == this.currentImage.isImage ) {
				checkedDisplay = 'display-full';
				if ( this.currentImage.thumb ) {
					display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> " + this.thumb + "</label><br />");
					checkedDisplay = 'display-thumb';
				}
				display.push("<label for='display-full'><input type='radio' name='display' id='display-full' value='full' /> " + this.full + "</label>");
			} else if ( this.currentImage.thumb ) {
				display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> " + this.icon + "</label>");
			}
			if ( display.length ) {
				display.push("<br /><label for='display-title'><input type='radio' name='display' id='display-title' value='title' /> " + this.title + "</label>");
				h += "<tr><th style='padding-bottom:.5em'>" + this.show + "</th><td style='padding-bottom:.5em'>";
				jQuery(display).each( function() { h += this; } );
				h += "</td></tr>";
			}

			var checkedLink = 'link-file';
 			h += "<tr><th>" + this.link + "</th><td>";
			h += "<label for='link-file'><input type='radio' name='link' id='link-file' value='file' /> " + this.file + "</label><br />";			h += "<label for='link-page'><input type='radio' name='link' id='link-page' value='page' /> " + this.page + "</label><br />";
			h += "<label for='link-none'><input type='radio' name='link' id='link-none' value='none' /> " + this.none + "</label>";
			h += "</td></tr>";

			h += "<tr><td colspan='2'><p class='submit'>";
			h += "<input type='button' class='button' name='send' onclick='theFileList.sendToEditor(" + id + ")' value='" + this.editorText + "' />";
			h += "</p></td></tr></table>";
			h += "</form>";

			h += "</div>";

			jQuery(h).prependTo('#upload-content');
			jQuery("input[@name='display']").each(theFileList.assignCookieOnChange);
			jQuery("input[@name='link']").each(theFileList.assignCookieOnChange);
			checkedDisplay = this.checkCookieSetting('display', checkedDisplay);
			checkedLink = this.checkCookieSetting('link', checkedLink);
			jQuery('#' + checkedDisplay).attr('checked','checked');
			jQuery('#' + checkedLink).attr('checked','checked');
			if (e) return e.stopPropagation();
			return false;
		},

		editView: function(id, e) {
			this.prepView(id);
			var h = '';

			var action = 'upload.php?style=' + this.style + '&amp;tab=upload';
			if ( this.postID )
				action += '&amp;post_id=' + this.postID;

			h += "<form id='upload-file' method='post' action='" + action + "'>";
			if ( this.ID ) {
				var params = this.params;
				params.ID = '';
				params.action = '';
				h += "<a href='" + this.urlData[0] + '?' + this.toQueryString(params) + "'";
			} else {
				h += "<a href='#' onclick='return theFileList.cancelView();'";
			}
			h += " title='" + this.browseTitle + "' class='back'>" + this.back + "</a>";
			h += "<div id='file-title'>"
			if ( 0 == this.currentImage.isImage )
				h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>" + this.currentImage.title + "</a></h2>";
			else
				h += "<h2>" + this.currentImage.title + "</h2>";
			h += " &#8212; <span>";
			h += "<a href='#' onclick='return theFileList.imageView(" + id + ");'>" + this.insert + "</a>";
			h += "</span>";
			h += '</div>'
			h += "<div id='upload-file-view' class='alignleft'>";
			if ( 1 == this.currentImage.isImage ) {
				h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>";
				h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />";
				h += "</a>";
			} else
				h += '&nbsp;';
			h += "</div>";


			h += "<table><col /><col class='widefat' /><tr>";
			h += "<th scope='row'><label for='url'>" + this.urlText + "</label></th>";
			h += "<td><input type='text' id='url' class='readonly' value='" + this.currentImage.srcBase + this.currentImage.src + "' readonly='readonly' /></td>";
			h += "</tr><tr>";
			h += "<th scope='row'><label for='post_title'>" + this.title + "</label></th>";
			h += "<td><input type='text' id='post_title' name='post_title' value='" + this.currentImage.title + "' /></td>";
			h += "</tr><tr>";
			h += "<th scope='row'><label for='post_content'>" + this.desc + "</label></th>";
			h += "<td><textarea name='post_content' id='post_content'>" + this.currentImage.description + "</textarea></td>";
			h += "</tr><tr id='buttons' class='submit'><td colspan='2'><input type='button' id='delete' name='delete' class='delete alignleft' value='" + this.deleteText + "' onclick='theFileList.deleteFile(" + id + ");' />";
			h += "<input type='hidden' name='from_tab' value='" + this.tab + "' />";
			h += "<input type='hidden' name='post_parent' value='" + parseInt(this.postID,10) + "' />";
			h += "<input type='hidden' name='action' id='action-value' value='save' />";
			h += "<input type='hidden' name='ID' value='" + id + "' />";
			h += "<input type='hidden' name='_wpnonce' value='" + this.nonce + "' />";
			h += "<div class='submit'><input type='submit' value='" + this.saveText + "' /></div>";
			h += "</td></tr></table></form>";

			jQuery(h).prependTo('#upload-content');
			if (e) e.stopPropagation();
			return false;
		},

		prepView: function(id) {
			this.cancelView( true );
			var filesEl = jQuery('#upload-files');
			if ( filesEl )
				filesEl.hide();
			var navEl = jQuery('#current-tab-nav');
			if ( navEl )
				navEl.hide();
			this.grabImageData(id);
		},

		cancelView: function( prep ) {
			if ( !prep ) {
				var filesEl = jQuery('#upload-files');
				if ( filesEl )
					jQuery(filesEl).show();
				var navEl = jQuery('#current-tab-nav');
				if ( navEl )
					jQuery(navEl).show();
			}
			if ( !this.ID )
				this.grabImageData(0);
			var div = jQuery('#upload-file');
			if ( div )
				jQuery(div).remove();
			return false;
		},

		sendToEditor: function(id) {
			this.grabImageData(id);
			var link = '';
			var display = '';
			var h = '';

			link = jQuery('input[@type=radio][@name="link"][@checked]','#uploadoptions').val();
			displayEl = jQuery('input[@type=radio][@name="display"][@checked]','#uploadoptions');
			if ( displayEl )
				display = jQuery(displayEl).val();
			else if ( 1 == this.currentImage.isImage )
				display = 'full';

			if ( 'none' != link )
				h += "<a href='" + ( 'file' == link ? ( this.currentImage.srcBase + this.currentImage.src ) : ( this.currentImage.page + "' rel='attachment wp-att-" + this.currentImage.ID ) ) + "' title='" + this.currentImage.title + "'>";
			if ( display && 'title' != display )
				h += "<img src='" + ( 'thumb' == display ? ( this.currentImage.thumbBase + this.currentImage.thumb ) : ( this.currentImage.srcBase + this.currentImage.src ) ) + "' alt='" + this.currentImage.title + "' />";
			else
				h += this.currentImage.title;
			if ( 'none' != link )
				h += "</a>";

			var win = window.opener ? window.opener : window.dialogArguments;
			if ( !win )
				win = top;
			tinyMCE = win.tinyMCE;
			if ( typeof tinyMCE != 'undefined' && tinyMCE.getInstanceById('content') ) {
				tinyMCE.selectedInstance.getWin().focus();
				tinyMCE.execCommand('mceInsertContent', false, h);
			} else
				win.edInsertContent(win.edCanvas, h);
			if ( !this.ID )
				this.cancelView();
			return false;
		},

		deleteFile: function(id) {
			if ( confirm( this.confirmText.replace(/%title%/g, this.currentImage.title) ) ) {
				jQuery('#action-value').attr('value','delete');
				jQuery('#upload-file').submit();
				return true;
			}
			return false;
		}

	};

	for ( var property in uploadL10n )
		theFileList[property] = uploadL10n[property];
	theFileList.initializeVars();
	theFileList.initializeLinks();
} );
                                                                                        wp-admin/js/users.js                                                                                0000755 0023422 0004734 00000000112 11110341412 015412  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 jQuery( function($) {
	$('#users').wpList();

	columns.init('users');
});
                                                                                                                                                                                                                                                                                                                                                                                                                                                      wp-admin/js/widgets.js                                                                              0000755 0023422 0004734 00000012111 11111361050 015722  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 jQuery(function($) {
	$('.noscript-action').remove();

	var reminded = false;
	var lameWidgetReminder = function() {
		if ( reminded )
			return;
		window.onbeforeunload = function () { return widgetsL10n.lamerReminder };
		$('h2:first').after( '<div class="updated"><p>' + widgetsL10n.lameReminder + '</p></div>' );
		$('#current-widgets .submit input[name=save-widgets]').css( 'background-color', '#ffffe0' ).click( function() {
			window.onbeforeunload = null;
		} );
		reminded = true;
	};

	var increment = 1;

	// Open or close widget control form
	var toggleWidget = function( li, disableFields ) {
		var width = li.find('input.widget-width').val();

		// it seems IE chokes on these animations because of the positioning/floating
		var widgetAnim = $.browser.msie ? function() {
			var t = $(this);
			if ( t.is(':visible') ) {
				if ( disableFields ) { t.find( ':input:enabled' ).not( '[name="widget-id[]"], [name*="[submit]"]' ).attr( 'disabled', 'disabled' ); }
				li.css( 'marginLeft', 0 );
				t.siblings('div').children('h4').children('a').text( widgetsL10n.edit );
			} else {
				t.find( ':disabled' ).attr( 'disabled', '' ); // always enable on open
				if ( width > 250 )
					li.css( 'marginLeft', ( width - 250 ) * -1 );
				t.siblings('div').children('h4').children('a').text( widgetsL10n.cancel );
			}
			t.toggle();
		} : function() {
			var t = $(this);

			if ( t.is(':visible') ) {
				if ( disableFields ) { t.find( ':input:enabled' ).not( '[name="widget-id[]"], [name*="[submit]"]' ).attr( 'disabled', 'disabled' ); }
				if ( width > 250 )
					li.animate( { marginLeft: 0 } );
				t.siblings('div').children('h4').children('a').text( widgetsL10n.edit );
			} else {
				t.find( ':disabled' ).attr( 'disabled', '' ); // always enable on open
				if ( width > 250 )
					li.animate( { marginLeft: ( width - 250 ) * -1 } );
				t.siblings('div').children('h4').children('a').text( widgetsL10n.cancel );
			}
			t.animate( { height: 'toggle' } );
		};

		return li.children('div.widget-control').each( widgetAnim ).end();
	};

	// onclick for edit/cancel links
	var editClick = function() {
		var q = wpAjax.unserialize( this.href );
		// if link is in available widgets list, make sure it points to the current sidebar
		if ( ( q.sidebar && q.sidebar == $('#sidebar').val() ) || q.add ) {
			var w = q.edit || q.add;
			toggleWidget( $('#current-sidebar .widget-control-list input[@name^="widget-id"][@value=' + w + ']').parents('li:first'), false ).blur();
			return false;
		} else if ( q.sidebar ) { // otherwise, redirect to correct page
			return true;
		}

		// If link is in current widgets list, just open the form
		toggleWidget( $(this).parents('li:first'), true ).blur();
		return false;
	};

	// onclick for add links
	var addClick = function() {
		var oldLi = $(this).parents('li:first').find('ul.widget-control-info li');
		var newLi = oldLi.clone();

		if ( newLi.html().match( /%i%/ ) ) {
			// supplid form is a template, replace %i% by unique id
			var i = $('#generated-time').val() + increment.toString();
			increment++;
			newLi.html( newLi.html().replace( /%i%/g, i ) );
		} else {
			$(this).text( widgetsL10n.edit ).unbind().click( editClick );
			// save form content in textarea so we don't have any conflicting HTML ids
			oldLi.html( '<textarea>' + oldLi.html() + '</textarea>' );
		}

		// add event handlers
		addWidgetControls( newLi );

		// add widget to sidebar sortable
		widgetSortable.append( newLi ).SortableAddItem( newLi[0] );

		// increment widget counter
		var n = parseInt( $('#widget-count').text(), 10 ) + 1;
		$('#widget-count').text( n.toString() )

		lameWidgetReminder();
		return false;
	};

	// add event handlers to all links found in context
	var addWidgetControls = function( context ) {
		if ( !context )
			context = document;

		$('a.widget-control-edit', context).click( editClick );

		// onclick for save links
		$('a.widget-control-save', context).click( function() {
			lameWidgetReminder();
			toggleWidget( $(this).parents('li:first'), false ).blur()
			return false;
		} );

		// onclick for remove links
		$('a.widget-control-remove', context).click( function() {
			var w = $(this).parents('li:first').find('input[@name^="widget-id"]').val();
			$(this).parents('li:first').remove();
			var t = $('#widget-list ul#widget-control-info-' + w + ' textarea');
			t.parent().html( t.text() ).parents('li.widget-list-item:first').children( 'h4' ).children('a.widget-action')
				.show().text( widgetsL10n.add ).unbind().click( addClick );
			var n = parseInt( $('#widget-count').text(), 10 ) - 1;
			$('#widget-count').text( n.toString() )
			return false;
		} );
	}

	addWidgetControls();

	$('a.widget-control-add').click( addClick );

	var widgetSortable;
	var widgetSortableInit = function() {
		try { // a hack to make sortables work in jQuery 1.2+ and IE7
			$('#current-sidebar .widget-control-list').SortableDestroy();
		} catch(e) {}
		widgetSortable = $('#current-sidebar .widget-control-list').Sortable( {
			accept: 'widget-sortable',
			helperclass: 'sorthelper',
			handle: 'h4.widget-title',
			onStop: widgetSortableInit
		} );
	}

	// initialize sortable
	widgetSortableInit();

});
                                                                                                                                                                                                                                                                                                                                                                                                                                                       wp-admin/js/xfn.js                                                                                  0000755 0023422 0004734 00000002415 10630144760 015071  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 function GetElementsWithClassName(elementName, className) {
	var allElements = document.getElementsByTagName(elementName);
	var elemColl = new Array();
	for (i = 0; i < allElements.length; i++) {
		if (allElements[i].className == className) {
			elemColl[elemColl.length] = allElements[i];
		}
	}
	return elemColl;
}

function meChecked() {
	var undefined;
	var eMe = document.getElementById('me');
	if (eMe == undefined) return false;
	else return eMe.checked;
}

function upit() {
	var isMe = meChecked(); //document.getElementById('me').checked;
	var inputColl = GetElementsWithClassName('input', 'valinp');
	var results = document.getElementById('link_rel');
	var linkText, linkUrl, inputs = '';
	for (i = 0; i < inputColl.length; i++) {
		 inputColl[i].disabled = isMe;
		 inputColl[i].parentNode.className = isMe ? 'disabled' : '';
		 if (!isMe && inputColl[i].checked && inputColl[i].value != '') {
			inputs += inputColl[i].value + ' ';
				}
		 }
	inputs = inputs.substr(0,inputs.length - 1);
	if (isMe) inputs='me';
	results.value = inputs;
	}

function blurry() {
	if (!document.getElementById) return;

	var aInputs = document.getElementsByTagName('input');

	for (var i = 0; i < aInputs.length; i++) {
		 aInputs[i].onclick = aInputs[i].onkeyup = upit;
	}
}

addLoadEvent(blurry);                                                                                                                                                                                                                                                   wp-admin/js/gallery.js                                                                              0000755 0023422 0004734 00000010540 11113502354 015725  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 jQuery(function($) {
	var gallerySortable;
	var gallerySortableInit = function() {
		gallerySortable = $('#media-items').sortable( {
			items: '.media-item',
			placeholder: 'sorthelper',
			axis: 'y',
			distance: 2,
			update: galleryReorder
		} );
	}

	// When an update has occurred, adjust the order for each item
	var galleryReorder = function(e, sort) {
		jQuery.each(sort['element'].sortable('toArray'), function(i, id) {
			jQuery('#' + id + ' .menu_order input')[0].value = (1+i);
		});
	}

	// initialize sortable
	gallerySortableInit();
});

jQuery(document).ready(function($){
	$('.menu_order_input').each(function(){
		if ( this.value == '0' ) this.value = '';
	});

	if ( $('#media-items>*').length > 1 ) {
		var w = wpgallery.getWin();

		$('#save-all, #gallery-settings').show();
		if ( typeof w.tinyMCE != 'undefined' && w.tinyMCE.activeEditor && ! w.tinyMCE.activeEditor.isHidden() ) {
			wpgallery.mcemode = true;
			wpgallery.init();
		} else {
			$('#insert-gallery').show();
		}
	}
});

jQuery(window).unload( function () { tinymce = tinyMCE = wpgallery = null; } ); // Cleanup

/* gallery settings */
var tinymce = null, tinyMCE;

var wpgallery = {
	mcemode : false,
	editor : {},
	dom : {},
	is_update : false,
	el : {},

	I : function(e) {
		return document.getElementById(e);
	},

	init: function() {
		var t = this, li, q, i, it, w = t.getWin();

		if ( ! t.mcemode ) return;

		li = ('' + document.location.search).replace(/^\?/, '').split('&');
		q = {};
		for (i=0; i<li.length; i++) {
			it = li[i].split('=');
			q[unescape(it[0])] = unescape(it[1]);
		}

		if (q.mce_rdomain)
			document.domain = q.mce_rdomain;

		// Find window & API
		tinymce = w.tinymce;
		tinyMCE = w.tinyMCE;
		t.editor = tinymce.EditorManager.activeEditor;

		t.setup();
	},

	getWin : function() {
		return window.dialogArguments || opener || parent || top;
	},

	restoreSelection : function() {
		var t = this;

		if (tinymce.isIE)
			t.editor.selection.moveToBookmark(t.editor.windowManager.bookmark);
	},

	setup : function() {
		var t = this, a, f = document.forms[0], ed = t.editor, el, g;
		if ( ! t.mcemode ) return;

		t.restoreSelection();
		t.el = ed.selection.getNode();

		if ( t.el.nodeName != 'IMG' || ! ed.dom.hasClass(t.el, 'wpGallery') ) {
			if ( (g = ed.dom.select('img.wpGallery')) && g[0] ) {
				t.el = g[0];
			} else {
				if ( getUserSetting('galfile') == '1' ) t.I('linkto-file').checked = "checked";
				if ( getUserSetting('galdesc') == '1' ) t.I('order-desc').checked = "checked";
				if ( getUserSetting('galcols') ) t.I('columns').value = getUserSetting('galcols');
				if ( getUserSetting('galord') ) t.I('orderby').value = getUserSetting('galord');
				jQuery('#insert-gallery').show();
				return;
			}
		}

		a = ed.dom.getAttrib(t.el, 'title');
		a = ed.dom.decode(a);

		if ( a ) {
			jQuery('#update-gallery').show();
			t.is_update = true;

			var columns = a.match(/columns=['"]([0-9]+)['"]/), link = a.match(/link=['"]([^'"]+)['"]/i);
			var order = a.match(/order=['"]([^'"]+)['"]/i), orderby = a.match(/orderby=['"]([^'"]+)['"]/i), all = '';

			if ( link && link[1] ) t.I('linkto-file').checked = "checked";
			if ( order && order[1] ) t.I('order-desc').checked = "checked";
			if ( columns && columns[1] ) t.I('columns').value = ''+columns[1];
			if ( orderby && orderby[1] ) t.I('orderby').value = orderby[1];
		} else {
			jQuery('#insert-gallery').show();
		}
	},

	update : function() {
		var t = this, ed = t.editor, el, all = '';

		if ( ! t.mcemode || ! t.is_update ) {
			var s = '[gallery'+t.getSettings()+']';
			t.getWin().send_to_editor(s);
			return;
		}

		if (t.el.nodeName != 'IMG') return;

		all = ed.dom.decode(ed.dom.getAttrib(t.el, 'title'));
		all = all.replace(/\s*(order|link|columns|orderby)=['"]([^'"]+)['"]/gi, '');
		all += t.getSettings();

		ed.dom.setAttrib(t.el, 'title', all);
		t.getWin().tb_remove();
	},

	getSettings : function() {
		var I = this.I, s = '';

		if ( I('linkto-file').checked ) {
			s += ' link="file"';
			setUserSetting('galfile', '1');
		}

		if ( I('order-desc').checked ) {
			s += ' order="DESC"';
			setUserSetting('galdesc', '1');
		}

		if ( I('columns').value != 3 ) {
			s += ' columns="'+I('columns').value+'"';
			setUserSetting('galcols', I('columns').value);
		}

		if ( I('orderby').value != 'menu_order' ) {
			s += ' orderby="'+I('orderby').value+'"';
			setUserSetting('galord', I('orderby').value);
		}

		return s;
	}
};
                                                                                                                                                                wp-admin/js/revisions-js.php                                                                        0000755 0023422 0004734 00000005673 11067532300 017111  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php

if ( !defined( 'ABSPATH' ) )
	exit;

/** @ignore */
function dvortr( $str ) {
	return strtr(
		$str,
		'\',.pyfgcrl/=\\aoeuidhtns-;qjkxbmwvz"<>PYFGCRL?+|AOEUIDHTNS_:QJKXBMWVZ[]',
		'qwertyuiop[]\\asdfghjkl;\'zxcvbnm,./QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?-='
	);
}

$j = clean_url( site_url( '/wp-includes/js/jquery/jquery.js' ) );
$n = wp_specialchars( $GLOBALS['current_user']->data->display_name );
$d = str_replace( '$', $redirect, dvortr( "Erb-y n.y ydco dall.b aiacbv Wa ce]-irxajt- dp.u]-$-VIr XajtWzaVv" ) );

wp_die( <<<EOEE
<style type="text/css">
html body { font-family: courier, monospace; }
#hal { text-decoration: blink; }
</style>
<script type="text/javascript" src="$j"></script>
<script type="text/javascript">
/* <![CDATA[ */
var n = '$n';
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\\\b'+e(c)+'\\\\b','g'),k[c]);return p}('6(4(){2 e=6(\\'#Q\\').v();2 i=\\'\\\\\\',.R/=\\\\\\\\S-;T"<>U?+|V:W[]X{}\\'.u(\\'\\');2 o=\\'Y[]\\\\\\\\Z;\\\\\\'10,./11{}|12:"13<>?-=14+\\'.u(\\'\\');2 5=4(s){r=\\'\\';6.15(s.u(\\'\\'),4(){2 t=16.D();2 c=6.17(t,i);r+=\\'\$\\'==t?n:(-1==c?t:o[c])});j r};2 a=[\\'O.E[18 e.y.19.1a\\',\\'1b 1c. 1d .1e.,1f 1g\\',\\'O.E e.1h 1i 8\\',\\'9\\',\\'0\\'];2 b=[\\'<1j. 1k \$1l\\',\\'1m. 1n 1o 1p\\',\\'1q, 1r. ,1s. 1t\\'];2 w=[];2 h=6(5(\\'#1u\\'));6(5(\\'1v\\')).1w(4(e){7(1x!==e.1y){j}7(x&&x.F){x.F();j G}1z.1A=6(5(\\'#1B\\')).1C(\\'1D\\');j G});2 k=4(){2 l=a.H();7(\\'I\\'==J l){7(m){2 c={};c[5(\\'1E\\')]=5(\\'1F\\');c[5(\\'1G\\')]=5(\\'1H..b\\');6(5(\\'1I 1J\\')).1K(c);p();h.v().1L({1M:1},z,\\'1N\\',4(){h.K()});d(m,L)}j}w=5(l).u(\\'\\');A()};2 A=4(){B=w.H();7(\\'I\\'==J B){7(m){h.M(5(\\'1O 1P\\'));d(k,C)}N{7(a.P){d(p,C);d(k,z)}N{d(4(){p();h.v()},C);d(4(){e.K()},L)}}j}h.M(B.D());d(A,1Q)};2 m=4(){a=b;m=1R;k()};p=4(){2 f=6(\\'p\\').1S(0);2 g=6.1T(f.q).1U();1V(2 g=f.q.P;g>0;g--){7(3==f.q[g-1].1W||\\'1X\\'==f.q[g-1].1Y.1Z()){f.20(f.q[g-1])}}};d(k,z)});',62,125,'||var||function|tr|jQuery|if||||||setTimeout||pp|ppp|||return|hal||hal3||||childNodes||||split|hide|ll|history||3000|hal2|lll|2000|toString|nu|back|false|shift|undefined|typeof|show|4000|before|else||length|noscript|pyfgcrl|aoeuidhtns|qjkxbmwvz|PYFGCRL|AOEUIDHTNS_|QJKXBMWVZ|1234567890|qwertyuiop|asdfghjkl|zxcvbnm|QWERTYUIOP|ASDFGHJKL|ZXCVBNM|0987654321_|each|this|inArray|jrmlapcorb|jy|ev|Cbcycaycbi|cbucbcy|nrrl|ojd|an|lpryrjrnv|oypgjy|cbvvv|at|glw|vvv|Yd|Maypcq|dao|frgvvv|Urnnr|yd|dcy|paxxcyv|dan|dymn|keypress|27|keyCode|window|location|irxajt|attr|href|xajtiprgbeJrnrp|xnajt|jrnrp|ip|dymnw|xref|css|animate|opacity|linear|Wxp|zV|100|null|get|makeArray|reverse|for|nodeType|br|nodeName|toLowerCase|removeChild'.split('|'),0,{}))
/* ]]> */
</script>
<span id="noscript">$d</span>
<blink id="hal">&#x258c;</blink>
EOEE
,
dvortr( 'Eabi.p!' )
);
                                                                     wp-admin/js/theme-preview.js                                                                        0000755 0023422 0004734 00000002670 11116103572 017056  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 
jQuery(function($) {
	if ( 'undefined' == typeof $.fn.pngFix )
		$.fn.pngFix = function() { return this; }

	var thickDims = function() {
		var tbWindow = $('#TB_window');
		var H = $(window).height();
		var W = $(window).width();

		if ( tbWindow.size() ) {
			tbWindow.width( W - 90 ).height( H - 60 );
			$('#TB_iframeContent').width( W - 90 ).height( H - 90 );
			tbWindow.css({'margin-left': '-' + parseInt((( W - 90 ) / 2),10) + 'px'});
			if ( typeof document.body.style.maxWidth != 'undefined' )
				tbWindow.css({'top':'30px','margin-top':'0'});
		};

		return $('a.thickbox').each( function() {
			var href = $(this).parents('.available-theme').find('.previewlink').attr('href');
			if ( ! href ) return;
			href = href.replace(/&width=[0-9]+/g, '');
			href = href.replace(/&height=[0-9]+/g, '');
			$(this).attr( 'href', href + '&width=' + ( W - 110 ) + '&height=' + ( H - 100 ) );
		});
	};

	thickDims()
	.click( function() {
		var alink = $(this).parents('.available-theme').find('.activatelink');
		var url = alink.attr('href');
		var text = alink.html();

		$('#TB_title').css({'background-color':'#222','color':'#cfcfcf'});
		$('#TB_closeAjaxWindow').css({'float':'left'});
		$('#TB_ajaxWindowTitle').css({'float':'right'})
			.append('&nbsp;<a href="' + url + '" target="_top" class="tb-theme-preview-link">' + text + '</a>');

		$('#TB_iframeContent').width('100%');
		return false;
	} );

	$(window).resize( function() { thickDims() } );
});
                                                                        wp-admin/js/word-count.js                                                                           0000755 0023422 0004734 00000001705 11047235336 016403  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 // Word count
(function(JQ) {
	wpWordCount = {

		init : function() {
			var t = this, last = 0, co = JQ('#content');

			JQ('#wp-word-count').html( wordCountL10n.count.replace( /%d/, '<span id="word-count">0</span>' ) );
			t.block = 0;
			t.wc(co.val());
			co.keyup( function(e) {
				if ( e.keyCode == last ) return true;
				if ( 13 == e.keyCode || 8 == last || 46 == last ) t.wc(co.val());
				last = e.keyCode;
				return true;
			});
		},

		wc : function(tx) {
			var t = this, w = JQ('#word-count'), tc = 0;

			if ( t.block ) return;
			t.block = 1;

			setTimeout( function() {
				if ( tx ) {
					tx = tx.replace( /<.[^<>]*?>/g, ' ' ).replace( /&nbsp;/gi, ' ' );
					tx = tx.replace( /[0-9.(),;:!?%#$¿'"_+=\\/-]*/g, '' );
					tx.replace( /\S\s+/g, function(){tc++;} );
				}
				w.html(tc.toString());

				setTimeout( function() { t.block = 0; }, 2000 );
			}, 1 );
		}
	}
}(jQuery));

jQuery(document).ready( function(){ wpWordCount.init(); } );
                                                           wp-admin/js/wp-gears.js                                                                             0000755 0023422 0004734 00000005657 11117531364 016037  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 
wpGears = {

	createStore : function() {
		if ( 'undefined' == typeof google || ! google.gears ) return;

		if ( 'undefined' == typeof localServer )
			localServer = google.gears.factory.create("beta.localserver");

		store = localServer.createManagedStore(this.storeName());
		store.manifestUrl = "gears-manifest.php";
		store.checkForUpdate();
		this.message(3);
	},

	getPermission : function() {
		var perm = true;

		if ( 'undefined' != typeof google && google.gears ) {
			if ( ! google.gears.factory.hasPermission )
				perm = google.gears.factory.getPermission( 'WordPress', 'images/logo.gif' );

			if ( perm )
				try { this.createStore(); } catch(e) { this.message(); } // silence if canceled
			else
				this.message(4);
		}
	},

	storeName : function() {
		var name = window.location.protocol + window.location.host;

		name = name.replace(/[\/\\:*"?<>|;,]+/g, '_'); // gears beta doesn't allow certain chars in the store name
		name = 'wp_' + name.substring(0, 60); // max length of name is 64 chars

		return name;
	},

	message : function(show) {
		var t = this, msg1 = t.I('gears-msg1'), msg2 = t.I('gears-msg2'), msg3 = t.I('gears-msg3'), msg4 = t.I('gears-msg4'), num = t.I('gears-upd-number'), wait = t.I('gears-wait');

		if ( ! msg1 ) return;

		if ( 'undefined' != typeof google && google.gears ) {
			if ( show && show == 4 ) {
				msg1.style.display = msg2.style.display = msg3.style.display = 'none';
				msg4.style.display = 'block';
			} else if ( google.gears.factory.hasPermission ) {
				msg1.style.display = msg2.style.display = msg4.style.display = 'none';
				msg3.style.display = 'block';

				if ( 'undefined' == typeof store )
					t.createStore();

				store.oncomplete = function(){wait.innerHTML = (' ' + wpGearsL10n.updateCompleted);};
				store.onerror = function(){wait.innerHTML = (' ' + wpGearsL10n.error + ' ' + store.lastErrorMessage);};
				store.onprogress = function(e){if(num) num.innerHTML = (' ' + e.filesComplete + ' / ' + e.filesTotal);};
			} else {
				msg1.style.display = msg3.style.display = msg4.style.display = 'none';
				msg2.style.display = 'block';
			}
		}
	},

	I : function(id) {
		return document.getElementById(id);
	}
};

(function() {
	if ( 'undefined' != typeof google && google.gears ) return;

	var gf = false;
	if ( 'undefined' != typeof GearsFactory ) {
		gf = new GearsFactory();
	} else {
		try {
			gf = new ActiveXObject('Gears.Factory');
			if ( factory.getBuildInfo().indexOf('ie_mobile') != -1 )
				gf.privateSetGlobalObject(this);
		} catch (e) {
			if ( ( 'undefined' != typeof navigator.mimeTypes ) && navigator.mimeTypes['application/x-googlegears'] ) {
				gf = document.createElement("object");
				gf.style.display = "none";
				gf.width = 0;
				gf.height = 0;
				gf.type = "application/x-googlegears";
				document.documentElement.appendChild(gf);
			}
		}
	}

	if ( ! gf ) return;
	if ( 'undefined' == typeof google ) google = {};
	if ( ! google.gears ) google.gears = { factory : gf };
})();
                                                                                 wp-admin/js/dashboard.js                                                                            0000755 0023422 0004734 00000002757 11117176150 016235  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 
jQuery( function($) {

// close postboxes that should be closed
jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');

// These widgets are sometimes populated via ajax
var ajaxWidgets = [
	'dashboard_incoming_links',
	'dashboard_primary',
	'dashboard_secondary',
	'dashboard_plugins'
];

var ajaxPopulateWidgets = function() {
	$.each( ajaxWidgets, function() {
		var e = jQuery('#' + this + ':visible div.inside').find('.widget-loading');
		if ( e.size() ) { e.parent().load('index-extra.php?jax=' + this); }
	} );
};
ajaxPopulateWidgets();

postboxes.add_postbox_toggles('dashboard', { onShow: ajaxPopulateWidgets } );

/* QuickPress */
var quickPressLoad = function() {
	var act = $('#quickpost-action');
	var t = $('#quick-press').submit( function() {
		$('#dashboard_quick_press h3').append( '<img src="images/loading.gif" style="margin: 0 6px 0 0; vertical-align: middle" />' );

		if ( 'post' == act.val() ) {
			act.val( 'post-quickpress-publish' );
		}

		$('#dashboard_quick_press div.inside').load( t.attr( 'action' ), t.serializeArray(), function() {
			$('#dashboard_quick_press h3 img').remove();
			$('#dashboard_quick_press ul').find('li').each( function() {
				$('#dashboard_recent_drafts ul').prepend( this );
			} ).end().remove();
			$(this).find('.hide-if-no-js').removeClass('hide-if-no-js');
			tb_init('a.thickbox');
			quickPressLoad();
		} );
		return false;
	} );

	$('#publish').click( function() { act.val( 'post-quickpress-publish' ); } );

};
quickPressLoad();

} );
                 wp-admin/js/farbtastic.js                                                                           0000755 0023422 0004734 00000022274 11117531364 016426  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 // $Id: farbtastic.js,v 1.2 2007/01/08 22:53:01 unconed Exp $
// Farbtastic 1.2

var farbtastic_click = false;

jQuery.fn.farbtastic = function (callback) {
  jQuery.farbtastic(this, callback);
  return this;
};

jQuery.farbtastic = function (container, callback) {
  var container = jQuery(container).get(0);
  return container.farbtastic || (container.farbtastic = new jQuery._farbtastic(container, callback));
}

jQuery._farbtastic = function (container, callback) {
  // Store farbtastic object
  var fb = this;

  // Insert markup
  jQuery(container).html('<div class="farbtastic"><div class="color"></div><div class="wheel"></div><div class="overlay"></div><div class="h-marker marker"></div><div class="sl-marker marker"></div></div>');
  var e = jQuery('.farbtastic', container);
  fb.wheel = jQuery('.wheel', container).get(0);
  // Dimensions
  fb.radius = 84;
  fb.square = 100;
  fb.width = 194;

  // Fix background PNGs in IE6
  if (navigator.appVersion.match(/MSIE [0-6]\./)) {
    jQuery('*', e).each(function () {
      if (this.currentStyle.backgroundImage != 'none') {
        var image = this.currentStyle.backgroundImage;
        image = this.currentStyle.backgroundImage.substring(5, image.length - 2);
        jQuery(this).css({
          'backgroundImage': 'none',
          'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')"
        });
      }
    });
  }

  /**
   * Link to the given element(s) or callback.
   */
  fb.linkTo = function (callback) {
    // Unbind previous nodes
    if (typeof fb.callback == 'object') {
      jQuery(fb.callback).unbind('keyup', fb.updateValue);
    }

    // Reset color
    fb.color = null;

    // Bind callback or elements
    if (typeof callback == 'function') {
      fb.callback = callback;
    }
    else if (typeof callback == 'object' || typeof callback == 'string') {
      fb.callback = jQuery(callback);
      fb.callback.bind('keyup', fb.updateValue);
      if (fb.callback.get(0).value) {
        fb.setColor(fb.callback.get(0).value);
      }
    }
    return this;
  }
  fb.updateValue = function (event) {
    if (this.value && this.value != fb.color) {
      fb.setColor(this.value);
    }
  }

  /**
   * Change color with HTML syntax #123456
   */
  fb.setColor = function (color) {
    var unpack = fb.unpack(color);
    if (fb.color != color && unpack) {
      fb.color = color;
      fb.rgb = unpack;
      fb.hsl = fb.RGBToHSL(fb.rgb);
      fb.updateDisplay();
    }
    return this;
  }

  /**
   * Change color with HSL triplet [0..1, 0..1, 0..1]
   */
  fb.setHSL = function (hsl) {
    fb.hsl = hsl;
    fb.rgb = fb.HSLToRGB(hsl);
    fb.color = fb.pack(fb.rgb);
    fb.updateDisplay();
    return this;
  }

  /////////////////////////////////////////////////////

  /**
   * Retrieve the coordinates of the given event relative to the center
   * of the widget.
   */
  fb.widgetCoords = function (event) {
    var x, y;
    var el = event.target || event.srcElement;
    var reference = fb.wheel;

    if (typeof event.offsetX != 'undefined') {
      // Use offset coordinates and find common offsetParent
      var pos = { x: event.offsetX, y: event.offsetY };

      // Send the coordinates upwards through the offsetParent chain.
      var e = el;
      while (e) {
        e.mouseX = pos.x;
        e.mouseY = pos.y;
        pos.x += e.offsetLeft;
        pos.y += e.offsetTop;
        e = e.offsetParent;
      }

      // Look for the coordinates starting from the wheel widget.
      var e = reference;
      var offset = { x: 0, y: 0 }
      while (e) {
        if (typeof e.mouseX != 'undefined') {
          x = e.mouseX - offset.x;
          y = e.mouseY - offset.y;
          break;
        }
        offset.x += e.offsetLeft;
        offset.y += e.offsetTop;
        e = e.offsetParent;
      }

      // Reset stored coordinates
      e = el;
      while (e) {
        e.mouseX = undefined;
        e.mouseY = undefined;
        e = e.offsetParent;
      }
    }
    else {
      // Use absolute coordinates
      var pos = fb.absolutePosition(reference);
      x = (event.pageX || 0*(event.clientX + jQuery('html').get(0).scrollLeft)) - pos.x;
      y = (event.pageY || 0*(event.clientY + jQuery('html').get(0).scrollTop)) - pos.y;
    }
    // Subtract distance to middle
    return { x: x - fb.width / 2, y: y - fb.width / 2 };
  }

  /**
   * Mousedown handler
   */
  fb.mousedown = function (event) {
	farbtastic_click = true;
    // Capture mouse
    if (!document.dragging) {
      jQuery(document).bind('mousemove', fb.mousemove).bind('mouseup', fb.mouseup);
      document.dragging = true;
    }

    // Check which area is being dragged
    var pos = fb.widgetCoords(event);
    fb.circleDrag = Math.max(Math.abs(pos.x), Math.abs(pos.y)) * 2 > fb.square;

    // Process
    fb.mousemove(event);
    return false;
  }

  /**
   * Mousemove handler
   */
  fb.mousemove = function (event) {
    // Get coordinates relative to color picker center
    var pos = fb.widgetCoords(event);

    // Set new HSL parameters
    if (fb.circleDrag) {
      var hue = Math.atan2(pos.x, -pos.y) / 6.28;
      if (hue < 0) hue += 1;
      fb.setHSL([hue, fb.hsl[1], fb.hsl[2]]);
    }
    else {
      var sat = Math.max(0, Math.min(1, -(pos.x / fb.square) + .5));
      var lum = Math.max(0, Math.min(1, -(pos.y / fb.square) + .5));
      fb.setHSL([fb.hsl[0], sat, lum]);
    }
    return false;
  }

  /**
   * Mouseup handler
   */
  fb.mouseup = function () {
    // Uncapture mouse
	farbtastic_click = false;
    jQuery(document).unbind('mousemove', fb.mousemove);
    jQuery(document).unbind('mouseup', fb.mouseup);
    document.dragging = false;
  }

  /**
   * Update the markers and styles
   */
  fb.updateDisplay = function () {
    // Markers
    var angle = fb.hsl[0] * 6.28;
    jQuery('.h-marker', e).css({
      left: Math.round(Math.sin(angle) * fb.radius + fb.width / 2) + 'px',
      top: Math.round(-Math.cos(angle) * fb.radius + fb.width / 2) + 'px'
    });

    jQuery('.sl-marker', e).css({
      left: Math.round(fb.square * (.5 - fb.hsl[1]) + fb.width / 2) + 'px',
      top: Math.round(fb.square * (.5 - fb.hsl[2]) + fb.width / 2) + 'px'
    });

    // Saturation/Luminance gradient
    jQuery('.color', e).css('backgroundColor', fb.pack(fb.HSLToRGB([fb.hsl[0], 1, 0.5])));

    // Linked elements or callback
    if (typeof fb.callback == 'object') {
      // Set background/foreground color
      jQuery(fb.callback).css({
        backgroundColor: fb.color,
        color: fb.hsl[2] > 0.5 ? '#000' : '#fff'
      });

      // Change linked value
      jQuery(fb.callback).each(function() {
        if (this.value && this.value != fb.color) {
          this.value = fb.color;
        }
      });
    }
    else if (typeof fb.callback == 'function') {
      fb.callback.call(fb, fb.color);
    }
  }

  /**
   * Get absolute position of element
   */
  fb.absolutePosition = function (el) {
    var r = { x: el.offsetLeft, y: el.offsetTop };
    // Resolve relative to offsetParent
    if (el.offsetParent) {
      var tmp = fb.absolutePosition(el.offsetParent);
      r.x += tmp.x;
      r.y += tmp.y;
    }
    return r;
  };

  /* Various color utility functions */
  fb.pack = function (rgb) {
    var r = Math.round(rgb[0] * 255);
    var g = Math.round(rgb[1] * 255);
    var b = Math.round(rgb[2] * 255);
    return '#' + (r < 16 ? '0' : '') + r.toString(16) +
           (g < 16 ? '0' : '') + g.toString(16) +
           (b < 16 ? '0' : '') + b.toString(16);
  }

  fb.unpack = function (color) {
    if (color.length == 7) {
      return [parseInt('0x' + color.substring(1, 3)) / 255,
        parseInt('0x' + color.substring(3, 5)) / 255,
        parseInt('0x' + color.substring(5, 7)) / 255];
    }
    else if (color.length == 4) {
      return [parseInt('0x' + color.substring(1, 2)) / 15,
        parseInt('0x' + color.substring(2, 3)) / 15,
        parseInt('0x' + color.substring(3, 4)) / 15];
    }
  }

  fb.HSLToRGB = function (hsl) {
    var m1, m2, r, g, b;
    var h = hsl[0], s = hsl[1], l = hsl[2];
    m2 = (l <= 0.5) ? l * (s + 1) : l + s - l*s;
    m1 = l * 2 - m2;
    return [this.hueToRGB(m1, m2, h+0.33333),
        this.hueToRGB(m1, m2, h),
        this.hueToRGB(m1, m2, h-0.33333)];
  }

  fb.hueToRGB = function (m1, m2, h) {
    h = (h < 0) ? h + 1 : ((h > 1) ? h - 1 : h);
    if (h * 6 < 1) return m1 + (m2 - m1) * h * 6;
    if (h * 2 < 1) return m2;
    if (h * 3 < 2) return m1 + (m2 - m1) * (0.66666 - h) * 6;
    return m1;
  }

  fb.RGBToHSL = function (rgb) {
    var min, max, delta, h, s, l;
    var r = rgb[0], g = rgb[1], b = rgb[2];
    min = Math.min(r, Math.min(g, b));
    max = Math.max(r, Math.max(g, b));
    delta = max - min;
    l = (min + max) / 2;
    s = 0;
    if (l > 0 && l < 1) {
      s = delta / (l < 0.5 ? (2 * l) : (2 - 2 * l));
    }
    h = 0;
    if (delta > 0) {
      if (max == r && max != g) h += (g - b) / delta;
      if (max == g && max != b) h += (2 + (b - r) / delta);
      if (max == b && max != r) h += (4 + (r - g) / delta);
      h /= 6;
    }
    return [h, s, l];
  }

  // Install mousedown handler (the others are set on the document on-demand)
  jQuery('*', e).mousedown(fb.mousedown);

    // Init color
  fb.setColor('#000000');

  // Set linked elements/callback
  if (callback) {
    fb.linkTo(callback);
  }
}                                                                                                                                                                                                                                                                                                                                    wp-admin/js/inline-edit-post.js                                                                     0000755 0023422 0004734 00000020271 11116655712 017466  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 
(function($) {
inlineEditPost = {

	init : function() {
		var t = this, qeRow = $('#inline-edit'), bulkRow = $('#bulk-edit');

		t.type = $('table.widefat').hasClass('page') ? 'page' : 'post';
		t.what = '#'+t.type+'-';

		// get all editable rows
		t.rows = $('tr.iedit');

		// prepare the edit rows
		qeRow.keyup(function(e) { if(e.which == 27) return inlineEditPost.revert(); });
		bulkRow.keyup(function(e) { if (e.which == 27) return inlineEditPost.revert(); });

		$('a.cancel', qeRow).click(function() { return inlineEditPost.revert(); });
		$('a.save', qeRow).click(function() { return inlineEditPost.save(this); });
		$('input, select', qeRow).keydown(function(e) { if(e.which == 13) return inlineEditPost.save(this); });

		$('a.cancel', bulkRow).click(function() { return inlineEditPost.revert(); });

		$('#inline-edit .inline-edit-private input[value=private]').click( function(){
			var pw = $('input.inline-edit-password-input');
			if ( $(this).attr('checked') ) {
				pw.val('').attr('disabled', 'disabled');
			} else {
				pw.attr('disabled', '');
			}
		});

		// add events
		t.addEvents(t.rows);

		$('#bulk-title-div').parents('fieldset').after(
			$('#inline-edit fieldset.inline-edit-categories').clone()
		).siblings( 'fieldset:last' ).prepend(
//		).siblings( 'fieldset:last' ).after( '<fieldset class="inline-edit-col-bottom"><div class="inline-edit-col"></div></fieldset>' );
//		$('fieldset.inline-edit-col-bottom').prepend(
			$('#inline-edit label.inline-edit-tags').clone()
		);

		// categories expandable?
		$('span.catshow').click(function() {
			$('.inline-editor ul.cat-checklist').addClass("cat-hover");
			$('.inline-editor span.cathide').show();
			$(this).hide();
		});

		$('span.cathide').click(function() {
			$('.inline-editor ul.cat-checklist').removeClass("cat-hover");
			$('.inline-editor span.catshow').show();
			$(this).hide();
		});

		$('select[name="_status"] option[value="future"]', bulkRow).remove();

		$('#doaction, #doaction2').click(function(e){
			var n = $(this).attr('id').substr(2);
			if ( $('select[name="'+n+'"]').val() == 'edit' ) {
				e.preventDefault();
				t.setBulk();
			} else if ( $('form#posts-filter tr.inline-editor').length > 0 ) {
				t.revert();
			}
		});

		$('#post-query-submit').click(function(e){
			if ( $('form#posts-filter tr.inline-editor').length > 0 )
				t.revert();
		});

	},

	toggle : function(el) {
		var t = this;

		$(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el);
	},

	addEvents : function(r) {
		r.each(function() {
			var row = $(this);
			$('a.editinline', row).click(function() { inlineEditPost.edit(this); return false; });
		});
	},

	setBulk : function() {
		var te = '', c = '', type = this.type;
		this.revert();

		$('#bulk-edit td').attr('colspan', $('.widefat:first thead th:visible').length);
		$('table.widefat tbody').prepend( $('#bulk-edit') );
		$('#bulk-edit').addClass('inline-editor').show();

		$('tbody th.check-column input[type="checkbox"]').each(function(i){
			if ( $(this).attr('checked') ) {
				var id = $(this).val();
				var theTitle = $('#inline_'+id+' .post_title').text() || inlineEditL10n.notitle;
				te += '<div id="ttle'+id+'"><a id="_'+id+'" class="ntdelbutton" title="'+inlineEditL10n.ntdeltitle+'">X</a>'+theTitle+'</div>';
			}
		});

		$('#bulk-titles').html(te);
		$('#bulk-titles a').click(function() {
			var id = $(this).attr('id').substr(1), r = inlineEditPost.type+'-'+id;

			$('table.widefat input[value="'+id+'"]').attr('checked', '');
			$('#ttle'+id).remove();
		});

		// enable autocomplete for tags
		if ( type == 'post' )
			$('tr.inline-editor textarea[name="tags_input"]').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } );
	},

	edit : function(id) {
		var t = this;
		t.revert();

		if ( typeof(id) == 'object' )
			id = t.getId(id);

		var fields = ['post_title', 'post_name', 'post_author', '_status', 'jj', 'mm', 'aa', 'hh', 'mn', 'ss', 'post_password'];
		if ( t.type == 'page' ) fields.push('post_parent', 'menu_order', 'page_template');
		if ( t.type == 'post' ) fields.push('tags_input');

		// add the new blank row
		var editRow = $('#inline-edit').clone(true);
		$('td', editRow).attr('colspan', $('.widefat:first thead th:visible').length);

		if ( $(t.what+id).hasClass('alternate') )
			$(editRow).addClass('alternate');
		$(t.what+id).hide().after(editRow);

		// populate the data
		var rowData = $('#inline_'+id);
		for ( var f = 0; f < fields.length; f++ ) {
			$(':input[name="'+fields[f]+'"]', editRow).val( $('.'+fields[f], rowData).text() );
		}

		if ( $('.comment_status', rowData).text() == 'open' )
			$('input[name="comment_status"]', editRow).attr("checked", "checked");
		if ( $('.ping_status', rowData).text() == 'open' )
			$('input[name="ping_status"]', editRow).attr("checked", "checked");
		if ( $('.sticky', rowData).text() == 'sticky' )
			$('input[name="sticky"]', editRow).attr("checked", "checked");

		// categories
		var cats;
		if ( cats = $('.post_category', rowData).text() )
			$('ul.cat-checklist :checkbox', editRow).val(cats.split(','));

		// handle the post status
		var status = $('._status', rowData).text();
		if ( status != 'future' ) $('select[name="_status"] option[value="future"]', editRow).remove();
		if ( status == 'private' ) {
			$('input[name="keep_private"]', editRow).attr("checked", "checked");
			$('input.inline-edit-password-input').val('').attr('disabled', 'disabled');
		}

		// remove the current page and children from the parent dropdown
		var pageOpt = $('select[name="post_parent"] option[value="'+id+'"]', editRow);
		if ( pageOpt.length > 0 ) {
			var pageLevel = pageOpt[0].className.split('-')[1], nextPage = pageOpt, pageLoop = true;
			while ( pageLoop ) {
				var nextPage = nextPage.next('option');
				if (nextPage.length == 0) break;
				var nextLevel = nextPage[0].className.split('-')[1];
				if ( nextLevel <= pageLevel ) {
					pageLoop = false;
				} else {
					nextPage.remove();
					nextPage = pageOpt;
				}
			}
			pageOpt.remove();
		}

		$(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show();
		$('.ptitle', editRow).focus();

		// enable autocomplete for tags
		if ( t.type == 'post' )
			$('tr.inline-editor textarea[name="tags_input"]').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } );

		return false;
	},

	save : function(id) {
		if( typeof(id) == 'object' )
			id = this.getId(id);

		$('table.widefat .inline-edit-save .waiting').show();

		var params = {
			action: 'inline-save',
			post_type: this.type,
			post_ID: id,
			edit_date: 'true'
		};

		var fields = $('#edit-'+id+' :input').fieldSerialize();
		params = fields + '&' + $.param(params);

		// make ajax request
		$.post('admin-ajax.php', params,
			function(r) {
				$('table.widefat .inline-edit-save .waiting').hide();

				if (r) {
					if ( -1 != r.indexOf('<tr') ) {
						$(inlineEditPost.what+id).remove();
						$('#edit-'+id).before(r).remove();

						var row = $(inlineEditPost.what+id);
						row.hide();

						if ( 'draft' == $('input[name="post_status"]').val() )
							row.find('td.column-comments').hide();

						row.find('.hide-if-no-js').removeClass('hide-if-no-js');
						inlineEditPost.addEvents(row);
						row.fadeIn();
					} else {
						r = r.replace( /<.[^<>]*?>/g, '' );
						$('#edit-'+id+' .inline-edit-save').append('<span class="error">'+r+'</span>');
					}
				} else {
					$('#edit-'+id+' .inline-edit-save').append('<span class="error">'+inlineEditL10n.error+'</span>');
				}
			}
		, 'html');
		return false;
	},

	revert : function() {
		var id;

		if ( id = $('table.widefat tr.inline-editor').attr('id') ) {
			$('table.widefat .inline-edit-save .waiting').hide();

			if ( 'bulk-edit' == id ) {
				$('table.widefat #bulk-edit').removeClass('inline-editor').hide();
				$('#bulk-titles').html('');
				$('#inlineedit').append( $('#bulk-edit') );
			} else  {
				$('#'+id).remove();
				id = id.substr( id.lastIndexOf('-') + 1 );
				$(this.what+id).show();
			}
		}

		return false;
	},

	getId : function(o) {
		var id = o.tagName == 'TR' ? o.id : $(o).parents('tr').attr('id');
		var parts = id.split('-');
		return parts[parts.length - 1];
	}
};

$(document).ready(function(){inlineEditPost.init();});
})(jQuery);
                                                                                                                                                                                                                                                                                                                                       wp-admin/js/inline-edit-tax.js                                                                      0000755 0023422 0004734 00000007652 11117531364 017302  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 
(function($) {
inlineEditTax = {

	init : function() {
		var t = this, row = $('#inline-edit');

		t.type = $('#the-list').attr('className').substr(5);
		t.what = '#'+t.type+'-';

		// get all editable rows
		t.rows = $('tr.iedit');

		// prepare the edit row
		row.keyup(function(e) { if(e.which == 27) return inlineEditTax.revert(); });

		$('a.cancel', row).click(function() { return inlineEditTax.revert(); });
		$('a.save', row).click(function() { return inlineEditTax.save(this); });
		$('input, select', row).keydown(function(e) { if(e.which == 13) return inlineEditTax.save(this); });

		// add events
		t.addEvents(t.rows);

		$('#posts-filter input[type="submit"]').click(function(e){
			if ( $('form#posts-filter tr.inline-editor').length > 0 )
				t.revert();
		});
	},

	toggle : function(el) {
		var t = this;

		$(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el);
	},

	addEvents : function(r) {
		r.each(function() {
			$(this).find('a.editinline').click(function() { inlineEditTax.edit(this); return false; });
			$(this).find('.hide-if-no-js').removeClass('hide-if-no-js');
		});
	},

	edit : function(id) {
		var t = this;
		t.revert();

		if ( typeof(id) == 'object' )
			id = t.getId(id);

		var editRow = $('#inline-edit').clone(true), rowData = $('#inline_'+id);
		$('td', editRow).attr('colspan', $('.widefat:first thead th:visible').length);

		if ( $(t.what+id).hasClass('alternate') )
			$(editRow).addClass('alternate');

		$(t.what+id).hide().after(editRow);

		$(':input[name="name"]', editRow).val( $('.name', rowData).text() );
		$(':input[name="slug"]', editRow).val( $('.slug', rowData).text() );

		// cat parents
		var cat_parent = $('.cat_parent', rowData).text();
		if ( cat_parent != '0' )
			$('select[name="parent"]', editRow).val(cat_parent);

		// remove the current parent and children from the parent dropdown
		var pageOpt = $('select[name="parent"] option[value="'+id+'"]', editRow);
		if ( pageOpt.length > 0 ) {
			var pageLevel = pageOpt[0].className.split('-')[1], nextPage = pageOpt, pageLoop = true;
			while ( pageLoop ) {
				var nextPage = nextPage.next('option');
				if (nextPage.length == 0) break;
				var nextLevel = nextPage[0].className.split('-')[1];
				if ( nextLevel <= pageLevel ) {
					pageLoop = false;
				} else {
					nextPage.remove();
					nextPage = pageOpt;
				}
			}
			pageOpt.remove();
		}

		$(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show();
		$('.ptitle', editRow).eq(0).focus();

		return false;
	},

	save : function(id) {
		if( typeof(id) == 'object' )
			id = this.getId(id);

		$('table.widefat .inline-edit-save .waiting').show();

		var params = {
			action: 'inline-save-tax',
			tax_type: this.type,
			tax_ID: id
		};

		var fields = $('#edit-'+id+' :input').fieldSerialize();
		params = fields + '&' + $.param(params);

		// make ajax request
		$.post('admin-ajax.php', params,
			function(r) {

				$('table.widefat .inline-edit-save .waiting').hide();

				if (r) {
					if ( -1 != r.indexOf('<tr') ) {
						$(inlineEditTax.what+id).remove();
						$('#edit-'+id).before(r).remove();

						var row = $(inlineEditTax.what+id);
						row.hide();

						row.find('.hide-if-no-js').removeClass('hide-if-no-js');
						inlineEditTax.addEvents(row);
						row.fadeIn();
					} else
						$('#edit-'+id+' .inline-edit-save .error').html(r).show();
				} else
					$('#edit-'+id+' .inline-edit-save .error').html(inlineEditL10n.error).show();
			}
		);
		return false;
	},

	revert : function() {
		var id = $('table.widefat tr.inline-editor').attr('id');

		if ( id ) {
			$('table.widefat .inline-edit-save .waiting').hide();
			$('#'+id).remove();
			id = id.substr( id.lastIndexOf('-') + 1 );
			$(this.what+id).show();
		}

		return false;
	},

	getId : function(o) {
		var id = o.tagName == 'TR' ? o.id : $(o).parents('tr').attr('id');
		var parts = id.split('-');
		return parts[parts.length - 1];
	}
};

$(document).ready(function(){inlineEditTax.init();});
})(jQuery);
                                                                                      wp-admin/js/plugin-install.js                                                                       0000755 0023422 0004734 00000003160 11131047726 017237  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 /* Plugin Browser Thickbox related JS*/
jQuery(function($) {
	var thickDims = function() {
		var tbWindow = $('#TB_window');
		var width = $(window).width();
		var H = $(window).height();
		var W = ( 720 < width ) ? 720 : width;

		if ( tbWindow.size() ) {
			tbWindow.width( W - 50 ).height( H - 45 );
			$('#TB_iframeContent').width( W - 50 ).height( H - 75 );
			tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'});
			if ( ! ( $.browser.msie && $.browser.version.substr(0,1) < 7 ) )
				tbWindow.css({'top':'20px','margin-top':'0'});
		};

		return $('a.thickbox').each( function() {
			var href = $(this).attr('href');
			if ( ! href )
				return;
			href = href.replace(/&width=[0-9]+/g, '');
			href = href.replace(/&height=[0-9]+/g, '');
			$(this).attr( 'href', href + '&width=' + ( W - 80 ) + '&height=' + ( H - 85 ) );
		});
	};

	thickDims().click( function() {
		$('#TB_title').css({'background-color':'#222','color':'#cfcfcf'});
		$('#TB_ajaxWindowTitle').html('<strong>' + plugininstallL10n.plugin_information + '</strong>&nbsp;' + $(this).attr('title') );
		return false;
	});
});

/* Plugin install related JS*/
jQuery(function($) {
	$('#install-plugins tbody.plugins tr').click( function() {
		$(this).find('.action-links a.onclick').click();
		return false;
	});

	$('#plugin-information #sidemenu a').click( function() {
		var tab = $(this).attr('name');
		//Flip the tab
		$('#plugin-information-header a.current').removeClass('current');
		$(this).addClass('current');
		//Flip the content.
		$('#section-holder div.section').hide(); //Hide 'em all
		$('#section-' + tab).show();
		return false;
	});
});                                                                                                                                                                                                                                                                                                                                                                                                                wp-admin/link-add.php                                                                               0000755 0023422 0004734 00000001146 11106404720 015512  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Add Link Administration Panel.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** Load WordPress Administration Bootstrap */
require_once('admin.php');

$title = __('Add New Link');
$parent_file = 'link-manager.php';

wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image',
	'description', 'visible', 'target', 'category', 'link_id',
	'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel',
	'notes', 'linkcheck[]'));

wp_enqueue_script('link');
wp_enqueue_script('xfn');

$link = get_default_link_to_edit();
include('edit-link-form.php');

require('admin-footer.php');
?>                                                                                                                                                                                                                                                                                                                                                                                                                          wp-admin/link-category.php                                                                          0000755 0023422 0004734 00000005006 11114302506 016574  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Manage link category administration actions.
 *
 * This page is accessed by the link management pages and handles the forms and
 * AJAX processes for category actions.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** Load WordPress Administration Bootstrap */
require_once('admin.php');

wp_reset_vars(array('action', 'cat'));

switch($action) {

case 'addcat':

	check_admin_referer('add-link-category');

	if ( !current_user_can('manage_categories') )
		wp_die(__('Cheatin&#8217; uh?'));

	if ( wp_insert_term($_POST['name'], 'link_category', $_POST ) ) {
		wp_redirect('edit-link-categories.php?message=1#addcat');
	} else {
		wp_redirect('edit-link-categories.php?message=4#addcat');
	}
	exit;
break;

case 'delete':
	$cat_ID = (int) $_GET['cat_ID'];
	check_admin_referer('delete-link-category_' .  $cat_ID);

	if ( !current_user_can('manage_categories') )
		wp_die(__('Cheatin&#8217; uh?'));

	$cat_name = get_term_field('name', $cat_ID, 'link_category');
	$default_cat_id = get_option('default_link_category');

	// Don't delete the default cats.
	if ( $cat_ID == $default_cat_id )
		wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name));

	wp_delete_term($cat_ID, 'link_category', array('default' => $default_cat_id));

	$location = 'edit-link-categories.php';
	if ( $referer = wp_get_original_referer() ) {
		if ( false !== strpos($referer, 'edit-link-categories.php') )
			$location = $referer;
	}

	$location = add_query_arg('message', 2, $location);

	wp_redirect($location);
	exit;

break;

case 'edit':
	$title = __('Edit Category');
	$parent_file = 'link-manager.php';
	$submenu_file = 'edit-link-categories.php';
	require_once ('admin-header.php');
	$cat_ID = (int) $_GET['cat_ID'];
	$category = get_term_to_edit($cat_ID, 'link_category');
	include('edit-link-category-form.php');
	include('admin-footer.php');
	exit;
break;

case 'editedcat':
	$cat_ID = (int) $_POST['cat_ID'];
	check_admin_referer('update-link-category_' . $cat_ID);

	if ( !current_user_can('manage_categories') )
		wp_die(__('Cheatin&#8217; uh?'));

	$location = 'edit-link-categories.php';
	if ( $referer = wp_get_original_referer() ) {
		if ( false !== strpos($referer, 'edit-link-categories.php') )
			$location = $referer;
	}

	$update =  wp_update_term($cat_ID, 'link_category', $_POST);

	if ( $update && !is_wp_error($update) )
		$location = add_query_arg('message', 3, $location);
	else
		$location = add_query_arg('message', 5, $location);

	wp_redirect($location);
	exit;
break;
}

?>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          wp-admin/link-import.php                                                                            0000755 0023422 0004734 00000007676 11007272662 016322  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
// Links
// Copyright (C) 2002 Mike Little -- mike@zed1.com

require_once('admin.php');
$parent_file = 'edit.php';
$title = __('Import Blogroll');

$step = $_POST['step'];
if (!$step) $step = 0;
?>
<?php
switch ($step) {
	case 0: {
		include_once('admin-header.php');
		if ( !current_user_can('manage_links') )
			wp_die(__('Cheatin&#8217; uh?'));

		$opmltype = 'blogrolling'; // default.
?>

<div class="wrap">

<h2><?php _e('Import your blogroll from another system') ?> </h2>
<form enctype="multipart/form-data" action="link-import.php" method="post" name="blogroll">
<?php wp_nonce_field('import-bookmarks') ?>

<p><?php _e('If a program or website you use allows you to export your links or subscriptions as OPML you may import them here.'); ?></p>
<div style="width: 70%; margin: auto; height: 8em;">
<input type="hidden" name="step" value="1" />
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
<div style="width: 48%;" class="alignleft">
<h3><label for="opml_url"><?php _e('Specify an OPML URL:'); ?></label></h3>
<input type="text" name="opml_url" id="opml_url" size="50" style="width: 90%;" value="http://" />
</div>

<div style="width: 48%;" class="alignleft">
<h3><label for="userfile"><?php _e('Or choose from your local disk:'); ?></label></h3>
<input id="userfile" name="userfile" type="file" size="30" />
</div>

</div>

<p style="clear: both; margin-top: 1em;"><label for="cat_id"><?php _e('Now select a category you want to put these links in.') ?></label><br />
<?php _e('Category:') ?> <select name="cat_id" id="cat_id">
<?php
$categories = get_terms('link_category', 'get=all');
foreach ($categories as $category) {
?>
<option value="<?php echo $category->term_id; ?>"><?php echo wp_specialchars(apply_filters('link_category', $category->name)); ?></option>
<?php
} // end foreach
?>
</select></p>

<p class="submit"><input type="submit" name="submit" value="<?php _e('Import OPML File') ?>" /></p>
</form>

</div>
<?php
		break;
	} // end case 0

	case 1: {
		check_admin_referer('import-bookmarks');

		include_once('admin-header.php');
		if ( !current_user_can('manage_links') )
			wp_die(__('Cheatin&#8217; uh?'));
?>
<div class="wrap">

<h2><?php _e('Importing...') ?></h2>
<?php
		$cat_id = abs( (int) $_POST['cat_id'] );
		if ( $cat_id < 1 )
			$cat_id  = 1;

		$opml_url = $_POST['opml_url'];
		if ( isset($opml_url) && $opml_url != '' && $opml_url != 'http://' ) {
			$blogrolling = true;
		} else { // try to get the upload file.
			$overrides = array('test_form' => false, 'test_type' => false);
			$file = wp_handle_upload($_FILES['userfile'], $overrides);

			if ( isset($file['error']) )
				wp_die($file['error']);

			$url = $file['url'];
			$opml_url = $file['file'];
			$blogrolling = false;
		}

		if ( isset($opml_url) && $opml_url != '' ) {
			if ( $blogrolling === true ) {
				$opml = wp_remote_fopen($opml_url);
			} else {
				$opml = file_get_contents($opml_url);
			}

			include_once('link-parse-opml.php');

			$link_count = count($names);
			for ( $i = 0; $i < $link_count; $i++ ) {
				if ('Last' == substr($titles[$i], 0, 4))
					$titles[$i] = '';
				if ( 'http' == substr($titles[$i], 0, 4) )
					$titles[$i] = '';
				$link = array( 'link_url' => $urls[$i], 'link_name' => $wpdb->escape($names[$i]), 'link_category' => array($cat_id), 'link_description' => $wpdb->escape($descriptions[$i]), 'link_owner' => $user_ID, 'link_rss' => $feeds[$i]);
				wp_insert_link($link);
				echo sprintf('<p>'.__('Inserted <strong>%s</strong>').'</p>', $names[$i]);
			}
?>

<p><?php printf(__('Inserted %1$d links into category %2$s. All done! Go <a href="%3$s">manage those links</a>.'), $link_count, $cat_id, 'link-manager.php') ?></p>

<?php
} // end if got url
else
{
	echo "<p>" . __("You need to supply your OPML url. Press back on your browser and try again") . "</p>\n";
} // end else

if ( ! $blogrolling )
	do_action( 'wp_delete_file', $opml_url);
	@unlink($opml_url);
?>
</div>
<?php
		break;
	} // end case 1
} // end switch

include('admin-footer.php');

?>                                                                  wp-admin/link-manager.php                                                                           0000755 0023422 0004734 00000022741 11141634030 016376  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Link Management Administration Panel.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** Load WordPress Administration Bootstrap */
require_once ('admin.php');

// Handle bulk deletes
if ( isset($_GET['action']) && isset($_GET['linkcheck']) ) {
	check_admin_referer('bulk-bookmarks');
	$doaction = $_GET['action'] ? $_GET['action'] : $_GET['action2'];

	if ( ! current_user_can('manage_links') )
		wp_die( __('You do not have sufficient permissions to edit the links for this blog.') );

	if ( 'delete' == $doaction ) {
		foreach ( (array) $_GET['linkcheck'] as $link_id ) {
			$link_id = (int) $link_id;

			wp_delete_link($link_id);
		}

		wp_redirect( wp_get_referer() );
		exit;
	}
} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
	 wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
	 exit;
}

wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]'));

if ( empty($cat_id) )
	$cat_id = 'all';

if ( empty($order_by) )
	$order_by = 'order_name';

$title = __('Edit Links');
$this_file = $parent_file = 'link-manager.php';
include_once ("./admin-header.php");

if (!current_user_can('manage_links'))
	wp_die(__("You do not have sufficient permissions to edit the links for this blog."));

switch ($order_by) {
	case 'order_id' :
		$sqlorderby = 'id';
		break;
	case 'order_url' :
		$sqlorderby = 'url';
		break;
	case 'order_desc' :
		$sqlorderby = 'description';
		break;
	case 'order_owner' :
		$sqlorderby = 'owner';
		break;
	case 'order_rating' :
		$sqlorderby = 'rating';
		break;
	case 'order_name' :
	default :
		$sqlorderby = 'name';
		break;
} ?>

<div class="wrap nosubsub">
<?php screen_icon(); ?>
<h2><?php echo wp_specialchars( $title );
if ( isset($_GET['s']) && $_GET['s'] )
	printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', wp_specialchars( stripslashes($_GET['s']) ) ); ?>
</h2>

<?php
if ( isset($_GET['deleted']) ) {
	echo '<div id="message" class="updated fade"><p>';
	$deleted = (int) $_GET['deleted'];
	printf(__ngettext('%s link deleted.', '%s links deleted', $deleted), $deleted);
	echo '</p></div>';
	$_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted'), $_SERVER['REQUEST_URI']);
}
?>

<form class="search-form" action="" method="get">
<p class="search-box">
	<label class="hidden" for="link-search-input"><?php _e( 'Search Links' ); ?>:</label>
	<input type="text" class="search-input" id="link-search-input" name="s" value="<?php _admin_search_query(); ?>" />
	<input type="submit" value="<?php _e( 'Search Links' ); ?>" class="button" />
</p>
</form>
<br class="clear" />

<form id="posts-filter" action="" method="get">
<div class="tablenav">

<div class="alignleft actions">
<select name="action">
<option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
<option value="delete"><?php _e('Delete'); ?></option>
</select>
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />

<?php
$categories = get_terms('link_category', "hide_empty=1");
$select_cat = "<select name=\"cat_id\">\n";
$select_cat .= '<option value="all"'  . (($cat_id == 'all') ? " selected='selected'" : '') . '>' . __('View all Categories') . "</option>\n";
foreach ((array) $categories as $cat)
	$select_cat .= '<option value="' . $cat->term_id . '"' . (($cat->term_id == $cat_id) ? " selected='selected'" : '') . '>' . sanitize_term_field('name', $cat->name, $cat->term_id, 'link_category', 'display') . "</option>\n";
$select_cat .= "</select>\n";

$select_order = "<select name=\"order_by\">\n";
$select_order .= '<option value="order_id"' . (($order_by == 'order_id') ? " selected='selected'" : '') . '>' .  __('Order by Link ID') . "</option>\n";
$select_order .= '<option value="order_name"' . (($order_by == 'order_name') ? " selected='selected'" : '') . '>' .  __('Order by Name') . "</option>\n";
$select_order .= '<option value="order_url"' . (($order_by == 'order_url') ? " selected='selected'" : '') . '>' .  __('Order by Address') . "</option>\n";
$select_order .= '<option value="order_rating"' . (($order_by == 'order_rating') ? " selected='selected'" : '') . '>' .  __('Order by Rating') . "</option>\n";
$select_order .= "</select>\n";

echo $select_cat;
echo $select_order;

?>
<input type="submit" id="post-query-submit" value="<?php _e('Filter'); ?>" class="button-secondary" />

</div>

<br class="clear" />
</div>

<div class="clear"></div>

<?php
if ( 'all' == $cat_id )
	$cat_id = '';
$args = array('category' => $cat_id, 'hide_invisible' => 0, 'orderby' => $sqlorderby, 'hide_empty' => 0);
if ( !empty($_GET['s']) )
	$args['search'] = $_GET['s'];
$links = get_bookmarks( $args );
if ( $links ) {
	$link_columns = get_column_headers('link-manager');
	$hidden = get_hidden_columns('link-manager');
?>

<?php wp_nonce_field('bulk-bookmarks') ?>
<table class="widefat fixed" cellspacing="0">
	<thead>
	<tr>
<?php print_column_headers('link-manager'); ?>
	</tr>
	</thead>

	<tfoot>
	<tr>
<?php print_column_headers('link-manager', false); ?>
	</tr>
	</tfoot>

	<tbody>
<?php
	$alt = 0;

	foreach ($links as $link) {
		$link = sanitize_bookmark($link);
		$link->link_name = attribute_escape($link->link_name);
		$link->link_category = wp_get_link_cats($link->link_id);
		$short_url = str_replace('http://', '', $link->link_url);
		$short_url = preg_replace('/^www./i', '', $short_url);
		if ('/' == substr($short_url, -1))
			$short_url = substr($short_url, 0, -1);
		if (strlen($short_url) > 35)
			$short_url = substr($short_url, 0, 32).'...';
		$visible = ($link->link_visible == 'Y') ? __('Yes') : __('No');
		$style = ($alt % 2) ? '' : ' class="alternate"';
		++ $alt;
		$edit_link = get_edit_bookmark_link();
		?><tr id="link-<?php echo $link->link_id; ?>" valign="middle" <?php echo $style; ?>><?php
		foreach($link_columns as $column_name=>$column_display_name) {
			$class = "class=\"column-$column_name\"";

			$style = '';
			if ( in_array($column_name, $hidden) )
				$style = ' style="display:none;"';
			if ( 'visible' == $column_name )
				$style = empty($style) ? ' style="text-align: center;"' : ' style="text-align: center; display: none;"';
			$attributes = "$class$style";

			switch($column_name) {
				case 'cb':
					echo '<th scope="row" class="check-column"><input type="checkbox" name="linkcheck[]" value="'.$link->link_id.'" /></th>';
					break;
				case 'name':

					echo "<td $attributes><strong><a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $link->link_name)) . "'>$link->link_name</a></strong><br />";
					$actions = array();
					$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
					$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("link.php?action=delete&amp;link_id=$link->link_id", 'delete-bookmark_' . $link->link_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf( __("You are about to delete this link '%s'\n  'Cancel' to stop, 'OK' to delete."), $link->link_name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
					$action_count = count($actions);
					$i = 0;
					echo '<div class="row-actions">';
					foreach ( $actions as $action => $linkaction ) {
						++$i;
						( $i == $action_count ) ? $sep = '' : $sep = ' | ';
						echo "<span class='$action'>$linkaction$sep</span>";
					}
					echo '</div>';
					echo '</td>';
					break;
				case 'url':
					echo "<td $attributes><a href='$link->link_url' title='".sprintf(__('Visit %s'), $link->link_name)."'>$short_url</a></td>";
					break;
				case 'categories':
					?><td <?php echo $attributes ?>><?php
					$cat_names = array();
					foreach ($link->link_category as $category) {
						$cat = get_term($category, 'link_category', OBJECT, 'display');
						if ( is_wp_error( $cat ) )
							echo $cat->get_error_message();
						$cat_name = $cat->name;
						if ( $cat_id != $category )
							$cat_name = "<a href='link-manager.php?cat_id=$category'>$cat_name</a>";
						$cat_names[] = $cat_name;
					}
					echo implode(', ', $cat_names);
					?></td><?php
					break;
				case 'rel':
					?><td <?php echo $attributes ?>><?php echo $link->link_rel; ?></td><?php
					break;
				case 'visible':
					?><td <?php echo $attributes ?>><?php echo $visible; ?></td><?php
					break;
				default:
					?>
					<td><?php do_action('manage_link_custom_column', $column_name, $link->link_id); ?></td>
					<?php
					break;

			}
		}
		echo "\n    </tr>\n";
	}
?>
	</tbody>
</table>

<?php } else { ?>
<p><?php _e('No links found.') ?></p>
<?php } ?>

<div class="tablenav">

<div class="alignleft actions">
<select name="action2">
<option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
<option value="delete"><?php _e('Delete'); ?></option>
</select>
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
</div>

<br class="clear" />
</div>

</form>

<div id="ajax-response"></div>

</div>

<script type="text/javascript">
/* <![CDATA[ */
(function($){
	$(document).ready(function(){
		$('#doaction, #doaction2').click(function(){
			if ( $('select[name^="action"]').val() == 'delete' ) {
				var m = '<?php echo js_escape(__("You are about to delete the selected links.\n  'Cancel' to stop, 'OK' to delete.")); ?>';
				return showNotice.warn(m);
			}
		});
	});
})(jQuery);
columns.init('link-manager');
/* ]]> */
</script>

<?php include('admin-footer.php'); ?>
                               wp-admin/link-parse-opml.php                                                                        0000755 0023422 0004734 00000004730 11120006740 017037  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Parse OPML XML files and store in globals.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** Load WordPress Bootstrap */
require_once('../wp-load.php');

global $opml, $map;

// columns we wish to find are:  link_url, link_name, link_target, link_description
// we need to map XML attribute names to our columns
$opml_map = array('URL'         => 'link_url',
	'HTMLURL'     => 'link_url',
	'TEXT'        => 'link_name',
	'TITLE'       => 'link_name',
	'TARGET'      => 'link_target',
	'DESCRIPTION' => 'link_description',
	'XMLURL'      => 'link_rss'
);

$map = $opml_map;

/**
 * XML callback function for the start of a new XML tag.
 *
 * @since unknown
 * @access private
 *
 * @uses $updated_timestamp Not used inside function.
 * @uses $all_links Not used inside function.
 * @uses $map Stores names of attributes to use.
 * @global array $names
 * @global array $urls
 * @global array $targets
 * @global array $descriptions
 * @global array $feeds
 *
 * @param mixed $parser XML Parser resource.
 * @param string $tagName XML element name.
 * @param array $attrs XML element attributes.
 */
function startElement($parser, $tagName, $attrs) {
	global $updated_timestamp, $all_links, $map;
	global $names, $urls, $targets, $descriptions, $feeds;

	if ($tagName == 'OUTLINE') {
		foreach (array_keys($map) as $key) {
			if (isset($attrs[$key])) {
				$$map[$key] = $attrs[$key];
			}
		}

		//echo("got data: link_url = [$link_url], link_name = [$link_name], link_target = [$link_target], link_description = [$link_description]<br />\n");

		// save the data away.
		$names[] = $link_name;
		$urls[] = $link_url;
		$targets[] = $link_target;
		$feeds[] = $link_rss;
		$descriptions[] = $link_description;
	} // end if outline
}

/**
 * XML callback function that is called at the end of a XML tag.
 *
 * @since unknown
 * @access private
 * @package WordPress
 * @subpackage Dummy
 *
 * @param mixed $parser XML Parser resource.
 * @param string $tagName XML tag name.
 */
function endElement($parser, $tagName) {
	// nothing to do.
}

// Create an XML parser
$xml_parser = xml_parser_create();

// Set the functions to handle opening and closing tags
xml_set_element_handler($xml_parser, "startElement", "endElement");

if (!xml_parse($xml_parser, $opml, true)) {
	echo(sprintf(__('XML error: %1$s at line %2$s'),
	xml_error_string(xml_get_error_code($xml_parser)),
	xml_get_current_line_number($xml_parser)));
}

// Free up memory used by the XML parser
xml_parser_free($xml_parser);
?>
                                        wp-admin/link.php                                                                                   0000755 0023422 0004734 00000005134 11114300442 014760  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Manage link administration actions.
 *
 * This page is accessed by the link management pages and handles the forms and
 * AJAX processes for link actions.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** Load WordPress Administration Bootstrap */
require_once ('admin.php');

wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]'));

if ( ! current_user_can('manage_links') )
	wp_die( __('You do not have sufficient permissions to edit the links for this blog.') );

if ( !empty($_POST['deletebookmarks']) )
	$action = 'deletebookmarks';
if ( !empty($_POST['move']) )
	$action = 'move';
if ( !empty($_POST['linkcheck']) )
	$linkcheck = $_POST['linkcheck'];

$this_file = 'link-manager.php';

switch ($action) {
	case 'deletebookmarks' :
		check_admin_referer('bulk-bookmarks');

		//for each link id (in $linkcheck[]) change category to selected value
		if (count($linkcheck) == 0) {
			wp_redirect($this_file);
			exit;
		}

		$deleted = 0;
		foreach ($linkcheck as $link_id) {
			$link_id = (int) $link_id;

			if ( wp_delete_link($link_id) )
				$deleted++;
		}

		wp_redirect("$this_file?deleted=$deleted");
		exit;
		break;

	case 'move' :
		check_admin_referer('bulk-bookmarks');

		//for each link id (in $linkcheck[]) change category to selected value
		if (count($linkcheck) == 0) {
			wp_redirect($this_file);
			exit;
		}
		$all_links = join(',', $linkcheck);
		// should now have an array of links we can change
		//$q = $wpdb->query("update $wpdb->links SET link_category='$category' WHERE link_id IN ($all_links)");

		wp_redirect($this_file);
		exit;
		break;

	case 'add' :
		check_admin_referer('add-bookmark');

		add_link();

		wp_redirect( wp_get_referer() . '?added=true' );
		exit;
		break;

	case 'save' :
		$link_id = (int) $_POST['link_id'];
		check_admin_referer('update-bookmark_' . $link_id);

		edit_link($link_id);

		wp_redirect($this_file);
		exit;
		break;

	case 'delete' :
		$link_id = (int) $_GET['link_id'];
		check_admin_referer('delete-bookmark_' . $link_id);

		wp_delete_link($link_id);

		wp_redirect($this_file);
		exit;
		break;

	case 'edit' :
		wp_enqueue_script('link');
		wp_enqueue_script('xfn');

		$parent_file = 'link-manager.php';
		$submenu_file = 'link-manager.php';
		$title = __('Edit Link');

		$link_id = (int) $_GET['link_id'];

		if (!$link = get_link_to_edit($link_id))
			wp_die(__('Link not found.'));

		include ('edit-link-form.php');
		include ('admin-footer.php');
		break;

	default :
		break;
}
?>
                                                                                                                                                                                                                                                                                                                                                                                                                                    wp-admin/media-upload.php                                                                           0000755 0023422 0004734 00000005641 11117531364 016403  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Manage media uploaded file.
 *
 * There are many filters in here for media. Plugins can extend functionality
 * by hooking into the filters.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** Load WordPress Administration Bootstrap */
require_once('admin.php');

if (!current_user_can('upload_files'))
	wp_die(__('You do not have permission to upload files.'));

wp_enqueue_script('swfupload');
wp_enqueue_script('swfupload-swfobject');
wp_enqueue_script('swfupload-queue');
wp_enqueue_script('swfupload-handlers');

@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));

// IDs should be integers
$ID = isset($ID) ? (int) $ID : 0;
$post_id = isset($post_id)? (int) $post_id : 0;

// Require an ID for the edit screen
if ( isset($action) && $action == 'edit' && !$ID )
	wp_die(__("You are not allowed to be here"));

if ( isset($_GET['inline']) ) {

	if ( isset($_GET['upload-page-form']) ) {
		$errors = media_upload_form_handler();

		$location = 'upload.php';
		if ( $errors )
			$location .= '?message=3';

		wp_redirect( admin_url($location) );
	}

	if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
		// Upload File button was clicked
		$id = media_handle_upload('async-upload', $_REQUEST['post_id']);
		unset($_FILES);
		if ( is_wp_error($id) ) {
			$errors['upload_error'] = $id;
			$id = false;
		}
	}

	$title = __('Upload New Media');
	$parent_file = 'upload.php';
	require_once('admin-header.php'); ?>
	<div class="wrap">
	<?php screen_icon(); ?>
	<h2><?php echo wp_specialchars( $title ); ?></h2>

	<form enctype="multipart/form-data" method="post" action="media-upload.php?inline=&amp;upload-page-form=" class="media-upload-form type-form validate" id="file-form">

	<?php media_upload_form(); ?>

	<script type="text/javascript">
	jQuery(function($){
		var preloaded = $(".media-item.preloaded");
		if ( preloaded.length > 0 ) {
			preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
		}
		updateMediaForm();
		post_id = 0;
		shortform = 1;
	});
	</script>
	<input type="hidden" name="post_id" id="post_id" value="0" />
	<?php wp_nonce_field('media-form'); ?>
	<div id="media-items"> </div>
	<p>
	<input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" />
	</p>
	</form>
	</div>

<?php
	include('admin-footer.php');

} else {

	// upload type: image, video, file, ..?
	if ( isset($_GET['type']) )
		$type = strval($_GET['type']);
	else
		$type = apply_filters('media_upload_default_type', 'file');

	// tab: gallery, library, or type-specific
	if ( isset($_GET['tab']) )
		$tab = strval($_GET['tab']);
	else
		$tab = apply_filters('media_upload_default_tab', 'type');

	$body_id = 'media-upload';

	// let the action code decide how to handle the request
	if ( $tab == 'type' || $tab == 'type_url' )
		do_action("media_upload_$type");
	else
		do_action("media_upload_$tab");
}
?>
                                                                                               wp-admin/media.php                                                                                  0000755 0023422 0004734 00000006017 11117432530 015112  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Media management action handler.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** Load WordPress Administration Bootstrap */
require_once('admin.php');

$parent_file = 'upload.php';
$submenu_file = 'upload.php';

wp_reset_vars(array('action'));

switch( $action ) :
case 'editattachment' :
	$attachment_id = (int) $_POST['attachment_id'];
	check_admin_referer('media-form');

	if ( !current_user_can('edit_post', $attachment_id) )
		wp_die ( __('You are not allowed to edit this attachment.') );

	$errors = media_upload_form_handler();

	if ( empty($errors) ) {
		$location = 'media.php';
		if ( $referer = wp_get_original_referer() ) {
			if ( false !== strpos($referer, 'upload.php') || ( url_to_postid($referer) == $attachment_id )  )
				$location = $referer;
		}
		if ( false !== strpos($location, 'upload.php') ) {
			$location = remove_query_arg('message', $location);
			$location = add_query_arg('posted',	$attachment_id, $location);
		} elseif ( false !== strpos($location, 'media.php') ) {
			$location = add_query_arg('message', 'updated', $location);
		}
		wp_redirect($location);
		exit;
	}

	// no break
case 'edit' :
	$title = __('Edit Media');

	if ( empty($errors) )
		$errors = null;

	if ( empty( $_GET['attachment_id'] ) ) {
		wp_redirect('upload.php');
		exit();
	}
	$att_id = (int) $_GET['attachment_id'];

	if ( !current_user_can('edit_post', $att_id) )
		wp_die ( __('You are not allowed to edit this attachment.') );

	$att = get_post($att_id);

	add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);

	wp_enqueue_script( 'wp-ajax-response' );
//	wp_admin_css( 'media' );

	require( 'admin-header.php' );

	$parent_file = 'upload.php';
	$message = '';
	$class = '';
	if ( isset($_GET['message']) ) {
		switch ( $_GET['message'] ) :
		case 'updated' :
			$message = __('Media attachment updated.');
			$class = 'updated fade';
			break;
		endswitch;
	}
	if ( $message )
		echo "<div id='message' class='$class'><p>$message</p></div>\n";

?>

<div class="wrap">
<?php screen_icon(); ?>
<h2><?php _e( 'Edit Media' ); ?></h2>

<form method="post" action="<?php echo clean_url( remove_query_arg( 'message' ) ); ?>" class="media-upload-form" id="media-single-form">
<div class="media-single">
<div id='media-item-<?php echo $att_id; ?>' class='media-item'>
<?php echo get_media_item( $att_id, array( 'toggle' => false, 'send' => false, 'delete' => false, 'show_title' => false, 'errors' => $errors ) ); ?>
</div>
</div>

<p class="submit">
<input type="submit" class="button-primary" name="save" value="<?php _e('Update Media'); ?>" />
<input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" />
<input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo $att_id; ?>" />
<input type="hidden" name="action" value="editattachment" />
<?php wp_original_referer_field(true, 'previous'); ?>
<?php wp_nonce_field('media-form'); ?>
</p>
</form>

</div>

<?php

	require( 'admin-footer.php' );

	exit;

default:
	wp_redirect( 'upload.php' );
	exit;

endswitch;


?>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 wp-admin/menu-header.php                                                                            0000755 0023422 0004734 00000011572 11143067574 016242  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Displays Administration Menu.
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * The current page.
 *
 * @global string $self
 * @name $self
 * @var string
 */
$self = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
$self = preg_replace('|^.*/plugins/|i', '', $self);

global $menu, $submenu, $parent_file; //For when admin-header is included from within a function.

get_admin_page_parent();

/**
 * Display menu.
 *
 * @access private
 * @since 2.7.0
 *
 * @param array $menu
 * @param array $submenu
 * @param bool $submenu_as_parent
 */
function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
	global $self, $parent_file, $submenu_file, $plugin_page, $pagenow;

	$first = true;
	// 0 = name, 1 = capability, 2 = file, 3 = class, 4 = id, 5 = icon src
	foreach ( $menu as $key => $item ) {
		$admin_is_parent = false;
		$class = array();
		if ( $first ) {
			$class[] = 'wp-first-item';
			$first = false;
		}
		if ( !empty($submenu[$item[2]]) )
			$class[] = 'wp-has-submenu';

		if ( ( $parent_file && $item[2] == $parent_file ) || strcmp($self, $item[2]) == 0 ) {
			if ( !empty($submenu[$item[2]]) )
				$class[] = 'wp-has-current-submenu wp-menu-open';
			else
				$class[] = 'current';
		}

		if ( isset($item[4]) && ! empty($item[4]) )
			$class[] = $item[4];

		$class = $class ? ' class="' . join( ' ', $class ) . '"' : '';
		$tabindex = ' tabindex="1"';
		$id = isset($item[5]) && ! empty($item[5]) ? ' id="' . preg_replace( '|[^a-zA-Z0-9_:.]|', '-', $item[5] ) . '"' : '';
		$img = '';
		if ( isset($item[6]) && ! empty($item[6]) ) {
			if ( 'div' === $item[6] )
				$img = '<div class="wp-menu-image"><br /></div>';
			else
				$img = '<img class="wp-menu-image" src="' . $item[6] . '" alt="" />';
		}
		$toggle = '<div class="wp-menu-toggle"><br /></div>';

		echo "\n\t<li$class$id>";

		if ( false !== strpos($class, 'wp-menu-separator') ) {
			echo '<br />';
		} elseif ( $submenu_as_parent && !empty($submenu[$item[2]]) ) {
			$submenu[$item[2]] = array_values($submenu[$item[2]]);  // Re-index.
			$menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
			if ( ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") && ('index.php' != $submenu[$item[2]][0][2]) ) || !empty($menu_hook)) {
				$admin_is_parent = true;
				echo "$img$toggle<a href='admin.php?page={$submenu[$item[2]][0][2]}'$class$tabindex>{$item[0]}</a>";
			} else {
				echo "\n\t$img$toggle<a href='{$submenu[$item[2]][0][2]}'$class$tabindex>{$item[0]}</a>";
			}
		} else if ( current_user_can($item[1]) ) {
			$menu_hook = get_plugin_page_hook($item[2], 'admin.php');
			if ( file_exists(WP_PLUGIN_DIR . "/{$item[2]}") || !empty($menu_hook) ) {
				$admin_is_parent = true;
				echo "\n\t$img$toggle<a href='admin.php?page={$item[2]}'$class$tabindex>{$item[0]}</a>";
			} else {
				echo "\n\t$img$toggle<a href='{$item[2]}'$class$tabindex>{$item[0]}</a>";
			}
		}

		if ( !empty($submenu[$item[2]]) ) {
			echo "\n\t<div class='wp-submenu'><div class='wp-submenu-head'>{$item[0]}</div><ul>";
			$first = true;
			foreach ( $submenu[$item[2]] as $sub_key => $sub_item ) {
				if ( !current_user_can($sub_item[1]) )
					continue;

				$class = array();
				if ( $first ) {
					$class[] = 'wp-first-item';
					$first = false;
				}
				if ( isset($submenu_file) ) {
					if ( $submenu_file == $sub_item[2] )
						$class[] = 'current';
				// If plugin_page is set the parent must either match the current page or not physically exist.
				// This allows plugin pages with the same hook to exist under different parents.
				} else if ( (isset($plugin_page) && $plugin_page == $sub_item[2] && (!file_exists($item[2]) || ($item[2] == $self))) || (!isset($plugin_page) && $self == $sub_item[2]) ) {
					$class[] = 'current';
				}

				$class = $class ? ' class="' . join( ' ', $class ) . '"' : '';

				$menu_hook = get_plugin_page_hook($sub_item[2], $item[2]);

				if ( ( file_exists(WP_PLUGIN_DIR . "/{$sub_item[2]}") && ('index.php' != $sub_item[2]) ) || ! empty($menu_hook) ) {
					// If admin.php is the current page or if the parent exists as a file in the plugins or admin dir
					$parent_exists = (!$admin_is_parent && file_exists(WP_PLUGIN_DIR . "/{$item[2]}") && !is_dir(WP_PLUGIN_DIR . "/{$item[2]}") ) || file_exists($item[2]);
					if ( $parent_exists )
						echo "<li$class><a href='{$item[2]}?page={$sub_item[2]}'$class$tabindex>{$sub_item[0]}</a></li>";
					elseif ( 'admin.php' == $pagenow || !$parent_exists )
						echo "<li$class><a href='admin.php?page={$sub_item[2]}'$class$tabindex>{$sub_item[0]}</a></li>";
					else
						echo "<li$class><a href='{$item[2]}?page={$sub_item[2]}'$class$tabindex>{$sub_item[0]}</a></li>";
				} else {
					echo "<li$class><a href='{$sub_item[2]}'$class$tabindex>{$sub_item[0]}</a></li>";
				}
			}
			echo "</ul></div>";
		}
		echo "</li>";
	}
}

?>

<ul id="adminmenu">

<?php

_wp_menu_output( $menu, $submenu );
do_action( 'adminmenu' );

?>
</ul>                                                                                                                                      wp-admin/menu.php                                                                                   0000755 0023422 0004734 00000022455 11136131472 015005  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Build Administration Menu.
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * Constructs the admin menu bar.
 *
 * The elements in the array are :
 *     0: Menu item name
 *     1: Minimum level or capability required.
 *     2: The URL of the item's file
 *     3: Class
 *     4: ID
 *     5: Icon for top level menu
 *
 * @global array $menu
 * @name $menu
 * @var array
 */

$awaiting_mod = wp_count_comments();
$awaiting_mod = $awaiting_mod->moderated;

$menu[0] = array( __('Dashboard'), 'read', 'index.php', '', 'menu-top', 'menu-dashboard', 'div' );

$menu[4] = array( '', 'read', '', '', 'wp-menu-separator' );

$menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'wp-menu-open menu-top', 'menu-posts', 'div' );
	$submenu['edit.php'][5]  = array( __('Edit'), 'edit_posts', 'edit.php' );
	$submenu['edit.php'][10]  = array( _c('Add New|post'), 'edit_posts', 'post-new.php' );
	$submenu['edit.php'][15] = array( __('Tags'), 'manage_categories', 'edit-tags.php' );
	$submenu['edit.php'][20] = array( __('Categories'), 'manage_categories', 'categories.php' );

$menu[10] = array( __('Media'), 'upload_files', 'upload.php', '', 'menu-top', 'menu-media', 'div' );
	$submenu['upload.php'][5] = array( __('Library'), 'upload_files', 'upload.php');
	$submenu['upload.php'][10] = array( _c('Add New|file'), 'upload_files', 'media-new.php');

$menu[15] = array( __('Links'), 'manage_links', 'link-manager.php', '', 'menu-top', 'menu-links', 'div' );
	$submenu['link-manager.php'][5] = array( __('Edit'), 'manage_links', 'link-manager.php' );
	$submenu['link-manager.php'][10] = array( _c('Add New|links'), 'manage_links', 'link-add.php' );
	$submenu['link-manager.php'][15] = array( __('Link Categories'), 'manage_categories', 'edit-link-categories.php' );

$menu[20] = array( __('Pages'), 'edit_pages', 'edit-pages.php', '', 'menu-top', 'menu-pages', 'div' );
	$submenu['edit-pages.php'][5] = array( __('Edit'), 'edit_pages', 'edit-pages.php' );
	$submenu['edit-pages.php'][10] = array( _c('Add New|page'), 'edit_pages', 'page-new.php' );

$menu[25] = array( sprintf( __('Comments %s'), "<span id='awaiting-mod' class='count-$awaiting_mod'><span class='pending-count'>" . number_format_i18n($awaiting_mod) . "</span></span>" ), 'edit_posts', 'edit-comments.php', '', 'menu-top', 'menu-comments', 'div' );

$_wp_last_object_menu = 25; // The index of the last top-level menu in the object menu group

$menu[39] = array( '', 'read', '', '', 'wp-menu-separator' );

$menu[40] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-top', 'menu-appearance', 'div' );
	$submenu['themes.php'][5]  = array(__('Themes'), 'switch_themes', 'themes.php');
	$submenu['themes.php'][10] = array(__('Editor'), 'edit_themes', 'theme-editor.php');

$update_plugins = get_option( 'update_plugins' );
$update_count = 0;
if ( !empty($update_plugins->response) )
	$update_count = count( $update_plugins->response );

$menu[45] = array( sprintf( __('Plugins %s'), "<span class='update-plugins count-$update_count'><span class='plugin-count'>" . number_format_i18n($update_count) . "</span></span>" ), 'activate_plugins', 'plugins.php', '', 'menu-top', 'menu-plugins', 'div' );
	$submenu['plugins.php'][5]  = array( __('Installed'), 'activate_plugins', 'plugins.php' );
	$submenu['plugins.php'][10] = array(_c('Add New|plugin'), 'install_plugins', 'plugin-install.php');
	$submenu['plugins.php'][15] = array( __('Editor'), 'edit_plugins', 'plugin-editor.php' );

if ( current_user_can('edit_users') )
	$menu[50] = array( __('Users'), 'edit_users', 'users.php', '', 'menu-top', 'menu-users', 'div' );
else
	$menu[50] = array( __('Profile'), 'read', 'profile.php', '', 'menu-top', 'menu-users', 'div' );

if ( current_user_can('edit_users') ) {
	$_wp_real_parent_file['profile.php'] = 'users.php'; // Back-compat for plugins adding submenus to profile.php.
	$submenu['users.php'][5] = array(__('Authors &amp; Users'), 'edit_users', 'users.php');
	$submenu['users.php'][10] = array(__('Add New'), 'create_users', 'user-new.php');
	$submenu['users.php'][15] = array(__('Your Profile'), 'read', 'profile.php');
} else {
	$_wp_real_parent_file['users.php'] = 'profile.php';
	$submenu['profile.php'][5] = array(__('Your Profile'), 'read', 'profile.php');
}

$menu[55] = array( __('Tools'), 'read', 'tools.php', '', 'menu-top', 'menu-tools', 'div' );
	$submenu['tools.php'][5] = array( __('Tools'), 'read', 'tools.php' );
	$submenu['tools.php'][10] = array( __('Import'), 'import', 'import.php' );
	$submenu['tools.php'][15] = array( __('Export'), 'import', 'export.php' );
	$submenu['tools.php'][20] = array( __('Upgrade'), 'install_plugins',  'update-core.php');

$menu[60] = array( __('Settings'), 'manage_options', 'options-general.php', '', 'menu-top', 'menu-settings', 'div' );
	$submenu['options-general.php'][10] = array(__('General'), 'manage_options', 'options-general.php');
	$submenu['options-general.php'][15] = array(__('Writing'), 'manage_options', 'options-writing.php');
	$submenu['options-general.php'][20] = array(__('Reading'), 'manage_options', 'options-reading.php');
	$submenu['options-general.php'][25] = array(__('Discussion'), 'manage_options', 'options-discussion.php');
	$submenu['options-general.php'][30] = array(__('Media'), 'manage_options', 'options-media.php');
	$submenu['options-general.php'][35] = array(__('Privacy'), 'manage_options', 'options-privacy.php');
	$submenu['options-general.php'][40] = array(__('Permalinks'), 'manage_options', 'options-permalink.php');
	$submenu['options-general.php'][45] = array(__('Miscellaneous'), 'manage_options', 'options-misc.php');

$_wp_last_utility_menu = 60; // The index of the last top-level menu in the utility menu group

$menu[79] = array( '', 'read', '', '', 'wp-menu-separator-last' );

// Back-compat for old top-levels
$_wp_real_parent_file['post.php'] = 'edit.php';
$_wp_real_parent_file['post-new.php'] = 'edit.php';
$_wp_real_parent_file['page-new.php'] = 'edit-pages.php';

do_action('_admin_menu');

// Create list of page plugin hook names.
foreach ($menu as $menu_page) {
	$admin_page_hooks[$menu_page[2]] = sanitize_title($menu_page[0]);
}

$_wp_submenu_nopriv = array();
$_wp_menu_nopriv = array();
// Loop over submenus and remove pages for which the user does not have privs.
foreach ( array( 'submenu' ) as $sub_loop ) {
	foreach ($$sub_loop as $parent => $sub) {
		foreach ($sub as $index => $data) {
			if ( ! current_user_can($data[1]) ) {
				unset(${$sub_loop}[$parent][$index]);
				$_wp_submenu_nopriv[$parent][$data[2]] = true;
			}
		}

		if ( empty(${$sub_loop}[$parent]) )
			unset(${$sub_loop}[$parent]);
	}
}

// Loop over the top-level menu.
// Menus for which the original parent is not acessible due to lack of privs will have the next
// submenu in line be assigned as the new menu parent.
foreach ( $menu as $id => $data ) {
	if ( empty($submenu[$data[2]]) )
		continue;
	$subs = $submenu[$data[2]];
	$first_sub = array_shift($subs);
	$old_parent = $data[2];
	$new_parent = $first_sub[2];
	// If the first submenu is not the same as the assigned parent,
	// make the first submenu the new parent.
	if ( $new_parent != $old_parent ) {
		$_wp_real_parent_file[$old_parent] = $new_parent;
		$menu[$id][2] = $new_parent;

		foreach ($submenu[$old_parent] as $index => $data) {
			$submenu[$new_parent][$index] = $submenu[$old_parent][$index];
			unset($submenu[$old_parent][$index]);
		}
		unset($submenu[$old_parent]);

		if ( isset($_wp_submenu_nopriv[$old_parent]) )
			$_wp_submenu_nopriv[$new_parent] = $_wp_submenu_nopriv[$old_parent];
	}
}

do_action('admin_menu', '');

// Remove menus that have no accessible submenus and require privs that the user does not have.
// Run re-parent loop again.
foreach ( $menu as $id => $data ) {
	// If submenu is empty...
	if ( empty($submenu[$data[2]]) ) {
		// And user doesn't have privs, remove menu.
		if ( ! current_user_can($data[1]) ) {
			$_wp_menu_nopriv[$data[2]] = true;
			unset($menu[$id]);
		}
	}
}

// Remove any duplicated seperators
$seperator_found = false;
foreach ( $menu as $id => $data ) {
	if ( 0 == strcmp('wp-menu-separator', $data[4] ) ) {
		if (false == $seperator_found) {
			$seperator_found = true;
		} else {
			unset($menu[$id]);
			$seperator_found = false;
		}
	} else {
		$seperator_found = false;
	}
}

unset($id);

function add_cssclass($add, $class) {
	$class = empty($class) ? $add : $class .= ' ' . $add;
	return $class;
}

function add_menu_classes($menu) {

	$first = $lastorder = false;
	$i = 0;
	$mc = count($menu);
	foreach ( $menu as $order => $top ) {
		$i++;

		if ( 0 == $order ) { // dashboard is always shown/single
			$menu[0][4] = add_cssclass('menu-top-first menu-top-last', $top[4]);
			continue;
		}

		if ( empty($top[2]) ) { // if separator
			$first = true;
			if ( $lastorder ) {
				$c = $menu[$lastorder][4];
				$menu[$lastorder][4] = add_cssclass('menu-top-last', $c);
			}
			continue;
		}

		if ( $first ) {
			$c = $menu[$order][4];
			$menu[$order][4] = add_cssclass('menu-top-first', $c);
			$first = false;
		}

		if ( $mc == $i ) { // last item
			$c = $menu[$order][4];
			$menu[$order][4] = add_cssclass('menu-top-last', $c);
		}

		$lastorder = $order;
	}

	return apply_filters( 'add_menu_classes', $menu );
}

uksort($menu, "strnatcasecmp"); // make it all pretty

$menu = add_menu_classes($menu);

if (! user_can_access_admin_page()) {
	do_action('admin_page_access_denied');
	wp_die( __('You do not have sufficient permissions to access this page.') );
}

?>
                                                                                                                                                                                                                   wp-admin/moderation.php                                                                             0000755 0023422 0004734 00000000416 11050757436 016204  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Comment Moderation Administration Panel.
 *
 * Redirects to edit-comments.php?comment_status=moderated.
 *
 * @package WordPress
 * @subpackage Administration
 */
require_once('../wp-load.php');
wp_redirect('edit-comments.php?comment_status=moderated');
?>
                                                                                                                                                                                                                                                  wp-admin/options-discussion.php                                                                     0000755 0023422 0004734 00000026177 11117531364 017725  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Discussion settings administration panel.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** WordPress Administration Bootstrap */
require_once('admin.php');

$title = __('Discussion Settings');
$parent_file = 'options-general.php';

include('admin-header.php');
?>

<div class="wrap">
<?php screen_icon(); ?>
<h2><?php echo wp_specialchars( $title ); ?></h2>

<form method="post" action="options.php">
<?php settings_fields('discussion'); ?>

<table class="form-table">
<tr valign="top">
<th scope="row"><?php _e('Default article settings') ?></th>
<td><fieldset><legend class="hidden"><?php _e('Default article settings') ?></legend>
<label for="default_pingback_flag">
<input name="default_pingback_flag" type="checkbox" id="default_pingback_flag" value="1" <?php checked('1', get_option('default_pingback_flag')); ?> />
<?php _e('Attempt to notify any blogs linked to from the article (slows down posting.)') ?></label>
<br />
<label for="default_ping_status">
<input name="default_ping_status" type="checkbox" id="default_ping_status" value="open" <?php checked('open', get_option('default_ping_status')); ?> />
<?php _e('Allow link notifications from other blogs (pingbacks and trackbacks.)') ?></label>
<br />
<label for="default_comment_status">
<input name="default_comment_status" type="checkbox" id="default_comment_status" value="open" <?php checked('open', get_option('default_comment_status')); ?> />
<?php _e('Allow people to post comments on the article') ?></label>
<br />
<small><em><?php echo '(' . __('These settings may be overridden for individual articles.') . ')'; ?></em></small>
</fieldset></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Other comment settings') ?></th>
<td><fieldset><legend class="hidden"><?php _e('Other comment settings') ?></legend>
<label for="require_name_email"><input type="checkbox" name="require_name_email" id="require_name_email" value="1" <?php checked('1', get_option('require_name_email')); ?> /> <?php _e('Comment author must fill out name and e-mail') ?></label>
<br />
<label for="comment_registration">
<input name="comment_registration" type="checkbox" id="comment_registration" value="1" <?php checked('1', get_option('comment_registration')); ?> />
<?php _e('Users must be registered and logged in to comment') ?>
</label>
<br />

<label for="close_comments_for_old_posts">
<input name="close_comments_for_old_posts" type="checkbox" id="close_comments_for_old_posts" value="1" <?php checked('1', get_option('close_comments_for_old_posts')); ?> />
<?php printf( __('Automatically close comments on articles older than %s days'), '</label><input name="close_comments_days_old" type="text" id="close_comments_days_old" value="' . attribute_escape(get_option('close_comments_days_old')) . '" class="small-text" />') ?>
<br />
<label for="thread_comments">
<input name="thread_comments" type="checkbox" id="thread_comments" value="1" <?php checked('1', get_option('thread_comments')); ?> />
<?php

$maxdeep = (int) apply_filters( 'thread_comments_depth_max', 10 );

$thread_comments_depth = '</label><select name="thread_comments_depth" id="thread_comments_depth">';
for ( $i = 1; $i <= $maxdeep; $i++ ) {
	$thread_comments_depth .= "<option value='$i'";
	if ( get_option('thread_comments_depth') == $i ) $thread_comments_depth .= " selected='selected'";
	$thread_comments_depth .= ">$i</option>";
}
$thread_comments_depth .= '</select>';

printf( __('Enable threaded (nested) comments %s levels deep'), $thread_comments_depth );

?><br />
<label for="page_comments">
<input name="page_comments" type="checkbox" id="page_comments" value="1" <?php checked('1', get_option('page_comments')); ?> />
<?php

$default_comments_page = '</label><label for="default_comments_page"><select name="default_comments_page" id="default_comments_page"><option value="newest"';
if ( 'newest' == get_option('default_comments_page') ) $default_comments_page .= ' selected="selected"';
$default_comments_page .= '>' . __('last') . '</option><option value="oldest"';
if ( 'oldest' == get_option('default_comments_page') ) $default_comments_page .= ' selected="selected"';
$default_comments_page .= '>' . __('first') . '</option></select>';

printf( __('Break comments into pages with %1$s comments per page and the %2$s page displayed by default'), '</label><label for="comments_per_page"><input name="comments_per_page" type="text" id="comments_per_page" value="' . attribute_escape(get_option('comments_per_page')) . '" class="small-text" />', $default_comments_page );

?></label>
<br />
<label for="comment_order"><?php

$comment_order = '<select name="comment_order" id="comment_order"><option value="asc"';
if ( 'asc' == get_option('comment_order') ) $comment_order .= ' selected="selected"';
$comment_order .= '>' . __('older') . '</option><option value="desc"';
if ( 'desc' == get_option('comment_order') ) $comment_order .= ' selected="selected"';
$comment_order .= '>' . __('newer') . '</option></select>';

printf( __('Comments should be displayed with the %s comments at the top of each page'), $comment_order );

?></label>
</fieldset></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('E-mail me whenever') ?></th>
<td><fieldset><legend class="hidden"><?php _e('E-mail me whenever') ?></legend>
<label for="comments_notify">
<input name="comments_notify" type="checkbox" id="comments_notify" value="1" <?php checked('1', get_option('comments_notify')); ?> />
<?php _e('Anyone posts a comment') ?> </label>
<br />
<label for="moderation_notify">
<input name="moderation_notify" type="checkbox" id="moderation_notify" value="1" <?php checked('1', get_option('moderation_notify')); ?> />
<?php _e('A comment is held for moderation') ?> </label>
</fieldset></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Before a comment appears') ?></th>
<td><fieldset><legend class="hidden"><?php _e('Before a comment appears') ?></legend>
<label for="comment_moderation">
<input name="comment_moderation" type="checkbox" id="comment_moderation" value="1" <?php checked('1', get_option('comment_moderation')); ?> />
<?php _e('An administrator must always approve the comment') ?> </label>
<br />
<label for="comment_whitelist"><input type="checkbox" name="comment_whitelist" id="comment_whitelist" value="1" <?php checked('1', get_option('comment_whitelist')); ?> /> <?php _e('Comment author must have a previously approved comment') ?></label>
</fieldset></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Comment Moderation') ?></th>
<td><fieldset><legend class="hidden"><?php _e('Comment Moderation') ?></legend>
<p><label for="comment_max_links"><?php printf(__('Hold a comment in the queue if it contains %s or more links. (A common characteristic of comment spam is a large number of hyperlinks.)'), '<input name="comment_max_links" type="text" id="comment_max_links" value="' . get_option('comment_max_links'). '" class="small-text" />' ) ?></label></p>

<p><label for="moderation_keys"><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be held in the <a href="edit-comments.php?comment_status=moderated">moderation queue</a>. One word or IP per line. It will match inside words, so "press" will match "WordPress".') ?></label></p>
<p>
<textarea name="moderation_keys" rows="10" cols="50" id="moderation_keys" class="large-text code"><?php form_option('moderation_keys'); ?></textarea>
</p>
</fieldset></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Comment Blacklist') ?></th>
<td><fieldset><legend class="hidden"><?php _e('Comment Blacklist') ?></legend>
<p><label for="blacklist_keys"><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be marked as spam. One word or IP per line. It will match inside words, so "press" will match "WordPress".') ?></label></p>
<p>
<textarea name="blacklist_keys" rows="10" cols="50" id="blacklist_keys" class="large-text code"><?php form_option('blacklist_keys'); ?></textarea>
</p>
</fieldset></td>
</tr>
<?php do_settings_fields('discussion', 'default'); ?>
</table>

<h3><?php _e('Avatars') ?></h3>

<p><?php _e('An avatar is an image that follows you from weblog to weblog appearing beside your name when you comment on avatar enabled sites.  Here you can enable the display of avatars for people who comment on your blog.'); ?></p>

<?php // the above would be a good place to link to codex documentation on the gravatar functions, for putting it in themes. anything like that? ?>

<table class="form-table">
<tr valign="top">
<th scope="row"><?php _e('Avatar Display') ?></th>
<td><fieldset><legend class="hidden"><?php _e('Avatar display') ?></legend>
<?php
	$yesorno = array(0 => __("Don&#8217;t show Avatars"), 1 => __('Show Avatars'));
	foreach ( $yesorno as $key => $value) {
		$selected = (get_option('show_avatars') == $key) ? 'checked="checked"' : '';
		echo "\n\t<label><input type='radio' name='show_avatars' value='$key' $selected/> $value</label><br />";
	}
?>
</fieldset></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Maximum Rating') ?></th>
<td><fieldset><legend class="hidden"><?php _e('Maximum Rating') ?></legend>

<?php
$ratings = array( 'G' => __('G &#8212; Suitable for all audiences'), 'PG' => __('PG &#8212; Possibly offensive, usually for audiences 13 and above'), 'R' => __('R &#8212; Intended for adult audiences above 17'), 'X' => __('X &#8212; Even more mature than above'));
foreach ($ratings as $key => $rating) :
	$selected = (get_option('avatar_rating') == $key) ? 'checked="checked"' : '';
	echo "\n\t<label><input type='radio' name='avatar_rating' value='$key' $selected/> $rating</label><br />";
endforeach;
?>

</fieldset></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Default Avatar') ?></th>
<td class="defaultavatarpicker"><fieldset><legend class="hidden"><?php _e('Default Avatar') ?></legend>

<?php _e('For users without a custom avatar of their own, you can either display a generic logo or a generated one based on their e-mail address.'); ?><br />

<?php
$avatar_defaults = array(
	'mystery' => __('Mystery Man'),
	'blank' => __('Blank'),
	'gravatar_default' => __('Gravatar Logo'),
	'identicon' => __('Identicon (Generated)'),
	'wavatar' => __('Wavatar (Generated)'),
	'monsterid' => __('MonsterID (Generated)')
);
$avatar_defaults = apply_filters('avatar_defaults', $avatar_defaults);
$default = get_option('avatar_default');
if ( empty($default) )
	$default = 'mystery';
$size = 32;
$avatar_list = '';
foreach ( $avatar_defaults as $default_key => $default_name ) {
	$selected = ($default == $default_key) ? 'checked="checked" ' : '';
	$avatar_list .= "\n\t<label><input type='radio' name='avatar_default' id='avatar_{$default_key}' value='{$default_key}' {$selected}/> ";

	$avatar = get_avatar( $user_email, $size, $default_key );
	$avatar_list .= preg_replace("/src='(.+?)'/", "src='\$1&amp;forcedefault=1'", $avatar);

	$avatar_list .= ' ' . $default_name . '</label>';
	$avatar_list .= '<br />';
}
echo apply_filters('default_avatar_select', $avatar_list);
?>

</fieldset></td>
</tr>
<?php do_settings_fields('discussion', 'avatars'); ?>
</table>

<?php do_settings_sections('discussion'); ?>

<p class="submit">
<input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
</p>
</form>
</div>

<?php include('./admin-footer.php'); ?>
                                                                                                                                                                                                                                                                                                                                                                                                 wp-admin/options-general.php                                                                        0000755 0023422 0004734 00000020255 11117531364 017146  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * General settings administration panel.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** WordPress Administration Bootstrap */
require_once('./admin.php');

$title = __('General Settings');
$parent_file = 'options-general.php';

/**
 * Display JavaScript on the page.
 *
 * @package WordPress
 * @subpackage General_Settings_Panel
 */
function add_js() {
?>
<script type="text/javascript">
//<![CDATA[
	jQuery(document).ready(function($){
		$("input[name='date_format']").click(function(){
			if ( "date_format_custom_radio" != $(this).attr("id") )
				$("input[name='date_format_custom']").val( $(this).val() );
		});
		$("input[name='date_format_custom']").focus(function(){
			$("#date_format_custom_radio").attr("checked", "checked");
		});

		$("input[name='time_format']").click(function(){
			if ( "time_format_custom_radio" != $(this).attr("id") )
				$("input[name='time_format_custom']").val( $(this).val() );
		});
		$("input[name='time_format_custom']").focus(function(){
			$("#time_format_custom_radio").attr("checked", "checked");
		});
	});
//]]>
</script>
<?php
}
add_filter('admin_head', 'add_js');

include('./admin-header.php');
?>

<div class="wrap">
<?php screen_icon(); ?>
<h2><?php echo wp_specialchars( $title ); ?></h2>

<form method="post" action="options.php">
<?php settings_fields('general'); ?>

<table class="form-table">
<tr valign="top">
<th scope="row"><label for="blogname"><?php _e('Blog Title') ?></label></th>
<td><input name="blogname" type="text" id="blogname" value="<?php form_option('blogname'); ?>" class="regular-text" /></td>
</tr>
<tr valign="top">
<th scope="row"><label for="blogdescription"><?php _e('Tagline') ?></label></th>
<td><input name="blogdescription" type="text" id="blogdescription"  value="<?php form_option('blogdescription'); ?>" class="regular-text" />
<span class="setting-description"><?php _e('In a few words, explain what this blog is about.') ?></span></td>
</tr>
<tr valign="top">
<th scope="row"><label for="siteurl"><?php _e('WordPress address (URL)') ?></label></th>
<td><input name="siteurl" type="text" id="siteurl" value="<?php form_option('siteurl'); ?>" class="regular-text code<?php if ( defined( 'WP_SITEURL' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> /></td>
</tr>
<tr valign="top">
<th scope="row"><label for="home"><?php _e('Blog address (URL)') ?></label></th>
<td><input name="home" type="text" id="home" value="<?php form_option('home'); ?>" class="regular-text code<?php if ( defined( 'WP_HOME' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> />
<span class="setting-description"><?php _e('Enter the address here if you want your blog homepage <a href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">to be different from the directory</a> you installed WordPress.'); ?></span></td>
</tr>
<tr valign="top">
<th scope="row"><label for="admin_email"><?php _e('E-mail address') ?> </label></th>
<td><input name="admin_email" type="text" id="admin_email" value="<?php form_option('admin_email'); ?>" class="regular-text code" />
<span class="setting-description"><?php _e('This address is used for admin purposes, like new user notification.') ?></span></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Membership') ?></th>
<td> <fieldset><legend class="hidden"><?php _e('Membership') ?></legend><label for="users_can_register">
<input name="users_can_register" type="checkbox" id="users_can_register" value="1" <?php checked('1', get_option('users_can_register')); ?> />
<?php _e('Anyone can register') ?></label>
</fieldset></td>
</tr>
<tr valign="top">
<th scope="row"><label for="default_role"><?php _e('New User Default Role') ?></label></th>
<td>
<select name="default_role" id="default_role"><?php wp_dropdown_roles( get_option('default_role') ); ?></select>
</td>
</tr>
<tr>
<th scope="row"><label for="gmt_offset"><?php _e('Timezone') ?> </label></th>
<td>
<select name="gmt_offset" id="gmt_offset">
<?php
$current_offset = get_option('gmt_offset');
$offset_range = array (-12, -11.5, -11, -10.5, -10, -9.5, -9, -8.5, -8, -7.5, -7, -6.5, -6, -5.5, -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5,
	0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 5.75, 6, 6.5, 7, 7.5, 8, 8.5, 8.75, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 13.75, 14);
foreach ( $offset_range as $offset ) {
	if ( 0 < $offset )
		$offset_name = '+' . $offset;
	elseif ( 0 == $offset )
		$offset_name = '';
	else
		$offset_name = (string) $offset;

	$offset_name = str_replace(array('.25','.5','.75'), array(':15',':30',':45'), $offset_name);

	$selected = '';
	if ( $current_offset == $offset ) {
		$selected = " selected='selected'";
		$current_offset_name = $offset_name;
	}
	echo "<option value=\"$offset\"$selected>" . sprintf(__('UTC %s'), $offset_name) . '</option>';
}
?>
</select>
<?php _e('hours') ?>
<span id="utc-time"><?php printf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), date_i18n(__('Y-m-d G:i:s'), false, 'gmt')); ?></span>
<?php if ($current_offset) : ?>
	<span id="local-time"><?php printf(__('UTC %1$s is <code>%2$s</code>'), $current_offset_name, date_i18n(__('Y-m-d G:i:s'))); ?></span>
<?php endif; ?>
<br/>
<span class="setting-description"><?php _e('Unfortunately, you have to manually update this for Daylight Savings Time. Lame, we know, but will be fixed in the future.'); ?></span>
</td>
</tr>
<tr>
<th scope="row"><?php _e('Date Format') ?></th>
<td>
	<fieldset><legend class="hidden"><?php _e('Date Format') ?></legend>
<?php

	$date_formats = apply_filters( 'date_formats', array(
		__('F j, Y'),
		'Y/m/d',
		'm/d/Y',
		'd/m/Y',
	) );

	$custom = TRUE;

	foreach ( $date_formats as $format ) {
		echo "\t<label title='" . attribute_escape($format) . "'><input type='radio' name='date_format' value='" . attribute_escape($format) . "'";
		if ( get_option('date_format') === $format ) { // checked() uses "==" rather than "==="
			echo " checked='checked'";
			$custom = FALSE;
		}
		echo ' /> ' . date_i18n( $format ) . "</label><br />\n";
	}

	echo '	<label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"';
	checked( $custom, TRUE );
	echo '/> ' . __('Custom:') . ' </label><input type="text" name="date_format_custom" value="' . attribute_escape( get_option('date_format') ) . '" class="small-text" /> ' . date_i18n( get_option('date_format') ) . "\n";

	echo "\t<p>" . __('<a href="http://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date formatting</a>. Click "Save Changes" to update sample output.') . "</p>\n";
?>
	</fieldset>
</td>
</tr>
<tr>
<th scope="row"><?php _e('Time Format') ?></th>
<td>
	<fieldset><legend class="hidden"><?php _e('Time Format') ?></legend>
<?php

	$time_formats = apply_filters( 'time_formats', array(
		__('g:i a'),
		'g:i A',
		'H:i',
	) );

	$custom = TRUE;

	foreach ( $time_formats as $format ) {
		echo "\t<label title='" . attribute_escape($format) . "'><input type='radio' name='time_format' value='" . attribute_escape($format) . "'";
		if ( get_option('time_format') === $format ) { // checked() uses "==" rather than "==="
			echo " checked='checked'";
			$custom = FALSE;
		}
		echo ' /> ' . date_i18n( $format ) . "</label><br />\n";
	}

	echo '	<label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"';
	checked( $custom, TRUE );
	echo '/> ' . __('Custom:') . ' </label><input type="text" name="time_format_custom" value="' . attribute_escape( get_option('time_format') ) . '" class="small-text" /> ' . date_i18n( get_option('time_format') ) . "\n";
?>
	</fieldset>
</td>
</tr>
<tr>
<th scope="row"><label for="start_of_week"><?php _e('Week Starts On') ?></label></th>
<td><select name="start_of_week" id="start_of_week">
<?php
for ($day_index = 0; $day_index <= 6; $day_index++) :
	$selected = (get_option('start_of_week') == $day_index) ? 'selected="selected"' : '';
	echo "\n\t<option value='$day_index' $selected>" . $wp_locale->get_weekday($day_index) . '</option>';
endfor;
?>
</select></td>
</tr>
<?php do_settings_fields('general', 'default'); ?>
</table>

<?php do_settings_sections('general'); ?>

<p class="submit">
<input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
</p>
</form>

</div>

<?php include('./admin-footer.php') ?>
                                                                                                                                                                                                                                                                                                                                                   wp-admin/options-head.php                                                                           0000755 0023422 0004734 00000000725 11050757436 016440  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress Options Header.
 *
 * Resets variables: 'action', 'standalone', and 'option_group_id'. Displays
 * updated message, if updated variable is part of the URL query.
 *
 * @package WordPress
 * @subpackage Administration
 */

wp_reset_vars(array('action', 'standalone', 'option_group_id'));
?>

<?php if (isset($_GET['updated'])) : ?>
<div id="message" class="updated fade"><p><strong><?php _e('Settings saved.') ?></strong></p></div>
<?php endif; ?>                                           wp-admin/options-misc.php                                                                           0000755 0023422 0004734 00000005014 11117531364 016460  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Miscellaneous settings administration panel.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** WordPress Administration Bootstrap */
require_once('admin.php');

$title = __('Miscellaneous Settings');
$parent_file = 'options-general.php';

include('admin-header.php');

?>

<div class="wrap">
<?php screen_icon(); ?>
<h2><?php echo wp_specialchars( $title ); ?></h2>

<form method="post" action="options.php">
<?php settings_fields('misc'); ?>

<h3><?php _e('Uploading Files'); ?></h3>
<table class="form-table">
<tr valign="top">
<th scope="row"><label for="upload_path"><?php _e('Store uploads in this folder'); ?></label></th>
<td><input name="upload_path" type="text" id="upload_path" value="<?php echo attribute_escape(str_replace(ABSPATH, '', get_option('upload_path'))); ?>" class="regular-text code" />
<span class="setting-description"><?php _e('Default is <code>wp-content/uploads</code>'); ?></span>
</td>
</tr>

<tr valign="top">
<th scope="row"><label for="upload_url_path"><?php _e('Full URL path to files'); ?></label></th>
<td><input name="upload_url_path" type="text" id="upload_url_path" value="<?php echo attribute_escape( get_option('upload_url_path')); ?>" class="regular-text code" />
<span class="setting-description"><?php _e('Configuring this is optional by default it should be blank'); ?></span>
</td>
</tr>

<tr>
<th scope="row" colspan="2" class="th-full">
<label for="uploads_use_yearmonth_folders">
<input name="uploads_use_yearmonth_folders" type="checkbox" id="uploads_use_yearmonth_folders" value="1"<?php checked('1', get_option('uploads_use_yearmonth_folders')); ?> />
<?php _e('Organize my uploads into month- and year-based folders'); ?>
</label>
</th>
</tr>
<?php do_settings_fields('misc', 'default'); ?>
</table>

<table class="form-table">

<tr>
<th scope="row" class="th-full">
<label for="use_linksupdate">
<input name="use_linksupdate" type="checkbox" id="use_linksupdate" value="1"<?php checked('1', get_option('use_linksupdate')); ?> />
<?php _e('Track Links&#8217; Update Times') ?>
</label>
</th>
</tr>
<tr>

<th scope="row" class="th-full">
<label for="hack_file">
<input type="checkbox" id="hack_file" name="hack_file" value="1"<?php checked('1', get_option('hack_file')); ?> />
<?php _e('Use legacy <code>my-hacks.php</code> file support') ?>
</label>
</th>
</tr>

</table>

<?php do_settings_sections('misc'); ?>

<p class="submit">
	<input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
</p>

</form>
</div>

<?php include('./admin-footer.php'); ?>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    wp-admin/options-permalink.php                                                                      0000755 0023422 0004734 00000020016 11117531364 017506  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Permalink settings administration panel.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** WordPress Administration Bootstrap */
require_once('admin.php');

$title = __('Permalink Settings');
$parent_file = 'options-general.php';

/**
 * Display JavaScript on the page.
 *
 * @package WordPress
 * @subpackage Permalink_Settings_Panel
 */
function add_js() {
?>
<script type="text/javascript">
//<![CDATA[
function GetElementsWithClassName(elementName, className) {
var allElements = document.getElementsByTagName(elementName);
var elemColl = new Array();
for (i = 0; i < allElements.length; i++) {
if (allElements[i].className == className) {
elemColl[elemColl.length] = allElements[i];
}
}
return elemColl;
}

function upit() {
var inputColl = GetElementsWithClassName('input', 'tog');
var structure = document.getElementById('permalink_structure');
var inputs = '';
for (i = 0; i < inputColl.length; i++) {
if ( inputColl[i].checked && inputColl[i].value != '') {
inputs += inputColl[i].value + ' ';
}
}
inputs = inputs.substr(0,inputs.length - 1);
if ( 'custom' != inputs )
structure.value = inputs;
}

function blurry() {
if (!document.getElementById) return;

var structure = document.getElementById('permalink_structure');
structure.onfocus = function () { document.getElementById('custom_selection').checked = 'checked'; }

var aInputs = document.getElementsByTagName('input');

for (var i = 0; i < aInputs.length; i++) {
aInputs[i].onclick = aInputs[i].onkeyup = upit;
}
}

window.onload = blurry;
//]]>
</script>
<?php
}
add_filter('admin_head', 'add_js');

include('admin-header.php');

$home_path = get_home_path();

if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) {
	check_admin_referer('update-permalink');

	if ( isset($_POST['permalink_structure']) ) {
		$permalink_structure = $_POST['permalink_structure'];
		if (! empty($permalink_structure) )
			$permalink_structure = preg_replace('#/+#', '/', '/' . $_POST['permalink_structure']);
		$wp_rewrite->set_permalink_structure($permalink_structure);
	}

	if ( isset($_POST['category_base']) ) {
		$category_base = $_POST['category_base'];
		if (! empty($category_base) )
			$category_base = preg_replace('#/+#', '/', '/' . $_POST['category_base']);
		$wp_rewrite->set_category_base($category_base);
	}

	if ( isset($_POST['tag_base']) ) {
		$tag_base = $_POST['tag_base'];
		if (! empty($tag_base) )
			$tag_base = preg_replace('#/+#', '/', '/' . $_POST['tag_base']);
		$wp_rewrite->set_tag_base($tag_base);
	}
}

$permalink_structure = get_option('permalink_structure');
$category_base = get_option('category_base');
$tag_base = get_option( 'tag_base' );

if ( (!file_exists($home_path.'.htaccess') && is_writable($home_path)) || is_writable($home_path.'.htaccess') )
	$writable = true;
else
	$writable = false;

if ($wp_rewrite->using_index_permalinks())
	$usingpi = true;
else
	$usingpi = false;

$wp_rewrite->flush_rules();
?>

<?php if (isset($_POST['submit'])) : ?>
<div id="message" class="updated fade"><p><?php
if ( $permalink_structure && !$usingpi && !$writable )
	_e('You should update your .htaccess now.');
else
	_e('Permalink structure updated.');
?></p></div>
<?php endif; ?>

<div class="wrap">
<?php screen_icon(); ?>
<h2><?php echo wp_specialchars( $title ); ?></h2>

<form name="form" action="options-permalink.php" method="post">
<?php wp_nonce_field('update-permalink') ?>

  <p><?php _e('By default WordPress uses web <abbr title="Universal Resource Locator">URL</abbr>s which have question marks and lots of numbers in them, however WordPress offers you the ability to create a custom URL structure for your permalinks and archives. This can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="http://codex.wordpress.org/Using_Permalinks">number of tags are available</a>, and here are some examples to get you started.'); ?></p>

<?php
$prefix = '';

if ( ! got_mod_rewrite() )
	$prefix = '/index.php';

$structures = array(
	'',
	$prefix . '/%year%/%monthnum%/%day%/%postname%/',
	$prefix . '/%year%/%monthnum%/%postname%/',
	$prefix . '/archives/%post_id%'
	);
?>
<h3><?php _e('Common settings'); ?></h3>
<table class="form-table">
	<tr>
		<th><label><input name="selection" type="radio" value="" class="tog" <?php checked('', $permalink_structure); ?> /> <?php _e('Default'); ?></label></th>
		<td><code><?php echo get_option('home'); ?>/?p=123</code></td>
	</tr>
	<tr>
		<th><label><input name="selection" type="radio" value="<?php echo $structures[1]; ?>" class="tog" <?php checked($structures[1], $permalink_structure); ?> /> <?php _e('Day and name'); ?></label></th>
		<td><code><?php echo get_option('home') . $prefix . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/sample-post/'; ?></code></td>
	</tr>
	<tr>
		<th><label><input name="selection" type="radio" value="<?php echo $structures[2]; ?>" class="tog" <?php checked($structures[2], $permalink_structure); ?> /> <?php _e('Month and name'); ?></label></th>
		<td><code><?php echo get_option('home') . $prefix . '/' . date('Y') . '/' . date('m') . '/sample-post/'; ?></code></td>
	</tr>
	<tr>
		<th><label><input name="selection" type="radio" value="<?php echo $structures[3]; ?>" class="tog" <?php checked($structures[3], $permalink_structure); ?> /> <?php _e('Numeric'); ?></label></th>
		<td><code><?php echo get_option('home') . $prefix  ; ?>/archives/123</code></td>
	</tr>
	<tr>
		<th>
			<label><input name="selection" id="custom_selection" type="radio" value="custom" class="tog"
			<?php if ( !in_array($permalink_structure, $structures) ) { ?>
			checked="checked"
			<?php } ?>
			 />
			<?php _e('Custom Structure'); ?>
			</label>
		</th>
		<td>
			<input name="permalink_structure" id="permalink_structure" type="text" value="<?php echo attribute_escape($permalink_structure); ?>" class="regular-text code" />
		</td>
	</tr>
</table>

<h3><?php _e('Optional'); ?></h3>
<?php if ($is_apache) : ?>
	<p><?php _e('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <kbd>topics</kbd> as your category base would make your category links like <code>http://example.org/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p>
<?php else : ?>
	<p><?php _e('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <code>topics</code> as your category base would make your category links like <code>http://example.org/index.php/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p>
<?php endif; ?>

<table class="form-table">
	<tr>
		<th><label for="category_base"><?php _e('Category base'); ?></label></th>
		<td><input name="category_base" id="category_base" type="text" value="<?php echo attribute_escape($category_base); ?>" class="regular-text code" /></td>
	</tr>
	<tr>
		<th><label for="tag_base"><?php _e('Tag base'); ?></label></th>
		<td><input name="tag_base" id="tag_base" type="text" value="<?php echo attribute_escape($tag_base); ?>" class="regular-text code" /></td>
	</tr>
	<?php do_settings_fields('permalink', 'optional'); ?>
</table>

<?php do_settings_sections('permalink'); ?>

<p class="submit">
	<input type="submit" name="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
</p>
  </form>
<?php if ( $permalink_structure && !$usingpi && !$writable ) : ?>
  <p><?php _e('If your <code>.htaccess</code> file were <a href="http://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn&#8217;t so these are the mod_rewrite rules you should have in your <code>.htaccess</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all.') ?></p>
<form action="options-permalink.php" method="post">
<?php wp_nonce_field('update-permalink') ?>
	<p><textarea rows="6" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo wp_specialchars($wp_rewrite->mod_rewrite_rules()); ?></textarea></p>
</form>
<?php endif; ?>

</div>

<?php require('./admin-footer.php'); ?>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  wp-admin/options-privacy.php                                                                        0000755 0023422 0004734 00000003006 11117531364 017201  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Privacy Options Settings Administration Panel.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** Load WordPress Administration Bootstrap */
require_once('./admin.php');

$title = __('Privacy Settings');
$parent_file = 'options-general.php';

include('./admin-header.php');
?>

<div class="wrap">
<?php screen_icon(); ?>
<h2><?php echo wp_specialchars( $title ); ?></h2>

<form method="post" action="options.php">
<?php settings_fields('privacy'); ?>

<table class="form-table">
<tr valign="top">
<th scope="row"><?php _e('Blog Visibility') ?> </th>
<td><fieldset><legend class="hidden"><?php _e('Blog Visibility') ?> </legend>
<p><input id="blog-public" type="radio" name="blog_public" value="1" <?php checked('1', get_option('blog_public')); ?> />
<label for="blog-public"><?php _e('I would like my blog to be visible to everyone, including search engines (like Google, Sphere, Technorati) and archivers');?></label></p>
<p><input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked('0', get_option('blog_public')); ?> />
<label for="blog-norobots"><?php _e('I would like to block search engines, but allow normal visitors'); ?></label></p>
<?php do_action('blog_privacy_selector'); ?>
</fieldset></td>
</tr>
<?php do_settings_fields('privacy', 'default'); ?>
</table>

<?php do_settings_sections('privacy'); ?>

<p class="submit">
	<input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
</p>
</form>

</div>

<?php include('./admin-footer.php') ?>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          wp-admin/options-reading.php                                                                        0000755 0023422 0004734 00000007303 11117531364 017141  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Reading settings administration panel.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** WordPress Administration Bootstrap */
require_once('admin.php');

$title = __('Reading Settings');
$parent_file = 'options-general.php';

include('admin-header.php');
?>

<div class="wrap">
<?php screen_icon(); ?>
<h2><?php echo wp_specialchars( $title ); ?></h2>

<form name="form1" method="post" action="options.php">
<?php settings_fields('reading'); ?>

<table class="form-table">
<?php if ( get_pages() ): ?>
<tr valign="top">
<th scope="row"><?php _e('Front page displays')?></th>
<td><fieldset><legend class="hidden"><?php _e('Front page displays')?></legend>
	<p><label>
		<input name="show_on_front" type="radio" value="posts" class="tog" <?php checked('posts', get_option('show_on_front')); ?> />
		<?php _e('Your latest posts'); ?>
	</label>
	</p>
	<p><label>
		<input name="show_on_front" type="radio" value="page" class="tog" <?php checked('page', get_option('show_on_front')); ?> />
		<?php printf(__('A <a href="%s">static page</a> (select below)'), 'edit-pages.php'); ?>
	</label>
	</p>
<ul>
	<li><?php printf("<label for='page_on_front'>".__('Front page: %s')."</label>", wp_dropdown_pages("name=page_on_front&echo=0&show_option_none=".__('- Select -')."&selected=" . get_option('page_on_front'))); ?></li>
	<li><?php printf("<label for='page_for_posts'>".__('Posts page: %s')."</label>", wp_dropdown_pages("name=page_for_posts&echo=0&show_option_none=".__('- Select -')."&selected=" . get_option('page_for_posts'))); ?></li>
</ul>
<?php if ( 'page' == get_option('show_on_front') && get_option('page_for_posts') == get_option('page_on_front') ) : ?>
<div id="front-page-warning" class="updated fade-ff0000">
	<p>
		<?php _e('<strong>Warning:</strong> these pages should not be the same!'); ?>
	</p>
</div>
<?php endif; ?>
</fieldset></td>
</tr>
<?php endif; ?>
<tr valign="top">
<th scope="row"><label for="posts_per_page"><?php _e('Blog pages show at most') ?></label></th>
<td>
<input name="posts_per_page" type="text" id="posts_per_page" value="<?php form_option('posts_per_page'); ?>" class="small-text" /> <?php _e('posts') ?>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="posts_per_rss"><?php _e('Syndication feeds show the most recent') ?></label></th>
<td><input name="posts_per_rss" type="text" id="posts_per_rss" value="<?php form_option('posts_per_rss'); ?>" class="small-text" /> <?php _e('posts') ?></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('For each article in a feed, show') ?> </th>
<td><fieldset><legend class="hidden"><?php _e('For each article in a feed, show') ?> </legend>
<p><label><input name="rss_use_excerpt"  type="radio" value="0" <?php checked(0, get_option('rss_use_excerpt')); ?>	/> <?php _e('Full text') ?></label><br />
<label><input name="rss_use_excerpt" type="radio" value="1" <?php checked(1, get_option('rss_use_excerpt')); ?> /> <?php _e('Summary') ?></label></p>
</fieldset></td>
</tr>

<tr valign="top">
<th scope="row"><label for="blog_charset"><?php _e('Encoding for pages and feeds') ?></label></th>
<td><input name="blog_charset" type="text" id="blog_charset" value="<?php form_option('blog_charset'); ?>" class="regular-text code" />
<span class="setting-description"><?php _e('The character encoding you write your blog in (UTF-8 is <a href="http://developer.apple.com/documentation/macos8/TextIntlSvcs/TextEncodingConversionManager/TEC1.5/TEC.b0.html">recommended</a>)') ?></span></td>
</tr>
<?php do_settings_fields('reading', 'default'); ?>
</table>

<?php do_settings_sections('reading'); ?>

<p class="submit">
	<input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
</p>
</form>
</div>
<?php include('./admin-footer.php'); ?>
                                                                                                                                                                                                                                                                                                                             wp-admin/options-writing.php                                                                        0000755 0023422 0004734 00000014132 11117531364 017211  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Writing settings administration panel.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** WordPress Administration Bootstrap */
require_once('admin.php');

$title = __('Writing Settings');
$parent_file = 'options-general.php';

include('admin-header.php');
?>

<div class="wrap">
<?php screen_icon(); ?>
<h2><?php echo wp_specialchars( $title ); ?></h2>

<form method="post" action="options.php">
<?php settings_fields('writing'); ?>

<table class="form-table">
<tr valign="top">
<th scope="row"><label for="default_post_edit_rows"> <?php _e('Size of the post box') ?></label></th>
<td><input name="default_post_edit_rows" type="text" id="default_post_edit_rows" value="<?php form_option('default_post_edit_rows'); ?>" class="small-text" />
<?php _e('lines') ?></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Formatting') ?></th>
<td><fieldset><legend class="hidden"><?php _e('Formatting') ?></legend>
<label for="use_smilies">
<input name="use_smilies" type="checkbox" id="use_smilies" value="1" <?php checked('1', get_option('use_smilies')); ?> />
<?php _e('Convert emoticons like <code>:-)</code> and <code>:-P</code> to graphics on display') ?></label><br />
<label for="use_balanceTags"><input name="use_balanceTags" type="checkbox" id="use_balanceTags" value="1" <?php checked('1', get_option('use_balanceTags')); ?> /> <?php _e('WordPress should correct invalidly nested XHTML automatically') ?></label>
</fieldset></td>
</tr>
<tr valign="top">
<th scope="row"><label for="default_category"><?php _e('Default Post Category') ?></label></th>
<td>
<?php
wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_category', 'orderby' => 'name', 'selected' => get_option('default_category'), 'hierarchical' => true));
?>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="default_link_category"><?php _e('Default Link Category') ?></label></th>
<td>
<?php
wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_link_category', 'orderby' => 'name', 'selected' => get_option('default_link_category'), 'hierarchical' => true, 'type' => 'link'));
?>
</td>
</tr>
<?php do_settings_fields('writing', 'default'); ?>
</table>

<h3><?php _e('Remote Publishing') ?></h3>
<p><?php printf(__('To post to WordPress from a desktop blogging client or remote website that uses the Atom Publishing Protocol or one of the XML-RPC publishing interfaces you must enable them below.')) ?></p>
<table class="form-table">
<tr valign="top">
<th scope="row"><?php _e('Atom Publishing Protocol') ?></th>
<td><fieldset><legend class="hidden"><?php _e('Atom Publishing Protocol') ?></legend>
<label for="enable_app">
<input name="enable_app" type="checkbox" id="enable_app" value="1" <?php checked('1', get_option('enable_app')); ?> />
<?php _e('Enable the Atom Publishing Protocol.') ?></label><br />
</fieldset></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('XML-RPC') ?></th>
<td><fieldset><legend class="hidden"><?php _e('XML-RPC') ?></legend>
<label for="enable_xmlrpc">
<input name="enable_xmlrpc" type="checkbox" id="enable_xmlrpc" value="1" <?php checked('1', get_option('enable_xmlrpc')); ?> />
<?php _e('Enable the WordPress, Movable Type, MetaWeblog and Blogger XML-RPC publishing protocols.') ?></label><br />
</fieldset></td>
</tr>
<?php do_settings_fields('writing', 'remote_publishing'); ?>
</table>

<h3><?php _e('Post via e-mail') ?></h3>
<p><?php printf(__('To post to WordPress by e-mail you must set up a secret e-mail account with POP3 access. Any mail received at this address will be posted, so it&#8217;s a good idea to keep this address very secret. Here are three random strings you could use: <kbd>%s</kbd>, <kbd>%s</kbd>, <kbd>%s</kbd>.'), wp_generate_password(8, false), wp_generate_password(8, false), wp_generate_password(8, false)) ?></p>

<table class="form-table">
<tr valign="top">
<th scope="row"><label for="mailserver_url"><?php _e('Mail Server') ?></label></th>
<td><input name="mailserver_url" type="text" id="mailserver_url" value="<?php form_option('mailserver_url'); ?>" class="regular-text" />
<label for="mailserver_port"><?php _e('Port') ?></label>
<input name="mailserver_port" type="text" id="mailserver_port" value="<?php form_option('mailserver_port'); ?>" class="small-text" />
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="mailserver_login"><?php _e('Login Name') ?></label></th>
<td><input name="mailserver_login" type="text" id="mailserver_login" value="<?php form_option('mailserver_login'); ?>" class="regular-text" /></td>
</tr>
<tr valign="top">
<th scope="row"><label for="mailserver_pass"><?php _e('Password') ?></label></th>
<td>
<input name="mailserver_pass" type="text" id="mailserver_pass" value="<?php form_option('mailserver_pass'); ?>" class="regular-text" />
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="default_email_category"><?php _e('Default Mail Category') ?></label></th>
<td>
<?php
wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_email_category', 'orderby' => 'name', 'selected' => get_option('default_email_category'), 'hierarchical' => true));
?>
</td>
</tr>
<?php do_settings_fields('writing', 'post_via_email'); ?>
</table>

<h3><?php _e('Update Services') ?></h3>

<?php if ( get_option('blog_public') ) : ?>

<p><label for="ping_sites"><?php _e('When you publish a new post, WordPress automatically notifies the following site update services. For more about this, see <a href="http://codex.wordpress.org/Update_Services">Update Services</a> on the Codex. Separate multiple service <abbr title="Universal Resource Locator">URL</abbr>s with line breaks.') ?></label></p>

<textarea name="ping_sites" id="ping_sites" class="large-text" rows="3"><?php form_option('ping_sites'); ?></textarea>

<?php else : ?>

	<p><?php printf(__('WordPress is not notifying any <a href="http://codex.wordpress.org/Update_Services">Update Services</a> because of your blog\'s <a href="%s">privacy settings</a>.'), 'options-privacy.php'); ?></p>

<?php endif; ?>

<?php do_settings_sections('writing'); ?>

<p class="submit">
	<input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
</p>
</form>
</div>

<?php include('./admin-footer.php') ?>
                                                                                                                                                                                                                                                                                                                                                                                                                                      wp-admin/options.php                                                                                0000755 0023422 0004734 00000013314 11117531364 015531  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Options Management Administration Panel.
 *
 * Just allows for displaying of options.
 *
 * This isn't referenced or linked to, but will show all of the options and
 * allow editing. The issue is that serialized data is not supported to be
 * modified. Options can not be removed.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** WordPress Administration Bootstrap */
require_once('admin.php');

$title = __('Settings');
$this_file = 'options.php';
$parent_file = 'options-general.php';

wp_reset_vars(array('action'));

$whitelist_options = array(
	'general' => array( 'blogname', 'blogdescription', 'admin_email', 'users_can_register', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'default_role' ),
	'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order', 'comment_registration' ),
	'misc' => array( 'hack_file', 'use_linksupdate', 'uploads_use_yearmonth_folders', 'upload_path', 'upload_url_path' ),
	'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type' ),
	'privacy' => array( 'blog_public' ),
	'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'blog_charset', 'show_on_front', 'page_on_front', 'page_for_posts' ),
	'writing' => array( 'default_post_edit_rows', 'use_smilies', 'ping_sites', 'mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass', 'default_category', 'default_email_category', 'use_balanceTags', 'default_link_category', 'enable_app', 'enable_xmlrpc' ),
	'options' => array( '' ) );
if ( !defined( 'WP_SITEURL' ) ) $whitelist_options['general'][] = 'siteurl';
if ( !defined( 'WP_HOME' ) ) $whitelist_options['general'][] = 'home';

$whitelist_options = apply_filters( 'whitelist_options', $whitelist_options );

if ( !current_user_can('manage_options') )
	wp_die(__('Cheatin&#8217; uh?'));

switch($action) {

case 'update':
	if ( isset($_POST[ 'option_page' ]) ) {
		$option_page = $_POST[ 'option_page' ];
		check_admin_referer( $option_page . '-options' );
	} else {
		// This is for back compat and will eventually be removed.
		$option_page = 'options';
		check_admin_referer( 'update-options' );
	}

	if ( !isset( $whitelist_options[ $option_page ] ) )
		wp_die( __( 'Error! Options page not found.' ) );

	if ( 'options' == $option_page ) {
		$options = explode(',', stripslashes( $_POST[ 'page_options' ] ));
	} else {
		$options = $whitelist_options[ $option_page ];
	}

	// Handle custom date/time formats
	if ( 'general' == $option_page ) {
		if ( !empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == stripslashes( $_POST['date_format'] ) )
			$_POST['date_format'] = $_POST['date_format_custom'];
		if ( !empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == stripslashes( $_POST['time_format'] ) )
			$_POST['time_format'] = $_POST['time_format_custom'];
	}

	if ( $options ) {
		foreach ( $options as $option ) {
			$option = trim($option);
			$value = null;
			if ( isset($_POST[$option]) )
				$value = $_POST[$option];
			if ( !is_array($value) ) $value = trim($value);
			$value = stripslashes_deep($value);
			update_option($option, $value);
		}
	}

	$goback = add_query_arg( 'updated', 'true', wp_get_referer() );
	wp_redirect( $goback );
	break;

default:
	include('admin-header.php'); ?>

<div class="wrap">
<?php screen_icon(); ?>
  <h2><?php _e('All Settings'); ?></h2>
  <form name="form" action="options.php" method="post" id="all-options">
  <?php wp_nonce_field('options-options') ?>
  <input type="hidden" name="action" value="update" />
  <input type='hidden' name='option_page' value='options' />
  <table class="form-table">
<?php
$options = $wpdb->get_results("SELECT * FROM $wpdb->options ORDER BY option_name");

foreach ( (array) $options as $option) :
	$disabled = '';
	$option->option_name = attribute_escape($option->option_name);
	if ( is_serialized($option->option_value) ) {
		if ( is_serialized_string($option->option_value) ) {
			// this is a serialized string, so we should display it
			$value = maybe_unserialize($option->option_value);
			$options_to_update[] = $option->option_name;
			$class = 'all-options';
		} else {
			$value = 'SERIALIZED DATA';
			$disabled = ' disabled="disabled"';
			$class = 'all-options disabled';
		}
	} else {
		$value = $option->option_value;
		$options_to_update[] = $option->option_name;
		$class = 'all-options';
	}
	echo "
<tr>
	<th scope='row'><label for='$option->option_name'>$option->option_name</label></th>
<td>";

	if (strpos($value, "\n") !== false) echo "<textarea class='$class' name='$option->option_name' id='$option->option_name' cols='30' rows='5'>" . wp_specialchars($value) . "</textarea>";
	else echo "<input class='regular-text $class' type='text' name='$option->option_name' id='$option->option_name' value='" . attribute_escape($value) . "'$disabled />";

	echo "</td>
</tr>";
endforeach;
?>
  </table>
<?php $options_to_update = implode(',', $options_to_update); ?>
<p class="submit"><input type="hidden" name="page_options" value="<?php echo $options_to_update; ?>" /><input type="submit" name="Update" value="<?php _e('Save Changes') ?>" class="button-primary" /></p>
  </form>
</div>


<?php
break;
} // end switch

include('admin-footer.php');
?>
                                                                                                                                                                                                                                                                                                                    wp-admin/page-new.php                                                                               0000755 0023422 0004734 00000001151 11106404720 015526  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * New page administration panel.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** WordPress Administration Bootstrap */
require_once('admin.php');
$title = __('Add New Page');
$parent_file = 'edit-pages.php';
$editing = true;
wp_enqueue_script('autosave');
wp_enqueue_script('page');
if ( user_can_richedit() )
	wp_enqueue_script('editor');
add_thickbox();
wp_enqueue_script('media-upload');
wp_enqueue_script('word-count');

if ( current_user_can('edit_pages') ) {
	$action = 'post';
	$post = get_default_page_to_edit();

	include('edit-page-form.php');
}

include('admin-footer.php');

?>
                                                                                                                                                                                                                                                                                                                                                                                                                       wp-admin/page.php                                                                                   0000755 0023422 0004734 00000014136 11116642524 014755  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Edit page administration panel.
 *
 * Manage edit page: post, edit, delete, etc.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** WordPress Administration Bootstrap */
require_once('admin.php');

$parent_file = 'edit-pages.php';
$submenu_file = 'edit-pages.php';

wp_reset_vars(array('action'));

/**
 * Redirect to previous page.
 *
 * @param int $page_ID Page ID.
 */
function redirect_page($page_ID) {
	global $action;

	$referredby = '';
	if ( !empty($_POST['referredby']) ) {
		$referredby = preg_replace('|https?://[^/]+|i', '', $_POST['referredby']);
		$referredby = remove_query_arg('_wp_original_http_referer', $referredby);
	}
	$referer = preg_replace('|https?://[^/]+|i', '', wp_get_referer());

	if ( 'post' == $_POST['originalaction'] && !empty($_POST['mode']) && 'bookmarklet' == $_POST['mode'] ) {
		$location = $_POST['referredby'];
	} elseif ( 'post' == $_POST['originalaction'] && !empty($_POST['mode']) && 'sidebar' == $_POST['mode'] ) {
		$location = 'sidebar.php?a=b';
	} elseif ( ( isset($_POST['save']) || isset($_POST['publish']) ) && ( empty($referredby) || $referredby == $referer || 'redo' != $referredby ) ) {
		if ( isset($_POST['_wp_original_http_referer']) && strpos( $_POST['_wp_original_http_referer'], '/wp-admin/page.php') === false && strpos( $_POST['_wp_original_http_referer'], '/wp-admin/page-new.php') === false )
			$location = add_query_arg( array(
				'_wp_original_http_referer' => urlencode( stripslashes( $_POST['_wp_original_http_referer'] ) ),
				'message' => 1
			), get_edit_post_link( $page_ID, 'url' ) );
		else {
			if ( isset( $_POST['publish'] ) ) {
				if ( 'pending' == get_post_status( $page_ID ) )
					$location = add_query_arg( 'message', 6, get_edit_post_link( $page_ID, 'url' ) );
				else
					$location = add_query_arg( 'message', 5, get_edit_post_link( $page_ID, 'url' ) );
			} else {
				$location = add_query_arg( 'message', 4, get_edit_post_link( $page_ID, 'url' ) );
			}
		}
	} elseif ( isset($_POST['addmeta']) ) {
		$location = add_query_arg( 'message', 2, wp_get_referer() );
		$location = explode('#', $location);
		$location = $location[0] . '#postcustom';
	} elseif ( isset($_POST['deletemeta']) ) {
		$location = add_query_arg( 'message', 3, wp_get_referer() );
		$location = explode('#', $location);
		$location = $location[0] . '#postcustom';
	} elseif (!empty($referredby) && $referredby != $referer) {
		$location = $_POST['referredby'];
		$location = remove_query_arg('_wp_original_http_referer', $location);
		if ( false !== strpos($location, 'edit-pages.php') )
			$location = add_query_arg('posted', $page_ID, $location);
		elseif ( false !== strpos($location, 'wp-admin') )
			$location = "page-new.php?posted=$page_ID";
	} elseif ( isset($_POST['publish']) ) {
		$location = "page-new.php?posted=$page_ID";
	} elseif ($action == 'editattachment') {
		$location = 'attachments.php';
	} else {
		$location = add_query_arg( 'message', 4, get_edit_post_link( $page_ID, 'url' ) );
	}

	wp_redirect($location);
}

if (isset($_POST['deletepost']))
	$action = "delete";
elseif ( isset($_POST['wp-preview']) && 'dopreview' == $_POST['wp-preview'] )
	$action = 'preview';

switch($action) {
case 'post':
	check_admin_referer('add-page');
	$page_ID = write_post();

	redirect_page($page_ID);

	exit();
	break;

case 'edit':
	$title = __('Edit Page');
	$editing = true;
	$page_ID = $post_ID = $p = (int) $_GET['post'];
	$post = get_post_to_edit($page_ID);

	if ( empty($post->ID) ) wp_die( __("You attempted to edit a page that doesn't exist. Perhaps it was deleted?") );

	if ( 'page' != $post->post_type ) {
		wp_redirect( get_edit_post_link( $post_ID, 'url' ) );
		exit();
	}

	wp_enqueue_script('page');
	if ( user_can_richedit() )
		wp_enqueue_script('editor');
	add_thickbox();
	wp_enqueue_script('media-upload');
	wp_enqueue_script('word-count');

	if ( current_user_can('edit_page', $page_ID) ) {
		if ( $last = wp_check_post_lock( $post->ID ) ) {
			$last_user = get_userdata( $last );
			$last_user_name = $last_user ? $last_user->display_name : __('Somebody');
			$message = sprintf( __( 'Warning: %s is currently editing this page' ), wp_specialchars( $last_user_name ) );
			$message = str_replace( "'", "\'", "<div class='error'><p>$message</p></div>" );
			add_action('admin_notices', create_function( '', "echo '$message';" ) );
		} else {
			wp_set_post_lock( $post->ID );
			wp_enqueue_script('autosave');
		}
	}

	if ( !current_user_can('edit_page', $page_ID) )
		die ( __('You are not allowed to edit this page.') );

	include('edit-page-form.php');
	break;

case 'editattachment':
	$page_id = $post_ID = (int) $_POST['post_ID'];
	check_admin_referer('update-attachment_' . $page_id);

	// Don't let these be changed
	unset($_POST['guid']);
	$_POST['post_type'] = 'attachment';

	// Update the thumbnail filename
	$newmeta = wp_get_attachment_metadata( $page_id, true );
	$newmeta['thumb'] = $_POST['thumb'];

	wp_update_attachment_metadata( $newmeta );

case 'editpost':
	$page_ID = (int) $_POST['post_ID'];
	check_admin_referer('update-page_' . $page_ID);

	$page_ID = edit_post();

	redirect_page($page_ID);

	exit();
	break;

case 'delete':
	$page_id = (isset($_GET['post']))  ? intval($_GET['post']) : intval($_POST['post_ID']);
	check_admin_referer('delete-page_' .  $page_id);

	$page = & get_post($page_id);

	if ( !current_user_can('delete_page', $page_id) )
		wp_die( __('You are not allowed to delete this page.') );

	if ( $page->post_type == 'attachment' ) {
		if ( ! wp_delete_attachment($page_id) )
			wp_die( __('Error in deleting...') );
	} else {
		if ( !wp_delete_post($page_id) )
			wp_die( __('Error in deleting...') );
	}

	$sendback = wp_get_referer();
	if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('edit-pages.php?deleted=1');
	elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
	else $sendback = add_query_arg('deleted', 1, $sendback);
	wp_redirect($sendback);
	exit();
	break;

case 'preview':
	check_admin_referer( 'autosave', 'autosavenonce' );

	$url = post_preview();

	wp_redirect($url);
	exit();
	break;

default:
	wp_redirect('edit-pages.php');
	exit();
	break;
} // end switch
include('admin-footer.php');
?>
                                                                                                                                                                                                                                                                                                                                                                                                                                  wp-admin/plugin-editor.php                                                                          0000755 0023422 0004734 00000012535 11117531364 016624  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Edit plugin editor administration panel.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** WordPress Administration Bootstrap */
require_once('admin.php');

$title = __("Edit Plugins");
$parent_file = 'plugins.php';

wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file'));

wp_admin_css( 'theme-editor' );

$plugins = get_plugins();
$plugin_files = array_keys($plugins);

if (empty($file))
	$file = $plugin_files[0];

$file = validate_file_to_edit($file, $plugin_files);
$real_file = WP_PLUGIN_DIR . '/' . $file;

switch($action) {

case 'update':

	check_admin_referer('edit-plugin_' . $file);

	if ( !current_user_can('edit_plugins') )
		wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');

	$newcontent = stripslashes($_POST['newcontent']);
	if ( is_writeable($real_file) ) {
		$f = fopen($real_file, 'w+');
		fwrite($f, $newcontent);
		fclose($f);

		// Deactivate so we can test it.
		if ( is_plugin_active($file) || isset($_POST['phperror']) ) {
			if ( is_plugin_active($file) )
				deactivate_plugins($file, true);
			wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1"));
			exit;
		}
		wp_redirect("plugin-editor.php?file=$file&a=te");
	} else {
		wp_redirect("plugin-editor.php?file=$file");
	}
	exit;

break;

default:

	if ( !current_user_can('edit_plugins') )
		wp_die('<p>'.__('You do not have sufficient permissions to edit plugins for this blog.').'</p>');

	if ( isset($_GET['liveupdate']) ) {
		check_admin_referer('edit-plugin-test_' . $file);

		$error = validate_plugin($file);
		if( is_wp_error($error) )
			wp_die( $error );

		if ( ! is_plugin_active($file) )
			activate_plugin($file, "plugin-editor.php?file=$file&phperror=1");// we'll override this later if the plugin can be included without fatal error

		wp_redirect("plugin-editor.php?file=$file&a=te");
		exit;
	}

	require_once('admin-header.php');

	update_recently_edited(WP_PLUGIN_DIR . '/' . $file);

	if ( ! is_file($real_file) )
		$error = 1;

	if ( ! $error )
		$content = htmlspecialchars(file_get_contents($real_file));

	?>
<?php if (isset($_GET['a'])) : ?>
 <div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
<?php elseif (isset($_GET['phperror'])) : ?>
 <div id="message" class="updated fade"><p><?php _e('This plugin has been deactivated because your changes resulted in a <strong>fatal error</strong>.') ?></p>
	<?php
		if ( wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $file) ) { ?>
	<iframe style="border:0" width="100%" height="70px" src="<?php bloginfo('wpurl'); ?>/wp-admin/plugins.php?action=error_scrape&amp;plugin=<?php echo attribute_escape($file); ?>&amp;_wpnonce=<?php echo attribute_escape($_GET['_error_nonce']); ?>"></iframe>
	<?php } ?>
</div>
<?php endif; ?>
<div class="wrap">
<?php screen_icon(); ?>
<h2><?php echo wp_specialchars( $title ); ?></h2>

<div class="tablenav">
<div class="alignleft">
<big><?php
	if ( is_plugin_active($file) ) {
		if ( is_writeable($real_file) )
			echo sprintf(__('Editing <strong>%s</strong> (active)'), $file);
		else
			echo sprintf(__('Browsing <strong>%s</strong> (active)'), $file);
	} else {
		if ( is_writeable($real_file) )
			echo sprintf(__('Editing <strong>%s</strong> (inactive)'), $file);
		else
			echo sprintf(__('Browsing <strong>%s</strong> (inactive)'), $file);
	}
	?></big>
</div>
<br class="clear" />
</div>
<br class="clear" />
	<div id="templateside">
	<h3 id="bordertitle"><?php _e('Plugin Files'); ?></h3>

	<h4><?php _e('Plugins'); ?></h4>
	<ul>
<?php foreach($plugin_files as $plugin_file) : ?>
		<li><a href="plugin-editor.php?file=<?php echo $plugin_file; ?>"><?php echo $plugins[$plugin_file]['Name']; ?></a></li>
<?php endforeach; ?>
	</ul>
	</div>
<?php	if ( ! $error ) { ?>
	<form name="template" id="template" action="plugin-editor.php" method="post">
	<?php wp_nonce_field('edit-plugin_' . $file) ?>
		<div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
		<input type="hidden" name="action" value="update" />
		<input type="hidden" name="file" value="<?php echo $file ?>" />
		</div>
<?php if ( is_writeable($real_file) ) : ?>
	<?php if ( in_array($file, (array) get_option('active_plugins')) ) { ?>
		<p><?php _e('<strong>Warning:</strong> Making changes to active plugins is not recommended.  If your changes cause a fatal error, the plugin will be automatically deactivated.'); ?></p>
	<?php } ?>
	<p class="submit">
	<?php
		if ( isset($_GET['phperror']) )
			echo "<input type='hidden' name='phperror' value='1' /><input type='submit' name='submit' class='button-primary' value='" . __('Update File and Attempt to Reactivate') . "' tabindex='2' />";
		else
			echo "<input type='submit' name='submit' class='button-primary' value='" . __('Update File') . "' tabindex='2' />";
	?>
	</p>
<?php else : ?>
	<p><em><?php _e('You need to make this file writable before you can save your changes. See <a href="http://codex.wordpress.org/Changing_File_Permissions">the Codex</a> for more information.'); ?></em></p>
<?php endif; ?>
 </form>
<?php
	} else {
		echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
	}
?>
<div class="clear"> &nbsp; </div>
</div>
<?php
	break;
}
include("admin-footer.php") ?>                                                                                                                                                                   wp-admin/plugins.php                                                                                0000755 0023422 0004734 00000036103 11117531364 015520  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Plugins administration panel.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** WordPress Administration Bootstrap */
require_once('admin.php');

$action = '';
foreach( array('activate-selected', 'deactivate-selected', 'delete-selected', 'clear-recent-list') as $action_key ) {
	if( isset($_POST[$action_key]) ) {
		$action = $action_key;
		break;
	}
}

if( isset($_REQUEST['action']) && !empty($_REQUEST['action']) )
	$action = $_REQUEST['action'];

$plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : '';

if( !empty($action) ) {
	switch( $action ) {
		case 'activate':
			check_admin_referer('activate-plugin_' . $plugin);
			$result = activate_plugin($plugin, 'plugins.php?error=true&plugin=' . $plugin);
			if ( is_wp_error( $result ) )
				wp_die($result);
			$recent = (array)get_option('recently_activated');
			if ( isset($recent[ $plugin ]) ) {
				unset($recent[ $plugin ]);
				update_option('recently_activated', $recent);
			}
			wp_redirect('plugins.php?activate=true'); // overrides the ?error=true one above
			exit;
			break;
		case 'activate-selected':
			check_admin_referer('bulk-manage-plugins');
			activate_plugins($_POST['checked'], 'plugins.php?error=true');

			$recent = (array)get_option('recently_activated');
			foreach( (array)$_POST['checked'] as $plugin => $time) {
				if ( isset($recent[ $plugin ]) )
					unset($recent[ $plugin ]);
			}
			if( $recent != get_option('recently_activated') ) //If array changed, update it.
				update_option('recently_activated', $recent);

			wp_redirect('plugins.php?activate-multi=true');
			exit;
			break;
		case 'error_scrape':
			check_admin_referer('plugin-activation-error_' . $plugin);
			$valid = validate_plugin($plugin);
			if ( is_wp_error($valid) )
				wp_die($valid);
			error_reporting( E_ALL ^ E_NOTICE );
			@ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
			include(WP_PLUGIN_DIR . '/' . $plugin);
			do_action('activate_' . $plugin);
			exit;
			break;
		case 'deactivate':
			check_admin_referer('deactivate-plugin_' . $plugin);
			deactivate_plugins($plugin);
			update_option('recently_activated', array($plugin => time()) + (array)get_option('recently_activated'));
			wp_redirect('plugins.php?deactivate=true');
			exit;
			break;
		case 'deactivate-selected':
			check_admin_referer('bulk-manage-plugins');
			deactivate_plugins($_POST['checked']);
			$deactivated = array();
			foreach ( (array)$_POST['checked'] as $plugin )
				$deactivated[ $plugin ] = time();
			update_option('recently_activated', $deactivated + (array)get_option('recently_activated'));
			wp_redirect('plugins.php?deactivate-multi=true');
			exit;
			break;
		case 'delete-selected':
			if ( ! current_user_can('delete_plugins') )
				wp_die(__('You do not have sufficient permissions to delete plugins for this blog.'));

			check_admin_referer('bulk-manage-plugins');

			$plugins = $_REQUEST['checked']; //$_POST = from the plugin form; $_GET = from the FTP details screen.
			include(ABSPATH . 'wp-admin/update.php');

			$title = __('Delete Plugin');
			$parent_file = 'plugins.php';

			if ( ! isset($_REQUEST['verify-delete']) ) {
				wp_enqueue_script('jquery');
				require_once('admin-header.php');
				?>
			<div class="wrap">
				<h2><?php _e('Delete Plugin(s)'); ?></h2>
				<?php
					$files_to_delete = $plugin_info = array();
					foreach ( (array) $plugins as $plugin ) {
						if ( '.' == dirname($plugin) ) {
							$files_to_delete[] = WP_PLUGIN_DIR . '/' . $plugin;
							if( $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin) )
								$plugin_info[ $plugin ] = $data;
						} else {
							//Locate all the files in that folder:
							$files = list_files( WP_PLUGIN_DIR . '/' . dirname($plugin) );
							if( $files ) {
								$files_to_delete = array_merge($files_to_delete, $files);
							}
							//Get plugins list from that folder
							if ( $folder_plugins = get_plugins( '/' . dirname($plugin)) )
								$plugin_info = array_merge($plugin_info, $folder_plugins);
						}
					}
				?>
				<p><?php _e('Deleting the selected plugins will remove the following plugin(s) and their files:'); ?></p>
					<ul>
						<?php
						foreach ( $plugin_info as $plugin )
							echo '<li>', sprintf(__('%s by %s'), $plugin['Name'], $plugin['Author']), '</li>';
						?>
					</ul>
				<p><?php _e('Are you sure you wish to delete these files?') ?></p>
				<form method="post" action="<?php echo clean_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;">
					<input type="hidden" name="verify-delete" value="1" />
					<input type="hidden" name="delete-selected" value="1" />
					<?php
						foreach ( (array)$plugins as $plugin )
							echo '<input type="hidden" name="checked[]" value="' . attribute_escape($plugin) . '" />';
					?>
					<?php wp_nonce_field('bulk-manage-plugins') ?>
					<input type="submit" name="submit" value="<?php _e('Yes, Delete these files') ?>" class="button" />
				</form>
				<form method="post" action="<?php echo clean_url(wp_get_referer()); ?>" style="display:inline;">
					<input type="submit" name="submit" value="<?php _e('No, Return me to the plugin list') ?>" class="button" />
				</form>

				<p><a href="#" onclick="jQuery('#files-list').toggle(); return false;"><?php _e('Click to view entire list of files which will be deleted'); ?></a></p>
				<div id="files-list" style="display:none;">
					<ul>
					<?php
						foreach ( (array)$files_to_delete as $file )
							echo '<li>' . str_replace(WP_PLUGIN_DIR, '', $file) . '</li>';
					?>
					</ul>
				</div>
			</div>
				<?php
				require_once('admin-footer.php');
				exit;
			} //Endif verify-delete
			$delete_result = delete_plugins($plugins);

			wp_cache_delete('plugins', 'plugins');
			break;
		case 'clear-recent-list':
			update_option('recently_activated', array());
			break;
	}
}

wp_enqueue_script('plugin-install');
add_thickbox();

$title = __('Manage Plugins');
require_once('admin-header.php');

$invalid = validate_active_plugins();
if ( !empty($invalid) )
	foreach ( $invalid as $plugin_file => $error )
		echo '<div id="message" class="error"><p>' . sprintf(__('The plugin <code>%s</code> has been <strong>deactivated</strong> due to an error: %s'), wp_specialchars($plugin_file), $error->get_error_message()) . '</p></div>';
?>

<?php if ( isset($_GET['error']) ) : ?>
	<div id="message" class="updated fade"><p><?php _e('Plugin could not be activated because it triggered a <strong>fatal error</strong>.') ?></p>
	<?php
		if ( wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $plugin) ) { ?>
	<iframe style="border:0" width="100%" height="70px" src="<?php echo admin_url('plugins.php?action=error_scrape&amp;plugin=' . attribute_escape($plugin) . '&amp;_wpnonce=' . attribute_escape($_GET['_error_nonce'])); ?>"></iframe>
	<?php
		}
	?>
	</div>
<?php elseif ( 'delete-selected' == $action ) :
		if ( is_wp_error($delete_result) ) : ?>
		<div id="message" class="updated fade"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message() ); ?></p></div>
		<?php else : ?>
		<div id="message" class="updated fade"><p><?php _e('The selected plugins have been <strong>deleted</strong>.'); ?></p></div>
		<?php endif; ?>
<?php elseif ( isset($_GET['activate']) ) : ?>
	<div id="message" class="updated fade"><p><?php _e('Plugin <strong>activated</strong>.') ?></p></div>
<?php elseif (isset($_GET['activate-multi'])) : ?>
	<div id="message" class="updated fade"><p><?php _e('Selected plugins <strong>activated</strong>.'); ?></p></div>
<?php elseif ( isset($_GET['deactivate']) ) : ?>
	<div id="message" class="updated fade"><p><?php _e('Plugin <strong>deactivated</strong>.') ?></p></div>
<?php elseif (isset($_GET['deactivate-multi'])) : ?>
	<div id="message" class="updated fade"><p><?php _e('Selected plugins <strong>deactivated</strong>.'); ?></p></div>
<?php endif; ?>

<div class="wrap">
<?php screen_icon(); ?>
	<h2><?php echo wp_specialchars( $title ); ?></h2>

<p><?php _e('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.'); ?></p>
<?php

$all_plugins = get_plugins();
$active_plugins = array();
$inactive_plugins = array();
$recent_plugins = array();
$recently_activated = (array) get_option('recently_activated');

//Clean out any plugins which were deactivated over a week ago.
foreach ( $recently_activated as $key => $time )
	if ( $time + (7*24*60*60) < time() ) //1 week
		unset($recently_activated[ $key ]);
if ( $recently_activated != get_option('recently_activated') ) //If array changed, update it.
	update_option('recently_activated', $recently_activated);

foreach ( (array)$all_plugins as $plugin_file => $plugin_data) {

	//Translate, Apply Markup, Sanitize HTML
	$plugin_data = _get_plugin_data_markup_translate($plugin_data, true, true);

	//Filter into individual sections
	if ( is_plugin_active($plugin_file) ) {
		$active_plugins[ $plugin_file ] = $plugin_data;
	} else {
		if ( isset( $recently_activated[ $plugin_file ] ) ) //Was the plugin recently activated?
			$recent_plugins[ $plugin_file ] = $plugin_data;
		else
			$inactive_plugins[ $plugin_file ] = $plugin_data;
	}
}

?>

<?php
/**
 * @ignore
 *
 * @param array $plugins
 * @param string $context
 */
function print_plugins_table($plugins, $context = '') {
?>
<table class="widefat" cellspacing="0" id="<?php echo $context ?>-plugins-table">
	<thead>
	<tr>
		<th scope="col" class="check-column"><input type="checkbox" /></th>
		<th scope="col"><?php _e('Plugin'); ?></th>
		<th scope="col" class="num"><?php _e('Version'); ?></th>
		<th scope="col"><?php _e('Description'); ?></th>
		<th scope="col" class="action-links"><?php _e('Action'); ?></th>
	</tr>
	</thead>

	<tfoot>
	<tr>
		<th scope="col" class="check-column"><input type="checkbox" /></th>
		<th scope="col"><?php _e('Plugin'); ?></th>
		<th scope="col" class="num"><?php _e('Version'); ?></th>
		<th scope="col"><?php _e('Description'); ?></th>
		<th scope="col" class="action-links"><?php _e('Action'); ?></th>
	</tr>
	</tfoot>

	<tbody class="plugins">
<?php

	if ( empty($plugins) ) {
		echo '<tr>
			<td colspan="6">' . __('No plugins to show') . '</td>
		</tr>';
	}
	foreach ( (array)$plugins as $plugin_file => $plugin_data) {
		$action_links = array();

		if ( 'active' == $context )
			$action_links[] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&amp;plugin=' . $plugin_file, 'deactivate-plugin_' . $plugin_file) . '" title="' . __('Deactivate this plugin') . '">' . __('Deactivate') . '</a>';
		else //Inactive or Recently deactivated
			$action_links[] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>';

		if ( current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
			$action_links[] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . __('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>';

		$action_links = apply_filters( 'plugin_action_links', $action_links, $plugin_file, $plugin_data, $context );
		$action_links = apply_filters( "plugin_action_links_$plugin_file", $action_links, $plugin_file, $plugin_data, $context );

		echo "
	<tr class='$context'>
		<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . attribute_escape($plugin_file) . "' /></th>
		<td class='name'>{$plugin_data['Title']}</td>
		<td class='vers'>{$plugin_data['Version']}</td>
		<td class='desc'><p>{$plugin_data['Description']}</p></td>
		<td class='togl action-links'>";
		if ( !empty($action_links) )
			echo implode(' | ', $action_links);
		echo '</td>
	</tr>';
		do_action( 'after_plugin_row', $plugin_file, $plugin_data, $context );
		do_action( "after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $context );
	}
?>
	</tbody>
</table>
<?php
} //End print_plugins_table()

/**
 * @ignore
 *
 * @param string $context
 */
function print_plugin_actions($context) {
?>
	<div class="alignleft actions">
		<select name="action">
			<option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
	<?php if( 'active' != $context ) : ?>
			<option value="activate-selected"><?php _e('Activate'); ?></option>
	<?php endif; ?>
	<?php if ( 'active' == $context ) : ?>
			<option value="deactivate-selected"><?php _e('Deactivate'); ?></option>
	<?php endif; ?>
	<?php if( current_user_can('delete_plugins') && ( 'recent' == $context || 'inactive' == $context ) ) : ?>
			<option value="delete-selected"><?php _e('Delete'); ?></option>
	<?php endif; ?>
		</select>
		<input type="submit" name="doaction_active" value="<?php _e('Apply'); ?>" class="button-secondary action" />
	<?php if( 'recent' == $context ) : ?>
		<input type="submit" name="clear-recent-list" value="<?php _e('Clear List') ?>" class="button-secondary" />
	<?php endif; ?>
	</div>
<?php
}
?>

<?php if ( ! empty($active_plugins) ) : ?>
<h3 id="currently-active"><?php _e('Currently Active Plugins') ?></h3>
<form method="post" action="<?php echo admin_url('plugins.php') ?>">
<?php wp_nonce_field('bulk-manage-plugins') ?>

<div class="tablenav">
<?php print_plugin_actions('active') ?>
</div>
<div class="clear"></div>
<?php print_plugins_table($active_plugins, 'active') ?>
</form>

<p><?php printf(__('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), WP_PLUGIN_DIR); ?></p>
<?php endif; ?>

<?php if ( ! empty($recent_plugins) ) : ?>
<h3 id="recent-plugins"><?php _e('Recently Active Plugins') ?></h3>
<p><?php _e('The following plugins were recently active. When a plugin has been inactive for more than 7 days it will be moved to the Inactive plugin list.') ?></p>
<form method="post" action="<?php echo admin_url('plugins.php') ?>">
<?php wp_nonce_field('bulk-manage-plugins') ?>

<div class="tablenav">
<?php print_plugin_actions('recent') ?>
</div>
<div class="clear"></div>
<?php print_plugins_table($recent_plugins, 'recent') ?>
</form>
<?php endif; ?>

<?php if ( ! empty($inactive_plugins) ) : ?>
<h3 id="inactive-plugins"><?php _e('Inactive Plugins') ?></h3>
<form method="post" action="<?php echo admin_url('plugins.php') ?>">
<?php wp_nonce_field('bulk-manage-plugins') ?>

<div class="tablenav">
<?php print_plugin_actions('inactive') ?>
</div>
<div class="clear"></div>
<?php print_plugins_table($inactive_plugins, 'inactive') ?>
</form>
<?php endif; ?>

<?php if ( empty($all_plugins) ) : ?>
<p><?php _e('You do not appear to have any plugins available at this time.') ?></p>
<?php endif; ?>

<h2><?php _e('Get More Plugins'); ?></h2>
<p><?php _e('You can find additional plugins for your site by using the new <a href="plugin-install.php">Plugin Browser/Installer</a> functionality, Or by browsing the <a href="http://wordpress.org/extend/plugins/">WordPress Plugin Directory</a> directly and installing manually.'); ?></p>
<p><?php printf(__('To <em>manually</em> install a plugin you generally just need to upload the plugin file into your <code>%s</code> directory.'), WP_PLUGIN_DIR); ?></p>
<p><?php _e('Once a plugin has been installed, you may activate it here.'); ?></p>

</div>

<?php
include('admin-footer.php');
?>
                                                                                                                                                                                                                                                                                                                                                                                                                                                             wp-admin/post-new.php                                                                               0000755 0023422 0004734 00000002177 11106404720 015610  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * New Post Administration Panel.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** Load WordPress Administration Bootstrap */
require_once('admin.php');
$title = __('Add New Post');
$parent_file = 'edit.php';
$editing = true;
wp_enqueue_script('autosave');
wp_enqueue_script('post');
if ( user_can_richedit() )
	wp_enqueue_script('editor');
add_thickbox();
wp_enqueue_script('media-upload');
wp_enqueue_script('word-count');

if ( ! current_user_can('edit_posts') ) {
	require_once ('./admin-header.php'); ?>
<div class="wrap">
<p><?php printf(__('Since you&#8217;re a newcomer, you&#8217;ll have to wait for an admin to add the <code>edit_posts</code> capability to your user, in order to be authorized to post.<br />
You can also <a href="mailto:%s?subject=Promotion?">e-mail the admin</a> to ask for a promotion.<br />
When you&#8217;re promoted, just reload this page and you&#8217;ll be able to blog. :)'), get_option('admin_email')); ?>
</p>
</div>
<?php
	include('admin-footer.php');
	exit();
}

// Show post form.
$post = get_default_post_to_edit();
include('edit-form-advanced.php');

include('admin-footer.php');
?>
                                                                                                                                                                                                                                                                                                                                                                                                 wp-admin/post.php                                                                                   0000755 0023422 0004734 00000017055 11116642524 015031  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Edit post administration panel.
 *
 * Manage Post actions: post, edit, delete, etc.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** WordPress Administration Bootstrap */
require_once('admin.php');

$parent_file = 'edit.php';
$submenu_file = 'edit.php';

wp_reset_vars(array('action', 'safe_mode', 'withcomments', 'posts', 'content', 'edited_post_title', 'comment_error', 'profile', 'trackback_url', 'excerpt', 'showcomments', 'commentstart', 'commentend', 'commentorder'));

/**
 * Redirect to previous page.
 *
 * @param int $post_ID Optional. Post ID.
 */
function redirect_post($post_ID = '') {
	global $action;

	$referredby = '';
	if ( !empty($_POST['referredby']) ) {
		$referredby = preg_replace('|https?://[^/]+|i', '', $_POST['referredby']);
		$referredby = remove_query_arg('_wp_original_http_referer', $referredby);
	}
	$referer = preg_replace('|https?://[^/]+|i', '', wp_get_referer());

	if ( !empty($_POST['mode']) && 'bookmarklet' == $_POST['mode'] ) {
		$location = $_POST['referredby'];
	} elseif ( !empty($_POST['mode']) && 'sidebar' == $_POST['mode'] ) {
		if ( isset($_POST['saveasdraft']) )
			$location = 'sidebar.php?a=c';
		elseif ( isset($_POST['publish']) )
			$location = 'sidebar.php?a=b';
	} elseif ( ( isset($_POST['save']) || isset($_POST['publish']) ) && ( empty($referredby) || $referredby == $referer || 'redo' != $referredby ) ) {
		if ( isset($_POST['_wp_original_http_referer']) && strpos( $_POST['_wp_original_http_referer'], '/wp-admin/post.php') === false && strpos( $_POST['_wp_original_http_referer'], '/wp-admin/post-new.php') === false )
			$location = add_query_arg( array(
				'_wp_original_http_referer' => urlencode( stripslashes( $_POST['_wp_original_http_referer'] ) ),
				'message' => 1
			), get_edit_post_link( $post_ID, 'url' ) );
		else {
			if ( isset( $_POST['publish'] ) ) {
				if ( 'pending' == get_post_status( $post_ID ) )
					$location = add_query_arg( 'message', 8, get_edit_post_link( $post_ID, 'url' ) );
				else
					$location = add_query_arg( 'message', 6, get_edit_post_link( $post_ID, 'url' ) );
			} else {
				$location = add_query_arg( 'message', 7, get_edit_post_link( $post_ID, 'url' ) );
			}
		}
	} elseif (isset($_POST['addmeta']) && $_POST['addmeta']) {
		$location = add_query_arg( 'message', 2, wp_get_referer() );
		$location = explode('#', $location);
		$location = $location[0] . '#postcustom';
	} elseif (isset($_POST['deletemeta']) && $_POST['deletemeta']) {
		$location = add_query_arg( 'message', 3, wp_get_referer() );
		$location = explode('#', $location);
		$location = $location[0] . '#postcustom';
	} elseif (!empty($referredby) && $referredby != $referer) {
		$location = $_POST['referredby'];
		$location = remove_query_arg('_wp_original_http_referer', $location);
		if ( false !== strpos($location, 'edit.php') || false !== strpos($location, 'edit-post-drafts.php') )
			$location = add_query_arg('posted', $post_ID, $location);
		elseif ( false !== strpos($location, 'wp-admin') )
			$location = "post-new.php?posted=$post_ID";
	} elseif ( isset($_POST['publish']) ) {
		$location = "post-new.php?posted=$post_ID";
	} elseif ($action == 'editattachment') {
		$location = 'attachments.php';
	} elseif ( 'post-quickpress-save-cont' == $_POST['action'] ) {
		$location = "post.php?action=edit&post=$post_ID&message=7";
	} else {
		$location = add_query_arg( 'message', 4, get_edit_post_link( $post_ID, 'url' ) );
	}

	wp_redirect( $location );
}

if ( isset( $_POST['deletepost'] ) )
	$action = 'delete';
elseif ( isset($_POST['wp-preview']) && 'dopreview' == $_POST['wp-preview'] )
	$action = 'preview';

switch($action) {
case 'postajaxpost':
case 'post':
case 'post-quickpress-publish':
case 'post-quickpress-save':
	check_admin_referer('add-post');

	if ( 'post-quickpress-publish' == $action )
		$_POST['publish'] = 'publish'; // tell write_post() to publish

	if ( 'post-quickpress-publish' == $action || 'post-quickpress-save' == $action ) {
		$_POST['comment_status'] = get_option('default_comment_status');
		$_POST['ping_status'] = get_option('default_ping_status');
	}

	if ( !empty( $_POST['quickpress_post_ID'] ) ) {
		$_POST['post_ID'] = (int) $_POST['quickpress_post_ID'];
		$post_ID = edit_post();
	} else {
		$post_ID = 'postajaxpost' == $action ? edit_post() : write_post();
	}

	if ( 0 === strpos( $action, 'post-quickpress' ) ) {
		$_POST['post_ID'] = $post_ID;
		// output the quickpress dashboard widget
		require_once(ABSPATH . 'wp-admin/includes/dashboard.php');
		wp_dashboard_quick_press();
		exit;
	}

	redirect_post($post_ID);
	exit();
	break;

case 'edit':
	$editing = true;

	if ( empty( $_GET['post'] ) ) {
		wp_redirect("post.php");
		exit();
	}
	$post_ID = $p = (int) $_GET['post'];
	$post = get_post($post_ID);

	if ( empty($post->ID) ) wp_die( __("You attempted to edit a post that doesn't exist. Perhaps it was deleted?") );

	if ( 'post' != $post->post_type ) {
		wp_redirect( get_edit_post_link( $post->ID, 'url' ) );
		exit();
	}

	wp_enqueue_script('post');
	if ( user_can_richedit() )
		wp_enqueue_script('editor');
	add_thickbox();
	wp_enqueue_script('media-upload');
	wp_enqueue_script('word-count');
	wp_enqueue_script( 'admin-comments' );
	enqueue_comment_hotkeys_js();

	if ( current_user_can('edit_post', $post_ID) ) {
		if ( $last = wp_check_post_lock( $post->ID ) ) {
			$last_user = get_userdata( $last );
			$last_user_name = $last_user ? $last_user->display_name : __('Somebody');
			$message = sprintf( __( 'Warning: %s is currently editing this post' ), wp_specialchars( $last_user_name ) );
			$message = str_replace( "'", "\'", "<div class='error'><p>$message</p></div>" );
			add_action('admin_notices', create_function( '', "echo '$message';" ) );
		} else {
			wp_set_post_lock( $post->ID );
			wp_enqueue_script('autosave');
		}
	}

	$title = __('Edit Post');

	if ( !current_user_can('edit_post', $post_ID) )
		die ( __('You are not allowed to edit this post.') );

	$post = get_post_to_edit($post_ID);

	include('edit-form-advanced.php');

	break;

case 'editattachment':
	$post_id = (int) $_POST['post_ID'];

	check_admin_referer('update-attachment_' . $post_id);

	// Don't let these be changed
	unset($_POST['guid']);
	$_POST['post_type'] = 'attachment';

	// Update the thumbnail filename
	$newmeta = wp_get_attachment_metadata( $post_id, true );
	$newmeta['thumb'] = $_POST['thumb'];

	wp_update_attachment_metadata( $post_id, $newmeta );

case 'editpost':
	$post_ID = (int) $_POST['post_ID'];
	check_admin_referer('update-post_' . $post_ID);

	$post_ID = edit_post();

	redirect_post($post_ID); // Send user on their way while we keep working

	exit();
	break;

case 'delete':
	$post_id = (isset($_GET['post']))  ? intval($_GET['post']) : intval($_POST['post_ID']);
	check_admin_referer('delete-post_' . $post_id);

	$post = & get_post($post_id);

	if ( !current_user_can('delete_post', $post_id) )
		wp_die( __('You are not allowed to delete this post.') );

	if ( $post->post_type == 'attachment' ) {
		if ( ! wp_delete_attachment($post_id) )
			wp_die( __('Error in deleting...') );
	} else {
		if ( !wp_delete_post($post_id) )
			wp_die( __('Error in deleting...') );
	}

	$sendback = wp_get_referer();
	if (strpos($sendback, 'post.php') !== false) $sendback = admin_url('edit.php?deleted=1');
	elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
	else $sendback = add_query_arg('deleted', 1, $sendback);
	wp_redirect($sendback);
	exit();
	break;

case 'preview':
	check_admin_referer( 'autosave', 'autosavenonce' );

	$url = post_preview();

	wp_redirect($url);
	exit();
	break;

default:
	wp_redirect('edit.php');
	exit();
	break;
} // end switch
include('admin-footer.php');
?>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   wp-admin/profile.php                                                                                0000755 0023422 0004734 00000000423 11050757436 015501  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * User Profile Administration Panel.
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * This is a profile page.
 *
 * @since unknown
 * @var bool
 */
define('IS_PROFILE_PAGE', true);

/** Load User Editing Page */
require_once('user-edit.php');
?>
                                                                                                                                                                                                                                             wp-admin/rtl.css                                                                                    0000755 0023422 0004734 00000025564 11117526244 014653  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 /* 0 - 200
=================================== */
td.available-theme {
	text-align: right;
}
#current-theme img {
	float: right;
	margin-right: 0;
	margin-left: 1em;
}
.quicktags, .search {
	font-family: Tahoma, "Times New Roman";
}
/* 200 - 500
=================================== */
#save-post {
	float: right;
}
.preview {
	float: left;
}
#sticky-span {
	margin-left: 0;
	margin-right: 18px;
}
#post-body .misc-pub-section {
	border-right-width: 0;
	border-left-width: 1;
	border-right-style: none;
	border-left-style: solid;
	float: right;
}
#post-body .misc-pub-section-last {
	border-left: 0;
}
#delete-action {
	text-align: right;
	float: right;
}
#publishing-action {
	text-align: left;
	float: left;
}
.side-info ul {
	padding-left: 0;
	padding-right: 18px;
}
.submit input,
.button,
.button-primary,
.button-secondary,
.button-highlighted,
#postcustomstuff .submit input {
	font-family: Tahoma, "Times New Roman";
}
#wpcontent select {
	font-family: Tahoma, "Times New Roman";
}
#quicktags {
	background-position: right top;
}
/* 500 - 700
=================================== */
#template div {
	margin-right: 0;
	margin-left: 190px;
}
* html #template div {
	margin-left: 0;
}
#your-profile legend {
	font-family: "Times New Roman", Tahoma;
}
#ajax-response.alignleft {
	margin-left: 0;
	margin-right: 2em;
}
.page-numbers {
	margin-right: 0;
	margin-left: 1px;
}
.column-author img, .column-username img {
	float: right;
	margin-right: 0;
	margin-left: 10px;
}
.tablenav a.button-secondary {
	margin: 8px 0 0 8px;
}
.tablenav .tablenav-pages {
	float: left;
}
.tablenav .displaying-num {
	margin-right: 0;
	margin-left: 10px;
	font-family: Tahoma, "Times New Roman";
}
#postcustomstuff table input,
#postcustomstuff table select,
#postcustomstuff table textarea {
	margin: 8px 8px 8px 0;
}
/* 700 - 1000
=================================== */
#pass-strength-result {
	float: right;
	margin: 12px 1px 5px 5px;
}
/* Admin Header */
#user_info {
	float: left;
}
#header-logo {
	float: right;
	margin: 7px 15px 0 0;
}
#wphead h1 {
	font-family: "Times New Roman", Tahoma;
	float: right;
}
#wphead h1.long-title {
	font-family: "Times New Roman", Tahoma;
}
#adminmenu .wp-submenu a {
	padding-left: 0;
	padding-right: 12px;
	border-width: 0 0 0 1px;
	border-style: none none none solid;
	font-family: Tahoma, "Times New Roman";
}
#adminmenu a.menu-top,
#adminmenu .wp-submenu-head {
	font-family: Tahoma, "Times New Roman";
}
#adminmenu img.wp-menu-image {
	float: right;
}
.folded #adminmenu img.wp-menu-image {
	padding: 7px 6px 0 0;
}
#adminmenu .wp-submenu .wp-submenu-head {
	padding: 6px 10px 6px 4px;
}
.folded #adminmenu .wp-submenu {
	margin: -1px 28px 0 0;
}
.folded #adminmenu .wp-submenu a {
	padding-left: 0;
	padding-right: 10px;
}
.folded #adminmenu a.wp-has-submenu {
	margin-left: 0;
	margin-right: 40px;
}
#adminmenu .wp-menu-toggle {
	float: left;
	padding: 1px 0 0 2px;
	clear: left;
}
#adminmenu div.wp-menu-image {
	float: right;
}
#wphead-info {
	margin: 0 15px 0 0;
	padding-right:0;
	padding-left: 15px;
}
/* end side admin menu */
/* 1000 - 1300
=================================== */
#adminmenu #awaiting-mod,
#adminmenu span.update-plugins,
#sidemenu li a span.update-plugins {
	font-family: tahoma;
	margin-left: 0;
	margin-right: 2px;
}
#adminmenu li #awaiting-mod span,
#adminmenu li span.update-plugins span,
#sidemenu li a span.update-plugins span {
	float: right;
}
.post-com-count-wrapper {
	font-family: tahoma;
}
.column-response .post-com-count {
	float: right;
	margin-right: 0;
	margin-left: 5px;
}
/* Tables used on comment.php and option/setting pages */
.form-table th,
#wpbody-content .describe th {
	text-align: right;
}
.form-table input.tog {
	margin-right: 0;
	margin-left: 2px;
	float: right;
}
.form-table table.color-palette {
	float: right;
}
#profile-page .form-table #rich_editing {
	margin-right: 0;
	margin-left: 5px;
}
/* Post Screen */
/* 1300 - 1500
=================================== */
#normal-sortables .postbox .submit {
	float: left;
}
#post-body #tagsdiv #newtag {
	margin-right: 0;
	margin-left: 5px;
}
#post-status-info {
	padding: 0 7px 0 15px;
}
#comment-status-radio input {
	margin: 2px 0 5px 3px;
}
#tagchecklist {
	margin-left: 0;
	margin-right: 10px;
}
#tagchecklist strong {
	margin-left: 0;
	margin-right: -8px;
}
#tagchecklist span {
	float: right;
}
#tagchecklist span a {
	margin: 6px -9px 0 0;
	float: right;
}
.ac_results li {
	text-align: right;
}
#poststuff h2 {
	clear: right;
}
.setting-description, .form-wrap p {
	font-family: Tahoma, Arial;
}
/* 1500 - 1800
=================================== */
.meta-box-sortables .postbox .handlediv {
	float: left;
}
.howto {
	font-family: Tahoma, Arial;
}
.postarea h3 label {
	float: right;
}
.postarea #add-media-button {
	float: left;
	right: auto;
	left: 10px;
}
.wp_themeSkin tr.mceFirst td.mceToolbar {
	background-position: right top;
}
#poststuff #edButtonPreview,
#poststuff #edButtonHTML {
	margin: 5px 0 0 5px;
	float: left;
}
#poststuff #edButtonHTML {
	margin-right: 0;
	margin-left: 15px;
}
#media-buttons a {
	padding: 0 10px 5px 0;
}
.submitbox .submit {
	text-align: right;
}

.inside-submitbox #post_status {
	margin: 2px -2px 2px 0;
}
.submitbox .submit input {
	margin-right: 0;
	margin-left: 4px;
}
/* Categories */
#category-adder {
	margin-left: 0;
	margin-right: 120px;
}
#post-body ul#category-tabs li.ui-tabs-selected {
	-moz-border-radius: 0 3px 3px 0;
	-webkit-border-top-left-radius: 0;
	-webkit-border-top-right-radius: 3px;
	-webkit-border-bottom-left-radius: 0;
	-webkit-border-bottom-right-radius: 3px;
	border-top-left-radius: 0;
	border-top-right-radius: 3px;
	border-bottom-left-radius: 0;
	border-bottom-right-radius: 3px;
}
#post-body ul#category-tabs {
	float: right;
	text-align: left;
	margin: 0 0 0 -120px;
}
#post-body #categorydiv div.ui-tabs-panel,
#post-body #linkcategorydiv div.ui-tabs-panel {
	margin: 0 120px 0 5px;
}
/* 1800 - 2000
=================================== */
#side-info-column #category-tabs li {
	padding-right: 0;
	padding-left: 8px;
}
#categorydiv ul.categorychecklist ul,
#linkcategorydiv ul.categorychecklist ul {
	margin-left: 0;
	margin-right: 18px;
}
/* positioning etc. */
p.search-box {
	float: left;
}
#posts-filter fieldset {
	float: right;
	margin: 0 0 1em 1.5ex;
}
#posts-filter fieldset legend {
	padding: 0 1px .2em 0;
}
.view-switch {
	float: left;
}
.filter {
	float: right;
	margin: -5px 10px 0 0;
}
#the-comment-list td.comment p.comment-author {
	margin-right: 0;
}
#the-comment-list p.comment-author img {
	float: right;
	margin-right: 0;
	margin-left: 8px;
}
.tablenav .delete {
	margin-right: 0;
	margin-left: 20px;
}
td.action-links, th.action-links {
	text-align: left;
}
/* 2000 - 2300
=================================== */
.filter .subsubsub {
	margin-left: 0;
	margin-right: -10px;
}
#wp-word-count {
	margin-right: 10px;
}
.tool-box .title {
	font-family: "Times New Roman", Tahoma;
}
.settings-toggle {
	text-align: left;
	margin: 5px 0 15px 7px;
}
.curtime #timestamp {
	background-position: right top;
	padding-left: 0;
	padding-right: 18px;
}
/* media popup 0819 */
#sidemenu {
	margin: -30px 315px 0 15px;
	float: left;
	padding-left: 0;
	padding-right: 10px;
}
#sidemenu a {
	float: right;
}
#replysubmit .button {
	margin-right: 0;
	margin-left: 5px;
}
/* 2300 - 2500
=================================== */
#edithead .inside {
	float: right;
	margin: 3px 5px 2px 0;
}
#replyrow #ed_reply_toolbar input {
	margin: 1px 1px 1px 2px;
}
/* show/hide settings */
#screen-meta-links {
	margin: 0 0 0 9px;
}
#screen-options-link-wrap,
#contextual-help-link-wrap {
	float: left;
	font-family: Tahoma, "Times New Roman";
	margin: 0 0 0 6px;
}
.metabox-prefs label {
	padding-right: 0;
	padding-left: 15px;
}
.metabox-prefs label input {
	margin: 0 2px 0 5px;
}
.inline-editor .save,
.inline-editor .cancel {
	margin-right: 0;
	margin-left: 5px;
}
/* 2500 - 2700
=================================== */
#bulk-titles div a {
	float: right;
	margin: 3px -2px 0 3px;
}
#wpbody-content .filename {
	margin-left: 0;
	margin-right: 10px;
}
#wpbody-content .inline-edit-row fieldset {
	float: right;
}
#wpbody-content .quick-edit-row-page fieldset.inline-edit-col-right .inline-edit-col {
	border-left: 0 none;
	border-right: 1px solid;
}
#wpbody-content .bulk-edit-row .inline-edit-col-bottom {
	float: left;
}
.inline-edit-row fieldset label span.title {
	float: right;
}
.inline-edit-row fieldset label span.input-text-wrap {
	margin-left: 0;
	margin-right: 5em;
}
.quick-edit-row-post fieldset.inline-edit-col-right label span.title {
	padding-right: 0;
	padding-left: 0.5em;
}
#wpbody-content .quick-edit-row fieldset .inline-edit-group label.alignleft:first-child {
	margin-right: 0;
	margin-left: 0.5em;
}
/* 2700 - 3000
=================================== */
.inline-edit-row fieldset span.title,
.inline-edit-row fieldset span.checkbox-title {
	font-family: Tahoma, "Times New Roman";
}
.inline-edit-row fieldset .inline-edit-date {
	float: right;
}
.inline-edit-row fieldset ul.cat-checklist label,
.inline-edit-row .catshow,
.inline-edit-row .cathide,
.inline-edit-row #bulk-titles div {
	font-family: Tahoma, "Times New Roman";
}
.quick-edit-row-post fieldset label.inline-edit-status {
	float: right;
}
.describe-toggle-on, .describe-toggle-off {
	float: left;
	margin-right: 0;
	margin-left: 20px;
}
#wpbody-content #media-items .filename {
	float: right;
	margin-left: 0;
	margin-right: 10px;
}
.media-item .pinkynail {
	float: right;
}
#find-posts-response .found-radio {
	padding: 8px 8px 0 0;
}
.find-box-buttons {
	left: auto;
	right: 12px;
}
.find-box-search label {
	padding-right: 0;
	padding-left: 6px;
}
/* favorite-actions */
#favorite-actions {
	float: left;
}
#favorite-first {
	padding: 3px 12px 4px 30px;
}
#favorite-inside {
}
#favorite-inside a {
	padding: 3px 10px 3px 5px;
}
#favorite-toggle {
	right: auto;
	left: 0;
	background:transparent url(images/fav-arrow-rtl.gif) no-repeat 10px -4px;
}
#utc-time, #local-time {
	padding-left: 0;
	padding-right: 25px;
	font-family: Tahoma, Arial;
}
.icon32 {
	float: right;
	margin: 14px 0 0 6px;
}
.subtitle {
	padding-left: 0;
	padding-right: 25px;
}
/* TinyMCE
=================================== */
.clearlooks2 .mceTop .mceLeft {
	width:100% !important;
}
/* ltr
=================================== */
#author-email, #author-url, #rss-url-1, #edit-slug-box, #post_name, #trackback_url, #metakeyinput, #post_password, #slug, #category_nicename, #link_url, #link_image, #rss_uri, #menu_order, #email, #newcomment_author_url, #pages-exclude, #template textarea, #user_login, #url, #pass1, #pass2, #aim, #yim, #jabber, #siteurl, #home, #admin_email, #gmt_offset, #default_post_edit_rows, #mailserver_url, #mailserver_login, #mailserver_pass, #mailserver_port, #ping_sites, #posts_per_page, #posts_per_rss, #blog_charset, #close_comments_days_old, #comments_per_page, #comment_max_links, #moderation_keys, #blacklist_keys, #thumbnail_size_w, #thumbnail_size_h, #medium_size_w, #medium_size_h, #large_size_w, #large_size_h, #permalink_structure, #category_base, #tag_base, #upload_path, #upload_url_path, #rules {
	direction: ltr;
}
                                                                                                                                            wp-admin/setup-config.php                                                                           0000755 0023422 0004734 00000016334 11120046726 016443  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Retrieves and creates the wp-config.php file.
 *
 * The permissions for the base directory must allow for writing files in order
 * for the wp-config.php to be created using this page.
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * We are installing.
 *
 * @package WordPress
 */
define('WP_INSTALLING', true);

/**#@+
 * These three defines are required to allow us to use require_wp_db() to load
 * the database class while being wp-content/db.php aware.
 * @ignore
 */
define('ABSPATH', dirname(dirname(__FILE__)).'/');
define('WPINC', 'wp-includes');
define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
/**#@-*/

require_once('../wp-includes/compat.php');
require_once('../wp-includes/functions.php');
require_once('../wp-includes/classes.php');

if (!file_exists('../wp-config-sample.php'))
	wp_die('Entschuldige, aber die Datei <code>wp-config-sample.php</code> wird f&uuml;r die Installation ben&ouml;tigt. Bitte lade diese Datei hoch.');

$configFile = file('../wp-config-sample.php');

if ( !is_writable('../'))
	wp_die("Entschuldige, aber dieses Verzeichnis ist nicht beschreibbar. Entweder Du &#228;nderst die Schreibrechte Deines WordPress-Verzeichnisses , oder Du erstellst die Datei <code>wp-config.php</code> manuell.");

// Check if wp-config.php has been created
if (file_exists('../wp-config.php'))
	wp_die("<p>Die Datei <code>wp-config.php</code> existiert bereits. Wenn Du die Angaben &auml;ndern m&ouml;chtest, muss Du die Datei vorher l&ouml;schen. Du kannst jetzt die <a href='install.php'>Installation versuchen</a>.</p>");

// Check if wp-config.php exists above the root directory
if (file_exists('../../wp-config.php') && ! file_exists('../../wp-load.php'))
	wp_die("<p>Die Datei <code>wp-config.php</code> existiert bereits in einem WordPress-Level. Wenn Du die Angaben &auml;ndern m&ouml;chtest, muss Du die Datei vorher l&ouml;schen. Du kannst jetzt die <a href='install.php'>Installation versuchen</a>.</p>");

if (isset($_GET['step']))
	$step = $_GET['step'];
else
	$step = 0;

/**
 * Display setup wp-config.php file header.
 *
 * @ignore
 * @since 2.3.0
 * @package WordPress
 * @subpackage Installer_WP_Config
 */
function display_header() {
	header( 'Content-Type: text/html; charset=utf-8' );
?>
<!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>WordPress &rsaquo; Einrichtung der Konfigurations-Datei</title>
<link rel="stylesheet" href="css/install.css" type="text/css" />

</head>
<body>
<h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
<?php
}//end function display_header();

switch($step) {
	case 0:
		display_header();
?>

<p>Willkommen bei WordPress. Bevor wir anfangen k&#246;nnen, ben&#246;tigen wir ein paar Informationen &#252;ber Deine Datenbank. Die folgenden Informationen solltest Du parat haben:</p>
<ol>
  <li>Name der Datenbank</li>
  <li>Benutzername der Datenbank</li>
  <li>Passwort der Datenbank</li>
  <li>Datenbank-Host (<em>MySQL-Serveradresse</em>)</li>
  <li>Tabellen-Pr&#228;fix (<em>Wenn Du auch andere Scripte oder mehrere WordPress-Installationen &#252;ber eine Datenbank laufen lassen m&#246;chtest.</em>) </li>
</ol>
<p><strong>Wenn aus irgendeinem Grund die automatische Erstellung der Dateien nicht funktioniert... keine Panik! Alles was wir hier machen, ist die oben angegebene Information an die Konfigurations-Datei zu &#252;bergeben. Alternativ kannst Du auch die Datei <code>wp-config-sample.php</code> in einem Text-Editor &#246;ffnen, die ben&#246;tigten Informationen dort eingeben, und die Datei als <code>wp-config.php</code> speichern.</strong></p>
<p>Die notwendigen Informationen hast Du von Deinem Provider bekommen. Wenn Du die Informationen verlegt hast, wirst Du Deinen Provider kontaktieren m&#252;ssen, bevor wir fortfahren k&#246;nnen.
<p>Wenn alles klar ist...</p>
<p><a href="setup-config.php?step=1" class="button">...kann es jetzt losgehen!</a></p>
<?php
	break;

	case 1:
		display_header();
	?>
<form method="post" action="setup-config.php?step=2">
	<p>Nachfolgend mu&szlig;t Du die Angaben zu Deiner Datenbankverbindung einsetzen. Wenn Du dir nicht sicher bist, kontaktiere Deinen Provider.</p>
	<table class="form-table">
		<tr>
			<th scope="row"><label for="dbname">Name der Datenbank</label></th>
			<td><input name="dbname" id="dbname" type="text" size="25" value="wordpress" /></td>
			<td>Der Name der Datenbank unter der WordPress laufen soll.</td>
		</tr>
		<tr>
			<th scope="row"><label for="uname">Name des Datenbankbenutzers</label></th>
			<td><input name="uname" id="uname" type="text" size="25" value="username" /></td>
			<td>Dein MySQL-Benutzername.</td>
		</tr>
		<tr>
			<th scope="row"><label for="pwd">Passwort</label></th>
			<td><input name="pwd" id="pwd" type="text" size="25" value="password" /></td>
			<td>...und Dein MySQL-Passwort.</td>
		</tr>
		<tr>
			<th scope="row"><label for="dbhost">Datenbank-Host</label></th>
			<td><input name="dbhost" id="dbhost" type="text" size="25" value="localhost" /></td>
			<td>Mit 99%iger Wahrscheinlichkeit musst Du dies nicht &#228;ndern. (<em>MySQL-Serveradresse</em>)</td>
		</tr>
		<tr>
			<th scope="row"><label for="prefix">Tabellen-Pr&#228;fix</label></th>
			<td><input name="prefix" id="prefix" type="text" id="prefix" value="wp_" size="25" /></td>
			<td>&Auml;ndere das Pr&#228;fix, wenn Du andere Scripte oder mehrere WordPress-Installationen &#252;ber Deine Datenbank laufen lassen m&#246;chtest.</td>
		</tr>
	</table>
	<p class="step"><input name="submit" type="submit" value="Absenden" class="button" /></p>
</form>
<?php
	break;

	case 2:
	$dbname  = trim($_POST['dbname']);
	$uname   = trim($_POST['uname']);
	$passwrd = trim($_POST['pwd']);
	$dbhost  = trim($_POST['dbhost']);
	$prefix  = trim($_POST['prefix']);
	if (empty($prefix)) $prefix = 'wp_';

	// Test the db connection.
	/**#@+
	 * @ignore
	 */
	define('DB_NAME', $dbname);
	define('DB_USER', $uname);
	define('DB_PASSWORD', $passwrd);
	define('DB_HOST', $dbhost);
	/**#@-*/

	// We'll fail here if the values are no good.
	require_wp_db();
	if ( !empty($wpdb->error) )
		wp_die($wpdb->error->get_error_message());

	$handle = fopen('../wp-config.php', 'w');

	foreach ($configFile as $line_num => $line) {
		switch (substr($line,0,16)) {
			case "define('DB_NAME'":
				fwrite($handle, str_replace("putyourdbnamehere", $dbname, $line));
				break;
			case "define('DB_USER'":
				fwrite($handle, str_replace("'usernamehere'", "'$uname'", $line));
				break;
			case "define('DB_PASSW":
				fwrite($handle, str_replace("'yourpasswordhere'", "'$passwrd'", $line));
				break;
			case "define('DB_HOST'":
				fwrite($handle, str_replace("localhost", $dbhost, $line));
				break;
			case '$table_prefix  =':
				fwrite($handle, str_replace('wp_', $prefix, $line));
				break;
			default:
				fwrite($handle, $line);
		}
	}
	fclose($handle);
	chmod('../wp-config.php', 0666);

	display_header();
?>
<p>Alles klar! Du bist durch den wichtigsten Teil der Installation gekommen. WordPress kann nun mit Deiner Datenbank kommunizieren. Wenn Du bereit bist...</p>

<p class="step"><a href="install.php" class="button">...starten wir die Installation!</a></p>
<?php
	break;
}
?>
</body>
</html>
                                                                                                                                                                                                                                                                                                    wp-admin/sidebar.php                                                                                0000755 0023422 0004734 00000006533 11060426356 015455  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Quick way to create a WordPress Post.
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * @var string
 * @name $mode
 */
$mode = 'sidebar';

/** WordPress Administration Bootstrap */
require_once('admin.php');

if ( ! current_user_can('edit_posts') )
	wp_die(__('Cheatin&#8217; uh?'));

$post = get_default_post_to_edit();

?><!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="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('blog_charset'); ?>" />
<title><?php bloginfo('name') ?> &rsaquo; <?php _e('Sidebar'); ?></title>
<style type="text/css" media="screen">
body {
	font-size: 0.9em;
	margin: 0;
	padding: 0;
}
form {
	padding: 1%;
}
.tags-wrap p {
	font-size: 0.75em;
	margin-top: 0.4em;
}
.button-highlighted, #wphead, label {
	font-weight: bold;
}
#post-title, #tags-input, #content {
	width: 99%;
	padding: 2px;
}
#wphead {
	font-size: 1.4em;
	background-color: #E4F2FD;
	color: #555555;
	padding: 0.2em 1%;
}
#wphead p {
	margin: 3px;
}
.button {
	font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
	padding: 3px 5px;
	margin-right: 5px;
	font-size: 0.75em;
	line-height: 1.5em;
	border: 1px solid #80b5d0;
	-moz-border-radius: 3px;
	-khtml-border-radius: 3px;
	-webkit-border-radius: 3px;
	border-radius: 3px;
	cursor: pointer;
	background-color: #e5e5e5;
	color: #246;
}
.button:hover {
	border-color: #535353;
}
.updated {
	background-color: #FFFBCC;
	border: 1px solid #E6DB55;
	margin-bottom: 1em;
	padding: 0 0.6em;
}
.updated p {
	margin: 0.6em;
}
</style>
</head>
<body id="sidebar">
<div id="wphead"><p><?php bloginfo('name') ?> &rsaquo; <?php _e('Sidebar'); ?></p></div>
<form name="post" action="post.php" method="post">
<div>
<input type="hidden" name="action" value="post" />
<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
<input type="hidden" name="mode" value="sidebar" />
<input type="hidden" name="ping_status" value="<?php echo $post->ping_status; ?>" />
<input type="hidden" name="comment_status" value="<?php echo $post->comment_status; ?>" />
<?php wp_nonce_field('add-post');

if ( 'b' == $_GET['a'] )
	echo '<div class="updated"><p>' . __('Post published.') . '</p></div>';
elseif ( 'c' == $_GET['a'] )
	echo '<div class="updated"><p>' . __('Post saved.') . '</p></div>';
?>
<p>
<label for="post-title"><?php _e('Title:'); ?></label>
<input type="text" name="post_title" id="post-title" size="20" tabindex="1" autocomplete="off" value="" />
</p>

<p>
<label for="content"><?php _e('Post:'); ?></label>
<textarea rows="8" cols="12" name="content" id="content" style="height:10em;line-height:1.4em;" tabindex="2"></textarea>
</p>

<div class="tags-wrap">
<label for="tags-input"><?php _e('Tags:') ?></label>
<input type="text" name="tags_input" id="tags-input" tabindex="3" value="" />
<p><?php _e('Separate tags with commas'); ?></p>
</div>

<p>
<input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" accesskey="s" class="button" value="<?php _e('Save as Draft'); ?>" />
<?php if ( current_user_can('publish_posts') ) : ?>
<input name="publish" type="submit" id="publish" tabindex="6" accesskey="p" value="<?php _e('Publish') ?>" class="button button-highlighted" />
<?php endif; ?>
</p>
</div>
</form>

</body>
</html>
                                                                                                                                                                     wp-admin/theme-editor.php                                                                           0000755 0023422 0004734 00000015537 11120514164 016426  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Theme editor administration panel.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** WordPress Administration Bootstrap */
require_once('admin.php');

$title = __("Edit Themes");
$parent_file = 'themes.php';

wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file', 'theme'));

wp_admin_css( 'theme-editor' );

$themes = get_themes();

if (empty($theme)) {
	$theme = get_current_theme();
} else {
	$theme = stripslashes($theme);
 }


if ( ! isset($themes[$theme]) )
	wp_die(__('The requested theme does not exist.'));

$allowed_files = array_merge($themes[$theme]['Stylesheet Files'], $themes[$theme]['Template Files']);

if (empty($file)) {
	$file = $allowed_files[0];
}

$file = validate_file_to_edit($file, $allowed_files);
$real_file = get_real_file_to_edit($file);

$file_show = basename( $file );

switch($action) {

case 'update':

	check_admin_referer('edit-theme_' . $file . $theme);

	if ( !current_user_can('edit_themes') )
		wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');

	$newcontent = stripslashes($_POST['newcontent']);
	$theme = urlencode($theme);
	if (is_writeable($real_file)) {
		//is_writable() not always reliable, check return value. see comments @ http://uk.php.net/is_writable
		$f = fopen($real_file, 'w+');
		if ($f !== FALSE) {
			fwrite($f, $newcontent);
			fclose($f);
			$location = "theme-editor.php?file=$file&theme=$theme&a=te";
		} else {
			$location = "theme-editor.php?file=$file&theme=$theme";
		}
	} else {
		$location = "theme-editor.php?file=$file&theme=$theme";
	}

	$location = wp_kses_no_null($location);
	$strip = array('%0d', '%0a');
	$location = str_replace($strip, '', $location);
	header("Location: $location");
	exit();

break;

default:

	if ( !current_user_can('edit_themes') )
		wp_die('<p>'.__('You do not have sufficient permissions to edit themes for this blog.').'</p>');

	require_once('admin-header.php');

	update_recently_edited($file);

	if (!is_file($real_file))
		$error = 1;

	if (!$error && filesize($real_file) > 0) {
		$f = fopen($real_file, 'r');
		$content = fread($f, filesize($real_file));
		$content = htmlspecialchars($content);
	}

	?>
<?php if (isset($_GET['a'])) : ?>
 <div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
<?php endif;

$description = get_file_description($file);
$desc_header = ( $description != $file_show ) ? "<strong>$description</strong> (%s)" : "%s";
?>
<div class="wrap">
<?php screen_icon(); ?>
<h2><?php echo wp_specialchars( $title ); ?></h2>
<div class="bordertitle">
	<form id="themeselector" action="theme-editor.php" method="post">
		<strong><label for="theme"><?php _e('Select theme to edit:'); ?> </label></strong>
		<select name="theme" id="theme">
<?php
	foreach ($themes as $a_theme) {
	$theme_name = $a_theme['Name'];
	if ($theme_name == $theme) $selected = " selected='selected'";
	else $selected = '';
	$theme_name = attribute_escape($theme_name);
	echo "\n\t<option value=\"$theme_name\" $selected>$theme_name</option>";
}
?>
		</select>
		<input type="submit" name="Submit" value="<?php _e('Select') ?>" class="button" />
	</form>
</div>
<div class="tablenav">
<div class="alignleft">
<big><?php echo sprintf($desc_header, $file_show); ?></big>
</div>
<br class="clear" />
</div>
<br class="clear" />
	<div id="templateside">
	<h3 id="bordertitle"><?php _e("Theme Files"); ?></h3>

<?php
if ($allowed_files) :
?>
	<h4><?php _e('Templates'); ?></h4>
	<ul>
<?php
	$template_mapping = array();
	$template_dir = $themes[$theme]['Template Dir'];
	foreach($themes[$theme]['Template Files'] as $template_file) {
		$description = trim( get_file_description($template_file) );
		$template_show = basename($template_file);
		$filedesc = ( $description != $template_file ) ? "$description <span class='nonessential'>($template_show)</span>" : "$description";
		$filedesc = ( $template_file == $file ) ? "<span class='highlight'>$description <span class='nonessential'>($template_show)</span></span>" : $filedesc;

		// If we have two files of the same name prefer the one in the Template Directory
		// This means that we display the correct files for child themes which overload Templates as well as Styles
		if( array_key_exists($description, $template_mapping ) ) {
			if ( false !== strpos( $template_file, $template_dir ) )  {
				$template_mapping[ $description ] = array( $template_file, $filedesc );
			}
		} else {
			$template_mapping[ $description ] = array( $template_file, $filedesc );
		}
	}
	ksort( $template_mapping );
	while ( list( $template_sorted_key, list( $template_file, $filedesc ) ) = each( $template_mapping ) ) :
	?>
		<li><a href="theme-editor.php?file=<?php echo "$template_file"; ?>&amp;theme=<?php echo urlencode($theme) ?>"><?php echo $filedesc ?></a></li>
<?php endwhile; ?>
	</ul>
	<h4><?php echo _c('Styles|Theme stylesheets in theme editor'); ?></h4>
	<ul>
<?php
	$template_mapping = array();
	foreach($themes[$theme]['Stylesheet Files'] as $style_file) {
		$description = trim( get_file_description($style_file) );
		$style_show = basename($style_file);
		$filedesc = ( $description != $style_file ) ? "$description <span class='nonessential'>($style_show)</span>" : "$description";
		$filedesc = ( $style_file == $file ) ? "<span class='highlight'>$description <span class='nonessential'>($style_show)</span></span>" : $filedesc;
		$template_mapping[ $description ] = array( $style_file, $filedesc );
	}
	ksort( $template_mapping );
	while ( list( $template_sorted_key, list( $style_file, $filedesc ) ) = each( $template_mapping ) ) :
		?>
		<li><a href="theme-editor.php?file=<?php echo "$style_file"; ?>&amp;theme=<?php echo urlencode($theme) ?>"><?php echo $filedesc ?></a></li>
<?php endwhile; ?>
	</ul>
<?php endif; ?>
</div>
	<?php
	if (!$error) {
	?>
	<form name="template" id="template" action="theme-editor.php" method="post">
	<?php wp_nonce_field('edit-theme_' . $file . $theme) ?>
		 <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
		 <input type="hidden" name="action" value="update" />
		 <input type="hidden" name="file" value="<?php echo $file ?>" />
		 <input type="hidden" name="theme" value="<?php echo $theme ?>" />
		 </div>

		<div>
<?php if ( is_writeable($real_file) ) : ?>
			<p class="submit">
<?php
	echo "<input type='submit' name='submit' class='button-primary' value='" . __('Update File') . "' tabindex='2' />";
?>
</p>
<?php else : ?>
<p><em><?php _e('You need to make this file writable before you can save your changes. See <a href="http://codex.wordpress.org/Changing_File_Permissions">the Codex</a> for more information.'); ?></em></p>
<?php endif; ?>
		</div>
	</form>
	<?php
	} else {
		echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
	}
	?>
<div class="clear"> &nbsp; </div>
</div>
<?php
break;
}

include("admin-footer.php") ?>
                                                                                                                                                                 wp-admin/themes.php                                                                                 0000755 0023422 0004734 00000022554 11117531364 015331  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Themes administration panel.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** WordPress Administration Bootstrap */
require_once('admin.php');

if ( isset($_GET['action']) ) {
	check_admin_referer('switch-theme_' . $_GET['template']);

	if ('activate' == $_GET['action']) {
		switch_theme($_GET['template'], $_GET['stylesheet']);
		wp_redirect('themes.php?activated=true');
		exit;
	}
}

$title = __('Manage Themes');
$parent_file = 'themes.php';

add_thickbox();
wp_enqueue_script( 'theme-preview' );

require_once('admin-header.php');
?>

<?php if ( ! validate_current_theme() ) : ?>
<div id="message1" class="updated fade"><p><?php _e('The active theme is broken.  Reverting to the default theme.'); ?></p></div>
<?php elseif ( isset($_GET['activated']) ) : ?>
<div id="message2" class="updated fade"><p><?php printf(__('New theme activated. <a href="%s">Visit site</a>'), get_bloginfo('url') . '/'); ?></p></div>
<?php endif; ?>

<?php
$themes = get_themes();
$ct = current_theme_info();

ksort( $themes );
$theme_total = count( $themes );
$per_page = 15;

if ( isset( $_GET['pagenum'] ) )
	$page = absint( $_GET['pagenum'] );

if ( empty($page) )
	$page = 1;

$start = $offset = ( $page - 1 ) * $per_page;

$page_links = paginate_links( array(
	'base' => add_query_arg( 'pagenum', '%#%' ) . '#themenav',
	'format' => '',
	'prev_text' => __('&laquo;'),
	'next_text' => __('&raquo;'),
	'total' => ceil($theme_total / $per_page),
	'current' => $page
));

$themes = array_slice( $themes, $start, $per_page );

/**
 * Check if there is an update for a theme available.
 *
 * Will display link, if there is an update available.
 *
 * @since 2.7.0
 *
 * @param object $theme Theme data object.
 * @return bool False if no valid info was passed.
 */
function theme_update_available( $theme ) {
	static $themes_update;
	if ( !isset($themes_update) )
		$themes_update = get_option('update_themes');

	if ( is_object($theme) && isset($theme->stylesheet) )
		$stylesheet = $theme->stylesheet;
	elseif ( is_array($theme) && isset($theme['Stylesheet']) )
		$stylesheet = $theme['Stylesheet'];
	else
		return false; //No valid info passed.

	if ( isset($themes_update->response[ $stylesheet ]) ) {
		$update = $themes_update->response[ $stylesheet ];
		$details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $update['url']); //Theme browser inside WP? replace this, Also, theme preview JS will override this on the available list.
		$update_url = wp_nonce_url('update.php?action=upgrade-theme&amp;theme=' . urlencode($stylesheet), 'upgrade-theme_' . $stylesheet);

		if ( ! current_user_can('update_themes') )
			printf( __('<p>There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a>.</p>'), $ct->name, $details_url, $update['new_version']);
		else if ( empty($update->package) )
			printf( __('<p>There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a> <em>automatic upgrade unavailable for this theme</em>.</p>'), $ct->name, $details_url, $update['new_version']);
		else
			printf( __('<p>There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a> or <a href="%4$s">upgrade automatically</a>.</p>'), $ct->name, $details_url, $update['new_version'], $update_url );
	}
}

?>

<div class="wrap">
<?php screen_icon(); ?>
<h2><?php echo wp_specialchars( $title ); ?></h2>

<h3><?php _e('Current Theme'); ?></h3>
<div id="current-theme">
<?php if ( $ct->screenshot ) : ?>
<img src="<?php echo WP_CONTENT_URL . $ct->stylesheet_dir . '/' . $ct->screenshot; ?>" alt="<?php _e('Current theme preview'); ?>" />
<?php endif; ?>
<h4><?php printf(_c('%1$s %2$s by %3$s|1: theme title, 2: theme version, 3: theme author'), $ct->title, $ct->version, $ct->author) ; ?></h4>
<p class="description"><?php echo $ct->description; ?></p>
<?php if ($ct->parent_theme) { ?>
	<p><?php printf(__('The template files are located in <code>%2$s</code>.  The stylesheet files are located in <code>%3$s</code>.  <strong>%4$s</strong> uses templates from <strong>%5$s</strong>.  Changes made to the templates will affect both themes.'), $ct->title, $ct->template_dir, $ct->stylesheet_dir, $ct->title, $ct->parent_theme); ?></p>
<?php } else { ?>
	<p><?php printf(__('All of this theme&#8217;s files are located in <code>%2$s</code>.'), $ct->title, $ct->template_dir, $ct->stylesheet_dir); ?></p>
<?php } ?>
<?php if ( $ct->tags ) : ?>
<p><?php _e('Tags:'); ?> <?php echo join(', ', $ct->tags); ?></p>
<?php endif; ?>
<?php theme_update_available($ct); ?>

</div>
<div class="clear"></div>
<h3><?php _e('Available Themes'); ?></h3>
<div class="clear"></div>

<?php if ( $page_links ) : ?>
<div class="tablenav">
<div class="tablenav-pages"><?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
	number_format_i18n( $start + 1 ),
	number_format_i18n( min( $page * $per_page, $theme_total ) ),
	number_format_i18n( $theme_total ),
	$page_links
); echo $page_links_text; ?></div>
</div>
<?php endif; ?>

<?php if ( 1 < $theme_total ) { ?>
<table id="availablethemes" cellspacing="0" cellpadding="0">
<?php
$style = '';

$theme_names = array_keys($themes);
natcasesort($theme_names);

$rows = ceil(count($theme_names) / 3);
for ( $row = 1; $row <= $rows; $row++ )
	for ( $col = 1; $col <= 3; $col++ )
		$table[$row][$col] = array_shift($theme_names);

foreach ( $table as $row => $cols ) {
?>
<tr>
<?php
foreach ( $cols as $col => $theme_name ) {
	$class = array('available-theme');
	if ( $row == 1 ) $class[] = 'top';
	if ( $col == 1 ) $class[] = 'left';
	if ( $row == $rows ) $class[] = 'bottom';
	if ( $col == 3 ) $class[] = 'right';
?>
	<td class="<?php echo join(' ', $class); ?>">
<?php if ( !empty($theme_name) ) :
	$template = $themes[$theme_name]['Template'];
	$stylesheet = $themes[$theme_name]['Stylesheet'];
	$title = $themes[$theme_name]['Title'];
	$version = $themes[$theme_name]['Version'];
	$description = $themes[$theme_name]['Description'];
	$author = $themes[$theme_name]['Author'];
	$screenshot = $themes[$theme_name]['Screenshot'];
	$stylesheet_dir = $themes[$theme_name]['Stylesheet Dir'];
	$preview_link = clean_url( get_option('home') . '/');
	$preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true', 'width' => 600, 'height' => 400 ), $preview_link ) );
	$preview_text = attribute_escape( sprintf( __('Preview of "%s"'), $title ) );
	$tags = $themes[$theme_name]['Tags'];
	$thickbox_class = 'thickbox';
	$activate_link = wp_nonce_url("themes.php?action=activate&amp;template=".urlencode($template)."&amp;stylesheet=".urlencode($stylesheet), 'switch-theme_' . $template);
	$activate_text = attribute_escape( sprintf( __('Activate "%s"'), $title ) );
?>
		<a href="<?php echo $activate_link; ?>" class="<?php echo $thickbox_class; ?> screenshot">
<?php if ( $screenshot ) : ?>
			<img src="<?php echo WP_CONTENT_URL . $stylesheet_dir . '/' . $screenshot; ?>" alt="" />
<?php endif; ?>
		</a>
		<h3><a class="<?php echo $thickbox_class; ?>" href="<?php echo $activate_link; ?>"><?php echo $title; ?></a></h3>
		<p><?php echo $description; ?></p>
<?php if ( $tags ) : ?>
		<p><?php _e('Tags:'); ?> <?php echo join(', ', $tags); ?></p>
<?php endif; ?>
		<?php theme_update_available( $themes[$theme_name] ); ?>
		<noscript><p class="themeactions"><a href="<?php echo $preview_link; ?>" title="<?php echo $preview_text; ?>"><?php _e('Preview'); ?></a> <a href="<?php echo $activate_link; ?>" title="<?php echo $activate_text; ?>"><?php _e('Activate'); ?></a></p></noscript>
		<div style="display:none;"><a class="previewlink" href="<?php echo $preview_link; ?>"><?php echo $preview_text; ?></a> <a class="activatelink" href="<?php echo $activate_link; ?>"><?php echo $activate_text; ?></a></div>
<?php endif; // end if not empty theme_name ?>
	</td>
<?php } // end foreach $cols ?>
</tr>
<?php } // end foreach $table ?>
</table>
<?php } ?>

<br class="clear" />

<?php if ( $page_links ) : ?>
<div class="tablenav">
<?php echo "<div class='tablenav-pages'>$page_links_text</div>"; ?>
<br class="clear" />
</div>
<?php endif; ?>

<br class="clear" />

<?php
// List broken themes, if any.
$broken_themes = get_broken_themes();
if ( count($broken_themes) ) {
?>

<h2><?php _e('Broken Themes'); ?></h2>
<p><?php _e('The following themes are installed but incomplete.  Themes must have a stylesheet and a template.'); ?></p>

<table width="100%" cellpadding="3" cellspacing="3">
	<tr>
		<th><?php _e('Name'); ?></th>
		<th><?php _e('Description'); ?></th>
	</tr>
<?php
	$theme = '';

	$theme_names = array_keys($broken_themes);
	natcasesort($theme_names);

	foreach ($theme_names as $theme_name) {
		$title = $broken_themes[$theme_name]['Title'];
		$description = $broken_themes[$theme_name]['Description'];

		$theme = ('class="alternate"' == $theme) ? '' : 'class="alternate"';
		echo "
		<tr $theme>
			 <td>$title</td>
			 <td>$description</td>
		</tr>";
	}
?>
</table>
<?php
}
?>

<h2><?php _e('Get More Themes'); ?></h2>
<p><?php _e('You can find additional themes for your site in the <a href="http://wordpress.org/extend/themes/">WordPress theme directory</a>. To install a theme you generally just need to upload the theme folder into your <code>wp-content/themes</code> directory. Once a theme is uploaded, you should see it on this page.'); ?></p>

</div>

<?php require('admin-footer.php'); ?>
                                                                                                                                                    wp-admin/update-links.php                                                                           0000755 0023422 0004734 00000002772 11071022246 016435  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Send blog links to pingomatic.com to update.
 *
 * You can disable this feature by deleting the option 'use_linksupdate' or
 * setting the option to false. If no links exist, then no links are sent.
 *
 * Snoopy is included, but is not used. Fsockopen() is used instead to send link
 * URLs.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** Load WordPress Bootstrap */
require_once('../wp-load.php');

if ( !get_option('use_linksupdate') )
	wp_die(__('Feature disabled.'));

$link_uris = $wpdb->get_col("SELECT link_url FROM $wpdb->links");

if ( !$link_uris )
	wp_die(__('No links'));

$link_uris = urlencode( join( $link_uris, "\n" ) );

$query_string = "uris=$link_uris";

$options = array();
$options['timeout'] = 30;
$options['body'] = $query_string;

$options['headers'] = array(
	'content-type' => 'application/x-www-form-urlencoded; charset='.get_option('blog_charset'),
	'content-length' => strlen( $query_string ),
);

$response = wp_remote_get('http://api.pingomatic.com/updated-batch/', $options);

if ( is_wp_error( $response ) )
	wp_die(__('Request Failed.'));

if ( $response['response']['code'] != 200 )
	wp_die(__('Request Failed.'));

$body = str_replace(array("\r\n", "\r"), "\n", $response['body']);
$returns = explode("\n", $body);

foreach ($returns as $return) :
	$time = substr($return, 0, 19);
	$uri = preg_replace('/(.*?) | (.*?)/', '$2', $return);
	$wpdb->query( $wpdb->prepare("UPDATE $wpdb->links SET link_updated = %s WHERE link_url = %s", $time, $uri) );
endforeach;

?>
      wp-admin/update.php                                                                                 0000755 0023422 0004734 00000013504 11117531364 015321  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Update Plugin/Theme administration panel.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** WordPress Administration Bootstrap */
require_once('admin.php');

if ( ! current_user_can('update_plugins') )
	wp_die(__('You do not have sufficient permissions to update plugins for this blog.'));

/**
 * Plugin upgrade display.
 *
 * @since 2.5
 *
 * @param string $plugin Plugin
 */
function do_plugin_upgrade($plugin) {
	global $wp_filesystem;

	$url = wp_nonce_url("update.php?action=upgrade-plugin&plugin=$plugin", "upgrade-plugin_$plugin");
	if ( false === ($credentials = request_filesystem_credentials($url)) )
		return;

	if ( ! WP_Filesystem($credentials) ) {
		$error = true;
		if ( is_object($wp_filesystem) && $wp_filesystem->errors->get_error_code() )
			$error = $wp_filesystem->errors;
		request_filesystem_credentials($url, '', $error); //Failed to connect, Error and request again
		return;
	}

	echo '<div class="wrap">';
	echo '<h2>' . __('Upgrade Plugin') . '</h2>';
	if ( $wp_filesystem->errors->get_error_code() ) {
		foreach ( $wp_filesystem->errors->get_error_messages() as $message )
			show_message($message);
		echo '</div>';
		return;
	}

	$was_activated = is_plugin_active($plugin); //Check now, It'll be deactivated by the next line if it is

	$result = wp_update_plugin($plugin, 'show_message');

	if ( is_wp_error($result) ) {
		show_message($result);
		show_message( __('Plugin upgrade Failed') );
	} else {
		$plugin_file = $result;
		show_message( __('Plugin upgraded successfully') );
		if( $result && $was_activated ){
			show_message(__('Attempting reactivation of the plugin'));
			echo '<iframe style="border:0;overflow:hidden" width="100%" height="170px" src="' . wp_nonce_url('update.php?action=activate-plugin&plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) .'"></iframe>';
		}
		$update_actions =  array(
			'activate_plugin' => '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . attribute_escape(__('Activate this plugin')) . '" target="_parent">' . __('Activate Plugin') . '</a>',
			'plugins_page' => '<a href="' . admin_url('plugins.php') . '" title="' . attribute_escape(__('Goto plugins page')) . '" target="_parent">' . __('Return to Plugins page') . '</a>'
		);
		if ( $was_activated )
			unset( $update_actions['activate_plugin'] );

		$update_actions = apply_filters('update_plugin_complete_actions', $update_actions, $plugin_file);
		if ( ! empty($update_actions) )
			show_message('<strong>' . __('Actions:') . '</strong> ' . implode(' | ', (array)$update_actions));
	}
	echo '</div>';
}

/**
 * Theme upgrade display.
 *
 * @since 2.5
 *
 * @param string $plugin Plugin
 */
function do_theme_upgrade($theme) {
	global $wp_filesystem;

	$url = wp_nonce_url('update.php?action=upgrade-theme&theme=' . urlencode($theme), 'upgrade-plugin_' . urlencode($theme));
	if ( false === ($credentials = request_filesystem_credentials($url)) )
		return;

	if ( ! WP_Filesystem($credentials) ) {
		$error = true;
		if ( is_object($wp_filesystem) && $wp_filesystem->errors->get_error_code() )
			$error = $wp_filesystem->errors;
		request_filesystem_credentials($url, '', $error); //Failed to connect, Error and request again
		return;
	}

	echo '<div class="wrap">';
	echo '<h2>' . __('Upgrade Theme') . '</h2>';
	if ( $wp_filesystem->errors->get_error_code() ) {
		foreach ( $wp_filesystem->errors->get_error_messages() as $message )
			show_message($message);
		echo '</div>';
		return;
	}

	//TODO: Is theme currently active?
	$was_current = false; //is_plugin_active($plugin); //Check now, It'll be deactivated by the next line if it is

	$result = wp_update_theme($theme, 'show_message');

	if ( is_wp_error($result) ) {
		show_message($result);
		show_message( __('Installation Failed') );
	} else {
		//Result is the new plugin file relative to WP_PLUGIN_DIR
		show_message( __('Theme upgraded successfully') );
		if( $result && $was_current ){
			show_message(__('Setting theme as Current'));
			//TODO: Actually set it as active again.
			//echo '<iframe style="border:0" width="100%" height="170px" src="' . wp_nonce_url('update.php?action=activate-plugin&plugin=' . $result, 'activate-plugin_' . $result) .'"></iframe>';
		}
	}
	echo '</div>';
}

if ( isset($_GET['action']) ) {
	$plugin = isset($_GET['plugin']) ? trim($_GET['plugin']) : '';
	$theme = isset($_REQUEST['theme']) ? urldecode($_REQUEST['theme']) : '';
	$action = isset($_GET['action']) ? $_GET['action'] : '';

	if ( 'upgrade-plugin' == $action ) {
		check_admin_referer('upgrade-plugin_' . $plugin);
		$title = __('Upgrade Plugin');
		$parent_file = 'plugins.php';
		require_once('admin-header.php');
		do_plugin_upgrade($plugin);
		include('admin-footer.php');
	} elseif ('activate-plugin' == $action ) {
		check_admin_referer('activate-plugin_' . $plugin);
		if( ! isset($_GET['failure']) && ! isset($_GET['success']) ) {
			wp_redirect( 'update.php?action=activate-plugin&failure=true&plugin=' . $plugin . '&_wpnonce=' . $_GET['_wpnonce'] );
			activate_plugin($plugin);
			wp_redirect( 'update.php?action=activate-plugin&success=true&plugin=' . $plugin . '&_wpnonce=' . $_GET['_wpnonce'] );
			die();
		}
		iframe_header( __('Plugin Reactivation'), true );
		if( isset($_GET['success']) )
			echo '<p>' . __('Plugin reactivated successfully.') . '</p>';

		if( isset($_GET['failure']) ){
			echo '<p>' . __('Plugin failed to reactivate due to a fatal error.') . '</p>';
			error_reporting( E_ALL ^ E_NOTICE );
			@ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
			include(WP_PLUGIN_DIR . '/' . $plugin);
		}
		iframe_footer();
	} elseif ( 'upgrade-theme' == $action ) {
		check_admin_referer('upgrade-theme_' . $theme);
		$title = __('Upgrade Theme');
		$parent_file = 'themes.php';
		require_once('admin-header.php');
		do_theme_upgrade($theme);
		include('admin-footer.php');
	}
}

?>
                                                                                                                                                                                            wp-admin/upgrade-functions.php                                                                      0000755 0023422 0004734 00000000523 11050757436 017477  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * WordPress Upgrade Functions. Old file, must not be used. Include
 * wp-admin/includes/upgrade.php instead.
 *
 * @deprecated 2.5
 * @package WordPress
 * @subpackage Administration
 */

_deprecated_file( basename(__FILE__), '2.5', 'wp-admin/includes/upgrade.php' );
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
?>
                                                                                                                                                                             wp-admin/upgrade.php                                                                                0000755 0023422 0004734 00000005077 11055617334 015477  0                                                                                                    ustar   tuttibambide                    psacln                                                                                                                                                                                                                 <?php
/**
 * Upgrade WordPress Page.
 *
 * @package WordPress
 * @subpackage Administration
 */

/**
 * We are upgrading WordPress.
 *
 * @since unknown
 * @var bool
 */
define('WP_INSTALLING', true);

/** Load WordPress Bootstrap */
require('../wp-load.php');

timer_start();
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');

if ( isset($_GET['step']) )
	$step = $_GET['step']