option-functions.php 27 KB

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