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
Compare revisions
d94d85016d2581e98afd8ba7f0107fb1024a133d to 51e49732549e896d166258c1a78bc6a73077344a
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
sucssite/sucs-site
Select target project
No results found
51e49732549e896d166258c1a78bc6a73077344a
Select Git revision
Branches
beta
master
sucs-site
Swap
Target
sucssite/sucs-site
Select target project
osian/sucs-site
kais58/sucs-site
imranh/sucs-site
foshjedi2004/sucs-site
gigosaurus/sucs-site
matstn/sucs-site
ripp_/sucs-site
eggnog/sucs-site
sucssite/sucs-site
elbows/sucs-site
realitykiller/sucs-site
crox/sucs-site
vectre/sucs-site
welshbyte/sucs-site
paperclipman/sucs-site
15 results
d94d85016d2581e98afd8ba7f0107fb1024a133d
Select Git revision
Branches
beta
master
sucs-site
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (2)
Fix motd generation
· 4f5034e7
Imran Hussain
authored
6 years ago
4f5034e7
Merge branch 'master' into 'beta'
· 51e49732
Imran Hussain
authored
6 years ago
Fix motd generation See merge request
!101
51e49732
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
components/motd.php
+24
-12
24 additions, 12 deletions
components/motd.php
with
24 additions
and
12 deletions
components/motd.php
View file @
51e49732
...
...
@@ -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
This diff is collapsed.
Click to expand it.