Album.php 19 KB

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