@@ -41,7 +41,7 @@ public function main() {
41
41
42
42
if (!$ this ->enable ) return $ this ->noCache ();
43
43
44
- $ content = '<div class="container-fluid"> ' ;
44
+ $ content = '<div class="container-fluid-off "> ' ;
45
45
46
46
// if (empty($_GET['mod'])) {
47
47
// $content .= $this->welcome();
@@ -78,23 +78,36 @@ public function all() {
78
78
$ this ->db ->query ('DELETE FROM ' .$ this ->table .'oldlinks WHERE sticky != 1 ' );
79
79
}
80
80
}
81
- $ c .= '<div class="succes "><p>Done.</p></div> ' ;
81
+ $ c .= '<div class="text-center "><p class="text-success bg-success" style="padding: 10px;" >Done.</p></div> ' ;
82
82
}
83
83
$ c .= '
84
- <h2>Force all links to update upon next hit</h2>
85
- <p>Upon next page hit, all links will be regenerated and if changed, any old link will be moved to "oldlinks".</p>
86
- <form method="post" action=" ' .$ this ->file .'mod=all">
87
- <input type="submit" name="refresh" value="FORCE UPDATE OF ALL LINKS" class="btn btn-warning">
88
- </form>
89
-
90
- <h2>Start again</h2>
91
- <p>Delete everything - cache and oldlinks.</p>
92
- <form method="post" action=" ' .$ this ->file .'mod=all" class="form-inline">
93
- <input type="submit" name="delete" value="DELETE EVERYTHING AND START AGAIN" class="btn btn-danger">
94
- <label class="checkbox">
95
- <input type="checkbox" name="sticky" value="1"> Delete sticky too
96
- </label>
97
- </form>
84
+ <div class="row">
85
+ <div class="col-md-6">
86
+ <div class="panel panel-default">
87
+ <div class="panel-heading">Force all links to update upon next hit</div>
88
+ <div class="panel-body">
89
+ <p>Upon next page hit, all links will be regenerated and if changed, any old link will be moved to "oldlinks".</p>
90
+ <form method="post" action=" ' .$ this ->file .'mod=all">
91
+ <input type="submit" name="refresh" value="FORCE UPDATE OF ALL LINKS" class="btn btn-warning">
92
+ </form>
93
+ </div>
94
+ </div>
95
+
96
+ <div class="panel panel-default">
97
+ <div class="panel-heading">Start again</div>
98
+ <div class="panel-body">
99
+ <p>Delete everything - cache and oldlinks.</p>
100
+ <form method="post" action=" ' .$ this ->file .'mod=all">
101
+ <div class="form-group">
102
+ <label>
103
+ <input type="checkbox" name="sticky" value="1"> Delete sticky too
104
+ </label>
105
+ </div>
106
+ <input type="submit" name="delete" value="DELETE EVERYTHING AND START AGAIN" class="btn btn-danger">
107
+ </form>
108
+ </div>
109
+ </div>
110
+ </div></div>
98
111
' ;
99
112
return $ c ;
100
113
}
@@ -151,7 +164,7 @@ public function sticky() {
151
164
if (!$ q || $ this ->db ->affected_rows ()==0 ) {
152
165
$ c = '<div class="error"><p>The sticky value hasn \'t been changed because the link doesn \'t exist (or maybe a DB error).</p></div> ' ;
153
166
} else {
154
- $ c = '<div class="succes "><p>The sticky value has been changed.</p></div> ' ;
167
+ $ c = '<div class="bg-success text-center "><p class="text-success" style="padding:15px;" >The sticky value has been changed.</p></div> ' ;
155
168
}
156
169
}
157
170
$ c .= $ this ->getBackLink ();
@@ -200,7 +213,7 @@ public function update() {
200
213
201
214
private function getBackLink () {
202
215
if (!empty ($ _GET ['from ' ])) $ from = explode (': ' ,$ _GET ['from ' ]);
203
- return '<p class="center"><a href=" ' .$ this ->file .(empty ($ from [0 ])?'' :'mod= ' .$ from [0 ].(empty ($ from [1 ])?'' :'&l= ' .$ from [1 ])).'"><< Back</a></p> ' ;
216
+ return '<p><a class="btn btn-primary" href=" ' .$ this ->file .(empty ($ from [0 ])?'' :'mod= ' .$ from [0 ].(empty ($ from [1 ])?'' :'&l= ' .$ from [1 ])).'"><< Back</a></p> ' ;
204
217
}
205
218
206
219
public function cache () {
@@ -213,20 +226,31 @@ public function cache() {
213
226
214
227
$ c = '<h1>Cached links</h1> ' ;
215
228
216
- $ c .= '<p class="center" > ' ;
217
- $ c .= '<b><a href=" ' .$ this ->file .'mod=cache&l= ' .urlencode ('% ' ).'">all </a></b >
229
+ $ c .= '<p> ' ;
230
+ $ c .= '<a class="badge badge-bprimary" href=" ' .$ this ->file .'mod=cache&l= ' .urlencode ('% ' ).'">All </a>
218
231
' ;
219
232
for ($ i =ord ('A ' );$ i <=ord ('Z ' );$ i ++) {
220
- $ c .= '<b><a href=" ' .$ this ->file .'mod=cache&l= ' .strtoupper (chr ($ i )).'"> ' .strtoupper (chr ($ i )).'</a></b >
233
+ $ c .= '<a class="badge" href=" ' .$ this ->file .'mod=cache&l= ' .strtoupper (chr ($ i )).'"> ' .strtoupper (chr ($ i )).'</a>
221
234
' ;
222
235
}
223
- $ c .= '</p> ' ;
224
- $ c .= '<form method="post" action=" ' .$ this ->file .'" class="form-inline">
225
- <label>Link starts with: <input type="text" name="l" class="a form-control" value=" ' .htmlspecialchars ($ let ).'"></label>
226
- <input type="hidden" name="mod" value="cache">
227
- <input type="submit" value="Search" class="submit btn btn-primary">
228
- <label><input type="checkbox" name="domain" value="1" ' .(!empty ($ _REQUEST ['domain ' ])?' checked="checked" ' :'' ).'> Ignore domain</label>
229
- </form> ' ;
236
+ $ c .= '</p> <hr> ' ;
237
+ $ c .= '<div class="row">
238
+ <div class="col-md-6">
239
+ <form method="post" action=" ' .$ this ->file .'">
240
+ <label>Link starts with:</label>
241
+ <div class="form-group">
242
+ <div class="input-group">
243
+ <input type="text" name="l" class="a form-control" value=" ' .htmlspecialchars ($ let ).'">
244
+ <input type="hidden" name="mod" value="cache">
245
+ <span class="input-group-btn">
246
+ <input type="submit" value="Search" class="submit btn btn-primary">
247
+ </span>
248
+ </div>
249
+ </div>
250
+ <div class="form-group">
251
+ <label><input type="checkbox" name="domain" value="1" ' .(!empty ($ _REQUEST ['domain ' ])?' checked="checked" ' :'' ).'> Ignore domain</label>
252
+ </div>
253
+ </form></div></div> ' ;
230
254
231
255
if (!empty ($ let )) {
232
256
@@ -238,13 +262,13 @@ public function cache() {
238
262
}
239
263
$ num = $ this ->db ->num_rows ($ q );
240
264
if ($ num >0 ) {
241
- $ c .= '<p class="center">Records found: ' .$ num .'</p> ' ;
265
+ $ c .= '<p class="center text-info ">Records found: ' .$ num .'</p> ' ;
242
266
$ c .= '<form method="post" action=" ' .$ this ->file .'mod=cache"> ' ;
243
- $ c .= '<table id="list" class="table table-striped"><thead><tr><th class="left">Cached URI</th><th>Parameters</th><th>Cached</th><th>Last check</th><th>Sticky</th><th>Action</th></tr></thead> ' ;
267
+ $ c .= '<table id="list" class="table table-striped" style="table-layout: fixed;" ><thead><tr><th class="left" style="width: 30%;" >Cached URI</th><th style="width: 30%;" >Parameters</th><th style="width: 10%;" >Cached</th><th style="width: 10%;" >Last check</th><th style="width: 5%;" >Sticky</th><th style="width: 20%;" >Action</th></tr></thead> ' ;
244
268
while ($ row = $ this ->db ->fetch ($ q )) {
245
269
$ c .= '<tr>
246
- <td class="left"> ' .htmlspecialchars ($ row ['url ' ]).'</td>
247
- <td> ' .htmlspecialchars ($ this ->serializedArrayToQueryString ($ row ['params ' ])).'</td>
270
+ <td class="left" style="word-wrap: break-word;" > ' .htmlspecialchars ($ row ['url ' ]).'</td>
271
+ <td style="word-wrap: break-word;" > ' .htmlspecialchars ($ this ->serializedArrayToQueryString ($ row ['params ' ])).'</td>
248
272
<td> ' .$ row ['crdatetime ' ].'</td>
249
273
<td> ' .$ row ['tstamp ' ].'</td>
250
274
<td> ' .($ row ['sticky ' ]?'YES ' :'NO ' ).'</td>
@@ -260,11 +284,11 @@ public function cache() {
260
284
}
261
285
$ c .= '</table></form> ' ;
262
286
} else {
263
- $ c .= '<p>No cached links found.</p> ' ;
287
+ $ c .= '<p class="text-info" >No cached links found.</p> ' ;
264
288
}
265
289
266
290
} else {
267
- $ c .= '<p>Input any filter. Use "%" to get all links. ' ;
291
+ $ c .= '<p class="text-muted" >Input any filter. Use "%" to get all links.</p> ' ;
268
292
}
269
293
return $ c ;
270
294
}
@@ -274,18 +298,25 @@ public function old() {
274
298
275
299
$ c = '<h1>Old links</h1> ' ;
276
300
277
- $ c .= '<p class="center" > ' ;
278
- $ c .= '<b><a href=" ' .$ this ->file .'mod=old&l=%">all</a></b >
301
+ $ c .= '<p> ' ;
302
+ $ c .= '<a class="badge badge-bprimary" href=" ' .$ this ->file .'mod=old&l=%">all</a>
279
303
' ;
280
304
for ($ i =ord ('A ' );$ i <=ord ('Z ' );$ i ++) {
281
- $ c .= '<b><a href=" ' .$ this ->file .'mod=old&l= ' .strtoupper (chr ($ i )).'"> ' .strtoupper (chr ($ i )).'</a></b >
305
+ $ c .= '<a class="badge" href=" ' .$ this ->file .'mod=old&l= ' .strtoupper (chr ($ i )).'"> ' .strtoupper (chr ($ i )).'</a>
282
306
' ;
283
307
}
284
- $ c .= '</p> ' ;
285
- $ c .= '<form method="post" action=" ' .$ this ->file .'mod=old" class="form-inline">
286
- <label>Link starts with: <input type="text" name="l" class="a form-control" value=" ' .htmlspecialchars ($ let ).'"></label>
287
- <input type="hidden" name="mod" value="cache">
288
- <input type="submit" value="Search" class="submit btn btn-primary">
308
+ $ c .= '</p> <hr> ' ;
309
+ $ c .= '<div class="row">
310
+ <div class="col-md-6">
311
+ <form method="post" action=" ' .$ this ->file .'mod=old">
312
+ <label>Link starts with:</label>
313
+ <div class="input-group">
314
+ <input type="text" name="l" class="a form-control" value=" ' .htmlspecialchars ($ let ).'">
315
+ <input type="hidden" name="mod" value="cache">
316
+ <span class="input-group-btn">
317
+ <input type="submit" value="Search" class="submit btn btn-primary">
318
+ </span>
319
+ </div></div></div>
289
320
</form> ' ;
290
321
291
322
if (!empty ($ let )) {
@@ -294,7 +325,7 @@ public function old() {
294
325
295
326
$ num = $ this ->db ->num_rows ($ q );
296
327
if ($ num >0 ) {
297
- $ c .= '<p class="center">Records found: ' .$ num .'</p> ' ;
328
+ $ c .= '<p class="center text-info ">Records found: ' .$ num .'</p> ' ;
298
329
$ c .= '<form method="post" action=" ' .$ this ->file .'mod=cache"> ' ;
299
330
$ c .= '<table id="list" class="table table-striped"><tr><th class="left">Old URI</th><th class="left">Cached URI</th><th>Moved to olds</th><th>Sticky</th><th>Action</th> ' ;
300
331
while ($ row = $ this ->db ->fetch ($ q )) {
@@ -313,10 +344,10 @@ public function old() {
313
344
}
314
345
$ c .= '</table></form> ' ;
315
346
} else {
316
- $ c .= '<p>No old links found.</p> ' ;
347
+ $ c .= '<p class="text-info" >No old links found.</p> ' ;
317
348
}
318
349
} else {
319
- $ c .= '<p>Input any filter. Use "%" to get all links.</p> ' ;
350
+ $ c .= '<p class="text-muted" >Input any filter. Use "%" to get all links.</p> ' ;
320
351
}
321
352
return $ c ;
322
353
}
@@ -364,7 +395,7 @@ public function link() {
364
395
$ data = $ _POST ;
365
396
$ data = array_map ('trim ' ,$ data );
366
397
if (empty ($ data ['url ' ]) || empty ($ data ['params ' ])) {
367
- $ c .= '<div class="error"><p>You must fill all inputs.</p></div> ' ;
398
+ $ c .= '<div class="error"><p class="text-danger" >You must fill all inputs.</p></div> ' ;
368
399
} else {
369
400
$ params = \Bednarik \Cooluri \Core \Functions::convertQuerystringToArray ($ data ['params ' ]);
370
401
$ cp = \Bednarik \Cooluri \Core \Functions::prepareParamsForCache ($ params );
@@ -422,26 +453,31 @@ public function link() {
422
453
}
423
454
}
424
455
425
- $ c .= '<form method="post" action=" ' .$ this ->file .'mod=link ' .($ new ?'' :'&lid= ' .$ id ).'">
426
- <fieldset>
427
- <legend>URI details</legend>
428
- <div class="form-group">
429
- <label for="url">URI:</label>
430
- <input type="text" name="url" id="url" class="form-control" value=" ' .(empty ($ data ['url ' ])?'' :htmlspecialchars ($ data ['url ' ])).'">
431
- </div>
432
- <div class="form-group">
433
- <label for="params">Parameters (query string: id=1&type=2):</label>
434
- <input type="text" name="params" id="params" class="form-control" value=" ' .(empty ($ data ['params ' ])?'' :htmlspecialchars ($ data ['params ' ])).'">
435
- </div>
436
- <div class="form-group">
437
- <label for="sticky">
438
- <input type="checkbox" class="check" name="sticky" id="sticky" value="1" ' .(empty ($ data ['sticky ' ])?'' :' checked="checked" ' ).'>
439
- Sticky (won \'t be updated)
440
- </label>
456
+ $ c .= '
457
+ <div class="row">
458
+ <div class="col-md-6">
459
+ <form method="post" action=" ' .$ this ->file .'mod=link ' .($ new ?'' :'&lid= ' .$ id ).'">
460
+ <fieldset>
461
+ <legend>URI details</legend>
462
+ <div class="form-group">
463
+ <label for="url">URI:</label>
464
+ <input type="text" name="url" id="url" class="form-control" value=" ' .(empty ($ data ['url ' ])?'' :htmlspecialchars ($ data ['url ' ])).'">
465
+ </div>
466
+ <div class="form-group">
467
+ <label for="params">Parameters (query string: id=1&type=2):</label>
468
+ <input type="text" name="params" id="params" class="form-control" value=" ' .(empty ($ data ['params ' ])?'' :htmlspecialchars ($ data ['params ' ])).'">
469
+ </div>
470
+ <div class="form-group">
471
+ <label for="sticky">
472
+ <input type="checkbox" class="check" name="sticky" id="sticky" value="1" ' .(empty ($ data ['sticky ' ])?'' :' checked="checked" ' ).'>
473
+ Sticky (won \'t be updated)
474
+ </label>
475
+ </div>
476
+ </fieldset>
477
+ <input type="submit" value=" ' .($ new ?'Save new URI ' :'Update this URI ' ).' " class="submit btn btn-primary">
478
+ </form>
479
+ </div>
441
480
</div>
442
- </fieldset>
443
- <input type="submit" value=" ' .($ new ?'Save new URI ' :'Update this URI ' ).' " class="submit btn btn-primary">
444
- </form>
445
481
' ;
446
482
return $ c ;
447
483
}
@@ -454,7 +490,7 @@ public function redirect() {
454
490
if (!empty ($ _POST )) {
455
491
$ id = (int )$ _POST ['to ' ];
456
492
if (empty ($ id ) || empty ($ _POST ['url ' ])) {
457
- $ c .= '<div class="error"><p>All fields are required.</p></div> ' ;
493
+ $ c .= '<div class="error"><p class="text-danger" >All fields are required.</p></div> ' ;
458
494
} else {
459
495
$ this ->db ->query ('INSERT INTO ' .$ this ->table .'oldlinks(link_id,url,sticky)
460
496
VALUES( ' .$ id .',
@@ -466,32 +502,37 @@ public function redirect() {
466
502
467
503
$ allq = $ this ->db ->query ('SELECT * FROM ' .$ this ->table .'cache ORDER BY url ' );
468
504
469
- $ c .= '<form method="post" action=" ' .$ this ->file .'mod=redirect">
470
- <fieldset>
471
- <legend>Redirect details</legend>
472
- <div class="form-group">
473
- <label for="url">From:</label>
474
- <input type="text" name="url" id="url" class="form-control">
475
- </div>
476
- <div class="form-group">
477
- <label for="to">To:</label>
478
- <select name="to" id="to" class="form-control">
479
- ' ;
480
- while ($ row = $ this ->db ->fetch ($ allq )) {
481
- $ c .= '<option value=" ' .$ row ['id ' ].'"> ' .$ row ['url ' ].'</option>
482
- ' ;
483
- }
484
- $ c .= '</select>
485
- </div>
486
- <div class="checkbox">
487
- <label for="sticky">
488
- <input type="checkbox" class="check" name="sticky" id="sticky" value="1" ' .(empty ($ data ['sticky ' ])?'' :' checked="checked" ' ).'>
489
- Sticky (won \'t be deleted upon Delete all action)
490
- </label>
505
+ $ c .= '
506
+ <div class="row">
507
+ <div class="col-md-6">
508
+ <form method="post" action=" ' .$ this ->file .'mod=redirect">
509
+ <fieldset>
510
+ <legend>Redirect details</legend>
511
+ <div class="form-group">
512
+ <label for="url">From:</label>
513
+ <input type="text" name="url" id="url" class="form-control">
514
+ </div>
515
+ <div class="form-group">
516
+ <label for="to">To:</label>
517
+ <select name="to" id="to" class="form-control">
518
+ ' ;
519
+ while ($ row = $ this ->db ->fetch ($ allq )) {
520
+ $ c .= '<option value=" ' .$ row ['id ' ].'"> ' .$ row ['url ' ].'</option>
521
+ ' ;
522
+ }
523
+ $ c .= '</select>
524
+ </div>
525
+ <div class="form-group">
526
+ <label for="sticky">
527
+ <input type="checkbox" class="check" name="sticky" id="sticky" value="1" ' .(empty ($ data ['sticky ' ])?'' :' checked="checked" ' ).'>
528
+ Sticky (won \'t be deleted upon Delete all action)
529
+ </label>
530
+ </div>
531
+ </fieldset>
532
+ <input type="submit" value="Submit this redirect" class="submit btn btn-primary">
533
+ </form>
534
+ </div>
491
535
</div>
492
- </fieldset>
493
- <input type="submit" value="Submit this redirect" class="submit btn btn-primary">
494
- </form>
495
536
' ;
496
537
return $ c ;
497
538
}
@@ -506,11 +547,11 @@ public function menu() {
506
547
if (empty ($ cm )) {
507
548
$ cm = 'cache ' ;
508
549
}
509
- $ c = '<nav class="navbar navbar-default " style="margin-bottom: 20px"><div class="container-fluid"><ul class="nav nav-tabs "> ' ;
550
+ $ c = '<ul class="nav nav-tabs " style="margin-bottom: 20px"> ' ;
510
551
foreach ($ mods as $ k =>$ v ) {
511
552
$ c .= '<li ' .($ cm ==$ k ?' class="active" ' :'' ).'><a href=" ' .$ this ->file .($ k ?'mod= ' .$ k :'' ).'"> ' .$ v .'</a></li> ' ;
512
553
}
513
- $ c .= '</ul></div></nav> ' ;
554
+ $ c .= '</ul> ' ;
514
555
return $ c ;
515
556
}
516
557
0 commit comments