123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- <?PHP
-
- require_once('info.inc.php');
-
- class InfoAPI extends WebAPI {
- function __construct() {
- parent::__construct(SZ_WEBAPI_API_DESCRIPTION_PATH);
- }
-
- protected function Process() {
- if (!strcasecmp($this->method, "getinfo")) {
- $this->GetInfo();
-
- // $this->CheckShareId();
- }
- }
-
- private function CheckShareId()
- {
- $PHP_BIN = "/usr/bin/php";
- $PHP_PARAMETER = "-n -d extension=pdo.so -d extension=pdo_pgsql.so -d extension=pdo_sqlite.so";
- $SHARE_ID_UPDATE_PHP = SYNO_PKG_DIR."/target/photo_scripts/update_photo_share.php";
- $cmd = sprintf("%s %s %s '%s' >/dev/null &", $PHP_BIN, $PHP_PARAMETER, $SHARE_ID_UPDATE_PHP, SYNOPHOTO_ADMIN_NAME);
-
- system($cmd);
- }
-
- private function GetInfo() {
- $resp = array();
-
- // get version
- $resp['version'] = '2965';
-
- // get PhotoStation title
- $resp['title'] = trim(csSYNOPhotoMisc::GetConfigDB("photo", "photo_page_title", "photo_config"));
-
- // get about_me title
- $value = csSYNOPhotoMisc::GetConfigDB("photo", "about_me_title", "photo_config");
- $resp['about_me_title'] = $value ? $value : __(photo_str_category_about_me);
-
- // get root album sort_by
- $value = csSYNOPhotoMisc::GetConfigDB("album", "thumb_sort_type", "photo_config");
- $resp['sort_by'] = 'filename';
- if ('0' === $value) {
- $resp['sort_by'] = 'filename';
- } elseif ('1' === $value) {
- $resp['sort_by'] = 'takendate';
- } elseif ('2' === $value) {
- $resp['sort_by'] = 'createdate';
- }
-
- // get root album sort_direction
- $value = csSYNOPhotoMisc::GetConfigDB("album", "thumb_sort_order", "photo_config");
- $resp['sort_direction'] = ('1' === $value) ? 'desc' : 'asc';
-
- // get use album explorer setting
- $value = csSYNOPhotoMisc::GetConfigDB("album", "use_album_explorer", "photo_config");
- $resp['use_album_explorer'] = 'off' !== $value; //return "on" by default
-
- // get paging setting
- $value = csSYNOPhotoMisc::GetConfigDB("album", "paging_use_bar", "photo_config");
- $resp['paging_use_bar'] = 'off' !== $value; //return "on" by default
- $value = intval(csSYNOPhotoMisc::GetConfigDB("album", "paging_item_count", "photo_config"));
- $resp['paging_item_count'] = ($value >= 50 && $value <= 500) ? $value : 50;
-
- // get folder sort direction
- $value = csSYNOPhotoMisc::GetConfigDB("album", "album_order_type_is_desc", "photo_config");
- $resp['folder_sort_direction'] = ("1" === $value) ? 'desc' : 'asc';
-
- // get allow downoload original photo
- /*
- $value = csSYNOPhotoMisc::GetConfigDB("photo", "allow_orig", "photo_config");
- $resp['allow_download_orig'] = ('on' === $value) ? true : false;
- */
-
- // get allow download album
- $value = csSYNOPhotoDB::GetDBInstance()->GetConfig('photo', 'allow_album_download');
- $resp['allow_download_album'] = ('on' === $value) ? true : false;
- // #2253 - reserve these two key for compatibility with DS photo+ which is using webapi already
- $resp['allow_download_orig'] = $resp['allow_download_album'];
- $resp['allow_download_video'] = $resp['allow_download_album'];
-
- // get allow download video
- /*
- $value = csSYNOPhotoMisc::GetConfigDB('photo', 'allow_video_download', 'photo_config');
- $resp['allow_download_video'] = ('on' === $value) ? true : false;
- */
-
- // get disable right button
- $value = csSYNOPhotoMisc::GetConfigDB('photo', 'disable_right_button', 'photo_config');
- $resp['disable_right_button'] = ('on' === $value) ? true : false;
-
- // get allow search
- $value = csSYNOPhotoMisc::GetConfigDB("photo", "hide_search", "photo_config");
- $resp['hide_search'] = ('on' === $value) ? true : false;
-
- // get hide gps info from normal user
- $value = csSYNOPhotoMisc::GetConfigDB("photo", "hide_gps_from_normal_user", "photo_config");
- $resp['hide_gps_from_normal_user'] = ('on' === $value) ? true : false;
-
- // get allow rss feed
- $value = csSYNOPhotoMisc::GetConfigDB("photo", "hide_rss_feed", "photo_config");
- $resp['hide_rss_feed'] = ('on' === $value) ? true : false;
-
- // get enable blog
- $resp['enable_blog'] = csSYNOPhotoMisc::IsBlogEnabled();
-
- $resp['external_host'] = csSYNOPhotoMisc::GetServerHost();
- $resp['external_host_quickconnect'] = csSYNOPhotoMisc::GetServerHost(true);
- $resp['external_host_external_ip'] = csSYNOPhotoMisc::GetServerHost(true, true);
- $resp['allow_social_share'] = !("on" == csSYNOPhotoDB::GetDBInstance()->GetConfig("photo", "disable_share"));
- $resp['allow_social_upload'] = ("on" == csSYNOPhotoMisc::GetConfigDB("photo", "allow_guest_fb_upload", "photo_config")); // means user actually...
- $resp['allow_social_upload_guest'] = $resp['allow_social_upload'] && ("on" == csSYNOPhotoMisc::GetConfigDB("photo", "allow_social_network_upload_guest", "photo_config")); // real guest...
- $resp['social_network_list'] = SocialNetwork::ReadList();
-
- // get virtual album (people, geo, desc tag)
- $tag['people_tag'] = $tag['geo_tag'] = $tag['desc_tag'] = false;
- if ('on' === ($value = csSYNOPhotoMisc::GetConfigDB("photo", "person_label_album", "photo_config"))) {
- $tag['people_tag'] = true;
- }
- if ('on' === ($value = csSYNOPhotoMisc::GetConfigDB("photo", "place_label_album", "photo_config"))) {
- $tag['geo_tag'] = true;
- }
- if ('on' === ($value = csSYNOPhotoMisc::GetConfigDB("photo", "general_label_album", "photo_config"))) {
- $tag['desc_tag'] = true;
- }
- $resp['virtual_tag'] = $tag;
-
- // get default get location
- $value = csSYNOPhotoMisc::GetConfigDB("gmap", "gps_default", "photo_config");
- $location['lat'] = $location['lng'] = '';
- $arr = explode(',', $value);
- if (2 === count($arr)) {
- $location['lat'] = $arr[0];
- $location['lng'] = $arr[1];
- }
- $resp['default_geo_location'] = $location;
-
- // get home category
- $resp['home_category'] = csSYNOPhotoMisc::GetConfigDB("album", "home_category", "photo_config");
-
- // get default album type
- $resp['default_album_public'] = false;
- if (isSet($_SESSION[SYNOPHOTO_ADMIN_USER]['system_config']['pkgCfg']['albumdefpublic']) &&
- 'yes' == $_SESSION[SYNOPHOTO_ADMIN_USER]['system_config']['pkgCfg']['albumdefpublic']) {
- $resp['default_album_public'] = true;
- }
-
- // get disable_aboutme
- $resp['disable_aboutme'] = 'on' === csSYNOPhotoMisc::GetConfigDB("photo", "disable_aboutme", "photo_config") ? true : false;
-
- $resp['show_album_hit'] = "off" === csSYNOPhotoMisc::GetConfigDB("photo", "show_album_hit", "photo_config") ? false : true;
-
- $resp['use_dsm_account'] = ("1" === csSYNOPhotoMisc::GetConfigDB("global", "account_system", "photo_config"));
-
- $resp['collapse_left_panel'] = 'on' === csSYNOPhotoMisc::GetConfigDB("photo", "collapse_left_panel", "photo_config") ? true : false;
- $resp['hide_lightbox_information'] = 'on' === csSYNOPhotoMisc::GetConfigDB("photo", "hide_lightbox_information", "photo_config") ? true : false;
- $resp['use_pop_window_to_edit_desc'] = 'on' === csSYNOPhotoMisc::GetConfigDB("photo", "use_pop_window_to_edit_desc", "photo_config") ? true : false;
- $resp['def_album_disable_conversion'] = 'on' === csSYNOPhotoMisc::GetConfigDB("photo", "def_album_disable_conversion", "photo_config") ? true : false;
-
- $this->SetResponse($resp);
- }
- }
-
- $api = new InfoAPI();
- $api->Run();
-
- ?>
|