Album.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. <?php
  2. ###
  3. # @name Album Module
  4. # @copyright 2015 by Tobias Reich
  5. ###
  6. if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
  7. class Album extends Module {
  8. private $database = null;
  9. private $settings = null;
  10. private $albumIDs = null;
  11. public function __construct($database, $plugins, $settings, $albumIDs) {
  12. # Init vars
  13. $this->database = $database;
  14. $this->plugins = $plugins;
  15. $this->settings = $settings;
  16. $this->albumIDs = $albumIDs;
  17. return true;
  18. }
  19. public function add($title = 'Untitled', $public = 0, $visible = 1) {
  20. # Check dependencies
  21. self::dependencies(isset($this->database));
  22. # Call plugins
  23. $this->plugins(__METHOD__, 0, func_get_args());
  24. # Parse
  25. if (strlen($title)>50) $title = substr($title, 0, 50);
  26. # Database
  27. $sysstamp = time();
  28. $query = Database::prepare($this->database, "INSERT INTO ? (title, sysstamp, public, visible) VALUES ('?', '?', '?', '?')", array(LYCHEE_TABLE_ALBUMS, $title, $sysstamp, $public, $visible));
  29. $result = $this->database->query($query);
  30. # Call plugins
  31. $this->plugins(__METHOD__, 1, func_get_args());
  32. if (!$result) {
  33. Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
  34. return false;
  35. }
  36. return $this->database->insert_id;
  37. }
  38. public function get() {
  39. # Check dependencies
  40. self::dependencies(isset($this->database, $this->settings, $this->albumIDs));
  41. # Call plugins
  42. $this->plugins(__METHOD__, 0, func_get_args());
  43. # Get album information
  44. switch ($this->albumIDs) {
  45. case 'f': $return['public'] = false;
  46. $query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url FROM ? WHERE star = 1 " . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
  47. break;
  48. case 's': $return['public'] = false;
  49. $query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url FROM ? WHERE public = 1 " . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
  50. break;
  51. case 'r': $return['public'] = false;
  52. $query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url FROM ? WHERE LEFT(id, 10) >= unix_timestamp(DATE_SUB(NOW(), INTERVAL 1 DAY)) " . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
  53. break;
  54. case '0': $return['public'] = false;
  55. $query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url FROM ? WHERE album = 0 " . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
  56. break;
  57. default: $query = Database::prepare($this->database, "SELECT * FROM ? WHERE id = '?' LIMIT 1", array(LYCHEE_TABLE_ALBUMS, $this->albumIDs));
  58. $albums = $this->database->query($query);
  59. $return = $albums->fetch_assoc();
  60. $return['sysdate'] = date('d M. Y', $return['sysstamp']);
  61. $return['password'] = ($return['password']=='' ? '0' : '1');
  62. $query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url FROM ? WHERE album = '?' " . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS, $this->albumIDs));
  63. break;
  64. }
  65. # Get photos
  66. $photos = $this->database->query($query);
  67. $previousPhotoID = '';
  68. while ($photo = $photos->fetch_assoc()) {
  69. # Parse
  70. $photo['sysdate'] = date('d F Y', substr($photo['id'], 0, -4));
  71. $photo['previousPhoto'] = $previousPhotoID;
  72. $photo['nextPhoto'] = '';
  73. $photo['thumbUrl'] = LYCHEE_URL_UPLOADS_THUMB . $photo['thumbUrl'];
  74. # Parse url
  75. $photo['url'] = LYCHEE_URL_UPLOADS_BIG . $photo['url'];
  76. if (isset($photo['takestamp'])&&$photo['takestamp']!=='0') {
  77. $photo['cameraDate'] = 1;
  78. $photo['sysdate'] = date('d F Y', $photo['takestamp']);
  79. }
  80. if ($previousPhotoID!=='') $return['content'][$previousPhotoID]['nextPhoto'] = $photo['id'];
  81. $previousPhotoID = $photo['id'];
  82. # Add to return
  83. $return['content'][$photo['id']] = $photo;
  84. }
  85. if ($photos->num_rows===0) {
  86. # Album empty
  87. $return['content'] = false;
  88. } else {
  89. # Enable next and previous for the first and last photo
  90. $lastElement = end($return['content']);
  91. $lastElementId = $lastElement['id'];
  92. $firstElement = reset($return['content']);
  93. $firstElementId = $firstElement['id'];
  94. if ($lastElementId!==$firstElementId) {
  95. $return['content'][$lastElementId]['nextPhoto'] = $firstElementId;
  96. $return['content'][$firstElementId]['previousPhoto'] = $lastElementId;
  97. }
  98. }
  99. $return['id'] = $this->albumIDs;
  100. $return['num'] = $photos->num_rows;
  101. # Call plugins
  102. $this->plugins(__METHOD__, 1, func_get_args());
  103. return $return;
  104. }
  105. public function getAll($public) {
  106. # Check dependencies
  107. self::dependencies(isset($this->database, $this->settings, $public));
  108. # Call plugins
  109. $this->plugins(__METHOD__, 0, func_get_args());
  110. # Initialize return var
  111. $return = array(
  112. 'smartalbums' => null,
  113. 'albums' => null,
  114. 'num' => 0
  115. );
  116. # Get SmartAlbums
  117. if ($public===false) $return['smartalbums'] = $this->getSmartInfo();
  118. # Albums query
  119. $query = Database::prepare($this->database, 'SELECT id, title, public, sysstamp, password FROM ? WHERE public = 1 AND visible <> 0', array(LYCHEE_TABLE_ALBUMS));
  120. if ($public===false) $query = Database::prepare($this->database, 'SELECT id, title, public, sysstamp, password FROM ?', array(LYCHEE_TABLE_ALBUMS));
  121. # Execute query
  122. $albums = $this->database->query($query);
  123. if (!$albums) {
  124. Log::error($database, __METHOD__, __LINE__, 'Could not get all albums (' . $database->error . ')');
  125. exit('Error: ' . $this->database->error);
  126. }
  127. # For each album
  128. while ($album = $albums->fetch_assoc()) {
  129. # Parse info
  130. $album['sysdate'] = date('F Y', $album['sysstamp']);
  131. $album['password'] = ($album['password']=='' ? '0' : '1');
  132. # Thumbs
  133. if (($public===true&&$album['password']==='0')||($public===false)) {
  134. # Execute query
  135. $query = Database::prepare($this->database, "SELECT thumbUrl FROM ? WHERE album = '?' ORDER BY star DESC, " . substr($this->settings['sorting'], 9) . " LIMIT 3", array(LYCHEE_TABLE_PHOTOS, $album['id']));
  136. $thumbs = $this->database->query($query);
  137. # For each thumb
  138. $k = 0;
  139. while ($thumb = $thumbs->fetch_object()) {
  140. $album["thumb$k"] = LYCHEE_URL_UPLOADS_THUMB . $thumb->thumbUrl;
  141. $k++;
  142. }
  143. }
  144. # Add to return
  145. $return['albums'][$album['id']] = $album;
  146. }
  147. # Num of albums
  148. $return['num'] = $albums->num_rows;
  149. # Call plugins
  150. $this->plugins(__METHOD__, 1, func_get_args());
  151. return $return;
  152. }
  153. private function getSmartInfo() {
  154. # Check dependencies
  155. self::dependencies(isset($this->database, $this->settings));
  156. # Initialize return var
  157. $return = array(
  158. 'unsorted' => null,
  159. 'public' => null,
  160. 'starred' => null,
  161. 'recent' => null
  162. );
  163. # Unsorted
  164. $query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE album = 0 ' . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
  165. $unsorted = $this->database->query($query);
  166. $i = 0;
  167. while($row = $unsorted->fetch_object()) {
  168. if ($i<3) {
  169. $return['unsorted']["thumb$i"] = LYCHEE_URL_UPLOADS_THUMB . $row->thumbUrl;
  170. $i++;
  171. } else break;
  172. }
  173. $return['unsorted']['num'] = $unsorted->num_rows;
  174. # Starred
  175. $query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE star = 1 ' . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
  176. $starred = $this->database->query($query);
  177. $i = 0;
  178. while($row3 = $starred->fetch_object()) {
  179. if ($i<3) {
  180. $return['starred']["thumb$i"] = LYCHEE_URL_UPLOADS_THUMB . $row3->thumbUrl;
  181. $i++;
  182. } else break;
  183. }
  184. $return['starred']['num'] = $starred->num_rows;
  185. # Public
  186. $query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE public = 1 ' . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
  187. $public = $this->database->query($query);
  188. $i = 0;
  189. while($row2 = $public->fetch_object()) {
  190. if ($i<3) {
  191. $return['public']["thumb$i"] = LYCHEE_URL_UPLOADS_THUMB . $row2->thumbUrl;
  192. $i++;
  193. } else break;
  194. }
  195. $return['public']['num'] = $public->num_rows;
  196. # Recent
  197. $query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE LEFT(id, 10) >= unix_timestamp(DATE_SUB(NOW(), INTERVAL 1 DAY)) ' . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS));
  198. $recent = $this->database->query($query);
  199. $i = 0;
  200. while($row3 = $recent->fetch_object()) {
  201. if ($i<3) {
  202. $return['recent']["thumb$i"] = LYCHEE_URL_UPLOADS_THUMB . $row3->thumbUrl;
  203. $i++;
  204. } else break;
  205. }
  206. $return['recent']['num'] = $recent->num_rows;
  207. return $return;
  208. }
  209. public function getArchive() {
  210. # Check dependencies
  211. self::dependencies(isset($this->database, $this->albumIDs));
  212. # Call plugins
  213. $this->plugins(__METHOD__, 0, func_get_args());
  214. # Illicit chars
  215. $badChars = array_merge(
  216. array_map('chr', range(0,31)),
  217. array("<", ">", ":", '"', "/", "\\", "|", "?", "*")
  218. );
  219. # Photos query
  220. switch($this->albumIDs) {
  221. case 's':
  222. $photos = Database::prepare($this->database, 'SELECT title, url FROM ? WHERE public = 1', array(LYCHEE_TABLE_PHOTOS));
  223. $zipTitle = 'Public';
  224. break;
  225. case 'f':
  226. $photos = Database::prepare($this->database, 'SELECT title, url FROM ? WHERE star = 1', array(LYCHEE_TABLE_PHOTOS));
  227. $zipTitle = 'Starred';
  228. break;
  229. case 'r':
  230. $photos = Database::prepare($this->database, 'SELECT title, url FROM ? WHERE LEFT(id, 10) >= unix_timestamp(DATE_SUB(NOW(), INTERVAL 1 DAY)) GROUP BY checksum', array(LYCHEE_TABLE_PHOTOS));
  231. $zipTitle = 'Recent';
  232. break;
  233. default:
  234. $photos = Database::prepare($this->database, "SELECT title, url FROM ? WHERE album = '?'", array(LYCHEE_TABLE_PHOTOS, $this->albumIDs));
  235. $zipTitle = 'Unsorted';
  236. }
  237. # Set title
  238. if ($this->albumIDs!=0&&is_numeric($this->albumIDs)) {
  239. $query = Database::prepare($this->database, "SELECT title FROM ? WHERE id = '?' LIMIT 1", array(LYCHEE_TABLE_ALBUMS, $this->albumIDs));
  240. $album = $this->database->query($query);
  241. $zipTitle = $album->fetch_object()->title;
  242. }
  243. # Escape title
  244. $zipTitle = str_replace($badChars, '', $zipTitle);
  245. $filename = LYCHEE_DATA . $zipTitle . '.zip';
  246. # Create zip
  247. $zip = new ZipArchive();
  248. if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE) {
  249. Log::error($this->database, __METHOD__, __LINE__, 'Could not create ZipArchive');
  250. return false;
  251. }
  252. # Execute query
  253. $photos = $this->database->query($photos);
  254. # Check if album empty
  255. if ($photos->num_rows==0) {
  256. Log::error($this->database, __METHOD__, __LINE__, 'Could not create ZipArchive without images');
  257. return false;
  258. }
  259. # Parse each path
  260. $files = array();
  261. while ($photo = $photos->fetch_object()) {
  262. # Parse url
  263. $photo->url = LYCHEE_UPLOADS_BIG . $photo->url;
  264. # Parse title
  265. $photo->title = str_replace($badChars, '', $photo->title);
  266. if (!isset($photo->title)||$photo->title==='') $photo->title = 'Untitled';
  267. # Check if readable
  268. if (!@is_readable($photo->url)) continue;
  269. # Get extension of image
  270. $extension = getExtension($photo->url);
  271. # Set title for photo
  272. $zipFileName = $zipTitle . '/' . $photo->title . $extension;
  273. # Check for duplicates
  274. if (!empty($files)) {
  275. $i = 1;
  276. while (in_array($zipFileName, $files)) {
  277. # Set new title for photo
  278. $zipFileName = $zipTitle . '/' . $photo->title . '-' . $i . $extension;
  279. $i++;
  280. }
  281. }
  282. # Add to array
  283. $files[] = $zipFileName;
  284. # Add photo to zip
  285. $zip->addFile($photo->url, $zipFileName);
  286. }
  287. # Finish zip
  288. $zip->close();
  289. # Send zip
  290. header("Content-Type: application/zip");
  291. header("Content-Disposition: attachment; filename=\"$zipTitle.zip\"");
  292. header("Content-Length: " . filesize($filename));
  293. readfile($filename);
  294. # Delete zip
  295. unlink($filename);
  296. # Call plugins
  297. $this->plugins(__METHOD__, 1, func_get_args());
  298. return true;
  299. }
  300. public function setTitle($title = 'Untitled') {
  301. # Check dependencies
  302. self::dependencies(isset($this->database, $this->albumIDs));
  303. # Call plugins
  304. $this->plugins(__METHOD__, 0, func_get_args());
  305. # Parse
  306. if (strlen($title)>50) $title = substr($title, 0, 50);
  307. # Execute query
  308. $query = Database::prepare($this->database, "UPDATE ? SET title = '?' WHERE id IN (?)", array(LYCHEE_TABLE_ALBUMS, $title, $this->albumIDs));
  309. $result = $this->database->query($query);
  310. # Call plugins
  311. $this->plugins(__METHOD__, 1, func_get_args());
  312. if (!$result) {
  313. Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
  314. return false;
  315. }
  316. return true;
  317. }
  318. public function setDescription($description = '') {
  319. # Check dependencies
  320. self::dependencies(isset($this->database, $this->albumIDs));
  321. # Call plugins
  322. $this->plugins(__METHOD__, 0, func_get_args());
  323. # Parse
  324. $description = htmlentities($description, ENT_COMPAT | ENT_HTML401, 'UTF-8');
  325. if (strlen($description)>1000) $description = substr($description, 0, 1000);
  326. # Execute query
  327. $query = Database::prepare($this->database, "UPDATE ? SET description = '?' WHERE id IN (?)", array(LYCHEE_TABLE_ALBUMS, $description, $this->albumIDs));
  328. $result = $this->database->query($query);
  329. # Call plugins
  330. $this->plugins(__METHOD__, 1, func_get_args());
  331. if (!$result) {
  332. Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
  333. return false;
  334. }
  335. return true;
  336. }
  337. public function getPublic() {
  338. # Check dependencies
  339. self::dependencies(isset($this->database, $this->albumIDs));
  340. # Call plugins
  341. $this->plugins(__METHOD__, 0, func_get_args());
  342. if ($this->albumIDs==='0'||$this->albumIDs==='s'||$this->albumIDs==='f') return false;
  343. # Execute query
  344. $query = Database::prepare($this->database, "SELECT public FROM ? WHERE id = '?' LIMIT 1", array(LYCHEE_TABLE_ALBUMS, $this->albumIDs));
  345. $albums = $this->database->query($query);
  346. $album = $albums->fetch_object();
  347. # Call plugins
  348. $this->plugins(__METHOD__, 1, func_get_args());
  349. if ($album->public==1) return true;
  350. return false;
  351. }
  352. public function getDownloadable() {
  353. # Check dependencies
  354. self::dependencies(isset($this->database, $this->albumIDs));
  355. # Call plugins
  356. $this->plugins(__METHOD__, 0, func_get_args());
  357. if ($this->albumIDs==='0'||$this->albumIDs==='s'||$this->albumIDs==='f'||$this->albumIDs==='r') return false;
  358. # Execute query
  359. $query = Database::prepare($this->database, "SELECT downloadable FROM ? WHERE id = '?' LIMIT 1", array(LYCHEE_TABLE_ALBUMS, $this->albumIDs));
  360. $albums = $this->database->query($query);
  361. $album = $albums->fetch_object();
  362. # Call plugins
  363. $this->plugins(__METHOD__, 1, func_get_args());
  364. if ($album->downloadable==1) return true;
  365. return false;
  366. }
  367. public function setPublic($password, $visible, $downloadable) {
  368. # Check dependencies
  369. self::dependencies(isset($this->database, $this->albumIDs));
  370. # Call plugins
  371. $this->plugins(__METHOD__, 0, func_get_args());
  372. # Get public
  373. $query = Database::prepare($this->database, "SELECT id, public FROM ? WHERE id IN (?)", array(LYCHEE_TABLE_ALBUMS, $this->albumIDs));
  374. $albums = $this->database->query($query);
  375. while ($album = $albums->fetch_object()) {
  376. # Invert public
  377. $public = ($album->public=='0' ? 1 : 0);
  378. # Convert visible
  379. $visible = ($visible==='true' ? 1 : 0);
  380. # Convert downloadable
  381. $downloadable = ($downloadable==='true' ? 1 : 0);
  382. # Set public
  383. $query = Database::prepare($this->database, "UPDATE ? SET public = '?', visible = '?', downloadable = '?', password = NULL WHERE id = '?'", array(LYCHEE_TABLE_ALBUMS, $public, $visible, $downloadable, $album->id));
  384. $result = $this->database->query($query);
  385. if (!$result) {
  386. Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
  387. return false;
  388. }
  389. # Reset permissions for photos
  390. if ($public===1) {
  391. $query = Database::prepare($this->database, "UPDATE ? SET public = 0 WHERE album = '?'", array(LYCHEE_TABLE_PHOTOS, $album->id));
  392. $result = $this->database->query($query);
  393. if (!$result) {
  394. Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
  395. return false;
  396. }
  397. }
  398. }
  399. # Call plugins
  400. $this->plugins(__METHOD__, 1, func_get_args());
  401. # Set password
  402. if (isset($password)&&strlen($password)>0) return $this->setPassword($password);
  403. return true;
  404. }
  405. private function setPassword($password) {
  406. # Check dependencies
  407. self::dependencies(isset($this->database, $this->albumIDs));
  408. # Call plugins
  409. $this->plugins(__METHOD__, 0, func_get_args());
  410. if (strlen($password)>0) {
  411. # Get hashed password
  412. $password = getHashedString($password);
  413. # Set hashed password
  414. # Do not prepare $password because it is hashed and save
  415. # Preparing (escaping) the password would destroy the hash
  416. $query = Database::prepare($this->database, "UPDATE ? SET password = '$password' WHERE id IN (?)", array(LYCHEE_TABLE_ALBUMS, $this->albumIDs));
  417. } else {
  418. # Unset password
  419. $query = Database::prepare($this->database, "UPDATE ? SET password = NULL WHERE id IN (?)", array(LYCHEE_TABLE_ALBUMS, $this->albumIDs));
  420. }
  421. # Execute query
  422. $result = $this->database->query($query);
  423. # Call plugins
  424. $this->plugins(__METHOD__, 1, func_get_args());
  425. if (!$result) {
  426. Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
  427. return false;
  428. }
  429. return true;
  430. }
  431. public function checkPassword($password) {
  432. # Check dependencies
  433. self::dependencies(isset($this->database, $this->albumIDs));
  434. # Call plugins
  435. $this->plugins(__METHOD__, 0, func_get_args());
  436. # Execute query
  437. $query = Database::prepare($this->database, "SELECT password FROM ? WHERE id = '?' LIMIT 1", array(LYCHEE_TABLE_ALBUMS, $this->albumIDs));
  438. $albums = $this->database->query($query);
  439. $album = $albums->fetch_object();
  440. # Call plugins
  441. $this->plugins(__METHOD__, 1, func_get_args());
  442. if ($album->password=='') return true;
  443. else if ($album->password===crypt($password, $album->password)) return true;
  444. return false;
  445. }
  446. public function delete() {
  447. # Check dependencies
  448. self::dependencies(isset($this->database, $this->albumIDs));
  449. # Call plugins
  450. $this->plugins(__METHOD__, 0, func_get_args());
  451. # Init vars
  452. $error = false;
  453. # Execute query
  454. $query = Database::prepare($this->database, "SELECT id FROM ? WHERE album IN (?)", array(LYCHEE_TABLE_PHOTOS, $this->albumIDs));
  455. $photos = $this->database->query($query);
  456. # For each album delete photo
  457. while ($row = $photos->fetch_object()) {
  458. $photo = new Photo($this->database, $this->plugins, null, $row->id);
  459. if (!$photo->delete($row->id)) $error = true;
  460. }
  461. # Delete albums
  462. $query = Database::prepare($this->database, "DELETE FROM ? WHERE id IN (?)", array(LYCHEE_TABLE_ALBUMS, $this->albumIDs));
  463. $result = $this->database->query($query);
  464. # Call plugins
  465. $this->plugins(__METHOD__, 1, func_get_args());
  466. if ($error) return false;
  467. if (!$result) {
  468. Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
  469. return false;
  470. }
  471. return true;
  472. }
  473. }
  474. ?>