Example #1
0
function pass_assignsite($eventData)
{
    global $env, $hui_mainstatus, $amp_locale;
    $result = false;
    if (!empty($eventData['userid'])) {
        $xuser = new XmlRpcUser($env['ampdb'], $eventData['userid']);
        $result = $xuser->AssignSite($eventData['siteid']);
    }
    if ($result) {
        $hui_mainstatus->mArgs['status'] = $amp_locale->GetStr('chsiteok_status');
    }
}
Example #2
0
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */
// $Id: ampremote.php,v 1.20 2004-07-08 15:04:25 alex Exp $
if (!defined('AMPREMOTE_PHP')) {
    define('AMPREMOTE_PHP', true);
    require 'ampoliros.php';
    $amp = Ampoliros::instance('Ampoliros');
    $amp->setMode(Ampoliros::MODE_ROOT);
    $amp->setInterface(Ampoliros::INTERFACE_REMOTE);
    OpenLibrary('xmlrpc.library');
    OpenLibrary('misc.library');
    $env['db'] = $GLOBALS['gEnv']['root']['db'];
    $GLOBALS['gEnv']['remote']['methods'] = array();
    $xuser = new XmlRpcUser($GLOBALS['gEnv']['root']['db']);
    if ($xuser->SetByAccount($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])) {
        $GLOBALS['gEnv']['remote']['user'] = $_SERVER['PHP_AUTH_USER'];
        $GLOBALS['gEnv']['remote']['profile'] = $xuser->mProfileId;
        if ($xuser->mSiteId) {
            $site_query = $GLOBALS['gEnv']['root']['db']->Execute('SELECT siteid FROM sites WHERE id=' . $xuser->mSiteId);
            if ($site_query->NumRows()) {
                $amp = Ampoliros::instance('Ampoliros');
                $amp->startSite($site_query->Fields('siteid'));
            }
        }
        $xprofile = new XmlRpcProfile($GLOBALS['gEnv']['root']['db'], $GLOBALS['gEnv']['remote']['profile']);
        $GLOBALS['gEnv']['remote']['methods'] = $xprofile->AvailableMethods();
    } else {
        if ($GLOBALS['gEnv']['core']['config']->Value('ALERT_ON_WRONG_REMOTE_LOGIN') == '1') {
            import('com.solarix.ampoliros.security.SecurityLayer');