Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
S
sucs-site
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
25
Issues
25
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sucssite
sucs-site
Commits
52425b80
Commit
52425b80
authored
Jan 24, 2019
by
Imran Hussain
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'beta' into 'sucs-site'
Beta to live! See merge request
!102
parents
61bf50a5
51e49732
Pipeline
#520
passed with stages
in 3 minutes and 9 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
12 deletions
+24
-12
components/motd.php
components/motd.php
+24
-12
No files found.
components/motd.php
View file @
52425b80
...
...
@@ -3,16 +3,21 @@ $motd_file = "/etc/motd";
function
decode_entities
(
$text
,
$quote_style
=
ENT_COMPAT
)
{
if
(
function_exists
(
'html_entity_decode'
))
{
$text
=
html_entity_decode
(
$text
,
$quote_style
,
'ISO-8859-1'
);
// NOTE: UTF-8 does not work!
}
else
{
$trans_tbl
=
get_html_translation_table
(
HTML_ENTITIES
,
$quote_style
);
$trans_tbl
=
array_flip
(
$trans_tbl
);
$text
=
strtr
(
$text
,
$trans_tbl
);
}
$text
=
preg_replace
(
'~&ndash\;~i'
,
'-'
,
$text
);
$text
=
preg_replace
(
'~&#x([0-9a-f]+);~ei'
,
'chr(hexdec("\\1"))'
,
$text
);
$text
=
preg_replace
(
'~&#([0-9]+);~e'
,
'chr("\\1")'
,
$text
);
$text
=
html_entity_decode
(
$text
,
$quote_style
,
'ISO-8859-1'
);
// NOTE: UTF-8 does not work!
$text
=
preg_replace_callback
(
'~&#x([0-9a-f]+);~i'
,
function
(
$matches
)
{
foreach
(
$matches
as
$match
)
{
return
chr
(
hexdec
(
$match
));
}
},
$text
);
$text
=
preg_replace_callback
(
'~&#([0-9]+);~'
,
function
(
$matches
)
{
foreach
(
$matches
as
$match
)
{
return
chr
(
$match
);
}
},
$text
);
return
$text
;
}
...
...
@@ -52,7 +57,12 @@ for ($i = count($news) - 1; $i > -1; $i--) {
$body
=
str_replace
(
"…"
,
"..."
,
$body
);
$body
=
str_replace
(
"'"
,
"'"
,
$body
);
// remove hyperlinks, collect to display later
$body
=
preg_replace
(
":<a href=['
\"
](.+?)['
\"
].*?>(.*?)</a>:e"
,
"'
\\
2['.linkcounter('
\\
1').']'"
,
$body
);
$body
=
preg_replace_callback
(
":<a href=['
\"
](.+?)['
\"
].*?>(.*?)</a>:"
,
function
(
$matches
)
{
$i
=
linkcounter
(
$matches
[
1
]);
return
$matches
[
0
]
.
"["
.
$i
.
"]"
;
},
$body
);
$body
=
strip_tags
(
$body
);
$body
=
decode_entities
(
$body
);
$body
=
wordwrap
(
$body
,
75
,
"
\n
"
,
1
);
...
...
@@ -76,9 +86,11 @@ for ($i = count($news) - 1; $i > -1; $i--) {
}
$motd
.=
"---------------------------- [ http://sucs.org/ ] -----------------------------
\n
"
;
//print($motd);
//if (time()-filemtime($motd_file) < 86000 && $poemmode == 1) { //86000 to allow a little slack depending on when cron runs
// print "MOTD too recent to replace with a poem!\n";
//} else {
file_put_contents
(
$motd_file
,
$motd
);
//}
?>
?>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment