Mercurial > hg > Members > shoshi > webvirt
annotate app/controllers/icon_controller.php @ 4:c3adb28473d6 default tip
modified icon feature
author | Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 16 Aug 2011 18:31:36 +0900 |
parents | 7201fd354bdf |
children |
rev | line source |
---|---|
3
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
1 <?php |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
2 |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
3 class IconController extends AppController |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4 { |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
5 public $name = "icon"; |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6 public $autoRender = false; |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7 public $uses = null; |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
8 |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
9 public function index() |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
10 { |
4
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
11 $this->autoRender = false; |
3
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
12 $icon_dir = "../icon"; //relative path without slash |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
13 $icon_default = "/default.png"; //file name must include slash |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
14 $icon_file = $icon_default; |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
15 |
4
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
16 if(isset($_GET["uuid"])){ |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
17 $uuid = $_GET["uuid"]; |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
18 if($this->IsUUID($uuid)){ |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
19 $icon_file = "/".$uuid.".png"; |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
20 }else{ |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
21 $this->RenderError("Invalid UUID."); |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
22 return; |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
23 } |
3
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
24 } |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
25 |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
26 $icon = @file_get_contents($icon_dir.$icon_file); |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
27 if($icon === FALSE){ |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
28 //failed to get icon |
4
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
29 $icon = @file_get_contents($icon_dir.$icon_default); |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
30 if($icon === FALSE){ |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
31 //print error code here. |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
32 $err = error_get_last(); |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
33 $this->RenderErorr($err["message"]); |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
34 return; |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
35 } |
3
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
36 } |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
37 |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
38 header("Content-Type: image/png"); |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
39 print($icon); |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
40 } |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
41 |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
42 public function EditIcon() |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
43 { |
4
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
44 if(!isset($this->params["url"]["uuid"])){ |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
45 $this->set("content","Domain ID is required."); |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
46 $this->render("error"); |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
47 return; |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
48 } |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
49 |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
50 $uuid = $this->params["url"]["uuid"]; |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
51 if(!$this->IsUUID($uuid)){ |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
52 $this->RenderError("Invalid UUID."); |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
53 } |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
54 |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
55 $this->autoRender = true; |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
56 |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
57 $this->set("max_size",ini_get("post_max_size")); |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
58 $this->set("uuid",$uuid); |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
59 } |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
60 |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
61 public function DeleteIcon() |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
62 { |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
63 $this->autoRender = true; |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
64 |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
65 if(!isset($_POST["uuid"])){ |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
66 $this->RenderError("Domain ID is required."); |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
67 return; |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
68 } |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
69 |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
70 $uuid = $_POST["uuid"]; |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
71 if($this->IsUUID($uuid)){ |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
72 $this->RenderError("Invalid UUID."); |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
73 return; |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
74 } |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
75 |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
76 $icon_name = "../icon/".$_POST["uuid"].".png"; |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
77 $result = @unlink($icon_name); |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
78 if(!$result){ |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
79 $err = error_get_last(); |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
80 $this->RenderError($err["message"]); |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
81 } |
3
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
82 } |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
83 |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
84 public function SaveIcon() |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
85 { |
4
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
86 if(!isset($_POST["uuid"])){ |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
87 $this->set("content","Domain ID is required."); |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
88 $this->render("error"); |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
89 return; |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
90 } |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
91 |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
92 $uuid = $_POST["uuid"]; |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
93 if(!$this->IsUUID($uuid)){ |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
94 $this->RenderErorr("Invalid UUID"); |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
95 } |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
96 |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
97 $this->set("uuid",$uuid); |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
98 $tmp_name = $_FILES["icon"]["tmp_name"]; |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
99 |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
100 if(is_uploaded_file($tmp_name) === FALSE){ |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
101 $this->RenderError("Failed to upload file"); |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
102 return; |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
103 } |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
104 |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
105 $img = @imagecreatefrompng($tmp_name); |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
106 if($img === FALSE){ |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
107 $this->RenderError("Failed to create image from uploaded file"); |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
108 return; |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
109 } |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
110 |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
111 $width = 81; |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
112 $height = 81; |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
113 $resized_img = @imagecreatetruecolor($width,$height); |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
114 @imagecopyresampled($resized_img,$img,0,0,0,0,$width,$height,imagesx($img),imagesy($img)); |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
115 |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
116 $target_name = "../icon/".$_POST["uuid"].".png"; |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
117 if(@imagepng($resized_img,$target_name) === FALSE){ |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
118 $this->RenderError("Failed to save image"); |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
119 return; |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
120 } |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
121 |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
122 $this->autoRender = true; |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
123 } |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
124 |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
125 public function RenderError($_msg) |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
126 { |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
127 $this->set("content",$_msg); |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
128 $this->render("error"); |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
129 } |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
130 |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
131 public function IsUUID($_uuid) |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
132 { |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
133 if(preg_match("/[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}/",$_uuid)){ |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
134 return true; |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
135 } |
c3adb28473d6
modified icon feature
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
136 return false; |
3
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
137 } |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
138 } |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
139 |
7201fd354bdf
added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
140 ?> |