summaryrefslogtreecommitdiff
path: root/kolab.org
diff options
context:
space:
mode:
authorTorsten Grote <grote@kolabsys.com>2013-07-03 13:53:17 (GMT)
committerTorsten Grote <grote@kolabsys.com>2013-07-03 13:53:17 (GMT)
commit5df17bdb1caa98fa209ddb8a2b0fbfaea6faccc5 (patch)
treed8c698bd02d856ea40537034766f7f3078e95e20 /kolab.org
parent6ec0b29b012d62576fa566e303ab9334b31b6319 (diff)
downloadkolab.org-www-5df17bdb1caa98fa209ddb8a2b0fbfaea6faccc5.tar.gz
add variable module for i18n
Diffstat (limited to 'kolab.org')
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/LICENSE.txt339
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/README.txt81
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/forum.variable.inc64
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/locale.variable.inc92
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/menu.variable.inc61
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/node.variable.inc144
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/system.variable.inc447
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/taxonomy.variable.inc46
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/translation.variable.inc13
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/user.variable.inc218
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.api.php213
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.form.inc200
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.inc280
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.info20
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.install58
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.module800
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.test53
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.tokens.inc51
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.variable.inc366
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_admin/variable_admin.inc209
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_admin/variable_admin.info11
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_admin/variable_admin.module109
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_advanced/variable_advanced.info11
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_advanced/variable_advanced.module5
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_advanced/variable_advanced.variable.inc73
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_example/variable_example.info14
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_example/variable_example.module81
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_example/variable_example.variable.inc67
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/README.txt93
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.api.php96
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.class.inc544
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.drush.inc112
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.features.inc127
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.form.inc400
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.info16
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.install21
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.module635
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.variable.inc61
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm_union.class.inc155
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_store/README.txt9
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_store/variable_store.class.inc46
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_store/variable_store.info16
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_store/variable_store.install64
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_store/variable_store.module148
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_store/variable_store.test78
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_views/includes/views_handler_field_variable_title.inc12
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_views/includes/views_handler_field_variable_value.inc23
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_views/includes/views_plugin_argument_default_variable.inc45
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_views/variable_views.info17
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_views/variable_views.module41
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_views/variable_views.views.inc67
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_views/variable_views.views_default.inc86
52 files changed, 7038 insertions, 0 deletions
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/LICENSE.txt b/kolab.org/www/drupal-7.18/sites/all/modules/variable/LICENSE.txt
new file mode 100644
index 0000000..d159169
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/LICENSE.txt
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/README.txt b/kolab.org/www/drupal-7.18/sites/all/modules/variable/README.txt
new file mode 100644
index 0000000..8a2a919
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/README.txt
@@ -0,0 +1,81 @@
+
+Drupal module: Variable API
+===========================
+
+Variable module will provide a registry for meta-data about Drupal variables.
+
+Module Developers: Please declare your variables.
+
+Why?
+====
+- So other modules can know about your module's variables and they can be translated, exported, etc.
+- You'll get automatic variable edit forms, tokens, access control and uninstall for free.
+
+How?
+====
+Easy: Implement hook_variable_info();
+
+/**
+ * Implements hook_variable_info().
+ */
+function mymodule_variable_info($options) {
+
+ $variable['mymodule_number'] = array(
+ 'title' => t('Magic number', array(), $options),
+ 'description' => t('Magic number, array(), $options),
+ 'type' => 'number',
+ 'access' => 'administer menus',
+ );
+
+ $variable['mymodule_name'] = array(
+ 'title' => t('Name', array(), $options),
+ 'description' => t('Enter your name, please.', array(), $options),
+ 'type' => 'string',
+ 'default' => t('Drupal user', array(), $options),
+ );
+
+ $variable['mymodule_mail'] = array(
+ 'title' => t('Mail'),
+ 'type' => 'mail_text',
+ // This type will spawn into two real variables: mymodule_mail_subject, mymodule_mail_body
+ // Everything, included the form elements, will be handled automatically
+ );
+
+ return $variable;
+}
+
+Note: You can have your variables declared in a separate file that just will be loaded when needed.
+
+ yourmodule.variable.inc
+
+FAQ
+===
+
+- Will I need to add a dependency on the variable.module?
+
+ Not neccessarily. Just if you want to enjoy some of the module's features advanced features like:
+ - Getting variable values or defaults in different languages. Use variable_get_value().
+ - Let other modules alter my variable defaults. Implement hook_variable_info_alter().
+ - Let other modules know when variables are changed. Use variable_set_value(). Implement hook_variable_update().
+ - Getting automatic forms for all the module's variables, a group of variables, etc..
+ - Having variables with multiple values handled automatically like mail body and subject or variables for node types.
+
+ Otherwise you can just provide the meta-data for other modules to use. You still get:
+ - Tokens for your variables like [variable:myvariable_name]
+ - Variables deleted automatically when the module is uninstalled
+ - Localizable texts for your variables when using the Internationalization module.
+
+- How do I get a form with all of my module's variables?
+
+ drupal_get_form('variable_module_form', 'mymodule');
+
+- Once I have declared a default for my variable, how can I benefit from it?
+
+ variable_get_value('variable_name');
+
+- What if I don't want to provide any administration form for my variables?
+
+ That's ok, people will still be able to see and edit them by enabling the 'Variable Admin' module included.
+
+
+
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/forum.variable.inc b/kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/forum.variable.inc
new file mode 100644
index 0000000..9fa1d51
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/forum.variable.inc
@@ -0,0 +1,64 @@
+<?php
+/**
+ * @file
+ * Variable API module. Definition for Drupal core variables
+ */
+
+/**
+ * Implements hook_variable_info().
+ */
+function forum_variable_info($options) {
+ $variables['forum_hot_topic'] = array(
+ 'title' => t('Hot topic threshold'),
+ 'type' => 'select_number',
+ 'default' => 15,
+ 'options' => array(5, 10, 15, 20, 25, 30, 35, 40, 50, 60, 80, 100, 150, 200, 250, 300, 350, 400, 500),
+ 'description' => t('The number of replies a topic must have to be considered "hot".'),
+ 'group' => 'forum_settings',
+ );
+ $variables['forum_per_page'] = array(
+ 'title' => t('Topics per page'),
+ 'type' => 'select_number',
+ 'default' => 25,
+ 'options' => array(10, 25, 50, 75, 100),
+ 'description' => t('Default number of forum topics displayed per page.'),
+ 'group' => 'forum_settings',
+ );
+ $forder = array(1 => t('Date - newest first'), 2 => t('Date - oldest first'), 3 => t('Posts - most active first'), 4 => t('Posts - least active first'));
+ $variables['forum_order'] = array(
+ 'title' => t('Default order'),
+ 'type' => 'select',
+ 'default' => 1,
+ 'options' => $forder,
+ 'description' => t('Default display order for topics.'),
+ 'group' => 'forum_settings',
+ );
+ // Some hidden variables that we may want exposed, localized, etc..
+ $variables['forum_nav_vocabulary'] = array(
+ 'type' => 'select',
+ 'options' => 'vocabulary_vid',
+ 'title' => t('Forum navigation vocabulary'),
+ 'default' => 0,
+ 'group' => 'forum_settings',
+ 'localize' => TRUE,
+ );
+ $variables['forum_containers'] = array(
+ 'type' => 'array',
+ 'title' => t('Forum containers'),
+ 'group' => 'forum_settings',
+ );
+ return $variables;
+}
+
+/**
+ * Implements hook_variable_group_info().
+ */
+function forum_variable_group_info() {
+ $groups['forum_settings'] = array(
+ 'title' => t('Forum settings'),
+ 'access' => 'administer forums',
+ 'path' => 'admin/structure/menu/settings',
+ );
+ return $groups;
+}
+
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/locale.variable.inc b/kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/locale.variable.inc
new file mode 100644
index 0000000..c8b0059
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/locale.variable.inc
@@ -0,0 +1,92 @@
+<?php
+/**
+ * @file
+ * Variable API module. Definition for Drupal core variables
+ */
+
+/**
+ * Implements hook_variable_info().
+ */
+function locale_variable_info($options) {
+ // This variable will be altered by translation module. See translation.variable.inc
+ $variables['language_content_type_[node_type]'] = array(
+ 'type' => 'multiple',
+ 'title' => t('Multilingual support'),
+ 'repeat' => array(
+ 'type' => 'enable',
+ // Set options here so translation module can add some more
+ 'options' => array(t('Disabled'), t('Enabled')),
+ ),
+ 'description' => t('Enable multilingual support for this content type. If enabled, a language selection field will be added to the editing form, allowing you to select from one of the <a href="!languages">enabled languages</a>. If disabled, new posts are saved with the default language. Existing content will not be affected by changing this option.', array('!languages' => url('admin/config/regional/language', $options)), $options),
+ 'group' => 'node_type_settings',
+ );
+ $variables['language_default'] = array(
+ 'title' => t('Site default language'),
+ 'type' => 'select',
+ 'group' => 'regional_settings',
+ 'options callback' => 'locale_variable_options_language',
+ 'format callback' => 'locale_variable_language_default_format',
+ 'element callback' => 'locale_variable_language_default_element',
+ 'default callback' => 'locale_variable_language_default',
+ );
+ return $variables;
+}
+
+/**
+ * Implements hook_variable_type_info().
+ */
+function locale_variable_type_info() {
+ // Language code
+ $type['language'] = array(
+ 'title' => t('Language'),
+ 'options callback' => 'locale_variable_options_language',
+ 'type' => 'select',
+ );
+ return $type;
+}
+
+/**
+ * Callback for all languages
+ */
+function locale_variable_options_language($variable, $options) {
+ return locale_language_list('name', TRUE);
+}
+
+/**
+ * Form element for site default language
+ */
+function locale_variable_language_default_element($variable, $options) {
+ $element = variable_form_element_options($variable, $options);
+ // Default needs to be language code for the radios to work.
+ $element['#default_value'] = $element['#default_value']->language;
+ // Since 'value callback' is useless as it is run before validation, we use validate
+ // callback to transform language code into an object.
+ $element['#element_validate'][] = 'locale_variable_language_element_validate';
+ return $element;
+}
+
+/**
+ * Get language default.
+ */
+function locale_variable_language_default($variable, $options) {
+ return language_default();
+}
+
+/**
+ * Format language object variable
+ */
+function locale_variable_language_default_format($variable, $options = array()) {
+ return !empty($variable['value']) ? check_plain($variable['value']->name) : t('None');
+}
+
+
+/**
+ * Replace language code by language object on submission.
+ *
+ * This runs alter default element validation so we know it is a valid checkbox option.
+ */
+function locale_variable_language_element_validate($element, &$form_state, $form) {
+ $languages = language_list();
+ $language = $languages[$element['#value']];
+ form_set_value($element, $language, $form_state);
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/menu.variable.inc b/kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/menu.variable.inc
new file mode 100644
index 0000000..444800e
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/menu.variable.inc
@@ -0,0 +1,61 @@
+<?php
+/**
+ * @file
+ * Variable API module. Definition for Drupal core variables
+ */
+
+/**
+ * Implements hook_variable_info().
+ */
+function menu_variable_info($options) {
+ $variables['menu_main_links_source'] = array(
+ 'type' => 'select',
+ 'title' => t('Source for the Main links'),
+ 'options' => 'menu',
+ 'default' => 'main-menu',
+ 'element' => array('#empty_option' => t('No Main links')),
+ 'description' => t('Select what should be displayed as the Main links (typically at the top of the page).', array(), $options),
+ 'group' => 'menu_settings'
+ );
+ $variables['menu_secondary_links_source'] = array(
+ 'type' => 'select',
+ 'title' => t('Source for the Secondary links'),
+ 'options' => 'menu',
+ 'default' => 'user-menu',
+ 'element' => array('#empty_option' => t('No Secondary links')),
+ 'description' => t('Select the source for the Secondary links.', array() , $options),
+ 'group' => 'menu_settings'
+ );
+ return $variables;
+}
+
+/**
+ * Implements hook_variable_group_info().
+ */
+function menu_variable_group_info() {
+ $groups['menu_settings'] = array(
+ 'title' => t('Menu settings'),
+ 'access' => 'administer menu',
+ 'path' => 'admin/structure/menu/settings',
+ );
+ return $groups;
+}
+
+/**
+ * Implements hook_variable_type_info()
+ */
+function menu_variable_type_info() {
+ $type['menu'] = array(
+ 'title' => t('Menu'),
+ 'type' => 'select',
+ 'options callback' => 'menu_variable_menu_list',
+ );
+ return $type;
+}
+
+/**
+ * Menu option list
+ */
+function menu_variable_menu_list($variable, $options) {
+ return menu_get_menus();
+} \ No newline at end of file
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/node.variable.inc b/kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/node.variable.inc
new file mode 100644
index 0000000..4047672
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/node.variable.inc
@@ -0,0 +1,144 @@
+<?php
+/**
+ * @file
+ * Variable API module. Definition for Drupal core variables
+ */
+
+/**
+ * Implements hook_variable_info().
+ */
+function node_variable_info($options) {
+ // Per content type options. Group 'node_type_settings'.
+ $variables['teaser_length_[node_type]'] = array(
+ 'type' => 'multiple',
+ 'title' => t('Length of trimmed posts'),
+ 'repeat' => array(
+ 'type' => 'select',
+ 'default' => 600,
+ 'options' => 'text_length',
+ ),
+ 'description' => t("The maximum number of characters used in the trimmed version of a post. Drupal will use this setting to determine at which offset long posts should be trimmed. The trimmed version of a post is typically used as a teaser when displaying the post on the main page, in XML feeds, etc. To disable teasers, set to 'Unlimited'. Note that this setting will only affect new or updated content and will not affect existing teasers.", array(), $options),
+ 'group' => 'node_type_settings',
+ );
+ $variables['node_preview_[node_type]'] = array(
+ 'type' => 'multiple',
+ 'title' => t('Preview before submitting'),
+ 'repeat' => array(
+ 'type' => 'select',
+ 'default' => DRUPAL_OPTIONAL,
+ 'options callback' => 'node_variable_option_list',
+ ),
+ 'description' => t('Must users preview posts before submitting?', array(), $options),
+ 'group' => 'node_type_settings',
+ );
+ $variables['node_options_[node_type]'] = array(
+ 'type' => 'multiple',
+ 'title' => t('Default options', array(), $options),
+ 'repeat' => array(
+ 'type' => 'options',
+ 'default' => array('status', 'promote'),
+ 'options callback' => 'node_variable_option_list',
+ ),
+ 'description' => t('Users with the <em>administer nodes</em> permission will be able to override these options.', array(), $options),
+ 'group' => 'node_type_settings',
+ );
+ $variables['node_submitted_[node_type]'] = array(
+ 'type' => 'multiple',
+ 'title' => t('Display author and date information.', array(), $options),
+ 'repeat' => array(
+ 'default' => TRUE,
+ 'type' => 'boolean',
+ ),
+ 'description' => t('Author username and publish date will be displayed.', array(), $options),
+ 'group' => 'node_type_settings',
+ );
+ return $variables;
+}
+
+
+/**
+ * Implements hook_variable_group_info().
+ */
+function node_variable_group_info() {
+ $groups['node_type_settings'] = array(
+ 'title' => t('Node type settings'),
+ 'description' => t('Settings for each node type.'),
+ 'access' => 'administer nodes',
+ 'path' => 'admin/structure/types',
+ );
+ return $groups;
+}
+
+/**
+ * Implements hook_variable_type_info()
+ */
+function node_variable_type_info() {
+ $type['node_type'] = array(
+ 'title' => t('Node type'),
+ 'options callback' => 'node_type_get_names',
+ 'type' => 'select',
+ );
+ $type['text_length'] = array(
+ 'title' => t('Text length'),
+ 'options callback' => 'node_variable_option_text_length',
+ 'type' => 'select',
+ );
+ return $type;
+}
+
+/**
+ * Callback for node variable options
+ */
+function node_variable_option_text_length($variable, $options = array()) {
+ return array(
+ 0 => t('Unlimited', array(), $options),
+ 200 => t('@count characters', array('@count' => 200), $options),
+ 400 => t('@count characters', array('@count' => 400), $options),
+ 600 => t('@count characters', array('@count' => 600), $options),
+ 800 => t('@count characters', array('@count' => 800), $options),
+ 1000 => t('@count characters', array('@count' => 1000), $options),
+ 1200 => t('@count characters', array('@count' => 1200), $options),
+ 1400 => t('@count characters', array('@count' => 1400), $options),
+ 1600 => t('@count characters', array('@count' => 1600), $options),
+ 1800 => t('@count characters', array('@count' => 1800), $options),
+ 2000 => t('@count characters', array('@count' => 2000), $options),
+ );
+}
+
+/**
+ * Callback for variable options
+ */
+function node_variable_option_list($variable, $options = array()) {
+ switch ($variable['parent']) {
+ case 'node_preview_[node_type]':
+ return array(
+ DRUPAL_DISABLED => t('Disabled', array(), $options),
+ DRUPAL_OPTIONAL => t('Optional', array(), $options),
+ DRUPAL_REQUIRED => t('Required', array(), $options),
+ );
+ case 'node_options_[node_type]':
+ return array(
+ 'status' => t('Published', array(), $options),
+ 'promote' => t('Promoted to front page', array(), $options),
+ 'sticky' => t('Sticky at top of lists', array(), $options),
+ 'revision' => t('Create new revision', array(), $options),
+ );
+ }
+}
+
+/**
+ * Build subform for variables for node type
+ *
+ * @param $type
+ * Node type name
+ * @param $list
+ * List of variables to include
+ */
+function node_variable_type_subform($type, $list) {
+ module_load_include('form.inc', 'variable');
+ foreach ($list as $name) {
+ $variable = variable_get_child($name . '_[node_type]', $type);
+ $form[$name] = variable_form_element($variable);
+ }
+ return $form;
+} \ No newline at end of file
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/system.variable.inc b/kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/system.variable.inc
new file mode 100644
index 0000000..30a8ceb
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/system.variable.inc
@@ -0,0 +1,447 @@
+<?php
+/**
+ * @file
+ * Variable API module. Definition for Drupal core variables
+ */
+
+/**
+ * Implements hook_variable_info().
+ */
+function system_variable_info($options) {
+ // Site configuration, site information
+ $variables['site_name'] = array(
+ 'type' => 'string',
+ 'title' => t('Site name', array(), $options),
+ 'default' => 'Drupal',
+ 'description' => t('The name of this website.', array(), $options),
+ 'required' => TRUE,
+ 'group' => 'site_information',
+ );
+ $variables['site_mail'] = array(
+ 'type' => 'mail_address',
+ 'title' => t('Site email address', array(), $options),
+ 'default' => ini_get('sendmail_from'),
+ 'description' => t("The <em>From</em> address in automated e-mails sent during registration and new password requests, and other notifications. (Use an address ending in your site's domain to help prevent this e-mail being flagged as spam.)", array(), $options),
+ 'required' => TRUE,
+ 'group' => 'site_information',
+ );
+ $variables['site_slogan'] = array(
+ 'type' => 'text',
+ 'title' => t('Site slogan', array(), $options),
+ 'default' => '',
+ 'description' => t("Your site's motto, tag line, or catchphrase (often displayed alongside the title of the site).", array(), $options),
+ 'group' => 'site_information',
+ );
+ $variables['anonymous'] = array(
+ 'type' => 'string',
+ 'title' => t('Anonymous user', array(), $options),
+ 'default' => t('Anonymous', array(), $options),
+ 'description' => t('The name used to indicate anonymous users.', array(), $options),
+ 'required' => TRUE,
+ 'group' => 'site_information',
+ );
+ $variables['site_frontpage'] = array(
+ 'type' => 'drupal_path',
+ 'title' => t('Default front page', array(), $options),
+ 'default' => 'node',
+ 'description' => t('The home page displays content from this relative URL. If unsure, specify "node".', array(), $options),
+ 'required' => TRUE,
+ 'group' => 'site_information',
+ );
+ $variables['default_nodes_main'] = array(
+ 'type' => 'select_number',
+ 'title' => t('Number of posts on main page', array(), $options),
+ 'default' => 10,
+ 'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30),
+ 'description' => t('The maximum number of posts displayed on overview pages such as the front page.', array(), $options),
+ 'group' => 'site_information',
+ );
+
+ $variables['site_403'] = array(
+ 'type' => 'drupal_path',
+ 'title' => t('Default 403 (access denied) page', array(), $options),
+ 'default' => '',
+ 'description' => t('This page is displayed when the requested document is denied to the current user. Leave blank to display a generic "access denied" page.', array(), $options),
+ 'group' => 'site_information',
+ );
+ $variables['site_404'] = array(
+ 'type' => 'drupal_path',
+ 'title' => t('Default 404 (not found) page', array(), $options),
+ 'default' => '',
+ 'description' => t('This page is displayed when no other content matches the requested document. Leave blank to display a generic "page not found" page.', array(), $options),
+ 'group' => 'site_information',
+ );
+
+ // Feed settings. Group 'feed_settings'.
+ $variables['feed_description'] = array(
+ 'type' => 'text',
+ 'title' => t('Feed description'),
+ 'default' => '',
+ 'description' => t('Description of your site, included in each feed.', array(), $options),
+ 'group' => 'feed_settings',
+ );
+ $variables['feed_default_items'] = array(
+ 'type' => 'select_number',
+ 'title' => t('Number of items in each feed'),
+ 'default' => 10,
+ 'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30),
+ 'description' => t('Default number of items to include in each feed.', array(), $options),
+ 'group' => 'feed_settings',
+ );
+ $variables['feed_item_length'] = array(
+ 'type' => 'select',
+ 'title' => t('Feed content'),
+ 'default' => 'fulltext',
+ 'options' => array(
+ 'title' => t('Titles only', array(), $options),
+ 'teaser' => t('Titles plus teaser', array(), $options),
+ 'fulltext' => t('Full text', array(), $options)
+ ),
+ 'description' => t('Global setting for the default display of content items in each feed.', array(), $options),
+ 'group' => 'feed_settings',
+ );
+
+ // Regional settings. Group 'regional_settings'.
+ $variables['site_default_country'] = array(
+ 'type' => 'select',
+ 'options' => 'country',
+ 'title' => t('Default country', array(), $options),
+ 'element' => array('#type' => 'select', '#attributes' => array('class' => array('country-detect'))),
+ 'group' => 'regional_settings',
+ );
+ $variables['date_first_day'] = array(
+ 'type' => 'select',
+ 'options' => 'weekday',
+ 'title' => t('First day of week', array(), $options),
+ 'default' => 0,
+ 'localize' => TRUE,
+ 'group' => 'regional_settings',
+ );
+ $variables['date_default_timezone'] = array(
+ 'type' => 'select',
+ 'options' => 'timezone',
+ 'title' => t('Default time zone', array(), $options),
+ 'default callback' => 'date_default_timezone_get',
+ 'group' => 'regional_settings',
+ );
+ $variables['configurable_timezones'] = array(
+ 'type' => 'boolean',
+ 'title' => t('Users may set their own time zone.', array(), $options),
+ 'default' => 1,
+ 'group' => 'regional_settings',
+ );
+ $variables['empty_timezone_message'] = array(
+ 'type' => 'boolean',
+ 'title' => t('Remind users at login if their time zone is not set.', array(), $options),
+ 'default' => 0,
+ 'description' => t('Only applied if users may set their own time zone.', array(), $options),
+ 'group' => 'regional_settings',
+ );
+ $variables['user_default_timezone'] = array(
+ 'type' => 'select',
+ 'title' => t('Time zone for new users'),
+ 'default' => DRUPAL_USER_TIMEZONE_DEFAULT,
+ 'options' => array(
+ DRUPAL_USER_TIMEZONE_DEFAULT => t('Default time zone.', array(), $options),
+ DRUPAL_USER_TIMEZONE_EMPTY => t('Empty time zone.', array(), $options),
+ DRUPAL_USER_TIMEZONE_SELECT => t('Users may set their own time zone at registration.', array(), $options),
+ ),
+ 'description' => t('Only applied if users may set their own time zone.', array(), $options),
+ 'localize' => TRUE,
+ 'group' => 'regional_settings',
+ );
+ $variables['date_format_[date_type]'] = array(
+ 'type' => 'multiple',
+ 'title' => t('Date format'),
+ 'repeat' => array(
+ 'type' => 'select',
+ 'options' => 'date_format',
+ ),
+ 'group' => 'regional_settings',
+ );
+ // Maintenance mode. Group 'site_information'
+ $variables['maintenance_mode'] = array(
+ 'type' => 'boolean',
+ 'title' => t('Put site into maintenance mode', array(), $options),
+ 'default' => 0,
+ 'description' => t('When enabled, only users with the "Use the site in maintenance mode" <a href="@permissions-url">permission</a> are able to access your site to perform maintenance; all other visitors see the maintenance mode message configured below. Authorized users can log in directly via the <a href="@user-login">user login</a> page.', array('@permissions-url' => url('admin/people/permissions'), '@user-login' => url('user')), $options),
+ 'group' => 'site_information'
+ );
+ $variables['maintenance_mode_message'] = array(
+ 'type' => 'text',
+ 'title' => t('Maintenance mode message', array(), $options),
+ 'default' => t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get('site_name', 'Drupal')), $options),
+ 'description' => t('Message to show visitors when the site is in maintenance mode.', array(), $options),
+ 'group' => 'site_information'
+ );
+ // Theme settings, we may want to localize the logo. Group 'theme_settings'
+ $variables['theme_settings'] = array(
+ 'type' => 'properties',
+ 'title' => t('Global theme settings.', array(), $options),
+ 'group' => 'theme_settings',
+ 'default callback' => 'system_variable_theme_defaults',
+ 'localize' => TRUE,
+ 'group' => 'theme_settings',
+ );
+ $variables['theme_[theme]_settings'] = array(
+ 'type' => 'multiple',
+ 'multiple' => 'theme',
+ 'title' => t('Theme settings', array(), $options),
+ 'description' => t('Logo, icons and other specific theme settings.', array(), $options),
+ 'repeat' => array(
+ 'type' => 'properties',
+ 'default callback' => 'system_variable_theme_defaults',
+ ),
+ 'group' => 'theme_settings',
+ 'localize' => TRUE,
+ );
+ // Performance options, changing them may need some extra cache refresh.
+ $variables['cache'] = array(
+ 'type' => 'boolean',
+ 'title' => t('Cache pages for anonymous users', array(), $options),
+ 'default' => 0,
+ 'group' => 'system_performance',
+ );
+ // This one belongs to a different module, block, but it won't do any harm having it here.
+ $variables['block_cache'] = array(
+ 'type' => 'boolean',
+ 'title' => t('Cache blocks'),
+ 'default' => FALSE,
+ 'description' => t('Block caching is inactive if you have enabled modules defining content access restrictions.', array(), $options),
+ 'group' => 'system_performance',
+ );
+ $interval = array(0, 60, 180, 300, 600, 900, 1800, 2700, 3600, 10800, 21600, 32400, 43200, 86400);
+ $variables['cache_lifetime'] = array(
+ 'type' => 'time_interval',
+ 'title' => t('Minimum cache lifetime', array(), $options),
+ 'default' => 0,
+ 'interval values' => $interval,
+ 'description' => t('Cached pages will not be re-created until at least this much time has elapsed.', array(), $options),
+ 'group' => 'system_performance',
+ );
+ $variables['page_cache_maximum_age'] = array(
+ 'type' => 'time_interval',
+ 'title' => t('Expiration of cached pages', array(), $options),
+ 'default' => 0,
+ 'interval values' => $interval,
+ 'description' => t('The maximum time an external cache can use an old version of a page.', array(), $options),
+ 'group' => 'system_performance',
+ );
+
+ $description = t('External resources can be optimized automatically, which can reduce both the size and number of requests made to your website.', array(), $options);
+ $variables['page_compression'] = array(
+ 'type' => 'enable',
+ 'title' => t('Compress cached pages.', array(), $options),
+ 'description' => $description,
+ 'default' => TRUE,
+ 'group' => 'system_performance',
+ );
+ $variables['preprocess_css'] = array(
+ 'type' => 'boolean',
+ 'title' => t('Aggregate and compress CSS files.'),
+ 'description' => $description,
+ 'default' => 0,
+ 'group' => 'system_performance',
+ );
+ $variables['preprocess_js'] = array(
+ 'type' => 'boolean',
+ 'title' => t('Aggregate JavaScript files.'),
+ 'description' => $description,
+ 'default' => 0,
+ 'group' => 'system_performance',
+ );
+ return $variables;
+}
+
+/**
+ * Implements hook_variable_group_info().
+ */
+function system_variable_group_info() {
+ $groups['site_information'] = array(
+ 'title' => t('Site information'),
+ 'description' => t('Site information and maintenance mode'),
+ 'access' => 'administer site configuration',
+ 'path' => array('admin/config/system/site-information', 'admin/config/development/maintenance'),
+ );
+ $groups['feed_settings'] = array(
+ 'title' => t('Feed settings'),
+ 'description' => t('Feed settings'),
+ 'access' => 'administer site configuration',
+ );
+ $groups['regional_settings'] = array(
+ 'title' => t('Regional settings'),
+ 'description' => t('Regional settings'),
+ 'access' => 'administer site configuration',
+ );
+ $groups['theme_settings'] = array(
+ 'title' => t('Theme settings'),
+ 'description' => t('Theme settings'),
+ 'access' => 'administer site configuration',
+ );
+ $groups['system_performance'] = array(
+ 'title' => t('System performance'),
+ 'description' => t('Options related with cache, file compression and bandwidth optimization.'),
+ 'access' => 'administer site configuration',
+ 'path' => 'admin/config/development/performance',
+ );
+ return $groups;
+}
+
+/**
+ * Implements hook_variable_type_info().
+ */
+function system_variable_type_info() {
+ // Internal Drupal path as used by menu items.
+ $type['drupal_path'] = array(
+ 'title' => t('Drupal path'),
+ 'element callback' => 'system_variable_path_element',
+ 'localize' => TRUE,
+ );
+ // File system path, relative to Drupal installation.
+ $type['file_path'] = array(
+ 'title' => t('File path'),
+ 'default' => conf_path() . '/files',
+ 'element' => array('#type' => 'textfield', '#maxlength' => 255, '#after_build' => array('system_check_directory')),
+ );
+ // These are just for option lists though they can be used as variable type to have a selectable value.
+ $type['weekday'] = array(
+ 'title' => t('Day of week'),
+ 'type' => 'select',
+ 'options callback' => 'system_variable_option_weekday',
+ );
+ $type['theme'] = array(
+ 'title' => t('Theme'),
+ 'type' => 'select',
+ 'options callback' => 'system_variable_option_theme',
+ 'cache' => TRUE,
+ );
+ $type['country'] = array(
+ 'title' => t('Country'),
+ 'type' => 'select',
+ 'options callback' => 'system_variable_option_country',
+ 'cache' => TRUE,
+ );
+ $type['timezone'] = array(
+ 'title' => t('Time zone'),
+ 'type' => 'select',
+ 'options callback' => 'system_time_zones',
+ 'cache' => TRUE,
+ );
+ $type['date_type'] = array(
+ 'title' => t('Date type'),
+ 'type' => 'select',
+ 'options callback' => 'system_variable_option_date_type',
+ );
+ $type['date_format'] = array(
+ 'title' => t('Date format'),
+ 'type' => 'select',
+ 'options callback' => 'system_variable_option_date_format',
+ );
+ $type['time_interval'] = array(
+ 'title' => t('Time interval'),
+ 'type' => 'select',
+ 'options callback' => 'system_variable_option_time_interval',
+ );
+ return $type;
+}
+
+/**
+ * Callback for theme options
+ */
+function system_variable_option_theme($variable, $options) {
+ $list = array();
+ foreach (list_themes() as $theme) {
+ $list[$theme->name] = $theme->info['name'];
+ }
+ return $list;
+}
+
+/**
+ * Callback for weekday options
+ */
+function system_variable_option_weekday($variable, $options) {
+ return array(
+ 0 => t('Sunday', array(), $options),
+ 1 => t('Monday', array(), $options),
+ 2 => t('Tuesday', array(), $options),
+ 3 => t('Wednesday', array(), $options),
+ 4 => t('Thursday', array(), $options),
+ 5 => t('Friday', array(), $options),
+ 6 => t('Saturday', array(), $options)
+ );
+}
+
+/**
+ * Callback for date types
+ */
+function system_variable_option_date_type($variable, $options) {
+ $list = array();
+ foreach (system_get_date_types() as $type => $info) {
+ $list[$type] = check_plain($info['title']);
+ }
+ return $list;
+}
+
+/**
+ * Callback for date types
+ *
+ * @todo These should be different for some variables
+ */
+function system_variable_option_date_format($variable, $options) {
+ // Get list of all available date formats.
+ $all_formats = array();
+ foreach (system_get_date_formats() as $type => $format_info) {
+ $all_formats = array_merge($all_formats, $format_info);
+ }
+ if ($custom_formats = system_get_date_formats('custom')) {
+ $all_formats = array_merge($all_formats, $custom_formats);
+ }
+ foreach ($all_formats as $f => $format) {
+ $list[$f] = format_date(REQUEST_TIME, 'custom', $f);
+ }
+ return $list;
+}
+
+/**
+ * Callback for country options
+ */
+function system_variable_option_country($variable, $options) {
+ include_once DRUPAL_ROOT . '/includes/locale.inc';
+ return country_get_list();
+}
+
+/**
+ * Callback for time interval options
+ */
+function system_variable_option_time_interval($variable, $options) {
+ $period = drupal_map_assoc($variable['interval values'], 'format_interval');
+ if (isset($period[0])) {
+ $period[0] = '<' . t('none') . '>';
+ }
+ return $period;
+}
+
+/**
+ * Callback for default theme settings
+ */
+function system_variable_theme_defaults($variable, $options) {
+ return array(
+ 'default_logo' => 1,
+ 'logo_path' => '',
+ 'default_favicon' => 1,
+ 'favicon_path' => '',
+ 'favicon_mimetype' => 'image/vnd.microsoft.icon',
+ );
+}
+
+/**
+ * Callback for path variable element
+ */
+function system_variable_path_element($variable, $options) {
+ $element = variable_form_element_default($variable, $options) +array(
+ '#type' => 'textfield',
+ '#size' => 40,
+ '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='),
+ );
+ return $element;
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/taxonomy.variable.inc b/kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/taxonomy.variable.inc
new file mode 100644
index 0000000..4aa27ac
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/taxonomy.variable.inc
@@ -0,0 +1,46 @@
+<?php
+/**
+ * @file
+ * Variable API module. Definition for Drupal core variables
+ */
+
+/**
+ * Implements hook_variable_type_info()
+ */
+function taxonomy_variable_type_info() {
+ $type['vocabulary_vid'] = array(
+ 'title' => t('Vocabulary'),
+ 'options callback' => 'taxonomy_variable_vocabulary_vid_list',
+ );
+ $type['vocabulary_name'] = array(
+ 'title' => t('Vocabulary'),
+ 'options callback' => 'taxonomy_variable_vocabulary_name_list',
+ );
+ return $type;
+}
+
+/**
+ * Options callback for vocabulary
+ */
+function taxonomy_variable_vocabulary_vid_list($variable, $options) {
+ static $list;
+ if (!isset($list)) {
+ foreach (taxonomy_get_vocabularies() as $vocab) {
+ $list[$vocab->vid] = $vocab->name;
+ };
+ }
+ return $list;
+}
+
+/**
+ * Options callback for vocabulary
+ */
+function taxonomy_variable_vocabulary_name_list($variable, $options) {
+ static $list;
+ if (!isset($list)) {
+ foreach (taxonomy_get_vocabularies() as $vocab) {
+ $list[$vocab->machine_name] = $vocab->name;
+ };
+ }
+ return $list;
+} \ No newline at end of file
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/translation.variable.inc b/kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/translation.variable.inc
new file mode 100644
index 0000000..0f81f30
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/translation.variable.inc
@@ -0,0 +1,13 @@
+<?php
+/**
+ * @file
+ * Variable API module. Definition for Drupal core variables
+ */
+
+/**
+ * Implements hook_variable_info_alter().
+ */
+function translation_variable_info_alter(&$variables, $options) {
+ $variables['language_content_type_[node_type]']['repeat']['options'][TRANSLATION_ENABLED] = t('Enabled, with translation', array(), $options);
+ $variables['language_content_type_[node_type]']['description'] = t('Enable multilingual support for this content type. If enabled, a language selection field will be added to the editing form, allowing you to select from one of the <a href="!languages">enabled languages</a>. You can also turn on translation for this content type, which lets you have content translated to any of the enabled languages. If disabled, new posts are saved with the default language. Existing content will not be affected by changing this option.', array('!languages' => url('admin/config/regional/language', $options)), $options);
+} \ No newline at end of file
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/user.variable.inc b/kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/user.variable.inc
new file mode 100644
index 0000000..24e0f5b
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/includes/user.variable.inc
@@ -0,0 +1,218 @@
+<?php
+/**
+ * @file
+ * Variable API module. Definition for Drupal core variables
+ */
+
+/**
+ * User module variables
+ */
+function user_variable_info($options) {
+ // $variables = array('#type' => 'fieldset', 'title' => t('User registration settings'));
+ $variables['user_register'] = array(
+ 'type' => 'select',
+ 'title' => t('Public registrations'),
+ 'default' => 1,
+ 'options' => TRUE,
+ 'options callback' => 'user_variable_option_list',
+ 'group' => 'user_settings',
+ );
+ $variables['user_email_verification'] = array(
+ 'type' => 'boolean',
+ 'title' => t('Require e-mail verification when a visitor creates an account', array(), $options),
+ 'default' => TRUE,
+ 'description' => t('If this box is checked, new users will be required to validate their e-mail address prior to logging into the site, and will be assigned a system-generated password. With it unchecked, users will be logged in immediately upon registering, and may select their own passwords during registration.', array(), $options),
+ 'group' => 'user_settings',
+ );
+ $variables['user_registration_help'] = array(
+ 'type' => 'text',
+ 'title' => t('User registration guidelines', array(), $options),
+ 'default' => '',
+ 'description' => t('This text is displayed at the top of the user registration form and is useful for helping or instructing your users.', array(), $options),
+ 'group' => 'user_settings',
+ );
+
+ // User e-mail settings.
+
+ // These email tokens are shared for all settings, so just define
+ // the list once to help ensure they stay in sync.
+ $email_token_help = ' ' . t('Available variables are: [site:name], [site:url], [user:name], [user:mail], [site:login-url], [site:url-brief], [user:edit-url], [user:one-time-login-url], [user:cancel-url].', array(), $options);
+
+ $variables['user_mail_register_admin_created_[mail_part]'] = array(
+ 'type' => 'user_mail',
+ 'title' => t('Welcome, new user created by administrator', array(), $options),
+ 'description' => t('Customize welcome e-mail messages sent to new member accounts created by an administrator.', array(), $options) . $email_token_help,
+ 'group' => 'user_mails',
+ );
+ $variables['user_mail_register_no_approval_required_[mail_part]'] = array(
+ 'type' => 'user_mail',
+ 'title' => t('Welcome, no approval required', array(), $options),
+ 'description' => t('Customize welcome e-mail messages sent to new members upon registering, when no administrator approval is required.', array(), $options) . $email_token_help,
+ 'group' => 'user_mails',
+ );
+ $variables['user_mail_register_pending_approval_[mail_part]'] = array(
+ 'type' => 'user_mail',
+ 'title' => t('Welcome, awaiting administrator approval', array(), $options),
+ 'description' => t('Customize welcome e-mail messages sent to new members upon registering, when administrative approval is required.', array(), $options) . $email_token_help,
+ 'group' => 'user_mails',
+ );
+ $variables['user_mail_password_reset_[mail_part]'] = array(
+ 'type' => 'user_mail',
+ 'title' => t('Password recovery email'),
+ 'description' => t('Customize e-mail messages sent to users who request a new password.') . $email_token_help,
+ 'group' => 'user_mails',
+ );
+ $variables['user_mail_status_activated_[mail_part]'] = array(
+ 'type' => 'user_mail',
+ 'title' => t('Account activation email', array(), $options),
+ 'description' => t('Enable and customize e-mail messages sent to users upon account activation (when an administrator activates an account of a user who has already registered, on a site where administrative approval is required).', array(), $options) . $email_token_help,
+ 'group' => 'user_mails',
+ );
+ $variables['user_mail_status_activated_notify'] = array(
+ 'type' => 'boolean',
+ 'title' => t('Notify user when account is activated.', array(), $options),
+ 'default' => TRUE,
+ 'group' => 'user_settings',
+ );
+ $variables['user_mail_status_blocked_[mail_part]'] = array(
+ 'type' => 'user_mail',
+ 'title' => t('Account blocked email', array(), $options),
+ 'description' => t('Enable and customize e-mail messages sent to users when their accounts are blocked.') . $email_token_help,
+ 'group' => 'user_mails',
+ );
+ $variables['user_mail_status_blocked_notify'] = array(
+ 'type' => 'boolean',
+ 'title' => t('Notify user when account is blocked.', array(), $options),
+ 'default' => FALSE,
+ 'group' => 'user_settings',
+ );
+ $variables['user_mail_cancel_confirm_[mail_part]'] = array(
+ 'type' => 'user_mail',
+ 'title' => t('Account cancellation confirmation'),
+ 'description' => t('Edit the e-mail messages sent to users when they attempt to cancel their accounts.', array(), $options) . $email_token_help,
+ 'group' => 'user_mails',
+ );
+ $variables['user_mail_status_canceled_[mail_part]'] = array(
+ 'type' => 'user_mail',
+ 'title' => t('Account deleted email'),
+ 'description' => t('Enable and customize e-mail messages sent to users when their accounts are deleted.', array(), $options) . $email_token_help,
+ 'group' => 'user_mails',
+ );
+ $variables['user_mail_status_deleted_notify'] = array(
+ 'type' => 'boolean',
+ 'title' => t('Notify user when account is deleted.', array(), $options),
+ 'default' => FALSE,
+ 'group' => 'user_settings',
+ );
+ // User signatures.
+ $variables['user_signatures'] = array(
+ 'type' => 'enable',
+ 'title' => t('Signature support'),
+ 'default' => 0,
+ 'group' => 'user_settings',
+ );
+
+ // Picture support
+ $picture_support = variable_get('user_pictures', 0);
+ $form['user_pictures'] = array(
+ 'type' => 'enable',
+ 'title' => t('Picture support', array(), $options),
+ 'default' => 0,
+ 'group' => 'user_settings',
+ );
+ $variables['user_picture_path'] = array(
+ 'type' => 'file_path',
+ 'title' => t('Picture directory', array(), $options),
+ 'default' => 'pictures',
+ 'element' => array('#size' => 30, '#maxlength' => 255),
+ 'description' => t('Subdirectory in the file upload directory where pictures will be stored.', array(), $options),
+ 'group' => 'user_settings',
+ );
+ $variables['user_picture_default'] = array(
+ 'type' => 'url',
+ 'title' => t('Default picture', array(), $options),
+ 'default' => '',
+ 'description' => t('URL of picture to display for users with no custom picture selected. Leave blank for none.', array(), $options),
+ 'group' => 'user_settings',
+ );
+ $variables['user_picture_dimensions'] = array(
+ 'type' => 'string',
+ 'title' => t('Picture maximum dimensions', array(), $options),
+ 'default' => '85x85',
+ 'description' => t('Maximum dimensions for pictures, in pixels.', array(), $options),
+ 'element' => array('#size' => 15, '#maxlength' => 10),
+ 'group' => 'user_settings',
+ );
+ $variables['user_picture_file_size'] = array(
+ 'type' => 'number',
+ 'title' => t('Picture maximum file size', array(), $options),
+ 'default' => 30,
+ 'description' => t('Maximum file size for pictures, in kB.', array(), $options),
+ 'group' => 'user_settings',
+ );
+ $variables['user_picture_guidelines'] = array(
+ 'type' => 'text',
+ 'title' => t('Picture guidelines', array(), $options),
+ 'default' => '',
+ 'description' => t("This text is displayed at the picture upload form in addition to the default guidelines. It's useful for helping or instructing your users.", array(), $options),
+ 'group' => 'user_settings',
+ );
+
+ return $variables;
+}
+
+/**
+ * Node module variable groups
+ */
+function user_variable_group_info() {
+ $groups['user_settings'] = array(
+ 'title' => t('User settings'),
+ 'description' => t('User settings'),
+ 'access' => 'administer users',
+ 'path' => 'admin/user/settings',
+ );
+ $groups['user_mails'] = array(
+ 'title' => t('User emails'),
+ 'description' => t('User emails'),
+ 'access' => 'administer users',
+ 'path' => 'admin/user/settings',
+ );
+ return $groups;
+}
+
+/**
+ * Implements hook_variable_type_info().
+ */
+function user_variable_type_info() {
+ $types['user_mail'] = array(
+ 'title' => t('User mail text'),
+ 'type' => 'mail_text',
+ 'repeat' => array(
+ 'default callback' => 'user_variable_mail_default',
+ ),
+ );
+ return $types;
+}
+
+/**
+ * Default callback for user mail variables
+ */
+function user_variable_mail_default($variable, $options) {
+ // Remove 'user_mail_' prefix
+ $name = substr($variable['name'], 10);
+ return _user_mail_text($name, $options['language']);
+}
+
+/**
+ * Implements hook_variable_option_list().
+ */
+function user_variable_option_list($variable, $options = array()) {
+ switch ($variable['name']) {
+ case 'user_register':
+ return array(
+ t('Only site administrators can create new user accounts.', array(), $options),
+ t('Visitors can create accounts and no administrator approval is required.', array(), $options),
+ t('Visitors can create accounts but administrator approval is required.', array(), $options)
+ );
+ }
+} \ No newline at end of file
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.api.php b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.api.php
new file mode 100644
index 0000000..7e0c7a5
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.api.php
@@ -0,0 +1,213 @@
+<?php
+
+/**
+ * @file
+ * Hooks provided by the Variable module.
+ */
+
+/**
+ * @defgroup variable_api_hooks Variable API Hooks
+ * @{
+ * Functions to define and modify information about variables.
+ *
+ * These hooks and all the related callbacks may be defined in a separate file
+ * named module.variable.inc
+ *
+ * @}
+ */
+
+/**
+ * Define variables used by a module.
+ *
+ * Provides meta-information for each variable that includes at the very least some human readable title.
+ * This information may be used by other modules to select variables from a list for translating, exporting, etc.
+ *
+ * Though not required we can also provide some more information to be able to handle the variable in an effective
+ * way, like which type of data and form element it uses, default value, etc.. There are multiple predefined
+ * variable types ('type' attribute) that will add a predefined set of properties. Some of them are:
+ *
+ * - "string": Simple plain string variable. The form element will be a text field and it will be localizable.
+ * - "number": Simple numeric value. The form element will be a text field.
+ * - "boolean": Simple TRUE/FALSE value. It will be a checkbox.
+ * - "enable": Enabled / Disabled selector. It will display as two radio buttons.
+ * - "select": Selectable list of options. Depending on the number of options, the element will be a list of
+ * radios or a drop down.
+ * - "options": List of options with multiple choices. It will be a list of checkboxes.
+ * ...
+ *
+ * More variable types can be defined by modules using hook_variable_type_info().
+ *
+ * For the case of variable names that depend on some other parameter (like variables per content-type),
+ * there's some special type of variables: Multiple variables. These can be defined like this:
+ *
+ * @code
+ * $variables['node_options_[node_type]'] = array(
+ * 'type' => 'multiple',
+ * 'title' => t('Default options', array(), $options),
+ * 'repeat' => array(
+ * 'type' => 'options',
+ * 'default' => array('status', 'promote'),
+ * 'options callback' => 'node_variable_option_list',
+ * ),
+ * );
+ * @endcode
+ *
+ * This multiple variable will spawn into one variable for each node type. Note the variable name that includes
+ * the property [node_type]. Values for [node_type] will be defined on hook_variable_type_info().
+ *
+ * The 'repeat' property defines the properties of children variables. In this case the 'type' property is optional
+ * and will default to 'multiple'.
+ *
+ * @param $options
+ * Array of options to build variable properties. Since variable properties are cached per language
+ * these options should be used at the very least for string translations, so titles and defaults are
+ * localized. Possible options:
+ * - "language" => Language object for which strings and defaults must be returned. This one will be always defined.
+ *
+ * @return
+ * An array of information defining the module's variables. The array
+ * contains a sub-array for each node variable, with the variable name
+ * as the key. Possible attributes:
+ * - "title": The human readable name of the variable, will be used in auto generated forms.
+ * - "type": Variable type, should be one of the defined on hook_variable_type_info().
+ * - "group": Group key, should be one of the defined on hook_variable_group_info().
+ * - "description": Variable description, will be used in auto generated forms.
+ * - "options": Array of selectable options, or option name as defined on hook_variable_option_info().
+ * - "options callback": Function to invoke to get the list of options.
+ * - "default": Default value.
+ * - "default callback": Function to invoke to get the default value.
+ * - "multiple": Array of multiple children variables to be created from this one.
+ * - "multiple callback": Function to invoke to get children variables.
+ * - "element": Form element properties to override the default ones for this variable type.
+ * - "element callback": Function to invoke to get a form element for this variable.
+ * - "module": Module to which this variable belongs. This property will be added automatically.
+ * - "repeat": Array of variable properties for children variables.
+ * - "localize": Boolean value, TRUE for variables that should be localized. This may be used by other modules.
+ * - "validate callback": Callback to validate the variable value, it will be added to form element #validate.
+ */
+function hook_variable_info($options) {
+ $variables['site_name'] = array(
+ 'type' => 'string',
+ 'title' => t('Name', array(), $options),
+ 'default' => 'Drupal',
+ 'description' => t('The name of this website.', array(), $options),
+ 'required' => TRUE,
+ );
+ $variables['site_403'] = array(
+ 'type' => 'drupal_path',
+ 'title' => t('Default 403 (access denied) page', array(), $options),
+ 'default' => '',
+ 'description' => t('This page is displayed when the requested document is denied to the current user. Leave blank to display a generic "access denied" page.', array(), $options),
+ );
+ return $variables;
+}
+
+/**
+ * Define types of variables or list of values used by a module.
+ *
+ * These subtypes can be used to provide defaults for all properties of variables of this type
+ * or to provide a list of options either for variable options (selectable values) or for children
+ * variables in the case of multiple variables.
+ *
+ * Example, three usages of variable type:
+ * @code
+ * // Use variable type 'weekday' to provide a selector for a day of the week
+ * $variables['date_first_day'] = array(
+ * 'type' => 'weekday',
+ * 'title' => t('First day of week'),
+ * 'default' => 0,
+ * );
+ *
+ * // Use 'options' with value 'weekday' for any other variable that needs to provide a selectable
+ * // list of days of the week. In this example you can select one or more days.
+ * $variables['working_days'] = array(
+ * 'type' => 'options',
+ * 'options' => 'weekday',
+ * 'title' => t('Select working days from the list.'),
+ * );
+ *
+ * // Use 'multiple' with value 'weekday' to create a subset of variables, one for each day of the week.
+ * // In fact, using '[weekday]' in the variable name will set these properties ('type' and 'multiple') automatically.
+ * $variables['daily_greeting_[weekday]'] = array(
+ * 'type' => 'multiple',
+ * 'multiple' => 'weekday',
+ * 'repeat' => array('type' => 'string'),
+ * 'title' => t('Greeting to display each day of the week'),
+ * );
+ * @endcode
+ *
+ * @return
+ * An array of information defining variable types. The array contains
+ * a sub-array for each variable type, with the variable type as the key.
+ *
+ * The possible attributes are the same as for hook_variable_info(), with the
+ * type attributes being added on top of the variable attributes.
+ *
+ * A special attribute:
+ * - "type": Variable subtype, the properties for the subtype will be added to these ones.
+ */
+function hook_variable_type_info() {
+ $type['mail_address'] = array(
+ 'title' => t('E-mail address'),
+ 'element' => array('#type' => 'textfield'),
+ 'token' => TRUE,
+ );
+ $type['mail_text'] = array(
+ 'title' => t('Mail text'),
+ 'multiple' => array('subject' => t('Subject'), 'body' => t('Body')),
+ 'build callback' => 'variable_build_mail_text',
+ 'localize' => TRUE,
+ 'type' => 'multiple',
+ );
+ return $type;
+}
+
+/**
+ * Define groups of variables used by a module.
+ *
+ * Variable groups are used for presentation only, to display and edit the variables
+ * on manageable groups. Groups can define a subset of a module's variables and can
+ * be reused accross modules to group related variables.
+ *
+ * A form to edit all variables in a group can be generated with:
+ *
+ * drupal_get_form('variable_group_form', group_name);
+ *
+ * @return
+ * An array of information defining variable types. The array contains
+ * a sub-array for each variable group, with the group as the key.
+ * Possible attributes:
+ * - "title": The human readable name of the group. Must be localized.
+ * - "description": The human readable description of the group. Must be localized.
+ * - "access": Permission required to edit group's variables. Will default to 'administer site configuration'.
+ * - "path": Array of administration paths where these variables can be accessed.
+ */
+function hook_variable_group_info() {
+ $groups['system_site_information'] = array(
+ 'title' => t('Site information'),
+ 'description' => t('Site information and maintenance mode'),
+ 'access' => 'administer site configuration',
+ 'path' => array('admin/config/system/site-information', 'admin/config/development/maintenance'),
+ );
+ $groups['system_feed_settings'] = array(
+ 'title' => t('Feed settings'),
+ 'description' => t('Feed settings'),
+ 'access' => 'administer site configuration',
+ );
+ return $groups;
+}
+
+/**
+ * Alter system settings forms.
+ *
+ * This is a special version of hook_form_alter() that is triggered only for
+ * system settings forms, and only after any other module has added/removed
+ * variables using hook_form_alter().
+ *
+ * It is used to mark / replace special realm variables that are contained in the form.
+ *
+ * @see hook_form_alter()
+ * @see variable_module_implements_alter()
+ */
+function hook_variable_settings_form_alter(&$form, &$form_state, $form_id) {
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.form.inc b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.form.inc
new file mode 100644
index 0000000..15c8043
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.form.inc
@@ -0,0 +1,200 @@
+<?php
+/**
+ * @file
+ * Variable API module. Form library.
+ */
+
+/**
+ * Build form element for a variable
+ */
+function variable_form_element($variable, $options = array()) {
+ $variable = variable_build($variable);
+ $variable = variable_build_options($variable, $options);
+ if (!empty($variable['element callback'])) {
+ $element = call_user_func($variable['element callback'], $variable, $options);
+ }
+ elseif (isset($variable['options'])) {
+ $element = variable_form_element_options($variable, $options);
+ }
+ else {
+ $element = variable_form_element_default($variable, $options);
+ }
+ if (!empty($variable['validate callback'])) {
+ $element['#element_validate'][] = 'variable_form_element_validate';
+ }
+ if (!empty($options['form parents'])) {
+ $element['#parents'] = $options['form parents'];
+ $element['#parents'][] = $variable['name'];
+ }
+ $element += array('#access' => variable_access($variable));
+ if (!empty($variable['required'])) {
+ $element += array('#required' => TRUE);
+ }
+ // Add variable data to element so we can use it later fo validation, etc..
+ $element['#variable'] = $variable;
+ return $element;
+}
+
+/**
+ * Build array form element
+ */
+function variable_form_element_array($variable, $options = array()) {
+ // This will be possibly a fieldset with tree value
+ $element = variable_form_element_default($variable, $options);
+ // We may have a multiple element base that will default to plain textfield
+ $item = $variable['repeat'];
+ $value = variable_get_value($variable, $options);
+ // Compile names and defaults for all elements
+ $names = $defaults = array();
+ if (!empty($variable['multiple'])) {
+ // If we've got a multiple value, it will be an array with known elements
+ $names = $variable['multiple'];
+ }
+ else {
+ // Array with unknown elements, we add an element for each existing one
+ $names = $value ? array_combine(array_keys($value), array_keys($value)) : array();
+ }
+ // Now build elements with the right names
+ foreach ($names as $key => $title) {
+ if (isset($value[$key]) && is_array($value[$key])) {
+ // This element is an array, we cannot edit it but we need to add it to the form
+ $element[$key] = array('#type' => 'value', '#value' => $value[$key]);
+ $element['variable_element_array_' . $key] = array('#type' => 'item', '#title' => $title, '#markup' => variable_format_array($value[$key]));
+ }
+ else {
+ $element[$key] = $item['element'] + array('#title' => $title, '#default_value' => isset($value[$key]) ? $value[$key] : '');
+ }
+ }
+ return $element;
+}
+
+/**
+ * Build multiple form element
+ */
+function variable_form_element_multiple($variable, $options = array()) {
+ $variable += array('element' => array(), 'title' => '', 'description' => '');
+ $element = $variable['element'] + array(
+ '#type' => 'fieldset',
+ '#title' => $variable['title'],
+ '#description' => $variable['description'],
+ );
+ foreach ($variable['children'] as $name => $item) {
+ $element[$name] = variable_form_element($item, $options);
+ }
+ return $element;
+}
+
+/**
+ * Build default form element
+ */
+function variable_form_element_default($variable, $options = array()) {
+ $variable += array('element' => array(), 'title' => '', 'description' => '');
+ $type = variable_get_type($variable['type']) + array('element' => array());
+ $element = $variable['element'] + array(
+ '#title' => $variable['title'],
+ '#description' => $variable['description'],
+ ) + $type['element'];
+ $value = variable_get_value($variable, $options);
+ if (isset($value)) {
+ $element['#default_value'] = $value;
+ }
+ return $element;
+}
+
+/**
+ * Build form element for unknown variable.
+ *
+ * This is not an editable form element but a form item.
+ */
+function variable_form_element_unknown($variable, $options = array()) {
+ $variable += array('element' => array(), 'title' => '', 'description' => '');
+ $type = variable_get_type($variable['type']) + array('element' => array());
+ $element = $variable['element'] + array(
+ '#title' => $variable['title'],
+ '#description' => $variable['description'],
+ '#markup' => variable_format_value($variable, $options),
+ ) + $type['element'];
+ return $element;
+}
+
+/**
+ * Build form element for text_format variable.
+ */
+function variable_form_element_text_format($variable, $options = array()) {
+ $variable += array('element' => array(), 'title' => '', 'description' => '');
+ $type = variable_get_type($variable['type']) + array('element' => array());
+ $element = $variable['element'] + array(
+ '#title' => $variable['title'],
+ '#description' => $variable['description'],
+ ) + $type['element'];
+ $value = variable_get_value($variable, $options);
+ if (isset($value) && is_array($value)) {
+ if (isset($value['value'])) {
+ $element['#default_value'] = $value['value'];
+ }
+ if (isset($value['format'])) {
+ $element['#format'] = $value['format'];
+ }
+ }
+ return $element;
+}
+
+/**
+ * Build options variables
+ */
+function variable_form_element_options($variable, $options = array()) {
+ $element = variable_form_element_default($variable, $options);
+ $element['#options'] = $variable['options'];
+ // Depending on the number of options this may be radios or a drop-down.
+ // However if there are nested options (an option is an array) it should be always a drop-down.
+ if (empty($element['#type'])) {
+ $element['#type'] = count($variable['options']) > 4 || array_filter(array_map('is_array', $variable['options'])) ? 'select' : 'radios';
+ }
+ return $element;
+}
+
+/**
+ * Implement validate callback
+ */
+function variable_form_element_validate($element, &$form_state, $form) {
+ $variable = $element['#variable'];
+ variable_include($variable);
+ $variable['value'] = isset($element['#value']) ? $element['#value'] : NULL;
+ if ($error = call_user_func($variable['validate callback'], $variable)) {
+ form_error($element, $error);
+ }
+}
+
+/**
+ * Form to select variables
+ */
+function theme_variable_table_select($variables) {
+ $element = $variables['element'];
+ $header = isset($element['#header']) ? $element['#header'] : array('element' => '', 'title' => t('Name'), 'description' => t('Description'));
+ $fields = array_keys($header);
+ $rows = array();
+ foreach (element_children($element) as $name) {
+ if (isset($element[$name]['#variable_name'])) {
+ $variable_name = $element[$name]['#variable_name'];
+ }
+ else {
+ $variable_name = str_replace(array('<', '>'), array('[', ']'), $name);
+ }
+ $variable = _variable_variable($variable_name);
+ $row = array();
+ foreach ($fields as $field) {
+ if ($field == 'element') {
+ $row[] = drupal_render($element[$name]);
+ }
+ else {
+ $row[] = isset($variable[$field]) ? $variable[$field] : '';
+ }
+ }
+ $rows[] = $row;
+ }
+ // Add a "Select all" checkbox.
+ drupal_add_js('misc/tableselect.js');
+ $header['element'] = array('class' => array('select-all'));
+
+ return theme('table', array('header' => array_values($header), 'rows' => $rows));
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.inc b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.inc
new file mode 100644
index 0000000..d770904
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.inc
@@ -0,0 +1,280 @@
+<?php
+/**
+ * @file
+ * Variable API module. Extended API.
+ */
+
+/**
+ * Build generic variable information
+ */
+function variable_build_info($type, $options) {
+ variable_module_include();
+ switch ($type) {
+ case 'variable':
+ return variable_build_list_info($options);
+ case 'group':
+ case 'type':
+ $info = variable_invoke_all('variable_' . $type . '_info');
+ drupal_alter('variable_' . $type . '_info', $info);
+ return $info;
+ }
+}
+
+/**
+ * Build variable information
+ */
+function variable_build_list_info($options) {
+ $variables = array();
+ foreach (module_implements('variable_info') as $module) {
+ $result = call_user_func($module . '_variable_info', $options);
+ if (isset($result) && is_array($result)) {
+ foreach ($result as $name => $variable) {
+ // Support name => title declarations
+ $variable = is_array($variable) ? $variable : array('title' => $variable);
+ $variable += array('name' => $name, 'module' => $module);
+ // Check variable name for multiple values
+ $multiple = NULL;
+ if (preg_match('/\[(\w+)\]/', $name, $matches)) {
+ $multiple = $matches[1];
+ $variable += array('type' => 'multiple');
+ }
+ $variable += array('group' => 'default', 'type' => 'default');
+ $variables[$name] = $variable + variable_get_type($variable['type']);
+ // Add this at the end so it doesn't override type properties
+ if (!empty($multiple)) {
+ $variables[$name] += array('multiple' => $multiple);
+ }
+ }
+ }
+ }
+ // Last chance for modules to alter variable info.
+ drupal_alter('variable_info', $variables, $options);
+ return $variables;
+}
+
+/**
+ * Build multiple variables
+ */
+function variable_build_multiple($variable, $options) {
+ // Invoke variable callbacks
+ if (!empty($variable['multiple callback'])) {
+ $variable['multiple'] = variable_callback($variable['multiple callback'], $variable, $options);
+ }
+ if (isset($variable['multiple'])) {
+ if (!is_array($variable['multiple'])) {
+ $variable['multiple'] = variable_option_list($variable['multiple'], $variable, $options);
+ }
+ $variable += array('children' => array(), 'repeat' => array());
+ // Build children variables with the name => value array
+ foreach ($variable['multiple'] as $key => $title) {
+ $name = preg_replace('/\[\w+\]/', $key, $variable['name']);
+ // Be careful to respect previously set properties, add but do not override.
+ $child = isset($variable['children'][$name]) ? $variable['children'][$name] : array();
+ $child += $variable['repeat'];
+ $child += array(
+ 'name' => $name, 'index' => $key, 'title' => $title,
+ 'type' => 'default', 'parent' => $variable['name'], 'module' => $variable['module'],
+ );
+ // Set default value from parent
+ if (isset($variable['default']) && is_array($variable['default']) && isset($variable['default'][$key])) {
+ $child += array('default' => $variable['default'][$key]);
+ }
+ $child += variable_get_type($child['type']);
+ $variable['children'][$name] = $child;
+ }
+ }
+ return $variable;
+}
+
+/**
+ * Build variable with options
+ */
+function variable_build_options($variable, $options) {
+ $variable = variable_build_variable($variable, $options);
+ if (isset($variable['options callback'])) {
+ $variable['options'] = variable_callback($variable['options callback'], $variable, $options);
+ }
+ if (!empty($variable['options']) && !is_array($variable['options'])) {
+ $variable['options'] = variable_option_list($variable['options'], $variable, $options);
+ }
+ return $variable;
+}
+
+/**
+ * Build single variable
+ *
+ * Some variables may spawn into multiple ones
+ */
+function variable_build_variable($variable, $options = array()) {
+ if (empty($variable['built'])) {
+ variable_include($variable);
+ // Mark as built so we don't build it again
+ $variable['built'] = TRUE;
+ $options = _variable_options($options);
+ $variable = _variable_variable($variable, $options);
+ // If the variable has a build callback, go for it
+ if (isset($variable['build callback'])) {
+ $variable = variable_callback($variable['build callback'], $variable, $options);
+ }
+ }
+ return $variable;
+}
+
+/**
+ * Invoke variable callback
+ *
+ * @param $callback
+ * Function name to invoke or array with module and funcion in this order
+ * @param $variable
+ * Array of variable information.
+ * @param $options
+ * Options to pass to the callback
+ * @param $module
+ * Optional module to include its '*.variable.inc' file if the function not found
+ */
+function variable_callback($callback, $variable, $options = array()) {
+ if (is_array($callback)) {
+ list($module, $function) = $callback;
+ }
+ else {
+ $function = $callback;
+ }
+ if (!function_exists($function)) {
+ if (isset($module)) {
+ variable_module_include($module);
+ }
+ else {
+ variable_include($variable);
+ }
+ }
+ return call_user_func($function, $variable, $options);
+}
+
+/**
+ * List variables for a group
+ */
+function variable_list_group($group) {
+ $list = array();
+ foreach (variable_get_info() as $name => $variable) {
+ if ($variable['group'] == $group) {
+ $list[$name] = $variable;
+ }
+ }
+ return $list;
+}
+
+/**
+ * List variables for a module
+ */
+function variable_list_module($module) {
+ $list = array();
+ foreach (variable_get_info() as $name => $variable) {
+ if ($variable['module'] == $module) {
+ $list[$name] = $variable;
+ }
+ }
+ return $list;
+}
+
+/**
+ * Fetch options for variable
+ */
+function variable_option_list($type, $variable, $options) {
+ $cache = &drupal_static(__FUNCTION__);
+ if (isset($cache[$type])) {
+ return $cache[$type];
+ }
+ elseif ($info = variable_get_type($type)) {
+ if (isset($info['options callback'])) {
+ $info['options'] = variable_callback(array($info['module'], $info['options callback']), $variable, $options);
+ }
+ if (!empty($info['cache'])) {
+ $cache[$type] = $info['options'];
+ }
+ return $info['options'];
+ }
+ else {
+ return array();
+ }
+}
+
+/**
+ * General function to include variable definitions for all modules
+ */
+function variable_module_include($modules = NULL) {
+ static $core_modules = array('locale', 'forum', 'menu', 'node', 'system', 'taxonomy', 'translation', 'user');
+ static $included = array();
+ $modules = $modules ? (is_array($modules) ? $modules : array($modules)) : $core_modules;
+ foreach ($modules as $module) {
+ if (!isset($included[$module])) {
+ if (module_exists($module)) {
+ if (in_array($module, $core_modules)) {
+ $included[$module] = module_load_include('variable.inc', 'variable', 'includes/' . $module);
+ }
+ else {
+ $included[$module] = module_load_include('variable.inc', $module);
+ }
+ }
+ }
+ }
+}
+
+/**
+ * Disable variables for module
+ *
+ * Store module variables so we can delete them if uninstalled
+ */
+function variable_module_disable($module) {
+}
+
+/**
+ * Disable variables for module
+ *
+ * Store module variables so we can delete them if uninstalled
+ */
+function variable_module_enable($module) {
+ if ($variables = variable_list_module($module)) {
+ $list = variable_get('variable_module_list', array());
+ $list[$module] = variable_children($variables);
+ variable_set('variable_module_list', $list);
+ }
+}
+
+/**
+ * Uninstall variables for module
+ *
+ * This will be called from variable_modules_uninstalled(), no need to implement it directly.
+ */
+function variable_module_uninstall($module) {
+ $list = variable_get('variable_module_list', array());
+ if (isset($list[$module])) {
+ // This is a plain list of variables so we can use raw delete.
+ array_map('variable_delete', $list[$module]);
+ unset($list[$module]);
+ variable_set('variable_module_list', $list);
+ }
+}
+
+/**
+ * Get value for multiple variable
+ */
+function variable_multiple_get_value($variable, $options = array()) {
+ $variable = variable_build($variable, $options);
+ $values = array();
+ foreach ($variable['children'] as $child) {
+ $values[$child['index']] = variable_get_value($child, $options);
+ }
+ return $values;
+}
+
+/**
+ * Get defaults for multiple variable
+ */
+function variable_multiple_get_default($variable, $options = array()) {
+ $variable = variable_build($variable, $options);
+ $values = array();
+ foreach ($variable['children'] as $child) {
+ $values[$child['index']] = variable_get_default($child, $options);
+ }
+ return $values;
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.info b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.info
new file mode 100644
index 0000000..7ab1e1e
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.info
@@ -0,0 +1,20 @@
+name = Variable
+description = Variable Information and basic variable API
+package = Variable
+core = 7.x
+
+files[] = includes/forum.variable.inc
+files[] = includes/locale.variable.inc
+files[] = includes/menu.variable.inc
+files[] = includes/node.variable.inc
+files[] = includes/system.variable.inc
+files[] = includes/taxonomy.variable.inc
+files[] = includes/translation.variable.inc
+files[] = includes/user.variable.inc
+files[] = variable.test
+; Information added by drupal.org packaging script on 2013-01-13
+version = "7.x-2.2"
+core = "7.x"
+project = "variable"
+datestamp = "1358075138"
+
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.install b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.install
new file mode 100644
index 0000000..4ab0253
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.install
@@ -0,0 +1,58 @@
+<?php
+/**
+ * @file
+ * Variable API module install file
+ */
+
+/**
+ * Implements hook_schema().
+ */
+function variable_schema() {
+ $schema['cache_variable'] = array(
+ 'description' => 'Cache table for variables.',
+ 'fields' => array(
+ 'cid' => array(
+ 'description' => 'Primary Key: Unique cache ID.',
+ 'type' => 'varchar',
+ 'length' => 255,
+ 'not null' => TRUE,
+ 'default' => '',
+ ),
+ 'data' => array(
+ 'description' => 'A collection of data to cache.',
+ 'type' => 'blob',
+ 'not null' => FALSE,
+ 'size' => 'big',
+ ),
+ 'expire' => array(
+ 'description' => 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.',
+ 'type' => 'int',
+ 'not null' => TRUE,
+ 'default' => 0,
+ ),
+ 'created' => array(
+ 'description' => 'A Unix timestamp indicating when the cache entry was created.',
+ 'type' => 'int',
+ 'not null' => TRUE,
+ 'default' => 0,
+ ),
+ 'serialized' => array(
+ 'description' => 'A flag to indicate whether content is serialized (1) or not (0).',
+ 'type' => 'int',
+ 'size' => 'small',
+ 'not null' => TRUE,
+ 'default' => 0,
+ ),
+ ),
+ 'indexes' => array('expire' => array('expire')),
+ 'primary key' => array('cid'),
+ );
+ return $schema;
+}
+
+/**
+ * Implements hook_uninstall().
+ */
+function variable_uninstall() {
+ variable_del('variable_module_list');
+} \ No newline at end of file
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.module b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.module
new file mode 100644
index 0000000..781124f
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.module
@@ -0,0 +1,800 @@
+<?php
+/**
+ * @file
+ * Variable API module
+ */
+
+/**
+ * Implementation of hook_boot()
+ *
+ * Though we don't do anything here, we ensure the module is loaded at boot stage
+ * for other modules (like variable_realm) to be able to use the API
+ */
+function variable_boot() {
+}
+
+/**
+* @defgroup variable_api Variable API
+* @{
+* Get meta-information about variables and extended get/set methods
+*
+* Use these functions if you want to take full advantage of Variable API
+*/
+
+/**
+ * Check access to variable
+ *
+ * All variables are restricted for editing so unless we've got some explicit access
+ * variables cannot be edited as default.
+ *
+ * @param $variable
+ * Variable name or info array
+ */
+function variable_access($variable, $account = NULL) {
+ $account = $account ? $account : $GLOBALS['user'];
+ if (user_access('administer site configuration', $account)) {
+ return TRUE;
+ }
+ elseif ($variable = _variable_variable($variable)) {
+ // Check parent variable if this is a child variable and doesn't have explicit access.
+ if (!isset($variable['access']) && !empty($variable['parent'])) {
+ return variable_access($variable['parent']);
+ }
+ // We need either a variable or group explicit access.
+ $group = isset($variable['group']) ? variable_get_group($variable['group']) : array();
+ if (!isset($group['access']) && !isset($variable['access']) ||
+ isset($group['access']) && !user_access($group['access'], $account) ||
+ isset($variable['access']) && !user_access($variable['access'], $account) )
+ {
+ return FALSE;
+ }
+ else {
+ return TRUE;
+ }
+ }
+ else {
+ // We don't have information for such variable
+ return FALSE;
+ }
+}
+
+
+/**
+ * Get list of variables expanding multiple ones
+ *
+ * @param $names
+ * List of variable names or full variable arrays
+ *
+ * @return array()
+ * List variable names with spawned multiple variables
+ */
+function variable_children($names) {
+ $names = is_array($names) ? $names : array($names);
+ $list = array();
+ foreach ($names as $name) {
+ // We need to build the variable, it may be multiple
+ $variable = variable_build($name);
+ if (!empty($variable['children'])) {
+ $list = array_merge($list, array_keys($variable['children']));
+ }
+ else {
+ $list[] = $variable['name'];
+ }
+ }
+ return $list;
+}
+
+/**
+ * Map children variables to parent variables
+ */
+function variable_parent($name) {
+ $map = &drupal_static(__FUNCTION__);
+ if (!isset($map)) {
+ foreach (array_keys(variable_get_info()) as $key) {
+ if ($children = variable_children($key)) {
+ foreach ($children as $child) {
+ $map[$child] = $key;
+ }
+ }
+ }
+ }
+ return isset($map[$name]) ? $map[$name] : NULL;
+}
+
+/**
+ * Format printable value
+ *
+ * @param $variable
+ */
+function variable_format_value($variable, $options = array()) {
+ $variable = variable_build($variable, $options);
+ $variable['value'] = variable_get_value($variable, $options);
+ if (isset($variable['value'])) {
+ return !empty($variable['format callback']) ? variable_callback($variable['format callback'], $variable, $options) : variable_format_unknown($variable, $options);
+ }
+ else {
+ return isset($variable['empty']) ? $variable['empty'] : t('Empty');
+ }
+}
+
+/**
+ * Format unknown variable
+ */
+function variable_format_unknown($variable, $options = array()) {
+ return '<pre>' . check_plain(print_r($variable['value'], TRUE)) . '</pre>';
+}
+
+/**
+ * Get variable child element from multiple variable
+ *
+ * @param $parent
+ * Parent variable
+ * @param $key
+ * Key of the children variable (not the full name, just the piece of string that makes the difference)
+ */
+function variable_get_child($parent, $key, $options = array()) {
+ $variable = variable_build($parent, $options);
+ $name = preg_replace('/\[\w+\]/', $key, $variable['name']);
+ $child = $variable['children'][$name];
+ // Replace title and description
+ foreach (array('title', 'description') as $property) {
+ if (isset($variable[$property])) {
+ $child[$property] = $variable[$property];
+ }
+ }
+ return $child;
+}
+
+/**
+ * Get variable information
+ *
+ * Variable information is collected from modules and cached by language
+ *
+ * @param $name
+ * Optional variable name. Will return all if no name.
+ * @param $options array
+ * Options for variable values
+ * - 'langcode', Language code
+ */
+function variable_get_info($name = NULL, $options = array()) {
+ $options = _variable_options($options);
+ if (!$name) {
+ return _variable_info('variable', NULL, $options);
+ }
+ elseif ($info = _variable_info('variable', $name, $options)) {
+ return $info;
+ }
+ elseif ($parent = variable_parent($name)) {
+ $info = variable_build(variable_get_info($parent));
+ $child = $info['children'][$name];
+ // Copy over some values from parent to child to add some context to it.
+ $child['title'] = $info['title'] . ' [' . $child['title'] . ']';
+ if (isset($info['description'])) {
+ $child['description'] = $info['description'];
+ }
+ return $child;
+ }
+ else {
+ return NULL;
+ }
+}
+
+/**
+ * Get variable group information.
+ *
+ * @param $group
+ * Group name. Will return all if not name.
+ */
+function variable_get_group($group = NULL) {
+ return _variable_info('group', $group);
+}
+
+/**
+ * Get variable type information.
+ *
+ * @param $type
+ * Type name. Will return all if no name.
+ */
+function variable_get_type($type = NULL) {
+ $info = _variable_info('type', $type);
+ if ($type && !empty($info['type'])) {
+ // Add subtipe properties, recursive
+ $info += variable_get_type($info['type']);
+ }
+ return $info;
+}
+
+/**
+ * Get variable option information.
+ */
+function variable_get_option($type = NULL) {
+ return _variable_info('option', $type);
+}
+
+/**
+ * Get value for simple scalar variable
+ *
+ * @param $variable
+ * Variable name or array data
+ * @param $options
+ * Options array, it may have the following elements
+ * - language => Language object
+ * - default => Default value if not set
+ * - realm => Realm object if working inside a variable realm
+ */
+function variable_get_value($variable, $options = array()) {
+ $variable = _variable_variable($variable, $options);
+ if (isset($variable['value'])) {
+ return $variable['value'];
+ }
+ elseif (!empty($variable['value callback'])) {
+ variable_include($variable);
+ return variable_callback($variable['value callback'], $variable, _variable_options($options));
+ }
+ else {
+ if (!empty($options['realm'])) {
+ $value = $options['realm']->variable_get($variable['name'], NULL);
+ }
+ else {
+ $value = variable_get($variable['name'], NULL);
+ }
+ if (isset($value)) {
+ return $value;
+ }
+ else {
+ return isset($options['default']) ? $options['default'] : variable_get_default($variable, $options);
+ }
+ }
+}
+
+/**
+ * Set variable value
+ *
+ * This basically sets the variable but also invokes hook_variable_update
+ */
+function variable_set_value($name, $value, $options = array()) {
+ $old_value = variable_get_value($name, NULL, $options);
+ if (!empty($options['realm'])) {
+ $options['realm']->variable_set($name, $value);
+ }
+ else {
+ variable_set($name, $value);
+ }
+ module_invoke_all('variable_update', $name, $value, $old_value, $options);
+}
+
+/**
+ * Get variable default
+ *
+ * @param $variable
+ * Variable name or variable information
+ */
+function variable_get_default($variable, $options = array()) {
+ $variable = _variable_variable($variable, $options);
+ if (isset($variable['default callback'])) {
+ variable_include($variable);
+ return call_user_func($variable['default callback'], $variable, _variable_options($options));
+ }
+ elseif (isset($variable['default'])) {
+ return $variable['default'];
+ }
+ else {
+ return NULL;
+ }
+}
+
+
+/**
+ * Delete variable (included children variables)
+ */
+function variable_delete($variable, $options = array()) {
+ $variable = _variable_variable($variable, $options);
+ variable_include();
+ // We need to build the variable, it may be multiple
+ $variable = variable_build($variable, $options);
+ if (!empty($variable['children'])) {
+ $callback = !empty($options['realm']) ? array($options['realm'], 'variable_del') : 'variable_del';
+ array_map($callback, array_keys($variable['children']));
+ }
+ elseif (!empty($options['realm'])) {
+ $options['realm']->variable_del($variable['name']);
+ }
+ else {
+ variable_del($variable['name']);
+ }
+ // Invoke the hook only once even if its multiple
+ module_invoke_all('variable_delete', $variable, $options);
+}
+
+/**
+ * Provide list of variable titles
+ *
+ * @param $names
+ * List of variable names or full variable arrays
+ * @return array()
+ * List of name => title
+ */
+function variable_list($names) {
+ $list = array();
+ foreach ($names as $name) {
+ if ($variable = _variable_variable($name)) {
+ $list[$variable['name']] = $variable['title'];
+ }
+ }
+ return $list;
+}
+
+/**
+ * Get human readable name for variable.
+ */
+function variable_name($variable) {
+ $variable = _variable_variable($variable);
+ return $variable['title'];
+}
+
+/**
+ * Get human readable names for variable list.
+ */
+function variable_list_name($list) {
+ $names = array_map('variable_name', $list);
+ return implode(', ', $names);
+}
+
+/**
+* @} End of "defgroup variable_api".
+*/
+
+/**
+ * Build full variable data
+ */
+function variable_build($variable, $options = array()) {
+ variable_include();
+ $variable = _variable_variable($variable, $options);
+ return variable_build_variable($variable, $options);
+}
+
+/**
+ * Clear cache
+ */
+function variable_cache_clear() {
+ cache_clear_all('*', 'cache_variable', TRUE);
+}
+
+/**
+ * Implementation of hook_flush_caches()
+ */
+function variable_flush_caches() {
+ return array('cache_variable');
+}
+
+/**
+ * Implements hook_element_info()
+ */
+function variable_element_info() {
+ // A fieldset with variable list
+ $types['variable_fieldset'] = array(
+ '#collapsible' => FALSE,
+ '#collapsed' => FALSE,
+ '#value' => NULL,
+ '#process' => array('variable_element_process_fieldset', 'form_process_fieldset', 'ajax_process_form'),
+ '#pre_render' => array('form_pre_render_fieldset'),
+ '#theme_wrappers' => array('fieldset'),
+ '#variable_list' => array(),
+ );
+ return $types;
+}
+
+/**
+ * Process variable fieldset
+ */
+function variable_element_process_fieldset($element) {
+ $element += variable_edit_subform($element['#variable_list']);
+ return $element;
+}
+
+/**
+ * Implements hook_hook_info().
+ */
+function variable_hook_info() {
+ $hooks['variable_info'] = array(
+ 'group' => 'variable',
+ );
+ $hooks['variable_group_info'] = array(
+ 'group' => 'variable',
+ );
+ $hooks['variable_type_info'] = array(
+ 'group' => 'variable',
+ );
+ $hooks['variable_settings_form_alter'] = array(
+ 'group' => 'variable',
+ );
+ return $hooks;
+}
+
+/**
+ * Form for variable list
+ *
+ * @param $list
+ * Variable name or list of variable names
+ */
+function variable_edit_form($form, $form_state, $list, $options = array()) {
+ // Pass on the values on the form for further reference.
+ $form['#variable_edit_form'] = $list;
+ module_load_include('form.inc', 'variable');
+ $form += variable_edit_subform($list, $options);
+ return variable_settings_form($form, $options);
+}
+
+/**
+ * Form elements for variable list.
+ *
+ * @param $list
+ * Variable name or array of variable names..
+ * @param $options
+ * Regular variable options (language, realm, etc) and optional 'form parents' array.
+ */
+function variable_edit_subform($list, $options = array()) {
+ module_load_include('form.inc', 'variable');
+ $list = is_array($list) ? $list : array($list);
+ $form = array();
+ foreach ($list as $name) {
+ if ($variable = variable_get_info($name, $options)) {
+ $form[$name] = variable_form_element($variable, $options);
+ }
+ }
+ return $form;
+}
+
+/**
+ * Include extended API and files related to specific variable
+ *
+ * @param $variable
+ * Variable array
+ */
+function variable_include($variable = NULL) {
+ static $included;
+ if (!isset($included)) {
+ // As a first step, include main variable API
+ module_load_include('inc', 'variable');
+ $included = array();
+ }
+ if ($variable && !isset($included[$variable['name']])) {
+ // Include module.variable.inc files related to the variable and the variable type.
+ variable_module_include($variable['module']);
+ variable_type_include($variable['type']);
+ $included[$variable['name']] = TRUE;
+ }
+}
+
+/**
+ * Include variable type files
+ */
+function variable_type_include($type) {
+ variable_include();
+ $info = variable_get_type($type);
+ variable_module_include($info['module']);
+ // Include subtype if any
+ if (!empty($info['type'])) {
+ variable_type_include($info['type']);
+ }
+}
+
+/**
+ * Form for module variables
+ */
+function variable_module_form($form, $form_state, $module) {
+ variable_include();
+ // Pass on the values on the form for further reference.
+ $form['#variable_module_form'] = $module;
+ return variable_edit_form($form, $form_state, array_keys(variable_list_module($module)));
+}
+
+/**
+ * Form for group variables
+ */
+function variable_group_form($form, $form_state, $group) {
+ variable_include();
+ // Pass on the values on the form for further reference.
+ $form['#variable_group_form'] = $group;
+ return variable_edit_form($form, $form_state, array_keys(variable_list_group($group)));
+}
+
+/**
+ * Implements hook_modules_disabled().
+ */
+function variable_modules_disabled($modules) {
+ variable_include();
+ array_map('variable_module_disable', $modules);
+ variable_cache_clear();
+}
+
+/**
+ * Implements hook_modules_enabled().
+ */
+function variable_modules_enabled($modules) {
+ variable_include();
+ array_map('variable_module_enable', $modules);
+ variable_cache_clear();
+}
+
+/**
+ * Implements hook_modules_uninstalled().
+ */
+function variable_modules_uninstalled($modules) {
+ variable_include();
+ array_map('variable_module_uninstall', $modules);
+ variable_cache_clear();
+}
+
+/**
+ * Implements hook_theme()
+ */
+function variable_theme($existing, $type, $theme, $path) {
+ return array(
+ 'variable_table_select' => array(
+ 'render element' => 'element',
+ 'file' => 'variable.form.inc',
+ ),
+ );
+}
+
+/**
+ * Get variable info static data, try the cache, or invoke the hook to collect it.
+ *
+ * @param $type
+ * Name of the info to collect
+ * - 'variable', Variable information, hook_variable_info()
+ * - 'group', Group information, hook_variable_group_info()
+ * - 'type', Type information, hook_variable_type_info()
+ * @param $options
+ * Options to retrieve or build the data.
+ * The only used option to collect the data is 'langcode', though a full array of options may be used for the hooks
+ */
+function &variable_static($type, $options = array()) {
+ static $data;
+ $name = 'variable_' . $type;
+ $langcode = isset($options['langcode']) ? $options['langcode'] : 'default';
+
+ if (!isset($data[$type])) {
+ $data[$type] = &drupal_static($name);
+ }
+ if (!isset($data[$type][$langcode])) {
+ $cache_id = $type . ':' . $langcode;
+ if ($cache = cache_get($cache_id, 'cache_variable')) {
+ $data[$type][$langcode] = $cache->data;
+ }
+ else {
+ variable_include();
+ $data[$type][$langcode] = variable_build_info($type, $options);
+ cache_set($cache_id, $data[$type][$langcode], 'cache_variable');
+ }
+ }
+ // Return a reference inside the big array
+ return $data[$type][$langcode];
+}
+
+
+/**
+ * Get data from a variable module info array.
+ */
+function _variable_info($type, $name = NULL, $options = array()) {
+ $info = &variable_static($type, $options);
+ if ($name) {
+ return isset($info[$name]) ? $info[$name] : array();
+ }
+ else {
+ return $info;
+ }
+}
+
+/**
+ * Get global language object.
+ *
+ * Initialize the language system if needed as we absolutely need a language here
+ */
+function _variable_language() {
+ global $language;
+ if (!isset($language)) {
+ drupal_bootstrap(DRUPAL_BOOTSTRAP_LANGUAGE);
+ }
+ return $language;
+}
+
+/**
+ * Normalize variable options
+ *
+ * Will fill the following values if not present in the parameters
+ * - langcode, Language code
+ * - language, Language object
+ */
+function _variable_options($options = array()) {
+ if (!empty($options['language'])) {
+ $options['langcode'] = $options['language']->language;
+ }
+ elseif (!empty($options['langcode']) && ($list = language_list()) && isset($list[$options['langcode']])) {
+ $options['language'] = $list[$options['langcode']];
+ }
+ else {
+ $language = _variable_language();
+ $options['language'] = $language;
+ $options['langcode'] = $language->language;
+ }
+ return $options;
+}
+
+/**
+ * Normalize variable data
+ *
+ * @param $variable
+ * Variable name or variable info array
+ * @return array
+ * Variable information
+ */
+function _variable_variable($variable, $options = array()) {
+ if (is_array($variable)) {
+ return $variable;
+ }
+ elseif ($info = variable_get_info($variable, $options)) {
+ return $info;
+ }
+ else {
+ // We don't have meta-information about this variable.
+ return _variable_unknown($variable);
+ }
+}
+
+/**
+ * Unknown variable
+ */
+function _variable_unknown($name) {
+ return array(
+ 'name' => $name,
+ 'title' => t('Unknown variable @name', array('@name' => $name)),
+ 'type' => 'unknown',
+ 'group' => 'default',
+ 'module' => 'variable',
+ // Space for public service advertisement :-)
+ 'description' => t('We have no meta information for this variable. Please, ask module developers to declare their variables. See <a href="http://drupal.org/project/variable">Variable module</a>.'),
+ );
+}
+
+/**
+ * Implements hook_form_alter().
+ *
+ * Triggers hook_variable_realm_settings_form_alter() giving other modules a chance
+ * to act on settings forms after other contrib modules have added their variables.
+ */
+function variable_form_alter(&$form, &$form_state, $form_id) {
+ if (isset($form['#submit']) && is_array($form['#submit']) && in_array('system_settings_form_submit', $form['#submit'])) {
+ // Replace submit callback and use our own function.
+ $form['#submit'] = str_replace('system_settings_form_submit', 'variable_settings_form_submit', $form['#submit']);
+ $alter = TRUE;
+ }
+ elseif (isset($form['#variable_edit_form'])) {
+ // This is a variable form, just invoke the hook but don't change submit callback.
+ $alter = TRUE;
+ }
+ if (!empty($alter)) {
+ foreach (module_implements('variable_settings_form_alter') as $module) {
+ $function = $module . '_variable_settings_form_alter';
+ $function($form, $form_state, $form_id);
+ }
+ }
+}
+
+
+
+/**
+ * Implements hook_module_implements_alter().
+ *
+ * Move variable_form_alter() to the end of the list to give modules manipulating
+ * variables/realms a chance to act on settings forms.
+ *
+ * @param $implementations
+ * All implementations of the given hook.
+ * @param $hook
+ * Name of the hook.
+ */
+function variable_module_implements_alter(&$implementations, $hook) {
+ if ($hook == 'form_alter') {
+ $group = $implementations['variable'];
+ unset($implementations['variable']);
+ $implementations['variable'] = $group;
+ }
+}
+
+/**
+ * Group variable list by variable info property.
+ *
+ * @param $list
+ * Array of variable names or full built variables.
+ * @param $field
+ * Field to group by. If empty, they will be added to the '<none>' array.
+ *
+ * @result
+ * Array of arrays indexed by that field value.
+ */
+function variable_group_variables($list, $field = 'group') {
+ $groups = array();
+ foreach ($list as $variable) {
+ $build = _variable_variable($variable);
+ $value = isset($build[$field]) ? $build[$field] : '<none>';
+ $groups[$value][$build['name']] = $variable;
+ }
+ return $groups;
+}
+
+/**
+ * Add default buttons to a form and set its prefix.
+ *
+ * @param $form
+ * An associative array containing the structure of the form.
+ * @param $options
+ * Aditional options to pass on, like variable realm.
+ *
+ * @return
+ * The form structure.
+ *
+ * @see system_settings_form_submit()
+ * @ingroup forms
+ */
+function variable_settings_form($form, $options = array()) {
+ $form['#variable_options'] = $options;
+ $form['actions']['#type'] = 'actions';
+ $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
+
+ if (!empty($_POST) && form_get_errors()) {
+ drupal_set_message(t('The settings have not been saved because of the errors.'), 'error');
+ }
+ $form['#submit'][] = 'variable_settings_form_submit';
+ // By default, render the form using theme_system_settings_form().
+ if (!isset($form['#theme'])) {
+ $form['#theme'] = 'system_settings_form';
+ }
+ return $form;
+}
+
+/**
+ * Execute the system_settings_form.
+ *
+ * If you want node type configure style handling of your checkboxes,
+ * add an array_filter value to your form.
+ */
+function variable_settings_form_submit($form, &$form_state) {
+ // Exclude unnecessary elements.
+ form_state_values_clean($form_state);
+ // This may contain some realm options.
+ $options = isset($form['#variable_options']) ? $form['#variable_options'] : array();
+ // Now run regular settings submission but using variable_set_value()
+ foreach ($form_state['values'] as $key => $value) {
+ if (is_array($value) && isset($form_state['values']['array_filter'])) {
+ $value = array_keys(array_filter($value));
+ }
+ // Using this function will invoke variable_update hook.
+ variable_set_value($key, $value, $options);
+ }
+
+ drupal_set_message(t('The configuration options have been saved.'));
+}
+
+/**
+ * Invoke hook on all modules, adding 'module' property
+ */
+function variable_invoke_all() {
+ $args = func_get_args();
+ $hook = $args[0];
+ unset($args[0]);
+ $return = array();
+ foreach (module_implements($hook) as $module) {
+ $function = $module . '_' . $hook;
+ if (function_exists($function)) {
+ $result = call_user_func_array($function, $args);
+ if (isset($result) && is_array($result)) {
+ foreach ($result as $key => $value) {
+ $return[$key] = $value + array('module' => $module);
+ }
+ }
+ }
+ }
+ return $return;
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.test b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.test
new file mode 100644
index 0000000..b10127f
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.test
@@ -0,0 +1,53 @@
+<?php
+
+/**
+ * @file
+ * Tests for variable.module.
+ */
+
+/**
+ * Helper class for module test cases.
+ */
+class VariableTestCase extends DrupalWebTestCase {
+ protected $admin_user;
+
+ public static function getInfo() {
+ return array(
+ 'name' => 'Test Variable API',
+ 'description' => 'Exercise the Variable API, default values, save and delete variables, etc.',
+ 'group' => 'Variable',
+ );
+ }
+
+ function setUp() {
+ parent::setUp('variable', 'variable_admin');
+
+ $this->admin_user = $this->drupalCreateUser(array('access administration pages', 'administer site configuration'));
+ $this->drupalLogin($this->admin_user);
+ }
+
+ /**
+ * Test that all core modules can be enabled, disabled and uninstalled.
+ */
+ function testVariableAPI() {
+ // Check default values, set, get, delete.
+ $this->assertEqual(variable_get_value('site_name'), 'Drupal', 'Function variable_get_value() returns proper default values.');
+ $name = 'My test site';
+ variable_set_value('site_name', $name);
+ $this->assertTrue(variable_get('site_name'), 'Variable has been set using Variable API.');
+ $this->drupalGet('');
+ $this->assertText($name, 'Site name set with variable_set_value() is displayed.');
+ variable_delete('site_name');
+ $this->assertFalse(variable_get('site_name'), 'Variable has been deleted using Variable API.');
+ $this->assertEqual(variable_get_value('site_name'), 'Drupal', 'Variable has been reset to its default value.');
+ // Find variable information and specific variable in module and group list
+ $variable = variable_get_info('site_name');
+ $this->assertEqual($variable['title'], t('Site name'), 'Variable information can be retrieved for specific variable.');
+ // Check our admin pages just to make sure all variable widgets are properly displayed.
+ $this->drupalGet('admin/config/system/variable');
+ $this->drupalGet('admin/config/system/variable/module');
+ $this->drupalGet('admin/config/system/variable/edit/site_name');
+ }
+
+
+} \ No newline at end of file
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.tokens.inc b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.tokens.inc
new file mode 100644
index 0000000..57b39aa
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.tokens.inc
@@ -0,0 +1,51 @@
+<?php
+
+/**
+ * @file
+ * Builds placeholder replacement tokens system-wide data.
+ *
+ * This file handles tokens for the global 'variable' token type.
+ */
+
+/**
+ * Implements hook_token_info().
+ */
+function variable_token_info() {
+ $types['variable'] = array(
+ 'name' => t("Variables"),
+ 'description' => t("Tokens for variable values."),
+ );
+ $variable = array();
+ foreach (variable_get_info() as $name => $info) {
+ if (!empty($info['token'])) {
+ $variable[$name] = array(
+ 'name' => $info['title'],
+ 'description' => !empty($info['description']) ? $info['description'] : t('Value of variable !name', array('!name' => $info['title'])),
+ );
+ }
+ }
+ return array(
+ 'types' => $types,
+ 'tokens' => array(
+ 'variable' => $variable,
+ ),
+ );
+}
+
+/**
+ * Implements hook_tokens().
+ */
+function variable_tokens($type, $tokens, array $data = array(), array $options = array()) {
+ $replacements = array();
+
+ if ($type == 'variable') {
+ foreach ($tokens as $name => $original) {
+ $variable = variable_get_info($name, $options);
+ if ($variable && !empty($variable['token'])) {
+ $replacements[$original] = variable_format_value($variable, $options);
+ }
+ }
+ }
+
+ return $replacements;
+} \ No newline at end of file
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.variable.inc b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.variable.inc
new file mode 100644
index 0000000..0ab3331
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable.variable.inc
@@ -0,0 +1,366 @@
+<?php
+/**
+ * @file
+ * Variable module hook implementations
+ */
+
+/**
+ * Implements hook_variable_group_info().
+ */
+function variable_variable_group_info() {
+ // Group for variable that have no group
+ $groups['default'] = array(
+ 'title' => t('Other'),
+ 'description' => t("Variables that don't belong to any other group."),
+ );
+ $groups['debug'] = array(
+ 'title' => t('Debug'),
+ 'description' => t('Debug and development options.'),
+ );
+ $groups['variable'] = array(
+ 'title' => t('Variable'),
+ 'description' => t('Variables that contain metadata about the variable system.'),
+ );
+ return $groups;
+}
+
+/**
+ * Implements hook_variable_type_info().
+ */
+function variable_variable_type_info() {
+ // Array of values
+ $type['array'] = array(
+ 'title' => t('Array'),
+ 'element' => array('#type' => 'fieldset', '#tree' => TRUE),
+ // Properties for each array item
+ 'repeat' => array(
+ 'element' => array('#type' => 'textfield'),
+ ),
+ 'format callback' => 'variable_format_array',
+ 'element callback' => 'variable_form_element_array',
+ 'default' => array(),
+ );
+ // Array whose keys are named properties.
+ $type['properties'] = array(
+ 'title' => t('Properties'),
+ 'format callback' => 'variable_format_properties',
+ 'type' => 'array',
+ );
+ // TRUE / FALSE value, checkbox
+ $type['boolean'] = array(
+ 'title' => t('Boolean'),
+ 'element' => array('#type' => 'checkbox'),
+ 'format callback' => 'variable_format_boolean',
+ );
+ // Default type for variables with no other type
+ $type['default'] = array(
+ 'title' => t('Default'),
+ 'element' => array('#type' => 'textfield'),
+ 'access' => 'administer site configuration',
+ );
+ // Enable/Disable
+ $type['enable'] = array(
+ 'title' => t('Enable'),
+ 'options' => array(t('Disabled'), t('Enabled')),
+ 'default' => 0,
+ 'element' => array('#type' => 'radios'),
+ 'format callback' => 'variable_format_selection',
+ );
+ // Multiple variable that will spawn into multiple elements
+ $type['multiple'] = array(
+ 'title' => t('Multiple'),
+ 'element' => array('#type' => 'fieldset'),
+ 'build callback' => 'variable_build_multiple',
+ 'format callback' => 'variable_format_multiple',
+ 'element callback' => 'variable_form_element_multiple',
+ 'value callback' => 'variable_multiple_get_value',
+ 'default callback' => 'variable_multiple_get_default',
+ );
+ $type['mail_address'] = array(
+ 'title' => t('E-mail address'),
+ 'element' => array('#type' => 'textfield'),
+ 'token' => TRUE,
+ );
+ $type['mail_text'] = array(
+ 'title' => t('Mail text'),
+ 'multiple' => array('subject' => t('Subject'), 'body' => t('Body')),
+ 'build callback' => 'variable_build_mail_text',
+ 'localize' => TRUE,
+ 'type' => 'multiple',
+ );
+ $type['number'] = array(
+ 'title' => t('Number'),
+ 'element' => array('#type' => 'textfield', '#size' => 15, '#maxlength' => 10),
+ 'token' => TRUE,
+ 'validate callback' => 'variable_validate_number',
+ );
+ // Select multiple options from multiple choices
+ $type['options'] = array(
+ 'title' => t('Options'),
+ 'options' => TRUE,
+ 'element' => array('#type' => 'checkboxes'),
+ 'element callback' => 'variable_form_element_options',
+ 'format callback' => 'variable_format_options',
+ );
+ // Select single option from multiple choices
+ $type['select'] = array(
+ 'title' => t('Select'),
+ 'options' => TRUE,
+ // This will become radios or drop-down depending on the number of options
+ 'element callback' => 'variable_form_element_options',
+ 'format callback' => 'variable_format_selection',
+ );
+ // Select number from array of values. Options array that can be list of numbers will be converted to a value => value
+ $type['select_number'] = array(
+ 'title' => t('Select'),
+ 'options' => TRUE,
+ 'element callback' => 'variable_form_element_options',
+ 'options callback' => 'variable_options_select_number',
+ );
+ $type['string'] = array(
+ 'title' => t('String'),
+ 'element' => array('#type' => 'textfield'),
+ 'localize' => TRUE,
+ 'format callback' => 'variable_format_string',
+ 'token' => TRUE,
+ // This type may have an 'allowed tags' attribute.
+ // If empty it will be formatted as plain text
+ 'allowed tags' => array(),
+ );
+ $type['text'] = array(
+ 'title' => t('Text'),
+ 'element' => array('#type' => 'textarea'),
+ 'localize' => TRUE,
+ 'format callback' => 'variable_format_text',
+ 'token' => TRUE,
+ // This type may have an 'allowed tags' attribute.
+ // If empty it will be formatted with filter_xss_admin.
+ 'allowed tags' => array(),
+ );
+ // Default type for variables with no other type
+ $type['unknown'] = array(
+ 'title' => t('Unknown'),
+ 'access' => 'administer site configuration',
+ 'format' => 'variable_format_unknown',
+ 'element callback' => 'variable_form_element_unknown',
+ 'element' => array('#type' => 'item'),
+ );
+ $type['url'] = array(
+ 'title' => t('URL'),
+ 'element' => array('#type' => 'textfield', '#size' => 80, '#maxlength' => 255),
+ 'token' => TRUE,
+ );
+ $type['mail_part'] = array(
+ 'title' => t('Mail parts'),
+ 'options' => array('subject' => t('Subject'), 'body' => t('Body')),
+ );
+ $type['text_format'] = array(
+ 'title' => t('Formatted text'),
+ 'element' => array('#type' => 'text_format'),
+ 'element callback' => 'variable_form_element_text_format',
+ 'format callback' => 'variable_format_text_format',
+ 'default callback' => 'variable_text_format_default',
+ 'localize' => TRUE,
+ );
+ return $type;
+}
+
+/**
+ * Build multiple mail variable
+ */
+function variable_build_mail_text($variable, $options = array()) {
+ $name = str_replace('[mail_part]', '', $variable['name']);
+ // For mail text, children have different types
+ $variable['children'][$name . 'subject']['type'] = 'string';
+ $variable['children'][$name . 'body']['type'] = 'text';
+ $variable = variable_build_multiple($variable, $options);
+ return $variable;
+}
+
+/**
+ * Format select variable
+ */
+function variable_format_selection($variable, $options = array()) {
+ $variable = variable_build_options($variable, $options);
+ if (isset($variable['value'])) {
+ return isset($variable['options'][$variable['value']]) ? $variable['options'][$variable['value']] : '<' . t('Invalid option') . '>';
+ }
+ else {
+ return variable_format_empty($variable);
+ }
+}
+
+/**
+ * Format options variable. Value is an array of options.
+ */
+function variable_format_options($variable, $options = array()) {
+ $variable = variable_build_options($variable, $options);
+ $names = array();
+ if (isset($variable['value']) && $variable['value']) {
+ if (is_array($variable['value'])) {
+ foreach ($variable['value'] as $index => $value) {
+ $names[$index] = isset($variable['options'][$value]) ? $variable['options'][$value] : '<' . t('Invalid option') . '>';
+ }
+ return implode(', ', $names);
+ }
+ else {
+ return '<' . t('Invalid value') . '>';
+ }
+ }
+ else {
+ return variable_format_empty($variable);
+ }
+}
+
+/**
+ * Format array variable, handling nested arrays
+ */
+function variable_format_array($variable = NULL, $options = array()) {
+ if (empty($variable['value'])) {
+ return variable_format_empty($variable);
+ }
+ else {
+ $list = array();
+ foreach ($variable['value'] as $index => $item) {
+ if (is_array($item) || is_object($item)) {
+ $list[$index] = variable_format_array(array('value' => (array)$item), $options);
+ }
+ else {
+ $list[$index] = check_plain((string)$item);
+ }
+ }
+ return theme('item_list', array('items' => $list));
+ }
+}
+/**
+ * Format array variable with known keys, handling nested arrays
+ */
+function variable_format_properties($variable = NULL, $options = array()) {
+ if (empty($variable['value'])) {
+ return variable_format_empty($variable);
+ }
+ else {
+ $rows = array();
+ foreach ($variable['value'] as $name => $item) {
+ $title = check_plain((string)$name);
+ if (is_array($item) || is_object($item)) {
+ $value = variable_format_array(array('value' => (array)$item), $options);
+ }
+ else {
+ $value = check_plain((string)$item);
+ }
+ $rows[] = array('<em>' . $title . '</em>', $value);
+ }
+ return theme('table', array('rows' => $rows));
+ }
+}
+
+/**
+ * Format boolean variable
+ */
+function variable_format_boolean($variable, $options = array()) {
+ if (isset($variable['value'])) {
+ return $variable['value'] ? t('True') : t('False');
+ }
+ else {
+ return t('Undefined');
+ }
+}
+
+/**
+ * Format variable empty value
+ */
+function variable_format_empty($variable) {
+ return isset($variable['empty']) ? $variable['empty'] : t('Empty');
+}
+
+/**
+ * Format variable as string. Either check plain for filter_xss.
+ */
+function variable_format_string($variable, $options = array()) {
+ if (empty($variable['value'])) {
+ return '';
+ }
+ elseif (!empty($variable['allowed tags'])) {
+ return filter_xss($variable['value'], $variable['allowed tags']);
+ }
+ else {
+ return check_plain($variable['value']);
+ }
+}
+
+/**
+ * Format text variable
+ */
+function variable_format_text($variable, $options = array()) {
+ if (empty($variable['value'])) {
+ return '';
+ }
+ elseif (!empty($variable['allowed tags'])) {
+ return filter_xss($variable['value'], $variable['allowed tags']);
+ }
+ else {
+ return filter_xss_admin($variable['value']);
+ }
+}
+
+/**
+ * Options callback for numeric select
+ */
+function variable_options_select_number($variable, $options = array()) {
+ return drupal_map_assoc($variable['options']);
+}
+
+/**
+ * Default callback for text_format.
+ */
+function variable_text_format_default($variable, $options = array()) {
+ $out = array(
+ 'value' => '',
+ 'format' => filter_default_format(),
+ );
+ if (!empty($variable['default'])) {
+ if (is_string($variable['default'])) {
+ $out['value'] = $variable['default'];
+ }
+ elseif (is_array($variable['default'])) {
+ if (isset($variable['default']['value'])) {
+ $out['value'] = $variable['default']['value'];
+ }
+ if (isset($variable['default']['format'])) {
+ $out['format'] = $variable['default']['format'];
+ }
+ }
+ }
+ return $out;
+}
+
+/**
+ * Format text_format.
+ */
+function variable_format_text_format($variable, $options = array()) {
+ return check_markup($variable['value']['value'], $variable['value']['format']);
+}
+
+/**
+ * Format multiple variable.
+ */
+function variable_format_multiple($variable, $options = array()) {
+ $rows = array();
+ foreach ($variable['children'] as $name => $child) {
+ $rows[$name] = array(
+ array('data' => check_plain($child['title']), 'header' => TRUE),
+ variable_format_value($child)
+ );
+ }
+ return theme('table', array('rows' => $rows));
+}
+
+/**
+ * Validate numeric variable.
+ */
+function variable_validate_number($variable) {
+ if (!is_numeric($variable['value'])) {
+ return t('The value is not a number.');
+ }
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_admin/variable_admin.inc b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_admin/variable_admin.inc
new file mode 100644
index 0000000..715bb9b
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_admin/variable_admin.inc
@@ -0,0 +1,209 @@
+<?php
+/**
+ * @file
+ * Variable API module - Admin UI
+ */
+
+/**
+ * Variable overview, by group
+ */
+function variable_admin_page_group($group = NULL) {
+ variable_include();
+ $build['message']['#markup'] = _variable_admin_realm_message();
+ $realm_options = _variable_admin_realm_options();
+ if ($group && ($group_info = variable_get_group($group))) {
+ $group_info += array('description' => '');
+ drupal_set_title($group_info['title']);
+ $list = variable_list_group($group);
+ $build['description']['#markup'] = '<h3>' . $group_info['description'] . '</h3>';
+ $build['form'] = drupal_get_form('variable_edit_form', array_keys($list), $realm_options);
+ return $build;
+ }
+ else {
+ // Groups overview
+ $build['groups'] = array(
+ '#type' => 'vertical_tabs',
+ );
+ foreach (variable_get_group() as $group => $info) {
+ if ($group_variables = variable_list_group($group)) {
+ $build['groups'][$group] = array(
+ '#type' => 'fieldset',
+ '#title' => $info['title'],
+ '#collapsible' => TRUE, '#collapsed' => TRUE,
+ '#description' => (!empty($info['description']) ? $info['description'] . ' ' : '') . l(t('Edit group variables'), 'admin/config/system/variable/group/' . $group),
+ );
+ $build['groups'][$group]['list'] = variable_admin_group_list($group_variables, $realm_options);
+ }
+ }
+ return $build;
+ }
+}
+
+/**
+ * Build list of variables for group
+ *
+ * @return Renderable array
+ */
+function variable_admin_group_list($variables, $options = array()) {
+ $list = array();
+ foreach ($variables as $name => $variable) {
+ $type = variable_get_type($variable['type']);
+ $list[$name] = array(
+ '#type' => 'item',
+ '#title' => l($variable['title'], 'admin/config/system/variable/edit/' . $name) . ' (' . $type['title'] . ')',
+ '#markup' => variable_format_value($variable, $options), //
+ '#description' => isset($variable['description']) ? $variable['description'] : '',
+ );
+ }
+ return $list;
+ return array(
+ '#theme' => 'table',
+ '#rows' => $list,
+ );
+}
+
+/**
+ * Variable overview, by group
+ */
+function variable_admin_page_module($name = NULL) {
+ variable_include();
+ $build['message']['#markup'] = _variable_admin_realm_message();
+ $realm_options = _variable_admin_realm_options();
+ if ($name && (in_array($name, module_list()))) {
+ $modules = system_list('module_enabled');
+ $module = $modules[$name];
+ drupal_set_title($module->info['name']);
+ $list = variable_list_module($name);
+ $build['description']['#markup'] = $module->info['description'];
+ $build['form'] = drupal_get_form('variable_edit_form', array_keys($list), $realm_options);
+ return $build;
+ }
+ else {
+ // Groups overview
+ $build['modules'] = array(
+ '#type' => 'vertical_tabs',
+
+ );
+ foreach (system_list('module_enabled') as $module) {
+ if ($variables = variable_list_module($module->name)) {
+ $build['modules'][$module->name] = array(
+ '#type' => 'fieldset',
+ '#title' => $module->info['name'],
+ '#collapsible' => TRUE, '#collapsed' => TRUE,
+ '#description' => $module->info['description'] . ' ' . l(t('Edit module variables'), 'admin/config/system/variable/module/' . $module->name),
+ '#group' => 'modules',
+ );
+ $build['modules'][$module->name]['list'] = variable_admin_group_list($variables, $realm_options);
+ }
+ }
+ return $build;
+ }
+}
+
+/**
+ * Lists available realms.
+ */
+function variable_admin_realm_overview($form, $form_state) {
+ $header = array(
+ t('Realm name'),
+ t('Weight'),
+ t('Options'),
+ );
+
+ $realms = array();
+ foreach (variable_realm_info() as $realm => $info) {
+ $options = array();
+ // Add list of configured variables + configuration link
+ if (!empty($info['select'])) {
+ $options[] = l(t('Configure'), 'admin/config/system/variable/realm/' . $realm . '/configure');
+ $options[] = l(t('Edit'), 'admin/config/system/variable/realm/' . $realm . '/edit');
+ }
+ // Get weight from realm controller.
+ $controller = variable_realm_controller($realm);
+ $realms[] = array(
+ l($info['title'], 'admin/config/system/variable/realm/' . $realm),
+ $controller->getDefaultWeight(),
+ implode(' | ' , $options)
+ );
+ }
+
+ $form['realms'] = array(
+ '#theme' => 'table',
+ '#header' => $header,
+ '#rows' => $realms,
+ '#empty' => t('No realms available.'),
+ );
+
+ return $form;
+}
+
+/**
+ * Lists available realms.
+ */
+function variable_admin_realm_info($realm_name) {
+ $controller = variable_realm_controller($realm_name);
+ $build['title'] = array(
+ '#type' => 'item',
+ '#title' => t('Name'),
+ '#markup' => $controller->getTitle(),
+ );
+ $build['keys'] = array(
+ '#theme' => 'item_list',
+ '#title' => t('Keys'),
+ '#items' => $controller->getAllKeys(),
+ );
+ $build['variables'] = array(
+ '#theme' => 'item_list',
+ '#title' => t('Variables'),
+ '#items' => $controller->getEnabledVariables(),
+ );
+ if ($controller->getInfo('select')) {
+ $build['options'] = array(
+ '#theme' => 'item_list',
+ '#title' => t('Options'),
+ '#items' => array(
+ l(t('Configure'), 'admin/config/system/variable/realm/' . $realm_name . '/configure'),
+ l(t('Edit'), 'admin/config/system/variable/realm/' . $realm_name . '/edit'),
+ ),
+ );
+ }
+ return $build;
+}
+
+/**
+ * Edit variables for realm.
+ */
+function variable_admin_realm_edit($realm_name) {
+ module_load_include('form.inc', 'variable_realm');
+ $realm_key = variable_realm_form_key_current($realm_name);
+ $build['select'] = variable_realm_form_key_selector($realm_name, $realm_key);
+ $build['form'] = drupal_get_form('variable_realm_edit_variables_form', $realm_name, $realm_key);
+ return $build;
+}
+
+/**
+ * Message for forms viewing / editing global variables.
+ */
+function _variable_admin_realm_message() {
+ if (module_exists('variable_realm')) {
+ return '<p>' . t('These are global default variables. To edit variables for a specific realm go to <a href="@variable-realm">Variable Realms</a>', array('@variable-realm' => url('admin/config/system/variable/realm'))) .'</p>';
+ }
+ else {
+ return '';
+ }
+}
+
+/**
+ * Options for forms viewing / editing global variables.
+ */
+function _variable_admin_realm_options() {
+ if (module_exists('variable_realm')) {
+ $options['realm'] = variable_realm('global', 'default');
+ $options['realm_name'] = 'global';
+ $options['realm_key'] = 'default';
+ return $options;
+ }
+ else {
+ return array();
+ }
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_admin/variable_admin.info b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_admin/variable_admin.info
new file mode 100644
index 0000000..7b78612
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_admin/variable_admin.info
@@ -0,0 +1,11 @@
+name = Variable admin
+description = Variable Administration UI
+dependencies[] = variable
+package = Variable
+core = 7.x
+; Information added by drupal.org packaging script on 2013-01-13
+version = "7.x-2.2"
+core = "7.x"
+project = "variable"
+datestamp = "1358075138"
+
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_admin/variable_admin.module b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_admin/variable_admin.module
new file mode 100644
index 0000000..fd602b6
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_admin/variable_admin.module
@@ -0,0 +1,109 @@
+<?php
+/**
+ * @file
+ * Variable API module - Admin UI
+ */
+
+/**
+ * Implements hook_menu().
+ */
+function variable_admin_menu() {
+ $items['admin/config/system/variable'] = array(
+ 'title' => 'Variables',
+ 'description' => 'Variable settings for mixed modules.',
+ 'page callback' => 'variable_admin_page_group',
+ 'file' => 'variable_admin.inc',
+ 'access arguments' => array('administer site configuration'),
+ );
+ $items['admin/config/system/variable/group'] = array(
+ 'title' => 'Groups',
+ 'description' => 'Variables per group.',
+ 'type' => MENU_DEFAULT_LOCAL_TASK,
+ );
+ $items['admin/config/system/variable/module'] = array(
+ 'title' => 'Modules',
+ 'description' => 'Variables per module.',
+ 'page callback' => 'variable_admin_page_module',
+ 'file' => 'variable_admin.inc',
+ 'access arguments' => array('administer site configuration'),
+ 'type' => MENU_LOCAL_TASK,
+ );
+ $items['admin/config/system/variable/edit/%'] = array(
+ 'title' => 'Edit variable',
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array('variable_edit_form', 5),
+ 'access callback' => 'variable_access',
+ 'access arguments' => array(5),
+ );
+ if (module_exists('variable_realm')) {
+ $items['admin/config/system/variable/realm'] = array(
+ 'title' => 'Realms',
+ 'description' => 'Configure realms.',
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array('variable_admin_realm_overview'),
+ 'file' => 'variable_admin.inc',
+ 'access arguments' => array('administer site configuration'),
+ 'type' => MENU_LOCAL_TASK,
+ );
+ $items['admin/config/system/variable/realm/overview'] = array(
+ 'title' => 'Overview',
+ 'description' => 'Configure realms.',
+ 'type' => MENU_DEFAULT_LOCAL_TASK,
+ 'weight' => -10
+ );
+ $weight = 0;
+ foreach (variable_realm_list_all() as $realm => $controller) {
+ $items['admin/config/system/variable/realm/' . $realm] = array(
+ 'title callback' => 'variable_admin_realm_title',
+ 'title arguments' => array($realm),
+ 'description' => 'Configure realm variables.',
+ 'page callback' => 'variable_admin_realm_info',
+ 'page arguments' => array($realm),
+ 'access callback' => 'variable_admin_realm_access',
+ 'access arguments' => array($realm),
+ 'file' => 'variable_admin.inc',
+ 'type' => MENU_LOCAL_TASK,
+ 'weight' => $weight++,
+ );
+ }
+ $items['admin/config/system/variable/realm/%/edit'] = array(
+ 'title' => 'Edit',
+ 'description' => 'Edit realm variables.',
+ 'page callback' => 'variable_admin_realm_edit',
+ 'page arguments' => array(5),
+ 'access callback' => 'variable_admin_realm_access',
+ 'access arguments' => array(5, 'select'),
+ 'file' => 'variable_admin.inc',
+ );
+ $items['admin/config/system/variable/realm/%/configure'] = array(
+ 'title' => 'Configure',
+ 'description' => 'Configure realm variables.',
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array('variable_realm_select_variables_form', 5),
+ 'access callback' => 'variable_admin_realm_access',
+ 'access arguments' => array(5, 'select'),
+ 'file' => 'variable_realm.form.inc',
+ 'file path' => drupal_get_path('module', 'variable_realm'),
+ );
+ }
+ return $items;
+}
+
+/**
+ * Check permission for administering realm
+ */
+function variable_admin_realm_access($realm_name, $property = 'title') {
+ if ($info = variable_realm_info($realm_name)) {
+ return !empty($info[$property]) && user_access('administer site configuration');
+ }
+}
+
+/**
+ * Retrieve title of given realm.
+ */
+function variable_admin_realm_title($realm) {
+ $info = variable_realm_info($realm);
+ return isset($info['title']) ? $info['title'] : $realm;
+}
+
+
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_advanced/variable_advanced.info b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_advanced/variable_advanced.info
new file mode 100644
index 0000000..d9ee706
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_advanced/variable_advanced.info
@@ -0,0 +1,11 @@
+name = Variable advanced
+description = Provides access to advanced low level variables. By using this you will be able to break your site badly.
+dependencies[] = variable
+package = Variable
+core = 7.x
+; Information added by drupal.org packaging script on 2013-01-13
+version = "7.x-2.2"
+core = "7.x"
+project = "variable"
+datestamp = "1358075138"
+
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_advanced/variable_advanced.module b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_advanced/variable_advanced.module
new file mode 100644
index 0000000..1ec1275
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_advanced/variable_advanced.module
@@ -0,0 +1,5 @@
+<?php
+/**
+ * @file
+ * Drupal module - Advanced variable otpions.
+ */ \ No newline at end of file
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_advanced/variable_advanced.variable.inc b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_advanced/variable_advanced.variable.inc
new file mode 100644
index 0000000..5bd408e
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_advanced/variable_advanced.variable.inc
@@ -0,0 +1,73 @@
+<?php
+/**
+ * @file
+ * Advanced variables.
+ */
+
+/**
+ * Implements hook_variable_group_info().
+ */
+function variable_advanced_variable_group_info() {
+ $groups['advanced'] = array(
+ 'title' => t('Advanced options'),
+ 'description' => t('Advanced settings not usually exposed. Changing these variables may seriously break your site so make sure you know what you do.'),
+ );
+ return $groups;
+}
+
+/**
+ * Implements hook_variable_info().
+ */
+function variable_advanced_variable_info($options) {
+ // Bootstrap caching options
+ $variables['page_cache_invoke_hooks'] = array(
+ 'title' => t('Cache invoke hooks'),
+ 'type' => 'enable',
+ 'default' => 1,
+ 'group' => 'advanced',
+ 'description' => T('Invoke <em>boot</em> and <em>exit</em> hooks when the page is served from cache.'),
+ );
+ $variables['actions_max_stack'] = array(
+ 'title' => t('Actions recursion level'),
+ 'type' => 'number',
+ 'default' => 35,
+ 'group' => 'advanced',
+ 'description' => t('Maximum recursion level for actions before the execution is aborted.', array(), $options),
+ );
+ // Bootstrap language variables.
+ $variables['language_count'] = array(
+ 'title' => t('Language count'),
+ 'type' => 'number',
+ 'default' => 1,
+ 'group' => 'advanced',
+ 'description' => t('Number of enabled languages, used for quick bootstrap. Not to be changed manually.', array(), $options),
+ );
+ $variables['language_types'] = array(
+ 'title' => t('Language types'),
+ 'type' => 'array',
+ 'default callback' => 'drupal_language_types',
+ 'group' => 'advanced',
+ 'description' => t('Available language types.'),
+ );
+ // Bootstrap proxy configuration
+ $variables['reverse_proxy'] = array(
+ 'title' => t('Reverse proxy'),
+ 'type' => 'enable',
+ 'default' => 0,
+ 'group' => 'advanced',
+ 'description' => t('If Drupal is behind a reverse proxy, we use the X-Forwarded-For header instead of $_SERVER[\'REMOTE_ADDR\'], which would be the IP address of the proxy server, and not the client\'s. The actual header name can be configured by the reverse_proxy_header variable.', array(), $options),
+ );
+ $variables['reverse_proxy_header'] = array(
+ 'title' => t('Reverse proxy header'),
+ 'default' => 'HTTP_X_FORWARDED_FOR',
+ 'group' => 'advanced',
+ );
+ $variables['reverse_proxy_addresses'] = array(
+ 'title' => t('Reverse proxy addresses'),
+ 'type' => 'array',
+ 'group' => 'advanced',
+ 'default' => array(),
+ 'description' => t('If an array of known reverse proxy IPs is provided, then trust the XFF header if request really comes from one of them.', array(), $options),
+ );
+ return $variables;
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_example/variable_example.info b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_example/variable_example.info
new file mode 100644
index 0000000..64d6ff0
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_example/variable_example.info
@@ -0,0 +1,14 @@
+name = Variable example
+description = An example module showing how to use the Variable API and providing some variables.
+dependencies[] = variable
+dependencies[] = variable_store
+package = Example modules
+core = 7.x
+files[] = variable_example.variable.inc
+
+; Information added by drupal.org packaging script on 2013-01-13
+version = "7.x-2.2"
+core = "7.x"
+project = "variable"
+datestamp = "1358075138"
+
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_example/variable_example.module b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_example/variable_example.module
new file mode 100644
index 0000000..c2de755
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_example/variable_example.module
@@ -0,0 +1,81 @@
+<?php
+/**
+ * Variable example.
+ */
+
+/**
+ * Implements hook_variable_realm_info()
+ */
+function variable_example_variable_realm_info() {
+ $realm['example'] = array(
+ 'title' => t('Example'),
+ 'weight' => 10,
+ 'store class' => 'VariableStoreRealmStore',
+ 'keys' => array(
+ 'first' => t('First example'),
+ 'second' => t('Second example'),
+ ),
+ );
+ return $realm;
+}
+
+/**
+ * Implements hook_menu().
+ */
+function variable_example_menu() {
+ $items['admin/config/system/variable_example'] = array(
+ 'title' => 'Variable example',
+ 'description' => 'Example of auto generated settings form.',
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array('variable_group_form', 'variable_example'),
+ 'access arguments' => array('administer site configuration'),
+ );
+ $items['variable/example'] = array(
+ 'title' => 'Variable example',
+ 'description' => 'List some variables.',
+ 'page callback' => 'variable_example_page_list',
+ 'access arguments' => array('administer site configuration'),
+ );
+ $items['variable/realm/%/%'] = array(
+ 'title' => 'Variable example realm',
+ 'description' => 'Example of variable realms.',
+ 'page callback' => 'variable_example_page_realm',
+ 'page arguments' => array(2, 3),
+ 'access arguments' => array('administer site configuration'),
+ );
+ return $items;
+}
+
+/**
+ * Variable example realm page.
+ *
+ * Will switch to given realm and display variables.
+ */
+function variable_example_page_list() {
+ variable_include();
+ $list = variable_list_group('site_information') + variable_list_group('variable_example');
+ foreach ($list as $name => $variable) {
+ $build[$name] = array(
+ '#type' => 'item',
+ '#title' => $variable['title'],
+ '#markup' => variable_format_value($variable),
+ );
+ }
+ return $build;
+}
+
+/**
+ * Variable example realm page.
+ *
+ * Will switch to given realm and display variables.
+ */
+function variable_example_page_realm($realm, $key) {
+ // Initialize realm from variable store.
+ $variables = variable_store($realm, $key);
+ // Set at least one variable for the realm
+ $variables += array('site_name' => 'Variable example realm');
+ variable_realm_add($realm, $key, $variables);
+ variable_realm_switch($realm, $key);
+ return variable_example_page_list();
+}
+
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_example/variable_example.variable.inc b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_example/variable_example.variable.inc
new file mode 100644
index 0000000..1510839
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_example/variable_example.variable.inc
@@ -0,0 +1,67 @@
+<?php
+/**
+ * @file
+ * Variable API module. Definition for some xample variables
+ */
+
+/**
+ * Implements hook_variable_info().
+ */
+function variable_example_variable_info($options) {
+ // Simple text
+ $variables['variable_example_text'] = array(
+ 'type' => 'text',
+ 'title' => t('Simple text', array(), $options),
+ 'default' => 'Example text.',
+ 'description' => t('Example of text variable.', array(), $options),
+ 'required' => TRUE,
+ 'group' => 'variable_example',
+ );
+ // Simple number, demonstrates validate callback.
+ $variables['variable_example_number'] = array(
+ 'type' => 'number',
+ 'title' => t('Number', array(), $options),
+ 'default' => 0,
+ 'description' => t('Example of numeric variable.', array(), $options),
+ 'required' => TRUE,
+ 'group' => 'variable_example',
+ );
+ // Text with format
+ $variables['variable_example_text_format'] = array(
+ 'type' => 'text_format',
+ 'title' => t('Text format', array(), $options),
+ // The default value may be a string (default format will be added) or
+ // an array with 'format' (format name) and 'value' (string) elements
+ 'default' => 'Example text with default format',
+ 'description' => t('Example of text variable with text format.', array(), $options),
+ 'required' => TRUE,
+ 'group' => 'variable_example',
+ );
+ // Text with format
+ $variables['variable_example_mail_[mail_part]'] = array(
+ 'type' => 'mail_text',
+ 'title' => t('Example mail', array(), $options),
+ 'default' => array(
+ 'subject' => t('Example mail subject', array(), $options),
+ 'body' => t('Example mail body.', array(), $options),
+ ),
+ 'description' => t('Example mail variable with subject and body.', array(), $options),
+ 'required' => TRUE,
+ 'group' => 'variable_example',
+ );
+ return $variables;
+}
+
+/**
+ * Implements hook_variable_group_info().
+ */
+function variable_example_variable_group_info() {
+ $groups['variable_example'] = array(
+ 'title' => t('Examples'),
+ 'description' => t('Variable examples of different types.'),
+ 'access' => 'administer site configuration',
+ 'path' => array('admin/config/system/variable/example'),
+ );
+ return $groups;
+}
+
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/README.txt b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/README.txt
new file mode 100644
index 0000000..7d5628a
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/README.txt
@@ -0,0 +1,93 @@
+
+Drupal module: Variable Realms
+============================================
+This is an API module that works as an arbitrator for multiple modules overriding global variables. It can
+handle multiple realms defined by different modules. Examples: 'global', 'language', 'country',
+
+Each realm has a weight and a current status. Realms with higher weights will override realms with lower weight.
+
+There's a special 'global/default' realm that is the one storing default global variables. It has a weight of 0
+so realms with weights higher than that (default weight for new realms is 10) will override these.
+
+Any number of realms can be defined by different modules. If two modules use the same realm, the last one's variables
+and weight will override the previous one. Every time we switch a realm, the $conf global array will be rebuilt.
+
+At any moment the $conf global array of variables will be a combination of the active realms.
+If we've got these two reamls defined:
+ - global/default, weight 0, which is defined by this module, will hold global default variables
+ - mymodule/key, weight 10, which may be defined by any contrib module on hook_boot() or hook_init()
+The resulting variable set will be a combination of these two, with the second overriding the first one,
+because of a higher weight. This is how we calculate the resulting variables when using variable_realm_switch()
+
+ $conf = $variables['global/default'] + $variables['mymodule/key']
+
+API Example
+-----------
+This is an example of how realms work:
+
+// We add a language realm with some variables and immediately switch to it
+ variable_realm_add('language', 'es', $spanish_variables);
+ variable_realm_switch('language', 'es');
+
+// We add a country realm on top of it with some more variables but don't switch to it yet.
+// Note the first time we add a domain we can set the weight for it.
+
+ variable_realm_add('country', 'spain', $spain_variables, 100);
+
+// We add another country realm, but don't switch to it.
+// The same weight from previous 'country' realm will be used
+
+ variable_realm_add('country', 'mexico', $mexico_variables);
+
+// Now we can switch to the 'spanish/spain' set of variables
+
+ variable_realm_switch('country', 'spain');
+
+// Or we can use the 'spanish/mexico' set
+
+ variable_realm_switch('country', 'mexico');
+
+// Still we can add one more realm which will override some variables for the current node's content type
+// These will override all the others because of its higher weight
+ variable_realm_add('nodetype', 'story', $story_variables, 200)
+ variable_realm_switch('nodetype', 'story')
+
+An example of a module using this API is Internationalization's i18n_variable module.
+
+Variable Realm Union.
+====================================
+
+This an API that allows combining two existing realms into a new one
+whose keys are a combination of the other two.
+
+An example of this module in action is the 'Domain+I18n Variables Integration' module
+which is part of 'Domain Variable' module.
+
+How to use it.
+=============
+To define a new domain that is a combination of two or more existing ones:
+
+1. Implement hook_variable_realm_info() to define the realm name and properties.
+
+function domain_i18n_variable_variable_realm_info() {
+ $realm['domain_language'] = array(
+ 'title' => t('Domain+Language'),
+ // Display on settings forms but without form switcher.
+ 'form settings' => TRUE,
+ 'form switcher' => FALSE,
+ 'variable name' => t('multilingual domain'),
+ );
+ return $realm;
+}
+
+2. Implement hook_variable_realm_controller() to define the Controller class to
+ be used and which other realms it is a combination of. Example:
+
+function domain_i18n_variable_variable_realm_controller() {
+ $realm['domain_language'] = array(
+ 'weight' => 200,
+ 'class' => 'VariableStoreRealmController',
+ 'union' => array('domain', 'language'),
+ );
+ return $realm;
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.api.php b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.api.php
new file mode 100644
index 0000000..4e81682
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.api.php
@@ -0,0 +1,96 @@
+<?php
+/**
+ * @file
+ * Documents hooks provided by Variable Realm API.
+ */
+
+/**
+ * @addtogroup hooks
+ * @{
+ */
+
+/**
+ * Provides information about controller classes and weights needed by the realm system
+ * and some more meta-information for realm administration.
+ *
+ * This information is mainly used to build exportable realms as Features.
+ *
+ * @see i18n_variable_variable_realm_info()
+ *
+ * @return array
+ * Array keyed by realm name which contains the following elements:
+ * - 'title', Humam readable name for the realm.
+ * - 'controller class', Class name for realm controller, implementing VariableRealmControllerInterface.
+ * - 'store class', Class name for realm store, implementing VariableRealmStoreInterface.
+ * - 'weight', Default weight for this realm.
+ * - 'keys', Associative array with human readable names for keys.
+ * - 'keys callback', Callback function to provide the keys.
+ * - 'default key', The default key.
+ * - 'options', Array of variable names that may be set for this realm. If not set
+ * any variable will be allowed for this realm.
+ * - 'list callback', Callback function to provide variable list for this realm.
+ * - 'select', Boolean flag whether variables for this realm can be selected from a list.
+ * - 'select path', Path to variable selection form (optional).
+ * - 'variable name', Name for variables that belong to this realm: e.g. 'multilingual' variable/s
+ * - 'variable class', CSS class name for annotated variables in system settings forms.
+ * - 'form settings', Boolean flag, whether realm variables should be handled automatically
+ * in system settings forms.
+ * - 'form switcher', Boolean flag, whether a realm switcher should be auto-generated
+ * for settings forms which contain variables that belong to this realm.
+ */
+function hook_variable_realm_info() {
+ $realm['language'] = array(
+ 'title' => t('Language'),
+ 'controller class' => 'I18nVariableLanguageRealm',
+ 'store class' => 'VariableStoreRealmStore',
+ 'keys' => locale_language_list('name', TRUE),
+ 'default key' => language_default('language'),
+ 'options' => _i18n_variable_variable_realm_list(),
+ 'select' => TRUE,
+ 'select path' => 'admin/config/regional/i18n/variable',
+ 'variable name' => t('multilingual'),
+ 'variable class' => 'i18n-variable',
+ 'form settings' => TRUE,
+ );
+ return $realm;
+}
+
+/**
+ * Allow other modules to act when enabling a realm.
+ *
+ * This hook is invoked right after the realm controller is enabled
+ * and it may have a valid key already set or it may be FALSE.
+ *
+ * @param $realm_name
+ * Realm that is switched.
+ * @param $realm_key
+ * New realm key.
+ */
+function hook_variable_realm_enable($realm_name, $realm_key) {
+}
+
+/**
+ * Allow other modules to act on realm switching.
+ *
+ * This hook is invoked right after the realm key is switched but before
+ * the global variables are rebuilt.
+ *
+ * @param $realm_name
+ * Realm that is switched.
+ * @param $realm_key
+ * New realm key.
+ */
+function hook_variable_realm_switch($realm_name, $realm_key) {
+}
+
+/**
+ * Allow other modules to act when rebuilding the configuration.
+ *
+ * This hook is invoked before the global variables are rebuilt
+ * using the active realms.
+ */
+function hook_variable_realm_rebuild() {
+}
+/**
+ * @} End of "addtogroup hooks".
+ */
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.class.inc b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.class.inc
new file mode 100644
index 0000000..a5828b0
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.class.inc
@@ -0,0 +1,544 @@
+<?php
+/**
+ * @file
+ * Variable realm controller
+ */
+
+/**
+ * Realm Controller Interface.
+ */
+interface VariableRealmControllerInterface {
+ /**
+ * Class constructor.
+ *
+ * @param $realm_name
+ * Realm name.
+ * @param $store_class
+ * Realm key.
+ */
+ public function __construct($realm_name);
+ /**
+ * Check whether the realm is enabled (has a key set).
+ */
+ public function isEnabled();
+ /**
+ * Check whether the realm is active (has a valid key set).
+ */
+ public function isActive();
+ /**
+ * Start this realm with request key.
+ *
+ * This will only change the realm key if the realm is not initialized yet.
+ */
+ public function enable($realm_key = NULL);
+ /**
+ * Get title for this realm.
+ */
+ public function getTitle();
+ /**
+ * Get name for variables in this realm.
+ */
+ public function getVariableName();
+ /**
+ * Add store for realm key.
+ *
+ * @param $variables
+ * Optional array with variable values to initialize the realm key store.
+ */
+ public function addStore($realm_key, $variables = NULL);
+ /**
+ * Get store for realm key.
+ */
+ public function getStore($realm_key);
+ /**
+ * Set store for realm key.
+ */
+ public function setStore($realm_key, $realm_store);
+ /**
+ * Get current realm key.
+ */
+ public function getKey();
+ /**
+ * Get default key for this realm.
+ */
+ public function getDefaultKey();
+ /**
+ * Get key for this page request.
+ */
+ public function getRequestKey();
+ /**
+ * Set current realm key.
+ */
+ public function setKey($realm_key);
+ /**
+ * Get all keys for this realm.
+ */
+ public function getAllKeys();
+ /**
+ * Get other realms this one may depend upon.
+ */
+ public function getParentRealms();
+ /**
+ * Get current realm weight.
+ */
+ public function getWeight();
+ /**
+ * Set current realm weight.
+ */
+ public function setWeight($weight);
+ /**
+ * Implementation of VariableRealmControllerInterface::getWeight().
+ */
+ public function getDefaultWeight();
+ /**
+ * Get current variable store.
+ */
+ public function getCurrentStore();
+ /**
+ * List all current variable values.
+ */
+ public function getCurrentVariables();
+ /**
+ * Get information for this realm.
+ *
+ * Return information provided by hook_variable_realm_info()
+ */
+ public function getInfo($property = NULL, $default = NULL);
+ /**
+ * Get list of variables available for this realm.
+ */
+ public function getAvailableVariables();
+ /**
+ * Get list of variables enabled for this realm.
+ */
+ public function getEnabledVariables();
+ /**
+ * Get system variable for this realm.
+ */
+ public function getRealmVariable($name, $default = NULL);
+ /**
+ * Set system variable for this realm.
+ */
+ public function setRealmVariable($name, $value);
+ /**
+ * Delete variable for all keys this realm.
+ *
+ * @param $variable_name
+ * Variable name to delete.
+ */
+ public function deleteVariable($variable_name);
+}
+
+/**
+ * Variable Realm Hooks.
+ */
+interface VariableRealmHooks {
+ /**
+ * Callback function that will be invoked when a realm is enabled.
+ */
+ public function variableRealmEnable($realm_name, $realm_key);
+ /**
+ * Callback method that will be invoked when a realm is switched.
+ */
+ public function variableRealmSwitch($realm_name, $realm_key);
+}
+
+/**
+ * Realm Store Interface.
+ */
+interface VariableRealmStoreInterface {
+ /**
+ * Class constructor.
+ *
+ * @param $realm
+ * Realm name.
+ * @param $key
+ * Realm key.
+ * @param $variables
+ * Optional array of variables to initialize the realm with.
+ */
+ public function __construct($realm, $key, $variables = NULL);
+ /**
+ * Initialize variables.
+ */
+ public function variable_init();
+ /**
+ * Get single variable.
+ *
+ * @param $name
+ * Variable name
+ * @param $default
+ * Default value
+ */
+ public function variable_get($name, $default = NULL);
+ /**
+ * Set single variable.
+ *
+ * @param $name
+ * Variable name
+ * @param $value
+ * Variable value
+ */
+ public function variable_set($name, $value);
+ /**
+ * Delete single variable.
+ *
+ * @param $name
+ * Variable name
+ */
+ public function variable_del($name);
+ /**
+ * Add single variable to the realm for current request.
+ *
+ * While variable set actually sets the variable on whatever realm storage
+ * we are using, this function just sets a runtime value.
+ *
+ * @param $name
+ * Variable name
+ * @param $value
+ * Variable value
+ */
+ public function variable_add($name, $value);
+ /**
+ * Check whether a variable exists in the realm.
+ */
+ public function variable_exists($name);
+ /**
+ * List all current variable values.
+ */
+ public function variable_list();
+}
+
+/**
+ * Base class, keeps static list of variables.
+ */
+class VariableRealmDefaultController implements VariableRealmControllerInterface {
+ // Unique realm name (language, domain..)
+ public $realm_name;
+ // Current realm key.
+ public $current_key;
+ // Current realm weight.
+ public $current_weight;
+ // Array of variable stores indexed by realm key.
+ protected $store;
+ /**
+ * Implementation of VariableRealmControllerInterface::__construct().
+ */
+ public function __construct($realm_name) {
+ $this->realm_name = $realm_name;
+ $this->current_weight = $this->getDefaultWeight();
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::isEnabled()
+ */
+ public function isEnabled() {
+ return isset($this->current_key);
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::isActive()
+ */
+ public function isActive() {
+ return $this->isEnabled() && $this->current_key !== FALSE;
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::enable().
+ */
+ public function enable($realm_key = NULL) {
+ if (!isset($this->current_key)) {
+ return $this->current_key = isset($realm_key) ? $realm_key : $this->getRequestKey();
+ }
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::getTitle().
+ */
+ public function getTitle() {
+ return $this->getInfo('title');
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::getVariableName().
+ */
+ public function getVariableName() {
+ return $this->getInfo('variable name');
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::getStore().
+ */
+ public function getStore($realm_key) {
+ if (isset($this->store[$realm_key])) {
+ return $this->store[$realm_key];
+ }
+ else {
+ return $this->addStore($realm_key);
+ }
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::addStore().
+ */
+ public function addStore($realm_key, $variables = NULL) {
+ $store = $this->createStore($realm_key, $variables);
+ $this->setStore($realm_key, $store);
+ return $store;
+ }
+ /**
+ * Create Store for key.
+ */
+ protected function createStore($realm_key, $variables = NULL) {
+ $class = $this->getInfo('store class');
+ $class = $class && class_exists($class) ? $class : 'VariableRealmDefaultStore';
+ return new $class($this->realm_name, $realm_key, $variables);
+ }
+ /**
+ * Set store for realm key.
+ */
+ public function setStore($realm_key, $realm_store) {
+ $this->store[$realm_key] = $realm_store;
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::setKey().
+ */
+ public function setKey($realm_key) {
+ $this->current_key = $realm_key;
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::getKey().
+ */
+ public function getKey() {
+ return isset($this->current_key) ? $this->current_key : FALSE;
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::getAllKeys().
+ */
+ public function getAllKeys() {
+ return $this->getInfo('keys', array());
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::getDefaultKey().
+ */
+ public function getDefaultKey() {
+ return $this->getInfo('default key', FALSE);
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::getRequestKey().
+ */
+ public function getRequestKey() {
+ return FALSE;
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::getWeight().
+ */
+ public function getWeight() {
+ return isset($this->current_weight) ? $this->current_weight : $this->controller_data['weight'];
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::setWeight().
+ */
+ public function setWeight($weight) {
+ $this->current_weight = $weight;
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::getWeight().
+ */
+ public function getDefaultWeight() {
+ return $this->getRealmVariable('weight', $this->getInfo('weight', 0));
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::getParentRealms().
+ */
+ public function getParentRealms() {
+ return array();
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::getCurrentVariables().
+ */
+ public function getCurrentVariables() {
+ if ($store = $this->getCurrentStore()) {
+ return $store->variable_list();
+ }
+ else {
+ return array();
+ }
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::getCurrentStore().
+ */
+ public function getCurrentStore() {
+ if ($this->isActive()) {
+ return $this->getStore($this->getKey());
+ }
+ else {
+ return NULL;
+ }
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::getAvailableVariables().
+ */
+ public function getAvailableVariables() {
+ if ($options = $this->getInfo('options')) {
+ return $options;
+ }
+ else {
+ // Defaults to all available variables.
+ return array_keys(variable_get_info());
+ }
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::getEnabledVariables().
+ */
+ public function getEnabledVariables() {
+ if ($this->getInfo('select')) {
+ return $this->getRealmVariable('list', array());
+ }
+ else {
+ // If the variable is not set it will default to all variables
+ return $this->getAvailableVariables();
+ }
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::getInfo().
+ */
+ public function getInfo($property = NULL, $default = NULL) {
+ $info = variable_realm_info($this->realm_name);
+ if ($property) {
+ return isset($info[$property]) ? $info[$property] : $default;
+ }
+ else {
+ return $info;
+ }
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::getRealmVariable().
+ */
+ public function getRealmVariable($name, $default = NULL) {
+ return variable_get('variable_realm_' . $name . '_' . $this->realm_name, $default);
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::setRealmVariable().
+ */
+ public function setRealmVariable($name, $value) {
+ variable_realm_global_set('variable_realm_' . $name . '_' . $this->realm_name, $value);
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::deleteVariable().
+ */
+ public function deleteVariable($variable_name) {
+ foreach ($this->getAllKeys() as $key => $name) {
+ variable_realm_del($this->realm_name, $key, $variable_name, FALSE);
+ }
+ }
+}
+
+/**
+ * Base class, keeps static list of variables.
+ */
+class VariableRealmDefaultStore implements VariableRealmStoreInterface {
+ public $realm;
+ public $key;
+ protected $variables;
+ /**
+ * Class constructor.
+ */
+ public function __construct($realm, $key, $variables = NULL) {
+ $this->realm = $realm;
+ $this->key = $key;
+ $this->variables = $variables;
+ }
+ /**
+ * Initialize variables.
+ */
+ public function variable_init() {
+ if (!isset($this->variables)) {
+ $this->variables = array();
+ }
+ }
+ /**
+ * Get single variable.
+ *
+ * @param $name
+ * Variable name
+ * @param $default
+ * Default value
+ */
+ public function variable_get($name, $default = NULL) {
+ $this->variable_init();
+ return isset($this->variables[$name]) ? $this->variables[$name] : $default;
+ }
+ /**
+ * Set single variable.
+ *
+ * @param $name
+ * Variable name
+ * @param $value
+ * Variable value
+ */
+ public function variable_set($name, $value) {
+ $this->variable_init();
+ $this->variables[$name] = $value;
+ }
+ /**
+ * Delete single variable.
+ *
+ * @param $name
+ * Variable name
+ */
+ public function variable_del($name) {
+ $this->variable_init();
+ unset($this->variables[$name]);
+ }
+ /**
+ * Implementation of VariableRealmStoreInterface::variable_add().
+ */
+ public function variable_add($name, $value) {
+ $this->variable_init();
+ $this->variables[$name] = $value;
+ }
+ /**
+ * Implementation of VariableRealmStoreInterface::variable_exists().
+ */
+ public function variable_exists($name) {
+ $this->variable_init();
+ return isset($this->variables[$name]);
+ }
+ /**
+ * List all current variable values.
+ */
+ public function variable_list() {
+ $this->variable_init();
+ return $this->variables;
+ }
+}
+
+/**
+ * Controller for default system variables.
+ */
+class VariableRealmGlobalStore extends VariableRealmDefaultStore {
+ /**
+ * Initialize variables.
+ */
+ public function variable_init() {
+ if (!isset($this->variables)) {
+ $this->variables = $GLOBALS['conf'];
+ }
+ }
+ /**
+ * Set single variable.
+ *
+ * @param $name
+ * Variable name
+ * @param $value
+ * Variable value
+ */
+ public function variable_set($name, $value) {
+ parent::variable_set($name, $value);
+ variable_set($name, $value);
+ }
+ /**
+ * Delete single variable.
+ *
+ * @param $name
+ * Variable name
+ */
+ public function variable_del($name) {
+ parent::variable_del($name);
+ variable_del($name);
+ }
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.drush.inc b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.drush.inc
new file mode 100644
index 0000000..f6aab08
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.drush.inc
@@ -0,0 +1,112 @@
+<?php
+/**
+ * @file
+ * Drush commands for Variable Realm.
+ */
+
+/**
+ * Implements hook_drush_command().
+ */
+function variable_realm_drush_command() {
+ $items['variable-realm-get'] = array(
+ 'description' => 'Get a variable for a specific realm and key.',
+ 'examples' => array(
+ 'drush variable-realm-get language es site_frontpage',
+ 'drush variable-realm-get language es',
+ ),
+ 'arguments' => array(
+ 'domain_name' => 'The realm name for the variable.',
+ 'domain_key' => 'The domain key for the variable.',
+ 'variable_name' => 'Optional variable name variable to get. If not present list all variables for that realm and key.',
+ ),
+ );
+ $items['variable-realm-set'] = array(
+ 'description' => 'Set a variable for a specific realm and key.',
+ 'examples' => array(
+ 'drush variable-realm-set language es site_frontpage /home ',
+ ),
+ 'arguments' => array(
+ 'domain_name' => 'The realm name for the variable.',
+ 'domain_key' => 'The domain key for the variable.',
+ 'variable_name' => 'The name variable to set (e.g. site_frontpage).',
+ 'value' => 'The value to set for this variable.'
+ ),
+ );
+ $items['variable-realm-del'] = array(
+ 'description' => 'Delete a variable for a specific realm and key.',
+ 'examples' => array(
+ 'drush variable-realm-del language es site_frontpage',
+ ),
+ 'arguments' => array(
+ 'domain_name' => 'The realm name for the variable.',
+ 'domain_key' => 'The domain key for the variable.',
+ 'variable_name' => 'The name variable to set (e.g. site_frontpage).',
+ ),
+ );
+ return $items;
+}
+
+/**
+ * Implements hook_drush_help().
+ */
+function variable_realm_drush_help($section) {
+ $items = variable_realm_drush_command();
+ $name = str_replace('domain:', '', $section);
+ if (isset($items[$name])) {
+ return dt($items[$name]['description']);
+ }
+}
+
+/**
+ * Drush command callback.
+ * Set realm's variables.
+ */
+function drush_variable_realm_set($realm_name, $realm_key, $variable_name, $value) {
+ variable_realm_set($realm_name, $realm_key, $variable_name, $value);
+ drush_print('Variable set.');
+}
+
+/**
+ * Drush command callback.
+ * Validate parameters
+ */
+function drush_variable_realm_set_validate($realm_name = NULL, $realm_key = NULL, $variable_name = NULL, $value = NULL) {
+ if (is_null($realm_name) | is_null($realm_key) || is_null($variable_name) || is_null($value)) {
+ return drush_set_error('variable_realm', dt('Please enter all four required arguments, "dc-set realm_name realm_key variable_name value".'));
+ }
+}
+
+/**
+ * Drush command callback.
+ * Delete realm's variables.
+ */
+function drush_variable_realm_del($realm_name, $realm_key, $variable_name) {
+ variable_realm_del($realm_name, $realm_key, $variable_name);
+ drush_print('Variable deleted.');
+}
+
+/**
+ * Drush command callback.
+ * List realm's variables.
+ */
+function drush_variable_realm_get($realm_name, $realm_key, $variable_name) {
+ if ($variable_name) {
+ $variables[$variable_name] = variable_realm_get($realm_name, $realm_key, $variable_name);
+ }
+ else {
+ $variables = variable_realm($realm_name, $realm_key)->variable_list();
+ }
+
+ foreach ($variables as $name => $value) {
+ drush_print_pipe(drush_format($value, $name, 'export'));
+ drush_print(drush_format($value, $name));
+ $returns[$name] = $value;
+ }
+
+ if (empty($variables)) {
+ return drush_set_error('No matching variable found.');
+ }
+ else {
+ return $returns;
+ }
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.features.inc b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.features.inc
new file mode 100644
index 0000000..b0f6275
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.features.inc
@@ -0,0 +1,127 @@
+<?php
+
+/**
+ * @file
+ * Features support for Variable store.
+ */
+
+/**
+ * Implements hook_features_export_options().
+ */
+function variable_realm_features_export_options() {
+ foreach (variable_realm_info() as $name => $realm) {
+ $controller = variable_realm_controller($name);
+ $realm_keys = $controller->getAllKeys();
+ if (count($realm_keys) > 1) {
+ $options[$name] = $controller->getTitle() . ': ' . t('all');
+ }
+ foreach ($realm_keys as $key => $title) {
+ $options[$name . ':' . $key] = $controller->getTitle() . ': ' . $title;
+ }
+ }
+ return $options;
+}
+
+/**
+ * Implements hook_features_export().
+ */
+function variable_realm_features_export($data, &$export, $module_name) {
+ $export['dependencies']['variable_realm'] = 'variable_realm';
+ $list = variable_realm_features_selection($data);
+ foreach ($list as $machine_name) {
+ // Add module that provides the exported realm
+ list($realm, $key) = explode(':', $machine_name, 2); // limit 2 because keys can contain colons
+ if ($realm_info = variable_realm_info($realm)) {
+ $export['dependencies'][$realm_info['module']] = $realm_info['module'];
+ }
+ $export['features']['variable_realm'][$machine_name] = $machine_name;
+ }
+ return array();
+}
+
+/**
+ * Processes export data selections consistently.
+ *
+ * @param $data
+ * Array of selections from the features component form.
+ *
+ * @return
+ * An array of realms, keyed by machine_name.
+ */
+function variable_realm_features_selection($data) {
+ $list = array();
+ foreach ($data as $machine_name) {
+ if (strpos($machine_name, ':')) {
+ $list[] = $machine_name;
+ }
+ else {
+ foreach (variable_realm_keys($machine_name) as $key => $title) {
+ $list[] = "$machine_name:$key";
+ }
+ }
+ }
+ return $list;
+}
+
+/**
+ * Implements hook_features_export_render().
+ */
+function variable_realm_features_export_render($module_name, $data, $export = NULL) {
+ variable_realm_features_load($module_name, 'variable_realm_default_variables', FALSE);
+ $code = array();
+ $code[] = '$realm_variables = array();';
+ foreach ($data as $machine_name) {
+ list($realm, $key) = explode(':', $machine_name, 2); // limit 2 because keys can contain colons
+ $variable_realm = variable_realm($realm, $key);
+ $variables = $variable_realm->variable_list();
+ $code[] = " \$realm_variables['{$realm}']['{$key}'] = " . features_var_export($variables) .";";
+ }
+ $code[] = "\nreturn \$realm_variables;";
+ $output = implode("\n", $code);
+ return array('variable_realm_default_variables' => $output);
+}
+
+/**
+ * Implements hook_features_revert().
+ */
+function variable_realm_features_revert($module) {
+ return variable_realm_features_rebuild($module);
+}
+
+/**
+ * Implements hook_features_rebuild().
+ */
+function variable_realm_features_rebuild($module) {
+ if ($defaults = variable_realm_features_load($module, 'variable_realm_default_variables', TRUE)) {
+ foreach ($defaults as $realm => $realm_data) {
+ foreach ($realm_data as $key => $variables) {
+ $variable_realm = variable_realm($realm, $key);
+ foreach ($variables as $name => $value) {
+ $variable_realm->variable_set($name, $value);
+ }
+ }
+ }
+ }
+}
+
+/**
+ * Features doesn't know how to load custom includes.
+ *
+ * @param $module
+ * The name of the feature to load.
+ * @param $hook
+ * The name of the domain hook.
+ * @param $return
+ * Boolean indicator to return the results of the function.
+ *
+ * @return
+ * The results of the $hook implemenation, if requested.
+ */
+function variable_realm_features_load($module, $hook, $return = TRUE) {
+ // Features does not handle module loading of custom files.
+ module_load_include('inc', $module, $module . '.variable');
+ $function = $module . '_' . $hook;
+ if ($return && function_exists($function)) {
+ return $function();
+ }
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.form.inc b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.form.inc
new file mode 100644
index 0000000..8805d9a
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.form.inc
@@ -0,0 +1,400 @@
+<?php
+/**
+ * @file
+ * Administrative forms for variable realms.
+ */
+
+/**
+ * Select variables for realm.
+ */
+function variable_realm_select_variables_form($form, &$form_state, $realm_name) {
+ $controller = variable_realm_controller($realm_name);
+ $current = $controller->getEnabledVariables();
+ $optional = $controller->getAvailableVariables();
+ // The final list will be the sum of both lists. We may have unknown variables
+ // we want to preserve.
+ $list = array_unique(array_merge($optional, $current));
+ $form['realm_name'] = array('#type' => 'value', '#value' => $realm_name);
+ $form['message']['select']['#markup'] = '<h3>' . t('Select variables to be set for this realm.') . '</h3>';
+ if ($current) {
+ $form['message']['current']['#markup'] = '<p>' . t('Currently selected variables are: <em>!variables</em>', array('!variables' => variable_list_name($current))) . '</p>';
+ }
+ $form['variables'] = array(
+ '#type' => 'vertical_tabs',
+ '#tree' => TRUE,
+ );
+ $variable_groups = variable_group_variables($list);
+ foreach ($variable_groups as $group => $group_list) {
+ $group_info = variable_get_group($group);
+ $group_current = array_intersect($group_list, $current);
+ $form['variables'][$group] = array(
+ '#type' => 'fieldset',
+ '#title' => $group_info['title'],
+ '#theme' => 'variable_table_select',
+ '#collapsible' => TRUE, '#collapsed' => TRUE,
+ );
+ foreach ($group_list as $name) {
+ // Variable names may clash with form element names, so we need to replace '[' and ']'
+ $safename = str_replace(array('[', ']'), array('<', '>'), $name);
+ $form['variables'][$group][$safename] = array(
+ '#type' => 'checkbox',
+ '#default_value' => in_array($name, $group_current),
+ '#variable_name' => $name,
+ '#parents' => array('variables', $safename),
+ );
+ }
+ }
+ $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
+ return $form;
+}
+
+/**
+ * Select variables for realm.
+ */
+function variable_realm_select_variables_form_submit($form, &$form_state) {
+ // Get realm name and current list of variables.
+ $realm_name = $form_state['values']['realm_name'];
+ $controller = variable_realm_controller($realm_name);
+ $old_variables = $controller->getEnabledVariables();
+ // Get main variable names
+ $variables = $form_state['values']['variables'];
+ unset($variables['variables__active_tab']);
+ $variables = array_keys(array_filter($variables));
+ // Translate variable names
+ foreach ($variables as $index => $name) {
+ $variables[$index] = str_replace(array('<', '>'), array('[', ']'), $name);
+ }
+ // Hook for modules to alter this variable list.
+ drupal_alter('variable_realm_variable_list', $variables, $realm_name);
+ // And save the list to a variable.
+ $controller->setRealmVariable('list', $variables);
+ // Spawn multiple variables and translate into actual variables
+ $new_list = variable_children($variables);
+ // Delete variables from realm that are not in the new list.
+ $old_list = variable_children($old_variables);
+ foreach (array_diff($old_list, $new_list) as $name) {
+ $controller->deleteVariable($name);
+ drupal_set_message(t('Deleted existing values of %name from realm variables.', array('%name' => $name)));
+ }
+}
+
+/**
+ * Edit variables for realm.
+ */
+function variable_realm_edit_variables_form($form, &$form_state, $realm_name, $realm_key) {
+ $controller = variable_realm_controller($realm_name);
+ $form['realm_name'] = array('#type' => 'value', '#value' => $realm_name);
+ $form['realm_key'] = array('#type' => 'value', '#value' => $realm_key);
+ $options['realm'] = variable_realm($realm_name, $realm_key);
+ if ($variable_list = $controller->getEnabledVariables()) {
+ // Group variables by variable group for vertical tabls
+ $group_list = array();
+ foreach ($variable_list as $variable_name) {
+ $variable_info = variable_get_info($variable_name, $options);
+ $group = $variable_info['group'];
+ $group_list[$group][] = $variable_name;
+ }
+ $form['variables'] = array(
+ '#type' => 'vertical_tabs',
+ '#tree' => TRUE,
+ );
+ foreach ($group_list as $group => $group_variables) {
+ $group_info = variable_get_group($group);
+ $form['variables'][$group] = array(
+ '#type' => 'fieldset',
+ '#title' => $group_info['title'],
+ '#collapsible' => TRUE, '#collapsed' => TRUE,
+ );
+ // Set form parents for this variable / group.
+ $options['form parents'] = array('variables', $group);
+ $form['variables'][$group] += variable_edit_subform($group_variables, $options);
+ }
+ $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
+ }
+ else {
+ $form['message']['#markup'] = '<h3>' . t('No variables have been selected as %realm_name specific.', array('%realm_name' => $controller->getTitle())) . '</h3>';
+ }
+ if (!empty($realm_info['select path'])) {
+ $form['select']['#markup'] = t('To select variables to be configured, see <a href="!select-url">%realm_name variable settings</a>.', array(
+ '%realm_name' => $realm_info['title'],
+ '!select-url' => url($realm_info['select path'])
+ ));
+ }
+ return $form;
+}
+
+/**
+ * Edit variables for realm.
+ */
+function variable_realm_edit_variables_form_submit($form, &$form_state) {
+ $realm_name = $form_state['values']['realm_name'];
+ $realm_key = $form_state['values']['realm_key'];
+ foreach ($form_state['values']['variables'] as $group => $group_variables) {
+ if (is_array($group_variables)) {
+ foreach ($group_variables as $name => $value) {
+ $current = variable_realm_get($realm_name, $realm_key, $name);
+ if ($current !== $value) {
+ variable_realm_set($realm_name, $realm_key, $name, $value);
+ }
+ }
+ }
+ }
+ // Redirect later depending on query string parameters.
+ _variable_realm_form_submit_redirect($form, $form_state);
+}
+
+/**
+ * Key selector for realm forms.
+ */
+function variable_realm_form_key_selector($realm_name, $current_key) {
+ $element_name = VARIABLE_REALM_FORM_SWITCHER . $realm_name;
+ $query_name = 'variable_realm_' . $realm_name . '_key';
+ $controller = variable_realm_controller($realm_name);
+ $form[$element_name] = array(
+ '#type' => 'fieldset',
+ '#title' => t('There are %name variables in this form', array('%name' => $controller->getVariableName())),
+ '#weight' => -100,
+ '#description' => t('Check you are editing the variables for the right %realm value or select the desired %realm.', array('%realm' => $controller->getTitle())),
+ );
+ // Replace only this element on current query string, there may be others.
+ $current_query = $_GET;
+ unset($current_query['q']);
+ foreach ($controller->getAllKeys() as $realm_key => $key_name) {
+ $query[VARIABLE_REALM_QUERY_STRING . $realm_name] = $realm_key;
+ $link = l($key_name, $_GET['q'], array('query' => $query + $current_query));
+ $items[] = $current_key == $realm_key ? '<strong>' . $link . '</strong>' : $link;
+ }
+ $form[$element_name]['select_key'] = array(
+ '#type' => 'item',
+ '#markup' => implode(' | ', $items),
+ );
+ return $form;
+}
+
+/**
+ * Get current realm key from query string or from current realm value.
+ */
+function variable_realm_form_key_current($realm_name) {
+ $realm_controller = variable_realm_controller($realm_name);
+ if ($key = variable_realm_params($realm_name)) {
+ return $key;
+ }
+ elseif ($key = $realm_controller->getKey()) {
+ return $key;
+ }
+ elseif ($key = $realm_controller->getRequestKey()) {
+ return $key;
+ }
+ else {
+ return $realm_controller->getDefaultKey();
+ }
+}
+
+/**
+ * Alter settings form and return list of found variables.
+ */
+function _variable_realm_variable_settings_form_alter(&$form, $realm_name, $variables) {
+ $result = array();
+ foreach (element_children($form) as $field) {
+ if (count(element_children($form[$field])) && empty($form[$field]['#tree'])) {
+ // Rewrite fieldsets recursively.
+ $result += _variable_realm_variable_settings_form_alter($form[$field], $realm_name, $variables);
+ }
+ elseif (in_array($field, $variables)) {
+ if (isset($form[$field]['#variable_realm'])) {
+ // Oh-oh, variable already taken by another realm.
+ _variable_realm_variable_settings_form_conflict($field);
+ $form[$field]['#disabled'] = TRUE;
+ }
+ else {
+ // Mark variable as already taken by a realm
+ $form[$field]['#variable_realm'] = $realm_name;
+ }
+ _variable_realm_variable_settings_form_mark($realm_name, $form[$field]);
+ // Addd field => name to result
+ $result[$field] = !empty($form[$field]['#title']) ? $form[$field]['#title'] : $field;
+ }
+ }
+ return $result;
+}
+
+/**
+ * Mark variable as belonging to a realm.
+ */
+function _variable_realm_variable_settings_form_mark($realm_name, &$element) {
+ $realm_info = variable_realm_info($realm_name);
+ // Add form field class (i18n-variable) and description text.
+ if (!empty($realm_info['variable class'])) {
+ $element['#attributes']['class'][] = $realm_info['variable class'];
+ }
+ $element['#description'] = !empty($element['#description']) ? $element['#description'] : '';
+ $element['#description'] .= ' <strong>' . t('This is a @name variable.', array('@name' => $realm_info['variable name'])) . '</strong> ';
+}
+
+/**
+ * Warning about variable conflict.
+ */
+function _variable_realm_variable_settings_form_conflict($variable) {
+ static $warnings;
+ if (!isset($warnings[$variable])) {
+ $warnings[$variable] = TRUE;
+ drupal_set_message(t('There are conflicting realm variables in the form. The variable %name is enabled for more than one realm. Review your realm settings', array('%name' => variable_name($variable))), 'warning');
+ }
+}
+
+/**
+ * Save realm variables and remove them from form.
+ */
+function variable_realm_variable_settings_form_submit($form, &$form_state) {
+ $op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';
+ foreach ($form['#realm_keys'] as $realm_name => $realm_key) {
+ $realm_controller = variable_realm_controller($realm_name);
+ //$language = i18n_language($form_state['values']['i18n_variable_language']);
+ //unset($form_state['values']['i18n_variable_language']);
+ $variables = array_keys($form['#realm_variables'][$realm_name]);
+ foreach ($variables as $variable_name) {
+ if (isset($form_state['values'][$variable_name])) {
+ if ($op == t('Reset to defaults')) {
+ variable_realm_del($realm_name, $realm_key, $variable_name);
+ }
+ else {
+ $value = $form_state['values'][$variable_name];
+ if (is_array($value) && isset($form_state['values']['array_filter'])) {
+ $value = array_keys(array_filter($value));
+ }
+ variable_realm_set($realm_name, $realm_key, $variable_name, $value);
+ }
+ // If current is not default realm key, we don't set any global variable (without realm)
+ if ($realm_key != $realm_controller->getDefaultKey()) {
+ unset($form_state['values'][$variable_name]);
+ }
+ }
+ }
+ }
+ // Redirect later depending on query string parameters.
+ _variable_realm_form_submit_redirect($form, $form_state);
+ // The form will go now through system_settings_form_submit()
+}
+
+/**
+ * Process system_theme_settings form submissions.
+ *
+ * @see system_theme_settings_submit()
+ */
+function variable_realm_variable_theme_form_submit($form, &$form_state) {
+ // Regular theme submission without variable set.
+ $values = $form_state['values'];
+
+ // If the user uploaded a new logo or favicon, save it to a permanent location
+ // and use it in place of the default theme-provided file.
+ if ($file = $values['logo_upload']) {
+ unset($values['logo_upload']);
+ $filename = file_unmanaged_copy($file->uri);
+ $values['default_logo'] = 0;
+ $values['logo_path'] = $filename;
+ $values['toggle_logo'] = 1;
+ }
+ if ($file = $values['favicon_upload']) {
+ unset($values['favicon_upload']);
+ $filename = file_unmanaged_copy($file->uri);
+ $values['default_favicon'] = 0;
+ $values['favicon_path'] = $filename;
+ $values['toggle_favicon'] = 1;
+ }
+
+ // If the user entered a path relative to the system files directory for
+ // a logo or favicon, store a public:// URI so the theme system can handle it.
+ if (!empty($values['logo_path'])) {
+ $values['logo_path'] = _system_theme_settings_validate_path($values['logo_path']);
+ }
+ if (!empty($values['favicon_path'])) {
+ $values['favicon_path'] = _system_theme_settings_validate_path($values['favicon_path']);
+ }
+
+ if (empty($values['default_favicon']) && !empty($values['favicon_path'])) {
+ $values['favicon_mimetype'] = file_get_mimetype($values['favicon_path']);
+ }
+ $key = $values['var'];
+
+ // Exclude unnecessary elements before saving.
+ unset($values['var'], $values['submit'], $values['reset'], $values['form_id'], $values['op'], $values['form_build_id'], $values['form_token']);
+
+ // Set realm variable.
+ $variable_name = $key;
+ $realm_name = $form['#realm_theme'];
+ $realm_key = $form['#realm_keys'][$realm_name];
+ variable_realm_set($realm_name, $realm_key, $variable_name, $values);
+
+ // If current is default realm key, set global variable too.
+ $realm_controller = variable_realm_controller($realm_name);
+ if ($realm_key == $realm_controller->getDefaultKey()) {
+ variable_set($variable_name, $values);
+ }
+ // Confirmation, clear cache, taken from system_theme_settings_submit()
+ drupal_set_message(t('The configuration options have been saved.'));
+ cache_clear_all();
+ // Redirect later depending on query string parameters.
+ _variable_realm_form_submit_redirect($form, $form_state);
+}
+
+/**
+ * Get variable list for settings forms handling multiple realms.
+ *
+ * Variables available for more than one realm, will be kept only in the list
+ * for the realm with the higher weight.
+ */
+function _variable_realm_variable_settings_form_list() {
+ $list = array();
+ foreach (variable_realm_list_all() as $realm_name => $controller) {
+ if ($controller->getInfo('form settings') && ($realm_list = $controller->getEnabledVariables())) {
+ // Remove from previous realms with lower weight.
+ foreach ($list as $name => $variables) {
+ $list[$name] = array_diff($variables, $realm_list);
+ }
+ $list[$realm_name] = $realm_list;
+ }
+ }
+ return $list;
+}
+
+/**
+ * Redirect to current page after form submission, using query string parameters.
+ */
+function _variable_realm_form_submit_redirect($form, &$form_state) {
+ if ($query_params = variable_realm_params()) {
+ foreach ($query_params as $realm => $value) {
+ $query[VARIABLE_REALM_QUERY_STRING . $realm] = $value;
+ }
+ // Parameters to be passed to drupal_goto().
+ $form_state['redirect'] = array(current_path(), array('query' => $query));
+ }
+}
+
+/**
+ * Add realm switcher to the form.
+ */
+function _variable_realm_variable_settings_form_switcher(&$form) {
+ // Add switchers for current realms and current key.
+ // Add realm values and subform realm / key selector.
+ foreach (array_keys($form['#realm_variables']) as $realm_name) {
+ $current_key = variable_realm_form_key_current($realm_name);
+ $info = variable_realm_info($realm_name);
+ if (!empty($info['form switcher'])) {
+ $form += variable_realm_form_key_selector($realm_name, $current_key);
+ }
+ $form['#realm_keys'][$realm_name] = $current_key;
+ }
+ // Make sure realm switchers are added for all parent realms of current ones.
+ foreach (variable_realm_list_all() as $realm_name => $realm_controller) {
+ if (($parent_realms = $realm_controller->getParentRealms()) && !empty($form['#realm_variables'][$realm_name]) && empty($form[VARIABLE_REALM_FORM_SWITCHER . $realm_name])) {
+ // Check we have selectors for the other realms.
+ foreach ($parent_realms as $realm) {
+ $info = variable_realm_info($realm);
+ if (!empty($info['form switcher']) && empty($form[VARIABLE_REALM_FORM_SWITCHER . $realm])) {
+ $current_key = variable_realm_form_key_current($realm);
+ $form += variable_realm_form_key_selector($realm, $current_key);
+ }
+ }
+ }
+ }
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.info b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.info
new file mode 100644
index 0000000..e1f56c6
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.info
@@ -0,0 +1,16 @@
+name = Variable realm
+description = API to use variable realms from different modules
+dependencies[] = variable
+package = Variable
+core = 7.x
+version = 7.x-2.x
+
+files[] = variable_realm.class.inc
+files[] = variable_realm_union.class.inc
+
+; Information added by drupal.org packaging script on 2013-01-13
+version = "7.x-2.2"
+core = "7.x"
+project = "variable"
+datestamp = "1358075138"
+
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.install b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.install
new file mode 100644
index 0000000..2e9e6c6
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.install
@@ -0,0 +1,21 @@
+<?php
+/**
+ * @file
+ * Variable API module install file
+ */
+
+/**
+ * Implements hook_install()
+ */
+function variable_realm_install() {
+ // Set module weight for it to run before most modules and initialize variable realms
+ db_query("UPDATE {system} SET weight = -1000 WHERE name = 'variable_realm' AND type = 'module'");
+}
+
+/**
+ * Refresh cache so new classes are found.
+ */
+function variable_realm_update_7000() {
+ drupal_flush_all_caches();
+}
+
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.module b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.module
new file mode 100644
index 0000000..b980741
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.module
@@ -0,0 +1,635 @@
+<?php
+/**
+ * @file
+ * Variable API module - Realms
+ *
+ * Each variable realm can be in one of four states.
+ * - Undefined, The realm controller has not been created yet.
+ * - Defined, The realm controller has been created.
+ * - Enabled, A value has been set for the realm key, though it may be disabled (FALSE)
+ * - Active, The realm key has been set and is not FALSE.
+ */
+
+// Prefix for realm keys on query string.
+define('VARIABLE_REALM_QUERY_STRING', 'variable_realm_key_');
+// Prefix for realm switcher element in forms.
+define('VARIABLE_REALM_FORM_SWITCHER', 'variable_realm_selector_');
+
+/**
+ * Implements hook_boot()
+ *
+ * We set current variable realms as early as possible in the page request.
+ */
+function variable_realm_boot() {
+ variable_realm_status('global', 'default');
+ variable_realm_rebuild();
+}
+
+/**
+ * Implements hook_init()
+ *
+ * Let realms be overriden by query string parameters, but only for:
+ * - Admin paths (not variable admin pages)
+ */
+function variable_realm_init() {
+ if (arg(0) == 'admin' && arg(3) != 'variable' && ($params = variable_realm_params()) && user_access('administer site configuration')) {
+ foreach ($params as $realm_name => $realm_key) {
+ variable_realm_switch($realm_name, $realm_key, FALSE);
+ }
+ variable_realm_rebuild();
+ }
+}
+
+/**
+ * Initialize realm and set key depending on request.
+ *
+ * @param $realm_name
+ * Variable realm name.
+ * @param $realm_key
+ * Optional key to be set when we don't have other key.
+ */
+function variable_realm_initialize($realm_name, $realm_key = NULL) {
+ $realm_controller = variable_realm_controller($realm_name);
+ if ($realm_controller && !$realm_controller->isEnabled()) {
+ $new_key = $realm_controller->enable($realm_key);
+ _variable_realm_invoke_all('variable_realm_enable', $realm_name, $new_key);
+ _variable_realm_hook('variableRealmEnable', $realm_name, $new_key);
+ // If we have already built the configuration, rebuild it.
+ if ($new_key && drupal_static('variable_realm_rebuild')) {
+ variable_realm_rebuild();
+ }
+ }
+}
+
+/**
+ * Get list of all available realm names ordered by default weight.
+ */
+function variable_realm_list() {
+ return _variable_realm_invoke(variable_realm_list_all(), 'getTitle');
+}
+
+/**
+ * Get all available realm controllers ordered by default weight.
+ */
+function variable_realm_list_all() {
+ $list = array();
+ foreach (array_keys(variable_realm_info()) as $name) {
+ if ($controller = variable_realm_controller($name)) {
+ $list[$name] = $controller;
+ }
+ uasort($list, '_variable_realm_sort_default');
+ }
+ return $list;
+}
+
+/**
+ * Get realm parameters from query string.
+ */
+function variable_realm_params($realm_name = NULL) {
+ $realm_params = &drupal_static(__FUNCTION__);
+ if (!isset($realm_params)) {
+ $realm_params = array();
+ foreach (variable_realm_info() as $realm => $realm_info) {
+ if (!empty($realm_info['form switcher'])) {
+ $param = VARIABLE_REALM_QUERY_STRING . $realm;
+ if (!empty($_GET[$param]) && array_key_exists($_GET[$param], variable_realm_keys($realm))) {
+ $realm_params[$realm] = $_GET[$param];
+ }
+ }
+ }
+ }
+ if ($realm_name) {
+ return isset($realm_params[$realm_name]) ? $realm_params[$realm_name] : FALSE;
+ }
+ else {
+ return $realm_params;
+ }
+}
+
+
+/**
+ * Get information about variable realms.
+ */
+function variable_realm_info($realm_name = NULL) {
+ $realm_info_tmp = $realm_info = &drupal_static(__FUNCTION__);
+
+ if (!isset($realm_info_tmp)) {
+ $realm_info_tmp = _variable_realm_invoke_all('variable_realm_info');
+
+ // If first param is NULL, module_load_all() only returns a boolean
+ // indicating whether all modules have been loaded.
+ if (module_load_all(NULL)) {
+ // Due to the fact that variable_realm_info() gets called by some
+ // modules and the menu access callbacks early in the bootstrap,
+ // we could not cache the realm info for later calls until all
+ // modules have been loaded.
+ $realm_info = $realm_info_tmp;
+ }
+ }
+
+ if ($realm_name) {
+ return isset($realm_info_tmp[$realm_name]) ? $realm_info_tmp[$realm_name] : array();
+ }
+ else {
+ return $realm_info_tmp;
+ }
+}
+
+/**
+ * Implements hook_variable_realm_info().
+ */
+function variable_realm_variable_realm_info() {
+ $realm['global'] = array(
+ 'title' => t('Global'),
+ 'weight' => 0,
+ 'controller class' => 'VariableRealmDefaultController',
+ 'store class' => 'VariableRealmGlobalStore',
+ 'keys' => array(
+ 'default' => t('All variables')
+ ),
+ );
+ return $realm;
+}
+
+
+/**
+ * Get keys for realm.
+ */
+function variable_realm_keys($realm_name) {
+ if ($controller = variable_realm_controller($realm_name)) {
+ return $controller->getAllKeys();
+ }
+}
+
+/**
+ * Get variable realm store.
+ *
+ * The first time this function is invoked we initialize the realm system
+ * and store global variables in the global/default realm.
+ *
+ * @param $realm
+ * Name of the realm to get / create.
+ * @param $key
+ * Realm key to get / create
+ *
+ * @return VariableRealmControllerInterface
+ */
+function variable_realm($realm, $key) {
+ $controller = variable_realm_controller($realm);
+ return $controller ? $controller->getStore($key) : NULL;
+}
+
+/**
+ * Get variable realm controller or create it if not defined.
+ */
+function variable_realm_controller($realm_name = NULL) {
+ static $drupal_static_fast;
+ if (!isset($drupal_static_fast)) {
+ $drupal_static_fast['realm'] = &drupal_static(__FUNCTION__, array());
+ if ($global = _variable_realm_controller('global')) {
+ $global->addStore('default', $GLOBALS['conf']);
+ $drupal_static_fast['realm']['global'] = $global;
+ }
+ }
+ $variable_realm = &$drupal_static_fast['realm'];
+
+ if ($realm_name) {
+ if (!isset($variable_realm[$realm_name])) {
+ $variable_realm[$realm_name] = _variable_realm_controller($realm_name);
+ }
+ return $variable_realm[$realm_name];
+ }
+ else {
+ // Return only existing realms.
+ return array_filter($variable_realm);
+ }
+}
+
+/**
+ * Get value from realm
+ */
+function variable_realm_get($realm, $key, $name = NULL, $default = NULL) {
+ if ($store = variable_realm($realm, $key)) {
+ return $store->variable_get($name, $default);
+ }
+}
+
+/**
+ * Set values for variable realm
+ *
+ * @param $realm
+ * Realm name.
+ * @param $key
+ * Realm key.
+ * @param $values
+ * Array of runtime variable values to add to the realm.
+ * @param $weight
+ * Optional explicit weight for this realm.
+ * @param $rebuild
+ * Whether to rebuild domains immediately
+ */
+function variable_realm_add($realm, $key, $values = array(), $weight = NULL, $rebuild = TRUE) {
+ if ($variable_realm = variable_realm($realm, $key)) {
+ foreach ($values as $name => $value) {
+ $variable_realm->variable_add($name, $value);
+ }
+ if (isset($weight)) {
+ variable_realm_weight($realm, $weight);
+ }
+ // Rebuild only if this is the current realm
+ if ($rebuild && variable_realm_status($realm) === $key) {
+ variable_realm_rebuild();
+ }
+ }
+}
+
+/**
+ * Set value for realm variable.
+ */
+function variable_realm_set($realm, $key, $name, $value, $rebuild = TRUE) {
+ if ($store = variable_realm($realm, $key)) {
+ $old_value = variable_realm_get($realm, $key, $name);
+ $store->variable_set($name, $value);
+ if ($rebuild) {
+ variable_realm_refresh($realm, $key, $name);
+ }
+ $options = array(
+ 'realm' => $store->realm,
+ 'key' => $store->key,
+ );
+ module_invoke_all('variable_update', $name, $value, $old_value, $options);
+ }
+}
+
+/**
+ * Delete variable from realm
+ */
+function variable_realm_del($realm, $key, $name, $rebuild = TRUE) {
+ if ($store = variable_realm($realm, $key)) {
+ $store->variable_del($name);
+ if ($rebuild) {
+ variable_realm_refresh($realm, $key, $name);
+ }
+ }
+}
+
+
+/**
+ * Refresh variable value.
+ */
+function variable_realm_refresh($realm_name, $realm_key, $variable_name) {
+ $value = NULL;
+ // Only update value if this is the current realm.
+ if (variable_realm_status($realm_name) === $realm_key) {
+ foreach (variable_realm_current() as $realm_controller) {
+ $value = $realm_controller->getCurrentStore()->variable_get($variable_name, $value);
+ }
+ }
+ if (isset($value)) {
+ $GLOBALS['conf'][$variable_name] = $value;
+ }
+ else {
+ unset($GLOBALS['conf'][$variable_name]);
+ }
+}
+
+
+/**
+ * Get active realm controllers ordered by weight.
+ */
+function variable_realm_current() {
+ $active = array_filter(variable_realm_controller(), '_variable_realm_active');
+ uasort($active, '_variable_realm_sort_current');
+ return $active;
+}
+
+/**
+ * Check whether a realm is defined.
+ */
+function variable_realm_defined($realm_name) {
+ $controllers = variable_realm_controller();
+ return !empty($controllers[$realm_name]);
+}
+
+/**
+ * Get current realm values ordered by weights, only realms that are set.
+ *
+ * @return array
+ * Ordered array of name => key pairs.
+ */
+function variable_realm_current_keys() {
+ return array_map('_variable_realm_status', variable_realm_current());
+}
+
+/**
+ * Get current realm values ordered by weights.
+ *
+ * @return array
+ * Ordered array of name => value pairs, only realms that are set.
+ */
+
+/**
+ * Get original global variable
+ */
+function variable_realm_global_get($name, $default = NULL) {
+ return variable_realm_get('global', 'default', $name, $default);
+}
+
+/**
+ * Switch global variable
+ *
+ * @param $name
+ * Optional global variable name. If not set, it will reset all global variables to its original value.
+ * @param $value
+ * Optional new value for global variable. If not set, it will reset the variable to its original value.
+ * @param $rebuild
+ * Whether to rebuild the current global $conf
+ */
+function variable_realm_global_set($name, $value = NULL, $rebuild = TRUE) {
+ variable_realm_set('global', 'default', $name, $value, $rebuild);
+}
+
+/**
+ * Set / get current realm values.
+ *
+ * @param $realm
+ * Optional realm name
+ * @param $key
+ * Optional realm value to set a status for this realm.
+ * FALSE to disable this realm.
+ */
+function variable_realm_status($realm, $key = NULL) {
+ if ($realm_controller = variable_realm_controller($realm)) {
+ if (isset($key)) {
+ $realm_controller->setKey($key);
+ }
+ return $realm_controller->getKey();
+ }
+}
+
+/**
+ * Switch current variable realms.
+ *
+ * @see variable_realm_weight()
+ *
+ * @param $realm
+ * Realm name. Example 'language'.
+ * @param $key
+ * Realm key. Example, for language will be a language code, 'en
+ * FALSE to unset the realm.
+ * @param $rebuild
+ * Whether we need to rebuild the configuration.
+ */
+function variable_realm_switch($realm, $key, $rebuild = TRUE) {
+ // Check previous status, if not changed no need to rebuild.
+ $current = variable_realm_status($realm);
+ if (!isset($current) || $current !== $key) {
+ variable_realm_status($realm, $key);
+ _variable_realm_invoke_all('variable_realm_switch', $realm, $key);
+ _variable_realm_hook('variableRealmSwitch', $realm, $key);
+ if ($rebuild) {
+ variable_realm_rebuild();
+ }
+ }
+}
+
+/**
+ * Get / set realm weights.
+ *
+ * The default realm will have a weight of 0. Realms with higher weights will override
+ * global variables.
+ *
+ * @param $realm
+ * Realm name
+ * @param $weight
+ * Optional numeric value for realm weight.
+ * @return integer
+ * Current realm weight
+ */
+function variable_realm_weight($realm, $weight = NULL) {
+ if ($realm_controller = variable_realm_controller($realm)) {
+ if (isset($weight)) {
+ $realm_controller->setWeight($weight);
+ }
+ return $realm_controller->getWeight();
+ }
+}
+
+
+/**
+ * Rebuild current variable realm.
+ */
+function variable_realm_rebuild() {
+ $rebuild_keys = &drupal_static(__FUNCTION__);
+ _variable_realm_invoke_all('variable_realm_rebuild');
+ $rebuild_keys = variable_realm_current_keys();
+ $GLOBALS['conf'] = _variable_realm_build();
+}
+
+
+/**
+ * Reset realms, deleting currently set ones
+ *
+ * If no parameters passed, it will reset global variables to original values.
+ *
+ * @param $realm_keys
+ * Array of realm name => realm key to be set.
+ */
+function variable_realm_reset($realm_keys = array()) {
+ // We need at least some value for the global realm
+ $status = $realm_keys + array('global', 'default');
+ // Disable current active realms not in the list
+ foreach (variable_realm_current() as $realm_name => $realm_controller) {
+ if (!isset($status[$realm_name])) {
+ variable_realm_switch($realm_name, FALSE, FALSE);
+ }
+ }
+ foreach ($status as $realm_name => $realm_key) {
+ variable_realm_switch($realm_name, $realm_key, FALSE);
+ }
+ variable_realm_rebuild();
+}
+
+
+/**
+ * Implements hook_variable_delete().
+ */
+function variable_realm_variable_delete($variable, $options) {
+ // If there's a realm option, we are already deleting variable for a realm only.
+ if (empty($options['realm'])) {
+ // Delete each variable for each current and existing realm/key
+ foreach (variable_children($variable['name']) as $variable_name) {
+ foreach (variable_realm_list_all() as $realm_controller) {
+ $realm_controller->deleteVariable($variable_name);
+ }
+ }
+ variable_realm_rebuild();
+ }
+}
+
+/**
+ * Implements hook_features_api().
+ */
+function variable_realm_features_api() {
+ $components = array(
+ 'variable_realm' => array(
+ 'name' => t('Realm variables'),
+ 'default_hook' => 'variable_realm_default_variables',
+ 'default_file' => FEATURES_DEFAULTS_CUSTOM,
+ 'default_filename' => 'variable',
+ 'features_source' => TRUE,
+ 'file' => drupal_get_path('module', 'variable_realm') .'/variable_realm.features.inc',
+ ),
+ );
+ return $components;
+}
+
+/**
+ * Check whether realm is active.
+ */
+function _variable_realm_active($realm_controller) {
+ return $realm_controller && $realm_controller->isActive();
+}
+
+/**
+ * Build current realm.
+ *
+ * Buids an array of variables for the current realm with higher weights overriding
+ * lower weights.
+ */
+function _variable_realm_build() {
+ $variables = array();
+ foreach (variable_realm_current() as $realm_controller) {
+ if ($values = $realm_controller->getCurrentVariables()) {
+ $variables = array_merge($variables, $values);
+ }
+ }
+ return $variables;
+}
+
+/**
+ * Invoke method on a list of objects.
+ */
+function _variable_realm_invoke($list, $method) {
+ $result = array();
+ foreach ($list as $index => $object) {
+ $result[$index] = $object->$method();
+ }
+ return $result;
+}
+
+/**
+ * Invokes all realm controllers that implement a method.
+ *
+ * @param $method
+ * Method name
+ * @param $arg1, $arg2...
+ * Variable number of arguments to pass to the method.
+ */
+function _variable_realm_hook() {
+ $args = func_get_args();
+ $method = array_shift($args);
+ $result = array();
+ foreach (variable_realm_controller() as $realm_name => $realm_controller) {
+ if (method_exists($realm_controller, $method)) {
+ $result[$realm_name] = call_user_func_array(array($realm_controller, $method), $args);
+ }
+ }
+ return $result;
+}
+
+/**
+ * Create realm controller object.
+ *
+ * This may be invoked really early in the bootstrap so it needs to be safe enough
+ * for module updates and check whether the class really exists. It returns FALSE if not.
+ */
+function _variable_realm_controller($realm_name) {
+ $info = variable_realm_info($realm_name);
+ $class = !empty($info['controller class']) ? $info['controller class'] : 'VariableRealmDefaultController';
+ return class_exists($class) ? new $class($realm_name) : FALSE;
+}
+
+/**
+ * Get current weight for realm controller.
+ */
+function _variable_realm_weight($realm_controller) {
+ return $realm_controller->getWeight();
+}
+
+/**
+ * Order realms by default weight.
+ */
+function _variable_realm_sort_default($a, $b) {
+ return $a->getDefaultWeight() - $b->getDefaultWeight();
+}
+
+/**
+ * Order realms by current weight.
+ */
+function _variable_realm_sort_current($a, $b) {
+ return $a->getWeight() - $b->getWeight();
+}
+
+/**
+ * Get status (current key) for realm controller.
+ */
+function _variable_realm_status($realm_controller) {
+ return $realm_controller->getKey();
+}
+
+/**
+ * Invoke variable realm hook on all currently loaded modules.
+ *
+ * Variable realm usually starts from bootstrap, on hook_boot() and from here it is not
+ * safe to user regular hook invokation so we use our own function, similar to
+ * bootstrap_invoke_all() but returning the values (with deep merge).
+ *
+ * @see boostrap_invoke_all()
+ * @see module_invoke()
+ *
+ * @pram $hook
+ * Hook to invoke in all loaded modules
+ * @param $arg1, $arg2...
+ * A variable number of arguments.
+ */
+function _variable_realm_invoke_all() {
+ $args = func_get_args();
+ $hook = array_shift($args);
+ $result = array();
+ foreach (module_list() as $module) {
+ if (module_hook($module, $hook) && $merge = call_user_func_array($module . '_' . $hook, $args)) {
+ $result = drupal_array_merge_deep($result, $merge);
+ unset($merge);
+ }
+ }
+ return $result;
+}
+
+/**
+ * Implements hook_form_FORM_ID_alter()
+ */
+function variable_realm_form_system_theme_settings_alter(&$form, &$form_state, $form_id) {
+ module_load_include('form.inc', 'variable_realm');
+ $theme_variable = $form['var']['#value'];
+ foreach (_variable_realm_variable_settings_form_list() as $realm_name => $variables) {
+ if (in_array($theme_variable, variable_children($variables))) {
+ // Mark theme settings and include other variables in the form.
+ _variable_realm_variable_settings_form_mark($realm_name, $form['theme_settings']);
+ $realm_variables = element_children($form);
+ $realm_variables = array_merge($realm_variables, array('default_logo', 'logo_path', 'default_favicon', 'favicon_path'));
+ _variable_realm_variable_settings_form_alter($form, $realm_name, $realm_variables);
+ // Replace variable (theme) name so we use a temporary storage variable
+ $form['#realm_variables'][$realm_name] = $realm_variables;
+ // This is a single variable so there can be one realm only.
+ $form['#realm_theme'] = $realm_name;
+ break;
+ }
+ }
+ if (!empty($form['#realm_theme'])) {
+ // Replace callback and user our own realm function.
+ $form['#submit'] = str_replace('system_theme_settings_submit', 'variable_realm_variable_theme_form_submit', $form['#submit']);
+ // Add realm switcher/s.
+ _variable_realm_variable_settings_form_switcher($form);
+ }
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.variable.inc b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.variable.inc
new file mode 100644
index 0000000..5d6897b
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm.variable.inc
@@ -0,0 +1,61 @@
+<?php
+/**
+ * @file
+ * Variable hooks.
+ */
+
+/**
+ * Implements hook_variable_info().
+ */
+function variable_realm_variable_info($options) {
+ $variables['variable_realm_list_[variable_realm]'] = array(
+ 'type' => 'multiple',
+ 'group' => 'variable',
+ 'multiple' => 'variable_realm',
+ 'title' => t('Realm list', array(), $options),
+ 'description' => t('List of variables that can be set for a realm.', array(), $options),
+ 'repeat' => array(
+ 'type' => 'array',
+ ),
+ );
+ $variables['variable_realm_weight_[variable_realm]'] = array(
+ 'type' => 'multiple',
+ 'group' => 'variable',
+ 'multiple' => 'variable_realm',
+ 'title' => t('Realm weight', array(), $options),
+ 'description' => t('Override default weight for realm variables.', array(), $options),
+ 'repeat' => array(
+ 'type' => 'number',
+ ),
+ );
+ return $variables;
+}
+
+/**
+ * Implements hook_variable_type_info().
+ */
+function variable_realm_variable_type_info() {
+ $type['variable_realm'] = array(
+ 'title' => t('Variable realm'),
+ 'type' => 'select',
+ 'options callback' => 'variable_realm_list',
+ );
+ return $type;
+}
+
+/**
+ * Implements hook_variable_settings_form_alter().
+ */
+function variable_realm_variable_settings_form_alter(&$form, &$form_state, $form_id) {
+ module_load_include('form.inc', 'variable_realm');
+ foreach (_variable_realm_variable_settings_form_list() as $realm_name => $variables) {
+ if ($realm_variables = _variable_realm_variable_settings_form_alter($form, $realm_name, variable_children($variables))) {
+ $form['#realm_variables'][$realm_name] = $realm_variables;
+ }
+ }
+ if (!empty($form['#realm_variables'])) {
+ array_unshift($form['#submit'], 'variable_realm_variable_settings_form_submit');
+ // Add form switcher and current key for each realm.
+ _variable_realm_variable_settings_form_switcher($form);
+ }
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm_union.class.inc b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm_union.class.inc
new file mode 100644
index 0000000..d83dcbf
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_realm/variable_realm_union.class.inc
@@ -0,0 +1,155 @@
+<?php
+/**
+ * @file
+ * Classes for Realm Union.
+ */
+
+/**
+ * Default Realm Union class
+ */
+class VariableRealmUnionController extends VariableRealmDefaultController implements VariableRealmHooks {
+ protected $union_realms;
+ /**
+ * Implementation of VariableRealmControllerInterface::__construct().
+ */
+ public function __construct($realm_name) {
+ parent::__construct($realm_name);
+ // Get / create realm controllers for each of the union realms.
+ foreach ($this->getParentRealms() as $realm_name) {
+ $this->union_realms[$realm_name] = variable_realm_controller($realm_name);
+ }
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::start().
+ */
+ public function start($realm_key = NULL) {
+ if (!isset($this->current_key)) {
+ if (isset($realm_key)) {
+ return $this->current_key = $realm_key;
+ }
+ elseif ($request_key = $this->getRequestKey()) {
+ return $this->current_key = $request_key;
+ }
+ }
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::getAllKeys().
+ */
+ public function getAllKeys() {
+ $all_realm_keys = $this->invokeUnionRealms('getAllKeys');
+ // First build all combinations of realm keys.
+ $combine = array(array('keys' => array(), 'names' => array()));
+ foreach ($all_realm_keys as $realm => $realm_keys) {
+ $new_combine = array();
+ foreach ($combine as $index => $data) {
+ foreach ($realm_keys as $new_key => $new_name) {
+ $keys = $data['keys'];
+ $names = $data['names'];
+ $keys[$realm] = $new_key;
+ $names[$realm] = $new_name;
+ $new_combine[] = array('keys' => $keys, 'names' => $names);
+ }
+ }
+ $combine = $new_combine;
+ }
+ // Now build all realm keys for the combinations.
+ $keys = array();
+ foreach ($combine as $data) {
+ $key = $this->buildUnionKey($data['keys']);
+ $name = $this->buildUnionName($data['names']);
+ $keys[$key] = $name;
+ }
+ return $keys;
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::getDefaultKey().
+ */
+ public function getDefaultKey() {
+ $keys = $this->invokeUnionRealms('getDefaultKey');
+ return $this->buildUnionKey($keys);
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::getRequestKey().
+ */
+ public function getRequestKey() {
+ // We'll have a request key if union realms have a current key.
+ $keys = $this->invokeUnionRealms('getKey');
+ return $this->buildUnionKey($keys);
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::getAvailableVariables().
+ */
+ public function getAvailableVariables() {
+ $variables = $this->invokeUnionRealms('getAvailableVariables');
+ return call_user_func_array('array_intersect', $variables);
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::getEnabledVariables().
+ */
+ public function getEnabledVariables() {
+ $variables = $this->invokeUnionRealms('getEnabledVariables');
+ return call_user_func_array('array_intersect', $variables);
+ }
+ /**
+ * Implementation of VariableRealmControllerInterface::getParentRealms().
+ */
+ public function getParentRealms() {
+ return $this->getInfo('union', array());
+ }
+ /**
+ * Get union realms controllers.
+ */
+ protected function getUnionRealms() {
+ return $this->union_realms;
+ }
+ /**
+ * Implementation of VariableRealmHooks::variableRealmEnable()
+ */
+ public function variableRealmEnable($realm_name, $realm_key) {
+ // If this realm is enabled but not active, try to find a key.
+ if ($this->isEnabled() && !$this->isActive() && $this->isUnionRealm($realm_name) && $union_key = $this->getRequestKey()) {
+ $this->setKey($union_key);
+ }
+ }
+ /**
+ * Implementation of VariableRealmHooks::variableRealmSwitch()
+ */
+ public function variableRealmSwitch($realm_name, $realm_key) {
+ // If the this realm is active, try to find new key.
+ if ($this->isActive() && $this->isUnionRealm($realm_name) && ($union_key = $this->getRequestKey())) {
+ $this->setKey($union_key);
+ }
+ }
+ /**
+ * Check whether a realm belongs to the union realms.
+ */
+ protected function isUnionRealm($realm_name) {
+ return isset($this->union_realms[$realm_name]);
+ }
+ /**
+ * Invoke function on all realms.
+ */
+ protected function invokeUnionRealms($method) {
+ return _variable_realm_invoke($this->getUnionRealms(), $method);
+ }
+ /**
+ * Build key from union realm keys.
+ */
+ protected static function buildUnionKey($keys) {
+ if (in_array(FALSE, $keys, TRUE)) {
+ return FALSE;
+ }
+ else {
+ // Make sure values are in correct order
+ ksort($keys);
+ // implode values
+ return implode(':', $keys);
+ }
+ }
+ /**
+ * Build key name from union realm key names.
+ */
+ protected static function buildUnionName($names) {
+ return implode(', ', $names);
+ }
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_store/README.txt b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_store/README.txt
new file mode 100644
index 0000000..0595d1a
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_store/README.txt
@@ -0,0 +1,9 @@
+
+Drupal module: Variable API Database storage
+============================================
+Provides database storage for realm variables.
+
+This module provides some CRUD API to store and read your custom variables
+and some _set() and _get() methods that are tightly integrated with Variable Realms
+
+An example of a module using this API is Internationalization's i18n_variable module. \ No newline at end of file
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_store/variable_store.class.inc b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_store/variable_store.class.inc
new file mode 100644
index 0000000..b6ae463
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_store/variable_store.class.inc
@@ -0,0 +1,46 @@
+<?php
+/**
+ * @file
+ * Variable realm controller
+ */
+
+class VariableStoreRealmStore extends VariableRealmDefaultStore {
+ /**
+ * Initialize realm.
+ */
+ public function variable_init() {
+ if (!isset($this->variables)) {
+ $this->variables = &variable_store($this->realm, $this->key);
+ }
+ }
+ /**
+ * Set single variable.
+ *
+ * @param $name
+ * Variable name
+ * @param $value
+ * Variable value
+ */
+ public function variable_set($name, $value) {
+ // Since $variables is a reference we just need to set the store value.
+ variable_store_set($this->realm, $this->key, $name, $value);
+ }
+ /**
+ * Delete single variable.
+ *
+ * @param $name
+ * Variable name
+ */
+ public function variable_del($name) {
+ // Since $variables is a reference we just need to delete the store value.
+ variable_store_del($this->realm, $this->key, $name);
+ }
+ /**
+ * Implements 'magic' _sleep method.
+ *
+ * If serialized, variables should not be saved, but rebuilt from store on wake up.
+ */
+ public function __sleep(){
+ return array('realm', 'key');
+ }
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_store/variable_store.info b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_store/variable_store.info
new file mode 100644
index 0000000..1da3f39
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_store/variable_store.info
@@ -0,0 +1,16 @@
+name = Variable store
+description = Database storage for variable realms. This is an API module.
+dependencies[] = variable
+package = Variable
+core = 7.x
+version = 7.x-2.x
+
+files[] = variable_store.class.inc
+files[] = variable_store.test
+
+; Information added by drupal.org packaging script on 2013-01-13
+version = "7.x-2.2"
+core = "7.x"
+project = "variable"
+datestamp = "1358075138"
+
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_store/variable_store.install b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_store/variable_store.install
new file mode 100644
index 0000000..5dbe481
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_store/variable_store.install
@@ -0,0 +1,64 @@
+<?php
+/**
+ * @file
+ * Variable API module install file
+ */
+
+/**
+ * Implements hook_install()
+ */
+function variable_store_install() {
+ // Set module weight for it to run before most modules and initialize variable realms
+ db_query("UPDATE {system} SET weight = -1000 WHERE name = 'variable_store' AND type = 'module'");
+}
+
+/**
+ * Implementation of hook_schema().
+ */
+function variable_store_schema() {
+ $schema['variable_store'] = array(
+ 'description' => 'Named variable/value pairs created by modules using Variable API database storage. All variables are cached in memory at the start of every Drupal request so developers should not be careless about what is stored here.',
+ 'fields' => array(
+ 'realm' => array(
+ 'description' => 'The realm domain of this variable.',
+ 'type' => 'varchar',
+ 'length' => 50,
+ 'not null' => TRUE,
+ 'default' => ''),
+ 'realm_key' => array(
+ 'description' => 'The realm key of this variable.',
+ 'type' => 'varchar',
+ 'length' => 50,
+ 'not null' => TRUE,
+ 'default' => ''),
+ 'name' => array(
+ 'description' => 'The name of the variable.',
+ 'type' => 'varchar',
+ 'length' => 128,
+ 'not null' => TRUE,
+ 'default' => ''),
+ 'value' => array(
+ 'description' => 'The value of the variable.',
+ 'type' => 'text',
+ 'not null' => TRUE,
+ 'size' => 'big'),
+ 'serialized' => array(
+ 'description' => 'A flag to indicate whether content is serialized (1) or not (0).',
+ 'type' => 'int',
+ 'size' => 'small',
+ 'not null' => TRUE,
+ 'default' => 1),
+ ),
+ 'primary key' => array('realm', 'realm_key', 'name'),
+ 'indexes' => array('realm_value' => array('realm', 'realm_key')),
+ );
+ return $schema;
+}
+
+/**
+ * Reduce realm key field length so it can be used on the primary key
+ */
+function variable_store_update_7000() {
+ $schema = variable_store_schema();
+ db_change_field('variable_store', 'realm_key', 'realm_key', $schema['variable_store']['fields']['realm_key']);
+} \ No newline at end of file
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_store/variable_store.module b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_store/variable_store.module
new file mode 100644
index 0000000..6e439a7
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_store/variable_store.module
@@ -0,0 +1,148 @@
+<?php
+/**
+ * @file
+ * Variable API module - Database storage
+ *
+ * This module provides database storage for variable realms
+ */
+
+/**
+ * Get variable store
+ */
+function &variable_store($realm, $key) {
+ $variable_store = &drupal_static('variable_store');
+
+ if (!isset($variable_store[$realm][$key])) {
+ $variable_store[$realm][$key] = _variable_store_load($realm, $key);
+ }
+ return $variable_store[$realm][$key];
+}
+
+/**
+ * Implementation of hook_boot()
+ */
+function variable_store_boot() {
+ // Do nothing, we just want this module to be available for boot.
+}
+
+/**
+ * Delete variable from db
+ */
+function variable_store_del($realm, $key, $name) {
+ $store = &variable_store($realm, $key);
+ db_delete('variable_store')
+ ->condition('realm', $realm)
+ ->condition('realm_key', $key)
+ ->condition('name', $name)
+ ->execute();
+ unset($store[$name]);
+ cache_clear_all('variable:' . $realm . ':' . $key, 'cache_bootstrap');
+}
+
+/**
+ * Get single variable from store
+ */
+function variable_store_get($realm, $key, $name, $default = NULL) {
+ $variables = variable_store($realm, $key);
+ return $variables && isset($variables[$name]) ? $variables[$name] : $default;
+}
+
+/**
+ * Delete realm variable or full realm from store.
+ *
+ * @param $realm
+ * Realm name to delete. NULL to delete all realms.
+ * @param $key
+ * Realm key to delete. NULL to delete all realm keys.
+ * @param $name
+ * Variable name to delete. NULL to delete all variables for that realm, key
+ */
+function variable_store_delete_all($realm, $key, $name = NULL) {
+ _variable_store_reset();
+ $query = db_delete('variable_store');
+ if (isset($realm)) {
+ $query->condition('realm', $realm);
+ }
+ if (isset($key)) {
+ $query->condition('realm_key', $key);
+ }
+ if (isset($name)) {
+ $query->condition('name', $name);
+ }
+ return $query->execute();
+}
+
+/**
+ * List all variable names from a realm.
+ *
+ * @param $realm
+ * Realm name to list. NULL to list all realms.
+ * @param $key
+ * Realm key to list. NULL to list all realm keys.
+ *
+ * @return array
+ * List of variable names.
+ */
+function variable_store_list_all($realm, $key = NULL) {
+ $query = db_select('variable_store', 'vs')
+ ->fields('vs', array('name'))
+ ->distinct();
+ if ($realm) {
+ $query->condition('realm', $realm);
+ }
+ if ($key) {
+ $query->condition('realm_key', $key);
+ }
+ return $query->execute()->fetchCol();
+}
+
+/**
+ * Load realm from db store
+ */
+function _variable_store_load($realm, $key) {
+ $cacheid = 'variable:' . $realm . ':' . $key;
+ if ($cached = cache_get($cacheid, 'cache_bootstrap')) {
+ $variables = $cached->data;
+ }
+ else {
+ $result = db_select('variable_store', 's')
+ ->fields('s', array('name', 'value', 'serialized'))
+ ->condition('realm', $realm)
+ ->condition('realm_key', $key)
+ ->execute();
+ $variables = array();
+ foreach ($result as $variable) {
+ $variables[$variable->name] = $variable->serialized ? unserialize($variable->value) : $variable->value;
+ }
+ cache_set($cacheid, $variables, 'cache_bootstrap');
+ }
+ return $variables;
+}
+
+/**
+ * Reset caches and static variables.
+ */
+function _variable_store_reset() {
+ $store = &drupal_static('variable_store', array());
+ foreach ($store as $realm => &$realm_store) {
+ foreach (array_keys($realm_store) as $key) {
+ $realm_store[$key] = NULL;
+ }
+ }
+ cache_clear_all('variable:', 'cache_bootstrap', TRUE);
+}
+
+/**
+ * Set variable value
+ */
+function variable_store_set($realm, $key, $name, $value, $rebuild = TRUE) {
+ $store = &variable_store($realm, $key);
+ $serialize = !is_int($value) && !is_string($value);
+ db_merge('variable_store')
+ ->key(array('realm' => $realm, 'realm_key' => $key, 'name' => $name))
+ ->fields(array('value' => $serialize ? serialize($value) : $value, 'serialized' => $serialize ? 1 : 0))
+ ->execute();
+ cache_clear_all('variable:' . $realm . ':' . $key, 'cache_bootstrap');
+ $store[$name] = $value;
+}
+
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_store/variable_store.test b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_store/variable_store.test
new file mode 100644
index 0000000..6fe575a
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_store/variable_store.test
@@ -0,0 +1,78 @@
+<?php
+
+/**
+ * @file
+ * Tests for variable.module.
+ */
+
+/**
+ * Helper class for module test cases.
+ */
+class VariableStoreTestCase extends DrupalWebTestCase {
+ protected $admin_user;
+
+ public static function getInfo() {
+ return array(
+ 'name' => 'Test Variable store and realms',
+ 'description' => 'Exercise the Variable API, default values, save and delete variables, etc.',
+ 'group' => 'Variable',
+ );
+ }
+
+ function setUp() {
+ parent::setUp('variable', 'variable_realm', 'variable_store', 'variable_example');
+
+ $this->admin_user = $this->drupalCreateUser(array('access administration pages', 'administer site configuration'));
+ $this->drupalLogin($this->admin_user);
+ }
+
+ /**
+ * Test that all core modules can be enabled, disabled and uninstalled.
+ */
+ function testVariableStoreAPI() {
+ // Store two values for the 'example' realm.
+ $realm = 'example';
+ $store = array(
+ 'first' => 'My first test site',
+ 'second' => 'My second test site',
+ );
+ $values = array(
+ 'default' => 'Drupal',
+ ) + $store;
+ foreach ($store as $key => $value) {
+ variable_store_set($realm, $key, 'site_name', $value);
+ }
+ // Check we've got stored the right value for each realm.
+ foreach ($store as $key => $value) {
+ $this->assertEqual(variable_store_get($realm, $key, 'site_name'), $value, 'Variable has been saved to the store.');
+ // Check the value is displayed with example page.
+ $this->drupalGet('variable/realm/' . $realm . '/' . $key);
+ $this->assertText($value, "The right site name is displayed for realm $realm:$key");
+ }
+ // Load realms from store and set them as different realm.
+ foreach ($store as $key => $value) {
+ $variables = variable_store($realm, $key);
+ variable_realm_add($realm, $key, $variables);
+ }
+ // Switch realms and get the right values.
+ foreach ($values as $key => $value) {
+ // Check value before setting realm
+ $this->assertEqual(variable_realm_get($realm, $key, 'site_name', 'Drupal'), $value, "We get the right value for realm $realm:$key");
+ variable_realm_switch($realm, $key);
+ $this->assertEqual(variable_get_value('site_name'), $value, "We get the right value with Variable API after switching to realm $realm:$key");
+ $this->assertEqual(variable_get('site_name', 'Drupal'), $value, "We get the right value with Drupal API after switching to realm $realm:$key");
+ }
+ // Delete variable and check it has been deleted, first from realms and then from store.
+ variable_delete('site_name');
+ // Check we've got stored the right value for each realm.
+ foreach ($store as $key => $value) {
+ $this->assertFalse(variable_store_get($realm, $key, 'site_name'), "Variable has been deleted from the realm for $realm:$key.");
+ $this->assertFalse(variable_store_get($realm, $key, 'site_name'), "Variable has been deleted from the store for $realm:$key.");
+ }
+ // Finally check variable has returned to default value. Use any of the realms.
+ variable_realm_switch($realm, 'first');
+ $this->assertEqual($value = variable_get_value('site_name'), 'Drupal', "We get the right value with Variable API after deleting the variable: $value");
+ $this->assertFalse($value = variable_get('site_name'), "We get the right value with Drupal API after deleting the variable: $value");
+
+ }
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_views/includes/views_handler_field_variable_title.inc b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_views/includes/views_handler_field_variable_title.inc
new file mode 100644
index 0000000..3cc6f32
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_views/includes/views_handler_field_variable_title.inc
@@ -0,0 +1,12 @@
+<?php
+
+/**
+ * Field handler to translate a variable name into its readable form.
+ */
+class views_handler_field_variable_title extends views_handler_field {
+ function render($values) {
+ $name = $this->get_value($values);
+ $variable = variable_build($name);
+ return $variable['title'];
+ }
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_views/includes/views_handler_field_variable_value.inc b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_views/includes/views_handler_field_variable_value.inc
new file mode 100644
index 0000000..db03957
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_views/includes/views_handler_field_variable_value.inc
@@ -0,0 +1,23 @@
+<?php
+/**
+ * A handler to display data from variable_values
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_variable_value extends views_handler_field {
+ function construct() {
+ parent::construct();
+ // Be explicit about the table we are using.
+ $this->additional_fields['name'] = array('table' => 'variable', 'field' => 'name');
+ }
+
+ /**
+ * Render value using variable name for formatting.
+ */
+ function render($values) {
+ $name = $this->get_value($values, 'name');
+ $variable = variable_build($name);
+ $variable['value'] = unserialize($this->get_value($values));
+ return variable_format_value($variable);
+ }
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_views/includes/views_plugin_argument_default_variable.inc b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_views/includes/views_plugin_argument_default_variable.inc
new file mode 100644
index 0000000..32d89d1
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_views/includes/views_plugin_argument_default_variable.inc
@@ -0,0 +1,45 @@
+<?php
+/**
+ * @file
+ * Contains the php code argument default plugin.
+ */
+
+/**
+ * Default argument plugin to provide a variable value.
+ */
+class views_plugin_argument_default_variable extends views_plugin_argument_default {
+ function option_definition() {
+ $options = parent::option_definition();
+ $options['variable'] = array('default' => '');
+ return $options;
+ }
+
+ function options_form(&$form, &$form_state) {
+ parent::options_form($form, $form_state);
+ $form['variable'] = array(
+ '#type' => 'select',
+ '#title' => t('Variable value'),
+ '#options' => _variable_views_variable_list(),
+ '#default_value' => $this->options['variable'],
+ '#description' => t('Select a variable whose value will be retrieved at run time.'),
+ );
+ }
+
+ function convert_options(&$options) {
+ if (!isset($options['variable']) && isset($this->argument->options['default_argument_variable'])) {
+ $options['variable'] = $this->argument->options['default_argument_variable'];
+ }
+ }
+
+ /**
+ * Only let users with PHP block visibility permissions set/modify this
+ * default plugin.
+ */
+ function access() {
+ return user_access('administer site configuration');
+ }
+
+ function get_argument() {
+ return variable_get_value($this->options['variable']);
+ }
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_views/variable_views.info b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_views/variable_views.info
new file mode 100644
index 0000000..0098950
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_views/variable_views.info
@@ -0,0 +1,17 @@
+name = Variable views
+description = Provides views integration for variable, included a default variable argument.
+dependencies[] = variable
+dependencies[] = views
+package = Variable
+core = 7.x
+
+files[] = includes/views_plugin_argument_default_variable.inc
+files[] = includes/views_handler_field_variable_title.inc
+files[] = includes/views_handler_field_variable_value.inc
+
+; Information added by drupal.org packaging script on 2013-01-13
+version = "7.x-2.2"
+core = "7.x"
+project = "variable"
+datestamp = "1358075138"
+
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_views/variable_views.module b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_views/variable_views.module
new file mode 100644
index 0000000..e53ab00
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_views/variable_views.module
@@ -0,0 +1,41 @@
+<?php
+/**
+ * @file
+ * Variable views module.
+ *
+ * Provides variable values as views default arguments.
+ *
+ * @todo Full views integration for variable table.
+ */
+
+/**
+ * Implements hook_views_api().
+ */
+function variable_views_views_api() {
+ return array(
+ 'api' => '3.0',
+ //'path' => drupal_get_path('module', 'variable_views') . '/includes',
+ );
+}
+
+/**
+ * Implements hook_views_plugins()
+ */
+function variable_views_views_plugins() {
+ $plugins = array (
+ 'argument default' => array(
+ 'variable' => array(
+ 'title' => t('Variable value'),
+ 'handler' => 'views_plugin_argument_default_variable',
+ ),
+ ),
+ );
+ return $plugins;
+}
+
+/**
+ * Variable list for the argument.
+ */
+function _variable_views_variable_list() {
+ return variable_list(variable_children(array_keys(variable_get_info())));
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_views/variable_views.views.inc b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_views/variable_views.views.inc
new file mode 100644
index 0000000..06af16e
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_views/variable_views.views.inc
@@ -0,0 +1,67 @@
+<?php
+/**
+ * @file
+ * Views hooks for variables.
+ */
+/**
+ * Implements hook_views_data().
+ */
+function variable_views_views_data() {
+ // Basic table information.
+
+ // Define the base group of this table.
+ $data['variable']['table']['group'] = t('Variable');
+
+ // Advertise this table as a possible base table.
+ $data['variable']['table']['base'] = array(
+ 'field' => 'name',
+ 'title' => t('Variable'),
+ 'help' => t('Variables from the system variable table.'),
+ );
+ // Variable name
+ $data['variable']['name'] = array(
+ 'title' => t('Name'),
+ 'help' => t('The low level name of the variable.'),
+ 'field' => array(
+ 'handler' => 'views_handler_field',
+ 'click sortable' => TRUE,
+ ),
+ 'argument' => array(
+ 'handler' => 'views_handler_argument_string',
+ ),
+ 'filter' => array(
+ 'handler' => 'views_handler_filter_string',
+ ),
+ 'sort' => array(
+ 'handler' => 'views_handler_sort',
+ ),
+ );
+ // Varaible value
+ $data['variable']['value'] = array(
+ 'title' => t('Value'),
+ 'help' => t('The value of the variable.'),
+ 'field' => array(
+ 'handler' => 'views_handler_field_variable_value',
+ ),
+ 'argument' => array(
+ 'handler' => 'views_handler_argument_string',
+ ),
+ 'filter' => array(
+ 'handler' => 'views_handler_filter',
+ ),
+ 'sort' => array(
+ 'handler' => 'views_handler_sort',
+ ),
+ );
+ // Variable title
+ $data['variable']['title'] = array(
+ 'group' => t('Variable'),
+ 'real field' => 'name',
+ 'field' => array(
+ 'title' => t('Title'),
+ 'help' => t('Human readable variable name.'),
+ 'handler' => 'views_handler_field_variable_title',
+ ),
+ );
+ return $data;
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_views/variable_views.views_default.inc b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_views/variable_views.views_default.inc
new file mode 100644
index 0000000..5bb9da9
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/variable/variable_views/variable_views.views_default.inc
@@ -0,0 +1,86 @@
+<?php
+/**
+ * @file
+ * View for listing variables.
+ */
+
+/**
+ * Implements hook_views_default_views().
+ */
+function variable_views_views_default_views() {
+ $view = new view;
+ $view->name = 'variable';
+ $view->description = 'System variables';
+ $view->tag = 'default';
+ $view->base_table = 'variable';
+ $view->human_name = 'Variable';
+ $view->core = 7;
+ $view->api_version = '3.0';
+ $view->disabled = TRUE; /* Edit this to true to make a default view disabled initially */
+
+ /* Display: Master */
+ $handler = $view->new_display('default', 'Master', 'default');
+ $handler->display->display_options['title'] = 'System variables';
+ $handler->display->display_options['access']['type'] = 'perm';
+ $handler->display->display_options['access']['perm'] = 'administer site configuration';
+ $handler->display->display_options['cache']['type'] = 'none';
+ $handler->display->display_options['query']['type'] = 'views_query';
+ $handler->display->display_options['query']['options']['query_comment'] = FALSE;
+ $handler->display->display_options['exposed_form']['type'] = 'basic';
+ $handler->display->display_options['pager']['type'] = 'full';
+ $handler->display->display_options['pager']['options']['items_per_page'] = '10';
+ $handler->display->display_options['style_plugin'] = 'table';
+ /* Field: Variable: Title */
+ $handler->display->display_options['fields']['title']['id'] = 'title';
+ $handler->display->display_options['fields']['title']['table'] = 'variable';
+ $handler->display->display_options['fields']['title']['field'] = 'title';
+ $handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
+ $handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
+ $handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
+ $handler->display->display_options['fields']['title']['alter']['external'] = 0;
+ $handler->display->display_options['fields']['title']['alter']['replace_spaces'] = 0;
+ $handler->display->display_options['fields']['title']['alter']['trim_whitespace'] = 0;
+ $handler->display->display_options['fields']['title']['alter']['nl2br'] = 0;
+ $handler->display->display_options['fields']['title']['alter']['word_boundary'] = 1;
+ $handler->display->display_options['fields']['title']['alter']['ellipsis'] = 1;
+ $handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
+ $handler->display->display_options['fields']['title']['alter']['trim'] = 0;
+ $handler->display->display_options['fields']['title']['alter']['html'] = 0;
+ $handler->display->display_options['fields']['title']['element_label_colon'] = 1;
+ $handler->display->display_options['fields']['title']['element_default_classes'] = 1;
+ $handler->display->display_options['fields']['title']['hide_empty'] = 0;
+ $handler->display->display_options['fields']['title']['empty_zero'] = 0;
+ $handler->display->display_options['fields']['title']['hide_alter_empty'] = 1;
+ /* Field: Variable: Name */
+ $handler->display->display_options['fields']['name']['id'] = 'name';
+ $handler->display->display_options['fields']['name']['table'] = 'variable';
+ $handler->display->display_options['fields']['name']['field'] = 'name';
+ /* Field: Variable: Value */
+ $handler->display->display_options['fields']['value']['id'] = 'value';
+ $handler->display->display_options['fields']['value']['table'] = 'variable';
+ $handler->display->display_options['fields']['value']['field'] = 'value';
+ $handler->display->display_options['fields']['value']['alter']['alter_text'] = 0;
+ $handler->display->display_options['fields']['value']['alter']['make_link'] = 0;
+ $handler->display->display_options['fields']['value']['alter']['absolute'] = 0;
+ $handler->display->display_options['fields']['value']['alter']['external'] = 0;
+ $handler->display->display_options['fields']['value']['alter']['replace_spaces'] = 0;
+ $handler->display->display_options['fields']['value']['alter']['trim_whitespace'] = 0;
+ $handler->display->display_options['fields']['value']['alter']['nl2br'] = 0;
+ $handler->display->display_options['fields']['value']['alter']['word_boundary'] = 1;
+ $handler->display->display_options['fields']['value']['alter']['ellipsis'] = 1;
+ $handler->display->display_options['fields']['value']['alter']['strip_tags'] = 0;
+ $handler->display->display_options['fields']['value']['alter']['trim'] = 0;
+ $handler->display->display_options['fields']['value']['alter']['html'] = 0;
+ $handler->display->display_options['fields']['value']['element_label_colon'] = 1;
+ $handler->display->display_options['fields']['value']['element_default_classes'] = 1;
+ $handler->display->display_options['fields']['value']['hide_empty'] = 0;
+ $handler->display->display_options['fields']['value']['empty_zero'] = 0;
+ $handler->display->display_options['fields']['value']['hide_alter_empty'] = 1;
+
+ /* Display: Page */
+ $handler = $view->new_display('page', 'Page', 'page');
+ $handler->display->display_options['path'] = 'variable';
+
+ $views[$view->name] = $view;
+ return $views;
+}