/** * Puts the datastructures for this plugin into the glFusion database * Note: Corresponding uninstall routine is in functions.inc * * @return boolean True if successful False otherwise */ function plugin_install_lglib() { global $INSTALL_plugin, $_LGLIB_CONF; COM_errorLog("Attempting to install the {$_LGLIB_CONF['pi_name']} plugin", 1); $ret = INSTALLER_install($INSTALL_plugin[$_LGLIB_CONF['pi_name']]); if ($ret > 0) { return false; } else { return true; } }
/** * Puts the datastructures for this plugin into the glFusion database * Note: Corresponding uninstall routine is in functions.inc * * @return boolean True if successful False otherwise */ function plugin_install_paypal() { global $INSTALL_plugin, $_PP_CONF; $pi_name = $_PP_CONF['pi_name']; $pi_display_name = $_PP_CONF['pi_display_name']; COM_errorLog("Attempting to install the {$pi_display_name} plugin", 1); $ret = INSTALLER_install($INSTALL_plugin[$pi_name]); if ($ret > 0) { return false; } return true; }
/** * Puts the datastructures for this plugin into the glFusion database * * Note: Corresponding uninstall routine is in functions.inc * * @return boolean True if successful False otherwise * */ function plugin_install_bad_behavior2() { global $INSTALL_plugin, $_BB2_CONF; $pi_name = $_BB2_CONF['pi_name']; $pi_display_name = $_BB2_CONF['pi_display_name']; $pi_version = $_BB2_CONF['pi_version']; COM_errorLog("Attempting to install the {$pi_display_name} plugin", 1); $ret = INSTALLER_install($INSTALL_plugin[$pi_name]); if ($ret > 0) { return false; } return true; }
/** * Puts the datastructures for this plugin into the glFusion database * * Note: Corresponding uninstall routine is in functions.inc * * @return boolean True if successful False otherwise * */ function plugin_install_filemgmt() { global $INSTALL_plugin, $CONF_FM; $pi_name = $CONF_FM['pi_name']; $pi_display_name = $CONF_FM['pi_display_name']; $pi_version = $CONF_FM['pi_version']; COM_errorLog("Attempting to install the {$pi_display_name} plugin", 1); $ret = INSTALLER_install($INSTALL_plugin[$pi_name]); if ($ret > 0) { return false; } return true; }
/** * Puts the datastructures for this plugin into the glFusion database * Note: Corresponding uninstall routine is in functions.inc * * @return boolean True if successful False otherwise */ function plugin_install_evlist() { global $INSTALL_plugin, $_EV_CONF, $_TABLES; $pi_name = $_EV_CONF['pi_name']; $pi_display_name = $_EV_CONF['pi_display_name']; $pi_version = $_EV_CONF['pi_version']; COM_errorLog("Attempting to install the {$pi_display_name} plugin", 1); $ret = INSTALLER_install($INSTALL_plugin[$pi_name]); if ($ret > 0) { return false; } return true; }
/** * Puts the datastructures for this plugin into the glFusion database. * Note: Corresponding uninstall routine is in functions.inc. * * @return boolean True if successful, False otherwise */ function plugin_install_classifieds() { global $INSTALL_plugin, $_CONF_ADVT; $pi_name = $_CONF_ADVT['pi_name']; $pi_display_name = $_CONF_ADVT['pi_display_name']; $pi_version = $_CONF_ADVT['pi_version']; COM_errorLog("Attempting to install the {$pi_display_name} plugin", 1); $ret = INSTALLER_install($INSTALL_plugin[$pi_name]); if ($ret > 0) { return false; } return true; }
/** * Install value added plugins * * @param string $plugin plugin name * @return boolean true: success; false: an error occured * */ function INST_pluginAutoInstall($plugin) { global $_CONF, $_TABLES, $_DB_table_prefix; global $_DB_dbms; $ret = false; if (!@file_exists($_CONF['path'] . '/system/lib-install.php')) { return false; } require_once $_CONF['path'] . '/system/lib-install.php'; if (file_exists($_CONF['path'] . '/plugins/' . $plugin . '/autoinstall.php')) { require_once $_CONF['path'] . '/plugins/' . $plugin . '/autoinstall.php'; $ret = INSTALLER_install($INSTALL_plugin[$plugin]); if ($ret == 0) { $ret = true; } else { $ret = false; } } return $ret; }
/** * Copies and installs new style plugins * * Copies all files the proper place and runs the automated installer * or upgrade. * * @return string Formatted HTML containing the page body * */ function post_uploadProcess() { global $_CONF, $_PLUGINS, $_TABLES, $pluginData, $LANG32, $_DB_dbms, $_DB_table_prefix; $retval = ''; $upgrade = false; $masterErrorCount = 0; $masterErrorMsg = ''; $pluginData = array(); $pluginData['id'] = COM_applyFilter($_POST['pi_name']); $pluginData['name'] = $pluginData['id']; $pluginData['version'] = COM_applyFilter($_POST['pi_version']); $pluginData['url'] = COM_applyFilter($_POST['pi_url']); $pluginData['glfusionversion'] = COM_applyFilter($_POST['pi_gl_version']); $upgrade = COM_applyFilter($_POST['upgrade'], true); $tdir = COM_applyFilter($_POST['temp_dir']); $tdir = preg_replace('/[^a-zA-Z0-9\\-_\\.]/', '', $tdir); $tdir = str_replace('..', '', $tdir); $tmp = $_CONF['path_data'] . $tdir; $pluginData = array(); $rc = _pi_parseXML($tmp); if ($rc == -1) { // no xml file found return _pi_errorBox($LANG32[74]); } clearstatcache(); $permError = 0; $permErrorList = ''; // copy to proper directories if (defined('DEMO_MODE')) { _pi_deleteDir($tmp); COM_setMessage(503); echo COM_refresh($_CONF['site_admin_url'] . '/plugins.php'); exit; } if (function_exists('set_time_limit')) { @set_time_limit(30); } $rc = _pi_dir_copy($tmp . '/' . $pluginData['id'] . '/', $_CONF['path'] . 'plugins/' . $pluginData['id']); list($success, $failed, $size, $faillist) = explode(',', $rc); if ($failed > 0) { $permError++; $t = array(); $t = explode('|', $faillist); if (is_array($t)) { foreach ($t as $failedFile) { $permErrorList .= sprintf($LANG32[45], $failedFile, $_CONF['path'] . 'plugins/' . $pluginData['id']); } } } if (function_exists('set_time_limit')) { @set_time_limit(30); } if (file_exists($tmp . '/' . $pluginData['id'] . '/admin/')) { $rc = _pi_dir_copy($tmp . '/' . $pluginData['id'] . '/admin/', $_CONF['path_html'] . 'admin/plugins/' . $pluginData['id']); list($success, $failed, $size, $faillist) = explode(',', $rc); if ($failed > 0) { $permError++; $t = array(); $t = explode('|', $faillist); if (is_array($t)) { foreach ($t as $failedFile) { $permErrorList .= sprintf($LANG32[45], $failedFile, $_CONF['path'] . 'plugins/' . $pluginData['id']); } } } _pi_deleteDir($_CONF['path'] . 'plugins/' . $pluginData['id'] . '/admin/'); } if (function_exists('set_time_limit')) { @set_time_limit(30); } if (file_exists($tmp . '/' . $pluginData['id'] . '/public_html/')) { $rc = _pi_dir_copy($tmp . '/' . $pluginData['id'] . '/public_html/', $_CONF['path_html'] . $pluginData['id']); list($success, $failed, $size, $faillist) = explode(',', $rc); if ($failed > 0) { $permError++; $t = array(); $t = explode('|', $faillist); if (is_array($t)) { foreach ($t as $failedFile) { $permErrorList .= sprintf($LANG32[45], $failedFile, $_CONF['path'] . 'plugins/' . $pluginData['id']); } } } _pi_deleteDir($_CONF['path'] . 'plugins/' . $pluginData['id'] . '/public_html/'); } if (function_exists('set_time_limit')) { @set_time_limit(30); } if (file_exists($tmp . '/' . $pluginData['id'] . '/themefiles/')) { // determine where to copy them, first check to see if layout was defined in xml if (isset($pluginData['layout']) && $pluginData['layout'] != '') { $destinationDir = $_CONF['path_html'] . 'layout/' . $pluginData['layout'] . '/'; fusion_io_mkdir_p($destinationDir); } else { $destinationDir = $_CONF['path_html'] . 'layout/nouveau/' . $pluginData['id'] . '/'; } $rc = _pi_dir_copy($tmp . '/' . $pluginData['id'] . '/themefiles/', $destinationDir); list($success, $failed, $size, $faillist) = explode(',', $rc); if ($failed > 0) { $permError++; $t = array(); $t = explode('|', $faillist); if (is_array($t)) { foreach ($t as $failedFile) { $permErrorList .= sprintf($LANG32[45], $failedFile, $_CONF['path'] . 'plugins/' . $pluginData['id']); } } } _pi_deleteDir($_CONF['path'] . 'plugins/' . $pluginData['id'] . '/themefiles/'); } if (function_exists('set_time_limit')) { @set_time_limit(30); } if ($permError != 0) { $errorMessage = '<h2>' . $LANG32[42] . '</h2>' . $LANG32[43] . $permErrorList . '<br />' . $LANG32[44]; _pi_deleteDir($tmp); return _pi_errorBox($errorMessage); } if (isset($pluginData['dataproxydriver']) && $pluginData['dataproxydriver'] != '') { if (file_exists($_CONF['path'] . 'plugins/dataproxy/drivers/')) { $src = $tmp . '/' . $pluginData['id'] . '/dataproxy/' . $pluginData['dataproxydriver']; $dest = $_CONF['path'] . 'plugins/dataproxy/drivers/' . $pluginData['dataproxydriver']; @copy($src, $dest); } } _pi_deleteDir($tmp); if (is_array($pluginData['renamedist'])) { foreach ($pluginData['renamedist'] as $fileToRename) { $rc = true; if (strncmp($fileToRename, 'admin', 5) == 0) { // we have a admin file to rename.... $absoluteFileName = substr($fileToRename, 6); $lastSlash = strrpos($fileToRename, '/'); if ($lastSlash === false) { continue; } $pathTo = substr($fileToRename, 0, $lastSlash); if ($pathTo != '') { $pathTo .= '/'; } $lastSlash++; $fileNameDist = substr($fileToRename, $lastSlash); $lastSlash = strrpos($fileNameDist, '.'); if ($lastSlash === false) { continue; } $fileName = substr($fileNameDist, 0, $lastSlash); if (!file_exists($_CONF['path_html'] . 'admin/plugins/' . $pluginData['id'] . $pathTo . $fileName)) { COM_errorLog("PLG-INSTALL: Renaming " . $fileNameDist . " to " . $_CONF['path_html'] . 'admin/plugins/' . $pluginData['id'] . $pathTo . $fileName); $rc = @copy($_CONF['path_html'] . 'admin/plugins/' . $pluginData['id'] . $absoluteFileName, $_CONF['path_html'] . 'admin/plugins/' . $pluginData['id'] . $pathTo . $fileName); if ($rc === false) { COM_errorLog("PLG-INSTALL: Unable to copy " . $_CONF['path_html'] . 'admin/plugins/' . $pluginData['id'] . $absoluteFileName . " to " . $_CONF['path_html'] . 'admin/plugins/' . $pluginData['id'] . $pathTo . $fileName); $masterErrorCount++; $masterErrorMsg .= sprintf($LANG32[75], $_CONF['path_html'] . 'admin/plugins/' . $pluginData['id'] . $absoluteFileName, $_CONF['path_html'] . 'admin/plugins/' . $pluginData['id'] . $pathTo . $fileName); } } } elseif (strncmp($fileToRename, 'public_html', 10) == 0) { // we have a public_html file to rename... $absoluteFileName = substr($fileToRename, 11); $lastSlash = strrpos($absoluteFileName, '/'); if ($lastSlash !== false) { $pathTo = substr($absoluteFileName, 0, $lastSlash); if ($pathTo != '') { $pathTo .= '/'; } } else { $pathTo = ''; } $lastSlash++; $fileNameDist = substr($absoluteFileName, $lastSlash); $lastSlash = strrpos($fileNameDist, '.'); if ($lastSlash === false) { continue; } $fileName = substr($fileNameDist, 0, $lastSlash); if (!file_exists($_CONF['path_html'] . $pluginData['id'] . $pathTo . $fileName)) { COM_errorLog("PLG-INSTALL: Renaming " . $fileNameDist . " to " . $_CONF['path_html'] . $pluginData['id'] . $pathTo . $fileName); $rc = @copy($_CONF['path_html'] . $pluginData['id'] . $absoluteFileName, $_CONF['path_html'] . $pluginData['id'] . $pathTo . $fileName); if ($rc === false) { COM_errorLog("PLG-INSTALL: Unable to copy " . $_CONF['path_html'] . $pluginData['id'] . $absoluteFileName . " to " . $_CONF['path_html'] . $pluginData['id'] . $pathTo . $fileName); $masterErrorCount++; $masterErrorMsg .= sprintf($LANG32[75], $_CONF['path_html'] . $pluginData['id'] . $absoluteFileName, $_CONF['path_html'] . $pluginData['id'] . $pathTo . $fileName); } } } else { // must be some other file relative to the plugin/pluginname/ directory $absoluteFileName = $fileToRename; $lastSlash = strrpos($fileToRename, '/'); $pathTo = substr($fileToRename, 0, $lastSlash); if ($pathTo != '') { $pathTo .= '/'; } $lastSlash++; $fileNameDist = substr($fileToRename, $lastSlash); $lastSlash = strrpos($fileNameDist, '.'); if ($lastSlash === false) { continue; } $fileName = substr($fileNameDist, 0, $lastSlash); if (!file_exists($_CONF['path'] . 'plugins/' . $pluginData['id'] . '/' . $pathTo . $fileName)) { COM_errorLog("PLG-INSTALL: Renaming " . $fileNameDist . " to " . $_CONF['path'] . 'plugins/' . $pluginData['id'] . '/' . $pathTo . $fileName); $rc = @copy($_CONF['path'] . 'plugins/' . $pluginData['id'] . '/' . $absoluteFileName, $_CONF['path'] . 'plugins/' . $pluginData['id'] . '/' . $pathTo . $fileName); if ($rc === false) { COM_errorLog("PLG-INSTALL: Unable to copy " . $_CONF['path'] . 'plugins/' . $pluginData['id'] . '/' . $absoluteFileName . " to " . $_CONF['path'] . 'plugins/' . $pluginData['id'] . '/' . $pathTo . $fileName); $masterErrorCount++; $masterErrorMsg .= sprintf($LANG32[75], $_CONF['path'] . 'plugins/' . $pluginData['id'] . '/' . $absoluteFileName, $_CONF['path'] . 'plugins/' . $pluginData['id'] . '/' . $pathTo . $fileName); } } } } } // handle masterErrorCount here, if not 0, display error and ask use to manually install via the plugin admin screen. // all files have been copied, so all they really should need to do is fix the error above and then run. if ($masterErrorCount != 0) { $errorMessage = '<h2>' . $LANG32[42] . '</h2>' . $LANG32[43] . $masterErrorMsg . '<br />' . $LANG32[44]; return _pi_errorBox($errorMessage); } if (function_exists('set_time_limit')) { @set_time_limit(30); } if ($upgrade == 0) { // fresh install USES_lib_install(); $pi_name = $pluginData['id']; $pi_display_name = $pluginData['name']; $pi_version = $pluginData['version']; $gl_version = $pluginData['glfusionversion']; $pi_url = $pluginData['url']; if (file_exists($_CONF['path'] . 'plugins/' . $pluginData['id'] . '/autoinstall.php')) { require_once $_CONF['path'] . 'plugins/' . $pluginData['id'] . '/autoinstall.php'; $ret = INSTALLER_install($INSTALL_plugin[$pi_name]); if ($ret == 0) { CTL_clearCache(); COM_setMessage(44); echo COM_refresh($_CONF['site_admin_url'] . '/plugins.php'); exit; } else { return _pi_errorBox($LANG32[54]); } } else { return _pi_errorBox($LANG32[55]); } } else { // upgrade - force refresh to load new functions.inc echo COM_refresh($_CONF['site_admin_url'] . '/plugin_upload.php?mode=upgrade&pi=' . $pluginData['id']); exit; } CTL_clearCache(); // show status (success or fail) return $retval; }