Commit 99d62fd3 authored by Martyn Smith's avatar Martyn Smith Committed by Martyn Smith
Browse files
parents 4a535f17 c9f15f8e
......@@ -4,5 +4,39 @@
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
>
<TABLES>
<TABLE NAME="artefact_internal_profile">
<FIELDS>
<FIELD NAME="user" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="field" TYPE="char" LENGTH="100" NOTNULL="true" />
<FIELD NAME="value" TYPE="text" NOTNULL="true" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="user,field" />
<KEY NAME="userfk" TYPE="foreign" FIELDS="user" REFTABLE="usr" REFFIELDS="id" />
</KEYS>
</TABLE>
<TABLE NAME="artefact_internal_profile_email">
<FIELDS>
<FIELD NAME="user" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="email" TYPE="text" NOTNULL="true" />
<FIELD NAME="verified" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="principal" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="user,email" />
<KEY NAME="userfk" TYPE="foreign" FIELDS="user" REFTABLE="usr" REFFIELDS="id" />
</KEYS>
</TABLE>
<TABLE NAME="artefact_internal_profile_icon">
<FIELDS>
<FIELD NAME="user" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="filename" TYPE="text" NOTNULL="true" />
<FIELD NAME="primary" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="user,filename" />
<KEY NAME="userfk" TYPE="foreign" FIELDS="user" REFTABLE="usr" REFFIELDS="id" />
</KEYS>
</TABLE>
</TABLES>
</XMLDB>
\ No newline at end of file
......@@ -41,7 +41,7 @@ $cfg->dbprefix = '';
// then try specifying it here
//$cfg->wwwroot = 'http://myhost.com/mahara/';
// dirroot - uploaded files are stored here
// dataroot - uploaded files are stored here
// must be writable by the webserver and outside document root.
// Mahara will NOT RUN if this is inside your document root, because
// this is a big security hole.
......
<?php
/**
* This program is part of Mahara
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @package mahara
* @subpackage core or plugintype/pluginname
* @author Your Name <you@example.org>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
*
*/
defined('INTERNAL') || die();
$string['aboutdefaultcontent'] = '<p>Established in 2006, Mahara is the result of a collaborative venture
funded by New Zealand\'s Ministry of Education\'s e-learning
Collaborative Development Fund (eCDF), involving Massey University,
Auckland University of Technology, The Open Polytechnic of New
Zealand and Victoria University of Wellington.</p>
<p>Mahara is a fully featured electronic portfolio, weblog, resume
builder and social networking system, connecting users and creating
online communities. Mahara is designed to provide users with the
tools to create a personal and professional learning and development
environment.</p>
<p>Meaning `think\' or `thought\' in Te Reo Maori, the name reflects the
project collaborator\'s dedication to creating a user-centred life
long learning and development application as well as the belief that
technology solutions cannot be developed outside the considerations
of pedagogy and policy.</p>
<p>Mahara is provided freely as Open Source software (under the GNU
Public License). In brief, this means that you are allowed to copy,
use and modify Mahara provided you agree to:
<ul><li>provide the source code to others; </li>
<li>not modify or remove the original license and copyrights, and</li>
<li>apply this same license to any derivative work.</li></ul></p>
<p>Please feel free to [Contact Us] if you have any questions regarding
Mahara.</p>
<p><a href="http://mahara.org">http://mahara.org</a></p>';
$string['homedefaultcontent'] = '<p>Welcome to Mahara</p>
<p>Mahara is a fully featured electronic portfolio, weblog, resume
builder and social networking system, connecting users and creating
online communities. Mahara provides you with the tools to set up a
personal learning and development environment.</p>
<p>For more information you can read [About] Mahara or alternatively
please feel free to [Contact Us].</p>';
$string['loggedouthomedefaultcontent'] = '<p>Welcome to Mahara</p>
<p>Mahara is a fully featured electronic portfolio, weblog, resume
builder and social networking system, connecting users and creating
online communities. Mahara provides you with the tools to set up a
personal learning and development environment.</p>
<p>For more information you can read [About] Mahara or alternatively
please feel free to [Contact Us].</p>';
$string['privacydefaultcontent'] = '<h3>Introduction</h3>
<p>We are committed to protecting your privacy and providing users with
a safe and functional personal learning and development environment.
This Statement of Privacy applies to the Mahara site and governs
data collection and usage.</p>
<h3>Collection of personal information</h3>
<p>By registering on Mahara you will be required to provide us with a
certain amount of personal information. We will not disclose any of
your personal information to any other person or organisation
without your written consent unless authorised or required by law.</p>
<h3>Cookies</h3>
<p>In order to use Mahara you must have cookies enabled within your
browser. Please note that no personal information is stored within
the cookies used in Mahara.</p>
<p>A cookie is a data file that is placed on your computer by a webpage
server. Cookies are not programs, spyware or viruses and are unable
to perform any operation by themselves.</p>
<h3>How we use your personal information</h3>
<p>We will only use your personal information for the purpose for which
you provided it to us.</p>
<p>As Mahara users you are able to determine what personal information
you make available to others. By default, unless assigned
Administrator, Course Creator or Tutor access rights, a user may
only view your Preferred Name. This includes listings within a
Recent Activity report or Visitor Log.</p>
<p>We may also collect system usage for statistical purposes however
this data will not identify any individual.</p>
<h3>Storage and security of your personal information</h3>
<p>We will take all reasonable steps to ensure that any personal
information we hold is not subject to loss or misuse or unauthorised
access, disclosure or alteration.</p>
<p>In order to help protect your personal information, please do not
disclose your Username or Password to person other than the Site
Administrator.</p>
<h3>Changes to this privacy statement</h3>
<p>We may occasionally make adjustments to our privacy statement to
reflect changes to the system and in response to customer feedback.
As such we suggest you check the Privacy Statement each time you
visit this site.</p>
<h3>Contact</h3>
<p>If you have any questions regarding this Statement or believe we
have not adhered to the above criteria, please [Contact Us] and we
will use all reasonable efforts to remedy the issue.</p>';
$string['termsandconditionsdefaultcontent'] = '<p>Terms and Conditions</p>
<p>By using [eP Site Name] you are agreeing to the Terms and Conditions
given below.</p>
<p>Our obligations The [eP Site Name] Site Administrators will undertake
all reasonable steps to provide all users with a safe , secure and
operational electronic portfolio system. If at any time you feel your
rights as a user have not been upheld or you have any questions
regarding the below, please [Contact Us] immediately.</p>
<p>[eP Site Name] will occasionally be unavailable for short periods of
time as we release new system features. We will endeavour to provide
at least 3 working days notice of any scheduled outage.</p>
<p>You are encouraged to report objectionable material or inappropriate
behaviour to the Site Administrator | [Contact Us] immediately. We
will ensure the matter is investigated in a timely manner.</p>
<p>Site Administrators may access your portfolio and its contents at
anytime, however they will avoid doing so unless specifically required
to support your use of <eP SiteName> or as per these Terms and
Conditions.</p>
<p>Your obligations The <Privacy Statement> should be considered an
extension of these Terms and Conditions and be read by all users.</p>
<p>Your [eP Site Name] account will expire after a given period of time
or after given period of inactivity, as set by the Site Administrator.
You will receive an email reminder shortly before your account is due
to expire and we suggest you save your portfolio to your personal
computer at this time, so that you may reuse it in the future.</p>
<p>All files and content you upload to [eP Site Name] are subject to New
Zealand Copyright legislation. You are responsible for ensuring you
have appropriate permission to reproduce and publish any work that is
not your own. Incidents of plagiarism will be dealt with in
accordance to your educational institution\'s policy.</p>
<p>You must not use your portfolio to store or display offensive
material. If the Site Administrator receives report of any
objectionable material within your portfolio, your account will be
suspended and your access to [eP Site Name] frozen pending an
investigation in accordance to the Student Conduct Policy or
equivalent of your educational institution. Where no Conduct Policy
exists the matter will be referred to an appropriate staff member of
your institution or organisation.</p>
<p>If the Site Administrator receives report of any inappropriate
behaviour on your part, where it relates to [eP Site Name], your
account will be suspended and your access to [eP Site Name] frozen
pending an investigation in accordance to the Student Conduct Policy
or equivalent of your educational institution. Where no Conduct
Policy exists the matter will be referred to an appropriate staff
member of your institution or organisation.</p>
<p>Inappropriate behaviour includes misuse of the objectionable material
reporting system, intentionally attempting to load files with virus
content, placing objectionable or excessive feedback or comments on
any other users portfolio and any other behaviour deemed to be
nuisance or offensive by the Site Administrator.</p>
<p>Any unsolicited contact you receive as a result of personal
information you have publicly released via your portfolio is your
responsibility, however any misconduct in behaviour from users of the
system should be reported to the Site Administrator | [Contact Us]
immediately. We may occasionally make minor adjustments to our Terms
and Condition to reflect changes to the system and in response to user
feedback. As such we suggest you check the Terms and Conditions each
time you visit this site. We will however notify users of any major
changes to the Terms and Conditions via the [eP Site Name] homepage.</p>';
$string['uploadcopyrightdefaultcontent'] = '<p>Do you promise you\'ve got permission to use the file
you\'re about to upload, cross your heart, on pain of death, give up
your soul and your first-born, etc.?</p>';
?>
......@@ -56,7 +56,7 @@ else {
$now = time();
}
log_dbg('---------- cron running ' . $now . ' ----------');
log_debug('---------- cron running ' . $now . ' ----------');
// for each plugin type
foreach (plugin_types() as $plugintype) {
......@@ -75,7 +75,7 @@ foreach (plugin_types() as $plugintype) {
foreach ($jobs as $job) {
$classname = generate_class_name($plugintype, $job['plugin']);
log_dbg("Running $classname::" . $job['callfunction']);
log_debug("Running $classname::" . $job['callfunction']);
safe_require($plugintype, $job['plugin'], 'lib.php', 'require_once');
call_static_method(
......@@ -276,7 +276,7 @@ function cron_day_of_week($date_array) {
// --------------------------------------------------------
function cron_valid_month($job, $run_date) {
log_dbg('cron_valid_month()');
log_debug('cron_valid_month()');
$propagate = 0;
cron_next_field_value($job['month'], $run_date['mon'], 13, $propagate, $steps, false);
......@@ -289,7 +289,7 @@ function cron_valid_month($job, $run_date) {
}
function cron_valid_day($job, $run_date) {
log_dbg('cron_valid_day()');
log_debug('cron_valid_day()');
$propagate = 0;
cron_next_field_value($job['day'], $run_date['mday'], 32, $propagate, $dayofmonth_steps, false);
......@@ -314,7 +314,7 @@ function cron_valid_day($job, $run_date) {
}
function cron_valid_hour($job, $run_date) {
log_dbg('cron_valid_hour()');
log_debug('cron_valid_hour()');
$propagate = 0;
cron_next_field_value($job['hour'], $run_date['hours'], 24, $propagate, $steps);
......@@ -327,7 +327,7 @@ function cron_valid_hour($job, $run_date) {
}
function cron_valid_minute($job, $run_date) {
log_dbg('cron_valid_minute()');
log_debug('cron_valid_minute()');
$propagate = 0;
cron_next_field_value($job['minute'], $run_date['minutes'], 60, $propagate, $steps);
......@@ -340,7 +340,7 @@ function cron_valid_minute($job, $run_date) {
}
function cron_next_month($job, &$run_date) {
log_dbg('cron_next_month()');
log_debug('cron_next_month()');
$propagate = 1;
$run_date['mon'] = cron_next_field_value($job['month'], $run_date['mon'], 13, $propagate, $steps, false);
......@@ -351,7 +351,7 @@ function cron_next_month($job, &$run_date) {
}
function cron_next_day($job, &$run_date) {
log_dbg('cron_next_day()');
log_debug('cron_next_day()');
// work out which has less steps
$propagate = 1;
......@@ -381,7 +381,7 @@ function cron_next_day($job, &$run_date) {
}
function cron_next_hour($job, &$run_date) {
log_dbg('cron_next_hour()');
log_debug('cron_next_hour()');
$propagate = 1;
$run_date['hours'] = cron_next_field_value($job['hour'], $run_date['hours'], 24, $propagate, $steps);
......@@ -392,7 +392,7 @@ function cron_next_hour($job, &$run_date) {
}
function cron_next_minute($job, &$run_date) {
log_dbg('cron_next_minute()');
log_debug('cron_next_minute()');
$propagate = 1;
$run_date['minutes'] = cron_next_field_value($job['minute'], $run_date['minutes'], 60, $propagate, $steps);
......@@ -403,7 +403,7 @@ function cron_next_minute($job, &$run_date) {
}
function cron_first_day($job, &$run_date) {
log_dbg('cron_first_day()');
log_debug('cron_first_day()');
$propagate = 0;
cron_next_field_value($job['day'], 1, 32, $propagate, $month_steps, false);
......@@ -422,22 +422,22 @@ function cron_first_day($job, &$run_date) {
$run_date['mday'] += $month_steps;
}
else {
log_dbg('using week_steps: ' . $week_steps);
log_debug('using week_steps: ' . $week_steps);
$run_date['mday'] += $week_steps;
}
log_dbg(' setting mday to ' . $run_date['mday']);
log_debug(' setting mday to ' . $run_date['mday']);
}
function cron_first_hour($job, &$run_date) {
log_dbg('cron_first_hour()');
log_debug('cron_first_hour()');
$propagate = 0;
$run_date['hours'] = cron_next_field_value($job['hour'], 0, 24, $propagate, $steps);
}
function cron_first_minute($job, &$run_date) {
log_dbg('cron_first_minute()');
log_debug('cron_first_minute()');
$propagate = 0;
$run_date['minutes'] = cron_next_field_value($job['minute'], 0, 60, $propagate, $steps);
......
......@@ -17,7 +17,7 @@
<TABLE NAME="usr">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
<FIELD NAME="username" TYPE="char" LENGTH="100" NOTNULL="true" />
<FIELD NAME="username" TYPE="char" LENGTH="30" NOTNULL="true" />
<FIELD NAME="password" TYPE="char" LENGTH="40" NOTNULL="true" />
<FIELD NAME="salt" TYPE="char" LENGTH="8" />
<FIELD NAME="passwordchange" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
......@@ -26,6 +26,10 @@
<FIELD NAME="lastlogin" TYPE="datetime" NOTNULL="false" />
<FIELD NAME="staff" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="admin" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="firstname" TYPE="text" NOTNULL="true" />
<FIELD NAME="lastname" TYPE="text" NOTNULL="true" />
<FIELD NAME="prefname" TYPE="text" NOTNULL="false" />
<FIELD NAME="email" TYPE="text" NOTNULL="true" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
......@@ -60,6 +64,8 @@
<TABLE NAME="activity_type">
<FIELDS>
<FIELD NAME="name" TYPE="char" LENGTH="50" NOTNULL="true" />
<FIELD NAME="admin" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="delay" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="name" />
......@@ -573,7 +579,7 @@
<FIELD NAME="content" TYPE="text" NOTNULL="true" />
<FIELD NAME="ctime" TYPE="datetime" NOTNOT="true" />
<FIELD NAME="mtime" TYPE="datetime" NOTNULL="true" />
<FIELD NAME="mauthor" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="mauthor" TYPE="int" LENGTH="10" NOTNULL="false" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="name" />
......@@ -637,7 +643,7 @@
</STATEMENT>
<STATEMENT NAME="insert root user" TYPE="insert" TABLE="usr">
<SENTENCES>
<SENTENCE TEXT="(username, password, passwordchange) VALUES ('root', 'mahara', 1)"/>
<SENTENCE TEXT="(username, password, passwordchange, firstname, lastname, email) VALUES ('root', 'mahara', 1, 'Admin', 'User', 'admin@example.com')"/>
</SENTENCES>
</STATEMENT>
<STATEMENT NAME="insert event types" TYPE="insert" TABLE="event_type">
......@@ -650,12 +656,15 @@
</STATEMENT>
<STATEMENT NAME="insert activity types" TYPE="insert" TABLE="activity_type">
<SENTENCES>
<SENTENCE TEXT="(name) VALUES ('maharamessage')" />
<SENTENCE TEXT="(name) VALUES ('usermessage')" />
<SENTENCE TEXT="(name) VALUES ('adminmessage')" />
<SENTENCE TEXT="(name) VALUES ('feedback')" />
<SENTENCE TEXT="(name) VALUES ('watchlist')" />
<SENTENCE TEXT="(name) VALUES ('newview')" />
<SENTENCE TEXT="(name, admin, delay) VALUES ('maharamessage', 0, 0)" />
<SENTENCE TEXT="(name, admin, delay) VALUES ('usermessage', 0, 0)" />
<SENTENCE TEXT="(name, admin, delay) VALUES ('feedback', 0, 0)" />
<SENTENCE TEXT="(name, admin, delay) VALUES ('watchlist', 0, 1)" />
<SENTENCE TEXT="(name, admin, delay) VALUES ('newview', 0, 1)" />
<SENTENCE TEXT="(name, admin, delay) VALUES ('contactus', 1, 1)" />
<SENTENCE TEXT="(name, admin, delay) VALUES ('objectionable', 1, 1)" />
<SENTENCE TEXT="(name, admin, delay) VALUES ('virusrepeat', 1, 1)" />
<SENTENCE TEXT="(name, admin, delay) VALUES ('virusrelease', 1, 1)" />
</SENTENCES>
</STATEMENT>
</STATEMENTS>
......
......@@ -901,7 +901,7 @@ function update_record($table, $dataobject, $where=null) {
// look for the values in $dataobject and complain bitterly if they're not there
// @todo throw hissy fit
foreach ($where as $field) {
if (!isset($dataobject[$field])) {
if (!isset($dataobject->{$field})) {
throw new SQLException('Field in where clause not in the update object');
}
$wherefields[] = $field;
......@@ -953,7 +953,7 @@ function update_record($table, $dataobject, $where=null) {
$whereclause = '';
$count = 0;
$numdd = count($wherefields);
$numddd = count($wherefields);
foreach ($wherefields as $field) {
$count++;
......
......@@ -81,9 +81,6 @@ function form($data) {
// - handle multipage forms?
// - handle a tabbed interface type of form?
//
//
// @todo: note somewhere that name, method, action are NOT html escaped, you have to
// do it yourself when buliding a form
}
/**
......@@ -140,11 +137,6 @@ class Form {
*/
private $tabindex = 1;
/**
* The form data array. Is this used?
*/
private $data = array();
/**
* The renderer used to build the HTML for the form that each element sits
* in. See the form/renderer package to find out the allowed types.
......@@ -204,10 +196,6 @@ class Form {
if (!isset($data['name']) || !preg_match('/^[a-z_][a-z0-9_]*$/', $data['name'])) {
throw new FormException('Forms must have a name, and that name must be valid (validity test: could you give a PHP function the name?)');
}
if ($data['name'] == 'form') {
// @todo<nigel>: This may not be the case any more, should test this
throw new FormException('You cannot call your form "form" due to namespace collisions with the form library');
}
$this->name = $data['name'];
// Assign defaults for the form
......@@ -248,10 +236,16 @@ class Form {
);
// Set some attributes for all elements
// @todo<nigel>: probably set the description and help for the elements too
foreach ($this->elements as $name => &$element) {
if (count($element) == 0) {
throw new FormException('An element in form "' . $this->name . '" has no data');
}
if (!isset($element['type'])) {
$element['type'] = 'markup';
if (!isset($element['value'])) {
throw new FormException('The markup element "'
. $name . '" has no value');
}
}
if (!isset($element['title'])) {
$element['title'] = '';
......@@ -316,7 +310,7 @@ class Form {
}
// Submit the form if things went OK
if (!$this->errors()) {
if (!$this->has_errors()) {
$function = $this->name . '_submit';
if (function_exists($function)) {
// Call the user defined function for processing a submit
......@@ -389,8 +383,8 @@ class Form {
* Given an element, gets the value for it from this form
*
* @param array $element The element to get the value for
* @return mixed The element's value
* @throws FormException If the element could not be found
* @return mixed The element's value. <kbd>null</kbd> if no value
* is available for the element.
*/
public function get_value($element) {
$global = ($this->method == 'get') ? $_GET : $_POST;
......@@ -403,7 +397,7 @@ class Form {
else if (isset($element['defaultvalue'])) {
return $element['defaultvalue'];
}
throw new FormException('Element "' . $element['name'] . '" cannot be found');
return null;
}
/**
......@@ -515,10 +509,20 @@ class Form {
/**
* Returns whether a field has an error marked on it.
*
* This method should be used in the custom validation functions, to see if
* there is an error on an element before checking for any more validation.
*
* Example:
*
* <code>
* if (!$form->get_error('name') && /* condition {@*}) {
* $form->set_error('name', 'error message');
* }
* </code>
*
* @param string $name The name of the element to check
* @return bool Whether the element has an error
* @throws FormException If the element could not be found
* @todo<nigel>: For consistency, should pass an $element here?
*/
public function get_error($name) {
$element = $this->get_element($name);
......@@ -526,12 +530,17 @@ class Form {
}
/**
* Marks a field has having an error
* Marks a field has having an error.
*
* This method should be used to set an error on an element in a custom
* validation function, if one has occured.
*
* Note that for the Mahara project, your error messages must be passed
* through {@link get_string} to internationalise them.
*
* @param string $name The name of the element to set an error on
* @param string $message The error message
* @throws FormException If the element could not be found
* @todo<nigel>: For consistency, should pass an $element here?
*/
public function set_error($name, $message) {
foreach ($this->elements as &$element) {
......@@ -553,22 +562,6 @@ class Form {
throw new FormException('Element "' . $name . '" could not be found');
}
/**
* Checks if there are errors on any of the form elements.
*
* @return bool Whether there are errors with the form
* @todo<nigel>: rename to has_errors()?
*/
private function errors() {
foreach ($this->get_elements() as $element) {
if (isset($element['error'])) {
return true;
}
}
return false;
}
/**
* Makes an ID for an element.
*
......@@ -662,21 +655,41 @@ class Form {
return $result;
}
/**
* Checks if there are errors on any of the form elements.
*
* @return bool Whether there are errors with the form
*/
private function has_errors() {
foreach ($this->get_elements() as $element) {
if (isset($element['error'])) {
return true;
}
}
return false;
}