public static function install_module($module_meta, $is_upgrade = FALSE) { // get the module xml to a temporary location $mod = cms_utils::get_module('ModuleManager'); $xml_filename = modulerep_client::get_repository_xml($module_meta['filename'], $module_meta['size']); if (!$xml_filename) { return array(FALSE, $mod->Lang('error_downloadxml', $module_meta['filename'])); } // get the md5sum of the data from the server. $server_md5 = modulerep_client::get_module_md5($module_meta['filename']); // verify the md5 $dl_md5 = md5_file($xml_filename); if ($server_md5 != $dl_md5) { @unlink($xml_filename); return array(FALSE, $mod->Lang('error_checksum', array($server_md5, $dl_md5))); } // expand the xml $ops = cmsms()->GetModuleOperations(); if (!$ops->ExpandXMLPackage($xml_filename, 1)) { debug_display('error:'); die($ops->GetLastError()); return array(FALSE, $ops->GetLastError()); } @unlink($xml_filename); // update the database. ModuleOperations::get_instance()->QueueForInstall($module_meta['name']); return array(true, ''); }
if (FALSE == can_admin_upload()) { echo '<div class="pageerrorcontainer"><div class="pageoverflow"><p class="pageerror">' . $this->Lang('error_permissions') . '</p></div></div>'; $caninstall = false; } $curletter = 'A'; if (isset($params['curletter'])) { $curletter = $params['curletter']; $_SESSION['mm_curletter'] = $curletter; } else { if (isset($_SESSION['mm_curletter'])) { $curletter = $_SESSION['mm_curletter']; } } // get the modules available in the repository $repmodules = ''; $result = modulerep_client::get_repository_modules($curletter); if (!$result[0]) { $this->_DisplayErrorPage($id, $params, $returnid, $result[1]); return; } $repmodules = $result[1]; // get the modules that are already installed $instmodules = ''; $result = modmgr_utils::get_installed_modules(); if (!$result[0]) { $this->_DisplayErrorPage($id, $params, $returnid, $result[1]); return; } $instmodules = $result[1]; // build a letters list $letters = array();
# Or read it online: http://www.gnu.org/licenses/licenses.html#GPL # #------------------------------------------------------------------------- #END_LICENSE if (!isset($gCms)) { exit; } if (!$this->CheckPermission('Modify Modules')) { exit; } $_SESSION[$this->GetName()]['active_tab'] = 'modules'; if (!isset($params['name'])) { $this->Redirect($id, 'defaultadmin'); } $prefix = trim($params['name']); $repmodules = modulerep_client::get_repository_modules($prefix, FALSE, TRUE); if (!is_array($repmodules) || $repmodules[0] === FALSE) { // for some reason, nothing matched. $this->Redirect($id, 'defaultadmin'); } $repmodules = $repmodules[1]; $instmodules = ''; $result = modmgr_utils::get_installed_modules(); if (!$result[0]) { $this->_DisplayErrorPage($id, $params, $returnid, $result[1]); return; } $instmodules = $result[1]; $caninstall = true; if (FALSE == can_admin_upload()) { echo '<div class="pageerrorcontainer"><div class="pageoverflow"><p class="pageerror">' . $this->Lang('error_permissions') . '</p></div></div>';
if (!isset($params['version'])) { $this->_DisplayErrorPage($id, $params, $returnid, $this->Lang('error_insufficientparams')); return; } $version = $params['version']; $url = $this->GetPreference('module_repository'); if ($url == '') { $this->_DisplayErrorPage($id, $params, $returnid, $this->Lang('error_norepositoryurl')); return; } if (!isset($params['filename'])) { $this->_DisplayErrorPage($id, $params, $returnid, $this->Lang('error_nofilename')); return; } $xmlfile = $params['filename']; $depends = modulerep_client::get_module_depends($xmlfile); if ($depends[0] == false) { $this->_DisplayErrorPage($id, $params, $returnid, $depends[1]); return; } $this->smarty->assign('title', $this->Lang('dependstxt')); $this->smarty->assign('moduletext', $this->Lang('nametext')); $this->smarty->assign('vertext', $this->Lang('vertext')); $this->smarty->assign('xmltext', $this->Lang('xmltext')); $this->smarty->assign('modulename', $name); $this->smarty->assign('moduleversion', $version); $this->smarty->assign('xmlfile', $xmlfile); $this->smarty->assign('link_back', $this->CreateLink($id, 'defaultadmin', $returnid, $this->Lang('back_to_module_manager'))); $txt = ''; if (is_array($depends[1])) { $txt = '<ul>';
$result = modmgr_utils::get_installed_modules(); if (!$result[0]) { $this->_DisplayErrorPage($id, $params, $returnid, $result[1]); return; } $instmodules = $result[1]; if (isset($params['submit'])) { $url = $this->GetPreference('module_repository'); $error = 0; $term = trim($params['term']); if (strlen($term) < 3) { echo $this->ShowErrors($this->Lang('error_searchterm')); return; } $advanced = (int) $params['advanced']; $res = modulerep_client::search($term, $advanced); if (!is_array($res) || $res[0] == FALSE) { echo $this->ShowErrors($this->Lang('error_search') . ' ' . $res[1]); return; } if (!is_array($res[1])) { echo $this->ShowMessage($this->Lang('search_noresults')); return; } $res = $res[1]; $data = array(); if (count($res)) { $res = modmgr_utils::build_module_data($res, $instmodules); } $search_data = array(); for ($i = 0; $i < count($res); $i++) {
# You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Or read it online: http://www.gnu.org/licenses/licenses.html#GPL # #------------------------------------------------------------------------- #END_LICENSE if (!isset($gCms)) { exit; } $active_tab = 'modules'; if (isset($params['active_tab'])) { $active_tab = $params['active_tab']; } $_SESSION[$this->GetName()]['active_tab'] = $active_tab; $allmods = modulerep_client::get_repository_modules('', 0); $deps = array(array('name' => $params['name'], 'version' => $params['version'], 'filename' => $params['filename'], 'by' => '', 'size' => $params['size'])); if (!$allmods[0]) { $this->_DisplayErrorPage($id, $params, $returnid, $allmods[1]); return; } $ret = modmgr_utils::add_dependencies_to_list($params['filename'], $allmods, $deps); if (!$ret[0]) { $this->_DisplayErrorPage($id, $params, $returnid, $ret[1]); return; } // de-dupe list $deps = modmgr_utils::remove_duplicate_dependencies($deps); modmgr_utils::find_unfulfilled_dependencies($deps); $tmp = array(); foreach ($deps as $onedep) {