File indexing completed on 2024-05-12 05:58:40

0001 <?php
0002 
0003 /**
0004  *  ocs-webserver
0005  *
0006  *  Copyright 2016 by pling GmbH.
0007  *
0008  *    This file is part of ocs-webserver.
0009  *
0010  *    This program is free software: you can redistribute it and/or modify
0011  *    it under the terms of the GNU Affero General Public License as
0012  *    published by the Free Software Foundation, either version 3 of the
0013  *    License, or (at your option) any later version.
0014  *
0015  *    This program is distributed in the hope that it will be useful,
0016  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
0017  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0018  *    GNU Affero General Public License for more details.
0019  *
0020  *    You should have received a copy of the GNU Affero General Public License
0021  *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
0022  *
0023  * Created: 31.05.2017
0024  */
0025 class SpamController extends Local_Controller_Action_DomainSwitch
0026 {
0027   const RESULT_OK = "OK";
0028   const RESULT_ERROR = "ERROR";
0029   const IDENTIFIER = 'comment_id';
0030   
0031     public function indexAction()
0032     {
0033         $this->forward('list', 'spam', 'default', $this->getAllParams());
0034     }
0035 
0036     public function listAction()
0037     {
0038       $this->view->headTitle('Spam','SET');
0039         $this->view->page = (int)$this->getParam('page', 1);
0040     }
0041 
0042     public function commentsAction()
0043     { 
0044       $this->view->headTitle('Spam - Comments','SET');
0045       
0046     }
0047      public function productAction()
0048     {   
0049         $this->view->headTitle('Watchlist - Products-10-files','SET');
0050         
0051     }
0052 
0053     public function newproductAction()
0054     {   
0055         $this->view->headTitle('Watchlist - new products < 2 months','SET');
0056         
0057     }
0058     public function unpublishedproductAction()
0059     {
0060         $this->view->headTitle('Watchlist - Unpublished Products','SET');
0061     }
0062 
0063     public function paypalAction()
0064     {   
0065         $this->view->headTitle('Watchlist - Paypal duplicated','SET');
0066     }
0067     public function mdsumAction()
0068     {   
0069         $this->view->headTitle('Watchlist - Md5sum duplicated','SET');
0070     }
0071 
0072     public function deprecatedAction()
0073     {   
0074         $this->view->headTitle('Watchlist - Deprecated Products','SET');
0075         
0076     }
0077 
0078     public function deletecommentAction()
0079     {
0080         $commentId = (int)$this->getParam(self::IDENTIFIER, null);
0081 
0082         $model = new Default_Model_DbTable_Comments();
0083         $record = $model->find($commentId)->current();
0084         $record->comment_active = 0;
0085         $record->save();
0086 
0087         $jTableResult = array();
0088         $jTableResult['Result'] = self::RESULT_OK;
0089         $jTableResult['Record'] = $record->toArray();
0090         $this->_helper->json($jTableResult);
0091     }
0092 
0093     public function deletereportsAction()
0094     {
0095         $commentId = (int)$this->getParam(self::IDENTIFIER, null);              
0096       $sql = '
0097               UPDATE reports_comment
0098               SET is_deleted = 1
0099               WHERE comment_id = :comment_id';
0100       Zend_Db_Table::getDefaultAdapter()->query($sql, array('comment_id' => $commentId))->execute();        
0101         
0102         $jTableResult = array();
0103         $jTableResult['Result'] = self::RESULT_OK;
0104         $jTableResult['Record'] = array();
0105         $this->_helper->json($jTableResult);
0106     }
0107 
0108     public function paypallistAction()
0109     {
0110         $startIndex = (int)$this->getParam('jtStartIndex');
0111         $pageSize = (int)$this->getParam('jtPageSize');
0112         $sorting = $this->getParam('jtSorting');     
0113 
0114         if(!isset($sorting))
0115         {
0116             $sorting = ' paypal_mail ';
0117         }        
0118 
0119         $sql = "
0120                     select a.*, 
0121                     (       select sum(d.credits_plings)/100  amount
0122                             from micro_payout d
0123                             where d.member_id in (a.ids)
0124                             and d.yearmonth= DATE_FORMAT(CURRENT_DATE() - INTERVAL 1 MONTH, '%Y%m')
0125                             and d.is_pling_excluded = 0 
0126                             and d.is_license_missing = 0
0127                             and d.is_member_pling_excluded = 0
0128                             and d.is_source_missing = 0
0129                             ) as amount
0130                     from
0131                     (
0132                         select paypal_mail, GROUP_CONCAT(member_id) ids, GROUP_CONCAT(username) names
0133                         , count(1) cnt 
0134                         , GROUP_CONCAT(m.is_deleted) is_deleted    
0135                         ,max(m.created_at) as created_at    
0136                         ,sum(m.is_deleted) as sum_is_deleted
0137                         from member m
0138                         where  m.paypal_mail is not null and m.paypal_mail <> '' and (m.paypal_mail regexp '^[A-Z0-9._%-]+@[A-Z0-9.-]+.[A-Z]{2,4}$') 
0139                         group by paypal_mail   
0140                         order by m.created_at desc
0141                     ) a
0142                     where  cnt > 1 and cnt>sum_is_deleted
0143                     
0144         
0145                     
0146                 ";
0147         $sql .= ' order by ' . $sorting;
0148         $sql .= ' limit ' . $pageSize;
0149         $sql .= ' offset ' . $startIndex;
0150         
0151         $results = Zend_Db_Table::getDefaultAdapter()->fetchAll($sql);                        
0152 
0153         $sqlall = "  select count(1) cnt from
0154                     (
0155                         select paypal_mail, GROUP_CONCAT(member_id) ids, GROUP_CONCAT(username) names
0156                         , count(1) cnt 
0157                         , GROUP_CONCAT(m.is_deleted) is_deleted    
0158                         ,max(m.created_at) as created_at    
0159                         ,sum(m.is_deleted) as sum_is_deleted
0160                         from member m
0161                         where  m.paypal_mail is not null and m.paypal_mail <> '' and (m.paypal_mail regexp '^[A-Z0-9._%-]+@[A-Z0-9.-]+.[A-Z]{2,4}$') 
0162                         group by paypal_mail  
0163                     ) a
0164                     where  cnt > 1 and cnt>sum_is_deleted";         
0165 
0166         $reportsAll = Zend_Db_Table::getDefaultAdapter()->fetchRow($sqlall);
0167 
0168 
0169         $jTableResult = array();
0170         $jTableResult['Result'] = self::RESULT_OK;
0171         $jTableResult['Records'] = $results;        
0172         $jTableResult['TotalRecordCount'] = $reportsAll['cnt'];
0173         $this->_helper->json($jTableResult);
0174 
0175     }
0176 
0177     public function mdsumlistAction()
0178     {
0179         $startIndex = (int)$this->getParam('jtStartIndex');
0180         $pageSize = (int)$this->getParam('jtPageSize');
0181         $sorting = $this->getParam('jtSorting');     
0182 
0183         if(!isset($sorting))
0184         {
0185             $sorting = ' changed_at desc ';
0186         }        
0187 
0188         $sql = "
0189                     select 
0190                     * 
0191                     from 
0192                     (
0193                         select f.owner_id as member_id,m.username, f.md5sum, COUNT(1) cnt, GROUP_CONCAT(distinct p.project_id) as projects
0194                         , count(distinct p.project_id) cntProjects
0195                         ,max(p.changed_at) as changed_at
0196                         from  ppload.ppload_files f
0197                         join project p on f.collection_id = p.ppload_collection_id
0198                         join member m on f.owner_id = m.member_id and m.is_deleted=0 and m.is_active = 1
0199                         where f.md5sum is not null
0200                         group by f.md5sum 
0201                         having count(1)>1
0202                     ) t
0203                     where cntProjects>1                                    
0204                 ";
0205         $sql .= ' order by ' . $sorting;
0206         $sql .= ' limit ' . $pageSize;
0207         $sql .= ' offset ' . $startIndex;
0208         
0209         $results = Zend_Db_Table::getDefaultAdapter()->fetchAll($sql);                        
0210 
0211         $sqlall = " select 
0212                         count(1) as cnt
0213                         from 
0214                         (
0215                             select f.owner_id as member_id,m.username, f.md5sum, COUNT(1) cnt, GROUP_CONCAT(distinct p.project_id) as projects
0216                             , count(distinct p.project_id) cntProjects
0217                             from  ppload.ppload_files f
0218                             join project p on f.collection_id = p.ppload_collection_id
0219                             join member m on f.owner_id = m.member_id and m.is_deleted=0 and m.is_active = 1
0220                             where f.md5sum is not null
0221                             group by f.md5sum 
0222                             having count(1)>1
0223                         ) t
0224                         where cntProjects>1
0225                   ";         
0226 
0227         $reportsAll = Zend_Db_Table::getDefaultAdapter()->fetchRow($sqlall);
0228 
0229 
0230         $jTableResult = array();
0231         $jTableResult['Result'] = self::RESULT_OK;
0232         $jTableResult['Records'] = $results;        
0233         $jTableResult['TotalRecordCount'] = $reportsAll['cnt'];
0234         $this->_helper->json($jTableResult);
0235 
0236     }
0237 
0238     public function newproductlistAction()
0239     {   
0240         $filter['filter_section'] = $this->getParam('filter_section');
0241 
0242         $startIndex = (int)$this->getParam('jtStartIndex');
0243         $pageSize = (int)$this->getParam('jtPageSize');
0244         $sorting = $this->getParam('jtSorting');     
0245 
0246         if(!isset($sorting))
0247         {
0248             $sorting = ' earn desc, created_at desc';
0249         }        
0250 
0251         $sql = "
0252                 select ss.section_id, ss.name as section_name, pp.project_id,pp.status,pp.member_id, pp.created_at, m.username, m.paypal_mail,m.created_at as member_since, c.title cat_title,c.lft, c.rgt
0253                 ,(select sum(probably_payout_amount) amount
0254                 from member_dl_plings pl
0255                 where pl.project_id=pp.project_id
0256                 and pl.member_id = pp.member_id
0257                 and pl.yearmonth= DATE_FORMAT(CURRENT_DATE() - INTERVAL 1 MONTH, '%Y%m')
0258                 and pl.is_pling_excluded = 0 
0259                 and pl.is_license_missing = 0
0260                 ) as earn                    
0261                 from
0262                 project pp                    
0263                 ,member m
0264                 ,project_category c
0265                 ,section_category s
0266                 ,section ss
0267                 where pp.member_id = m.member_id 
0268                 and pp.project_category_id = c.project_category_id and m.is_deleted=0 and m.is_active = 1
0269                 and s.project_category_id = c.project_category_id
0270                 and s.section_id = ss.section_id
0271                 and pp.created_at > (CURRENT_DATE() - INTERVAL 2 MONTH)                                            
0272                                         
0273         ";
0274         if($filter['filter_section'])
0275         {
0276             $sql.=" and ss.section_id = ".$filter['filter_section'];
0277         }
0278         $sql .= ' order by ' . $sorting;
0279         $sql .= ' limit ' . $pageSize;
0280         $sql .= ' offset ' . $startIndex;
0281         $printDateSince = new Default_View_Helper_PrintDateSince();
0282         $filesize = new Default_View_Helper_HumanFilesize();
0283         $results = Zend_Db_Table::getDefaultAdapter()->fetchAll($sql);
0284                 
0285         $tmpsql = "select lft, rgt from project_category where project_category_id=295";
0286         $wal =Zend_Db_Table::getDefaultAdapter()->fetchRow($tmpsql);            
0287         $lft = $wal['lft'];
0288         $rgt = $wal['rgt'];
0289         foreach ($results as &$value) {
0290             $value['created_at'] = $printDateSince->printDateSince($value['created_at']);                
0291             if($value['earn'] && $value['earn']>0)
0292             {
0293                  $value['earn'] = number_format($value['earn'] , 2, '.', '');
0294             }             
0295             if($value['lft'] >= $lft && $value['rgt'] <= $rgt)
0296             {
0297                 $value['is_wallpaper'] = 1;
0298             }else{
0299                 $value['is_wallpaper'] = 0;
0300             }
0301         }
0302 
0303         $sqlTotal = "select count(1) as cnt
0304                 from
0305                 project pp                    
0306                 ,member m
0307                 ,project_category c
0308                 ,section_category s
0309                 ,section ss
0310                 where pp.member_id = m.member_id 
0311                 and pp.project_category_id = c.project_category_id and m.is_deleted=0 and m.is_active = 1
0312                 and s.project_category_id = c.project_category_id
0313                 and s.section_id = ss.section_id
0314                 and pp.created_at > (CURRENT_DATE() - INTERVAL 2 MONTH)   ";
0315 
0316         if($filter['filter_section'])
0317         {
0318             $sqlTotal.=" and ss.section_id = ".$filter['filter_section'];
0319         }
0320         $resultsCnt = Zend_Db_Table::getDefaultAdapter()->fetchRow($sqlTotal);
0321         $jTableResult = array();
0322         $jTableResult['Result'] = self::RESULT_OK;
0323         $jTableResult['Records'] = $results;        
0324         $jTableResult['TotalRecordCount'] = $resultsCnt['cnt'];
0325         $this->_helper->json($jTableResult);
0326 
0327     }
0328 
0329     public function deprecatedlistAction()
0330     {
0331         $startIndex = (int)$this->getParam('jtStartIndex');
0332         $pageSize = (int)$this->getParam('jtPageSize');
0333         $sorting = $this->getParam('jtSorting');             
0334 
0335         if(!isset($sorting))
0336         {
0337           $sorting = ' tag_created desc';
0338         }        
0339         $sql = "
0340                     select 
0341                     project_id,
0342                     title,
0343                     username,
0344                     member_id,
0345                     cat_title,
0346                     profile_image_url,
0347                     o.tag_created created_at
0348                     from 
0349                     stat_projects p
0350                     inner join tag_object o on p.project_id = o.tag_object_id and o.tag_id= 5589 and o.tag_group_id = 36 and is_deleted = 0 and tag_type_id = 1
0351                     
0352           ";   
0353         
0354         $sql .= ' order by ' . $sorting;
0355         $sql .= ' limit ' . $pageSize;
0356         $sql .= ' offset ' . $startIndex;
0357         $printDateSince = new Default_View_Helper_PrintDateSince();
0358         $results = Zend_Db_Table::getDefaultAdapter()->fetchAll($sql);
0359         $helperImage = new Default_View_Helper_Image();
0360         foreach ($results as &$value) {            
0361             $value['created_at'] = $printDateSince->printDateSince($value['created_at']);
0362             $value['avatar'] = $helperImage->Image($value['profile_image_url'], array('width' => '200', 'height' => '200', 'crop' => 2)); 
0363         }
0364     
0365     $sqlall = " select count(1) 
0366                     from stat_projects p
0367                     inner join tag_object o on p.project_id = o.tag_object_id and o.tag_id= 5589 and o.tag_group_id = 36 and is_deleted = 0 and tag_type_id = 1
0368                     ";                            
0369 
0370         $reportsAll = Zend_Db_Table::getDefaultAdapter()->fetchRow($sqlall);
0371 
0372         $jTableResult = array();
0373         $jTableResult['Result'] = self::RESULT_OK;
0374         $jTableResult['Records'] = $results;
0375         $jTableResult['TotalRecordCount'] = array_pop($reportsAll);        
0376         $this->_helper->json($jTableResult);
0377     }
0378 
0379     public function unpublishedproductlistAction()
0380     {
0381         $startIndex = (int)$this->getParam('jtStartIndex');
0382         $pageSize = (int)$this->getParam('jtPageSize');
0383         $sorting = $this->getParam('jtSorting');     
0384 
0385         if(!isset($sorting))
0386         {
0387             $sorting = ' unpublished_time desc';
0388         }        
0389 
0390         $sql = "
0391                     select pp.project_id,pp.title,pp.status,pp.member_id, pp.created_at, m.username, m.paypal_mail,m.created_at as member_since, c.title cat_title,c.lft, c.rgt
0392                     ,(select sum(probably_payout_amount) amount
0393                     from member_dl_plings 
0394                     where member_id=pp.member_id
0395                     and yearmonth= DATE_FORMAT(CURRENT_DATE() - INTERVAL 1 MONTH, '%Y%m')
0396                     and is_pling_excluded = 0 
0397                     and is_license_missing = 0
0398                     ) as earn ,
0399                     (SELECT max(time) FROM pling.activity_log l where l.activity_type_id = 9 and project_id = pp.project_id) as unpublished_time
0400                     ,(
0401                         select  sum(m.credits_plings)/100 AS probably_payout_amount from micro_payout m
0402                         where m.project_id=pp.project_id 
0403                         and m.paypal_mail is not null 
0404                         and m.paypal_mail <> '' and (m.paypal_mail regexp '^[A-Z0-9._%-]+@[A-Z0-9.-]+.[A-Z]{2,4}$') 
0405                         and m.yearmonth = DATE_FORMAT(CURRENT_DATE() - INTERVAL 1 MONTH, '%Y%m')
0406                     ) as probably_payout_amount
0407                     from project pp                    
0408                     join member m on pp.member_id = m.member_id and m.is_deleted=0 and m.is_active = 1
0409                     join project_category c on pp.project_category_id = c.project_category_id        
0410                     where pp.status = 40 
0411                     
0412                                         
0413         ";
0414         $sql .= ' order by ' . $sorting;
0415         $sql .= ' limit ' . $pageSize;
0416         $sql .= ' offset ' . $startIndex;
0417         $printDateSince = new Default_View_Helper_PrintDateSince();
0418         $filesize = new Default_View_Helper_HumanFilesize();
0419         $results = Zend_Db_Table::getDefaultAdapter()->fetchAll($sql);
0420                 
0421         $tmpsql = "select lft, rgt from project_category where project_category_id=295";
0422         $wal =Zend_Db_Table::getDefaultAdapter()->fetchRow($tmpsql);            
0423         $lft = $wal['lft'];
0424         $rgt = $wal['rgt'];
0425         foreach ($results as &$value) {
0426             $value['created_at'] = $printDateSince->printDateSince($value['created_at']);   
0427             $value['unpublished_time'] = $printDateSince->printDateSince($value['unpublished_time']);              
0428             if($value['earn'] && $value['earn']>0)
0429             {
0430                  $value['earn'] = number_format($value['earn'] , 2, '.', '');
0431             }             
0432             if($value['lft'] >= $lft && $value['rgt'] <= $rgt)
0433             {
0434                 $value['is_wallpaper'] = 1;
0435             }else{
0436                 $value['is_wallpaper'] = 0;
0437             }
0438         }
0439 
0440         $sqltotal = "select count(1) as cnt from
0441                         project pp                                         
0442                     where pp.status = 40 ";
0443         $resultsCnt = Zend_Db_Table::getDefaultAdapter()->fetchRow($sqltotal);
0444         $jTableResult = array();
0445         $jTableResult['Result'] = self::RESULT_OK;
0446         $jTableResult['Records'] = $results;        
0447         $jTableResult['TotalRecordCount'] = $resultsCnt['cnt'];
0448         $this->_helper->json($jTableResult);
0449 
0450     }
0451 
0452     public function productfilesAction()
0453     {
0454         $startIndex = (int)$this->getParam('jtStartIndex');
0455         $pageSize = (int)$this->getParam('jtPageSize');
0456         $sorting = $this->getParam('jtSorting');     
0457 
0458         if(!isset($sorting))
0459         {
0460             $sorting = ' created_at desc';
0461         }        
0462 
0463         $sql = "
0464                 select pp.project_id,pp.status,pp.member_id, pp.created_at, cntfiles,size, m.username, m.paypal_mail,m.created_at as member_since, c.title cat_title,c.lft, c.rgt
0465                     ,(select sum(probably_payout_amount) amount
0466                     from member_dl_plings 
0467                     where member_id=pp.member_id
0468                     and yearmonth= DATE_FORMAT(CURRENT_DATE() - INTERVAL 1 MONTH, '%Y%m')
0469                     and is_pling_excluded = 0 
0470                     and is_license_missing = 0
0471                     ) as earn,
0472                     m.is_deleted 
0473                     from
0474                     (
0475                         select 
0476                         p.project_id,
0477                         p.created_at,
0478                         p.changed_at,
0479                         p.member_id,    
0480                         p.status,
0481                         p.project_category_id,
0482                         count(1) cntfiles,
0483                         sum(size) size
0484                         from 
0485                         project p,
0486                         ppload.ppload_files f
0487                         where p.ppload_collection_id = f.collection_id
0488                         group by p.project_id
0489                         order by p.created_at desc, cntfiles desc
0490                     )
0491                     pp 
0492                     ,member m
0493                     ,project_category c
0494                     where pp.member_id = m.member_id
0495                     and pp.project_category_id = c.project_category_id and m.is_deleted=0 and m.is_active = 1
0496                     and cntfiles > 10
0497         ";
0498         $sql .= ' order by ' . $sorting;
0499         $sql .= ' limit ' . $pageSize;
0500         $sql .= ' offset ' . $startIndex;
0501         $printDateSince = new Default_View_Helper_PrintDateSince();
0502         $filesize = new Default_View_Helper_HumanFilesize();
0503         $results = Zend_Db_Table::getDefaultAdapter()->fetchAll($sql);
0504                 
0505         $tmpsql = "select lft, rgt from project_category where project_category_id=295";
0506         $wal =Zend_Db_Table::getDefaultAdapter()->fetchRow($tmpsql);            
0507         $lft = $wal['lft'];
0508         $rgt = $wal['rgt'];
0509         foreach ($results as &$value) {
0510             $value['created_at'] = $printDateSince->printDateSince($value['created_at']);    
0511             $value['size'] = $filesize->humanFilesize($value['size']);  
0512             if($value['earn'] && $value['earn']>0)
0513             {
0514                  $value['earn'] = number_format($value['earn'] , 2, '.', '');
0515             }             
0516             if($value['lft'] >= $lft && $value['rgt'] <= $rgt)
0517             {
0518                 $value['is_wallpaper'] = 1;
0519             }else{
0520                 $value['is_wallpaper'] = 0;
0521             }
0522         }
0523 
0524         $jTableResult = array();
0525         $jTableResult['Result'] = self::RESULT_OK;
0526         $jTableResult['Records'] = $results;        
0527         $jTableResult['TotalRecordCount'] = 1000;
0528         $this->_helper->json($jTableResult);
0529 
0530     }
0531     public function commentslistAction()
0532     {
0533       
0534         $startIndex = (int)$this->getParam('jtStartIndex');
0535         $pageSize = (int)$this->getParam('jtPageSize');
0536         $sorting = $this->getParam('jtSorting');     
0537         $filter_year = $this->getParam('filter_year', date("Y"));     
0538 
0539         if(!isset($sorting))
0540         {
0541           $sorting = ' comment_created_at desc';
0542         }        
0543         $sql = "
0544           select 
0545                 comment_id,
0546                 comment_target_id,
0547                 comment_member_id,
0548                 comment_parent_id,
0549                 comment_text,
0550                 comment_created_at,
0551                 (select count(1) from reports_comment r where c.comment_id = r.comment_id ) cntreport,
0552                 (select GROUP_CONCAT(distinct reported_by) from reports_comment r where c.comment_id = r.comment_id order by created_at desc ) as reportedby,
0553                   (
0554                   SELECT count(1) AS count FROM comments c2
0555                   where c2.comment_target_id <> 0 and c2.comment_member_id = c.comment_member_id and c2.comment_active = 1 
0556                   ) as cntComments,
0557                   m.created_at member_since,
0558                   m.username,
0559                   (select count(1) from project p where p.status=100 and p.member_id=m.member_id and p.type_id = 1 and p.is_deleted=0) cntProjects,
0560                   m.profile_image_url,
0561                   (select description from project p where p.type_id=0 and p.member_id = c.comment_member_id) aboutme
0562                 from comments c
0563                 join member m on c.comment_member_id = m.member_id and m.is_active = 1 and m.is_deleted = 0
0564                 where c.comment_type=0
0565                 and c.comment_active = 1 
0566                 and DATE_FORMAT(c.comment_created_at, '%Y') = :filter_year
0567           ";   
0568         
0569         $sql .= ' order by ' . $sorting;
0570         $sql .= ' limit ' . $pageSize;
0571         $sql .= ' offset ' . $startIndex;
0572         $printDateSince = new Default_View_Helper_PrintDateSince();
0573         $comments = Zend_Db_Table::getDefaultAdapter()->fetchAll($sql, array('filter_year' =>$filter_year));
0574         $helperImage = new Default_View_Helper_Image();
0575         foreach ($comments as &$value) {
0576             $value['member_since'] = $printDateSince->printDateSince($value['member_since']);
0577             $value['comment_created_at'] = $printDateSince->printDateSince($value['comment_created_at']);
0578             $value['avatar'] = $helperImage->Image($value['profile_image_url'], array('width' => '200', 'height' => '200', 'crop' => 2)); 
0579         }
0580     
0581     $sqlall = " select count(1) 
0582                     from comments c 
0583                     join member m on c.comment_member_id = m.member_id and m.is_active = 1 and m.is_deleted = 0
0584           where c.comment_type=0
0585           and c.comment_active = 1 and DATE_FORMAT(c.comment_created_at, '%Y') = :filter_year";         
0586 
0587         $reportsAll = Zend_Db_Table::getDefaultAdapter()->fetchRow($sqlall,array('filter_year' =>$filter_year));
0588 
0589         $jTableResult = array();
0590         $jTableResult['Result'] = self::RESULT_OK;
0591         $jTableResult['Records'] = $comments;
0592         $jTableResult['TotalRecordCount'] = array_pop($reportsAll);
0593         //$jTableResult['TotalRecordCount'] = 1000;
0594         $this->_helper->json($jTableResult);
0595     }
0596 
0597 }