Changeset 703

Show
Ignore:
Timestamp:
11/09/06 14:49:59 (2 years ago)
Author:
sven
Message:

add a $CFG option to globally disable public comments

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/config-dist.php

    r542 r703  
    8181    $CFG->default_access = "LOGGED_IN"; 
    8282 
     83// Set the following to true to force users to log in before they can post comments, overriding per-user option 
     84// Handy sledgehammer-to-crack-a-nut to protect against comment spam. 
     85    $CFG->disable_publiccomments = false; 
     86     
    8387// dataroot. this is where uploaded files will go (and sessions for now) 
    8488// This should be OUTSIDE your wwwroot. 
  • devel/htaccess-dist

    r694 r703  
    77 
    88Options +FollowSymLinks 
     9 
     10# PHP defaults to allowing file uploads of max 2MB, below is example option for 5MB. 
     11# NB: Adjusting value may not work, depending on other configured php and apache limits 
     12#php_value upload_max_filesize 5242880 
    913 
    1014# Not really necessary, just to be clean 
  • devel/lib/setup.php

    r701 r703  
    6060if (empty($CFG->disable_templatechanging)) { 
    6161    $CFG->disable_templatechanging = false; 
     62} 
     63 
     64if (empty($CFG->disable_publiccomments)) { 
     65    $CFG->disable_publiccomments = false; 
    6266} 
    6367 
  • devel/units/users/userdetails_actions.php

    r659 r703  
    22 
    33// Userdetails actions 
    4 global $USER
     4global $USER, $CFG
    55global $page_owner; 
    66 
     
    4848            } 
    4949 
    50             $publiccomments = optional_param('publiccomments'); 
    51             if ($usertype == 'person' && !empty($publiccomments)) { 
    52                 if ($publiccomments == "yes") { 
    53                     user_flag_set("publiccomments", "1", $id); 
    54                     $messages[] = __gettext("Public comments and discussion set to 'on'."); 
    55                 } else { 
    56                     user_flag_unset("publiccomments",$id); 
    57                     $messages[] = __gettext("Public comments and discussion set to 'off'."); 
     50            if (!$CFG->disable_publiccomments) { 
     51                $publiccomments = optional_param('publiccomments'); 
     52                if ($usertype == 'person' && !empty($publiccomments)) { 
     53                    if ($publiccomments == "yes") { 
     54                        user_flag_set("publiccomments", "1", $id); 
     55                        $messages[] = __gettext("Public comments and discussion set to 'on'."); 
     56                    } else { 
     57                        user_flag_unset("publiccomments",$id); 
     58                        $messages[] = __gettext("Public comments and discussion set to 'off'."); 
     59                    } 
    5860                } 
    5961            } 
  • devel/units/users/userdetails_edit.php

    r659 r703  
    11<?php 
    22 
    3     global $page_owner
     3    global $page_owner, $CFG
    44     
    55    if (user_type($page_owner) == 'person' && run("permissions:check",array("userdetails:change", $page_owner))) { 
     
    101101END; 
    102102 
    103     $emailreplies = user_flag_get("publiccomments",$page_owner); 
    104     if ($emailreplies) { 
    105         $body .= templates_draw(array( 
    106             'context' => 'databox', 
    107             'name' => __gettext("Public comments: "), 
    108             'column1' => "<label><input type=\"radio\" name=\"publiccomments\" value=\"yes\" checked=\"checked\" /> " . __gettext("Yes") . "</label> <label><input type=\"radio\" name=\"publiccomments\" value=\"no\" /> " . __gettext("No") . "</label>" 
    109         ) 
    110         ); 
    111     } else { 
    112         $body .= templates_draw(array( 
    113             'context' => 'databox', 
    114             'name' => __gettext("Public comments: "), 
    115             'column1' => "<label><input type=\"radio\" name=\"publiccomments\" value=\"yes\" /> " . __gettext("Yes") . "</label> <label><input type=\"radio\" name=\"publiccomments\" value=\"no\" checked=\"checked\" /> " . __gettext("No") . "</label>" 
    116         ) 
    117         ); 
     103    if (!$CFG->disable_publiccomments) { 
     104        $publiccomments = user_flag_get("publiccomments",$page_owner); 
     105        if ($publiccomments) { 
     106            $body .= templates_draw(array( 
     107                'context' => 'databox', 
     108                'name' => __gettext("Public comments: "), 
     109                'column1' => "<label><input type=\"radio\" name=\"publiccomments\" value=\"yes\" checked=\"checked\" /> " . __gettext("Yes") . "</label> <label><input type=\"radio\" name=\"publiccomments\" value=\"no\" /> " . __gettext("No") . "</label>" 
     110            ) 
     111            ); 
     112        } else { 
     113            $body .= templates_draw(array( 
     114                'context' => 'databox', 
     115                'name' => __gettext("Public comments: "), 
     116                'column1' => "<label><input type=\"radio\" name=\"publiccomments\" value=\"yes\" /> " . __gettext("Yes") . "</label> <label><input type=\"radio\" name=\"publiccomments\" value=\"no\" checked=\"checked\" /> " . __gettext("No") . "</label>" 
     117            ) 
     118            ); 
     119        } 
    118120    } 
    119121         
  • devel/units/weblogs/weblogs_actions.php

    r659 r703  
    134134                if (run("spam:check",$comment->body) != true) { 
    135135                    // If we're logged on or comments are public, add one 
    136                     if (logged_on || user_flag_get("publiccomments",$post->owner)) { 
     136                    if (logged_on || (!$CFG->disable_publiccomments && user_flag_get("publiccomments",$post->owner)) ) { 
    137137                        $comment->owner = $USER->ident; 
    138138                        $comment->posted = time(); 
  • devel/units/weblogs/weblogs_posts_view.php

    r694 r703  
    200200                                          ); 
    201201             
    202             if (logged_on || user_flag_get("publiccomments",$post->owner)) { 
     202            if (logged_on || (!$CFG->disable_publiccomments && user_flag_get("publiccomments",$post->owner)) ) { 
    203203                $run_result .= run("weblogs:comments:add",$post); 
    204204            } else {