public static function friendly_url($text) { $friendlyurl = Str_Replace(' ', '-', AddSlashes($text)); $tbl = array("á" => "a", "ä" => "a", "č" => "c", "ď" => "d", "é" => "e", "ě" => "e", "í" => "i", "ľ" => "l", "ĺ" => "l", "ň" => "n", "ó" => "o", "ö" => "o", "ő" => "o", "ô" => "o", "ř" => "r", "ŕ" => "r", "š" => "s", "ť" => "t", "ú" => "u", "ů" => "u", "ü" => "u", "ű" => "u", "ý" => "y", "ž" => "z", "Á" => "A", "Ä" => "A", "Č" => "C", "Ď" => "D", "É" => "E", "Ě" => "E", "Í" => "I", "Ľ" => "L", "Ĺ" => "L", "Ň" => "N", "Ó" => "O", "Ö" => "O", "Ő" => "O", "Ô" => "O", "Ř" => "R", "Ŕ" => "R", "Š" => "S", "Ť" => "T", "Ú" => "U", "Ů" => "U", "Ü" => "U", "Ű" => "U", "Ý" => "Y", "Ž" => "Z", "'" => "", ",-" => "kc"); $url = StrTr($friendlyurl, $tbl); $text = StrTr($url, "ÁÄČÇĎÉĚËÍŇÓÖŘŠŤÚŮÜÝŽáäčçďéěëíňóöřšťúůüýž", "AACCDEEEINOORSTUUUYZaaccdeeeinoorstuuuyz"); // somehow I wasnt able to add following characters to previous StrTr strings: $text = StrTr($text, "& .,?!_+", "--------"); //$text = Preg_Replace ("/[^[:alpha:][:digit:]]/", "-", $text); $text = Trim($text, "-"); $text = Preg_Replace("/[-]+/", "-", $text); return strtolower($text); }
public function __construct($Option) { $this->AppStart = MicroTime(true); if ($Option === 'force') { $this->UseCache = false; } $UrlsPath = __DIR__ . '/urls.json'; $ApiKeyPath = __DIR__ . '/.support/apikey.txt'; $ETagsPath = __DIR__ . '/.support/etags.txt'; if (!File_Exists($ApiKeyPath)) { $this->Log('{lightred}Missing ' . $ApiKeyPath); exit; } else { if (!File_Exists($UrlsPath)) { $this->Log('{lightred}Missing ' . $UrlsPath); exit; } } if ($this->UseCache && File_Exists($ETagsPath)) { $this->ETags = JSON_Decode(File_Get_Contents($ETagsPath), true); } $this->APIKey = Trim(File_Get_Contents($ApiKeyPath)); $this->CurrentTime = Time(); $Data = File_Get_Contents($UrlsPath); // Strip comments $Data = Preg_Replace('#^([\\s]?//.*)#m', '', $Data); $Data = JSON_Decode($Data, true); foreach ($Data as $File => $URL) { $this->URLsToFetch[] = array('URL' => $URL, 'File' => $File); } unset($Data, $URL, $File); $Tries = 5; do { $URLs = $this->URLsToFetch; $this->Log('{yellow}' . Count($URLs) . ' urls to be fetched...'); $this->URLsToFetch = array(); $this->Fetch($URLs, $Tries); } while (!empty($this->URLsToFetch) && $Tries-- > 0); File_Put_Contents($ETagsPath, JSON_Encode($this->ETags, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT)); if ($this->ExtractClientArchives) { $this->Log('{lightblue}Extracting client archives and doing voodoo magic'); // Let's break all kinds of things! :( System('bash ' . __DIR__ . '/extract_client.sh'); } $this->CheckCDN(); $this->Log('{lightblue}Done'); }
function CleanUpElem(&$elem_name, &$cfg_file, &$template) { // Fixes HEX strings to look like 0xABCDEF12345 rather than 0Xabc or 0xaf if (Preg_Match("/(0x)([a-fA-F0-9]+)/i", $elem_name, $matches)) { $elem_name = Preg_Replace("/(0x)([a-fA-F0-9]+)/i", "0x" . StrToUpper($matches[2]), $elem_name); } print " Cleaning up elem '{$elem_name}'\n"; $cfg_elem = FindConfigElem($cfg_file, $elem_name); $cfg_elem = array_change_key_case($cfg_elem, CASE_LOWER); $new_elem = array(); $last_label = 0; foreach ($template as $indice => $line) { if (Preg_Match('/\\[Label=([[:alnum:][:space:][:punct:]]+)\\]/', $line, $matches)) { if ($last_label) { unset($new_elem[$last_label]); } $matches[1] = Preg_Replace("/%s/i", " ", $matches[1]); $line = "//{$matches[1]}"; if ($indice > 1) { $line = "\n\t{$line}"; } $last_label = $line; $new_elem[$line] = array(""); continue; } else { $property = StrToLower($line); if ($cfg_elem[$property]) { $new_elem[$line] = $cfg_elem[$property]; unset($cfg_elem[$property]); $last_label = 0; } } } if (Count($cfg_elem) > 0) { $new_elem["\n\t//Custom Values"] = array(""); // Lines not in the template go at the end as custom values foreach ($cfg_elem as $key => $value) { $new_elem[$key] = $value; } } if ($last_label) { unset($new_elem[$last_label]); } return $new_elem; }
function BuildItemDesc($file) { print " * Loading multis config file...\n"; $cfg_file = ReadConfigFile($file); if ($cfg_file == FALSE) { print "Cant open {$file} ({$php_errormsg}). Blame Stephen Donald.\n"; exit; } print " * Purging itemdesc.cfg for new write...\n"; $handle = FOpen("itemdesc.cfg", "w"); FClose($handle); $handle = FOpen("itemdesc.cfg", "a"); print " * Finding elem names..."; $elem_names = GetConfigStringKeys($cfg_file, CLASS_LABELS_ON); print "(" . Count($elem_names) . ")\n"; foreach ($elem_names as $elem_name) { if (!Preg_Match("/^House\\s+/i", $elem_name)) { continue; } $multi_id = Preg_Replace("/^House\\s+/i", "", $elem_name); $objtype = HexDec($multi_id); $objtype += 16384; // 0x4000 $objtype = "0x" . DecHex($objtype); FWrite($handle, "House {$objtype}\n"); FWrite($handle, "{\n"); FWrite($handle, "\t// Main Stuff\n"); FWrite($handle, "\tName\t\tHouse{$objtype}\n"); FWrite($handle, "\tGraphic\t\t{$objtype}\n"); FWrite($handle, "\n"); FWrite($handle, "\t// Multi Info\n"); FWrite($handle, "\tMultiID\t\t{$multi_id}\n"); FWrite($handle, "}\n\n"); } FClose($handle); return 1; }
case 'error': return ERROR | @Trigger_Error(500); case 'exception': # No more... break; case 'array': #--------------------------------------------------------------------------- foreach ($Profiles as $Profile) { #------------------------------------------------------------------------- $Attribs = $Profile['Attribs']; #------------------------------------------------------------------------- #------------------------------------------------------------------------- $Attribs['pCountry'] = $Attribs['Country']; $Attribs['pState'] = $Attribs['State']; $Attribs['pCity'] = $Attribs['City']; $Attribs['pAddress'] = Trim(Preg_Replace('/ул./iu', '', $Attribs['Address'])); $Attribs['AddressEn'] = Translit($Attribs['pAddress']); $Attribs['pIndex'] = $Attribs['PostIndex']; $Attribs['pRecipient'] = $Attribs['Recipient']; #------------------------------------------------------------------------- #------------------------------------------------------------------------- $Attribs['PasportWhom'] = $Attribs['PasportWhom']; $Attribs['PasportDate'] = $Attribs['PasportDate']; #------------------------------------------------------------------------- if (Preg_Match('/(.*)\\s(.*)$/', $Attribs['PasportNum'], $Matches)) { #----------------------------------------------------------------------- $Attribs['PasportLine'] = Str_Replace(' ', '', $Matches[1]); $Attribs['PasportNum'] = $Matches[2]; } #------------------------------------------------------------------------- #-------------------------------------------------------------------------
function GetConfigMaxIntKey(&$cfg_file) { $high_num = 0; foreach ($cfg_file as $cfg_line) { $cfg_line = RTrim($cfg_line); //Only check lines that are not blank. if (!$cfg_line) { // Blank line continue; } elseif (Preg_Match("/^(\\/\\/|#)/", $cfg_line)) { //Comment lines continue; } elseif (Preg_Match("/^[[:alnum:]]+\\s+{$elem_name}/i", $cfg_line)) { //An elem key was found. //Remove the first word from the line and check if it is an Integer //type element. If so, tuck it into an array. $cfg_line = Preg_Replace("/^[[:alnum:]]+\\s+/", "", $cfg_line); if (Is_Numeric($cfg_line) ? IntVal($cfg_line) == $cfg_line : false) { if ($cfg_line > $high_num) { $high_num = IntVal($cfg_line); } } } } return $high_num; }
function UnikData($data = '', $db = 'titre', $size = 10) { $res = ''; $sup = $_ENV['ksup']; $s[] = "origindata:" . $data; if (RS == 404) { return; } if (!isgoodurl() or preg_match("~url.data:|image/png;|base64|/(adtech|iframeproxy)~", U) or e(',badurl', 1)) { return; } static $trig; if (!$trig) { Gt('unikdata:start'); $trig = 1; } #Returns only unique Array Data ! For Titles + descriptions (1Mo + 13ms) if (strpos(u3, '.jpg')) { return; } $rev = 1342976292; Gt('udata'); $u = $db . ':' . hu3; #Maj if ($y = param($data, '&')) { extract($y); } #extraction paramètres ...? $origin = Rem($data, CLT(surl)); $data = trim(str_replace(array('»', 'Â', '£', 'N%253BO=D'), ' ', $data), '!?»,. '); if (!$_ENV['auth']) { $u = Preg_Replace("~(#|\\?|&).*~", '', $u); } else { $u = Preg_Replace("~[#|\\?|&][^(&|\\?)" . $_ENV['auth'] . "]+~", '', $u); } #!genius!really nice syntax-"~(#|\?|&)[^(".$_ENV['auth'].")].*~" while (strlen($data) < $size && $sup) { $next = Array_shift($sup); if (!stripos($data, $next)) { $data .= ' ' . $next; } } #push ksup inside if (strpos(SURL, '?', 0)) { Preg_match_all("~=([^&]+)~is", SURL, $t); if ($t) { $t = $t[1]; $data .= ' ' . implode(' ', $t); } } #si titre similaire, pusher le query string $ret = $data; #av("data:$data db:$db ret:$ret".pre($s)); ###Si pas de résultats : invalider le record en placant un "1" dessus if (1 or H == 'a74.fr') { $arg = 'no=1,bd=' . sip; $prev = array(); #previously db -> comes to mysql unikdata:id,url,db,data,score #CREATE TABLE `unikdata`(`id` INT(8) NOT NULL AUTO_INCREMENT PRIMARY KEY,`url` VARCHAR(255) NOT NULL,`data` TEXT NOT NULL,`score` INT(5) NOT NULL) ENGINE = MYISAM;#`db` VARCHAR(25) NOT NULL, $s[] = "select sql_cache data from " . DB . ".unikdata where url=\"{$u}\""; $x = sql5(['cache' => 1, 'sql' => end($s)], "bd=" . sip) or $noexist = 1; #if(strpos(U,'webcam.php')){print_r(compact('y','s','u','x'));die;} $s[] = "result:" . count($x) . "/" . $x . "/data:" . $data; if ($x == $data) { return $data; } else { #on défini le score puis On recherche si des correspondances existent déjà if (!Q && e('tprio,forcetitre', 1)) { $score[$u] = 0; } else { $score[$u] = substr_count(u, '/') * 20 + substr_count(u, '?') * 10 + substr_count(u, '&') * 10 + strlen(u); } /*Score de lui même*/ $datas[$u] = $data; $s[] = "select sql_cache url,score from " . DB . ".unikdata where data=\"{$data}\" and url<>\"{$u}\" and left(url,6) rlike'{$db}:" . H . ".*' order by score asc"; $y = sql5(['cache' => 1, 'sql' => end($s)], $arg); /* select * from ben.unikdata where url='titre:a74.fr/z/webcam.php'; select sql_cache url,score from ben.unikdata where data="Webcams Ski Haute Savoie" and url<>"titre:a74.fr/z/webcam.php" and left(url,6) rlike'titre:a74.fr.*' order by score asc insert into ben.unikdata(url,data,score)VALUES("titre:a74.fr/z/webcam.php","Webcams Ski Haute Savoie","32") */ #Si une ou plusieurs Pages have the same results if ($y) { if (!is_array($y)) { $y = [$y]; } foreach ($y as $t) { $score[$t['url']] = $t['score']; $datas[$t['url']] = $data; } } if (count($score) == 1) { if ($noexist) { return $data; $s[] = "insert ignore into " . DB . ".unikdata(url,data,score)VALUES(\"{$u}\",\"{$data}\",\"{$score[$u]}\")"; sql5(end($s), $arg); } else { return $data; $s[] = "update " . DB . ".unikdata set data=\"{$data}\",score=\"{$score[$u]}\" where url=\"{$u}\""; $x = sql5(end($s), $arg); } #Non car le score est unique ! #if($db=='titre')DbM('unikdata',surl."<li>db?$db / ".hu3."->$data<li>noexist?$noexist<li>sql:".pre($s)."<li>score:".pre($score)."<li>datas:".pre($datas)."<li>res:".pre($res)."<li>GT:".pre($_ENV['dbt']),1); return $data; } else { #si plusieurs résultats pour mêmes données, il peut exister des similarités .. $s[] = "select sql_cache url,data,score from " . DB . ".unikdata where data rlike(\"{$data}*\") and url rlike'{$db}:" . H . ".*' and url<>\"{$u}\" order by score asc"; $y = sql5(['cache' => 1, 'sql' => end($s)], $arg); #les autres résultats proches, on s'en tape ! if ($y) { foreach ($y as $t) { $score[$t['url']] = $t['score']; $datas[$t['url']] = $t['data']; } } Asort($score); foreach ($score as $url => $v) { #calcul des doublons et population de la matrice des résultats $n = 0; $t2 = $temp = $datas[$url]; while (in_Array(accents(strtolower($t2)), $prev) && $n < 20) { #déjà un doublon de score inférieur - 20 opérations maximum if ($trig != 'chiffres' && Preg_match_all("~([0-9]+)~", u, $m)) { $n++; $i = implode('', $m[1]); $t2 = $temp . " {$i}"; $trig = 'chiffres'; continue; } $i++; $t2 = $temp . " {$i}"; #sinon on incrémente } $res[$url] = $t2; $prev[] = accents(strtolower($t2)); #les scores les plus pourris ramassent la merde if ($url == $u) { $ret = $t2; } #calcule le retour pour l'url courante } foreach ($res as $url => $v) { if ($noexist && $url == $u) { $s[] = "insert into " . DB . ".unikdata(url,data,score)VALUES(\"{$u}\",\"{$v}\",\"{$score[$u]}\")"; sql5(end($s), $arg); continue; } $s[] = "update " . DB . ".unikdata set data=\"{$v}\" where url=\"{$url}\""; sql5(end($s), $arg); #Il est possible que l'url courante n'aie pas d'enregistrements !!! } } if ($db == 'titre') { DbM('unikdata', surl . "<li>db?{$db} / " . hu3 . "->{$data}<li>noexist?{$noexist}<li>sql:" . pre($s) . "<li>score:" . pre($score) . "<li>datas:" . pre($datas) . "<li>res:" . pre($res) . "<li>GT:" . pre($_ENV['dbt']), 1); } return $ret; } } else { $u = u3; #local db mode if ($db == 'titre' && filemtime(DR . $db . '.db') < $rev) { Unlink(DR . $db . '.db'); } #Unlink the whole file #if(!strpos(u3,'=')&&$_ENV['soloQ'])$u=Preg_replace("~\?(?!({$_ENV['soloQ']})).*~is",'',u3);#déjà calculée dans autoappend #Determine unique Array 1 while (strlen($data) < $size && $_ENV['ksup']) { $next = Array_shift($_ENV['ksup']); if (!stripos($data, $next)) { $data .= ' ' . $next; } } #push ksup inside Rem($key, $u, 'index'); $x = FGC(DR . $db . '.db'); #if(J9)die(pre($x)); if ($x[$key] && now > $_ENV['rev'] && !strpos($_ENV['args'], 'forcetitre')) { return $x[$key]; } #Si la clé date d'avant la dernière révision on la retourne if ($x[$key] != $data) { #différente ou non définie $score[$key] = substr_count(u, '/') * 20 + substr_count(u, '?') * 10 + substr_count(u, '&') * 10 + strlen(u); #Score de lui même if (strpos($_ENV['args'], ',tprio')) { $score[$key] = 0; } if (strpos(surl, '?', 0)) { Preg_match_all("~=([^&]+)~is", surl, $t); if ($t) { $t = $t[1]; $data .= ' ' . implode(' ', $t); } #si titre similaire, ajouter le query string } #Cas 1 : il y a un chiffre dans l'url et il est différent des titres des autres, s'il y a déjà un chiffre, on remplace ce dernier par 156 if (is_Array($x)) { null; } else { dbM("x is not array-no f*****g way:{$x[$key]}§" . pre($x)); } #elseif(!$x){dbM("uniktitre:x is null ?? wtf ??");return;} $y = Array_map('strtolower', $x); $e = print_r(error_get_last(), 1); #if(stripos($e,'array given'))dBM("uniktitre:$db:{$x[$key]}\n<br>err:".pre($e)."\n<Br>y:".pre($y)."<Br>x:".pre($x)); $found = array_keys($y, strtolower($data)); #Arrive très souvent..; if (count($found) && Preg_match_all("~([0-9]+)~", u, $m)) { #avec des chiffres à injecter dans le titre $i = implode('', $m[1]); $data = $origin . " {$i}"; $found = array_keys($y, strtolower($data)); #last verif if (count($found) < 1) { FAP("tx=1&file=" . DR . $db . '.db', array($u => $data)); db('found:numbers injected in title'); return $data; } #Ok si aucun doublon } if (count($found)) { #des doublons de titres ont été trouvés foreach ($found as $k2) { #si les scores sont égaux, on ne pourra la comparer à un autre numéro.. $score[$k2] = substr_count($k2, '/') * 20 + substr_count($k2, '?') * 10 + substr_count($k2, '&') * 10 + strlen($k2); if ($k2 == 'index') { $score[$k2] = 0; } #raz page 0 } Asort($score); $os = $score; foreach ($score as $k => $v) { #Remplacer le score par les valeurs titre while (in_array($data, $score) && $n < 10) { $n++; $i++; $data = $origin . " {$i}"; } if ($n > 10) { Dbm("{$db} n:{$n}; data:" . pre($data) . "score:" . pre($score)); } $score[$k] = $data; GT('whilescore'); #crée autant } #if($score[0]==$score[self])Best=1;swap titles #if(count($score)<2)$score=end($score); FAP("tx=2,{$key}&file=" . dr . $db . '.db', $score); #DbM('unikdata',surl."<li>data:$data<li>x[key]:".print_r($x[$key],1)."<li>found:".print_r($found,1)."<li>score:".print_r($os,1)."<li>res:".print_r($score,1)); return $score[$key]; } if ($x[$key] && now > $_ENV['rev'] && !strpos($_ENV['args'], 'forcetitre')) { return $x[$key]; } } #swap those values pour url prioritaire!!! if ($x[$key] && now > $_ENV['rev'] && !strpos($_ENV['args'], 'forcetitre')) { return $x[$key]; } #ajouter ici les valeurs des query strings ! if ($data && $key) { FAP("tx=3,{$key}&file=" . dr . $db . '.db', $key, $data); gt('l' . __LINE__); return $data; } DB(surl . ':notitle found:' . count($found) . 'x[key]' . $x[$key] . 'data:' . $data . 'origin:' . $origin); } }
#------------------------------------------------------------------------------- $Args = isset($Args) ? $Args : Args(); #------------------------------------------------------------------------------- $DomainName = (string) @$Args['DomainName']; $JSON = (bool) @$Args['JSON']; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $DomainName = Trim($DomainName); #------------------------------------------------------------------------------- $Regulars = Regulars(); #------------------------------------------------------------------------------- $Config = Config(); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if ($DomainName) { $DomainName = Preg_Replace('/[^a-zа-я0-9-\\.]/u', '-', Mb_StrToLower($DomainName, 'UTF-8')); } #------------------------------------------------------------------------------- Debug(SPrintF('[comp/www/DomainWhoIs]: DomainName = %s', $DomainName)); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $DOM = new DOM(); #------------------------------------------------------------------------------- $Links =& Links(); # Коллекция ссылок $Links['DOM'] =& $DOM; #------------------------------------------------------------------------------- if (Is_Error($DOM->Load('Base'))) { return ERROR | @Trigger_Error(500); } #-------------------------------------------------------------------------------
#------------------------------------------------------------------------------- $InvoiceID = (int) @$Args['InvoiceID']; $IsRemote = (bool) @$Args['IsRemote']; $Mobile = (string) @$Args['Mobile']; #------------------------------------------------------------------------------- if (Is_Error(System_Load('modules/Authorisation.mod', 'classes/DOM.class.php', 'libs/Upload.php'))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Regulars = Regulars(); #------------------------------------------------------------------------------- if ($Mobile) { #------------------------------------------------------------------------------- # удаляем из телефона всё кроме цифр $Mobile = Preg_Replace('/[^0-9]/', '', $Mobile); #------------------------------------------------------------------------------- if (!Preg_Match($Regulars['SMS'], $Mobile)) { #------------------------------------------------------------------------------- Debug(SPrintF('[comp/www/InvoiceDocument]: WRONG_MOBILE = %s', $Mobile)); #------------------------------------------------------------------------------- return new gException('WRONG_MOBILE', 'Номер мобильного телефона указан неверно'); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- if (!SetCookie('Mobile', $Mobile, Time() + 364 * 24 * 3600, '/')) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- } #-------------------------------------------------------------------------------
#--------------------------------------------------------------------------- $Table = array(array(new Tag('TD', array('class' => 'Head'), 'Тип договора'), new Tag('TD', array('class' => 'Head'), 'Сумма балансов'), new Tag('TD', array('class' => 'Head'), 'Кол-во'))); #--------------------------------------------------------------------------- $Config = Config(); #--------------------------------------------------------------------------- $Types = $Config['Contracts']['Types']; #--------------------------------------------------------------------------- $Total = 0.0; #--------------------------------------------------------------------------- $dPiece = $lPiece = array(); #--------------------------------------------------------------------------- foreach ($Contracts as $Contract) { #------------------------------------------------------------------------- $String = $Type = $Types[$Contract['TypeID']]['Name']; #------------------------------------------------------------------------- $String = Preg_Replace('/\\s+/', "\n", $String); #------------------------------------------------------------------------- $dPiece[] = $Contract['Count']; $lPiece[] = $String; #------------------------------------------------------------------------- $Comp = Comp_Load('Formats/Currency', $Contract['Balance']); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------- $Table[] = array($Type, $Comp, (int) $Contract['Count']); #------------------------------------------------------------------------- $Total += $Contract['Balance']; } #--------------------------------------------------------------------------- $Comp = Comp_Load('Formats/Currency', $Total);
function stripcont($x, $xp = '') { GT('l' . __LINE__); if (!$xp) { $xp = CONTBANNED; } if (preg_match("~{$xp}~i", $x)) { $x = Preg_Replace("~{$xp}~is", '', $x); } GT('l' . __LINE__); return $x; #$x=explode('|',$xp);foreach($x as $v){sql('update portail.zpages2 set contenu=replace(contenu,'$v','');}# }
$Attribs['SournameEn'] = Translit($Attribs['dSourname']); #------------------------------------------------------------------------- #------------------------------------------------------------------------- $Attribs['jCountry'] = $Attribs['Country']; $Attribs['pCountry'] = $Attribs['Country']; #------------------------------------------------------------------------- $Attribs['jState'] = $Attribs['State']; $Attribs['pState'] = $Attribs['State']; $Attribs['StateEn'] = Translit($Attribs['State']); #------------------------------------------------------------------------- $Attribs['jCity'] = $Attribs['City']; $Attribs['pCity'] = $Attribs['City']; $Attribs['CityEn'] = Translit($Attribs['City']); #------------------------------------------------------------------------- $Attribs['jAddress'] = Trim(Preg_Replace('/(ул|пр)\\./iu', '', $Attribs['jAddress'])); $Attribs['pAddress'] = Trim(Preg_Replace('/(ул|пр)\\./iu', '', $Attribs['jAddress'])); $Attribs['AddressEn'] = Translit($Attribs['jAddress']); #------------------------------------------------------------------------- $Attribs['jIndex'] = $Attribs['PostIndex']; $Attribs['pIndex'] = $Attribs['PostIndex']; #------------------------------------------------------------------------- #------------------------------------------------------------------------- $CompanyName = $Attribs['CompanyName']; #------------------------------------------------------------------------- $CompanyName = Preg_Split('/\\s+/', $CompanyName); #------------------------------------------------------------------------- $Attribs['Form'] = Current($CompanyName); #------------------------------------------------------------------------- unset($CompanyName[0]); #------------------------------------------------------------------------- $CompanyName = Implode(' ', $CompanyName);
#------------------------------------------------------------------------------- $Tr->AddChild(new Tag('TD', array('class' => 'Standard'), $Comp)); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # для JBS-512 $Comp = Comp_Load(SPrintF('Colors/%s', $ModeID), $StatusHistory['StatusID']); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Style = array('class' => 'Standard', 'style' => SPrintF('background-color:%s;', $Comp['bgcolor'])); #------------------------------------------------------------------------------- $Tr->AddChild(new Tag('TD', $Style, $Statuses[$StatusHistory['StatusID']]['Name'])); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Initiator = $GLOBALS['__USER']['IsAdmin'] ? $StatusHistory['Initiator'] : Preg_Replace('/\\s(\\(\\H+\\))$/', '', $StatusHistory['Initiator']); #------------------------------------------------------------------------------- $Tr->AddChild(new Tag('TD', array('class' => 'Standard'), $Initiator)); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Comment = $StatusHistory['Comment'] ? $StatusHistory['Comment'] : '-'; #------------------------------------------------------------------------------- $Comment = Comp_Load('Formats/String', $Comment, 45); if (Is_Error($Comment)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Tr->AddChild(new Tag('TD', array('class' => 'Standard'), $Comment)); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Table[] = $Tr;
return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- if (!$Count) { return new gException('CONTRACT_WITHOUT_PROFILE', 'У выбранного договора отсутствует профиль. Выберите другой договор, или, пусть клиент создаст и назначит профиль для этого договора.'); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # TODO: надо бы налепить проверок соответствия сервера и заказа.... #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $IExtraIPOrder = array('Login' => $Login, 'SchemeID' => $ExtraIPScheme['ID'], 'DependOrderID' => Preg_Replace('/[^0-9]/', '', $DependOrder)); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if ($ExtraIPOrderID) { #------------------------------------------------------------------------------- $ExtraIPOrder = DB_Select('ExtraIPOrders', 'OrderID', array('UNIQ', 'ID' => $ExtraIPOrderID)); #------------------------------------------------------------------------------- switch (ValueOf($ExtraIPOrder)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return new gException('ExtraIP_ORDER_NOT_FOUND', 'Заказ на ExtraIP не найден'); case 'array': break; default: return ERROR | @Trigger_Error(101);
#------------------------------------------------------------------------------- $String = preg_replace("#(^|\\s|>)((http|https|news|ftp)://\\w+[^\\s\\[\\]\\<]+)#i", !isset($Params['IsEmail']) ? "\\1<A href=\"\\2\" target=\"blank\">\\2</A>" : '\\1\\2', $String); #------------------------------------------------------------------------------- $String = Preg_Replace('/\\[link](.+)\\[\\/link\\]/sU', !isset($Params['IsEmail']) ? '<A href="\\1" target="blank">\\1</A>' : '\\1', $String); #------------------------------------------------------------------------------- $String = Preg_Replace("(\\[link\\=[\"']?((http|ftp|https):\\/\\/[\\w-]+(\\.[\\w-]+)+([\\w.,@?^=%&:\\/~+#-]*[\\w@?^=%&\\/~+#-])?)[\"']?\\](.+?)\\[/link\\])", isset($Params['IsEmail']) ? "\$5 \$1" : "<a target=\"blank\" href=\"\$1\">\$5</a>", $String); #------------------------------------------------------------------------------- $String = Preg_Replace('/\\[b](.+)\\[\\/b\\]/sU', !isset($Params['IsEmail']) ? '<B>\\1</B>' : '\\1', $String); #------------------------------------------------------------------------------- $String = Preg_Replace('/\\[p](.+)\\[\\/p\\]\\n/sU', !isset($Params['IsEmail']) ? '<P>\\1</P>' : '\\1', $String); #------------------------------------------------------------------------------- $String = Preg_Replace('/\\[marker](.+)\\[\\/marker\\]\\n/sU', !isset($Params['IsEmail']) ? '<TABLE style="margin-left:15px;" cellspacing="2" cellpadding="2"><TR><TD valign="top" style="padding-top:5px;"><IMG alt="+" width="8px" height="8px" src="/styles/root/Images/Ul.png" /></TD><TD>\\1</TD></TR></TABLE>' : '\\1', $String); #------------------------------------------------------------------------------- $String = Preg_Replace('/\\n--\\n/sU', !isset($Params['IsEmail']) ? '<HR align="left" width="90%" size="1" />' : "\n--\n", $String); #------------------------------------------------------------------------------- $String = Preg_Replace('/\\[bg=([a-z]+)\\](.+)\\[\\/bg\\]/sU', !isset($Params['IsEmail']) ? '<DIV style="padding:5px;background-color:\\1;">\\2</DIV>' : '\\2', $String); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if (!isset($Params['IsEmail'])) { #------------------------------------------------------------------------------- $Smiles = System_XML('config/Smiles.xml'); #------------------------------------------------------------------------------- if (Is_Error($Smiles)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- foreach (Array_Keys($Smiles) as $SmileID) { #----------------------------------------------------------------------------- $Smile = $Smiles[$SmileID]; #----------------------------------------------------------------------------- $String = Str_Replace($Smile['Pattern'], SPrintF('<IMG alt="%s" src="%s" style="display:inline;" />', $Smile['Name'], SPrintF('SRC:{Images/Smiles/%s.gif}', $SmileID)), $String);
$Config = Config(); #----------------------------------------------------------------------- $Type = $Config['Tasks']['Types'][$TypeID]; #----------------------------------------------------------------------- $Params = $Task['Params']; #----------------------------------------------------------------------- if (Count($Params)) { #--------------------------------------------------------------------- $Table[] = 'Параметры'; #--------------------------------------------------------------------- foreach (Array_Keys($Params) as $ParamID) { if (Is_String($Params[$ParamID])) { #------------------------------------------------------------------- $Text = Str_Replace("\n", '<BR />', HtmlSpecialChars(Trim($Params[$ParamID]))); #------------------------------------------------------------------- $Text = Preg_Replace('/(http\\:\\/\\/[a-zA-Z0-9\\/\\:\\?\\&\\=\\@\\-\\.\\;\\_]+)/', '<A href="\\1">[ссылка]</A>', $Text); #------------------------------------------------------------------- $Td = new Tag('TD', array('class' => 'Standard', 'style' => 'max-width:400px;')); #------------------------------------------------------------------- $Td->AddHTML(SPrintF('<SPAN>%s</SPAN>', $Text)); #------------------------------------------------------------------- if (isset($Type['Params'][$ParamID])) { $Table[] = array($Type['Params'][$ParamID], $Td); } else { $Table[] = array($ParamID, $Td); } } } } #----------------------------------------------------------------------- $Table[] = 'Текущее состояние';
function IO_RmDir($Folder) { #------------------------------------------------------------------------------- $Folder = Preg_Replace('/\\/{2,}/', '/', rTrim($Folder, '/')); #------------------------------------------------------------------------------- if (StrPos(SPrintF('/%s/', $Folder), SYSTEM_PATH) === FALSE) { return ERROR | @Trigger_Error(SPrintF('[IO_RmDir]: ошибка безопасности при удалении (%s)', $Folder)); } #------------------------------------------------------------------------------- $Entities = IO_Scan($Folder, FALSE); if (Is_Error($Entities)) { return ERROR | @Trigger_Error('[IO_RmDir]: не удалось получить содержимое папки'); } #------------------------------------------------------------------------------- if (Count($Entities)) { #------------------------------------------------------------------------------- foreach ($Entities as $Entity) { #------------------------------------------------------------------------------- $Entity = SPrintF('%s/%s', $Folder, $Entity); #------------------------------------------------------------------------------- if (Is_Dir($Entity)) { #------------------------------------------------------------------------------- if (Is_Error(IO_RmDir($Entity))) { return ERROR | @Trigger_Error(SPrintF('[IO_RmDir]: ошибка рекурсивного вызова при удалении (%s)', $Entity)); } #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- if (!UnLink($Entity)) { return ERROR | @Trigger_Error(SPrintF('[IO_RmDir]: ошибка при удалении файла (%s)', $Entity)); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- if (!@RmDir($Folder)) { return ERROR | @Trigger_Error(SPrintF('[IO_RmDir]: ошибка при удалении директории (%s)', $Folder)); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- return TRUE; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- }
function WhoIs_Check($DomainName, $ZoneName, $IsAvalible = FALSE) { #------------------------------------------------------------------------------- Debug(SPrintF('[system/libs/WhoIs]: run function WhoIs_Check, Domain = %s.%s', $DomainName, $ZoneName)); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $CacheID = SPrintF('WhoIs-%s.%s', $DomainName, $ZoneName); #------------------------------------------------------------------------------- $Answer = CacheManager::get($CacheID); #------------------------------------------------------------------------------- if (!$Answer) { #------------------------------------------------------------------------------- # смотрим доменную зону, на предмет того использовать ли данные whois сервера, или юзать запросы к регистратору $DomainZones = System_XML('config/DomainZones.xml'); if (Is_Error($DomainZones)) { return ERROR | @Trigger_Error('[comp/www/API/WhoIs]: не удалось загрузить базу WhoIs серверов'); } #------------------------------------------------------------------------------- $IsSuppoted = FALSE; #------------------------------------------------------------------------------- foreach ($DomainZones as $Zone) { #------------------------------------------------------------------------------- if ($Zone['Name'] == $ZoneName) { #------------------------------------------------------------------------------- $IsSuppoted = TRUE; #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- if (!$IsSuppoted || $Zone['IsUseRegistratorWhoIs']) { #------------------------------------------------------------------------------- if (!$IsSuppoted) { Debug(SPrintF('[comp/www/API/WhoIs]: доменная зона не поддерживается')); } #------------------------------------------------------------------------------- if ($IsSuppoted && $Zone['IsUseRegistratorWhoIs']) { Debug(SPrintF('[comp/www/API/WhoIs]: принудительное использование WhoIs регистратора')); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # чекаем доменную зону $Regulars = Regulars(); #------------------------------------------------------------------------------- if (!Preg_Match($Regulars['DomainZone'], $ZoneName)) { return ERROR | @Trigger_Error(SPrintF('[comp/www/API/WhoIs]: неверная доменная зона (%s)', $ZoneName)); } #------------------------------------------------------------------------------- # достаём список серверов на которых есть такой тариф $Servers = DB_Select('DomainSchemes', array('ServerID'), array('Where' => SPrintF('`Name` = "%s"', $ZoneName))); #------------------------------------------------------------------------------- switch (ValueOf($Servers)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return new gException('REGISTRATOR_SERVER_NOT_FOUND', 'Не найдены активные сервера регистраторов'); case 'array': #------------------------------------------------------------------------------- $Array = array(); #------------------------------------------------------------------------------- foreach ($Servers as $Server) { $Array[] = $Server['ServerID']; } #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- # достаём список активных серверов регистраторов $Servers = DB_Select('Servers', array('ID', 'Address', 'Params'), array('Where' => array(SPrintF('`ID` IN (%s)', Implode(',', $Array)), '`IsActive` = "yes"'), 'SortOn' => 'Address')); #------------------------------------------------------------------------------- switch (ValueOf($Servers)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return new gException('REGISTRATOR_SERVER_NOT_FOUND', 'Не найдены активные сервера регистраторов'); case 'array': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- # перебираем регистраторов $UseServer = FALSE; #------------------------------------------------------------------------------- foreach ($Servers as $iServer) { #------------------------------------------------------------------------------- # если это не проверка доступности и в настройках сервера не стоит галка про получение WhoIs - пропускаем if (!$IsAvalible) { if (!$iServer['Params']['IsFetchWhoIs']) { continue; } } #------------------------------------------------------------------------------- # достаём использованные запросы к регистратору, на данную минуту $RatelimitID = SPrintF('ratelimit-%s-%s-00', $iServer['Address'], Date('H-i')); #------------------------------------------------------------------------------- $Ratelimit = CacheManager::get($RatelimitID); #------------------------------------------------------------------------------- # если из кэша что-то досталось и оно больше разрешённой частоты запросов - пропускаем цикл if ($Ratelimit && $Ratelimit >= $iServer['Params']['RatelimitAPI']) { #------------------------------------------------------------------------------- Debug(SPrintF('[comp/www/API/WhoIs]: превышена частота запросов к серверу %s (разрешено %u, использовано %u)', $iServer['Address'], $iServer['Params']['RatelimitAPI'], $Ratelimit)); #------------------------------------------------------------------------------- continue; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- # сохраняем, на пару минут, в кэш новое число запросов к регистратору CacheManager::add($RatelimitID, IntVal($Ratelimit) + 1, 120); #------------------------------------------------------------------------------- $UseServer = $iServer; #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- # если не задан сервер - частота превышена для всех серверов if (!$UseServer) { return new gException('REGISTRATOR_SERVER_RATELIMIT', 'Превышена максимальная частота запросов к интерфейсу регистратора'); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # выбираем сервер регистратора if (Is_Error(System_Load('classes/DomainServer.class.php'))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Server = new DomainServer(); #------------------------------------------------------------------------------- $IsSelected = $Server->Select((int) $UseServer['ID']); #------------------------------------------------------------------------------- switch (ValueOf($IsSelected)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return new gException('CANNOT_SELECT_REGISTRATOR', 'Не удалось выбрать регистратора'); case 'true': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- # делаем запрос к API - функция в зависимости от $IsAvalible if ($IsAvalible) { #------------------------------------------------------------------------------- $DomainCheck = $Server->DomainCheck($DomainName, $ZoneName); #------------------------------------------------------------------------------- switch (ValueOf($DomainCheck)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'true': return TRUE; case 'false': return array(); case 'array': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- $DomainWhoIs = $Server->DomainWhoIs($DomainName, $ZoneName); #------------------------------------------------------------------------------- switch (ValueOf($DomainWhoIs)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': # a функции нет ... вылезаем на обычную проверку whois break; case 'true': return TRUE; case 'string': #------------------------------------------------------------------------------- CacheManager::add($CacheID, $DomainWhoIs, 1800); #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Config = Config(); #------------------------------------------------------------------------------- $UseSystemApplication = $Config['Other']['Libs']['WhoIs']['UseSystemApplication']; #------------------------------------------------------------------------------- $Regulars = Regulars(); #------------------------------------------------------------------------------- if (!Preg_Match($Regulars['DomainName'], $DomainName)) { return new gException('WRONG_DOMAIN_NAME', 'Неверное доменное имя'); } #------------------------------------------------------------------------------- $DomainZones = System_XML('config/DomainZones.xml'); if (Is_Error($DomainZones)) { return ERROR | @Trigger_Error('[WhoIs_Check]: не удалось загрузить базу WhoIs серверов'); } #------------------------------------------------------------------------------- $IsSuppoted = FALSE; #------------------------------------------------------------------------------- foreach ($DomainZones as $DomainZone) { #------------------------------------------------------------------------------- if ($DomainZone['Name'] == $ZoneName) { #------------------------------------------------------------------------------- $IsSuppoted = TRUE; #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- if (!$IsSuppoted && !isset($DomainWhoIs)) { return FALSE; } #------------------------------------------------------------------------------- if (Mb_StrLen($DomainName) < ($MinChars = $DomainZone['MinChars'])) { return new gException('WRONG_DOMAIN_NAME_LENGTH', SPrintF('Длина доменного имени должна быть не менее %u символа(ов)', $MinChars)); } #------------------------------------------------------------------------------- $Domain = SPrintF('%s.%s', $DomainName, $DomainZone['Name']); #------------------------------------------------------------------------------- $Answer = CacheManager::get($CacheID); #------------------------------------------------------------------------------- if (!$Answer) { #------------------------------------------------------------------------------- $IDNAConverter = new IDNAConvert(); #------------------------------------------------------------------------------- if ($UseSystemApplication) { #------------------------------------------------------------------------------- $IsExec = Exec(SPrintF('whois %s', $IDNAConverter->encode($Domain)), $Answer); #------------------------------------------------------------------------------- $Answer = Implode("\n", $Answer); #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- $Socket = @FsockOpen($DomainZone['Server'], 43, $nError, $sError, 5); #------------------------------------------------------------------------------- if (!$Socket) { return ERROR | @Trigger_Error('[WhoIs_Check]: ошибка соединения с сервером WhoIs'); } #------------------------------------------------------------------------------- if (!@Fputs($Socket, SPrintF("%s\r\n", $IDNAConverter->encode($Domain)))) { return ERROR | @Trigger_Error('[WhoIs_Check]: ошибка работы с серверов WhoIs'); } #------------------------------------------------------------------------------- $Answer = ''; #------------------------------------------------------------------------------- do { #------------------------------------------------------------------------------- $Line = @Fgets($Socket, 10); #------------------------------------------------------------------------------- $Answer .= $Line; #------------------------------------------------------------------------------- } while ($Line); #------------------------------------------------------------------------------- Fclose($Socket); #------------------------------------------------------------------------------- CacheManager::add($CacheID, $Answer, 1800); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- Debug(SPrintF('[system/libs/WhoIs.php]: Answer = %s', print_r($Answer, true))); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- if (Preg_Match(SPrintF('/%s/', $DomainZone['Available']), $Answer)) { return TRUE; } #------------------------------------------------------------------------------- if (Preg_Match(SPrintF('/%s/', $DomainZone['NotAvailable']), $Answer)) { return new gException('DOMAIN_NOT_AVAILABLE', 'Доменное имя не доступно для регистрации'); } #------------------------------------------------------------------------------- $Result = array('Info' => Preg_Replace('/\\n\\s+\\n/sU', "\n", Preg_Replace('/\\%.+\\n/sU', '', $Answer)), 'ExpirationDate' => 0); #------------------------------------------------------------------------------- $ExpirationDate = $DomainZone['ExpirationDate']; #------------------------------------------------------------------------------- if ($ExpirationDate) { #------------------------------------------------------------------------------- if (Preg_Match(SPrintF('/%s/', $ExpirationDate), $Answer, $Mathes)) { #------------------------------------------------------------------------------- if (Count($Mathes) < 2) { return ERROR | @Trigger_Error('[WhoIs_Check]: шаблон поиска даты окончания задан неверно'); } #------------------------------------------------------------------------------- $ExpirationDate = $Mathes[1]; #------------------------------------------------------------------------------- $Months = array('jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'); #------------------------------------------------------------------------------- if (Preg_Match('/^[0-9]{4}\\.[0-9]{2}\\.[0-9]{2}$/', $ExpirationDate)) { #------------------------------------------------------------------------------- $Date = Array_Combine(array('Year', 'Month', 'Day'), Explode('.', $ExpirationDate)); #------------------------------------------------------------------------------- $ExpirationDate = MkTime(0, 0, 0, $Date['Month'], $Date['Day'], $Date['Year']); #------------------------------------------------------------------------------- } elseif (Preg_Match('/^[0-9]{4}\\-[0-9]{2}\\-[0-9]{2}$/', $ExpirationDate)) { #------------------------------------------------------------------------------- $Date = Array_Combine(array('Year', 'Month', 'Day'), Explode('-', $ExpirationDate)); #------------------------------------------------------------------------------- $ExpirationDate = MkTime(0, 0, 0, $Date['Month'], $Date['Day'], $Date['Year']); #------------------------------------------------------------------------------- } elseif (Preg_Match('/^[0-9]{2}\\-[a-zA-Z]{3}\\-[0-9]{4}$/', $ExpirationDate)) { #------------------------------------------------------------------------------- $Date = Array_Combine(array('Day', 'Month', 'Year'), Explode('-', $ExpirationDate)); #------------------------------------------------------------------------------- $Month = Array_Search(StrToLower($Date['Month']), $Months); #------------------------------------------------------------------------------- $ExpirationDate = MkTime(0, 0, 0, $Month + 1, $Date['Day'], $Date['Year']); #------------------------------------------------------------------------------- } elseif (Preg_Match('/^[0-9]{2}\\s[a-zA-Z]{2,10}\\s[0-9]{4}$/', $ExpirationDate)) { #------------------------------------------------------------------------------- $Months = array('january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'octember', 'november', 'decemeber'); #------------------------------------------------------------------------------- $Date = Array_Combine(array('Day', 'Month', 'Year'), Preg_Split('/\\s+/', $ExpirationDate)); #------------------------------------------------------------------------------- $Month = Array_Search(StrToLower($Date['Month']), $Months); #------------------------------------------------------------------------------- $ExpirationDate = MkTime(0, 0, 0, $Month + 1, $Date['Day'], $Date['Year']); #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- $Date = Array_Combine(array('Week', 'Month', 'Day', 'Time', 'GMT', 'Year'), Preg_Split('/\\s+/', $ExpirationDate)); #------------------------------------------------------------------------------- $Month = Array_Search(StrToLower($Date['Month']), $Months); #------------------------------------------------------------------------------- $ExpirationDate = MkTime(0, 0, 0, $Month + 1, $Date['Day'], $Date['Year']); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- $Result['ExpirationDate'] = $ExpirationDate; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- $NsName = $DomainZone['NsName']; #------------------------------------------------------------------------------- if ($NsName) { #------------------------------------------------------------------------------- if (Preg_Match_All(SPrintF('/%s/', $NsName), $Answer, $Mathes)) { #------------------------------------------------------------------------------- if (Count($Mathes) < 2) { return ERROR | @Trigger_Error('[WhoIs_Check]: шаблон поиска именных серверов задан неверно'); } #------------------------------------------------------------------------------- $NsNames = $Mathes[1]; #------------------------------------------------------------------------------- for ($i = 0; $i < Count($NsNames); $i++) { #------------------------------------------------------------------------------- $NsName = Trim(StrToLower($NsNames[$i]), '.'); #------------------------------------------------------------------------------- $Result[SPrintF('Ns%uName', $i + 1)] = $NsName; #------------------------------------------------------------------------------- if ($NsName) { #------------------------------------------------------------------------------- if (Mb_SubStr($NsName, -Mb_StrLen($Domain)) == $Domain) { #------------------------------------------------------------------------------- $IP = GetHostByName($NsName); #------------------------------------------------------------------------------- if ($IP != $NsName) { $Result[SPrintF('Ns%uIP', $i + 1)] = $IP; } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- $Registrar = $DomainZone['Registrar']; #------------------------------------------------------------------------------- if ($Registrar) { #------------------------------------------------------------------------------- if (Preg_Match(SPrintF('/%s/', $Registrar), $Answer, $Mathes)) { #------------------------------------------------------------------------------- if (Count($Mathes) < 2) { return ERROR | @Trigger_Error('[WhoIs_Check]: шаблон поиска регистратора серверов задан неверно'); } #------------------------------------------------------------------------------- $Registrar = Next($Mathes); #------------------------------------------------------------------------------- $Result['Registrar'] = $Registrar; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- return $Result; #------------------------------------------------------------------------------- }
if (Is_Error($Hash)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- # надо ли вырезать цитаты из текста if ($Settings['CutQuotes']) { #------------------------------------------------------------------------------- $textPlain = Trim(Preg_Replace('#^>(.*)$#m', '', $textPlain)); $textPlain = preg_replace("/\r/", "\n", $textPlain); $textPlain = trim(preg_replace('/[\\n]+/m', "\n", $textPlain)); #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- $textPlain = Trim(Preg_Replace('/\\n(\\>.*(\\n\\>.*)*)/', "\n[quote]\\1[/quote]", $textPlain)); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # надо ли отпиливать подпись из сообщения if ($Settings['CutSign']) { #------------------------------------------------------------------------------- $Texts = Explode("\n", $textPlain); #------------------------------------------------------------------------------- $textPlain = array(); #------------------------------------------------------------------------------- foreach ($Texts as $Text) { #------------------------------------------------------------------------------- $textPlain[] = Trim($Text); #-------------------------------------------------------------------------------
#Av(__LINE__,$a['preload'],'pre:'.$preload,'def:'.def($preload,Array(param($a['preload']),'fichiers'))); #csf as sqlite database #Définitions - variables de base du framework - FIN DE LA CUSTOMISATION !!!! setlocale(LC_ALL, 'fr_FR'); date_default_timezone_set('Europe/Berlin'); #php.ini => date.timezone = "Europe/Whatever" Rem($ndate, UcFirst(strftime("%A %d %B %Y %T")), date("Y m d H:i:s")); #pat(PHP_OS,,strftime("%A %d %B %Y %T")); #Vendredi 27 Septembre 2013 16:49:36 $D = array('ndate' => "<a id=ndate>" . $ndate . "</a>", 'deblockurl' => '!*%$%M', 'vit' => LOGS . 'Vitale.db', 'starter' => $starter, 'logs' => $a['logs'], 'tmp' => $a['tmp'], 'rt' => $a['rt']); foreach ($D as $k => $v) { redef($k, $v, 1); } e(RU . H . U . $a['args']); #note surl is obselete $D = array('bots' => isbot(), 'mu' => mu(H . U), 'u2' => Preg_Replace("~(\\?|&).*~", '', U), 'ipf' => IPSTORE . IP . ".db", 'fkeyword' => TMP . 'keyw/' . IP, 'u3' => BadQ(U)); foreach ($D as $k => $v) { redef($k, $v, 1); } $D = array('hu3' => H . '/' . U3, 'hu4' => '//' . H . '/' . U3, 'seed' => alpha2num(u2), 'su2' => SR . U2, 'CACHEPATH' => TMP . 'cache/' . MU . '.ca'); /**/ foreach ($D as $k => $v) { redef($k, $v, 1); } #$_ENV $_ENV['c']['cachetime'] = 3600 * 100; #100h par seconde de calcul-1h pour 10ms $D = array('lasttime' => 0, 'lastmemusage' => 0, 'lastkey' => 0, 'maxop' => 4000, 'mu' => MU, 'script' => $a['SCRIPT_FILENAME'], 'Mem' => array(), 'dbt' => array(), 'yt' => array('host' => RH, 'ip' => IP, 'dlp' => SU, 'u' => SU, 'r' => REFE, 'ref' => REFE)); foreach ($D as $k => $v) { $_ENV[$k] = $v; }
function Build_Query($Query = array(), $Params) { #------------------------------------------------------------------------------- if (In_Array($Params['DomainZone'], array('ru', 'su', 'рф'))) { #------------------------------------------------------------------------------- switch ($Params['PersonID']) { case 'Natural': #------------------------------------------------------------------------------- $Query['person'] = SPrintF('%s %s %s', Translit($Params['Person']['Name']), Mb_SubStr(Translit($Params['Person']['Lastname']), 0, 1), Translit($Params['Person']['Sourname'])); $Query['private_person'] = $Params['IsPrivateWhoIs'] ? '1' : '0'; $Query['person_r'] = SPrintF('%s %s %s', $Params['Person']['Sourname'], $Params['Person']['Name'], $Params['Person']['Lastname']); $Query['passport'] = SPrintF('%s %s выдан %s %s', $Params['Person']['PasportLine'], $Params['Person']['PasportNum'], $Params['Person']['PasportWhom'], $Params['Person']['PasportDate']); $Query['residence'] = SPrintF('%s, %s, %s, %s %s', $Params['Person']['pIndex'], $Params['Person']['pState'], $Params['Person']['pCity'], $Params['Person']['pType'], $Params['Person']['pAddress']); $Query['birth_date'] = $Params['Person']['BornDate']; $Query['country'] = isset($Params['Person']['PasportCountry']) ? $Params['Person']['PasportCountry'] : $Params['Person']['pCountry']; $Query['p_addr'] = SPrintF('%s, %s, %s, %s %s, %s', $Params['Person']['pIndex'], $Params['Person']['pState'], $Params['Person']['pCity'], $Params['Person']['pType'], $Params['Person']['pAddress'], $Params['Person']['pRecipient']); $Query['phone'] = $Params['Person']['Phone']; $Query['cell_phone'] = Preg_Replace('/\\s+/', '', $Params['Person']['CellPhone']); $Query['fax'] = $Params['Person']['Fax']; $Query['e_mail'] = $Params['Person']['Email']; #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- case 'Juridical': #------------------------------------------------------------------------------- $Query['org'] = SPrintF('%s %s', Translit($Params['Person']['CompanyName']), Translit($Params['Person']['CompanyFormFull'])); $Query['org_r'] = SPrintF('%s "%s"', $Params['Person']['CompanyFormFull'], $Params['Person']['CompanyName']); $Query['code'] = $Params['Person']['Inn']; $Query['kpp'] = $Params['Person']['Kpp']; $Query['country'] = $Params['Person']['jCountry']; $Query['address_r'] = SPrintF('%s, %s, %s, %s %s', $Params['Person']['jIndex'], $Params['Person']['pState'], $Params['Person']['jCity'], $Params['Person']['jType'], $Params['Person']['jAddress']); $Query['p_addr'] = SPrintF('%s, %s, %s, %s, %s %s, %s "%s"', $Params['Person']['pIndex'], $Params['Person']['pState'], $Params['Person']['pCountry'], $Params['Person']['pCity'], $Params['Person']['pType'], $Params['Person']['pAddress'], $Params['Person']['CompanyFormFull'], $Params['Person']['CompanyName']); $Query['phone'] = $Params['Person']['Phone']; $Query['cell_phone'] = Preg_Replace('/\\s+/', '', $Params['Person']['CellPhone']); $Query['fax'] = $Params['Person']['Fax']; $Query['e_mail'] = $Params['Person']['Email']; #------------------------------------------------------------------------------- if (In_Array($Params['DomainZone'], array('ru', 'su', 'рф'))) { $Query['ogrn_org'] = $Params['Person']['Ogrn']; } #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- default: return new gException('WRONG_PROFILE_ID', 'Неверный идентификатор профиля'); } #------------------------------------------------------------------------------- } elseif (In_Array($Params['DomainZone'], array('moscow', 'москва', 'by', 'tatar', 'дети'))) { #------------------------------------------------------------------------------- # Общие поля для организации и физ.лица $Phone = $Params['Person']['Phone']; #------------------------------------------------------------------------------- $Phone = Preg_Split('/\\s+/', $Phone); #------------------------------------------------------------------------------- $Phone = SPrintF('%s.%s%s', Current($Phone), Next($Phone), Next($Phone)); #------------------------------------------------------------------------------- $Query['o_phone'] = $Phone; $Query['addr_lang'] = isset($Params['Person']['jCountry']) ? $Params['Person']['jCountry'] : (isset($Params['Person']['PasportCountry']) ? $Params['Person']['PasportCountry'] : $Params['Person']['pCountry']); $Query['o_email'] = $Params['Person']['Email']; $Query['addr_cc'] = $Query['addr_lang']; $Query['country'] = $Query['addr_lang']; $Query['descr'] = 'Для представительских функций'; #------------------------------------------------------------------------------- switch ($Params['PersonID']) { case 'Natural': #------------------------------------------------------------------------------- $Query['person_r'] = SPrintF('%s %s %s', $Params['Person']['Sourname'], $Params['Person']['Name'], $Params['Person']['Lastname']); $Query['birth_date'] = $Params['Person']['BornDate']; $Query['passport'] = SPrintF('%s %s выдан %s %s', $Params['Person']['PasportLine'], $Params['Person']['PasportNum'], $Params['Person']['PasportWhom'], $Params['Person']['PasportDate']); $Query['addr_street'] = SPrintF('%s %s', $Params['Person']['pType'], $Params['Person']['pAddress']); $Query['addr_city'] = $Params['Person']['pCity']; $Query['addr_sp'] = $Params['Person']['pState']; $Query['addr_pc'] = $Params['Person']['pIndex']; #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- case 'Juridical': #------------------------------------------------------------------------------- #Контактные данные организации (только при регистрации домена на организацию!) $Query['company_name'] = SPrintF('%s %s', $Params['Person']['CompanyName'], $Params['Person']['CompanyFormFull']); $Query['company_tin'] = $Params['Person']['Inn']; $Query['addr_street'] = SPrintF('%s %s', $Params['Person']['pType'], $Params['Person']['pAddress']); $Query['addr_city'] = $Params['Person']['pCity']; $Query['addr_sp'] = $Params['Person']['pState']; $Query['addr_pc'] = $Params['Person']['pIndex']; #------------------------------------------------------------------------------- $Query['legal_lang'] = 'RU'; $Query['legal_street'] = SPrintF('%s %s', $Params['Person']['jType'], $Params['Person']['jAddress']); $Query['legal_city'] = $Params['Person']['jCity']; $Query['legal_sp'] = $Params['Person']['jState']; $Query['legal_pc'] = $Params['Person']['jIndex']; #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- default: return new gException('WRONG_PERSON_TYPE_ID_2', 'Неверный идентификатор типа персоны'); } #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- # для .kz - Местонахождение серверного оборудования... Москва, пл. Дзержинского, д. 2 =) $Query['street'] = 'ploschad Dzerzinskogo, dom 2'; $Query['city'] = 'Moscow'; $Query['sp'] = 'Moscow'; #------------------------------------------------------------------------------- switch ($Params['PersonID']) { case 'Natural': #------------------------------------------------------------------------------- $Query['o_company'] = 'Private person'; $Query['a_company'] = 'Private person'; $Query['t_company'] = 'Private person'; $Query['b_company'] = 'Private person'; #------------------------------------------------------------------------------- $Query['o_country_code'] = $Params['Person']['pCountry']; $Query['a_country_code'] = $Params['Person']['pCountry']; $Query['t_country_code'] = $Params['Person']['pCountry']; $Query['b_country_code'] = $Params['Person']['pCountry']; #------------------------------------------------------------------------------- $Query['o_postcode'] = $Params['Person']['pIndex']; $Query['a_postcode'] = $Params['Person']['pIndex']; $Query['t_postcode'] = $Params['Person']['pIndex']; $Query['b_postcode'] = $Params['Person']['pIndex']; #------------------------------------------------------------------------------- $Query['o_first_name'] = Translit($Params['Person']['Name']); $Query['a_first_name'] = Translit($Params['Person']['Name']); $Query['t_first_name'] = Translit($Params['Person']['Name']); $Query['b_first_name'] = Translit($Params['Person']['Name']); #------------------------------------------------------------------------------- $Query['o_last_name'] = Translit($Params['Person']['Sourname']); $Query['a_last_name'] = Translit($Params['Person']['Sourname']); $Query['t_last_name'] = Translit($Params['Person']['Sourname']); $Query['b_last_name'] = Translit($Params['Person']['Sourname']); #------------------------------------------------------------------------------- $Query['o_email'] = $Params['Person']['Email']; $Query['a_email'] = $Params['Person']['Email']; $Query['t_email'] = $Params['Person']['Email']; $Query['b_email'] = $Params['Person']['Email']; #------------------------------------------------------------------------------- $Query['o_addr'] = Translit(SPrintF('%s %s', $Params['Person']['pType'], $Params['Person']['pAddress'])); $Query['a_addr'] = Translit(SPrintF('%s %s', $Params['Person']['pType'], $Params['Person']['pAddress'])); $Query['t_addr'] = Translit(SPrintF('%s %s', $Params['Person']['pType'], $Params['Person']['pAddress'])); $Query['b_addr'] = Translit(SPrintF('%s %s', $Params['Person']['pType'], $Params['Person']['pAddress'])); #------------------------------------------------------------------------------- $Query['o_city'] = Translit($Params['Person']['pCity']); $Query['a_city'] = Translit($Params['Person']['pCity']); $Query['t_city'] = Translit($Params['Person']['pCity']); $Query['b_city'] = Translit($Params['Person']['pCity']); #------------------------------------------------------------------------------- $Query['o_state'] = Translit($Params['Person']['pState']); $Query['a_state'] = Translit($Params['Person']['pState']); $Query['t_state'] = Translit($Params['Person']['pState']); $Query['b_state'] = Translit($Params['Person']['pState']); #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- case 'Juridical': #------------------------------------------------------------------------------- $Query['o_company'] = SPrintF('%s %s', Translit($Params['Person']['CompanyName']), Translit($Params['Person']['CompanyFormFull'])); $Query['a_company'] = SPrintF('%s %s', Translit($Params['Person']['CompanyName']), Translit($Params['Person']['CompanyFormFull'])); $Query['t_company'] = SPrintF('%s %s', Translit($Params['Person']['CompanyName']), Translit($Params['Person']['CompanyFormFull'])); $Query['b_company'] = SPrintF('%s %s', Translit($Params['Person']['CompanyName']), Translit($Params['Person']['CompanyFormFull'])); #------------------------------------------------------------------------------- $Query['o_country_code'] = $Params['Person']['jCountry']; $Query['a_country_code'] = $Params['Person']['jCountry']; $Query['t_country_code'] = $Params['Person']['jCountry']; $Query['b_country_code'] = $Params['Person']['jCountry']; #------------------------------------------------------------------------------- $Query['o_postcode'] = $Params['Person']['jIndex']; $Query['a_postcode'] = $Params['Person']['jIndex']; $Query['t_postcode'] = $Params['Person']['jIndex']; $Query['b_postcode'] = $Params['Person']['jIndex']; #------------------------------------------------------------------------------- $Query['o_first_name'] = Translit($Params['Person']['dName']); $Query['a_first_name'] = Translit($Params['Person']['dName']); $Query['t_first_name'] = Translit($Params['Person']['dName']); $Query['b_first_name'] = Translit($Params['Person']['dName']); #------------------------------------------------------------------------------- $Query['o_last_name'] = Translit($Params['Person']['dSourname']); $Query['a_last_name'] = Translit($Params['Person']['dSourname']); $Query['t_last_name'] = Translit($Params['Person']['dSourname']); $Query['b_last_name'] = Translit($Params['Person']['dSourname']); #------------------------------------------------------------------------------- $Query['o_email'] = $Params['Person']['Email']; $Query['a_email'] = $Params['Person']['Email']; $Query['t_email'] = $Params['Person']['Email']; $Query['b_email'] = $Params['Person']['Email']; #------------------------------------------------------------------------------- $Query['o_addr'] = Translit(SPrintF('%s %s', $Params['Person']['jType'], $Params['Person']['jAddress'])); $Query['a_addr'] = Translit(SPrintF('%s %s', $Params['Person']['jType'], $Params['Person']['jAddress'])); $Query['t_addr'] = Translit(SPrintF('%s %s', $Params['Person']['jType'], $Params['Person']['jAddress'])); $Query['b_addr'] = Translit(SPrintF('%s %s', $Params['Person']['jType'], $Params['Person']['jAddress'])); #------------------------------------------------------------------------------- $Query['o_city'] = Translit($Params['Person']['jCity']); $Query['a_city'] = Translit($Params['Person']['jCity']); $Query['t_city'] = Translit($Params['Person']['jCity']); $Query['b_city'] = Translit($Params['Person']['jCity']); #------------------------------------------------------------------------------- $Query['o_state'] = Translit($Params['Person']['jState']); $Query['a_state'] = Translit($Params['Person']['jState']); $Query['t_state'] = Translit($Params['Person']['jState']); $Query['b_state'] = Translit($Params['Person']['jState']); #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- default: return new gException('WRONG_PERSON_TYPE_ID', 'Неверный идентификатор типа персоны'); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Phone = $Params['Person']['Phone']; #------------------------------------------------------------------------------- if ($Phone) { #------------------------------------------------------------------------------- $Phone = Preg_Split('/\\s+/', $Phone); #------------------------------------------------------------------------------- $Phone = SPrintF('%s.%s%s', Current($Phone), Next($Phone), Next($Phone)); #------------------------------------------------------------------------------- $Query['o_phone'] = $Phone; $Query['a_phone'] = $Phone; $Query['t_phone'] = $Phone; $Query['b_phone'] = $Phone; #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- $Query['o_phone'] = ''; $Query['a_phone'] = ''; $Query['t_phone'] = ''; $Query['b_phone'] = ''; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Fax = $Params['Person']['Fax']; #------------------------------------------------------------------------------- if ($Fax) { #------------------------------------------------------------------------------- $Fax = Preg_Split('/\\s+/', $Fax); #------------------------------------------------------------------------------- $Fax = SPrintF('%s.%s%s', Current($Fax), Next($Fax), Next($Fax)); #------------------------------------------------------------------------------- $Query['o_fax'] = $Fax; $Query['a_fax'] = $Fax; $Query['t_fax'] = $Fax; $Query['b_fax'] = $Fax; #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- $Query['o_fax'] = ''; $Query['a_fax'] = ''; $Query['t_fax'] = ''; $Query['b_fax'] = ''; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Query['ns0'] = $Params['Ns1Name']; $Query['ns1'] = $Params['Ns2Name']; #------------------------------------------------------------------------------- if ($Params['Ns3Name']) { $Query['ns3'] = $Params['Ns3Name']; } #------------------------------------------------------------------------------- if ($Params['Ns4Name']) { $Query['ns4'] = $Params['Ns4Name']; } #------------------------------------------------------------------------------- if ($Params['Ns1IP'] && $Params['Ns2IP']) { #------------------------------------------------------------------------------- $Query['ns0ip'] = $Params['Ns1IP']; $Query['ns1ip'] = $Params['Ns2IP']; } #------------------------------------------------------------------------------- if ($Params['Ns3IP']) { $Query['ns3ip'] = $Params['Ns3IP']; } #------------------------------------------------------------------------------- if ($Params['Ns4IP']) { $Query['ns4ip'] = $Params['Ns4IP']; } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if ($Params['DomainZone'] == 'aero') { $Query['aerodata'] = SPrintF('%s.%s', $Params['DomainName'], $Params['DomainZone']); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- return $Query; #------------------------------------------------------------------------------- }