예제 #1
0
function it_q_list_page_content($questions, $pagesize, $start, $count, $sometitle, $nonetitle, $navcategories, $categoryid, $categoryqcount, $categorypathprefix, $feedpathprefix, $suggest, $pagelinkparams = null, $categoryparams = null, $dummy = null)
{
    require_once QA_INCLUDE_DIR . 'qa-app-format.php';
    require_once QA_INCLUDE_DIR . 'qa-app-updates.php';
    $userid = qa_get_logged_in_userid();
    //	Chop down to size, get user information for display
    if (isset($pagesize)) {
        $questions = array_slice($questions, 0, $pagesize);
    }
    $usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
    $qa_content['q_list']['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote')));
    $qa_content['q_list']['qs'] = array();
    if (count($questions)) {
        $qa_content['title'] = $sometitle;
        $defaults = qa_post_html_defaults('Q');
        foreach ($questions as $question) {
            $qa_content['q_list']['qs'][] = qa_any_to_q_html_fields($question, $userid, it_cookie_get(), $usershtml, null, qa_post_html_options($question, $defaults));
        }
    } else {
        $qa_content['title'] = $nonetitle;
    }
    if (isset($count) && isset($pagesize)) {
        $qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $count, qa_opt('pages_prev_next'), $pagelinkparams);
    }
    return $qa_content;
}
예제 #2
0
function qa_q_list_page_content($questions, $pagesize, $start, $count, $sometitle, $nonetitle, $navcategories, $categoryid, $categoryqcount, $categorypathprefix, $feedpathprefix, $suggest, $pagelinkparams = null, $categoryparams = null, $dummy = null)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    require_once QA_INCLUDE_DIR . 'app/format.php';
    require_once QA_INCLUDE_DIR . 'app/updates.php';
    $userid = qa_get_logged_in_userid();
    //	Chop down to size, get user information for display
    if (isset($pagesize)) {
        $questions = array_slice($questions, 0, $pagesize);
    }
    $usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
    //	Prepare content for theme
    $qa_content = qa_content_prepare(true, array_keys(qa_category_path($navcategories, $categoryid)));
    $qa_content['q_list']['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote')));
    $qa_content['q_list']['qs'] = array();
    if (count($questions)) {
        $qa_content['title'] = $sometitle;
        $defaults = qa_post_html_defaults('Q');
        if (isset($categorypathprefix)) {
            $defaults['categorypathprefix'] = $categorypathprefix;
        }
        foreach ($questions as $question) {
            $fields = qa_any_to_q_html_fields($question, $userid, qa_cookie_get(), $usershtml, null, qa_post_html_options($question, $defaults));
            if (!empty($fields['raw']['closedbyid'])) {
                $fields['closed'] = array('state' => qa_lang_html('main/closed'));
            }
            $qa_content['q_list']['qs'][] = $fields;
        }
    } else {
        $qa_content['title'] = $nonetitle;
    }
    if (isset($userid) && isset($categoryid)) {
        $favoritemap = qa_get_favorite_non_qs_map();
        $categoryisfavorite = @$favoritemap['category'][$navcategories[$categoryid]['backpath']];
        $qa_content['favorite'] = qa_favorite_form(QA_ENTITY_CATEGORY, $categoryid, $categoryisfavorite, qa_lang_sub($categoryisfavorite ? 'main/remove_x_favorites' : 'main/add_category_x_favorites', $navcategories[$categoryid]['title']));
    }
    if (isset($count) && isset($pagesize)) {
        $qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $count, qa_opt('pages_prev_next'), $pagelinkparams);
    }
    if (empty($qa_content['page_links'])) {
        $qa_content['suggest_next'] = $suggest;
    }
    if (qa_using_categories() && count($navcategories) && isset($categorypathprefix)) {
        $qa_content['navigation']['cat'] = qa_category_navigation($navcategories, $categoryid, $categorypathprefix, $categoryqcount, $categoryparams);
    }
    if (isset($feedpathprefix) && (qa_opt('feed_per_category') || !isset($categoryid))) {
        $qa_content['feed'] = array('url' => qa_path_html(qa_feed_request($feedpathprefix . (isset($categoryid) ? '/' . qa_category_path_request($navcategories, $categoryid) : ''))), 'label' => strip_tags($sometitle));
    }
    return $qa_content;
}
예제 #3
0
 function get_user_activity($handle, $limit = 10)
 {
     $userid = qa_handle_to_userid($handle);
     require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
     require_once QA_INCLUDE_DIR . 'qa-app-format.php';
     $identifier = QA_FINAL_EXTERNAL_USERS ? $userid : $handle;
     list($useraccount, $questions, $answerqs, $commentqs, $editqs) = qa_db_select_with_pending(QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_account_selectspec($handle, false), qa_db_user_recent_qs_selectspec($userid, $identifier, $limit), qa_db_user_recent_a_qs_selectspec($userid, $identifier), qa_db_user_recent_c_qs_selectspec($userid, $identifier), qa_db_user_recent_edit_qs_selectspec($userid, $identifier));
     if (!QA_FINAL_EXTERNAL_USERS && !is_array($useraccount)) {
         // check the user exists
         return include QA_INCLUDE_DIR . 'qa-page-not-found.php';
     }
     //	Get information on user references
     $questions = qa_any_sort_and_dedupe(array_merge($questions, $answerqs, $commentqs, $editqs));
     $questions = array_slice($questions, 0, $limit);
     $usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions), false);
     $htmldefaults = qa_post_html_defaults('Q');
     $htmldefaults['whoview'] = false;
     $htmldefaults['voteview'] = false;
     $htmldefaults['avatarsize'] = 0;
     foreach ($questions as $question) {
         $qa_content[] = qa_any_to_q_html_fields($question, $userid, qa_cookie_get(), $usershtml, null, array('voteview' => false) + qa_post_html_options($question, $htmldefaults));
     }
     $output = '<div class="user-activities">';
     $output .= '<ul>';
     if (isset($qa_content)) {
         foreach ($qa_content as $qs) {
             $icon = 'icon-time undefined';
             $output .= '<li class="activity-item">';
             $output .= '<div class="list-right">';
             $output .= '<div class="type pull-left ' . $icon . '"></div>';
             $output .= '<div class="what"><a class="what-task" href="' . @$qs['url'] . '">' . $qs['what'] . '</a>';
             $output .= '<a href="' . $qs['url'] . '">' . $qs['title'] . '</a> </div>';
             $output .= '<strong class="when">' . implode(' ', $qs['when']) . '</strong>';
             $output .= '</div>';
             $output .= '</li>';
         }
     } else {
         $output .= '<li>' . qa_lang('cleanstrap/no_activity_yet') . '</li>';
     }
     $output .= '</ul>';
     $output .= '</div>';
     return $output;
 }
예제 #4
0
function qa_q_list_page_content($questions, $pagesize, $start, $count, $sometitle, $nonetitle, $navcategories, $categoryid, $categoryqcount, $categorypathprefix, $feedpathprefix, $suggest, $pagelinkparams = array())
{
    require_once QA_INCLUDE_DIR . 'qa-app-format.php';
    global $qa_login_userid, $qa_cookieid, $qa_request;
    // get globals from qa-page.php
    //	Chop down to size, get user information for display
    if (isset($pagesize)) {
        $questions = array_slice($questions, 0, $pagesize);
    }
    $usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
    //	Prepare content for theme
    $qa_content = qa_content_prepare(true, array_keys(qa_category_path($navcategories, $categoryid)));
    $qa_content['q_list']['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"');
    $qa_content['q_list']['qs'] = array();
    if (count($questions)) {
        $qa_content['title'] = $sometitle;
        $options = qa_post_html_defaults('Q');
        if (isset($categorypathprefix)) {
            $options['categorypathprefix'] = $categorypathprefix;
        }
        foreach ($questions as $question) {
            $qa_content['q_list']['qs'][] = qa_any_to_q_html_fields($question, $qa_login_userid, $qa_cookieid, $usershtml, null, $options);
        }
    } else {
        $qa_content['title'] = $nonetitle;
    }
    if (isset($count) && isset($pagesize)) {
        $qa_content['page_links'] = qa_html_page_links($qa_request, $start, $pagesize, $count, qa_opt('pages_prev_next'), $pagelinkparams);
    }
    if (empty($qa_content['page_links'])) {
        $qa_content['suggest_next'] = $suggest;
    }
    if (qa_using_categories() && count($navcategories) && isset($categorypathprefix)) {
        $qa_content['navigation']['cat'] = qa_category_navigation($navcategories, $categoryid, $categorypathprefix, $categoryqcount);
    }
    if (isset($feedpathprefix) && (qa_opt('feed_per_category') || !isset($categoryid))) {
        $qa_content['feed'] = array('url' => qa_path_html(qa_feed_request($feedpathprefix . (isset($categoryid) ? '/' . qa_category_path_request($navcategories, $categoryid) : ''))), 'label' => strip_tags($sometitle));
    }
    return $qa_content;
}
예제 #5
0
    return $qa_content;
}
//	Check to see if any have been reshown or deleted
$pageerror = qa_admin_check_clicks();
//	Combine sets of questions and remove those this user has no permissions for
$questions = qa_any_sort_by_date(array_merge($hiddenquestions, $hiddenanswers, $hiddencomments));
if (qa_user_permit_error('permit_hide_show') && qa_user_permit_error('permit_delete_hidden')) {
    // not allowed to see all hidden posts
    foreach ($questions as $index => $question) {
        if (qa_user_post_permit_error('permit_hide_show', $question) && qa_user_post_permit_error('permit_delete_hidden', $question)) {
            unset($questions[$index]);
        }
    }
}
//	Get information for users
$usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
//	Create list of actual hidden postids and see which ones have dependents
$qhiddenpostid = array();
foreach ($questions as $key => $question) {
    $qhiddenpostid[$key] = isset($question['opostid']) ? $question['opostid'] : $question['postid'];
}
$dependcounts = qa_db_postids_count_dependents($qhiddenpostid);
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('admin/recent_hidden_title');
$qa_content['error'] = isset($pageerror) ? $pageerror : qa_admin_page_error();
$qa_content['q_list'] = array('form' => array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('admin/click'))), 'qs' => array());
if (count($questions)) {
    foreach ($questions as $key => $question) {
        $elementid = 'p' . $qhiddenpostid[$key];
        $htmloptions = qa_post_html_options($question);
예제 #6
0
function get_user_activity($handle)
{
    $userid = qa_handle_to_userid($handle);
    require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
    require_once QA_INCLUDE_DIR . 'qa-app-format.php';
    $loginuserid = qa_get_logged_in_userid();
    $identifier = QA_FINAL_EXTERNAL_USERS ? $userid : $handle;
    list($useraccount, $questions, $answerqs, $commentqs, $editqs) = qa_db_select_with_pending(QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_account_selectspec($handle, false), qa_db_user_recent_qs_selectspec($loginuserid, $identifier, qa_opt_if_loaded('page_size_activity')), qa_db_user_recent_a_qs_selectspec($loginuserid, $identifier), qa_db_user_recent_c_qs_selectspec($loginuserid, $identifier), qa_db_user_recent_edit_qs_selectspec($loginuserid, $identifier));
    if (!QA_FINAL_EXTERNAL_USERS && !is_array($useraccount)) {
        // check the user exists
        return include QA_INCLUDE_DIR . 'qa-page-not-found.php';
    }
    //	Get information on user references
    $questions = qa_any_sort_and_dedupe(array_merge($questions, $answerqs, $commentqs, $editqs));
    $questions = array_slice($questions, 0, qa_opt('page_size_activity'));
    $usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions), false);
    $htmldefaults = qa_post_html_defaults('Q');
    $htmldefaults['whoview'] = false;
    $htmldefaults['voteview'] = false;
    $htmldefaults['avatarsize'] = 0;
    foreach ($questions as $question) {
        $qa_content[] = qa_any_to_q_html_fields($question, $loginuserid, qa_cookie_get(), $usershtml, null, array('voteview' => false) + qa_post_html_options($question, $htmldefaults));
    }
    $output = '<div class="widget user-activities">';
    $output .= '<h3 class="widget-title">' . ra_name($handle) . '\'s ' . _ra_lang('activities') . '</h3>';
    $output .= '<ul class="question-list">';
    if (isset($qa_content)) {
        foreach ($qa_content as $qs) {
            if ($qs['what'] == 'answered') {
                $icon = 'icon-chat-3 answered';
            } elseif ($qs['what'] == 'asked') {
                $icon = 'icon-question asked';
            } elseif ($qs['what'] == 'commented') {
                $icon = 'icon-chat-2 commented';
            } elseif ($qs['what'] == 'edited' || $qs['what'] == 'answer edited') {
                $icon = 'icon-edit edited';
            } elseif ($qs['what'] == 'closed') {
                $icon = 'icon-error closed';
            } elseif ($qs['what'] == 'answer selected') {
                $icon = 'icon-checked selected';
            } elseif ($qs['what'] == 'recategorized') {
                $icon = 'icon-folder-close recategorized';
            } else {
                $icon = 'icon-pin undefined';
            }
            $output .= '<li class="activity-item">';
            $output .= '<div class="type pull-left ' . $icon . '"></div>';
            $output .= '<div class="list-right">';
            $output .= '<h5 class="when"><a href="' . @$qs['what_url'] . '">' . $qs['what'] . '</a> ' . implode(' ', $qs['when']) . '</h5>';
            $output .= '<h5 class="what"><a href="' . $qs['url'] . '">' . $qs['title'] . '</a></h5>';
            $output .= '</div>';
            $output .= '</li>';
        }
    } else {
        $output .= '<li>' . _ra_lang('No activity yet.') . '</li>';
    }
    $output .= '</ul>';
    $output .= '</div>';
    return $output;
}