Пример #1
0
     $db->sql_query('DELETE FROM ' . AUTH_ACCESS_TABLE . ' WHERE group_id = ' . $group_id);
     group_msg('The group has been deleted');
 } else {
     $group_type = isset($_POST['group_type']) ? intval($_POST['group_type']) : 0;
     $group_name = isset($_POST['group_name']) ? trim($_POST['group_name']) : '';
     $group_description = isset($_POST['group_description']) ? trim($_POST['group_description']) : '';
     $group_moderator = isset($_POST['username']) ? Fix_Quotes($_POST['username'], true) : '';
     $delete_old_moderator = isset($_POST['delete_old_moderator']) ? true : false;
     if ($group_name == '') {
         cpg_error('No_group_name');
     } else {
         if ($group_moderator == '') {
             cpg_error('No_group_moderator');
         }
     }
     $this_userdata = getusrdata($group_moderator, "user_id");
     $group_moderator = $this_userdata['user_id'];
     if (!$group_moderator) {
         cpg_error('The member ' . $group_moderator . ' doesn\'t exist');
     }
     if ($mode == "editgroup") {
         $group_info = $db->sql_ufetchrow('SELECT * FROM ' . $prefix . '_bbgroups WHERE group_single_user = 0 AND group_id = ' . $group_id);
         if (empty($group_info)) {
             cpg_error('The group doesn\'t exist');
         }
         if ($group_info['group_moderator'] != $group_moderator) {
             if ($delete_old_moderator) {
                 $db->sql_query('DELETE FROM ' . $prefix . '_bbuser_group WHERE user_id = ' . $group_info['group_moderator'] . ' AND group_id = ' . $group_id);
             }
             $result = $db->sql_query("SELECT user_id FROM " . $prefix . "_bbuser_group WHERE user_id = {$group_moderator} AND group_id = {$group_id}");
             if (!($row = $db->sql_fetchrow($result))) {
Пример #2
0
	<input type="checkbox" name="radminsuper" value="1" /> <strong>' . _SUPERUSER . '</strong><br />
	<font class="tiny"><i>' . _SUPERWARNING . '</i></font></td>
  </tr><tr></table><br />
	<center><input type="submit" value="' . _PROMOTEUSER . '" />
  <input type="hidden" name="mode" value="promoteConf" /><input type="hidden" name="password" value="' . $upass . '" /></form></center>';
                                    showfooter();
                                }
                            }
                        }
                    }
                } else {
                    if (isset($_POST['mode'])) {
                        if ($_POST['mode'] == 'edit') {
                            $pagetitle .= ' ' . _BC_DELIM . ' ' . _EDITUSER;
                            showheader();
                            if (!($memberinfo = getusrdata($_POST['username']))) {
                                echo _NOINFOFOR . ' <strong>' . $_POST['username'] . '</strong>';
                            } else {
                                require 'modules/Your_Account/edit_profile.php';
                                edituser($memberinfo);
                            }
                            showfooter();
                        } else {
                            if ($_POST['mode'] == 'addConf') {
                                if ($CPG_SESS['admin']['page'] != 'users') {
                                    cpg_error(_ERROR_BAD_LINK, _SEC_ERROR);
                                }
                                $username = Fix_Quotes($_POST['username'], 1);
                                $email = Fix_Quotes($_POST['email'], 1);
                                $password = Fix_Quotes($_POST['password'], 1);
                                if ($password != Fix_Quotes($_POST['password_confirm'], 1)) {
Пример #3
0
//
$userdata = session_pagestart($user_ip, PAGE_PROFILE);
init_userprefs($userdata);
//
// End session management
//
//
// Obtain initial var settings
//
if (isset($_GET[POST_USERS_URL]) || isset($_POST[POST_USERS_URL])) {
    $user_id = isset($_POST[POST_USERS_URL]) ? $_POST[POST_USERS_URL] : $_GET[POST_USERS_URL];
} else {
    message_die(GENERAL_MESSAGE, $lang['No_user_id_specified']);
}
$user_id = $user_id == '-1' ? ANONYMOUS : intval($user_id);
$profiledata = getusrdata($user_id);
if ($user_id == ANONYMOUS) {
    $profiledata['user_id'] = ANONYMOUS;
    $profiledata['username'] = $lang['Guest'];
} else {
    $profiledata['user_id'] = intval($profiledata['user_id']);
}
if ($profiledata['user_id'] != $userdata['user_id'] && $userdata['user_level'] != ADMIN) {
    message_die(GENERAL_MESSAGE, $lang['Not_Authorised']);
}
$page_title = $lang['User_acp_title'];
require_once "includes/phpBB/page_header.php";
$start = isset($_GET['start']) ? $_GET['start'] : 0;
if (isset($_POST['order'])) {
    $sort_order = $_POST['order'] == 'ASC' ? 'ASC' : 'DESC';
} else {
Пример #4
0
function DisplayComments($sid, $title, $pid = 0, $tid = 0)
{
    global $userinfo, $MAIN_CFG, $prefix, $db, $bgcolor3, $cpgtpl, $CPG_SESS;
    if (empty($CPG_SESS['comments']['mode'])) {
        $CPG_SESS['comments']['mode'] = 'thread';
    }
    $order =& $CPG_SESS['comments']['order'];
    $thold =& $CPG_SESS['comments']['thold'];
    require_once 'header.php';
    $q = 'SELECT tid, pid, sid, date, name, email, host_name, subject, comment, score, reason FROM ' . $prefix . "_comments WHERE sid='{$sid}' and pid='{$pid}' AND score>=" . ($thold != "" ? "'{$thold}'" : "'0'");
    if ($order == 1) {
        $q .= ' ORDER BY date DESC';
    }
    if ($order == 2) {
        $q .= ' ORDER BY score DESC';
    }
    $something = $db->sql_query($q);
    navbar($sid, $title, $thold, $CPG_SESS['comments']['mode'], $order);
    $moderate = $db->sql_numrows($something) > 0 && (is_admin() && $MAIN_CFG['global']['moderate'] > 0 || $MAIN_CFG['global']['moderate'] == 2 && is_user());
    if ($moderate) {
        $cpgtpl->assign_var('U_MODERATE', URL::index());
    } else {
        $cpgtpl->assign_var('U_MODERATE', false);
    }
    while ($row = $db->sql_fetchrow($something)) {
        $tid = $row['tid'];
        $pid = $row['pid'];
        $sid = $row['sid'];
        $comment = decode_bb_all($row['comment']);
        if ($row['name'] == '') {
            $row['name'] = _ANONYMOUS;
        } else {
            $usrdata = getusrdata($row['name']);
        }
        if ($row['subject'] == '') {
            $row['subject'] = "[" . _NOSUBJECT . "]";
        }
        if ($userinfo['commentmax'] && strlen($comment) > $userinfo['commentmax']) {
            $comment = substr($comment, 0, $userinfo['commentmax']);
            $commext = 1;
        } elseif (strlen($comment) > $MAIN_CFG['global']['commentlimit']) {
            $comment = substr($comment, 0, $MAIN_CFG['global']['commentlimit']);
            $commext = 1;
        }
        if ($pid != 0) {
            list($parentid) = $db->sql_ufetchrow("SELECT pid FROM " . $prefix . "_comments WHERE tid='{$pid}'", SQL_NUM);
        }
        $cpgtpl->assign_block_vars('comment', array('IS_NESTED' => false, 'IS_NESTED_END' => false, 'IS_FIRST' => true, 'IS_FIRST_END' => false, 'IS_LIST' => false, 'I_COMMENTID' => $tid, 'I_SCORE' => $row['score'], 'S_SCORE' => _SCORE, 'S_BGCOLOR3' => $bgcolor3, 'S_SUBJECT' => $row['subject'], 'S_REASON' => $row['reason'] > 0 ? constant('_REASONS_' . $row['reason']) : '', 'S_BYNAME' => _BY . ' ' . $row['name'], 'S_BY' => _BY, 'S_NAME' => $row['name'], 'S_ON' => _ON, 'S_DATE' => formatDateTime($row['date'], _DATESTRING), 'S_IP' => is_admin() ? '(IP: ' . decode_ip($row['host_name']) . ')' : '', 'S_COMMENT' => $comment, 'S_COMMENTEXT' => _READREST, 'S_DELETE' => _DELETE, 'S_REPLY' => _REPLY, 'S_MODERATE' => modtwo($tid, $row['score'], $row['reason']), 'S_PARENT' => _PARENT, 'S_USERINFO' => _USERINFO, 'U_USERINFO' => isset($usrdata) ? URL::index("Your_Account&amp;profile={$usrdata['user_id']}") : '', 'S_USERPM' => _SENDAMSG, 'U_USERPM' => isset($usrdata) && is_active('Private_Messages') ? URL::index("Private_Messages&amp;mode=post&amp;u={$usrdata['user_id']}") : '', 'U_COMMENTEXT' => isset($commentext) ? URL::index("&amp;file=comments&amp;sid={$sid}&amp;tid={$tid}") : '', 'U_DELETE' => is_admin() ? URL::admin("comments&amp;del={$tid}") : '', 'U_PARENT' => $pid != 0 ? URL::index("&amp;comment=0&amp;sid={$sid}&amp;pid={$parentid}") : '', 'U_REPLY' => $MAIN_CFG['global']['anonpost'] || is_user() ? URL::index("&amp;reply={$tid}&amp;sid={$sid}") : ''));
        DisplayKids($tid, $CPG_SESS['comments']['mode'], $order, $thold, 0);
        $cpgtpl->assign_block_vars('comment', array('IS_NESTED' => false, 'IS_NESTED_END' => false, 'IS_FIRST' => false, 'IS_FIRST_END' => true));
    }
    $db->sql_freeresult($something);
    if ($moderate) {
        modthree($sid);
    }
    $cpgtpl->assign_var('S_NOCOMMENTS', false);
    $cpgtpl->assign_var('S_ONECOMMENT', false);
    $cpgtpl->set_filenames(array('comments' => 'news/comments.html'));
    $cpgtpl->display('comments');
}
Пример #5
0
function attachment_quota_settings($admin_mode, $submit = FALSE, $mode)
{
    global $template, $db, $_POST, $_GET, $lang, $group_id, $lang, $phpbb_root_path, $attach_config;
    if (!intval($attach_config['allow_ftp_upload'])) {
        if ($attach_config['upload_dir'][0] == '/' || $attach_config['upload_dir'][0] != '/' && $attach_config['upload_dir'][1] == ':') {
            $upload_dir = $attach_config['upload_dir'];
        } else {
            $upload_dir = $attach_config['upload_dir'];
        }
    } else {
        $upload_dir = $attach_config['download_path'];
    }
    include 'includes/phpBB/attach/functions_selects.php';
    include 'includes/phpBB/attach/functions_admin.php';
    if ($admin_mode == 'user') {
        $submit = isset($_POST['submit']) ? TRUE : FALSE;
        if (!$submit && $mode != 'save') {
            if (isset($_GET[POST_USERS_URL]) || isset($_POST[POST_USERS_URL])) {
                $user_id = isset($_POST[POST_USERS_URL]) ? intval($_POST[POST_USERS_URL]) : intval($_GET[POST_USERS_URL]);
                $this_userdata['user_id'] = $user_id;
                if (empty($user_id)) {
                    message_die(GENERAL_MESSAGE, $lang['No_user_id_specified']);
                }
            } else {
                $u_name = isset($_POST['username']) ? htmlprepare($_POST['username']) : htmlprepare($_GET['username']);
                if (!($this_userdata = getusrdata($u_name))) {
                    message_die(GENERAL_MESSAGE, $lang['No_user_id_specified']);
                }
            }
            $user_id = intval($this_userdata['user_id']);
        } else {
            $user_id = isset($_POST['id']) ? intval($_POST['id']) : intval($_GET['id']);
            if (empty($user_id)) {
                message_die(GENERAL_MESSAGE, $lang['No_user_id_specified']);
            }
        }
    }
    if ($admin_mode == 'user' && !$submit && $mode != 'save') {
        // Show the contents
        $result = $db->sql_query("SELECT quota_limit_id, quota_type FROM " . QUOTA_TABLE . " WHERE user_id = " . $user_id);
        $pm_quota = -1;
        $upload_quota = -1;
        while ($row = $db->sql_fetchrow($result)) {
            if ($row['quota_type'] == QUOTA_UPLOAD_LIMIT) {
                $upload_quota = $row['quota_limit_id'];
            } else {
                if ($row['quota_type'] == QUOTA_PM_LIMIT) {
                    $pm_quota = $row['quota_limit_id'];
                }
            }
        }
        $template->assign_vars(array('S_SELECT_UPLOAD_QUOTA' => quota_limit_select('user_upload_quota', $upload_quota), 'S_SELECT_PM_QUOTA' => quota_limit_select('user_pm_quota', $pm_quota), 'L_UPLOAD_QUOTA' => $lang['Upload_quota'], 'L_PM_QUOTA' => $lang['Pm_quota']));
    }
    if ($admin_mode == 'user' && $submit && $_POST['deleteuser']) {
        process_quota_settings($admin_mode, $user_id, QUOTA_UPLOAD_LIMIT, -1);
        process_quota_settings($admin_mode, $user_id, QUOTA_PM_LIMIT, -1);
    } else {
        if ($admin_mode == 'user' && $submit && $mode == 'save') {
            // Get the contents
            $upload_quota = intval($_POST['user_upload_quota']);
            $pm_quota = intval($_POST['user_pm_quota']);
            if ($upload_quota <= 0) {
                process_quota_settings($admin_mode, $user_id, QUOTA_UPLOAD_LIMIT, -1);
            } else {
                process_quota_settings($admin_mode, $user_id, QUOTA_UPLOAD_LIMIT, $upload_quota);
            }
            if ($pm_quota <= 0) {
                process_quota_settings($admin_mode, $user_id, QUOTA_PM_LIMIT, -1);
            } else {
                process_quota_settings($admin_mode, $user_id, QUOTA_PM_LIMIT, $pm_quota);
            }
        }
    }
    if ($admin_mode == 'group' && $mode == 'newgroup') {
        return;
    } else {
        if ($admin_mode == 'group') {
            // Get group id again, we do not trust phpBB here, Mods may be installed ;)
            if (isset($_POST[POST_GROUPS_URL]) || isset($_GET[POST_GROUPS_URL])) {
                $group_id = isset($_POST[POST_GROUPS_URL]) ? intval($_POST[POST_GROUPS_URL]) : intval($_GET[POST_GROUPS_URL]);
            } else {
                // This should not occur :(
                $group_id = '';
            }
        }
    }
    if ($admin_mode == 'group' && !$submit && isset($_POST['edit'])) {
        // Show the contents
        $result = $db->sql_query("SELECT quota_limit_id, quota_type FROM " . QUOTA_TABLE . " WHERE group_id = " . $group_id);
        $pm_quota = -1;
        $upload_quota = -1;
        while ($row = $db->sql_fetchrow($result)) {
            if ($row['quota_type'] == QUOTA_UPLOAD_LIMIT) {
                $upload_quota = $row['quota_limit_id'];
            } else {
                if ($row['quota_type'] == QUOTA_PM_LIMIT) {
                    $pm_quota = $row['quota_limit_id'];
                }
            }
        }
        $template->assign_vars(array('S_SELECT_UPLOAD_QUOTA' => quota_limit_select('group_upload_quota', $upload_quota), 'S_SELECT_PM_QUOTA' => quota_limit_select('group_pm_quota', $pm_quota), 'L_UPLOAD_QUOTA' => $lang['Upload_quota'], 'L_PM_QUOTA' => $lang['Pm_quota']));
    }
    if ($admin_mode == 'group' && $submit && isset($_POST['group_delete'])) {
        process_quota_settings($admin_mode, $group_id, QUOTA_UPLOAD_LIMIT, -1);
        process_quota_settings($admin_mode, $group_id, QUOTA_PM_LIMIT, -1);
    } else {
        if ($admin_mode == 'group' && $submit) {
            // Get the contents
            $upload_quota = intval($_POST['group_upload_quota']);
            $pm_quota = intval($_POST['group_pm_quota']);
            if ($upload_quota <= 0) {
                process_quota_settings($admin_mode, $group_id, QUOTA_UPLOAD_LIMIT, -1);
            } else {
                process_quota_settings($admin_mode, $group_id, QUOTA_UPLOAD_LIMIT, $upload_quota);
            }
            if ($pm_quota <= 0) {
                process_quota_settings($admin_mode, $group_id, QUOTA_PM_LIMIT, -1);
            } else {
                process_quota_settings($admin_mode, $group_id, QUOTA_PM_LIMIT, $pm_quota);
            }
        }
    }
}
Пример #6
0
function get_userid_by_name($name)
{
    $user = getusrdata(Fix_Quotes($name));
    return $user['user_id'];
}
Пример #7
0
/* Last modification notes:							*/
/*										*/
/*	 $Id: admin_user_ban.php,v 10.0 2010/11/05 00:56:57 djmaze Exp $			*/
/*										*/
/************************************************************************/
if (!defined('ADMIN_PAGES')) {
    exit;
}
//
// Start program
//
if (isset($_POST['submit'])) {
    $user_bansql = $email_bansql = $ip_bansql = '';
    $user_list = array();
    if (!empty($_POST['username'])) {
        $this_userdata = getusrdata($_POST['username']);
        if (!$this_userdata) {
            message_die(GENERAL_MESSAGE, $lang['No_user_id_specified']);
        }
        $user_list[] = $this_userdata['user_id'];
    }
    $ip_list = array();
    if (isset($_POST['ban_ip'])) {
        $ip_list_temp = explode(',', $_POST['ban_ip']);
        for ($i = 0; $i < count($ip_list_temp); $i++) {
            if (preg_match('/^([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})[ ]*\\-[ ]*([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})$/', trim($ip_list_temp[$i]), $ip_range_explode)) {
                //
                // Don't ask about all this, just don't ask ... !
                //
                $ip_1_counter = $ip_range_explode[1];
                $ip_1_end = $ip_range_explode[5];
Пример #8
0
     $message = $lang['Deleted_group'] . '<br /><br />' . sprintf($lang['Click_return_groupsadmin'], '<a href="' . URL::admin("&amp;do=groups") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . URL::admin("forums") . '">', '</a>');
     message_die(GENERAL_MESSAGE, $message);
 } else {
     $group_type = isset($_POST['group_type']) ? intval($_POST['group_type']) : GROUP_OPEN;
     $group_name = isset($_POST['group_name']) ? trim($_POST['group_name']) : '';
     $group_description = isset($_POST['group_description']) ? trim($_POST['group_description']) : '';
     $group_moderator = isset($_POST['username']) ? $_POST['username'] : '';
     $delete_old_moderator = isset($_POST['delete_old_moderator']) ? true : false;
     if ($group_name == '') {
         message_die(GENERAL_MESSAGE, $lang['No_group_name']);
     } else {
         if ($group_moderator == '') {
             message_die(GENERAL_MESSAGE, $lang['No_group_moderator']);
         }
     }
     $this_userdata = getusrdata($group_moderator, true);
     $group_moderator = $this_userdata['user_id'];
     if (!$group_moderator) {
         message_die(GENERAL_MESSAGE, $lang['No_group_moderator']);
     }
     if ($mode == "editgroup") {
         $sql = "SELECT * FROM " . GROUPS_TABLE . "\n\t\t\t\tWHERE group_single_user <> " . TRUE . "\n\t\t\t\tAND group_id = " . $group_id;
         if (!($result = $db->sql_query($sql))) {
             message_die(GENERAL_ERROR, 'Error getting group information', '', __LINE__, __FILE__, $sql);
         }
         if (!($group_info = $db->sql_fetchrow($result))) {
             message_die(GENERAL_MESSAGE, $lang['Group_not_exist']);
         }
         if ($group_info['group_moderator'] != $group_moderator) {
             if ($delete_old_moderator) {
                 $sql = "DELETE FROM " . USER_GROUP_TABLE . "\n\t\t\t\t\t\tWHERE user_id = " . $group_info['group_moderator'] . "\n\t\t\t\t\t\t\tAND group_id = " . $group_id;
Пример #9
0
function userinfo($username)
{
    global $db, $prefix, $user_prefix, $currentlang, $pagetitle, $MAIN_CFG, $CPG_SESS, $CLASS, $cpgtpl;
    $owninfo = is_user() && ($username == is_user() || strtolower($username) == strtolower($CLASS['member']->members[is_user()]['username']));
    if ($owninfo) {
        $userinfo =& $CLASS['member']->members[is_user()];
        global $Blocks;
        $block = array('bid' => 10000, 'view' => 1, 'side' => 'l', 'title' => _TB_BLOCK, 'content' => member_block());
        $Blocks->custom($block);
        $block = NULL;
    } else {
        if (!is_user() && $username != 'Anonymous') {
            URL::redirect(URL::index('&amp;profile=Anonymous'));
        } else {
            if (!($userinfo = getusrdata($username)) || $userinfo['user_level'] < 1) {
                require_once 'header.php';
                OpenTable();
                echo _NOINFOFOR . ' <strong>' . htmlspecialchars($username) . '</strong>';
                if (!$userinfo) {
                    echo '<br /><br /><em>' . _MA_USERNOEXIST . '</em>';
                } elseif ($userinfo['user_level'] == 0) {
                    echo '<br /><br /><em>' . _ACCSUSPENDED . '</em>';
                } elseif ($userinfo['user_level'] == -1) {
                    echo '<br /><br /><em>' . _ACCDELETED . '</em>';
                }
                CloseTable();
                return;
            }
        }
    }
    $username = $userinfo['username'];
    $imgpath = 'themes/' . $CPG_SESS['theme'] . '/images/forums/lang_';
    $imgpath .= file_exists($imgpath . $currentlang . '/icon_email.gif') ? $currentlang : 'english';
    if ($owninfo) {
        $pagetitle .= ' ' . _BC_DELIM . ' ' . $username . ', ' . _THISISYOURPAGE;
    } else {
        $pagetitle .= ' ' . _BC_DELIM . ' ' . _PERSONALINFO . ' ' . _BC_DELIM . ' ' . $username;
    }
    require_once 'header.php';
    require_once CORE_PATH . 'nbbcode.php';
    if ($userinfo['user_avatar_type'] == 1) {
        $avatar = $MAIN_CFG['avatar']['path'] . '/' . $userinfo['user_avatar'];
    } else {
        if ($userinfo['user_avatar_type'] == 2) {
            $avatar = $userinfo['user_avatar'];
        } else {
            if ($userinfo['user_avatar_type'] == 3 && !empty($userinfo['user_avatar'])) {
                $avatar = $MAIN_CFG['avatar']['gallery_path'] . '/' . $userinfo['user_avatar'];
            } else {
                $avatar = $MAIN_CFG['avatar']['gallery_path'] . '/' . $MAIN_CFG['avatar']['default'];
            }
        }
    }
    if ($avatar) {
        $avatar = '<img src="' . $avatar . '" alt="" />';
    }
    if ($userinfo['user_website']) {
        if (false === strpos($userinfo['user_website'], '://')) {
            $userinfo['user_website'] = "http://{$userinfo['user_website']}";
        }
    }
    if (!preg_match('#^(http[s]?\\:\\/\\/)?([a-z0-9\\-\\.]+)?[a-z0-9\\-]+\\.[a-z]{2,4}$#i', $userinfo['user_website'])) {
        $userinfo['user_website'] = '';
    }
    if ($userinfo['user_rank']) {
        $sql = 'rank_id = ' . $userinfo['user_rank'] . ' AND rank_special = 1';
    } else {
        $sql = 'rank_min <= ' . intval($userinfo['user_posts']) . ' AND rank_special = 0 ORDER BY rank_min DESC';
    }
    list($poster_rank, $rank_image) = $db->sql_ufetchrow('SELECT rank_title, rank_image FROM ' . $prefix . '_bbranks WHERE ' . $sql, SQL_NUM);
    $poster_rank = $rank_image ? '<img src="' . $rank_image . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" />' : $poster_rank;
    if (can_admin('members') || $owninfo) {
        $result = $db->sql_query("SELECT field, langdef, type FROM " . $user_prefix . "_users_fields WHERE section = 2 OR section = 3");
    } else {
        $result = $db->sql_query("SELECT field, langdef, type FROM " . $user_prefix . "_users_fields WHERE section = 2");
    }
    if ($db->sql_numrows($result) > 0) {
        while ($row = $db->sql_fetchrow($result)) {
            if ($row['type'] == 1) {
                $value = $userinfo[$row['field']] ? _YES : _NO;
            } else {
                $value = $userinfo[$row['field']];
            }
            if (defined($row['langdef'])) {
                $row['langdef'] = constant($row['langdef']);
            }
            $cpgtpl->assign_block_vars('custom_field', array('NAME' => $row['langdef'], 'VALUE' => $value));
        }
    }
    $blog_url = 0;
    if (is_active('Blogs')) {
        list($num_blogs) = $db->sql_ufetchrow("SELECT COUNT(*) FROM " . $prefix . "_blogs \n\t\tWHERE aid='{$username}' AND private=0");
        if ($num_blogs > 0) {
            $blog_url = 1;
        }
    }
    $show_email = 0;
    if ($userinfo['user_viewemail'] && is_user() || $owninfo || is_admin() && !$CLASS['member']->demo) {
        $email = $userinfo['user_email'];
    } else {
        if ($userinfo['femail']) {
            $email = $userinfo['femail'];
        }
    }
    if (isset($email) && Security::check_email($email)) {
        $email = 'mailto:' . $email;
        if (!$owninfo && is_user()) {
            define('IN_PHPBB', true);
            define('PHPBB_INSTALLED', true);
            $phpbb_root_path = "./modules/Forums/";
            require_once $phpbb_root_path . 'common.php';
            global $board_config;
            if ($board_config['board_email_form']) {
                $email = URL::index('Forums&amp;file=profile&amp;mode=email&amp;u=' . $userinfo['user_id']);
            }
        }
        $show_email = 1;
    }
    $show_pm = 0;
    if (!$owninfo && is_user() && is_active('Private_Messages')) {
        $show_pm = 1;
    }
    $show_gallery = 0;
    if (is_active('coppermine')) {
        $user_gallery = 10000 + $userinfo['user_id'];
        $ugall_result = $db->sql_query("SELECT p.pid FROM " . $prefix . "_cpg_pictures AS p, " . $prefix . "_cpg_albums AS a WHERE a.aid = p.aid AND a.category = {$user_gallery}");
        if ($db->sql_numrows($ugall_result) > 0) {
            $show_gallery = 1;
        }
    }
    $cpgtpl->assign_vars(array('ABOUT_USER' => _ABOUT_USER . $username, 'AVATAR' => $avatar, 'JOINED_DATE' => formatDateTime($userinfo['user_regdate'], _DATESTRING3), 'USER_RANK' => $poster_rank, 'USER_LOCATION' => decode_bb_all($userinfo['user_from']), 'USER_WEBSITE' => $userinfo['user_website'], 'USER_OCCUPATION' => decode_bb_all($userinfo['user_occ']), 'USER_INTERESTS' => decode_bb_all($userinfo['user_interests']), 'USER_SIGNATURE' => $userinfo['user_sig'] ? decode_bb_all($userinfo['user_sig'], 1, false) : false, 'USER_EXTRA_INFO' => $userinfo['bio'] ? decode_bb_all($userinfo['bio'], 1, false) : false, 'BLOG_URL' => $blog_url ? URL::index('Blogs&amp;mode=user&amp;nick=' . $username) : false, 'EMAIL_ADDRESS' => $show_email ? $email : false, 'IMG_PATH' => $imgpath, 'U_PM' => $show_pm ? URL::index("Private_Messages&amp;mode=post&amp;u={$userinfo['user_id']}") : false, 'USER_MSNM' => $userinfo['user_msnm'], 'USER_YIM' => $userinfo['user_yim'], 'USER_AIM' => $userinfo['user_aim'], 'USER_ICQ' => $userinfo['user_icq'], 'USER_SKYPE' => $userinfo['user_skype'], 'USER_GALLERY' => $show_gallery ? URL::index('coppermine&amp;cat=' . (10000 + $userinfo['user_id'])) : false, 'OWN_OR_CAN_ADMIN' => $owninfo || can_admin('members'), 'OWN_INFO' => $owninfo, 'SUBSCRIBED' => $userinfo['newsletter'], 'CAN_ADMIN_MEMBERS' => can_admin('members'), 'U_EDIT_USER' => URL::admin('users&amp;mode=edit&amp;edit=profile&amp;id=' . $userinfo['user_id']), 'U_SUSPEND_USER' => URL::admin('users&amp;mode=edit&amp;edit=admin&amp;id=' . $userinfo['user_id']), 'HEADLINES_ALLOWED' => $owninfo && $MAIN_CFG['member']['my_headlines'], 'URL_URI' => URL::uri(), 'SHOW_RSS' => false));
    if ($owninfo && $MAIN_CFG['member']['my_headlines']) {
        $hid = isset($_POST['hid']) ? intval($_POST['hid']) : 0;
        $url = isset($_POST['url']) ? $_POST['url'] : '';
        $sql4 = 'SELECT hid, sitename FROM ' . $prefix . '_headlines ORDER BY sitename';
        $headl = $db->sql_query($sql4);
        while (list($nhid, $hsitename) = $db->sql_fetchrow($headl)) {
            $sel = $hid == $nhid ? ' selected="selected"' : '';
            $cpgtpl->assign_block_vars('feed_option', array('VALUE' => $nhid, 'SELECTED' => $sel, 'NAME' => $hsitename));
        }
        if ($hid > 0 || $hid == 0 && strlen($url) > 10) {
            if ($hid > 0) {
                $sql5 = 'SELECT sitename, headlinesurl FROM ' . $prefix . "_headlines WHERE hid='{$hid}'";
                $result5 = $db->sql_query($sql5);
                list($title, $url) = $db->sql_fetchrow($result5);
                $siteurl = str_ireplace('http://', '', $url);
                $siteurl = explode('/', $siteurl);
            } else {
                if (false === strpos($url, '://')) {
                    $url = 'http://' . $url;
                }
                $siteurl = str_ireplace('http://', '', $url);
                $siteurl = explode('/', $siteurl);
                $title = 'http://' . $siteurl[0];
            }
            include_once CORE_PATH . 'classes/rss.php';
            $content = CPG_RSS::display($url);
            $cpgtpl->assign_vars(array('SHOW_RSS' => true, 'RSS_CONTENT' => $content, 'RSS_URL' => $siteurl[0], 'RSS_TITLE' => $title));
        }
    }
    $cpgtpl->set_handle('userinfo', 'your_account/userinfo.html');
    $cpgtpl->display('userinfo');
    $blocksdir = dir('modules/Your_Account/blocks');
    while ($func = $blocksdir->read()) {
        if (substr($func, -3) == 'php') {
            $blockslist[] = $func;
        }
    }
    closedir($blocksdir->handle);
    natcasesort($blockslist);
    for ($i = 0; $i < sizeof($blockslist); $i++) {
        require_once 'modules/Your_Account/blocks/' . $blockslist[$i];
    }
}
Пример #10
0
 $blog_text = decode_bb_all($blog_text, 1);
 $blog_timestamp = formatDateTime($blog_timestamp, _DATESTRING);
 echo '<table border="0" cellpadding="3" cellspacing="1" width="100%" class="forumline">
 <tr><td class="row1" colspan="2"><a href="' . getlink() . '">' . _MAIN . '</a> | ' . (is_user() ? '<a href="' . getlink('&amp;mode=user&amp;nick=' . $userinfo['username']) . '">' . _B_MYBLOG . '</a> | ' : '') . '<a href="' . getlink('&amp;mode=add') . '">' . _B_CREATE_TITLE . '</a></td></tr>
 <tr><td class="catleft" colspan="2" align="center"><b><span class="gen">' . $blog_title . '</span></b></td></tr>
 <tr><td class="row1" colspan="2" align="center">' . $blog_timestamp . '</td></tr>
 <tr><td class="row1" colspan="2"><span class="gen">' . $blog_text . '</span></td></tr>
 </table><br /><table border="0" cellpadding="3" cellspacing="1" width="100%" class="forumline">
 <tr><td class="row1" colspan="2" align="center">' . ($_GET['comments'] == 'show' ? '<a href="' . getlink('&amp;mode=display&amp;id=' . $blog_id) . '">' . _B_COMMENTS_HIDE . '</a>' : '<a href="' . getlink('&amp;mode=display&amp;id=' . $blog_id . '&amp;comments=show') . '">' . _B_COMMENTS . ' (' . $blog_comments . ')</a>') . ' | <a href="' . getlink('Your_Account&amp;op=userinfo&amp;username='******'">' . $blog_author . '\'s ' . _B_PROFILE . '</a>' . ($blog_author == $userinfo['username'] || is_admin() ? ' | <a href="' . getlink('&amp;mode=edit&amp;id=' . $blog_id) . '">' . _B_EDIT_TITLE . '</a>' : '') . ($blog_author == $userinfo['username'] || is_admin() ? ' | <a href="' . getlink('&amp;mode=remove&amp;type=blog&amp;id=' . $blog_id) . '">' . _B_REMOVE_BLOG . '</a>' : '') . '</td></tr>
 </table>';
 if ($_GET['comments'] == 'show') {
     echo '<br /><table border="0" cellpadding="3" cellspacing="1" width="100%" class="forumline">
     <tr><td class="catleft" colspan="2" align="center"><b><span class="gen">' . _B_COMMENTS . '</span></b></td></tr>';
     while (list($comment_id, $comment_blog, $comment_author, $comment_email, $comment_ip, $comment_text, $comment_timestamp) = $db->sql_fetchrow($result)) {
         $comment_ip = decode_ip($comment_ip);
         $info = getusrdata($comment_author, 'user_viewemail');
         if (!empty($comment_email)) {
             $usrlink = $info['user_viewemail'] ? 'mailto:' . $comment_email : getlink('Blogs&amp;mode=user&amp;nick=' . $comment_author);
         } else {
             $usrlink = getlink('Your_Account&amp;profile=' . $comment_author);
         }
         echo '<tr><td class="row1" colspan="2"><span class="gen">' . set_smilies($comment_text) . '</span></td></tr>
         <tr><td class="row1" align="left">' . _POSTEDBY . ' <a href="' . $usrlink . '">' . $comment_author . '</a> | ' . formatDateTime($comment_timestamp, _DATESTRING) . '</td>';
         if (is_admin()) {
             echo '<td class="row2" align="right">IP: <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=' . $comment_ip . '" target="ResourceWindow">' . $comment_ip . '</a> | <a href="' . getlink('&amp;mode=remove&amp;type=comment&amp;id=' . $comment_id) . '">' . _B_REMOVE . '</a></td>';
         }
         echo '</tr></table><br /><table border="0" cellpadding="3" cellspacing="1" width="100%" class="forumline">';
     }
     if ($db->sql_numrows($result) < 1) {
         echo '<tr><td class="row1" colspan="2" align="center"><span class="gen">' . _B_COMMENTS_NONEYET . '</span></td></tr>';
     }