Permalink
Browse files

Adds compatibility for site plugins while installing the website.

  • Loading branch information...
JB Lebrun
JB Lebrun committed Mar 20, 2018
1 parent de703f3 commit 388de62b5b2e05f5e5b0d5fb4b3663ab9fa2ec8f
@@ -2,15 +2,12 @@
/*
* CaMykS Engine
* Developed by : camyks.net
* Author : CaMykS Team <camyks.contact@gmail.com>
* CaMykS Version : 1.0a
* Object Version : 1.0
* Author : CaMykS Team <camyks.contact@gmail.com>
* CaMykS Version : 1.0
* Object Version : 1.0
* Object Type : Engine / Tool Library
* Creation Date : Jun 2005
* Last Modif Date : Jan 2008
* History :
* * 05-06-xx : Initial File
* * 08-01-07 : Rebuild input methods with generic plugin methods
* Creation Date : Jun 2005
* Last Modif Date : Mar 2018
*
* Inputs static methods
*/
@@ -22,8 +19,12 @@
* @return Input object
* @access public
*/
function input_get( $name, $path_type='camyks' ) {
return plugin_get( 'input', $name, $path_type );
function input_get($name, $path_type=false) {
if ($path_type !== false)
return plugin_get('input', $name, $path_type);
if (($p = plugin_get('input', $name, 'camyks')) !== false)
return $p;
return plugin_get('input', $name, 'site');
}
/*
@@ -33,7 +34,7 @@ function input_get( $name, $path_type='camyks' ) {
* @return array
* @access public
*/
function input_getList( $path, $path_type='camyks' ) {
return plugin_getList( $path.'/input', $path_type );
function input_getList($path, $path_type='camyks') {
return plugin_getList($path.'/input', $path_type);
}
?>
@@ -2,15 +2,12 @@
/*
* CaMykS Engine
* Developed by : camyks.net
* Author : CaMykS Team <camyks.contact@gmail.com>
* CaMykS Version : 1.0a
* Object Version : 1.0
* Object Type : Engine / Tool Library
* Creation Date : Jun 2005
* Last Modif Date : Jan 2008
* History :
* * 05-06-XX : Initial File
* * 08-01-07 : Rebuild module methods with generic plugin methods
* Author : CaMykS Team <camyks.contact@gmail.com>
* CaMykS Version : 1.0
* Object Version : 1.0
* Object Type : Engine / Tool Library
* Creation Date : Jun 2005
* Last Modif Date : Mar 2018
*
* Module static methods
*/
@@ -22,8 +19,12 @@
* @return mixed
* @access public
*/
function module_get( $name, $path_type='camyks' ) {
return plugin_get('module', $name, $path_type );
function module_get($name, $path_type=false) {
if ($path_type !== false)
return plugin_get('module', $name, $path_type);
if (($p = plugin_get('module', $name, 'camyks')) !== false)
return $p;
return plugin_get('module', $name, 'site');
}
/*
@@ -33,7 +34,7 @@ function module_get( $name, $path_type='camyks' ) {
* @return array
* @access public
*/
function module_getList( $path, $path_type='camyks' ) {
return plugin_getList( $path.'/module', $path_type );
function module_getList($path, $path_type='camyks') {
return plugin_getList($path.'/module', $path_type);
}
?>
@@ -2,15 +2,12 @@
/*
* CaMykS Engine
* Developed by : camyks.net
* Author : CaMykS Team <camyks.contact@gmail.com>
* CaMykS Version : 1.0a
* Object Version : 1.0
* Object Type : Engine / Tool Library
* Creation Date : Jun 2005
* Last Modif Date : Jan 2008
* History :
* * 05-06-xx : Initial File
* * 08-01-07 : Rebuild template methods with generic plugin methods
* Author : CaMykS Team <camyks.contact@gmail.com>
* CaMykS Version : 1.0
* Object Version : 1.0
* Object Type : Engine / Tool Library
* Creation Date : Jun 2005
* Last Modif Date : Mar 2018
*
* Template static methods
*/
@@ -22,8 +19,12 @@
* @return Template object
* @access public
*/
function template_get( $name, $path_type='camyks' ) {
return plugin_get( 'template', $name, $path_type );
function template_get($name, $path_type=false) {
if ($path_type !== false)
return plugin_get('template', $name, $path_type);
if (($p = plugin_get('template', $name, 'camyks')) !== false)
return $p;
return plugin_get('template', $name, 'site');
}
/*
@@ -33,7 +34,7 @@ function template_get( $name, $path_type='camyks' ) {
* @return array
* @access public
*/
function template_getList( $path, $path_type='camyks' ) {
return plugin_getList( $path.'/template', $path_type );
function template_getList($path, $path_type='camyks') {
return plugin_getList($path.'/template', $path_type);
}
?>
@@ -2,15 +2,12 @@
/*
* CaMykS Engine
* Developed by : camyks.net
* Author : CaMykS Team <camyks.contact@gmail.com>
* CaMykS Version : 1.0a
* Object Version : 1.0
* Object Type : Engine / Tool library
* Creation Date : Jun 2005
* Last Modif Date : Jan 2002
* History :
* * 05-06-xx : Initial File
* * 08-01-07 : Rebuild theme methods with generic plugin methods
* Author : CaMykS Team <camyks.contact@gmail.com>
* CaMykS Version : 1.0
* Object Version : 1.0
* Object Type : Engine / Tool Library
* Creation Date : Jun 2005
* Last Modif Date : Mar 2018
*
* Theme static methods
*/
@@ -22,8 +19,12 @@
* @return Theme object
* @access public
*/
function theme_get( $name, $path_type='camyks' ) {
return plugin_get( 'theme', $name, $path_type );
function theme_get($name, $path_type=false) {
if ($path_type !== false)
return plugin_get('theme', $name, $path_type);
if (($p = plugin_get('theme', $name, 'camyks')) !== false)
return $p;
return plugin_get('theme', $name, 'site');
}
/*
@@ -186,34 +186,35 @@ final class Admin_PluginManagerItem {
* @access public
*/
public function active_plugin( $plugin=null, $type=null, $location=null, $active=null ) {
if ( isset( $plugin ) )
if (isset($plugin))
$this->pluginvalue = $plugin;
if ( isset( $type ) )
if (isset($type))
$this->typevalue = $type;
if ( isset( $location ) )
if (isset($location))
$this->locationvalue = $location;
if ( isset( $active) )
if (isset($active))
$this->activevalue = $active;
/* install module if needed */
switch ( $this->typevalue ) {
switch ($this->typevalue) {
case 'module':
$plugin = module_get ($this->pluginvalue, $this->locationvalue);
if ( $plugin->is_installed()===false and $plugin->install()===false ) {
$plugin = module_get($this->pluginvalue, $this->locationvalue);
if ($plugin->is_installed()===false and $plugin->install()===false) {
return false;
}
break;
case 'template':
$plugin = template_get ($this->pluginvalue, $this->locationvalue);
$plugin = template_get($this->pluginvalue, $this->locationvalue);
break;
case 'theme':
$plugin = theme_get ($this->pluginvalue, $this->locationvalue);
$plugin = theme_get($this->pluginvalue, $this->locationvalue);
break;
case 'input':
$plugin = input_get ($this->pluginvalue, $this->locationvalue);
$plugin = input_get($this->pluginvalue, $this->locationvalue);
break;
}
$this->versionvalue = $plugin->version;
$this->locationvalue = $plugin->path_type;
/* active plugin in database */
return $this->save_toDatabase();
@@ -55,7 +55,7 @@ final class Tool_Installer extends Module {
*/
public function init_admin () {
global $camyks;
/* get mode */
$mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : 'welcome';
@@ -224,7 +224,7 @@ final class Tool_Installer extends Module {
'link' => '?mode=configuration',
));
if ( $this->allowInstall ) {
if ($this->allowInstall) {
$this->buttons[] = array(
'title' => $this->get_translation('install'),
'link' => '?mode=install',
@@ -368,7 +368,7 @@ final class Tool_Installer extends Module {
'value' => '',
);
if ( isset($camyks->site_conf['url']) and $camyks->site_conf['url'] != '' ) {
if (isset($camyks->site_conf['url']) and $camyks->site_conf['url'] != '') {
$message['value'] = $this->get_translation('ok');
$message['color'] = $this->textColors['yes'];
} else {
@@ -562,13 +562,13 @@ final class Tool_Installer extends Module {
foreach ($camyks->neededModules as $p) {
$message = array(
'type' => 'message',
'name' => $camyks->get_translation('modulex', $p['name'])
'name' => $camyks->get_translation('modulex', $p['name']),
);
if ( !isset($camyks->modules[$p['name']])) {
if (!isset($camyks->modules[$p['name']])) {
$message['value'] = $this->get_translation('notfound');
$message['color'] = $this->textColors['no'];
$this->allowInstall = false;
} else if ( $camyks->modules[$p['name']]->version < $p['version'] ) {
} elseif ($camyks->modules[$p['name']]->version < $p['version']) {
$message['value'] = $this->get_translation('oldversion');
$message['color'] = $this->textColors['no'];
$this->allowInstall = false;
@@ -586,11 +586,11 @@ final class Tool_Installer extends Module {
'name' => $camyks->get_translation('inputx', $p['name']),
);
if ( !isset($camyks->inputs[$p['name']])) {
if (!isset($camyks->inputs[$p['name']])) {
$message['value'] = $this->get_translation('notfound');
$message['color'] = $this->textColors['no'];
$this->allowInstall = false;
} else if ( $camyks->inputs[$p['name']]->version < $p['version'] ) {
} elseif ($camyks->inputs[$p['name']]->version < $p['version']) {
$message['value'] = $this->get_translation('oldversion');
$message['color'] = $this->textColors['no'];
$this->allowInstall = false;
@@ -605,14 +605,14 @@ final class Tool_Installer extends Module {
foreach ($camyks->neededThemes as $p) {
$message = array(
'type' => 'message',
'name' => $camyks->get_translation('themex', $p['name'])
'name' => $camyks->get_translation('themex', $p['name']),
);
if ( !isset($camyks->themes[$p['name']])) {
if (!isset($camyks->themes[$p['name']])) {
$message['value'] = $this->get_translation('notfound');
$message['color'] = $this->textColors['no'];
$this->allowInstall = false;
} else if ( $camyks->themes[$p['name']]->version < $p['version'] ) {
} elseif ($camyks->themes[$p['name']]->version < $p['version']) {
$message['value'] = $this->get_translation('oldversion');
$message['color'] = $this->textColors['no'];
$this->allowInstall = false;
@@ -627,14 +627,14 @@ final class Tool_Installer extends Module {
foreach ($camyks->neededTemplates as $p) {
$message = array(
'type' => 'message',
'name' => $camyks->get_translation('templatex', $p['name'])
'name' => $camyks->get_translation('templatex', $p['name']),
);
if ( !isset($camyks->templates[$p['name']])) {
if (!isset($camyks->templates[$p['name']])) {
$message['value'] = $this->get_translation('notfound');
$message['color'] = $this->textColors['no'];
$this->allowInstall = false;
} else if ( $camyks->templates[$p['name']]->version < $p['version'] ) {
} elseif ($camyks->templates[$p['name']]->version < $p['version']) {
$message['value'] = $this->get_translation('oldversion');
$message['color'] = $this->textColors['no'];
$this->allowInstall = false;
@@ -655,7 +655,7 @@ final class Tool_Installer extends Module {
global $camyks;
/* get database connection */
$camyks->db_conn = new Database_connection (
$camyks->db_conn = new Database_connection(
$camyks->site_conf['database_host'] != '' ? $camyks->site_conf['database_host']:$camyks->_conf['database_host'],
$camyks->site_conf['database_login'],
$camyks->site_conf['database_pwd'],
@@ -715,7 +715,7 @@ final class Tool_Installer extends Module {
);
/* check if link already exists */
if (file_exists( realpath('./'.$l )))
if (file_exists(realpath('./'.$l)))
continue;
/* create link */
@@ -759,9 +759,9 @@ final class Tool_Installer extends Module {
foreach ($camyks->neededModules as $p) {
$message = array(
'type'=>'message',
'name'=>$this->get_translation('module_x_installed', $p['name'] )
'name'=>$this->get_translation('module_x_installed', $p['name']),
);
if ($camyks->modules['Admin_PluginManager']->install_plugin($p['name'], 'module', 'camyks', 1)) {
if ($camyks->modules['Admin_PluginManager']->install_plugin($p['name'], 'module', false, 1)) {
$message['value'] = $camyks->get_translation('yes');
$message['color'] = $this->textColors['yes'];
$this->summary[] = $message;
@@ -778,10 +778,10 @@ final class Tool_Installer extends Module {
foreach ($camyks->neededInputs as $p) {
$message = array(
'type' => 'message',
'name' => $this->get_translation('input_x_installed', $p['name'])
'name' => $this->get_translation('input_x_installed', $p['name']),
);
if ($camyks->modules['Admin_PluginManager']->install_plugin($p['name'], 'input', 'camyks', 1)) {
if ($camyks->modules['Admin_PluginManager']->install_plugin($p['name'], 'input', false, 1)) {
$message['value'] = $camyks->get_translation('yes');
$message['color'] = $this->textColors['yes'];
$this->summary[] = $message;
@@ -798,10 +798,10 @@ final class Tool_Installer extends Module {
foreach ($camyks->neededThemes as $p) {
$message = array(
'type' => 'message',
'name' => $this->get_translation('theme_x_installed', $p['name'])
'name' => $this->get_translation('theme_x_installed', $p['name']),
);
if ($camyks->modules['Admin_PluginManager']->install_plugin($p['name'], 'theme', 'camyks', 1)) {
if ($camyks->modules['Admin_PluginManager']->install_plugin($p['name'], 'theme', false, 1)) {
$message['value'] = $camyks->get_translation('yes');
$message['color'] = $this->textColors['yes'];
$this->summary[] = $message;
@@ -821,7 +821,7 @@ final class Tool_Installer extends Module {
'name' => $this->get_translation('template_x_installed', $p['name']),
);
if ( $camyks->modules['Admin_PluginManager']->install_plugin($p['name'], 'template', 'camyks', 1) ) {
if ( $camyks->modules['Admin_PluginManager']->install_plugin($p['name'], 'template', false, 1) ) {
$message['value'] = $camyks->get_translation('yes');
$message['color'] = $this->textColors['yes'];
$this->summary[] = $message;

0 comments on commit 388de62

Please sign in to comment.