Album.php 19 KB

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