Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

169 lines
8.3 KiB

  1. <?php
  2. /**
  3. * Theme settings
  4. */
  5. function theme_content(&$a){
  6. if(!local_user())
  7. return;
  8. $font_size = get_pconfig(local_user(), 'diabook', 'font_size' );
  9. $line_height = get_pconfig(local_user(), 'diabook', 'line_height' );
  10. $resolution = get_pconfig(local_user(), 'diabook', 'resolution' );
  11. $color = get_pconfig(local_user(), 'diabook', 'color' );
  12. $TSearchTerm = get_pconfig(local_user(), 'diabook', 'TSearchTerm' );
  13. $ELZoom = get_pconfig(local_user(), 'diabook', 'ELZoom' );
  14. $ELPosX = get_pconfig(local_user(), 'diabook', 'ELPosX' );
  15. $ELPosY = get_pconfig(local_user(), 'diabook', 'ELPosY' );
  16. $close_pages = get_pconfig(local_user(), 'diabook', 'close_pages' );
  17. $close_mapquery = get_pconfig(local_user(), 'diabook', 'close_mapquery' );
  18. $close_profiles = get_pconfig(local_user(), 'diabook', 'close_profiles' );
  19. $close_helpers = get_pconfig(local_user(), 'diabook', 'close_helpers' );
  20. $close_services = get_pconfig(local_user(), 'diabook', 'close_services' );
  21. $close_friends = get_pconfig(local_user(), 'diabook', 'close_friends' );
  22. $close_lastusers = get_pconfig(local_user(), 'diabook', 'close_lastusers' );
  23. $close_lastphotos = get_pconfig(local_user(), 'diabook', 'close_lastphotos' );
  24. $close_lastlikes = get_pconfig(local_user(), 'diabook', 'close_lastlikes' );
  25. return diabook_form($a,$font_size, $line_height, $resolution, $color, $TSearchTerm, $ELZoom, $ELPosX, $ELPosY, $close_pages, $close_mapquery, $close_profiles, $close_helpers, $close_services, $close_friends, $close_lastusers, $close_lastphotos, $close_lastlikes);
  26. }
  27. function theme_post(&$a){
  28. if(! local_user())
  29. return;
  30. if (isset($_POST['diabook-settings-submit'])){
  31. set_pconfig(local_user(), 'diabook', 'font_size', $_POST['diabook_font_size']);
  32. set_pconfig(local_user(), 'diabook', 'line_height', $_POST['diabook_line_height']);
  33. set_pconfig(local_user(), 'diabook', 'resolution', $_POST['diabook_resolution']);
  34. set_pconfig(local_user(), 'diabook', 'color', $_POST['diabook_color']);
  35. set_pconfig(local_user(), 'diabook', 'TSearchTerm', $_POST['diabook_TSearchTerm']);
  36. set_pconfig(local_user(), 'diabook', 'ELZoom', $_POST['diabook_ELZoom']);
  37. set_pconfig(local_user(), 'diabook', 'ELPosX', $_POST['diabook_ELPosX']);
  38. set_pconfig(local_user(), 'diabook', 'ELPosY', $_POST['diabook_ELPosY']);
  39. set_pconfig(local_user(), 'diabook', 'ELPosY', $_POST['diabook_ELPosY']);
  40. set_pconfig(local_user(), 'diabook', 'close_pages', $_POST['diabook_close_pages']);
  41. set_pconfig(local_user(), 'diabook', 'close_mapquery', $_POST['diabook_close_mapquery']);
  42. set_pconfig(local_user(), 'diabook', 'close_profiles', $_POST['diabook_close_profiles']);
  43. set_pconfig(local_user(), 'diabook', 'close_helpers', $_POST['diabook_close_helpers']);
  44. set_pconfig(local_user(), 'diabook', 'close_services', $_POST['diabook_close_services']);
  45. set_pconfig(local_user(), 'diabook', 'close_friends', $_POST['diabook_close_friends']);
  46. set_pconfig(local_user(), 'diabook', 'close_lastusers', $_POST['diabook_close_lastusers']);
  47. set_pconfig(local_user(), 'diabook', 'close_lastphotos', $_POST['diabook_close_lastphotos']);
  48. set_pconfig(local_user(), 'diabook', 'close_lastlikes', $_POST['diabook_close_lastlikes']);
  49. }
  50. }
  51. function theme_admin(&$a){
  52. $font_size = get_config('diabook', 'font_size' );
  53. $line_height = get_config('diabook', 'line_height' );
  54. $resolution = get_config('diabook', 'resolution' );
  55. $color = get_config('diabook', 'color' );
  56. $TSearchTerm = get_config('diabook', 'TSearchTerm' );
  57. $ELZoom = get_config('diabook', 'ELZoom' );
  58. $ELPosX = get_config('diabook', 'ELPosX' );
  59. $ELPosY = get_config('diabook', 'ELPosY' );
  60. $close_pages = get_config('diabook', 'close_pages' );
  61. $close_mapquery = get_config('diabook', 'close_mapquery' );
  62. $close_profiles = get_config('diabook', 'close_profiles' );
  63. $close_helpers = get_config('diabook', 'close_helpers' );
  64. $close_services = get_config('diabook', 'close_services' );
  65. $close_friends = get_config('diabook', 'close_friends' );
  66. $close_lastusers = get_config('diabook', 'close_lastusers' );
  67. $close_lastphotos = get_config('diabook', 'close_lastphotos' );
  68. $close_lastlikes = get_config('diabook', 'close_lastlikes' );
  69. return diabook_form($a,$font_size, $line_height, $resolution, $color, $TSearchTerm, $ELZoom, $ELPosX, $ELPosY, $close_pages, $close_mapquery, $close_profiles, $close_helpers, $close_services, $close_friends, $close_lastusers, $close_lastphotos, $close_lastlikes);
  70. }
  71. function theme_admin_post(&$a){
  72. if (isset($_POST['diabook-settings-submit'])){
  73. set_config('diabook', 'font_size', $_POST['diabook_font_size']);
  74. set_config('diabook', 'line_height', $_POST['diabook_line_height']);
  75. set_config('diabook', 'resolution', $_POST['diabook_resolution']);
  76. set_config('diabook', 'color', $_POST['diabook_color']);
  77. set_config('diabook', 'TSearchTerm', $_POST['diabook_TSearchTerm']);
  78. set_config('diabook', 'ELZoom', $_POST['diabook_ELZoom']);
  79. set_config('diabook', 'ELPosX', $_POST['diabook_ELPosX']);
  80. set_config('diabook', 'close_pages', $_POST['diabook_close_pages']);
  81. set_config('diabook', 'close_mapquery', $_POST['diabook_close_mapquery']);
  82. set_config('diabook', 'close_profiles', $_POST['diabook_close_profiles']);
  83. set_config('diabook', 'close_helpers', $_POST['diabook_close_helpers']);
  84. set_config('diabook', 'close_services', $_POST['diabook_close_services']);
  85. set_config('diabook', 'close_friends', $_POST['diabook_close_friends']);
  86. set_config('diabook', 'close_lastusers', $_POST['diabook_close_lastusers']);
  87. set_config('diabook', 'close_lastphotos', $_POST['diabook_close_lastphotos']);
  88. set_config('diabook', 'close_lastlikes', $_POST['diabook_close_lastlikes']);
  89. }
  90. }
  91. function diabook_form(&$a, $font_size, $line_height, $resolution, $color, $TSearchTerm, $ELZoom, $ELPosX, $ELPosY, $close_pages, $close_mapquery, $close_profiles, $close_helpers, $close_services, $close_friends, $close_lastusers, $close_lastphotos, $close_lastlikes){
  92. $line_heights = array(
  93. "1.3"=>"1.3",
  94. "---"=>"---",
  95. "1.6"=>"1.6",
  96. "1.5"=>"1.5",
  97. "1.4"=>"1.4",
  98. "1.2"=>"1.2",
  99. "1.1"=>"1.1",
  100. );
  101. $font_sizes = array(
  102. '14'=>'14',
  103. "---"=>"---",
  104. "16"=>"16",
  105. "15"=>"15",
  106. '13.5'=>'13.5',
  107. '13'=>'13',
  108. '12.5'=>'12.5',
  109. '12'=>'12',
  110. );
  111. $resolutions = array(
  112. 'normal'=>'normal',
  113. 'wide'=>'wide',
  114. );
  115. $colors = array(
  116. 'diabook'=>'diabook',
  117. 'aerith'=>'aerith',
  118. 'blue'=>'blue',
  119. 'green'=>'green',
  120. 'pink'=>'pink',
  121. 'red'=>'red',
  122. 'dark'=>'dark',
  123. );
  124. $close_or_not = array('1'=>t("don't show"), '0'=>t("show"),);
  125. $t = get_markup_template("theme_settings.tpl" );
  126. $o .= replace_macros($t, array(
  127. '$submit' => t('Submit'),
  128. '$baseurl' => $a->get_baseurl(),
  129. '$title' => t("Theme settings"),
  130. '$font_size' => array('diabook_font_size', t('Set font-size for posts and comments'), $font_size, '', $font_sizes),
  131. '$line_height' => array('diabook_line_height', t('Set line-height for posts and comments'), $line_height, '', $line_heights),
  132. '$resolution' => array('diabook_resolution', t('Set resolution for middle column'), $resolution, '', $resolutions),
  133. '$color' => array('diabook_color', t('Set color scheme'), $color, '', $colors),
  134. '$ELZoom' => array('diabook_ELZoom', t('Set zoomfactor for Earth Layer'), $ELZoom, '', $ELZoom),
  135. '$ELPosX' => array('diabook_ELPosX', t('Set longitude (X) for Earth Layers'), $ELPosX, '', $ELPosX),
  136. '$ELPosY' => array('diabook_ELPosY', t('Set latitude (Y) for Earth Layers'), $ELPosY, '', $ELPosY),
  137. '$close_pages' => array('diabook_close_pages', t('Community Pages'), $close_pages, '', $close_or_not),
  138. '$close_mapquery' => array('diabook_close_mapquery', t('Earth Layers'), $close_mapquery, '', $close_or_not),
  139. '$close_profiles' => array('diabook_close_profiles', t('Community Profiles'), $close_profiles, '', $close_or_not),
  140. '$close_helpers' => array('diabook_close_helpers', t('Help or @NewHere ?'), $close_helpers, '', $close_or_not),
  141. '$close_services' => array('diabook_close_services', t('Connect Services'), $close_services, '', $close_or_not),
  142. '$close_friends' => array('diabook_close_friends', t('Find Friends'), $close_friends, '', $close_or_not),
  143. '$close_lastusers' => array('diabook_close_lastusers', t('Last users'), $close_lastusers, '', $close_or_not),
  144. '$close_lastphotos' => array('diabook_close_lastphotos', t('Last photos'), $close_lastphotos, '', $close_or_not),
  145. '$close_lastlikes' => array('diabook_close_lastlikes', t('Last likes'), $close_lastlikes, '', $close_or_not),
  146. ));
  147. return $o;
  148. }