示例#1
0
 /**
  * Write the accept/reject buttons.
  *
  * @staticvar null $DiscussionModel
  * @staticvar boolean $InformMessage
  *
  * @param DiscussionController $sender Sending controller instance.
  * @param array $args Event arguments.
  */
 public function discussionController_afterCommentBody_handler($sender, $args)
 {
     $Discussion = $sender->data('Discussion');
     $Comment = val('Comment', $args);
     if (!$Comment) {
         return;
     }
     $CommentID = val('CommentID', $Comment);
     if (!is_numeric($CommentID)) {
         return;
     }
     if (!$Discussion) {
         static $DiscussionModel = null;
         if ($DiscussionModel === null) {
             $DiscussionModel = new DiscussionModel();
         }
         $Discussion = $DiscussionModel->getID(val('DiscussionID', $Comment));
     }
     if (!$Discussion || strtolower(val('Type', $Discussion)) != 'question') {
         return;
     }
     // Check permissions.
     $CanAccept = Gdn::session()->checkPermission('Garden.Moderation.Manage');
     $CanAccept |= Gdn::session()->UserID == val('InsertUserID', $Discussion);
     if (!$CanAccept) {
         return;
     }
     $QnA = val('QnA', $Comment);
     if ($QnA) {
         return;
     }
     $Query = http_build_query(array('commentid' => $CommentID, 'tkey' => Gdn::session()->transientKey()));
     echo '<div class="ActionBlock QnA-Feedback">';
     echo '<span class="DidThisAnswer">' . t('Did this answer the question?') . '</span> ';
     echo '<span class="QnA-YesNo">';
     echo anchor(t('Yes'), '/discussion/qna/accept?' . $Query, array('class' => 'React QnA-Yes', 'title' => t('Accept this answer.')));
     echo ' ' . bullet() . ' ';
     echo anchor(t('No'), '/discussion/qna/reject?' . $Query, array('class' => 'React QnA-No', 'title' => t('Reject this answer.')));
     echo '</span>';
     echo '</div>';
 }
示例#2
0
/**
 * callback to display sublist element
 */
function cat_select_before_each($cat_ID, $level, $total_count)
{
    // callback to display sublist element
    global $current_blog_ID, $blog, $post_extracats, $edited_Item, $current_User;
    global $creating, $cat_select_level, $cat_select_form_fields;
    global $cat_sel_total_count;
    $ChapterCache =& get_ChapterCache();
    $thisChapter = $ChapterCache->get_by_ID($cat_ID);
    if ($thisChapter->lock && !$current_User->check_perm('blog_cats', '', false, $current_blog_ID)) {
        // This chapter is locked and current user has no permission to edit the categories of this blog
        return;
    }
    $cat_sel_total_count++;
    $r = "\n" . '<tr class="' . ($total_count % 2 ? 'odd' : 'even') . '">';
    // RADIO for main cat:
    if (get_post_cat_setting($blog) != 2) {
        // if no "Multiple categories per post" option is set display radio
        if (!$thisChapter->meta && ($current_blog_ID == $blog || get_allow_cross_posting($blog) >= 2)) {
            // This is current blog or we allow moving posts accross blogs
            if ($cat_select_form_fields) {
                // We want a form field:
                $r .= '<td class="selector catsel_main"><input type="radio" name="post_category" class="checkbox" title="' . T_('Select as MAIN category') . '" value="' . $cat_ID . '"';
                if ($cat_ID == $edited_Item->main_cat_ID) {
                    // main cat of the Item or set as default main cat above
                    $r .= ' checked="checked"';
                }
                $r .= ' id="sel_maincat_' . $cat_ID . '"';
                $r .= ' onclick="check_extracat(this);" /></td>';
            } else {
                // We just want info:
                $r .= '<td class="selector catsel_main">' . bullet($cat_ID == $edited_Item->main_cat_ID) . '</td>';
            }
        } else {
            // Don't allow to select this cat as a main cat
            $r .= '<td class="selector catsel_main">&nbsp;</td>';
        }
    }
    // CHECKBOX:
    if (get_post_cat_setting($blog) >= 2) {
        // We allow multiple categories or main + extra cat,  display checkbox:
        if (!$thisChapter->meta && ($current_blog_ID == $blog || get_allow_cross_posting($blog) % 2 == 1 || get_allow_cross_posting($blog) == 2 && get_post_cat_setting($blog) == 2)) {
            // This is the current blog or we allow cross posting (select extra cat from another blog)
            if ($cat_select_form_fields) {
                // We want a form field:
                $r .= '<td class="selector catsel_extra"><input type="checkbox" name="post_extracats[]" class="checkbox" title="' . T_('Select as an additional category') . '" value="' . $cat_ID . '"';
                // if( ($cat_ID == $edited_Item->main_cat_ID) || (in_array( $cat_ID, $post_extracats )) )  <--- We don't want to precheck the default cat because it will stay checked if we change the default main. On edit, the checkbox will always be in the array.
                if (in_array($cat_ID, $post_extracats)) {
                    // This category was selected
                    $r .= ' checked="checked"';
                }
                $r .= ' id="sel_extracat_' . $cat_ID . '"';
                $r .= ' /></td>';
            } else {
                // We just want info:
                $r .= '<td class="selector catsel_main">' . bullet($cat_ID == $edited_Item->main_cat_ID || in_array($cat_ID, $post_extracats)) . '</td>';
            }
        } else {
            // Don't allow to select this cat as an extra cat
            $r .= '<td class="selector catsel_main">&nbsp;</td>';
        }
    }
    $additional_style = '';
    if ($thisChapter->meta) {
        // Change style of meta category
        $additional_style .= 'font-weight:bold;';
    }
    $chapter_lock_status = '';
    if ($thisChapter->lock) {
        // Add icon for locked category
        $chapter_lock_status = '<span style="padding-left:5px">' . get_icon('file_not_allowed', 'imgtag', array('title' => T_('Locked'))) . '</span>';
    }
    $BlogCache =& get_BlogCache();
    $r .= '<td class="catsel_name"><label' . ' for="' . (get_post_cat_setting($blog) == 2 ? 'sel_extracat_' . $cat_ID : 'sel_maincat_' . $cat_ID) . '"' . ' style="padding-left:' . ($level - 1) . 'em;' . $additional_style . '">' . $thisChapter->name . '</label>' . $chapter_lock_status . ' <a href="' . htmlspecialchars($thisChapter->get_permanent_url()) . '" title="' . htmlspecialchars(T_('View category in blog.')) . '">' . '&nbsp;&raquo;&nbsp;' . '</a></td>' . '<!--[if IE 7]><td width="1"><!-- for IE7 --></td><![endif]--></tr>' . "\n";
    return $r;
}
function ol($a)
{
    return bullet(func_get_args(), 'ol');
}
示例#4
0
文件: _item.funcs.php 项目: LFSF/oras
/**
 * callback to display sublist element
 */
function cat_select_before_each($cat_ID, $level, $total_count)
{
    // callback to display sublist element
    global $current_blog_ID, $blog, $post_extracats, $edited_Item;
    global $creating, $allow_cross_posting, $cat_select_level, $cat_select_form_fields;
    $this_cat = get_the_category_by_ID($cat_ID);
    $r = "\n" . '<tr class="' . ($total_count % 2 ? 'odd' : 'even') . '">';
    // RADIO for main cat:
    if ($current_blog_ID == $blog || $allow_cross_posting > 2) {
        // This is current blog or we allow moving posts accross blogs
        if ($cat_select_form_fields) {
            // We want a form field:
            $r .= '<td class="selector catsel_main"><input type="radio" name="post_category" class="checkbox" title="' . T_('Select as MAIN category') . '" value="' . $cat_ID . '"';
            if ($cat_ID == $edited_Item->main_cat_ID) {
                // main cat of the Item or set as default main cat above
                $r .= ' checked="checked"';
            }
            $r .= ' id="sel_maincat_' . $cat_ID . '"';
            $r .= ' onclick="check_extracat(this);" /></td>';
        } else {
            // We just want info:
            $r .= '<td class="selector catsel_main">' . bullet($cat_ID == $edited_Item->main_cat_ID) . '</td>';
        }
    } else {
        // Don't allow to select this cat as a main cat
        $r .= '<td class="selector catsel_main">&nbsp;</td>';
    }
    // CHECKBOX:
    if ($allow_cross_posting) {
        // We allow cross posting, display checkbox:
        if ($cat_select_form_fields) {
            // We want a form field:
            $r .= '<td class="selector catsel_extra"><input type="checkbox" name="post_extracats[]" class="checkbox" title="' . T_('Select as an additional category') . '" value="' . $cat_ID . '"';
            // if( ($cat_ID == $edited_Item->main_cat_ID) || (in_array( $cat_ID, $post_extracats )) )  <--- We don't want to precheck the default cat because it will stay checked if we change the default main. On edit, the checkbox will always be in the array.
            if (in_array($cat_ID, $post_extracats)) {
                $r .= ' checked="checked"';
            }
            $r .= ' id="sel_extracat_' . $cat_ID . '"';
            $r .= ' /></td>';
        } else {
            // We just want info:
            $r .= '<td class="selector catsel_main">' . bullet($cat_ID == $edited_Item->main_cat_ID || in_array($cat_ID, $post_extracats)) . '</td>';
        }
    }
    $r .= '<td class="catsel_name"><label' . ' for="' . ($allow_cross_posting ? 'sel_extracat_' . $cat_ID : 'sel_maincat_' . $cat_ID) . '"' . ' style="padding-left:' . ($level - 1) . 'em;">' . $this_cat['cat_name'] . '</label>' . "</td></tr>\n";
    return $r;
}
示例#5
0
                         continue;
                 }
         }
     } else {
         $page->setStatus("Blocked");
         continue;
     }
 } else {
     // Accepted but not indexed types
     // User must supply details via Entry List panel
 }
 $page->status = $_XDATA['cleanup'] ? "Orphan" : "OK";
 $page->mysqlPrep();
 /* HVZM -- */
 if ($page->noindex) {
     echo "<h3 class=\"notice warning\"" . (strpos($page->uri, "~") !== false ? " style=\"color:#009;font-style:italic\"" : " style=\"color:#fb0\"") . ">" . bullet($page->uri) . " <strong>IGNORED</strong> ", $_LOG[] = $page->uri . " ignored because of meta-tag 'noindex'", "</h3>\n";
 } else {
     /* -- HVZM */
     if (count($_EXISTING)) {
         $update = mysql_query("UPDATE `{$_DDATA['tabletemp']}` SET\n                    `md5`='{$page->md5}',\n                    `ctype`='{$page->ctype}',\n                    " . ($_EXISTING['locked'] == "false" ? "`title`='{$page->title}'," : "") . "\n                    " . ($_EXISTING['locked'] == "false" && $page->description ? "`description`='{$page->description}'," : "") . "\n                    " . ($_EXISTING['locked'] == "false" && $page->keywords ? "`keywords`='{$page->keywords}'," : "") . "\n                    `wtags`='{$page->wtags}',\n                    `body`='{$page->body}',\n                    `links`='{$page->links}',\n                    `encoding`='{$page->charset}',\n                    `status`='{$page->status}',\n                    `new`='{$page->isnew}',\n                    `sm.lastmod`={$page->lastmod},\n                    `sm.changefreq`='{$page->changefreq}'\n                  WHERE `uri`='" . addslashes($page->uri) . "';", $_DDATA['link']);
         if (mysql_affected_rows()) {
             if ($page->status != "Orphan" || $page->isnew == "true") {
                 $_XDATA['stats']['Updated']++;
             }
         } else {
             echo mysql_error();
         }
         addTime("MySQL");
     } else {
         $category = $GLOBALS['VDATA']['sp.defcat'];
         reset($_XDATA['autoCat']);