option-functions.php 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383
  1. <?php
  2. trait OptionsFunction
  3. {
  4. public function settingsOptionGroup($options = [])
  5. {
  6. $settings = [];
  7. foreach ($options as $option) {
  8. $optionType = $option[0] ? $option[0] : false;
  9. $optionName = $option[1] ? $option[1] : null;
  10. $optionExtras = $option[2] ? $option[2] : [];
  11. $setting = $this->settingsOption($optionType, $optionName, $optionExtras);
  12. array_push($settings, $setting);
  13. }
  14. return $settings;
  15. }
  16. public function settingsOption($type, $name = null, $extras = null)
  17. {
  18. $type = strtolower(str_replace('-', '', $type));
  19. $setting = [
  20. 'name' => $name,
  21. 'value' => $this->config[$name] ?? ''
  22. ];
  23. switch ($type) {
  24. case 'enable':
  25. $settingMerge = [
  26. 'type' => 'switch',
  27. 'label' => 'Enable',
  28. ];
  29. break;
  30. case 'auth':
  31. $this->setGroupOptionsVariable();
  32. $settingMerge = [
  33. 'type' => 'select',
  34. 'label' => 'Minimum Authentication',
  35. 'options' => $this->groupOptions
  36. ];
  37. break;
  38. case 'refresh':
  39. $settingMerge = [
  40. 'type' => 'select',
  41. 'label' => 'Refresh Seconds',
  42. 'options' => $this->timeOptions()
  43. ];
  44. break;
  45. case 'combine':
  46. case 'combine-downloader':
  47. $settingMerge = [
  48. 'type' => 'switch',
  49. 'label' => 'Add to Combined Downloader',
  50. ];
  51. break;
  52. case 'test':
  53. $settingMerge = [
  54. 'type' => 'button',
  55. 'label' => 'Test Connection',
  56. 'icon' => 'fa fa-flask',
  57. 'class' => 'pull-right',
  58. 'text' => 'Test Connection',
  59. 'attr' => 'onclick="testAPIConnection(\'' . $name . '\')"',
  60. 'help' => 'Remember! Please save before using the test button!'
  61. ];
  62. break;
  63. case 'url':
  64. $settingMerge = [
  65. 'type' => 'input',
  66. 'label' => 'URL',
  67. 'help' => 'Please make sure to use local IP address and port - You also may use local dns name too.',
  68. 'placeholder' => 'http(s)://hostname:port'
  69. ];
  70. break;
  71. case 'multipleurl':
  72. $settingMerge = [
  73. 'type' => 'select2',
  74. 'class' => 'select2-multiple',
  75. 'id' => $name . '-select-' . $this->random_ascii_string(6),
  76. 'label' => 'Multiple URL\'s',
  77. 'help' => 'Please make sure to use local IP address and port - You also may use local dns name too.',
  78. 'placeholder' => 'http(s)://hostname:port',
  79. 'options' => $this->makeOptionsFromValues($this->config[$name]),
  80. 'settings' => '{tags: true, selectOnClose: true, closeOnSelect: true, allowClear: true}',
  81. ];
  82. break;
  83. case 'multiple':
  84. $settingMerge = [
  85. 'type' => 'select2',
  86. 'class' => 'select2-multiple',
  87. 'id' => $name . '-select-' . $this->random_ascii_string(6),
  88. 'label' => 'Multiple Values\'s',
  89. 'options' => $this->makeOptionsFromValues($this->config[$name]),
  90. 'settings' => '{tags: true, selectOnClose: true, closeOnSelect: true, allowClear: true}',
  91. ];
  92. break;
  93. case 'cron':
  94. $settingMerge = [
  95. 'type' => 'cron',
  96. 'label' => 'Cron Schedule',
  97. 'help' => 'You may use either Cron format or - @hourly, @daily, @monthly',
  98. 'placeholder' => '* * * * *'
  99. ];
  100. break;
  101. case 'folder':
  102. $settingMerge = [
  103. 'type' => 'folder',
  104. 'label' => 'Save Path',
  105. 'help' => 'Folder path',
  106. 'placeholder' => '/path/to/folder'
  107. ];
  108. break;
  109. case 'cronfile':
  110. $path = $this->root . DIRECTORY_SEPARATOR . 'cron.php';
  111. $server = $this->serverIP();
  112. $installInstruction = ($this->docker) ?
  113. '<p lang="en">No action needed. Organizr\'s docker image comes with the Cron job built-in</p>' :
  114. '<p lang="en">Setup a Cron job so it\'s call will originate from either the server\'s IP address or a local IP address. Please use the following information to set up the Cron Job correctly.</p>
  115. <h5>Cron Information</h5>
  116. <ul class="list-icons">
  117. <li><i class="fa fa-caret-right text-info"></i> <b lang="en">Schedule</b> <small>* * * * *</small></li>
  118. <li><i class="fa fa-caret-right text-info"></i> <b lang="en">File Path</b> <small>' . $path . '</small></li>
  119. </ul>
  120. <h5>Command Examples</h5>
  121. <ul class="list-icons">
  122. <li><i class="ti-angle-right"></i> * * * * * /path/to/php ' . $path . '</li>
  123. <li><i class="ti-angle-right"></i> * * * * * curl -XGET -sL "http://' . $server . '/cron.php"</li>
  124. </ul>
  125. ';
  126. $settingMerge = [
  127. 'type' => 'html',
  128. 'override' => 12,
  129. 'label' => '',
  130. 'html' => '
  131. <div class="row">
  132. <div class="col-lg-12">
  133. <div class="panel panel-info">
  134. <div class="panel-heading">
  135. <span lang="en">Organizr Enable Cron Instructions</span>
  136. </div>
  137. <div class="panel-wrapper collapse in" aria-expanded="true">
  138. <div class="panel-body">
  139. <h3 lang="en">Instructions for your install type</h3>
  140. <span>' . $installInstruction . '</span>
  141. <button type="button" onclick="checkCronFile();" class="btn btn-outline btn-info btn-lg btn-block" lang="en">Check Cron Status</button>
  142. <div class="m-t-15 hidden cron-results-container">
  143. <div class="well">
  144. <pre class="cron-results"></pre>
  145. </div>
  146. </div>
  147. </div>
  148. </div>
  149. </div>
  150. </div>
  151. </div>
  152. '
  153. ];
  154. break;
  155. case 'username':
  156. $settingMerge = [
  157. 'type' => 'input',
  158. 'label' => 'Username',
  159. ];
  160. break;
  161. case 'password':
  162. $settingMerge = [
  163. 'type' => 'password',
  164. 'label' => 'Password',
  165. ];
  166. break;
  167. case 'passwordalt':
  168. $settingMerge = [
  169. 'type' => 'password-alt',
  170. 'label' => 'Password',
  171. ];
  172. break;
  173. case 'passwordaltcopy':
  174. $settingMerge = [
  175. 'type' => 'password-alt-copy',
  176. 'label' => 'Password',
  177. ];
  178. break;
  179. case 'apikey':
  180. case 'token':
  181. $settingMerge = [
  182. 'type' => 'password-alt',
  183. 'label' => 'API Key/Token',
  184. ];
  185. break;
  186. case 'multipleapikey':
  187. case 'multipletoken':
  188. $settingMerge = [
  189. 'type' => 'select2',
  190. 'class' => 'select2-multiple',
  191. 'id' => $name . '-select-' . $this->random_ascii_string(6),
  192. 'label' => 'Multiple API Key/Token\'s',
  193. 'options' => $this->makeOptionsFromValues($this->config[$name]),
  194. 'settings' => '{tags: true, theme: "default", selectionCssClass: "password-alt", selectOnClose: true, closeOnSelect: true, allowClear: true}',
  195. ];
  196. break;
  197. case 'notice':
  198. $settingMerge = [
  199. 'type' => 'html',
  200. 'override' => 12,
  201. 'label' => '',
  202. 'html' => '
  203. <div class="row">
  204. <div class="col-lg-12">
  205. <div class="panel panel-' . ($extras['notice'] ?? 'info') . '">
  206. <div class="panel-heading">
  207. <span lang="en">' . ($extras['title'] ?? 'Attention') . '</span>
  208. </div>
  209. <div class="panel-wrapper collapse in" aria-expanded="true">
  210. <div class="panel-body">
  211. <span lang="en">' . ($extras['body'] ?? '') . '</span>
  212. <span>' . ($extras['bodyHTML'] ?? '') . '</span>
  213. </div>
  214. </div>
  215. </div>
  216. </div>
  217. </div>
  218. '
  219. ];
  220. break;
  221. case 'socks':
  222. $settingMerge = [
  223. 'type' => 'html',
  224. 'override' => 12,
  225. 'label' => '',
  226. 'html' => '
  227. <div class="panel panel-default">
  228. <div class="panel-wrapper collapse in">
  229. <div class="panel-body">' . $this->socksHeadingHTML($name) . '</div>
  230. </div>
  231. </div>'
  232. ];
  233. break;
  234. case 'about':
  235. $settingMerge = [
  236. 'type' => 'html',
  237. 'override' => 12,
  238. 'label' => '',
  239. 'html' => '
  240. <div class="panel panel-default">
  241. <div class="panel-wrapper collapse in">
  242. <div class="panel-body">
  243. <h3 lang="en">' . ucwords($name) . ' Homepage Item</h3>
  244. <p lang="en">' . $extras["about"] . '</p>
  245. </div>
  246. </div>
  247. </div>'
  248. ];
  249. break;
  250. case 'title':
  251. $settingMerge = [
  252. 'type' => 'input',
  253. 'label' => 'Title',
  254. 'help' => 'Sets the title of this homepage module',
  255. ];
  256. break;
  257. case 'toggletitle':
  258. $settingMerge = [
  259. 'type' => 'switch',
  260. 'label' => 'Toggle Title',
  261. 'help' => 'Shows/hides the title of this homepage module'
  262. ];
  263. break;
  264. case 'disablecertcheck':
  265. $settingMerge = [
  266. 'type' => 'switch',
  267. 'label' => 'Disable Certificate Check',
  268. ];
  269. break;
  270. case 'usecustomcertificate':
  271. $settingMerge = [
  272. 'type' => 'switch',
  273. 'label' => 'Use Custom Certificate',
  274. ];
  275. break;
  276. case 'hideseeding':
  277. $settingMerge = [
  278. 'type' => 'switch',
  279. 'label' => 'Hide Seeding',
  280. ];
  281. break;
  282. case 'hidecompleted':
  283. $settingMerge = [
  284. 'type' => 'switch',
  285. 'label' => 'Hide Completed',
  286. ];
  287. break;
  288. case 'hidestatus':
  289. $settingMerge = [
  290. 'type' => 'switch',
  291. 'label' => 'Hide Status',
  292. ];
  293. break;
  294. case 'limit':
  295. $settingMerge = [
  296. 'type' => 'number',
  297. 'label' => 'Item Limit',
  298. ];
  299. break;
  300. case 'mediasearchserver':
  301. $settingMerge = [
  302. 'type' => 'select',
  303. 'label' => 'Media Search Server',
  304. 'options' => $this->mediaServerOptions()
  305. ];
  306. break;
  307. case 'imagecachequality':
  308. $settingMerge = [
  309. 'type' => 'select',
  310. 'label' => 'Image Cache Quality',
  311. 'options' => [
  312. [
  313. 'name' => 'Low',
  314. 'value' => '.5'
  315. ],
  316. [
  317. 'name' => '1x',
  318. 'value' => '1'
  319. ],
  320. [
  321. 'name' => '2x',
  322. 'value' => '2'
  323. ],
  324. [
  325. 'name' => '3x',
  326. 'value' => '3'
  327. ]
  328. ]
  329. ];
  330. break;
  331. case 'blank':
  332. $settingMerge = [
  333. 'type' => 'blank',
  334. 'label' => '',
  335. ];
  336. break;
  337. case 'plexlibraryexclude':
  338. $settingMerge = [
  339. 'type' => 'select2',
  340. 'class' => 'select2-multiple',
  341. 'id' => $name . '-exclude-select-' . $this->random_ascii_string(6),
  342. 'label' => 'Libraries to Exclude',
  343. 'options' => $extras['options']
  344. ];
  345. break;
  346. case 'plexlibraryinclude':
  347. $settingMerge = [
  348. 'type' => 'select2',
  349. 'class' => 'select2-multiple',
  350. 'id' => $name . '-include-select-' . $this->random_ascii_string(6),
  351. 'label' => 'Libraries to Include',
  352. 'options' => $extras['options']
  353. ];
  354. break;
  355. // HTML ITEMS
  356. // precodeeditor possibly not needed anymore
  357. case 'precodeeditor':
  358. $settingMerge = [
  359. 'type' => 'textbox',
  360. 'class' => 'hidden ' . $name . 'Textarea',
  361. 'label' => '',
  362. ];
  363. break;
  364. case 'codeeditor':
  365. $mode = strtolower($extras['mode'] ?? 'css');
  366. switch ($mode) {
  367. case 'html':
  368. case 'javascript':
  369. $mode = 'ace/mode/' . $mode;
  370. break;
  371. case 'js':
  372. $mode = 'ace/mode/javascript';
  373. break;
  374. default:
  375. $mode = 'ace/mode/css';
  376. break;
  377. }
  378. $settingMerge = [
  379. 'type' => 'html',
  380. 'override' => 12,
  381. 'label' => 'Custom Code',
  382. 'html' => '
  383. <textarea data-changed="false" class="form-control hidden ' . $name . 'Textarea" name="' . $name . '" data-type="textbox" autocomplete="new-password">' . $this->config[$name] . '</textarea>
  384. <div id="' . $name . 'Editor" style="height:300px">' . htmlentities($this->config[$name]) . '</div>
  385. <script>
  386. let mode = ace.require("' . $mode . '").Mode;
  387. ' . str_replace('-', '', $name) . ' = ace.edit("' . $name . 'Editor");
  388. ' . str_replace('-', '', $name) . '.session.setMode(new mode());
  389. ' . str_replace('-', '', $name) . '.setTheme("ace/theme/idle_fingers");
  390. ' . str_replace('-', '', $name) . '.setShowPrintMargin(false);
  391. ' . str_replace('-', '', $name) . '.session.on("change", function(delta) {
  392. $(".' . $name . 'Textarea").val(' . str_replace('-', '', $name) . '.getValue());
  393. $(".' . $name . 'Textarea").trigger("change");
  394. });
  395. </script>
  396. '
  397. ];
  398. break;
  399. // CALENDAR ITEMS
  400. case 'calendarstart':
  401. $settingMerge = [
  402. 'type' => 'number',
  403. 'label' => '# of Days Before'
  404. ];
  405. break;
  406. case 'calendarend':
  407. $settingMerge = [
  408. 'type' => 'number',
  409. 'label' => '# of Days After'
  410. ];
  411. break;
  412. case 'calendarstartingday':
  413. case 'calendarstartday':
  414. case 'calendarstart':
  415. $settingMerge = [
  416. 'type' => 'select',
  417. 'label' => 'Start Day',
  418. 'options' => $this->daysOptions()
  419. ];
  420. break;
  421. case 'calendardefaultview':
  422. $settingMerge = [
  423. 'type' => 'select',
  424. 'label' => 'Default View',
  425. 'options' => $this->calendarDefaultOptions()
  426. ];
  427. break;
  428. case 'calendartimeformat':
  429. $settingMerge = [
  430. 'type' => 'select',
  431. 'label' => 'Time Format',
  432. 'options' => $this->timeFormatOptions()
  433. ];
  434. break;
  435. case 'calendarlocale':
  436. $settingMerge = [
  437. 'type' => 'select',
  438. 'label' => 'Locale',
  439. 'options' => $this->calendarLocaleOptions()
  440. ];
  441. break;
  442. case 'calendarlimit':
  443. $settingMerge = [
  444. 'type' => 'select',
  445. 'label' => 'Items Per Day',
  446. 'options' => $this->limitOptions()
  447. ];
  448. break;
  449. case 'color':
  450. $settingMerge = [
  451. 'type' => 'input',
  452. 'label' => 'Color',
  453. 'class' => 'pick-a-color-custom-options',
  454. 'attr' => 'data-original="' . $this->config[$name] . '"'
  455. ];
  456. break;
  457. case 'calendarlinkurl':
  458. $settingMerge = [
  459. 'type' => 'select-input',
  460. 'label' => 'Target URL',
  461. 'help' => 'Set the primary URL used when clicking on calendar icon.',
  462. 'options' => $this->makeOptionsFromValues($this->config[str_replace('CalendarLink', '', $name) . 'URL'], true, 'Use Default'),
  463. ];
  464. break;
  465. case 'calendarframetarget':
  466. $settingMerge = [
  467. 'type' => 'select',
  468. 'label' => 'Target Tab',
  469. 'help' => 'Set the tab used when clicking on calendar icon. If not set, link will open in new window.',
  470. 'options' => $this->getIframeTabs($this->config[str_replace('FrameTarget', 'CalendarLink', $name)])
  471. ];
  472. break;
  473. default:
  474. $settingMerge = [
  475. 'type' => strtolower($type),
  476. 'label' => ''
  477. ];
  478. break;
  479. }
  480. $setting = array_merge($settingMerge, $setting);
  481. if ($extras) {
  482. if (gettype($extras) == 'array') {
  483. $setting = array_merge($setting, $extras);
  484. }
  485. }
  486. return $setting;
  487. }
  488. public function getIframeTabs($url = "")
  489. {
  490. if (!empty($url)) {
  491. $response = [
  492. array(
  493. 'function' => 'fetchAll',
  494. 'query' => array(
  495. "SELECT * FROM tabs WHERE `enabled`='1' AND `type`='1' AND `group_id`>=? AND (`url` = '" . $url . "' OR `url_local` = '" . $url . "') ORDER BY `order` ASC",
  496. $this->getUserLevel(),
  497. )
  498. )
  499. ];
  500. } else {
  501. $response = [
  502. array(
  503. 'function' => 'fetchAll',
  504. 'query' => array(
  505. "SELECT * FROM tabs WHERE `enabled`='1' AND `type`='1' AND `group_id`>=? ORDER BY `order` ASC",
  506. $this->getUserLevel()
  507. )
  508. )
  509. ];
  510. }
  511. $formattedValues[] = [
  512. 'name' => 'Open in New Window',
  513. 'value' => ''
  514. ];
  515. foreach ($this->processQueries($response) as $result) {
  516. $formattedValues[] = [
  517. 'name' => $result['name'],
  518. 'value' => $result['id']
  519. ];
  520. }
  521. return $formattedValues;
  522. }
  523. public function makeOptionsFromValues($values = null, $appendBlank = null, $blankLabel = null)
  524. {
  525. if ($appendBlank === true) {
  526. $formattedValues[] = [
  527. 'name' => (!empty($blankLabel)) ? $blankLabel : 'Select option...',
  528. 'value' => ''
  529. ];
  530. } else {
  531. $formattedValues = [];
  532. }
  533. if (strpos($values, ',') !== false) {
  534. $explode = explode(',', $values);
  535. foreach ($explode as $item) {
  536. $formattedValues[] = [
  537. 'name' => $item,
  538. 'value' => $item
  539. ];
  540. }
  541. } elseif ($values == '') {
  542. $formattedValues = '';
  543. } else {
  544. $formattedValues[] = [
  545. 'name' => $values,
  546. 'value' => $values
  547. ];
  548. }
  549. return $formattedValues;
  550. }
  551. public function logLevels()
  552. {
  553. return [
  554. [
  555. 'name' => 'Debug',
  556. 'value' => 'DEBUG'
  557. ],
  558. [
  559. 'name' => 'Info',
  560. 'value' => 'INFO'
  561. ],
  562. [
  563. 'name' => 'Notice',
  564. 'value' => 'NOTICE'
  565. ],
  566. [
  567. 'name' => 'Warning',
  568. 'value' => 'WARNING'
  569. ],
  570. [
  571. 'name' => 'Error',
  572. 'value' => 'ERROR'
  573. ],
  574. [
  575. 'name' => 'Critical',
  576. 'value' => 'CRITICAL'
  577. ],
  578. [
  579. 'name' => 'Alert',
  580. 'value' => 'ALERT'
  581. ],
  582. [
  583. 'name' => 'Emergency',
  584. 'value' => 'EMERGENCY'
  585. ]
  586. ];
  587. }
  588. public function sandboxOptions()
  589. {
  590. return [
  591. [
  592. 'name' => 'Allow Presentation',
  593. 'value' => 'allow-presentation'
  594. ],
  595. [
  596. 'name' => 'Allow Forms',
  597. 'value' => 'allow-forms'
  598. ],
  599. [
  600. 'name' => 'Allow Same Origin',
  601. 'value' => 'allow-same-origin'
  602. ],
  603. [
  604. 'name' => 'Allow Orientation Lock',
  605. 'value' => 'allow-orientation-lock'
  606. ],
  607. [
  608. 'name' => 'Allow Pointer Lock',
  609. 'value' => 'allow-pointer-lock'
  610. ],
  611. [
  612. 'name' => 'Allow Scripts',
  613. 'value' => 'allow-scripts'
  614. ],
  615. [
  616. 'name' => 'Allow Popups',
  617. 'value' => 'allow-popups'
  618. ],
  619. [
  620. 'name' => 'Allow Popups To Escape Sandbox',
  621. 'value' => 'allow-popups-to-escape-sandbox'
  622. ],
  623. [
  624. 'name' => 'Allow Modals',
  625. 'value' => 'allow-modals'
  626. ],
  627. [
  628. 'name' => 'Allow Top Navigation',
  629. 'value' => 'allow-top-navigation'
  630. ],
  631. [
  632. 'name' => 'Allow Top Navigation By User Activation',
  633. 'value' => 'allow-top-navigation-by-user-activation'
  634. ],
  635. [
  636. 'name' => 'Allow Downloads',
  637. 'value' => 'allow-downloads'
  638. ],
  639. ];
  640. }
  641. public function calendarLocaleOptions()
  642. {
  643. return [
  644. [
  645. 'name' => 'Arabic (Standard)',
  646. 'value' => 'ar',
  647. ],
  648. [
  649. 'name' => 'Arabic (Morocco)',
  650. 'value' => 'ar-ma',
  651. ],
  652. [
  653. 'name' => 'Arabic (Saudi Arabia)',
  654. 'value' => 'ar-sa'
  655. ],
  656. [
  657. 'value' => 'ar-tn',
  658. 'name' => 'Arabic (Tunisia)'
  659. ],
  660. [
  661. 'value' => 'bg',
  662. 'name' => 'Bulgarian'
  663. ],
  664. [
  665. 'value' => 'ca',
  666. 'name' => 'Catalan'
  667. ],
  668. [
  669. 'value' => 'cs',
  670. 'name' => 'Czech'
  671. ],
  672. [
  673. 'value' => 'da',
  674. 'name' => 'Danish'
  675. ],
  676. [
  677. 'value' => 'de',
  678. 'name' => 'German (Standard)'
  679. ],
  680. [
  681. 'value' => 'de-at',
  682. 'name' => 'German (Austria)'
  683. ],
  684. [
  685. 'value' => 'el',
  686. 'name' => 'Greek'
  687. ],
  688. [
  689. 'value' => 'en',
  690. 'name' => 'English'
  691. ],
  692. [
  693. 'value' => 'en-au',
  694. 'name' => 'English (Australia)'
  695. ],
  696. [
  697. 'value' => 'en-ca',
  698. 'name' => 'English (Canada)'
  699. ],
  700. [
  701. 'value' => 'en-gb',
  702. 'name' => 'English (United Kingdom)'
  703. ],
  704. [
  705. 'value' => 'es',
  706. 'name' => 'Spanish'
  707. ],
  708. [
  709. 'value' => 'fa',
  710. 'name' => 'Farsi'
  711. ],
  712. [
  713. 'value' => 'fi',
  714. 'name' => 'Finnish'
  715. ],
  716. [
  717. 'value' => 'fr',
  718. 'name' => 'French (Standard)'
  719. ],
  720. [
  721. 'value' => 'fr-ca',
  722. 'name' => 'French (Canada)'
  723. ],
  724. [
  725. 'value' => 'he',
  726. 'name' => 'Hebrew'
  727. ],
  728. [
  729. 'value' => 'hi',
  730. 'name' => 'Hindi'
  731. ],
  732. [
  733. 'value' => 'hr',
  734. 'name' => 'Croatian'
  735. ],
  736. [
  737. 'value' => 'hu',
  738. 'name' => 'Hungarian'
  739. ],
  740. [
  741. 'value' => 'id',
  742. 'name' => 'Indonesian'
  743. ],
  744. [
  745. 'value' => 'is',
  746. 'name' => 'Icelandic'
  747. ],
  748. [
  749. 'value' => 'it',
  750. 'name' => 'Italian'
  751. ],
  752. [
  753. 'value' => 'ja',
  754. 'name' => 'Japanese'
  755. ],
  756. [
  757. 'value' => 'ko',
  758. 'name' => 'Korean'
  759. ],
  760. [
  761. 'value' => 'lt',
  762. 'name' => 'Lithuanian'
  763. ],
  764. [
  765. 'value' => 'lv',
  766. 'name' => 'Latvian'
  767. ],
  768. [
  769. 'value' => 'nb',
  770. 'name' => 'Norwegian (Bokmal)'
  771. ],
  772. [
  773. 'value' => 'nl',
  774. 'name' => 'Dutch (Standard)'
  775. ],
  776. [
  777. 'value' => 'pl',
  778. 'name' => 'Polish'
  779. ],
  780. [
  781. 'value' => 'pt',
  782. 'name' => 'Portuguese'
  783. ],
  784. [
  785. 'value' => 'pt-br',
  786. 'name' => 'Portuguese (Brazil)'
  787. ],
  788. [
  789. 'value' => 'ro',
  790. 'name' => 'Romanian'
  791. ],
  792. [
  793. 'value' => 'ru',
  794. 'name' => 'Russian'
  795. ],
  796. [
  797. 'value' => 'sk',
  798. 'name' => 'Slovak'
  799. ],
  800. [
  801. 'value' => 'sl',
  802. 'name' => 'Slovenian'
  803. ],
  804. [
  805. 'value' => 'sr',
  806. 'name' => 'Serbian'
  807. ],
  808. [
  809. 'value' => 'sv',
  810. 'name' => 'Swedish'
  811. ],
  812. [
  813. 'value' => 'th',
  814. 'name' => 'Thai'
  815. ],
  816. [
  817. 'value' => 'tr',
  818. 'name' => 'Turkish'
  819. ],
  820. [
  821. 'value' => 'uk',
  822. 'name' => 'Ukrainian'
  823. ],
  824. [
  825. 'value' => 'vi',
  826. 'name' => 'Vietnamese'
  827. ],
  828. [
  829. 'value' => 'zh-cn',
  830. 'name' => 'Chinese (PRC)'
  831. ],
  832. [
  833. 'value' => 'zh-tw',
  834. 'name' => 'Chinese (Taiwan)'
  835. ]
  836. ];
  837. }
  838. public function daysOptions()
  839. {
  840. return array(
  841. array(
  842. 'name' => 'Sunday',
  843. 'value' => '0'
  844. ),
  845. array(
  846. 'name' => 'Monday',
  847. 'value' => '1'
  848. ),
  849. array(
  850. 'name' => 'Tueday',
  851. 'value' => '2'
  852. ),
  853. array(
  854. 'name' => 'Wednesday',
  855. 'value' => '3'
  856. ),
  857. array(
  858. 'name' => 'Thursday',
  859. 'value' => '4'
  860. ),
  861. array(
  862. 'name' => 'Friday',
  863. 'value' => '5'
  864. ),
  865. array(
  866. 'name' => 'Saturday',
  867. 'value' => '6'
  868. )
  869. );
  870. }
  871. public function mediaServerOptions()
  872. {
  873. return array(
  874. array(
  875. 'name' => 'N/A',
  876. 'value' => ''
  877. ),
  878. array(
  879. 'name' => 'Plex',
  880. 'value' => 'plex'
  881. ),
  882. array(
  883. 'name' => 'Emby [Not Available]',
  884. 'value' => 'emby'
  885. )
  886. );
  887. }
  888. public function requestTvOptions($includeUserOption = false)
  889. {
  890. $options = [
  891. [
  892. 'name' => 'All Seasons',
  893. 'value' => 'all'
  894. ],
  895. [
  896. 'name' => 'First Season Only',
  897. 'value' => 'first'
  898. ],
  899. [
  900. 'name' => 'Last Season Only',
  901. 'value' => 'last'
  902. ],
  903. ];
  904. $userOption = [
  905. 'name' => 'Let User Select',
  906. 'value' => 'user'
  907. ];
  908. if ($includeUserOption) {
  909. array_push($options, $userOption);
  910. }
  911. return $options;
  912. }
  913. public function requestServiceOptions()
  914. {
  915. return [
  916. [
  917. 'name' => 'Ombi',
  918. 'value' => 'ombi'
  919. ],
  920. [
  921. 'name' => 'Overseerr',
  922. 'value' => 'overseerr'
  923. ]
  924. ];
  925. }
  926. public function limitOptions()
  927. {
  928. return array(
  929. array(
  930. 'name' => '1 Item',
  931. 'value' => '1'
  932. ),
  933. array(
  934. 'name' => '2 Items',
  935. 'value' => '2'
  936. ),
  937. array(
  938. 'name' => '3 Items',
  939. 'value' => '3'
  940. ),
  941. array(
  942. 'name' => '4 Items',
  943. 'value' => '4'
  944. ),
  945. array(
  946. 'name' => '5 Items',
  947. 'value' => '5'
  948. ),
  949. array(
  950. 'name' => '6 Items',
  951. 'value' => '6'
  952. ),
  953. array(
  954. 'name' => '7 Items',
  955. 'value' => '7'
  956. ),
  957. array(
  958. 'name' => '8 Items',
  959. 'value' => '8'
  960. ),
  961. array(
  962. 'name' => 'Unlimited',
  963. 'value' => '1000'
  964. ),
  965. );
  966. }
  967. public function notificationTypesOptions()
  968. {
  969. return array(
  970. array(
  971. 'name' => 'Toastr',
  972. 'value' => 'toastr'
  973. ),
  974. array(
  975. 'name' => 'Izi',
  976. 'value' => 'izi'
  977. ),
  978. array(
  979. 'name' => 'Alertify',
  980. 'value' => 'alertify'
  981. ),
  982. array(
  983. 'name' => 'Noty',
  984. 'value' => 'noty'
  985. ),
  986. );
  987. }
  988. public function notificationPositionsOptions()
  989. {
  990. return array(
  991. array(
  992. 'name' => 'Bottom Right',
  993. 'value' => 'br'
  994. ),
  995. array(
  996. 'name' => 'Bottom Left',
  997. 'value' => 'bl'
  998. ),
  999. array(
  1000. 'name' => 'Bottom Center',
  1001. 'value' => 'bc'
  1002. ),
  1003. array(
  1004. 'name' => 'Top Right',
  1005. 'value' => 'tr'
  1006. ),
  1007. array(
  1008. 'name' => 'Top Left',
  1009. 'value' => 'tl'
  1010. ),
  1011. array(
  1012. 'name' => 'Top Center',
  1013. 'value' => 'tc'
  1014. ),
  1015. array(
  1016. 'name' => 'Center',
  1017. 'value' => 'c'
  1018. ),
  1019. );
  1020. }
  1021. public function timeOptions()
  1022. {
  1023. return array(
  1024. array(
  1025. 'name' => '2.5',
  1026. 'value' => '2500'
  1027. ),
  1028. array(
  1029. 'name' => '5',
  1030. 'value' => '5000'
  1031. ),
  1032. array(
  1033. 'name' => '10',
  1034. 'value' => '10000'
  1035. ),
  1036. array(
  1037. 'name' => '15',
  1038. 'value' => '15000'
  1039. ),
  1040. array(
  1041. 'name' => '30',
  1042. 'value' => '30000'
  1043. ),
  1044. array(
  1045. 'name' => '60 [1 Minute]',
  1046. 'value' => '60000'
  1047. ),
  1048. array(
  1049. 'name' => '300 [5 Minutes]',
  1050. 'value' => '300000'
  1051. ),
  1052. array(
  1053. 'name' => '600 [10 Minutes]',
  1054. 'value' => '600000'
  1055. ),
  1056. array(
  1057. 'name' => '900 [15 Minutes]',
  1058. 'value' => '900000'
  1059. ),
  1060. array(
  1061. 'name' => '1800 [30 Minutes]',
  1062. 'value' => '1800000'
  1063. ),
  1064. array(
  1065. 'name' => '3600 [1 Hour]',
  1066. 'value' => '3600000'
  1067. ),
  1068. );
  1069. }
  1070. public function netdataOptions()
  1071. {
  1072. return [
  1073. [
  1074. 'name' => 'Disk Read',
  1075. 'value' => 'disk-read',
  1076. ],
  1077. [
  1078. 'name' => 'Disk Write',
  1079. 'value' => 'disk-write',
  1080. ],
  1081. [
  1082. 'name' => 'CPU',
  1083. 'value' => 'cpu'
  1084. ],
  1085. [
  1086. 'name' => 'Network Inbound',
  1087. 'value' => 'net-in',
  1088. ],
  1089. [
  1090. 'name' => 'Network Outbound',
  1091. 'value' => 'net-out',
  1092. ],
  1093. [
  1094. 'name' => 'Used RAM',
  1095. 'value' => 'ram-used',
  1096. ],
  1097. [
  1098. 'name' => 'Used Swap',
  1099. 'value' => 'swap-used',
  1100. ],
  1101. [
  1102. 'name' => 'Disk space used',
  1103. 'value' => 'disk-used',
  1104. ],
  1105. [
  1106. 'name' => 'Disk space available',
  1107. 'value' => 'disk-avail',
  1108. ],
  1109. [
  1110. 'name' => 'Custom',
  1111. 'value' => 'custom',
  1112. ]
  1113. ];
  1114. }
  1115. public function netdataChartOptions()
  1116. {
  1117. return [
  1118. [
  1119. 'name' => 'Easy Pie Chart',
  1120. 'value' => 'easypiechart',
  1121. ],
  1122. [
  1123. 'name' => 'Gauge',
  1124. 'value' => 'gauge'
  1125. ]
  1126. ];
  1127. }
  1128. public function netdataColourOptions()
  1129. {
  1130. return [
  1131. [
  1132. 'name' => 'Red',
  1133. 'value' => 'fe3912',
  1134. ],
  1135. [
  1136. 'name' => 'Green',
  1137. 'value' => '46e302',
  1138. ],
  1139. [
  1140. 'name' => 'Purple',
  1141. 'value' => 'CC22AA'
  1142. ],
  1143. [
  1144. 'name' => 'Blue',
  1145. 'value' => '5054e6',
  1146. ],
  1147. [
  1148. 'name' => 'Yellow',
  1149. 'value' => 'dddd00',
  1150. ],
  1151. [
  1152. 'name' => 'Orange',
  1153. 'value' => 'd66300',
  1154. ]
  1155. ];
  1156. }
  1157. public function netdataSizeOptions()
  1158. {
  1159. return [
  1160. [
  1161. 'name' => 'Large',
  1162. 'value' => 'lg',
  1163. ],
  1164. [
  1165. 'name' => 'Medium',
  1166. 'value' => 'md',
  1167. ],
  1168. [
  1169. 'name' => 'Small',
  1170. 'value' => 'sm'
  1171. ]
  1172. ];
  1173. }
  1174. public function timeFormatOptions()
  1175. {
  1176. return array(
  1177. array(
  1178. 'name' => '6p',
  1179. 'value' => 'h(:mm)t'
  1180. ),
  1181. array(
  1182. 'name' => '6:00p',
  1183. 'value' => 'h:mmt'
  1184. ),
  1185. array(
  1186. 'name' => '6pm',
  1187. 'value' => 'h(:mm)a'
  1188. ),
  1189. array(
  1190. 'name' => '6:00pm',
  1191. 'value' => 'h:mma'
  1192. ),
  1193. array(
  1194. 'name' => '6:00',
  1195. 'value' => 'h:mm'
  1196. ),
  1197. array(
  1198. 'name' => '18',
  1199. 'value' => 'H(:mm)'
  1200. ),
  1201. array(
  1202. 'name' => '18:00',
  1203. 'value' => 'H:mm'
  1204. )
  1205. );
  1206. }
  1207. public function rTorrentSortOptions()
  1208. {
  1209. return array(
  1210. array(
  1211. 'name' => 'Date Desc',
  1212. 'value' => 'dated'
  1213. ),
  1214. array(
  1215. 'name' => 'Date Asc',
  1216. 'value' => 'datea'
  1217. ),
  1218. array(
  1219. 'name' => 'Hash Desc',
  1220. 'value' => 'hashd'
  1221. ),
  1222. array(
  1223. 'name' => 'Hash Asc',
  1224. 'value' => 'hasha'
  1225. ),
  1226. array(
  1227. 'name' => 'Name Desc',
  1228. 'value' => 'named'
  1229. ),
  1230. array(
  1231. 'name' => 'Name Asc',
  1232. 'value' => 'namea'
  1233. ),
  1234. array(
  1235. 'name' => 'Size Desc',
  1236. 'value' => 'sized'
  1237. ),
  1238. array(
  1239. 'name' => 'Size Asc',
  1240. 'value' => 'sizea'
  1241. ),
  1242. array(
  1243. 'name' => 'Label Desc',
  1244. 'value' => 'labeld'
  1245. ),
  1246. array(
  1247. 'name' => 'Label Asc',
  1248. 'value' => 'labela'
  1249. ),
  1250. array(
  1251. 'name' => 'Status Desc',
  1252. 'value' => 'statusd'
  1253. ),
  1254. array(
  1255. 'name' => 'Status Asc',
  1256. 'value' => 'statusa'
  1257. ),
  1258. );
  1259. }
  1260. public function qBittorrentApiOptions()
  1261. {
  1262. return array(
  1263. array(
  1264. 'name' => 'V1',
  1265. 'value' => '1'
  1266. ),
  1267. array(
  1268. 'name' => 'V2',
  1269. 'value' => '2'
  1270. ),
  1271. );
  1272. }
  1273. public function qBittorrentSortOptions()
  1274. {
  1275. return array(
  1276. array(
  1277. 'name' => 'Hash',
  1278. 'value' => 'hash'
  1279. ),
  1280. array(
  1281. 'name' => 'Name',
  1282. 'value' => 'name'
  1283. ),
  1284. array(
  1285. 'name' => 'Size',
  1286. 'value' => 'size'
  1287. ),
  1288. array(
  1289. 'name' => 'Progress',
  1290. 'value' => 'progress'
  1291. ),
  1292. array(
  1293. 'name' => 'Download Speed',
  1294. 'value' => 'dlspeed'
  1295. ),
  1296. array(
  1297. 'name' => 'Upload Speed',
  1298. 'value' => 'upspeed'
  1299. ),
  1300. array(
  1301. 'name' => 'Priority',
  1302. 'value' => 'priority'
  1303. ),
  1304. array(
  1305. 'name' => 'Number of Seeds',
  1306. 'value' => 'num_seeds'
  1307. ),
  1308. array(
  1309. 'name' => 'Number of Seeds in Swarm',
  1310. 'value' => 'num_complete'
  1311. ),
  1312. array(
  1313. 'name' => 'Number of Leechers',
  1314. 'value' => 'num_leechs'
  1315. ),
  1316. array(
  1317. 'name' => 'Number of Leechers in Swarm',
  1318. 'value' => 'num_incomplete'
  1319. ),
  1320. array(
  1321. 'name' => 'Ratio',
  1322. 'value' => 'ratio'
  1323. ),
  1324. array(
  1325. 'name' => 'ETA',
  1326. 'value' => 'eta'
  1327. ),
  1328. array(
  1329. 'name' => 'State',
  1330. 'value' => 'state'
  1331. ),
  1332. array(
  1333. 'name' => 'Category',
  1334. 'value' => 'category'
  1335. )
  1336. );
  1337. }
  1338. public function calendarDefaultOptions()
  1339. {
  1340. return array(
  1341. array(
  1342. 'name' => 'Month',
  1343. 'value' => 'month'
  1344. ),
  1345. array(
  1346. 'name' => 'Day',
  1347. 'value' => 'basicDay'
  1348. ),
  1349. array(
  1350. 'name' => 'Week',
  1351. 'value' => 'basicWeek'
  1352. ),
  1353. array(
  1354. 'name' => 'List',
  1355. 'value' => 'list'
  1356. )
  1357. );
  1358. }
  1359. }