|
|
@@ -26,23 +26,7 @@ class gelato extends Conexion_Mysql {
|
|
26
|
26
|
} else {
|
|
27
|
27
|
return false;
|
|
28
|
28
|
}
|
|
29
|
|
- }
|
|
30
|
|
-
|
|
31
|
|
- function saveMP3($remoteFileName) {
|
|
32
|
|
- if (getMP3File($remoteFileName)) {
|
|
33
|
|
- return true;
|
|
34
|
|
- } else {
|
|
35
|
|
- return false;
|
|
36
|
|
- }
|
|
37
|
|
- }
|
|
38
|
|
-
|
|
39
|
|
- function savePhoto($remoteFileName) {
|
|
40
|
|
- if (getPhotoFile($remoteFileName)) {
|
|
41
|
|
- return true;
|
|
42
|
|
- } else {
|
|
43
|
|
- return false;
|
|
44
|
|
- }
|
|
45
|
|
- }
|
|
|
29
|
+ }
|
|
46
|
30
|
|
|
47
|
31
|
function getPosts($limit="10", $from="0") {
|
|
48
|
32
|
$sqlStr = "select * from ".$this->conf->tablePrefix."data ORDER BY date DESC LIMIT $from,$limit";
|
|
|
@@ -55,6 +39,12 @@ class gelato extends Conexion_Mysql {
|
|
55
|
39
|
return mysql_fetch_array($this->mid_consulta);
|
|
56
|
40
|
}
|
|
57
|
41
|
|
|
|
42
|
+ function getPostsNumber() {
|
|
|
43
|
+ $this->ejecutarConsulta("select count(*) as total from ".$this->conf->tablePrefix."data");
|
|
|
44
|
+ $row = mysql_fetch_assoc($this->mid_consulta);
|
|
|
45
|
+ return $row['total'];
|
|
|
46
|
+ }
|
|
|
47
|
+
|
|
58
|
48
|
function getType($id) {
|
|
59
|
49
|
if ($this->ejecutarConsulta("select type from ".$this->conf->tablePrefix."data WHERE id_post=".$id)) {
|
|
60
|
50
|
if ($this->contarRegistros()>0) {
|
|
|
@@ -97,6 +87,22 @@ class gelato extends Conexion_Mysql {
|
|
97
|
87
|
return $formatedText;
|
|
98
|
88
|
}
|
|
99
|
89
|
|
|
|
90
|
+ function saveMP3($remoteFileName) {
|
|
|
91
|
+ if (getMP3File($remoteFileName)) {
|
|
|
92
|
+ return true;
|
|
|
93
|
+ } else {
|
|
|
94
|
+ return false;
|
|
|
95
|
+ }
|
|
|
96
|
+ }
|
|
|
97
|
+
|
|
|
98
|
+ function savePhoto($remoteFileName) {
|
|
|
99
|
+ if (getPhotoFile($remoteFileName)) {
|
|
|
100
|
+ return true;
|
|
|
101
|
+ } else {
|
|
|
102
|
+ return false;
|
|
|
103
|
+ }
|
|
|
104
|
+ }
|
|
|
105
|
+
|
|
100
|
106
|
function getVideoPlayer($url) {
|
|
101
|
107
|
if (isYoutubeVideo($url)) {
|
|
102
|
108
|
$id_video = getYoutubeVideoUrl($url);
|
|
|
@@ -104,8 +110,33 @@ class gelato extends Conexion_Mysql {
|
|
104
|
110
|
} elseif (isVimeoVideo($url)) {
|
|
105
|
111
|
$id_video = getVimeoVideoUrl($url);
|
|
106
|
112
|
return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://www.vimeo.com/moogaloop.swf?clip_id=".$id_video."\"><param name=\"movie\" value=\"http://www.vimeo.com/moogaloop.swf?clip_id=".$id_video."\" /></object>\n";
|
|
|
113
|
+ } elseif (isGoogleVideo($url)) {
|
|
|
114
|
+ $html = trim(file_get_contents($url));
|
|
|
115
|
+ $start_code = strpos($html, "var flashObj =\n \"");
|
|
|
116
|
+ $end_code = strpos($html, "\";\n flashObj = flashObj.replace");
|
|
|
117
|
+ $start_code = $start_code + strlen("var flashObj =\n \"");
|
|
|
118
|
+ $video_code = substr($html, $start_code, $end_code - $start_code);
|
|
|
119
|
+ $video_code = str_replace("\u003c", "<", $video_code);
|
|
|
120
|
+ $video_code = str_replace("\u003d", "=", $video_code);
|
|
|
121
|
+ $video_code = str_replace("\\\"", "\"", $video_code);
|
|
|
122
|
+ $video_code = str_replace("width:100%;height:100%;", "width:500px;height:393px", $video_code);
|
|
|
123
|
+ $video_code = str_replace("/googleplayer.swf", "http://video.google.com/googleplayer.swf", $video_code);
|
|
|
124
|
+ $video_code = str_replace("embed", "object", $video_code);
|
|
|
125
|
+ $video_code = str_replace("src=", "data=", $video_code);
|
|
|
126
|
+ $video_code = str_replace('align="middle"', "", $video_code);
|
|
|
127
|
+ $video_code = str_replace('allowScriptAccess="always"', "", $video_code);
|
|
|
128
|
+ $video_code = str_replace('quality="best"', "", $video_code);
|
|
|
129
|
+ $video_code = str_replace('bgcolor="#ffffff"', "", $video_code);
|
|
|
130
|
+ $video_code = str_replace('scale="noScale"', "", $video_code);
|
|
|
131
|
+ $video_code = str_replace('salign="TL"', "", $video_code);
|
|
|
132
|
+ $video_code = str_replace('FlashVars="playerMode=normal&autoPlay=true&docid=-2519555829449987448&clickUrl="', "", $video_code);
|
|
|
133
|
+ $video_code = str_replace(' \\', " /", $video_code);
|
|
|
134
|
+ $video_code = str_replace('\></object\>', ' ></object>', $video_code);
|
|
|
135
|
+ $video_code = str_replace("id=\"VideoPlayback\"", "", $video_code);
|
|
|
136
|
+ $video_code = str_replace("&", "&", $video_code);
|
|
|
137
|
+ return $video_code;
|
|
107
|
138
|
} else {
|
|
108
|
|
- return "This URL is not a supported video (YouTube or Vimeo)";
|
|
|
139
|
+ return "This URL is not a supported video (YouTube, Vimeo or Google Video)";
|
|
109
|
140
|
}
|
|
110
|
141
|
}
|
|
111
|
142
|
|
|
|
@@ -116,12 +147,6 @@ class gelato extends Conexion_Mysql {
|
|
116
|
147
|
} else {
|
|
117
|
148
|
return "This URL is not a supported video (YouTube or Vimeo)";
|
|
118
|
149
|
}
|
|
119
|
|
- }
|
|
120
|
|
-
|
|
121
|
|
- function getPostsNumber() {
|
|
122
|
|
- $this->ejecutarConsulta("select count(*) as total from ".$this->conf->tablePrefix."data");
|
|
123
|
|
- $row = mysql_fetch_assoc($this->mid_consulta);
|
|
124
|
|
- return $row['total'];
|
|
125
|
|
- }
|
|
|
150
|
+ }
|
|
126
|
151
|
}
|
|
127
|
152
|
?>
|