<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://gwiki3.thatlinuxbox.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Roccivic</id>
		<title>GeeklogWiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://gwiki3.thatlinuxbox.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Roccivic"/>
		<link rel="alternate" type="text/html" href="http://gwiki3.thatlinuxbox.com/Special:Contributions/Roccivic"/>
		<updated>2026-04-04T20:39:04Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.27.5</generator>

	<entry>
		<id>http://gwiki3.thatlinuxbox.com/index.php?title=Themes_and_XHTML&amp;diff=6161</id>
		<title>Themes and XHTML</title>
		<link rel="alternate" type="text/html" href="http://gwiki3.thatlinuxbox.com/index.php?title=Themes_and_XHTML&amp;diff=6161"/>
				<updated>2012-04-15T13:40:05Z</updated>
		
		<summary type="html">&lt;p&gt;Roccivic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Since version 1.5.0, Geeklog supports [http://en.wikipedia.org/wiki/XHTML XHTML] compliant themes. This means that Geeklog will automatically create XHTML compliant tags when required.&lt;br /&gt;
&lt;br /&gt;
== Switching to XHTML ==&lt;br /&gt;
&lt;br /&gt;
Since Geeklog 2.0, you must specify a doctype for your theme, if you wish for your theme to be XHTML compliant.&lt;br /&gt;
This is done in the functions.php file by implementing the function theme_config_yourThemeName() method, for example, for a theme called foobar this would look like:&lt;br /&gt;
&lt;br /&gt;
  function theme_config_foobar()&lt;br /&gt;
  {&lt;br /&gt;
      return array(&lt;br /&gt;
          'doctype' =&amp;gt; 'xhtml10strict'&lt;br /&gt;
      );&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Valid XHTML doctypes are:&lt;br /&gt;
&lt;br /&gt;
* xhtml10transitional&lt;br /&gt;
* xhtml10strict&lt;br /&gt;
&lt;br /&gt;
== Switching to XHTML in Geeklog &amp;lt; 2.0 ==&lt;br /&gt;
&lt;br /&gt;
Whether Geeklog will switch to XHTML compliant mode or not depends on the definition of an &amp;lt;tt&amp;gt;XHTML&amp;lt;/tt&amp;gt; variable in the PHP code. This variable can either be defined by the theme (in the theme's &amp;lt;tt&amp;gt;functions.php&amp;lt;/tt&amp;gt; file) or by selecting an XHTML DOCTYPE from the Configuation (since Geeklog 1.6.0):&lt;br /&gt;
&lt;br /&gt;
: Configuration &amp;gt; Geeklog &amp;gt; Theme &amp;gt; Theme &amp;gt; [http://www.geeklog.net/docs/english/config.html#desc_doctype DOCTYPE Declaration]&lt;br /&gt;
&lt;br /&gt;
Selecting an XHTML DOCTYPE will automatically set the &amp;lt;tt&amp;gt;XHTML&amp;lt;/tt&amp;gt; constant properly (any definition made by the theme still takes precedence, though, so make sure the two don't conflict).&lt;br /&gt;
&lt;br /&gt;
== XHTML Constant ==&lt;br /&gt;
&lt;br /&gt;
For an XHTML compliant theme, the &amp;lt;tt&amp;gt;XHTML&amp;lt;/tt&amp;gt; constant should be defined like so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define('XHTML', ' /');&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Otherwise, the constant will be defined as an empty string:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;define('XHTML', '');&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plugins can simply use the &amp;lt;tt&amp;gt;XHTML&amp;lt;/tt&amp;gt; constant - Geeklog will take care that is always defined. The same is true for code in &amp;lt;tt&amp;gt;lib-custom.php&amp;lt;/tt&amp;gt;, with the exception of code that is not located in a function (since &amp;lt;tt&amp;gt;lib-custom.php&amp;lt;/tt&amp;gt; will be included before the theme, and any global code in &amp;lt;tt&amp;gt;lib-custom.php&amp;lt;/tt&amp;gt; would therefore be executed before the constant is defined).&lt;br /&gt;
&lt;br /&gt;
== Template Variables ==&lt;br /&gt;
&lt;br /&gt;
The definition of the &amp;lt;tt&amp;gt;XHTML&amp;lt;/tt&amp;gt; constant is also available as a &amp;lt;tt&amp;gt;{xhtml}&amp;lt;/tt&amp;gt; template variable in all template files used by Geeklog. This way, it is possible to create themes that will work both as XHTML and &amp;quot;plain&amp;quot; HTML by using the template variable for tags that have to be closed in XHTML, e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;br{xhtml}&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;test&amp;quot;{xhtml}&amp;gt;&lt;br /&gt;
&amp;lt;img src=&amp;quot;image.png&amp;quot; alt=&amp;quot;&amp;quot;{xhtml}&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Other Template Variables ===&lt;br /&gt;
&lt;br /&gt;
Themes that are written to be both valid HTML and XHTML (as described above) should use the &amp;lt;tt&amp;gt;{doctype}&amp;lt;/tt&amp;gt; variable as the first line in &amp;lt;tt&amp;gt;header.thtml&amp;lt;/tt&amp;gt; instead of hard-coding the DOCTYPE.&lt;br /&gt;
&lt;br /&gt;
In XHTML mode, Geeklog will also provide a &amp;lt;tt&amp;gt;{xmlns}&amp;lt;/tt&amp;gt; variable that will contain the &amp;lt;tt&amp;gt;xmlns&amp;lt;/tt&amp;gt; attribute for the &amp;lt;tt&amp;gt;html&amp;lt;/tt&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
Putting it all together, the first 3 lines of your theme's &amp;lt;tt&amp;gt;header.thtml&amp;lt;/tt&amp;gt; should look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;{doctype}&lt;br /&gt;
&amp;lt;html{lang_attribute}{xmlns}&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;{lang_attribute}&amp;lt;/tt&amp;gt; will set a &amp;lt;tt&amp;gt;lang&amp;lt;/tt&amp;gt; attribute in [[Multilingual Support|multi-language setups]].&lt;br /&gt;
&lt;br /&gt;
The Professional theme that ships with Geeklog uses the &amp;lt;tt&amp;gt;{doctype}&amp;lt;/tt&amp;gt; template variable and is both HTML and XHTML compliant, depending on the DOCTYPE selected in the Configuration.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Themes]]&lt;/div&gt;</summary>
		<author><name>Roccivic</name></author>	</entry>

	<entry>
		<id>http://gwiki3.thatlinuxbox.com/index.php?title=Theme_Developers_Guide&amp;diff=6160</id>
		<title>Theme Developers Guide</title>
		<link rel="alternate" type="text/html" href="http://gwiki3.thatlinuxbox.com/index.php?title=Theme_Developers_Guide&amp;diff=6160"/>
				<updated>2012-04-15T13:34:38Z</updated>
		
		<summary type="html">&lt;p&gt;Roccivic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Creating a theme for Geeklog is easy and quite fast. If you can manipulate HTML files then you can create a theme! There's no need to learn PHP.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creating a theme ==&lt;br /&gt;
&lt;br /&gt;
First, copy an existing theme that is most similar to what you want to implement (if one exists). If what you will do is radically different (and we hope so!) then copying any one will do. Copy the existing theme to the name you want your theme to have (please, no spaces in the theme name): &lt;br /&gt;
&lt;br /&gt;
cp -R /path/to/geeklog/public_html/layout/Yahoo /path/to/geeklog/public_html/layout/My_Theme_Name_No_Spaces &lt;br /&gt;
&lt;br /&gt;
Change into your new theme directory: &lt;br /&gt;
&lt;br /&gt;
cd /path/to/geeklog/public_html/layout/My_Theme_Name_No_Spaces &lt;br /&gt;
&lt;br /&gt;
Now edit the templates to suit your needs. Keep in mind that templates, generally are partial HTML files. The directory you just created holds ALL templates Geeklog needs but you will only need to modify a small few to make a huge impact on the look. &lt;br /&gt;
&lt;br /&gt;
In particular these are the templates you will undoubtedly want to change: &lt;br /&gt;
&lt;br /&gt;
*header.thtml &lt;br /&gt;
*footer.thtml &lt;br /&gt;
*blockheader.thtml &lt;br /&gt;
*blockfooter.thtml &lt;br /&gt;
*storybody.thtml &lt;br /&gt;
*storybodytext.thtml &lt;br /&gt;
*featuredstorybody.thtml &lt;br /&gt;
*featuredstorybodytext.thtml &lt;br /&gt;
*style.css&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
== How themes work ==&lt;br /&gt;
&lt;br /&gt;
When rendering a theme, Geeklog starts with header.thtml which builds the site's header and then goes on to include the left column of blocks (look for the variable {left_blocks} and the leftblocks.thtml file). The middle part of a site consists of the stories which are built using the storytext.thtml and storybodytext.thtml (for normal stories) and featuredstorytext.thtml and featuredstorybodytext.thtml (for featured stories) template files. The footer.thtml file then builds the right column of blocks (variable {right_blocks}, file right_blocks.thtml) and the site's footer. Blocks themselves consist of the blockheader.thtml and blockfooter.thtml files. &lt;br /&gt;
&lt;br /&gt;
The above only described how Geeklog's main page and stories are rendered. More templates exist for the various editors and lists you will see in Geeklog, as well as for the calendar and almost every other part of Geeklog.&lt;br /&gt;
&lt;br /&gt;
There is currently no complete list available that explains which template file is used for which part of Geeklog. However, in most cases the use should be obvious when you have a look at the file and directory names in your theme's layout directory. If you're unsure which template file is used to render a certain part of Geeklog, have a look at the URL. You will notice the name of a PHP file there, e.g. the users.php file when you view a user's profile. Open that file and search for '.thtml'. For the profile you will find these lines (in function userprofile()):&lt;br /&gt;
&lt;br /&gt;
;$user_templates = COM_newTemplate ($_CONF['path_layout'] . 'users');&lt;br /&gt;
;$user_templates-&amp;gt;set_file (array ('profile'=&amp;gt;'profile.thtml', 'row'=&amp;gt;'commentrow.thtml', 'strow'=&amp;gt;'storyrow.thtml')); &lt;br /&gt;
&lt;br /&gt;
You don't need to understand PHP code to see that this uses the template files profile.thtml, commentrow.thtml, and storyrow.thtml. The first line also indicates that these are taken from the users directory within the theme's layout directory.&lt;br /&gt;
&lt;br /&gt;
An [http://www.geeklog.net/docs/english/themevars.html incomplete list of variables] that can be used in templates files is also included.&lt;br /&gt;
&lt;br /&gt;
== Testing a theme and further information ==&lt;br /&gt;
&lt;br /&gt;
After you have edited your themes, you are now ready to test it out. Simply go to &amp;lt;nowiki&amp;gt;http://mygeeklogsite/users.php?mode=preferences&amp;lt;/nowiki&amp;gt; - in the theme drop-down select your newly created theme (note the name of your theme is the same name as the directory for your theme). &lt;br /&gt;
&lt;br /&gt;
Finally, you may want to update the logo and other images in your theme's images directory. &lt;br /&gt;
&lt;br /&gt;
For the template system we are using [http://phplib.sourceforge.net/ PHPLib]'s template class. Read their documentation and, optionally, look at /path/to/geeklog/system/classes/template.class.php to see how it is implemented. Even with this knowledge it may not be clear which templates are used in conjunction with one another (i.e. storybody.thtml and storybodytext.thtml together make up the complete format of a single story). If you have questions join our mailing list at http://lists.geeklog.net/listinfo/geeklog-users or check us out in IRC at irc.freenode.net in #geeklog.&lt;br /&gt;
&lt;br /&gt;
== Theme API ==&lt;br /&gt;
&lt;br /&gt;
Since Geeklog 2.0, a minimal theme API is available. It can be used to override defaults, load CSS files and load JavaScript files.&lt;br /&gt;
The API is structured similarly to that of the Geeklog plugins. In the file &amp;quot;functions.php&amp;quot; in the theme's folder, the following functions may be declared (replace yourThemeName with the actual theme name):&lt;br /&gt;
&lt;br /&gt;
* function theme_config_yourThemeName() {}&lt;br /&gt;
* function theme_css_yourThemeName() {}&lt;br /&gt;
* function theme_js_libs_yourThemeName() {}&lt;br /&gt;
* function theme_js_files_yourThemeName() {}&lt;br /&gt;
* function theme_init_yourThemeName() {}&lt;br /&gt;
&lt;br /&gt;
For implementation details please see the functions.php file that was shipped with your version of Geeklog.&lt;br /&gt;
&lt;br /&gt;
== Tips and tricks ==&lt;br /&gt;
&lt;br /&gt;
'''Themes and WYSIWG editors''': The template files used by Geeklog are not complete HTML files - they contain only parts of the HTML that Geeklog puts together to build a proper HTML document. This, however, seems to confuse some WYSIWYG HTML editors and some of them tend to add the HTML which they think is missing from the file, thus making it unusable for Geeklog.&lt;br /&gt;
We suggest you use a simple text editor to edit your themes.&lt;br /&gt;
&lt;br /&gt;
'''PHP in themes''': You can use PHP in the header of a theme, i.e. in the header.thtml file. If you want to use custom PHP functions, you can put them in the file functions.php within your themes directory.&lt;br /&gt;
&lt;br /&gt;
'''Different look for left and right blocks''': You can give the blocks on the left and right a different look. See [http://www.geeklog.net/forum/viewtopic.php?forum=10&amp;amp;showtopic=21070 this story on the Geeklog homepage] for details.&lt;br /&gt;
&lt;br /&gt;
'''Polls''': To use multi-colored bars in the graphical display of poll results, you can use the {answer_counter} and {answer_odd} variables in the pollbooth/pollvotes_bar.thtml template file. {answer_counter} will be replaced with a running number for each answer, hence bar{answer_counter}.gif would result in bar1.gif, bar2.gif, etc. Giving each of those GIFs a different color would give you a different color for each answer.&lt;br /&gt;
{answer_odd} will alternate between 0 and 1 for every answer, hence bar{answer_odd}.gif will result in bar0.gif for the first, third, fifth, etc. answer and bar1.gif for the second, fourth, etc. answer.&lt;br /&gt;
&lt;br /&gt;
'''XHTML''': [[Themes and XHTML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Themes]]&lt;/div&gt;</summary>
		<author><name>Roccivic</name></author>	</entry>

	<entry>
		<id>http://gwiki3.thatlinuxbox.com/index.php?title=Plugin_Autoinstall&amp;diff=6041</id>
		<title>Plugin Autoinstall</title>
		<link rel="alternate" type="text/html" href="http://gwiki3.thatlinuxbox.com/index.php?title=Plugin_Autoinstall&amp;diff=6041"/>
				<updated>2011-05-02T14:58:43Z</updated>
		
		<summary type="html">&lt;p&gt;Roccivic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
Geeklog 1.6 brings two important changes regarding installation of plugins:&lt;br /&gt;
&lt;br /&gt;
* Plugins can be installed by uploading their tarball (from Geeklog's Plugins Admin panel)&lt;br /&gt;
* Plugins can be bundled / unbundled by simply adding / removing their respective directories to / from the Geeklog tarball&lt;br /&gt;
&lt;br /&gt;
In both of these scenarios, Geeklog needs a way to automatically run the install procedure for such a plugin.&lt;br /&gt;
&lt;br /&gt;
The problem with the plugin install scripts used until now are that they were mainly aimed at being run by a human and that they also check permissions that simply may not be set when the install is done (e.g. when running Geeklog's install script).&lt;br /&gt;
&lt;br /&gt;
The solution proposed here is the inclusion of a new file, &amp;lt;tt&amp;gt;autoinstall.php&amp;lt;/tt&amp;gt; into every plugin that implements up to 4 new API functions (3 of which are optional).&lt;br /&gt;
&lt;br /&gt;
= autoinstall.php =&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;tt&amp;gt;autoinstall.php&amp;lt;/tt&amp;gt; is to be located in the plugin's main directory, i.e. in the same directory as its &amp;lt;tt&amp;gt;functions.inc&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/path/to/geeklog/plugins/&lt;br /&gt;
                         foo/&lt;br /&gt;
                             functions.inc&lt;br /&gt;
                             autoinstall.php&lt;br /&gt;
                         staticpages/&lt;br /&gt;
                             functions.inc&lt;br /&gt;
                             autoinstall.php&lt;br /&gt;
                         ...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plugins that ship with an &amp;lt;tt&amp;gt;autoinstall.php&amp;lt;/tt&amp;gt; file won't need to provide the &amp;quot;traditional&amp;quot; install script (&amp;lt;tt&amp;gt;admin/plugins/foo/install.php&amp;lt;/tt&amp;gt;) unless they want to be backward-compatible with Geeklog releases prior to 1.6.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== plugin_autoinstall_ ==&lt;br /&gt;
&lt;br /&gt;
This is the most important and mandatory API function to implement in &amp;lt;tt&amp;gt;autoinstall.php&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function plugin_autoinstall_foo($pi_name)&lt;br /&gt;
{&lt;br /&gt;
    $pi_name         = 'foo';&lt;br /&gt;
    $pi_display_name = 'Foo';&lt;br /&gt;
    $pi_admin        = $pi_display_name . ' Admin';&lt;br /&gt;
&lt;br /&gt;
    $info = array(&lt;br /&gt;
        'pi_name'         =&amp;gt; $pi_name,&lt;br /&gt;
        'pi_display_name' =&amp;gt; $pi_display_name,&lt;br /&gt;
        'pi_version'      =&amp;gt; '1.0.0',&lt;br /&gt;
        'pi_gl_version'   =&amp;gt; '1.6.0',&lt;br /&gt;
        'pi_homepage'     =&amp;gt; 'http://www.example.com/'&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $groups = array(&lt;br /&gt;
        $pi_admin =&amp;gt; 'Has full access to ' . $pi_display_name . ' features'&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $features = array(&lt;br /&gt;
        $pi_name . '.edit'      =&amp;gt; 'Access to ' . $pi_display_name . ' editor'&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $mappings = array(&lt;br /&gt;
        $pi_name . '.edit'      =&amp;gt; array($pi_admin)&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $tables = array(&lt;br /&gt;
        'foo'&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $inst_parms = array(&lt;br /&gt;
        'info'      =&amp;gt; $info,&lt;br /&gt;
        'groups'    =&amp;gt; $groups,&lt;br /&gt;
        'features'  =&amp;gt; $features,&lt;br /&gt;
        'mappings'  =&amp;gt; $mappings,&lt;br /&gt;
        'tables'    =&amp;gt; $tables&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    return $inst_parms;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you've written a Geeklog plugin before, the data provided by this function should look familiar.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;$info&amp;lt;/code&amp;gt; array provides the information that goes into the plugin's entry in the &amp;lt;tt&amp;gt;gl_plugins&amp;lt;/tt&amp;gt; table. The only addition here is the &amp;lt;code&amp;gt;$pi_display_name&amp;lt;/code&amp;gt; entry, so that we can use a nicely formatted name to present to the user instead of having to refer to the plugin by its internal and possibly abbreviated name (&amp;lt;code&amp;gt;$pi_name&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$groups&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;$features&amp;lt;/code&amp;gt; simply list all the groups and features (permissions) that the plugin would like to introduce. Geeklog will create those automatically for the plugin, using the &amp;lt;code&amp;gt;$mappings&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;$mappings&amp;lt;/code&amp;gt; defines which permissions to assign to which of the new groups.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;$tables&amp;lt;/code&amp;gt; array obviously lists all the table names used by the plugin (note that the names are given without the &amp;lt;code&amp;gt;$_DB_table_prefix&amp;lt;/code&amp;gt;). Geeklog will add these tables names (with the proper prefix) to the global &amp;lt;code&amp;gt;$_TABLES&amp;lt;/code&amp;gt; array during the install. The plugin will still have to make sure they are known after the install, e.g. by defining them in its &amp;lt;tt&amp;gt;functions.inc&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Finally, all these arrays are wrapped into another array and returned from the autoinstall function.&lt;br /&gt;
&lt;br /&gt;
With the exception of the &amp;lt;code&amp;gt;$info&amp;lt;/code&amp;gt; array, all of these arrays are optional. Plugins that don't create any groups or tables don't need to provide &amp;lt;code&amp;gt;$groups&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;$tables&amp;lt;/code&amp;gt; entries.&lt;br /&gt;
&lt;br /&gt;
In case of an error during the install, Geeklog will also use this information to attempt a cleanup of the database, i.e. remove groups, permissions, etc.&lt;br /&gt;
&lt;br /&gt;
=== Plugin dependencies and version control ===&lt;br /&gt;
&lt;br /&gt;
Since Geeklog 1.8.0, a new and optional array, $requires, is available. It must contain dependency information for a plugin.&lt;br /&gt;
You can make a requirement for a particular range of versions of Geeklog, databases and other plugins.&lt;br /&gt;
Each dependency is stored inside this array as another array.&lt;br /&gt;
&lt;br /&gt;
The minimal usage is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
    $requires= array(&lt;br /&gt;
        // This plugin requires another plugin, 'someplugin', and does not need a databases to function.&lt;br /&gt;
        array('plugin' =&amp;gt; 'someplugin')&lt;br /&gt;
    );&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
    $requires= array(&lt;br /&gt;
        // This plugin requires another plugin, 'someplugin', and supports MySQL and PgSQL databases.&lt;br /&gt;
        array('plugin' =&amp;gt; 'someplugin'),&lt;br /&gt;
        array('db' =&amp;gt; 'mysql'),&lt;br /&gt;
        array('db' =&amp;gt; 'pgsql')&lt;br /&gt;
    );&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can define any particular range of versions as the requirements for your plugin by adding the 'version' and 'operator' indeces to the arrays. Here's a more complex example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
    $requires= array(&lt;br /&gt;
        // This plugin requires a version greater than or equal to 1.0.0 of 'someplugin' (The default 'operator' is '&amp;gt;=')&lt;br /&gt;
        array('plugin' =&amp;gt; 'someplugin',&lt;br /&gt;
              'version' =&amp;gt; '1.0.0'),&lt;br /&gt;
&lt;br /&gt;
        // This plugin also requires a version greater than 1.0.0 of 'someotherplugin'&lt;br /&gt;
        array('plugin' =&amp;gt; 'someotherplugin',&lt;br /&gt;
              'version' =&amp;gt; '1.0.0',&lt;br /&gt;
              'operator' =&amp;gt; '&amp;gt;'),&lt;br /&gt;
&lt;br /&gt;
        // Multiple dependencies are allowed for the same parent plugin&lt;br /&gt;
        // The below line ensures that only 'someplugin' with version less than 2.0.0 is used&lt;br /&gt;
        array('plugin' =&amp;gt; 'someotherplugin',&lt;br /&gt;
              'version' =&amp;gt; '2.0.0',&lt;br /&gt;
              'operator' =&amp;gt; '&amp;lt;'),&lt;br /&gt;
&lt;br /&gt;
        // You can also require a particular range of versions of geeklog&lt;br /&gt;
        array('core' =&amp;gt; 'geeklog',&lt;br /&gt;
              'version' =&amp;gt; '1.8.0'),&lt;br /&gt;
&lt;br /&gt;
        // You must require either all or none of the databases that your plugin supports&lt;br /&gt;
        // Or you might lock out some of the capabilities of your plugin&lt;br /&gt;
        array('db' =&amp;gt; 'mysql'),&lt;br /&gt;
&lt;br /&gt;
        array('db' =&amp;gt; 'mssql',&lt;br /&gt;
              'version' =&amp;gt; '9.0'), // At least SQL Server 2005&lt;br /&gt;
&lt;br /&gt;
        array('db' =&amp;gt; 'pgsql',&lt;br /&gt;
              'version' =&amp;gt; '7.3',&lt;br /&gt;
              'operator' =&amp;gt; '&amp;gt;')&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $inst_parms = array(&lt;br /&gt;
        'info'      =&amp;gt; $info,&lt;br /&gt;
        'groups'    =&amp;gt; $groups,&lt;br /&gt;
        'features'  =&amp;gt; $features,&lt;br /&gt;
        'mappings'  =&amp;gt; $mappings,&lt;br /&gt;
        'tables'    =&amp;gt; $tables,&lt;br /&gt;
        'requires'  =&amp;gt; $requires // Add the dependency information to the installation parameters here&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' Expect this function to be called more than once during installation. Also, the fact that the function is being called at all does not necessarily mean that the plugin will actually be installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== plugin_postinstall_ ==&lt;br /&gt;
&lt;br /&gt;
Geeklog, armed with the information provided by the &amp;lt;code&amp;gt;plugin_autoinstall_&amp;lt;/code&amp;gt; function, will take care of moving the plugin's files into their 3 standard locations, create the tables, the groups, and permissions. For any additional steps that need to be performed during installation, the &amp;lt;code&amp;gt;plugin_postinstall_&amp;lt;/code&amp;gt; function will be called:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function plugin_postinstall_foo($pi_name)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point, all the files are already in their correct place, the groups and permissions have been added and the plugin has been registered with Geeklog (i.e. has been added to the &amp;lt;tt&amp;gt;gl_plugins&amp;lt;/tt&amp;gt; table). However, the plugin has not been loaded yet, i.e. you can not rely on any of your plugin's functions being available.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== plugin_compatible_with_this_version_ ==&lt;br /&gt;
&lt;br /&gt;
The very first function from &amp;lt;tt&amp;gt;autoinstall.php&amp;lt;/tt&amp;gt; that Geeklog attempts to call is &amp;lt;code&amp;gt;plugin_compatible_with_this_version_&amp;lt;/code&amp;gt;. Here, the plugin can check if it's compatible with the current Geeklog version. Since this function was only introduced in Geeklog 1.6.0, you can assume this to be the minimum version.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function plugin_compatible_with_this_version_foo($pi_name)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The function should return &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; when the plugin requires a more recent Geeklog version. Return &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; if installation on the current Geeklog version is okay.&lt;br /&gt;
&lt;br /&gt;
If you would like to rely on Geeklog's &amp;quot;Plugin dependencies and version control&amp;quot; feature for ensuring that all required plugin are available, you must ensure that the user has at least version 1.8.0 of Geeklog. This can be accomplished with the following code snippet:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function plugin_compatible_with_this_version_foo($pi_name) {&lt;br /&gt;
   if (function_exists('PLG_resolveDependencies')) {&lt;br /&gt;
       return true;&lt;br /&gt;
   } else {&lt;br /&gt;
       COM_errorLog('Plugin &amp;quot;foo&amp;quot; requires at least Geeklog 1.8.0, but you are running an older version.');&lt;br /&gt;
       return false;&lt;br /&gt;
   }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== plugin_load_configuration_ ==&lt;br /&gt;
&lt;br /&gt;
This function only needs to be implemented by plugins that use the [[PluginConfiguration|Configuration GUI]]. A typical implementation would look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function plugin_load_configuration_foo($pi_name)&lt;br /&gt;
{&lt;br /&gt;
    global $_CONF;&lt;br /&gt;
&lt;br /&gt;
    $base_path = $_CONF['path'] . 'plugins/' . $pi_name . '/';&lt;br /&gt;
&lt;br /&gt;
    require_once $_CONF['path_system'] . 'classes/config.class.php';&lt;br /&gt;
    require_once $base_path . 'install_defaults.php';&lt;br /&gt;
&lt;br /&gt;
    return plugin_initconfig_foo();&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where the &amp;lt;code&amp;gt;plugin_initconfig_foo&amp;lt;/code&amp;gt; function is implemented in a &amp;lt;tt&amp;gt;install_defaults.php&amp;lt;/tt&amp;gt; file, that handles creation and updates of the plugin's config GUI elements.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Also see =&lt;br /&gt;
&lt;br /&gt;
* [[Plugin Auto-Uninstall]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Plugin Development]]&lt;/div&gt;</summary>
		<author><name>Roccivic</name></author>	</entry>

	<entry>
		<id>http://gwiki3.thatlinuxbox.com/index.php?title=Plugin_Autoinstall&amp;diff=6007</id>
		<title>Plugin Autoinstall</title>
		<link rel="alternate" type="text/html" href="http://gwiki3.thatlinuxbox.com/index.php?title=Plugin_Autoinstall&amp;diff=6007"/>
				<updated>2011-03-13T21:10:44Z</updated>
		
		<summary type="html">&lt;p&gt;Roccivic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
Geeklog 1.6 brings two important changes regarding installation of plugins:&lt;br /&gt;
&lt;br /&gt;
* Plugins can be installed by uploading their tarball (from Geeklog's Plugins Admin panel)&lt;br /&gt;
* Plugins can be bundled / unbundled by simply adding / removing their respective directories to / from the Geeklog tarball&lt;br /&gt;
&lt;br /&gt;
In both of these scenarios, Geeklog needs a way to automatically run the install procedure for such a plugin.&lt;br /&gt;
&lt;br /&gt;
The problem with the plugin install scripts used until now are that they were mainly aimed at being run by a human and that they also check permissions that simply may not be set when the install is done (e.g. when running Geeklog's install script).&lt;br /&gt;
&lt;br /&gt;
The solution proposed here is the inclusion of a new file, &amp;lt;tt&amp;gt;autoinstall.php&amp;lt;/tt&amp;gt; into every plugin that implements up to 4 new API functions (3 of which are optional).&lt;br /&gt;
&lt;br /&gt;
= autoinstall.php =&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;tt&amp;gt;autoinstall.php&amp;lt;/tt&amp;gt; is to be located in the plugin's main directory, i.e. in the same directory as its &amp;lt;tt&amp;gt;functions.inc&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/path/to/geeklog/plugins/&lt;br /&gt;
                         foo/&lt;br /&gt;
                             functions.inc&lt;br /&gt;
                             autoinstall.php&lt;br /&gt;
                         staticpages/&lt;br /&gt;
                             functions.inc&lt;br /&gt;
                             autoinstall.php&lt;br /&gt;
                         ...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plugins that ship with an &amp;lt;tt&amp;gt;autoinstall.php&amp;lt;/tt&amp;gt; file won't need to provide the &amp;quot;traditional&amp;quot; install script (&amp;lt;tt&amp;gt;admin/plugins/foo/install.php&amp;lt;/tt&amp;gt;) unless they want to be backward-compatible with Geeklog releases prior to 1.6.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== plugin_autoinstall_ ==&lt;br /&gt;
&lt;br /&gt;
This is the most important and mandatory API function to implement in &amp;lt;tt&amp;gt;autoinstall.php&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function plugin_autoinstall_foo($pi_name)&lt;br /&gt;
{&lt;br /&gt;
    $pi_name         = 'foo';&lt;br /&gt;
    $pi_display_name = 'Foo';&lt;br /&gt;
    $pi_admin        = $pi_display_name . ' Admin';&lt;br /&gt;
&lt;br /&gt;
    $info = array(&lt;br /&gt;
        'pi_name'         =&amp;gt; $pi_name,&lt;br /&gt;
        'pi_display_name' =&amp;gt; $pi_display_name,&lt;br /&gt;
        'pi_version'      =&amp;gt; '1.0.0',&lt;br /&gt;
        'pi_gl_version'   =&amp;gt; '1.6.0',&lt;br /&gt;
        'pi_homepage'     =&amp;gt; 'http://www.example.com/'&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $groups = array(&lt;br /&gt;
        $pi_admin =&amp;gt; 'Has full access to ' . $pi_display_name . ' features'&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $features = array(&lt;br /&gt;
        $pi_name . '.edit'      =&amp;gt; 'Access to ' . $pi_display_name . ' editor'&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $mappings = array(&lt;br /&gt;
        $pi_name . '.edit'      =&amp;gt; array($pi_admin)&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $tables = array(&lt;br /&gt;
        'foo'&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $inst_parms = array(&lt;br /&gt;
        'info'      =&amp;gt; $info,&lt;br /&gt;
        'groups'    =&amp;gt; $groups,&lt;br /&gt;
        'features'  =&amp;gt; $features,&lt;br /&gt;
        'mappings'  =&amp;gt; $mappings,&lt;br /&gt;
        'tables'    =&amp;gt; $tables&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    return $inst_parms;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you've written a Geeklog plugin before, the data provided by this function should look familiar.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;$info&amp;lt;/code&amp;gt; array provides the information that goes into the plugin's entry in the &amp;lt;tt&amp;gt;gl_plugins&amp;lt;/tt&amp;gt; table. The only addition here is the &amp;lt;code&amp;gt;$pi_display_name&amp;lt;/code&amp;gt; entry, so that we can use a nicely formatted name to present to the user instead of having to refer to the plugin by its internal and possibly abbreviated name (&amp;lt;code&amp;gt;$pi_name&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$groups&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;$features&amp;lt;/code&amp;gt; simply list all the groups and features (permissions) that the plugin would like to introduce. Geeklog will create those automatically for the plugin, using the &amp;lt;code&amp;gt;$mappings&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;$mappings&amp;lt;/code&amp;gt; defines which permissions to assign to which of the new groups.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;$tables&amp;lt;/code&amp;gt; array obviously lists all the table names used by the plugin (note that the names are given without the &amp;lt;code&amp;gt;$_DB_table_prefix&amp;lt;/code&amp;gt;). Geeklog will add these tables names (with the proper prefix) to the global &amp;lt;code&amp;gt;$_TABLES&amp;lt;/code&amp;gt; array during the install. The plugin will still have to make sure they are known after the install, e.g. by defining them in its &amp;lt;tt&amp;gt;functions.inc&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Finally, all these arrays are wrapped into another array and returned from the autoinstall function.&lt;br /&gt;
&lt;br /&gt;
With the exception of the &amp;lt;code&amp;gt;$info&amp;lt;/code&amp;gt; array, all of these arrays are optional. Plugins that don't create any groups or tables don't need to provide &amp;lt;code&amp;gt;$groups&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;$tables&amp;lt;/code&amp;gt; entries.&lt;br /&gt;
&lt;br /&gt;
In case of an error during the install, Geeklog will also use this information to attempt a cleanup of the database, i.e. remove groups, permissions, etc.&lt;br /&gt;
&lt;br /&gt;
'''Plugin dependencies and version control'''&lt;br /&gt;
&lt;br /&gt;
Since Geeklog 1.8.0, a new and optional array, $requires, is available. It must contain dependency information for a plugin.&lt;br /&gt;
You can make a requirement for a particular range of versions of Geeklog, databases and other plugins.&lt;br /&gt;
Each dependency is stored inside this array as another array.&lt;br /&gt;
&lt;br /&gt;
The minimal usage is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
    $requires= array(&lt;br /&gt;
        // This plugin requires another plugin, 'someplugin', and does not need a databases to function.&lt;br /&gt;
        array('plugin' =&amp;gt; 'someplugin')&lt;br /&gt;
    );&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
    $requires= array(&lt;br /&gt;
        // This plugin requires another plugin, 'someplugin', and supports MySQL and PgSQL databases.&lt;br /&gt;
        array('plugin' =&amp;gt; 'someplugin'),&lt;br /&gt;
        array('db' =&amp;gt; 'mysql'),&lt;br /&gt;
        array('db' =&amp;gt; 'pgsql')&lt;br /&gt;
    );&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can define any particular range of versions as the requirements for your plugin by adding the 'version' and 'operator' indeces to the arrays. Here's a more complex example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
    $requires= array(&lt;br /&gt;
        // This plugin requires a version greater than or equal to 1.0.0 of 'someplugin' (The default 'operator' is '&amp;gt;=')&lt;br /&gt;
        array('plugin' =&amp;gt; 'someplugin',&lt;br /&gt;
              'version' =&amp;gt; '1.0.0'),&lt;br /&gt;
&lt;br /&gt;
        // This plugin also requires a version greater than 1.0.0 of 'someotherplugin'&lt;br /&gt;
        array('plugin' =&amp;gt; 'someotherplugin',&lt;br /&gt;
              'version' =&amp;gt; '1.0.0',&lt;br /&gt;
              'operator' =&amp;gt; '&amp;gt;'),&lt;br /&gt;
&lt;br /&gt;
        // Multiple dependencies are allowed for the same parent plugin&lt;br /&gt;
        // The below line ensures that only 'someplugin' with version less than 2.0.0 is used&lt;br /&gt;
        array('plugin' =&amp;gt; 'someotherplugin',&lt;br /&gt;
              'version' =&amp;gt; '2.0.0',&lt;br /&gt;
              'operator' =&amp;gt; '&amp;lt;'),&lt;br /&gt;
&lt;br /&gt;
        // You can also require a particular range of versions of geeklog&lt;br /&gt;
        array('core' =&amp;gt; 'geeklog',&lt;br /&gt;
              'version' =&amp;gt; '1.8.0'),&lt;br /&gt;
&lt;br /&gt;
        // You must require either all or none of the databases that your plugin supports&lt;br /&gt;
        // Or you might lock out some of the capabilities of your plugin&lt;br /&gt;
        array('db' =&amp;gt; 'mysql'),&lt;br /&gt;
&lt;br /&gt;
        array('db' =&amp;gt; 'mssql',&lt;br /&gt;
              'version' =&amp;gt; '9.0'), // At least SQL Server 2005&lt;br /&gt;
&lt;br /&gt;
        array('db' =&amp;gt; 'pgsql',&lt;br /&gt;
              'version' =&amp;gt; '7.3',&lt;br /&gt;
              'operator' =&amp;gt; '&amp;gt;')&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $inst_parms = array(&lt;br /&gt;
        'info'      =&amp;gt; $info,&lt;br /&gt;
        'groups'    =&amp;gt; $groups,&lt;br /&gt;
        'features'  =&amp;gt; $features,&lt;br /&gt;
        'mappings'  =&amp;gt; $mappings,&lt;br /&gt;
        'tables'    =&amp;gt; $tables,&lt;br /&gt;
        'requires'  =&amp;gt; $requires // Add the dependency information to the installation parameters here&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' Expect this function to be called more than once during installation. Also, the fact that the function is being called at all does not necessarily mean that the plugin will actually be installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== plugin_postinstall_ ==&lt;br /&gt;
&lt;br /&gt;
Geeklog, armed with the information provided by the &amp;lt;code&amp;gt;plugin_autoinstall_&amp;lt;/code&amp;gt; function, will take care of moving the plugin's files into their 3 standard locations, create the tables, the groups, and permissions. For any additional steps that need to be performed during installation, the &amp;lt;code&amp;gt;plugin_postinstall_&amp;lt;/code&amp;gt; function will be called:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function plugin_postinstall_foo($pi_name)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point, all the files are already in their correct place, the groups and permissions have been added and the plugin has been registered with Geeklog (i.e. has been added to the &amp;lt;tt&amp;gt;gl_plugins&amp;lt;/tt&amp;gt; table). However, the plugin has not been loaded yet, i.e. you can not rely on any of your plugin's functions being available.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== plugin_compatible_with_this_version_ ==&lt;br /&gt;
&lt;br /&gt;
The very first function from &amp;lt;tt&amp;gt;autoinstall.php&amp;lt;/tt&amp;gt; that Geeklog attempts to call is &amp;lt;code&amp;gt;plugin_compatible_with_this_version_&amp;lt;/code&amp;gt;. Here, the plugin can check if it's compatible with the current Geeklog version. Since this function was only introduced in Geeklog 1.6.0, you can assume this to be the minimum version.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function plugin_compatible_with_this_version_foo($pi_name)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The function should return &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; when the plugin requires a more recent Geeklog version. Return &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; if installation on the current Geeklog version is okay.&lt;br /&gt;
&lt;br /&gt;
If you would like to rely on Geeklog's &amp;quot;Plugin dependencies and version control&amp;quot; feature for ensuring that all required plugin are available, you must ensure that the user has at least version 1.8.0 of Geeklog. This can be accomplished with the following code snippet:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function plugin_compatible_with_this_version_foo($pi_name) {&lt;br /&gt;
   if (function_exists('PLG_resolveDependencies')) {&lt;br /&gt;
       return true;&lt;br /&gt;
   } else {&lt;br /&gt;
       COM_errorLog('Plugin &amp;quot;foo&amp;quot; requires at least Geeklog 1.8.0, but you are running an older version.');&lt;br /&gt;
       return false;&lt;br /&gt;
   }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== plugin_load_configuration_ ==&lt;br /&gt;
&lt;br /&gt;
This function only needs to be implemented by plugins that use the [[PluginConfiguration|Configuration GUI]]. A typical implementation would look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function plugin_load_configuration_foo($pi_name)&lt;br /&gt;
{&lt;br /&gt;
    global $_CONF;&lt;br /&gt;
&lt;br /&gt;
    $base_path = $_CONF['path'] . 'plugins/' . $pi_name . '/';&lt;br /&gt;
&lt;br /&gt;
    require_once $_CONF['path_system'] . 'classes/config.class.php';&lt;br /&gt;
    require_once $base_path . 'install_defaults.php';&lt;br /&gt;
&lt;br /&gt;
    return plugin_initconfig_foo();&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where the &amp;lt;code&amp;gt;plugin_initconfig_foo&amp;lt;/code&amp;gt; function is implemented in a &amp;lt;tt&amp;gt;install_defaults.php&amp;lt;/tt&amp;gt; file, that handles creation and updates of the plugin's config GUI elements.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Also see =&lt;br /&gt;
&lt;br /&gt;
* [[Plugin Auto-Uninstall]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Plugin Development]]&lt;/div&gt;</summary>
		<author><name>Roccivic</name></author>	</entry>

	<entry>
		<id>http://gwiki3.thatlinuxbox.com/index.php?title=Plugin_Autoinstall&amp;diff=6006</id>
		<title>Plugin Autoinstall</title>
		<link rel="alternate" type="text/html" href="http://gwiki3.thatlinuxbox.com/index.php?title=Plugin_Autoinstall&amp;diff=6006"/>
				<updated>2011-03-13T21:08:42Z</updated>
		
		<summary type="html">&lt;p&gt;Roccivic: updated plugin dependecy and version control&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
Geeklog 1.6 brings two important changes regarding installation of plugins:&lt;br /&gt;
&lt;br /&gt;
* Plugins can be installed by uploading their tarball (from Geeklog's Plugins Admin panel)&lt;br /&gt;
* Plugins can be bundled / unbundled by simply adding / removing their respective directories to / from the Geeklog tarball&lt;br /&gt;
&lt;br /&gt;
In both of these scenarios, Geeklog needs a way to automatically run the install procedure for such a plugin.&lt;br /&gt;
&lt;br /&gt;
The problem with the plugin install scripts used until now are that they were mainly aimed at being run by a human and that they also check permissions that simply may not be set when the install is done (e.g. when running Geeklog's install script).&lt;br /&gt;
&lt;br /&gt;
The solution proposed here is the inclusion of a new file, &amp;lt;tt&amp;gt;autoinstall.php&amp;lt;/tt&amp;gt; into every plugin that implements up to 4 new API functions (3 of which are optional).&lt;br /&gt;
&lt;br /&gt;
= autoinstall.php =&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;tt&amp;gt;autoinstall.php&amp;lt;/tt&amp;gt; is to be located in the plugin's main directory, i.e. in the same directory as its &amp;lt;tt&amp;gt;functions.inc&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/path/to/geeklog/plugins/&lt;br /&gt;
                         foo/&lt;br /&gt;
                             functions.inc&lt;br /&gt;
                             autoinstall.php&lt;br /&gt;
                         staticpages/&lt;br /&gt;
                             functions.inc&lt;br /&gt;
                             autoinstall.php&lt;br /&gt;
                         ...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plugins that ship with an &amp;lt;tt&amp;gt;autoinstall.php&amp;lt;/tt&amp;gt; file won't need to provide the &amp;quot;traditional&amp;quot; install script (&amp;lt;tt&amp;gt;admin/plugins/foo/install.php&amp;lt;/tt&amp;gt;) unless they want to be backward-compatible with Geeklog releases prior to 1.6.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== plugin_autoinstall_ ==&lt;br /&gt;
&lt;br /&gt;
This is the most important and mandatory API function to implement in &amp;lt;tt&amp;gt;autoinstall.php&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function plugin_autoinstall_foo($pi_name)&lt;br /&gt;
{&lt;br /&gt;
    $pi_name         = 'foo';&lt;br /&gt;
    $pi_display_name = 'Foo';&lt;br /&gt;
    $pi_admin        = $pi_display_name . ' Admin';&lt;br /&gt;
&lt;br /&gt;
    $info = array(&lt;br /&gt;
        'pi_name'         =&amp;gt; $pi_name,&lt;br /&gt;
        'pi_display_name' =&amp;gt; $pi_display_name,&lt;br /&gt;
        'pi_version'      =&amp;gt; '1.0.0',&lt;br /&gt;
        'pi_gl_version'   =&amp;gt; '1.6.0',&lt;br /&gt;
        'pi_homepage'     =&amp;gt; 'http://www.example.com/'&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $groups = array(&lt;br /&gt;
        $pi_admin =&amp;gt; 'Has full access to ' . $pi_display_name . ' features'&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $features = array(&lt;br /&gt;
        $pi_name . '.edit'      =&amp;gt; 'Access to ' . $pi_display_name . ' editor'&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $mappings = array(&lt;br /&gt;
        $pi_name . '.edit'      =&amp;gt; array($pi_admin)&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $tables = array(&lt;br /&gt;
        'foo'&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $inst_parms = array(&lt;br /&gt;
        'info'      =&amp;gt; $info,&lt;br /&gt;
        'groups'    =&amp;gt; $groups,&lt;br /&gt;
        'features'  =&amp;gt; $features,&lt;br /&gt;
        'mappings'  =&amp;gt; $mappings,&lt;br /&gt;
        'tables'    =&amp;gt; $tables&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    return $inst_parms;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you've written a Geeklog plugin before, the data provided by this function should look familiar.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;$info&amp;lt;/code&amp;gt; array provides the information that goes into the plugin's entry in the &amp;lt;tt&amp;gt;gl_plugins&amp;lt;/tt&amp;gt; table. The only addition here is the &amp;lt;code&amp;gt;$pi_display_name&amp;lt;/code&amp;gt; entry, so that we can use a nicely formatted name to present to the user instead of having to refer to the plugin by its internal and possibly abbreviated name (&amp;lt;code&amp;gt;$pi_name&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$groups&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;$features&amp;lt;/code&amp;gt; simply list all the groups and features (permissions) that the plugin would like to introduce. Geeklog will create those automatically for the plugin, using the &amp;lt;code&amp;gt;$mappings&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;$mappings&amp;lt;/code&amp;gt; defines which permissions to assign to which of the new groups.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;$tables&amp;lt;/code&amp;gt; array obviously lists all the table names used by the plugin (note that the names are given without the &amp;lt;code&amp;gt;$_DB_table_prefix&amp;lt;/code&amp;gt;). Geeklog will add these tables names (with the proper prefix) to the global &amp;lt;code&amp;gt;$_TABLES&amp;lt;/code&amp;gt; array during the install. The plugin will still have to make sure they are known after the install, e.g. by defining them in its &amp;lt;tt&amp;gt;functions.inc&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Finally, all these arrays are wrapped into another array and returned from the autoinstall function.&lt;br /&gt;
&lt;br /&gt;
With the exception of the &amp;lt;code&amp;gt;$info&amp;lt;/code&amp;gt; array, all of these arrays are optional. Plugins that don't create any groups or tables don't need to provide &amp;lt;code&amp;gt;$groups&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;$tables&amp;lt;/code&amp;gt; entries.&lt;br /&gt;
&lt;br /&gt;
In case of an error during the install, Geeklog will also use this information to attempt a cleanup of the database, i.e. remove groups, permissions, etc.&lt;br /&gt;
&lt;br /&gt;
'''Plugin dependencies and version control'''&lt;br /&gt;
&lt;br /&gt;
Since Geeklog 1.8.0, a new and optional array, $requires, is available. It must contain dependency information for a plugin.&lt;br /&gt;
You can make a requirement for a particular range of versions of Geeklog, databases and other plugins.&lt;br /&gt;
Each dependency is stored inside this array as another array.&lt;br /&gt;
&lt;br /&gt;
The minimal usage is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
    $requires= array(&lt;br /&gt;
        // This plugin requires another plugin, 'someplugin', and does not need a databases to function.&lt;br /&gt;
        array('plugin' =&amp;gt; 'someplugin')&lt;br /&gt;
    );&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
    $requires= array(&lt;br /&gt;
        // This plugin requires another plugin, 'someplugin', and supports MySQL and PgSQL databases.&lt;br /&gt;
        array('plugin' =&amp;gt; 'someplugin'),&lt;br /&gt;
        array('db' =&amp;gt; 'mysql'),&lt;br /&gt;
        array('db' =&amp;gt; 'pgsql')&lt;br /&gt;
    );&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can define any particular range of versions as the requirements for your plugin by adding the 'version' and 'operator' indeces to the arrays. Here's a more complex example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
    $requires= array(&lt;br /&gt;
        // This plugin requires a version greater than or equal to 1.0.0 of 'someplugin' (The default 'operator' is '&amp;gt;=')&lt;br /&gt;
        array('plugin' =&amp;gt; 'someplugin',&lt;br /&gt;
              'version' =&amp;gt; '1.0.0'),&lt;br /&gt;
&lt;br /&gt;
        // This plugin also requires a version greater than 1.0.0 of 'someotherplugin'&lt;br /&gt;
        array('plugin' =&amp;gt; 'someotherplugin',&lt;br /&gt;
              'version' =&amp;gt; '1.0.0',&lt;br /&gt;
              'operator' =&amp;gt; '&amp;gt;'),&lt;br /&gt;
&lt;br /&gt;
        // Multiple dependencies are allowed for the same parent plugin&lt;br /&gt;
        // The below line ensures that only 'someplugin' with version less than 2.0.0 is used&lt;br /&gt;
        array('plugin' =&amp;gt; 'someotherplugin',&lt;br /&gt;
              'version' =&amp;gt; '2.0.0',&lt;br /&gt;
              'operator' =&amp;gt; '&amp;lt;'),&lt;br /&gt;
&lt;br /&gt;
        // You can also require a particular range of versions of geeklog&lt;br /&gt;
        array('core' =&amp;gt; 'geeklog',&lt;br /&gt;
              'version' =&amp;gt; '1.8.0'),&lt;br /&gt;
&lt;br /&gt;
        // You must require either all or none of the databases that your plugin supports&lt;br /&gt;
        // Or you might lock out some of the capabilities of your plugin&lt;br /&gt;
        array('db' =&amp;gt; 'mysql'),&lt;br /&gt;
        array('db' =&amp;gt; 'mssql', 'version' =&amp;gt; '9.0'), // At least SQL Server 2005&lt;br /&gt;
        array('db' =&amp;gt; 'pgsql', 'version' =&amp;gt; '7.3', 'operator' =&amp;gt; '&amp;gt;')&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $inst_parms = array(&lt;br /&gt;
        'info'      =&amp;gt; $info,&lt;br /&gt;
        'groups'    =&amp;gt; $groups,&lt;br /&gt;
        'features'  =&amp;gt; $features,&lt;br /&gt;
        'mappings'  =&amp;gt; $mappings,&lt;br /&gt;
        'tables'    =&amp;gt; $tables,&lt;br /&gt;
        'requires'  =&amp;gt; $requires // Add the dependency information to the installation parameters here&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' Expect this function to be called more than once during installation. Also, the fact that the function is being called at all does not necessarily mean that the plugin will actually be installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== plugin_postinstall_ ==&lt;br /&gt;
&lt;br /&gt;
Geeklog, armed with the information provided by the &amp;lt;code&amp;gt;plugin_autoinstall_&amp;lt;/code&amp;gt; function, will take care of moving the plugin's files into their 3 standard locations, create the tables, the groups, and permissions. For any additional steps that need to be performed during installation, the &amp;lt;code&amp;gt;plugin_postinstall_&amp;lt;/code&amp;gt; function will be called:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function plugin_postinstall_foo($pi_name)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point, all the files are already in their correct place, the groups and permissions have been added and the plugin has been registered with Geeklog (i.e. has been added to the &amp;lt;tt&amp;gt;gl_plugins&amp;lt;/tt&amp;gt; table). However, the plugin has not been loaded yet, i.e. you can not rely on any of your plugin's functions being available.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== plugin_compatible_with_this_version_ ==&lt;br /&gt;
&lt;br /&gt;
The very first function from &amp;lt;tt&amp;gt;autoinstall.php&amp;lt;/tt&amp;gt; that Geeklog attempts to call is &amp;lt;code&amp;gt;plugin_compatible_with_this_version_&amp;lt;/code&amp;gt;. Here, the plugin can check if it's compatible with the current Geeklog version. Since this function was only introduced in Geeklog 1.6.0, you can assume this to be the minimum version.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function plugin_compatible_with_this_version_foo($pi_name)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The function should return &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; when the plugin requires a more recent Geeklog version. Return &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; if installation on the current Geeklog version is okay.&lt;br /&gt;
&lt;br /&gt;
If you would like to rely on Geeklog's &amp;quot;Plugin dependencies and version control&amp;quot; feature for ensuring that all required plugin are available, you must ensure that the user has at least version 1.8.0 of Geeklog. This can be accomplished with the following code snippet:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function plugin_compatible_with_this_version_foo($pi_name) {&lt;br /&gt;
   if (function_exists('PLG_resolveDependencies')) {&lt;br /&gt;
       return true;&lt;br /&gt;
   } else {&lt;br /&gt;
       COM_errorLog('Plugin &amp;quot;foo&amp;quot; requires at least Geeklog 1.8.0, but you are running an older version.');&lt;br /&gt;
       return false;&lt;br /&gt;
   }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== plugin_load_configuration_ ==&lt;br /&gt;
&lt;br /&gt;
This function only needs to be implemented by plugins that use the [[PluginConfiguration|Configuration GUI]]. A typical implementation would look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function plugin_load_configuration_foo($pi_name)&lt;br /&gt;
{&lt;br /&gt;
    global $_CONF;&lt;br /&gt;
&lt;br /&gt;
    $base_path = $_CONF['path'] . 'plugins/' . $pi_name . '/';&lt;br /&gt;
&lt;br /&gt;
    require_once $_CONF['path_system'] . 'classes/config.class.php';&lt;br /&gt;
    require_once $base_path . 'install_defaults.php';&lt;br /&gt;
&lt;br /&gt;
    return plugin_initconfig_foo();&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where the &amp;lt;code&amp;gt;plugin_initconfig_foo&amp;lt;/code&amp;gt; function is implemented in a &amp;lt;tt&amp;gt;install_defaults.php&amp;lt;/tt&amp;gt; file, that handles creation and updates of the plugin's config GUI elements.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Also see =&lt;br /&gt;
&lt;br /&gt;
* [[Plugin Auto-Uninstall]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Plugin Development]]&lt;/div&gt;</summary>
		<author><name>Roccivic</name></author>	</entry>

	<entry>
		<id>http://gwiki3.thatlinuxbox.com/index.php?title=OAuth&amp;diff=5978</id>
		<title>OAuth</title>
		<link rel="alternate" type="text/html" href="http://gwiki3.thatlinuxbox.com/index.php?title=OAuth&amp;diff=5978"/>
				<updated>2011-02-25T13:45:51Z</updated>
		
		<summary type="html">&lt;p&gt;Roccivic: /* OAuth Login Methods */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is OAuth? ==&lt;br /&gt;
&lt;br /&gt;
The idea behind OAuth is to get rid of the need to register separately with all the websites out there that require registration before you can use them. Instead of having to keep track of all the different accounts, you can use one login on every website that supports OAuth.&lt;br /&gt;
&lt;br /&gt;
To quote the [http://OAuth.net/ OAuth homepage]:&lt;br /&gt;
&lt;br /&gt;
:&amp;quot;An open protocol to allow secure API authorization in a simple and standard method from desktop and web applications.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
OAuth is a free and open protocol. It is not owned by any corporation.&lt;br /&gt;
&lt;br /&gt;
== OAuth in Geeklog ==&lt;br /&gt;
&lt;br /&gt;
OAuth support in Geeklog differs slightly from the [[Remote Authentication]] support, but only in that it requires a separate login prompt.&lt;br /&gt;
&lt;br /&gt;
To activate OAuth support there are several steps.&lt;br /&gt;
&lt;br /&gt;
First you must go to the Configuration Admin panel:&lt;br /&gt;
&lt;br /&gt;
: Configuration &amp;gt; Geeklog &amp;gt; Users and Submissions &amp;gt; Users &amp;gt; User Login Method[OAuth]&lt;br /&gt;
&lt;br /&gt;
Set this option to &amp;quot;true&amp;quot;. Just below this configuration option you will find the other OAuth settings. Currently Geeklog supports logging in via Facebook, LinkedIn and Twitter via OAuth. For each of these three login methods you will find an option to enable it and two text boxes for you to enter an Application Id and Application Secret Key (see below to find out how to get an Id and Secret Key). Each of these items needs to be filled out before the login button for it will be enabled. Once you have filled out the required information remember to then save the configuration changes.&lt;br /&gt;
&lt;br /&gt;
Other requirements needed to enable Geeklogs OAuth Login process is you must have the PHP extension OpenSSL loaded on your web server. &lt;br /&gt;
&lt;br /&gt;
When you log out, you will see one or more new login buttons in your site's User Functions block, below the normal login options:&lt;br /&gt;
&lt;br /&gt;
[[Image:OAuth-login.png|border]]&lt;br /&gt;
&lt;br /&gt;
The first time any user clicks on one of the OAuth login buttons they will be redirected to the website offering the OAuth login (Facebook, LinkedIn or Twitter). Here (if they are not currently logged into the website) they will be asked to login. Once logined they will then be asked if they wish to give permission to your Geeklog website to access some of your personal information. If the user approves the request they will then be redirected back to the Geeklog website which will then use the information to create a Geeklog user account and log them into the Geeklog website. If the user does not approve the request for information they will still be redirected back to the website but no Geeklog user account will be created.&lt;br /&gt;
&lt;br /&gt;
The next time the user logs into your Geeklog website using the same OAuth login method Geeklog will check with the website providing the OAuth login to see if you are logged in the site. If not the user will be redirected to the site to login. Once they have the site will the redirect back to your Geeklog website. &lt;br /&gt;
&lt;br /&gt;
When Geeklog uses OAuth to login it's users, it will never see your OAuth password - it will only get an &amp;quot;okay&amp;quot; back from the OAuth provider if you authenticated successfully.&lt;br /&gt;
&lt;br /&gt;
Once a user has logged in via OAuth, they are just like any other Geeklog user. They can be added to groups, change their profile, do whatever else you allow your users to do on your site. And yes, OAuth users can also be banned.&lt;br /&gt;
&lt;br /&gt;
Users that log in through OAuth are automatically added to the &amp;quot;Remote Users&amp;quot; group.&lt;br /&gt;
&lt;br /&gt;
=== Limitations ===&lt;br /&gt;
&lt;br /&gt;
* Currently, OAuth 1.0 is supported (OAuth 2.0 is still in development).&lt;br /&gt;
&lt;br /&gt;
== OAuth Login Methods ==&lt;br /&gt;
&lt;br /&gt;
General review...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Facebook ===&lt;br /&gt;
&lt;br /&gt;
Access Facebook 'Create an Application' page, and input form.&amp;lt;br&amp;gt;&lt;br /&gt;
http://developers.facebook.com/setup/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== LinkedIn ===&lt;br /&gt;
&lt;br /&gt;
Access LinkedIn 'List of Applications' page, and click 'Add New Application'.&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.linkedin.com/secure/developer&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Twitter ===&lt;br /&gt;
Access 'Applications Using Twitter' page and click 'Register a new application'.&amp;lt;br&amp;gt;&lt;br /&gt;
https://twitter.com/apps&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Application Type: Select 'Browser'&amp;lt;br&amp;gt;&lt;br /&gt;
Callback URL: Input URL same as Website&amp;lt;br&amp;gt;&lt;br /&gt;
Default Access type: Select 'Read &amp;amp; Write'&amp;lt;br&amp;gt;&lt;br /&gt;
Use Twitter for login: Check&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Further reading ==&lt;br /&gt;
&lt;br /&gt;
* [http://OAuth.net/ OAuth homepage]&lt;/div&gt;</summary>
		<author><name>Roccivic</name></author>	</entry>

	<entry>
		<id>http://gwiki3.thatlinuxbox.com/index.php?title=File:OAuth-login.png&amp;diff=5977</id>
		<title>File:OAuth-login.png</title>
		<link rel="alternate" type="text/html" href="http://gwiki3.thatlinuxbox.com/index.php?title=File:OAuth-login.png&amp;diff=5977"/>
				<updated>2011-02-24T00:04:57Z</updated>
		
		<summary type="html">&lt;p&gt;Roccivic: uploaded a new version of &amp;quot;Image:OAuth-login.png&amp;quot;: New OAuth buttons.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Shows the login screen when OAuth is enabled.&lt;/div&gt;</summary>
		<author><name>Roccivic</name></author>	</entry>

	<entry>
		<id>http://gwiki3.thatlinuxbox.com/index.php?title=OAuth&amp;diff=5961</id>
		<title>OAuth</title>
		<link rel="alternate" type="text/html" href="http://gwiki3.thatlinuxbox.com/index.php?title=OAuth&amp;diff=5961"/>
				<updated>2011-02-12T00:06:18Z</updated>
		
		<summary type="html">&lt;p&gt;Roccivic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is OAuth? ==&lt;br /&gt;
&lt;br /&gt;
The idea behind OAuth is to get rid of the need to register separately with all the websites out there that require registration before you can use them. Instead of having to keep track of all the different accounts, you can use one login on every website that supports OAuth.&lt;br /&gt;
&lt;br /&gt;
To quote the [http://OAuth.net/ OAuth homepage]:&lt;br /&gt;
&lt;br /&gt;
:&amp;quot;An open protocol to allow secure API authorization in a simple and standard method from desktop and web applications.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
OAuth is a free and open protocol. It is not owned by any corporation.&lt;br /&gt;
&lt;br /&gt;
== OAuth in Geeklog ==&lt;br /&gt;
&lt;br /&gt;
OAuth support in Geeklog differs slightly from the [[Remote Authentication]] support, but only in that it requires a separate login prompt.&lt;br /&gt;
&lt;br /&gt;
To activate OAuth support there are several steps.&lt;br /&gt;
&lt;br /&gt;
First you must go to the Configuration Admin panel:&lt;br /&gt;
&lt;br /&gt;
: Configuration &amp;gt; Geeklog &amp;gt; Users and Submissions &amp;gt; Users &amp;gt; User Login Method[OAuth]&lt;br /&gt;
&lt;br /&gt;
Set this option to &amp;quot;true&amp;quot;. Just below this configuration option you will find the other OAuth settings. Currently Geeklog supports logging in via Facebook, LinkedIn and Twitter via OAuth. For each of these three login methods you will find an option to enable it and two text boxes for you to enter an Application Id and Application Secret Key (see below to find out how to get an Id and Secret Key). Each of these items needs to be filled out before the login button for it will be enabled. Once you have filled out the required information remember to then save the configuration changes.&lt;br /&gt;
&lt;br /&gt;
Other requirements needed to enable Geeklogs OAuth Login process is you must have the PHP extension OpenSSL loaded on your web server. &lt;br /&gt;
&lt;br /&gt;
When you log out, you will see one or more new login buttons in your site's User Functions block, below the normal login options:&lt;br /&gt;
&lt;br /&gt;
[[Image:OAuth-login.png|border]]&lt;br /&gt;
&lt;br /&gt;
The first time any user clicks on one of the OAuth login buttons they will be redirected to the website offering the OAuth login (Facebook, LinkedIn or Twitter). Here (if they are not currently logged into the website) they will be asked to login. Once logined they will then be asked if they wish to give permission to your Geeklog website to access some of your personal information. If the user approves the request they will then be redirected back to the Geeklog website which will then use the information to create a Geeklog user account and log them into the Geeklog website. If the user does not approve the request for information they will still be redirected back to the website but no Geeklog user account will be created.&lt;br /&gt;
&lt;br /&gt;
The next time the user logs into your Geeklog website using the same OAuth login method Geeklog will check with the website providing the OAuth login to see if you are logged in the site. If not the user will be redirected to the site to login. Once they have the site will the redirect back to your Geeklog website. &lt;br /&gt;
&lt;br /&gt;
When Geeklog uses OAuth to login it's users, it will never see your OAuth password - it will only get an &amp;quot;okay&amp;quot; back from the OAuth provider if you authenticated successfully.&lt;br /&gt;
&lt;br /&gt;
Once a user has logged in via OAuth, they are just like any other Geeklog user. They can be added to groups, change their profile, do whatever else you allow your users to do on your site. And yes, OAuth users can also be banned.&lt;br /&gt;
&lt;br /&gt;
Users that log in through OAuth are automatically added to the &amp;quot;Remote Users&amp;quot; group.&lt;br /&gt;
&lt;br /&gt;
=== Limitations ===&lt;br /&gt;
&lt;br /&gt;
* Currently, OAuth 1.0 is supported (OAuth 2.0 is still in development).&lt;br /&gt;
&lt;br /&gt;
== OAuth Login Methods ==&lt;br /&gt;
&lt;br /&gt;
General review...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Facebook ===&lt;br /&gt;
&lt;br /&gt;
Access Facebook 'Create an Application' page, and input form.&lt;br /&gt;
http://developers.facebook.com/setup/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== LinkedIn ===&lt;br /&gt;
&lt;br /&gt;
Access LinkedIn 'List of Applications' page, and click 'Add New Application'.&lt;br /&gt;
https://www.linkedin.com/secure/developer&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Twitter ===&lt;br /&gt;
Access 'Applications Using Twitter' page and click 'Register a new application »'.&lt;br /&gt;
https://twitter.com/apps&lt;br /&gt;
&lt;br /&gt;
Application Type: Select 'Browser'&lt;br /&gt;
Callback URL: Input URL same as Website&lt;br /&gt;
Default Access type: Select 'Read &amp;amp; Write'&lt;br /&gt;
Use Twitter for login: Check&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Further reading ==&lt;br /&gt;
&lt;br /&gt;
* [http://OAuth.net/ OAuth homepage]&lt;/div&gt;</summary>
		<author><name>Roccivic</name></author>	</entry>

	<entry>
		<id>http://gwiki3.thatlinuxbox.com/index.php?title=File:OAuth-login.png&amp;diff=5960</id>
		<title>File:OAuth-login.png</title>
		<link rel="alternate" type="text/html" href="http://gwiki3.thatlinuxbox.com/index.php?title=File:OAuth-login.png&amp;diff=5960"/>
				<updated>2011-02-11T23:54:05Z</updated>
		
		<summary type="html">&lt;p&gt;Roccivic: Shows the login screen when OAuth is enabled.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Shows the login screen when OAuth is enabled.&lt;/div&gt;</summary>
		<author><name>Roccivic</name></author>	</entry>

	<entry>
		<id>http://gwiki3.thatlinuxbox.com/index.php?title=Plugin_Autoinstall&amp;diff=5951</id>
		<title>Plugin Autoinstall</title>
		<link rel="alternate" type="text/html" href="http://gwiki3.thatlinuxbox.com/index.php?title=Plugin_Autoinstall&amp;diff=5951"/>
				<updated>2011-02-06T14:40:06Z</updated>
		
		<summary type="html">&lt;p&gt;Roccivic: better code snippet&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
Geeklog 1.6 brings two important changes regarding installation of plugins:&lt;br /&gt;
&lt;br /&gt;
* Plugins can be installed by uploading their tarball (from Geeklog's Plugins Admin panel)&lt;br /&gt;
* Plugins can be bundled / unbundled by simply adding / removing their respective directories to / from the Geeklog tarball&lt;br /&gt;
&lt;br /&gt;
In both of these scenarios, Geeklog needs a way to automatically run the install procedure for such a plugin.&lt;br /&gt;
&lt;br /&gt;
The problem with the plugin install scripts used until now are that they were mainly aimed at being run by a human and that they also check permissions that simply may not be set when the install is done (e.g. when running Geeklog's install script).&lt;br /&gt;
&lt;br /&gt;
The solution proposed here is the inclusion of a new file, &amp;lt;tt&amp;gt;autoinstall.php&amp;lt;/tt&amp;gt; into every plugin that implements up to 4 new API functions (3 of which are optional).&lt;br /&gt;
&lt;br /&gt;
= autoinstall.php =&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;tt&amp;gt;autoinstall.php&amp;lt;/tt&amp;gt; is to be located in the plugin's main directory, i.e. in the same directory as its &amp;lt;tt&amp;gt;functions.inc&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/path/to/geeklog/plugins/&lt;br /&gt;
                         foo/&lt;br /&gt;
                             functions.inc&lt;br /&gt;
                             autoinstall.php&lt;br /&gt;
                         staticpages/&lt;br /&gt;
                             functions.inc&lt;br /&gt;
                             autoinstall.php&lt;br /&gt;
                         ...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plugins that ship with an &amp;lt;tt&amp;gt;autoinstall.php&amp;lt;/tt&amp;gt; file won't need to provide the &amp;quot;traditional&amp;quot; install script (&amp;lt;tt&amp;gt;admin/plugins/foo/install.php&amp;lt;/tt&amp;gt;) unless they want to be backward-compatible with Geeklog releases prior to 1.6.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== plugin_autoinstall_ ==&lt;br /&gt;
&lt;br /&gt;
This is the most important and mandatory API function to implement in &amp;lt;tt&amp;gt;autoinstall.php&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function plugin_autoinstall_foo($pi_name)&lt;br /&gt;
{&lt;br /&gt;
    $pi_name         = 'foo';&lt;br /&gt;
    $pi_display_name = 'Foo';&lt;br /&gt;
    $pi_admin        = $pi_display_name . ' Admin';&lt;br /&gt;
&lt;br /&gt;
    $info = array(&lt;br /&gt;
        'pi_name'         =&amp;gt; $pi_name,&lt;br /&gt;
        'pi_display_name' =&amp;gt; $pi_display_name,&lt;br /&gt;
        'pi_version'      =&amp;gt; '1.0.0',&lt;br /&gt;
        'pi_gl_version'   =&amp;gt; '1.6.0',&lt;br /&gt;
        'pi_homepage'     =&amp;gt; 'http://www.example.com/'&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $groups = array(&lt;br /&gt;
        $pi_admin =&amp;gt; 'Has full access to ' . $pi_display_name . ' features'&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $features = array(&lt;br /&gt;
        $pi_name . '.edit'      =&amp;gt; 'Access to ' . $pi_display_name . ' editor'&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $mappings = array(&lt;br /&gt;
        $pi_name . '.edit'      =&amp;gt; array($pi_admin)&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $tables = array(&lt;br /&gt;
        'foo'&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $inst_parms = array(&lt;br /&gt;
        'info'      =&amp;gt; $info,&lt;br /&gt;
        'groups'    =&amp;gt; $groups,&lt;br /&gt;
        'features'  =&amp;gt; $features,&lt;br /&gt;
        'mappings'  =&amp;gt; $mappings,&lt;br /&gt;
        'tables'    =&amp;gt; $tables&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    return $inst_parms;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you've written a Geeklog plugin before, the data provided by this function should look familiar.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;$info&amp;lt;/code&amp;gt; array provides the information that goes into the plugin's entry in the &amp;lt;tt&amp;gt;gl_plugins&amp;lt;/tt&amp;gt; table. The only addition here is the &amp;lt;code&amp;gt;$pi_display_name&amp;lt;/code&amp;gt; entry, so that we can use a nicely formatted name to present to the user instead of having to refer to the plugin by its internal and possibly abbreviated name (&amp;lt;code&amp;gt;$pi_name&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$groups&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;$features&amp;lt;/code&amp;gt; simply list all the groups and features (permissions) that the plugin would like to introduce. Geeklog will create those automatically for the plugin, using the &amp;lt;code&amp;gt;$mappings&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;$mappings&amp;lt;/code&amp;gt; defines which permissions to assign to which of the new groups.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;$tables&amp;lt;/code&amp;gt; array obviously lists all the table names used by the plugin (note that the names are given without the &amp;lt;code&amp;gt;$_DB_table_prefix&amp;lt;/code&amp;gt;). Geeklog will add these tables names (with the proper prefix) to the global &amp;lt;code&amp;gt;$_TABLES&amp;lt;/code&amp;gt; array during the install. The plugin will still have to make sure they are known after the install, e.g. by defining them in its &amp;lt;tt&amp;gt;functions.inc&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
'''Plugin dependencies and version control'''&lt;br /&gt;
&lt;br /&gt;
Since Geeklog 1.8.0, a new and optional array, $requires, that can contain dependency information for a plugin. Each dependency is stored inside this array as another array. Here's an example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
    $requires= array(&lt;br /&gt;
        // This plugin requires a version greater than 1.0.0 of 'someplugin'&lt;br /&gt;
        array('name' =&amp;gt; 'someplugin', 'version' =&amp;gt; '1.0.0', 'operator' =&amp;gt; '&amp;gt;'),&lt;br /&gt;
&lt;br /&gt;
        // The default 'operator' is '&amp;gt;='&lt;br /&gt;
        // This plugin also requires a version greater than or equal to 1.0.0 of 'someotherplugin'&lt;br /&gt;
        array('name' =&amp;gt; 'someotherplugin', 'version' =&amp;gt; '1.0.0'),&lt;br /&gt;
&lt;br /&gt;
        // Multiple dependencies are allowed for the same parent plugin&lt;br /&gt;
        // The below line ensures that only 'someplugin' with version less than 2.0.0 is used&lt;br /&gt;
        array('name' =&amp;gt; 'someotherplugin', 'version' =&amp;gt; '2.0.0', 'operator' =&amp;gt; '&amp;lt;')&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $inst_parms = array(&lt;br /&gt;
        'info'      =&amp;gt; $info,&lt;br /&gt;
        'groups'    =&amp;gt; $groups,&lt;br /&gt;
        'features'  =&amp;gt; $features,&lt;br /&gt;
        'mappings'  =&amp;gt; $mappings,&lt;br /&gt;
        'tables'    =&amp;gt; $tables,&lt;br /&gt;
        'requires'  =&amp;gt; $requires&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, all these arrays are wrapped into another array and returned from the autoinstall function.&lt;br /&gt;
&lt;br /&gt;
With the exception of the &amp;lt;code&amp;gt;$info&amp;lt;/code&amp;gt; array, all of these arrays are optional. Plugins that don't create any groups or tables don't need to provide &amp;lt;code&amp;gt;$groups&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;$tables&amp;lt;/code&amp;gt; entries.&lt;br /&gt;
&lt;br /&gt;
In case of an error during the install, Geeklog will also use this information to attempt a cleanup of the database, i.e. remove groups, permissions, etc.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' Expect this function to be called more than once during installation. Also, the fact that the function is being called at all does not necessarily mean that the plugin will actually be installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== plugin_postinstall_ ==&lt;br /&gt;
&lt;br /&gt;
Geeklog, armed with the information provided by the &amp;lt;code&amp;gt;plugin_autoinstall_&amp;lt;/code&amp;gt; function, will take care of moving the plugin's files into their 3 standard locations, create the tables, the groups, and permissions. For any additional steps that need to be performed during installation, the &amp;lt;code&amp;gt;plugin_postinstall_&amp;lt;/code&amp;gt; function will be called:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function plugin_postinstall_foo($pi_name)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point, all the files are already in their correct place, the groups and permissions have been added and the plugin has been registered with Geeklog (i.e. has been added to the &amp;lt;tt&amp;gt;gl_plugins&amp;lt;/tt&amp;gt; table). However, the plugin has not been loaded yet, i.e. you can not rely on any of your plugin's functions being available.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== plugin_compatible_with_this_version_ ==&lt;br /&gt;
&lt;br /&gt;
The very first function from &amp;lt;tt&amp;gt;autoinstall.php&amp;lt;/tt&amp;gt; that Geeklog attempts to call is &amp;lt;code&amp;gt;plugin_compatible_with_this_version_&amp;lt;/code&amp;gt;. Here, the plugin can check if it's compatible with the current Geeklog version. Since this function was only introduced in Geeklog 1.6.0, you can assume this to be the minimum version.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function plugin_compatible_with_this_version_foo($pi_name)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The function should return &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; when the plugin requires a more recent Geeklog version. Return &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; if installation on the current Geeklog version is okay.&lt;br /&gt;
&lt;br /&gt;
If you would like to rely on Geeklog's &amp;quot;Plugin dependencies and version control&amp;quot; feature for ensuring that all required plugin are available, you must ensure that the user has at least version 1.8.0 of Geeklog. This can be accomplished with the following code snippet:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function plugin_compatible_with_this_version_foo($pi_name) {&lt;br /&gt;
   if (function_exists('PLG_resolveDependencies')) {&lt;br /&gt;
       return true;&lt;br /&gt;
   } else {&lt;br /&gt;
       COM_errorLog('Plugin &amp;quot;foo&amp;quot; requires at least Geeklog 1.8.0, but you are running an older version.');&lt;br /&gt;
       return false;&lt;br /&gt;
   }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== plugin_load_configuration_ ==&lt;br /&gt;
&lt;br /&gt;
This function only needs to be implemented by plugins that use the [[PluginConfiguration|Configuration GUI]]. A typical implementation would look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function plugin_load_configuration_foo($pi_name)&lt;br /&gt;
{&lt;br /&gt;
    global $_CONF;&lt;br /&gt;
&lt;br /&gt;
    $base_path = $_CONF['path'] . 'plugins/' . $pi_name . '/';&lt;br /&gt;
&lt;br /&gt;
    require_once $_CONF['path_system'] . 'classes/config.class.php';&lt;br /&gt;
    require_once $base_path . 'install_defaults.php';&lt;br /&gt;
&lt;br /&gt;
    return plugin_initconfig_foo();&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where the &amp;lt;code&amp;gt;plugin_initconfig_foo&amp;lt;/code&amp;gt; function is implemented in a &amp;lt;tt&amp;gt;install_defaults.php&amp;lt;/tt&amp;gt; file, that handles creation and updates of the plugin's config GUI elements.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Also see =&lt;br /&gt;
&lt;br /&gt;
* [[Plugin Auto-Uninstall]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Plugin Development]]&lt;/div&gt;</summary>
		<author><name>Roccivic</name></author>	</entry>

	<entry>
		<id>http://gwiki3.thatlinuxbox.com/index.php?title=Plugin_Autoinstall&amp;diff=5950</id>
		<title>Plugin Autoinstall</title>
		<link rel="alternate" type="text/html" href="http://gwiki3.thatlinuxbox.com/index.php?title=Plugin_Autoinstall&amp;diff=5950"/>
				<updated>2011-02-06T14:39:02Z</updated>
		
		<summary type="html">&lt;p&gt;Roccivic: Added &amp;quot;Plugin dependencies and version control&amp;quot; feature information&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
Geeklog 1.6 brings two important changes regarding installation of plugins:&lt;br /&gt;
&lt;br /&gt;
* Plugins can be installed by uploading their tarball (from Geeklog's Plugins Admin panel)&lt;br /&gt;
* Plugins can be bundled / unbundled by simply adding / removing their respective directories to / from the Geeklog tarball&lt;br /&gt;
&lt;br /&gt;
In both of these scenarios, Geeklog needs a way to automatically run the install procedure for such a plugin.&lt;br /&gt;
&lt;br /&gt;
The problem with the plugin install scripts used until now are that they were mainly aimed at being run by a human and that they also check permissions that simply may not be set when the install is done (e.g. when running Geeklog's install script).&lt;br /&gt;
&lt;br /&gt;
The solution proposed here is the inclusion of a new file, &amp;lt;tt&amp;gt;autoinstall.php&amp;lt;/tt&amp;gt; into every plugin that implements up to 4 new API functions (3 of which are optional).&lt;br /&gt;
&lt;br /&gt;
= autoinstall.php =&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;tt&amp;gt;autoinstall.php&amp;lt;/tt&amp;gt; is to be located in the plugin's main directory, i.e. in the same directory as its &amp;lt;tt&amp;gt;functions.inc&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/path/to/geeklog/plugins/&lt;br /&gt;
                         foo/&lt;br /&gt;
                             functions.inc&lt;br /&gt;
                             autoinstall.php&lt;br /&gt;
                         staticpages/&lt;br /&gt;
                             functions.inc&lt;br /&gt;
                             autoinstall.php&lt;br /&gt;
                         ...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plugins that ship with an &amp;lt;tt&amp;gt;autoinstall.php&amp;lt;/tt&amp;gt; file won't need to provide the &amp;quot;traditional&amp;quot; install script (&amp;lt;tt&amp;gt;admin/plugins/foo/install.php&amp;lt;/tt&amp;gt;) unless they want to be backward-compatible with Geeklog releases prior to 1.6.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== plugin_autoinstall_ ==&lt;br /&gt;
&lt;br /&gt;
This is the most important and mandatory API function to implement in &amp;lt;tt&amp;gt;autoinstall.php&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function plugin_autoinstall_foo($pi_name)&lt;br /&gt;
{&lt;br /&gt;
    $pi_name         = 'foo';&lt;br /&gt;
    $pi_display_name = 'Foo';&lt;br /&gt;
    $pi_admin        = $pi_display_name . ' Admin';&lt;br /&gt;
&lt;br /&gt;
    $info = array(&lt;br /&gt;
        'pi_name'         =&amp;gt; $pi_name,&lt;br /&gt;
        'pi_display_name' =&amp;gt; $pi_display_name,&lt;br /&gt;
        'pi_version'      =&amp;gt; '1.0.0',&lt;br /&gt;
        'pi_gl_version'   =&amp;gt; '1.6.0',&lt;br /&gt;
        'pi_homepage'     =&amp;gt; 'http://www.example.com/'&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $groups = array(&lt;br /&gt;
        $pi_admin =&amp;gt; 'Has full access to ' . $pi_display_name . ' features'&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $features = array(&lt;br /&gt;
        $pi_name . '.edit'      =&amp;gt; 'Access to ' . $pi_display_name . ' editor'&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $mappings = array(&lt;br /&gt;
        $pi_name . '.edit'      =&amp;gt; array($pi_admin)&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $tables = array(&lt;br /&gt;
        'foo'&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $inst_parms = array(&lt;br /&gt;
        'info'      =&amp;gt; $info,&lt;br /&gt;
        'groups'    =&amp;gt; $groups,&lt;br /&gt;
        'features'  =&amp;gt; $features,&lt;br /&gt;
        'mappings'  =&amp;gt; $mappings,&lt;br /&gt;
        'tables'    =&amp;gt; $tables&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    return $inst_parms;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you've written a Geeklog plugin before, the data provided by this function should look familiar.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;$info&amp;lt;/code&amp;gt; array provides the information that goes into the plugin's entry in the &amp;lt;tt&amp;gt;gl_plugins&amp;lt;/tt&amp;gt; table. The only addition here is the &amp;lt;code&amp;gt;$pi_display_name&amp;lt;/code&amp;gt; entry, so that we can use a nicely formatted name to present to the user instead of having to refer to the plugin by its internal and possibly abbreviated name (&amp;lt;code&amp;gt;$pi_name&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$groups&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;$features&amp;lt;/code&amp;gt; simply list all the groups and features (permissions) that the plugin would like to introduce. Geeklog will create those automatically for the plugin, using the &amp;lt;code&amp;gt;$mappings&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;$mappings&amp;lt;/code&amp;gt; defines which permissions to assign to which of the new groups.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;$tables&amp;lt;/code&amp;gt; array obviously lists all the table names used by the plugin (note that the names are given without the &amp;lt;code&amp;gt;$_DB_table_prefix&amp;lt;/code&amp;gt;). Geeklog will add these tables names (with the proper prefix) to the global &amp;lt;code&amp;gt;$_TABLES&amp;lt;/code&amp;gt; array during the install. The plugin will still have to make sure they are known after the install, e.g. by defining them in its &amp;lt;tt&amp;gt;functions.inc&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
'''Plugin dependencies and version control'''&lt;br /&gt;
&lt;br /&gt;
Since Geeklog 1.8.0, a new and optional array, $requires, that can contain dependency information for a plugin. Each dependency is stored inside this array as another array. Here's an example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
    $requires= array(&lt;br /&gt;
        // This plugin requires a version greater than 1.0.0 of 'someplugin'&lt;br /&gt;
        array('name' =&amp;gt; 'someplugin', 'version' =&amp;gt; '1.0.0', 'operator' =&amp;gt; '&amp;gt;'),&lt;br /&gt;
&lt;br /&gt;
        // The default 'operator' is '&amp;gt;='&lt;br /&gt;
        // This plugin also requires a version greater than or equal to 1.0.0 of 'someotherplugin'&lt;br /&gt;
        array('name' =&amp;gt; 'someotherplugin', 'version' =&amp;gt; '1.0.0'),&lt;br /&gt;
&lt;br /&gt;
        // Multiple dependencies are allowed for the same parent plugin&lt;br /&gt;
        // The below line ensures that only 'someplugin' with version less than 2.0.0 is used&lt;br /&gt;
        array('name' =&amp;gt; 'someotherplugin', 'version' =&amp;gt; '2.0.0', 'operator' =&amp;gt; '&amp;lt;')&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    $inst_parms = array(&lt;br /&gt;
        'info'      =&amp;gt; $info,&lt;br /&gt;
        'groups'    =&amp;gt; $groups,&lt;br /&gt;
        'features'  =&amp;gt; $features,&lt;br /&gt;
        'mappings'  =&amp;gt; $mappings,&lt;br /&gt;
        'tables'    =&amp;gt; $tables,&lt;br /&gt;
        'requires'  =&amp;gt; $requires&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, all these arrays are wrapped into another array and returned from the autoinstall function.&lt;br /&gt;
&lt;br /&gt;
With the exception of the &amp;lt;code&amp;gt;$info&amp;lt;/code&amp;gt; array, all of these arrays are optional. Plugins that don't create any groups or tables don't need to provide &amp;lt;code&amp;gt;$groups&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;$tables&amp;lt;/code&amp;gt; entries.&lt;br /&gt;
&lt;br /&gt;
In case of an error during the install, Geeklog will also use this information to attempt a cleanup of the database, i.e. remove groups, permissions, etc.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' Expect this function to be called more than once during installation. Also, the fact that the function is being called at all does not necessarily mean that the plugin will actually be installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== plugin_postinstall_ ==&lt;br /&gt;
&lt;br /&gt;
Geeklog, armed with the information provided by the &amp;lt;code&amp;gt;plugin_autoinstall_&amp;lt;/code&amp;gt; function, will take care of moving the plugin's files into their 3 standard locations, create the tables, the groups, and permissions. For any additional steps that need to be performed during installation, the &amp;lt;code&amp;gt;plugin_postinstall_&amp;lt;/code&amp;gt; function will be called:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function plugin_postinstall_foo($pi_name)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point, all the files are already in their correct place, the groups and permissions have been added and the plugin has been registered with Geeklog (i.e. has been added to the &amp;lt;tt&amp;gt;gl_plugins&amp;lt;/tt&amp;gt; table). However, the plugin has not been loaded yet, i.e. you can not rely on any of your plugin's functions being available.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== plugin_compatible_with_this_version_ ==&lt;br /&gt;
&lt;br /&gt;
The very first function from &amp;lt;tt&amp;gt;autoinstall.php&amp;lt;/tt&amp;gt; that Geeklog attempts to call is &amp;lt;code&amp;gt;plugin_compatible_with_this_version_&amp;lt;/code&amp;gt;. Here, the plugin can check if it's compatible with the current Geeklog version. Since this function was only introduced in Geeklog 1.6.0, you can assume this to be the minimum version.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function plugin_compatible_with_this_version_foo($pi_name)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The function should return &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; when the plugin requires a more recent Geeklog version. Return &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; if installation on the current Geeklog version is okay.&lt;br /&gt;
&lt;br /&gt;
If you would like to rely on Geeklog's &amp;quot;Plugin dependencies and version control&amp;quot; feature for ensuring that all required plugin are available, you must ensure that the user has at least version 1.8.0 of Geeklog. This can be accomplished with the following code snippet:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function plugin_compatible_with_this_version_foo($pi_name) {&lt;br /&gt;
   if (!function_exists('PLG_resolveDependencies')) {&lt;br /&gt;
       COM_errorLog('Plugin &amp;quot;foo&amp;quot; requires at least Geeklog 1.8.0, but you are running an older version.');&lt;br /&gt;
       return false;&lt;br /&gt;
   } else {&lt;br /&gt;
       return true;&lt;br /&gt;
   }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== plugin_load_configuration_ ==&lt;br /&gt;
&lt;br /&gt;
This function only needs to be implemented by plugins that use the [[PluginConfiguration|Configuration GUI]]. A typical implementation would look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function plugin_load_configuration_foo($pi_name)&lt;br /&gt;
{&lt;br /&gt;
    global $_CONF;&lt;br /&gt;
&lt;br /&gt;
    $base_path = $_CONF['path'] . 'plugins/' . $pi_name . '/';&lt;br /&gt;
&lt;br /&gt;
    require_once $_CONF['path_system'] . 'classes/config.class.php';&lt;br /&gt;
    require_once $base_path . 'install_defaults.php';&lt;br /&gt;
&lt;br /&gt;
    return plugin_initconfig_foo();&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where the &amp;lt;code&amp;gt;plugin_initconfig_foo&amp;lt;/code&amp;gt; function is implemented in a &amp;lt;tt&amp;gt;install_defaults.php&amp;lt;/tt&amp;gt; file, that handles creation and updates of the plugin's config GUI elements.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Also see =&lt;br /&gt;
&lt;br /&gt;
* [[Plugin Auto-Uninstall]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Plugin Development]]&lt;/div&gt;</summary>
		<author><name>Roccivic</name></author>	</entry>

	</feed>