PageRenderTime 27ms CodeModel.GetById 30ms RepoModel.GetById 0ms app.codeStats 1ms

/wp-content/plugins/wptouch/include/submit.php

https://github.com/digitalstrategyworks/Reese-WordPress
PHP | 288 lines | 233 code | 51 blank | 4 comment | 88 complexity | 329cfa10e405111119ae43f75fa2ea22 MD5 | raw file
  1. <?php
  2. if ( isset( $_POST['submit'] ) ) {
  3. // let's rock and roll
  4. $nonce = $_POST['wptouch-nonce'];
  5. if ( !wp_verify_nonce( $nonce, 'wptouch-nonce' ) ) {
  6. _e( "Nonce Failure", "wptouch" );
  7. die;
  8. }
  9. if ( !current_user_can( 'manage_options' ) ) {
  10. _e( "Security failure. Please log in again.", "wptouch" );
  11. die;
  12. }
  13. unset( $_POST['submit'] );
  14. $a = array();
  15. if ( isset( $_POST['enable-post-excerpts'] ) ) {
  16. $a['enable-post-excerpts'] = 1;
  17. } else {
  18. $a['enable-post-excerpts'] = 0;
  19. }
  20. if ( isset( $_POST['enable-twenty-eleven-footer'] ) ) {
  21. $a['enable-twenty-eleven-footer'] = 1;
  22. } else {
  23. $a['enable-twenty-eleven-footer'] = 0;
  24. }
  25. if ( isset( $_POST['enable-page-coms'] ) ) {
  26. $a['enable-page-coms'] = 1;
  27. } else {
  28. $a['enable-page-coms'] = 0;
  29. }
  30. if ( isset( $_POST['enable-zoom'] ) ) {
  31. $a['enable-zoom'] = 1;
  32. } else {
  33. $a['enable-zoom'] = 0;
  34. }
  35. if ( isset( $_POST['enable-cats-button'] ) ) {
  36. $a['enable-cats-button'] = 1;
  37. } else {
  38. $a['enable-cats-button'] = 0;
  39. }
  40. if ( isset( $_POST['enable-tags-button'] ) ) {
  41. $a['enable-tags-button'] = 1;
  42. } else {
  43. $a['enable-tags-button'] = 0;
  44. }
  45. if ( isset( $_POST['enable-search-button'] ) ) {
  46. $a['enable-search-button'] = 1;
  47. } else {
  48. $a['enable-search-button'] = 0;
  49. }
  50. if ( isset( $_POST['enable-login-button'] ) ) {
  51. $a['enable-login-button'] = 1;
  52. } else {
  53. $a['enable-login-button'] = 0;
  54. }
  55. if ( isset( $_POST['enable-gigpress-button'] ) ) {
  56. $a['enable-gigpress-button'] = 1;
  57. } else {
  58. $a['enable-gigpress-button'] = 0;
  59. }
  60. if ( isset( $_POST['enable-flat-icon'] ) ) {
  61. $a['enable-flat-icon'] = 1;
  62. } else {
  63. $a['enable-flat-icon'] = 0;
  64. }
  65. if ( isset( $_POST['enable-gravatars'] ) ) {
  66. $a['enable-gravatars'] = 1;
  67. } else {
  68. $a['enable-gravatars'] = 0;
  69. }
  70. if ( isset( $_POST['enable-main-home'] ) ) {
  71. $a['enable-main-home'] = 1;
  72. } else {
  73. $a['enable-main-home'] = 0;
  74. }
  75. if ( isset( $_POST['enable-main-rss'] ) ) {
  76. $a['enable-main-rss'] = 1;
  77. } else {
  78. $a['enable-main-rss'] = 0;
  79. }
  80. if ( isset( $_POST['enable-main-email'] ) ) {
  81. $a['enable-main-email'] = 1;
  82. } else {
  83. $a['enable-main-email'] = 0;
  84. }
  85. if ( isset( $_POST['enable-truncated-titles'] ) ) {
  86. $a['enable-truncated-titles'] = 1;
  87. } else {
  88. $a['enable-truncated-titles'] = 0;
  89. }
  90. if ( isset( $_POST['enable-main-name'] ) ) {
  91. $a['enable-main-name'] = 1;
  92. } else {
  93. $a['enable-main-name'] = 0;
  94. }
  95. if ( isset( $_POST['enable-main-tags'] ) ) {
  96. $a['enable-main-tags'] = 1;
  97. } else {
  98. $a['enable-main-tags'] = 0;
  99. }
  100. if ( isset( $_POST['enable-main-categories'] ) ) {
  101. $a['enable-main-categories'] = 1;
  102. } else {
  103. $a['enable-main-categories'] = 0;
  104. }
  105. //Prowl
  106. if ( isset($_POST['prowl-api']) ) {
  107. $a['prowl-api'] = $_POST['prowl-api'];
  108. }
  109. if ( isset( $_POST['enable-prowl-comments-button'] ) ) {
  110. $a['enable-prowl-comments-button'] = 1;
  111. } else {
  112. $a['enable-prowl-comments-button'] = 0;
  113. }
  114. if ( isset( $_POST['enable-prowl-users-button'] ) ) {
  115. $a['enable-prowl-users-button'] = 1;
  116. } else {
  117. $a['enable-prowl-users-button'] = 0;
  118. }
  119. if ( isset( $_POST['enable-prowl-message-button'] ) ) {
  120. $a['enable-prowl-message-button'] = 1;
  121. } else {
  122. $a['enable-prowl-message-button'] = 0;
  123. }
  124. //
  125. if ( isset( $_POST['home-page'] ) ) {
  126. $a['home-page'] = $_POST['home-page'];
  127. if (strlen($a['home-page']) == 0) {
  128. $a['home-page'] = 'Default';
  129. }
  130. } else {
  131. $a['home-page'] = 'Default';
  132. }
  133. if ( isset($_POST['statistics']) ) {
  134. $a['statistics'] = $_POST['statistics'];
  135. }
  136. if ( isset($_POST['sort-order']) ) {
  137. $a['sort-order'] = $_POST['sort-order'];
  138. }
  139. if ( isset($_POST['enable-regular-default']) ) {
  140. $a['enable-regular-default'] = 1;
  141. } else {
  142. $a['enable-regular-default'] = 0;
  143. }
  144. if ( isset($_POST['enable-show-comments']) ) {
  145. $a['enable-show-comments'] = 1;
  146. } else {
  147. $a['enable-show-comments'] = 0;
  148. }
  149. if ( isset($_POST['enable-show-tweets']) ) {
  150. $a['enable-show-tweets'] = 1;
  151. } else {
  152. $a['enable-show-tweets'] = 0;
  153. }
  154. if ( isset( $_POST['custom-user-agents'] ) ) {
  155. $new_array = array();
  156. if ( !strlen( trim( $_POST['custom-user-agents'] ) ) ) {
  157. $a['custom-user-agents'] = array();
  158. } else {
  159. $a['custom-user-agents'] = explode( ",", $_POST['custom-user-agents'] );
  160. foreach( $a['custom-user-agents'] as $agent ) {
  161. $new_array[] = trim( $agent );
  162. }
  163. $a['custom-user-agents'] = $new_array;
  164. }
  165. } else {
  166. $a['custom-user-agents'] = array();
  167. }
  168. if ( isset($_POST['excluded-cat-ids']) ) {
  169. $a['excluded-cat-ids'] = $_POST['excluded-cat-ids'];
  170. }
  171. if ( isset($_POST['excluded-tag-ids']) ) {
  172. $a['excluded-tag-ids'] = $_POST['excluded-tag-ids'];
  173. }
  174. if ( isset($_POST['adsense-id']) ) {
  175. $a['adsense-id'] = trim( $_POST['adsense-id'] );
  176. }
  177. if ( isset($_POST['adsense-channel']) ) {
  178. $a['adsense-channel'] = $_POST['adsense-channel'];
  179. }
  180. if ( isset($_POST['post-cal-thumb']) ) {
  181. $a['post-cal-thumb'] = $_POST['post-cal-thumb'];
  182. }
  183. if ( isset($_POST['h2-font']) ) {
  184. $a['h2-font'] = $_POST['h2-font'];
  185. }
  186. if ( isset($_POST['style-text-justify']) ) {
  187. $a['style-text-justify'] = $_POST['style-text-justify'];
  188. }
  189. if ( isset($_POST['style-background']) ) {
  190. $a['style-background'] = $_POST['style-background'];
  191. }
  192. if ( isset($_POST['style-icon']) ) {
  193. $a['style-icon'] = $_POST['style-icon'];
  194. }
  195. if ( isset( $_POST['enable-exclusive'] ) ) {
  196. $a['enable-exclusive'] = 1;
  197. } else {
  198. $a['enable-exclusive'] = 0;
  199. }
  200. if ( isset( $_POST['wptouch-language'] ) ) {
  201. $a['wptouch-language'] = $_POST['wptouch-language'];
  202. } else {
  203. $a['wptouch-language'] = "auto";
  204. }
  205. foreach ($_POST as $k => $v) {
  206. if ($k == 'enable_main_title') {
  207. $a['main_title'] = $v;
  208. } else {
  209. if (preg_match('#enable_(.*)#', $k, $matches)) {
  210. $id = $matches[1];
  211. if (!isset($a[$id]))
  212. $a[$id] = $_POST['icon_' . $id];
  213. }
  214. }
  215. }
  216. $a['header-title'] = $_POST['header-title'];
  217. if (!isset($a['header-title']) || (isset($a['header-title']) && strlen($a['header-title']) == 0)) {
  218. $a['header-title'] = get_bloginfo('title');
  219. }
  220. $a['custom-footer-msg'] = $_POST['custom-footer-msg'];
  221. if (!isset($a['custom-footer-msg']) || (isset($a['custom-footer-msg']) && strlen($a['custom-footer-msg']) == 0)) {
  222. $a['custom-footer-msg'] = 'All content Copyright '. get_bloginfo('name') . '';
  223. }
  224. $a['header-background-color'] = $_POST['header-background-color'];
  225. $a['header-border-color'] = $_POST['header-border-color'];
  226. $a['header-text-color'] = $_POST['header-text-color'];
  227. $a['link-color'] = $_POST['link-color'];
  228. //Prowl
  229. $a['prowl-api'] = $_POST['prowl-api'];
  230. $values = serialize($a);
  231. update_option('bnc_iphone_pages', $values);
  232. } elseif ( isset( $_POST['reset'] ) ) {
  233. update_option( 'bnc_iphone_pages', false );
  234. }
  235. do_action( 'wptouch_load_locale' );
  236. global $wptouch_settings;
  237. $wptouch_settings = bnc_wptouch_get_settings();