# Boston, MA 02111-1307  USA
#
# $Id: gmgr_savegroup.php,v 1.7 2005/04/18 15:33:33 filetreefrog Exp $
##################################################
//GREP:HARDCODEDTEXT
// Part of the User Management category
if (!defined('PATHOS')) {
    exit('');
}
if (pathos_permissions_check('user_management', pathos_core_makeLocation('administrationmodule'))) {
    if (!defined('SYS_USERS')) {
        require_once BASE . 'subsystems/users.php';
    }
    if (isset($_POST['id'])) {
        // Existing user profile edit
        $g = pathos_users_getGroupById($_POST['id']);
        $g = pathos_users_groupUpdate($_POST, $g);
        pathos_users_saveGroup($g);
        pathos_flow_redirect();
    } else {
        if (pathos_users_getGroupByName($_POST['name']) != null) {
            pathos_lang_loadDictionary('modules', 'administrationmodule');
            $post = $_POST;
            $post['_formError'] = TR_ADMINISTRATIONMODULE_GROUPNAMETAKEN;
            pathos_sessions_set('last_POST', $post);
            header('Location: ' . $_SERVER['HTTP_REFERER']);
        } else {
            $g = pathos_users_groupUpdate($_POST, null);
            pathos_users_saveGroup($g);
            pathos_flow_redirect();
        }
# Suite 330,
# Boston, MA 02111-1307  USA
#
# $Id: savegroupperms.php,v 1.5 2005/04/18 15:22:39 filetreefrog Exp $
##################################################
if (!defined("PATHOS")) {
    exit("");
}
if (pathos_permissions_check("administrate", $loc)) {
    $groups = explode(";", $_POST['permdata']);
    if (!defined("SYS_USERS")) {
        require_once BASE . "subsystems/users.php";
    }
    foreach ($groups as $group_str) {
        $perms = explode(":", $group_str);
        if ($perms[0] == 0) {
            // Anonymous Users
            $g->id = 0;
        } else {
            $g = pathos_users_getGroupById($perms[0]);
        }
        pathos_permissions_revokeAllGroup($g, $loc);
        for ($i = 1; $i < count($perms); $i++) {
            pathos_permissions_grantGroup($g, $perms[$i], $loc);
        }
    }
    pathos_permissions_triggerRefresh();
    pathos_flow_redirect();
} else {
    echo SITE_403_HTML;
}
 function form($object)
 {
     pathos_lang_loadDictionary('standard', 'core');
     pathos_lang_loadDictionary('modules', 'formbuilder');
     global $db;
     if (!defined('SYS_FORMS')) {
         require_once BASE . 'subsystems/forms.php';
     }
     if (!defined('SYS_USERS')) {
         require_once BASE . 'subsystems/users.php';
     }
     //global $user;
     pathos_forms_initialize();
     $form = new form();
     if (!isset($object->id)) {
         $object->name = '';
         $object->description = '';
         $object->is_email = 0;
         $object->is_saved = 1;
         $object->response = 'Your form has been submitted.';
         $object->resetbtn = 'Reset';
         $object->submitbtn = 'Submit';
         $object->subject = 'Submitted form from site.';
     } else {
         $form->meta('id', $object->id);
     }
     $form->register('name', TR_FORMBUILDER_NAME, new textcontrol($object->name));
     $form->register('description', TR_FORMBUILDER_DESCRIPTION, new texteditorcontrol($object->description));
     $form->register('response', TR_FORMBUILDER_RESPONSE, new htmleditorcontrol($object->response));
     $form->register(null, '', new htmlcontrol('<br><br><b>' . TR_FORMBUILDER_BUTTONHEADER . '</b><br><hr><br>'));
     $form->register('submitbtn', TR_FORMBUILDER_SUBMITTEXT, new textcontrol($object->submitbtn));
     $form->register('resetbtn', TR_FORMBUILDER_RESETTEXT, new textcontrol($object->resetbtn));
     $form->register(null, '', new htmlcontrol('<br><br><b>' . TR_FORMBUILDER_EMAILHEADER . '</b><br><hr><br>'));
     $form->register('is_email', TR_FORMBUILDER_EMAILFORM, new checkboxcontrol($object->is_email, false));
     $userlist = array();
     $users = pathos_users_getAllUsers();
     foreach ($users as $locuser) {
         $userlist[$locuser->id] = $locuser->username;
     }
     $defaults = array();
     foreach ($db->selectObjects('formbuilder_address', 'form_id=' . $object->id . ' and user_id != 0') as $address) {
         $locuser = pathos_users_getUserById($address->user_id);
         $defaults[$locuser->id] = $locuser->username;
     }
     $form->register('users', TR_FORMBUILDER_USERS, new listbuildercontrol($defaults, $userlist));
     $groups = pathos_users_getAllGroups();
     $grouplist = array();
     $defaults = array();
     foreach ($groups as $group) {
         $grouplist[$group->id] = $group->name;
     }
     if ($grouplist != null) {
         foreach ($db->selectObjects('formbuilder_address', 'form_id=' . $object->id . ' and group_id != 0') as $address) {
             $group = pathos_users_getGroupById($address->group_id);
             $defaults[$group->id] = $group->name;
         }
         $form->register('groups', TR_FORMBUILDER_GROUPS, new listbuildercontrol($defaults, $grouplist));
     }
     $defaults = array();
     foreach ($db->selectObjects('formbuilder_address', 'form_id=' . $object->id . " and email != ''") as $address) {
         $defaults[$address->email] = $address->email;
     }
     $form->register('addresses', TR_FORMBUILDER_OTHERADDRESSES, new listbuildercontrol($defaults, null));
     $form->register('subject', TR_FORMBUILDER_EMAILSUBJECT, new textcontrol($object->subject));
     $form->register(null, '', new htmlcontrol('<br><br><b>' . TR_FORMBUILDER_DBHEADER . '</b><br><hr size="1"><br>'));
     $form->register('is_saved', TR_FORMBUILDER_SAVETODB, new checkboxcontrol($object->is_saved, false));
     $form->register(null, '', new htmlcontrol('<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . TR_FORMBUILDER_DATALOSSWARNING . '<br>'));
     if ($object->is_saved == 1) {
         $form->controls['is_saved']->disabled = true;
         $form->meta('is_saved', '1');
     }
     $form->register(null, '', new htmlcontrol('<br><br><br>'));
     $form->register('submit', '', new buttongroupcontrol(TR_CORE_SAVE, '', TR_CORE_CANCEL));
     return $form;
 }
Beispiel #4
0
         $banned[$b->user_id] = $b->user_id;
     } else {
         $banned[$b->user_id] = $b->owner;
     }
 }
 if (isset($_POST['replyto'])) {
     $recipients[] = $_POST['replyto'];
 }
 $gr = array();
 if (isset($_POST['group_recipients'])) {
     $gr = listbuildercontrol::parseData($_POST, "group_recipients");
     foreach ($gr as $ginfo) {
         $toks = explode("_", $ginfo);
         $gid = $toks[1];
         if ($toks[0] == "group") {
             foreach (pathos_users_getUsersInGroup(pathos_users_getGroupById($gid)) as $u) {
                 if (!in_array($u->id, $banned)) {
                     $recipients[] = $u->id;
                 }
             }
         } else {
             $list = $db->selectObject("inbox_contactlist", "id=" . $gid);
             if ($list->owner == $user->id) {
                 foreach ($db->selectObjects("inbox_contactlist_member", "list_id=" . $list->id) as $m) {
                     if (!in_array($u->id, $banned)) {
                         $recipients[] = $m->user_id;
                     }
                 }
             }
         }
     }