Cheetah
ChWsbTwigModuleDb.php
Go to the documentation of this file.
1 <?php
2 
8 ch_import('ChWsbModuleDb');
9 
14 {
15  var $_sTableMain = 'main';
16  var $_sTableShoutbox = '';
18  var $_sFieldId = 'id';
19  var $_sFieldAuthorId = 'author_id';
20  var $_sFieldUri = 'uri';
21  var $_sFieldTitle = 'title';
22  var $_sFieldDescription = 'desc';
23  var $_sFieldTags = 'tags';
24  var $_sFieldThumb = 'thumb';
25  var $_sFieldStatus = 'status';
26  var $_sFieldFeatured = 'featured';
27  var $_sFieldCreated = 'created';
28  var $_sFieldDesc = 'desc';
29  var $_sFieldFansCount = 'fans_count';
30  var $_sTableFans = 'fans';
31  var $_sTableAdmins = 'admins';
32  var $_sFieldAllowViewTo = 'allow_view_to';
33  var $_sFieldCommentCount = 'comments_count';
34 
35  /*
36  * Constructor.
37  */
38  function __construct(&$oConfig)
39  {
40  parent::__construct($oConfig);
41  }
42 
43  // entry functions
44 
45  function isAnyPublicContent()
46  {
47  return $this->getOne ("SELECT `{$this->_sFieldId}` FROM `" . $this->_sPrefix . $this->_sTableMain . "` WHERE `{$this->_sFieldStatus}` = 'approved' AND `{$this->_sFieldAllowViewTo}` = '" . CH_WSB_PG_ALL . "' LIMIT 1");
48  }
49 
50  function getEntryByIdAndOwner ($iId, $iOwner, $isAdmin)
51  {
52  $sWhere = '';
53  $aBindings = [$iId];
54  if (!$isAdmin) {
55  $sWhere = " AND `{$this->_sFieldAuthorId}` = ? ";
56  $aBindings[] = $iOwner;
57  }
58  return $this->getRow ("SELECT * FROM `" . $this->_sPrefix . $this->_sTableMain . "` WHERE `{$this->_sFieldId}` = ? $sWhere LIMIT 1", $aBindings);
59  }
60 
61  function getEntryById ($iId)
62  {
63  return $this->getEntryByIdAndOwner ($iId, 0, true);
64  }
65 
67  {
68  return $this->getPairs ("SELECT `{$this->_sFieldId}` FROM `" . $this->_sPrefix . $this->_sTableMain . "` WHERE `{$this->_sFieldAuthorId}` = '$iProfileId'", $this->_sFieldId, $this->_sFieldId);
69  }
70 
72  {
73  return $this->getOne ("SELECT COUNT(*) FROM `" . $this->_sPrefix . $this->_sTableMain . "` WHERE `{$this->_sFieldStatus}` = '$sStatus' AND `{$this->_sFieldAuthorId}` = '$iProfileId'");
74  }
75 
76  function getEntryByUri ($sUri)
77  {
78  return $this->getRow ("SELECT * FROM `" . $this->_sPrefix . $this->_sTableMain . "` WHERE `{$this->_sFieldUri}` = ? LIMIT 1", [$sUri]);
79  }
80 
82  {
83  $sWhere = " AND `{$this->_sFieldFeatured}` = '1' ";
84  return $this->getRow ("SELECT * FROM `" . $this->_sPrefix . $this->_sTableMain . "`
85  WHERE `{$this->_sFieldStatus}` = ? AND `{$this->_sFieldAllowViewTo}` = ? $sWhere ORDER BY `{$this->_sFieldCreated}` DESC LIMIT 1", ['approved', CH_WSB_PG_ALL]);
86  }
87 
88  function getEntriesByMonth ($iYear, $iMonth, $iNextYear, $iNextMonth)
89  {
90  return $this->getAll ("SELECT *, DAYOFMONTH(FROM_UNIXTIME(`{$this->_sFieldCreated}`)) AS `Day`
91  FROM `" . $this->_sPrefix . $this->_sTableMain . "`
92  WHERE `{$this->_sFieldCreated}` >= UNIX_TIMESTAMP('$iYear-$iMonth-1') AND `{$this->_sFieldCreated}` < UNIX_TIMESTAMP('$iNextYear-$iNextMonth-1') AND `{$this->_sFieldStatus}` = 'approved'");
93  }
94 
95  function deleteEntryByIdAndOwner ($iId, $iOwner, $isAdmin)
96  {
97  $sWhere = '';
98  if (!$isAdmin)
99  $sWhere = " AND `{$this->_sFieldAuthorId}` = '$iOwner' ";
100  if (!($iRet = $this->query ("DELETE FROM `" . $this->_sPrefix . $this->_sTableMain . "` WHERE `{$this->_sFieldId}` = $iId $sWhere LIMIT 1")))
101  return false;
102 
103  $this->deleteEntryMediaAll ($iId, 'images');
104  $this->deleteEntryMediaAll ($iId, 'videos');
105  $this->deleteEntryMediaAll ($iId, 'files');
106 
107  return true;
108  }
109 
110  function markAsFeatured ($iId)
111  {
112  return $this->query ("UPDATE `" . $this->_sPrefix . $this->_sTableMain . "` SET `{$this->_sFieldFeatured}` = (`{$this->_sFieldFeatured}` - 1)*(`{$this->_sFieldFeatured}` - 1) WHERE `{$this->_sFieldId}` = $iId LIMIT 1");
113  }
114 
115  function activateEntry ($iId)
116  {
117  return $this->query ("UPDATE `" . $this->_sPrefix . $this->_sTableMain . "` SET `{$this->_sFieldStatus}` = 'approved' WHERE `{$this->_sFieldId}` = $iId LIMIT 1");
118  }
119 
120  // media functions
121 
122  function updateMedia ($iEntryId, $aMediaAdd, $aMediaDelete, $sMediaType)
123  {
124  $this->deleteMedia ($iEntryId, $aMediaDelete, $sMediaType);
125  return $this->insertMedia ($iEntryId, $aMediaAdd, $sMediaType);
126  }
127 
128  function insertMedia ($iEntryId, $aMedia, $sMediaType)
129  {
130  if (!$aMedia)
131  return false;
132  if (is_array($aMedia))
133  $sValues = implode ("), ($iEntryId, ", $aMedia);
134  else
135  $sValues = (int)$aMedia;
136  return $this->query ("INSERT IGNORE INTO `" . $this->_sPrefix . $this->_sTableMediaPrefix . "{$sMediaType}` VALUES ($iEntryId, $sValues)");
137  }
138 
139  function deleteMedia ($iEntryId, $aMedia, $sMediaType)
140  {
141  if (!$aMedia)
142  return false;
143  if (is_array($aMedia))
144  $sValues = implode ("') OR (`entry_id` = $iEntryId AND `media_id` = '", $aMedia);
145  else
146  $sValues = (int)$aMedia;
147  return $this->query ("DELETE FROM `" . $this->_sPrefix . $this->_sTableMediaPrefix . "{$sMediaType}` WHERE (`entry_id` = '$iEntryId' AND `media_id` = '$sValues')");
148  }
149 
150  function deleteEntryMediaAll ($iEntryId, $sMediaType)
151  {
152  $a = $this->getMediaIds($iEntryId, $sMediaType);
153  foreach ($a as $iMediaId)
154  ChWsbService::call(('images' == $sMediaType ? 'photos' : $sMediaType), 'remove_object', array($iMediaId));
155  return $this->query ("DELETE FROM `" . $this->_sPrefix . $this->_sTableMediaPrefix . "{$sMediaType}` WHERE `entry_id` = '$iEntryId'");
156  }
157 
158  function deleteMediaFile ($iMediaId, $sMediaType)
159  {
160  return $this->query ("DELETE FROM `" . $this->_sPrefix . $this->_sTableMediaPrefix . "{$sMediaType}` WHERE `media_id` = '$iMediaId'");
161  }
162 
163  function getMediaIds ($iEntryId, $sMediaType)
164  {
165  return $this->getPairs ("SELECT `media_id` FROM `" . $this->_sPrefix . $this->_sTableMediaPrefix . "{$sMediaType}` WHERE `entry_id` = '$iEntryId'", 'media_id', 'media_id');
166  }
167 
168  function isMediaInUse ($iMediaId, $sMediaType)
169  {
170  return $this->getOne ("SELECT `entry_id` FROM `" . $this->_sPrefix . $this->_sTableMediaPrefix . "{$sMediaType}` WHERE `media_id` = '$iEntryId' LIMIT 1");
171  }
172 
173  function getMedia ($iEntryId, $iMediaId, $sMediaType)
174  {
175  return $this->getRow ("SELECT `entry_id`, `media_id` FROM `" . $this->_sPrefix . $this->_sTableMediaPrefix . "{$sMediaType}` WHERE `entry_id` = ? AND `media_id` = ?", [$iEntryId, $iMediaId]);
176  }
177 
178  function setThumbnail ($iEntryId, $iImageId)
179  {
180  if (!$iImageId) {
181  $iOldThumbId = $this->getOne ("SELECT `{$this->_sFieldThumb}` FROM `" . $this->_sPrefix . $this->_sTableMain . "` WHERE `{$this->_sFieldId}` = '$iEntryId' LIMIT 1");
182  if ($iOldThumbId > 0 && $this->getOne("SELECT `entry_id` FROM `" . $this->_sPrefix . $this->_sTableMediaPrefix. "images` WHERE `media_id` = '$iOldThumbId' LIMIT 1") > 0)
183  return false;
184  $iImageId = $this->getOne("SELECT `media_id` FROM `" . $this->_sPrefix . $this->_sTableMediaPrefix. "images` WHERE `entry_id` = '$iEntryId' LIMIT 1");
185  }
186 
187  if (!$iImageId)
188  return false;
189  return $this->query ("UPDATE `" . $this->_sPrefix . $this->_sTableMain . "` SET `{$this->_sFieldThumb}` = '$iImageId' WHERE `{$this->_sFieldId}` = '$iEntryId' LIMIT 1");
190  }
191 
192  // forum functions
193 
194  function getForumById ($iForumId)
195  {
196  return $this->getRow ("SELECT * FROM `" . $this->_sPrefix . "forum` WHERE `forum_id` = ? LIMIT 1", [$iForumId]);
197  }
198 
199  function createForum ($aDataEntry, $sUsername)
200  {
201  $sForumTitle = process_db_input($aDataEntry[$this->_sFieldTitle], CH_TAGS_NO_ACTION, CH_SLASHES_NO_ACTION);
202  $sUsername = process_db_input($sUsername, CH_TAGS_NO_ACTION, CH_SLASHES_NO_ACTION);
203  return $this->query ("INSERT INTO `" . $this->_sPrefix . "forum` SET `forum_uri` = '{$aDataEntry[$this->_sFieldUri]}', `cat_id` = 1, `forum_title` = '{$sForumTitle}', `forum_desc` = '$sUsername', `forum_last` = UNIX_TIMESTAMP(), `forum_type` = 'public', `entry_id` = '{$aDataEntry[$this->_sFieldId]}'");
204  }
205 
206  function deleteForum ($iEntryId)
207  {
208  global $gConf;
209  $gConf['db']['host'] = DATABASE_HOST;
210  $gConf['db']['db'] = DATABASE_NAME;
211  $gConf['db']['user'] = DATABASE_USER;
212  $gConf['db']['pwd'] = DATABASE_PASS;
213  $gConf['db']['port'] = DATABASE_PORT;
214  $gConf['db']['sock'] = DATABASE_SOCK;
215  $gConf['db']['prefix'] = $this->_sPrefix;
216 
217  require_once (CH_DIRECTORY_PATH_CLASSES . 'Thing.php');
218  if (!class_exists('ThingPage'))
219  require_once (CH_DIRECTORY_PATH_MODULES . 'cheetah/forum/classes/ThingPage.php');
220  if (!class_exists('Mistake'))
221  require_once (CH_DIRECTORY_PATH_MODULES . 'cheetah/forum/classes/Mistake.php');
222  if (!class_exists('ChDb'))
223  require_once (CH_DIRECTORY_PATH_MODULES . 'cheetah/forum/classes/ChDb.php');
224  if (!class_exists('DbAdmin'))
225  require_once (CH_DIRECTORY_PATH_MODULES . 'cheetah/forum/classes/DbAdmin.php');
226 
227  $db = new DbAdmin ();
228  $iForumId = $this->getOne ("SELECT `forum_id` FROM `" . $this->_sPrefix . "forum` WHERE `entry_id` = '{$iEntryId}'");
229  return $db->deleteForumAll($iForumId);
230  }
231 
232  // profile functions
233 
235  {
236  $a = getProfileInfo($iId);
237  return $a['NickName'];
238  }
239 
240  function getProfileIdByNickName ($sNick, $isProcessDbInput = true)
241  {
242  if ($isProcessDbInput)
244  return $this->getOne ("SELECT `ID` FROM `Profiles` WHERE `NickName` = '$sNick' LIMIT 1");
245  }
246 
247  // settings functions
248 
250  {
251  return $this->getOne("SELECT `ID` FROM `sys_options_cats` WHERE `name` = '{$sName}' LIMIT 1");
252  }
253 
255  {
256  $a = $this->getAllWithKey ("SELECT `p`.`NickName`, `p`.`ID` FROM `sys_friend_list` AS `o` INNER JOIN `Profiles` AS `p` ON (`p`.`ID` = `o`.`ID` AND `o`.`Profile` = ?)", 'NickName', [$iProfileId]);
257  $a = array_merge($a, $this->getAllWithKey ("SELECT `p`.`NickName`, `p`.`ID` FROM `sys_friend_list` AS `o` INNER JOIN `Profiles` AS `p` ON (`p`.`ID` = `o`.`Profile` AND `o`.`ID` = ?)", 'NickName', [$iProfileId]));
258  $a = array_merge($a, $this->getAllWithKey ("SELECT `p`.`NickName`, `p`.`ID` FROM `sys_fave_list` AS `o` INNER JOIN `Profiles` AS `p` ON (`p`.`ID` = `o`.`ID` AND `o`.`Profile` = ?)", 'NickName', [$iProfileId]));
259  $a = array_merge($a, $this->getAllWithKey ("SELECT `p`.`NickName`, `p`.`ID` FROM `sys_fave_list` AS `o` INNER JOIN `Profiles` AS `p` ON (`p`.`ID` = `o`.`Profile` AND `o`.`ID` = ?)", 'NickName', [$iProfileId]));
260  $a = array_merge($a, $this->getAllWithKey ("SELECT `p`.`NickName`, `p`.`ID` FROM `sys_messages` AS `o` INNER JOIN `Profiles` AS `p` ON (`p`.`ID` = `o`.`Recipient` AND `o`.`Sender` = ?)", 'NickName', [$iProfileId]));
261  foreach ($a as $k => $r) {
262  if ($iProfileId == $r['ID']) {
263  unset($a[$k]);
264  break;
265  }
266  }
267  asort ($a);
268  return $a;
269  }
270 
271  // fans and admins functions
272 
273  function getBroadcastRecipients ($iEntryId)
274  {
275  return $this->getAll ("SELECT DISTINCT `p`.`ID`, `p`.`Email` FROM `" . $this->_sPrefix . $this->_sTableFans . "` AS `f` INNER JOIN `Profiles` as `p` ON (`f`.`id_entry` = '$iEntryId' AND `f`.`id_profile` = `p`.`ID` AND `f`.`confirmed` = 1 AND `p`.`Status` = 'Active')");
276  }
277 
278  function joinEntry($iEntryId, $iProfileId, $isConfirmed)
279  {
280  $isConfirmed = $isConfirmed ? 1 : 0;
281  $iRet = $this->query ("INSERT IGNORE INTO `" . $this->_sPrefix . $this->_sTableFans . "` SET `id_entry` = '$iEntryId', `id_profile` = '$iProfileId', `confirmed` = '$isConfirmed', `when` = '" . time() . "'");
282  if ($iRet && $isConfirmed)
283  $this->query ("UPDATE `" . $this->_sPrefix . "main` SET `" . $this->_sFieldFansCount . "` = `" . $this->_sFieldFansCount . "` + 1 WHERE `id` = '$iEntryId'");
284  return $iRet;
285  }
286 
287  function leaveEntry ($iEntryId, $iProfileId)
288  {
289  $isConfirmed = $this->getOne ("SELECT `confirmed` FROM `" . $this->_sPrefix . $this->_sTableFans . "` WHERE `id_entry` = '$iEntryId' AND `id_profile` = '$iProfileId' LIMIT 1");
290  $iRet = $this->query ("DELETE FROM `" . $this->_sPrefix . $this->_sTableFans . "` WHERE `id_entry` = '$iEntryId' AND `id_profile` = '$iProfileId'");
291  if ($iRet && $isConfirmed)
292  $this->query ("UPDATE `" . $this->_sPrefix . "main` SET `" . $this->_sFieldFansCount . "` = `" . $this->_sFieldFansCount . "` - 1 WHERE `id` = '$iEntryId'");
293  return $iRet;
294  }
295 
296  function isFan($iEntryId, $iProfileId, $isConfirmed)
297  {
298  $isConfirmed = $isConfirmed ? 1 : 0;
299  return $this->getOne ("SELECT `when` FROM `" . $this->_sPrefix . $this->_sTableFans . "` WHERE `id_entry` = '$iEntryId' AND `id_profile` = '$iProfileId' AND `confirmed` = '$isConfirmed' LIMIT 1");
300  }
301 
302  function getFansBrowse(&$aProfiles, $iEntryId, $iStart, $iMaxNum)
303  {
304  return $this->getFans($aProfiles, $iEntryId, true, $iStart, $iMaxNum);
305  }
306 
307  function getFans(&$aProfiles, $iEntryId, $isConfirmed, $iStart, $iMaxNum, $aFilter = array())
308  {
309  $isConfirmed = $isConfirmed ? 1 : 0;
310  $sFilter = '';
311  if ($aFilter) {
312  $s = implode (' OR `f`.`id_profile` = ', $aFilter);
313  $sFilter = ' AND (`f`.`id_profile` = ' . $s . ') ';
314  }
315  $aProfiles = $this->getAll ("SELECT SQL_CALC_FOUND_ROWS `p`.* FROM `Profiles` AS `p` INNER JOIN `" . $this->_sPrefix . $this->_sTableFans . "` AS `f` ON (`f`.`id_entry` = '$iEntryId' AND `f`.`id_profile` = `p`.`ID` AND `f`.`confirmed` = $isConfirmed AND `p`.`Status` = 'Active' $sFilter) ORDER BY `f`.`when` DESC LIMIT $iStart, $iMaxNum");
316  return $this->getOne("SELECT FOUND_ROWS()");
317  }
318 
319  function confirmFans ($iEntryId, $aProfileIds)
320  {
321  if (!$aProfileIds)
322  return false;
323  $s = implode (' OR `id_profile` = ', $aProfileIds);
324  $iRet = $this->query ("UPDATE `" . $this->_sPrefix . $this->_sTableFans . "` SET `confirmed` = 1 WHERE `id_entry` = '$iEntryId' AND `confirmed` = 0 AND (`id_profile` = $s)");
325  if ($iRet)
326  $this->query ("UPDATE `" . $this->_sPrefix . "main` SET `" . $this->_sFieldFansCount . "` = `" . $this->_sFieldFansCount . "` + $iRet WHERE `id` = '$iEntryId'");
327  return $iRet;
328  }
329 
330  function removeFans ($iEntryId, $aProfileIds)
331  {
332  if (!$aProfileIds)
333  return false;
334  $s = implode (' OR `id_profile` = ', $aProfileIds);
335  $iRet = $this->query ("DELETE FROM `" . $this->_sPrefix . $this->_sTableFans . "` WHERE `id_entry` = '$iEntryId' AND `confirmed` = 1 AND (`id_profile` = $s)");
336  if ($iRet)
337  $this->query ("UPDATE `" . $this->_sPrefix . "main` SET `" . $this->_sFieldFansCount . "` = `" . $this->_sFieldFansCount . "` - $iRet WHERE `id` = '$iEntryId'");
338  if ($iRet && $this->_sTableAdmins)
339  $this->query ("DELETE FROM `" . $this->_sPrefix . $this->_sTableAdmins . "` WHERE `id_entry` = '$iEntryId' AND `id_profile` = $s");
340  return $iRet;
341  }
342 
344  {
345  $iProfileId = (int)$iProfileId;
346  if (!$iProfileId || !$this->_sTableFans)
347  return false;
348 
349  // delete unconfirmed fans
350  $iDeleted = $this->query ("DELETE FROM `" . $this->_sPrefix . $this->_sTableFans . "` WHERE `confirmed` = 0 AND `id_profile` = " . $iProfileId);
351 
352  // delete confirmed fans
353  $aEntries = $this->getColumn("SELECT DISTINCT `id_entry` FROM `" . $this->_sPrefix . $this->_sTableFans . "` WHERE `id_profile` = " . $iProfileId);
354  foreach ($aEntries as $iEntryId) {
355  $iDeleted += $this->leaveEntry ($iEntryId, $iProfileId) ? 1 : 0;
356  }
357 
358  return $iDeleted;
359  }
360 
362  {
363  $iProfileId = (int)$iProfileId;
364  if (!$iProfileId || !$this->_sTableAdmins)
365  return false;
366 
367  return $this->query ("DELETE FROM `" . $this->_sPrefix . $this->_sTableAdmins . "` WHERE `id_profile` = " . $iProfileId);
368  }
369 
370  function rejectFans ($iEntryId, $aProfileIds)
371  {
372  if (!$aProfileIds)
373  return false;
374  $s = implode (' OR `id_profile` = ', $aProfileIds);
375  return $this->query ("DELETE FROM `" . $this->_sPrefix . $this->_sTableFans . "` WHERE `id_entry` = '$iEntryId' AND `confirmed` = 0 AND (`id_profile` = $s)");
376  }
377 
378  function getAdmins(&$aProfiles, $iEntryId, $iStart, $iMaxNum, $aFilter = array())
379  {
380  $sFilter = '';
381  if ($aFilter) {
382  $s = implode (' OR `f`.`id_profile` = ', $aFilter);
383  $sFilter = ' AND (`f`.`id_profile` = ' . $s . ') ';
384  }
385  $aProfiles = $this->getAll ("SELECT SQL_CALC_FOUND_ROWS `p`.* FROM `Profiles` AS `p` INNER JOIN `" . $this->_sPrefix . $this->_sTableAdmins . "` AS `f` ON (`f`.`id_entry` = '$iEntryId' AND `f`.`id_profile` = `p`.`ID` AND `p`.`Status` = 'Active' $sFilter) ORDER BY `f`.`when` DESC LIMIT $iStart, $iMaxNum");
386  return $this->getOne("SELECT FOUND_ROWS()");
387  }
388 
389  function isGroupAdmin($iEntryId, $iProfileId)
390  {
391  return $this->getOne ("SELECT `when` FROM `" . $this->_sPrefix . $this->_sTableAdmins . "` WHERE `id_entry` = '$iEntryId' AND `id_profile` = '$iProfileId' LIMIT 1");
392  }
393 
394  function addGroupAdmin($iEntryId, $aProfileIds)
395  {
396  if (is_array($aProfileIds)) {
397  $iRet = 0;
398  foreach ($aProfileIds AS $iProfileId)
399  $iRet += $this->query ("INSERT IGNORE INTO `" . $this->_sPrefix . $this->_sTableAdmins . "` SET `id_entry` = '$iEntryId', `id_profile` = '$iProfileId', `when` = '" . time() . "'");
400  return $iRet;
401  } else {
402  return $this->query ("INSERT IGNORE INTO `" . $this->_sPrefix . $this->_sTableAdmins . "` SET `id_entry` = '$iEntryId', `id_profile` = '$aProfileIds', `when` = '" . time() . "'");
403  }
404  }
405 
406  function removeGroupAdmin($iEntryId, $aProfileIds)
407  {
408  if (!$aProfileIds)
409  return false;
410  if (is_array($aProfileIds)) {
411  $s = implode (' OR `id_profile` = ', $aProfileIds);
412  return $this->query ("DELETE FROM `" . $this->_sPrefix . $this->_sTableAdmins . "` WHERE `id_entry` = '$iEntryId' AND (`id_profile` = $s)");
413  } else {
414  return $this->query ("DELETE FROM `" . $this->_sPrefix . $this->_sTableAdmins . "` WHERE `id_entry` = '$iEntryId' AND `id_profile` = '$aProfileIds'");
415  }
416  }
417 
418 }
process_db_input
process_db_input($sText, $iStripTags=0)
Definition: utils.inc.php:256
ChWsbTwigModuleDb\getMediaIds
getMediaIds($iEntryId, $sMediaType)
Definition: ChWsbTwigModuleDb.php:163
ChWsbTwigModuleDb\$_sFieldCreated
$_sFieldCreated
Definition: ChWsbTwigModuleDb.php:27
ChWsbTwigModuleDb\$_sFieldAllowViewTo
$_sFieldAllowViewTo
Definition: ChWsbTwigModuleDb.php:32
ChWsbTwigModuleDb\$_sFieldFansCount
$_sFieldFansCount
Definition: ChWsbTwigModuleDb.php:29
ChWsbTwigModuleDb\$_sFieldDescription
$_sFieldDescription
Definition: ChWsbTwigModuleDb.php:22
ChWsbTwigModuleDb\getEntriesByAuthor
getEntriesByAuthor($iProfileId)
Definition: ChWsbTwigModuleDb.php:66
ChWsbTwigModuleDb\isMediaInUse
isMediaInUse($iMediaId, $sMediaType)
Definition: ChWsbTwigModuleDb.php:168
ChWsbTwigModuleDb\deleteForum
deleteForum($iEntryId)
Definition: ChWsbTwigModuleDb.php:206
ChWsbTwigModuleDb\$_sTableMediaPrefix
$_sTableMediaPrefix
Definition: ChWsbTwigModuleDb.php:17
ChWsbTwigModuleDb\rejectFans
rejectFans($iEntryId, $aProfileIds)
Definition: ChWsbTwigModuleDb.php:370
ChWsbTwigModuleDb\removeGroupAdmin
removeGroupAdmin($iEntryId, $aProfileIds)
Definition: ChWsbTwigModuleDb.php:406
$db
if(!defined("DB_HOST")) define("DB_HOST" $db['host']
Definition: header.inc.php:18
ChWsbTwigModuleDb\getFans
getFans(&$aProfiles, $iEntryId, $isConfirmed, $iStart, $iMaxNum, $aFilter=array())
Definition: ChWsbTwigModuleDb.php:307
ChWsbTwigModuleDb\$_sFieldStatus
$_sFieldStatus
Definition: ChWsbTwigModuleDb.php:25
ChWsbTwigModuleDb\deleteEntryMediaAll
deleteEntryMediaAll($iEntryId, $sMediaType)
Definition: ChWsbTwigModuleDb.php:150
ChWsbTwigModuleDb\isAnyPublicContent
isAnyPublicContent()
Definition: ChWsbTwigModuleDb.php:45
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
ChWsbTwigModuleDb\insertMedia
insertMedia($iEntryId, $aMedia, $sMediaType)
Definition: ChWsbTwigModuleDb.php:128
ChWsbTwigModuleDb\getAdmins
getAdmins(&$aProfiles, $iEntryId, $iStart, $iMaxNum, $aFilter=array())
Definition: ChWsbTwigModuleDb.php:378
ChWsbTwigModuleDb\$_sTableAdmins
$_sTableAdmins
Definition: ChWsbTwigModuleDb.php:31
ChWsbTwigModuleDb\deleteEntryByIdAndOwner
deleteEntryByIdAndOwner($iId, $iOwner, $isAdmin)
Definition: ChWsbTwigModuleDb.php:95
php
DbAdmin
Definition: DbAdmin.php:38
ChWsbModuleDb
Definition: ChWsbModuleDb.php:12
$iId
$iId
Definition: license.php:15
ChWsbTwigModuleDb\__construct
__construct(&$oConfig)
Definition: ChWsbTwigModuleDb.php:38
ChWsbDb\getAll
getAll($sQuery, $aBindings=[], $iFetchType=PDO::FETCH_ASSOC)
Definition: ChWsbDb.php:206
ChWsbDb\getPairs
getPairs($sQuery, $sFieldKey, $sFieldValue, $aBindings=[])
Definition: ChWsbDb.php:363
ChWsbTwigModuleDb\removeAdminFromAllEntries
removeAdminFromAllEntries($iProfileId)
Definition: ChWsbTwigModuleDb.php:361
ChWsbTwigModuleDb\getProfileIdByNickName
getProfileIdByNickName($sNick, $isProcessDbInput=true)
Definition: ChWsbTwigModuleDb.php:240
ChWsbTwigModuleDb\setThumbnail
setThumbnail($iEntryId, $iImageId)
Definition: ChWsbTwigModuleDb.php:178
ChWsbTwigModuleDb\$_sFieldThumb
$_sFieldThumb
Definition: ChWsbTwigModuleDb.php:24
ChWsbTwigModuleDb\getBroadcastRecipients
getBroadcastRecipients($iEntryId)
Definition: ChWsbTwigModuleDb.php:273
ChWsbTwigModuleDb\addGroupAdmin
addGroupAdmin($iEntryId, $aProfileIds)
Definition: ChWsbTwigModuleDb.php:394
CH_SLASHES_NO_ACTION
const CH_SLASHES_NO_ACTION
Definition: utils.inc.php:30
ChWsbTwigModuleDb\createForum
createForum($aDataEntry, $sUsername)
Definition: ChWsbTwigModuleDb.php:199
ChWsbTwigModuleDb\$_sTableShoutbox
$_sTableShoutbox
Definition: ChWsbTwigModuleDb.php:16
ChWsbTwigModuleDb\getEntryByIdAndOwner
getEntryByIdAndOwner($iId, $iOwner, $isAdmin)
Definition: ChWsbTwigModuleDb.php:50
ChWsbTwigModuleDb\$_sFieldTags
$_sFieldTags
Definition: ChWsbTwigModuleDb.php:23
ChWsbTwigModuleDb\getEntriesByMonth
getEntriesByMonth($iYear, $iMonth, $iNextYear, $iNextMonth)
Definition: ChWsbTwigModuleDb.php:88
ChWsbDb\getRow
getRow($sQuery, $aBindings=[], $iFetchStyle=PDO::FETCH_ASSOC)
Definition: ChWsbDb.php:225
ChWsbTwigModuleDb\leaveEntry
leaveEntry($iEntryId, $iProfileId)
Definition: ChWsbTwigModuleDb.php:287
ChWsbTwigModuleDb\markAsFeatured
markAsFeatured($iId)
Definition: ChWsbTwigModuleDb.php:110
ChWsbTwigModuleDb\$_sFieldCommentCount
$_sFieldCommentCount
Definition: ChWsbTwigModuleDb.php:33
ChWsbDb\query
query($sQuery, $aBindings=[])
Definition: ChWsbDb.php:386
ChWsbTwigModuleDb\getLatestFeaturedItem
getLatestFeaturedItem()
Definition: ChWsbTwigModuleDb.php:81
ChWsbTwigModuleDb
Definition: ChWsbTwigModuleDb.php:14
CH_TAGS_NO_ACTION
const CH_TAGS_NO_ACTION
Definition: utils.inc.php:21
ChWsbModuleDb\$_sPrefix
$_sPrefix
Definition: ChWsbModuleDb.php:13
ChWsbTwigModuleDb\$_sFieldDesc
$_sFieldDesc
Definition: ChWsbTwigModuleDb.php:28
global
if(!defined("GLOBAL_MODULE")) define("GLOBAL_MODULE" global
Definition: header.inc.php:25
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
CH_WSB_PG_ALL
const CH_WSB_PG_ALL
Definition: ChWsbPrivacy.php:12
ChWsbDb\getOne
getOne($sQuery, $aBindings=[], $iIndex=0)
Definition: ChWsbDb.php:263
ChWsbTwigModuleDb\getForumById
getForumById($iForumId)
Definition: ChWsbTwigModuleDb.php:194
ChWsbTwigModuleDb\joinEntry
joinEntry($iEntryId, $iProfileId, $isConfirmed)
Definition: ChWsbTwigModuleDb.php:278
ChWsbTwigModuleDb\confirmFans
confirmFans($iEntryId, $aProfileIds)
Definition: ChWsbTwigModuleDb.php:319
ChWsbTwigModuleDb\deleteMediaFile
deleteMediaFile($iMediaId, $sMediaType)
Definition: ChWsbTwigModuleDb.php:158
ChWsbTwigModuleDb\$_sTableMain
$_sTableMain
Definition: ChWsbTwigModuleDb.php:15
ChWsbTwigModuleDb\$_sFieldTitle
$_sFieldTitle
Definition: ChWsbTwigModuleDb.php:21
ChWsbTwigModuleDb\$_sTableFans
$_sTableFans
Definition: ChWsbTwigModuleDb.php:30
$s
$s
Definition: embed.php:13
ChWsbTwigModuleDb\activateEntry
activateEntry($iId)
Definition: ChWsbTwigModuleDb.php:115
ChWsbTwigModuleDb\getEntryByUri
getEntryByUri($sUri)
Definition: ChWsbTwigModuleDb.php:76
ChWsbTwigModuleDb\$_sFieldId
$_sFieldId
Definition: ChWsbTwigModuleDb.php:18
ChWsbTwigModuleDb\removeFans
removeFans($iEntryId, $aProfileIds)
Definition: ChWsbTwigModuleDb.php:330
ChWsbTwigModuleDb\removeFanFromAllEntries
removeFanFromAllEntries($iProfileId)
Definition: ChWsbTwigModuleDb.php:343
getProfileInfo
getProfileInfo($iProfileID=0, $checkActiveStatus=false, $forceCache=false)
Definition: profiles.inc.php:249
ChWsbTwigModuleDb\getEntryById
getEntryById($iId)
Definition: ChWsbTwigModuleDb.php:61
ChWsbTwigModuleDb\$_sFieldUri
$_sFieldUri
Definition: ChWsbTwigModuleDb.php:20
ChWsbTwigModuleDb\getCountByAuthorAndStatus
getCountByAuthorAndStatus($iProfileId, $sStatus)
Definition: ChWsbTwigModuleDb.php:71
ChWsbTwigModuleDb\updateMedia
updateMedia($iEntryId, $aMediaAdd, $aMediaDelete, $sMediaType)
Definition: ChWsbTwigModuleDb.php:122
ChWsbTwigModuleDb\deleteMedia
deleteMedia($iEntryId, $aMedia, $sMediaType)
Definition: ChWsbTwigModuleDb.php:139
ChWsbTwigModuleDb\isGroupAdmin
isGroupAdmin($iEntryId, $iProfileId)
Definition: ChWsbTwigModuleDb.php:389
ChWsbTwigModuleDb\getFansBrowse
getFansBrowse(&$aProfiles, $iEntryId, $iStart, $iMaxNum)
Definition: ChWsbTwigModuleDb.php:302
$gConf
global $gConf
Definition: header.inc.php:8
ChWsbTwigModuleDb\getSettingsCategory
getSettingsCategory($sName)
Definition: ChWsbTwigModuleDb.php:249
$sNick
$sNick
Definition: actions.inc.php:9
ChWsbService\call
static call($mixed, $sMethod, $aParams=array(), $sClass='Module')
Definition: ChWsbService.php:32
as
as
Definition: Filter.ExtractStyleBlocks.Escaping.txt:10
ChWsbTwigModuleDb\getProfileNickNameById
getProfileNickNameById($iId)
Definition: ChWsbTwigModuleDb.php:234
ChWsbDb\getAllWithKey
getAllWithKey($sQuery, $sFieldKey, $aBindings=[], $iFetchType=PDO::FETCH_ASSOC)
Definition: ChWsbDb.php:338
ChWsbTwigModuleDb\$_sFieldAuthorId
$_sFieldAuthorId
Definition: ChWsbTwigModuleDb.php:19
ChWsbTwigModuleDb\getPotentialVisitors
getPotentialVisitors($iProfileId)
Definition: ChWsbTwigModuleDb.php:254
$sName
$sName
Definition: ChWsbAdminTools.php:853
$sStatus
$sStatus
Definition: actions.inc.php:11
ChWsbTwigModuleDb\isFan
isFan($iEntryId, $iProfileId, $isConfirmed)
Definition: ChWsbTwigModuleDb.php:296
ChWsbTwigModuleDb\getMedia
getMedia($iEntryId, $iMediaId, $sMediaType)
Definition: ChWsbTwigModuleDb.php:173
$iProfileId
if( $sMembersList) $iProfileId
Definition: communicator.php:29
ChWsbTwigModuleDb\$_sFieldFeatured
$_sFieldFeatured
Definition: ChWsbTwigModuleDb.php:26
ChWsbDb\getColumn
getColumn($sQuery, $aBindings=[])
Definition: ChWsbDb.php:243