option-functions.php 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374
  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 'limit':
  289. $settingMerge = [
  290. 'type' => 'number',
  291. 'label' => 'Item Limit',
  292. ];
  293. break;
  294. case 'mediasearchserver':
  295. $settingMerge = [
  296. 'type' => 'select',
  297. 'label' => 'Media Search Server',
  298. 'options' => $this->mediaServerOptions()
  299. ];
  300. break;
  301. case 'imagecachequality':
  302. $settingMerge = [
  303. 'type' => 'select',
  304. 'label' => 'Image Cache Quality',
  305. 'options' => [
  306. [
  307. 'name' => 'Low',
  308. 'value' => '.5'
  309. ],
  310. [
  311. 'name' => '1x',
  312. 'value' => '1'
  313. ],
  314. [
  315. 'name' => '2x',
  316. 'value' => '2'
  317. ],
  318. [
  319. 'name' => '3x',
  320. 'value' => '3'
  321. ]
  322. ]
  323. ];
  324. break;
  325. case 'blank':
  326. $settingMerge = [
  327. 'type' => 'blank',
  328. 'label' => '',
  329. ];
  330. break;
  331. case 'plexlibraryexclude':
  332. $settingMerge = [
  333. 'type' => 'select2',
  334. 'class' => 'select2-multiple',
  335. 'id' => $name . '-exclude-select-' . $this->random_ascii_string(6),
  336. 'label' => 'Libraries to Exclude',
  337. 'options' => $extras['options']
  338. ];
  339. break;
  340. case 'plexlibraryinclude':
  341. $settingMerge = [
  342. 'type' => 'select2',
  343. 'class' => 'select2-multiple',
  344. 'id' => $name . '-include-select-' . $this->random_ascii_string(6),
  345. 'label' => 'Libraries to Include',
  346. 'options' => $extras['options']
  347. ];
  348. break;
  349. // HTML ITEMS
  350. // precodeeditor possibly not needed anymore
  351. case 'precodeeditor':
  352. $settingMerge = [
  353. 'type' => 'textbox',
  354. 'class' => 'hidden ' . $name . 'Textarea',
  355. 'label' => '',
  356. ];
  357. break;
  358. case 'codeeditor':
  359. $mode = strtolower($extras['mode'] ?? 'css');
  360. switch ($mode) {
  361. case 'html':
  362. case 'javascript':
  363. $mode = 'ace/mode/' . $mode;
  364. break;
  365. case 'js':
  366. $mode = 'ace/mode/javascript';
  367. break;
  368. default:
  369. $mode = 'ace/mode/css';
  370. break;
  371. }
  372. $settingMerge = [
  373. 'type' => 'html',
  374. 'override' => 12,
  375. 'label' => 'Custom Code',
  376. 'html' => '
  377. <textarea data-changed="false" class="form-control hidden ' . $name . 'Textarea" name="' . $name . '" data-type="textbox" autocomplete="new-password">' . $this->config[$name] . '</textarea>
  378. <div id="' . $name . 'Editor" style="height:300px">' . htmlentities($this->config[$name]) . '</div>
  379. <script>
  380. let mode = ace.require("' . $mode . '").Mode;
  381. ' . $name . ' = ace.edit("' . $name . 'Editor");
  382. ' . $name . '.session.setMode(new mode());
  383. ' . $name . '.setTheme("ace/theme/idle_fingers");
  384. ' . $name . '.setShowPrintMargin(false);
  385. ' . $name . '.session.on("change", function(delta) { $(".' . $name . 'Textarea").val(' . $name . '.getValue()); $(".' . $name . 'Textarea").trigger("change") });
  386. </script>
  387. '
  388. ];
  389. break;
  390. // CALENDAR ITEMS
  391. case 'calendarstart':
  392. $settingMerge = [
  393. 'type' => 'number',
  394. 'label' => '# of Days Before'
  395. ];
  396. break;
  397. case 'calendarend':
  398. $settingMerge = [
  399. 'type' => 'number',
  400. 'label' => '# of Days After'
  401. ];
  402. break;
  403. case 'calendarstartingday':
  404. case 'calendarstartday':
  405. case 'calendarstart':
  406. $settingMerge = [
  407. 'type' => 'select',
  408. 'label' => 'Start Day',
  409. 'options' => $this->daysOptions()
  410. ];
  411. break;
  412. case 'calendardefaultview':
  413. $settingMerge = [
  414. 'type' => 'select',
  415. 'label' => 'Default View',
  416. 'options' => $this->calendarDefaultOptions()
  417. ];
  418. break;
  419. case 'calendartimeformat':
  420. $settingMerge = [
  421. 'type' => 'select',
  422. 'label' => 'Time Format',
  423. 'options' => $this->timeFormatOptions()
  424. ];
  425. break;
  426. case 'calendarlocale':
  427. $settingMerge = [
  428. 'type' => 'select',
  429. 'label' => 'Locale',
  430. 'options' => $this->calendarLocaleOptions()
  431. ];
  432. break;
  433. case 'calendarlimit':
  434. $settingMerge = [
  435. 'type' => 'select',
  436. 'label' => 'Items Per Day',
  437. 'options' => $this->limitOptions()
  438. ];
  439. break;
  440. case 'color':
  441. $settingMerge = [
  442. 'type' => 'input',
  443. 'label' => 'Color',
  444. 'class' => 'pick-a-color-custom-options',
  445. 'attr' => 'data-original="' . $this->config[$name] . '"'
  446. ];
  447. break;
  448. case 'calendarlinkurl':
  449. $settingMerge = [
  450. 'type' => 'select',
  451. 'label' => 'Target URL',
  452. 'help' => 'Set the primary URL used when clicking on calendar icon.',
  453. 'options' => $this->makeOptionsFromValues($this->config[str_replace('CalendarLink','',$name).'URL'], true, 'Use Default'),
  454. ];
  455. break;
  456. case 'calendarframetarget':
  457. $settingMerge = [
  458. 'type' => 'select',
  459. 'label' => 'Target Tab',
  460. 'help' => 'Set the tab used when clicking on calendar icon. If not set, link will open in new window.',
  461. 'options' => $this->getIframeTabs($this->config[str_replace('FrameTarget','CalendarLink',$name)])
  462. ];
  463. break;
  464. default:
  465. $settingMerge = [
  466. 'type' => strtolower($type),
  467. 'label' => ''
  468. ];
  469. break;
  470. }
  471. $setting = array_merge($settingMerge, $setting);
  472. if ($extras) {
  473. if (gettype($extras) == 'array') {
  474. $setting = array_merge($setting, $extras);
  475. }
  476. }
  477. return $setting;
  478. }
  479. public function getIframeTabs($url = "")
  480. {
  481. if (!empty($url)){
  482. $response = [
  483. array(
  484. 'function' => 'fetchAll',
  485. 'query' => array(
  486. "SELECT * FROM tabs WHERE `enabled`='1' AND `type`='1' AND `group_id`>=? AND (`url` = '" . $url . "' OR `url_local` = '" . $url . "') ORDER BY `order` ASC",
  487. $this->getUserLevel(),
  488. )
  489. )
  490. ];
  491. } else {
  492. $response = [
  493. array(
  494. 'function' => 'fetchAll',
  495. 'query' => array(
  496. "SELECT * FROM tabs WHERE `enabled`='1' AND `type`='1' AND `group_id`>=? ORDER BY `order` ASC",
  497. $this->getUserLevel()
  498. )
  499. )
  500. ];
  501. }
  502. $formattedValues[] = [
  503. 'name' => 'Open in New Window',
  504. 'value' => ''
  505. ];
  506. foreach($this->processQueries($response) as $result) {
  507. $formattedValues[] = [
  508. 'name' => $result['name'],
  509. 'value' => $result['name']
  510. ];
  511. }
  512. return $formattedValues;
  513. }
  514. public function makeOptionsFromValues($values = null, $appendBlank = null, $blankLabel = null)
  515. {
  516. if ($appendBlank === true){
  517. $formattedValues[] = [
  518. 'name' => (!empty($blankLabel)) ? $blankLabel : 'Select option...',
  519. 'value' => ''
  520. ];
  521. } else {
  522. $formattedValues = [];
  523. }
  524. if (strpos($values, ',') !== false) {
  525. $explode = explode(',', $values);
  526. foreach ($explode as $item) {
  527. $formattedValues[] = [
  528. 'name' => $item,
  529. 'value' => $item
  530. ];
  531. }
  532. } elseif ($values == '') {
  533. $formattedValues = '';
  534. } else {
  535. $formattedValues[] = [
  536. 'name' => $values,
  537. 'value' => $values
  538. ];
  539. }
  540. return $formattedValues;
  541. }
  542. public function logLevels()
  543. {
  544. return [
  545. [
  546. 'name' => 'Debug',
  547. 'value' => 'DEBUG'
  548. ],
  549. [
  550. 'name' => 'Info',
  551. 'value' => 'INFO'
  552. ],
  553. [
  554. 'name' => 'Notice',
  555. 'value' => 'NOTICE'
  556. ],
  557. [
  558. 'name' => 'Warning',
  559. 'value' => 'WARNING'
  560. ],
  561. [
  562. 'name' => 'Error',
  563. 'value' => 'ERROR'
  564. ],
  565. [
  566. 'name' => 'Critical',
  567. 'value' => 'CRITICAL'
  568. ],
  569. [
  570. 'name' => 'Alert',
  571. 'value' => 'ALERT'
  572. ],
  573. [
  574. 'name' => 'Emergency',
  575. 'value' => 'EMERGENCY'
  576. ]
  577. ];
  578. }
  579. public function sandboxOptions()
  580. {
  581. return [
  582. [
  583. 'name' => 'Allow Presentation',
  584. 'value' => 'allow-presentation'
  585. ],
  586. [
  587. 'name' => 'Allow Forms',
  588. 'value' => 'allow-forms'
  589. ],
  590. [
  591. 'name' => 'Allow Same Origin',
  592. 'value' => 'allow-same-origin'
  593. ],
  594. [
  595. 'name' => 'Allow Orientation Lock',
  596. 'value' => 'allow-orientation-lock'
  597. ],
  598. [
  599. 'name' => 'Allow Pointer Lock',
  600. 'value' => 'allow-pointer-lock'
  601. ],
  602. [
  603. 'name' => 'Allow Scripts',
  604. 'value' => 'allow-scripts'
  605. ],
  606. [
  607. 'name' => 'Allow Popups',
  608. 'value' => 'allow-popups'
  609. ],
  610. [
  611. 'name' => 'Allow Popups To Escape Sandbox',
  612. 'value' => 'allow-popups-to-escape-sandbox'
  613. ],
  614. [
  615. 'name' => 'Allow Modals',
  616. 'value' => 'allow-modals'
  617. ],
  618. [
  619. 'name' => 'Allow Top Navigation',
  620. 'value' => 'allow-top-navigation'
  621. ],
  622. [
  623. 'name' => 'Allow Top Navigation By User Activation',
  624. 'value' => 'allow-top-navigation-by-user-activation'
  625. ],
  626. [
  627. 'name' => 'Allow Downloads',
  628. 'value' => 'allow-downloads'
  629. ],
  630. ];
  631. }
  632. public function calendarLocaleOptions()
  633. {
  634. return [
  635. [
  636. 'name' => 'Arabic (Standard)',
  637. 'value' => 'ar',
  638. ],
  639. [
  640. 'name' => 'Arabic (Morocco)',
  641. 'value' => 'ar-ma',
  642. ],
  643. [
  644. 'name' => 'Arabic (Saudi Arabia)',
  645. 'value' => 'ar-sa'
  646. ],
  647. [
  648. 'value' => 'ar-tn',
  649. 'name' => 'Arabic (Tunisia)'
  650. ],
  651. [
  652. 'value' => 'bg',
  653. 'name' => 'Bulgarian'
  654. ],
  655. [
  656. 'value' => 'ca',
  657. 'name' => 'Catalan'
  658. ],
  659. [
  660. 'value' => 'cs',
  661. 'name' => 'Czech'
  662. ],
  663. [
  664. 'value' => 'da',
  665. 'name' => 'Danish'
  666. ],
  667. [
  668. 'value' => 'de',
  669. 'name' => 'German (Standard)'
  670. ],
  671. [
  672. 'value' => 'de-at',
  673. 'name' => 'German (Austria)'
  674. ],
  675. [
  676. 'value' => 'el',
  677. 'name' => 'Greek'
  678. ],
  679. [
  680. 'value' => 'en',
  681. 'name' => 'English'
  682. ],
  683. [
  684. 'value' => 'en-au',
  685. 'name' => 'English (Australia)'
  686. ],
  687. [
  688. 'value' => 'en-ca',
  689. 'name' => 'English (Canada)'
  690. ],
  691. [
  692. 'value' => 'en-gb',
  693. 'name' => 'English (United Kingdom)'
  694. ],
  695. [
  696. 'value' => 'es',
  697. 'name' => 'Spanish'
  698. ],
  699. [
  700. 'value' => 'fa',
  701. 'name' => 'Farsi'
  702. ],
  703. [
  704. 'value' => 'fi',
  705. 'name' => 'Finnish'
  706. ],
  707. [
  708. 'value' => 'fr',
  709. 'name' => 'French (Standard)'
  710. ],
  711. [
  712. 'value' => 'fr-ca',
  713. 'name' => 'French (Canada)'
  714. ],
  715. [
  716. 'value' => 'he',
  717. 'name' => 'Hebrew'
  718. ],
  719. [
  720. 'value' => 'hi',
  721. 'name' => 'Hindi'
  722. ],
  723. [
  724. 'value' => 'hr',
  725. 'name' => 'Croatian'
  726. ],
  727. [
  728. 'value' => 'hu',
  729. 'name' => 'Hungarian'
  730. ],
  731. [
  732. 'value' => 'id',
  733. 'name' => 'Indonesian'
  734. ],
  735. [
  736. 'value' => 'is',
  737. 'name' => 'Icelandic'
  738. ],
  739. [
  740. 'value' => 'it',
  741. 'name' => 'Italian'
  742. ],
  743. [
  744. 'value' => 'ja',
  745. 'name' => 'Japanese'
  746. ],
  747. [
  748. 'value' => 'ko',
  749. 'name' => 'Korean'
  750. ],
  751. [
  752. 'value' => 'lt',
  753. 'name' => 'Lithuanian'
  754. ],
  755. [
  756. 'value' => 'lv',
  757. 'name' => 'Latvian'
  758. ],
  759. [
  760. 'value' => 'nb',
  761. 'name' => 'Norwegian (Bokmal)'
  762. ],
  763. [
  764. 'value' => 'nl',
  765. 'name' => 'Dutch (Standard)'
  766. ],
  767. [
  768. 'value' => 'pl',
  769. 'name' => 'Polish'
  770. ],
  771. [
  772. 'value' => 'pt',
  773. 'name' => 'Portuguese'
  774. ],
  775. [
  776. 'value' => 'pt-br',
  777. 'name' => 'Portuguese (Brazil)'
  778. ],
  779. [
  780. 'value' => 'ro',
  781. 'name' => 'Romanian'
  782. ],
  783. [
  784. 'value' => 'ru',
  785. 'name' => 'Russian'
  786. ],
  787. [
  788. 'value' => 'sk',
  789. 'name' => 'Slovak'
  790. ],
  791. [
  792. 'value' => 'sl',
  793. 'name' => 'Slovenian'
  794. ],
  795. [
  796. 'value' => 'sr',
  797. 'name' => 'Serbian'
  798. ],
  799. [
  800. 'value' => 'sv',
  801. 'name' => 'Swedish'
  802. ],
  803. [
  804. 'value' => 'th',
  805. 'name' => 'Thai'
  806. ],
  807. [
  808. 'value' => 'tr',
  809. 'name' => 'Turkish'
  810. ],
  811. [
  812. 'value' => 'uk',
  813. 'name' => 'Ukrainian'
  814. ],
  815. [
  816. 'value' => 'vi',
  817. 'name' => 'Vietnamese'
  818. ],
  819. [
  820. 'value' => 'zh-cn',
  821. 'name' => 'Chinese (PRC)'
  822. ],
  823. [
  824. 'value' => 'zh-tw',
  825. 'name' => 'Chinese (Taiwan)'
  826. ]
  827. ];
  828. }
  829. public function daysOptions()
  830. {
  831. return array(
  832. array(
  833. 'name' => 'Sunday',
  834. 'value' => '0'
  835. ),
  836. array(
  837. 'name' => 'Monday',
  838. 'value' => '1'
  839. ),
  840. array(
  841. 'name' => 'Tueday',
  842. 'value' => '2'
  843. ),
  844. array(
  845. 'name' => 'Wednesday',
  846. 'value' => '3'
  847. ),
  848. array(
  849. 'name' => 'Thursday',
  850. 'value' => '4'
  851. ),
  852. array(
  853. 'name' => 'Friday',
  854. 'value' => '5'
  855. ),
  856. array(
  857. 'name' => 'Saturday',
  858. 'value' => '6'
  859. )
  860. );
  861. }
  862. public function mediaServerOptions()
  863. {
  864. return array(
  865. array(
  866. 'name' => 'N/A',
  867. 'value' => ''
  868. ),
  869. array(
  870. 'name' => 'Plex',
  871. 'value' => 'plex'
  872. ),
  873. array(
  874. 'name' => 'Emby [Not Available]',
  875. 'value' => 'emby'
  876. )
  877. );
  878. }
  879. public function requestTvOptions($includeUserOption = false)
  880. {
  881. $options = [
  882. [
  883. 'name' => 'All Seasons',
  884. 'value' => 'all'
  885. ],
  886. [
  887. 'name' => 'First Season Only',
  888. 'value' => 'first'
  889. ],
  890. [
  891. 'name' => 'Last Season Only',
  892. 'value' => 'last'
  893. ],
  894. ];
  895. $userOption = [
  896. 'name' => 'Let User Select',
  897. 'value' => 'user'
  898. ];
  899. if ($includeUserOption) {
  900. array_push($options, $userOption);
  901. }
  902. return $options;
  903. }
  904. public function requestServiceOptions()
  905. {
  906. return [
  907. [
  908. 'name' => 'Ombi',
  909. 'value' => 'ombi'
  910. ],
  911. [
  912. 'name' => 'Overseerr',
  913. 'value' => 'overseerr'
  914. ]
  915. ];
  916. }
  917. public function limitOptions()
  918. {
  919. return array(
  920. array(
  921. 'name' => '1 Item',
  922. 'value' => '1'
  923. ),
  924. array(
  925. 'name' => '2 Items',
  926. 'value' => '2'
  927. ),
  928. array(
  929. 'name' => '3 Items',
  930. 'value' => '3'
  931. ),
  932. array(
  933. 'name' => '4 Items',
  934. 'value' => '4'
  935. ),
  936. array(
  937. 'name' => '5 Items',
  938. 'value' => '5'
  939. ),
  940. array(
  941. 'name' => '6 Items',
  942. 'value' => '6'
  943. ),
  944. array(
  945. 'name' => '7 Items',
  946. 'value' => '7'
  947. ),
  948. array(
  949. 'name' => '8 Items',
  950. 'value' => '8'
  951. ),
  952. array(
  953. 'name' => 'Unlimited',
  954. 'value' => '1000'
  955. ),
  956. );
  957. }
  958. public function notificationTypesOptions()
  959. {
  960. return array(
  961. array(
  962. 'name' => 'Toastr',
  963. 'value' => 'toastr'
  964. ),
  965. array(
  966. 'name' => 'Izi',
  967. 'value' => 'izi'
  968. ),
  969. array(
  970. 'name' => 'Alertify',
  971. 'value' => 'alertify'
  972. ),
  973. array(
  974. 'name' => 'Noty',
  975. 'value' => 'noty'
  976. ),
  977. );
  978. }
  979. public function notificationPositionsOptions()
  980. {
  981. return array(
  982. array(
  983. 'name' => 'Bottom Right',
  984. 'value' => 'br'
  985. ),
  986. array(
  987. 'name' => 'Bottom Left',
  988. 'value' => 'bl'
  989. ),
  990. array(
  991. 'name' => 'Bottom Center',
  992. 'value' => 'bc'
  993. ),
  994. array(
  995. 'name' => 'Top Right',
  996. 'value' => 'tr'
  997. ),
  998. array(
  999. 'name' => 'Top Left',
  1000. 'value' => 'tl'
  1001. ),
  1002. array(
  1003. 'name' => 'Top Center',
  1004. 'value' => 'tc'
  1005. ),
  1006. array(
  1007. 'name' => 'Center',
  1008. 'value' => 'c'
  1009. ),
  1010. );
  1011. }
  1012. public function timeOptions()
  1013. {
  1014. return array(
  1015. array(
  1016. 'name' => '2.5',
  1017. 'value' => '2500'
  1018. ),
  1019. array(
  1020. 'name' => '5',
  1021. 'value' => '5000'
  1022. ),
  1023. array(
  1024. 'name' => '10',
  1025. 'value' => '10000'
  1026. ),
  1027. array(
  1028. 'name' => '15',
  1029. 'value' => '15000'
  1030. ),
  1031. array(
  1032. 'name' => '30',
  1033. 'value' => '30000'
  1034. ),
  1035. array(
  1036. 'name' => '60 [1 Minute]',
  1037. 'value' => '60000'
  1038. ),
  1039. array(
  1040. 'name' => '300 [5 Minutes]',
  1041. 'value' => '300000'
  1042. ),
  1043. array(
  1044. 'name' => '600 [10 Minutes]',
  1045. 'value' => '600000'
  1046. ),
  1047. array(
  1048. 'name' => '900 [15 Minutes]',
  1049. 'value' => '900000'
  1050. ),
  1051. array(
  1052. 'name' => '1800 [30 Minutes]',
  1053. 'value' => '1800000'
  1054. ),
  1055. array(
  1056. 'name' => '3600 [1 Hour]',
  1057. 'value' => '3600000'
  1058. ),
  1059. );
  1060. }
  1061. public function netdataOptions()
  1062. {
  1063. return [
  1064. [
  1065. 'name' => 'Disk Read',
  1066. 'value' => 'disk-read',
  1067. ],
  1068. [
  1069. 'name' => 'Disk Write',
  1070. 'value' => 'disk-write',
  1071. ],
  1072. [
  1073. 'name' => 'CPU',
  1074. 'value' => 'cpu'
  1075. ],
  1076. [
  1077. 'name' => 'Network Inbound',
  1078. 'value' => 'net-in',
  1079. ],
  1080. [
  1081. 'name' => 'Network Outbound',
  1082. 'value' => 'net-out',
  1083. ],
  1084. [
  1085. 'name' => 'Used RAM',
  1086. 'value' => 'ram-used',
  1087. ],
  1088. [
  1089. 'name' => 'Used Swap',
  1090. 'value' => 'swap-used',
  1091. ],
  1092. [
  1093. 'name' => 'Disk space used',
  1094. 'value' => 'disk-used',
  1095. ],
  1096. [
  1097. 'name' => 'Disk space available',
  1098. 'value' => 'disk-avail',
  1099. ],
  1100. [
  1101. 'name' => 'Custom',
  1102. 'value' => 'custom',
  1103. ]
  1104. ];
  1105. }
  1106. public function netdataChartOptions()
  1107. {
  1108. return [
  1109. [
  1110. 'name' => 'Easy Pie Chart',
  1111. 'value' => 'easypiechart',
  1112. ],
  1113. [
  1114. 'name' => 'Gauge',
  1115. 'value' => 'gauge'
  1116. ]
  1117. ];
  1118. }
  1119. public function netdataColourOptions()
  1120. {
  1121. return [
  1122. [
  1123. 'name' => 'Red',
  1124. 'value' => 'fe3912',
  1125. ],
  1126. [
  1127. 'name' => 'Green',
  1128. 'value' => '46e302',
  1129. ],
  1130. [
  1131. 'name' => 'Purple',
  1132. 'value' => 'CC22AA'
  1133. ],
  1134. [
  1135. 'name' => 'Blue',
  1136. 'value' => '5054e6',
  1137. ],
  1138. [
  1139. 'name' => 'Yellow',
  1140. 'value' => 'dddd00',
  1141. ],
  1142. [
  1143. 'name' => 'Orange',
  1144. 'value' => 'd66300',
  1145. ]
  1146. ];
  1147. }
  1148. public function netdataSizeOptions()
  1149. {
  1150. return [
  1151. [
  1152. 'name' => 'Large',
  1153. 'value' => 'lg',
  1154. ],
  1155. [
  1156. 'name' => 'Medium',
  1157. 'value' => 'md',
  1158. ],
  1159. [
  1160. 'name' => 'Small',
  1161. 'value' => 'sm'
  1162. ]
  1163. ];
  1164. }
  1165. public function timeFormatOptions()
  1166. {
  1167. return array(
  1168. array(
  1169. 'name' => '6p',
  1170. 'value' => 'h(:mm)t'
  1171. ),
  1172. array(
  1173. 'name' => '6:00p',
  1174. 'value' => 'h:mmt'
  1175. ),
  1176. array(
  1177. 'name' => '6pm',
  1178. 'value' => 'h(:mm)a'
  1179. ),
  1180. array(
  1181. 'name' => '6:00pm',
  1182. 'value' => 'h:mma'
  1183. ),
  1184. array(
  1185. 'name' => '6:00',
  1186. 'value' => 'h:mm'
  1187. ),
  1188. array(
  1189. 'name' => '18',
  1190. 'value' => 'H(:mm)'
  1191. ),
  1192. array(
  1193. 'name' => '18:00',
  1194. 'value' => 'H:mm'
  1195. )
  1196. );
  1197. }
  1198. public function rTorrentSortOptions()
  1199. {
  1200. return array(
  1201. array(
  1202. 'name' => 'Date Desc',
  1203. 'value' => 'dated'
  1204. ),
  1205. array(
  1206. 'name' => 'Date Asc',
  1207. 'value' => 'datea'
  1208. ),
  1209. array(
  1210. 'name' => 'Hash Desc',
  1211. 'value' => 'hashd'
  1212. ),
  1213. array(
  1214. 'name' => 'Hash Asc',
  1215. 'value' => 'hasha'
  1216. ),
  1217. array(
  1218. 'name' => 'Name Desc',
  1219. 'value' => 'named'
  1220. ),
  1221. array(
  1222. 'name' => 'Name Asc',
  1223. 'value' => 'namea'
  1224. ),
  1225. array(
  1226. 'name' => 'Size Desc',
  1227. 'value' => 'sized'
  1228. ),
  1229. array(
  1230. 'name' => 'Size Asc',
  1231. 'value' => 'sizea'
  1232. ),
  1233. array(
  1234. 'name' => 'Label Desc',
  1235. 'value' => 'labeld'
  1236. ),
  1237. array(
  1238. 'name' => 'Label Asc',
  1239. 'value' => 'labela'
  1240. ),
  1241. array(
  1242. 'name' => 'Status Desc',
  1243. 'value' => 'statusd'
  1244. ),
  1245. array(
  1246. 'name' => 'Status Asc',
  1247. 'value' => 'statusa'
  1248. ),
  1249. );
  1250. }
  1251. public function qBittorrentApiOptions()
  1252. {
  1253. return array(
  1254. array(
  1255. 'name' => 'V1',
  1256. 'value' => '1'
  1257. ),
  1258. array(
  1259. 'name' => 'V2',
  1260. 'value' => '2'
  1261. ),
  1262. );
  1263. }
  1264. public function qBittorrentSortOptions()
  1265. {
  1266. return array(
  1267. array(
  1268. 'name' => 'Hash',
  1269. 'value' => 'hash'
  1270. ),
  1271. array(
  1272. 'name' => 'Name',
  1273. 'value' => 'name'
  1274. ),
  1275. array(
  1276. 'name' => 'Size',
  1277. 'value' => 'size'
  1278. ),
  1279. array(
  1280. 'name' => 'Progress',
  1281. 'value' => 'progress'
  1282. ),
  1283. array(
  1284. 'name' => 'Download Speed',
  1285. 'value' => 'dlspeed'
  1286. ),
  1287. array(
  1288. 'name' => 'Upload Speed',
  1289. 'value' => 'upspeed'
  1290. ),
  1291. array(
  1292. 'name' => 'Priority',
  1293. 'value' => 'priority'
  1294. ),
  1295. array(
  1296. 'name' => 'Number of Seeds',
  1297. 'value' => 'num_seeds'
  1298. ),
  1299. array(
  1300. 'name' => 'Number of Seeds in Swarm',
  1301. 'value' => 'num_complete'
  1302. ),
  1303. array(
  1304. 'name' => 'Number of Leechers',
  1305. 'value' => 'num_leechs'
  1306. ),
  1307. array(
  1308. 'name' => 'Number of Leechers in Swarm',
  1309. 'value' => 'num_incomplete'
  1310. ),
  1311. array(
  1312. 'name' => 'Ratio',
  1313. 'value' => 'ratio'
  1314. ),
  1315. array(
  1316. 'name' => 'ETA',
  1317. 'value' => 'eta'
  1318. ),
  1319. array(
  1320. 'name' => 'State',
  1321. 'value' => 'state'
  1322. ),
  1323. array(
  1324. 'name' => 'Category',
  1325. 'value' => 'category'
  1326. )
  1327. );
  1328. }
  1329. public function calendarDefaultOptions()
  1330. {
  1331. return array(
  1332. array(
  1333. 'name' => 'Month',
  1334. 'value' => 'month'
  1335. ),
  1336. array(
  1337. 'name' => 'Day',
  1338. 'value' => 'basicDay'
  1339. ),
  1340. array(
  1341. 'name' => 'Week',
  1342. 'value' => 'basicWeek'
  1343. ),
  1344. array(
  1345. 'name' => 'List',
  1346. 'value' => 'list'
  1347. )
  1348. );
  1349. }
  1350. }