Play images and video from Synology PhotoStation server

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <?PHP
  2. require_once('info.inc.php');
  3. class InfoAPI extends WebAPI {
  4. function __construct() {
  5. parent::__construct(SZ_WEBAPI_API_DESCRIPTION_PATH);
  6. }
  7. protected function Process() {
  8. if (!strcasecmp($this->method, "getinfo")) {
  9. $this->GetInfo();
  10. // $this->CheckShareId();
  11. }
  12. }
  13. private function CheckShareId()
  14. {
  15. $PHP_BIN = "/usr/bin/php";
  16. $PHP_PARAMETER = "-n -d extension=pdo.so -d extension=pdo_pgsql.so -d extension=pdo_sqlite.so";
  17. $SHARE_ID_UPDATE_PHP = SYNO_PKG_DIR."/target/photo_scripts/update_photo_share.php";
  18. $cmd = sprintf("%s %s %s '%s' >/dev/null &", $PHP_BIN, $PHP_PARAMETER, $SHARE_ID_UPDATE_PHP, SYNOPHOTO_ADMIN_NAME);
  19. system($cmd);
  20. }
  21. private function GetInfo() {
  22. $resp = array();
  23. // get version
  24. $resp['version'] = '2965';
  25. // get PhotoStation title
  26. $resp['title'] = trim(csSYNOPhotoMisc::GetConfigDB("photo", "photo_page_title", "photo_config"));
  27. // get about_me title
  28. $value = csSYNOPhotoMisc::GetConfigDB("photo", "about_me_title", "photo_config");
  29. $resp['about_me_title'] = $value ? $value : __(photo_str_category_about_me);
  30. // get root album sort_by
  31. $value = csSYNOPhotoMisc::GetConfigDB("album", "thumb_sort_type", "photo_config");
  32. $resp['sort_by'] = 'filename';
  33. if ('0' === $value) {
  34. $resp['sort_by'] = 'filename';
  35. } elseif ('1' === $value) {
  36. $resp['sort_by'] = 'takendate';
  37. } elseif ('2' === $value) {
  38. $resp['sort_by'] = 'createdate';
  39. }
  40. // get root album sort_direction
  41. $value = csSYNOPhotoMisc::GetConfigDB("album", "thumb_sort_order", "photo_config");
  42. $resp['sort_direction'] = ('1' === $value) ? 'desc' : 'asc';
  43. // get use album explorer setting
  44. $value = csSYNOPhotoMisc::GetConfigDB("album", "use_album_explorer", "photo_config");
  45. $resp['use_album_explorer'] = 'off' !== $value; //return "on" by default
  46. // get paging setting
  47. $value = csSYNOPhotoMisc::GetConfigDB("album", "paging_use_bar", "photo_config");
  48. $resp['paging_use_bar'] = 'off' !== $value; //return "on" by default
  49. $value = intval(csSYNOPhotoMisc::GetConfigDB("album", "paging_item_count", "photo_config"));
  50. $resp['paging_item_count'] = ($value >= 50 && $value <= 500) ? $value : 50;
  51. // get folder sort direction
  52. $value = csSYNOPhotoMisc::GetConfigDB("album", "album_order_type_is_desc", "photo_config");
  53. $resp['folder_sort_direction'] = ("1" === $value) ? 'desc' : 'asc';
  54. // get allow downoload original photo
  55. /*
  56. $value = csSYNOPhotoMisc::GetConfigDB("photo", "allow_orig", "photo_config");
  57. $resp['allow_download_orig'] = ('on' === $value) ? true : false;
  58. */
  59. // get allow download album
  60. $value = csSYNOPhotoDB::GetDBInstance()->GetConfig('photo', 'allow_album_download');
  61. $resp['allow_download_album'] = ('on' === $value) ? true : false;
  62. // #2253 - reserve these two key for compatibility with DS photo+ which is using webapi already
  63. $resp['allow_download_orig'] = $resp['allow_download_album'];
  64. $resp['allow_download_video'] = $resp['allow_download_album'];
  65. // get allow download video
  66. /*
  67. $value = csSYNOPhotoMisc::GetConfigDB('photo', 'allow_video_download', 'photo_config');
  68. $resp['allow_download_video'] = ('on' === $value) ? true : false;
  69. */
  70. // get disable right button
  71. $value = csSYNOPhotoMisc::GetConfigDB('photo', 'disable_right_button', 'photo_config');
  72. $resp['disable_right_button'] = ('on' === $value) ? true : false;
  73. // get allow search
  74. $value = csSYNOPhotoMisc::GetConfigDB("photo", "hide_search", "photo_config");
  75. $resp['hide_search'] = ('on' === $value) ? true : false;
  76. // get hide gps info from normal user
  77. $value = csSYNOPhotoMisc::GetConfigDB("photo", "hide_gps_from_normal_user", "photo_config");
  78. $resp['hide_gps_from_normal_user'] = ('on' === $value) ? true : false;
  79. // get allow rss feed
  80. $value = csSYNOPhotoMisc::GetConfigDB("photo", "hide_rss_feed", "photo_config");
  81. $resp['hide_rss_feed'] = ('on' === $value) ? true : false;
  82. // get enable blog
  83. $resp['enable_blog'] = csSYNOPhotoMisc::IsBlogEnabled();
  84. $resp['external_host'] = csSYNOPhotoMisc::GetServerHost();
  85. $resp['external_host_quickconnect'] = csSYNOPhotoMisc::GetServerHost(true);
  86. $resp['external_host_external_ip'] = csSYNOPhotoMisc::GetServerHost(true, true);
  87. $resp['allow_social_share'] = !("on" == csSYNOPhotoDB::GetDBInstance()->GetConfig("photo", "disable_share"));
  88. $resp['allow_social_upload'] = ("on" == csSYNOPhotoMisc::GetConfigDB("photo", "allow_guest_fb_upload", "photo_config")); // means user actually...
  89. $resp['allow_social_upload_guest'] = $resp['allow_social_upload'] && ("on" == csSYNOPhotoMisc::GetConfigDB("photo", "allow_social_network_upload_guest", "photo_config")); // real guest...
  90. $resp['social_network_list'] = SocialNetwork::ReadList();
  91. // get virtual album (people, geo, desc tag)
  92. $tag['people_tag'] = $tag['geo_tag'] = $tag['desc_tag'] = false;
  93. if ('on' === ($value = csSYNOPhotoMisc::GetConfigDB("photo", "person_label_album", "photo_config"))) {
  94. $tag['people_tag'] = true;
  95. }
  96. if ('on' === ($value = csSYNOPhotoMisc::GetConfigDB("photo", "place_label_album", "photo_config"))) {
  97. $tag['geo_tag'] = true;
  98. }
  99. if ('on' === ($value = csSYNOPhotoMisc::GetConfigDB("photo", "general_label_album", "photo_config"))) {
  100. $tag['desc_tag'] = true;
  101. }
  102. $resp['virtual_tag'] = $tag;
  103. // get default get location
  104. $value = csSYNOPhotoMisc::GetConfigDB("gmap", "gps_default", "photo_config");
  105. $location['lat'] = $location['lng'] = '';
  106. $arr = explode(',', $value);
  107. if (2 === count($arr)) {
  108. $location['lat'] = $arr[0];
  109. $location['lng'] = $arr[1];
  110. }
  111. $resp['default_geo_location'] = $location;
  112. // get home category
  113. $resp['home_category'] = csSYNOPhotoMisc::GetConfigDB("album", "home_category", "photo_config");
  114. // get default album type
  115. $resp['default_album_public'] = false;
  116. if (isSet($_SESSION[SYNOPHOTO_ADMIN_USER]['system_config']['pkgCfg']['albumdefpublic']) &&
  117. 'yes' == $_SESSION[SYNOPHOTO_ADMIN_USER]['system_config']['pkgCfg']['albumdefpublic']) {
  118. $resp['default_album_public'] = true;
  119. }
  120. // get disable_aboutme
  121. $resp['disable_aboutme'] = 'on' === csSYNOPhotoMisc::GetConfigDB("photo", "disable_aboutme", "photo_config") ? true : false;
  122. $resp['show_album_hit'] = "off" === csSYNOPhotoMisc::GetConfigDB("photo", "show_album_hit", "photo_config") ? false : true;
  123. $resp['use_dsm_account'] = ("1" === csSYNOPhotoMisc::GetConfigDB("global", "account_system", "photo_config"));
  124. $resp['collapse_left_panel'] = 'on' === csSYNOPhotoMisc::GetConfigDB("photo", "collapse_left_panel", "photo_config") ? true : false;
  125. $resp['hide_lightbox_information'] = 'on' === csSYNOPhotoMisc::GetConfigDB("photo", "hide_lightbox_information", "photo_config") ? true : false;
  126. $resp['use_pop_window_to_edit_desc'] = 'on' === csSYNOPhotoMisc::GetConfigDB("photo", "use_pop_window_to_edit_desc", "photo_config") ? true : false;
  127. $resp['def_album_disable_conversion'] = 'on' === csSYNOPhotoMisc::GetConfigDB("photo", "def_album_disable_conversion", "photo_config") ? true : false;
  128. $this->SetResponse($resp);
  129. }
  130. }
  131. $api = new InfoAPI();
  132. $api->Run();
  133. ?>