Commit d06847ec authored by Malcolm Blaney's avatar Malcolm Blaney

Remove default font-family css rules set in modules now that a

default font-family is set on the body. Updated nickname cache to
include the original photo url as well as the cached url so that
the original is not re-cached when it hasn't changed.
parent f369008b
Pipeline #37368321 passed with stage
in 1 minute and 19 seconds
......@@ -240,7 +240,6 @@ class Banking extends Base {
$this->AddTemplateDescription($description);
$site_style = ['"",".banking .edit a","color","#222222"',
'"",".banking .edit a","font-family","Verdana"',
'"",".banking .edit a","font-size","0.8em"',
'"",".banking .edit a","text-decoration","none"',
'"",".banking .edit a:hover","color","#aaaaaa"',
......
......@@ -175,8 +175,7 @@ class Comment extends Base {
'"",".comment-wrapper","border","2px solid #888888"',
'"",".comment-wrapper","border-radius","3px"',
'"",".comment-wrapper","margin","5px"',
'"",".comment-wrapper","padding","10px"',
'"",".comment-wrapper","font-family","Verdana,Arial"'];
'"",".comment-wrapper","padding","10px"'];
$this->AddSiteStyle($site_style);
$this->AddTemplate(['"comment-notifications", "", "true"']);
}
......
......@@ -351,8 +351,7 @@ class Detail extends Base {
if (!$mysqli->query($query)) {
$this->Log('Detail->Install: ' . $mysqli->error);
}
$site_style = ['"",".detail","font-family","Verdana,Arial"',
'"",".detail a","text-decoration","none"',
$site_style = ['"",".detail a","text-decoration","none"',
'"",".detail a","color","#222222"',
'"",".detail a:hover","color","#aaaaaa"',
'"",".detail .edit","margin-top","10px"',
......
......@@ -744,13 +744,13 @@ class Escrow extends Base {
}
$mysqli = connect_db();
// The empty path segment may have been trimmed above, so try matching both.
$query = 'SELECT name, url, photo, reachable FROM nickname WHERE url ' .
$query = 'SELECT name, url, cache, reachable FROM nickname WHERE url ' .
'LIKE "http%://' . $address . '" OR url LIKE "http%://' . $address . '/"';
if ($result = $mysqli->query($query)) {
if ($nickname = $result->fetch_assoc()) {
$us_name = $nickname['name'];
$us_url = $nickname['url'];
$us_photo = $nickname['photo'];
$us_photo = $nickname['cache'];
$reachable = $nickname['reachable'] === '1';
}
$result->close();
......
......@@ -1021,7 +1021,7 @@ class Invoice extends Base {
$first = $details['first'];
if ($first === '') $first = $user;
$message = '<html><head><title>' . $subject . "</title>\n" .
'<style>body { font-family: Verdana,Arial; } ' .
'<style>body { font-family: Arial, sans-serif; } ' .
'table { border: 0; border-collapse: collapse; } ' .
'th { background-color: #f0f0f0; padding: 2px; } ' .
'td { padding: 5px; }</style>' . "\n" .
......@@ -1248,7 +1248,7 @@ class Invoice extends Base {
$total = 0;
$line_items = '';
$message = '<html><head><title>Invoice</title>' . "\n" .
'<style>body { font-family: Verdana,Arial; } ' . "\n" .
'<style>body { font-family: Arial, sans-serif; } ' . "\n" .
'table { border: 0; border-collapse: collapse; } ' . "\n" .
'th { background-color: #f0f0f0; padding: 2px; } ' . "\n" .
'td { padding: 5px; }</style>' . "\n" .
......@@ -1520,7 +1520,7 @@ class Invoice extends Base {
// given here sorted by user.
$message_data = [];
$intro = '';
$style = '<style>body { font-family: Verdana,Arial; } ' . "\n" .
$style = '<style>body { font-family: Arial, sans-serif; } ' . "\n" .
'table { border: 0; border-collapse: collapse; } ' . "\n" .
'th { background-color: #f0f0f0; padding: 2px; } ' . "\n" .
'td { padding: 2px; }' . "\n";
......@@ -1660,7 +1660,7 @@ class Invoice extends Base {
$total_quantity = 0;
$count = 0;
$style = '<style>body { font-family: Verdana,Arial; } ' .
$style = '<style>body { font-family: Arial, sans-serif; } ' .
'table { border: 0; border-collapse: collapse; } ' .
'th { background-color: #f0f0f0; padding: 2px; } ' .
'td { padding: 2px; }</style>' . "\n";
......
......@@ -311,7 +311,6 @@ class Payment extends Base {
'"","#payment-details-form .submit","margin-left","8.3em"',
'"",".payment .edit","text-align","right"',
'"",".payment a","color","#222222"',
'"",".payment a","font-family","Verdana"',
'"",".payment a","font-size","0.8em"',
'"",".payment a","text-decoration","none"',
'"",".payment a:hover","color","#aaaaaa"',
......
......@@ -463,7 +463,6 @@ class Reader extends Base {
'"",".reader h4","margin","10px 0"',
'"",".reader a","color","#666666"',
'"",".reader a:hover","color","#999999"',
'"",".reader","font-family","Verdana,Arial"',
'"",".reader-actions","margin","10px"',
'"",".reader-actions","clear","both"',
'"",".reader-actions a","margin","5px"',
......@@ -703,7 +702,6 @@ class Reader extends Base {
}
else if (strpos($xml_url, 'https://twitter-atom.appspot.com') === 0) {
$html_url = 'https://twitter-atom.appspot.com';
$scheme = $this->user->config->Secure() ? 'https://' : 'http://';
$image_url = $scheme . $server_name . '/images/twitter.png';
}
$query = 'INSERT INTO reader_feeds VALUES ("' . $xml_url . '", ' .
......
......@@ -187,8 +187,7 @@ class Settings extends Base {
$this->AppendScript($path, 'dobrado.settings.js', false);
$this->AddTemplate(['"settings-display","","control"']);
$site_style = ['"",".settings","font-family","Verdana,Arial"',
'"",".settings-section","background-color","#eeeeee"',
$site_style = ['"",".settings-section","background-color","#eeeeee"',
'"",".settings-section","border","1px solid #aaaaaa"',
'"",".settings-section","margin","5px"',
'"",".settings-section","padding","5px"',
......
......@@ -178,7 +178,6 @@ class Summary extends Base {
// Note that the module is only available when logged in.
$this->AppendScript($path, 'dobrado.summary.js', false);
$site_style = ['"",".summary a","color","#222222"',
'"",".summary a","font-family","Verdana, Arial"',
'"",".summary a","text-decoration","none"',
'"",".summary a:hover","color","#aaaaaa"',
'"","#summary-form","background-color","#eeeeee"',
......
......@@ -109,8 +109,7 @@ class Viewanalytics extends Base {
// Need to call AppendScript here if module uses javascript.
// Note that the module is only available when logged in.
$this->AppendScript($path, 'dobrado.viewanalytics.js', false);
$site_style = ['"",".viewanalytics","font-family","Verdana,Arial"',
'"","#viewanalytics-total-search label","width","4em"',
$site_style = ['"","#viewanalytics-total-search label","width","4em"',
'"","#viewanalytics-total-button","margin-left","3.9em"'];
}
......
......@@ -254,8 +254,7 @@ class Writer extends Base {
$mysqli->close();
// Add style rules to the site_style table.
$site_style = ['"",".writer","font-family","Verdana,Arial"',
'"",".writer .feed-title","display","none"',
$site_style = ['"",".writer .feed-title","display","none"',
'"",".writer .feed-author","display","none"',
'"",".writer-options","display","none"',
'"",".writer-options","position","relative"',
......
......@@ -276,6 +276,7 @@ function create_tables() {
'name VARCHAR(200) NOT NULL,' .
'url VARCHAR(200) NOT NULL,' .
'photo VARCHAR(200),' .
'cache VARCHAR(200),' .
'nickname VARCHAR(200),' .
'reachable TINYINT(1),' .
'PRIMARY KEY(url)' .
......@@ -349,6 +350,7 @@ function create_site_style() {
'"","body","color","#222222"',
'"","body","font-family","Arial, sans-serif"',
'"","iframe","max-width","100%"',
'"","video","max-width","100%"',
'"","img","max-width","100%"',
'"","img","height","auto"',
'"","img","border-style","none"',
......
This diff is collapsed.
......@@ -442,12 +442,12 @@ abstract class Base {
$mysqli = connect_db();
$name = $mysqli->escape_string($us_name);
$domain = $mysqli->escape_string($us_domain);
$query = 'SELECT url, photo FROM nickname WHERE name = "' . $name . '" ' .
$query = 'SELECT url, cache FROM nickname WHERE name = "' . $name . '" ' .
'AND url LIKE "%' . $domain . '%"';
if ($result = $mysqli->query($query)) {
if ($nickname = $result->fetch_assoc()) {
$us_url = $nickname['url'];
$us_photo = $nickname['photo'];
$us_photo = $nickname['cache'];
}
$result->close();
}
......@@ -456,23 +456,29 @@ abstract class Base {
}
$mysqli->close();
$secure = $this->user->config->Secure();
$server = $this->user->config->ServerName();
if ($us_photo === '') {
// Assume here that there was no match and provide some simplified urls
// for facebook and twitter feeds knowing they have path segments.
if (strpos($us_url, 'https://twitter.com') === 0 &&
preg_match('/^(https:\/\/twitter.com\/[^\/]+)/i', $us_url, $match)) {
$us_url = $match[1];
$us_photo = $this->user->config->Secure() ? 'https://' : 'http://';
$us_photo .= $this->user->config->ServerName() . '/images/twitter.png';
$us_photo = $secure ? 'https://' : 'http://';
$us_photo .= $server . '/images/twitter.png';
}
else if (strpos($us_url, 'https://www.facebook.com') === 0 &&
preg_match('/^(https:\/\/www.facebook.com\/[^\/]+)/i',
$us_url, $match)) {
$us_url = $match[1];
$us_photo = $this->user->config->Secure() ? 'https://' : 'http://';
$us_photo .= $this->user->config->ServerName() . '/images/facebook.png';
$us_photo = $secure ? 'https://' : 'http://';
$us_photo .= $server . '/images/facebook.png';
}
}
else if ($secure && strpos($us_photo, 'http://' . $server) === 0) {
// Rewrite scheme on non-secure cache urls in secure mode.
$us_photo = 'https://' . substr($us_photo, 7);
}
return [$us_name, $us_url, $us_photo];
}
......
......@@ -116,7 +116,7 @@ class Control extends Base {
// jquery-ui uses the label information for buttons.
$content = '<div class="wrapper ui-widget-header">' . $home .
'<div class="control-button account-button" title="account">' .
'account</div>'.
'account</div>' .
'<div class="control-button message-button" title="messages">' .
'messages</div>' .
'<div class="control-button notification-button" ' .
......@@ -397,9 +397,9 @@ class Control extends Base {
if ($label_query !== '') {
$label_query .= ' OR ';
}
$label_query .= 'label = "'.$labels[$i].'"';
$label_query .= 'label = "' . $labels[$i] . '"';
}
$query = 'SELECT label, title FROM installed_modules WHERE '.$label_query;
$query = 'SELECT label, title FROM installed_modules WHERE ' . $label_query;
if ($result = $mysqli->query($query)) {
while ($installed_modules = $result->fetch_assoc()) {
if ($installed_modules['title'] === '') {
......@@ -412,15 +412,15 @@ class Control extends Base {
$result->close();
}
else {
$this->Log('Control->AddMenu: '.$mysqli->error);
$this->Log('Control->AddMenu: ' . $mysqli->error);
}
$mysqli->close();
$menu = '';
for ($i = 0; $i < count($labels); $i++) {
if (isset($titles[$labels[$i]])) {
$menu .= '<li id="'.$labels[$i].'"><div>'.
$titles[$labels[$i]].'</div></li>';
$menu .= '<li id="' . $labels[$i] . '"><div>' .
$titles[$labels[$i]] . '</div></li>';
}
}
return $menu;
......@@ -435,12 +435,12 @@ class Control extends Base {
// First check if a backup was already created today.
$date = date('Y-m-d');
$file = $db_name.'-backup-'.$date.'.sql.gz';
if (file_exists($path.$file)) return $file;
$file = $db_name . '-backup-' . $date . '.sql.gz';
if (file_exists($path . $file)) return $file;
exec('mysqldump -u '.$db_user.' -h '.$db_server.' -p'.$db_password.' '.
$db_name.' | gzip > '.$path.$file);
if (file_exists($path.$file)) return $file;
exec('mysqldump -u ' . $db_user . ' -h ' . $db_server .
' -p' . $db_password . ' ' . $db_name . ' | gzip > ' . $path . $file);
if (file_exists($path . $file)) return $file;
return false;
}
......@@ -451,12 +451,13 @@ class Control extends Base {
if (isset($_SESSION['control-page-options'])) {
foreach($_SESSION['control-page-options'] as $page) {
if ($this->owner === 'admin' && $this->user->page === $page) {
$options .= '<option value="admin/'.$page.'" selected="selected">'.
$page.'</option>';
$options .= '<option value="admin/' . $page . '" ' .
'selected="selected">' . $page . '</option>';
$selected = true;
}
else {
$options .= '<option value="admin/'.$page.'">'.$page.'</option>';
$options .= '<option value="admin/' . $page . '">' . $page .
'</option>';
}
}
}
......@@ -467,15 +468,16 @@ class Control extends Base {
$page = trim($page);
if ($page === '') continue;
if (can_view_page('admin/'.$page)) {
if (can_view_page('admin/' . $page)) {
$_SESSION['control-page-options'][] = $page;
if ($this->owner === 'admin' && $this->user->page === $page) {
$options .= '<option value="admin/'.$page.'" selected="selected">'.
$page.'</option>';
$options .= '<option value="admin/' . $page . '" ' .
'selected="selected">' . $page . '</option>';
$selected = true;
}
else {
$options .= '<option value="admin/'.$page.'">'.$page.'</option>';
$options .= '<option value="admin/' . $page . '">' . $page .
'</option>';
}
}
}
......@@ -486,16 +488,16 @@ class Control extends Base {
if ($options !== '') {
if (!$selected) {
// Show the current page at the top of the select for display purposes.
$options = '<option value="" selected="selected">'.$this->user->page.
'</option>'.$options;
$options = '<option value="" selected="selected">' . $this->user->page .
'</option>' . $options;
}
$options .= '<option value="">other...</option>';
$page_select = '<select id="page-select">'.$options.'</select>';
$page_select = '<select id="page-select">' . $options . '</select>';
$hide_input = ' hidden';
}
return '<form id="control-page-form">'.$page_select.
'<input id="page-input" class="control-input'.$hide_input.'" '.
'type="text" name="page" value="change page..." maxlength="200">'.
return '<form id="control-page-form">' . $page_select .
'<input id="page-input" class="control-input' . $hide_input . '" ' .
'type="text" name="page" value="change page..." maxlength="200">' .
'</form>';
}
......
......@@ -27,7 +27,6 @@ class Login extends Base {
'"","' . $selector . '","padding","0.4em"',
'"","' . $selector . '","width","500px"',
'"","' . $selector . '","color","#ffffff"',
'"","' . $selector . '","font-family","Verdana,Arial"',
'"","' . $selector . ' a","color","#222222"',
'"","' . $selector . ' a","text-decoration","none"',
'"","' . $selector . ' a:hover","color","#dddddd"',
......@@ -59,7 +58,7 @@ class Login extends Base {
'<div class="form-spacing">' .
'<label for="remember-input">Remember me:</label>' .
'<input id="remember-input" type="checkbox" name="remember" ' .
'value="true" checked="checked">'.
'value="true" checked="checked">' .
'</div>' .
'<input class="submit" type="submit" value="submit">' .
'</form>' .
......@@ -211,7 +210,7 @@ class Login extends Base {
if (!$mysqli->query($query)) {
$this->Log('Login->Remove 2: ' . $mysqli->error);
}
$query = 'DELETE FROM login_history WHERE user = "' . $this->owner.'"';
$query = 'DELETE FROM login_history WHERE user = "' . $this->owner . '"';
if (!$mysqli->query($query)) {
$this->Log('Login->Remove 3: ' . $mysqli->error);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment