GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — expack: · unpush/p2-php@9120f28

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • aas.php
  • conf
    • conf.inc.php
    • conf_user_def_ex.inc.php
  • css.php
  • css
    • iphone.css
    • iv2_iphone.css
    • limelight.css
    • menu_i.css
  • edit_conf_user.php
  • editpref.php
  • first_cont.php
  • httpcmd.php
  • ic2_fitimage.php
  • ic2_getinfo.php
  • info.php
  • iv2.php
  • js
    • basic.js
    • edit_conf_user.js
    • fitimage.js
    • gpopup.js
    • htmlpopup.js
    • ic2_iphone.js
    • ic2_popinfo.js
    • iphone.js
    • iv2.js
    • iv2_iphone.js
    • lightbox
      • lightbox_ic2ext.js
    • limelight.js
    • loadthumb.js
    • menu_i.js
    • respopup.js
    • respopup_iphone.js
    • sb_iphone.js
    • spm_iphone.js
  • lib
    • FavSetManager.php
    • P2Util.php
    • SettingTxt.php
    • ShowThreadK.php
    • ShowThreadPc.php
    • Thread.php
    • expack
      • ExpackLoader.php
      • ic2/templates
        • iv2.tpl.html
        • iv2a.tpl.html
        • iv2ip.tpl.html
        • iv2m.tpl.html
      • tgrep
        • view_x.inc.php
    • menu_iphone.inc.php
    • p2util.inc.php
    • post_form.inc.php
    • read_footer.inc.php
    • read_footer_k.inc.php
    • read_header.inc.php
    • read_header_k.inc.php
    • sb_footer_k.inc.php
    • sb_header.inc.php
    • sb_header_k.inc.php
    • sb_print.inc.php
    • sb_print_k.inc.php
    • setfav.inc.php
    • setfavita.inc.php
    • setpalace.inc.php
    • subject_new.inc.php
  • menu_i.php
  • post.php
  • read_copy_k.php
  • read_new.php
  • read_new_k.php
  • style
    • edit_conf_user_css.inc
    • editfavita_css.inc
    • editpref_css.inc
    • fitimage_css.inc
    • info_css.inc
    • iv2_css.inc
    • login2ch_css.inc
    • login_css.inc
    • login_first_css.inc
    • menu_css.inc
    • mona_css.inc
    • mystyle_css.php
    • post_css.inc
    • prvw_css.inc
    • read_css.inc
    • setting_css.inc
    • subject_css.inc
  • subject.php

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎aas.php‎

Copy file name to clipboardExpand all lines: aas.php
+59-78Lines changed: 59 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@
1313
* <ins>IPA モナーフォント 1.0.3 で動作確認、行間をチューニングしている。</ins>
1414
*
1515
* Dependencies:
16-
* - PHP Version: 4.2.0 or newer (rep2-expack requires 4.4.1 or newer)
16+
* - PHP Version: 4.2.0 or newer (rep2-expack requires 5.2.3 or newer)
1717
* - PHP Extension: gd (with FreeType 2)
1818
* - PHP Extension: mbstring
1919
* - PHP Extension: pcre
2020
*
2121
* TODO:
2222
* - ページ遷移と画像の部分拡大リンク付きHTML生成
23-
* - フォントサイズ決め打ちで描画して、あとから縮小する..かも?
2423
*
2524
* NOTICE:
2625
* PHP (or PHP GDモジュール) をコンパイルするときの configure のオプションに
@@ -197,7 +196,6 @@
197196
}
198197
$inline = false;
199198
$rotate = !empty($_POST['aas_rotate']);
200-
$bold = ($_conf['expack.aas.bold'] || !empty($_POST['aas_bold']));
201199
} else {
202200
$params = array('host' => 'string', 'bbs' => 'string', 'key' => 'int', 'resnum' => 'int');
203201
foreach ($params as $name => $type) {
@@ -211,7 +209,6 @@
211209
}
212210
$inline = !empty($_GET['inline']);
213211
$rotate = !empty($_GET['rotate']);
214-
$bold = ($_conf['expack.aas.bold'] || !empty($_GET['bold']));
215212
}
216213

217214
// レス読み込み
@@ -287,7 +284,7 @@
287284
$c = 0;
288285
foreach ($lines as $line) {
289286
if (strlen($line) > 0) {
290-
$b = imagettfbbox(12, 0, $font, $line);
287+
$b = imagettfbbox(16, 0, $font, $line);
291288
if (!$c) {
292289
$c = $b[2];
293290
$hint = $line;
@@ -301,82 +298,81 @@
301298
}
302299
}
303300

304-
// 画像サイズを決定
301+
// 画像サイズ等を決定
305302
if ($inline) {
306-
$default_width = $_conf['expack.aas.image_width_il'];
307-
$default_height = $_conf['expack.aas.image_height_il'];
308-
} elseif (!$_conf['ktai']) {
309-
$default_width = $_conf['expack.aas.image_width_pc'];
310-
$default_height = $_conf['expack.aas.image_height_pc'];
303+
$mode = 'inline';
304+
} elseif ($_conf['ktai']) {
305+
$mode = 'mobile';
311306
} else {
312-
$default_width = $_conf['expack.aas.image_width'];
313-
$default_height = $_conf['expack.aas.image_height'];
307+
$mode = 'default';
314308
}
309+
$image_type = $_conf["expack.aas.{$mode}.type"];
310+
$quality = $_conf["expack.aas.{$mode}.quality"];
311+
$width = $_conf["expack.aas.{$mode}.width"];
312+
$height = $_conf["expack.aas.{$mode}.height"];
313+
$margin = $_conf["expack.aas.{$mode}.margin"];
314+
$fontsize = $_conf["expack.aas.{$mode}.fontsize"];
315+
$overflow = $_conf["expack.aas.{$mode}.overflow"];
316+
$bold = $_conf["expack.aas.{$mode}.bold"];
317+
$fgcolor = $_conf["expack.aas.{$mode}.fgcolor"];
318+
$bgcolor = $_conf["expack.aas.{$mode}.bgcolor"];
315319
if ($rotate) {
316-
list($default_width, $default_height) = array($default_height, $default_width);
317-
}
318-
319-
// 画像サイズに合わせてフォントサイズを調節
320-
if ($inline && $_conf['expack.aas.inline_fontsize']) {
321-
$size = $_conf['expack.aas.inline_fontsize'];
322-
} else {
323-
$size = $_conf['expack.aas.max_fontsize'];
324-
list($width, $height) = aas_getTextBoxSize($size, $font, $hint, $lc);
325-
$max_width = $default_width - 2;
326-
$max_height = $default_height - 2;
327-
$ratio = max($width / $max_width, $height / $max_height);
328-
if ($ratio > 1.0) {
329-
$size = max(intval($_conf['expack.aas.max_fontsize'] / $ratio), $_conf['expack.aas.min_fontsize']);
330-
while ($size > $_conf['expack.aas.min_fontsize'] &&
331-
!aas_isTextInPicture($size, $font, $hint, $lc, $max_width, $max_height))
332-
{
333-
$size--;
334-
}
335-
}
320+
list($width, $height) = array($height, $width);
336321
}
337322

338323
// イメージ作成
339-
if ($_conf['expack.aas.trim']) {
340-
list($width, $height) = aas_getTextBoxSize($size, $font, $hint, $lc);
341-
$width = min($default_width, $width + 5);
342-
$height = min($default_height, $height + 5);
324+
list($image_width, $image_height) = aas_getTextBoxSize($fontsize, $font, $hint, $lc, $margin);
325+
if ($overflow) {
326+
$image_width = min($width, $image_width);
327+
$image_height = min($height, $image_height);
328+
}
329+
$image = imagecreatetruecolor($image_width, $image_height);
330+
if ($bgcolor && false !== ($c = aas_parseColor($bgcolor))) {
331+
$bgcolor = imagecolorallocate($image, $c[0], $c[1], $c[2]);
343332
} else {
344-
$width = $default_width;
345-
$height = $default_height;
333+
$bgcolor = imagecolorallocate($image, 255, 255, 255);
346334
}
347-
348-
$image = imagecreate($width, $height);
349-
if (isset($_conf['expack.aas.fgcolor']) &&
350-
false !== ($c = aas_parseColor($_conf['expack.aas.fgcolor'])))
351-
{
335+
if ($fgcolor && false !== ($c = aas_parseColor($fgcolor))) {
352336
$fgcolor = imagecolorallocate($image, $c[0], $c[1], $c[2]);
353337
} else {
354338
$fgcolor = imagecolorallocate($image, 0, 0, 0);
355339
}
356-
if (isset($_conf['expack.aas.bgcolor']) &&
357-
false !== ($c = aas_parseColor($_conf['expack.aas.bgcolor'])))
358-
{
359-
$bgcolor = imagecolorallocate($image, $c[0], $c[1], $c[2]);
360-
} else {
361-
$bgcolor = imagecolorallocate($image, 255, 255, 255);
362-
}
363340
imagefill($image, 0, 0, $bgcolor);
364341

365342
// テキスト描画
366343
$x_adjust = 1;
367-
$y_adjust = $size + floor($size / AAS_Y_ADJUST_P1) + AAS_Y_ADJUST_P2;
368-
$x_pos = $x_adjust;
369-
$y_pos = $y_adjust;
344+
$y_adjust = $fontsize + floor($fontsize / AAS_Y_ADJUST_P1) + AAS_Y_ADJUST_P2;
345+
$x_pos = $margin + $x_adjust;
346+
$y_pos = $margin + $y_adjust;
370347
// まとめて描画しようとすると長い文字列でエラーが出るので
371-
//imagettftext($image, $size, 0, $x_pos, $y_pos, $fgcolor, $font, $text);
348+
//imagettftext($image, $fontsize, 0, $x_pos, $y_pos, $fgcolor, $font, $text);
372349
// 一行ずつ描画する
373350
foreach ($lines as $line) {
374-
imagettftext($image, $size, 0, $x_pos, $y_pos, $fgcolor, $font, $line);
351+
imagettftext($image, $fontsize, 0, $x_pos, $y_pos, $fgcolor, $font, $line);
375352
// 太字は1ピクセル右に重ねて描画
376353
if ($bold) {
377-
imagettftext($image, $size, 0, $x_pos + 1, $y_pos, $fgcolor, $font, $line);
354+
imagettftext($image, $fontsize, 0, $x_pos + 1, $y_pos, $fgcolor, $font, $line);
378355
}
379356
$y_pos += $y_adjust;
357+
if (!$overflow && $y_pos >= $height) {
358+
break;
359+
}
360+
}
361+
362+
// リサイズ
363+
if (!$overflow && ($image_width > $width || $image_height > $height)) {
364+
if ($image_width > $width) {
365+
$height = $image_height * ($width / $image_width);
366+
}
367+
if ($image_height > $height) {
368+
$width = $image_width * ($height / $image_height);
369+
}
370+
$width = (int)floor($width);
371+
$height = (int)floor($height);
372+
$new_image = imagecreatetruecolor($width, $height);
373+
imagecopyresampled($new_image, $image, 0, 0, 0, 0, $width, $height, $image_width, $image_height);
374+
imagedestroy($image);
375+
$image = $new_image;
380376
}
381377

382378
// 回転
@@ -393,10 +389,10 @@
393389

394390
// 画像を出力
395391
if (!headers_sent()) {
396-
switch ($_conf['expack.aas.image_type']) {
392+
switch ($image_type) {
397393
case 1:
398394
header('Content-Type: image/jpeg');
399-
imagejpeg($image, '', $_conf['expack.aas.jpeg_quality']);
395+
imagejpeg($image, '', $quality);
400396
break;
401397
case 2:
402398
header('Content-Type: image/gif');
@@ -506,29 +502,14 @@ function aas_decodeHTMLEntity($e)
506502
/**
507503
* テキストボックスの大きさを計算する
508504
*/
509-
function aas_getTextBoxSize($size, $font, $hint, $lines)
505+
function aas_getTextBoxSize($size, $font, $hint, $lines, $margin)
510506
{
511-
$x_adjust = 5;
512-
$y_adjust = ($size + floor($size / AAS_Y_ADJUST_P1) + AAS_Y_ADJUST_P2) * ($lines - 1);
507+
$x_adjust = ($margin * 2) + 5;
508+
$y_adjust = ($margin * 2) + (($size + floor($size / AAS_Y_ADJUST_P1) + AAS_Y_ADJUST_P2) * ($lines - 1));
513509
$box = imagettfbbox($size, 0, $font, $hint);
514510
$box_width = max($box[0], $box[2], $box[4], $box[6]) - min($box[0], $box[2], $box[4], $box[6]) + $x_adjust;
515511
$box_height = max($box[1], $box[3], $box[5], $box[7]) - min($box[1], $box[3], $box[5], $box[7]) + $y_adjust;
516-
return array($box_width, $box_height);
517-
}
518-
519-
// }}}
520-
// {{{ aas_isTextInPicture()
521-
522-
/**
523-
* テキストが画像に収まり切るかチェックする
524-
*/
525-
function aas_isTextInPicture($size, $font, $hint, $lines, $max_width, $max_height)
526-
{
527-
list($box_width, $box_height) = aas_getTextBoxSize($size, $font, $hint, $lines);
528-
if ($box_width > $max_width || $box_height > $max_height) {
529-
return false;
530-
}
531-
return true;
512+
return array((int)$box_width, (int)$box_height);
532513
}
533514

534515
// }}}
Collapse file

‎conf/conf.inc.php‎

Copy file name to clipboardExpand all lines: conf/conf.inc.php
+26-11Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
// バージョン情報
88
$_conf = array(
9-
'p2version' => '1.7.29+1.8.14', // rep2のバージョン
10-
'p2expack' => '090519.2230', // 拡張パックのバージョン
9+
'p2version' => '1.7.29+1.8.x', // rep2のバージョン
10+
'p2expack' => '090601.1845', // 拡張パックのバージョン
1111
'p2name' => 'expack', // rep2の名前
1212
);
1313

@@ -651,7 +651,7 @@ function p2configure()
651651
} elseif (strpos($K, 'color') !== false) {
652652
$STYLE[$K] = p2_correct_css_color($V);
653653
} elseif (strpos($K, 'background') !== false) {
654-
$STYLE[$K] = "url('" . str_replace("'", "''", $V) . "')";
654+
$STYLE[$K] = "url('" . p2_escape_css_url($V) . "')";
655655
}
656656
}
657657

@@ -677,7 +677,7 @@ function p2configure()
677677

678678
// 強制PCビュー時
679679
case 'pc':
680-
$_conf['extra_headers_ht'] = <<<EOS
680+
$_conf['extra_headers_ht'] .= <<<EOS
681681
<meta name="format-detection" content="telephone=no">
682682
<link rel="apple-touch-icon" type="image/png" href="img/touch-icon/p2-serif.png">
683683
<style type="text/css">body { -webkit-text-size-adjust: none; }</style>
@@ -686,7 +686,7 @@ function p2configure()
686686

687687
// 強制携帯ビュー時
688688
case 'k':
689-
$_conf['extra_headers_ht'] = <<<EOS
689+
$_conf['extra_headers_ht'] .= <<<EOS
690690
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=yes">
691691
<meta name="format-detection" content="telephone=no">
692692
<link rel="apple-touch-icon" type="image/png" href="img/touch-icon/p2-serif.png">
@@ -703,7 +703,7 @@ function p2configure()
703703
// 純正iPhoneビュー
704704
case 'i':
705705
default:
706-
$_conf['extra_headers_ht'] = <<<EOS
706+
$_conf['extra_headers_ht'] .= <<<EOS
707707
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=yes">
708708
<meta name="format-detection" content="telephone=no">
709709
<link rel="apple-touch-icon" type="image/png" href="img/touch-icon/p2-serif.png">
@@ -715,12 +715,25 @@ function p2configure()
715715

716716
// 強制iPhoneビュー時
717717
} elseif ($_conf['iphone']) {
718-
$_conf['extra_headers_ht'] = <<<EOS
718+
$_conf['extra_headers_ht'] .= <<<EOS
719719
<link rel="stylesheet" type="text/css" media="screen" href="css/iphone.css?{$_conf['p2_version_id']}">
720720
<script type="text/javascript" src="js/iphone.js?{$_conf['p2_version_id']}"></script>
721721
EOS;
722722
}
723723

724+
// iPhone用スキン
725+
if ($_conf['iphone'] && isset($_conf['expack.iphone.skin'])) {
726+
if (strpos($_conf['expack.iphone.skin'], DIRECTORY_SEPARATOR) === false) {
727+
$iskin = 'skin/iphone/' . $iskin . '.css';
728+
if (file_exists($iskin)) {
729+
$iskin_mtime = filemtime($iskin);
730+
$_conf['extra_headers_ht'] .= <<<EOS
731+
<link rel="stylesheet" type="text/css" media="screen" href="{$iskin}?{$iskin_mtime}">
732+
EOS;
733+
}
734+
}
735+
}
736+
724737
// 携帯用「トップに戻る」リンクとaccesskey
725738
if ($_conf['ktai']) {
726739
// iPhone
@@ -925,8 +938,10 @@ function p2configure()
925938

926939
// 複数のお気にセットを使うとき
927940
if ($_conf['expack.misc.multi_favs']) {
928-
require_once $P2_LIB_DIR_S . 'FavSetManager.php';
929-
// 切り替え表示用に全てのお気に板を読み込んでおく
941+
if (!class_exists('FavSetManager', false)) {
942+
include $P2_LIB_DIR_S . 'FavSetManager.php';
943+
}
944+
// 切り替え表示用に全てのお気にスレ・お気に板を読み込んでおく
930945
FavSetManager::loadAllFavSet();
931946
// お気にセットを切り替える
932947
FavSetManager::switchFavSet();
@@ -986,15 +1001,15 @@ function p2checkenv($check_recommended)
9861001

9871002
$php_version = phpversion();
9881003
$required_version = '5.2.3';
989-
$recommended_version = '5.2.6';
1004+
$recommended_version = '5.2.9';
9901005

9911006
// PHPのバージョン
9921007
if (version_compare($php_version, $required_version, '<')) {
9931008
p2die("PHP {$required_version} 未満では使えません。");
9941009
}
9951010

9961011
// 必須拡張モジュール
997-
foreach (array('mbstring', 'pcre', 'pdo_sqlite', 'session', 'zlib') as $ext) {
1012+
foreach (array('json', 'mbstring', 'pcre', 'pdo', 'pdo_sqlite', 'session', 'zlib') as $ext) {
9981013
if (!extension_loaded($ext)) {
9991014
p2die("{$ext} 拡張モジュールがロードされていません。");
10001015
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.