public function __call($name, $arguments) { try { $res = $this->service->__call($name, $arguments); } catch (Exception $e) { if ($e->faultcode == 'not_authorized') { popup_error(_('You are not allowed to perform this action')); } else { popup_error(self::format_soap_error_message($e)); } return null; } if (defined('DEBUG_MODE') && DEBUG_MODE === true) { popup_info('soap Call ' . $name); } return $res; }
function adminAuthenticate($login_, $password_) { if (array_key_exists('no_ssl', $_SESSION)) { unset($_SESSION['no_ssl']); } try { $service = new SessionManager($login_, $password_, true); $ret = $service->test_link_connected(); } catch (Exception $e) { if ($e->faultcode == 'auth_failed') { $_SESSION['admin_error'] = _('There was an error with your authentication'); return false; } if (defined('DEBUG_MODE') && DEBUG_MODE === true) { popup_error('Unable to login the Session Manager using HTTPS method, retry with HTTP'); } try { $service = new SessionManager($login_, $password_, false); $ret = $service->test_link_connected(); } catch (Exception $e) { if ($e->faultcode == 'auth_failed') { $_SESSION['admin_error'] = _('There was an error with your authentication'); return false; } if (defined('DEBUG_MODE') && DEBUG_MODE === true) { popup_error($service->format_soap_error_message($e)); } die_error(_('Unable to initialize communication with Session Manager')); } $_SESSION['no_ssl'] = true; if (defined('DEBUG_MODE') && DEBUG_MODE === true) { popup_info('Succefully connected the Session Manager using HTTP method, will alwais use HTTP for this session'); } } $_SESSION['admin_login'] = $login_; $_SESSION['admin_password'] = $password_; $_SESSION['service'] = $service; return true; }
} $prefs->initialize(); $prefs->set('general', 'sql', $elements_form['general']['sql']); } else { $elements_form = formToArray($_POST); $prefs = new Preferences_admin($elements_form); } $ret = $prefs->isValid(); if ($ret === true) { $ret = $prefs->backup(); if ($ret > 0) { $buf = $prefs->get('general', 'admin_language'); $language = locale2unix($buf); setlocale(LC_ALL, $language . '.UTF-8'); // configuration saved popup_info(_('Configuration successfully saved')); redirect('index.php'); } else { header_static(_('Configuration')); echo 'problem : configuration not saved<br>'; // TODO (class msg...) + gettext footer_static(); } } else { // conf not valid if ($setup) { popup_error('Error : ' . $ret); redirect('configuration.php?action=init'); } else { header_static(_('Configuration')); echo '<p class="msg_error centered">' . $ret . '</p>';
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ require_once dirname(dirname(__FILE__)) . '/includes/core.inc.php'; require_once dirname(dirname(__FILE__)) . '/includes/page_template.php'; if (!checkAuthorization('viewNews')) { redirect('index.php'); } if (isset($_REQUEST['action'])) { if ($_REQUEST['action'] == 'rename' && isset($_REQUEST['id'])) { if (!checkAuthorization('manageNews')) { redirect(); } if (isset($_REQUEST['news_title']) && isset($_REQUEST['news_content'])) { $res = $_SESSION['service']->news_modify($_REQUEST['id'], $_REQUEST['news_title'], $_REQUEST['news_content']); if ($res === true) { popup_info(_('News successfully modified')); } } redirect(); } if ($_REQUEST['action'] == 'manage' && isset($_REQUEST['id'])) { show_manage($_REQUEST['id']); } } else { show_default(); } function show_default() { $news = $_SESSION['service']->news_list(); if (is_null($news)) { $news = array();
function action_del_sharedfolder_acl($sharedfolder_id_, $usergroup_id_) { $sharedfolder = $_SESSION['service']->shared_folder_info($sharedfolder_id_); if (!$sharedfolder) { popup_error(_('Unable to delete this shared folder access')); return false; } $ret = $_SESSION['service']->shared_folder_remove_group($usergroup_id_, $sharedfolder_id_); if ($ret === true) { popup_info(_('Shared folder successfully modified')); return true; } else { popup_error(sprintf(_("Unable to modify shared folder named '%s'"), $sharedfolder->name)); return false; } }
function action_del_sharedfolder_acl($sharedfolder_id_, $usergroup_id_) { $sharedfolderdb = SharedFolderDB::getInstance(); $sharedfolder = $sharedfolderdb->import($sharedfolder_id_); if (!$sharedfolder) { popup_error(_('Unable to delete this shared folder access')); return false; } $usergroupDB = UserGroupDB::getInstance(); $group = $usergroupDB->import($usergroup_id_); if (is_object($group) === false) { popup_error(_('Unable to load usergroup')); return false; } $ret = $sharedfolder->delUserGroup($group); if ($ret === true) { popup_info(_('Shared folder successfully modified')); return true; } else { popup_error(sprintf(_("Unable to modify shared folder named '%s'"), $sharedfolder->name)); return false; } }
function disable_hostDB($SQL, $table, $id_host) { $query = 'SELECT * FROM `' . $table . '` WHERE register="yes" AND id_host=' . $id_host; $res = $SQL->DoQuery($query); $nb = $SQL->NumRows(); if (!$nb) { popup_error(_('Cannot disable host because it is not enabled!')); } $query = 'DELETE FROM `' . $table . '` WHERE id_host=' . $id_host; $res = $SQL->DoQuery($query); $nb = $SQL->NumRows(); if ($nb) { popup_info(_('Host has been disabled!')); } else { popup_error(_('An error occured during disabling host, cannot disable host!')); } }