| Textpattern | PHP Cross Reference | Content Management Systems |
1 <?php 2 3 /* 4 This is Textpattern 5 6 Copyright 2005 by Dean Allen 7 www.textpattern.com 8 All rights reserved 9 10 Use of this software indicates acceptance of the Textpattern license agreement 11 12 $HeadURL: https://textpattern.googlecode.com/svn/releases/4.5.4/source/textpattern/include/txp_diag.php $ 13 $LastChangedRevision: 4192 $ 14 15 */ 16 17 if (!defined('txpinterface')) die('txpinterface is undefined.'); 18 19 //------------------------------------------------------------- 20 21 define("cs",': '); 22 define("ln",str_repeat('-', 24).n); 23 24 global $files; 25 26 $files = array( 27 '/../index.php', 28 '/../css.php', 29 '/css.php', 30 '/include/import/import_b2.php', 31 '/include/import/import_blogger.php', 32 '/include/import/import_mt.php', 33 '/include/import/import_mtdb.php', 34 '/include/import/import_wp.php', 35 '/include/txp_admin.php', 36 '/include/txp_article.php', 37 '/include/txp_auth.php', 38 '/include/txp_category.php', 39 '/include/txp_css.php', 40 '/include/txp_diag.php', 41 '/include/txp_discuss.php', 42 '/include/txp_file.php', 43 '/include/txp_form.php', 44 '/include/txp_image.php', 45 '/include/txp_import.php', 46 '/include/txp_link.php', 47 '/include/txp_list.php', 48 '/include/txp_log.php', 49 '/include/txp_page.php', 50 '/include/txp_plugin.php', 51 '/include/txp_prefs.php', 52 '/include/txp_section.php', 53 '/include/txp_tag.php', 54 '/index.php', 55 '/jquery.js', 56 '/lib/IXRClass.php', 57 '/lib/admin_config.php', 58 '/lib/class.thumb.php', 59 '/lib/classTextile.php', 60 '/lib/constants.php', 61 '/lib/taglib.php', 62 '/lib/txplib_admin.php', 63 '/lib/txplib_db.php', 64 '/lib/txplib_forms.php', 65 '/lib/txplib_head.php', 66 '/lib/txplib_html.php', 67 '/lib/txplib_misc.php', 68 '/lib/txplib_publish.php', 69 '/lib/txplib_theme.php', 70 '/lib/txplib_update.php', 71 '/lib/txplib_validator.php', 72 '/lib/txplib_wrapper.php', 73 '/publish.php', 74 '/publish/atom.php', 75 '/publish/comment.php', 76 '/publish/log.php', 77 '/publish/rss.php', 78 '/publish/search.php', 79 '/publish/taghandlers.php', 80 '/textpattern.js', 81 '/theme/classic/classic.php', 82 '/update/_to_1.0.0.php', 83 '/update/_to_4.0.2.php', 84 '/update/_to_4.0.3.php', 85 '/update/_to_4.0.4.php', 86 '/update/_to_4.0.5.php', 87 '/update/_to_4.0.6.php', 88 '/update/_to_4.0.7.php', 89 '/update/_to_4.0.8.php', 90 '/update/_to_4.2.0.php', 91 '/update/_to_4.3.0.php', 92 '/update/_to_4.4.0.php', 93 '/update/_to_4.4.1.php', 94 '/update/_to_4.5.0.php', 95 '/update/_update.php' 96 ); 97 98 $files_rpc = array( 99 '/../rpc/index.php', 100 '/../rpc/TXP_RPCServer.php', 101 ); 102 103 if ($prefs['enable_xmlrpc_server']) $files = array_merge($files, $files_rpc); 104 105 if ($event == 'diag') { 106 require_privs('diag'); 107 108 $step = gps('step'); 109 doDiagnostics(); 110 } 111 112 function apache_module($m) { 113 $modules = @apache_get_modules(); 114 if (is_array($modules)) { 115 return in_array($m, $modules); 116 } 117 } 118 119 function test_tempdir($dir) { 120 $f = realpath(tempnam($dir, 'txp_')); 121 if (is_file($f)) { 122 @unlink($f); 123 return true; 124 } 125 } 126 127 function list_txp_tables() { 128 $table_names = array(PFX.'textpattern'); 129 $rows = getRows("SHOW TABLES LIKE '".PFX."txp\_%'"); 130 foreach ($rows as $row) 131 $table_names[] = array_shift($row); 132 return $table_names; 133 } 134 135 function check_tables($tables, $type='FAST', $warnings=0) { 136 $msgs = array(); 137 foreach ($tables as $table) { 138 $rs = getRows("CHECK TABLE `$table` $type"); 139 if ($rs) { 140 foreach ($rs as $r) 141 if ($r['Msg_type'] != 'status' and ($warnings or $r['Msg_type'] != 'warning')) 142 $msgs[] = $table.cs.$r['Msg_type'].cs.$r['Msg_text']; 143 } 144 } 145 return $msgs; 146 } 147 148 function diag_msg_wrap($msg, $type='error') 149 { 150 return '<span class="'.$type.'">'.$msg.'</span>'; 151 } 152 153 function doDiagnostics() 154 { 155 global $prefs, $files, $txpcfg, $event, $step, $theme; 156 extract(get_prefs()); 157 158 $urlparts = parse_url(hu); 159 $mydomain = $urlparts['host']; 160 $server_software = (@$_SERVER['SERVER_SOFTWARE'] || @$_SERVER['HTTP_HOST']) 161 ? ( (@$_SERVER['SERVER_SOFTWARE']) ? @$_SERVER['SERVER_SOFTWARE'] : $_SERVER['HTTP_HOST'] ) 162 : ''; 163 $is_apache = ($server_software and stristr($server_software, 'Apache')) 164 or (is_callable('apache_get_version')); 165 $real_doc_root = (isset($_SERVER['DOCUMENT_ROOT'])) ? realpath($_SERVER['DOCUMENT_ROOT']) : ''; 166 167 // ini_get() returns string values passed via php_value as a string, not boolean 168 $is_register_globals = ( (strcasecmp(ini_get('register_globals'),'on')===0) or (ini_get('register_globals')==='1')); 169 170 // Check for Textpattern updates, at most once every 24 hours 171 $now = time(); 172 $updateInfo = unserialize(get_pref('last_update_check', '')); 173 174 if (!$updateInfo || ( $now > ($updateInfo['when'] + (60*60*24)) )) 175 { 176 $updates = checkUpdates(); 177 $updateInfo['msg'] = ($updates) ? gTxt($updates['msg'], array('{version}' => $updates['version'])) : ''; 178 $updateInfo['when'] = $now; 179 set_pref('last_update_check', serialize($updateInfo), 'publish', PREF_HIDDEN, 'text_input'); 180 } 181 182 $fail = array( 183 184 'textpattern_version_update' => ($updateInfo['msg'] ? diag_msg_wrap($updateInfo['msg'], 'information') : ''), 185 186 'php_version_required' => 187 (!is_callable('version_compare') or version_compare(PHP_VERSION, REQUIRED_PHP_VERSION, '<')) 188 ? diag_msg_wrap(gTxt('php_version_required', array('{version}' => REQUIRED_PHP_VERSION))) 189 : '', 190 191 'path_to_site_missing' => 192 (!isset($path_to_site)) 193 ? diag_msg_wrap(gTxt('path_to_site_missing'), 'warning') 194 : '', 195 196 'dns_lookup_fails' => 197 (@gethostbyname($mydomain) == $mydomain) 198 ? diag_msg_wrap(gTxt('dns_lookup_fails').cs.$mydomain, 'warning') 199 : '', 200 201 'path_to_site_inacc' => 202 (!@is_dir($path_to_site)) 203 ? diag_msg_wrap(gTxt('path_to_site_inacc').cs.$path_to_site) 204 : '', 205 206 'site_trailing_slash' => 207 (rtrim($siteurl, '/') != $siteurl) 208 ? diag_msg_wrap(gTxt('site_trailing_slash').cs.$path_to_site, 'warning') 209 : '', 210 211 'index_inaccessible' => 212 (!@is_file($path_to_site."/index.php") or !@is_readable($path_to_site."/index.php")) 213 ? diag_msg_wrap("{$path_to_site}/index.php ".gTxt('is_inaccessible')) 214 : '', 215 216 'dir_not_writable' => 217 trim( 218 ((!@is_writable($path_to_site.'/'.$img_dir)) 219 ? diag_msg_wrap(str_replace('{dirtype}', gTxt('img_dir'), gTxt('dir_not_writable')).": {$path_to_site}/{$img_dir}", 'warning').n 220 : ''). 221 ((!@is_writable($file_base_path)) 222 ? diag_msg_wrap(str_replace('{dirtype}', gTxt('file_base_path'), gTxt('dir_not_writable')).": {$file_base_path}", 'warning').n 223 : ''). 224 ((!@is_writable($tempdir)) 225 ? diag_msg_wrap(str_replace('{dirtype}', gTxt('tempdir'), gTxt('dir_not_writable')).": {$tempdir}", 'warning').n 226 : '')), 227 228 'cleanurl_only_apache' => 229 ($permlink_mode != 'messy' and !$is_apache ) 230 ? diag_msg_wrap(gTxt('cleanurl_only_apache'), 'information') 231 : '', 232 233 'htaccess_missing' => 234 ($permlink_mode != 'messy' and !@is_readable($path_to_site.'/.htaccess')) 235 ? diag_msg_wrap(gTxt('htaccess_missing')) 236 : '', 237 238 'mod_rewrite_missing' => 239 ($permlink_mode != 'messy' and is_callable('apache_get_modules') and !apache_module('mod_rewrite')) 240 ? diag_msg_wrap(gTxt('mod_rewrite_missing')) 241 : '', 242 243 'file_uploads_disabled' => 244 (!ini_get('file_uploads')) 245 ? diag_msg_wrap(gTxt('file_uploads_disabled'), 'information') 246 : '', 247 248 'setup_still_exists' => 249 (@is_dir(txpath . DS. 'setup')) 250 ? diag_msg_wrap(txpath.DS."setup".DS.' '.gTxt('still_exists'), 'warning') 251 : '', 252 253 'no_temp_dir' => 254 (empty($tempdir)) 255 ? diag_msg_wrap(gTxt('no_temp_dir'), 'warning') 256 : '', 257 258 'warn_mail_unavailable' => 259 (is_disabled('mail')) 260 ? diag_msg_wrap(gTxt('warn_mail_unavailable'), 'warning') 261 : '', 262 263 'warn_register_globals_or_update' => 264 ( $is_register_globals && 265 ( version_compare(phpversion(),'4.4.0','<=') 266 or ( version_compare(phpversion(),'5.0.0','>=') and version_compare(phpversion(),'5.0.5','<=') ) 267 )) 268 ? diag_msg_wrap(gTxt('warn_register_globals_or_update'), 'warning') 269 : '', 270 271 ); 272 273 if ($permlink_mode != 'messy') { 274 $rs = safe_column("name","txp_section", "1"); 275 foreach ($rs as $name) { 276 if ($name and @file_exists($path_to_site.'/'.$name)) 277 $fail['old_placeholder_exists'] = diag_msg_wrap(gTxt('old_placeholder').": {$path_to_site}/{$name}"); 278 } 279 } 280 281 $missing = array(); 282 283 foreach ($files as $f) 284 { 285 $realpath = realpath(txpath . $f); 286 287 if (is_readable($realpath)) 288 { 289 $found[] = $realpath; 290 } 291 else 292 { 293 $missing[] = txpath . $f; 294 } 295 } 296 297 $files = $found; 298 unset($found); 299 300 if ($missing) 301 $fail['missing_files'] = diag_msg_wrap(gTxt('missing_files').cs.n.t.join(', '.n.t, $missing)); 302 303 foreach ($fail as $k=>$v) 304 if (empty($v)) unset($fail[$k]); 305 306 # Find the highest revision number 307 $file_revs = $file_md5 = array(); 308 $rev = 0; 309 310 foreach ($files as $f) 311 { 312 $content = @file_get_contents($f); 313 314 if ($content !== FALSE) 315 { 316 if (preg_match('/^\$'.'LastChangedRevision: (\d+) \$/m', $content, $match)) 317 { 318 $file_revs[$f] = $match[1]; 319 320 if ($match[1] > $rev) 321 { 322 $rev = $match[1]; 323 } 324 } 325 326 $file_md5[$f] = md5(str_replace('$'.'HeadURL: http:', '$'.'HeadURL: https:', str_replace("\r\n", "\n", $content))); 327 } 328 } 329 330 # Check revs & md5 against stable release, if possible 331 $dev_files = $old_files = $modified_files = array(); 332 333 if ($cs = @file(txpath . '/checksums.txt')) 334 { 335 foreach ($cs as $c) 336 { 337 if (preg_match('@^(\S+): r?(\S+) \((.*)\)$@', trim($c), $m)) 338 { 339 list(,$file,$r,$md5) = $m; 340 $file = realpath(txpath . $file); 341 342 if (!empty($file_revs[$file]) and $r and $file_revs[$file] < $r) 343 { 344 $old_files[] = $file; 345 } 346 elseif (!empty($file_revs[$file]) and $r and $file_revs[$file] > $r) 347 { 348 $dev_files[] = $file; 349 } 350 elseif (!empty($file_md5[$file]) and $file_md5[$file] != $md5) 351 { 352 $modified_files[] = $file; 353 } 354 } 355 } 356 } 357 358 # files that haven't been updated 359 if ($old_files) 360 $fail['old_files'] = diag_msg_wrap(gTxt('old_files').cs.n.t.join(', '.n.t, $old_files)); 361 362 # files that don't match their checksums 363 if ($modified_files) 364 $fail['modified_files'] = diag_msg_wrap(gTxt('modified_files').cs.n.t.join(', '.n.t, $modified_files), 'warning'); 365 366 # running development code in live mode is not recommended 367 if ($dev_files and $production_status == 'live') 368 $fail['dev_version_live'] = diag_msg_wrap(gTxt('dev_version_live').cs.n.t.join(', '.n.t, $dev_files), 'warning'); 369 370 # anything might break if arbitrary functions are disabled 371 if (ini_get('disable_functions')) { 372 $disabled_funcs = array_map('trim', explode(',', ini_get('disable_functions'))); 373 # commonly disabled functions that we don't need 374 $disabled_funcs = array_diff($disabled_funcs, array( 375 'imagefilltoborder', 376 'exec', 377 'system', 378 'dl', 379 'passthru', 380 'chown', 381 'shell_exec', 382 'popen', 383 'proc_open', 384 )); 385 if ($disabled_funcs) 386 $fail['some_php_functions_disabled'] = diag_msg_wrap(gTxt('some_php_functions_disabled').cs.join(', ',$disabled_funcs), 'warning'); 387 } 388 389 # not sure about this one 390 #if (strncmp(php_sapi_name(), 'cgi', 3) == 0 and ini_get('cgi.rfc2616_headers')) 391 # $fail['cgi_header_config'] = gTxt('cgi_header_config'); 392 393 $guess_site_url = $_SERVER['HTTP_HOST'] . preg_replace('#[/\\\\]$#','',dirname(dirname($_SERVER['SCRIPT_NAME']))); 394 if ($siteurl and strip_prefix($siteurl, 'www.') != strip_prefix($guess_site_url, 'www.')) 395 $fail['site_url_mismatch'] = diag_msg_wrap(gTxt('site_url_mismatch').cs.$guess_site_url, 'warning'); 396 397 # test clean URL server vars 398 if (hu) { 399 if (ini_get('allow_url_fopen') and ($permlink_mode != 'messy')) { 400 $s = md5(uniqid(rand(), true)); 401 ini_set('default_socket_timeout', 10); 402 $pretext_data = @file(hu.$s.'/?txpcleantest=1'); 403 if ($pretext_data) { 404 $pretext_req = trim(@$pretext_data[0]); 405 if ($pretext_req != md5('/'.$s.'/?txpcleantest=1')) 406 $fail['clean_url_data_failed'] = diag_msg_wrap(gTxt('clean_url_data_failed').cs.txpspecialchars($pretext_req), 'warning'); 407 } 408 else 409 $fail['clean_url_test_failed'] = diag_msg_wrap(gTxt('clean_url_test_failed'), 'warning'); 410 } 411 } 412 413 if ($tables = list_txp_tables()) { 414 $table_errors = check_tables($tables); 415 if ($table_errors) 416 $fail['mysql_table_errors'] = diag_msg_wrap(gTxt('mysql_table_errors').cs.n.t.join(', '.n.t, $table_errors)); 417 } 418 419 $active_plugins = array(); 420 if ($rows = safe_rows('name, version, code_md5, md5(code) as md5', 'txp_plugin', 'status > 0')) { 421 foreach ($rows as $row) { 422 $n = $row['name'].'-'.$row['version']; 423 if (strtolower($row['md5']) != strtolower($row['code_md5'])) 424 $n .= 'm'; 425 $active_plugins[] = $n; 426 } 427 } 428 429 $theme_manifest = $theme->manifest(); 430 431 // check GD info 432 if (function_exists('gd_info')) { 433 $gd_info = gd_info(); 434 435 $gd_support = array(); 436 437 if ($gd_info['GIF Create Support']) { 438 $gd_support[] = 'GIF'; 439 } 440 441 // Aside: In PHP 5.3, they chose to add a previously unemployed capital "E" to the array key. 442 if (!empty($gd_info['JPEG Support']) || !empty($gd_info['JPG Support'])) { 443 $gd_support[] = 'JPG'; 444 } 445 446 if ($gd_info['PNG Support']) { 447 $gd_support[] = 'PNG'; 448 } 449 450 if ($gd_support) { 451 $gd_support = join(', ', $gd_support); 452 } else { 453 $gd_support = gTxt('none'); 454 } 455 456 $gd = gTxt('gd_info', array( 457 '{version}' => $gd_info['GD Version'], 458 '{supported}' => $gd_support 459 )); 460 } else { 461 $gd = gTxt('gd_unavailable'); 462 } 463 464 if ( realpath($prefs['tempdir']) == realpath($prefs['plugin_cache_dir']) ) 465 { 466 $fail['tmp_plugin_paths_match'] = diag_msg_wrap(gTxt('tmp_plugin_paths_match')); 467 } 468 469 echo 470 pagetop(gTxt('tab_diagnostics'),''), 471 '<h1 class="txp-heading">'.gTxt('tab_diagnostics').'</h1>', 472 '<div id="'.$event.'_container" class="txp-container">', 473 '<div id="pre_flight_check">', 474 hed(gTxt('preflight_check'),2); 475 476 if ($fail) { 477 foreach ($fail as $help => $message) 478 echo graf(nl2br($message).sp.popHelp($help)); 479 } 480 else { 481 echo graf(diag_msg_wrap(gTxt('all_checks_passed'), 'success')); 482 } 483 echo '</div>'; 484 485 echo '<div id="diagnostics">', 486 hed(gTxt('diagnostic_info'),2); 487 488 $fmt_date = '%Y-%m-%d %H:%M:%S'; 489 490 $out = array( 491 '<p><textarea id="diagnostics-detail" cols="'.INPUT_LARGE.'" rows="'.INPUT_MEDIUM.'" readonly="readonly">', 492 493 gTxt('txp_version').cs.txp_version.' ('.($rev ? 'r'.$rev : 'unknown revision').')'.n, 494 495 gTxt('last_update').cs.gmstrftime($fmt_date, $dbupdatetime).'/'.gmstrftime($fmt_date, @filemtime(txpath.'/update/_update.php')).n, 496 497 gTxt('document_root').cs.@$_SERVER['DOCUMENT_ROOT']. (($real_doc_root != @$_SERVER['DOCUMENT_ROOT']) ? ' ('.$real_doc_root.')' : '') .n, 498 499 '$path_to_site'.cs.$path_to_site.n, 500 501 gTxt('txp_path').cs.txpath.n, 502 503 gTxt('permlink_mode').cs.$permlink_mode.n, 504 505 (ini_get('open_basedir')) ? 'open_basedir: '.ini_get('open_basedir').n : '', 506 507 (ini_get('upload_tmp_dir')) ? 'upload_tmp_dir: '.ini_get('upload_tmp_dir').n : '', 508 509 gTxt('tempdir').cs.$tempdir.n, 510 511 gTxt('web_domain').cs.$siteurl.n, 512 513 gTxt('php_version').cs.phpversion().n, 514 515 ($is_register_globals) ? gTxt('register_globals').cs.$is_register_globals.n : '', 516 517 gTxt('gd_library').cs.$gd.n, 518 519 gTxt('server').' TZ: '.(timezone::is_supported() ? @date_default_timezone_get() : ((getenv('TZ')) ? getenv('TZ') : '-')).n, 520 gTxt('server_time').cs.strftime('%Y-%m-%d %H:%M:%S').n, 521 strip_tags(gTxt('is_dst')).cs.$is_dst.n, 522 strip_tags(gTxt('auto_dst')).cs.$auto_dst.n, 523 strip_tags(gTxt('gmtoffset')).cs.$timezone_key.sp."($gmtoffset)".n, 524 525 'MySQL'.cs.mysql_get_server_info().n, 526 527 gTxt('locale').cs.$locale.n, 528 529 (isset($_SERVER['SERVER_SOFTWARE'])) ? gTxt('server').cs.$_SERVER['SERVER_SOFTWARE'].n : '', 530 531 (is_callable('apache_get_version')) ? gTxt('apache_version').cs.@apache_get_version().n : '', 532 533 gTxt('php_sapi_mode').cs.PHP_SAPI.n, 534 535 gTxt('rfc2616_headers').cs.ini_get('cgi.rfc2616_headers').n, 536 537 gTxt('os_version').cs.php_uname('s').' '.php_uname('r').n, 538 539 ($active_plugins ? gTxt('active_plugins').cs.join(', ', $active_plugins).n : ''), 540 541 gTxt('theme_name').cs.$theme_name.sp.$theme_manifest['version'].n, 542 543 $fail 544 ? n.gTxt('preflight_check').cs.n.ln.join("\n", doStripTags($fail)).n.ln 545 : '', 546 547 (is_readable($path_to_site.'/.htaccess')) 548 ? n.gTxt('htaccess_contents').cs.n.ln.txpspecialchars(join('',file($path_to_site.'/.htaccess'))).n.ln 549 : '' 550 ); 551 552 if ($step == 'high') { 553 $mysql_client_encoding = (is_callable('mysql_client_encoding')) ? mysql_client_encoding() : '-'; 554 $out[] = n.'Charset (default/config)'.cs.$mysql_client_encoding.'/'.@$txpcfg['dbcharset'].n; 555 556 $result = safe_query("SHOW variables like 'character_se%'"); 557 while ($row = mysql_fetch_row($result)) 558 { 559 $out[] = $row[0].cs.$row[1].n; 560 if ($row[0] == 'character_set_connection') $conn_char = $row[1]; 561 } 562 563 $table_names = array(PFX.'textpattern'); 564 $result = safe_query("SHOW TABLES LIKE '".PFX."txp\_%'"); 565 while ($row = mysql_fetch_row($result)) 566 { 567 $table_names[] = $row[0]; 568 } 569 $table_msg = array(); 570 foreach ($table_names as $table) 571 { 572 $ctr = safe_query("SHOW CREATE TABLE ". $table.""); 573 if (!$ctr) 574 { 575 unset($table_names[$table]); 576 continue; 577 } 578 $ctcharset = preg_replace('#^CREATE TABLE.*SET=([^ ]+)[^)]*$#is','\\1',mysql_result($ctr,0,'Create Table')); 579 if (isset($conn_char) && !stristr($ctcharset,'CREATE') && ($conn_char != $ctcharset)) 580 $table_msg[] = "$table is $ctcharset"; 581 $ctr = safe_query("CHECK TABLE ". $table); 582 if (in_array(mysql_result($ctr,0,'Msg_type'), array('error','warning')) ) 583 $table_msg[] = $table .cs. mysql_result($ctr,0,'Msg_Text'); 584 } 585 if ($table_msg == array()) 586 $table_msg = (count($table_names) < 17) ? array('-') : array('OK'); 587 $out[] = count($table_names).' Tables'.cs. implode(', ',$table_msg).n; 588 589 $cf = preg_grep('/^custom_\d+/', getThings('describe `'.PFX.'textpattern`')); 590 $out[] = n.get_pref('max_custom_fields', 10).sp.gTxt('custom').cs. 591 implode(', ', $cf).sp.'('.count($cf).')'.n; 592 593 $extns = get_loaded_extensions(); 594 $extv = array(); 595 foreach ($extns as $e) { 596 $extv[] = $e . (phpversion($e) ? '/' . phpversion($e) : ''); 597 } 598 $out[] = n.gTxt('php_extensions').cs.join(', ', $extv).n; 599 600 if (is_callable('apache_get_modules')) 601 $out[] = n.gTxt('apache_modules').cs.join(', ', apache_get_modules()).n; 602 603 if (@is_array($pretext_data) and count($pretext_data) > 1) { 604 $out[] = n.gTxt('pretext_data').cs.txpspecialchars(join('', array_slice($pretext_data, 1, 20))).n; 605 } 606 607 $out[] = n; 608 609 foreach ($files as $f) 610 { 611 $checksum = isset($file_md5[$f]) ? $file_md5[$f] : gTxt('unknown'); 612 $revision = isset($file_revs[$f]) ? 'r'.$file_revs[$f] : gTxt('unknown'); 613 614 $out[] = "$f" .cs.n.t. $revision .' ('.$checksum.')'.n; 615 } 616 $out[] = n.ln; 617 618 } 619 620 $out[] = callback_event('diag_results', $step).n; 621 $out[] = '</textarea></p>'; 622 623 $dets = array('low'=>gTxt('low'),'high'=>gTxt('high')); 624 625 $out[] = 626 form( 627 graf( 628 eInput('diag').n. 629 '<label>'.gTxt('detail').'</label>'.n. 630 selectInput('step', $dets, $step, 0, 1) 631 ) 632 ); 633 634 echo join('',$out), 635 '</div>', 636 '</div>'; 637 } 638 639 //------------------------------------------------------------- 640 // check for updates through xml-rpc 641 function checkUpdates() 642 { 643 require_once txpath.'/lib/IXRClass.php'; 644 $client = new IXR_Client('http://rpc.textpattern.com'); 645 $uid = safe_field('val','txp_prefs',"name='blog_uid'"); 646 if (!$client->query('tups.getTXPVersion',$uid)) 647 { 648 return array('version' => 0, 'msg' => 'problem_connecting_rpc_server'); 649 } 650 651 else 652 { 653 $out = array(); 654 $response = $client->getResponse(); 655 if (is_array($response)) 656 { 657 ksort($response); 658 $version = get_pref('version'); 659 660 // Go through each available branch (x.y), but only return the _highest_ version 661 foreach ($response as $key => $val) 662 { 663 if (version_compare($version, $val) < 0) 664 { 665 $out = array('version' => $val, 'msg' => 'textpattern_update_available'); 666 } 667 } 668 669 return $out; 670 } 671 } 672 } 673 674 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
title