Skip to content

Commit

Permalink
Merge pull request #22 from xibosignage/develop
Browse files Browse the repository at this point in the history
Merge into master for release 1.7.1
  • Loading branch information
dasgarner committed Feb 8, 2015
2 parents ada0bff + 525eb96 commit e235044
Show file tree
Hide file tree
Showing 71 changed files with 6,019 additions and 6,008 deletions.
12 changes: 7 additions & 5 deletions 3rdparty/jquery-file-upload/XiboUploadHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,19 @@ protected function handle_form_data($file, $index) {
$name = $_REQUEST['name'][$index];
$duration = $_REQUEST['duration'][$index];

$layoutid = Kit::GetParam('layoutid', _REQUEST, _INT);
$regionid = Kit::GetParam('regionid', _REQUEST, _STRING);
$layoutId = Kit::GetParam('layoutid', _REQUEST, _INT);
$type = Kit::GetParam('type', _REQUEST, _WORD);

Debug::LogEntry('audit', 'Upload complete for Type: ' . $type . ' and file name: ' . $file->name . '. Name: ' . $name . '. Duration:' . $duration);

// We want to create a module for each of the uploaded files.
// Do not pass in the region ID so that we only assign to the library and not to the layout
require_once("modules/$type.module.php");
if (!$module = new $type($this->options['db'], $this->options['user'], '', $layoutid, '', '')) {
$file->error = $module->GetErrorMessage();
try {
$module = ModuleFactory::createForLibrary($type, $layoutId, $this->options['db'], $this->options['user']);
}
catch (Exception $e) {
$file->error = $e->getMessage();
exit();
}

// We want to add this item to our library
Expand Down
12 changes: 12 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Contributing
We'd love to work with you and accept your contributions. For small changes like bug fixes, typos, etc. Please Fork us and submit a pull request with the details of what you have changed.

For larger changes, you will have to electronically sign a statement that indicates two things:

* You are willingly licensing your contributions under the terms of the open source license of the project that you're contributing to.

* You are legally able to license your contributions as stated.

This is called a Contributor Licence Agreement or "CLA" for short.

The standard licence for Xibo is the [AGPLv3](LICENSE). For more information please see [CONTRIBUTING](https://github.com/xibosignage/xibo/blob/master/CONTRIBUTING.md).
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Xibo. If not, see <http://www.gnu.org/licenses/>.

# Contributing
The standard licence for Xibo is the [AGPLv3](LICENSE). For more information please see [CONTRIBUTING.md](CONTRIBUTING.md).

# Repository
This folder contains the Xibo CMS application.

Expand Down
15 changes: 13 additions & 2 deletions config/client.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@
array('id' => 14400, 'value' => __('4 hours')),
array('id' => 43200, 'value' => __('12 hours'))
),
'default' => 900,
'default' => 300,
'helpText' => __('How often should the Player check for new content.'),
'validation' => 'numeric',
'enabled' => true,
Expand Down Expand Up @@ -493,7 +493,18 @@
'helpText' => __('The duration between status screen shots in minutes. 0 to disable. Warning: This is bandwidth intensive.'),
'enabled' => Theme::GetConfig('client_screenShotRequestInterval_enabled', true),
'groupClass' => NULL
)
),
array(
'name' => 'expireModifiedLayouts',
'tabId' => 'advanced',
'title' => __('Expire Modified Layouts?'),
'type' => _CHECKBOX,
'fieldType' => 'checkbox',
'default' => 0,
'helpText' => __('When enabled the client will send the current layout to the CMS each time it changes. Warning: This is bandwidth intensive and should be disabled unless on a LAN.'),
'enabled' => true,
'groupClass' => NULL
),
)
)
);
1 change: 1 addition & 0 deletions install.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
require_once("lib/data/data.class.php");
require_once("lib/modules/module.interface.php");
require_once("lib/modules/module.class.php");
require_once("lib/modules/modulefactory.class.php");
require_once('modules/module_user_general.php');

// Create a theme
Expand Down
2 changes: 1 addition & 1 deletion install/database/80.sql
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ UPDATE `setting` SET cat = 'general', ordering = 60, usersee = '1', userchange =
UPDATE `setting` SET cat = 'general', ordering = 70, usersee = '1', userchange = '0', `default` = '', `title` = 'Status Dashboard Widget' WHERE setting = 'EMBEDDED_STATUS_WIDGET';
UPDATE `setting` SET cat = 'general', ordering = 80, usersee = '1', userchange = '1', `default` = '1', `title` = 'Allow Import?' WHERE setting = 'SETTING_IMPORT_ENABLED';
UPDATE `setting` SET cat = 'general', ordering = 90, usersee = '1', userchange = '1', `default` = '1', `title` = 'Enable Library Tidy?' WHERE setting = 'SETTING_LIBRARY_TIDY_ENABLED';
UPDATE `setting` SET cat = 'general', ordering = 10, usersee = '1', userchange = '1', `default` = 'http://www.xibo.org.uk/manual/', `title` = 'Location of the Manual' WHERE setting = 'HELP_BASE';
UPDATE `setting` SET cat = 'general', ordering = 10, usersee = '1', userchange = '1', `default` = 'http://www.xibo.org.uk/manual/en/', `title` = 'Location of the Manual' WHERE setting = 'HELP_BASE';
UPDATE `setting` SET cat = 'maintenance', ordering = 10, usersee = '1', userchange = '1', `default` = 'Off', `title` = 'Enable Maintenance?' WHERE setting = 'MAINTENANCE_ENABLED';
UPDATE `setting` SET cat = 'maintenance', ordering = 20, usersee = '1', userchange = '1', `default` = 'On', `title` = 'Enable Email Alerts?' WHERE setting = 'MAINTENANCE_EMAIL_ALERTS';
UPDATE `setting` SET cat = 'maintenance', ordering = 30, usersee = '1', userchange = '1', `default` = '[email protected]', `title` = 'Admin email address' WHERE setting = 'mail_to';
Expand Down
2 changes: 1 addition & 1 deletion install/database/82.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ CREATE TABLE IF NOT EXISTS `lktagmedia` (
`tagId` int(11) NOT NULL,
`mediaId` int(11) NOT NULL,
PRIMARY KEY (`lkTagMediaId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf16 AUTO_INCREMENT=1 ;
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

/* Clear the un-used template id field */
UPDATE `layout` SET templateID = NULL;
Expand Down
3 changes: 3 additions & 0 deletions install/database/84.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ VALUES (
'CALENDAR_TYPE', 'Gregorian', 'dropdown', 'Which Calendar Type should the CMS use?', 'Gregorian|Jalali', 'regional', 1, 'Calendar Type', '', '50', 'Gregorian', '1', 'string'
);

INSERT INTO `displayprofile` (`name`, `type`, `config`, `isdefault`, `userid`)
VALUES ('Windows', 'windows', '[]', '1', '1'), ('Android', 'android', '[]', '1', '1');

UPDATE `version` SET `app_ver` = '1.7.0', `XmdsVersion` = 4, `XlfVersion` = 2;
UPDATE `setting` SET `value` = 0 WHERE `setting` = 'PHONE_HOME_DATE';
UPDATE `version` SET `DBVersion` = '84';
9 changes: 9 additions & 0 deletions install/database/85.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
INSERT INTO `module` (`ModuleID`, `Module`, `Name`, `Enabled`, `RegionSpecific`, `Description`, `ImageUri`, `SchemaVersion`, `ValidExtensions`, `PreviewEnabled`, `assignable`, `render_as`) VALUES
(NULL, 'clock', 'Clock', '1', '1', 'Display a Clock', 'forms/library.gif', '1', '', '1', '1', 'html');

ALTER TABLE `display` ADD `storageAvailableSpace` INT NULL ,
ADD `storageTotalSpace` INT NULL;

UPDATE `version` SET `app_ver` = '1.7.1', `XmdsVersion` = 4, `XlfVersion` = 2;
UPDATE `setting` SET `value` = 0 WHERE `setting` = 'PHONE_HOME_DATE';
UPDATE `version` SET `DBVersion` = '85';
10 changes: 7 additions & 3 deletions install/master/data.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
INSERT INTO `version` (`app_ver`, `XmdsVersion`, `XlfVersion`, `DBVersion`) VALUES
('1.7.0', 4, 2, 84);
('1.7.1', 4, 2, 85);

INSERT INTO `group` (`groupID`, `group`, `IsUserSpecific`, `IsEveryone`) VALUES
(1, 'Users', 0, 0),
Expand Down Expand Up @@ -113,7 +113,8 @@ INSERT INTO `module` (`ModuleID`, `Module`, `Name`, `Enabled`, `RegionSpecific`,
(13, 'localvideo', 'Local Video', 1, 1, 'Play a video locally stored on the client', 'forms/video.gif', 1, NULL, 1, 1, NULL, NULL),
(14, 'genericfile', 'Generic File', 1, 0, 'A generic file to be stored in the library', 'forms/library.gif', 1, 'apk,js,html,htm', 0, 0, NULL, NULL),
(15, 'clock', 'Clock', 1, 1, 'Display a Clock', 'forms/library.gif', 1, NULL, 1, 1, 'html', '[]'),
(16, 'font', 'Font', 1, 0, 'A font to use in other Modules', 'forms/library.gif', 1, 'ttf,otf,eot,svg,woff', 0, 0, NULL, NULL);
(16, 'font', 'Font', 1, 0, 'A font to use in other Modules', 'forms/library.gif', 1, 'ttf,otf,eot,svg,woff', 0, 0, NULL, NULL),
(17, 'clock', 'Clock', 1, 1, 'Display a Clock', 'forms/library.gif', 1, NULL, 1, 1, 'html', NULL);

INSERT INTO `pagegroup` (`pagegroupID`, `pagegroup`) VALUES
(1, 'Schedule'),
Expand Down Expand Up @@ -224,7 +225,7 @@ INSERT INTO `setting` (`settingid`, `setting`, `value`, `fieldType`, `helptext`,
(30, 'audit', 'error', 'dropdown', 'Set the level of logging the CMS should record. In production systems "error" is recommended.', 'error|info|audit|off', 'troubleshooting', 1, 'Log Level', '', 20, 'error', 1, 'word'),
(33, 'LIBRARY_LOCATION', '', 'text', 'The fully qualified path to the CMS library location.', NULL, 'configuration', 1, 'Library Location', 'required', 10, '', 1, 'string'),
(34, 'SERVER_KEY', '', 'text', NULL, NULL, 'configuration', 1, 'CMS Secret Key', 'required', 20, '', 1, 'string'),
(35, 'HELP_BASE', 'http://www.xibo.org.uk/manual-tuttle/', 'text', NULL, NULL, 'general', 1, 'Location of the Manual', 'required', 10, 'http://www.xibo.org.uk/manual/', 1, 'string'),
(35, 'HELP_BASE', 'http://www.xibo.org.uk/manual/en/', 'text', NULL, NULL, 'general', 1, 'Location of the Manual', 'required', 10, 'http://www.xibo.org.uk/manual/', 1, 'string'),
(36, 'PHONE_HOME', 'On', 'dropdown', 'Should the server send anonymous statistics back to the Xibo project?', 'On|Off', 'general', 1, 'Allow usage tracking?', '', 10, 'On', 1, 'word'),
(37, 'PHONE_HOME_KEY', '', 'text', 'Key used to distinguish each Xibo instance. This is generated randomly based on the time you first installed Xibo, and is completely untraceable.', NULL, 'general', 0, 'Phone home key', '', 20, '', 0, 'string'),
(38, 'PHONE_HOME_URL', 'http://www.xibo.org.uk/stats/track.php', 'text', 'The URL to connect to to PHONE_HOME (if enabled)', NULL, 'network', 0, 'Phone home URL', '', 60, 'http://www.xibo.org.uk/stats/track.php', 0, 'string'),
Expand Down Expand Up @@ -342,3 +343,6 @@ INSERT INTO `tag` (`tagId`, `tag`) VALUES
(1, 'template'),
(2, 'background'),
(3, 'thumbnail');

INSERT INTO `displayprofile` (`name`, `type`, `config`, `isdefault`, `userid`)
VALUES ('Windows', 'windows', '[]', '1', '1'), ('Android', 'android', '[]', '1', '1');
2 changes: 2 additions & 0 deletions install/master/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ CREATE TABLE IF NOT EXISTS `display` (
`displayprofileid` int(11) NULL,
`currentLayoutId` int(11) NULL,
`screenShotRequested` tinyint(4) NOT NULL DEFAULT '0',
`storageAvailableSpace` int(11) NULL,
`storageTotalSpace` int(11) NULL,
PRIMARY KEY (`displayid`),
KEY `defaultplaylistid` (`defaultlayoutid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
Expand Down
144 changes: 84 additions & 60 deletions lib/app/debug.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,62 +158,15 @@ function MailError($errmsg, $err)
*/
static function LogEntry($type, $message, $page = "", $function = "", $logdate = "", $displayid = 0, $scheduleID = 0, $layoutid = 0, $mediaid = '')
{
// Check level
if (Debug::getLevel($type) > self::$_level)
return;

if (self::$pdo == NULL)
self::$pdo = PDOConnect::newConnection();

$currentdate = date("Y-m-d H:i:s");
$requestUri = Kit::GetParam('REQUEST_URI', $_SERVER, _STRING, 'Not Supplied');
$requestIp = Kit::GetParam('REMOTE_ADDR', $_SERVER, _STRING, 'Not Supplied');
$requestUserAgent = Kit::GetParam('HTTP_USER_AGENT', $_SERVER, _STRING, 'Not Supplied');
$requestUserAgent = substr($requestUserAgent, 0, 253);
$userid = Kit::GetParam('userid', _SESSION, _INT, 0);
$message = Kit::ValidateParam($message, _HTMLSTRING);

if ($logdate == "")
$logdate = $currentdate;

//Prepare the variables
if ($page == "")
$page = Kit::GetParam('p', _GET, _WORD);

// Insert into the DB
try {
$dbh = self::$pdo;

$SQL = 'INSERT INTO log (logdate, type, page, function, message, requesturi, remoteaddr, useragent, userid, displayid, scheduleid, layoutid, mediaid) ';
$SQL .= ' VALUES (:logdate, :type, :page, :function, :message, :requesturi, :remoteaddr, :useragent, :userid, :displayid, :scheduleid, :layoutid, :mediaid) ';

$sth = $dbh->prepare($SQL);

$params = array(
'logdate' => $currentdate,
'type' => $type,
'page' => $page,
'function' => $function,
'message' => $message,
'requesturi' => $requestUri,
'remoteaddr' => $requestIp,
'useragent' => $requestUserAgent,
'userid' => $userid,
'displayid' => $displayid,
'scheduleid' => $scheduleID,
'layoutid' => $layoutid,
'mediaid' => $mediaid
);

$sth->execute($params);
}
catch (PDOException $e) {
// In this case just silently log the error
error_log($message . '\n\n', 3, './err_log.xml');
error_log($e->getMessage() . '\n\n', 3, './err_log.xml');
}
// Log
self::log($type, $message, $page, $function, $logdate, $displayid, $scheduleID, $layoutid, $mediaid);
}

public static function Audit($message)
public static function Audit($message, $displayId = 0)
{
if (self::$_level < 10)
return;
Expand All @@ -222,18 +175,22 @@ public static function Audit($message)
$trace = debug_backtrace();
$caller = $trace[1];

Debug::LogEntry('audit', $message, (isset($caller['class'])) ? $caller['class'] : 'Global', $caller['function']);
Debug::LogEntry('audit', $message, (isset($caller['class'])) ? $caller['class'] : 'Global', $caller['function'], '', $displayId);
}

public static function Info($message)
public static function Info($message, $displayId = 0)
{
if (self::$_level < 5)
return;

Debug::LogEntry('info', $message, (isset($caller['class'])) ? $caller['class'] : 'Global', $caller['function']);
// Get the calling class / function
$trace = debug_backtrace();
$caller = $trace[1];

Debug::LogEntry('info', $message, (isset($caller['class'])) ? $caller['class'] : 'Global', $caller['function'], '', $displayId);
}

public static function Error($message)
public static function Error($message, $displayId = 0)
{
if (self::$_level < 1)
return;
Expand All @@ -242,15 +199,16 @@ public static function Error($message)
$trace = debug_backtrace();
$caller = $trace[1];

Debug::LogEntry('error', $message, (isset($caller['class'])) ? $caller['class'] : 'Global', $caller['function']);
Debug::LogEntry('error', $message, (isset($caller['class'])) ? $caller['class'] : 'Global', $caller['function'], '', $displayId);
}

/**
* Log the SQL statement
* @param $sql string The SQL
* @param $params array The Params
* @param string $sql
* @param array $params[Optional] The Params
* @param int[Optional] $displayId
*/
public static function sql($sql, $params)
public static function sql($sql, $params = array(), $displayId = 0)
{
if (self::$_logSql != 1)
return;
Expand All @@ -259,7 +217,73 @@ public static function sql($sql, $params)
$trace = debug_backtrace();
$caller = $trace[1];

Debug::LogEntry('error', 'SQL: ' . $sql . '. Params: ' . var_export($params, true) . '.', (isset($caller['class'])) ? $caller['class'] : 'Global', $caller['function']);
Debug::LogEntry('audit', 'SQL: ' . $sql . '. Params: ' . var_export($params, true) . '.', (isset($caller['class'])) ? $caller['class'] : 'Global', $caller['function'], '', $displayId);
}

/**
* Log
* @param string $type
* @param string $message
* @param string $page[Optional]
* @param string $function[Optional]
* @param string $logDate[Optional]
* @param int $displayId[Optional]
* @param int $scheduleId[Optional]
* @param int $layoutId[Optional]
* @param string $mediaId[Optional]
*/
public static function log($type, $message, $page = null, $function = null, $logDate = null, $displayId = 0, $scheduleId = 0, $layoutId = 0, $mediaId = null)
{
if (self::$pdo == NULL)
self::$pdo = PDOConnect::newConnection();

$currentDate = date("Y-m-d H:i:s");
$requestUri = Kit::GetParam('REQUEST_URI', $_SERVER, _STRING, 'Not Supplied');
$requestIp = Kit::GetParam('REMOTE_ADDR', $_SERVER, _STRING, 'Not Supplied');
$requestUserAgent = Kit::GetParam('HTTP_USER_AGENT', $_SERVER, _STRING, 'Not Supplied');
$requestUserAgent = substr($requestUserAgent, 0, 253);
$userId = Kit::GetParam('userid', _SESSION, _INT, 0);
$message = Kit::ValidateParam($message, _HTMLSTRING);

// Prepare the variables
if ($logDate == null)
$logDate = $currentDate;

if ($page == null)
$page = Kit::GetParam('p', _GET, _WORD);

// Insert into the DB
try {
$dbh = self::$pdo;

$SQL = 'INSERT INTO log (logdate, type, page, function, message, requesturi, remoteaddr, useragent, userid, displayid, scheduleid, layoutid, mediaid)
VALUES (:logdate, :type, :page, :function, :message, :requesturi, :remoteaddr, :useragent, :userid, :displayid, :scheduleid, :layoutid, :mediaid) ';

$sth = $dbh->prepare($SQL);

$params = array(
'logdate' => $logDate,
'type' => $type,
'page' => $page,
'function' => $function,
'message' => $message,
'requesturi' => $requestUri,
'remoteaddr' => $requestIp,
'useragent' => $requestUserAgent,
'userid' => $userId,
'displayid' => $displayId,
'scheduleid' => $scheduleId,
'layoutid' => $layoutId,
'mediaid' => $mediaId
);

$sth->execute($params);
}
catch (PDOException $e) {
// In this case just silently log the error
error_log($message . '\n\n', 3, './err_log.xml');
error_log($e->getMessage() . '\n\n', 3, './err_log.xml');
}
}
}
?>
7 changes: 4 additions & 3 deletions lib/app/kit.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,10 @@ static public function GetParam($param, $source = _POST, $type = _STRING, $defau
/**
* Validates a Parameter
* Based on code from Joomla! 1.5
* @return
* @param $param Object
* @param $type Object
* @return mixed
* @param string $param
* @param string $type
* @param bool $sanitize
*/
static function ValidateParam($param, $type, $sanitize = true)
{
Expand Down
Loading

0 comments on commit e235044

Please sign in to comment.