function print_theme_selectbox($theme_list, $selected_theme, $type)
{
    if (!is_array($theme_list) || count($theme_list) == 0) {
        return;
    }
    ?>
	<div class="row">
		<label for="<?php 
    if ($type == DESKTOP_DEVICE) {
        echo "theme";
    } else {
        echo "mobile_theme";
    }
    ?>
"><?php 
    if ($type == DESKTOP_DEVICE) {
        echo _AT('desktop_theme');
    } else {
        echo _AT('mobile_theme');
    }
    ?>
</label><br />
		<select name="<?php 
    if ($type == DESKTOP_DEVICE) {
        echo "theme";
    } else {
        echo "mobile_theme";
    }
    ?>
" id="<?php 
    if ($type == DESKTOP_DEVICE) {
        echo "theme";
    } else {
        echo "mobile_theme";
    }
    ?>
"><?php 
    foreach ($theme_list as $theme_id => $theme) {
        if (!$theme) {
            continue;
        }
        $theme_fldr = get_folder($theme);
        if ($theme_fldr == $selected_theme) {
            echo '<option value="' . $theme_fldr . '" selected="selected">' . $theme . '</option>';
        } else {
            echo '<option value="' . $theme_fldr . '">' . $theme . '</option>';
        }
    }
    ?>
		</select>
	</div>
<?php 
}
Example #2
0
    function main($id, $mode)
    {
        global $user, $template, $phpbb_root_path, $auth, $phpEx, $db, $config;
        if (!$user->data['is_registered']) {
            trigger_error('NO_MESSAGE');
        }
        // Is PM disabled?
        if (!$config['allow_privmsg']) {
            trigger_error('PM_DISABLED');
        }
        $user->add_lang('posting');
        $template->assign_var('S_PRIVMSGS', true);
        // Folder directly specified?
        $folder_specified = request_var('folder', '');
        if (!in_array($folder_specified, array('inbox', 'outbox', 'sentbox'))) {
            $folder_specified = (int) $folder_specified;
        } else {
            $folder_specified = $folder_specified == 'inbox' ? PRIVMSGS_INBOX : ($folder_specified == 'outbox' ? PRIVMSGS_OUTBOX : PRIVMSGS_SENTBOX);
        }
        if (!$folder_specified) {
            $mode = !$mode ? request_var('mode', 'view') : $mode;
        } else {
            $mode = 'view';
        }
        include $phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx;
        switch ($mode) {
            // New private messages popup
            case 'popup':
                $l_new_message = '';
                if ($user->data['is_registered']) {
                    if ($user->data['user_new_privmsg']) {
                        $l_new_message = $user->data['user_new_privmsg'] == 1 ? $user->lang['YOU_NEW_PM'] : $user->lang['YOU_NEW_PMS'];
                    } else {
                        $l_new_message = $user->lang['YOU_NO_NEW_PM'];
                    }
                }
                $template->assign_vars(array('MESSAGE' => $l_new_message, 'S_NOT_LOGGED_IN' => $user->data['user_id'] == ANONYMOUS ? true : false, 'CLICK_TO_VIEW' => sprintf($user->lang['CLICK_VIEW_PRIVMSG'], '<a href="' . append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm&amp;folder=inbox') . '" onclick="jump_to_inbox(this.href); return false;">', '</a>'), 'U_INBOX' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm&amp;folder=inbox'), 'UA_INBOX' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm&folder=inbox', false)));
                $tpl_file = 'ucp_pm_popup';
                break;
                // Compose message
            // Compose message
            case 'compose':
                $action = request_var('action', 'post');
                get_folder($user->data['user_id']);
                if (!$auth->acl_get('u_sendpm')) {
                    // trigger_error('NO_AUTH_SEND_MESSAGE');
                    $template->assign_vars(array('S_NO_AUTH_SEND_MESSAGE' => true, 'S_COMPOSE_PM_VIEW' => true));
                    $tpl_file = 'ucp_pm_viewfolder';
                    break;
                }
                include $phpbb_root_path . 'includes/ucp/ucp_pm_compose.' . $phpEx;
                compose_pm($id, $mode, $action);
                $tpl_file = 'posting_body';
                break;
            case 'options':
                set_user_message_limit();
                get_folder($user->data['user_id']);
                include $phpbb_root_path . 'includes/ucp/ucp_pm_options.' . $phpEx;
                message_options($id, $mode, $global_privmsgs_rules, $global_rule_conditions);
                $tpl_file = 'ucp_pm_options';
                break;
            case 'drafts':
                get_folder($user->data['user_id']);
                $this->p_name = 'pm';
                // Call another module... please do not try this at home... Hoochie Coochie Man
                include $phpbb_root_path . 'includes/ucp/ucp_main.' . $phpEx;
                $module = new ucp_main($this);
                $module->u_action = $this->u_action;
                $module->main($id, $mode);
                $this->tpl_name = $module->tpl_name;
                $this->page_title = 'UCP_PM_DRAFTS';
                unset($module);
                return;
                break;
            case 'view':
                set_user_message_limit();
                if ($folder_specified) {
                    $folder_id = $folder_specified;
                    $action = 'view_folder';
                } else {
                    $folder_id = request_var('f', PRIVMSGS_NO_BOX);
                    $action = request_var('action', 'view_folder');
                }
                $msg_id = request_var('p', 0);
                $view = request_var('view', '');
                // View message if specified
                if ($msg_id) {
                    $action = 'view_message';
                }
                if (!$auth->acl_get('u_readpm')) {
                    trigger_error('NO_AUTH_READ_MESSAGE');
                }
                // Do not allow hold messages to be seen
                if ($folder_id == PRIVMSGS_HOLD_BOX) {
                    trigger_error('NO_AUTH_READ_HOLD_MESSAGE');
                }
                // First Handle Mark actions and moving messages
                $submit_mark = isset($_POST['submit_mark']) ? true : false;
                $move_pm = isset($_POST['move_pm']) ? true : false;
                $mark_option = request_var('mark_option', '');
                $dest_folder = request_var('dest_folder', PRIVMSGS_NO_BOX);
                // Is moving PM triggered through mark options?
                if (!in_array($mark_option, array('mark_important', 'delete_marked')) && $submit_mark) {
                    $move_pm = true;
                    $dest_folder = (int) $mark_option;
                    $submit_mark = false;
                }
                // Move PM
                if ($move_pm) {
                    $move_msg_ids = isset($_POST['marked_msg_id']) ? request_var('marked_msg_id', array(0)) : array();
                    $cur_folder_id = request_var('cur_folder_id', PRIVMSGS_NO_BOX);
                    if (move_pm($user->data['user_id'], $user->data['message_limit'], $move_msg_ids, $dest_folder, $cur_folder_id)) {
                        // Return to folder view if single message moved
                        if ($action == 'view_message') {
                            $msg_id = 0;
                            $folder_id = request_var('cur_folder_id', PRIVMSGS_NO_BOX);
                            $action = 'view_folder';
                        }
                    }
                }
                // Message Mark Options
                if ($submit_mark) {
                    handle_mark_actions($user->data['user_id'], $mark_option);
                }
                // If new messages arrived, place them into the appropriate folder
                $num_not_moved = $num_removed = 0;
                $release = request_var('release', 0);
                if ($user->data['user_new_privmsg'] && $action == 'view_folder') {
                    $return = place_pm_into_folder($global_privmsgs_rules, $release);
                    $num_not_moved = $return['not_moved'];
                    $num_removed = $return['removed'];
                }
                if (!$msg_id && $folder_id == PRIVMSGS_NO_BOX) {
                    $folder_id = PRIVMSGS_INBOX;
                } else {
                    if ($msg_id && $folder_id == PRIVMSGS_NO_BOX) {
                        $sql = 'SELECT folder_id
						FROM ' . PRIVMSGS_TO_TABLE . "\n\t\t\t\t\t\tWHERE msg_id = {$msg_id}\n\t\t\t\t\t\t\tAND folder_id <> " . PRIVMSGS_NO_BOX . '
							AND user_id = ' . $user->data['user_id'];
                        $result = $db->sql_query($sql);
                        $row = $db->sql_fetchrow($result);
                        $db->sql_freeresult($result);
                        if (!$row) {
                            trigger_error('NO_MESSAGE');
                        }
                        $folder_id = (int) $row['folder_id'];
                    }
                }
                $message_row = array();
                if ($action == 'view_message' && $msg_id) {
                    // Get Message user want to see
                    if ($view == 'next' || $view == 'previous') {
                        $sql_condition = $view == 'next' ? '>' : '<';
                        $sql_ordering = $view == 'next' ? 'ASC' : 'DESC';
                        $sql = 'SELECT t.msg_id
							FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . PRIVMSGS_TABLE . " p2\n\t\t\t\t\t\t\tWHERE p2.msg_id = {$msg_id}\n\t\t\t\t\t\t\t\tAND t.folder_id = {$folder_id}\n\t\t\t\t\t\t\t\tAND t.user_id = " . $user->data['user_id'] . "\n\t\t\t\t\t\t\t\tAND t.msg_id = p.msg_id\n\t\t\t\t\t\t\t\tAND p.message_time {$sql_condition} p2.message_time\n\t\t\t\t\t\t\tORDER BY p.message_time {$sql_ordering}";
                        $result = $db->sql_query_limit($sql, 1);
                        $row = $db->sql_fetchrow($result);
                        $db->sql_freeresult($result);
                        if (!$row) {
                            $message = $view == 'next' ? 'NO_NEWER_PM' : 'NO_OLDER_PM';
                            trigger_error($message);
                        } else {
                            $msg_id = $row['msg_id'];
                        }
                    }
                    $sql = 'SELECT t.*, p.*, u.*
						FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . ' u
						WHERE t.user_id = ' . $user->data['user_id'] . "\n\t\t\t\t\t\t\tAND p.author_id = u.user_id\n\t\t\t\t\t\t\tAND t.folder_id = {$folder_id}\n\t\t\t\t\t\t\tAND t.msg_id = p.msg_id\n\t\t\t\t\t\t\tAND p.msg_id = {$msg_id}";
                    $result = $db->sql_query($sql);
                    $message_row = $db->sql_fetchrow($result);
                    $db->sql_freeresult($result);
                    if (!$message_row) {
                        trigger_error('NO_MESSAGE');
                    }
                    // Update unread status
                    update_unread_status($message_row['pm_unread'], $message_row['msg_id'], $user->data['user_id'], $folder_id);
                }
                $folder = get_folder($user->data['user_id'], $folder_id);
                $s_folder_options = $s_to_folder_options = '';
                foreach ($folder as $f_id => $folder_ary) {
                    $option = '<option' . (!in_array($f_id, array(PRIVMSGS_INBOX, PRIVMSGS_OUTBOX, PRIVMSGS_SENTBOX)) ? ' class="sep"' : '') . ' value="' . $f_id . '"' . ($f_id == $folder_id ? ' selected="selected"' : '') . '>' . $folder_ary['folder_name'] . ($folder_ary['unread_messages'] ? ' [' . $folder_ary['unread_messages'] . '] ' : '') . '</option>';
                    $s_to_folder_options .= $f_id != PRIVMSGS_OUTBOX && $f_id != PRIVMSGS_SENTBOX ? $option : '';
                    $s_folder_options .= $option;
                }
                clean_sentbox($folder[PRIVMSGS_SENTBOX]['num_messages']);
                // Header for message view - folder and so on
                $folder_status = get_folder_status($folder_id, $folder);
                $template->assign_vars(array('CUR_FOLDER_ID' => $folder_id, 'CUR_FOLDER_NAME' => $folder_status['folder_name'], 'NUM_NOT_MOVED' => $num_not_moved, 'NUM_REMOVED' => $num_removed, 'RELEASE_MESSAGE_INFO' => sprintf($user->lang['RELEASE_MESSAGES'], '<a href="' . $this->u_action . '&amp;folder=' . $folder_id . '&amp;release=1">', '</a>'), 'NOT_MOVED_MESSAGES' => $num_not_moved == 1 ? $user->lang['NOT_MOVED_MESSAGE'] : sprintf($user->lang['NOT_MOVED_MESSAGES'], $num_not_moved), 'RULE_REMOVED_MESSAGES' => $num_removed == 1 ? $user->lang['RULE_REMOVED_MESSAGE'] : sprintf($user->lang['RULE_REMOVED_MESSAGES'], $num_removed), 'S_FOLDER_OPTIONS' => $s_folder_options, 'S_TO_FOLDER_OPTIONS' => $s_to_folder_options, 'S_FOLDER_ACTION' => $this->u_action . '&amp;action=view_folder', 'S_PM_ACTION' => $this->u_action . '&amp;action=' . $action, 'U_INBOX' => $this->u_action . '&amp;folder=inbox', 'U_OUTBOX' => $this->u_action . '&amp;folder=outbox', 'U_SENTBOX' => $this->u_action . '&amp;folder=sentbox', 'U_CREATE_FOLDER' => $this->u_action . '&amp;mode=options', 'U_CURRENT_FOLDER' => $this->u_action . '&amp;folder=' . $folder_id, 'S_IN_INBOX' => $folder_id == PRIVMSGS_INBOX ? true : false, 'S_IN_OUTBOX' => $folder_id == PRIVMSGS_OUTBOX ? true : false, 'S_IN_SENTBOX' => $folder_id == PRIVMSGS_SENTBOX ? true : false, 'FOLDER_STATUS' => $folder_status['message'], 'FOLDER_MAX_MESSAGES' => $folder_status['max'], 'FOLDER_CUR_MESSAGES' => $folder_status['cur'], 'FOLDER_REMAINING_MESSAGES' => $folder_status['remaining'], 'FOLDER_PERCENT' => $folder_status['percent']));
                if ($action == 'view_folder') {
                    include $phpbb_root_path . 'includes/ucp/ucp_pm_viewfolder.' . $phpEx;
                    view_folder($id, $mode, $folder_id, $folder);
                    $tpl_file = 'ucp_pm_viewfolder';
                } else {
                    if ($action == 'view_message') {
                        $template->assign_vars(array('S_VIEW_MESSAGE' => true, 'MSG_ID' => $msg_id));
                        if (!$msg_id) {
                            trigger_error('NO_MESSAGE');
                        }
                        include $phpbb_root_path . 'includes/ucp/ucp_pm_viewmessage.' . $phpEx;
                        view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row);
                        $tpl_file = $view == 'print' ? 'ucp_pm_viewmessage_print' : 'ucp_pm_viewmessage';
                    }
                }
                break;
            default:
                trigger_error('NO_ACTION_MODE', E_USER_ERROR);
                break;
        }
        $template->assign_vars(array('L_TITLE' => $user->lang['UCP_PM_' . strtoupper($mode)], 'S_UCP_ACTION' => $this->u_action . (isset($action) ? "&amp;action={$action}" : '')));
        // Set desired template
        $this->tpl_name = $tpl_file;
        $this->page_title = 'UCP_PM_' . strtoupper($mode);
    }
Example #3
0
            }
            $sql = 'SELECT t.*, p.*, u.*
				FROM ' . FORUMS_PRIVMSGS_TO_TABLE . ' t, ' . FORUMS_PRIVMSGS_TABLE . ' p, ' . CORE_USERS_TABLE . ' u
				WHERE t.user_id = ' . $_CLASS['core_user']->data['user_id'] . "\n\t\t\t\t\tAND p.author_id = u.user_id\n\t\t\t\t\tAND t.folder_id = {$folder_id}\n\t\t\t\t\tAND t.msg_id = p.msg_id\n\t\t\t\t\tAND p.msg_id = {$msg_id}";
            $result = $_CLASS['core_db']->query_limit($sql, 1);
            $message_row = $_CLASS['core_db']->fetch_row_assoc($result);
            $_CLASS['core_db']->free_result($result);
            if (!$message_row) {
                trigger_error('NO_MESSAGE');
            }
            // Update unread status
            if ($message_row['pm_unread']) {
                set_read_status(true, $message_row['msg_id'], $_CLASS['core_user']->data['user_id'], $folder_id);
            }
        }
        $folder = get_folder($_CLASS['core_user']->data['user_id'], $folder_id);
        $s_folder_options = $s_to_folder_options = '';
        foreach ($folder as $f_id => $folder_ary) {
            $option = '<option' . (!in_array($f_id, array(PRIVMSGS_INBOX, PRIVMSGS_OUTBOX, PRIVMSGS_SENTBOX)) ? ' class="blue"' : '') . ' value="' . $f_id . '"' . ($f_id == $folder_id ? ' selected="selected"' : '') . '>' . $folder_ary['folder_name'] . ($folder_ary['unread_messages'] ? ' [' . $folder_ary['unread_messages'] . '] ' : '') . '</option>';
            $s_to_folder_options .= $f_id != PRIVMSGS_OUTBOX && $f_id != PRIVMSGS_SENTBOX ? $option : '';
            $s_folder_options .= $option;
        }
        clean_sentbox($folder[PRIVMSGS_SENTBOX]['num_messages']);
        // Header for message view - folder and so on
        $folder_status = get_folder_status($folder_id, $folder);
        $_CLASS['core_template']->assign_array(array('CUR_FOLDER_ID' => $folder_id, 'CUR_FOLDER_NAME' => $folder_status['folder_name'], 'NUM_NOT_MOVED' => $num_not_moved, 'RELEASE_MESSAGE_INFO' => sprintf($_CLASS['core_user']->lang['RELEASE_MESSAGES'], '<a href="' . generate_link($this->link_parent . '&amp;folder=' . $folder_id . '&amp;release=1') . '">', '</a>'), 'NOT_MOVED_MESSAGES' => $num_not_moved == 1 ? $_CLASS['core_user']->lang['NOT_MOVED_MESSAGE'] : sprintf($_CLASS['core_user']->lang['NOT_MOVED_MESSAGES'], $num_not_moved), 'S_FOLDER_OPTIONS' => $s_folder_options, 'S_TO_FOLDER_OPTIONS' => $s_to_folder_options, 'S_FOLDER_ACTION' => generate_link($this->link_parent . '&amp;mode=view&amp;action=view_folder'), 'S_PM_ACTION' => generate_link($this->link_parent . '&amp;mode=$mode&amp;action=' . $action), 'U_INBOX' => generate_link($this->link_parent . '&amp;folder=inbox'), 'U_OUTBOX' => generate_link($this->link_parent . '&amp;folder=outbox'), 'U_SENTBOX' => generate_link($this->link_parent . '&amp;folder=sentbox'), 'U_CREATE_FOLDER' => generate_link($this->link_parent . '&amp;mode=options'), 'S_IN_INBOX' => $folder_id == PRIVMSGS_INBOX, 'S_IN_OUTBOX' => $folder_id == PRIVMSGS_OUTBOX, 'S_IN_SENTBOX' => $folder_id == PRIVMSGS_SENTBOX, 'FOLDER_STATUS' => $folder_status['message'], 'FOLDER_MAX_MESSAGES' => $folder_status['max'], 'FOLDER_CUR_MESSAGES' => $folder_status['cur'], 'FOLDER_REMAINING_MESSAGES' => $folder_status['remaining'], 'FOLDER_PERCENT' => $folder_status['percent']));
        $_CLASS['core_template']->assign('S_VIEW_MESSAGE', false);
        if ($action === 'view_folder') {
            require SITE_FILE_ROOT . 'modules/control_panel/modules/ucp_pm_viewfolder.php';
            view_folder($this, $folder_id, $folder, $mode === 'unread' ? 'unread' : 'folder');
            $_CLASS['core_display']->display(false, 'modules/control_panel/ucp_pm_viewfolder.html');
Example #4
0
	</div>

<?php 
if (defined('AT_ENABLE_CATEGORY_THEMES') && AT_ENABLE_CATEGORY_THEMES) {
    ?>
	<div class="row">
		<label for="category_theme"><?php 
    echo _AT('cat_theme');
    ?>
</label><br />
		<select name="cat_theme" id="category_theme"><?php 
    echo '<option value="0">&nbsp;&nbsp;&nbsp;[ ' . _AT('cats_none') . ' ]&nbsp;&nbsp;&nbsp;</option>';
    $_themes = get_enabled_themes();
    foreach ($_themes as $theme) {
        $theme = trim($theme);
        $theme_dir = get_folder($theme);
        if ($theme_dir == $categories[$cat_id]['theme']) {
            echo '<option value="' . $theme_dir . '" selected="selected">' . $theme . '</option>';
        } else {
            echo '<option value="' . $theme_dir . '">' . $theme . '</option>';
        }
    }
    ?>
</select>
			<?php 
    if ($cat_id && is_array($categories[$cat_id]['children']) && count($categories[$cat_id]['children'])) {
        ?>
				<br />
				<input type="checkbox" name="theme_children" id="theme_children" value="1" /><label for="theme_children"><?php 
        echo _AT('apply_theme_subcategories');
        ?>
Example #5
0
    function ucp_pm($id, $mode)
    {
        global $_CLASS, $site_file_root, $config;
        $action = '';
        if ($_CLASS['core_user']->data['user_id'] == ANONYMOUS) {
            trigger_error('NO_MESSAGE');
        }
        // Is PM disabled?
        if (!$config['allow_privmsg']) {
            trigger_error('PM_DISABLED');
        }
        // This is loaded 2x with drafts
        $_CLASS['core_user']->add_lang('posting', 'Forums');
        $_CLASS['core_template']->assign('S_PRIVMSGS', true);
        // Folder directly specified?
        $folder_specified = request_var('folder', '');
        if (!in_array($folder_specified, array('inbox', 'outbox', 'sentbox'))) {
            $folder_specified = (int) $folder_specified;
        } else {
            $folder_specified = $folder_specified == 'inbox' ? PRIVMSGS_INBOX : ($folder_specified == 'outbox' ? PRIVMSGS_OUTBOX : PRIVMSGS_SENTBOX);
        }
        if (!$folder_specified) {
            $mode = !$mode ? request_var('mode', 'view_messages') : $mode;
        } else {
            $mode = 'view_messages';
        }
        require $site_file_root . 'includes/forums/functions_privmsgs.php';
        $tpl_file = 'ucp_pm_' . $mode . '.html';
        switch ($mode) {
            // New private messages popup
            case 'popup':
                $indox_link = generate_link('Control_Panel&amp;i=pm&amp;folder=inbox');
                if ($_CLASS['core_user']->data['user_id'] != ANONYMOUS) {
                    if ($_CLASS['core_user']->data['user_new_privmsg']) {
                        $l_new_message = $_CLASS['core_user']->data['user_new_privmsg'] == 1 ? $_CLASS['core_user']->lang['YOU_NEW_PM'] : $_CLASS['core_user']->lang['YOU_NEW_PMS'];
                    } else {
                        $l_new_message = $_CLASS['core_user']->lang['YOU_NO_NEW_PM'];
                    }
                }
                $_CLASS['core_template']->assign(array('MESSAGE' => $l_new_message, 'U_JS_RETURN_INBOX' => $indox_link, 'S_NOT_LOGGED_IN' => $_CLASS['core_user']->data['user_id'] == ANONYMOUS ? true : false, 'CLICK_TO_VIEW' => sprintf($_CLASS['core_user']->lang['CLICK_VIEW_PRIVMSG'], '<a href="' . $indox_link . '" onclick="jump_to_inbox();return false;" target="_new">', '</a>'), 'U_INBOX' => $indox_link));
                break;
                // Compose message
            // Compose message
            case 'compose':
                $action = request_var('action', 'post');
                get_folder($_CLASS['core_user']->data['user_id'], $folder);
                if (!$_CLASS['auth']->acl_get('u_sendpm')) {
                    trigger_error('NO_AUTH_SEND_MESSAGE');
                }
                require $site_file_root . 'modules/Control_Panel/ucp/ucp_pm_compose.php';
                compose_pm($id, $mode, $action);
                $tpl_file = 'ucp_posting_body.html';
                break;
            case 'options':
                $sql = 'SELECT group_message_limit
					FROM ' . GROUPS_TABLE . '
					WHERE group_id = ' . $_CLASS['core_user']->data['user_group'];
                $result = $_CLASS['core_db']->query($sql);
                list($message_limit) = $_CLASS['core_db']->fetch_row_num($result);
                $_CLASS['core_db']->free_result($result);
                (int) ($_CLASS['core_user']->data['message_limit'] = !$message_limit ? $config['pm_max_msgs'] : $message_limit);
                get_folder($_CLASS['core_user']->data['user_id'], $folder);
                require $site_file_root . 'modules/Control_Panel/ucp/ucp_pm_options.php';
                message_options($id, $mode, $global_privmsgs_rules, $global_rule_conditions);
                break;
            case 'drafts':
                get_folder($_CLASS['core_user']->data['user_id'], $folder);
                require $site_file_root . 'modules/Control_Panel/ucp/ucp_main.php';
                $module = new ucp_main($id, $mode);
                unset($module);
                exit;
                break;
            case 'unread':
            case 'view_messages':
                $sql = 'SELECT group_message_limit
					FROM ' . GROUPS_TABLE . '
					WHERE group_id = ' . $_CLASS['core_user']->data['user_group'];
                $result = $_CLASS['core_db']->query($sql);
                list($message_limit) = $_CLASS['core_db']->fetch_row_num($result);
                $_CLASS['core_db']->free_result($result);
                $_CLASS['core_user']->data['message_limit'] = !$message_limit ? $config['pm_max_msgs'] : $message_limit;
                if ($folder_specified) {
                    $folder_id = $folder_specified;
                    $action = 'view_folder';
                } else {
                    $folder_id = request_var('f', PRIVMSGS_INBOX);
                    $action = request_var('action', 'view_folder');
                }
                $msg_id = request_var('p', 0);
                $view = request_var('view', '');
                if ($msg_id && $action == 'view_folder') {
                    $action = 'view_message';
                }
                if (!$_CLASS['auth']->acl_get('u_readpm')) {
                    trigger_error('NO_AUTH_READ_MESSAGE');
                }
                // First Handle Mark actions and moving messages
                // Move PM
                if (isset($_REQUEST['move_pm'])) {
                    $move_msg_ids = isset($_POST['marked_msg_id']) ? array_map('intval', $_POST['marked_msg_id']) : array();
                    $dest_folder = request_var('dest_folder', PRIVMSGS_NO_BOX);
                    $cur_folder_id = request_var('cur_folder_id', PRIVMSGS_NO_BOX);
                    if (move_pm($_CLASS['core_user']->data['user_id'], $_CLASS['core_user']->data['message_limit'], $move_msg_ids, $dest_folder, $cur_folder_id)) {
                        // Return to folder view if single message moved
                        if ($action == 'view_message') {
                            $msg_id = 0;
                            $folder_id = request_var('cur_folder_id', PRIVMSGS_NO_BOX);
                            $action = 'view_folder';
                        }
                    }
                }
                // Message Mark Options
                if (isset($_REQUEST['submit_mark'])) {
                    handle_mark_actions($_CLASS['core_user']->data['user_id'], request_var('mark_option', ''));
                }
                // If new messages arrived, place them into the appropiate folder
                $num_not_moved = 0;
                if ($_CLASS['core_user']->data['user_new_privmsg'] && $action == 'view_folder') {
                    place_pm_into_folder($global_privmsgs_rules, request_var('release', 0));
                    $num_not_moved = $_CLASS['core_user']->data['user_new_privmsg'];
                }
                if (!$msg_id && $folder_id == PRIVMSGS_NO_BOX && $mode == 'unread') {
                    $folder_id = PRIVMSGS_INBOX;
                } else {
                    if ($msg_id && $folder_id == PRIVMSGS_NO_BOX) {
                        $sql = 'SELECT folder_id
						FROM ' . FORUMS_PRIVMSGS_TO_TABLE . "\n\t\t\t\t\t\tWHERE msg_id = {$msg_id}\n\t\t\t\t\t\t\tAND user_id = " . $_CLASS['core_user']->data['user_id'];
                        $result = $_CLASS['core_db']->query_limit($sql, 1);
                        if (!($row = $_CLASS['core_db']->fetch_row_assoc($result))) {
                            trigger_error('NO_MESSAGE');
                        }
                        $folder_id = (int) $row['folder_id'];
                    }
                }
                $message_row = array();
                if ($mode == 'view_messages' && $action == 'view_message' && $msg_id) {
                    // Get Message user want to see
                    if ($view == 'next' || $view == 'previous') {
                        $sql_condition = $view == 'next' ? '>' : '<';
                        $sql_ordering = $view == 'next' ? 'ASC' : 'DESC';
                        $sql = 'SELECT t.msg_id
							FROM ' . FORUMS_PRIVMSGS_TO_TABLE . ' t, ' . FORUMS_PRIVMSGS_TABLE . ' p, ' . FORUMS_PRIVMSGS_TABLE . " p2\n\t\t\t\t\t\t\tWHERE p2.msg_id = {$msg_id}\n\t\t\t\t\t\t\t\tAND t.folder_id = {$folder_id}\n\t\t\t\t\t\t\t\tAND t.user_id = " . $_CLASS['core_user']->data['user_id'] . "\n\t\t\t\t\t\t\t\tAND t.msg_id = p.msg_id\n\t\t\t\t\t\t\t\tAND p.message_time {$sql_condition} p2.message_time\n\t\t\t\t\t\t\tORDER BY p.message_time {$sql_ordering}";
                        $result = $_CLASS['core_db']->query_limit($sql, 1);
                        if (!($row = $_CLASS['core_db']->fetch_row_assoc($result))) {
                            $message = $view == 'next' ? 'NO_NEWER_PM' : 'NO_OLDER_PM';
                            trigger_error($message);
                        } else {
                            $msg_id = $row['msg_id'];
                        }
                    }
                    $sql = 'SELECT t.*, p.*, u.*
						FROM ' . FORUMS_PRIVMSGS_TO_TABLE . ' t, ' . FORUMS_PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . ' u
						WHERE t.user_id = ' . $_CLASS['core_user']->data['user_id'] . "\n\t\t\t\t\t\t\tAND p.author_id = u.user_id\n\t\t\t\t\t\t\tAND t.folder_id = {$folder_id}\n\t\t\t\t\t\t\tAND t.msg_id = p.msg_id\n\t\t\t\t\t\t\tAND p.msg_id = {$msg_id}";
                    $result = $_CLASS['core_db']->query_limit($sql, 1);
                    if (!($message_row = $_CLASS['core_db']->fetch_row_assoc($result))) {
                        trigger_error('NO_MESSAGE');
                    }
                    // Update unread status
                    update_unread_status($message_row['unread'], $message_row['msg_id'], $_CLASS['core_user']->data['user_id'], $folder_id);
                }
                get_folder($_CLASS['core_user']->data['user_id'], $folder, $folder_id);
                $s_folder_options = $s_to_folder_options = '';
                foreach ($folder as $f_id => $folder_ary) {
                    $option = '<option' . (!in_array($f_id, array(PRIVMSGS_INBOX, PRIVMSGS_OUTBOX, PRIVMSGS_SENTBOX)) ? ' class="blue"' : '') . ' value="' . $f_id . '"' . ($f_id == $folder_id && $mode != 'unread' || $f_id === 'unread' && $mode == 'unread' ? ' selected="selected"' : '') . '>' . $folder_ary['folder_name'] . ($folder_ary['unread_messages'] ? ' [' . $folder_ary['unread_messages'] . '] ' : '') . '</option>';
                    $s_to_folder_options .= $f_id != PRIVMSGS_OUTBOX && $f_id != PRIVMSGS_SENTBOX ? $option : '';
                    $s_folder_options .= $option;
                }
                clean_sentbox($folder[PRIVMSGS_SENTBOX]['num_messages']);
                // Header for message view - folder and so on
                $folder_status = get_folder_status($folder_id, $folder);
                $url = 'Control_Panel&amp;i=' . $id;
                $_CLASS['core_template']->assign(array('CUR_FOLDER_ID' => $folder_id, 'CUR_FOLDER_NAME' => $folder_status['folder_name'], 'NUM_NOT_MOVED' => $num_not_moved, 'RELEASE_MESSAGE_INFO' => sprintf($_CLASS['core_user']->lang['RELEASE_MESSAGES'], '<a href="' . generate_link($url . '&amp;folder=' . $folder_id . '&amp;release=1') . '">', '</a>'), 'NOT_MOVED_MESSAGES' => $num_not_moved == 1 ? $_CLASS['core_user']->lang['NOT_MOVED_MESSAGE'] : sprintf($_CLASS['core_user']->lang['NOT_MOVED_MESSAGES'], $num_not_moved), 'S_FOLDER_OPTIONS' => $s_folder_options, 'S_TO_FOLDER_OPTIONS' => $s_to_folder_options, 'S_FOLDER_ACTION' => generate_link($url . '&amp;mode=view_messages&amp;action=view_folder'), 'S_PM_ACTION' => generate_link("{$url}&amp;mode={$mode}&amp;action={$action}"), 'U_INBOX' => generate_link($url . '&amp;folder=inbox'), 'U_OUTBOX' => generate_link($url . '&amp;folder=outbox'), 'U_SENTBOX' => generate_link($url . '&amp;folder=sentbox'), 'U_CREATE_FOLDER' => generate_link($url . '&amp;mode=options'), 'S_IN_INBOX' => $folder_id == PRIVMSGS_INBOX ? true : false, 'S_IN_OUTBOX' => $folder_id == PRIVMSGS_OUTBOX ? true : false, 'S_IN_SENTBOX' => $folder_id == PRIVMSGS_SENTBOX ? true : false, 'FOLDER_STATUS' => $folder_status['message'], 'FOLDER_MAX_MESSAGES' => $folder_status['max'], 'FOLDER_CUR_MESSAGES' => $folder_status['cur'], 'FOLDER_REMAINING_MESSAGES' => $folder_status['remaining'], 'FOLDER_PERCENT' => $folder_status['percent']));
                $_CLASS['core_template']->assign('S_VIEW_MESSAGE', false);
                if ($mode == 'unread' || $action == 'view_folder') {
                    require $site_file_root . 'modules/Control_Panel/ucp/ucp_pm_viewfolder.php';
                    view_folder($id, $mode, $folder_id, $folder, $mode == 'unread' ? 'unread' : 'folder');
                    $tpl_file = 'ucp_pm_viewfolder.html';
                } else {
                    if ($action == 'view_message') {
                        $_CLASS['core_template']->assign(array('S_VIEW_MESSAGE' => true, 'MSG_ID' => $msg_id));
                        if (!$msg_id) {
                            trigger_error('NO_MESSAGE');
                        }
                        require $site_file_root . 'modules/Control_Panel/ucp/ucp_pm_viewmessage.php';
                        view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row);
                        $tpl_file = $view == 'print' ? 'ucp_pm_viewmessage_print.html' : 'ucp_pm_viewmessage.html';
                    }
                }
                break;
            default:
                trigger_error('NO_ACTION_MODE');
                break;
        }
        $_CLASS['core_template']->assign(array('L_TITLE' => $_CLASS['core_user']->lang['UCP_PM_' . strtoupper($mode)], 'S_UCP_ACTION' => generate_link("Control_Panel&amp;i={$id}&amp;mode={$mode}" . (isset($action) ? "&amp;action={$action}" : ''))));
        if (isset($view) && $view == 'print' || $mode == 'popup') {
            //page_header($page_title);
            $_CLASS['core_template']->display('modules/Control_Panel/' . $tpl_file);
            $_CLASS['core_display']->display_footer();
        } else {
            $this->display($_CLASS['core_user']->lang['UCP_PM'], $tpl_file);
        }
    }
Example #6
0
function get_box_func($xmlrpc_params)
{
    global $db, $auth, $user, $cache, $config, $phpbb_home, $phpbb_root_path, $phpEx;
    $params = php_xmlrpc_decode($xmlrpc_params);
    $user->setup('ucp');
    if (!$user->data['is_registered']) {
        trigger_error('LOGIN_EXPLAIN_UCP');
    }
    if (!$config['allow_privmsg']) {
        trigger_error('Module not accessible');
    }
    if (!isset($params[0])) {
        trigger_error('UNKNOWN_FOLDER');
    }
    // get folder id from parameters
    $folder_id = intval($params[0]);
    if (PRIVMSGS_INBOX !== $folder_id) {
        $folder_id = PRIVMSGS_SENTBOX;
    }
    list($start, $limit, $page) = process_page($params[1], $params[2]);
    // Grab icons
    //$icons = $cache->obtain_icons();
    $user_id = $user->data['user_id'];
    include_once $phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx;
    $folder = get_folder($user_id, $folder_id);
    include $phpbb_root_path . 'includes/ucp/ucp_pm_viewfolder.' . $phpEx;
    $folder_info = get_pm_from($folder_id, $folder, $user_id);
    $address_list = array();
    // Build Recipient List if in outbox/sentbox - max two additional queries
    if ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) {
        $recipient_list = $address = array();
        foreach ($folder_info['rowset'] as $message_id => $row) {
            $address[$message_id] = rebuild_header(array('to' => $row['to_address'], 'bcc' => $row['bcc_address']));
            $_save = array('u', 'g');
            foreach ($_save as $save) {
                if (isset($address[$message_id][$save]) && sizeof($address[$message_id][$save])) {
                    foreach (array_keys($address[$message_id][$save]) as $ug_id) {
                        $recipient_list[$save][$ug_id] = array('name' => $user->lang['NA'], 'colour' => '');
                    }
                }
            }
        }
        $_types = array('u', 'g');
        foreach ($_types as $ug_type) {
            if (!empty($recipient_list[$ug_type])) {
                if ($ug_type == 'u') {
                    $sql = 'SELECT user_id as id, username as name, user_colour as colour
                        FROM ' . USERS_TABLE . '
                        WHERE ';
                } else {
                    $sql = 'SELECT group_id as id, group_name as name, group_colour as colour, group_type
                        FROM ' . GROUPS_TABLE . '
                        WHERE ';
                }
                $sql .= $db->sql_in_set($ug_type == 'u' ? 'user_id' : 'group_id', array_map('intval', array_keys($recipient_list[$ug_type])));
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    if ($ug_type == 'g') {
                        $row['name'] = $row['group_type'] == GROUP_SPECIAL ? $user->lang['G_' . $row['name']] : $row['name'];
                    }
                    $recipient_list[$ug_type][$row['id']] = array('id' => $row['id'], 'name' => $row['name'], 'colour' => $row['colour']);
                }
                $db->sql_freeresult($result);
            }
        }
        foreach ($address as $message_id => $adr_ary) {
            foreach ($adr_ary as $type => $id_ary) {
                foreach ($id_ary as $ug_id => $_id) {
                    $address_list[$message_id][] = $recipient_list[$type][$ug_id];
                }
            }
        }
        unset($recipient_list, $address);
    }
    // get unread count in inbox only
    if (PRIVMSGS_INBOX === $folder_id) {
        $sql = 'SELECT COUNT(msg_id) as num_messages
                FROM ' . PRIVMSGS_TO_TABLE . '
                WHERE pm_unread = 1
                    AND folder_id = ' . PRIVMSGS_INBOX . '
                    AND user_id = ' . $user->data['user_id'];
        $result = $db->sql_query($sql);
        $unread_num = (int) $db->sql_fetchfield('num_messages');
        $db->sql_freeresult($result);
    } else {
        $unread_num = 0;
    }
    $sql = 'SELECT COUNT(msg_id) as num_messages
            FROM ' . PRIVMSGS_TO_TABLE . '
            WHERE folder_id = ' . $folder_id . '
                AND user_id = ' . $user->data['user_id'];
    $result = $db->sql_query($sql);
    $total_num = (int) $db->sql_fetchfield('num_messages');
    $db->sql_freeresult($result);
    $sql = 'SELECT t.*, p.*, u.username, u.user_avatar, u.user_avatar_type, u.user_id
            FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . " u\r\r\n            WHERE t.user_id = {$user_id}\r\r\n            AND p.author_id = u.user_id\r\r\n            AND t.folder_id = {$folder_id}\r\r\n            AND t.msg_id = p.msg_id\r\r\n            ORDER BY p.message_time DESC";
    $result = $db->sql_query_limit($sql, $limit, $start);
    $total_message_count = $total_unread_count = 0;
    $online_cache = array();
    while ($row = $db->sql_fetchrow($result)) {
        $msg_state = 2;
        // message read
        if ($row['pm_unread']) {
            $msg_state = 1;
        } else {
            if ($row['pm_replied']) {
                $msg_state = 3;
            } else {
                if ($row['pm_forwarded']) {
                    $msg_state = 4;
                }
            }
        }
        if ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) {
            $msg_to_list = $address_list[$row['msg_id']];
        } else {
            $msg_to_list = array(array('id' => $user->data['user_id'], 'name' => $user->data['username']));
        }
        $msg_to = array();
        foreach ($msg_to_list as $address) {
            $msg_to[] = new xmlrpcval(array('user_id' => new xmlrpcval($address['id'], 'string'), 'username' => new xmlrpcval(basic_clean($address['name']), 'base64'), 'user_type' => check_return_user_type($address['name'])), 'struct');
        }
        $sent_date = mobiquo_iso8601_encode($row['message_time']);
        //$icon_url   = (!empty($icons[$row['icon_id']])) ? $phpbb_home . $config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] : '';
        $icon_url = $user->optionget('viewavatars') ? get_user_avatar_url($row['user_avatar'], $row['user_avatar_type']) : '';
        $msg_subject = html_entity_decode(strip_tags(censor_text($row['message_subject'])));
        $short_content = censor_text($row['message_text']);
        $short_content = preg_replace('/\\[url.*?\\].*?\\[\\/url.*?\\]/', '[url]', $short_content);
        $short_content = preg_replace('/\\[img.*?\\].*?\\[\\/img.*?\\]/', '[img]', $short_content);
        $short_content = preg_replace('/[\\n\\r\\t]+/', ' ', $short_content);
        strip_bbcode($short_content);
        $short_content = html_entity_decode($short_content);
        $short_content = substr($short_content, 0, 200);
        if ($config['load_onlinetrack'] && !isset($online_cache[$row['user_id']])) {
            $sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline
                    FROM ' . SESSIONS_TABLE . '
                    WHERE session_user_id=' . $row['user_id'] . '
                    GROUP BY session_user_id';
            $online_result = $db->sql_query($sql);
            $online_info = $db->sql_fetchrow($online_result);
            $db->sql_freeresult($online_result);
            $update_time = $config['load_online_time'] * 60;
            $online_cache[$row['user_id']] = time() - $update_time < $online_info['online_time'] && ($online_info['viewonline'] || $auth->acl_get('u_viewonline')) ? true : false;
        }
        $is_online = isset($online_cache[$row['user_id']]) ? $online_cache[$row['user_id']] : false;
        $pm_list[] = new xmlrpcval(array('msg_id' => new xmlrpcval($row['msg_id']), 'msg_state' => new xmlrpcval($msg_state, 'int'), 'sent_date' => new xmlrpcval($sent_date, 'dateTime.iso8601'), 'timestamp' => new xmlrpcval($row['message_time'], 'string'), 'msg_from' => new xmlrpcval(basic_clean($row['username']), 'base64'), 'msg_from_id' => new xmlrpcval($row['user_id']), 'icon_url' => new xmlrpcval($icon_url), 'msg_to' => new xmlrpcval($msg_to, 'array'), 'msg_subject' => new xmlrpcval($msg_subject, 'base64'), 'short_content' => new xmlrpcval($short_content, 'base64'), 'is_online' => new xmlrpcval($is_online, 'boolean')), 'struct');
    }
    $db->sql_freeresult($result);
    $result = new xmlrpcval(array('total_message_count' => new xmlrpcval($total_num, 'int'), 'total_unread_count' => new xmlrpcval($unread_num, 'int'), 'list' => new xmlrpcval($pm_list, 'array')), 'struct');
    return new xmlrpcresp($result);
}
Example #7
0
 function get_folder($rep)
 {
     $folder = array();
     chdir($rep);
     $dir = opendir(".");
     while ($f = readdir($dir)) {
         if ($f != "." and $f != ".." and is_dir($rep . $f)) {
             $folder[] = $f;
             $subfolder = get_folder($rep . $f . "/");
             if (!empty($subfolder)) {
                 foreach ($subfolder as $sub) {
                     $folder[] = $f . "/" . $sub;
                 }
             }
         }
     }
     closedir($dir);
     return $folder;
 }
Example #8
0
/*
 * EasyGallery
 * http://github.com/romaricdrigon/
 */
/* Config */
// do you want to use thumbnails? 60px images, galleries will load faster (big pictures are not loaded at the same time than the page)
// it'll degrade smartly if no thumb is found - but disabling it may allow you to save a little time if you don't have any thumb
$use_thumbs = TRUE;
$thumbs_suffix = '_thumb';
// the thumbs corresponding to 'IMG42.jpg' should be called 'IMG42_thumb.jpg'
$lang = 'en';
// either fr or en
/* end of config, no more things to modify */
require 'lister.php';
require 'lang/' . $lang . '.php';
$subdir = get_folder();
// get only subdirectory
$dir = $subdir == '' ? 'photos' : 'photos/' . $subdir;
// full path - check if there's subdir to avoid ending /
// scan folder
$list = lister($dir, $use_thumbs, $thumbs_suffix);
?>
<!doctype html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title><?php 
echo $messages['title'];
?>
</title>
    <link type="text/css" href="style.css" rel="stylesheet" />