Cheetah
ChFdbModule.php
Go to the documentation of this file.
1 <?php
2 
8 ch_import('ChWsbTextModule');
9 
10 require_once('ChFdbCmts.php');
11 require_once('ChFdbVoting.php');
12 require_once('ChFdbSearchResult.php');
13 require_once('ChFdbPrivacy.php');
14 require_once('ChFdbData.php');
15 
91 {
96  {
97  parent::__construct($aModule);
98 
99  //--- Define Membership Actions ---//
100  defineMembershipActions(array('feedback delete'), 'ACTION_ID_');
101  }
102 
106  function serviceFeedbackRss($iLength = 0)
107  {
108  return $this->actionRss($iLength);
109  }
110 
111  function serviceMyBlock($iStart = 0, $iPerPage = 0)
112  {
113  if(!$this->isLogged())
114  return MsgBox(_t('_feedback_msg_no_results'));
115 
116  if(empty($iPerPage))
117  $iPerPage = $this->_oConfig->getPerPage();
118 
119  return $this->_oTemplate->displayBlock(array(
120  'sample_type' => 'owner',
121  'sample_params' => array('owner_id' => $this->_oTextData->getAuthorId()),
122  'viewer_type' => $this->_oTextData->getViewerType(),
123  'start' => $iStart,
124  'count' => $iPerPage
125  ));
126  }
127 
131  function actionGetFeedback($sSampleType = 'all', $iStart = 0, $iPerPage = 0)
132  {
133  return $this->actionGetEntries($sSampleType, $iStart, $iPerPage);
134  }
135 
136  function actionIndex()
137  {
138  $sMenu = "";
139  if(isMember()) {
140  $sLink = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'post/';
141  $sCaption = _t('_feedback_lcaption_post');
142 
143  $sMenu = ChWsbPageView::getBlockCaptionMenu(time(), array(
144  'fdb_post' => array('href' => $sLink, 'title' => $sCaption)
145  ));
146  }
147  $sContent = $this->serviceArchiveBlock();
148 
149  $aParams = array(
150  'index' => 2,
151  'css' => array('view.css', 'cmts.css'),
152  'title' => array(
153  'page' => _t('_feedback_pcaption_all'),
154  'block' => _t('_feedback_bcaption_view_all')
155  ),
156  'content' => array(
157  'page_menu_code' => $sMenu,
158  'page_main_code' => $sContent
159  )
160  );
161  $this->_oTemplate->getPageCode($aParams);
162  }
163  function actionPost($sName = '')
164  {
165  if (!$this -> _isAllowedPost())
166  $this->_oTemplate->displayAccessDenied ();
167 
168  $sContentView = DesignBoxContent(_t('_feedback_bcaption_view_my'), $this->serviceMyBlock(), 1);
169 
170  if(!empty($sName))
171  $sContentForm = $this->serviceEditBlock(process_db_input($sName, CH_TAGS_STRIP));
172  else if(isset($_POST['id']))
173  $sContentForm = $this->serviceEditBlock((int)$_POST['id']);
174  else
175  $sContentForm = $this->servicePostBlock();
176  $sContentForm = DesignBoxContent(_t('_feedback_bcaption_post'), $sContentForm, 1);
177 
178  $aParams = array(
179  'index' => 3,
180  'css' => array('view.css', 'post.css'),
181  'title' => array(
182  'page' => _t('_feedback_pcaption_post'),
183  'block' => _t('_feedback_bcaption_view_all')
184  ),
185  'content' => array(
186  'page_code_view' => $sContentView,
187  'page_code_form' => $sContentForm
188  )
189  );
190  $this->_oTemplate->getPageCode($aParams);
191  }
192 
193  function actionAdmin($sName = '')
194  {
195  $GLOBALS['iAdminPage'] = 1;
196  require_once(CH_DIRECTORY_PATH_INC . 'admin_design.inc.php');
197 
198  check_logged();
199  if(!@isAdmin()) {
201  login_form("", 1);
202  exit;
203  }
204 
205  //--- Process actions ---//
207  if(isset($_POST['save']) && isset($_POST['cat'])) {
208  $mixedResultSettings = $this->setSettings($_POST);
209  }
210 
211  if(isset($_POST['feedback-approve']))
212  $this->_actPublish($_POST['feedback-ids'], true);
213  else if(isset($_POST['feedback-reject']))
214  $this->_actPublish($_POST['feedback-ids'], false);
215  else if(isset($_POST['feedback-delete']))
216  $this->_actDelete($_POST['feedback-ids']);
217  //--- Process actions ---//
218 
219  $sFilterValue = '';
220  if(isset($_GET['feedback-filter']))
221  $sFilterValue = process_db_input($_GET['feedback-filter'], CH_TAGS_STRIP);
222 
223  $sContent = DesignBoxAdmin(_t('_feedback_bcaption_settings'), $GLOBALS['oAdmTemplate']->parseHtmlByName('design_box_content.html', array('content' => $this->getSettingsForm($mixedResultSettings))));
224  $sContent .= DesignBoxAdmin(_t('_feedback_bcaption_view_admin'), $this->serviceAdminBlock(0, 0, $sFilterValue));
225 
226  $aParams = array(
227  'title' => array(
228  'page' => _t('_feedback_pcaption_admin')
229  ),
230  'content' => array(
231  'page_main_code' => $sContent
232  )
233  );
234  $this->_oTemplate->getPageCodeAdmin($aParams);
235  }
236 
241  {
242  return new ChFdbCmts($this->_oConfig->getCommentsSystemName(), $iId);
243  }
245  {
246  return new ChFdbVoting($this->_oConfig->getVotesSystemName(), $iId);
247  }
248  function _isDeleteAllowed($iAuthorId = 0, $bPerform = false)
249  {
250  if(!isLogged())
251  return false;
252 
253  if(isAdmin())
254  return true;
255 
256  $iUserId = getLoggedId();
257  if($iAuthorId != 0 && $iAuthorId == $iUserId)
258  return true;
259 
260  $aCheckResult = checkAction($iUserId, ACTION_ID_FEEDBACK_DELETE, $bPerform);
261  return $aCheckResult[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED;
262  }
263 
264  function _isAllowedPost()
265  {
266  return isLogged();
267  }
268 
269  function _isCommentsAllowed(&$aEntry)
270  {
271  return $this->_oPrivacy->check('comment', $aEntry['id'], $this->_oTextData->getAuthorId());
272  }
273  function _isVotesAllowed(&$aEntry)
274  {
275  return $this->_oPrivacy->check('vote', $aEntry['id'], $this->_oTextData->getAuthorId());
276  }
277 }
process_db_input
process_db_input($sText, $iStripTags=0)
Definition: utils.inc.php:256
ChFdbVoting
Definition: ChFdbVoting.php:11
MsgBox
MsgBox($sText, $iTimer=0)
Definition: design.inc.php:175
ChFdbModule\_createObjectVoting
_createObjectVoting($iId)
Definition: ChFdbModule.php:244
check_logged
check_logged()
Definition: admin.inc.php:238
ChWsbModule\isLogged
isLogged()
Definition: ChWsbModule.php:113
CHECK_ACTION_RESULT_ALLOWED
const CHECK_ACTION_RESULT_ALLOWED
Definition: membership_levels.inc.php:60
$aModule
$aModule
Definition: classifieds.php:21
ChFdbModule\_isCommentsAllowed
_isCommentsAllowed(&$aEntry)
Definition: ChFdbModule.php:269
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
ChWsbPageView\getBlockCaptionMenu
static getBlockCaptionMenu( $iBlockID, $aLinks)
Definition: ChWsbPageView.php:586
CHECK_ACTION_RESULT
const CHECK_ACTION_RESULT
Definition: membership_levels.inc.php:54
php
ChFdbModule\actionGetFeedback
actionGetFeedback($sSampleType='all', $iStart=0, $iPerPage=0)
Definition: ChFdbModule.php:131
$iId
$iId
Definition: license.php:15
login_form
login_form($text="", $member=0, $bAjaxMode=false, $sLoginFormParams='')
Definition: admin.inc.php:13
ChWsbTextModule\getSettingsForm
getSettingsForm($mixedResult)
Definition: ChWsbTextModule.php:229
send_headers_page_changed
send_headers_page_changed()
Definition: design.inc.php:99
$iPerPage
else $iPerPage
Definition: browse.php:61
ChWsbTextModule\servicePostBlock
servicePostBlock()
Definition: ChWsbTextModule.php:260
ChWsbTextModule\_actDelete
_actDelete($aIds)
Definition: ChWsbTextModule.php:929
isAdmin
isAdmin()
Definition: index.php:649
ChWsbTextModule\actionGetEntries
actionGetEntries($sSampleType='all', $iStart=0, $iPerPage=0)
Definition: ChWsbTextModule.php:460
ChFdbModule\serviceMyBlock
serviceMyBlock($iStart=0, $iPerPage=0)
Definition: ChFdbModule.php:111
ChFdbModule\_isAllowedPost
_isAllowedPost()
Definition: ChFdbModule.php:264
DesignBoxAdmin
DesignBoxAdmin($sTitle, $sContent, $mixedTopItems='', $sBottomItems='', $iIndex=1)
Definition: admin_design.inc.php:50
exit
exit
Definition: cart.php:21
ChFdbModule\_isDeleteAllowed
_isDeleteAllowed($iAuthorId=0, $bPerform=false)
Definition: ChFdbModule.php:248
$_GET
$_GET['debug']
Definition: index.php:67
ChWsbTextModule\serviceAdminBlock
serviceAdminBlock($iStart=0, $iPerPage=0, $sFilterValue='')
Definition: ChWsbTextModule.php:281
ChFdbModule\actionPost
actionPost($sName='')
Definition: ChFdbModule.php:163
ChWsbTextModule\setSettings
setSettings($aData)
Definition: ChWsbTextModule.php:245
ChFdbModule\serviceFeedbackRss
serviceFeedbackRss($iLength=0)
Definition: ChFdbModule.php:106
getLoggedId
getLoggedId()
Definition: profiles.inc.php:32
ChFdbModule\__construct
__construct($aModule)
Definition: ChFdbModule.php:95
ChFdbCmts
Definition: ChFdbCmts.php:11
ChFdbModule\_isVotesAllowed
_isVotesAllowed(&$aEntry)
Definition: ChFdbModule.php:273
ChFdbModule\_createObjectCmts
_createObjectCmts($iId)
Definition: ChFdbModule.php:240
$sContent
$sContent
Definition: bottom_menu_compose.php:169
_t
_t($key, $arg0="", $arg1="", $arg2="")
Definition: languages.inc.php:509
time
that in the case of a Adaptation or at a minimum such credit will if a credit for all contributing authors of the Adaptation or Collection then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors For the avoidance of You may only use the credit required by this Section for the purpose of attribution in the manner set out above by exercising Your rights under this You may not implicitly or explicitly assert or imply any connection sponsorship or endorsement by the Original Licensor and or Attribution as of You or Your use of the without the express prior written permission of the Original Licensor and or Attribution Parties Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable if You Distribute or Publicly Perform the Work either by itself or as part of any Adaptations or You must not modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author s honor or reputation Licensor agrees that in those in which any exercise of the right granted in modification or other derogatory action prejudicial to the Original Author s honor and the Licensor will waive or not as this to the fullest extent permitted by the applicable national to enable You to reasonably exercise Your right under Warranties and Disclaimer UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN LICENSOR OFFERS THE WORK AS IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE STATUTORY OR WITHOUT WARRANTIES OF FITNESS FOR A PARTICULAR OR THE ABSENCE OF LATENT OR OTHER OR THE PRESENCE OF ABSENCE OF WHETHER OR NOT DISCOVERABLE SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED SO SUCH EXCLUSION MAY NOT APPLY TO YOU Limitation on Liability EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES Termination This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License Individuals or entities who have received Adaptations or Collections from You under this will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses and will survive any termination of this License Subject to the above terms and the license granted here is Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time
Definition: license.txt:56
ChWsbTextModule\_actPublish
_actPublish($aIds, $bPositive=true)
Definition: ChWsbTextModule.php:900
checkAction
checkAction($iMemberId, $actionID, $performAction=false, $iForcedProfID=0, $isCheckMemberStatus=true)
Definition: membership_levels.inc.php:313
$mixedResultSettings
$mixedResultSettings
Definition: admin.php:36
CH_TAGS_STRIP
const CH_TAGS_STRIP
Definition: utils.inc.php:22
defineMembershipActions
defineMembershipActions($aActionsAll, $sPrefix='CH_')
Definition: membership_levels.inc.php:744
ChWsbTextModule\serviceArchiveBlock
serviceArchiveBlock($iStart=0, $iPerPage=0, $bShowEmpty=true)
Definition: ChWsbTextModule.php:310
ChFdbModule\actionIndex
actionIndex()
Definition: ChFdbModule.php:136
ChWsbTextModule
Definition: ChWsbTextModule.php:22
$sCaption
$sCaption
Definition: tellfriend.php:39
DesignBoxContent
DesignBoxContent($title, $content, $db_num=0, $caption_item='', $bottom_item='')
Definition: design.inc.php:78
ChFdbModule
Definition: ChFdbModule.php:91
ChWsbTextModule\actionRss
actionRss($iLength=0, $sType='archive')
Definition: ChWsbTextModule.php:425
empty
Attr AllowedRel this is empty
Definition: Attr.AllowedRel.txt:7
$sName
$sName
Definition: ChWsbAdminTools.php:853
ChFdbModule\actionAdmin
actionAdmin($sName='')
Definition: ChFdbModule.php:193
$GLOBALS
$GLOBALS['iAdminPage']
Definition: advanced_settings.php:10
isMember
isMember($iId=0)
Definition: profiles.inc.php:44
ChWsbTextModule\serviceEditBlock
serviceEditBlock($mixed)
Definition: ChWsbTextModule.php:268