mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 20:58:30 +01:00
More plugin-class tweaks, Support for {plugin}_setup.php file added. TinyMce default settings added after install. plugin.xml spec modified for language files and management.
This commit is contained in:
parent
171e65fea3
commit
5656cce43d
@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/plugin.php,v $
|
||||
| $Revision: 1.48 $
|
||||
| $Date: 2009-09-28 07:17:52 $
|
||||
| $Revision: 1.49 $
|
||||
| $Date: 2009-10-20 03:49:12 $
|
||||
| $Author: e107coders $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -438,7 +438,7 @@ class pluginManager{
|
||||
function pluginInstall()
|
||||
{
|
||||
global $plugin,$admin_log,$eplug_folder;
|
||||
$text = $plugin->install_plugin($this->id);
|
||||
$text = $plugin->install_plugin($this->id);
|
||||
if ($text === FALSE)
|
||||
{ // Tidy this up
|
||||
$this->show_message("Error messages above this line", E_MESSAGE_ERROR);
|
||||
@ -446,7 +446,6 @@ class pluginManager{
|
||||
else
|
||||
{
|
||||
$plugin ->save_addon_prefs();
|
||||
// if($eplug_conffile){ $text .= " <a href='".e_PLUGIN."$eplug_folder/$eplug_conffile'>[".LAN_CONFIGURE."]</a>"; }
|
||||
$admin_log->log_event('PLUGMAN_01', $this->id.':'.$eplug_folder, E_LOG_INFORMATIVE, '');
|
||||
$this->show_message($text, E_MESSAGE_SUCCESS);
|
||||
}
|
||||
|
@ -9,9 +9,9 @@
|
||||
* e107 Main
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/e107_class.php,v $
|
||||
* $Revision: 1.54 $
|
||||
* $Date: 2009-10-09 10:18:07 $
|
||||
* $Author: secretr $
|
||||
* $Revision: 1.55 $
|
||||
* $Date: 2009-10-20 03:49:12 $
|
||||
* $Author: e107coders $
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
@ -1159,10 +1159,12 @@ class e107
|
||||
if($NEWSIMAGES_DIRECTORY)
|
||||
{
|
||||
define("e_NEWSIMAGE", e_BASE.$NEWSIMAGES_DIRECTORY);
|
||||
define("e_NEWSIMAGE_ABS", e_HTTP.$NEWSIMAGES_DIRECTORY);
|
||||
}
|
||||
else
|
||||
{
|
||||
define("e_NEWSIMAGE", e_IMAGE."newspost_images/");
|
||||
define("e_NEWSIMAGE_ABS", e_HTTP.$IMAGES_DIRECTORY."newspost_images/");
|
||||
}
|
||||
|
||||
if($CUSTIMAGES_DIRECTORY)
|
||||
|
@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $
|
||||
| $Revision: 1.101 $
|
||||
| $Date: 2009-10-09 18:58:12 $
|
||||
| $Revision: 1.102 $
|
||||
| $Date: 2009-10-20 03:49:12 $
|
||||
| $Author: e107coders $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -97,8 +97,10 @@ class e107plugin
|
||||
var $current_plug;
|
||||
var $parsed_plugin;
|
||||
var $plugFolder;
|
||||
var $plugConfigFile;
|
||||
var $unInstallOpts;
|
||||
var $module = array();
|
||||
|
||||
|
||||
function e107plugin()
|
||||
{
|
||||
@ -938,11 +940,17 @@ class e107plugin
|
||||
$canContinue = FALSE;
|
||||
}
|
||||
|
||||
// First of all, see if there's a language file specific to install
|
||||
if(varset($plug_vars['languageFiles']))
|
||||
{
|
||||
$this->XmlLanguageFiles($function,$plug_vars['languageFiles'],'pre'); // First of all, see if there's a language file specific to install
|
||||
}
|
||||
|
||||
/* // DEPRECATED
|
||||
if (isset($plug_vars['installLanguageFile']) && isset($plug_vars['installLanguageFile']['@attributes']['filename']))
|
||||
{
|
||||
include_lan($path.str_replace('--LAN--',e_LANGUAGE, $plug_vars['installLanguageFile']['@attributes']['filename']));
|
||||
}
|
||||
*/
|
||||
|
||||
// Next most important, if installing or upgrading, check that any dependencies are met
|
||||
if ($canContinue && ($function != 'uninstall') && isset($plug_vars['dependencies']))
|
||||
@ -974,10 +982,12 @@ class e107plugin
|
||||
$tableList = $dbHandler->get_table_def('',$path.$sqlFile);
|
||||
if (!is_array($tableList))
|
||||
{
|
||||
$emessage->add("Can\'t read SQL definition: ".$path.$sqlFile,E_MESSAGE_ERROR);
|
||||
$emessage->add("Can't read SQL definition: ".$path.$sqlFile,E_MESSAGE_ERROR);
|
||||
break;
|
||||
}
|
||||
// Got the required definition here
|
||||
|
||||
|
||||
foreach ($tableList as $ct)
|
||||
{ // Process one table at a time (but they could be multi-language)
|
||||
switch($function)
|
||||
@ -1016,7 +1026,13 @@ class e107plugin
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(varset($plug_vars['adminLinks']))
|
||||
{
|
||||
$this->XmlAdminLinks($function,$plug_vars['adminLinks']);
|
||||
}
|
||||
|
||||
|
||||
if(varset($plug_vars['siteLinks']))
|
||||
{
|
||||
@ -1043,9 +1059,9 @@ class e107plugin
|
||||
$this->XmlExtendedFields($function,$plug_vars['extendedFields']);
|
||||
}
|
||||
|
||||
if(varset($plug_vars['logLanguageFile']))
|
||||
if(varset($plug_vars['languageFiles']))
|
||||
{
|
||||
$this->XmlLogLanguageFile($function,$plug_vars['logLanguageFile']);
|
||||
$this->XmlLanguageFiles($function,$plug_vars['languageFiles']);
|
||||
}
|
||||
|
||||
$this->manage_icons($this->plugFolder,$function);
|
||||
@ -1062,13 +1078,6 @@ class e107plugin
|
||||
$this->manage_search($function, $plug_vars['folder']);
|
||||
$this->manage_notify($function, $plug_vars['folder']);
|
||||
|
||||
if ($canContinue)
|
||||
{ // Let's call any custom post functions defined in <management> section
|
||||
$ret = $this->execute_function($path, $function, 'post');
|
||||
if (!is_bool($ret)) $txt .= $ret;
|
||||
}
|
||||
|
||||
|
||||
$eplug_addons = $this->getAddons($plug['plugin_path']);
|
||||
|
||||
$p_installed = e107::getPref('plug_installed',array()); // load preference;
|
||||
@ -1093,17 +1102,35 @@ class e107plugin
|
||||
|
||||
e107::getConfig('core')->save();
|
||||
|
||||
if($function == 'install')
|
||||
/* if($function == 'install')
|
||||
{
|
||||
$txt .= LAN_INSTALL_SUCCESSFUL."<br />";
|
||||
if(isset($plug_vars['management']['installDone'][0]))
|
||||
{
|
||||
$emessage->add($plug_vars['management']['installDone'][0], E_MESSAGE_SUCCESS);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
if(!$this->execute_function($path, $function, 'post')) // Call any custom post functions defined in <plugin>_setup.php or the deprecated <management> section
|
||||
{
|
||||
if($function == 'install')
|
||||
{
|
||||
$text = "Installation Complete.";
|
||||
|
||||
if($this->plugConfigFile)
|
||||
{
|
||||
$text .= " <a href='".$this->plugConfigFile."'>[".LAN_CONFIGURE."]</a>";
|
||||
}
|
||||
|
||||
// return $txt;
|
||||
$emessage->add($text, E_MESSAGE_SUCCESS);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Process XML Tag <dependencies> (deprecated 'depend' which is a brand of adult diapers)
|
||||
@ -1177,31 +1204,53 @@ class e107plugin
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Process XML Tag <logLanguageFile>
|
||||
* Process XML Tag <LanguageFiles>
|
||||
* @param object $function
|
||||
* @param object $tag
|
||||
* @return
|
||||
*/
|
||||
function XmlLogLanguageFile($function,$tag)
|
||||
function XmlLanguageFiles($function,$tag,$when='')
|
||||
{
|
||||
$core = e107::getConfig('core');
|
||||
|
||||
switch ($function)
|
||||
{
|
||||
case 'install' :
|
||||
case 'upgrade' :
|
||||
case 'refresh' :
|
||||
$core->setPref('logLanguageFile/'.$this->plugFolder,$tag['@attributes']['filename']);
|
||||
break;
|
||||
case 'uninstall' :
|
||||
$core->removePref('logLanguageFile/'.$this->plugFolder);
|
||||
break;
|
||||
}
|
||||
|
||||
foreach($tag['file'] as $val)
|
||||
{
|
||||
$att = $val['@attributes'];
|
||||
|
||||
if($when == 'pre') // just check for install language file BEFORE install.
|
||||
{
|
||||
if($att['type']=='install')
|
||||
{
|
||||
$file = str_replace('--LAN--',e_LANGUAGE, $att['path']);
|
||||
$fullpath_file = e_PLUGIN.$this->plugFolder."/".$file;
|
||||
include_lan($fullpath_file);
|
||||
return;
|
||||
}
|
||||
}
|
||||
elseif($att['type']=='log')
|
||||
{
|
||||
switch ($function)
|
||||
{
|
||||
case 'install' :
|
||||
case 'upgrade' :
|
||||
case 'refresh' :
|
||||
$core->setPref('logLanguageFile/'.$this->plugFolder,$att['path']);
|
||||
break;
|
||||
case 'uninstall' :
|
||||
$core->removePref('logLanguageFile/'.$this->plugFolder);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -1219,7 +1268,7 @@ class e107plugin
|
||||
$attrib = $link['@attributes'];
|
||||
$linkName = (defset($link['@value'])) ? constant($link['@value']) : $link['@value'];
|
||||
$remove = (varset($attrib['deprecate']) == 'true') ? TRUE : FALSE;
|
||||
$url = e_PLUGIN.$attrib['url'];;
|
||||
$url = e_PLUGIN.$attrib['url']; //TODO should also handle links to the root directory. (eg. /news.php)
|
||||
$perm = (isset($attrib['perm']) ? $attrib['perm'] : 0);
|
||||
|
||||
switch($function)
|
||||
@ -1256,9 +1305,18 @@ class e107plugin
|
||||
* Process XML Tag <adminLinks>
|
||||
* @return
|
||||
*/
|
||||
function XmlAdminLinks()
|
||||
function XmlAdminLinks($function,$tag)
|
||||
{
|
||||
//TODO
|
||||
foreach($tag['link'] as $link)
|
||||
{
|
||||
$attrib = $link['@attributes'];
|
||||
$linkName = (defset($link['@value'])) ? constant($link['@value']) : $link['@value'];
|
||||
$url = e_PLUGIN_ABS.$this->plugFolder."/".$attrib['url'];
|
||||
if($attrib['primary']=='true')
|
||||
{
|
||||
$this->plugConfigFile = $url;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1452,7 +1510,55 @@ class e107plugin
|
||||
|
||||
|
||||
function execute_function($path = '', $what='', $when='')
|
||||
{
|
||||
{
|
||||
$emessage = eMessage::getInstance();
|
||||
$class_name = $this->plugFolder."_setup";
|
||||
$method_name = $this->plugFolder."_".$what."_".$when;
|
||||
|
||||
if(varset($this->plug_vars['@attributes']['setupFile']))
|
||||
{
|
||||
$setup_file = e_PLUGIN.$this->plugFolder.'/'.$this->plug_vars['@attributes']['setupFile'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$setup_file = e_PLUGIN.$this->plugFolder.'/'.$this->plugFolder.'_setup.php';
|
||||
}
|
||||
|
||||
if(is_readable($setup_file))
|
||||
{
|
||||
$emessage->add("Found setup file <b>".$setup_file."</b> ", E_MESSAGE_DEBUG);
|
||||
include_once($setup_file);
|
||||
|
||||
if(class_exists($class_name))
|
||||
{
|
||||
$obj = new $class_name;
|
||||
if(method_exists($obj,$method_name))
|
||||
{
|
||||
$emessage->add("Executing setup function <b>".$method_name."()</b>", E_MESSAGE_DEBUG);
|
||||
return call_user_func(array($obj,$method_name), $this);
|
||||
}
|
||||
else
|
||||
{
|
||||
$emessage->add("Setup function <b>".$method_name."()</b> NOT found.", E_MESSAGE_DEBUG);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$emessage->add("Setup function <b>".$method_name."()</b> NOT found.", E_MESSAGE_DEBUG);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$emessage->add("Optional Setup File NOT Found <b>".$setup_file."</b> ", E_MESSAGE_DEBUG);
|
||||
}
|
||||
|
||||
$emessage->add("Setup function <b>".$method_name."()</b> NOT found.", E_MESSAGE_DEBUG);
|
||||
return FALSE;
|
||||
|
||||
// deprecated 0.8 method below. Can safely be removed.
|
||||
|
||||
if($what == '' || $when == '') { return true; }
|
||||
if(!isset($this->plug_vars['management'][$what])) { return true; }
|
||||
$vars = $this->plug_vars['management'][$what];
|
||||
@ -1479,7 +1585,13 @@ class e107plugin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE; // IMPORTANT.
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// DEPRECATED - See XMLPrefs();
|
||||
function parse_prefs($pref_array,$mode='simple')
|
||||
@ -1603,6 +1715,10 @@ class e107plugin
|
||||
e107::getConfig('core')->setPref('plug_installed',$p_installed)->save();
|
||||
|
||||
$text .= (isset($eplug_done) ? "<br />{$eplug_done}" : "<br />".LAN_INSTALL_SUCCESSFUL);
|
||||
if($eplug_conffile)
|
||||
{
|
||||
$text .= " <a href='".e_PLUGIN.$eplug_folder."/".$eplug_conffile."'>[".LAN_CONFIGURE."]</a>";
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
@ -1,13 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- $Id: plugin.xml,v 1.6 2009-09-24 00:11:19 e107coders Exp $ -->
|
||||
<!-- $Id: plugin.xml,v 1.7 2009-10-20 03:49:21 e107coders Exp $ -->
|
||||
|
||||
<e107Plugin name="LAN_ALT_65" version="0.4" compatibility="0.8" installRequired="true" >
|
||||
<author name="e107 Inc." url="e107.org" email="mcfly@e107.org" />
|
||||
<description>LAN_ALT_66</description>
|
||||
<category>users</category>
|
||||
<copyright>Copyright e107 Inc e107.org, Licensed under GPL (http://www.gnu.org/licenses/gpl.txt)</copyright>
|
||||
<logLanguageFile filename="languages/--LAN--/--LAN--_log.php" />
|
||||
<languageFiles>
|
||||
<file type='log' path='languages/--LAN--/--LAN--_log.php' />
|
||||
</languageFiles>
|
||||
<adminLinks>
|
||||
<link url='alt_auth_conf.php' description='LAN_ALT_67' icon='images/alt_auth_32.png' iconSmall='images/alt_auth_16.png' primary='true' >LAN_ALT_67</link>
|
||||
</adminLinks>
|
||||
@ -16,7 +18,4 @@
|
||||
<pref name="auth_nouser">0</pref>
|
||||
<pref name="auth_extended"></pref>
|
||||
</mainPrefs>
|
||||
<management>
|
||||
<installDone>LAN_ALT_68</installDone>
|
||||
</management>
|
||||
</e107Plugin>
|
@ -1,11 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- $Id: plugin.xml,v 1.3 2009-09-24 00:11:19 e107coders Exp $ -->
|
||||
<!-- $Id: plugin.xml,v 1.4 2009-10-20 03:49:21 e107coders Exp $ -->
|
||||
|
||||
<e107Plugin name="Banners" version="1.0" compatibility="0.8" installRequired="true" releaseUrl=''>
|
||||
<author name="e107 Inc." url="http://e107.org" email="jalist@e107.org" />
|
||||
<description>FBLAN_02</description>
|
||||
<logLanguageFile filename="languages/--LAN--_admin_banner.php" />
|
||||
<languageFiles>
|
||||
<file type='log' path='languages/--LAN--_admin_banner.php' />
|
||||
</languageFiles>
|
||||
<category>content</category>
|
||||
<copyright>Copyright e107 Inc e107.org, Licensed under GPL (http://www.gnu.org/licenses/gpl.txt)</copyright>
|
||||
<adminLinks>
|
||||
|
@ -1,14 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- $Id: plugin.xml,v 1.10 2009-09-24 00:11:19 e107coders Exp $ -->
|
||||
<!-- $Id: plugin.xml,v 1.11 2009-10-20 03:49:22 e107coders Exp $ -->
|
||||
|
||||
<e107Plugin name="EC_ADLAN_1" version="3.70" compatibility="0.8" installRequired="true">
|
||||
<e107Plugin name="EC_ADLAN_1" version="3.70" compatibility="0.8" installRequired="true" setupFile='calendar_setup.php'>
|
||||
<author name="e107 Inc. + Barry" url="http://e107.org" />
|
||||
<description>EC_ADLAN_A206</description>
|
||||
<readMe>readme.pdf</readMe>
|
||||
<category>content</category>
|
||||
<installLanguageFile filename="languages/--LAN--_install.php" />
|
||||
<logLanguageFile filename="languages/--LAN--_log.php" />
|
||||
<languageFiles>
|
||||
<file type='install' path='languages/--LAN--_install.php' />
|
||||
<file type='log' path='languages/--LAN--_log.php' />
|
||||
</languageFiles>
|
||||
<adminLinks>
|
||||
<link url='admin_config.php' description='EC_ADINST_LAN_05' icon='images/calendar_32.png' iconSmall='images/calendar_16.png' primary='true' >EC_ADINST_LAN_05</link>
|
||||
</adminLinks>
|
||||
@ -54,10 +56,4 @@
|
||||
<pref name="eventpost_showcaticon">0</pref>
|
||||
<pref name="eventpost_namelink">0</pref>
|
||||
</mainPrefs>
|
||||
<management>
|
||||
<install when="post" type="classFunction" file="calendar_install.php" class="calendarInstall" function="postInstall" />
|
||||
<uninstall when="pre" type="classFunction" file="calendar_install.php" class="calendarInstall" function="preUninstall" />
|
||||
<upgrade when="pre" type="classFunction" file="calendar_install.php" class="calendarInstall" function="postUpgrade" />
|
||||
<installDone>EC_ADINST_LAN_04</installDone>
|
||||
</management>
|
||||
</e107Plugin>
|
@ -1,13 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- $Id: plugin.xml,v 1.7 2009-09-24 00:11:19 e107coders Exp $ -->
|
||||
<!-- $Id: plugin.xml,v 1.8 2009-10-20 03:49:22 e107coders Exp $ -->
|
||||
|
||||
<e107Plugin name="CHBLAN_40" version="1.0" compatibility="0.8" installRequired="true">
|
||||
<author name="e107 Inc." url="http://e107.org" email="jalist@e107.org" />
|
||||
<description>CHBLAN_41</description>
|
||||
<category>content</category>
|
||||
<logLanguageFile filename="languages/--LAN--/--LAN--_config.php" />
|
||||
|
||||
<copyright>Copyright e107 Inc e107.org, Licensed under GPL (http://www.gnu.org/licenses/gpl.txt)</copyright>
|
||||
<languageFiles>
|
||||
<file type='log' path='languages/--LAN--/--LAN--_config.php' />
|
||||
</languageFiles>
|
||||
<adminLinks>
|
||||
<link url='admin_chatbox.php' description='LAN_CONFIGURE' icon='images/chatbox_32.png' iconSmall='images/chatbox_16.png' primary='true' >LAN_CONFIGURE</link>
|
||||
</adminLinks>
|
||||
|
@ -1,10 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Id: plugin.xml,v 1.13 2009-09-24 00:11:19 e107coders Exp $ -->
|
||||
<!-- $Id: plugin.xml,v 1.14 2009-10-20 03:49:22 e107coders Exp $ -->
|
||||
<e107Plugin name="Download" version="1.0" compatibility="0.8" installRequired="true" releaseUrl=''>
|
||||
<author name="e107 Inc." url="http://e107.org" />
|
||||
<description>DOWLAN_DESCRIPTION</description>
|
||||
<category>content</category>
|
||||
<installLanguageFile filename="languages/--LAN--/admin_download.php" />
|
||||
<languageFiles>
|
||||
<file type='install' path='languages/--LAN--/admin_download.php' />
|
||||
</languageFiles>
|
||||
<adminLinks>
|
||||
<link url='admin_download.php' description='LAN_CONFIGURE' icon='images/downloads_32.png' iconSmall='images/downloads_16.png' primary='true' >DOWLAN_CAPTION</link>
|
||||
<link url='admin_download.php' description='' icon='manage' iconSmall=''>DOWLAN_29</link>
|
||||
@ -31,10 +33,4 @@
|
||||
<pref name="agree_text"></pref>
|
||||
<pref name="download_denied"></pref>
|
||||
</mainPrefs>
|
||||
<management>
|
||||
<install when="post" type="classFunction" file="download_management.php" class="download_management" function="download_install_post" />
|
||||
<uninstall type="classFunction" file="download_management.php" class="download_management" function="download_uninstall" />
|
||||
<upgrade type="classFunction" file="download_management.php" class="download_management" function="download_upgrade" />
|
||||
<installDone>DOWLAN_INSTALL_DONE</installDone>
|
||||
</management>
|
||||
</e107Plugin>
|
||||
|
@ -1,20 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- $Id: plugin.xml,v 1.7 2009-09-24 00:11:20 e107coders Exp $ -->
|
||||
<!-- $Id: plugin.xml,v 1.8 2009-10-20 03:49:22 e107coders Exp $ -->
|
||||
|
||||
<e107Plugin name="FBLAN_01" version="1.0" compatibility="0.8" installRequired="true">
|
||||
<author name="e107 Inc." url="http://e107.org" email="jalist@e107.org" />
|
||||
<description>FBLAN_02</description>
|
||||
<logLanguageFile filename="languages/--LAN--_admin_featurebox.php" />
|
||||
<category>content</category>
|
||||
<copyright>Copyright e107 Inc e107.org, Licensed under GPL (http://www.gnu.org/licenses/gpl.txt)</copyright>
|
||||
<languageFiles>
|
||||
<file type='log' path='languages/--LAN--_admin_featurebox.php' />
|
||||
</languageFiles>
|
||||
<adminLinks>
|
||||
<link url='admin_config.php' description='Configure feature box' icon='images/featurebox_32.png' iconSmall='images/featurebox_16.png' primary='true' >Configure feature box</link>
|
||||
</adminLinks>
|
||||
<mainPrefs>
|
||||
<pref name="fb_active">1</pref>
|
||||
</mainPrefs>
|
||||
<management>
|
||||
<installDone>FBLAN_04</installDone>
|
||||
</management>
|
||||
</e107Plugin>
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Id: plugin.xml,v 1.25 2009-09-23 23:18:18 e107coders Exp $ -->
|
||||
<!-- $Id: plugin.xml,v 1.26 2009-10-20 03:49:22 e107coders Exp $ -->
|
||||
<e107Plugin name="Forum" version="2.0" compatibility="0.8" installRequired="true" xhtmlcompliant="true" >
|
||||
<author name="e107 Inc." url="http://e107.org" />
|
||||
<description>This plugin is a fully featured Forum system</description>
|
||||
@ -34,10 +34,4 @@
|
||||
<field name="viewed" type='EUF_TEXTAREA' default='0' active="true" />
|
||||
<field name="posts" type='EUF_INTEGER' default='0' active="true" />
|
||||
</extendedFields>
|
||||
<management>
|
||||
<install when="post" type="classFunction" file="forum_management.php" class="forum_management" function="forum_install_post" />
|
||||
<uninstall type="classFunction" file="forum_management.php" class="forum_management" function="forum_uninstall" />
|
||||
<upgrade type="classFunction" file="forum_management.php" class="forum_management" function="forum_upgrade" />
|
||||
<installDone>It's finished</installDone>
|
||||
</management>
|
||||
</e107Plugin>
|
||||
|
@ -1,10 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Id: plugin.xml,v 1.5 2009-09-24 00:11:20 e107coders Exp $ -->
|
||||
<!-- $Id: plugin.xml,v 1.6 2009-10-20 03:49:22 e107coders Exp $ -->
|
||||
<e107Plugin name="GSLAN_19" version="1.0" compatibility="0.8" installRequired="true" releaseUrl=''>
|
||||
<author name="e107 Inc." url="http://e107coders.org" email="cameron@e107coders.org" />
|
||||
<description>GSLAN_41</description>
|
||||
<logLanguageFile filename="languages/--LAN--_admin_gsitemap.php" />
|
||||
<copyright>Copyright e107 Inc e107.org, Licensed under GPL (http://www.gnu.org/licenses/gpl.txt)</copyright>
|
||||
<languageFiles>
|
||||
<file type='log' path='languages/--LAN--_admin_gsitemap.php' />
|
||||
</languageFiles>
|
||||
<adminLinks>
|
||||
<link url='admin_config.php' description='Configure feature box' icon='images/icon.png' iconSmall='images/icon_16.png' primary='true' >Configure Sitemap</link>
|
||||
</adminLinks>
|
||||
@ -13,7 +15,4 @@
|
||||
</siteLinks>
|
||||
<pluginPrefs>
|
||||
</pluginPrefs>
|
||||
<management>
|
||||
<installDone>GSLAN_42</installDone>
|
||||
</management>
|
||||
</e107Plugin>
|
@ -1,14 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- $Id: plugin.xml,v 1.7 2009-09-24 00:11:20 e107coders Exp $ -->
|
||||
<!-- $Id: plugin.xml,v 1.8 2009-10-20 03:49:22 e107coders Exp $ -->
|
||||
|
||||
<e107Plugin name="LCLAN_PLUGIN_LAN_1" version="1.12" compatibility="0.8" installRequired="true" releaseUrl=''>
|
||||
<author name="e107 Inc." url="http://e107.org" />
|
||||
<description>Links Page For Displaying External Web Links</description>
|
||||
<category>content</category>
|
||||
<copyright>Copyright e107 Inc e107.org, Licensed under GPL (http://www.gnu.org/licenses/gpl.txt)</copyright>
|
||||
<logLanguageFile filename="languages/--LAN--_admin_links_page.php" />
|
||||
<adminLinks>
|
||||
<languageFiles>
|
||||
<file type='log' path='languages/--LAN--_admin_links_page.php' />
|
||||
</languageFiles>
|
||||
<adminLinks>
|
||||
<link url='admin_linkspage_config.php' description='Configure Links Page' icon='images/linkspage_32.png' iconSmall='images/linkspage_16.png' primary='true' >Configure Links Page</link>
|
||||
</adminLinks>
|
||||
<siteLinks>
|
||||
@ -16,7 +18,4 @@
|
||||
</siteLinks>
|
||||
<pluginPrefs>
|
||||
</pluginPrefs>
|
||||
<management>
|
||||
<installDone>Links page has successfully installed, please configure it from the Links Page link on the admin front page.</installDone>
|
||||
</management>
|
||||
</e107Plugin>
|
@ -1,9 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Id: plugin.xml,v 1.6 2009-09-24 00:11:20 e107coders Exp $ -->
|
||||
<!-- $Id: plugin.xml,v 1.7 2009-10-20 03:49:22 e107coders Exp $ -->
|
||||
<e107Plugin name="LWLANINS_1" version="1.1" compatibility="0.8" installRequired="true" >
|
||||
<author name="e107 Inc." url="http://e107.org" />
|
||||
<description>This plugin will link specified words with a defined link and/or tooltip</description>
|
||||
<logLanguageFile filename="languages/--LAN--_admin_linkwords.php" />
|
||||
<languageFiles>
|
||||
<file type='log' path='languages/--LAN--_admin_linkwords.php' />
|
||||
</languageFiles>
|
||||
<adminLinks>
|
||||
<link url='admin_config.php' description='Configure LinkWords' icon='images/linkwords_32.png' iconSmall='images/linkwords_16.png' primary='true' >Configure LinkWords</link>
|
||||
</adminLinks>
|
||||
@ -23,7 +25,4 @@
|
||||
)
|
||||
</pref>
|
||||
</mainPrefs>
|
||||
<management>
|
||||
<installDone>To configure please click on the link in the plugins section of the admin front page</installDone>
|
||||
</management>
|
||||
</e107Plugin>
|
@ -1,12 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- $Id: plugin.xml,v 1.8 2009-09-24 00:11:20 e107coders Exp $ -->
|
||||
<!-- $Id: plugin.xml,v 1.9 2009-10-20 03:49:22 e107coders Exp $ -->
|
||||
|
||||
<e107Plugin name="LIST_PLUGIN_1" version="1.0" compatibility="0.8" installRequired="true" releaseUrl=''>
|
||||
<author name="e107 Inc." url="http://e107.org" />
|
||||
<description>LIST_PLUGIN_2</description>
|
||||
<logLanguageFile filename="languages/--LAN--_admin_list_new.php" />
|
||||
<copyright>Copyright e107 Inc e107.org, Licensed under GPL (http://www.gnu.org/licenses/gpl.txt)</copyright>
|
||||
<copyright>Copyright e107 Inc e107.org, Licensed under GPL (http://www.gnu.org/licenses/gpl.txt)</copyright>
|
||||
<languageFiles>
|
||||
<file type='log' path='languages/--LAN--_admin_list_new.php' />
|
||||
</languageFiles>
|
||||
<adminLinks>
|
||||
<link url='admin_list_config.php' description='LIST_PLUGIN_3' icon='icon/list_32.png' iconSmall='icon/list_16.png' primary='true' >LIST_PLUGIN_3</link>
|
||||
</adminLinks>
|
||||
@ -15,7 +17,4 @@
|
||||
</siteLinks>
|
||||
<pluginPrefs>
|
||||
</pluginPrefs>
|
||||
<management>
|
||||
<installDone>LIST_PLUGIN_4</installDone>
|
||||
</management>
|
||||
</e107Plugin>
|
@ -1,9 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Id: plugin.xml,v 1.7 2009-09-24 00:11:20 e107coders Exp $ -->
|
||||
<!-- $Id: plugin.xml,v 1.8 2009-10-20 03:49:22 e107coders Exp $ -->
|
||||
<e107Plugin name="ADSTAT_L3" version="2.1" compatibility="0.8" installRequired="true" releaseUrl=''>
|
||||
<author name="e107 Inc." url="http://e107.org" />
|
||||
<description>ADSTAT_L1</description>
|
||||
<logLanguageFile filename="languages/--LAN--_admin_log.php" />
|
||||
<languageFiles>
|
||||
<file type='log' path='languages/--LAN--_admin_log.php' />
|
||||
</languageFiles>
|
||||
<adminLinks>
|
||||
<link url='admin_config.php' description='ADSTAT_L33' icon='images/stats_32.png' iconSmall='images/stats_16.png' primary='true' >ADSTAT_L33</link>
|
||||
</adminLinks>
|
||||
@ -22,7 +24,4 @@
|
||||
<pref name="statRecent">1</pref>
|
||||
<pref name="statPrevMonth">0</pref>
|
||||
</mainPrefs>
|
||||
<management>
|
||||
<installDone>ADSTAT_L2</installDone>
|
||||
</management>
|
||||
</e107Plugin>
|
BIN
e107_plugins/metaweblog/images/icon_16.png
Normal file
BIN
e107_plugins/metaweblog/images/icon_16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 969 B |
BIN
e107_plugins/metaweblog/images/icon_32.png
Normal file
BIN
e107_plugins/metaweblog/images/icon_32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
1172
e107_plugins/metaweblog/metaweblog.php
Normal file
1172
e107_plugins/metaweblog/metaweblog.php
Normal file
File diff suppressed because it is too large
Load Diff
12
e107_plugins/metaweblog/plugin.xml
Normal file
12
e107_plugins/metaweblog/plugin.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Id: plugin.xml,v 1.1 2009-10-20 03:49:22 e107coders Exp $ -->
|
||||
<e107Plugin name="Metaweblog" version="1.0" compatibility="0.8" installRequired="true" >
|
||||
<author name="e107 Inc." url="http://e107.org" />
|
||||
<description>Metaweblog API support for e107</description>
|
||||
<category>tools</category>
|
||||
<adminLinks>
|
||||
<link url='admin_prefs.php' description='Configure' icon='images/icon_32.png' iconSmall='images/icon_16.png' primary='true' >Configure</link>
|
||||
</adminLinks>
|
||||
<pluginPrefs>
|
||||
</pluginPrefs>
|
||||
</e107Plugin>
|
3776
e107_plugins/metaweblog/xmlrpc.inc
Normal file
3776
e107_plugins/metaweblog/xmlrpc.inc
Normal file
File diff suppressed because it is too large
Load Diff
955
e107_plugins/metaweblog/xmlrpc_wrappers.inc
Normal file
955
e107_plugins/metaweblog/xmlrpc_wrappers.inc
Normal file
@ -0,0 +1,955 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP-XMLRPC "wrapper" functions
|
||||
* Generate stubs to transparently access xmlrpc methods as php functions and viceversa
|
||||
*
|
||||
* @version $Id: xmlrpc_wrappers.inc,v 1.1 2009-10-20 03:49:22 e107coders Exp $
|
||||
* @author Gaetano Giunta
|
||||
* @copyright (C) 2006-2009 G. Giunta
|
||||
* @license code licensed under the BSD License: http://phpxmlrpc.sourceforge.net/license.txt
|
||||
*
|
||||
* @todo separate introspection from code generation for func-2-method wrapping
|
||||
* @todo use some better templating system for code generation?
|
||||
* @todo implement method wrapping with preservation of php objs in calls
|
||||
* @todo when wrapping methods without obj rebuilding, use return_type = 'phpvals' (faster)
|
||||
* @todo implement self-parsing of php code for PHP <= 4
|
||||
*/
|
||||
|
||||
// requires: xmlrpc.inc
|
||||
|
||||
/**
|
||||
* Given a string defining a php type or phpxmlrpc type (loosely defined: strings
|
||||
* accepted come from javadoc blocks), return corresponding phpxmlrpc type.
|
||||
* NB: for php 'resource' types returns empty string, since resources cannot be serialized;
|
||||
* for php class names returns 'struct', since php objects can be serialized as xmlrpc structs
|
||||
* for php arrays always return array, even though arrays sometiles serialize as json structs
|
||||
* @param string $phptype
|
||||
* @return string
|
||||
*/
|
||||
function php_2_xmlrpc_type($phptype)
|
||||
{
|
||||
switch(strtolower($phptype))
|
||||
{
|
||||
case 'string':
|
||||
return $GLOBALS['xmlrpcString'];
|
||||
case 'integer':
|
||||
case $GLOBALS['xmlrpcInt']: // 'int'
|
||||
case $GLOBALS['xmlrpcI4']:
|
||||
return $GLOBALS['xmlrpcInt'];
|
||||
case 'double':
|
||||
return $GLOBALS['xmlrpcDouble'];
|
||||
case 'boolean':
|
||||
return $GLOBALS['xmlrpcBoolean'];
|
||||
case 'array':
|
||||
return $GLOBALS['xmlrpcArray'];
|
||||
case 'object':
|
||||
return $GLOBALS['xmlrpcStruct'];
|
||||
case $GLOBALS['xmlrpcBase64']:
|
||||
case $GLOBALS['xmlrpcStruct']:
|
||||
return strtolower($phptype);
|
||||
case 'resource':
|
||||
return '';
|
||||
default:
|
||||
if(class_exists($phptype))
|
||||
{
|
||||
return $GLOBALS['xmlrpcStruct'];
|
||||
}
|
||||
else
|
||||
{
|
||||
// unknown: might be any 'extended' xmlrpc type
|
||||
return $GLOBALS['xmlrpcValue'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a string defining a phpxmlrpc type return corresponding php type.
|
||||
* @param string $xmlrpctype
|
||||
* @return string
|
||||
*/
|
||||
function xmlrpc_2_php_type($xmlrpctype)
|
||||
{
|
||||
switch(strtolower($xmlrpctype))
|
||||
{
|
||||
case 'base64':
|
||||
case 'datetime.iso8601':
|
||||
case 'string':
|
||||
return $GLOBALS['xmlrpcString'];
|
||||
case 'int':
|
||||
case 'i4':
|
||||
return 'integer';
|
||||
case 'struct':
|
||||
case 'array':
|
||||
return 'array';
|
||||
case 'double':
|
||||
return 'float';
|
||||
case 'undefined':
|
||||
return 'mixed';
|
||||
case 'boolean':
|
||||
case 'null':
|
||||
default:
|
||||
// unknown: might be any xmlrpc type
|
||||
return strtolower($xmlrpctype);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a user-defined PHP function, create a PHP 'wrapper' function that can
|
||||
* be exposed as xmlrpc method from an xmlrpc_server object and called from remote
|
||||
* clients (as well as its corresponding signature info).
|
||||
*
|
||||
* Since php is a typeless language, to infer types of input and output parameters,
|
||||
* it relies on parsing the javadoc-style comment block associated with the given
|
||||
* function. Usage of xmlrpc native types (such as datetime.dateTime.iso8601 and base64)
|
||||
* in the @param tag is also allowed, if you need the php function to receive/send
|
||||
* data in that particular format (note that base64 encoding/decoding is transparently
|
||||
* carried out by the lib, while datetime vals are passed around as strings)
|
||||
*
|
||||
* Known limitations:
|
||||
* - requires PHP 5.0.3 +
|
||||
* - only works for user-defined functions, not for PHP internal functions
|
||||
* (reflection does not support retrieving number/type of params for those)
|
||||
* - functions returning php objects will generate special xmlrpc responses:
|
||||
* when the xmlrpc decoding of those responses is carried out by this same lib, using
|
||||
* the appropriate param in php_xmlrpc_decode, the php objects will be rebuilt.
|
||||
* In short: php objects can be serialized, too (except for their resource members),
|
||||
* using this function.
|
||||
* Other libs might choke on the very same xml that will be generated in this case
|
||||
* (i.e. it has a nonstandard attribute on struct element tags)
|
||||
* - usage of javadoc @param tags using param names in a different order from the
|
||||
* function prototype is not considered valid (to be fixed?)
|
||||
*
|
||||
* Note that since rel. 2.0RC3 the preferred method to have the server call 'standard'
|
||||
* php functions (ie. functions not expecting a single xmlrpcmsg obj as parameter)
|
||||
* is by making use of the functions_parameters_type class member.
|
||||
*
|
||||
* @param string $funcname the name of the PHP user function to be exposed as xmlrpc method; array($obj, 'methodname') and array('class', 'methodname') are ok too
|
||||
* @param string $newfuncname (optional) name for function to be created
|
||||
* @param array $extra_options (optional) array of options for conversion. valid values include:
|
||||
* bool return_source when true, php code w. function definition will be returned, not evaluated
|
||||
* bool encode_php_objs let php objects be sent to server using the 'improved' xmlrpc notation, so server can deserialize them as php objects
|
||||
* bool decode_php_objs --- WARNING !!! possible security hazard. only use it with trusted servers ---
|
||||
* bool suppress_warnings remove from produced xml any runtime warnings due to the php function being invoked
|
||||
* @return false on error, or an array containing the name of the new php function,
|
||||
* its signature and docs, to be used in the server dispatch map
|
||||
*
|
||||
* @todo decide how to deal with params passed by ref: bomb out or allow?
|
||||
* @todo finish using javadoc info to build method sig if all params are named but out of order
|
||||
* @todo add a check for params of 'resource' type
|
||||
* @todo add some trigger_errors / error_log when returning false?
|
||||
* @todo what to do when the PHP function returns NULL? we are currently returning an empty string value...
|
||||
* @todo add an option to suppress php warnings in invocation of user function, similar to server debug level 3?
|
||||
* @todo if $newfuncname is empty, we could use create_user_func instead of eval, as it is possibly faster
|
||||
* @todo add a verbatim_object_copy parameter to allow avoiding the same obj instance?
|
||||
*/
|
||||
function wrap_php_function($funcname, $newfuncname='', $extra_options=array())
|
||||
{
|
||||
$buildit = isset($extra_options['return_source']) ? !($extra_options['return_source']) : true;
|
||||
$prefix = isset($extra_options['prefix']) ? $extra_options['prefix'] : 'xmlrpc';
|
||||
$encode_php_objects = isset($extra_options['encode_php_objs']) ? (bool)$extra_options['encode_php_objs'] : false;
|
||||
$decode_php_objects = isset($extra_options['decode_php_objs']) ? (bool)$extra_options['decode_php_objs'] : false;
|
||||
$catch_warnings = isset($extra_options['suppress_warnings']) && $extra_options['suppress_warnings'] ? '@' : '';
|
||||
|
||||
if(version_compare(phpversion(), '5.0.3') == -1)
|
||||
{
|
||||
// up to php 5.0.3 some useful reflection methods were missing
|
||||
error_log('XML-RPC: cannot not wrap php functions unless running php version bigger than 5.0.3');
|
||||
return false;
|
||||
}
|
||||
|
||||
$exists = false;
|
||||
if (is_string($funcname) && strpos($funcname, '::') !== false)
|
||||
{
|
||||
$funcname = explode('::', $funcname);
|
||||
}
|
||||
if(is_array($funcname))
|
||||
{
|
||||
if(count($funcname) < 2 || (!is_string($funcname[0]) && !is_object($funcname[0])))
|
||||
{
|
||||
error_log('XML-RPC: syntax for function to be wrapped is wrong');
|
||||
return false;
|
||||
}
|
||||
if(is_string($funcname[0]))
|
||||
{
|
||||
$plainfuncname = implode('::', $funcname);
|
||||
}
|
||||
elseif(is_object($funcname[0]))
|
||||
{
|
||||
$plainfuncname = get_class($funcname[0]) . '->' . $funcname[1];
|
||||
}
|
||||
$exists = method_exists($funcname[0], $funcname[1]);
|
||||
if (!$exists && version_compare(phpversion(), '5.1') < 0)
|
||||
{
|
||||
// workaround for php 5.0: static class methods are not seen by method_exists
|
||||
$exists = is_callable( $funcname );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$plainfuncname = $funcname;
|
||||
$exists = function_exists($funcname);
|
||||
}
|
||||
|
||||
if(!$exists)
|
||||
{
|
||||
error_log('XML-RPC: function to be wrapped is not defined: '.$plainfuncname);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// determine name of new php function
|
||||
if($newfuncname == '')
|
||||
{
|
||||
if(is_array($funcname))
|
||||
{
|
||||
if(is_string($funcname[0]))
|
||||
$xmlrpcfuncname = "{$prefix}_".implode('_', $funcname);
|
||||
else
|
||||
$xmlrpcfuncname = "{$prefix}_".get_class($funcname[0]) . '_' . $funcname[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
$xmlrpcfuncname = "{$prefix}_$funcname";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$xmlrpcfuncname = $newfuncname;
|
||||
}
|
||||
while($buildit && function_exists($xmlrpcfuncname))
|
||||
{
|
||||
$xmlrpcfuncname .= 'x';
|
||||
}
|
||||
|
||||
// start to introspect PHP code
|
||||
if(is_array($funcname))
|
||||
{
|
||||
$func = new ReflectionMethod($funcname[0], $funcname[1]);
|
||||
if($func->isPrivate())
|
||||
{
|
||||
error_log('XML-RPC: method to be wrapped is private: '.$plainfuncname);
|
||||
return false;
|
||||
}
|
||||
if($func->isProtected())
|
||||
{
|
||||
error_log('XML-RPC: method to be wrapped is protected: '.$plainfuncname);
|
||||
return false;
|
||||
}
|
||||
if($func->isConstructor())
|
||||
{
|
||||
error_log('XML-RPC: method to be wrapped is the constructor: '.$plainfuncname);
|
||||
return false;
|
||||
}
|
||||
// php 503 always says isdestructor = true...
|
||||
if( version_compare(phpversion(), '5.0.3') != 0 && $func->isDestructor())
|
||||
{
|
||||
error_log('XML-RPC: method to be wrapped is the destructor: '.$plainfuncname);
|
||||
return false;
|
||||
}
|
||||
if($func->isAbstract())
|
||||
{
|
||||
error_log('XML-RPC: method to be wrapped is abstract: '.$plainfuncname);
|
||||
return false;
|
||||
}
|
||||
/// @todo add more checks for static vs. nonstatic?
|
||||
}
|
||||
else
|
||||
{
|
||||
$func = new ReflectionFunction($funcname);
|
||||
}
|
||||
if($func->isInternal())
|
||||
{
|
||||
// Note: from PHP 5.1.0 onward, we will possibly be able to use invokeargs
|
||||
// instead of getparameters to fully reflect internal php functions ?
|
||||
error_log('XML-RPC: function to be wrapped is internal: '.$plainfuncname);
|
||||
return false;
|
||||
}
|
||||
|
||||
// retrieve parameter names, types and description from javadoc comments
|
||||
|
||||
// function description
|
||||
$desc = '';
|
||||
// type of return val: by default 'any'
|
||||
$returns = $GLOBALS['xmlrpcValue'];
|
||||
// desc of return val
|
||||
$returnsDocs = '';
|
||||
// type + name of function parameters
|
||||
$paramDocs = array();
|
||||
|
||||
$docs = $func->getDocComment();
|
||||
if($docs != '')
|
||||
{
|
||||
$docs = explode("\n", $docs);
|
||||
$i = 0;
|
||||
foreach($docs as $doc)
|
||||
{
|
||||
$doc = trim($doc, " \r\t/*");
|
||||
if(strlen($doc) && strpos($doc, '@') !== 0 && !$i)
|
||||
{
|
||||
if($desc)
|
||||
{
|
||||
$desc .= "\n";
|
||||
}
|
||||
$desc .= $doc;
|
||||
}
|
||||
elseif(strpos($doc, '@param') === 0)
|
||||
{
|
||||
// syntax: @param type [$name] desc
|
||||
if(preg_match('/@param\s+(\S+)(\s+\$\S+)?\s+(.+)/', $doc, $matches))
|
||||
{
|
||||
if(strpos($matches[1], '|'))
|
||||
{
|
||||
//$paramDocs[$i]['type'] = explode('|', $matches[1]);
|
||||
$paramDocs[$i]['type'] = 'mixed';
|
||||
}
|
||||
else
|
||||
{
|
||||
$paramDocs[$i]['type'] = $matches[1];
|
||||
}
|
||||
$paramDocs[$i]['name'] = trim($matches[2]);
|
||||
$paramDocs[$i]['doc'] = $matches[3];
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
elseif(strpos($doc, '@return') === 0)
|
||||
{
|
||||
// syntax: @return type desc
|
||||
//$returns = preg_split('/\s+/', $doc);
|
||||
if(preg_match('/@return\s+(\S+)\s+(.+)/', $doc, $matches))
|
||||
{
|
||||
$returns = php_2_xmlrpc_type($matches[1]);
|
||||
if(isset($matches[2]))
|
||||
{
|
||||
$returnsDocs = $matches[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// execute introspection of actual function prototype
|
||||
$params = array();
|
||||
$i = 0;
|
||||
foreach($func->getParameters() as $paramobj)
|
||||
{
|
||||
$params[$i] = array();
|
||||
$params[$i]['name'] = '$'.$paramobj->getName();
|
||||
$params[$i]['isoptional'] = $paramobj->isOptional();
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
// start building of PHP code to be eval'd
|
||||
$innercode = '';
|
||||
$i = 0;
|
||||
$parsvariations = array();
|
||||
$pars = array();
|
||||
$pnum = count($params);
|
||||
foreach($params as $param)
|
||||
{
|
||||
if (isset($paramDocs[$i]['name']) && $paramDocs[$i]['name'] && strtolower($paramDocs[$i]['name']) != strtolower($param['name']))
|
||||
{
|
||||
// param name from phpdoc info does not match param definition!
|
||||
$paramDocs[$i]['type'] = 'mixed';
|
||||
}
|
||||
|
||||
if($param['isoptional'])
|
||||
{
|
||||
// this particular parameter is optional. save as valid previous list of parameters
|
||||
$innercode .= "if (\$paramcount > $i) {\n";
|
||||
$parsvariations[] = $pars;
|
||||
}
|
||||
$innercode .= "\$p$i = \$msg->getParam($i);\n";
|
||||
if ($decode_php_objects)
|
||||
{
|
||||
$innercode .= "if (\$p{$i}->kindOf() == 'scalar') \$p$i = \$p{$i}->scalarval(); else \$p$i = php_{$prefix}_decode(\$p$i, array('decode_php_objs'));\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$innercode .= "if (\$p{$i}->kindOf() == 'scalar') \$p$i = \$p{$i}->scalarval(); else \$p$i = php_{$prefix}_decode(\$p$i);\n";
|
||||
}
|
||||
|
||||
$pars[] = "\$p$i";
|
||||
$i++;
|
||||
if($param['isoptional'])
|
||||
{
|
||||
$innercode .= "}\n";
|
||||
}
|
||||
if($i == $pnum)
|
||||
{
|
||||
// last allowed parameters combination
|
||||
$parsvariations[] = $pars;
|
||||
}
|
||||
}
|
||||
|
||||
$sigs = array();
|
||||
$psigs = array();
|
||||
if(count($parsvariations) == 0)
|
||||
{
|
||||
// only known good synopsis = no parameters
|
||||
$parsvariations[] = array();
|
||||
$minpars = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$minpars = count($parsvariations[0]);
|
||||
}
|
||||
|
||||
if($minpars)
|
||||
{
|
||||
// add to code the check for min params number
|
||||
// NB: this check needs to be done BEFORE decoding param values
|
||||
$innercode = "\$paramcount = \$msg->getNumParams();\n" .
|
||||
"if (\$paramcount < $minpars) return new {$prefix}resp(0, {$GLOBALS['xmlrpcerr']['incorrect_params']}, '{$GLOBALS['xmlrpcstr']['incorrect_params']}');\n" . $innercode;
|
||||
}
|
||||
else
|
||||
{
|
||||
$innercode = "\$paramcount = \$msg->getNumParams();\n" . $innercode;
|
||||
}
|
||||
|
||||
$innercode .= "\$np = false;\n";
|
||||
// since there are no closures in php, if we are given an object instance,
|
||||
// we store a pointer to it in a global var...
|
||||
if ( is_array($funcname) && is_object($funcname[0]) )
|
||||
{
|
||||
$GLOBALS['xmlrpcWPFObjHolder'][$xmlrpcfuncname] =& $funcname[0];
|
||||
$innercode .= "\$obj =& \$GLOBALS['xmlrpcWPFObjHolder']['$xmlrpcfuncname'];\n";
|
||||
$realfuncname = '$obj->'.$funcname[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
$realfuncname = $plainfuncname;
|
||||
}
|
||||
foreach($parsvariations as $pars)
|
||||
{
|
||||
$innercode .= "if (\$paramcount == " . count($pars) . ") \$retval = {$catch_warnings}$realfuncname(" . implode(',', $pars) . "); else\n";
|
||||
// build a 'generic' signature (only use an appropriate return type)
|
||||
$sig = array($returns);
|
||||
$psig = array($returnsDocs);
|
||||
for($i=0; $i < count($pars); $i++)
|
||||
{
|
||||
if (isset($paramDocs[$i]['type']))
|
||||
{
|
||||
$sig[] = php_2_xmlrpc_type($paramDocs[$i]['type']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sig[] = $GLOBALS['xmlrpcValue'];
|
||||
}
|
||||
$psig[] = isset($paramDocs[$i]['doc']) ? $paramDocs[$i]['doc'] : '';
|
||||
}
|
||||
$sigs[] = $sig;
|
||||
$psigs[] = $psig;
|
||||
}
|
||||
$innercode .= "\$np = true;\n";
|
||||
$innercode .= "if (\$np) return new {$prefix}resp(0, {$GLOBALS['xmlrpcerr']['incorrect_params']}, '{$GLOBALS['xmlrpcstr']['incorrect_params']}'); else {\n";
|
||||
//$innercode .= "if (\$_xmlrpcs_error_occurred) return new xmlrpcresp(0, $GLOBALS['xmlrpcerr']user, \$_xmlrpcs_error_occurred); else\n";
|
||||
$innercode .= "if (is_a(\$retval, '{$prefix}resp')) return \$retval; else\n";
|
||||
if($returns == $GLOBALS['xmlrpcDateTime'] || $returns == $GLOBALS['xmlrpcBase64'])
|
||||
{
|
||||
$innercode .= "return new {$prefix}resp(new {$prefix}val(\$retval, '$returns'));";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($encode_php_objects)
|
||||
$innercode .= "return new {$prefix}resp(php_{$prefix}_encode(\$retval, array('encode_php_objs')));\n";
|
||||
else
|
||||
$innercode .= "return new {$prefix}resp(php_{$prefix}_encode(\$retval));\n";
|
||||
}
|
||||
// shall we exclude functions returning by ref?
|
||||
// if($func->returnsReference())
|
||||
// return false;
|
||||
$code = "function $xmlrpcfuncname(\$msg) {\n" . $innercode . "}\n}";
|
||||
//print_r($code);
|
||||
if ($buildit)
|
||||
{
|
||||
$allOK = 0;
|
||||
eval($code.'$allOK=1;');
|
||||
// alternative
|
||||
//$xmlrpcfuncname = create_function('$m', $innercode);
|
||||
|
||||
if(!$allOK)
|
||||
{
|
||||
error_log('XML-RPC: could not create function '.$xmlrpcfuncname.' to wrap php function '.$plainfuncname);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// @todo examine if $paramDocs matches $parsvariations and build array for
|
||||
/// usage as method signature, plus put together a nice string for docs
|
||||
|
||||
$ret = array('function' => $xmlrpcfuncname, 'signature' => $sigs, 'docstring' => $desc, 'signature_docs' => $psigs, 'source' => $code);
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a user-defined PHP class or php object, map its methods onto a list of
|
||||
* PHP 'wrapper' functions that can be exposed as xmlrpc methods from an xmlrpc_server
|
||||
* object and called from remote clients (as well as their corresponding signature info).
|
||||
*
|
||||
* @param mixed $classname the name of the class whose methods are to be exposed as xmlrpc methods, or an object instance of that class
|
||||
* @param array $extra_options see the docs for wrap_php_method for more options
|
||||
* string method_type 'static', 'nonstatic', 'all' and 'auto' (default); the latter will switch between static and non-static depending on wheter $classname is a class name or object instance
|
||||
* @return array or false on failure
|
||||
*
|
||||
* @todo get_class_methods will return both static and non-static methods.
|
||||
* we have to differentiate the action, depending on wheter we recived a class name or object
|
||||
*/
|
||||
function wrap_php_class($classname, $extra_options=array())
|
||||
{
|
||||
$methodfilter = isset($extra_options['method_filter']) ? $extra_options['method_filter'] : '';
|
||||
$methodtype = isset($extra_options['method_type']) ? $extra_options['method_type'] : 'auto';
|
||||
|
||||
if(version_compare(phpversion(), '5.0.3') == -1)
|
||||
{
|
||||
// up to php 5.0.3 some useful reflection methods were missing
|
||||
error_log('XML-RPC: cannot not wrap php functions unless running php version bigger than 5.0.3');
|
||||
return false;
|
||||
}
|
||||
|
||||
$result = array();
|
||||
$mlist = get_class_methods($classname);
|
||||
foreach($mlist as $mname)
|
||||
{
|
||||
if ($methodfilter == '' || preg_match($methodfilter, $mname))
|
||||
{
|
||||
// echo $mlist."\n";
|
||||
$func = new ReflectionMethod($classname, $mname);
|
||||
if(!$func->isPrivate() && !$func->isProtected() && !$func->isConstructor() && !$func->isDestructor() && !$func->isAbstract())
|
||||
{
|
||||
if(($func->isStatic && ($methodtype == 'all' || $methodtype == 'static' || ($methodtype == 'auto' && is_string($classname)))) ||
|
||||
(!$func->isStatic && ($methodtype == 'all' || $methodtype == 'nonstatic' || ($methodtype == 'auto' && is_object($classname)))))
|
||||
{
|
||||
$methodwrap = wrap_php_function(array($classname, $mname), '', $extra_options);
|
||||
if ( $methodwrap )
|
||||
{
|
||||
$result[$methodwrap['function']] = $methodwrap['function'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an xmlrpc client and a method name, register a php wrapper function
|
||||
* that will call it and return results using native php types for both
|
||||
* params and results. The generated php function will return an xmlrpcresp
|
||||
* oject for failed xmlrpc calls
|
||||
*
|
||||
* Known limitations:
|
||||
* - server must support system.methodsignature for the wanted xmlrpc method
|
||||
* - for methods that expose many signatures, only one can be picked (we
|
||||
* could in priciple check if signatures differ only by number of params
|
||||
* and not by type, but it would be more complication than we can spare time)
|
||||
* - nested xmlrpc params: the caller of the generated php function has to
|
||||
* encode on its own the params passed to the php function if these are structs
|
||||
* or arrays whose (sub)members include values of type datetime or base64
|
||||
*
|
||||
* Notes: the connection properties of the given client will be copied
|
||||
* and reused for the connection used during the call to the generated
|
||||
* php function.
|
||||
* Calling the generated php function 'might' be slow: a new xmlrpc client
|
||||
* is created on every invocation and an xmlrpc-connection opened+closed.
|
||||
* An extra 'debug' param is appended to param list of xmlrpc method, useful
|
||||
* for debugging purposes.
|
||||
*
|
||||
* @param xmlrpc_client $client an xmlrpc client set up correctly to communicate with target server
|
||||
* @param string $methodname the xmlrpc method to be mapped to a php function
|
||||
* @param array $extra_options array of options that specify conversion details. valid ptions include
|
||||
* integer signum the index of the method signature to use in mapping (if method exposes many sigs)
|
||||
* integer timeout timeout (in secs) to be used when executing function/calling remote method
|
||||
* string protocol 'http' (default), 'http11' or 'https'
|
||||
* string new_function_name the name of php function to create. If unsepcified, lib will pick an appropriate name
|
||||
* string return_source if true return php code w. function definition instead fo function name
|
||||
* bool encode_php_objs let php objects be sent to server using the 'improved' xmlrpc notation, so server can deserialize them as php objects
|
||||
* bool decode_php_objs --- WARNING !!! possible security hazard. only use it with trusted servers ---
|
||||
* mixed return_on_fault a php value to be returned when the xmlrpc call fails/returns a fault response (by default the xmlrpcresp object is returned in this case). If a string is used, '%faultCode%' and '%faultString%' tokens will be substituted with actual error values
|
||||
* bool debug set it to 1 or 2 to see debug results of querying server for method synopsis
|
||||
* @return string the name of the generated php function (or false) - OR AN ARRAY...
|
||||
*/
|
||||
function wrap_xmlrpc_method($client, $methodname, $extra_options=0, $timeout=0, $protocol='', $newfuncname='')
|
||||
{
|
||||
// mind numbing: let caller use sane calling convention (as per javadoc, 3 params),
|
||||
// OR the 2.0 calling convention (no options) - we really love backward compat, don't we?
|
||||
if (!is_array($extra_options))
|
||||
{
|
||||
$signum = $extra_options;
|
||||
$extra_options = array();
|
||||
}
|
||||
else
|
||||
{
|
||||
$signum = isset($extra_options['signum']) ? (int)$extra_options['signum'] : 0;
|
||||
$timeout = isset($extra_options['timeout']) ? (int)$extra_options['timeout'] : 0;
|
||||
$protocol = isset($extra_options['protocol']) ? $extra_options['protocol'] : '';
|
||||
$newfuncname = isset($extra_options['new_function_name']) ? $extra_options['new_function_name'] : '';
|
||||
}
|
||||
//$encode_php_objects = in_array('encode_php_objects', $extra_options);
|
||||
//$verbatim_client_copy = in_array('simple_client_copy', $extra_options) ? 1 :
|
||||
// in_array('build_class_code', $extra_options) ? 2 : 0;
|
||||
|
||||
$encode_php_objects = isset($extra_options['encode_php_objs']) ? (bool)$extra_options['encode_php_objs'] : false;
|
||||
$decode_php_objects = isset($extra_options['decode_php_objs']) ? (bool)$extra_options['decode_php_objs'] : false;
|
||||
$simple_client_copy = isset($extra_options['simple_client_copy']) ? (int)($extra_options['simple_client_copy']) : 0;
|
||||
$buildit = isset($extra_options['return_source']) ? !($extra_options['return_source']) : true;
|
||||
$prefix = isset($extra_options['prefix']) ? $extra_options['prefix'] : 'xmlrpc';
|
||||
if (isset($extra_options['return_on_fault']))
|
||||
{
|
||||
$decode_fault = true;
|
||||
$fault_response = $extra_options['return_on_fault'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$decode_fault = false;
|
||||
$fault_response = '';
|
||||
}
|
||||
$debug = isset($extra_options['debug']) ? ($extra_options['debug']) : 0;
|
||||
|
||||
$msgclass = $prefix.'msg';
|
||||
$valclass = $prefix.'val';
|
||||
$decodefunc = 'php_'.$prefix.'_decode';
|
||||
|
||||
$msg = new $msgclass('system.methodSignature');
|
||||
$msg->addparam(new $valclass($methodname));
|
||||
$client->setDebug($debug);
|
||||
$response =& $client->send($msg, $timeout, $protocol);
|
||||
if($response->faultCode())
|
||||
{
|
||||
error_log('XML-RPC: could not retrieve method signature from remote server for method '.$methodname);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$msig = $response->value();
|
||||
if ($client->return_type != 'phpvals')
|
||||
{
|
||||
$msig = $decodefunc($msig);
|
||||
}
|
||||
if(!is_array($msig) || count($msig) <= $signum)
|
||||
{
|
||||
error_log('XML-RPC: could not retrieve method signature nr.'.$signum.' from remote server for method '.$methodname);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// pick a suitable name for the new function, avoiding collisions
|
||||
if($newfuncname != '')
|
||||
{
|
||||
$xmlrpcfuncname = $newfuncname;
|
||||
}
|
||||
else
|
||||
{
|
||||
// take care to insure that methodname is translated to valid
|
||||
// php function name
|
||||
$xmlrpcfuncname = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
|
||||
array('_', ''), $methodname);
|
||||
}
|
||||
while($buildit && function_exists($xmlrpcfuncname))
|
||||
{
|
||||
$xmlrpcfuncname .= 'x';
|
||||
}
|
||||
|
||||
$msig = $msig[$signum];
|
||||
$mdesc = '';
|
||||
// if in 'offline' mode, get method description too.
|
||||
// in online mode, favour speed of operation
|
||||
if(!$buildit)
|
||||
{
|
||||
$msg = new $msgclass('system.methodHelp');
|
||||
$msg->addparam(new $valclass($methodname));
|
||||
$response =& $client->send($msg, $timeout, $protocol);
|
||||
if (!$response->faultCode())
|
||||
{
|
||||
$mdesc = $response->value();
|
||||
if ($client->return_type != 'phpvals')
|
||||
{
|
||||
$mdesc = $mdesc->scalarval();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$results = build_remote_method_wrapper_code($client, $methodname,
|
||||
$xmlrpcfuncname, $msig, $mdesc, $timeout, $protocol, $simple_client_copy,
|
||||
$prefix, $decode_php_objects, $encode_php_objects, $decode_fault,
|
||||
$fault_response);
|
||||
|
||||
//print_r($code);
|
||||
if ($buildit)
|
||||
{
|
||||
$allOK = 0;
|
||||
eval($results['source'].'$allOK=1;');
|
||||
// alternative
|
||||
//$xmlrpcfuncname = create_function('$m', $innercode);
|
||||
if($allOK)
|
||||
{
|
||||
return $xmlrpcfuncname;
|
||||
}
|
||||
else
|
||||
{
|
||||
error_log('XML-RPC: could not create function '.$xmlrpcfuncname.' to wrap remote method '.$methodname);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$results['function'] = $xmlrpcfuncname;
|
||||
return $results;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to wrap_xmlrpc_method, but will generate a php class that wraps
|
||||
* all xmlrpc methods exposed by the remote server as own methods.
|
||||
* For more details see wrap_xmlrpc_method.
|
||||
* @param xmlrpc_client $client the client obj all set to query the desired server
|
||||
* @param array $extra_options list of options for wrapped code
|
||||
* @return mixed false on error, the name of the created class if all ok or an array with code, class name and comments (if the appropriatevoption is set in extra_options)
|
||||
*/
|
||||
function wrap_xmlrpc_server($client, $extra_options=array())
|
||||
{
|
||||
$methodfilter = isset($extra_options['method_filter']) ? $extra_options['method_filter'] : '';
|
||||
//$signum = isset($extra_options['signum']) ? (int)$extra_options['signum'] : 0;
|
||||
$timeout = isset($extra_options['timeout']) ? (int)$extra_options['timeout'] : 0;
|
||||
$protocol = isset($extra_options['protocol']) ? $extra_options['protocol'] : '';
|
||||
$newclassname = isset($extra_options['new_class_name']) ? $extra_options['new_class_name'] : '';
|
||||
$encode_php_objects = isset($extra_options['encode_php_objs']) ? (bool)$extra_options['encode_php_objs'] : false;
|
||||
$decode_php_objects = isset($extra_options['decode_php_objs']) ? (bool)$extra_options['decode_php_objs'] : false;
|
||||
$verbatim_client_copy = isset($extra_options['simple_client_copy']) ? !($extra_options['simple_client_copy']) : true;
|
||||
$buildit = isset($extra_options['return_source']) ? !($extra_options['return_source']) : true;
|
||||
$prefix = isset($extra_options['prefix']) ? $extra_options['prefix'] : 'xmlrpc';
|
||||
|
||||
$msgclass = $prefix.'msg';
|
||||
//$valclass = $prefix.'val';
|
||||
$decodefunc = 'php_'.$prefix.'_decode';
|
||||
|
||||
$msg = new $msgclass('system.listMethods');
|
||||
$response =& $client->send($msg, $timeout, $protocol);
|
||||
if($response->faultCode())
|
||||
{
|
||||
error_log('XML-RPC: could not retrieve method list from remote server');
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mlist = $response->value();
|
||||
if ($client->return_type != 'phpvals')
|
||||
{
|
||||
$mlist = $decodefunc($mlist);
|
||||
}
|
||||
if(!is_array($mlist) || !count($mlist))
|
||||
{
|
||||
error_log('XML-RPC: could not retrieve meaningful method list from remote server');
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// pick a suitable name for the new function, avoiding collisions
|
||||
if($newclassname != '')
|
||||
{
|
||||
$xmlrpcclassname = $newclassname;
|
||||
}
|
||||
else
|
||||
{
|
||||
$xmlrpcclassname = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
|
||||
array('_', ''), $client->server).'_client';
|
||||
}
|
||||
while($buildit && class_exists($xmlrpcclassname))
|
||||
{
|
||||
$xmlrpcclassname .= 'x';
|
||||
}
|
||||
|
||||
/// @todo add function setdebug() to new class, to enable/disable debugging
|
||||
$source = "class $xmlrpcclassname\n{\nvar \$client;\n\n";
|
||||
$source .= "function $xmlrpcclassname()\n{\n";
|
||||
$source .= build_client_wrapper_code($client, $verbatim_client_copy, $prefix);
|
||||
$source .= "\$this->client =& \$client;\n}\n\n";
|
||||
$opts = array('simple_client_copy' => 2, 'return_source' => true,
|
||||
'timeout' => $timeout, 'protocol' => $protocol,
|
||||
'encode_php_objs' => $encode_php_objects, 'prefix' => $prefix,
|
||||
'decode_php_objs' => $decode_php_objects
|
||||
);
|
||||
/// @todo build javadoc for class definition, too
|
||||
foreach($mlist as $mname)
|
||||
{
|
||||
if ($methodfilter == '' || preg_match($methodfilter, $mname))
|
||||
{
|
||||
$opts['new_function_name'] = preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
|
||||
array('_', ''), $mname);
|
||||
$methodwrap = wrap_xmlrpc_method($client, $mname, $opts);
|
||||
if ($methodwrap)
|
||||
{
|
||||
if (!$buildit)
|
||||
{
|
||||
$source .= $methodwrap['docstring'];
|
||||
}
|
||||
$source .= $methodwrap['source']."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
error_log('XML-RPC: will not create class method to wrap remote method '.$mname);
|
||||
}
|
||||
}
|
||||
}
|
||||
$source .= "}\n";
|
||||
if ($buildit)
|
||||
{
|
||||
$allOK = 0;
|
||||
eval($source.'$allOK=1;');
|
||||
// alternative
|
||||
//$xmlrpcfuncname = create_function('$m', $innercode);
|
||||
if($allOK)
|
||||
{
|
||||
return $xmlrpcclassname;
|
||||
}
|
||||
else
|
||||
{
|
||||
error_log('XML-RPC: could not create class '.$xmlrpcclassname.' to wrap remote server '.$client->server);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return array('class' => $xmlrpcclassname, 'code' => $source, 'docstring' => '');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given the necessary info, build php code that creates a new function to
|
||||
* invoke a remote xmlrpc method.
|
||||
* Take care that no full checking of input parameters is done to ensure that
|
||||
* valid php code is emitted.
|
||||
* Note: real spaghetti code follows...
|
||||
* @access private
|
||||
*/
|
||||
function build_remote_method_wrapper_code($client, $methodname, $xmlrpcfuncname,
|
||||
$msig, $mdesc='', $timeout=0, $protocol='', $client_copy_mode=0, $prefix='xmlrpc',
|
||||
$decode_php_objects=false, $encode_php_objects=false, $decode_fault=false,
|
||||
$fault_response='')
|
||||
{
|
||||
$code = "function $xmlrpcfuncname (";
|
||||
if ($client_copy_mode < 2)
|
||||
{
|
||||
// client copy mode 0 or 1 == partial / full client copy in emitted code
|
||||
$innercode = build_client_wrapper_code($client, $client_copy_mode, $prefix);
|
||||
$innercode .= "\$client->setDebug(\$debug);\n";
|
||||
$this_ = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
// client copy mode 2 == no client copy in emitted code
|
||||
$innercode = '';
|
||||
$this_ = 'this->';
|
||||
}
|
||||
$innercode .= "\$msg = new {$prefix}msg('$methodname');\n";
|
||||
|
||||
if ($mdesc != '')
|
||||
{
|
||||
// take care that PHP comment is not terminated unwillingly by method description
|
||||
$mdesc = "/**\n* ".str_replace('*/', '* /', $mdesc)."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$mdesc = "/**\nFunction $xmlrpcfuncname\n";
|
||||
}
|
||||
|
||||
// param parsing
|
||||
$plist = array();
|
||||
$pcount = count($msig);
|
||||
for($i = 1; $i < $pcount; $i++)
|
||||
{
|
||||
$plist[] = "\$p$i";
|
||||
$ptype = $msig[$i];
|
||||
if($ptype == 'i4' || $ptype == 'int' || $ptype == 'boolean' || $ptype == 'double' ||
|
||||
$ptype == 'string' || $ptype == 'dateTime.iso8601' || $ptype == 'base64' || $ptype == 'null')
|
||||
{
|
||||
// only build directly xmlrpcvals when type is known and scalar
|
||||
$innercode .= "\$p$i = new {$prefix}val(\$p$i, '$ptype');\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($encode_php_objects)
|
||||
{
|
||||
$innercode .= "\$p$i =& php_{$prefix}_encode(\$p$i, array('encode_php_objs'));\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$innercode .= "\$p$i =& php_{$prefix}_encode(\$p$i);\n";
|
||||
}
|
||||
}
|
||||
$innercode .= "\$msg->addparam(\$p$i);\n";
|
||||
$mdesc .= '* @param '.xmlrpc_2_php_type($ptype)." \$p$i\n";
|
||||
}
|
||||
if ($client_copy_mode < 2)
|
||||
{
|
||||
$plist[] = '$debug=0';
|
||||
$mdesc .= "* @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n";
|
||||
}
|
||||
$plist = implode(', ', $plist);
|
||||
$mdesc .= '* @return '.xmlrpc_2_php_type($msig[0])." (or an {$prefix}resp obj instance if call fails)\n*/\n";
|
||||
|
||||
$innercode .= "\$res =& \${$this_}client->send(\$msg, $timeout, '$protocol');\n";
|
||||
if ($decode_fault)
|
||||
{
|
||||
if (is_string($fault_response) && ((strpos($fault_response, '%faultCode%') !== false) || (strpos($fault_response, '%faultString%') !== false)))
|
||||
{
|
||||
$respcode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $fault_response)."')";
|
||||
}
|
||||
else
|
||||
{
|
||||
$respcode = var_export($fault_response, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$respcode = '$res';
|
||||
}
|
||||
if ($decode_php_objects)
|
||||
{
|
||||
$innercode .= "if (\$res->faultcode()) return $respcode; else return php_{$prefix}_decode(\$res->value(), array('decode_php_objs'));";
|
||||
}
|
||||
else
|
||||
{
|
||||
$innercode .= "if (\$res->faultcode()) return $respcode; else return php_{$prefix}_decode(\$res->value());";
|
||||
}
|
||||
|
||||
$code = $code . $plist. ") {\n" . $innercode . "\n}\n";
|
||||
|
||||
return array('source' => $code, 'docstring' => $mdesc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given necessary info, generate php code that will rebuild a client object
|
||||
* Take care that no full checking of input parameters is done to ensure that
|
||||
* valid php code is emitted.
|
||||
* @access private
|
||||
*/
|
||||
function build_client_wrapper_code($client, $verbatim_client_copy, $prefix='xmlrpc')
|
||||
{
|
||||
$code = "\$client = new {$prefix}_client('".str_replace("'", "\'", $client->path).
|
||||
"', '" . str_replace("'", "\'", $client->server) . "', $client->port);\n";
|
||||
|
||||
// copy all client fields to the client that will be generated runtime
|
||||
// (this provides for future expansion or subclassing of client obj)
|
||||
if ($verbatim_client_copy)
|
||||
{
|
||||
foreach($client as $fld => $val)
|
||||
{
|
||||
if($fld != 'debug' && $fld != 'return_type')
|
||||
{
|
||||
$val = var_export($val, true);
|
||||
$code .= "\$client->$fld = $val;\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
// only make sure that client always returns the correct data type
|
||||
$code .= "\$client->return_type = '{$prefix}vals';\n";
|
||||
//$code .= "\$client->setDebug(\$debug);\n";
|
||||
return $code;
|
||||
}
|
||||
?>
|
1246
e107_plugins/metaweblog/xmlrpcs.inc
Normal file
1246
e107_plugins/metaweblog/xmlrpcs.inc
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,14 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt) -->
|
||||
<!-- $Id: plugin.xml,v 1.6 2009-09-24 00:11:20 e107coders Exp $ -->
|
||||
<!-- $Id: plugin.xml,v 1.7 2009-10-20 03:49:22 e107coders Exp $ -->
|
||||
|
||||
<e107Plugin name="NFLAN_01" version="2.0" compatibility="0.8" installRequired="true">
|
||||
<author name="e107 Inc." url="http://e107.org" email="jalist@e107.org" />
|
||||
<description>NFLAN_02</description>
|
||||
<category>content</category>
|
||||
<copyright>Copyright e107 Inc e107.org, Licensed under GPL (http://www.gnu.org/licenses/gpl.txt)</copyright>
|
||||
<logLanguageFile filename="languages/--LAN--_admin_newsfeed.php" />
|
||||
<languageFiles>
|
||||
<file type='log' path='languages/--LAN--_admin_newsfeed.php' />
|
||||
</languageFiles>
|
||||
<adminLinks>
|
||||
<link url='admin_config.php' description='Configure Newsfeeds' icon='images/newsfeed_32.png' iconSmall='images/newsfeed_16.png' primary='true' >Configure Newsfeeds</link>
|
||||
</adminLinks>
|
||||
@ -17,7 +19,4 @@
|
||||
</siteLinks>
|
||||
<pluginPrefs>
|
||||
</pluginPrefs>
|
||||
<management>
|
||||
<installDone>NFLAN_02</installDone>
|
||||
</management>
|
||||
</e107Plugin>
|
@ -1,18 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- $Id: plugin.xml,v 1.4 2009-09-24 00:11:20 e107coders Exp $ -->
|
||||
<!-- $Id: plugin.xml,v 1.5 2009-10-20 03:49:22 e107coders Exp $ -->
|
||||
|
||||
<e107Plugin name="PDF_PLUGIN_LAN_1" version="1.0" compatibility="0.8" installRequired="true" releaseUrl=''>
|
||||
<author name="Eric Vanderfeesten (lisa)" url="http://eindhovenseschool.net" email="lisa@eindhovenseschool.net" />
|
||||
<description>PDF_PLUGIN_LAN_2</description>
|
||||
<copyright>Copyright e107 Inc e107.org, Licensed under GPL (http://www.gnu.org/licenses/gpl.txt)</copyright>
|
||||
<logLanguageFile filename="languages/--LAN--_admin_pdf.php" />
|
||||
<languageFiles>
|
||||
<file type='log' path='languages/--LAN--_admin_pdf.php' />
|
||||
</languageFiles>
|
||||
<adminLinks>
|
||||
<link url='admin_pdf_config.php' description='PDF' icon='images/pdf_32.png' iconSmall='images/pdf_16.png' primary='true' >PDF</link>
|
||||
</adminLinks>
|
||||
<pluginPrefs>
|
||||
</pluginPrefs>
|
||||
<management>
|
||||
<installDone>PDF_PLUGIN_LAN_4</installDone>
|
||||
</management>
|
||||
</e107Plugin>
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Id: plugin.xml,v 1.11 2009-09-24 00:11:20 e107coders Exp $ -->
|
||||
<!-- $Id: plugin.xml,v 1.12 2009-10-20 03:49:22 e107coders Exp $ -->
|
||||
<e107Plugin name="ADLAN_PM" version="3.0" compatibility="0.8" installRequired="true">
|
||||
<author name="e107 Inc." email="mcfly@e107.org" />
|
||||
<description>ADLAN_PM_57</description>
|
||||
@ -7,9 +7,4 @@
|
||||
<adminLinks>
|
||||
<link url='pm_conf.php' description='ADLAN_PM_2' icon='images/pvt_message_32.png' iconSmall='images/pvt_message_16.png' primary='true' >ADLAN_PM_2</link>
|
||||
</adminLinks>
|
||||
<management>
|
||||
<install type="fileFunction" file="pm_install.php" function="forum_install" />
|
||||
<uninstall type="fileFunction" file="pm_uninstall.php" function="forum_uninstall" />
|
||||
<upgrade type="fileFunction" file="pm_uninstall" function="forum_upgrade" />
|
||||
</management>
|
||||
</e107Plugin>
|
||||
|
@ -1,10 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Id: plugin.xml,v 1.10 2009-09-24 00:11:20 e107coders Exp $ -->
|
||||
<!-- $Id: plugin.xml,v 1.11 2009-10-20 03:49:22 e107coders Exp $ -->
|
||||
<e107Plugin name="POLL_ADLAN01" version="2.0" compatibility="0.8" installRequired="true" >
|
||||
<author name="e107 Inc." url="http://e107.org" />
|
||||
<description>POLL_ADLAN02</description>
|
||||
<category>content</category>
|
||||
<logLanguageFile filename="languages/--LAN--_admin_poll.php" />
|
||||
<languageFiles>
|
||||
<file type='log' path='languages/--LAN--_admin_poll.php' />
|
||||
</languageFiles>
|
||||
<adminLinks>
|
||||
<link url='admin_config.php' description='POLL_ADLAN03' icon='images/polls_32.png' iconSmall='images/polls_16.png' primary='true' >POLL_ADLAN03</link>
|
||||
</adminLinks>
|
||||
|
@ -1,10 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Id: plugin.xml,v 1.1 2009-09-29 00:03:01 e107coders Exp $ -->
|
||||
<!-- $Id: plugin.xml,v 1.2 2009-10-20 03:49:22 e107coders Exp $ -->
|
||||
<e107Plugin name="Release" version="1.0" compatibility="0.8" installRequired="true" >
|
||||
<author name="e107 Inc." url="http://e107.org" />
|
||||
<description>Manage Release Feeds for e107 Plugins and Themes</description>
|
||||
<category>tools</category>
|
||||
<logLanguageFile filename="languages/--LAN--_admin_poll.php" />
|
||||
<adminLinks>
|
||||
<link url='admin_config.php' description='Configure' icon='images/e107_icon_32.png' iconSmall='images/e107_icon_16.png' primary='true' >Configure</link>
|
||||
</adminLinks>
|
||||
|
@ -1,13 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- $Id: plugin.xml,v 1.8 2009-10-09 18:58:44 e107coders Exp $ -->
|
||||
<!-- $Id: plugin.xml,v 1.9 2009-10-20 03:49:22 e107coders Exp $ -->
|
||||
|
||||
<e107Plugin name="RSS_PLUGIN_LAN_1" version="1.3" compatibility="0.8" installRequired="true">
|
||||
<author name="e107 Inc." url="http://e107.org" />
|
||||
<description>RSS_PLUGIN_LAN_2</description>
|
||||
<compatibility>0.8</compatibility>
|
||||
<category>misc</category>
|
||||
<logLanguageFile filename="languages/--LAN--_admin_rss_menu.php" />
|
||||
<languageFiles>
|
||||
<file type='log' path='languages/--LAN--_admin_rss_menu.php' />
|
||||
</languageFiles>
|
||||
<copyright>Copyright e107 Inc e107.org, Licensed under GPL (http://www.gnu.org/licenses/gpl.txt)</copyright>
|
||||
<adminLinks>
|
||||
<link url='admin_prefs.php' description='LAN_CONFIGURE' icon='images/rss_32.png' iconSmall='images/rss_16.png' primary='true' >LAN_CONFIGURE</link>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Id: plugin.xml,v 1.6 2009-09-24 00:11:20 e107coders Exp $ -->
|
||||
<!-- $Id: plugin.xml,v 1.7 2009-10-20 03:49:22 e107coders Exp $ -->
|
||||
<e107Plugin name="Tagwords" version="1.0" compatibility="0.8" installRequired="true">
|
||||
<author name="e107 Inc." url="http://e107.org/" />
|
||||
<description>A fully featured Tagword system</description>
|
||||
@ -10,7 +10,4 @@
|
||||
<siteLinks>
|
||||
<link url="tagwords/tagwords.php" perm="everyone">Tagwords</link>
|
||||
</siteLinks>
|
||||
<management>
|
||||
<installDone>Tagwords is installed<br />To configure please click on the link in the plugins section of the admin front page</installDone>
|
||||
</management>
|
||||
</e107Plugin>
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Id: plugin.xml,v 1.2 2009-10-12 06:38:01 e107coders Exp $ -->
|
||||
<e107Plugin name="TinyMce" version="1.0" compatibility="0.8" installRequired="true" >
|
||||
<!-- $Id: plugin.xml,v 1.3 2009-10-20 03:49:22 e107coders Exp $ -->
|
||||
<e107Plugin name="TinyMce" version="1.0" compatibility="0.8" installRequired="true">
|
||||
<author name="e107 Inc." url="http://e107.org" />
|
||||
<description>Wysiwyg Text-Area Replacement</description>
|
||||
<category>misc</category>
|
||||
|
62
e107_plugins/tinymce/tinymce_setup.php
Normal file
62
e107_plugins/tinymce/tinymce_setup.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright ( c ) 2001-2008 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* Custom TinyMce install/uninstall/update routines
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/tinymce/tinymce_setup.php,v $
|
||||
* $Revision: 1.1 $
|
||||
* $Date: 2009-10-20 03:49:22 $
|
||||
* $Author: e107coders $
|
||||
*
|
||||
*/
|
||||
|
||||
class tinymce_setup
|
||||
{
|
||||
/*
|
||||
function tinymce_install_pre(&$var)
|
||||
{
|
||||
// print_a($var);
|
||||
// echo "custom install 'pre' function<br /><br />";
|
||||
}
|
||||
*/
|
||||
function tinymce_install_post(&$var)
|
||||
{
|
||||
$sql = e107::getDb();
|
||||
$mes = eMessage::getInstance();
|
||||
|
||||
$query = "INSERT INTO #tinymce (
|
||||
`tinymce_id`, `tinymce_name`, `tinymce_userclass`, `tinymce_plugins`, `tinymce_buttons1`, `tinymce_buttons2`, `tinymce_buttons3`, `tinymce_buttons4`, `tinymce_custom`, `tinymce_prefs`) VALUES
|
||||
(1, 'Simple Users', '252', 'e107bbcode,emoticons', 'bold, italic, underline, undo, redo, link, unlink, image, forecolor, bullist, numlist, outdent, indent, emoticons', '', '', '', '', ''),
|
||||
(2, 'Members', '253', 'e107bbcode,emoticons,table', 'bold, italic, underline, undo, redo, link, unlink, image, forecolor, removeformat, table, bullist, numlist, outdent, indent, emoticons', '', '', '', '', ''),
|
||||
(3, 'Administrators', '254', 'contextmenu,e107bbcode,emoticons,ibrowser,iespell,paste,table,xhtmlxtras', 'bold, italic, underline, undo, redo, link, unlink, image, forecolor, removeformat, table, bullist, numlist, outdent, indent, cleanup, code, emoticons', '', '', '', '', ''),
|
||||
(4, 'Main Admin', '250', 'advhr,advlink,autoresize,compat2x,contextmenu,directionality,emoticons,ibrowser,paste,table,visualchars,wordcount,xhtmlxtras,zoom', 'bold, italic, underline, undo, redo, link, unlink, ibrowser, forecolor, removeformat, table, bullist, numlist, outdent, indent, cleanup, code, emoticons', '', '', '', '', ''
|
||||
);";
|
||||
|
||||
if($sql->db_Select_gen($query))
|
||||
{
|
||||
$mes->add("Default data added to table.", E_MESSAGE_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
$mes->add("Failed to add default table data.", E_MESSAGE_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
function tinymce_uninstall_post(&$var)
|
||||
{
|
||||
// $sql = e107::getDb();
|
||||
}
|
||||
|
||||
function tinymce_upgrade_post(&$var)
|
||||
{
|
||||
// $sql = e107::getDb();
|
||||
}
|
||||
*/
|
||||
}
|
||||
?>
|
@ -1,5 +1,6 @@
|
||||
CREATE TABLE tinymce (
|
||||
`tinymce_id` int(5) NOT NULL AUTO_INCREMENT,
|
||||
`tinymce_name` varchar(255) NOT NULL,
|
||||
`tinymce_userclass` varchar(255) NOT NULL,
|
||||
`tinymce_plugins` text NOT NULL,
|
||||
`tinymce_buttons1` varchar(255) NOT NULL,
|
||||
@ -11,11 +12,4 @@ CREATE TABLE tinymce (
|
||||
PRIMARY KEY (`tinymce_id`)
|
||||
) TYPE=MyISAM;
|
||||
|
||||
INSERT INTO tinymce (
|
||||
`tinymce_id`, `tinymce_name`, `tinymce_userclass`, `tinymce_plugins`, `tinymce_buttons1`, `tinymce_buttons2`, `tinymce_buttons3`, `tinymce_buttons4`, `tinymce_custom`, `tinymce_prefs`) VALUES
|
||||
(1, 'Simple Users', '252', 'e107bbcode,emoticons', 'bold, italic, underline, undo, redo, link, unlink, image, forecolor, bullist, numlist, outdent, indent, emoticons', '', '', '', '', ''),
|
||||
(2, 'Members', '253', 'e107bbcode,emoticons,table', 'bold, italic, underline, undo, redo, link, unlink, image, forecolor, removeformat, table, bullist, numlist, outdent, indent, emoticons', '', '', '', '', ''),
|
||||
(3, 'Administrators', '254', 'contextmenu,e107bbcode,emoticons,ibrowser,iespell,paste,table,xhtmlxtras', 'bold, italic, underline, undo, redo, link, unlink, image, forecolor, removeformat, table, bullist, numlist, outdent, indent, cleanup, code, emoticons', '', '', '', '', ''),
|
||||
(4, 'Main Admin', '250', 'advhr,advlink,autoresize,compat2x,contextmenu,directionality,emoticons,ibrowser,paste,table,visualchars,wordcount,xhtmlxtras,zoom', 'bold, italic, underline, undo, redo, link, unlink, ibrowser, forecolor, removeformat, table, bullist, numlist, outdent, indent, cleanup, code, emoticons', '', '', '', '', ''
|
||||
);
|
||||
|
||||
|
@ -1,12 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- $Id: plugin.xml,v 1.5 2009-09-24 00:11:21 e107coders Exp $ -->
|
||||
<!-- $Id: plugin.xml,v 1.6 2009-10-20 03:49:22 e107coders Exp $ -->
|
||||
|
||||
<e107Plugin name="TRACKBACK_L16" version="1.1" compatibility="0.8" installRequired="true" releaseUrl=''>
|
||||
<author name="e107 Inc." url="http://e107.org" email="jalist@e107.org" />
|
||||
<description>TRACKBACK_L2</description>
|
||||
<copyright>Copyright e107 Inc e107.org, Licensed under GPL (http://www.gnu.org/licenses/gpl.txt)</copyright>
|
||||
<logLanguageFile filename="languages/--LAN--_admin_trackback.php" />
|
||||
<languageFiles>
|
||||
<file type='log' path='languages/--LAN--_admin_trackback.php' />
|
||||
</languageFiles>
|
||||
<adminLinks>
|
||||
<link url='admin_config.php' description='TRACKBACK_L1' icon='images/trackback_32.png' iconSmall='images/trackback_16.png' primary='true' >TRACKBACK_L1</link>
|
||||
</adminLinks>
|
||||
@ -14,7 +16,4 @@
|
||||
<pref name="trackbackEnabled">0</pref>
|
||||
<pref name="trackbackString">Trackback address for this post:</pref>
|
||||
</mainPrefs>
|
||||
<management>
|
||||
<installDone>TRACKBACK_L3</installDone>
|
||||
</management>
|
||||
</e107Plugin>
|
Loading…
x
Reference in New Issue
Block a user