Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sucs-site
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sucssite
sucs-site
Commits
9b586f51
"README.md" did not exist on "88a676ff7df56290c9cc2ef0a11a1d16eaf3f02f"
Commit
9b586f51
authored
15 years ago
by
Justin Mitchell
Browse files
Options
Downloads
Patches
Plain Diff
add new uri support
parent
cde733c0
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
components/milliways.php
+61
-0
61 additions, 0 deletions
components/milliways.php
templates/milliways_uri.tpl
+45
-0
45 additions, 0 deletions
templates/milliways_uri.tpl
with
106 additions
and
0 deletions
components/milliways.php
+
61
−
0
View file @
9b586f51
...
@@ -24,6 +24,66 @@ function compare_idletime($a, $b) {
...
@@ -24,6 +24,66 @@ function compare_idletime($a, $b) {
return
strnatcmp
(
$a
[
'idleseconds'
],
$b
[
'idleseconds'
]);
return
strnatcmp
(
$a
[
'idleseconds'
],
$b
[
'idleseconds'
]);
}
}
$mwpath
=
array_search
(
"Milliways"
,
$pathlist
);
$newpath
=
$baseurl
;
for
(
$i
=
0
;
$i
<=
$mwpath
;
$i
++
)
{
if
(
$i
!=
0
)
$newpath
.
=
"/"
;
$newpath
.
=
$pathlist
[
$i
];
}
$smarty
->
assign
(
"mwpath"
,
$newpath
);
if
(
strtolower
(
$pathlist
[
$mwpath
+
1
])
==
"uri"
)
{
$today
=
FALSE
;
if
(
isset
(
$pathlist
[
$mwpath
+
2
]))
$today
=
strtotime
(
$pathlist
[
$mwpath
+
2
]);
if
(
$today
===
FALSE
)
$today
=
time
();
$smarty
->
assign
(
"extra_scripts"
,
array
(
'<meta name="ROBOTS" content="NOINDEX" />'
,
'<meta name="ROBOTS" content="NOFOLLOW" />'
));
$mwdb
=
new
PDO
(
'sqlite:/var/lib/mw/mwuri.db'
);
$res
=
$mwdb
->
prepare
(
"select *, time(added) as hour, date(added) as day from mwuri where date(added)=? order by added desc"
);
$res
->
execute
(
array
(
date
(
"Y-m-d"
,
$today
)));
$data
=
$res
->
fetchAll
(
PDO
::
FETCH_ASSOC
);
foreach
(
$data
as
$k
=>
$row
)
{
if
(
$row
[
'tags'
])
{
$json
=
json_decode
(
$row
[
'tags'
],
TRUE
);
$data
[
$k
][
'taglist'
]
=
$json
[
0
][
'top_tags'
];
}
}
$smarty
->
assign
(
"urilist"
,
$data
);
$res
=
$mwdb
->
prepare
(
"select distinct strftime('%Y',added) from mwuri"
);
$res
->
execute
();
$yearlist
=
$res
->
fetchAll
(
PDO
::
FETCH_COLUMN
,
0
);
$smarty
->
assign
(
"yearlist"
,
$yearlist
);
$res
=
$mwdb
->
prepare
(
"select distinct strftime('%m',added) from mwuri where strftime('%Y',added) = ?"
);
$res
->
execute
(
array
(
date
(
"Y"
,
$today
)));
$monthlist
=
$res
->
fetchAll
(
PDO
::
FETCH_COLUMN
,
0
);
$smarty
->
assign
(
"monthlist"
,
$monthlist
);
$res
=
$mwdb
->
prepare
(
"select distinct strftime('%d',added) from mwuri where strftime('%Y-%m',added) = ?"
);
$res
->
execute
(
array
(
date
(
"Y-m"
,
$today
)));
$daylist
=
$res
->
fetchAll
(
PDO
::
FETCH_COLUMN
,
0
);
$smarty
->
assign
(
"daylist"
,
$daylist
);
$smarty
->
assign
(
"thisyear"
,
date
(
"Y"
,
$today
));
$smarty
->
assign
(
"thismonth"
,
date
(
"m"
,
$today
));
$smarty
->
assign
(
"thisday"
,
date
(
"d"
,
$today
));
$output
=
$smarty
->
fetch
(
$base
.
"templates/milliways_uri.tpl"
);
$smarty
->
assign
(
"title"
,
"Milliways URI"
);
$smarty
->
assign
(
"body"
,
$output
);
$smarty
->
assign
(
"extra_styles"
,
"/css/milliways.css"
);
$smarty
->
assign
(
"refresh"
,
120
);
return
;
}
exec
(
"/usr/bin/mw -who"
,
$wholist
,
$ret
);
exec
(
"/usr/bin/mw -who"
,
$wholist
,
$ret
);
$people
=
array
();
$people
=
array
();
$idlers
=
array
();
$idlers
=
array
();
...
@@ -46,6 +106,7 @@ foreach ($wholist as $person) {
...
@@ -46,6 +106,7 @@ foreach ($wholist as $person) {
usort
(
$people
,
'compare_idletime'
);
usort
(
$people
,
'compare_idletime'
);
usort
(
$idlers
,
'compare_idletime'
);
usort
(
$idlers
,
'compare_idletime'
);
$output
.
=
print_r
(
$pathlist
,
true
);
$smarty
->
assign
(
"people"
,
$people
);
$smarty
->
assign
(
"people"
,
$people
);
$smarty
->
assign
(
"idlers"
,
$idlers
);
$smarty
->
assign
(
"idlers"
,
$idlers
);
...
...
This diff is collapsed.
Click to expand it.
templates/milliways_uri.tpl
0 → 100644
+
45
−
0
View file @
9b586f51
<table>
<tr>
<td
nowrap=
"nowrap"
class=
"date"
colspan=
"3"
>
Year:
{
foreach
from
=
$yearlist
item
=
year
}{
if
$year
!=
$thisyear
}
<a
href=
"
{
$mwpath
}
/uri/
{
$year
}
-01-01"
>
{
$year
}
</a>
{
else
}{
$year
}{/
if
}{/
foreach
}
</td>
</tr>
<tr>
<td
nowrap=
"nowrap"
class=
"date"
colspan=
"3"
>
Month:
{
foreach
from
=
$monthlist
item
=
month
}{
if
$month
!=
$thismonth
}
<a
href=
"
{
$mwpath
}
/uri/
{
$thisyear
}
-
{
$month
}
-01"
>
{
$month
}
</a>
{
else
}{
$month
}
{/
if
}{/
foreach
}
</td>
</tr>
<tr>
<td
nowrap=
"nowrap"
class=
"date"
colspan=
"3"
>
Day:
{
foreach
from
=
$daylist
item
=
day
}{
if
$day
!=
$thisday
}
<a
href=
"
{
$mwpath
}
/uri/
{
$thisyear
}
-
{
$thismonth
}
-
{
$day
}
"
>
{
$day
}
</a>
{
else
}{
$day
}{/
if
}{/
foreach
}
</td>
</tr>
{
assign
var
=
lastday
value
=
''
}
{
foreach
from
=
$urilist
item
=
row
name
=
list
}
{
if
$row.day
!=
$lastday
}
{
assign
var
=
lastday
value
=
$row.day
}
<tr>
<td
nowrap=
"nowrap"
class=
"date"
colspan=
"3"
>
{
$row.added
|
date_format
:
'%d %b %Y'
}
</td>
</tr>
{/
if
}
{
assign
var
=
rows
value
=
1
}
{
if
$row.title
}{
assign
var
=
rows
value
=
$rows
+
1
}{/
if
}
{
if
count
(
$row.taglist
)
}{
assign
var
=
rows
value
=
$rows
+
1
}{/
if
}
<tr>
<td
nowrap=
"nowrap"
class=
"time"
rowspan=
"
{
$rows
}
"
>
{
$row.hour
}
</td>
<td
nowrap=
"nowrap"
class=
"user"
rowspan=
"
{
$rows
}
"
>
{
$row.user
}
</td>
<td
><a
href=
"
{
$row.url
|
escape
:
"hexentity"
}
"
>
{
$row.url
|
truncate
:
80
:
" ... "
:
true
:
true
|
escape
:
"html"
}
</a></td>
</tr>
{
if
$row.title
}
<tr><td>
{
$row.title
|
escape
:
"html"
}
</td></tr>
{/
if
}
{
if
count
(
$row.taglist
)
}
<tr>
<td
class=
"taglist"
>
Tags:
{
foreach
from
=
$row.taglist
item
=
tcount
key
=
tname
name
=
tags
}{
$tname
}{
if
!
$smarty.foreach.tags.last
}
,
{/
if
}{/
foreach
}
</td>
</tr>
{/
if
}
{/
foreach
}
</table>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment