'http://sp.mountyhall.com/SP_ProfilPublic2.php?Numero=XXX&Motdepasse=YYY', 'err_re' => '/^\\s*Erreur/i', 'passwords' => array( 'admin' => array('@mh_admins'), 'attr' => array('@mh_admins'), 'edit' => array('id:*'), ), 'cookie' => array( 'name' => $CookiePrefix . 'AuthUserMountyHall', 'expires' => $Now + 60 * 60 * 24 * 30, 'dir' => '/', ), 'js' => '', )); ### populate passwords foreach($MountyHallInfo['passwords'] as $auth => $pwlist) { if(!is_array($DefaultPasswords[$auth])) $DefaultPasswords[$auth] = array($DefaultPasswords[$auth]); $DefaultPasswords[$auth] = array_merge($pwlist, (array)$DefaultPasswords[$auth]); } ### AuthUser function function AuthUserMH($pagename, $id, $pw, $pwlist) { global $MessagesFmt, $MountyHallInfo; $url = str_replace(array('XXX', 'YYY'), array($id, $pw), $MountyHallInfo['url']); if(IsEnabled($MountyHallInfo['use_curl'], 0)) { $ch = curl_init(); SDVA($MountyHallInfo['ctx'], array(CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, )); foreach($MountyHallInfo['ctx'] as $opt => $val) curl_setopt($ch, $opt, $val); $response = curl_exec($ch); curl_close($ch); } elseif((bool) ini_get('allow_url_fopen')) { if(($fp = isset($MountyHallInfo['ctx']) ? fopen($url, 'r', false, $MountyHallInfo['ctx']) : fopen($url, 'r', false)) !== false) { $response = fgets($fp, 1024); fclose($fp); } } else Abort("?no appropriate method to reach MountyHall"); if(!is_string($response) || !strlen($response)) Abort("?unable to reach MountyHall"); if(preg_match($MountyHallInfo['err_re'], $response)) { $MessagesFmt[] = "
$response
"; return false; } $troll = explode(';', $response); $MountyHallInfo['cookie']['value'] = array('n' => $troll[0], 'profil' => $troll, ); setcookie($MountyHallInfo['cookie']['name'], serialize($MountyHallInfo['cookie']['value']), $MountyHallInfo['cookie']['expires'], $MountyHallInfo['cookie']['dir']); return true; } $AuthUserFunctions['AuthUserMountyHall'] = 'AuthUserMH'; $AuthUser['AuthUserMountyHall'] = true; include_once("$FarmD/scripts/authuser.php"); $LogoutCookies[] = $MountyHallInfo['cookie']['name']; /*StopWatch(TraceVars(array( '$MountyHallInfo' => $MountyHallInfo, '$DefaultPasswords' => $DefaultPasswords, '$AuthId' => $AuthId, )));/**/ $MountyHallAuth = isset($_COOKIE[$MountyHallInfo['cookie']['name']]) ? unserialize($_COOKIE[$MountyHallInfo['cookie']['name']]) : $MountyHallInfo['cookie']['value']; ### troll markup $FmtPV['$Troll'] = '$GLOBALS["MountyHallAuth"]["profil"][1]'; function TrollMH($arg0, $arg1) { global $HTMLHeaderFmt, $MountyHallInfo; if(preg_match('/^\\d+$/', $arg0)) { $name = $arg1; $id = $arg0; } else { $name = $arg0; $id = $arg1; } SDV($HTMLHeaderFmt['AuthUserMountyHall'], $MountyHallInfo['js']); return Keep("$name($id)"); } $MarkupExpr['troll'] = 'TrollMH($args[0], $args[1])'; ### set Author from AuthId #unset($_POST['author']); include_once("$FarmD/scripts/author.php"); /*StopWatch(TraceVars(array( '$_COOKIE' => $_COOKIE, '$MountyHallAuth' => $MountyHallAuth, )));/**/ if($AuthId && !@$_COOKIE[$AuthorCookie]) { $Author = isset($MountyHallAuth) ? htmlspecialchars(preg_replace("/[^$AuthorNameChars]/", '', $MountyHallAuth['n']), ENT_QUOTES) : $AuthId; setcookie($AuthorCookie, $Author, $AuthorCookieExpires, $AuthorCookieDir); } ### trolls can't change Author if(preg_match('/^\\d+$/', $AuthId) && isset($MountyHallAuth)) { $troll = TrollMH($MountyHallAuth['profil'][0], $MountyHallAuth['profil'][1]); $InputTags['e_author'][':html'] = "$troll"; ### alter Author markup $ROSPatterns['/(?