• R/O
  • SSH
  • HTTPS

epitta-bbs: Commit


Commit MetaInfo

Revision33 (tree)
Time2011-09-20 00:39:06
Authorwajett

Log Message

2011/09/20 投稿系。

Change Summary

Incremental Difference

--- app/actions/image_action.php (nonexistent)
+++ app/actions/image_action.php (revision 33)
@@ -0,0 +1,90 @@
1+<?php if ( ! defined('BASEPATH')) exit('Denied Access');
2+/**
3+ * Epitta BB
4+ *
5+ * @author Wajett
6+ * @copyright Copyright (c) 2011 - 2012, Wajett Systems
7+ *
8+ *
9+ */
10+
11+
12+
13+class Image_Action extends Base_Action {
14+
15+
16+ public function __construct()
17+ {
18+ $GLOBALS['ENV'] = 'pdc';
19+
20+ }
21+
22+
23+
24+ /**
25+ * CAPTCHA破りは切りがないため、最低限の迷彩処理しかしない。
26+ *
27+ */
28+ public function captchaOutput()
29+ {
30+
31+ if ( ! isset($_GET['cpc']) && ! empty($_GET['cpc']) ) {
32+ trigger_error ('Invalid request to captcha!');
33+ }
34+
35+ $cpcNum = $this->getRequest('cpc', '');
36+ //echo $cpcNum;
37+
38+ $dh = $this->loadLib('dataHelper');
39+
40+ $decNum = $dh->decrypt($cpcNum, EPITTAIDTF);
41+ //echo $decNum;
42+
43+ $img = @imagecreate(70, 20)
44+ or die("Cannot Initialize new GD image stream!");
45+
46+
47+ $col_ellipse = imagecolorallocate($img, 255, 255, 255);
48+ //
49+ $bg_color = imagecolorallocate($img, 0, 0, 0);
50+ $text_color = imagecolorallocate($img, 255, 255, 255);
51+
52+ imagefill($img, 0, 0, $bg_color);
53+
54+
55+ //楕円
56+ $x = rand(22,50);
57+ $y = rand(5,15);
58+ imageellipse($img, $x, $y, 60, 20, $col_ellipse);
59+
60+ //ライン
61+ $x = 3 + rand(0,15);
62+ imageline($img, 0, $x, 100, $x, $col_ellipse);
63+
64+ //数値
65+ $x = -5;
66+ $y = 2;
67+ for ( $i=0; $i<=3; $i++ ) {
68+ $num = substr($decNum, $i, 1);
69+ $x += 7+rand(2,9);
70+ $y += rand(-1,1);
71+ imagestring($img, 5, $x, $y, $num, $text_color);
72+ }
73+
74+ header ('Content-Type: image/png');
75+ imagepng($img);
76+ imagedestroy($img);
77+
78+ exit;
79+
80+ }
81+
82+
83+ public function __destruct()
84+ {
85+
86+ }
87+
88+}
89+
90+?>
\ No newline at end of file
--- app/actions/post_action.php (revision 32)
+++ app/actions/post_action.php (revision 33)
@@ -92,7 +92,7 @@
9292
9393 //CAPTCHAパス
9494 if ( $GLOBALS['CNF']['captcha_on'] == 1 ) {
95- $this->postSet['captcha'] = $dh->makeRandomNumbers();
95+ $this->postSet['captcha'] = $dh->encrypt($dh->makeRandomNumbers(), EPITTAIDTF);
9696 }
9797
9898 } else {
--- app/actions/base_action.php (revision 32)
+++ app/actions/base_action.php (revision 33)
@@ -68,7 +68,7 @@
6868 $this->baseSet['pubURL'] = PUBURL ."/default";
6969 $this->baseSet['dataURL'] = DATAURL ."/default";
7070 }
71- $this->baseSet['pubCmn'] = PUBURL;
71+ $this->baseSet['pubCmn'] = PUBURL."/common";
7272
7373 //スキンパス
7474 if ( $this->platform ) {
@@ -304,8 +304,6 @@
304304 }
305305
306306
307-
308-
309307 }
310308
311309
--- app/app_controller.php (revision 32)
+++ app/app_controller.php (revision 33)
@@ -13,7 +13,7 @@
1313 {
1414
1515 //for Debug
16- if ( ENV == 'dev' ) {
16+ if ( $GLOBALS['ENV'] == 'dev' ) {
1717 array_push( $GLOBALS['DBG'], "Mem=" . round((memory_get_usage()/(1024*1024) ),2) . "MB\n" );
1818 }
1919
@@ -39,7 +39,10 @@
3939 'srhipt' =>array( 'act'=>'Search', 'func'=>'input' ),
4040 'srhrst' =>array( 'act'=>'Search', 'func'=>'result' ),
4141 //
42- 'ntce' =>array( 'act'=>'Page', 'func'=>'notice' ),
42+ 'ntce' =>array( 'act'=>'Page', 'func'=>'notice' ),
43+ //
44+ 'cpc' =>array( 'act'=>'Image', 'func'=>'captchaOutput' ),
45+
4346
4447 );
4548
@@ -94,13 +97,15 @@
9497
9598 function __destruct() {
9699
97- if ( ENV == 'dev' ) {
100+ if ( $GLOBALS['ENV'] == 'dev' ) {
98101 echo "<div>Now Developing!</div>\n";
99102 array_push( $GLOBALS['DBG'], "Mem=" . round((memory_get_usage()/(1024*1024) ),2) . "MB\n" );
103+
104+ print_r( $GLOBALS['DBG']);
105+
100106 }
101107
102- print_r( $GLOBALS['DBG']);
103-
108+
104109 }
105110
106111 }
@@ -195,17 +200,15 @@
195200
196201 }
197202
198-
199-
200203 function __destruct() {
201204
202- if ( ENV == 'dev' ) {
205+ if ( $GLOBALS['ENV'] == 'dev' ) {
203206 echo "<div>Now Developing!</div>\n";
204- array_push( $GLOBALS['DBG'], "Mem=" . round((memory_get_usage()/(1024*1024) ),2) . "MB\n" );
207+ array_push( $GLOBALS['DBG'], "Mem=" . round((memory_get_usage()/(1024*1024) ),2) . "MB\n" );
208+
209+ print_r( $GLOBALS['DBG']);
205210 }
206211
207- print_r( $GLOBALS['DBG']);
208-
209212 }
210213
211214 }
--- system/epitta_config.php (revision 32)
+++ system/epitta_config.php (revision 33)
@@ -39,9 +39,8 @@
3939
4040 /** 環境 **/
4141
42-//環境指定
43-define('ENV', 'dev');
44-
42+//環境指定 pdc or dev
43+$GLOBALS['ENV'] = 'dev';
4544
4645 //言語系
4746 define('BASEENC', 'UTF-8');
--- system/epitta_core.php (revision 32)
+++ system/epitta_core.php (revision 33)
@@ -27,7 +27,7 @@
2727 $GLOBALS['ERR'] = array();
2828
2929 //
30- if ( ENV == 'dev' ) {
30+ if ( $GLOBALS['ENV'] == 'dev' ) {
3131 array_push( $GLOBALS['DBG'], "Mem=" . round((memory_get_usage()/(1024*1024) ),2) . "MB\n" );
3232 }
3333
--- views/pc/default/article_input.php (revision 32)
+++ views/pc/default/article_input.php (revision 33)
@@ -7,8 +7,8 @@
77 $clips = makeFileUpload($postSet['clipfile']);
88 $ftclr = makeFontColorSelect($postSet['ftcolor_on'], $postSet['ftcolors'], $art['fontcolor']);
99 $icon = makeIconSelect($postSet['icon_on'], $postSet['icons'], $art['iconfile']);
10- $captc = makeCaptcha($postSet['captcha_on'], $postSet['captcha']);
11- $kword = makeKeyword($postSet['keyword_on'], $postSet['keyword_q'], $postSet['keyword_a']);
10+ $captc = makeCaptcha($postSet['captcha_on'], $postSet['captcha'], $baseSet['script'], $baseSet['pubURL']);
11+ $kword = makeKeyword($postSet['keyword_on'], $postSet['keyword_q']);
1212 $prev = makePreview($postSet['preview']);
1313 $err = makeError($postSet['errMessage'], $postSet['errMsgAry']);
1414 $prnt = makeResponseTo($postSet['resto']);
@@ -412,32 +412,46 @@
412412 return $myContent;
413413 }
414414
415-function makeCaptcha($flag, $strNum) {
415+function makeCaptcha($flag, $strNum, $script, $pubUrl) {
416+ if ( $flag==0 ) return '';
417+
416418 $myContent = '';
417419
420+$myContent .=<<< HTML
421+ <div class="itemName">{$GLOBALS['LNG']['captcha']}:</div>
422+ <div class="itemInput">
423+ <input type="text" name="captcha" size=6 value="" class="PostInput" style="ime-mode: disabled;" />
424+ <input type="hidden" name="captcha_enc" value="$strNum" />
425+HTML;
426+
418427 if ( $flag == 1 ) {
428+ $myContent .= "<img src=\"{$script}?act=cpc&cpc=" . urlencode($strNum) . '" width="70" height="20" align="top" class="captcha" />';
419429
430+ } else if ( $flag == 2 ) {
431+ $num = '';
432+ for ( $i=0; $i<=3; $i++ ) {
433+ $num = substr($strNum, $i, 1);
434+ $myContent .= "<img src=\"{$pubUrl}/img/num" . $num . '.gif" width="70" height="20" align="bottom" class="captcha" />';
435+ }
436+
437+ }
420438 $myContent .=<<< HTML
421- <div class="itemInput">
422- $strNum
423- <img src="">
424- <input type="hidden" name="captcha_enc" value="$strNum" />
425439 </div>
426440 <div class="clear"></div>
427441 HTML;
428442
429- }
430-
431443 return $myContent;
432444 }
433445
434446
435-function makeKeyword($flag, $qst, $asw) {
447+function makeKeyword($flag, $qst) {
436448 $myContent = '';
437449
438450 $myContent .=<<< HTML
439- <div class="itemName">{$GLOBALS['LNG']['mySubmitKey']}:</div>
440- <div class="itemInput"><img src=""></div>
451+ <div class="itemName" style="padding-top:0px;">{$GLOBALS['LNG']['mySubmitKey']}:</div>
452+ <div class="itemInput">$qst<br />
453+ <input type="text" name="captcha" size=10 value="" class="PostInput" style="ime-mode: disabled;" />
454+ </div>
441455 <div class="clear"></div>
442456 HTML;
443457
--- views/pc/default/base_layout.php (revision 32)
+++ views/pc/default/base_layout.php (revision 33)
@@ -4,8 +4,8 @@
44 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>" />
55 <meta http-equiv="content-script-type" content="text/javascript" />
66 <meta http-equiv="content-style-type" content="text/css" />
7-<link rel="stylesheet" type="text/css" href="<?php echo $this->baseSet['dataURL']; ?>/base.css" />
8-<link rel="stylesheet" type="text/css" href="<?php echo $this->baseSet['dataURL']; ?>/overwrite.css" />
7+<link rel="stylesheet" type="text/css" href="<?php echo $this->baseSet['pubCmn']; ?>/css/base.css" />
8+<link rel="stylesheet" type="text/css" href="<?php echo $this->baseSet['pubURL']; ?>/css/overwrite.css" />
99 <script type="text/javascript" src="<?php echo $this->baseSet['pubCmn']; ?>/js/common.js"></script>
1010 <title><?php echo $this->set['vw_title']; ?></title>
1111 </head>
Show on old repository browser