Completed
Push — develop ( d37623...be9b66 )
by Kenji
14s queued 11s
created
application/views/bbs_delete_finished_mobile.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 </table>
28 28
 
29 29
 <hr>
30
-<?=anchor('bbs', 'トップに戻る');?>
30
+<?=anchor('bbs', 'トップに戻る'); ?>
31 31
 
32 32
 </body>
33 33
 </html>
Please login to merge, or discard this patch.
application/controllers/Bbs.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -311,6 +311,9 @@
 block discarded – undo
311 311
 	}
312 312
 
313 313
 # 携帯端末かどうかを判定し、ビューをロードするプライベートメソッドです。
314
+	/**
315
+	 * @param string $file
316
+	 */
314 317
 	private function _load_view($file, $data = '')
315 318
 	{
316 319
 # 携帯端末の場合は、「_mobile」がファイル名に付くビューファイルをロードします。
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	{
32 32
 # 引数から$offsetに値が渡されます。これは、3番目のURIセグメントの値です。
33 33
 # ユーザが変更可能なデータですので、int型へ変換し、必ず整数値にします。
34
-		$offset = (int) $offset;
34
+		$offset = (int)$offset;
35 35
 
36 36
 # 新しい記事ID順に、limit値とoffset値を指定し、bbsテーブルから記事データ
37 37
 # (オブジェクト)を取得し、$data['query']に代入します。order_by()メソッドは、
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 # メソッドを使い、ランダムな4桁の数字を取得します。
122 122
 		$vals = [
123 123
 					'word'      => random_string('numeric', 4),
124
-					'img_path'  => FCPATH . 'captcha/',
125
-					'img_url'   => base_url() . 'captcha/'
124
+					'img_path'  => FCPATH.'captcha/',
125
+					'img_url'   => base_url().'captcha/'
126 126
 				];
127 127
 		$cap = create_captcha($vals);
128 128
 		$data = [
@@ -149,12 +149,12 @@  discard block
 block discarded – undo
149 149
 	public function delete($id = '')
150 150
 	{
151 151
 # 第1引数、つまり、3番目のURIセグメントのデータをint型に変換します。
152
-		$id = (int) $id;
152
+		$id = (int)$id;
153 153
 # POSTされたpasswordフィールドの値を$passwordに代入します。
154 154
 		$password = $this->input->post('password');
155 155
 # POSTされたdeleteフィールドの値を$deleteに代入します。この値が
156 156
 # 1の場合は、削除を実行します。1以外は、削除の確認ページを表示します。
157
-		$delete = (int) $this->input->post('delete');
157
+		$delete = (int)$this->input->post('delete');
158 158
 
159 159
 # 削除パスワードが入力されていない場合は、エラーページを表示します。
160 160
 		if ($password == '')
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 # 有効期限を2時間に設定し、それ以前に生成されたキャプチャをデータベースから
287 287
 # 削除します。delete()メソッドの第2引数では、「captcha_time <」を配列のキーに
288 288
 # していますが、このように記述することで、WHERE句の条件の演算子を指定できます。
289
-		$expiration = time() - 7200;	// 有効期限 2時間
289
+		$expiration = time() - 7200; // 有効期限 2時間
290 290
 		$this->db->delete('captcha', ['captcha_time <' => $expiration]);
291 291
 
292 292
 # バリデーション(検証)クラスより引数$strに渡された、ユーザからの入力値がデータ
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 # 携帯端末の場合は、「_mobile」がファイル名に付くビューファイルをロードします。
325 325
 		if ($this->agent->is_mobile())
326 326
 		{
327
-			$this->load->view($file . '_mobile', $data);
327
+			$this->load->view($file.'_mobile', $data);
328 328
 		}
329 329
 		else
330 330
 		{
Please login to merge, or discard this patch.
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -61,8 +61,7 @@  discard block
 block discarded – undo
61 61
 		{
62 62
 			$config['full_tag_open']  = '<tr><td bgcolor="#EEEEEE">';
63 63
 			$config['full_tag_close'] = '</td></tr>';
64
-		}
65
-		else
64
+		} else
66 65
 		{
67 66
 			$config['full_tag_open']  = '<p class="pagination">';
68 67
 			$config['full_tag_close'] = '</p>';
@@ -98,8 +97,7 @@  discard block
 block discarded – undo
98 97
 			$this->_delete_captcha_data();
99 98
 
100 99
 			$this->_show_post_page();
101
-		}
102
-		else
100
+		} else
103 101
 		{
104 102
 			$data = [];
105 103
 			$data['name']       = $this->input->post('name');
@@ -169,8 +167,7 @@  discard block
 block discarded – undo
169 167
 		if ($password == '')
170 168
 		{
171 169
 			$this->_load_view('bbs_delete_error');
172
-		}
173
-		else
170
+		} else
174 171
 		{
175 172
 # 記事IDと削除パスワードを条件として、bbsテーブルを検索します。
176 173
 			$this->db->where('id', $id);
@@ -223,8 +220,7 @@  discard block
 block discarded – undo
223 220
 		if ($this->agent->is_mobile())
224 221
 		{
225 222
 			$this->form_validation->set_error_delimiters('<div>', '</div>');
226
-		}
227
-		else
223
+		} else
228 224
 		{
229 225
 			$this->form_validation->set_error_delimiters('<div class="error">', '</div>');
230 226
 		}
@@ -268,8 +264,7 @@  discard block
 block discarded – undo
268 264
 			$this->_delete_captcha_data();
269 265
 
270 266
 			$this->_show_post_page();
271
-		}
272
-		else
267
+		} else
273 268
 		{
274 269
 # 検証にパスした場合は、送られたデータとIPアドレスをbbsテーブルに登録します。
275 270
 			$data = [];
@@ -337,8 +332,7 @@  discard block
 block discarded – undo
337 332
 		if ($this->agent->is_mobile())
338 333
 		{
339 334
 			$this->load->view($file . '_mobile', $data);
340
-		}
341
-		else
335
+		} else
342 336
 		{
343 337
 			$this->load->view($file, $data);
344 338
 		}
Please login to merge, or discard this patch.
application/libraries/Twig.php 3 patches
Indentation   +236 added lines, -236 removed lines patch added patch discarded remove patch
@@ -17,242 +17,242 @@
 block discarded – undo
17 17
 
18 18
 class Twig
19 19
 {
20
-    /**
21
-     * @var array Paths to Twig templates
22
-     */
23
-    private $paths = [];
24
-
25
-    /**
26
-     * @var array Twig Environment Options
27
-     * @see http://twig.sensiolabs.org/doc/api.html#environment-options
28
-     */
29
-    private $config = [];
30
-
31
-    /**
32
-     * @var array Functions to add to Twig
33
-     */
34
-    private $functions_asis = [
35
-        'base_url', 'site_url',
36
-    ];
37
-
38
-    /**
39
-     * @var array Functions with `is_safe` option
40
-     * @see http://twig.sensiolabs.org/doc/advanced.html#automatic-escaping
41
-     */
42
-    private $functions_safe = [
43
-        'form_open', 'form_close', 'form_error', 'form_hidden', 'set_value',
20
+	/**
21
+	 * @var array Paths to Twig templates
22
+	 */
23
+	private $paths = [];
24
+
25
+	/**
26
+	 * @var array Twig Environment Options
27
+	 * @see http://twig.sensiolabs.org/doc/api.html#environment-options
28
+	 */
29
+	private $config = [];
30
+
31
+	/**
32
+	 * @var array Functions to add to Twig
33
+	 */
34
+	private $functions_asis = [
35
+		'base_url', 'site_url',
36
+	];
37
+
38
+	/**
39
+	 * @var array Functions with `is_safe` option
40
+	 * @see http://twig.sensiolabs.org/doc/advanced.html#automatic-escaping
41
+	 */
42
+	private $functions_safe = [
43
+		'form_open', 'form_close', 'form_error', 'form_hidden', 'set_value',
44 44
 //		'form_open_multipart', 'form_upload', 'form_submit', 'form_dropdown',
45 45
 //		'set_radio', 'set_select', 'set_checkbox',
46
-    ];
47
-
48
-    /**
49
-     * @var bool Whether functions are added or not
50
-     */
51
-    private $functions_added = FALSE;
52
-
53
-    /**
54
-     * @var Twig_Environment
55
-     */
56
-    private $twig;
57
-
58
-    /**
59
-     * @var Twig_Loader_Filesystem
60
-     */
61
-    private $loader;
62
-
63
-    public function __construct($params = [])
64
-    {
65
-        if (isset($params['functions']))
66
-        {
67
-            $this->functions_asis =
68
-                array_unique(
69
-                    array_merge($this->functions_asis, $params['functions'])
70
-                );
71
-            unset($params['functions']);
72
-        }
73
-        if (isset($params['functions_safe']))
74
-        {
75
-            $this->functions_safe =
76
-                array_unique(
77
-                    array_merge($this->functions_safe, $params['functions_safe'])
78
-                );
79
-            unset($params['functions_safe']);
80
-        }
81
-
82
-        if (isset($params['paths']))
83
-        {
84
-            $this->paths = $params['paths'];
85
-            unset($params['paths']);
86
-        }
87
-        else
88
-        {
89
-            $this->paths = [VIEWPATH];
90
-        }
91
-
92
-        // default Twig config
93
-        $this->config = [
94
-            'cache'      => APPPATH . 'cache/twig',
95
-            'debug'      => ENVIRONMENT !== 'production',
96
-            'autoescape' => 'html',
97
-        ];
98
-
99
-        $this->config = array_merge($this->config, $params);
100
-    }
101
-
102
-    protected function resetTwig()
103
-    {
104
-        $this->twig = null;
105
-        $this->createTwig();
106
-    }
107
-
108
-    protected function createTwig()
109
-    {
110
-        // $this->twig is singleton
111
-        if ($this->twig !== null)
112
-        {
113
-            return;
114
-        }
115
-
116
-        if ($this->loader === null)
117
-        {
118
-            $this->loader = new \Twig_Loader_Filesystem($this->paths);
119
-        }
120
-
121
-        $twig = new \Twig_Environment($this->loader, $this->config);
122
-
123
-        if ($this->config['debug'])
124
-        {
125
-            $twig->addExtension(new \Twig_Extension_Debug());
126
-        }
127
-
128
-        $this->twig = $twig;
129
-    }
130
-
131
-    protected function setLoader($loader)
132
-    {
133
-        $this->loader = $loader;
134
-    }
135
-
136
-    /**
137
-     * Registers a Global
138
-     *
139
-     * @param string $name  The global name
140
-     * @param mixed  $value The global value
141
-     */
142
-    public function addGlobal($name, $value)
143
-    {
144
-        $this->createTwig();
145
-        $this->twig->addGlobal($name, $value);
146
-    }
147
-
148
-    /**
149
-     * Renders Twig Template and Set Output
150
-     *
151
-     * @param string $view   Template filename without `.twig`
152
-     * @param array  $params Array of parameters to pass to the template
153
-     */
154
-    public function display($view, $params = [])
155
-    {
156
-        $CI =& get_instance();
157
-        $CI->output->set_output($this->render($view, $params));
158
-    }
159
-
160
-    /**
161
-     * Renders Twig Template and Returns as String
162
-     *
163
-     * @param string $view   Template filename without `.twig`
164
-     * @param array  $params Array of parameters to pass to the template
165
-     * @return string
166
-     */
167
-    public function render($view, $params = [])
168
-    {
169
-        $this->createTwig();
170
-        // We call addFunctions() here, because we must call addFunctions()
171
-        // after loading CodeIgniter functions in a controller.
172
-        $this->addFunctions();
173
-
174
-        $view = $view . '.twig';
175
-        return $this->twig->render($view, $params);
176
-    }
177
-
178
-    protected function addFunctions()
179
-    {
180
-        // Runs only once
181
-        if ($this->functions_added)
182
-        {
183
-            return;
184
-        }
185
-
186
-        // as is functions
187
-        foreach ($this->functions_asis as $function)
188
-        {
189
-            if (function_exists($function))
190
-            {
191
-                $this->twig->addFunction(
192
-                    new \Twig_SimpleFunction(
193
-                        $function,
194
-                        $function
195
-                    )
196
-                );
197
-            }
198
-        }
199
-
200
-        // safe functions
201
-        foreach ($this->functions_safe as $function)
202
-        {
203
-            if (function_exists($function))
204
-            {
205
-                $this->twig->addFunction(
206
-                    new \Twig_SimpleFunction(
207
-                        $function,
208
-                        $function,
209
-                        ['is_safe' => ['html']]
210
-                    )
211
-                );
212
-            }
213
-        }
214
-
215
-        // customized functions
216
-        if (function_exists('anchor'))
217
-        {
218
-            $this->twig->addFunction(
219
-                new \Twig_SimpleFunction(
220
-                    'anchor',
221
-                    [$this, 'safe_anchor'],
222
-                    ['is_safe' => ['html']]
223
-                )
224
-            );
225
-        }
226
-
227
-        $this->functions_added = TRUE;
228
-    }
229
-
230
-    /**
231
-     * @param string $uri
232
-     * @param string $title
233
-     * @param array  $attributes [changed] only array is acceptable
234
-     * @return string
235
-     */
236
-    public function safe_anchor($uri = '', $title = '', $attributes = [])
237
-    {
238
-        $uri = html_escape($uri);
239
-        $title = html_escape($title);
240
-
241
-        $new_attr = [];
242
-        foreach ($attributes as $key => $val)
243
-        {
244
-            $new_attr[html_escape($key)] = html_escape($val);
245
-        }
246
-
247
-        return anchor($uri, $title, $new_attr);
248
-    }
249
-
250
-    /**
251
-     * @return \Twig_Environment
252
-     */
253
-    public function getTwig()
254
-    {
255
-        $this->createTwig();
256
-        return $this->twig;
257
-    }
46
+	];
47
+
48
+	/**
49
+	 * @var bool Whether functions are added or not
50
+	 */
51
+	private $functions_added = FALSE;
52
+
53
+	/**
54
+	 * @var Twig_Environment
55
+	 */
56
+	private $twig;
57
+
58
+	/**
59
+	 * @var Twig_Loader_Filesystem
60
+	 */
61
+	private $loader;
62
+
63
+	public function __construct($params = [])
64
+	{
65
+		if (isset($params['functions']))
66
+		{
67
+			$this->functions_asis =
68
+				array_unique(
69
+					array_merge($this->functions_asis, $params['functions'])
70
+				);
71
+			unset($params['functions']);
72
+		}
73
+		if (isset($params['functions_safe']))
74
+		{
75
+			$this->functions_safe =
76
+				array_unique(
77
+					array_merge($this->functions_safe, $params['functions_safe'])
78
+				);
79
+			unset($params['functions_safe']);
80
+		}
81
+
82
+		if (isset($params['paths']))
83
+		{
84
+			$this->paths = $params['paths'];
85
+			unset($params['paths']);
86
+		}
87
+		else
88
+		{
89
+			$this->paths = [VIEWPATH];
90
+		}
91
+
92
+		// default Twig config
93
+		$this->config = [
94
+			'cache'      => APPPATH . 'cache/twig',
95
+			'debug'      => ENVIRONMENT !== 'production',
96
+			'autoescape' => 'html',
97
+		];
98
+
99
+		$this->config = array_merge($this->config, $params);
100
+	}
101
+
102
+	protected function resetTwig()
103
+	{
104
+		$this->twig = null;
105
+		$this->createTwig();
106
+	}
107
+
108
+	protected function createTwig()
109
+	{
110
+		// $this->twig is singleton
111
+		if ($this->twig !== null)
112
+		{
113
+			return;
114
+		}
115
+
116
+		if ($this->loader === null)
117
+		{
118
+			$this->loader = new \Twig_Loader_Filesystem($this->paths);
119
+		}
120
+
121
+		$twig = new \Twig_Environment($this->loader, $this->config);
122
+
123
+		if ($this->config['debug'])
124
+		{
125
+			$twig->addExtension(new \Twig_Extension_Debug());
126
+		}
127
+
128
+		$this->twig = $twig;
129
+	}
130
+
131
+	protected function setLoader($loader)
132
+	{
133
+		$this->loader = $loader;
134
+	}
135
+
136
+	/**
137
+	 * Registers a Global
138
+	 *
139
+	 * @param string $name  The global name
140
+	 * @param mixed  $value The global value
141
+	 */
142
+	public function addGlobal($name, $value)
143
+	{
144
+		$this->createTwig();
145
+		$this->twig->addGlobal($name, $value);
146
+	}
147
+
148
+	/**
149
+	 * Renders Twig Template and Set Output
150
+	 *
151
+	 * @param string $view   Template filename without `.twig`
152
+	 * @param array  $params Array of parameters to pass to the template
153
+	 */
154
+	public function display($view, $params = [])
155
+	{
156
+		$CI =& get_instance();
157
+		$CI->output->set_output($this->render($view, $params));
158
+	}
159
+
160
+	/**
161
+	 * Renders Twig Template and Returns as String
162
+	 *
163
+	 * @param string $view   Template filename without `.twig`
164
+	 * @param array  $params Array of parameters to pass to the template
165
+	 * @return string
166
+	 */
167
+	public function render($view, $params = [])
168
+	{
169
+		$this->createTwig();
170
+		// We call addFunctions() here, because we must call addFunctions()
171
+		// after loading CodeIgniter functions in a controller.
172
+		$this->addFunctions();
173
+
174
+		$view = $view . '.twig';
175
+		return $this->twig->render($view, $params);
176
+	}
177
+
178
+	protected function addFunctions()
179
+	{
180
+		// Runs only once
181
+		if ($this->functions_added)
182
+		{
183
+			return;
184
+		}
185
+
186
+		// as is functions
187
+		foreach ($this->functions_asis as $function)
188
+		{
189
+			if (function_exists($function))
190
+			{
191
+				$this->twig->addFunction(
192
+					new \Twig_SimpleFunction(
193
+						$function,
194
+						$function
195
+					)
196
+				);
197
+			}
198
+		}
199
+
200
+		// safe functions
201
+		foreach ($this->functions_safe as $function)
202
+		{
203
+			if (function_exists($function))
204
+			{
205
+				$this->twig->addFunction(
206
+					new \Twig_SimpleFunction(
207
+						$function,
208
+						$function,
209
+						['is_safe' => ['html']]
210
+					)
211
+				);
212
+			}
213
+		}
214
+
215
+		// customized functions
216
+		if (function_exists('anchor'))
217
+		{
218
+			$this->twig->addFunction(
219
+				new \Twig_SimpleFunction(
220
+					'anchor',
221
+					[$this, 'safe_anchor'],
222
+					['is_safe' => ['html']]
223
+				)
224
+			);
225
+		}
226
+
227
+		$this->functions_added = TRUE;
228
+	}
229
+
230
+	/**
231
+	 * @param string $uri
232
+	 * @param string $title
233
+	 * @param array  $attributes [changed] only array is acceptable
234
+	 * @return string
235
+	 */
236
+	public function safe_anchor($uri = '', $title = '', $attributes = [])
237
+	{
238
+		$uri = html_escape($uri);
239
+		$title = html_escape($title);
240
+
241
+		$new_attr = [];
242
+		foreach ($attributes as $key => $val)
243
+		{
244
+			$new_attr[html_escape($key)] = html_escape($val);
245
+		}
246
+
247
+		return anchor($uri, $title, $new_attr);
248
+	}
249
+
250
+	/**
251
+	 * @return \Twig_Environment
252
+	 */
253
+	public function getTwig()
254
+	{
255
+		$this->createTwig();
256
+		return $this->twig;
257
+	}
258 258
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
         // default Twig config
93 93
         $this->config = [
94
-            'cache'      => APPPATH . 'cache/twig',
94
+            'cache'      => APPPATH.'cache/twig',
95 95
             'debug'      => ENVIRONMENT !== 'production',
96 96
             'autoescape' => 'html',
97 97
         ];
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
      */
154 154
     public function display($view, $params = [])
155 155
     {
156
-        $CI =& get_instance();
156
+        $CI = & get_instance();
157 157
         $CI->output->set_output($this->render($view, $params));
158 158
     }
159 159
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
         // after loading CodeIgniter functions in a controller.
172 172
         $this->addFunctions();
173 173
 
174
-        $view = $view . '.twig';
174
+        $view = $view.'.twig';
175 175
         return $this->twig->render($view, $params);
176 176
     }
177 177
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -83,8 +83,7 @@
 block discarded – undo
83 83
         {
84 84
             $this->paths = $params['paths'];
85 85
             unset($params['paths']);
86
-        }
87
-        else
86
+        } else
88 87
         {
89 88
             $this->paths = [VIEWPATH];
90 89
         }
Please login to merge, or discard this patch.