4
0

Entry.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  1. <?php
  2. class Entry extends Model {
  3. private $id = null;
  4. private $guid;
  5. private $title;
  6. private $author;
  7. private $content;
  8. private $link;
  9. private $date;
  10. private $is_read;
  11. private $is_favorite;
  12. private $is_public;
  13. private $feed;
  14. private $tags;
  15. private $notes;
  16. private $lastUpdate;
  17. public function __construct ($feed = '', $guid = '', $title = '', $author = '', $content = '',
  18. $link = '', $pubdate = 0, $is_read = false, $is_favorite = false,
  19. $is_public = false) {
  20. $this->_guid ($guid);
  21. $this->_title ($title);
  22. $this->_author ($author);
  23. $this->_content ($content);
  24. $this->_link ($link);
  25. $this->_date ($pubdate);
  26. $this->_isRead ($is_read);
  27. $this->_isFavorite ($is_favorite);
  28. $this->_isPublic ($is_public);
  29. $this->_feed ($feed);
  30. $this->_lastUpdate ($pubdate);
  31. $this->_notes ('');
  32. $this->_tags (array ());
  33. }
  34. public function id () {
  35. if(is_null($this->id)) {
  36. return small_hash ($this->guid . Configuration::selApplication ());
  37. } else {
  38. return $this->id;
  39. }
  40. }
  41. public function guid () {
  42. return $this->guid;
  43. }
  44. public function title () {
  45. return $this->title;
  46. }
  47. public function author () {
  48. if (is_null ($this->author)) {
  49. return '';
  50. } else {
  51. return $this->author;
  52. }
  53. }
  54. public function content () {
  55. return $this->content;
  56. }
  57. public function link () {
  58. return $this->link;
  59. }
  60. public function date ($raw = false) {
  61. if ($raw) {
  62. return $this->date;
  63. } else {
  64. return timestamptodate ($this->date);
  65. }
  66. }
  67. public function isRead () {
  68. return $this->is_read;
  69. }
  70. public function isFavorite () {
  71. return $this->is_favorite;
  72. }
  73. public function isPublic () {
  74. return $this->is_public;
  75. }
  76. public function feed ($object = false) {
  77. if ($object) {
  78. $feedDAO = new FeedDAO ();
  79. return $feedDAO->searchById ($this->feed);
  80. } else {
  81. return $this->feed;
  82. }
  83. }
  84. public function tags ($inString = false) {
  85. if ($inString) {
  86. if (!empty ($this->tags)) {
  87. return '#' . implode(' #', $this->tags);
  88. } else {
  89. return '';
  90. }
  91. } else {
  92. return $this->tags;
  93. }
  94. }
  95. public function notes ($raw = true, $parse_tags = true) {
  96. if ($raw) {
  97. return $this->notes;
  98. } else {
  99. if($parse_tags) {
  100. return parse_tags (bbdecode ($this->notes));
  101. } else {
  102. return bbdecode ($this->notes);
  103. }
  104. }
  105. }
  106. public function lastUpdate ($raw = false) {
  107. if ($raw) {
  108. return $this->lastUpdate;
  109. } else {
  110. return timestamptodate ($this->lastUpdate);
  111. }
  112. }
  113. public function _id ($value) {
  114. $this->id = $value;
  115. }
  116. public function _guid ($value) {
  117. $this->guid = $value;
  118. }
  119. public function _title ($value) {
  120. $this->title = $value;
  121. }
  122. public function _author ($value) {
  123. $this->author = $value;
  124. }
  125. public function _content ($value) {
  126. $this->content = $value;
  127. }
  128. public function _link ($value) {
  129. $this->link = $value;
  130. }
  131. public function _date ($value) {
  132. if (is_int (intval ($value))) {
  133. $this->date = $value;
  134. } else {
  135. $this->date = time ();
  136. }
  137. }
  138. public function _isRead ($value) {
  139. $this->is_read = $value;
  140. }
  141. public function _isFavorite ($value) {
  142. $this->is_favorite = $value;
  143. }
  144. public function _isPublic ($value) {
  145. $this->is_public = $value;
  146. }
  147. public function _feed ($value) {
  148. $this->feed = $value;
  149. }
  150. public function _tags ($value) {
  151. if (!is_array ($value)) {
  152. $value = array ($value);
  153. }
  154. foreach ($value as $key => $t) {
  155. if (!$t) {
  156. unset ($value[$key]);
  157. }
  158. }
  159. $this->tags = $value;
  160. }
  161. public function _notes ($value) {
  162. $this->notes = $value;
  163. }
  164. public function _lastUpdate ($value) {
  165. if (is_int (intval ($value))) {
  166. $this->lastUpdate = $value;
  167. } else {
  168. $this->lastUpdate = $this->date (true);
  169. }
  170. }
  171. public function isDay ($day) {
  172. $date = getdate ();
  173. $today = mktime (0, 0, 0, $date['mon'], $date['mday'], $date['year']);
  174. $yesterday = $today - 86400;
  175. if ($day == Days::TODAY &&
  176. $this->date >= $today && $this->date < $today + 86400) {
  177. return true;
  178. } elseif ($day == Days::YESTERDAY &&
  179. $this->date >= $yesterday && $this->date < $yesterday + 86400) {
  180. return true;
  181. } elseif ($day == Days::BEFORE_YESTERDAY && $this->date < $yesterday) {
  182. return true;
  183. } else {
  184. return false;
  185. }
  186. }
  187. public function toArray () {
  188. return array (
  189. 'id' => $this->id (),
  190. 'guid' => $this->guid (),
  191. 'title' => $this->title (),
  192. 'author' => $this->author (),
  193. 'content' => $this->content (),
  194. 'link' => $this->link (),
  195. 'date' => $this->date (true),
  196. 'is_read' => $this->isRead (),
  197. 'is_favorite' => $this->isFavorite (),
  198. 'is_public' => $this->isPublic (),
  199. 'id_feed' => $this->feed (),
  200. 'lastUpdate' => $this->lastUpdate (true),
  201. 'tags' => $this->tags (true),
  202. 'annotation' => $this->notes ()
  203. );
  204. }
  205. }
  206. class EntryDAO extends Model_pdo {
  207. public function addEntry ($valuesTmp) {
  208. $sql = 'INSERT INTO entry(id, guid, title, author, content, link, date, is_read, is_favorite, is_public, id_feed, lastUpdate) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
  209. $stm = $this->bd->prepare ($sql);
  210. $values = array (
  211. $valuesTmp['id'],
  212. $valuesTmp['guid'],
  213. $valuesTmp['title'],
  214. $valuesTmp['author'],
  215. base64_encode (gzdeflate (serialize ($valuesTmp['content']))),
  216. $valuesTmp['link'],
  217. $valuesTmp['date'],
  218. $valuesTmp['is_read'],
  219. $valuesTmp['is_favorite'],
  220. $valuesTmp['is_public'],
  221. $valuesTmp['id_feed'],
  222. $valuesTmp['lastUpdate'],
  223. );
  224. if ($stm && $stm->execute ($values)) {
  225. return true;
  226. } else {
  227. $info = $stm->errorInfo();
  228. Log::record ('SQL error : ' . $info[2], Log::ERROR);
  229. return false;
  230. }
  231. }
  232. public function updateEntry ($id, $valuesTmp) {
  233. if (isset ($valuesTmp['content'])) {
  234. $valuesTmp['content'] = base64_encode (gzdeflate (serialize ($valuesTmp['content'])));
  235. }
  236. $set = '';
  237. foreach ($valuesTmp as $key => $v) {
  238. $set .= $key . '=?, ';
  239. }
  240. $set = substr ($set, 0, -2);
  241. $sql = 'UPDATE entry SET ' . $set . ' WHERE id=?';
  242. $stm = $this->bd->prepare ($sql);
  243. foreach ($valuesTmp as $v) {
  244. $values[] = $v;
  245. }
  246. $values[] = $id;
  247. if ($stm && $stm->execute ($values)) {
  248. return true;
  249. } else {
  250. $info = $stm->errorInfo();
  251. Log::record ('SQL error : ' . $info[2], Log::ERROR);
  252. return false;
  253. }
  254. }
  255. public function markReadEntries ($read, $dateMax) {
  256. $sql = 'UPDATE entry e INNER JOIN feed f ON e.id_feed = f.id SET is_read = ? WHERE date < ? AND priority > 0';
  257. $stm = $this->bd->prepare ($sql);
  258. $values = array ($read, $dateMax);
  259. if ($stm && $stm->execute ($values)) {
  260. return true;
  261. } else {
  262. $info = $stm->errorInfo();
  263. Log::record ('SQL error : ' . $info[2], Log::ERROR);
  264. return false;
  265. }
  266. }
  267. public function markReadCat ($id, $read, $dateMax) {
  268. $sql = 'UPDATE entry e INNER JOIN feed f ON e.id_feed = f.id SET is_read = ? WHERE category = ? AND date < ?';
  269. $stm = $this->bd->prepare ($sql);
  270. $values = array ($read, $id, $dateMax);
  271. if ($stm && $stm->execute ($values)) {
  272. return true;
  273. } else {
  274. $info = $stm->errorInfo();
  275. Log::record ('SQL error : ' . $info[2], Log::ERROR);
  276. return false;
  277. }
  278. }
  279. public function markReadFeed ($id, $read, $dateMax) {
  280. $sql = 'UPDATE entry SET is_read = ? WHERE id_feed = ? AND date < ?';
  281. $stm = $this->bd->prepare ($sql);
  282. $values = array ($read, $id, $dateMax);
  283. if ($stm && $stm->execute ($values)) {
  284. return true;
  285. } else {
  286. $info = $stm->errorInfo();
  287. Log::record ('SQL error : ' . $info[2], Log::ERROR);
  288. return false;
  289. }
  290. }
  291. public function updateEntries ($valuesTmp) {
  292. if (isset ($valuesTmp['content'])) {
  293. $valuesTmp['content'] = base64_encode (gzdeflate (serialize ($valuesTmp['content'])));
  294. }
  295. $set = '';
  296. foreach ($valuesTmp as $key => $v) {
  297. $set .= $key . '=?, ';
  298. }
  299. $set = substr ($set, 0, -2);
  300. $sql = 'UPDATE entry SET ' . $set;
  301. $stm = $this->bd->prepare ($sql);
  302. foreach ($valuesTmp as $v) {
  303. $values[] = $v;
  304. }
  305. if ($stm && $stm->execute ($values)) {
  306. return true;
  307. } else {
  308. $info = $stm->errorInfo();
  309. Log::record ('SQL error : ' . $info[2], Log::ERROR);
  310. return false;
  311. }
  312. }
  313. public function cleanOldEntries ($nb_month) {
  314. $date = 60 * 60 * 24 * 30 * $nb_month;
  315. $sql = 'DELETE FROM entry WHERE date <= ? AND is_favorite = 0 AND annotation = ""';
  316. $stm = $this->bd->prepare ($sql);
  317. $values = array (
  318. time () - $date
  319. );
  320. if ($stm && $stm->execute ($values)) {
  321. return true;
  322. } else {
  323. $info = $stm->errorInfo();
  324. Log::record ('SQL error : ' . $info[2], Log::ERROR);
  325. return false;
  326. }
  327. }
  328. public function searchById ($id) {
  329. $sql = 'SELECT * FROM entry WHERE id=?';
  330. $stm = $this->bd->prepare ($sql);
  331. $values = array ($id);
  332. $stm->execute ($values);
  333. $res = $stm->fetchAll (PDO::FETCH_ASSOC);
  334. $entry = HelperEntry::daoToEntry ($res);
  335. if (isset ($entry[0])) {
  336. return $entry[0];
  337. } else {
  338. return false;
  339. }
  340. }
  341. public function listEntries ($mode, $search = false, $order = 'high_to_low') {
  342. $where = ' WHERE priority > 0';
  343. if ($mode == 'not_read') {
  344. $where .= ' AND is_read=0';
  345. }
  346. $values = array();
  347. if ($search) {
  348. $values[] = '%'.$search.'%';
  349. $where .= ' AND title LIKE ?';
  350. }
  351. if ($order == 'low_to_high') {
  352. $order = ' DESC';
  353. } else {
  354. $order = '';
  355. }
  356. $sql = 'SELECT COUNT(*) AS count FROM entry e INNER JOIN feed f ON e.id_feed = f.id' . $where;
  357. $stm = $this->bd->prepare ($sql);
  358. $stm->execute ($values);
  359. $res = $stm->fetchAll (PDO::FETCH_ASSOC);
  360. $this->nbItems = $res[0]['count'];
  361. $deb = ($this->currentPage () - 1) * $this->nbItemsPerPage;
  362. $fin = $this->nbItemsPerPage;
  363. $sql = 'SELECT e.* FROM entry e'
  364. . ' INNER JOIN feed f ON e.id_feed = f.id' . $where
  365. . ' ORDER BY date' . $order
  366. . ' LIMIT ' . $deb . ', ' . $fin;
  367. $stm = $this->bd->prepare ($sql);
  368. $stm->execute ($values);
  369. return HelperEntry::daoToEntry ($stm->fetchAll (PDO::FETCH_ASSOC));
  370. }
  371. public function listFavorites ($mode, $search = false, $order = 'high_to_low') {
  372. $where = ' WHERE is_favorite=1';
  373. if ($mode == 'not_read') {
  374. $where .= ' AND is_read=0';
  375. }
  376. $values = array();
  377. if ($search) {
  378. $values[] = '%'.$search.'%';
  379. $where .= ' AND title LIKE ?';
  380. }
  381. if ($order == 'low_to_high') {
  382. $order = ' DESC';
  383. } else {
  384. $order = '';
  385. }
  386. $sql = 'SELECT COUNT(*) AS count FROM entry' . $where;
  387. $stm = $this->bd->prepare ($sql);
  388. $stm->execute ($values);
  389. $res = $stm->fetchAll (PDO::FETCH_ASSOC);
  390. $this->nbItems = $res[0]['count'];
  391. if($this->nbItemsPerPage < 0) {
  392. $sql = 'SELECT * FROM entry' . $where
  393. . ' ORDER BY date' . $order;
  394. } else {
  395. $deb = ($this->currentPage () - 1) * $this->nbItemsPerPage;
  396. $fin = $this->nbItemsPerPage;
  397. $sql = 'SELECT * FROM entry' . $where
  398. . ' ORDER BY date' . $order
  399. . ' LIMIT ' . $deb . ', ' . $fin;
  400. }
  401. $stm = $this->bd->prepare ($sql);
  402. $stm->execute ($values);
  403. return HelperEntry::daoToEntry ($stm->fetchAll (PDO::FETCH_ASSOC));
  404. }
  405. public function listPublic ($mode, $search = false, $order = 'high_to_low') {
  406. $where = ' WHERE is_public=1';
  407. if ($mode == 'not_read') {
  408. $where .= ' AND is_read=0';
  409. }
  410. $values = array();
  411. if ($search) {
  412. $values[] = '%'.$search.'%';
  413. $where .= ' AND title LIKE ?';
  414. }
  415. if ($order == 'low_to_high') {
  416. $order = ' DESC';
  417. } else {
  418. $order = '';
  419. }
  420. $sql = 'SELECT COUNT(*) AS count FROM entry' . $where;
  421. $stm = $this->bd->prepare ($sql);
  422. $stm->execute ($values);
  423. $res = $stm->fetchAll (PDO::FETCH_ASSOC);
  424. $this->nbItems = $res[0]['count'];
  425. if($this->nbItemsPerPage < 0) {
  426. $sql = 'SELECT * FROM entry' . $where
  427. . ' ORDER BY date' . $order;
  428. } else {
  429. $deb = ($this->currentPage () - 1) * $this->nbItemsPerPage;
  430. $fin = $this->nbItemsPerPage;
  431. $sql = 'SELECT * FROM entry' . $where
  432. . ' ORDER BY date' . $order
  433. . ' LIMIT ' . $deb . ', ' . $fin;
  434. }
  435. $stm = $this->bd->prepare ($sql);
  436. $stm->execute ($values);
  437. return HelperEntry::daoToEntry ($stm->fetchAll (PDO::FETCH_ASSOC));
  438. }
  439. public function listByCategory ($cat, $mode, $search = false, $order = 'high_to_low') {
  440. $where = ' WHERE category=?';
  441. if ($mode == 'not_read') {
  442. $where .= ' AND is_read=0';
  443. }
  444. $values = array ($cat);
  445. if ($search) {
  446. $values[] = '%'.$search.'%';
  447. $where .= ' AND title LIKE ?';
  448. }
  449. if ($order == 'low_to_high') {
  450. $order = ' DESC';
  451. } else {
  452. $order = '';
  453. }
  454. $sql = 'SELECT COUNT(*) AS count FROM entry e INNER JOIN feed f ON e.id_feed = f.id' . $where;
  455. $stm = $this->bd->prepare ($sql);
  456. $stm->execute ($values);
  457. $res = $stm->fetchAll (PDO::FETCH_ASSOC);
  458. $this->nbItems = $res[0]['count'];
  459. $deb = ($this->currentPage () - 1) * $this->nbItemsPerPage;
  460. $fin = $this->nbItemsPerPage;
  461. $sql = 'SELECT e.* FROM entry e INNER JOIN feed f ON e.id_feed = f.id' . $where
  462. . ' ORDER BY date' . $order
  463. . ' LIMIT ' . $deb . ', ' . $fin;
  464. $stm = $this->bd->prepare ($sql);
  465. $stm->execute ($values);
  466. return HelperEntry::daoToEntry ($stm->fetchAll (PDO::FETCH_ASSOC));
  467. }
  468. public function listByFeed ($feed, $mode, $search = false, $order = 'high_to_low') {
  469. $where = ' WHERE id_feed=?';
  470. if ($mode == 'not_read') {
  471. $where .= ' AND is_read=0';
  472. }
  473. $values = array($feed);
  474. if ($search) {
  475. $values[] = '%'.$search.'%';
  476. $where .= ' AND title LIKE ?';
  477. }
  478. if ($order == 'low_to_high') {
  479. $order = ' DESC';
  480. } else {
  481. $order = '';
  482. }
  483. $sql = 'SELECT COUNT(*) AS count FROM entry' . $where;
  484. $stm = $this->bd->prepare ($sql);
  485. $stm->execute ($values);
  486. $res = $stm->fetchAll (PDO::FETCH_ASSOC);
  487. $this->nbItems = $res[0]['count'];
  488. $deb = ($this->currentPage () - 1) * $this->nbItemsPerPage;
  489. $fin = $this->nbItemsPerPage;
  490. $sql = 'SELECT * FROM entry e' . $where
  491. . ' ORDER BY date' . $order
  492. . ' LIMIT ' . $deb . ', ' . $fin;
  493. $stm = $this->bd->prepare ($sql);
  494. $stm->execute ($values);
  495. return HelperEntry::daoToEntry ($stm->fetchAll (PDO::FETCH_ASSOC));
  496. }
  497. public function count () {
  498. $sql = 'SELECT COUNT(*) AS count FROM entry e INNER JOIN feed f ON e.id_feed = f.id WHERE priority > 0';
  499. $stm = $this->bd->prepare ($sql);
  500. $stm->execute ();
  501. $res = $stm->fetchAll (PDO::FETCH_ASSOC);
  502. return $res[0]['count'];
  503. }
  504. public function countNotRead () {
  505. $sql = 'SELECT COUNT(*) AS count FROM entry e INNER JOIN feed f ON e.id_feed = f.id WHERE is_read=0 AND priority > 0';
  506. $stm = $this->bd->prepare ($sql);
  507. $stm->execute ();
  508. $res = $stm->fetchAll (PDO::FETCH_ASSOC);
  509. return $res[0]['count'];
  510. }
  511. public function countNotReadByFeed ($id) {
  512. $sql = 'SELECT COUNT(*) AS count FROM entry WHERE is_read = 0 AND id_feed = ?';
  513. $stm = $this->bd->prepare ($sql);
  514. $stm->execute (array ($id));
  515. $res = $stm->fetchAll (PDO::FETCH_ASSOC);
  516. return $res[0]['count'];
  517. }
  518. public function countNotReadByCat ($id) {
  519. $sql = 'SELECT COUNT(*) AS count FROM entry e INNER JOIN feed f ON e.id_feed = f.id WHERE is_read=0 AND category = ?';
  520. $stm = $this->bd->prepare ($sql);
  521. $stm->execute (array ($id));
  522. $res = $stm->fetchAll (PDO::FETCH_ASSOC);
  523. return $res[0]['count'];
  524. }
  525. public function countNotReadFavorites () {
  526. $sql = 'SELECT COUNT(*) AS count FROM entry WHERE is_read=0 AND is_favorite=1';
  527. $stm = $this->bd->prepare ($sql);
  528. $stm->execute ();
  529. $res = $stm->fetchAll (PDO::FETCH_ASSOC);
  530. return $res[0]['count'];
  531. }
  532. public function countFavorites () {
  533. $sql = 'SELECT COUNT(*) AS count FROM entry WHERE is_favorite=1';
  534. $stm = $this->bd->prepare ($sql);
  535. $stm->execute ();
  536. $res = $stm->fetchAll (PDO::FETCH_ASSOC);
  537. return $res[0]['count'];
  538. }
  539. // gestion de la pagination directement via le DAO
  540. private $nbItemsPerPage = 1;
  541. private $currentPage = 1;
  542. private $nbItems = 0;
  543. public function _nbItemsPerPage ($value) {
  544. $this->nbItemsPerPage = $value;
  545. }
  546. public function _currentPage ($value) {
  547. $this->currentPage = $value;
  548. }
  549. public function currentPage () {
  550. if ($this->currentPage < 1) {
  551. return 1;
  552. }
  553. $maxPage = ceil ($this->nbItems / $this->nbItemsPerPage);
  554. if ($this->currentPage > $maxPage) {
  555. return $maxPage;
  556. }
  557. return $this->currentPage;
  558. }
  559. public function getPaginator ($entries) {
  560. $paginator = new Paginator ($entries);
  561. $paginator->_nbItems ($this->nbItems);
  562. $paginator->_nbItemsPerPage ($this->nbItemsPerPage);
  563. $paginator->_currentPage ($this->currentPage ());
  564. return $paginator;
  565. }
  566. }
  567. class HelperEntry {
  568. public static function daoToEntry ($listDAO, $mode = 'all', $favorite = false) {
  569. $list = array ();
  570. if (!is_array ($listDAO)) {
  571. $listDAO = array ($listDAO);
  572. }
  573. foreach ($listDAO as $key => $dao) {
  574. $list[$key] = new Entry (
  575. $dao['id_feed'],
  576. $dao['guid'],
  577. $dao['title'],
  578. $dao['author'],
  579. unserialize (gzinflate (base64_decode ($dao['content']))),
  580. $dao['link'],
  581. $dao['date'],
  582. $dao['is_read'],
  583. $dao['is_favorite'],
  584. $dao['is_public']
  585. );
  586. $tags = preg_split('/[\s#]/', $dao['tags']);
  587. $list[$key]->_notes ($dao['annotation']);
  588. $list[$key]->_lastUpdate ($dao['lastUpdate']);
  589. $list[$key]->_tags ($tags);
  590. if (isset ($dao['id'])) {
  591. $list[$key]->_id ($dao['id']);
  592. }
  593. }
  594. return $list;
  595. }
  596. }