annotate reclib.php @ 149:5b192e94f49d

fix: 予約済み定数を使ってしまったミスを修正。エラーレベルに警告を追加
author epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
date Sat, 27 Mar 2010 16:04:54 +0900
parents f268d7d10590
children b172a0b1ea48
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
1 <?php
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
2
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
3 // ゃ
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
4
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
5 function toTimestamp( $string ) {
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
6 sscanf( $string, "%4d-%2d-%2d %2d:%2d:%2d", $y, $mon, $day, $h, $min, $s );
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
7 return mktime( $h, $min, $s, $mon, $day, $y );
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
8 }
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
9
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
10 function toDatetime( $timestamp ) {
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
11 return date("Y-m-d H:i:s", $timestamp);
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
12 }
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
13
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
14
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
15 function jdialog( $message, $url = "index.php" ) {
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
16 header( "Content-Type: text/html;charset=utf-8" );
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
17 exit( "<script type=\"text/javascript\">\n" .
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
18 "<!--\n".
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
19 "alert(\"". $message . "\");\n".
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
20 "window.open(\"".$url."\",\"_self\");".
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
21 "// -->\n</script>" );
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
22 }
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
23
116
f268d7d10590 fix: マルチバイトmb_str_replaceをネットからいただいて追加
yoneda <epgrec@park.mda.or.jp>
parents: 1
diff changeset
24 // ゃstr_replace
f268d7d10590 fix: マルチバイトmb_str_replaceをネットからいただいて追加
yoneda <epgrec@park.mda.or.jp>
parents: 1
diff changeset
25
f268d7d10590 fix: マルチバイトmb_str_replaceをネットからいただいて追加
yoneda <epgrec@park.mda.or.jp>
parents: 1
diff changeset
26 function mb_str_replace($search, $replace, $target, $encoding = "UTF-8" ) {
f268d7d10590 fix: マルチバイトmb_str_replaceをネットからいただいて追加
yoneda <epgrec@park.mda.or.jp>
parents: 1
diff changeset
27 $notArray = !is_array($target) ? TRUE : FALSE;
f268d7d10590 fix: マルチバイトmb_str_replaceをネットからいただいて追加
yoneda <epgrec@park.mda.or.jp>
parents: 1
diff changeset
28 $target = $notArray ? array($target) : $target;
f268d7d10590 fix: マルチバイトmb_str_replaceをネットからいただいて追加
yoneda <epgrec@park.mda.or.jp>
parents: 1
diff changeset
29 $search_len = mb_strlen($search, $encoding);
f268d7d10590 fix: マルチバイトmb_str_replaceをネットからいただいて追加
yoneda <epgrec@park.mda.or.jp>
parents: 1
diff changeset
30 $replace_len = mb_strlen($replace, $encoding);
f268d7d10590 fix: マルチバイトmb_str_replaceをネットからいただいて追加
yoneda <epgrec@park.mda.or.jp>
parents: 1
diff changeset
31
f268d7d10590 fix: マルチバイトmb_str_replaceをネットからいただいて追加
yoneda <epgrec@park.mda.or.jp>
parents: 1
diff changeset
32 foreach ($target as $i => $tar) {
f268d7d10590 fix: マルチバイトmb_str_replaceをネットからいただいて追加
yoneda <epgrec@park.mda.or.jp>
parents: 1
diff changeset
33 $offset = mb_strpos($tar, $search);
f268d7d10590 fix: マルチバイトmb_str_replaceをネットからいただいて追加
yoneda <epgrec@park.mda.or.jp>
parents: 1
diff changeset
34 while ($offset !== FALSE){
f268d7d10590 fix: マルチバイトmb_str_replaceをネットからいただいて追加
yoneda <epgrec@park.mda.or.jp>
parents: 1
diff changeset
35 $tar = mb_substr($tar, 0, $offset).$replace.mb_substr($tar, $offset + $search_len);
f268d7d10590 fix: マルチバイトmb_str_replaceをネットからいただいて追加
yoneda <epgrec@park.mda.or.jp>
parents: 1
diff changeset
36 $offset = mb_strpos($tar, $search, $offset + $replace_len);
f268d7d10590 fix: マルチバイトmb_str_replaceをネットからいただいて追加
yoneda <epgrec@park.mda.or.jp>
parents: 1
diff changeset
37 }
f268d7d10590 fix: マルチバイトmb_str_replaceをネットからいただいて追加
yoneda <epgrec@park.mda.or.jp>
parents: 1
diff changeset
38 $target[$i] = $tar;
f268d7d10590 fix: マルチバイトmb_str_replaceをネットからいただいて追加
yoneda <epgrec@park.mda.or.jp>
parents: 1
diff changeset
39 }
f268d7d10590 fix: マルチバイトmb_str_replaceをネットからいただいて追加
yoneda <epgrec@park.mda.or.jp>
parents: 1
diff changeset
40 return $notArray ? $target[0] : $target;
f268d7d10590 fix: マルチバイトmb_str_replaceをネットからいただいて追加
yoneda <epgrec@park.mda.or.jp>
parents: 1
diff changeset
41 }
f268d7d10590 fix: マルチバイトmb_str_replaceをネットからいただいて追加
yoneda <epgrec@park.mda.or.jp>
parents: 1
diff changeset
42
1
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
43 ?>