Exemplo n.º 1
0
function smarty_function_attribution($params, &$smarty)
{
    if (isset($params['user_id'])) {
        if (!defined("SYS_USERS")) {
            require_once BASE . "subsystems/users.php";
        }
        $u = pathos_users_getUserById($params['user_id']);
    } else {
        if (isset($params['user'])) {
            $u = $params['user'];
        }
    }
    if ($u) {
        $str = "";
        switch (DISPLAY_ATTRIBUTION) {
            case "firstlast":
                $str = $u->firstname . " " . $u->lastname;
                break;
            case "lastfirst":
                $str = $u->lastname . ", " . $u->lastname;
                break;
            case "first":
                $str = $u->firstname;
                break;
            case "username":
            default:
                $str = $u->username;
                break;
        }
        echo $str;
    }
}
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307  USA
#
# $Id: saveuserperms.php,v 1.5 2005/04/18 15:22:39 filetreefrog Exp $
##################################################
if (!defined("PATHOS")) {
    exit("");
}
if (pathos_permissions_check("administrate", $loc)) {
    $users = explode(";", $_POST['permdata']);
    if (!defined("SYS_USERS")) {
        require_once BASE . "subsystems/users.php";
    }
    foreach ($users as $user_str) {
        $perms = explode(":", $user_str);
        $u = pathos_users_getUserById($perms[0]);
        pathos_permissions_revokeAll($u, $loc);
        for ($i = 1; $i < count($perms); $i++) {
            pathos_permissions_grant($u, $perms[$i], $loc);
        }
        if ($perms[0] == $user->id) {
            pathos_permissions_load($user);
        }
    }
    pathos_permissions_triggerRefresh();
    pathos_flow_redirect();
} else {
    echo SITE_403_HTML;
}
# You should have received a copy of the GNU
# General Public License along with Exponent; if
# not, write to:
#
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307  USA
#
# $Id: session_kick.php,v 1.6 2005/04/18 15:33:34 filetreefrog Exp $
##################################################
// Part of the User Management category
if (!defined('PATHOS')) {
    exit('');
}
if (pathos_permissions_check('user_management', pathos_core_makeLocation('administrationmodule'))) {
    $ticket = $db->selectObject('sessionticket', "ticket='" . $_GET['ticket'] . "'");
    if ($ticket) {
        if (!defined('SYS_USERS')) {
            require_once BASE . 'subsystems/users.php';
        }
        $u = pathos_users_getUserById($ticket->uid);
        if ($u->is_acting_admin == 0 || $user->is_admin == 1 && $u->is_admin == 0) {
            // We can only kick the user if they are A) not an acting admin, or B) The current user is a super user and the kicked user is not.
            $db->delete('sessionticket', "ticket='" . $ticket->ticket . "'");
        }
    }
    pathos_flow_redirect();
} else {
    echo SITE_403_HTML;
}
Exemplo n.º 4
0
     $post->body = chop(strip_tags(str_replace(array("<br />", "<br>", "br/>"), "\n", $post->body)));
     $template->assign("post", $post);
     if (!defined("SYS_USERS")) {
         require_once BASE . "subsystems/users.php";
     }
     $template->assign("poster", pathos_users_getUserById($post->poster));
     $template->assign("board", $bb);
     $msg = $template->render();
     // Saved.  do notifs
     $emails = array();
     if (!defined("SYS_USERS")) {
         require_once BASE . "subsystems/users.php";
     }
     foreach ($notifs as $n) {
         if ($n->user_id != $user->id) {
             $u = pathos_users_getUserById($n->user_id);
             if ($u->email != "") {
                 $emails[] = $u->email;
             }
         }
     }
     if (!defined("SYS_SMTP")) {
         require BASE . "subsystems/smtp.php";
     }
     pathos_smtp_mail($emails, $from_addr, $title, $msg, $headers);
 }
 // Save new monitors
 $thread_id = $parent ? $parent->id : $post->id;
 if (isset($_POST['monitor'])) {
     if (!$db->selectObject("bb_threadmonitor", "thread_id=" . $parent . " AND user_id=" . $user->id)) {
         $mon = null;
Exemplo n.º 5
0
     }
     usort($controls, "pathos_sorting_byRankAscending");
     foreach (array_slice($controls, 0, 5) as $control) {
         if ($rpt->column_names != '') {
             $rpt->column_names .= '|!|';
         }
         $rpt->column_names .= $control->name;
     }
 }
 foreach (explode("|!|", $rpt->column_names) as $column_name) {
     if ($column_name == "ip") {
         $columndef .= 'new cColumn("' . TR_FORMBUILDER_FIELD_IP . '","ip",null,null),';
     } elseif ($column_name == "user_id") {
         foreach ($items as $key => $item) {
             if ($item->{$column_name} != 0) {
                 $locUser = pathos_users_getUserById($item->{$column_name});
                 $item->{$column_name} = $locUser->username;
             } else {
                 $item->{$column_name} = '';
             }
             $items[$key] = $item;
         }
         $columndef .= 'new cColumn("' . TR_FORMBUILDER_FIELD_USERNAME . '","user_id",null,null),';
     } elseif ($column_name == "timestamp") {
         $srt = $column_name . "_srt";
         foreach ($items as $key => $item) {
             $item->{$srt} = $item->{$column_name};
             $item->{$column_name} = strftime(DISPLAY_DATETIME_FORMAT, $item->{$column_name});
             $items[$key] = $item;
         }
         $columndef .= 'new cColumn("' . TR_FORMBUILDER_FIELD_TIMESTAMP . '","timestamp",null,f' . $srt . '),';
Exemplo n.º 6
0
 // This type of permissions check requires us to read the data from the database first,
 // and then decide whether or not to let the user in.
 $canview = pathos_permissions_check("approve", $loc) || pathos_permissions_check("manage_approval", $loc);
 if (!defined("SYS_USERS")) {
     require_once BASE . "subsystems/users.php";
 }
 pathos_flow_set(SYS_FLOW_PROTECTED, SYS_FLOW_ACTION);
 if ($db->tableExists($datatype . "_wf_info")) {
     $approveloc = pathos_core_makeLocation($_GET['m'], $_GET['s']);
     $summaries = $db->selectObjects($datatype . "_wf_info", "location_data='" . serialize($approveloc) . "'");
     for ($i = 0; $i < count($summaries); $i++) {
         $summaries[$i]->revision = $db->selectObject($datatype . "_wf_revision", "wf_original=" . $summaries[$i]->real_id . " AND wf_major=" . $summaries[$i]->current_major . " AND wf_minor=" . $summaries[$i]->current_minor);
         $summaries[$i]->state_data = unserialize($summaries[$i]->current_state_data);
         $involved_users = array();
         foreach ($summaries[$i]->state_data[0] as $id) {
             $involved_users[$id] = pathos_users_getUserById($id);
         }
         if (isset($involved_users[$user->id])) {
             $canview = true;
         }
         $summaries[$i]->involved = $involved_users;
         $summaries[$i]->policy = $db->selectObject("approvalpolicy", "id=" . $summaries[$i]->policy_id);
         $summaries[$i]->real = $db->selectObject($datatype, "id=" . $summaries[$i]->real_id);
     }
 }
 if ($canview) {
     $template = new template("workflow", "_summary", pathos_core_makeLocation('workflow', $loc->src));
     $template->register_permissions(array("manage_approval", "approve"), $loc);
     $template->assign("summaries", $summaries);
     $template->assign("datatype", $datatype);
     $template->assign("user", $user);
Exemplo n.º 7
0
#
# You should have received a copy of the GNU
# General Public License along with Exponent; if
# not, write to:
#
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307  USA
#
# $Id: ban.php,v 1.7 2005/04/18 15:24:02 filetreefrog Exp $
##################################################
if (!defined("PATHOS")) {
    exit("");
}
$u = null;
if (isset($_REQUEST['uid'])) {
    if (!defined("SYS_USERS")) {
        require_once BASE . "subsystems/users.php";
    }
    $u = pathos_users_getUserById($_REQUEST['uid']);
}
if ($user && $u) {
    $ban = null;
    $ban->owner = $user->id;
    $ban->user_id = $u->id;
    $db->insertObject($ban, "inbox_contactbanned");
    pathos_flow_redirect();
} else {
    echo SITE_404_HTML;
}
 function form($object)
 {
     pathos_lang_loadDictionary('modules', 'inboxmodule');
     pathos_lang_loadDictionary('standard', 'core');
     if (!defined('SYS_FORMS')) {
         require_once BASE . 'subsystems/forms.php';
     }
     pathos_forms_initialize();
     $form = new form();
     $users = array();
     $groups = array();
     global $db, $user;
     if (!defined('SYS_USERS')) {
         require_once BASE . 'subsystems/users.php';
     }
     if (pathos_permissions_check('contact_all', pathos_core_makeLocation('inboxmodule'))) {
         foreach (pathos_users_getAllUsers() as $u) {
             $users[$u->id] = $u->firstname . ' ' . $u->lastname . ' (' . $u->username . ')';
         }
     } else {
         foreach (pathos_users_getGroupsForUser($user, 1, 0) as $g) {
             foreach (pathos_users_getUsersInGroup($g) as $u) {
                 $users[$u->id] = $u->firstname . ' ' . $u->lastname . ' (' . $u->username . ')';
             }
         }
     }
     // Process other uses who the current user has blocked, and remove them from the list
     // Process other users who have blocked the current user, and remove them from the list.
     foreach ($db->selectObjects('inbox_contactbanned', 'owner=' . $user->id . ' OR user_id=' . $user->id) as $blocked) {
         if ($blocked->user_id == $user->id) {
             // Blocked by someone else.  Remove the owner (user who blocked us)
             unset($users[$blocked->owner]);
         } else {
             if ($blocked->owner == $user->id) {
                 // We blocked the user, remove the blocked user_id
                 unset($users[$blocked->user_id]);
             }
         }
     }
     uasort($users, 'strnatcmp');
     $groups = array();
     foreach ($db->selectObjects('inbox_contactlist', 'owner=' . $user->id) as $g) {
         $groups['list_' . $g->id] = $g->name . ' ' . TR_INBOXMODULE_PERSONALLIST;
     }
     if (pathos_permissions_check('contact_all', pathos_core_makeLocation('inboxmodule'))) {
         foreach (pathos_users_getAllGroups(1, 0) as $g) {
             $groups['group_' . $g->id] = $g->name . ' ' . TR_INBOXMODULE_SYSGROUP;
         }
     } else {
         foreach (pathos_users_getGroupsForUser($user, 1, 0) as $g) {
             $groups['group_' . $g->id] = $g->name . ' ' . TR_INBOXMODULE_SYSGROUP;
         }
     }
     uasort($groups, 'strnatcmp');
     $recipient_caption = TR_INBOXMODULE_RECIPIENT;
     $group_recipient_caption = TR_INBOXMODULE_GROUPRECIPIENT;
     $btn = new buttongroupcontrol(TR_INBOXMODULE_SEND, '', TR_CORE_CANCEL);
     $object->group_recipient = array();
     if ($object == null || !isset($object->recipient)) {
         $object->subject = '';
         $object->body = '';
         $object->recipient = array();
         if (!count($users) && !count($groups)) {
             $btn->disabled = true;
         }
     } else {
         if (!defined('SYS_USERS')) {
             require_once BASE . 'subsystems/users.php';
         }
         $u = pathos_users_getUserById($object->recipient);
         $form->register(null, '', new htmlcontrol(sprintf(TR_INBOXMODULE_REPLYTO, $u->firstname . ' ' . $u->lastname . ' (' . $u->username . ')')));
         $form->meta('replyto', $object->recipient);
         $object->recipient = array();
         unset($users[$u->id]);
         $recipient_caption = TR_INBOXMODULE_COPYTO;
         $group_recipient_caption = TR_INBOXMODULE_GROUPCOPYTO;
     }
     if (count($users)) {
         $form->register('recipients', $recipient_caption, new listbuildercontrol($object->recipient, $users));
     }
     if (count($groups)) {
         $form->register('group_recipients', $group_recipient_caption, new listbuildercontrol($object->group_recipient, $groups));
     }
     if (!count($groups) && !count($users)) {
         $form->register(null, '', new htmlcontrol('<div class="error">' . TR_INBOXMODULE_NOCONTACTSWARNING . '</div>'));
     }
     $form->register('subject', TR_INBOXMODULE_SUBJECT, new textcontrol($object->subject));
     $form->register('body', TR_INBOXMODULE_MESSAGE, new htmleditorcontrol($object->body));
     $form->register('submit', '', $btn);
     return $form;
 }
$bb = $db->selectObject("bb_board", "id=" . $_GET['id']);
$loc = unserialize($bb->location_data);
pathos_flow_set(SYS_FLOW_PUBLIC, SYS_FLOW_ACTION);
if (!defined("SYS_USERS")) {
    require BASE . "subsystems/users.php";
}
$users = array();
$posts = $db->selectObjects("bb_post", "board_id=" . $bb->id . " AND parent=0");
for ($i = 0; $i < count($posts); $i++) {
    if (!isset($users[$posts[$i]->poster])) {
        $users[$posts[$i]->poster] = pathos_users_getUserById($posts[$i]->poster);
    }
    $posts[$i]->user = $users[$posts[$i]->poster];
    if ($posts[$i]->editted != 0) {
        if (!isset($users[$posts[$i]->editor])) {
            $users[$posts[$i]->editor] = pathos_users_getUserById($posts[$i]->poster);
        }
        $posts[$i]->editor = $users[$posts[$i]->editor];
    }
}
if (!defined("SYS_SORTING")) {
    require_once BASE . "subsystems/sorting.php";
}
if (!function_exists("pathos_sorting_byUpdatedDescending")) {
    function pathos_sorting_byUpdatedDescending($a, $b)
    {
        return $a->updated > $b->updated ? -1 : 1;
    }
}
usort($posts, "pathos_sorting_byUpdatedDescending");
$bbloc = pathos_core_makeLocation($loc->mod, $loc->src, "b" . $bb->id);
Exemplo n.º 10
0
}
if ($post) {
    $bb = $db->selectObject("bb_board", "id=" . $post->board_id);
}
if ($post && $bb) {
    $loc = unserialize($bb->location_data);
    pathos_flow_set(SYS_FLOW_PUBLIC, SYS_FLOW_ACTION);
    $loc->int = "b" . $bb->id;
    $replies = $db->selectObjects("bb_post", "parent=" . $post->id);
    $users = array();
    if (!defined("SYS_USERS")) {
        require_once BASE . "subsystems/users.php";
    }
    $users[$post->poster] = pathos_users_getUserById($post->poster);
    $post->poster = $users[$post->poster];
    for ($i = 0; $i < count($replies); $i++) {
        if (!isset($users[$replies[$i]->poster])) {
            $users[$replies[$i]->poster] = pathos_users_getUserById($replies[$i]->poster);
        }
        $replies[$i]->poster = $users[$replies[$i]->poster];
    }
    $template = new template("bbmodule", "_view_thread", $loc);
    $template->assign("thread", $post);
    $template->assign("replies", $replies);
    $template->register_permissions(array("administrate", "create_thread", "delete_thread", "edit_post", "reply"), $loc);
    $template->assign("monitoring", $user && $db->selectObject("bb_threadmonitor", "user_id=" . $user->id . " AND thread_id=" . $post->id) != null ? 1 : 0);
    $template->assign("loggedin", $user != null ? 1 : 0);
    $template->output();
} else {
    echo SITE_404_HTML;
}
Exemplo n.º 11
0
function pathos_users_userManagerFormTemplate($template)
{
    global $db;
    global $user;
    $users = $db->selectObjects('user');
    if (!defined('SYS_SORTING')) {
        require_once BASE . 'subsystems/sorting.php';
    }
    if (!function_exists('pathos_sorting_byLastFirstAscending')) {
        function pathos_sorting_byLastFirstAscending($a, $b)
        {
            return strnatcmp($a->lastname . ', ' . $a->firstname, $b->lastname . ', ' . $b->firstname);
        }
    }
    usort($users, 'pathos_sorting_byLastFirstAscending');
    for ($i = 0; $i < count($users); $i++) {
        $users[$i] = pathos_users_getUserById($users[$i]->id);
        if ($users[$i]->is_acting_admin && $user->is_admin == 0) {
            // Dealing with an acting admin, and the current user is not a super user
            // Fake the is_admin parameter to disable editting.
            $users[$i]->is_admin = 1;
        }
    }
    $template->assign('users', $users);
    $template->assign('blankpass', md5(''));
    return $template;
}
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307  USA
#
# $Id: usersessions.php,v 1.6 2005/04/18 15:33:34 filetreefrog Exp $
##################################################
// Part of the User Management category
if (!defined('PATHOS')) {
    exit('');
}
if (pathos_permissions_check('user_management', pathos_core_makeLocation('administrationmodule'))) {
    pathos_flow_set(SYS_FLOW_PROTECTED, SYS_FLOW_ACTION);
    $db->delete('sessionticket', 'last_active < ' . (time() - SESSION_TIMEOUT));
    if (!defined('SYS_USERS')) {
        require_once BASE . 'subsystems/users.php';
    }
    if (!defined('SYS_DATETIME')) {
        require_once BASE . 'subsystems/datetime.php';
    }
    $sessions = $db->selectObjects('sessionticket');
    for ($i = 0; $i < count($sessions); $i++) {
        $sessions[$i]->user = pathos_users_getUserById($sessions[$i]->uid);
        $sessions[$i]->duration = pathos_datetime_duration($sessions[$i]->last_active, $sessions[$i]->start_time);
    }
    $template = new template('administrationmodule', '_sessionmanager', $loc);
    $template->assign('sessions', $sessions);
    $template->assign('user', $user);
    $template->output();
} else {
    echo SITE_403_HTML;
}
Exemplo n.º 13
0
     }
     usort($controls, "pathos_sorting_byRankAscending");
     $fields = array();
     $captions = array();
     foreach ($controls as $c) {
         $ctl = unserialize($c->data);
         $control_type = get_class($ctl);
         $name = $c->name;
         $fields[$name] = call_user_func(array($control_type, 'templateFormat'), $data->{$name}, $ctl);
         $captions[$name] = $c->caption;
     }
     $captions['ip'] = TR_FORMBUILDER_FIELD_IP;
     $captions['timestamp'] = TR_FORMBUILDER_FIELD_TIMESTAMP;
     $captions['user_id'] = TR_FORMBUILDER_FIELD_USERNAME;
     $fields['ip'] = $data->ip;
     $locUser = pathos_users_getUserById($data->user_id);
     $fields['user_id'] = isset($locUser->username) ? $locUser->username : '';
     $fields['timestamp'] = strftime(DISPLAY_DATETIME_FORMAT, $data->timestamp);
     if ($rpt->text == "") {
         $template = new template("formbuilder", "_default_report");
     } else {
         $template = new template("formbuilder", "_custom_report");
         $template->assign("template", $rpt->text);
     }
     $template->assign("fields", $fields);
     $template->assign("captions", $captions);
     $template->assign("backlink", pathos_flow_get());
     $template->assign("is_email", 0);
     $template->output();
 } else {
     echo SITE_403_HTML;
//GREP:HARDCODEDTEXT
// Part of the User Management category
if (!defined('PATHOS')) {
    exit('');
}
if (pathos_permissions_check('user_management', pathos_core_makeLocation('administrationmodule'))) {
    #if ($user && $user->is_acting_admin == 1) {
    if (!defined('SYS_USERS')) {
        require_once BASE . 'subsystems/users.php';
    }
    if (!defined('SYS_SECURITY')) {
        require_once BASE . 'subsystems/security.php';
    }
    if (isset($_POST['id'])) {
        // Existing user profile edit
        $u = pathos_users_getUserById($_POST['id']);
        $u = pathos_users_update($_POST, $u);
        pathos_users_saveUser($u);
        pathos_flow_redirect();
    } else {
        pathos_lang_loadDictionary('modules', 'loginmodule');
        if (pathos_users_getUserByName($_POST['username']) != null) {
            $post = $_POST;
            unset($post['username']);
            $post['_formError'] = TR_LOGINMODULE_USERNAMETAKEN;
            pathos_sessions_set('last_POST', $post);
            header('Location: ' . $_SERVER['HTTP_REFERER']);
        } else {
            if ($_POST['pass1'] != $_POST['pass2']) {
                $post = $_POST;
                unset($post['pass1']);
Exemplo n.º 15
0
# $Id: view.php,v 1.3 2005/04/18 15:24:57 filetreefrog Exp $
##################################################
if (!defined("PATHOS")) {
    exit("");
}
pathos_flow_set(SYS_FLOW_PUBLIC, SYS_FLOW_ACTION);
$resource = $db->selectObject("resourceitem", "id=" . $_GET['id']);
if ($resource != null) {
    $loc = unserialize($resource->location_data);
    $iloc = pathos_core_makeLocation($loc->mod, $loc->src, $resource->id);
    $resource->permissions = array("administrate" => pathos_permissions_check("administrate", $iloc), "edit" => pathos_permissions_check("edit", $iloc), "delete" => pathos_permissions_check("delete", $iloc));
    if ($resource->flock_owner != 0) {
        if (!defined("SYS_USERS")) {
            require_once BASE . "subsystems/users.php";
        }
        $resource->lock_owner = pathos_users_getUserById($resource->flock_owner);
        $resource->locked = 1;
    } else {
        $resource->locked = 0;
    }
    $file = $db->selectObject("file", "id=" . $resource->file_id);
    if ($file != null) {
        $mimetype = $db->selectObject("mimetype", "mimetype='" . $file->mimetype . "'");
        $template = new template("resourcesmodule", "_view", $loc);
        $template->assign("resource", $resource);
        $template->assign("user", $user);
        $template->assign("file", $file);
        $template->assign("mimetype", $mimetype);
        $template->register_permissions(array("administrate", "edit", "delete", "manage_approval"), $loc);
        $template->output();
    } else {
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307  USA
#
# $Id: umgr_membership.php,v 1.7 2005/04/18 15:33:34 filetreefrog Exp $
##################################################
// 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';
    }
    $u = pathos_users_getUserById($_GET['id']);
    if ($u) {
        $groups = pathos_users_getAllGroups();
        $admin = array();
        $membership = array();
        foreach ($db->selectObjects('groupmembership', 'member_id=' . $u->id) as $m) {
            $membership[] = $m->group_id;
            if ($m->is_admin == 1) {
                $admin[] = $m->group_id;
            }
        }
        for ($i = 0; $i < count($groups); $i++) {
            if (in_array($groups[$i]->id, $membership)) {
                $groups[$i]->is_member = 1;
                if (in_array($groups[$i]->id, $admin)) {
                    $groups[$i]->is_admin = 1;
Exemplo n.º 17
0
    $newpass = '';
    for ($i = 0; $i < rand(12, 20); $i++) {
        $num = rand(48, 122);
        if ($num > 97 && $num < 122 || $num > 65 && $num < 90 || $num > 48 && $num < 57) {
            $newpass .= chr($num);
        } else {
            $i--;
        }
    }
    // Send message
    if (!defined('SYS_SMTP')) {
        require_once BASE . 'subsystems/smtp.php';
    }
    $e_template = new template('loginmodule', '_email_resetdone', $loc);
    $e_template->assign('newpass', $newpass);
    $msg = $e_template->render();
    if (!defined('SYS_USERS')) {
        require_once BASE . 'subsystems/users.php';
    }
    $u = pathos_users_getUserById($tok->uid);
    if (!pathos_smtp_mail($u->email, 'Password Manager <passwords@pathos>', 'Your New Password', $msg)) {
        $template->assign('state', 'smtp_error');
    } else {
        // Save new password
        $u->password = md5($newpass);
        pathos_users_saveUser($u);
        $db->delete('passreset_token', 'uid=' . $tok->uid);
        $template->assign('state', 'sent');
    }
}
$template->output();
Exemplo n.º 18
0
 function show($view, $loc = null, $title = "")
 {
     global $db;
     if (!defined("SYS_USERS")) {
         require_once BASE . "subsystems/users.php";
     }
     $boards = $db->selectObjects("bb_board", "location_data='" . serialize($loc) . "'");
     $iloc = pathos_core_makeLocation($loc->mod, $loc->src);
     for ($i = 0; $i < count($boards); $i++) {
         $iloc->int = "b" . $boards[$i]->id;
         $boards[$i]->permissions = array("edit_board" => pathos_permissions_check("edit_board", $iloc), "delete_board" => pathos_permissions_check("delete_board", $iloc));
         if ($boards[$i]->last_post_id != 0) {
             $lp = $db->selectObject("bb_post", "id=" . $boards[$i]->last_post_id);
             $lp->poster = pathos_users_getUserById($lp->poster);
             $boards[$i]->last_post = $lp;
         } else {
             $boards[$i]->last_post = null;
         }
     }
     $template = new template("bbmodule", $view, $loc);
     $template->assign("moduletitle", $title);
     $template->assign("boards", $boards);
     $template->register_permissions(array("administrate", "configure", "create_board", "edit_board", "delete_board"), $loc);
     $template->output();
 }
 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;
 }
Exemplo n.º 20
0
 }
 //Email stuff here...
 //Don't send email if this is an edit.
 if ($f->is_email == 1 && !isset($_POST['data_id'])) {
     //Building Email List...
     $emaillist = array();
     foreach ($db->selectObjects("formbuilder_address", "form_id=" . $f->id) as $address) {
         if ($address->group_id != 0) {
             foreach (pathos_users_getUsersInGroup($address->group_id) as $locUser) {
                 if ($locUser->email != '') {
                     $emaillist[] = $locUser->email;
                 }
             }
         } else {
             if ($address->user_id != 0) {
                 $locUser = pathos_users_getUserById($address->user_id);
                 if ($locUser->email != '') {
                     $emaillist[] = $locUser->email;
                 }
             } else {
                 if ($address->email != '') {
                     $emaillist[] = $address->email;
                 }
             }
         }
     }
     if ($rpt->text == "") {
         $template = new template("formbuilder", "_default_report");
     } else {
         $template = new template("formbuilder", "_custom_report");
         $template->assign("template", $rpt->text);
Exemplo n.º 21
0
#
# You should have received a copy of the GNU
# General Public License along with Exponent; if
# not, write to:
#
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307  USA
#
# $Id: view_contacts.php,v 1.6 2005/04/18 15:24:02 filetreefrog Exp $
##################################################
if (!defined("PATHOS")) {
    exit("");
}
if ($user) {
    pathos_flow_set(SYS_FLOW_PROTECTED, SYS_FLOW_ACTION);
    if (!defined("SYS_USERS")) {
        require_once BASE . "subsystems/users.php";
    }
    $groups = $db->selectObjects("inbox_contactlist", "owner=" . $user->id);
    $banned = $db->selectObjects("inbox_contactbanned", "owner=" . $user->id);
    for ($i = 0; $i < count($banned); $i++) {
        $banned[$i]->user = pathos_users_getUserById($banned[$i]->user_id);
    }
    $template = new template("inboxmodule", "_viewcontacts", $loc);
    #$template->assign("contacts",$contacts);
    $template->assign("groups", $groups);
    $template->assign("banned", $banned);
    $template->output();
}