当前位置: 首页>>代码示例>>PHP>>正文


PHP qa_post_set_hidden函数代码示例

本文整理汇总了PHP中qa_post_set_hidden函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_post_set_hidden函数的具体用法?PHP qa_post_set_hidden怎么用?PHP qa_post_set_hidden使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了qa_post_set_hidden函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: qa_db_user_set_flag

            qa_db_user_set_flag($userid, QA_USER_FLAGS_USER_BLOCKED, true);
            qa_report_event('u_block', $loginuserid, qa_get_logged_in_handle(), qa_cookie_get(), array('userid' => $userid, 'handle' => $useraccount['handle']));
            qa_redirect(qa_request());
        }
        if (qa_clicked('dounblock')) {
            require_once QA_INCLUDE_DIR . 'qa-db-users.php';
            qa_db_user_set_flag($userid, QA_USER_FLAGS_USER_BLOCKED, false);
            qa_report_event('u_unblock', $loginuserid, qa_get_logged_in_handle(), qa_cookie_get(), array('userid' => $userid, 'handle' => $useraccount['handle']));
            qa_redirect(qa_request());
        }
        if (qa_clicked('dohideall') && !qa_user_permit_error('permit_hide_show')) {
            require_once QA_INCLUDE_DIR . 'qa-db-admin.php';
            require_once QA_INCLUDE_DIR . 'qa-app-posts.php';
            $postids = qa_db_get_user_visible_postids($userid);
            foreach ($postids as $postid) {
                qa_post_set_hidden($postid, true, $loginuserid);
            }
            qa_redirect(qa_request());
        }
        if (qa_clicked('dodelete') && $loginlevel >= QA_USER_LEVEL_ADMIN) {
            require_once QA_INCLUDE_DIR . 'qa-app-users-edit.php';
            qa_delete_user($userid);
            qa_report_event('u_delete', $loginuserid, qa_get_logged_in_handle(), qa_cookie_get(), array('userid' => $userid, 'handle' => $useraccount['handle']));
            qa_redirect('users');
        }
    }
}
//	Process bonus setting button
if ($loginlevel >= QA_USER_LEVEL_ADMIN && qa_clicked('dosetbonus')) {
    require_once QA_INCLUDE_DIR . 'qa-db-points.php';
    qa_db_points_set_bonus($userid, (int) qa_post_text('bonus'));
开发者ID:ruuttt,项目名称:question2answer,代码行数:31,代码来源:qa-page-user.php

示例2: qa_admin_single_click

function qa_admin_single_click($postid, $action)
{
    require_once QA_INCLUDE_DIR . 'qa-app-posts.php';
    $post = qa_post_get_full($postid);
    if (isset($post)) {
        $userid = qa_get_logged_in_userid();
        $queued = substr($post['type'], 1) == '_QUEUED';
        switch ($action) {
            case 'approve':
                if ($queued && !qa_user_permit_error('permit_moderate')) {
                    qa_post_set_hidden($postid, false, $userid);
                    return true;
                }
                break;
            case 'reject':
                if ($queued && !qa_user_permit_error('permit_moderate')) {
                    qa_post_set_hidden($postid, true, $userid);
                    return true;
                }
                break;
            case 'hide':
                if (!$queued && !qa_user_permit_error('permit_hide_show')) {
                    qa_post_set_hidden($postid, true, $userid);
                    return true;
                }
                break;
            case 'reshow':
                if ($post['hidden'] && !qa_user_permit_error('permit_hide_show')) {
                    qa_post_set_hidden($postid, false, $userid);
                    return true;
                }
                break;
            case 'delete':
                if ($post['hidden'] && !qa_user_permit_error('permit_delete_hidden')) {
                    qa_post_delete($postid);
                    return true;
                }
                break;
            case 'clearflags':
                require_once QA_INCLUDE_DIR . 'qa-app-votes.php';
                if (!qa_user_permit_error('permit_hide_show')) {
                    qa_flags_clear_all($post, $userid, qa_get_logged_in_handle(), null);
                    return true;
                }
                break;
        }
    }
    return false;
}
开发者ID:mathjoy,项目名称:math-duodaa,代码行数:49,代码来源:qa-app-admin.php

示例3: qa_post_delete

function qa_post_delete($postid)
{
    $oldpost = qa_post_get_full($postid, 'QAC');
    if (!$oldpost['hidden']) {
        qa_post_set_hidden($postid, true, null);
        $oldpost = qa_post_get_full($postid, 'QAC');
    }
    switch ($oldpost['basetype']) {
        case 'Q':
            $answers = qa_post_get_question_answers($postid);
            $commentsfollows = qa_post_get_question_commentsfollows($postid);
            $closepost = qa_post_get_question_closepost($postid);
            if (count($answers) || count($commentsfollows)) {
                qa_fatal_error('Could not delete question ID due to dependents: ' . $postid);
            }
            qa_question_delete($oldpost, null, null, null, $closepost);
            break;
        case 'A':
            $question = qa_post_get_full($oldpost['parentid'], 'Q');
            $commentsfollows = qa_post_get_answer_commentsfollows($postid);
            if (count($commentsfollows)) {
                qa_fatal_error('Could not delete answer ID due to dependents: ' . $postid);
            }
            qa_answer_delete($oldpost, $question, null, null, null);
            break;
        case 'C':
            $parent = qa_post_get_full($oldpost['parentid'], 'QA');
            $question = qa_post_parent_to_question($parent);
            qa_comment_delete($oldpost, $question, $parent, null, null, null);
            break;
    }
}
开发者ID:mathjoy,项目名称:math-duodaa,代码行数:32,代码来源:qa-app-posts.php

示例4: foreach

            foreach ($blockipclauses as $key => $blockipclause) {
                if (qa_block_ip_match($ip, $blockipclause)) {
                    unset($blockipclauses[$key]);
                }
            }
            qa_set_option('block_ips_write', implode(' , ', $blockipclauses));
            qa_report_event('ip_unblock', $userid, qa_get_logged_in_handle(), qa_cookie_get(), array('ip' => $ip));
            qa_redirect(qa_request());
        }
        if (qa_clicked('dohideall') && !qa_user_maximum_permit_error('permit_hide_show')) {
            // allow moderator in one category to hide posts across all categories if they are identified via IP page
            require_once QA_INCLUDE_DIR . 'qa-db-admin.php';
            require_once QA_INCLUDE_DIR . 'qa-app-posts.php';
            $postids = qa_db_get_ip_visible_postids($ip);
            foreach ($postids as $postid) {
                qa_post_set_hidden($postid, true, $userid);
            }
            qa_redirect(qa_request());
        }
    }
}
//	Combine sets of questions and get information for users
$questions = qa_any_sort_by_date(array_merge($qs, $qs_queued, $qs_hidden, $a_qs, $a_queued_qs, $a_hidden_qs, $c_qs, $c_queued_qs, $c_hidden_qs, $edit_qs));
$usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
$hostname = gethostbyaddr($ip);
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html_sub('main/ip_address_x', qa_html($ip));
$qa_content['error'] = @$pageerror;
$qa_content['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'style' => 'wide', 'fields' => array('host' => array('type' => 'static', 'label' => qa_lang_html('misc/host_name'), 'value' => qa_html($hostname))), 'hidden' => array('code' => qa_get_form_security_code('ip-' . $ip)));
if ($blockable) {
开发者ID:gogupe,项目名称:question2answer-releases,代码行数:31,代码来源:qa-page-ip.php

示例5: qa_admin_single_click

function qa_admin_single_click($entityid, $action)
{
    $userid = qa_get_logged_in_userid();
    if (!QA_FINAL_EXTERNAL_USERS && ($action == 'userapprove' || $action == 'userblock')) {
        // approve/block moderated users
        require_once QA_INCLUDE_DIR . 'db/selects.php';
        $useraccount = qa_db_select_with_pending(qa_db_user_account_selectspec($entityid, true));
        if (isset($useraccount) && qa_get_logged_in_level() >= QA_USER_LEVEL_MODERATOR) {
            switch ($action) {
                case 'userapprove':
                    if ($useraccount['level'] <= QA_USER_LEVEL_APPROVED) {
                        // don't demote higher level users
                        require_once QA_INCLUDE_DIR . 'app/users-edit.php';
                        qa_set_user_level($useraccount['userid'], $useraccount['handle'], QA_USER_LEVEL_APPROVED, $useraccount['level']);
                        return true;
                    }
                    break;
                case 'userblock':
                    require_once QA_INCLUDE_DIR . 'app/users-edit.php';
                    qa_set_user_blocked($useraccount['userid'], $useraccount['handle'], true);
                    return true;
                    break;
            }
        }
    } else {
        // something to do with a post
        require_once QA_INCLUDE_DIR . 'app/posts.php';
        $post = qa_post_get_full($entityid);
        if (isset($post)) {
            $queued = substr($post['type'], 1) == '_QUEUED';
            switch ($action) {
                case 'approve':
                    if ($queued && !qa_user_post_permit_error('permit_moderate', $post)) {
                        qa_post_set_hidden($entityid, false, $userid);
                        return true;
                    }
                    break;
                case 'reject':
                    if ($queued && !qa_user_post_permit_error('permit_moderate', $post)) {
                        qa_post_set_hidden($entityid, true, $userid);
                        return true;
                    }
                    break;
                case 'hide':
                    if (!$queued && !qa_user_post_permit_error('permit_hide_show', $post)) {
                        qa_post_set_hidden($entityid, true, $userid);
                        return true;
                    }
                    break;
                case 'reshow':
                    if ($post['hidden'] && !qa_user_post_permit_error('permit_hide_show', $post)) {
                        qa_post_set_hidden($entityid, false, $userid);
                        return true;
                    }
                    break;
                case 'delete':
                    if ($post['hidden'] && !qa_user_post_permit_error('permit_delete_hidden', $post)) {
                        qa_post_delete($entityid);
                        return true;
                    }
                    break;
                case 'clearflags':
                    require_once QA_INCLUDE_DIR . 'app/votes.php';
                    if (!qa_user_post_permit_error('permit_hide_show', $post)) {
                        qa_flags_clear_all($post, $userid, qa_get_logged_in_handle(), null);
                        return true;
                    }
                    break;
            }
        }
    }
    return false;
}
开发者ID:architbakliwal,项目名称:RapidInnovation,代码行数:73,代码来源:admin.php

示例6: do_hide

 function do_hide($data, $post)
 {
     $userid = qa_get_logged_in_userid();
     $cookieid = qa_cookie_get();
     $userlevel = qa_user_level_for_post($post);
     $postid = (int) @$data['action_id'];
     $rules['closed'] = $post['basetype'] == 'Q' && (isset($post['closedbyid']) || isset($post['selchildid']) && qa_opt('do_close_on_select'));
     $rules['isbyuser'] = qa_post_is_by_user($post, $userid, $cookieid);
     $rules['queued'] = substr($post['type'], 1) == '_QUEUED';
     $rules['authorlast'] = !isset($post['lastuserid']) || $post['lastuserid'] === $post['userid'];
     $notclosedbyother = !($rules['closed'] && isset($post['closedbyid']) && !$rules['authorlast']);
     $nothiddenbyother = !($post['hidden'] && !$rules['authorlast']);
     $permiterror_hide_show = qa_user_permit_error($rules['isbyuser'] ? null : 'permit_hide_show', null, $userlevel);
     $rules['reshowimmed'] = $post['hidden'] && !qa_user_permit_error('permit_hide_show', null, $userlevel);
     // means post can be reshown immediately without checking whether it needs moderation
     $hideable = !$post['hidden'] && ($rules['isbyuser'] || !$rules['queued']) && !$permiterror_hide_show && ($notclosedbyother || !qa_user_permit_error('permit_hide_show', null, $userlevel));
     $showable = $post['hidden'] && !$permiterror_hide_show && ($rules['reshowimmed'] || $nothiddenbyother && !$post['flagcount']);
     // cannot reshow a question if it was hidden by someone else, or if it has flags - unless you have global hide/show permissions
     require_once QA_INCLUDE_DIR . 'qa-app-posts.php';
     if ($hideable && isset($data['action_data']['hide'])) {
         // hide allowed
         qa_post_set_hidden($postid, true, $userid);
     } else {
         if ($showable && !isset($data['action_data']['hide'])) {
             // reshow allowed
             qa_post_set_hidden($postid, false, $userid);
         } else {
             return false;
         }
     }
     return true;
 }
开发者ID:doekia,项目名称:q2a-xml-rpc,代码行数:32,代码来源:qa-xml-rpc-server.php

示例7: actionFillDb

 public function actionFillDb()
 {
     set_time_limit(0);
     ini_set('mysqli.reconnect', 'on');
     ini_set('mysql.connect_timeout', 400);
     // 		foreach (glob("C:/Users/fabio/git/qea/webapp/protected/vendors/qea/qa-include/*.php") as $filename)
     // 		{
     // 			inclde $filename;
     // 		}
     $tag = "";
     $criteria = new CDbCriteria();
     $criteria->condition = "post_type_l1 like '%useful%' AND post_type_l3 like '%si%' ";
     // 			$criteria->condition = "fbpid = 143370932459708";
     $posts = FbPost::model()->findAll($criteria);
     foreach ($posts as $p) {
         $blob_id = null;
         if ($this->addFakeName($p->author_id)) {
             $qa_user_id = $this->addAuthor($p->author_id);
         }
         if (is_array($qa_user_id)) {
             $qa_user_id = $qa_user_id[0];
         }
         // 				$tag =  str_replace("_baseline", "",$p->post_type_l2);
         // 				$tag =  str_replace("_", "-",$p->post_type_l2);
         //categories
         if (isset($p->degree_group_id)) {
             $category_id = $this->setSecondLevelCategory($p->degree_group_id, 1);
         } else {
             if (isset($p->exam_group_id)) {
                 $exam_group = ExamGroup::model()->findByPk($p->exam_group_id);
                 $course = Courses::model()->findByPk($exam_group->courses_id);
                 $parent = $this->setSecondLevelCategory($course->degree_id, 0);
                 $category_id = $this->setThirdLevelCategory($course->name, $parent);
                 // 				 	$exam_group = ExamGroup::model()->findByPk($p->exam_group_id);
                 // 				 	$course = Courses::model()->findByPk($exam_group->courses_id);
                 $tag = $course->name;
                 $tag = str_replace(" ", "-", $tag);
                 // 				 	$tag = $tag.",";
             }
         }
         $photo = PhotoFbPost::model()->findByAttributes(array('element_id' => $p->fbpid));
         if (isset($photo)) {
             $photo->medium = str_replace("/" . $photo->fid . "jpeg", "", $photo->medium);
             $blob_id = qa_upload_file($photo->medium, $photo->fid . 'jpeg');
         }
         $tag_hold = "";
         $substrmessage = substr($p->message, 0, 50);
         if (is_int(strpos($substrmessage, "["))) {
             for ($i = strpos($substrmessage, "[") + 1; $i < strlen($p->message); $i++) {
                 if ($p->message[$i] == "]") {
                     break;
                 }
                 $tag_hold = $tag_hold . $p->message[$i];
             }
             if ($tag == "") {
                 $tag = str_replace(" ", "-", $tag_hold);
             } else {
                 $tag = $tag . "," . str_replace(" ", "-", $tag_hold);
             }
         }
         $title = substr($p->message, 0, 100);
         $title = $title . "...";
         //posts
         if (qa_post_check_by_fb_id($p->fbpid) == null) {
             if ($blob_id != null) {
                 $p->message = '<p><img alt="" src="http://www.universitree.com/?qa=blob&amp;qa_blobid=' . $blob_id['blobid'] . '" style="height:250px;"><br>' . $p->message . '</p>';
                 //RIVEDI
                 $question_id = qa_post_create_with_data("Q", null, $title, $p->message, 'html', $p->created_time, $category_id, $tag, $qa_user_id);
                 qa_post_set_hidden($question_id, true);
             } else {
                 $question_id = qa_post_create_with_data("Q", null, $title, $p->message, '', $p->created_time, $category_id, $tag, $qa_user_id);
             }
             qa_post_create_fb_mapping($question_id, $p->fbpid);
             $this->addLikes($p->fbpid, $question_id);
             $this->addAnswer($p->fbpid, $question_id);
             //	$this->deletePost($p->fbpid);
         }
         // 				$comments = FbPostComment::model()->findAllByAttributes(array("ref_entity_id" => $p->fbpid));
         // 				foreach ($comments as $c){
         // 					if($this->addFakeName($c->author_id))
         // 					if(!$this->addAuthor($c->author_id))
         // 						echo "problemi di inconsistenza nei commenti";
         // 				}
         //inserire qui gli unset
         unset($blob_id);
         unset($qa_user_id);
         unset($category_id);
         unset($exam_group);
         unset($course);
         unset($photo);
         $p->post_type_l1 = "ut_base";
         $p->save();
     }
     //$this->deleteUselessPost();
 }
开发者ID:bafio89,项目名称:qea-u,代码行数:95,代码来源:DefaultController.php

示例8: ami_dhp_post_delete_recursive

 /**
  * Fetches the child posts of the question and delete them recursively
  *
  * @param $postid
  */
 function ami_dhp_post_delete_recursive($postid)
 {
     require_once QA_INCLUDE_DIR . 'qa-app-admin.php';
     require_once QA_INCLUDE_DIR . 'qa-db-admin.php';
     require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
     require_once QA_INCLUDE_DIR . 'qa-app-format.php';
     require_once QA_INCLUDE_DIR . 'qa-app-posts.php';
     global $ami_dhp_posts_deleted;
     if (is_null($ami_dhp_posts_deleted)) {
         $ami_dhp_posts_deleted = array();
     }
     if (in_array($postid, $ami_dhp_posts_deleted)) {
         return;
     }
     $oldpost = qa_post_get_full($postid, 'QAC');
     if (!$oldpost['hidden']) {
         qa_post_set_hidden($postid, true, null);
         $oldpost = qa_post_get_full($postid, 'QAC');
     }
     switch ($oldpost['basetype']) {
         case 'Q':
             $answers = qa_post_get_question_answers($postid);
             $commentsfollows = qa_post_get_question_commentsfollows($postid);
             $closepost = qa_post_get_question_closepost($postid);
             if (count($answers)) {
                 foreach ($answers as $answer) {
                     ami_dhp_post_delete_recursive($answer['postid']);
                 }
             }
             if (count($commentsfollows)) {
                 foreach ($commentsfollows as $commentsfollow) {
                     ami_dhp_post_delete_recursive($commentsfollow['postid']);
                 }
             }
             if (!in_array($oldpost['postid'], $ami_dhp_posts_deleted)) {
                 qa_question_delete($oldpost, null, null, null, $closepost);
                 $ami_dhp_posts_deleted[] = $oldpost['postid'];
             }
             break;
         case 'A':
             $question = qa_post_get_full($oldpost['parentid'], 'Q');
             $commentsfollows = qa_post_get_answer_commentsfollows($postid);
             if (count($commentsfollows)) {
                 foreach ($commentsfollows as $commentsfollow) {
                     ami_dhp_post_delete_recursive($commentsfollow['postid']);
                 }
             }
             if (!in_array($oldpost['postid'], $ami_dhp_posts_deleted)) {
                 qa_answer_delete($oldpost, $question, null, null, null);
                 $ami_dhp_posts_deleted[] = $oldpost['postid'];
             }
             break;
         case 'C':
             $parent = qa_post_get_full($oldpost['parentid'], 'QA');
             $question = qa_post_parent_to_question($parent);
             if (!in_array($oldpost['postid'], $ami_dhp_posts_deleted)) {
                 qa_comment_delete($oldpost, $question, $parent, null, null, null);
                 $ami_dhp_posts_deleted[] = $oldpost['postid'];
             }
             break;
     }
 }
开发者ID:aunna77doe,项目名称:q2a-delete-hidden-posts,代码行数:67,代码来源:qa-dhp-utils.php

示例9: qa_db_user_set_flag

            qa_db_user_set_flag($userid, QA_USER_FLAGS_USER_BLOCKED, true);
            qa_report_event('u_block', $qa_login_userid, qa_get_logged_in_handle(), $qa_cookieid, array('userid' => $userid, 'handle' => $useraccount['handle']));
            qa_redirect($qa_request);
        }
        if (qa_clicked('dounblock')) {
            require_once QA_INCLUDE_DIR . 'qa-db-users.php';
            qa_db_user_set_flag($userid, QA_USER_FLAGS_USER_BLOCKED, false);
            qa_report_event('u_unblock', $qa_login_userid, qa_get_logged_in_handle(), $qa_cookieid, array('userid' => $userid, 'handle' => $useraccount['handle']));
            qa_redirect($qa_request);
        }
        if (qa_clicked('dohideall') && !qa_user_permit_error('permit_hide_show')) {
            require_once QA_INCLUDE_DIR . 'qa-db-admin.php';
            require_once QA_INCLUDE_DIR . 'qa-app-posts.php';
            $postids = qa_db_get_user_visible_postids($userid);
            foreach ($postids as $postid) {
                qa_post_set_hidden($postid, true, $qa_login_userid);
            }
            qa_redirect($qa_request);
        }
    }
}
//	Get information on user references in answers and other stuff need for page
$pagesize = qa_opt('page_size_user_posts');
$questions = qa_any_sort_by_date(array_merge($questions, $answerquestions, $commentquestions));
$questions = array_slice($questions, 0, $pagesize);
$usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
$usershtml[$userid] = $userhtml;
//	Prepare content for theme
$qa_content = qa_content_prepare(true);
$qa_content['title'] = qa_lang_html_sub('profile/user_x', $userhtml);
//	General information about the user, only available if we're using internal user management
开发者ID:TheProjecter,项目名称:microprobe,代码行数:31,代码来源:qa-page-user.php


注:本文中的qa_post_set_hidden函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。