Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- function _527006668($i){
- $a = array (
- 0 => '_TRUSTLINK_USER',
- 1 => '_TRUSTLINK_USER',
- 2 => '0a70cdb962f17a3f437983921fa02647',
- 3 => '',
- 4 => 'host',
- 5 => 'host',
- 6 => 'use_server_array',
- 7 => 'use_server_array',
- 8 => 'HTTP_HOST',
- 9 => '/^http:\\/\\//',
- 10 => '',
- 11 => '/^www\\./',
- 12 => '',
- 13 => 'request_uri',
- 14 => 'request_uri',
- 15 => 'request_uri',
- 16 => 'REQUEST_URI',
- 17 => 'REQUEST_URI',
- 18 => 'multi_site',
- 19 => 'multi_site',
- 20 => 'debug',
- 21 => 'debug',
- 22 => 'trustlink_cookie',
- 23 => 'trustlink_cookie',
- 24 => 'trustlink_debug',
- 25 => 'trustlink_debug',
- 26 => 'REQUEST_URI',
- 27 => 'REQUEST_URI',
- 28 => 'trustlink_updatedb',
- 29 => 'trustlink_updatedb',
- 30 => 'verbose',
- 31 => 'verbose',
- 32 => 'charset',
- 33 => 'charset',
- 34 => 'charset',
- 35 => 'windows-1251',
- 36 => 'fetch_remote_type',
- 37 => 'fetch_remote_type',
- 38 => 'fetch_remote_type',
- 39 => 'socket_timeout',
- 40 => 'socket_timeout',
- 41 => 'socket_timeout',
- 42 => 'socket_timeout',
- 43 => 'force_show_code',
- 44 => 'force_show_code',
- 45 => '_TRUSTLINK_USER',
- 46 => 'Не задана константа _TRUSTLINK_USER',
- 47 => 'ignore_case',
- 48 => 'ignore_case',
- 49 => ' ',
- 50 => 'allow_url_fopen',
- 51 => 'default_socket_timeout',
- 52 => 'user_agent',
- 53 => 'file_get_contents',
- 54 => '',
- 55 => 'allow_url_fopen',
- 56 => 'file_get_contents',
- 57 => '
- ',
- 58 => 'http://',
- 59 => 'http://',
- 60 => 'curl',
- 61 => '',
- 62 => 'curl',
- 63 => 'http://',
- 64 => 'Accept-Charset: ',
- 65 => 'socket',
- 66 => '',
- 67 => '
- ',
- 68 => '
- ',
- 69 => 'Не могу подключиться к серверу: ',
- 70 => ', type: ',
- 71 => 'rb',
- 72 => '',
- 73 => 'Не могу считать данные из файла: ',
- 74 => 'ab',
- 75 => 'Нарушена целостность данных при записи в файл: ',
- 76 => 'Не могу записать данные в файл: ',
- 77 => '<p style="color: red; font-weight: bold;">TRUSTLINK ERROR: ',
- 78 => '</p>',
- 79 => 'Нет файла ',
- 80 => '. Создать не удалось. Выставите права 777 на папку.',
- 81 => 'Нет доступа на запись к файлу: ',
- 82 => '! Выставите права 777 на папку.',
- 83 => '&charset=',
- 84 => 'FATAL ERROR:',
- 85 => '__trustlink_charset__',
- 86 => '__last_update__',
- 87 => '__multi_site__',
- 88 => '__fetch_remote_type__',
- 89 => '__ignore_case__',
- 90 => '__php_version__',
- 91 => '__server_software__',
- 92 => 'SERVER_SOFTWARE',
- 93 => '=',
- 94 => '?',
- 95 => '&',
- 96 => '',
- 97 => '<sape_noindex>',
- 98 => '</sape_noindex>',
- 99 => 'is_block_links',
- 100 => 'is_block_links',
- 101 => 'nof_links_requested',
- 102 => 'nof_links_requested',
- 103 => 'nof_links_displayed',
- 104 => 'nof_links_displayed',
- 105 => 'nof_obligatory',
- 106 => 'nof_obligatory',
- 107 => 'nof_conditional',
- 108 => 'nof_conditional',
- 109 => '<sape_block nof_req="',
- 110 => 'nof_links_requested',
- 111 => '" nof_displ="',
- 112 => 'nof_links_displayed',
- 113 => '" nof_oblig="',
- 114 => 'nof_obligatory',
- 115 => '" nof_cond="',
- 116 => 'nof_conditional',
- 117 => '">',
- 118 => '</sape_block>',
- 119 => 'block_no_css',
- 120 => 'block_orientation',
- 121 => 'block_width',
- 122 => '',
- 123 => '',
- 124 => 'is_block_links',
- 125 => '',
- 126 => '',
- 127 => 'is_block_links',
- 128 => 'nof_links_requested',
- 129 => 'nof_links_displayed',
- 130 => 'nof_obligatory',
- 131 => 'nof_conditional',
- 132 => 'block_no_css',
- 133 => 'css',
- 134 => 'block_orientation',
- 135 => 'block',
- 136 => 'item',
- 137 => 'item_container',
- 138 => '{item}',
- 139 => '',
- 140 => '#<a href="(https?://([^"/]+)[^"]*)"[^>]*>[\\s]*([^<]+)</a>#i',
- 141 => '1251',
- 142 => '{header}',
- 143 => '{text}',
- 144 => '{url}',
- 145 => '{link}',
- 146 => '{item}',
- 147 => '{item}',
- 148 => '',
- 149 => '{items}',
- 150 => '{td_width}',
- 151 => '{td_width}',
- 152 => 'block_width',
- 153 => 'block_width',
- 154 => '{block_style_custom}',
- 155 => 'style="width: ',
- 156 => 'block_width',
- 157 => '!important;"',
- 158 => 'block_no_css',
- 159 => 'block_orientation',
- 160 => 'block_width',
- 161 => '{',
- 162 => '}',
- 163 => '#\\{[a-z\\d_\\-]+\\}#',
- 164 => ' ',
- 165 => 'is_block_links',
- 166 => 'nof_links_requested',
- 167 => 'nof_links_displayed',
- 168 => 'nof_obligatory',
- 169 => 'nof_conditional',
- 170 => 'as_block',
- 171 => 'as_block',
- 172 => '<sape_noindex>',
- 173 => '</sape_noindex>',
- 174 => '<sape_noindex></sape_noindex>',
- 175 => '/',
- 176 => '.home.jpg',
- 177 => '/home.jpg',
- 178 => '/code.php?user=',
- 179 => '&host=',
- 180 => '__trustlink_delimiter__',
- 181 => '__trustlink_delimiter__',
- 182 => '__trustlink_charset__',
- 183 => '__trustlink_charset__',
- 184 => '',
- 185 => '__trustlink_new_url__',
- 186 => '__trustlink_new_url__',
- 187 => '__trustlink_new_url__',
- 188 => '__trustlink_show_only_block__',
- 189 => '__trustlink_show_only_block__',
- 190 => '__sape_block_tpl__',
- 191 => '__sape_block_tpl__',
- 192 => '__sape_block_tpl__',
- 193 => '__sape_block_tpl__',
- 194 => '__sape_block_tpl_options__',
- 195 => '__sape_block_tpl_options__',
- 196 => '__sape_block_tpl_options__',
- 197 => '__sape_block_tpl_options__',
- 198 => '__sape_block_uri_idna__',
- 199 => '__sape_block_uri_idna__',
- 200 => '__sape_block_uri_idna__',
- 201 => '__sape_block_uri_idna__',
- 202 => 'beforeall',
- 203 => 'beforeblock',
- 204 => 'afterblock',
- 205 => 'itemobligatory',
- 206 => 'itemconditional',
- 207 => 'afterall',
- 208 => '__sape_block_ins_',
- 209 => '__',
- 210 => '_block_ins_',
- 211 => '',
- 212 => '<!-- argument for replace_in_text_segment:
- ',
- 213 => '
- -->',
- 214 => '<!-- sentences for replace: ',
- 215 => '&',
- 216 => '&',
- 217 => '"',
- 218 => '"',
- 219 => ''',
- 220 => '\'',
- 221 => '<',
- 222 => '<',
- 223 => '>',
- 224 => '>',
- 225 => '/',
- 226 => '/(&[#a-zA-Z0-9]{2,6};)/isU',
- 227 => '((',
- 228 => ')|(',
- 229 => '))',
- 230 => ' ',
- 231 => '((\\s)|( ))+',
- 232 => '
- ',
- 233 => '-->',
- 234 => '',
- 235 => '',
- 236 => ' ',
- 237 => '<',
- 238 => '/(?si)^(\\/?[a-z0-9]+)/',
- 239 => '/',
- 240 => '<!-- close_tag: ',
- 241 => ' -->',
- 242 => '',
- 243 => '<!-- open_tag: ',
- 244 => ' -->',
- 245 => '<!-- ',
- 246 => ' - deleted from open_tags -->',
- 247 => '<!-- start replacement -->',
- 248 => '>',
- 249 => '/',
- 250 => '/',
- 251 => '/',
- 252 => '/',
- 253 => '$',
- 254 => '\\$',
- 255 => '<!-- ',
- 256 => ' --- ',
- 257 => ' replaced -->',
- 258 => '>',
- 259 => '<!-- ',
- 260 => ' - added to open_tags, stop replacement -->',
- 261 => '/',
- 262 => '/',
- 263 => '/',
- 264 => '/',
- 265 => '$',
- 266 => '\\$',
- 267 => '<!-- ',
- 268 => ' --- ',
- 269 => ' replaced -->',
- 270 => '',
- 271 => '<',
- 272 => '<',
- 273 => '<!-- No word`s for page -->',
- 274 => '<!-- END: work of replace_in_text_segment() -->',
- 275 => '<sape_index>',
- 276 => '</sape_index>',
- 277 => '__trustlink_new_url__',
- 278 => '__trustlink_new_url__',
- 279 => '__trustlink_new_url__',
- 280 => '<!-- Not replaced: ',
- 281 => '
- ',
- 282 => '
- ',
- 283 => '-->',
- 284 => '/(?smi)(<\\/?sape_index>)/',
- 285 => '',
- 286 => '<!-- Split by Sape_index cnt_parts=',
- 287 => '-->',
- 288 => '/(?smi)(<\\/?body[^>]*>)/',
- 289 => '<!-- Split by BODY -->',
- 290 => '<!-- Can`t split by BODY -->',
- 291 => '/(?smi)(<\\/?sape_index>)/',
- 292 => '',
- 293 => '__trustlink_new_url__',
- 294 => '__trustlink_new_url__',
- 295 => '__trustlink_new_url__',
- 296 => '<!-- No word`s for page -->',
- 297 => '/',
- 298 => '.words.db',
- 299 => '/words.db',
- 300 => '/code_context.php?user=',
- 301 => '&host=',
- 302 => 'headers_enabled',
- 303 => 'headers_enabled',
- 304 => 'charset',
- 305 => 'charset',
- 306 => 'charset',
- 307 => '',
- 308 => 'index',
- 309 => 'announcements_delimiter',
- 310 => 'index',
- 311 => 'announcements_delimiter',
- 312 => 'index',
- 313 => 'charset',
- 314 => 'charset',
- 315 => 'charset',
- 316 => 'index',
- 317 => 'charset',
- 318 => 'host',
- 319 => 'host',
- 320 => 'HTTP_HOST',
- 321 => 'index',
- 322 => 'announcements',
- 323 => '/',
- 324 => '/',
- 325 => 'index',
- 326 => 'announcements',
- 327 => '',
- 328 => 'index',
- 329 => 'checkCode',
- 330 => 'index',
- 331 => 'checkCode',
- 332 => 'index',
- 333 => 'announcements',
- 334 => 'index',
- 335 => 'announcements',
- 336 => 'index',
- 337 => 'announcements',
- 338 => 'index',
- 339 => 'announcements',
- 340 => '<sape_noindex>',
- 341 => '</sape_noindex>',
- 342 => 'index',
- 343 => 'articles.db',
- 344 => 'index',
- 345 => 'index',
- 346 => 'articles',
- 347 => 'index',
- 348 => 'index',
- 349 => 'images',
- 350 => 'index',
- 351 => 'checkCode',
- 352 => 'article',
- 353 => 'index',
- 354 => 'articles',
- 355 => 'id',
- 356 => '.article.db',
- 357 => 'id',
- 358 => 'article',
- 359 => 'date_updated',
- 360 => 'article',
- 361 => 'date_updated',
- 362 => 'date_updated',
- 363 => 'index',
- 364 => 'templates',
- 365 => 'template_id',
- 366 => 'url',
- 367 => 'template_id',
- 368 => '/images/',
- 369 => 'Нет папки ',
- 370 => '. Создать не удалось. Выставите права 777 на папку.',
- 371 => '.',
- 372 => 'image',
- 373 => 'index',
- 374 => 'images',
- 375 => 'id',
- 376 => '.',
- 377 => 'ext',
- 378 => 'date_updated',
- 379 => 'date_updated',
- 380 => 'dispenser_path',
- 381 => 'FATAL ERROR:',
- 382 => 'mime',
- 383 => 'mime',
- 384 => 'image',
- 385 => 'Content-Type: ',
- 386 => '{meta_charset}',
- 387 => 'index',
- 388 => 'template_fields',
- 389 => 'article',
- 390 => '{',
- 391 => '}',
- 392 => 'article',
- 393 => '{',
- 394 => '}',
- 395 => '',
- 396 => 'tpl.articles.db',
- 397 => 'templates',
- 398 => 'templates',
- 399 => 'templates',
- 400 => 'date_updated',
- 401 => 'index',
- 402 => 'templates',
- 403 => 'lifetime',
- 404 => 'templates',
- 405 => 'Не найден шаблон для статьи',
- 406 => 'templates',
- 407 => 'body',
- 408 => '',
- 409 => 'path',
- 410 => 'path',
- 411 => 'query',
- 412 => '?',
- 413 => 'query',
- 414 => 'templates',
- 415 => 'body',
- 416 => 'date_updated',
- 417 => 'templates',
- 418 => 'mask',
- 419 => 'code',
- 420 => 'len',
- 421 => 'mask',
- 422 => 'code',
- 423 => 'len',
- 424 => '~(\\<a [^\\>]*?href[^\\>]*?\\=["\']{0,1}http[^\\>]*?\\>.*?\\</a[^\\>]*?\\>|\\<a [^\\>]*?href[^\\>]*?\\=["\']{0,1}http[^\\>]*?\\>|\\<area [^\\>]*?href[^\\>]*?\\=["\']{0,1}http[^\\>]*?\\>)~si',
- 425 => '~\\<a |\\<area ~si',
- 426 => '~[\\s]{1}rel\\=["\']{1}[^ "\'\\>]*?["\']{1}| rel\\=[^ "\'\\>]*?[\\s]{1}~si',
- 427 => '~[\\s]{1}href\\=["\']{0,1}(http[^ "\'\\>]*)?["\']{0,1} {0,1}~si',
- 428 => 'index',
- 429 => 'ext_links_allowed',
- 430 => 'www.',
- 431 => 'C',
- 432 => '|<!--(.*?)-->|smi',
- 433 => 'S',
- 434 => '|<script[^>]*>.*?</script>|si',
- 435 => 'N',
- 436 => '|<noindex[^>]*>.*?</noindex>|si',
- 437 => 'host',
- 438 => 'host',
- 439 => '<noindex>',
- 440 => '</noindex>',
- 441 => '',
- 442 => 'N',
- 443 => 'host',
- 444 => 'host',
- 445 => '',
- 446 => '$0rel="nofollow" ',
- 447 => '',
- 448 => 'S',
- 449 => 'C',
- 450 => 'index',
- 451 => 'template_required_fields',
- 452 => '{',
- 453 => '}',
- 454 => 'В шаблоне не хватает поля ',
- 455 => '.',
- 456 => 'HTTP/1.x 200 OK',
- 457 => 'Content-Type: text/html; charset=',
- 458 => 'HTTP/1.x 404 Not Found',
- 459 => 'index',
- 460 => '/?user=',
- 461 => '&host=',
- 462 => '&rtype=',
- 463 => 'article',
- 464 => '/?user=',
- 465 => '&host=',
- 466 => '&rtype=',
- 467 => '&artid=',
- 468 => 'image',
- 469 => '/',
- 470 => '.',
- 471 => '/',
- );
- return $a[$i];
- }
- if (!defined("_TRUSTLINK_USER")) {
- define("_TRUSTLINK_USER" , "0a70cdb962f17a3f437983921fa02647");
- }
- class TRUSTLINK_base
- {
- var $_0 = '1.1.6';
- var $_1 = false;
- var $_2 = '';
- var $_3 = '';
- var $_4 = array(
- 'dispenser-01.strangled.net',
- 'dispenser-02.us.to'
- );
- var $_5 = 3600;
- var $_6 = 600;
- var $_7 = '';
- var $_8 = '';
- var $_9 = '';
- var $_10 = false;
- var $_11 = '';
- var $_12 = 6;
- var $_13 = false;
- var $_14 = false;
- var $_15 = false;
- var $_16 = false;
- var $_17 = '';
- var $_18 = false;
- var $_19 = false;
- var $_20 = false;
- var $_21 = false;
- function TRUSTLINK_base($_22 = null)
- {
- $_23 = "";
- if (is_array($_22)) {
- if (isset($_22["host"])) {
- $_23 = $_22["host"];
- }
- }
- elseif (strlen($_22)) {
- $_23 = $_22;
- $_22 = array();
- }
- else {
- $_22 = array();
- }
- if (isset($_22["use_server_array"]) && $_22["use_server_array"] == true) {
- $this->_18 = true;
- }
- if (strlen($_23)) {
- $this->_8 = $_23;
- }
- else {
- $this->_8 = $_SERVER["HTTP_HOST"];
- }
- $this->_8 = preg_replace('/^http:\/\//' , '' , $this->_8);
- $this->_8 = preg_replace('/^www\./' , '' , $this->_8);
- if (isset($_22["request_uri" ]) && strlen($_22["request_uri" ])) {
- $this->_9 = $_22["request_uri" ];
- }
- elseif ($this->_18 === false) {
- $this->_9 = getenv("REQUEST_URI");
- }
- if (strlen($this->_9) == round(0)) {
- $this->_9 = $_SERVER["REQUEST_URI" ];
- }
- if (isset($_22["multi_site" ]) && $_22["multi_site" ] == true) {
- $this->_10 = true;
- }
- if (isset($_22["debug" ]) && $_22["debug" ] == true) {
- $this->_15 = true;
- }
- if (isset($_COOKIE["trustlink_cookie" ]) && ($_COOKIE["trustlink_cookie" ] == _TRUSTLINK_USER)) {
- $this->_14 = true;
- if (isset($_COOKIE["trustlink_debug" ]) && ($_COOKIE["trustlink_debug" ] == round(0 + 0.25 + 0.25 + 0.25 + 0.25))) {
- $this->_15 = true;
- $this->_24 = $_22;
- $this->_25 = $this->_9 = $_SERVER["REQUEST_URI" ];
- $this->_26 = getenv("REQUEST_URI");
- $this->_27 = _TRUSTLINK_USER;
- }
- if (isset($_COOKIE["trustlink_updatedb" ]) && ($_COOKIE["trustlink_updatedb" ] == round(0 + 0.5 + 0.5))) {
- $this->_19 = true;
- }
- }
- else {
- $this->_14 = false;
- }
- if (isset($_22["verbose" ]) && $_22["verbose" ] == true || $this->_15) {
- $this->_1 = true;
- }
- if (isset($_22["charset" ]) && strlen($_22["charset" ])) {
- $this->_2 = $_22["charset" ];
- }
- else {
- $this->_2 = "windows-1251";
- }
- if (isset($_22["fetch_remote_type" ]) && strlen($_22["fetch_remote_type" ])) {
- $this->_11 = $_22["fetch_remote_type" ];
- }
- if (isset($_22["socket_timeout" ]) && is_numeric($_22["socket_timeout" ]) && $_22["socket_timeout" ] > round(0)) {
- $this->_12 = $_22["socket_timeout" ];
- }
- if (isset($_22["force_show_code" ]) && $_22["force_show_code" ] == true) {
- $this->_13 = true;
- }
- if (!defined("_TRUSTLINK_USER")) {
- return $this->raise_error("Не задана константа _TRUSTLINK_USER");
- }
- if (isset($_22["ignore_case" ]) && $_22["ignore_case" ] == true) {
- $this->_16 = true;
- $this->_9 = strtolower($this->_9);
- }
- }
- function fetch_remote_file($_23, $_28, $_29 = false)
- {
- $_30 = $this->_31 . " " . $this->_0;
- @ini_set("allow_url_fopen" , round(0 + 0.2 + 0.2 + 0.2 + 0.2 + 0.2));
- @ini_set("default_socket_timeout" , $this->_12);
- @ini_set("user_agent" , $_30);
- if ($this->_11 == "file_get_contents" || ($this->_11 == "" && function_exists('file_get_contents') && ini_get("allow_url_fopen") == round(0 + 0.5 + 0.5))) {
- $this->_11 = "file_get_contents";
- if ($_29 && function_exists('stream_context_create')) {
- $_32 = array(
- 'http' => array(
- 'method' => 'GET',
- 'header' => 'Accept-Charset: ' . $this->_2 . "
- "
- )
- );
- $_33 = @stream_context_create($_32);
- if ($_34 = @file_get_contents("http://" . $_23 . $_28, null, $_33)) {
- return $_34;
- }
- }
- else {
- if ($_34 = @file_get_contents("http://" . $_23 . $_28)) {
- return $_34;
- }
- }
- }
- elseif ($this->_11 == "curl" || ($this->_11 == "" && function_exists('curl_init'))) {
- $this->_11 = "curl";
- if ($_35 = @curl_init()) {
- @curl_setopt($_35, 10002, "http://" . $_23 . $_28);
- @curl_setopt($_35, 42, false);
- @curl_setopt($_35, 19913, true);
- @curl_setopt($_35, 78, $this->_12);
- @curl_setopt($_35, 10018, $_30);
- if ($_29) {
- @curl_setopt($_35, 10023, array(
- "Accept-Charset: " . $this->_2
- ));
- }
- $_34 = @curl_exec($_35);
- @curl_close($_35);
- if ($_34) {
- return $_34;
- }
- }
- }
- else {
- $this->_11 = "socket";
- $_36 = "";
- $_37 = @fsockopen($_23, round(0 + 16 + 16 + 16 + 16 + 16) , $_38, $_39, $this->_12);
- if ($_37) {
- @fputs($_37, "GET {$_28} HTTP/1.0\r\nHost: {$_23}\r\n");
- if ($_29) {
- @fputs($_37, "Accept-Charset: {$this->_2}\r\n");
- }
- @fputs($_37, "User-Agent: {$_30}\r\n\r\n");
- while (!@feof($_37)) {
- $_36.= @fgets($_37, round(0 + 32 + 32 + 32 + 32));
- }
- @fclose($_37);
- $_40 = explode("
- " , $_36);
- unset($_40[round(0) ]);
- return implode("
- " , $_40);
- }
- }
- return $this->raise_error("Не могу подключиться к серверу: " . $_23 . $_28 . ", type: " . $this->_11);
- }
- function _read($_41)
- {
- $_37 = @fopen($_41, "rb");
- @flock($_37, 1);
- if ($_37) {
- clearstatcache();
- $_42 = @filesize($_41);
- $_43 = @get_magic_quotes_runtime();
- @set_magic_quotes_runtime(round(0));
- if ($_42) {
- $_34 = @fread($_37, $_42);
- }
- else {
- $_34 = "";
- }
- @set_magic_quotes_runtime($_43);
- @flock($_37, 3);
- @fclose($_37);
- return $_34;
- }
- return $this->raise_error("Не могу считать данные из файла: " . $_41);
- }
- function _write($_41, $_34)
- {
- $_37 = @fopen($_41, "ab");
- if ($_37) {
- if (flock($_37, 2 | 4)) {
- ftruncate($_37, round(0));
- $_43 = @get_magic_quotes_runtime();
- @set_magic_quotes_runtime(round(0));
- @fwrite($_37, $_34);
- @set_magic_quotes_runtime($_43);
- @flock($_37, 3);
- @fclose($_37);
- if (md5($this->_read($_41)) != md5($_34)) {
- @unlink($_41);
- return $this->raise_error("Нарушена целостность данных при записи в файл: " . $_41);
- }
- }
- else {
- return false;
- }
- return true;
- }
- return $this->raise_error("Не могу записать данные в файл: " . $_41);
- }
- function raise_error($_44)
- {
- $this->_7 = '<p style="color: red; font-weight: bold;">TRUSTLINK ERROR: ' . $_44 . '</p>';
- if ($this->_1 == true) {
- print $this->_7;
- }
- return false;
- }
- function load_data()
- {
- $this->_17 = $this->_get_db_file();
- if (!is_file($this->_17)) {
- if (@touch($this->_17)) {
- @chmod($this->_17, round(0 + 438));
- }
- else {
- return $this->raise_error("Нет файла " . $this->_17 . ". Создать не удалось. Выставите права 777 на папку.");
- }
- }
- if (!is_writable($this->_17)) {
- return $this->raise_error("Нет доступа на запись к файлу: " . $this->_17 . "! Выставите права 777 на папку.");
- }
- @clearstatcache();
- $_34 = $this->_read($this->_17);
- if ($this->_19 || (!$this->_14 && (filemtime($this->_17) < (time() - $this->_5) || filesize($this->_17) == round(0) || @unserialize($_34) == false))) {
- @touch($this->_17, (time() - $this->_5 + $this->_6));
- $_28 = $this->_get_dispenser_path();
- if (strlen($this->_2)) {
- $_28.= "&charset=" . $this->_2;
- }
- foreach($this->_4 as $_45 => $_46) {
- if ($_34 = $this->fetch_remote_file($_46, $_28)) {
- if (substr($_34, round(0) , round(0 + 2.4 + 2.4 + 2.4 + 2.4 + 2.4)) == "FATAL ERROR:") {
- $this->raise_error($_34);
- }
- else {
- $_47 = @unserialize($_34);
- if ($_47 != false) {
- $_47["__trustlink_charset__" ] = $this->_2;
- $_47["__last_update__" ] = time();
- $_47["__multi_site__" ] = $this->_10;
- $_47["__fetch_remote_type__" ] = $this->_11;
- $_47["__ignore_case__" ] = $this->_16;
- $_47["__php_version__" ] = phpversion();
- $_47["__server_software__" ] = $_SERVER["SERVER_SOFTWARE" ];
- $_48 = @serialize($_47);
- if ($_48) {
- $_34 = $_48;
- }
- $this->_write($this->_17, $_34);
- break;
- }
- }
- }
- }
- }
- if (strlen(session_id())) {
- $_49 = session_name() . "=" . session_id();
- $this->_9 = str_replace(array(
- "?" . $_49,
- "&" . $_49
- ) , "" , $this->_9);
- }
- $this->set_data(@unserialize($_34));
- }
- }
- class TRUSTLINK_client extends TRUSTLINK_base
- {
- var $_50 = '';
- var $_51 = array();
- var $_52 = array();
- var $_31 = 'TRUSTLINK_Client PHP';
- function TRUSTLINK_client($_22 = null)
- {
- parent::TRUSTLINK_base($_22);
- $this->load_data();
- }
- function _return_array_links_html($_53, $_22 = null)
- {
- if (empty($_22)) {
- $_22 = array();
- }
- if (strlen($this->_2) > round(0) && strlen($this->_3) > round(0) && $this->_3 != $this->_2 && function_exists('iconv')) {
- $_54 = @iconv($this->_3, $this->_2, $_53);
- if ($_54) {
- $_53 = $_54;
- }
- }
- if ($this->_14) {
- $_53 = "<sape_noindex>" . $_53 . "</sape_noindex>";
- if (isset($_22["is_block_links" ]) && true == $_22["is_block_links" ]) {
- if (!isset($_22["nof_links_requested" ])) {
- $_22["nof_links_requested" ] = round(0);
- }
- if (!isset($_22["nof_links_displayed" ])) {
- $_22["nof_links_displayed" ] = round(0);
- }
- if (!isset($_22["nof_obligatory" ])) {
- $_22["nof_obligatory" ] = round(0);
- }
- if (!isset($_22["nof_conditional" ])) {
- $_22["nof_conditional" ] = round(0);
- }
- $_53 = '<sape_block nof_req="' . $_22["nof_links_requested" ] . '" nof_displ="' . $_22["nof_links_displayed" ] . '" nof_oblig="' . $_22["nof_obligatory" ] . '" nof_cond="' . $_22["nof_conditional" ] . '">' . $_53 . '</sape_block>';
- }
- }
- return $_53;
- }
- function _return_html($_53)
- {
- if ($this->_15) {
- $_53.= print_r($this, true);
- }
- return $_53;
- }
- function return_block_links($_55 = null, $_56 = 0, $_22 = null)
- {
- if (empty($_22)) {
- $_22 = array();
- }
- $_57 = array();
- $_57["block_no_css" ] = false;
- $_57["block_orientation" ] = round(0 + 0.33333333333333 + 0.33333333333333 + 0.33333333333333);
- $_57["block_width" ] = "";
- $_58 = array();
- if (isset($this->_59) && is_array($this->_59)) {
- $_58 = $this->_59;
- }
- $_22 = array_merge($_57, $_58, $_22);
- if (!is_array($this->_52)) {
- $_53 = $this->_return_array_links_html("" , array(
- "is_block_links" => true
- ));
- return $this->_return_html($this->_52 . $_53);
- }
- elseif (!isset($this->_60)) {
- return $this->_return_html("");
- }
- $_61 = count($this->_52);
- $_62 = false;
- $_63 = false;
- $_64 = round(0);
- if (isset($this->_65)) {
- $_62 = true;
- }
- if (is_numeric($_55) && $_55 >= $_61) {
- $_64 = $_55;
- if (isset($this->_66)) {
- $_63 = true;
- }
- }
- if (!is_numeric($_55) || $_55 > $_61) {
- $_55 = $_61;
- }
- $_67 = array();
- for ($_45 = round(0 + 0.5 + 0.5); $_45 <= $_55; $_45++) {
- if ($_56 > round(0) && $_45 <= $_56) {
- array_shift($this->_52);
- }
- else {
- $_67[] = array_shift($this->_52);
- }
- }
- $_53 = "";
- $_68 = round(0);
- if (count($_67) < $_64 && true == $_63) {
- $_68 = $_64 - count($_67);
- }
- if (empty($_67) && $_62 == false && $_68 == round(0)) {
- $_69 = array(
- "is_block_links" => true,
- "nof_links_requested" => $_64,
- "nof_links_displayed" => round(0) ,
- "nof_obligatory" => round(0) ,
- "nof_conditional" => round(0)
- );
- $_53 = $this->_return_array_links_html($_53, $_69);
- return $this->_return_html($_53);
- }
- if (!$this->_20 && false == $_22["block_no_css" ]) {
- $_53.= $this->_60["css" ];
- $this->_20 = true;
- }
- if (isset($this->_70) && !$this->_21) {
- $_53.= $this->_70;
- $this->_21 = true;
- }
- if (isset($this->_71)) {
- $_53.= $this->_71;
- }
- $_72 = $this->_60[$_22["block_orientation" ]];
- $_73 = $_72["block" ];
- $_74 = $_72["item" ];
- $_75 = $_72["item_container" ];
- $_76 = str_replace("{item}" , $_74, $_75);
- $_77 = "";
- $_78 = count($_67);
- foreach($_67 as $_79) {
- preg_match('#<a href="(https?://([^"/]+)[^"]*)"[^>]*>[\s]*([^<]+)</a>#i' , $_79, $_80);
- if (function_exists('mb_strtoupper') && strlen($this->_3) > round(0)) {
- $_81 = mb_substr($_80[round(0 + 1.5 + 1.5) ], round(0 + 1) , mb_strlen($_80[round(0 + 0.75 + 0.75 + 0.75 + 0.75) ], $this->_3) - round(0 + 0.5 + 0.5) , $this->_3);
- $_82 = mb_strtoupper(mb_substr($_80[round(0 + 0.75 + 0.75 + 0.75 + 0.75) ], round(0) , round(0 + 1) , $this->_3) , $this->_3);
- $_80[round(0 + 1.5 + 1.5) ] = $_82 . $_81;
- }
- elseif (function_exists('ucfirst') && (strlen($this->_3) == round(0) || strpos($this->_3, "1251") !== false)) {
- $_80[round(0 + 1 + 1 + 1) ][round(0) ] = ucfirst($_80[round(0 + 3) ][round(0) ]);
- }
- if (isset($this->_83) && isset($this->_83[$_80[round(0 + 1 + 1) ]])) {
- $_80[round(0 + 1 + 1) ] = $this->_83[$_80[round(0 + 2) ]];
- }
- $_84 = $_76;
- $_84 = str_replace("{header}" , $_80[round(0 + 1.5 + 1.5) ], $_84);
- $_84 = str_replace("{text}" , trim($_79) , $_84);
- $_84 = str_replace("{url}" , $_80[round(0 + 1 + 1) ], $_84);
- $_84 = str_replace("{link}" , $_80[round(0 + 0.33333333333333 + 0.33333333333333 + 0.33333333333333) ], $_84);
- $_77.= $_84;
- }
- if (true == $_62) {
- $_77.= str_replace("{item}" , $this->_65, $_75);
- $_78+= round(0 + 0.2 + 0.2 + 0.2 + 0.2 + 0.2);
- }
- if ($_63 == true && $_68 > round(0)) {
- for ($_45 = round(0); $_45 < $_68; $_45++) {
- $_77.= str_replace("{item}" , $this->_66, $_75);
- }
- $_78+= $_68;
- }
- if ($_77 != "") {
- $_53.= str_replace("{items}" , $_77, $_73);
- if ($_78 > round(0)) {
- $_53 = str_replace("{td_width}" , round(round(0 + 20 + 20 + 20 + 20 + 20) / $_78) , $_53);
- }
- else {
- $_53 = str_replace("{td_width}" , round(0) , $_53);
- }
- if (isset($_22["block_width" ]) && !empty($_22["block_width" ])) {
- $_53 = str_replace("{block_style_custom}" , 'style="width: ' . $_22["block_width" ] . '!important;"' , $_53);
- }
- }
- unset($_72, $_73, $_77, $_84, $_74, $_75);
- if (isset($this->_85)) {
- $_53.= $this->_85;
- }
- unset($_22["block_no_css" ], $_22["block_orientation" ], $_22["block_width" ]);
- $_86 = array_keys($_22);
- foreach($_86 as $_87 => $_88) {
- $_86[$_87] = "{" . $_88 . "}";
- }
- unset($_88, $_87);
- $_89 = array_values($_22);
- $_53 = str_replace($_86, $_89, $_53);
- unset($_86, $_89);
- $_90 = "#\{[a-z\d_\-]+\}#";
- $_53 = preg_replace($_90, " " , $_53);
- $_69 = array(
- "is_block_links" => true,
- "nof_links_requested" => $_64,
- "nof_links_displayed" => $_55,
- "nof_obligatory" => ($_62 == true ? round(0 + 0.5 + 0.5) : round(0)) ,
- "nof_conditional" => $_68
- );
- $_53 = $this->_return_array_links_html($_53, $_69);
- return $this->_return_html($_53);
- }
- function return_links($_55 = null, $_56 = 0, $_22 = null)
- {
- $_91 = $this->_92;
- if (is_array($_22) && isset($_22["as_block" ]) && false == $_91) {
- $_91 = $_22["as_block" ];
- }
- if (true == $_91 && isset($this->_60)) {
- return $this->return_block_links($_55, $_56, $_22);
- }
- if (is_array($this->_52)) {
- $_61 = count($this->_52);
- if (!is_numeric($_55) || $_55 > $_61) {
- $_55 = $_61;
- }
- $_67 = array();
- for ($_45 = round(0 + 0.33333333333333 + 0.33333333333333 + 0.33333333333333); $_45 <= $_55; $_45++) {
- if ($_56 > round(0) && $_45 <= $_56) {
- array_shift($this->_52);
- }
- else {
- $_67[] = array_shift($this->_52);
- }
- }
- $_53 = join($this->_50, $_67);
- if (strlen($this->_2) > round(0) && strlen($this->_3) > round(0) && $this->_3 != $this->_2 && function_exists('iconv')) {
- $_54 = @iconv($this->_3, $this->_2, $_53);
- if ($_54) {
- $_53 = $_54;
- }
- }
- if ($this->_14) {
- $_53 = "<sape_noindex>" . $_53 . "</sape_noindex>";
- }
- }
- else {
- $_53 = $this->_52;
- if ($this->_14) {
- $_53.= "<sape_noindex></sape_noindex>";
- }
- }
- if ($this->_15) {
- $_53.= print_r($this, true);
- }
- return $_53;
- }
- function _get_db_file()
- {
- if ($this->_10) {
- return dirname(__FILE__) . "/" . $this->_8 . ".home.jpg";
- }
- else {
- return dirname(__FILE__) . "/home.jpg";
- }
- }
- function _get_dispenser_path()
- {
- return "/code.php?user=" . _TRUSTLINK_USER . "&host=" . $this->_8;
- }
- function set_data($_34)
- {
- if ($this->_16) {
- $this->_51 = array_change_key_case($_34);
- }
- else {
- $this->_51 = $_34;
- }
- if (isset($this->_51["__trustlink_delimiter__" ])) {
- $this->_50 = $this->_51["__trustlink_delimiter__" ];
- }
- if (isset($this->_51["__trustlink_charset__" ])) {
- $this->_3 = $this->_51["__trustlink_charset__" ];
- }
- else {
- $this->_3 = "";
- }
- if (@array_key_exists($this->_9, $this->_51) && is_array($this->_51[$this->_9])) {
- $this->_52 = $this->_51[$this->_9];
- }
- else {
- if (isset($this->_51["__trustlink_new_url__" ]) && strlen($this->_51["__trustlink_new_url__" ])) {
- if ($this->_14 || $this->_13) {
- $this->_52 = $this->_51["__trustlink_new_url__" ];
- }
- }
- }
- if (isset($this->_51["__trustlink_show_only_block__" ])) {
- $this->_92 = $this->_51["__trustlink_show_only_block__" ];
- }
- else {
- $this->_92 = false;
- }
- if (isset($this->_51["__sape_block_tpl__" ]) && !empty($this->_51["__sape_block_tpl__" ]) && is_array($this->_51["__sape_block_tpl__" ])) {
- $this->_60 = $this->_51["__sape_block_tpl__" ];
- }
- if (isset($this->_51["__sape_block_tpl_options__" ]) && !empty($this->_51["__sape_block_tpl_options__" ]) && is_array($this->_51["__sape_block_tpl_options__" ])) {
- $this->_59 = $this->_51["__sape_block_tpl_options__" ];
- }
- if (isset($this->_51["__sape_block_uri_idna__" ]) && !empty($this->_51["__sape_block_uri_idna__" ]) && is_array($this->_51["__sape_block_uri_idna__" ])) {
- $this->_83 = $this->_51["__sape_block_uri_idna__" ];
- }
- $_93 = array(
- "beforeall" ,
- "beforeblock" ,
- "afterblock" ,
- "itemobligatory" ,
- "itemconditional" ,
- "afterall"
- );
- foreach($_93 as $_94) {
- $_95 = "__sape_block_ins_" . $_94 . "__";
- $_96 = "_block_ins_" . $_94;
- if (isset($this->_51[$_95]) && strlen($this->_51[$_95]) > round(0)) {
- $this->$_96 = $this->_51[$_95];
- }
- }
- }
- }
- class TRUSTLINK_context extends TRUSTLINK_base
- {
- var $_97 = array();
- var $_98 = array();
- var $_31 = 'TRUSTLINK_Context PHP';
- var $_99 = array(
- 'a',
- 'textarea',
- 'select',
- 'script',
- 'style',
- 'label',
- 'noscript',
- 'noindex',
- 'button'
- );
- function TRUSTLINK_context($_22 = null)
- {
- parent::TRUSTLINK_base($_22);
- $this->load_data();
- }
- function replace_in_text_segment($_100)
- {
- $_101 = "";
- if ($this->_15) {
- $_101.= "<!-- argument for replace_in_text_segment:
- " . base64_encode($_100) . "
- -->";
- }
- if (count($this->_98) > round(0)) {
- $_102 = array();
- if ($this->_15) {
- $_101.= "<!-- sentences for replace: ";
- }
- foreach($this->_98 as $_55 => $_103) {
- $_104 = array(
- "&" => "&" ,
- """ => '"' ,
- "'" => "'" ,
- "<" => "<" ,
- ">" => ">"
- );
- $_103 = strip_tags($_103);
- foreach($_104 as $_105 => $_106) {
- str_replace($_105, $_106, $_103);
- }
- $_103 = htmlspecialchars($_103);
- $_103 = preg_quote($_103, "/");
- $_107 = array();
- if (preg_match_all('/(&[#a-zA-Z0-9]{2,6};)/isU' , $_103, $_108)) {
- for ($_45 = round(0); $_45 < count($_108[round(0 + 0.2 + 0.2 + 0.2 + 0.2 + 0.2) ]); $_45++) {
- $_109 = $_104[$_108[round(0 + 0.5 + 0.5) ][$_45]];
- $_110 = $_108[round(0 + 0.25 + 0.25 + 0.25 + 0.25) ][$_45];
- $_107[$_109] = $_110;
- }
- }
- foreach($_107 as $_109 => $_110) {
- $_103 = str_replace($_110, "((" . $_110 . ")|(" . $_109 . "))" , $_103);
- }
- $_111[$_55] = str_replace(" " , "((\s)|( ))+" , $_103);
- if ($this->_15) {
- $_101.= $_111[$_55] . "
- ";
- }
- }
- if ($this->_15) {
- $_101.= "-->";
- }
- $_112 = true;
- if (count($_111) > round(0)) {
- $_113 = "";
- $_114 = array();
- $_115 = "";
- $_116 = strtok(" " . $_100, "<");
- while ($_116 !== false) {
- if (preg_match('/(?si)^(\/?[a-z0-9]+)/' , $_116, $_117)) {
- $_118 = strtolower($_117[round(0 + 0.5 + 0.5) ]);
- if (substr($_118, round(0) , round(0 + 0.2 + 0.2 + 0.2 + 0.2 + 0.2)) == "/") {
- $_115 = substr($_118, round(0 + 0.5 + 0.5));
- if ($this->_15) {
- $_101.= "<!-- close_tag: " . $_115 . " -->";
- }
- }
- else {
- $_115 = "";
- if ($this->_15) {
- $_101.= "<!-- open_tag: " . $_118 . " -->";
- }
- }
- $_119 = count($_114);
- if (($_119 > round(0)) && ($_114[$_119 - round(0 + 0.25 + 0.25 + 0.25 + 0.25) ] == $_115)) {
- array_pop($_114);
- if ($this->_15) {
- $_101.= "<!-- " . $_118 . " - deleted from open_tags -->";
- }
- if ($_119 - round(0 + 0.5 + 0.5) == round(0)) {
- if ($this->_15) {
- $_101.= "<!-- start replacement -->";
- }
- }
- }
- if (count($_114) == round(0)) {
- if (!in_array($_118, $this->_99)) {
- $_120 = explode(">" , $_116, round(0 + 2));
- if (count($_120) == round(0 + 1 + 1)) {
- foreach($_111 as $_55 => $_103) {
- if (preg_match("/" . $_103 . "/" , $_120[round(0 + 0.5 + 0.5) ]) == round(0 + 1)) {
- $_120[round(0 + 1) ] = preg_replace("/" . $_103 . "/" , str_replace("$" , "\$" , $this->_98[$_55]) , $_120[round(0 + 0.25 + 0.25 + 0.25 + 0.25) ], round(0 + 0.5 + 0.5));
- if ($this->_15) {
- $_101.= "<!-- " . $_103 . " --- " . $this->_98[$_55] . " replaced -->";
- }
- unset($_111[$_55]);
- unset($this->_98[$_55]);
- }
- }
- $_116 = $_120[round(0) ] . ">" . $_120[round(0 + 0.33333333333333 + 0.33333333333333 + 0.33333333333333) ];
- unset($_120);
- }
- }
- else {
- $_114[] = $_118;
- if ($this->_15) {
- $_101.= "<!-- " . $_118 . " - added to open_tags, stop replacement -->";
- }
- }
- }
- }
- else {
- foreach($_111 as $_55 => $_103) {
- if (preg_match("/" . $_103 . "/" , $_116) == round(0 + 1)) {
- $_116 = preg_replace("/" . $_103 . "/" , str_replace("$" , "\$" , $this->_98[$_55]) , $_116, round(0 + 0.33333333333333 + 0.33333333333333 + 0.33333333333333));
- if ($this->_15) {
- $_101.= "<!-- " . $_103 . " --- " . $this->_98[$_55] . " replaced -->";
- }
- unset($_111[$_55]);
- unset($this->_98[$_55]);
- }
- }
- }
- if ($this->_15) {
- $_113.= $_101;
- $_101 = "";
- }
- if ($_112) {
- $_113.= $_116;
- $_112 = false;
- }
- else {
- $_113.= $_101 . "<" . $_116;
- }
- unset($_116);
- $_116 = strtok("<");
- }
- $_100 = ltrim($_113);
- unset($_113);
- }
- }
- else {
- if ($this->_15) {
- $_101.= "<!-- No word`s for page -->";
- }
- }
- if ($this->_15) {
- $_101.= "<!-- END: work of replace_in_text_segment() -->";
- }
- if ($this->_14 || $this->_13 || $this->_15) {
- $_100 = "<sape_index>" . $_100 . "</sape_index>";
- if (isset($this->_97["__trustlink_new_url__" ]) && strlen($this->_97["__trustlink_new_url__" ])) {
- $_100.= $this->_97["__trustlink_new_url__" ];
- }
- }
- if ($this->_15) {
- if (count($this->_98) > round(0)) {
- $_100.= "<!-- Not replaced: " . "
- ";
- foreach($this->_98 as $_55 => $_121) {
- $_100.= $_121 . "
- ";
- }
- $_100.= "-->";
- }
- $_100.= $_101;
- }
- return $_100;
- }
- function replace_in_page(&$_122)
- {
- if (count($this->_98) > round(0)) {
- $_123 = preg_split("/(?smi)(<\/?sape_index>)/" , $_122, -round(0 + 1));
- $_124 = count($_123);
- if ($_124 > round(0 + 0.25 + 0.25 + 0.25 + 0.25)) {
- if ($_124 >= round(0 + 1.5 + 1.5)) {
- for ($_45 = round(0 + 1); $_45 < $_124; $_45 = $_45 + round(0 + 2)) {
- $_123[$_45] = $this->replace_in_text_segment($_123[$_45]);
- }
- }
- $_122 = implode("" , $_123);
- if ($this->_15) {
- $_122.= "<!-- Split by Sape_index cnt_parts=" . $_124 . "-->";
- }
- }
- else {
- $_123 = preg_split("/(?smi)(<\/?body[^>]*>)/" , $_122, -round(0 + 0.25 + 0.25 + 0.25 + 0.25) , 2);
- if (count($_123) == round(0 + 1 + 1 + 1 + 1 + 1)) {
- $_123[round(0) ] = $_123[round(0) ] . $_123[round(0 + 0.5 + 0.5) ];
- $_123[round(0 + 0.33333333333333 + 0.33333333333333 + 0.33333333333333) ] = $this->replace_in_text_segment($_123[round(0 + 0.4 + 0.4 + 0.4 + 0.4 + 0.4) ]);
- $_123[round(0 + 1 + 1) ] = $_123[round(0 + 3) ] . $_123[round(0 + 1.3333333333333 + 1.3333333333333 + 1.3333333333333) ];
- unset($_123[round(0 + 0.6 + 0.6 + 0.6 + 0.6 + 0.6) ]);
- unset($_123[round(0 + 0.8 + 0.8 + 0.8 + 0.8 + 0.8) ]);
- $_122 = $_123[round(0) ] . $_123[round(0 + 0.33333333333333 + 0.33333333333333 + 0.33333333333333) ] . $_123[round(0 + 0.5 + 0.5 + 0.5 + 0.5) ];
- if ($this->_15) {
- $_122.= "<!-- Split by BODY -->";
- }
- }
- else {
- if ($this->_15) {
- $_122.= "<!-- Can`t split by BODY -->";
- }
- }
- }
- }
- else {
- if (!$this->_14 && !$this->_13 && !$this->_15) {
- $_122 = preg_replace("/(?smi)(<\/?sape_index>)/" , "" , $_122);
- }
- else {
- if (isset($this->_97["__trustlink_new_url__" ]) && strlen($this->_97["__trustlink_new_url__" ])) {
- $_122.= $this->_97["__trustlink_new_url__" ];
- }
- }
- if ($this->_15) {
- $_122.= "<!-- No word`s for page -->";
- }
- }
- return $_122;
- }
- function _get_db_file()
- {
- if ($this->_10) {
- return dirname(__FILE__) . "/" . $this->_8 . ".words.db";
- }
- else {
- return dirname(__FILE__) . "/words.db";
- }
- }
- function _get_dispenser_path()
- {
- return "/code_context.php?user=" . _TRUSTLINK_USER . "&host=" . $this->_8;
- }
- function set_data($_34)
- {
- $this->_97 = $_34;
- if (@array_key_exists($this->_9, $this->_97) && is_array($this->_97[$this->_9])) {
- $this->_98 = $this->_97[$this->_9];
- }
- }
- }
- class TRUSTLINK_articles extends TRUSTLINK_base
- {
- var $_125;
- var $_4 = array(
- 'dispenser.amursk-rayon.ru'
- );
- var $_126 = array();
- var $_127;
- var $_128;
- var $_129 = '';
- var $_130;
- var $_131 = false;
- var $_132 = '<!--sape_noindex-->';
- var $_133 = false;
- var $_134;
- var $_135;
- var $_31 = 'TRUSTLINK_Articles_Client PHP';
- function TRUSTLINK_articles($_22 = null)
- {
- parent::TRUSTLINK_base($_22);
- if (is_array($_22) && isset($_22["headers_enabled" ])) {
- $this->_133 = $_22["headers_enabled" ];
- }
- if (isset($_22["charset" ]) && strlen($_22["charset" ])) {
- $this->_2 = $_22["charset" ];
- }
- else {
- $this->_2 = "";
- }
- $this->_get_index();
- if (!empty($this->_126["index" ]["announcements_delimiter" ])) {
- $this->_129 = $this->_126["index" ]["announcements_delimiter" ];
- }
- if (!empty($this->_126["index" ]["charset" ]) and !(isset($_22["charset" ]) && strlen($_22["charset" ]))) {
- $this->_2 = $this->_126["index" ]["charset" ];
- }
- if (is_array($_22)) {
- if (isset($_22["host" ])) {
- $_23 = $_22["host" ];
- }
- }
- elseif (strlen($_22)) {
- $_23 = $_22;
- $_22 = array();
- }
- if (isset($_23) && strlen($_23)) {
- $this->_135 = $_23;
- }
- else {
- $this->_135 = $_SERVER["HTTP_HOST" ];
- }
- if (!isset($this->_126["index" ]["announcements" ][$this->_9])) {
- $this->_correct_uri();
- }
- }
- function _correct_uri()
- {
- if (substr($this->_9, -round(0 + 0.5 + 0.5)) == "/") {
- $_136 = substr($this->_9, round(0) , -round(0 + 1));
- }
- else {
- $_136 = $this->_9 . "/";
- }
- if (isset($this->_126["index" ]["announcements" ][$_136])) {
- $this->_9 = $_136;
- }
- }
- function return_announcements($_55 = null, $_56 = 0)
- {
- $_137 = "";
- if ($this->_13 || $this->_14) {
- if (isset($this->_126["index" ]["checkCode" ])) {
- $_137.= $this->_126["index" ]["checkCode" ];
- }
- }
- if (isset($this->_126["index" ]["announcements" ][$this->_9])) {
- $_61 = count($this->_126["index" ]["announcements" ][$this->_9]);
- if (!is_numeric($_55) || $_55 > $_61) {
- $_55 = $_61;
- }
- $_67 = array();
- for ($_45 = round(0 + 0.5 + 0.5); $_45 <= $_55; $_45++) {
- if ($_56 > round(0) && $_45 <= $_56) {
- array_shift($this->_126["index" ]["announcements" ][$this->_9]);
- }
- else {
- $_67[] = array_shift($this->_126["index" ]["announcements" ][$this->_9]);
- }
- }
- $_53 = join($this->_129, $_67);
- if ($this->_14) {
- $_53 = "<sape_noindex>" . $_53 . "</sape_noindex>";
- }
- $_137.= $_53;
- }
- return $_137;
- }
- function _get_index()
- {
- $this->_set_request_mode("index");
- $this->_128 = "articles.db";
- $this->load_data();
- }
- function process_request()
- {
- if (!empty($this->_126["index" ]) and isset($this->_126["index" ]["articles" ][$this->_9])) {
- return $this->_return_article();
- }
- elseif (!empty($this->_126["index" ]) and isset($this->_126["index" ]["images" ][$this->_9])) {
- return $this->_return_image();
- }
- else {
- if ($this->_14) {
- return $this->_return_html($this->_126["index" ]["checkCode" ] . $this->_132);
- }
- else {
- return $this->_return_not_found();
- }
- }
- }
- function _return_article()
- {
- $this->_set_request_mode("article");
- $_138 = $this->_126["index" ]["articles" ][$this->_9];
- $this->_128 = $_138["id" ] . ".article.db";
- $this->_127 = $_138["id" ];
- $this->load_data();
- if (!isset($this->_126["article" ]["date_updated" ]) OR $this->_126["article" ]["date_updated" ] < $_138["date_updated" ]) {
- unlink($this->_get_db_file());
- $this->load_data();
- }
- $_139 = $this->_get_template($this->_126["index" ]["templates" ][$_138["template_id" ]]["url" ], $_138["template_id" ]);
- $_140 = $this->_fetch_article($_139);
- if ($this->_14) {
- $_140.= $this->_132;
- }
- return $this->_return_html($_140);
- }
- function _prepare_path_to_images()
- {
- $this->_130 = dirname(__FILE__) . "/images/";
- if (!is_dir($this->_130)) {
- if (@mkdir($this->_130)) {
- @chmod($this->_130, round(0 + 255.5 + 255.5));
- }
- else {
- return $this->raise_error("Нет папки " . $this->_130 . ". Создать не удалось. Выставите права 777 на папку.");
- }
- }
- if ($this->_10) {
- $this->_130.= $this->_8 . ".";
- }
- }
- function _return_image()
- {
- $this->_set_request_mode("image");
- $this->_prepare_path_to_images();
- $_141 = $this->_126["index" ]["images" ][$this->_9];
- $_142 = $this->_130 . $_141["id" ] . "." . $_141["ext" ];
- if (!is_file($_142) or filemtime($_142) > $_141["date_updated" ]) {
- @touch($_142, $_141["date_updated" ]);
- $_28 = $_141["dispenser_path" ];
- foreach($this->_4 as $_45 => $_46) {
- if ($_34 = $this->fetch_remote_file($_46, $_28)) {
- if (substr($_34, round(0) , round(0 + 3 + 3 + 3 + 3)) == "FATAL ERROR:") {
- $this->raise_error($_34);
- }
- else {
- if (strlen($_34) > round(0)) {
- $this->_write($_142, $_34);
- break;
- }
- }
- }
- }
- }
- unset($_34);
- if (!is_file($_142)) {
- return $this->_return_not_found();
- }
- $_143 = @getimagesize($_142);
- $_144 = isset($_143["mime" ]) ? $_143["mime" ] : "image";
- if ($this->_133) {
- header("Content-Type: " . $_144);
- }
- return $this->_read($_142);
- }
- function _fetch_article($_139)
- {
- if (strlen($this->_2)) {
- $_139 = str_replace("{meta_charset}" , $this->_2, $_139);
- }
- foreach($this->_126["index" ]["template_fields" ] as $_145) {
- if (isset($this->_126["article" ][$_145])) {
- $_139 = str_replace("{" . $_145 . "}" , $this->_126["article" ][$_145], $_139);
- }
- else {
- $_139 = str_replace("{" . $_145 . "}" , "" , $_139);
- }
- }
- return ($_139);
- }
- function _get_template($_146, $_147)
- {
- $this->_128 = "tpl.articles.db";
- $_148 = $this->_get_db_file();
- if (file_exists($_148)) {
- $this->_126["templates" ] = unserialize($this->_read($_148));
- }
- if (!isset($this->_126["templates" ][$_146]) or (time() - $this->_126["templates" ][$_146]["date_updated" ]) > $this->_126["index" ]["templates" ][$_147]["lifetime" ]) {
- $this->_refresh_template($_146, $_148);
- }
- if (!isset($this->_126["templates" ][$_146])) {
- if ($this->_131) {
- return $this->raise_error($this->_131);
- }
- return $this->raise_error("Не найден шаблон для статьи");
- }
- return $this->_126["templates" ][$_146]["body" ];
- }
- function _refresh_template($_146, $_148)
- {
- $_149 = parse_url($_146);
- $_150 = "";
- if ($_149["path" ]) {
- $_150.= $_149["path" ];
- }
- if (isset($_149["query" ])) {
- $_150.= "?" . $_149["query" ];
- }
- $_151 = $this->fetch_remote_file($this->_135, $_150, true);
- if (!$this->_is_valid_template($_151)) {
- return false;
- }
- $_151 = $this->_cut_template_links($_151);
- $this->_126["templates" ][$_146] = array(
- "body" => $_151,
- "date_updated" => time()
- );
- $this->_write($_148, serialize($this->_126["templates" ]));
- }
- function _fill_mask($_34)
- {
- global $_152;
- $_153 = strlen($_34[round(0) ]);
- $_154 = str_repeat($this->_134, $_153);
- $_152[$this->_134][] = array(
- "mask" => $_154,
- "code" => $_34[round(0) ],
- "len" => $_153
- );
- return $_154;
- }
- function _cut_unnecessary(&$_155, $_156, $_154)
- {
- global $_152;
- $this->_134 = $_156;
- $_157[$this->_134] = array();
- $_155 = preg_replace_callback($_154, array(
- $this,
- '_fill_mask'
- ) , $_155);
- }
- function _restore_unnecessary(&$_155, $_156)
- {
- global $_152;
- $_56 = round(0);
- if (!empty($_152[$_156])) {
- foreach($_152[$_156] as $_158) {
- $_56 = strpos($_155, $_158["mask" ], $_56);
- $_155 = substr($_155, round(0) , $_56) . $_158["code" ] . substr($_155, $_56 + $_158["len" ]);
- }
- }
- }
- function _cut_template_links($_151)
- {
- $_159 = "~(\<a [^\>]*?href[^\>]*?\=[\"']{0,1}http[^\>]*?\>.*?\</a[^\>]*?\>|\<a [^\>]*?href[^\>]*?\=[\"']{0,1}http[^\>]*?\>|\<area [^\>]*?href[^\>]*?\=[\"']{0,1}http[^\>]*?\>)~si";
- $_160 = "~\<a |\<area ~si";
- $_161 = "~[\s]{1}rel\=[\"']{1}[^ \"'\>]*?[\"']{1}| rel\=[^ \"'\>]*?[\s]{1}~si";
- $_162 = "~[\s]{1}href\=[\"']{0,1}(http[^ \"'\>]*)?[\"']{0,1} {0,1}~si";
- $_163 = $this->_126["index" ]["ext_links_allowed" ];
- $_163[] = $this->_8;
- $_163[] = "www." . $this->_8;
- $this->_cut_unnecessary($_151, "C" , "|<!--(.*?)-->|smi");
- $this->_cut_unnecessary($_151, "S" , "|<script[^>]*>.*?</script>|si");
- $this->_cut_unnecessary($_151, "N" , "|<noindex[^>]*>.*?</noindex>|si");
- $_164 = preg_split($_159, $_151, -round(0 + 0.33333333333333 + 0.33333333333333 + 0.33333333333333) , 2);
- if (is_array($_164)) {
- foreach($_164 as $_165 => $_79) {
- if ($_165 % round(0 + 0.5 + 0.5 + 0.5 + 0.5) == round(0)) {
- continue;
- }
- if (preg_match($_162, $_79, $_166)) {
- $_167 = @parse_url($_166[round(0 + 0.5 + 0.5) ]);
- $_23 = isset($_167["host" ]) ? $_167["host" ] : false;
- if (!in_array($_23, $_163) || !$_23) {
- $_164[$_165] = "<noindex>" . $_164[$_165] . "</noindex>";
- }
- }
- }
- $_151 = implode("" , $_164);
- }
- $this->_restore_unnecessary($_151, "N");
- $_164 = preg_split($_159, $_151, -round(0 + 0.2 + 0.2 + 0.2 + 0.2 + 0.2) , 2);
- if (is_array($_164)) {
- foreach($_164 as $_165 => $_79) {
- if ($_165 % round(0 + 2) == round(0)) {
- continue;
- }
- if (preg_match($_162, $_79, $_166)) {
- $_167 = @parse_url($_166[round(0 + 0.5 + 0.5) ]);
- $_23 = isset($_167["host" ]) ? $_167["host" ] : false;
- if (!in_array($_23, $_163) || !$_23) {
- $_164[$_165] = preg_replace($_161, "" , $_79);
- $_164[$_165] = preg_replace($_160, "$0rel="nofollow" " , $_164[$_165]);
- }
- }
- }
- $_151 = implode("" , $_164);
- }
- $this->_restore_unnecessary($_151, "S");
- $this->_restore_unnecessary($_151, "C");
- return $_151;
- }
- function _is_valid_template($_151)
- {
- foreach($this->_126["index" ]["template_required_fields" ] as $_145) {
- if (strpos($_151, "{" . $_145 . "}") === false) {
- $this->_131 = "В шаблоне не хватает поля " . $_145 . ".";
- return false;
- }
- }
- return true;
- }
- function _return_html($_53)
- {
- if ($this->_133) {
- header("HTTP/1.x 200 OK");
- if (!empty($this->_2)) {
- header("Content-Type: text/html; charset=" . $this->_2);
- }
- }
- return $_53;
- }
- function _return_not_found()
- {
- header("HTTP/1.x 404 Not Found");
- }
- function _get_dispenser_path()
- {
- switch ($this->_125) {
- case "index":
- return "/?user=" . _TRUSTLINK_USER . "&host=" . $this->_8 . "&rtype=" . $this->_125;
- break;
- case "article":
- return "/?user=" . _TRUSTLINK_USER . "&host=" . $this->_8 . "&rtype=" . $this->_125 . "&artid=" . $this->_127;
- break;
- case "image":
- return $this->_168;
- break;
- }
- }
- function _set_request_mode($_169)
- {
- $this->_125 = $_169;
- }
- function _get_db_file()
- {
- if ($this->_10) {
- return dirname(__FILE__) . "/" . $this->_8 . "." . $this->_128;
- }
- else {
- return dirname(__FILE__) . "/" . $this->_128;
- }
- }
- function set_data($_34)
- {
- $this->_126[$this->_125] = $_34;
- }
- }
Add Comment
Please, Sign In to add comment