Dotclear

Changeset 246


Ignore:
Timestamp:
10/03/08 16:49:39 (15 years ago)
Author:
olivier
Message:

Minor fixes in authorMode.

Location:
plugins/authorMode
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • plugins/authorMode/_admin.php

    r217 r246  
    1010# 
    1111# -- END LICENSE BLOCK ------------------------------------ 
     12if (!defined('DC_CONTEXT_ADMIN')) { return; } 
     13 
    1214require_once dirname(__FILE__).'/_widgets.php'; 
    1315 
     
    2325$core->addBehavior('adminBeforeUserUpdate',array('authorModeBehaviors','adminBeforeUserUpdate')); 
    2426 
    25 class authorModeBehaviors { 
    26  
     27class authorModeBehaviors 
     28{ 
    2729     public static function adminBeforeUserUpdate(&$cur,&$user_id = '') 
    2830     { 
    2931          $cur->user_desc = $_POST['user_desc']; 
    3032     } 
    31  
    32  
     33      
    3334     public static function adminAuthorHeaders() 
    3435     { 
     
    3738          dcPage::jsLoad('index.php?pf=authorMode/_user.js'); 
    3839     } 
    39  
     40      
    4041     public static function adminAuthorForm(&$rs) 
    4142     { 
     
    4950          elseif ($rs instanceof record && $rs->exists('user_desc')) {$user_desc = $rs->user_desc;} 
    5051          else $user_desc = ''; 
    51  
     52           
    5253          echo 
    5354          '<fieldset class="clear"><legend>'. 
  • plugins/authorMode/_define.php

    r217 r246  
    1010# 
    1111# -- END LICENSE BLOCK ------------------------------------ 
     12if (!defined('DC_RC_PATH')) { return; } 
    1213 
    1314$this->registerModule( 
     
    1516     /* Description*/         "post entries per author + author desc handling", 
    1617     /* Author */             "xave", 
    17      /* Version */            '1.2.1', 
     18     /* Version */            '1.2.2', 
    1819     /* Permissions */        'admin,contentadmin' 
    1920); 
  • plugins/authorMode/_prepend.php

    r217 r246  
    1010# 
    1111# -- END LICENSE BLOCK ------------------------------------ 
     12if (!defined('DC_RC_PATH')) { return; } 
     13 
    1214$core =& $GLOBALS['core']; 
    1315 
    1416class rsAuthor 
    15 {  
     17{ 
    1618     public static function getAuthorCN(&$rs) 
    1719     { 
     
    3840          return $rs->user_email; 
    3941     } 
    40 }     
     42} 
    4143 
    42 if ($core->blog->settings->authormode_active)  
     44if ($core->blog->settings->authormode_active) 
    4345{ 
    4446     if ($core->blog->settings->authormode_url_author !== null) { 
  • plugins/authorMode/_public.php

    r217 r246  
    1010# 
    1111# -- END LICENSE BLOCK ------------------------------------ 
     12if (!defined('DC_RC_PATH')) { return; } 
     13if (!$core->blog->settings->authormode_active) { return; } 
     14 
    1215require_once dirname(__FILE__).'/_widgets.php'; 
    1316 
     
    3841          $args = func_get_args(); 
    3942          array_shift($args); 
    40  
     43           
    4144          if ($args[0] == 'Comments') { 
    4245               $p = 
     
    8386               $p = '$params = array();'."\n".$p; 
    8487          } 
    85       
     88           
    8689          $res = 
    8790          "<?php\n". 
     
    9598          return $res; 
    9699     } 
    97  
     100      
    98101     public static function AuthorsHeader($attr,$content) 
    99102     { 
     
    118121          'echo $_ctx->users->user_desc;'."\n". 
    119122          "?>\n"; 
    120  
     123           
    121124          return $res; 
    122125     } 
    123  
     126      
    124127     public static function AuthorPostsURL($attr) 
    125128     { 
     
    129132               "/".$_ctx->users->user_id').'; ?>'; 
    130133     } 
    131  
     134      
    132135     public static function AuthorNbPosts($attr) 
    133136     { 
     
    136139     } 
    137140      
    138  
     141      
    139142     public static function AuthorCommonName($attr) 
    140143     { 
     
    166169          return '<?php echo '.sprintf($f,'$_ctx->users->user_id').'; ?>'; 
    167170     } 
    168  
     171      
    169172     public static function AuthorEmail($attr) 
    170173     { 
     
    189192          return '<?php echo '.sprintf($f,'$_ctx->users->user_url').'; ?>'; 
    190193     } 
    191  
     194      
    192195     public static function AuthorFeedURL($attr) 
    193196     { 
     
    202205          'rawurlencode($_ctx->users->user_id)."/'.$type.'"').'; ?>'; 
    203206     } 
    204  
    205207} 
    206       
     208 
    207209 
    208210class urlAuthor extends dcUrlHandlers 
     
    219221               } 
    220222               $GLOBALS['_ctx']->users = authormodeUtils::getPostsUsers($args); 
    221  
     223                
    222224               if ($GLOBALS['_ctx']->users->isEmpty()) { 
    223225                    self::p404(); 
    224226               } 
    225            
     227                
    226228               self::serveDocument('author.html'); 
    227229          } 
     
    232234     { 
    233235          $GLOBALS['_ctx']->users = authormodeUtils::getPostsUsers($args); 
    234  
     236           
    235237          if ($GLOBALS['_ctx']->users->isEmpty()) { 
    236238               self::p404(); 
    237239          } 
    238  
     240           
    239241          self::serveDocument('authors.html'); 
    240242          exit; 
    241243     } 
    242  
     244      
    243245     public static function feed($args) 
    244246     { 
     
    261263               self::p404(); 
    262264          } 
    263                 
     265           
    264266          if ($type == 'atom') { 
    265267               $mime = 'application/atom+xml'; 
     
    282284     { 
    283285          global $core; 
    284  
     286           
    285287          if ($params !== null && is_string($params)) { 
    286288               $params = array('author' => $params); 
    287289          } 
    288  
     290           
    289291          $strReq = 
    290292          'SELECT P.user_id, user_name, user_firstname, '. 
     
    294296          "WHERE blog_id = '".$core->con->escape($core->blog->id)."' ". 
    295297          'AND P.post_status = 1 '; 
    296  
     298           
    297299          if (!empty($params['author'])) { 
    298300               $strReq .= 
     
    309311               " AND P.post_type = 'post' "; 
    310312          } 
    311                                
     313           
    312314          $strReq .= 
    313315          'GROUP BY P.user_id, user_name, user_firstname, user_displayname, user_desc '; 
    314  
     316           
    315317          if (!empty($params['order'])) { 
    316318               $strReq .= 
     
    322324               'ORDER BY user_displayname, user_firstname, user_name '; 
    323325          } 
    324  
     326           
    325327          try 
    326328          { 
  • plugins/authorMode/_widgets.php

    r217 r246  
    1010# 
    1111# -- END LICENSE BLOCK ------------------------------------ 
     12if (!defined('DC_RC_PATH')) { return; } 
     13 
    1214$core->addBehavior('initWidgets',array('widgetsAuthorMode','init')); 
    1315 
     
    4446          return $res; 
    4547     } 
    46  
    47  
     48      
    4849     public static function init(&$w) 
    4950     { 
  • plugins/authorMode/index.php

    r217 r246  
    2222     { 
    2323          $core->blog->settings->setNameSpace('authormode'); 
    24  
     24           
    2525          $active = (empty($_POST['active']))?false:true; 
    2626          if (trim($_POST['url_author']) == '') { 
     
    3636          $posts_only  = (empty($_POST['posts_only']))?false:true; 
    3737          $alpha_order = (empty($_POST['alpha_order']))?false:true; 
    38  
     38           
    3939          $core->blog->settings->put('authormode_active',$active,'boolean'); 
    4040          $core->blog->settings->put('authormode_url_author',$url_author,'string'); 
     
    4343          $core->blog->settings->put('authormode_default_alpha_order',$alpha_order,'boolean'); 
    4444          $core->blog->triggerBlog(); 
    45  
     45           
    4646          $msg = __('Configuration successfully updated.'); 
    4747     } 
Note: See TracChangeset for help on using the changeset viewer.

Sites map