]>
git.immae.eu Git - github/wallabag/wallabag.git/blob - inc/poche/Poche.class.php
39d43761f44cdaf0b5d2b9e18c8819148d5dc50e
3 * poche, a read it later open source system
6 * @author Nicolas LÅ“uillet <support@inthepoche.com>
8 * @license http://www.wtfpl.net/ see COPYING file
13 public static $canRenderTemplates = true ;
14 public static $configFileAvailable = true ;
22 private $currentTheme = '' ;
23 private $currentLanguage = '' ;
24 private $notInstalledMessage = array ();
26 # @todo make this dynamic (actually install themes and save them in the database including author information et cetera)
27 private $installedThemes = array (
28 'default' => array ( 'requires' => array ()),
29 'dark' => array ( 'requires' => array ( 'default' )),
30 'dmagenta' => array ( 'requires' => array ( 'default' )),
31 'solarized' => array ( 'requires' => array ( 'default' )),
32 'solarized-dark' => array ( 'requires' => array ( 'default' ))
35 public function __construct ()
37 if ( $this- > configFileIsAvailable ()) {
41 if ( $this- > themeIsInstalled ()) {
45 if ( $this- > systemIsInstalled ()) {
46 $this- > store
= new Database ();
47 $this- > messages
= new Messages ();
49 if (! $this- > store
-> isInstalled ()) {
55 private function init ()
58 Session
:: $sessionName = 'poche' ;
61 if ( isset ( $_SESSION [ 'poche_user' ]) && $_SESSION [ 'poche_user' ] != array ()) {
62 $this- > user
= $_SESSION [ 'poche_user' ];
64 # fake user, just for install & login screens
65 $this- > user
= new User ();
66 $this- > user
-> setConfig ( $this- > getDefaultConfig ());
70 $language = $this- > user
-> getConfigValue ( 'language' );
71 putenv ( 'LC_ALL=' . $language );
72 setlocale ( LC_ALL
, $language );
73 bindtextdomain ( $language , LOCALE
);
74 textdomain ( $language );
77 $this- > pagination
= new Paginator ( $this- > user
-> getConfigValue ( 'pager' ), 'p' );
80 $themeDirectory = $this- > user
-> getConfigValue ( 'theme' );
82 if ( $themeDirectory === false ) {
83 $themeDirectory = DEFAULT_THEME
;
86 $this- > currentTheme
= $themeDirectory ;
89 $languageDirectory = $this- > user
-> getConfigValue ( 'language' );
91 if ( $languageDirectory === false ) {
92 $languageDirectory = DEFAULT_THEME
;
95 $this- > currentLanguage
= $languageDirectory ;
98 public function configFileIsAvailable () {
99 if (! self
:: $configFileAvailable ) {
100 $this- > notInstalledMessage
[] = 'You have to rename inc/poche/config.inc.php.new to inc/poche/config.inc.php.' ;
108 public function themeIsInstalled () {
110 # Twig is an absolute requirement for Poche to function. Abort immediately if the Composer installer hasn't been run yet
111 if (! self
:: $canRenderTemplates ) {
112 $this- > notInstalledMessage
[] = 'Twig does not seem to be installed. Please initialize the Composer installation to automatically fetch dependencies. Have a look at <a href="http://doc.inthepoche.com/doku.php?id=users:begin:install">the documentation.</a>' ;
116 if (! is_writable ( CACHE
)) {
117 $this- > notInstalledMessage
[] = 'You don \' t have write access on cache directory.' ;
119 self
:: $canRenderTemplates = false ;
124 # Check if the selected theme and its requirements are present
125 if ( $this- > getTheme () != '' && ! is_dir ( THEME
. '/' . $this- > getTheme ())) {
126 $this- > notInstalledMessage
[] = 'The currently selected theme (' . $this- > getTheme () . ') does not seem to be properly installed (Missing directory: ' . THEME
. '/' . $this- > getTheme () . ')' ;
128 self
:: $canRenderTemplates = false ;
133 foreach ( $this- > installedThemes
[ $this- > getTheme ()][ 'requires' ] as $requiredTheme ) {
134 if (! is_dir ( THEME
. '/' . $requiredTheme )) {
135 $this- > notInstalledMessage
[] = 'The required "' . $requiredTheme . '" theme is missing for the current theme (' . $this- > getTheme () . ')' ;
137 self
:: $canRenderTemplates = false ;
152 * all checks before installation.
153 * @todo move HTML to template
156 public function systemIsInstalled ()
160 $configSalt = defined ( 'SALT' ) ? constant ( 'SALT' ) : '' ;
162 if ( empty ( $configSalt )) {
163 $this- > notInstalledMessage
[] = 'You have not yet filled in the SALT value in the config.inc.php file.' ;
166 if ( STORAGE
== 'sqlite' && ! file_exists ( STORAGE_SQLITE
)) {
167 Tools
:: logm ( 'sqlite file doesn \' t exist' );
168 $this- > notInstalledMessage
[] = 'sqlite file doesn \' t exist, you can find it in install folder. Copy it in /db folder.' ;
171 if ( is_dir ( ROOT
. '/install' ) && ! DEBUG_POCHE
) {
172 $this- > notInstalledMessage
[] = 'you have to delete the /install folder before using poche.' ;
175 if ( STORAGE
== 'sqlite' && ! is_writable ( STORAGE_SQLITE
)) {
176 Tools
:: logm ( 'you don \' t have write access on sqlite file' );
177 $this- > notInstalledMessage
[] = 'You don \' t have write access on sqlite file.' ;
188 public function getNotInstalledMessage () {
189 return $this- > notInstalledMessage
;
192 private function initTpl ()
194 $loaderChain = new Twig_Loader_Chain ();
196 # add the current theme as first to the loader chain so Twig will look there first for overridden template files
198 $loaderChain- > addLoader ( new Twig_Loader_Filesystem ( THEME
. '/' . $this- > getTheme ()));
199 } catch ( Twig_Error_Loader
$e ) {
200 # @todo isInstalled() should catch this, inject Twig later
201 die ( 'The currently selected theme (' . $this- > getTheme () . ') does not seem to be properly installed (' . THEME
. '/' . $this- > getTheme () . ' is missing)' );
204 # add all required themes to the loader chain
205 foreach ( $this- > installedThemes
[ $this- > getTheme ()][ 'requires' ] as $requiredTheme ) {
207 $loaderChain- > addLoader ( new Twig_Loader_Filesystem ( THEME
. '/' . DEFAULT_THEME
));
208 } catch ( Twig_Error_Loader
$e ) {
209 # @todo isInstalled() should catch this, inject Twig later
210 die ( 'The required "' . $requiredTheme . '" theme is missing for the current theme (' . $this- > getTheme () . ')' );
215 $twig_params = array ();
217 $twig_params = array ( 'cache' => CACHE
);
220 $this- > tpl
= new Twig_Environment ( $loaderChain , $twig_params );
221 $this- > tpl
-> addExtension ( new Twig_Extensions_Extension_I18n ());
223 # filter to display domain name of an url
224 $filter = new Twig_SimpleFilter ( 'getDomain' , 'Tools::getDomain' );
225 $this- > tpl
-> addFilter ( $filter );
227 # filter for reading time
228 $filter = new Twig_SimpleFilter ( 'getReadingTime' , 'Tools::getReadingTime' );
229 $this- > tpl
-> addFilter ( $filter );
231 # filter for simple filenames in config view
232 $filter = new Twig_SimpleFilter ( 'getPrettyFilename' , function ( $string ) { return str_replace ( ROOT
, '' , $
string ); });
233 $this- > tpl
-> addFilter ( $filter );
236 private function install ()
238 Tools
:: logm ( 'poche still not installed' );
239 echo $this- > tpl
-> render ( 'install.twig' , array (
240 'token' => Session
:: getToken (),
241 'theme' => $this- > getTheme (),
242 'poche_url' => Tools
:: getPocheUrl ()
244 if ( isset ( $_GET [ 'install' ])) {
245 if (( $_POST [ 'password' ] == $_POST [ 'password_repeat' ])
246 && $_POST [ 'password' ] != "" && $_POST [ 'login' ] != "" ) {
247 # let's rock, install poche baby !
248 if ( $this- > store
-> install ( $_POST [ 'login' ], Tools
:: encodeString ( $_POST [ 'password' ] . $_POST [ 'login' ])))
251 Tools
:: logm ( 'poche is now installed' );
256 Tools
:: logm ( 'error during installation' );
263 public function getTheme () {
264 return $this- > currentTheme
;
267 public function getLanguage () {
268 return $this- > currentLanguage
;
271 public function getInstalledThemes () {
272 $handle = opendir ( THEME
);
275 while (( $theme = readdir ( $handle )) !== false ) {
276 # Themes are stored in a directory, so all directory names are themes
277 # @todo move theme installation data to database
278 if (! is_dir ( THEME
. '/' . $theme ) || in_array ( $theme , array ( '..' , '.' ))) {
284 if ( $theme === $this- > getTheme ()) {
288 $themes [] = array ( 'name' => $theme , 'current' => $current );
295 public function getInstalledLanguages () {
296 $handle = opendir ( LOCALE
);
297 $languages = array ();
299 while (( $language = readdir ( $handle )) !== false ) {
300 # Languages are stored in a directory, so all directory names are languages
301 # @todo move language installation data to database
302 if (! is_dir ( LOCALE
. '/' . $language ) || in_array ( $language , array ( '..' , '.' ))) {
308 if ( $language === $this- > getLanguage ()) {
312 $languages [] = array ( 'name' => $language , 'current' => $current );
318 public function getDefaultConfig ()
321 'pager' => PAGINATION
,
323 'theme' => DEFAULT_THEME
328 * Call action (mark as fav, archive, delete, etc.)
330 public function action ( $action , Url
$url , $id = 0 , $import = FALSE )
335 $content = $url- > extract ();
337 if ( $this- > store
-> add ( $url- > getUrl (), $content [ 'title' ], $content [ 'body' ], $this- > user
-> getId ())) {
338 Tools
:: logm ( 'add link ' . $url- > getUrl ());
340 if ( STORAGE
== 'postgres' ) {
341 $sequence = 'entries_id_seq' ;
343 $last_id = $this- > store
-> getLastId ( $sequence );
344 if ( DOWNLOAD_PICTURES
) {
345 $content = filtre_picture ( $content [ 'body' ], $url- > getUrl (), $last_id );
346 Tools
:: logm ( 'updating content article' );
347 $this- > store
-> updateContent ( $last_id , $content , $this- > user
-> getId ());
350 $this- > messages
-> add ( 's' , _ ( 'the link has been added successfully' ));
355 $this- > messages
-> add ( 'e' , _ ( 'error during insertion : the link wasn \' t added' ));
356 Tools
:: logm ( 'error during insertion : the link wasn \' t added ' . $url- > getUrl ());
361 Tools
:: redirect ( '?view=home' );
365 $msg = 'delete link #' . $id ;
366 if ( $this- > store
-> deleteById ( $id , $this- > user
-> getId ())) {
367 if ( DOWNLOAD_PICTURES
) {
368 remove_directory ( ABS_PATH
. $id );
370 $this- > messages
-> add ( 's' , _ ( 'the link has been deleted successfully' ));
373 $this- > messages
-> add ( 'e' , _ ( 'the link wasn \' t deleted' ));
374 $msg = 'error : can \' t delete link #' . $id ;
377 Tools
:: redirect ( '?' );
380 $this- > store
-> favoriteById ( $id , $this- > user
-> getId ());
381 Tools
:: logm ( 'mark as favorite link #' . $id );
386 case 'toggle_archive' :
387 $this- > store
-> archiveById ( $id , $this- > user
-> getId ());
388 Tools
:: logm ( 'archive link #' . $id );
398 function displayView ( $view , $id = 0 )
405 $dev = $this- > getPocheVersion ( 'dev' );
406 $prod = $this- > getPocheVersion ( 'prod' );
407 $compare_dev = version_compare ( POCHE
, $dev );
408 $compare_prod = version_compare ( POCHE
, $prod );
409 $themes = $this- > getInstalledThemes ();
410 $languages = $this- > getInstalledLanguages ();
411 $http_auth = ( isset ( $_SERVER [ 'PHP_AUTH_USER' ]))? true : false ;
414 'languages' => $languages ,
417 'compare_dev' => $compare_dev ,
418 'compare_prod' => $compare_prod ,
419 'http_auth' => $http_auth ,
421 Tools
:: logm ( 'config view' );
424 $entry = $this- > store
-> retrieveOneById ( $id , $this- > user
-> getId ());
425 if ( $entry != NULL ) {
426 Tools
:: logm ( 'view link #' . $id );
427 $content = $entry [ 'content' ];
428 if ( function_exists ( 'tidy_parse_string' )) {
429 $tidy = tidy_parse_string ( $content , array ( 'indent' => true , 'show-body-only' => true ), 'UTF8' );
430 $tidy- > cleanRepair ();
431 $content = $tidy- > value
;
435 $flattr = new FlattrItem ();
436 $flattr- > checkItem ( $entry [ 'url' ], $entry [ 'id' ]);
440 'content' => $content ,
445 Tools
:: logm ( 'error in view call : entry is null' );
448 default : # home, favorites and archive views
449 $entries = $this- > store
-> getEntriesByView ( $view , $this- > user
-> getId ());
456 if ( count ( $entries ) > 0 ) {
457 $this- > pagination
-> set_total ( count ( $entries ));
458 $page_links = $this- > pagination
-> page_links ( '?view=' . $view . '&sort=' . $_SESSION [ 'sort' ] . '&' );
459 $datas = $this- > store
-> getEntriesByView ( $view , $this- > user
-> getId (), $this- > pagination
-> get_limit ());
460 $tpl_vars [ 'entries' ] = $datas ;
461 $tpl_vars [ 'page_links' ] = $page_links ;
462 $tpl_vars [ 'nb_results' ] = count ( $entries );
464 Tools
:: logm ( 'display ' . $view . ' view' );
472 * update the password of the current user.
473 * if MODE_DEMO is TRUE, the password can't be updated.
474 * @todo add the return value
475 * @todo set the new password in function header like this updatePassword($newPassword)
478 public function updatePassword ()
481 $this- > messages
-> add ( 'i' , _ ( 'in demo mode, you can \' t update your password' ));
482 Tools
:: logm ( 'in demo mode, you can \' t do this' );
483 Tools
:: redirect ( '?view=config' );
486 if ( isset ( $_POST [ 'password' ]) && isset ( $_POST [ 'password_repeat' ])) {
487 if ( $_POST [ 'password' ] == $_POST [ 'password_repeat' ] && $_POST [ 'password' ] != "" ) {
488 $this- > messages
-> add ( 's' , _ ( 'your password has been updated' ));
489 $this- > store
-> updatePassword ( $this- > user
-> getId (), Tools
:: encodeString ( $_POST [ 'password' ] . $this- > user
-> getUsername ()));
491 Tools
:: logm ( 'password updated' );
495 $this- > messages
-> add ( 'e' , _ ( 'the two fields have to be filled & the password must be the same in the two fields' ));
496 Tools
:: redirect ( '?view=config' );
502 public function updateTheme ()
505 if ( empty ( $_POST [ 'theme' ])) {
508 # we are not going to change it to the current theme...
509 if ( $_POST [ 'theme' ] == $this- > getTheme ()) {
510 $this- > messages
-> add ( 'w' , _ ( 'still using the "' . $this- > getTheme () . '" theme!' ));
511 Tools
:: redirect ( '?view=config' );
514 $themes = $this- > getInstalledThemes ();
515 $actualTheme = false ;
517 foreach ( $themes as $theme ) {
518 if ( $theme [ 'name' ] == $_POST [ 'theme' ]) {
524 if (! $actualTheme ) {
525 $this- > messages
-> add ( 'e' , _ ( 'that theme does not seem to be installed' ));
526 Tools
:: redirect ( '?view=config' );
529 $this- > store
-> updateUserConfig ( $this- > user
-> getId (), 'theme' , $_POST [ 'theme' ]);
530 $this- > messages
-> add ( 's' , _ ( 'you have changed your theme preferences' ));
532 $currentConfig = $_SESSION [ 'poche_user' ]-> config
;
533 $currentConfig [ 'theme' ] = $_POST [ 'theme' ];
535 $_SESSION [ 'poche_user' ]-> setConfig ( $currentConfig );
537 Tools
:: redirect ( '?view=config' );
540 public function updateLanguage ()
543 if ( empty ( $_POST [ 'language' ])) {
546 # we are not going to change it to the current language...
547 if ( $_POST [ 'language' ] == $this- > getLanguage ()) {
548 $this- > messages
-> add ( 'w' , _ ( 'still using the "' . $this- > getLanguage () . '" language!' ));
549 Tools
:: redirect ( '?view=config' );
552 $languages = $this- > getInstalledLanguages ();
553 $actualLanguage = false ;
555 foreach ( $languages as $language ) {
556 if ( $language [ 'name' ] == $_POST [ 'language' ]) {
557 $actualLanguage = true ;
562 if (! $actualLanguage ) {
563 $this- > messages
-> add ( 'e' , _ ( 'that language does not seem to be installed' ));
564 Tools
:: redirect ( '?view=config' );
567 $this- > store
-> updateUserConfig ( $this- > user
-> getId (), 'language' , $_POST [ 'language' ]);
568 $this- > messages
-> add ( 's' , _ ( 'you have changed your language preferences' ));
570 $currentConfig = $_SESSION [ 'poche_user' ]-> config
;
571 $currentConfig [ 'language' ] = $_POST [ 'language' ];
573 $_SESSION [ 'poche_user' ]-> setConfig ( $currentConfig );
575 Tools
:: redirect ( '?view=config' );
579 * get credentials from differents sources
580 * it redirects the user to the $referer link
583 private function credentials () {
584 if ( isset ( $_SERVER [ 'PHP_AUTH_USER' ])) {
585 return array ( $_SERVER [ 'PHP_AUTH_USER' ], 'php_auth' );
587 if (! empty ( $_POST [ 'login' ]) && ! empty ( $_POST [ 'password' ])) {
588 return array ( $_POST [ 'login' ], $_POST [ 'password' ]);
590 return array ( false , false );
594 * checks if login & password are correct and save the user in session.
595 * it redirects the user to the $referer link
596 * @param string $referer the url to redirect after login
597 * @todo add the return value
600 public function login ( $referer )
602 list ( $login , $password )= $this- > credentials ();
603 if ( $login === false || $password === false ) {
604 $this- > messages
-> add ( 'e' , _ ( 'login failed: you have to fill all fields' ));
605 Tools
:: logm ( 'login failed' );
608 if (! empty ( $login ) && ! empty ( $password )) {
609 $user = $this- > store
-> login ( $login , Tools
:: encodeString ( $password . $login ));
610 if ( $user != array ()) {
611 # Save login into Session
612 Session
:: login ( $user [ 'username' ], $user [ 'password' ], $login , Tools
:: encodeString ( $password . $login ), array ( 'poche_user' => new User ( $user )));
613 $this- > messages
-> add ( 's' , _ ( 'welcome to your poche' ));
614 Tools
:: logm ( 'login successful' );
615 Tools
:: redirect ( $referer );
617 $this- > messages
-> add ( 'e' , _ ( 'login failed: bad login or password' ));
618 Tools
:: logm ( 'login failed' );
624 * log out the poche user. It cleans the session.
625 * @todo add the return value
628 public function logout ()
630 $this- > user
= array ();
632 $this- > messages
-> add ( 's' , _ ( 'see you soon!' ));
633 Tools
:: logm ( 'logout' );
638 * import from Instapaper. poche needs a ./instapaper-export.html file
639 * @todo add the return value
640 * @param string $targetFile the file used for importing
643 private function importFromInstapaper ( $targetFile )
645 # TODO gestion des articles favs
646 $html = new simple_html_dom ();
647 $html- > load_file ( $targetFile );
648 Tools
:: logm ( 'starting import from instapaper' );
652 foreach ( $html- > find ( 'ol' ) as $ul )
654 foreach ( $ul- > find ( 'li' ) as $li )
657 $url = new Url ( base64_encode ( $a [ 0 ]-> href
));
658 $this- > action ( 'add' , $url , 0 , TRUE );
661 if ( STORAGE
== 'postgres' ) {
662 $sequence = 'entries_id_seq' ;
664 $last_id = $this- > store
-> getLastId ( $sequence );
665 $this- > action ( 'toggle_archive' , $url , $last_id , TRUE );
669 # the second <ol> is for read links
672 $this- > messages
-> add ( 's' , _ ( 'import from instapaper completed' ));
673 Tools
:: logm ( 'import from instapaper completed' );
678 * import from Pocket. poche needs a ./ril_export.html file
679 * @todo add the return value
680 * @param string $targetFile the file used for importing
683 private function importFromPocket ( $targetFile )
685 # TODO gestion des articles favs
686 $html = new simple_html_dom ();
687 $html- > load_file ( $targetFile );
688 Tools
:: logm ( 'starting import from pocket' );
692 foreach ( $html- > find ( 'ul' ) as $ul )
694 foreach ( $ul- > find ( 'li' ) as $li )
697 $url = new Url ( base64_encode ( $a [ 0 ]-> href
));
698 $this- > action ( 'add' , $url , 0 , TRUE );
701 if ( STORAGE
== 'postgres' ) {
702 $sequence = 'entries_id_seq' ;
704 $last_id = $this- > store
-> getLastId ( $sequence );
705 $this- > action ( 'toggle_archive' , $url , $last_id , TRUE );
709 # the second <ul> is for read links
712 $this- > messages
-> add ( 's' , _ ( 'import from pocket completed' ));
713 Tools
:: logm ( 'import from pocket completed' );
718 * import from Readability. poche needs a ./readability file
719 * @todo add the return value
720 * @param string $targetFile the file used for importing
723 private function importFromReadability ( $targetFile )
725 # TODO gestion des articles lus / favs
726 $str_data = file_get_contents ( $targetFile );
727 $data = json_decode ( $str_data , true );
728 Tools
:: logm ( 'starting import from Readability' );
730 foreach ( $data as $key => $value ) {
734 foreach ( $value as $attr => $attr_value ) {
735 if ( $attr == 'article__url' ) {
736 $url = new Url ( base64_encode ( $attr_value ));
739 if ( STORAGE
== 'postgres' ) {
740 $sequence = 'entries_id_seq' ;
742 if ( $attr_value == 'true' ) {
743 if ( $attr == 'favorite' ) {
746 if ( $attr == 'archive' ) {
752 if (! is_null ( $url ) && $url- > isCorrect ()) {
753 $this- > action ( 'add' , $url , 0 , TRUE );
756 $last_id = $this- > store
-> getLastId ( $sequence );
757 $this- > action ( 'toggle_fav' , $url , $last_id , TRUE );
760 $last_id = $this- > store
-> getLastId ( $sequence );
761 $this- > action ( 'toggle_archive' , $url , $last_id , TRUE );
765 $this- > messages
-> add ( 's' , _ ( 'import from Readability completed. ' . $count . ' new links.' ));
766 Tools
:: logm ( 'import from Readability completed' );
771 * import datas into your poche
772 * @param string $from name of the service to import : pocket, instapaper or readability
773 * @todo add the return value
776 public function import ( $from )
779 'pocket' => 'importFromPocket' ,
780 'readability' => 'importFromReadability' ,
781 'instapaper' => 'importFromInstapaper'
784 if (! isset ( $providers [ $from ])) {
785 $this- > messages
-> add ( 'e' , _ ( 'Unknown import provider.' ));
789 $targetDefinition = 'IMPORT_' . strtoupper ( $from ) . '_FILE' ;
790 $targetFile = constant ( $targetDefinition );
792 if (! defined ( $targetDefinition )) {
793 $this- > messages
-> add ( 'e' , _ ( 'Incomplete inc/poche/define.inc.php file, please define "' . $targetDefinition . '".' ));
797 if (! file_exists ( $targetFile )) {
798 $this- > messages
-> add ( 'e' , _ ( 'Could not find required "' . $targetFile . '" import file.' ));
802 $this- > $providers [ $from ]( $targetFile );
806 * export poche entries in json
807 * @return json all poche entries
809 public function export ()
811 $entries = $this- > store
-> retrieveAll ( $this- > user
-> getId ());
812 echo $this- > tpl
-> render ( 'export.twig' , array (
813 'export' => Tools
:: renderJson ( $entries ),
815 Tools
:: logm ( 'export view' );
819 * Checks online the latest version of poche and cache it
820 * @param string $which 'prod' or 'dev'
821 * @return string latest $which version
823 private function getPocheVersion ( $which = 'prod' )
825 $cache_file = CACHE
. '/' . $which ;
827 # checks if the cached version file exists
828 if ( file_exists ( $cache_file ) && ( filemtime ( $cache_file ) > ( time () - 86400 ))) {
829 $version = file_get_contents ( $cache_file );
831 $version = file_get_contents ( 'http://static.inthepoche.com/versions/' . $which );
832 file_put_contents ( $cache_file , $version , LOCK_EX
);