aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/apiadmin/actions/generate.php68
-rw-r--r--mod/groups/actions/edit.php256
-rw-r--r--mod/groups/views/default/forms/groups/edit.php236
-rw-r--r--mod/profile/actions/edit.php10
-rw-r--r--mod/profile/views/default/profile/edit.php2
-rw-r--r--mod/reportedcontent/actions/add.php2
-rw-r--r--mod/reportedcontent/views/default/reportedcontent/form.php2
7 files changed, 288 insertions, 288 deletions
diff --git a/mod/apiadmin/actions/generate.php b/mod/apiadmin/actions/generate.php
index 32265bab3..cbc43e228 100644
--- a/mod/apiadmin/actions/generate.php
+++ b/mod/apiadmin/actions/generate.php
@@ -1,35 +1,35 @@
-<?php
- global $CONFIG;
-
- admin_gatekeeper();
- action_gatekeeper();
-
- $ref = get_input('ref');
-
- if ($ref)
- {
- $keypair = create_api_user($CONFIG->site_id);
-
- if ($keypair)
- {
-
- $newkey = new ElggObject();
- $newkey->subtype = 'api_key';
- $newkey->access_id = 2;
- $newkey->title = $ref;
- $newkey->public = $keypair->api_key;
-
- if (!$newkey->save())
- register_error(elgg_echo('apiadmin:generationfail'));
- else
- system_message(elgg_echo('apiadmin:generated'));
- }
- else
- register_error(elgg_echo('apiadmin:generationfail'));
- }
- else
- register_error(elgg_echo('apiadmin:noreference'));
-
-
- forward($_SERVER['HTTP_REFERER']);
+<?php
+ global $CONFIG;
+
+ admin_gatekeeper();
+ action_gatekeeper();
+
+ $ref = get_input('ref');
+
+ if ($ref)
+ {
+ $keypair = create_api_user($CONFIG->site_id);
+
+ if ($keypair)
+ {
+
+ $newkey = new ElggObject();
+ $newkey->subtype = 'api_key';
+ $newkey->access_id = ACCESS_PUBLIC;
+ $newkey->title = $ref;
+ $newkey->public = $keypair->api_key;
+
+ if (!$newkey->save())
+ register_error(elgg_echo('apiadmin:generationfail'));
+ else
+ system_message(elgg_echo('apiadmin:generated'));
+ }
+ else
+ register_error(elgg_echo('apiadmin:generationfail'));
+ }
+ else
+ register_error(elgg_echo('apiadmin:noreference'));
+
+
+ forward($_SERVER['HTTP_REFERER']);
?> \ No newline at end of file
diff --git a/mod/groups/actions/edit.php b/mod/groups/actions/edit.php
index af01479dc..e30fc7fee 100644
--- a/mod/groups/actions/edit.php
+++ b/mod/groups/actions/edit.php
@@ -1,129 +1,129 @@
-<?php
- /**
- * Elgg groups plugin edit action.
- *
- * @package ElggGroups
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Curverider Ltd
- * @copyright Curverider Ltd 2008-2009
- * @link http://elgg.com/
- */
-
- // Load configuration
- global $CONFIG;
-
- // Get group fields
- $input = array();
- foreach($CONFIG->group as $shortname => $valuetype) {
- $input[$shortname] = get_input($shortname);
- if ($valuetype == 'tags')
- $input[$shortname] = string_to_tag_array($input[$shortname]);
- }
-
- $user_guid = get_input('user_guid');
- $user = NULL;
- if (!$user_guid) $user = $_SESSION['user'];
- else
- $user = get_entity($user_guid);
-
- $group_guid = get_input('group_guid');
-
- $group = new ElggGroup($group_guid); // load if present, if not create a new group
- if (($group_guid) && (!$group->canEdit()))
- {
- register_error(elgg_echo("groups:cantedit"));
-
- forward($_SERVER['HTTP_REFERER']);
- exit;
- }
-
- // Assume we can edit or this is a new group
- if (sizeof($input) > 0)
- {
- foreach($input as $shortname => $value) {
- $group->$shortname = $value;
- }
- }
-
- // Validate create
- if (!$group->name)
- {
- register_error(elgg_echo("groups:notitle"));
-
- forward($_SERVER['HTTP_REFERER']);
- exit;
- }
-
- // Group membership
- switch (get_input('membership'))
- {
- case 0: $group->membership = 0;
- case 1 :$group->membership = 1; break;
- case 2:
- default: $group->membership = 2;
- }
-
- // Get access
- $group->access_id = get_input('access_id', 0);
-
- // Set group tool options
- $group->files_enable = get_input('files_enable', 'yes');
- $group->pages_enable = get_input('pages_enable', 'yes');
- $group->forum_enable = get_input('forum_enable', 'yes');
-
- $group->save();
-
- if (!$group->isMember($user))
- $group->join($user); // Creator always a member
-
-
- // Now see if we have a file icon
- if ((isset($_FILES['icon'])) && (substr_count($_FILES['icon']['type'],'image/')))
- {
- $prefix = "groups/".$group->guid;
-
- $filehandler = new ElggFile();
- $filehandler->owner_guid = $group->owner_guid;
- $filehandler->setFilename($prefix . ".jpg");
- $filehandler->open("write");
- $filehandler->write(get_uploaded_file('icon'));
- $filehandler->close();
-
- $thumbtiny = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(),25,25, true);
- $thumbsmall = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(),40,40, true);
- $thumbmedium = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(),100,100, true);
- $thumblarge = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(),200,200, false);
- if ($thumbtiny) {
-
- $thumb = new ElggFile();
- $thumb->setMimeType('image/jpeg');
-
- $thumb->setFilename($prefix."tiny.jpg");
- $thumb->open("write");
- $thumb->write($thumbtiny);
- $thumb->close();
-
- $thumb->setFilename($prefix."small.jpg");
- $thumb->open("write");
- $thumb->write($thumbsmall);
- $thumb->close();
-
- $thumb->setFilename($prefix."medium.jpg");
- $thumb->open("write");
- $thumb->write($thumbmedium);
- $thumb->close();
-
- $thumb->setFilename($prefix."large.jpg");
- $thumb->open("write");
- $thumb->write($thumblarge);
- $thumb->close();
-
- }
- }
-
- system_message(elgg_echo("groups:saved"));
-
- // Forward to the user's profile
- forward($group->getUrl());
- exit;
+<?php
+ /**
+ * Elgg groups plugin edit action.
+ *
+ * @package ElggGroups
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008-2009
+ * @link http://elgg.com/
+ */
+
+ // Load configuration
+ global $CONFIG;
+
+ // Get group fields
+ $input = array();
+ foreach($CONFIG->group as $shortname => $valuetype) {
+ $input[$shortname] = get_input($shortname);
+ if ($valuetype == 'tags')
+ $input[$shortname] = string_to_tag_array($input[$shortname]);
+ }
+
+ $user_guid = get_input('user_guid');
+ $user = NULL;
+ if (!$user_guid) $user = $_SESSION['user'];
+ else
+ $user = get_entity($user_guid);
+
+ $group_guid = get_input('group_guid');
+
+ $group = new ElggGroup($group_guid); // load if present, if not create a new group
+ if (($group_guid) && (!$group->canEdit()))
+ {
+ register_error(elgg_echo("groups:cantedit"));
+
+ forward($_SERVER['HTTP_REFERER']);
+ exit;
+ }
+
+ // Assume we can edit or this is a new group
+ if (sizeof($input) > 0)
+ {
+ foreach($input as $shortname => $value) {
+ $group->$shortname = $value;
+ }
+ }
+
+ // Validate create
+ if (!$group->name)
+ {
+ register_error(elgg_echo("groups:notitle"));
+
+ forward($_SERVER['HTTP_REFERER']);
+ exit;
+ }
+
+ // Group membership - should these be treated with same constants as access permissions?
+ switch (get_input('membership'))
+ {
+ case 0: $group->membership = ACCESS_PRIVATE;
+ case 1 :$group->membership = ACCESS_LOGGED_IN; break;
+ case 2:
+ default: $group->membership = ACCESS_PUBLIC;
+ }
+
+ // Get access
+ $group->access_id = get_input('access_id', ACCESS_PRIVATE);
+
+ // Set group tool options
+ $group->files_enable = get_input('files_enable', 'yes');
+ $group->pages_enable = get_input('pages_enable', 'yes');
+ $group->forum_enable = get_input('forum_enable', 'yes');
+
+ $group->save();
+
+ if (!$group->isMember($user))
+ $group->join($user); // Creator always a member
+
+
+ // Now see if we have a file icon
+ if ((isset($_FILES['icon'])) && (substr_count($_FILES['icon']['type'],'image/')))
+ {
+ $prefix = "groups/".$group->guid;
+
+ $filehandler = new ElggFile();
+ $filehandler->owner_guid = $group->owner_guid;
+ $filehandler->setFilename($prefix . ".jpg");
+ $filehandler->open("write");
+ $filehandler->write(get_uploaded_file('icon'));
+ $filehandler->close();
+
+ $thumbtiny = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(),25,25, true);
+ $thumbsmall = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(),40,40, true);
+ $thumbmedium = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(),100,100, true);
+ $thumblarge = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(),200,200, false);
+ if ($thumbtiny) {
+
+ $thumb = new ElggFile();
+ $thumb->setMimeType('image/jpeg');
+
+ $thumb->setFilename($prefix."tiny.jpg");
+ $thumb->open("write");
+ $thumb->write($thumbtiny);
+ $thumb->close();
+
+ $thumb->setFilename($prefix."small.jpg");
+ $thumb->open("write");
+ $thumb->write($thumbsmall);
+ $thumb->close();
+
+ $thumb->setFilename($prefix."medium.jpg");
+ $thumb->open("write");
+ $thumb->write($thumbmedium);
+ $thumb->close();
+
+ $thumb->setFilename($prefix."large.jpg");
+ $thumb->open("write");
+ $thumb->write($thumblarge);
+ $thumb->close();
+
+ }
+ }
+
+ system_message(elgg_echo("groups:saved"));
+
+ // Forward to the user's profile
+ forward($group->getUrl());
+ exit;
?> \ No newline at end of file
diff --git a/mod/groups/views/default/forms/groups/edit.php b/mod/groups/views/default/forms/groups/edit.php
index fa64563b7..a570a7a86 100644
--- a/mod/groups/views/default/forms/groups/edit.php
+++ b/mod/groups/views/default/forms/groups/edit.php
@@ -1,119 +1,119 @@
-<?php
- /**
- * Elgg groups plugin
- *
- * @package ElggGroups
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Curverider Ltd
- * @copyright Curverider Ltd 2008-2009
- * @link http://elgg.com/
- */
-?>
-<form action="<?php echo $vars['url']; ?>action/groups/edit" enctype="multipart/form-data" method="post">
-
- <p>
- <label><?php echo elgg_echo("groups:icon"); ?><br />
- <?php
-
- echo elgg_view("input/file",array('internalname' => 'icon'));
-
- ?>
- </label>
- </p>
-<?php
-
- //var_export($vars['profile']);
- if (is_array($vars['config']->group) && sizeof($vars['config']->group) > 0)
- foreach($vars['config']->group as $shortname => $valtype) {
-
-?>
-
- <p>
- <label>
- <?php echo elgg_echo("groups:{$shortname}") ?><br />
- <?php echo elgg_view("input/{$valtype}",array(
- 'internalname' => $shortname,
- 'value' => $vars['entity']->$shortname,
- )); ?>
- </label>
- </p>
-
-<?php
-
- }
-
-?>
-
- <p>
- <label>
- <?php echo elgg_echo('groups:membership'); ?><br />
- <?php echo elgg_view('input/access', array('internalname' => 'membership','value' => $vars['entity']->membership, 'options' => array( 0 => elgg_echo('PRIVATE'), 2=>elgg_echo('PUBLIC')))); ?>
- </label>
- </p>
-
- <p>
- <label>
- <?php echo elgg_echo('groups:access'); ?><br />
- <?php echo elgg_view('input/access', array('internalname' => 'access_id','value' => $vars['entity']->access_id )); ?>
- </label>
- </p>
- <p>
- <label>
- <?php echo elgg_echo('groups:enablepages'); ?><br />
- <?php
-
- echo elgg_view("input/radio",array(
- "internalname" => "pages_enable",
- "value" => $vars['entity']->pages_enable ? $vars['entity']->pages_enable : 'yes',
- 'options' => array(
- elgg_echo('groups:yes') => 'yes',
- elgg_echo('groups:no') => 'no',
- ),
- ));
- ?>
- </label>
- </p>
- <p>
- <label>
- <?php echo elgg_echo('groups:enableforum'); ?><br />
- <?php
-
- echo elgg_view("input/radio",array(
- "internalname" => "forum_enable",
- "value" => $vars['entity']->forum_enable ? $vars['entity']->forum_enable : 'yes',
- 'options' => array(
- elgg_echo('groups:yes') => 'yes',
- elgg_echo('groups:no') => 'no',
- ),
- ));
- ?>
- </label>
- </p>
- <p>
- <label>
- <?php echo elgg_echo('groups:enablefiles'); ?><br />
- <?php
-
- echo elgg_view("input/radio",array(
- "internalname" => "files_enable",
- "value" => $vars['entity']->files_enable ? $vars['entity']->files_enable : 'yes',
- 'options' => array(
- elgg_echo('groups:yes') => 'yes',
- elgg_echo('groups:no') => 'no',
- ),
- ));
- ?>
- </label>
- </p>
- <p>
- <?php
- if ($vars['entity'])
- {
- ?><input type="hidden" name="group_guid" value="<?php echo $vars['entity']->getGUID(); ?>" /><?php
- }
- ?>
- <input type="hidden" name="user_guid" value="<?php echo page_owner_entity()->guid; ?>" />
- <input type="submit" class="submit_button" value="<?php echo elgg_echo("save"); ?>" />
- </p>
-
+<?php
+ /**
+ * Elgg groups plugin
+ *
+ * @package ElggGroups
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008-2009
+ * @link http://elgg.com/
+ */
+?>
+<form action="<?php echo $vars['url']; ?>action/groups/edit" enctype="multipart/form-data" method="post">
+
+ <p>
+ <label><?php echo elgg_echo("groups:icon"); ?><br />
+ <?php
+
+ echo elgg_view("input/file",array('internalname' => 'icon'));
+
+ ?>
+ </label>
+ </p>
+<?php
+
+ //var_export($vars['profile']);
+ if (is_array($vars['config']->group) && sizeof($vars['config']->group) > 0)
+ foreach($vars['config']->group as $shortname => $valtype) {
+
+?>
+
+ <p>
+ <label>
+ <?php echo elgg_echo("groups:{$shortname}") ?><br />
+ <?php echo elgg_view("input/{$valtype}",array(
+ 'internalname' => $shortname,
+ 'value' => $vars['entity']->$shortname,
+ )); ?>
+ </label>
+ </p>
+
+<?php
+
+ }
+
+?>
+
+ <p>
+ <label>
+ <?php echo elgg_echo('groups:membership'); ?><br />
+ <?php echo elgg_view('input/access', array('internalname' => 'membership','value' => $vars['entity']->membership, 'options' => array( ACCESS_PRIVATE => elgg_echo('PRIVATE'), ACCESS_PUBLIC => elgg_echo('PUBLIC')))); ?>
+ </label>
+ </p>
+
+ <p>
+ <label>
+ <?php echo elgg_echo('groups:access'); ?><br />
+ <?php echo elgg_view('input/access', array('internalname' => 'access_id','value' => $vars['entity']->access_id )); ?>
+ </label>
+ </p>
+ <p>
+ <label>
+ <?php echo elgg_echo('groups:enablepages'); ?><br />
+ <?php
+
+ echo elgg_view("input/radio",array(
+ "internalname" => "pages_enable",
+ "value" => $vars['entity']->pages_enable ? $vars['entity']->pages_enable : 'yes',
+ 'options' => array(
+ elgg_echo('groups:yes') => 'yes',
+ elgg_echo('groups:no') => 'no',
+ ),
+ ));
+ ?>
+ </label>
+ </p>
+ <p>
+ <label>
+ <?php echo elgg_echo('groups:enableforum'); ?><br />
+ <?php
+
+ echo elgg_view("input/radio",array(
+ "internalname" => "forum_enable",
+ "value" => $vars['entity']->forum_enable ? $vars['entity']->forum_enable : 'yes',
+ 'options' => array(
+ elgg_echo('groups:yes') => 'yes',
+ elgg_echo('groups:no') => 'no',
+ ),
+ ));
+ ?>
+ </label>
+ </p>
+ <p>
+ <label>
+ <?php echo elgg_echo('groups:enablefiles'); ?><br />
+ <?php
+
+ echo elgg_view("input/radio",array(
+ "internalname" => "files_enable",
+ "value" => $vars['entity']->files_enable ? $vars['entity']->files_enable : 'yes',
+ 'options' => array(
+ elgg_echo('groups:yes') => 'yes',
+ elgg_echo('groups:no') => 'no',
+ ),
+ ));
+ ?>
+ </label>
+ </p>
+ <p>
+ <?php
+ if ($vars['entity'])
+ {
+ ?><input type="hidden" name="group_guid" value="<?php echo $vars['entity']->getGUID(); ?>" /><?php
+ }
+ ?>
+ <input type="hidden" name="user_guid" value="<?php echo page_owner_entity()->guid; ?>" />
+ <input type="submit" class="submit_button" value="<?php echo elgg_echo("save"); ?>" />
+ </p>
+
</form> \ No newline at end of file
diff --git a/mod/profile/actions/edit.php b/mod/profile/actions/edit.php
index 76ea28159..e7f307756 100644
--- a/mod/profile/actions/edit.php
+++ b/mod/profile/actions/edit.php
@@ -44,7 +44,7 @@
if (isset($accesslevel[$shortname])) {
$access_id = (int) $accesslevel[$shortname];
} else {
- $access_id = 0;
+ $access_id = ACCESS_PRIVATE;
}
if (is_array($value)) {
$i = 0;
@@ -59,10 +59,10 @@
}
$user->save();
-
- // Notify of profile update
- trigger_elgg_event('profileupdate',$user->type,$user);
-
+
+ // Notify of profile update
+ trigger_elgg_event('profileupdate',$user->type,$user);
+
system_message(elgg_echo("profile:saved"));
diff --git a/mod/profile/views/default/profile/edit.php b/mod/profile/views/default/profile/edit.php
index c81e023b0..baa843c8e 100644
--- a/mod/profile/views/default/profile/edit.php
+++ b/mod/profile/views/default/profile/edit.php
@@ -36,7 +36,7 @@
}
} else {
$value = '';
- $access_id = 1;
+ $access_id = ACCESS_LOGGED_IN;
}
?>
diff --git a/mod/reportedcontent/actions/add.php b/mod/reportedcontent/actions/add.php
index ebe1d7e3b..3f818ca3c 100644
--- a/mod/reportedcontent/actions/add.php
+++ b/mod/reportedcontent/actions/add.php
@@ -13,7 +13,7 @@
$title = get_input('title');
$description = get_input('description');
$address = get_input('address');
- $access = 0; //this is private and only admins can see it
+ $access = ACCESS_PRIVATE; //this is private and only admins can see it
if ($title && $address) {
diff --git a/mod/reportedcontent/views/default/reportedcontent/form.php b/mod/reportedcontent/views/default/reportedcontent/form.php
index ded9960c8..ed4833f6e 100644
--- a/mod/reportedcontent/views/default/reportedcontent/form.php
+++ b/mod/reportedcontent/views/default/reportedcontent/form.php
@@ -17,7 +17,7 @@
if ($address == "previous")
$address = $_SERVER['HTTP_REFERER'];
$tags = array();
- $access_id = 0;
+ $access_id = ACCESS_PRIVATE;
$shares = array();
$owner = $vars['user'];