Commit 5277530b authored by Malcolm Blaney's avatar Malcolm Blaney

Groupwizard module remove orders section has been hidden behind a

flag, as it's not as useful anymore and can cause problems if set
without planning. Invoice module added new invoice-date-format
template, rather than creating a bunch of optional date formats.
Also added invoice-date-offset to have more control over the
invoice subject. Remove Purchase->ActiveUsers as this is now done
by the Invoice module. Fixed an issue in the Purchase module where
purchasing with the same account on consecutive days would load the
previous day's purchases. Control module settings callback still
uses the word 'fixed' for position but applies the value 'sticky'.
Also assumes default is now opaque for control and applies
transparency class for absolute positioning only. Minimise button
has been removed because sticky positioning doesn't obscure the
top of the page. Old browser specific css properties have been
removed from write_style as support for generic properties is much
better. SimplePie->Item fix following recent changes, enclosure
caching needs to make sure the url is for an image. Microformats
url fetcher has a new default option to return json as Firefox has
a new json viewer enabled by default.
parent 7e5c55ea
Pipeline #35214373 passed with stage
in 1 minute and 12 seconds
......@@ -139,3 +139,4 @@ css/leaflet.css
css/slick.grid.css
css/slider.css
tests/js
public
......@@ -1054,11 +1054,6 @@ class Groupwizard extends Base {
$this->Options('invoice-day-time', $hours) .
'</select>' .
'</div>' .
'<div class="form-spacing">' .
'<label for="groupwizard-invoice-day-date">Switch to calendar date' .
'</label>' .
'<input type="checkbox" id="groupwizard-invoice-day-date">' .
'</div>' .
'<div class="form-spacing">' .
'<label for="groupwizard-invoice-look-forward">Invoices are sent ' .
'out <b>before</b> the order is collected:</label>' .
......@@ -1076,39 +1071,41 @@ class Groupwizard extends Base {
'maxlength="5" value="' . $this->Value('invoice-day-count') . '">' .
'</div>';
}
$content .= '<p>Orders can be removed from the system after they\'ve been '.
'processed, so that unavailable products don\'t get included in ' .
'purchases. The date orders are removed should be set to just before ' .
'purchases will be entered, so that members can be reminded via their '.
'summary page that they have an order placed.</p>' .
'<div class="form-spacing">' .
'<label for="groupwizard-invoice-remove-orders-select">The day to ' .
'remove orders:</label>' .
'<select id="groupwizard-invoice-remove-orders-select">' .
$this->Options('invoice-remove-orders', $weekdays) .
'</select>' .
'</div>' .
'<div class="form-spacing hidden">' .
'<label for="groupwizard-invoice-remove-orders-input">The day to ' .
'remove orders:</label>' .
'<input id="groupwizard-invoice-remove-orders-input" type="text" ' .
'maxlength="50" value="' . $this->Value('invoice-remove-orders',
$weekdays) . '">' .
'</div>' .
'<div class="form-spacing">' .
'<label for="groupwizard-invoice-remove-orders-date">Switch to ' .
'calendar date</label>' .
'<input type="checkbox" id="groupwizard-invoice-remove-orders-date">' .
'</div>' .
'<div class="form-spacing">' .
'<label for="groupwizard-purchase-check-quota">Only remove orders ' .
'for products where quota wasn\'t met:</label>' .
'<input type="checkbox" id="groupwizard-purchase-check-quota"' .
$this->Checked('purchase-check-quota') . '>' .
'</div>' .
'<p>Orders for a product can be generated as a fraction or rounded to ' .
'the nearest whole quantity. Enter a value between <b>0 and 1</b>, ' .
'or leave this empty to keep as fractions.</p>' .
if ($this->Substitute('groupwizard-remove-orders') === 'true') {
$content .= '<p>Orders can be removed from the system after they\'ve ' .
'been processed, so that unavailable products don\'t get included ' .
'in purchases. The date orders are removed should be set to just ' .
'before purchases will be entered, so that members can be reminded ' .
'via their summary page that they have an order placed.</p>' .
'<div class="form-spacing">' .
'<label for="groupwizard-invoice-remove-orders-select">The day to ' .
'remove orders:</label>' .
'<select id="groupwizard-invoice-remove-orders-select">' .
$this->Options('invoice-remove-orders', $weekdays) .
'</select>' .
'</div>' .
'<div class="form-spacing hidden">' .
'<label for="groupwizard-invoice-remove-orders-input">The day to ' .
'remove orders:</label>' .
'<input id="groupwizard-invoice-remove-orders-input" type="text" ' .
'maxlength="50" value="' . $this->Value('invoice-remove-orders',
$weekdays) . '">' .
'</div>' .
'<div class="form-spacing">' .
'<label for="groupwizard-invoice-remove-orders-date">Switch to ' .
'calendar date</label>' .
'<input type="checkbox" id="groupwizard-invoice-remove-orders-date">'.
'</div>' .
'<div class="form-spacing">' .
'<label for="groupwizard-purchase-check-quota">Only remove orders ' .
'for products where quota wasn\'t met:</label>' .
'<input type="checkbox" id="groupwizard-purchase-check-quota"' .
$this->Checked('purchase-check-quota') . '>' .
'</div>';
}
$content .= '<p>Orders for a product can be generated as a fraction or ' .
'rounded to the nearest whole quantity. Enter a value between <b>0 ' .
'and 1</b>, or leave this empty to keep as fractions.</p>' .
'<div class="form-spacing">' .
'<label for="groupwizard-invoice-order-rounding">Round down when ' .
'fraction is less than:</label>' .
......@@ -1182,6 +1179,13 @@ class Groupwizard extends Base {
'<input id="groupwizard-invoice-subject" type="text" ' .
'maxlength="100" value="' . $this->Value('invoice-subject') . '">' .
'</div>' .
'<div class="form-spacing">' .
'<label for="groupwizard-invoice-no-purchase-subject">' .
'Account Statement email subject:</label>' .
'<input id="groupwizard-invoice-no-purchase-subject" type="text" ' .
'maxlength="100" ' .
'value="' . $this->Value('invoice-no-purchase-subject') . '">' .
'</div>' .
'<i>The sender email address must be on the current domain.</i>' .
'<div class="form-spacing">' .
'<label for="groupwizard-invoice-sender">Invoice email sender:' .
......
......@@ -222,8 +222,8 @@ class Invoice extends Base {
// Send the orders to individual members.
foreach ($this->RunGroups('invoice-send-orders') as $run_group) {
$group = $run_groups['group'];
$timezone = $run_groups['timezone'];
$group = $run_group['group'];
$timezone = $run_group['timezone'];
$this->user = new User($this->owner, $group, $timezone);
$this->SendOrders();
}
......@@ -326,9 +326,10 @@ class Invoice extends Base {
'"invoice-current-balance","","' . $current_balance . '"',
'"invoice-old-balance","","' . $old_balance . '"',
'"invoice-sign-off","","Thanks, see you next week!"',
'"invoice-subject","","Invoice for week !week"',
'"invoice-date-format","","j F Y"',
'"invoice-subject","","Invoice for !date"',
'"invoice-no-purchase-subject","",' .
'"Account statement for week !week"',
'"Account statement for !date"',
'"invoice-sender","","noreply@!host"',
'"invoice-order-subject","","Order for next week"',
'"invoice-order-start","","Here is your order for this week:"',
......@@ -392,8 +393,19 @@ class Invoice extends Base {
'accurate.',
'invoice-sign-off' => 'A final massage at the end of the ' .
'invoice.',
'invoice-date-format' => 'A formatting string that will ' .
'be used to display the date. Options that can be used ' .
'together include: j (day), F (month), Y (year), ' .
'W (week)',
'invoice-date-offset' => 'The number of days to offset ' .
'the current date by when formatting the invoice date',
'invoice-subject' => 'A subject line for the invoice ' .
'email.',
'email, can substitute !date or !number, where the ' .
'date format is set in invoice-date-format',
'invoice-no-purchase-subject' => 'A subject line for the ' .
'account statement email when there are no purchases, ' .
'can substitute !date where the format is set in ' .
'invoice-date-format',
'invoice-sender' => 'The \'from\' address of invoice ' .
'email, must be on the domain.',
'invoice-sender-name' => 'A descriptive name prepended ' .
......@@ -925,13 +937,18 @@ class Invoice extends Base {
$pre_order_available, $pre_order_created,
$invoice_date);
$subject = '';
$date = time();
$date_format = $this->Substitute('invoice-date-format');
$date_offset = $this->Substitute('invoice-date-offset');
if ($date_offset !== '') $date += (int)$date_offset * 86400;
if ($invoice_number === 0) {
$subject = $this->Substitute('invoice-no-purchase-subject', '/!week/',
date('W'));
$subject = $this->Substitute('invoice-no-purchase-subject', '/!date/',
date($date_format, $date));
}
else {
$subject = $this->Substitute('invoice-subject', ['/!week/', '/!number/'],
[date('W'), $invoice_number]);
$subject = $this->Substitute('invoice-subject', ['/!date/', '/!number/'],
[date($date_format, $date),
$invoice_number]);
}
$sender = $this->Substitute('invoice-sender', '/!host/',
$this->user->config->ServerName());
......@@ -1984,8 +2001,12 @@ class Invoice extends Base {
$first = $username;
}
}
// Get the week number before modifying start in case it changes.
$week = date('W', $start);
// Get invoice date before modifying start in case it changes.
$date = $start;
$date_format = $this->Substitute('invoice-date-format');
$date_offset = $this->Substitute('invoice-date-offset');
if ($date_offset !== '') $date += (int)$date_offset * 86400;
$date = date($date_format, $date);
// Add the number of days to look forward from the end, or subtract the
// number of days to look back from the start. When it's set to 1, only
// purchases on the date provided are used.
......@@ -2035,12 +2056,12 @@ class Invoice extends Base {
false, $invoice_date);
$subject = '';
if ($invoice_number === 0) {
$subject = $this->Substitute('invoice-no-purchase-subject', '/!week/',
$week);
$subject = $this->Substitute('invoice-no-purchase-subject', '/!date/',
$date);
}
else {
$subject = $this->Substitute('invoice-subject', ['/!week/', '/!number/'],
[$week, $invoice_number]);
$subject = $this->Substitute('invoice-subject', ['/!date/', '/!number/'],
[$date, $invoice_number]);
}
$sender = $this->Substitute('invoice-sender', '/!host/',
$this->user->config->ServerName());
......
......@@ -298,20 +298,6 @@ class Purchase extends Base {
}
}
}
// 'purchase-active-users' should be set to a relative date such as
// 'first day of this month' so that the dates 'first day of last month'
// and 'last day of last month' make sense in ActiveUsers().
$run_groups = $this->RunGroups('purchase-active-users');
for ($i = 0; $i < count($run_groups); $i++) {
$group = $run_groups[$i]['group'];
$timezone = $run_groups[$i]['timezone'];
$this->user = new User($this->owner, $group, $timezone);
$description = 'Cron: <b>' . $this->ActiveUsers() . '</b> active ' .
'users for ' . ucfirst($group);
$this->Notification('purchase', 'Purchase', $description, 'system',
$group);
}
}
public function Factory($fn, $p = NULL) {
......@@ -602,33 +588,6 @@ class Purchase extends Base {
// Public functions that aren't part of interface here /////////////////////
public function ActiveUsers() {
$count = 0;
$mysqli = connect_db();
$query = 'SELECT DISTINCT purchase.user FROM purchase LEFT JOIN users ON ' .
'purchase.user = users.user WHERE users.system_group = ' .
'"' . $this->user->group . '" AND timestamp >= ' .
strtotime('first day of last month, 00:00') . ' AND timestamp <= ' .
strtotime('last day of last month, 23:59');
if ($result = $mysqli->query($query)) {
$count = $result->num_rows;
$result->close();
}
else {
$this->Log('Purchase->ActiveUsers 1: ' . $mysqli->error);
}
// Also store the count in a template so that it's accessible by the
// Invoice module which displays it descriptively.
$query = 'INSERT INTO template VALUES ("purchase-user-count", ' .
'"' . $this->user->group . '", ' . $count . ') ON DUPLICATE KEY UPDATE ' .
'content = ' . $count;
if (!$mysqli->query($query)) {
$this->Log('Purchase->ActiveUsers 2: ' . $mysqli->error);
}
$mysqli->close();
return $count;
}
public function AdjustOrders($start, $end, $organisation = false) {
// If invoice-order-rounding isn't set, don't do anything.
$rounding = $this->Substitute('invoice-order-rounding');
......@@ -891,8 +850,8 @@ class Purchase extends Base {
}
else {
// Look for purchases over a range of time.
$start = $timestamp - 86400;
$end = $timestamp + 86400;
$start = $timestamp - 43200;
$end = $timestamp + 43200;
$query = 'SELECT name, quantity, timestamp FROM purchase WHERE ' .
'user = "' . $user . '" AND timestamp >= ' . $start . ' AND ' .
'timestamp <= ' . $end;
......@@ -2465,7 +2424,8 @@ class Purchase extends Base {
$current['username'] = $this->user->name;
// Need to tell the client if ordering is no longer available.
// In ordering mode timestamp is set from next_co_op.
$timestamp = isset($_POST['timestamp']) ? (int)$_POST['timestamp'] : 0;
$timestamp = isset($_POST['timestamp']) ?
(int)($_POST['timestamp'] / 1000) : 0;
if ($timestamp === 0) {
$current['save'] = false;
}
......@@ -2707,10 +2667,11 @@ class Purchase extends Base {
}
else {
$object['products'] = $stock->AvailableProducts();
// Otherwise in normal purchasing mode, only show purchases from the
// last 24 hours, as these are the only ones that can be changed in
// UpdateData below.
$start = strtotime('-24 hours');
// Otherwise in normal purchasing mode, only show purchases from the last
// 12 hours, as these are the only ones that can be changed in UpdateData
// below. (12 hours is used so that purchases from the previous day are
// not displayed for groups that meet on consecutive days.)
$start = strtotime('-12 hours');
$end = 0;
// An end timestamp is required when pre-order is true, otherwise
// orders for next week will be shown when purchasing this week.
......@@ -2858,12 +2819,11 @@ class Purchase extends Base {
$invite = new Invite($this->user, $this->owner);
$joined = $invite->Joined();
}
$timestamp = (int)($_POST['timestamp'] / 1000);
// Need to make sure ordering is available, because the user may have left
// the page open and the order window has since closed. (And the countdown
// which reloads the page automatically doesn't always get set.)
if ($_SESSION['purchase-order']) {
$timestamp = (int)$_POST['timestamp'];
$order_gap = (int)$this->Substitute('purchase-order-gap') * 86400;
$ordering = $this->OrderingAvailable($timestamp, $order_gap);
// OrderingAvailable returns an array, with the first value being a
......@@ -2882,10 +2842,9 @@ class Purchase extends Base {
// associated with the item, and only keep the most recent one.
// A further complication however is that at some point the new data
// shouldn't be considered a duplicate, but a new purchase. Make this
// cut-off 24 hours either side of the given purchase date.
$timestamp = (int)($_POST['timestamp'] / 1000);
$start = $timestamp - 86400;
$end = $timestamp + 86400;
// cut-off 12 hours either side of the given purchase date.
$start = $timestamp - 43200;
$end = $timestamp + 43200;
$user_not_found = false;
$current = $this->AllData($start, $end, false, false, false);
$us_data = json_decode($_POST['data'], true);
......@@ -2964,8 +2923,8 @@ class Purchase extends Base {
$price . ', ' . $base_price . ', "' . $this->user->group . '", ' .
'"' . $this->user->name . '")';
// Delete the old entry if it has a recent timestamp.
if ($new_date > $old_date && $new_date - $old_date < 86400) {
// Delete the old entry if it has a timestamp in the last 12 hours.
if ($new_date > $old_date && $new_date - $old_date < 43200) {
// Find the old quantity for this purchase to increase stock.
// Need to look at a timestamp range due to rounding by 1ms.
$query = 'SELECT quantity, timestamp FROM purchase WHERE ' .
......
This diff is collapsed.
This diff is collapsed.
......@@ -346,6 +346,8 @@ function create_site_style() {
// Add some site wide style rules that aren't set by modules.
$site_style = ['"","body","margin","0"',
'"","body","padding","0"',
'"","body","color","#222222"',
'"","body","font-family","Arial, sans-serif"',
'"","iframe","max-width","100%"',
'"","img","max-width","100%"',
'"","img","height","auto"',
......
<?php
// Dobrado Content Management System
// Copyright (C) 2016 Malcolm Blaney
// Copyright (C) 2018 Malcolm Blaney
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
......@@ -23,7 +23,7 @@ function write_file($filename, $content) {
}
$handle = fopen($filename, 'w');
if (!$handle) {
log_db('Error opening file: '.$filename);
log_db('Error opening file: ' . $filename);
return;
}
fwrite($handle, $content);
......@@ -33,21 +33,9 @@ function write_file($filename, $content) {
function style($selector, $rules) {
if (empty($rules)) return;
$style = $selector." {\n";
$style = $selector . " {\n";
foreach ($rules as $property => $value) {
// Add browser specific property names.
if ($property === 'border-radius' || $property === 'box-shadow') {
$style .= ' -moz-'.$property.' : '.$value.";\n";
$style .= ' -webkit-'.$property.' : '.$value.";\n";
}
// IE compatability for opacity.
else if ($property === 'opacity') {
$ie_value = $value * 100;
$style .= ' -ms-filter:"progid:DXImageTransform.Microsoft.Alpha'.
'(Opacity='.$ie_value.')"'.";\n";
$style .= ' filter: alpha(opacity='.$ie_value.");\n";
}
$style .= ' '.$property.' : '.$value.";\n";
$style .= ' ' . $property . ' : ' . $value . ";\n";
}
$style .= "}\n";
return $style;
......@@ -91,7 +79,7 @@ function fetch_style($result) {
}
$media = $fetch_style['media'];
if ($media !== '') {
$style .= $media." {\n";
$style .= $media . " {\n";
}
}
}
......@@ -108,14 +96,14 @@ function fetch_style($result) {
function write_site_style() {
$mysqli = connect_db();
$query = 'SELECT media, selector, property, value FROM site_style '.
$query = 'SELECT media, selector, property, value FROM site_style ' .
'ORDER BY media, selector, property';
if ($result = $mysqli->query($query)) {
write_file('../site.css', fetch_style($result));
$result->close();
}
else {
log_db('write_site_style: '.$mysqli->error);
log_db('write_site_style: ' . $mysqli->error);
}
$mysqli->close();
}
......@@ -129,29 +117,29 @@ function write_page_style($user, $file) {
if ($page === '') return;
$mysqli = connect_db();
$query = 'SELECT media, selector, property, value FROM page_style WHERE '.
'user = "'.$user.'" AND name = "'.$page.'" ORDER BY media, selector, '.
'property';
$query = 'SELECT media, selector, property, value FROM page_style WHERE ' .
'user = "' . $user . '" AND name = "' . $page . '" ORDER BY media, ' .
'selector, property';
if ($result = $mysqli->query($query)) {
write_file($file, fetch_style($result));
$result->close();
}
else {
log_db('write_page_style: '.$mysqli->error, $user, '', $page);
log_db('write_page_style: ' . $mysqli->error, $user, '', $page);
}
$mysqli->close();
}
function write_box_style($user, $file) {
$mysqli = connect_db();
$query = 'SELECT media, selector, property, value FROM box_style WHERE '.
'user = "'.$user.'" ORDER BY media, selector, property';
$query = 'SELECT media, selector, property, value FROM box_style WHERE ' .
'user = "' . $user . '" ORDER BY media, selector, property';
if ($result = $mysqli->query($query)) {
write_file($file, fetch_style($result));
$result->close();
}
else {
log_db('write_box_style: '.$mysqli->error, $user);
log_db('write_box_style: ' . $mysqli->error, $user);
}
$mysqli->close();
}
......@@ -159,9 +147,9 @@ function write_box_style($user, $file) {
function page_value($user, $page, $selector, $property, $media = '') {
$value = '';
$mysqli = connect_db();
$query = 'SELECT value FROM page_style WHERE user = "'.$user.'" AND '.
'name = "'.$page.'" AND media = "'.$media.'" AND '.
'selector = "'.$selector.'" AND property = "'.$property.'"';
$query = 'SELECT value FROM page_style WHERE user = "' . $user . '" AND ' .
'name = "' . $page . '" AND media = "' . $media . '" AND ' .
'selector = "' . $selector . '" AND property = "' . $property . '"';
if ($result = $mysqli->query($query)) {
if ($page_style = $result->fetch_assoc()) {
$value = $page_style['value'];
......@@ -169,7 +157,7 @@ function page_value($user, $page, $selector, $property, $media = '') {
$result->close();
}
else {
log_db('page_value: '.$mysqli->error, $user, '', $page);
log_db('page_value: ' . $mysqli->error, $user, '', $page);
}
$mysqli->close();
return $value;
......@@ -178,8 +166,8 @@ function page_value($user, $page, $selector, $property, $media = '') {
function site_value($selector, $property, $media = '') {
$value = '';
$mysqli = connect_db();
$query = 'SELECT value FROM site_style WHERE media = "'.$media.'" AND '.
'selector = "'.$selector.'" AND property = "'.$property.'"';
$query = 'SELECT value FROM site_style WHERE media = "' . $media . '" AND ' .
'selector = "' . $selector . '" AND property = "' . $property . '"';
if ($result = $mysqli->query($query)) {
if ($site_style = $result->fetch_assoc()) {
$value = $site_style['value'];
......@@ -187,7 +175,7 @@ function site_value($selector, $property, $media = '') {
$result->close();
}
else {
log_db('site_value: '.$mysqli->error);
log_db('site_value: ' . $mysqli->error);
}
$mysqli->close();
return $value;
......
......@@ -1771,6 +1771,7 @@ class SimplePie_Item
$thumbnails = null;
$title = null;
$try_cache = false;
// Start checking the attributes of media:content
if (isset($content['attribs']['']['bitrate']))
{
......@@ -1819,12 +1820,13 @@ class SimplePie_Item
if (isset($content['attribs']['']['type']))
{
$type = $this->sanitize($content['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
$try_cache = strpos($type, 'image/') === 0;
}
if (isset($content['attribs']['']['width']))
{
$width = $this->sanitize($content['attribs']['']['width'], SIMPLEPIE_CONSTRUCT_TEXT);
}
$url = $this->sanitize($content['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI, '', true);
$url = $this->sanitize($content['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI, '', $try_cache);
// Checking the other optional media: elements. Priority: media:content, media:group, item, channel
......@@ -2393,6 +2395,7 @@ class SimplePie_Item
$thumbnails = null;
$title = null;
$try_cache = false;
// Start checking the attributes of media:content
if (isset($content['attribs']['']['bitrate']))
{
......@@ -2441,6 +2444,7 @@ class SimplePie_Item
if (isset($content['attribs']['']['type']))
{
$type = $this->sanitize($content['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
$try_cache = strpos($type, 'image/') === 0;
}
if (isset($content['attribs']['']['width']))
{
......@@ -2448,7 +2452,7 @@ class SimplePie_Item
}
if (isset($content['attribs']['']['url']))
{
$url = $this->sanitize($content['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI, '', true);
$url = $this->sanitize($content['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI, '', $try_cache);
}
// Checking the other optional media: elements. Priority: media:content, media:group, item, channel
......@@ -2786,10 +2790,11 @@ class SimplePie_Item
$url = null;
$width = null;
$url = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link), true);
$try_cache = false;
if (isset($link['attribs']['']['type']))
{
$type = $this->sanitize($link['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
$try_cache = strpos($type, 'image/') === 0;
}
if (isset($link['attribs']['']['length']))
{
......@@ -2803,6 +2808,7 @@ class SimplePie_Item
{
$title = $title_parent;
}
$url = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link), $try_cache);
// Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
$this->data['enclosures'][] = $this->registry->create('Enclosure', array($url, $type, $length, null, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title, $width));
......
......@@ -61,6 +61,10 @@ if (!isset($_GET['url']) || $_GET['url'] === '') {
'<div class="form-spacing">' .
'<label>curl:</label><input type="checkbox" name="curl">' .
'</div>' .
'<div class="form-spacing">' .
'<label>json:</label>' .
'<input type="checkbox" name="json" checked="checked">' .
'</div>' .
'<button>submit</button>' .
'</form></body></html>';
exit;
......@@ -75,4 +79,10 @@ if (isset($_GET['item']) && $_GET['item'] !== '') {
if (isset($_GET['property']) && $_GET['property'] !== '') {
$mf = $mf['properties'][$_GET['property']];
}
highlight_string("<?php\n\n" . print_r($mf, true));
\ No newline at end of file
if (isset($_GET['json']) && !in_array($_GET['json'], ['', '0', 'off'])) {
header('Content-Type: application/json');
echo json_encode($mf);
}
else {
highlight_string("<?php\n\n" . print_r($mf, true));
}
\ No newline at end of file
......@@ -39,7 +39,7 @@ function photo_html($photo_list) {
else {
$value = $photo_list[0];
}
return '<p><img src="' . $value . '"' . $alt . '></p>';
return '<p><img class="u-photo" src="' . $value . '"' . $alt . '></p>';
}
// Make sure image-set is unique incase there's more than one shown on
// the feed page.
......@@ -61,7 +61,7 @@ function photo_html($photo_list) {
}
$html .= '<a href="' . $photo_list[$i] . '" ' . $hidden .
'data-lightbox="' . $image_set_id . '">' .
'<img src="' . $value . '"' . $alt . '></a>';
'<img class="u-photo" src="' . $value . '"' . $alt . '></a>';
}
return $html . '<br><b>' . $count . ' photos</b></p>';
}
......
......@@ -129,7 +129,6 @@ class Control extends Base {
'<div class="toolbar hidden">' .
'<div class="control-button site" title="site">site</div>';
$minimise_button = '';
if ($this->user->canEditPage) {
$content .= '<div class="control-button page" title="page">page</div>' .
'<div class="control-button add" title="add">add</div>' .
......@@ -143,7 +142,6 @@ class Control extends Base {
'<label for="control-layout" class="control-button layout">' .
'<span class="ui-icon ui-icon-arrow-4-diag"></span>' .
'</label>';
$minimise_button = '<div class="control-button minimise">minimise</div>';
}
if ($this->user->canCopyPage) {
$content .= '<div class="control-button copy" title="copy">copy</div>';
......@@ -158,7 +156,7 @@ class Control extends Base {
'<span class="ui-icon ui-icon-alert"></span>' .
'<span class="message">error</span>' .
'</div>' .
$minimise_button . $this->PageForm() .
$this->PageForm() .
'<div class="username">' . $user . '</div>' .
'</div>' . // This closes the opening div with class 'wrapper'.
$account_menu . $message_menu . $notification_menu . $add_menu .
......@@ -231,21 +229,18 @@ class Control extends Base {
// Add style rules to the site_style table.
$site_style = ['"",".control","position","sticky"',
'"",".control","width","100%"',
'"",".control","min-width","300px"',
'"",".control","top","0"',
'"",".control","opacity",".8"',
'"",".control","z-index","50"',
'"",".control","height","38px"',
'"",".control","height","48px"',
'"",".control","overflow","hidden"',
'"",".control","display","none"',
'"",".control.transparency","opacity","0.8"',
'"",".control .wrapper","height","38px"',
'"",".control .wrapper","padding-top","8px"',
'"",".control-button","margin-left","7px"',
'"",".control-button","float","left"',
'"",".control-button","font-size","15px"',
'"","label.control-button","margin-top","0"',
'"",".control-button.minimise","float","right"',
'"",".control-button.minimise","margin-right","7px"',
'"'. $media .'",".control-button.minimise","display","none"',
'"",".arrow","border-style","solid"',
'"",".arrow","border-width","10px"',
'"",".arrow","height","0px"',
......@@ -328,7 +323,7 @@ class Control extends Base {
'"","label[for=copy-input]","margin-top","3px"',
'"","#copy-input","width","175px"',
'"",".control .username","float","right"',
'"",".control .username","font-family","trebuchet ms"',
'"",".control .username","font-family","Helvetica"',
'"",".control .username","padding","6px"',
'"' . $media . '",".control .username","display","none"',
'"",".control .info","position","absolute"',
......@@ -336,15 +331,15 @@ class Control extends Base {
'"",".control .info","padding","8px"',
'"",".control .info .ui-icon-info","float","left"',
'"",".control .info .message","padding-left","0.2em"',
'"",".control .info .message","font-family","trebuchet ms"',
'"",".control .error .message","font-family","trebuchet ms"',
'"",".control .info .message","font-family","Helvetica"',
'"",".control .error .message","font-family","Helvetica"',
'"",".control .error","position","absolute"',
'"",".control .error","width","18em"',
'"",".control .error","padding","8px"',
'"",".control .error .ui-icon-alert","float","left"',
'"",".control .error .message","padding-left","0.2em"'];
$this->AddSiteStyle($site_style);
$this->AddSettingTypes(['"control","position","scroll,sticky","radio",' .
$this->AddSettingTypes(['"control","position","scroll,fixed","radio",' .
'"The control bar can be fixed to the top of the browser window so ' .
'that it\'s always visible, or it can scroll with the page."',
'"control","displayMessageButton","display,hidden","radio",' .
......
......@@ -43,7 +43,7 @@ class Page {
return;
}
// When secure is true in config check the scheme and redirect if reqd.
// When secure is true in config check the scheme and redirect if required.
$http_only = !isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] === '';
if ($http_only && $this->user->config->Secure()) {
header('Location: ' . $this->Url($this->name, $this->owner, true));
......
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