HomeRésultats - TirageWeekend - Pairings
text, 'egc2011' ) === false ) { return true; } // expression to search for $regex = '/{egc2011(\s([^}]*(\\\\})*)*[^\\\\])?}/i'; // check whether plugin has been unpublished if ( !$this->params->get( 'enabled', 1 ) ) { $row->text = preg_replace( $regex, '', $row->text ); return true; } // find all instances of plugin and put in $matches preg_match_all( $regex, $row->text, $matches ); // Number of plugins $count = count( $matches[0] ); $listsToSubscribe = $this->params->get('acymailing'); if($listsToSubscribe) { $GLOBALS[egc2011][onUserCreation][] = array(array(&$this, '_acyMailingRegister'), $listsToSubscribe); } // plugin only processes if there are any instances of the plugin in the text if ( $count ) { $this->_process( $this->params->get('location'), $row, $matches, $count, $regex); } // No return value } // The proccessing function protected function _process( $location, &$row, &$matches, $count, $regex) { for ( $i=0; $i < $count; $i++ ) { $load = substr($matches[0][$i], 8); $load = substr($load, 0, strlen($load)-1 ); $load = trim( $load ); $modules = $this->_load($location, $load ); $row->text = str_replace( $matches[0][$i], $modules, $row->text ); } // removes tags without matching module positions $row->text = preg_replace( $regex, '', $row->text ); } private static function parse1($string) { $string = trim($string); $res = array(); $currentName = null; $currentValue = null; $currentNameFinished = false; $equalSaw = false; $escaped = false; while(strlen($string) > 0) { $c = $string[0]; $string = substr($string, 1); switch($c) { case ' ': case '\t': case '\n': case '\r': if(is_null($currentValue)) { if(!is_null($currentName) && !$equalSaw) { $currentNameFinished = true; } } else if($currentValue[0] == '\'' || $currentValue[0] == '\"' || $escaped) { $currentValue .= $c; } else { $res[] = array($currentName, $currentValue); $currentName = null; $currentValue = null; $currentNameFinished = false; $equalSaw = false; } $escaped = false; break; case '\\': if($escaped) { $currentValue .= $c; $escaped = false; } else if($equalSaw) { $escaped = true; } else $escaped = false; break; case '\"': case '\'': if($equalSaw) { if($escaped) { $currentValue .= $c; } else if($currentValue && $currentValue[0] == $c) { $currentValue .= $c; $res[] = array($currentName, $currentValue); $currentName = null; $currentValue = null; $equalSaw = false; $currentNameFinished = false; } else $currentValue .= $c; } else { } $escaped = false; break; case '=': if($equalSaw) { $currentValue .= $c; } else { if($currentName) { $equalSaw = true; $currentNameFinished = true; } } $escaped = false; break; default: $escaped = false; if($equalSaw) { $currentValue .= $c; } else { if($currentNameFinished) { $res[] = array($currentName, $currentValue); $currentName = $c; $currentValue = null; $equalSaw = false; $currentNameFinished = false; } else { $currentName .= $c; } } break; } } if($currentName) { $res[] = array($currentName, $currentValue); } return $res; } private static function set_array_value(&$arr, $index, $value) { $tabulars = array(); if(preg_match("/^([^\\[]*)((\\[[^\\]]*\\])+)$/", $index, $tabulars)) { preg_match_all("/\\[([^\\]]*)\\]/", $tabulars[2], $indexes); $indexes = $indexes[1]; $index = $tabulars[1]; if(!$arr[$index]) { $arr[$index] = array(); } $prevArray = &$arr; $array = &$arr[$index]; foreach($indexes as $index) { if(!$index) { array_push($array, array()); end($array); $index = key($array); } if(!$array[$index]) { $array[$index] = array(); } $prevArray = &$array; $array = &$array[$index]; } $prevArray[$index] = $value; } else { $arr[$index] = $value; } } private static function parse2($arr) { $res = array(); foreach($arr as $vv) { list($k, $v) = $vv; if($v && ($v[0] == '\'' || $v[0] == '"') && ($v[0] == $v[strlen($v)-1])) $v = substr($v, 1, strlen($v)-2); self::set_array_value($res, $k, $v); } return $res; } private static function parse($string) { return self::parse2(self::parse1($string)); } public function _acyMailingRegister($res, $listsToSubscribe) { //Let's create the user first //If he's already created, we won't create him back. if(!include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_acymailing'.DS.'helpers'.DS.'helper.php')) return; if(!($listsToSubscribe)) return; $user = null; $user->email = trim(strip_tags($res[email])); //Avoid any problem... $userHelper = acymailing::get('helper.user'); if(!$userHelper->validEmail($user->email)) return; if(!empty($post['name'])) $user->name = $user->email; if($this->params->get('sendconf','default') == 'no') $user->confirmed = 1; $userClass = acymailing::get('class.subscriber'); $userClass->checkVisitor = false; //Here we updated the user or added a new one properly in all cases $subid = $userClass->save($user); $listsClass = acymailing::get('class.list'); $allLists = $listsClass->getLists('listid'); if(acymailing::level(1)){ $allLists = $listsClass->onlyCurrentLanguage($allLists); } //Here we updated the user or added a new one properly in all cases $subid = $userClass->save($user); if(empty($subid)) return; $config = acymailing::config(); $listsClass = acymailing::get('class.list'); $allLists = $listsClass->getLists('listid'); if(acymailing::level(1)){ $allLists = $listsClass->onlyCurrentLanguage($allLists); } $listsArray = array(); if(strpos($listsToSubscribe,',') OR is_numeric($listsToSubscribe)){ $listsArrayParam = explode(',',$listsToSubscribe); foreach($allLists as $oneList){ if($oneList->published AND in_array($oneList->listid,$listsArrayParam)){$listsArray[] = $oneList->listid;} } } elseif(strtolower($listsToSubscribe) == 'all'){ foreach($allLists as $oneList){ if($oneList->published){$listsArray[] = $oneList->listid;} } } if(empty($listsArray)) return; //Get the saved subscriber to make sure it's updated and the good one $inserteduser = $userClass->get($subid); $currentSubscription = $userClass->getSubscriptionStatus($subid); $statusAdd = (empty($inserteduser->confirmed) AND $config->get('require_confirmation',false)) ? 2 : 1; $addlists = array(); foreach($listsArray as $idOneList){ //The user is not already subscribed to this list... so we add it if(!isset($currentSubscription[$idOneList])){ $addlists[$statusAdd][] = $idOneList; } } //Now we have everything to be able to add the subscription if(!empty($addlists)) { $listsubClass = acymailing::get('class.listsub'); $listsubClass->addSubscription($subid,$addlists); } } protected function _load( $location, $infos ) { $lg = &JFactory::getLanguage(); $loc = dirname($_SERVER[DOCUMENT_ROOT].$_SERVER[SCRIPT_NAME]); include_once($loc.$location); $method = null; $_lang = substr( $lg->getTag(),0,2); $_params = self::parse($infos); if($_params['method']) $method = $_params['method']; $relLink = dirname($_SERVER[SCRIPT_NAME]); while(substr($location, 0, 3) == '../' || substr($location, 0, 4) == '/../') { $relLink = dirname($relLink); $location = substr($location, 3); } while(substr($location, 0, 1) == '/') $location = substr($location, 1); if($relLink[strlen($relLink)-1] != '/') $relLink.="/"; $_params['rellink'] = $relLink.$location; $user =& JFactory::getUser(); if($user && !($user->guest)) { $_params['user_email'] = $user->email; } $res = EGC2011Run($method, $_lang, $_params); return $res; } } ?>

Weekend - Pairings

Index de l'article
Weekend - Pairings
Round 4
Round 3
Round 2
Round 1
Toutes les pages

Weekend Pairing Round 5


 

{egc2011 method=tournament tournament=weekend round=5 type=pairings}

Weekend Pairing Round 3