Changed the name of "Default" theme folder to "Classic"
544
common.inc.php
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
// ////echo phpinfo();
|
// ////echo phpinfo();
|
||||||
header('Content-Type: text/html; charset=utf8');
|
header('Content-Type: text/html; charset=utf8');
|
||||||
include_once ('helper.inc.php');
|
include_once('helper.inc.php');
|
||||||
// set error reporting to not show notices, for some reason some people's installation dont set this by default
|
// set error reporting to not show notices, for some reason some people's installation dont set this by default
|
||||||
// so we will set it in the code instead just to make sure
|
// so we will set it in the code instead just to make sure
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
@ -70,7 +70,7 @@ if (!is_writable($prependdir . 'data')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (file_exists($prependdir . 'data/config.inc.php')) {
|
if (file_exists($prependdir . 'data/config.inc.php')) {
|
||||||
require_once ($prependdir . 'data/config.inc.php');
|
require_once($prependdir . 'data/config.inc.php');
|
||||||
} else {
|
} else {
|
||||||
echo '<html><head><title>SFIAB</title></head><body>';
|
echo '<html><head><title>SFIAB</title></head><body>';
|
||||||
echo '<h1>Science Fair In A Box - Installation</h1>';
|
echo '<h1>Science Fair In A Box - Installation</h1>';
|
||||||
@ -173,10 +173,10 @@ while ($r = $q->fetch()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// and now pull the theme
|
// and now pull the theme
|
||||||
require_once ("theme/{$config['theme']}/theme.php");
|
require_once("theme/{$config['theme']}/theme.php");
|
||||||
require_once ("theme/{$config['theme_icons']}/icons.php");
|
require_once("theme/{$config['theme_icons']}/icons.php");
|
||||||
|
|
||||||
require_once ('committee.inc.php');
|
require_once('committee.inc.php');
|
||||||
|
|
||||||
if ($config['SFIABDIRECTORY'] == '') {
|
if ($config['SFIABDIRECTORY'] == '') {
|
||||||
session_name('SFIABSESSID');
|
session_name('SFIABSESSID');
|
||||||
@ -276,7 +276,7 @@ function i18n($str, $args = array(), $argsdesc = array(), $forcelang = '')
|
|||||||
if (count($argsdesc)) {
|
if (count($argsdesc)) {
|
||||||
$argsdescstring = '';
|
$argsdescstring = '';
|
||||||
$n = 1;
|
$n = 1;
|
||||||
foreach ($argsdesc AS $ad) {
|
foreach ($argsdesc as $ad) {
|
||||||
$argsdescstring .= "%$n=$ad, ";
|
$argsdescstring .= "%$n=$ad, ";
|
||||||
$n++;
|
$n++;
|
||||||
}
|
}
|
||||||
@ -351,63 +351,74 @@ function send_header($title = '', $nav = null, $icon = null, $titletranslated =
|
|||||||
else
|
else
|
||||||
$HEADER_SENT = true;
|
$HEADER_SENT = true;
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<title><? if ($title && !$titletranslated) echo i18n($title); else if ($title) echo $title; else echo i18n($config['fairname']); ?></title>
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://code.jquery.com/ui/1.14.1/themes/base/jquery-ui.css">
|
<head>
|
||||||
<link rel="stylesheet" href="<?= $config['SFIABDIRECTORY'] ?>/theme/<?= $config['theme'] ?>/sfiab.css" type="text/css" media="all" />
|
<meta charset="utf-8" />
|
||||||
<link rel="stylesheet" href="<?= $config['SFIABDIRECTORY'] ?>/tableeditor.css" type="text/css" media="all" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined" rel="stylesheet" />
|
<title><? if ($title && !$titletranslated) echo i18n($title);
|
||||||
|
else if ($title) echo $title;
|
||||||
|
else echo i18n($config['fairname']); ?></title>
|
||||||
|
|
||||||
</head>
|
<link rel="stylesheet" href="https://code.jquery.com/ui/1.14.1/themes/base/jquery-ui.css">
|
||||||
<body>
|
<link rel="stylesheet" href="<?= $config['SFIABDIRECTORY'] ?>/theme/<?= $config['theme'] ?>/sfiab.css" type="text/css" media="all" />
|
||||||
<!-- <? if ($title && !$titletranslated) echo i18n($title); else if ($title) echo $title; else echo i18n($config['fairname']); ?> -->
|
<link rel="stylesheet" href="<?= $config['SFIABDIRECTORY'] ?>/tableeditor.css" type="text/css" media="all" />
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
<link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined" rel="stylesheet" />
|
||||||
<script src="https://code.jquery.com/jquery-migrate-3.5.2.js"></script>
|
|
||||||
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.32.0/js/jquery.tablesorter.min.js" integrity="sha512-O/JP2r8BG27p5NOtVhwqsSokAwEP5RwYgvEzU9G6AfNjLYqyt2QT8jqU1XrXCiezS50Qp1i3ZtCQWkHZIRulGA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
</head>
|
||||||
|
|
||||||
<!-- <script type="text/javascript" src="<?= $config['SFIABDIRECTORY'] ?>/js/jqueryui/1.7.2/jquery-ui.min.js"></script> -->
|
<body>
|
||||||
<script src="https://code.jquery.com/ui/1.14.1/jquery-ui.min.js"></script>
|
<!-- <? if ($title && !$titletranslated) echo i18n($title);
|
||||||
<script type="text/javascript" src="<?= $config['SFIABDIRECTORY'] ?>/js/sfiab.js"></script>
|
else if ($title) echo $title;
|
||||||
<script type="text/javascript" src="<?= $config['SFIABDIRECTORY'] ?>/theme/<?= $config['theme'] ?>/theme-script.js"></script>
|
else echo i18n($config['fairname']); ?> -->
|
||||||
<script type="text/javascript">
|
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
||||||
$(document).ready(function(){
|
<script src="https://code.jquery.com/jquery-migrate-3.5.2.js"></script>
|
||||||
|
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.32.0/js/jquery.tablesorter.min.js" integrity="sha512-O/JP2r8BG27p5NOtVhwqsSokAwEP5RwYgvEzU9G6AfNjLYqyt2QT8jqU1XrXCiezS50Qp1i3ZtCQWkHZIRulGA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||||
|
|
||||||
|
<!-- <script type="text/javascript" src="<?= $config['SFIABDIRECTORY'] ?>/js/jqueryui/1.7.2/jquery-ui.min.js"></script> -->
|
||||||
|
<script src="https://code.jquery.com/ui/1.14.1/jquery-ui.min.js"></script>
|
||||||
|
<script type="text/javascript" src="<?= $config['SFIABDIRECTORY'] ?>/js/sfiab.js"></script>
|
||||||
|
<script type="text/javascript" src="<?= $config['SFIABDIRECTORY'] ?>/theme/<?= $config['theme'] ?>/theme-script.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
$('.tableview').tablesorter();
|
$('.tableview').tablesorter();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<?
|
<?
|
||||||
// if we're under /admin or /config we also want the translation editor
|
// if we're under /admin or /config we also want the translation editor
|
||||||
if (substr(getcwd(), -6) == '/admin' || substr(getcwd(), -7) == '/config' || substr(getcwd(), -6) == '\admin' || substr(getcwd(), -7) == '\config')
|
if (substr(getcwd(), -6) == '/admin' || substr(getcwd(), -7) == '/config' || substr(getcwd(), -6) == '\admin' || substr(getcwd(), -7) == '\config')
|
||||||
require_once ('../translationseditor.inc.php');
|
require_once('../translationseditor.inc.php');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div id="notice_area" class="notice_area"></div>
|
<div id="notice_area" class="notice_area"></div>
|
||||||
<div id="header">
|
<div id="header">
|
||||||
<?
|
<?
|
||||||
if (file_exists($prependdir . 'data/logo-100.gif'))
|
if (file_exists($prependdir . 'data/logo-100.gif'))
|
||||||
echo '<img align="left" height="50" src="' . $config['SFIABDIRECTORY'] . '/data/logo-100.gif">';
|
echo '<img align="left" height="50" src="' . $config['SFIABDIRECTORY'] . '/data/logo-100.gif">';
|
||||||
|
|
||||||
echo '<h1>' . i18n($config['fairname']) . '</h1>';
|
echo '<h1>' . i18n($config['fairname']) . '</h1>';
|
||||||
|
|
||||||
if($config['theme'] == 'science_ation')
|
|
||||||
echo "<span id='menu-toggle-button' onClick='toggle_sidebar()' class='material-symbols-outlined'>
|
|
||||||
menu
|
|
||||||
</span>"
|
|
||||||
?>
|
|
||||||
|
|
||||||
</div>
|
if ($config['theme'] == 'science_ation')
|
||||||
<hr />
|
echo "<span id='menu-toggle-button' onClick='toggle_sidebar()' class='material-symbols-outlined'>
|
||||||
<?
|
menu
|
||||||
|
</span>"
|
||||||
|
?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
|
<?
|
||||||
echo '<div align="right" style="font-size: 0.75em;">';
|
echo '<div align="right" style="font-size: 0.75em;">';
|
||||||
if (isset($_SESSION['users_type'])) {
|
if (isset($_SESSION['users_type'])) {
|
||||||
$types = array('volunteer' => 'Volunteer', 'judge' => 'Judge',
|
$types = array(
|
||||||
'student' => 'Participant', 'committee' => 'Committee Member',
|
'volunteer' => 'Volunteer',
|
||||||
'fair' => 'Science Fair');
|
'judge' => 'Judge',
|
||||||
|
'student' => 'Participant',
|
||||||
|
'committee' => 'Committee Member',
|
||||||
|
'fair' => 'Science Fair'
|
||||||
|
);
|
||||||
if ($_SESSION['users_type'] != false) {
|
if ($_SESSION['users_type'] != false) {
|
||||||
echo i18n($types[$_SESSION['users_type']]);
|
echo i18n($types[$_SESSION['users_type']]);
|
||||||
}
|
}
|
||||||
@ -429,11 +440,12 @@ menu
|
|||||||
echo i18n('Not Logged In');
|
echo i18n('Not Logged In');
|
||||||
}
|
}
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<table id='content' cellpadding="5" width="100%">
|
<table id='content' cellpadding="5" width="100%">
|
||||||
<tr><td id='sidebar' width="175">
|
<tr>
|
||||||
<?
|
<td id='sidebar' width="175">
|
||||||
|
<?
|
||||||
global $pdo;
|
global $pdo;
|
||||||
// if the date is greater than the date/time that the confirmed participants gets posted,
|
// if the date is greater than the date/time that the confirmed participants gets posted,
|
||||||
// then we will show the registration confirmation page as a link in the menu,
|
// then we will show the registration confirmation page as a link in the menu,
|
||||||
@ -448,10 +460,10 @@ menu
|
|||||||
$registrationconfirmationlink = '<li><a href="' . $config['SFIABDIRECTORY'] . '/confirmed_participants.php">' . i18n('Confirmed Participants') . '</a></li>';
|
$registrationconfirmationlink = '<li><a href="' . $config['SFIABDIRECTORY'] . '/confirmed_participants.php">' . i18n('Confirmed Participants') . '</a></li>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div id="left">
|
<div id="left">
|
||||||
<?
|
<?
|
||||||
if (is_array($nav)) {
|
if (is_array($nav)) {
|
||||||
$navkeys = array_keys($nav);
|
$navkeys = array_keys($nav);
|
||||||
if (isset($navkeys[2]) && $navkeys[2] == 'Fundraising') {
|
if (isset($navkeys[2]) && $navkeys[2] == 'Fundraising') {
|
||||||
@ -465,9 +477,9 @@ menu
|
|||||||
echo "</ul><br />\n";
|
echo "</ul><br />\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<ul class="mainnav">
|
<ul class="mainnav">
|
||||||
<?
|
<?
|
||||||
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/index.php\">" . i18n('Home Page') . '</a></li>';
|
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/index.php\">" . i18n('Home Page') . '</a></li>';
|
||||||
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/important_dates.php\">" . i18n('Important Dates') . '</a></li>';
|
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/important_dates.php\">" . i18n('Important Dates') . '</a></li>';
|
||||||
|
|
||||||
@ -483,10 +495,10 @@ menu
|
|||||||
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/committees.php\">" . i18n('Committee') . '</a></li>';
|
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/committees.php\">" . i18n('Committee') . '</a></li>';
|
||||||
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/winners.php\">" . i18n('Winners') . '</a></li>';
|
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/winners.php\">" . i18n('Winners') . '</a></li>';
|
||||||
echo '</ul>';
|
echo '</ul>';
|
||||||
?>
|
?>
|
||||||
<br />
|
<br />
|
||||||
<ul class="mainnav">
|
<ul class="mainnav">
|
||||||
<?
|
<?
|
||||||
if (get_value_from_session('users_type') == 'committee') {
|
if (get_value_from_session('users_type') == 'committee') {
|
||||||
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/user_personal.php\">" . i18n('My Profile') . '</a></li>';
|
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/user_personal.php\">" . i18n('My Profile') . '</a></li>';
|
||||||
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/committee_main.php\">" . i18n('Committee Home') . '</a></li>';
|
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/committee_main.php\">" . i18n('Committee Home') . '</a></li>';
|
||||||
@ -518,14 +530,14 @@ menu
|
|||||||
} else {
|
} else {
|
||||||
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/login.php\">" . i18n('Login/Register') . '</a></li>';
|
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/login.php\">" . i18n('Login/Register') . '</a></li>';
|
||||||
}
|
}
|
||||||
?></ul>
|
?></ul>
|
||||||
<div class="aligncenter">
|
<div class="aligncenter">
|
||||||
<?
|
<?
|
||||||
if (count($config['languages']) > 1) {
|
if (count($config['languages']) > 1) {
|
||||||
echo '<br />';
|
echo '<br />';
|
||||||
echo '<form name="languageselect" method="get" action="' . $_SERVER['PHP_SELF'] . '">';
|
echo '<form name="languageselect" method="get" action="' . $_SERVER['PHP_SELF'] . '">';
|
||||||
echo "<select name=\"switchlanguage\" onchange=\"document.forms.languageselect.submit()\">\n";
|
echo "<select name=\"switchlanguage\" onchange=\"document.forms.languageselect.submit()\">\n";
|
||||||
foreach ($config['languages'] AS $key => $val) {
|
foreach ($config['languages'] as $key => $val) {
|
||||||
if ($_SESSION['lang'] == $key)
|
if ($_SESSION['lang'] == $key)
|
||||||
$selected = 'selected="selected"';
|
$selected = 'selected="selected"';
|
||||||
else
|
else
|
||||||
@ -537,17 +549,18 @@ menu
|
|||||||
echo '</form>';
|
echo '</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<?
|
<?
|
||||||
echo "<br /><ul class=\"mainnav\">\n";
|
echo "<br /><ul class=\"mainnav\">\n";
|
||||||
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/contact.php\">" . i18n('Contact Us') . "</a></li>\n";
|
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/contact.php\">" . i18n('Contact Us') . "</a></li>\n";
|
||||||
echo '</ul>';
|
echo '</ul>';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</td><td id='main-content'>
|
</td>
|
||||||
<?
|
<td id='main-content'>
|
||||||
|
<?
|
||||||
|
|
||||||
if (is_array($nav)) {
|
if (is_array($nav)) {
|
||||||
echo '<div id="mainwhere">' . i18n('You are here:') . ' ';
|
echo '<div id="mainwhere">' . i18n('You are here:') . ' ';
|
||||||
@ -560,10 +573,10 @@ menu
|
|||||||
echo $title;
|
echo $title;
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div id="main">
|
<div id="main">
|
||||||
<?
|
<?
|
||||||
|
|
||||||
if (committee_auth_has_access('config') || committee_auth_has_access('admin'))
|
if (committee_auth_has_access('config') || committee_auth_has_access('admin'))
|
||||||
committee_warnings();
|
committee_warnings();
|
||||||
@ -598,18 +611,20 @@ menu
|
|||||||
echo '</table>';
|
echo '</table>';
|
||||||
|
|
||||||
display_messages();
|
display_messages();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* END OF send_header */
|
/* END OF send_header */
|
||||||
|
|
||||||
function send_footer()
|
function send_footer()
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
?>
|
?>
|
||||||
</td></tr></table>
|
</td>
|
||||||
</div>
|
</tr>
|
||||||
<div id="footer">
|
</table>
|
||||||
<?
|
</div>
|
||||||
|
<div id="footer">
|
||||||
|
<?
|
||||||
// we only show the debug session variables if we have an ODD numbered version.
|
// we only show the debug session variables if we have an ODD numbered version.
|
||||||
if (substr($config['version'], -1) % 2 != 0) {
|
if (substr($config['version'], -1) % 2 != 0) {
|
||||||
$pos = strpos(getcwd(), '/');
|
$pos = strpos(getcwd(), '/');
|
||||||
@ -627,19 +642,20 @@ function send_footer()
|
|||||||
|
|
||||||
// echo "<a target=\"blank\" href=\"http://www.sfiab.ca\">Science-ation Version ".$config['version']."{$extra}</a>";
|
// echo "<a target=\"blank\" href=\"http://www.sfiab.ca\">Science-ation Version ".$config['version']."{$extra}</a>";
|
||||||
echo '<a target="blank" href="https://science-ation.ca">Science-ation Version 3</a>';
|
echo '<a target="blank" href="https://science-ation.ca">Science-ation Version 3</a>';
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<div id="debug" style="display:<?= (get_value_from_array($_SESSION, 'debug') == 'true') ? 'block' : 'none' ?>; font-family:monospace; white-space:pre;">Debug...</div>
|
<div id="debug" style="display:<?= (get_value_from_array($_SESSION, 'debug') == 'true') ? 'block' : 'none' ?>; font-family:monospace; white-space:pre;">Debug...</div>
|
||||||
<iframe id="content" src="" style="visibility:hidden; width:0px; height:0px"></iframe>
|
<iframe id="content" src="" style="visibility:hidden; width:0px; height:0px"></iframe>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
|
||||||
|
</html>
|
||||||
|
|
||||||
<?
|
<?
|
||||||
}
|
}
|
||||||
|
|
||||||
function send_popup_header($title = '')
|
function send_popup_header($title = '')
|
||||||
{
|
{
|
||||||
global $HEADER_SENT;
|
global $HEADER_SENT;
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -651,40 +667,42 @@ function send_popup_header($title = '')
|
|||||||
|
|
||||||
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n";
|
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n";
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
<head>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta charset="utf-8" />
|
||||||
<title><?= i18n($title) ?></title>
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<link rel="stylesheet" href="https://code.jquery.com/ui/1.14.1/themes/base/jquery-ui.css">
|
<title><?= i18n($title) ?></title>
|
||||||
<!--<link rel="stylesheet" href="<?= $config['SFIABDIRECTORY'] ?>/theme/<?= $config['theme'] ?>/jquery-ui-1.7.2.custom.css" type="text/css" media="all" />-->
|
<link rel="stylesheet" href="https://code.jquery.com/ui/1.14.1/themes/base/jquery-ui.css">
|
||||||
<link rel="stylesheet" href="<?= $config['SFIABDIRECTORY'] ?>/theme/<?= $config['theme'] ?>/sfiab.css" type="text/css" media="all" />
|
<!--<link rel="stylesheet" href="<?= $config['SFIABDIRECTORY'] ?>/theme/<?= $config['theme'] ?>/jquery-ui-1.7.2.custom.css" type="text/css" media="all" />-->
|
||||||
<link media=all href="<?= $config['SFIABDIRECTORY'] ?>/tableeditor.css" type=text/css rel=stylesheet>
|
<link rel="stylesheet" href="<?= $config['SFIABDIRECTORY'] ?>/theme/<?= $config['theme'] ?>/sfiab.css" type="text/css" media="all" />
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
<link media=all href="<?= $config['SFIABDIRECTORY'] ?>/tableeditor.css" type=text/css rel=stylesheet>
|
||||||
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||||
rel="stylesheet">
|
rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
<body onLoad="window.focus()">
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
|
||||||
<script src="https://code.jquery.com/jquery-migrate-3.5.2.js"></script>
|
|
||||||
<script src="https://code.jquery.com/ui/1.14.1/jquery-ui.min.js"></script>
|
|
||||||
<script type="text/javascript" src="<?= $config['SFIABDIRECTORY'] ?>/js/sfiab.js"></script>
|
|
||||||
|
|
||||||
<script type="text/javascript" src="<?= $config['SFIABDIRECTORY'] ?>/theme/<?= $config['theme'] ?>/theme-script.js"></script>
|
<body onLoad="window.focus()">
|
||||||
<div id="notice_area" class="notice_area"></div>
|
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
||||||
|
<script src="https://code.jquery.com/jquery-migrate-3.5.2.js"></script>
|
||||||
|
<script src="https://code.jquery.com/ui/1.14.1/jquery-ui.min.js"></script>
|
||||||
|
<script type="text/javascript" src="<?= $config['SFIABDIRECTORY'] ?>/js/sfiab.js"></script>
|
||||||
|
|
||||||
<?
|
<script type="text/javascript" src="<?= $config['SFIABDIRECTORY'] ?>/theme/<?= $config['theme'] ?>/theme-script.js"></script>
|
||||||
|
<div id="notice_area" class="notice_area"></div>
|
||||||
|
|
||||||
|
<?
|
||||||
if ($title)
|
if ($title)
|
||||||
echo '<h2>' . i18n($title) . '</h2>';
|
echo '<h2>' . i18n($title) . '</h2>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function send_popup_footer()
|
function send_popup_footer()
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<div id="footer">
|
<div id="footer">
|
||||||
<?
|
<?
|
||||||
global $config;
|
global $config;
|
||||||
$lastdigit = $config['version'][strlen($config['version']) - 1];
|
$lastdigit = $config['version'][strlen($config['version']) - 1];
|
||||||
if ($lastdigit % 2 != 0) {
|
if ($lastdigit % 2 != 0) {
|
||||||
@ -692,18 +710,19 @@ function send_popup_footer()
|
|||||||
print_r($_SESSION);
|
print_r($_SESSION);
|
||||||
}
|
}
|
||||||
echo 'Science-ation Version ' . $config['version'];
|
echo 'Science-ation Version ' . $config['version'];
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<div id="debug" style="display:<?= ($_SESSION['debug'] == 'true') ? 'block' : 'none' ?>">Debug...</div>
|
<div id="debug" style="display:<?= ($_SESSION['debug'] == 'true') ? 'block' : 'none' ?>">Debug...</div>
|
||||||
<iframe id="content" src="" style="visibility:hidden; width:0px; height:0px"></iframe>
|
<iframe id="content" src="" style="visibility:hidden; width:0px; height:0px"></iframe>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
|
||||||
|
</html>
|
||||||
<?
|
<?
|
||||||
}
|
}
|
||||||
|
|
||||||
function emit_month_selector($name, $selected = '')
|
function emit_month_selector($name, $selected = '')
|
||||||
{
|
{
|
||||||
echo "<select name=\"$name\">\n";
|
echo "<select name=\"$name\">\n";
|
||||||
$months = array('', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
|
$months = array('', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
|
||||||
echo '<option value="">' . i18n('Month') . "</option>\n";
|
echo '<option value="">' . i18n('Month') . "</option>\n";
|
||||||
@ -716,10 +735,10 @@ function emit_month_selector($name, $selected = '')
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo "</select>\n";
|
echo "</select>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
function emit_day_selector($name, $selected = '')
|
function emit_day_selector($name, $selected = '')
|
||||||
{
|
{
|
||||||
echo "<select name=\"$name\">\n";
|
echo "<select name=\"$name\">\n";
|
||||||
echo '<option value="">' . i18n('Day') . "</option>\n";
|
echo '<option value="">' . i18n('Day') . "</option>\n";
|
||||||
|
|
||||||
@ -727,10 +746,10 @@ function emit_day_selector($name, $selected = '')
|
|||||||
echo '<option value="' . ($x < 10 ? '0' : '') . "$x\" " . ($selected == $x ? 'selected="selected"' : '') . ">$x</option>\n";
|
echo '<option value="' . ($x < 10 ? '0' : '') . "$x\" " . ($selected == $x ? 'selected="selected"' : '') . ">$x</option>\n";
|
||||||
|
|
||||||
echo "</select>\n";
|
echo "</select>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
function emit_year_selector($name, $selected = '', $min = 0, $max = 0)
|
function emit_year_selector($name, $selected = '', $min = 0, $max = 0)
|
||||||
{
|
{
|
||||||
$curyear = date('Y');
|
$curyear = date('Y');
|
||||||
echo "<select name=\"$name\">\n";
|
echo "<select name=\"$name\">\n";
|
||||||
echo '<option value="">' . i18n('Year') . "</option>\n";
|
echo '<option value="">' . i18n('Year') . "</option>\n";
|
||||||
@ -744,10 +763,10 @@ function emit_year_selector($name, $selected = '', $min = 0, $max = 0)
|
|||||||
echo "<option value=\"$x\" " . ($selected == $x ? 'selected="selected"' : '') . ">$x</option>\n";
|
echo "<option value=\"$x\" " . ($selected == $x ? 'selected="selected"' : '') . ">$x</option>\n";
|
||||||
}
|
}
|
||||||
echo "</select>\n";
|
echo "</select>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
function emit_date_selector($name, $selected = '')
|
function emit_date_selector($name, $selected = '')
|
||||||
{
|
{
|
||||||
if ($selected) {
|
if ($selected) {
|
||||||
list($year, $month, $day) = explode('-', $selected);
|
list($year, $month, $day) = explode('-', $selected);
|
||||||
}
|
}
|
||||||
@ -760,10 +779,10 @@ function emit_date_selector($name, $selected = '')
|
|||||||
emit_day_selector($name . '_day', $day);
|
emit_day_selector($name . '_day', $day);
|
||||||
echo '</td></tr>';
|
echo '</td></tr>';
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function emit_hour_selector($name, $selected = '')
|
function emit_hour_selector($name, $selected = '')
|
||||||
{
|
{
|
||||||
if ($selected != '')
|
if ($selected != '')
|
||||||
$selected = (int) $selected;
|
$selected = (int) $selected;
|
||||||
echo "<select name=\"$name\">\n";
|
echo "<select name=\"$name\">\n";
|
||||||
@ -778,10 +797,10 @@ function emit_hour_selector($name, $selected = '')
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo "</select>\n";
|
echo "</select>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
function emit_minute_selector($name, $selected = '')
|
function emit_minute_selector($name, $selected = '')
|
||||||
{
|
{
|
||||||
$mins = array('00', '05', '10', '15', '20', '25', '30', '35', '40', '45', '50', '55');
|
$mins = array('00', '05', '10', '15', '20', '25', '30', '35', '40', '45', '50', '55');
|
||||||
echo "<select name=\"$name\">\n";
|
echo "<select name=\"$name\">\n";
|
||||||
echo "<option value=\"\">MM</option>\n";
|
echo "<option value=\"\">MM</option>\n";
|
||||||
@ -790,10 +809,10 @@ function emit_minute_selector($name, $selected = '')
|
|||||||
echo '<option value="' . $mins[$x] . '" ' . ($selected == $mins[$x] ? 'selected' : '') . ">$mins[$x]</option>\n";
|
echo '<option value="' . $mins[$x] . '" ' . ($selected == $mins[$x] ? 'selected' : '') . ">$mins[$x]</option>\n";
|
||||||
|
|
||||||
echo "</select>\n";
|
echo "</select>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
function emit_time_selector($name, $selected = '')
|
function emit_time_selector($name, $selected = '')
|
||||||
{
|
{
|
||||||
global $hour;
|
global $hour;
|
||||||
global $minute;
|
global $minute;
|
||||||
if ($selected) {
|
if ($selected) {
|
||||||
@ -806,10 +825,10 @@ function emit_time_selector($name, $selected = '')
|
|||||||
emit_minute_selector($name . '_minute', $minute);
|
emit_minute_selector($name . '_minute', $minute);
|
||||||
echo '</td></tr>';
|
echo '</td></tr>';
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function emit_province_selector($name, $selected = '', $extra = '')
|
function emit_province_selector($name, $selected = '', $extra = '')
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
global $pdo;
|
global $pdo;
|
||||||
@ -837,10 +856,10 @@ function emit_province_selector($name, $selected = '', $extra = '')
|
|||||||
|
|
||||||
echo "</select>\n";
|
echo "</select>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function outputStatus($status)
|
function outputStatus($status)
|
||||||
{
|
{
|
||||||
$ret = '';
|
$ret = '';
|
||||||
switch ($status) {
|
switch ($status) {
|
||||||
case 'incomplete':
|
case 'incomplete':
|
||||||
@ -864,19 +883,19 @@ function outputStatus($status)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns true if its a valid email address, false if its not
|
// returns true if its a valid email address, false if its not
|
||||||
function isEmailAddress($str)
|
function isEmailAddress($str)
|
||||||
{
|
{
|
||||||
if (preg_match('/^[+a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.([a-zA-Z]{2,4})$/i', $str))
|
if (preg_match('/^[+a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.([a-zA-Z]{2,4})$/i', $str))
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function communication_get_user_replacements(&$u)
|
function communication_get_user_replacements(&$u)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
$rep = array(
|
$rep = array(
|
||||||
'FAIRNAME' => $config['fairname'],
|
'FAIRNAME' => $config['fairname'],
|
||||||
@ -889,10 +908,10 @@ function communication_get_user_replacements(&$u)
|
|||||||
'ORGANIZATION' => $u['sponsor']['organization'],
|
'ORGANIZATION' => $u['sponsor']['organization'],
|
||||||
);
|
);
|
||||||
return $rep;
|
return $rep;
|
||||||
}
|
}
|
||||||
|
|
||||||
function communication_replace_vars($text, &$u, $otherrep = array())
|
function communication_replace_vars($text, &$u, $otherrep = array())
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
if ($u) {
|
if ($u) {
|
||||||
$userrep = communication_get_user_replacements($u);
|
$userrep = communication_get_user_replacements($u);
|
||||||
@ -901,14 +920,14 @@ function communication_replace_vars($text, &$u, $otherrep = array())
|
|||||||
}
|
}
|
||||||
|
|
||||||
$rep = array_merge($userrep, $otherrep);
|
$rep = array_merge($userrep, $otherrep);
|
||||||
foreach ($rep AS $k => $v) {
|
foreach ($rep as $k => $v) {
|
||||||
$text = preg_replace("\[$k\]", $v, $text);
|
$text = preg_replace("\[$k\]", $v, $text);
|
||||||
}
|
}
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
function email_send($val, $to, $sub_subject = array(), $sub_body = array())
|
function email_send($val, $to, $sub_subject = array(), $sub_body = array())
|
||||||
{
|
{
|
||||||
global $config, $pdo;
|
global $config, $pdo;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -941,18 +960,18 @@ function email_send($val, $to, $sub_subject = array(), $sub_body = array())
|
|||||||
|
|
||||||
/* Eventually we should just do this with communication_replace_vars() */
|
/* Eventually we should just do this with communication_replace_vars() */
|
||||||
if (count($sub_subject)) {
|
if (count($sub_subject)) {
|
||||||
foreach ($sub_subject AS $sub_k => $sub_v) {
|
foreach ($sub_subject as $sub_k => $sub_v) {
|
||||||
$subject = preg_replace("\[$sub_k\]", "$sub_v", $subject);
|
$subject = preg_replace("\[$sub_k\]", "$sub_v", $subject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count($sub_body)) {
|
if (count($sub_body)) {
|
||||||
foreach ($sub_body AS $sub_k => $sub_v) {
|
foreach ($sub_body as $sub_k => $sub_v) {
|
||||||
$body = preg_replace("\[$sub_k\]", "$sub_v", $body);
|
$body = preg_replace("\[$sub_k\]", "$sub_v", $body);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($sub_body)) {
|
if (count($sub_body)) {
|
||||||
foreach ($sub_body AS $sub_k => $sub_v) {
|
foreach ($sub_body as $sub_k => $sub_v) {
|
||||||
$bodyhtml = preg_replace("\[$sub_k\]", "$sub_v", $bodyhtml);
|
$bodyhtml = preg_replace("\[$sub_k\]", "$sub_v", $bodyhtml);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -974,9 +993,9 @@ function email_send($val, $to, $sub_subject = array(), $sub_body = array())
|
|||||||
} else {
|
} else {
|
||||||
echo error(i18n("CRITICAL ERROR: email '%1' not found", array($val), array('email key name')));
|
echo error(i18n("CRITICAL ERROR: email '%1' not found", array($val), array('email key name')));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*require_once("Rmail/Rmail.php");
|
/*require_once("Rmail/Rmail.php");
|
||||||
require_once("Rmail/RFC822.php");
|
require_once("Rmail/RFC822.php");
|
||||||
|
|
||||||
// this sends out an all-ready-to-go email, it does no substitution or changes or database lookups or anything
|
// this sends out an all-ready-to-go email, it does no substitution or changes or database lookups or anything
|
||||||
@ -1008,14 +1027,14 @@ function email_send_new($to, $from, $subject, $body, $bodyhtml = '')
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* returns an array of arrays
|
* returns an array of arrays
|
||||||
* [ 0 ] = array ( to, firstname, lastname, email )
|
* [ 0 ] = array ( to, firstname, lastname, email )
|
||||||
* [ 1 ] = array ( to, firstname, lastname, email )
|
* [ 1 ] = array ( to, firstname, lastname, email )
|
||||||
* ...etc
|
* ...etc
|
||||||
*/
|
*/
|
||||||
function getEmailRecipientsForRegistration($reg_id)
|
function getEmailRecipientsForRegistration($reg_id)
|
||||||
{
|
{
|
||||||
global $config, $pdo;
|
global $config, $pdo;
|
||||||
// okay first grab the registration record, to see if we should email the kids, the teacher, and/or the parents
|
// okay first grab the registration record, to see if we should email the kids, the teacher, and/or the parents
|
||||||
$q = $pdo->prepare("SELECT * FROM registrations WHERE id='$reg_id' AND year='{$config['FAIRYEAR']}'");
|
$q = $pdo->prepare("SELECT * FROM registrations WHERE id='$reg_id' AND year='{$config['FAIRYEAR']}'");
|
||||||
@ -1047,10 +1066,10 @@ function getEmailRecipientsForRegistration($reg_id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
function output_page_text($textname)
|
function output_page_text($textname)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
global $pdo;
|
global $pdo;
|
||||||
|
|
||||||
@ -1070,10 +1089,10 @@ function output_page_text($textname)
|
|||||||
echo nl2br($r->text);
|
echo nl2br($r->text);
|
||||||
else
|
else
|
||||||
echo get_value_property_or_default($r, 'text');
|
echo get_value_property_or_default($r, 'text');
|
||||||
}
|
}
|
||||||
|
|
||||||
function output_page_cms($filename)
|
function output_page_cms($filename)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
global $pdo;
|
global $pdo;
|
||||||
|
|
||||||
@ -1099,10 +1118,10 @@ function output_page_cms($filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
send_footer();
|
send_footer();
|
||||||
}
|
}
|
||||||
|
|
||||||
function generatePassword($pwlen = 8)
|
function generatePassword($pwlen = 8)
|
||||||
{
|
{
|
||||||
// these are good characters that are not easily confused with other characters :)
|
// these are good characters that are not easily confused with other characters :)
|
||||||
$available = 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz23456789';
|
$available = 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz23456789';
|
||||||
$len = strlen($available) - 1;
|
$len = strlen($available) - 1;
|
||||||
@ -1111,17 +1130,17 @@ function generatePassword($pwlen = 8)
|
|||||||
for ($x = 0; $x < $pwlen; $x++)
|
for ($x = 0; $x < $pwlen; $x++)
|
||||||
$key .= $available[rand(0, $len)];
|
$key .= $available[rand(0, $len)];
|
||||||
return $key;
|
return $key;
|
||||||
}
|
}
|
||||||
|
|
||||||
// config specific warning
|
// config specific warning
|
||||||
function config_warnings() {}
|
function config_warnings() {}
|
||||||
|
|
||||||
// admin specific warnings
|
// admin specific warnings
|
||||||
function admin_warnings() {}
|
function admin_warnings() {}
|
||||||
|
|
||||||
// warnings to show to both config and/or admin people
|
// warnings to show to both config and/or admin people
|
||||||
function committee_warnings()
|
function committee_warnings()
|
||||||
{
|
{
|
||||||
global $config, $pdo;
|
global $config, $pdo;
|
||||||
// it is vital that each year the system be rolled over before we start it again
|
// it is vital that each year the system be rolled over before we start it again
|
||||||
// we should do this, say, 4 months after the FAIRDATE, so its soon enough that they should see
|
// we should do this, say, 4 months after the FAIRDATE, so its soon enough that they should see
|
||||||
@ -1167,9 +1186,9 @@ function committee_warnings()
|
|||||||
// let everyone know about the need to re-download awards before being able to upload
|
// let everyone know about the need to re-download awards before being able to upload
|
||||||
echo notice(i18n("March 30, 2010 - There was a minor issue with uploading award results that has now been corrected, however, you will need to re-download your awards from all external sources, before you will be able to upload the award winners back to those external sources. Re-downloading the awards will not affect the awards in any visible way, it will just allow the winners to be uploaded properly. Click on Fair Administration -> Awards Management -> Download awards from external sources -> and click 'check' for each award source"));
|
echo notice(i18n("March 30, 2010 - There was a minor issue with uploading award results that has now been corrected, however, you will need to re-download your awards from all external sources, before you will be able to upload the award winners back to those external sources. Re-downloading the awards will not affect the awards in any visible way, it will just allow the winners to be uploaded properly. Click on Fair Administration -> Awards Management -> Download awards from external sources -> and click 'check' for each award source"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$CWSFDivisions = array(
|
$CWSFDivisions = array(
|
||||||
1 => 'Discovery',
|
1 => 'Discovery',
|
||||||
2 => 'Energy',
|
2 => 'Energy',
|
||||||
3 => 'Environment',
|
3 => 'Environment',
|
||||||
@ -1177,10 +1196,10 @@ $CWSFDivisions = array(
|
|||||||
5 => 'Information',
|
5 => 'Information',
|
||||||
6 => 'Innovation',
|
6 => 'Innovation',
|
||||||
7 => 'Resources'
|
7 => 'Resources'
|
||||||
);
|
);
|
||||||
|
|
||||||
function theme_icon($icon, $width = 0)
|
function theme_icon($icon, $width = 0)
|
||||||
{
|
{
|
||||||
global $theme_icons, $config;
|
global $theme_icons, $config;
|
||||||
|
|
||||||
$w = ($width == 0) ? '' : "width=\"$width\"";
|
$w = ($width == 0) ? '' : "width=\"$width\"";
|
||||||
@ -1188,41 +1207,41 @@ function theme_icon($icon, $width = 0)
|
|||||||
return "<img src=\"{$config['SFIABDIRECTORY']}/theme/{$config['theme_icons']}/{$theme_icons['icons'][$icon]}\" border=\"0\" $w alt=\"" . htmlspecialchars($icon) . '">';
|
return "<img src=\"{$config['SFIABDIRECTORY']}/theme/{$config['theme_icons']}/{$theme_icons['icons'][$icon]}\" border=\"0\" $w alt=\"" . htmlspecialchars($icon) . '">';
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// $d can be a unix timestamp integer, OR a text string, eg 2008-01-22
|
// $d can be a unix timestamp integer, OR a text string, eg 2008-01-22
|
||||||
function format_date($d)
|
function format_date($d)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
if (is_numeric($d))
|
if (is_numeric($d))
|
||||||
return date($config['dateformat'], $d);
|
return date($config['dateformat'], $d);
|
||||||
else
|
else
|
||||||
return date($config['dateformat'], strtotime($d));
|
return date($config['dateformat'], strtotime($d));
|
||||||
}
|
}
|
||||||
|
|
||||||
// $t can be a unix timestamp integer, or a text string, eg 10:23:48
|
// $t can be a unix timestamp integer, or a text string, eg 10:23:48
|
||||||
function format_time($t)
|
function format_time($t)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
if (is_numeric($t))
|
if (is_numeric($t))
|
||||||
return date($config['timeformat'], $t);
|
return date($config['timeformat'], $t);
|
||||||
else
|
else
|
||||||
return date($config['timeformat'], strtotime($t));
|
return date($config['timeformat'], strtotime($t));
|
||||||
}
|
}
|
||||||
|
|
||||||
// $dt can be a unix timestamp integer, or a text string, eg 2008-01-22 10:23:48
|
// $dt can be a unix timestamp integer, or a text string, eg 2008-01-22 10:23:48
|
||||||
function format_datetime($dt)
|
function format_datetime($dt)
|
||||||
{
|
{
|
||||||
if (is_numeric($dt)) {
|
if (is_numeric($dt)) {
|
||||||
return format_date($dt) . ' ' . i18n('at') . ' ' . format_time($dt);
|
return format_date($dt) . ' ' . i18n('at') . ' ' . format_time($dt);
|
||||||
} else {
|
} else {
|
||||||
list($d, $t) = explode(' ', $dt);
|
list($d, $t) = explode(' ', $dt);
|
||||||
return format_date($d) . ' ' . i18n('at') . ' ' . format_time($t);
|
return format_date($d) . ' ' . i18n('at') . ' ' . format_time($t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function format_money($n, $decimals = true)
|
function format_money($n, $decimals = true)
|
||||||
{
|
{
|
||||||
global $neg;
|
global $neg;
|
||||||
if ($n < 0) {
|
if ($n < 0) {
|
||||||
$neg = true;
|
$neg = true;
|
||||||
@ -1262,36 +1281,36 @@ function format_money($n, $decimals = true)
|
|||||||
else
|
else
|
||||||
return sprintf('%s$%s', $negdisp, $out);
|
return sprintf('%s$%s', $negdisp, $out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function message_push($m)
|
function message_push($m)
|
||||||
{
|
{
|
||||||
if (!is_array($_SESSION['messages']))
|
if (!is_array($_SESSION['messages']))
|
||||||
$_SESSION['messages'] = array();
|
$_SESSION['messages'] = array();
|
||||||
$_SESSION['messages'][] = $m;
|
$_SESSION['messages'][] = $m;
|
||||||
}
|
}
|
||||||
|
|
||||||
function notice_($str, $i18n_array = array(), $timeout = -1, $type = 'notice')
|
function notice_($str, $i18n_array = array(), $timeout = -1, $type = 'notice')
|
||||||
{
|
{
|
||||||
if ($timeout == -1)
|
if ($timeout == -1)
|
||||||
$timeout = 5000;
|
$timeout = 5000;
|
||||||
echo "<script type=\"text/javascript\">
|
echo "<script type=\"text/javascript\">
|
||||||
notice_create('$type',\"" . i18n($str, $i18n_array) . "\",$timeout);
|
notice_create('$type',\"" . i18n($str, $i18n_array) . "\",$timeout);
|
||||||
</script>";
|
</script>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function happy_($str, $i18n_array = array(), $timeout = -1)
|
function happy_($str, $i18n_array = array(), $timeout = -1)
|
||||||
{
|
{
|
||||||
notice_($str, $i18n_array, $timeout, 'happy');
|
notice_($str, $i18n_array, $timeout, 'happy');
|
||||||
}
|
}
|
||||||
|
|
||||||
function error_($str, $i18n_array = array(), $timeout = -1)
|
function error_($str, $i18n_array = array(), $timeout = -1)
|
||||||
{
|
{
|
||||||
notice_($str, $i18n_array, $timeout, 'error');
|
notice_($str, $i18n_array, $timeout, 'error');
|
||||||
}
|
}
|
||||||
|
|
||||||
function debug_($str)
|
function debug_($str)
|
||||||
{
|
{
|
||||||
if (get_value_from_array($_SESSION, 'debug') != true)
|
if (get_value_from_array($_SESSION, 'debug') != true)
|
||||||
return;
|
return;
|
||||||
$s = str_replace("\n", '', nl2br(htmlspecialchars($str))) . '<br />';
|
$s = str_replace("\n", '', nl2br(htmlspecialchars($str))) . '<br />';
|
||||||
@ -1300,11 +1319,11 @@ function debug_($str)
|
|||||||
\$(\"#debug\").append(\"$s\");
|
\$(\"#debug\").append(\"$s\");
|
||||||
});
|
});
|
||||||
</script>";
|
</script>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// this function returns a HTML colour code ranging between red and green, with yellow in the middle based on the percent passed into it
|
// this function returns a HTML colour code ranging between red and green, with yellow in the middle based on the percent passed into it
|
||||||
function colour_to_percent($percent)
|
function colour_to_percent($percent)
|
||||||
{
|
{
|
||||||
// 0 is red
|
// 0 is red
|
||||||
// 50 is yellow
|
// 50 is yellow
|
||||||
// 100 is green
|
// 100 is green
|
||||||
@ -1312,23 +1331,21 @@ function colour_to_percent($percent)
|
|||||||
if ($percent <= 50)
|
if ($percent <= 50)
|
||||||
$red = 255;
|
$red = 255;
|
||||||
else
|
else
|
||||||
$red = (100 - $percent) * 2 / 100 * 255;
|
$red = (100 - $percent) * 2 / 100 * 255;;
|
||||||
;
|
|
||||||
|
|
||||||
if ($percent > 50)
|
if ($percent > 50)
|
||||||
$green = 255;
|
$green = 255;
|
||||||
else
|
else
|
||||||
$green = ($percent) * 2 / 100 * 255;
|
$green = ($percent) * 2 / 100 * 255;;
|
||||||
;
|
|
||||||
|
|
||||||
// echo "red=$red";
|
// echo "red=$red";
|
||||||
// echo "green=$green";
|
// echo "green=$green";
|
||||||
$str = '#' . sprintf('%02s', dechex($red)) . sprintf('%02s', dechex($green)) . '00';
|
$str = '#' . sprintf('%02s', dechex($red)) . sprintf('%02s', dechex($green)) . '00';
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
function format_duration($seconds, $granularity = 2)
|
function format_duration($seconds, $granularity = 2)
|
||||||
{
|
{
|
||||||
$units = array(
|
$units = array(
|
||||||
'1 year|:count years' => 31536000,
|
'1 year|:count years' => 31536000,
|
||||||
'1 week|:count weeks' => 604800,
|
'1 week|:count weeks' => 604800,
|
||||||
@ -1353,10 +1370,10 @@ function format_duration($seconds, $granularity = 2)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $output ? $output : '0 sec';
|
return $output ? $output : '0 sec';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTextFromHtml($html)
|
function getTextFromHtml($html)
|
||||||
{
|
{
|
||||||
// first, replace an </p> with </p><br />
|
// first, replace an </p> with </p><br />
|
||||||
$text = str_replace('</p>', '</p><br />', $html);
|
$text = str_replace('</p>', '</p><br />', $html);
|
||||||
// next, replace a </div> with </div><br />
|
// next, replace a </div> with </div><br />
|
||||||
@ -1379,10 +1396,10 @@ function getTextFromHtml($html)
|
|||||||
$text = wordwrap($text, 75, "\n", true);
|
$text = wordwrap($text, 75, "\n", true);
|
||||||
|
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getUserForSponsor($sponsor_id)
|
function getUserForSponsor($sponsor_id)
|
||||||
{
|
{
|
||||||
global $pdo;
|
global $pdo;
|
||||||
// loop through each contact and draw a form with their data in it.
|
// loop through each contact and draw a form with their data in it.
|
||||||
$q = $pdo->prepare("SELECT *,MAX(year) FROM users LEFT JOIN users_sponsor ON users_sponsor.users_id=users.id
|
$q = $pdo->prepare("SELECT *,MAX(year) FROM users LEFT JOIN users_sponsor ON users_sponsor.users_id=users.id
|
||||||
@ -1397,10 +1414,10 @@ function getUserForSponsor($sponsor_id)
|
|||||||
$q->execute();
|
$q->execute();
|
||||||
$r = $q->fetch();
|
$r = $q->fetch();
|
||||||
return user_load_by_uid($r->uid);
|
return user_load_by_uid($r->uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
function projectdivisions_load($year = false)
|
function projectdivisions_load($year = false)
|
||||||
{
|
{
|
||||||
global $config, $pdo;
|
global $config, $pdo;
|
||||||
if ($year == false)
|
if ($year == false)
|
||||||
$year = $config['FAIRYEAR'];
|
$year = $config['FAIRYEAR'];
|
||||||
@ -1410,10 +1427,10 @@ function projectdivisions_load($year = false)
|
|||||||
while ($d = $q->fetch(PDO::FETCH_ASSOC))
|
while ($d = $q->fetch(PDO::FETCH_ASSOC))
|
||||||
$divs[$d['id']] = $d;
|
$divs[$d['id']] = $d;
|
||||||
return $divs;
|
return $divs;
|
||||||
}
|
}
|
||||||
|
|
||||||
function projectcategories_load($year = false)
|
function projectcategories_load($year = false)
|
||||||
{
|
{
|
||||||
global $config, $pdo;
|
global $config, $pdo;
|
||||||
if ($year == false)
|
if ($year == false)
|
||||||
$year = $config['FAIRYEAR'];
|
$year = $config['FAIRYEAR'];
|
||||||
@ -1423,12 +1440,12 @@ function projectcategories_load($year = false)
|
|||||||
while ($c = $q->fetch(PDO::FETCH_ASSOC))
|
while ($c = $q->fetch(PDO::FETCH_ASSOC))
|
||||||
$cats[$c['id']] = $c;
|
$cats[$c['id']] = $c;
|
||||||
return $cats;
|
return $cats;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Converts the numeric value "$val" to an English text representation of it (e.g. "two thousand four").
|
// Converts the numeric value "$val" to an English text representation of it (e.g. "two thousand four").
|
||||||
// If the "$monetize" flag is set to true, then it's formatted to be useable on printed cheques (e.g. "***** Two Thousand Four 00/100 *****".
|
// If the "$monetize" flag is set to true, then it's formatted to be useable on printed cheques (e.g. "***** Two Thousand Four 00/100 *****".
|
||||||
function wordify($val, $monetize = false)
|
function wordify($val, $monetize = false)
|
||||||
{
|
{
|
||||||
$digits = array('zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine');
|
$digits = array('zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine');
|
||||||
if ($monetize) {
|
if ($monetize) {
|
||||||
$pennies = intval(($val - intval($val)) * 100);
|
$pennies = intval(($val - intval($val)) * 100);
|
||||||
@ -1444,7 +1461,12 @@ function wordify($val, $monetize = false)
|
|||||||
}
|
}
|
||||||
$val = intval($val);
|
$val = intval($val);
|
||||||
$powerofthousand = array(
|
$powerofthousand = array(
|
||||||
'', 'Thousand', 'Million', 'Billion', 'trillion', 'quadrillion'
|
'',
|
||||||
|
'Thousand',
|
||||||
|
'Million',
|
||||||
|
'Billion',
|
||||||
|
'trillion',
|
||||||
|
'quadrillion'
|
||||||
);
|
);
|
||||||
$n = 0;
|
$n = 0;
|
||||||
if (!$val) {
|
if (!$val) {
|
||||||
@ -1467,11 +1489,11 @@ function wordify($val, $monetize = false)
|
|||||||
if ($monetize)
|
if ($monetize)
|
||||||
$returnval = '***' . $returnval;
|
$returnval = '***' . $returnval;
|
||||||
return $returnval;
|
return $returnval;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Converts a number between zero and one thousand to Canadian English text
|
// Converts a number between zero and one thousand to Canadian English text
|
||||||
function smallIntToText($number)
|
function smallIntToText($number)
|
||||||
{
|
{
|
||||||
$number %= 1000;
|
$number %= 1000;
|
||||||
$rvals = array(
|
$rvals = array(
|
||||||
0 => 'Zero',
|
0 => 'Zero',
|
||||||
@ -1527,6 +1549,6 @@ function smallIntToText($number)
|
|||||||
$returnval .= ' ' . $rvals[$number];
|
$returnval .= ' ' . $rvals[$number];
|
||||||
}
|
}
|
||||||
return $returnval;
|
return $returnval;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Before Width: | Height: | Size: 180 B After Width: | Height: | Size: 180 B |
Before Width: | Height: | Size: 180 B After Width: | Height: | Size: 180 B |
Before Width: | Height: | Size: 136 B After Width: | Height: | Size: 136 B |
Before Width: | Height: | Size: 131 B After Width: | Height: | Size: 131 B |
Before Width: | Height: | Size: 177 B After Width: | Height: | Size: 177 B |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 88 B After Width: | Height: | Size: 88 B |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
@ -20,8 +20,8 @@
|
|||||||
Boston, MA 02111-1307, USA.
|
Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$theme['name']="Default";
|
$theme['name']="Classic";
|
||||||
$theme['description']="The default theme";
|
$theme['description']="The classic theme";
|
||||||
$theme['author']="James Grant <james@lightbox.org>";
|
$theme['author']="James Grant <james@lightbox.org>";
|
||||||
|
|
||||||
?>
|
?>
|
@ -20,7 +20,7 @@
|
|||||||
Boston, MA 02111-1307, USA.
|
Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$theme_icons['name']="Default Icons";
|
$theme_icons['name']="Classic Theme Icons";
|
||||||
$theme_icons['description']="KDE4 icons";
|
$theme_icons['description']="KDE4 icons";
|
||||||
$theme_icons['author']="James Grant <james@lightbox.org>";
|
$theme_icons['author']="James Grant <james@lightbox.org>";
|
||||||
|
|
||||||
|