function main_moduleversions($eventData) { global $gEnv, $gLocale, $gXml_def, $gPage_title, $gToolbars; OpenLibrary('modules.library'); $ac_remote = new AmpCentralRemoteServer($gEnv['root']['db'], $eventData['id']); $avail_reps = $ac_remote->ListAvailableRepositories(isset($eventData['refresh']) ? true : false); $avail_mods = $ac_remote->ListAvailableModules($eventData['repid'], isset($eventData['refresh']) ? true : false); $mod_versions = $ac_remote->ListAvailableModuleVersions($eventData['repid'], $eventData['moduleid'], isset($eventData['refresh']) ? true : false); $x_account = new XmlRpcAccount($gEnv['root']['db'], $ac_remote->mAccountId); $headers[0]['label'] = $gLocale->GetStr('version.header'); $headers[1]['label'] = $gLocale->GetStr('dependencies.header'); $headers[2]['label'] = $gLocale->GetStr('installed_version.header'); $gXml_def = '<vertgroup><name>modules</name> <children> <label><name>title</name> <args> <bold>true</bold> <label type="encoded">' . urlencode($x_account->mName . ' - ' . $avail_reps[$eventData['repid']]['name'] . ' - ' . $avail_mods[$eventData['moduleid']]['modid']) . '</label> </args> </label> <table><name>modules</name> <args> <headers type="array">' . huixml_encode($headers) . '</headers> <rowsperpage>10</rowsperpage> <pagesactionfunction>repmodules_list_action_builder</pagesactionfunction> <pagenumber>' . (isset($eventData['pagenumber']) ? $eventData['pagenumber'] : '') . '</pagenumber> <sessionobjectusername>' . $eventData['id'] . '-' . $eventData['repid'] . '-' . $eventData['moduleid'] . '</sessionobjectusername> </args> <children>'; $row = 0; $mod_query =& $gEnv['root']['db']->Execute('SELECT modversion ' . 'FROM modules ' . 'WHERE modid=' . $gEnv['root']['db']->Format_Text($avail_mods[$eventData['moduleid']]['modid'])); while (list($version, $data) = each($mod_versions)) { if (strlen($data['dependencies'])) { $mod_deps = new ModuleDep($gEnv['root']['db']); $dep_check = $mod_deps->CheckModuleDeps(0, '', $mod_deps->ExplodeDeps($data['dependencies'])); } else { $dep_check = false; } if ($mod_query->NumRows()) { $current_version = $mod_query->Fields('modversion'); } else { $current_version = $gLocale->GetStr('none_version.label'); } if ($dep_check == false) { $mod_installable = true; $missing_deps = ''; if ($mod_query->NumRows()) { switch (CompareVersionNumbers($version, $current_version)) { case AMPOLIROS_VERSIONCOMPARE_EQUAL: $label = $gLocale->GetStr('reinstall_module.button'); $icon = 'reload'; break; case AMPOLIROS_VERSIONCOMPARE_MORE: $label = $gLocale->GetStr('update_module.button'); $icon = 'folder_new'; break; case AMPOLIROS_VERSIONCOMPARE_LESS: $label = $gLocale->GetStr('downgrade_module.button'); $icon = 'down'; break; } } else { $label = $gLocale->GetStr('install_module.button'); $icon = 'folder'; } } else { $mod_installable = false; $missing_deps = '<br><strong>' . $gLocale->GetStr('missing_deps.label') . '</strong>'; while (list(, $dep) = each($dep_check)) { $missing_deps .= '<br>' . $dep; } } $toolbars = array(); if ($mod_installable) { $toolbars['main']['install'] = array('label' => $label, 'themeimage' => $icon, 'horiz' => 'true', 'action' => build_events_call_string('', array(array('main', 'repositorymodules', array('id' => $eventData['id'], 'repid' => $eventData['repid'])), array('action', 'installmodule', array('id' => $eventData['id'], 'repid' => $eventData['repid'], 'moduleid' => $eventData['moduleid'], 'version' => $version))))); } $gXml_def .= '<label row="' . $row . '" col="0"><name>version</name> <args> <label type="encoded">' . urlencode($version) . '</label> </args> </label> <label row="' . $row . '" col="1"><name>dependencies</name> <args> <label type="encoded">' . urlencode(str_replace(',', '<br>', $data['dependencies']) . (strlen($data['suggestions']) ? '<br><br><strong>' . $gLocale->GetStr('suggestions.label') . '</strong><br>' . str_replace(',', '<br>', $data['suggestions']) . '<br>' : '') . $missing_deps) . '</label> </args> </label> <label row="' . $row . '" col="2"><name>current</name> <args> <label type="encoded">' . urlencode($current_version) . '</label> </args> </label> <amptoolbar row="' . $row . '" col="3"><name>tb</name> <args> <frame>false</frame> <toolbars type="array">' . huixml_encode($toolbars) . '</toolbars> </args> </amptoolbar>'; $row++; } $gXml_def .= ' </children> </table> </children> </vertgroup>'; $gToolbars['reptools'] = array('refresh' => array('label' => $gLocale->GetStr('refresh.button'), 'themeimage' => 'reload', 'horiz' => 'true', 'action' => build_events_call_string('', array(array('main', 'moduleversions', array('id' => $eventData['id'], 'repid' => $eventData['repid'], 'moduleid' => $eventData['moduleid'], 'refresh' => '1')))))); $gPage_title .= ' - ' . $gLocale->GetStr('moduleversions.title'); }
function CheckUserLogin($username, $password) { global $content; // Check if LDAP Auth has to be used! if (GetConfigSetting("UserDBAuthMode", USERDB_AUTH_INTERNAL) == USERDB_AUTH_LDAP) { // perform user auth using LDAP, will add user record to loganalyzer DB if necessary $myrow = CheckLDAPUserLogin($username, $password); } else { // TODO: SessionTime and AccessLevel check $md5pass = md5(DB_RemoveBadChars($password)); /* DB_RemoveBadChars() needs to be done here to maintain backwards compatibility even if it is not needed here*/ $sqlquery = "SELECT * FROM `" . DB_USERS . "` WHERE username = '******' and password = '******'"; $result = DB_Query($sqlquery); $myrow = DB_GetSingleRow($result, true); } // The admin field must be set! if (isset($myrow['is_admin'])) { $_SESSION['SESSION_LOGGEDIN'] = true; $_SESSION['SESSION_USERNAME'] = $username; $_SESSION['SESSION_USERID'] = $myrow['ID']; $_SESSION['SESSION_ISADMIN'] = $myrow['is_admin']; // Check Readonly setting if ($content['database_installedversion'] > 8) { $_SESSION['SESSION_ISREADONLY'] = $myrow['is_readonly']; } else { $_SESSION['SESSION_ISREADONLY'] = false; } $content['SESSION_LOGGEDIN'] = $_SESSION['SESSION_LOGGEDIN']; $content['SESSION_USERNAME'] = $_SESSION['SESSION_USERNAME']; $content['SESSION_USERID'] = $_SESSION['SESSION_USERID']; $content['SESSION_ISADMIN'] = $_SESSION['SESSION_ISADMIN']; $content['SESSION_ISREADONLY'] = $_SESSION['SESSION_ISREADONLY']; // --- Read Groupmember ship for the user! $sqlquery = "SELECT " . DB_GROUPMEMBERS . ".groupid, " . DB_GROUPMEMBERS . ".is_member " . "FROM `" . DB_GROUPMEMBERS . "` WHERE userid = " . $content['SESSION_USERID'] . " AND `" . DB_GROUPMEMBERS . "`.is_member = 1"; $result = DB_Query($sqlquery); $myrows = DB_GetAllRows($result, true); if (isset($myrows) && count($myrows) > 0) { for ($i = 0; $i < count($myrows); $i++) { if (isset($content['SESSION_GROUPIDS'])) { $content['SESSION_GROUPIDS'] .= ", " . $myrows[$i]['groupid']; } else { $content['SESSION_GROUPIDS'] = $myrows[$i]['groupid']; } } } // Copy into session as well $_SESSION['SESSION_GROUPIDS'] = $content['SESSION_GROUPIDS']; // --- // ---Set LASTLOGIN Time! $result = DB_Query("UPDATE `" . DB_USERS . "` SET last_login = "******" WHERE ID = " . $content['SESSION_USERID']); DB_FreeQuery($result); // --- // --- Extracheck for available database updates! if (isset($content['database_forcedatabaseupdate']) && $content['database_forcedatabaseupdate'] == "yes" && !defined('IS_UPRGADEPAGE')) { RedirectToDatabaseUpgrade(); } // --- // --- Now we check for an PhpLogCon Update $iProxyLen = strlen(GetConfigSetting("UseProxyServerForRemoteQueries", "")); if ($iProxyLen > 0) { // Proxy Server configured, create a context with proxy option! $opts = array('http' => array('proxy' => 'tcp://' . GetConfigSetting("UseProxyServerForRemoteQueries", ""), 'request_fulluri' => true)); $context = stream_context_create($opts); // Create handle with my context! $myHandle = @fopen($content['UPDATEURL'], "r", false, $context); } else { $myHandle = @fopen($content['UPDATEURL'], "r"); } if ($myHandle) { $myBuffer = ""; while (!feof($myHandle)) { $myBuffer .= fgets($myHandle, 4096); } fclose($myHandle); $myLines = explode("\n", $myBuffer); // Compare Version numbers! if (CompareVersionNumbers($content['BUILDNUMBER'], $myLines[0])) { // True means new version available! $_SESSION['UPDATEAVAILABLE'] = true; $_SESSION['UPDATEVERSION'] = $myLines[0]; if (isset($myLines[1])) { $_SESSION['UPDATELINK'] = $myLines[1]; } else { $_SESSION['UPDATELINK'] = "http://www.phplogcon.org"; } } } // --- // Success ! return true; } else { /* if (isset($myrow) && is_numeric($myrow) ) { //return error code! return $myrow; } */ if (GetConfigSetting("DebugUserLogin", 0) == 1) { DieWithFriendlyErrorMsg("Debug Error: Could not find user '" . $username . "' <br><br><B>Sessionarray</B> <pre>" . var_export($_SESSION, true) . "</pre>"); } // Default return false return false; } }
public function isInstalled($modId) { if (!empty($modId)) { $exploded_module_string = $this->ExplodeSingleDep($modId); $mod_id = $exploded_module_string['modid']; $mod_version = $exploded_module_string['modversion']; $module_check = $this->mrAmpDb->Execute('SELECT id,modversion,onlyextension FROM modules WHERE modid=' . $this->mrAmpDb->Format_Text($mod_id)); if ($mod_id == 'php') { $module_check->resultrows = 1; $module_check->currfields['id'] = '0'; $module_check->currfields['modversion'] = PHP_VERSION; $module_check->currfields['onlyextension'] = $this->mrAmpDb->fmtfalse; } else { if (strpos($mod_id, '.extension')) { $mod_id = substr($mod_id, 0, strpos($mod_id, '.extension')); if (extension_loaded($mod_id)) { $module_check->resultrows = 1; $module_check->currfields['id'] = '0'; $module_check->currfields['modversion'] = PHP_VERSION; $module_check->currfields['onlyextension'] = $this->mrAmpDb->fmtfalse; } } } if ($module_check->NumRows()) { if (CompareVersionNumbers($module_check->Fields('modversion'), $mod_version) != AMPOLIROS_VERSIONCOMPARE_LESS) { return $module_check; } } } else { import('com.solarix.ampoliros.io.log.Logger'); $log = new Logger(AMP_LOG); $log->LogEvent('ampoliros.modules_library.moddeps_class.isinstalled', 'Empty module id', LOGGER_ERROR); } return false; }