static function fetch($nodeID, $asObject = true) { return eZPersistentObject::fetchObject(eZTipafriendCounter::definition(), null, array('node_id' => $nodeID), $asObject); }
{ $cli->output( "Removing all preferences" ); eZPreferences::cleanup(); } if ( $clean['browse'] ) { $cli->output( "Removing all recent items and bookmarks for browse page" ); eZContentBrowseRecent::cleanup(); eZContentBrowseBookmark::cleanup(); } if ( $clean['tipafriend'] ) { $cli->output( "Removing all counters for tip-a-friend" ); eZTipafriendCounter::cleanup(); } if ( $clean['shop'] ) { $cli->output( "Removing all baskets" ); eZBasket::cleanup(); $cli->output( "Removing all wishlists" ); eZWishList::cleanup(); $cli->output( "Removing all orders" ); eZOrder::cleanup(); $productCount = eZPersistentObject::count( eZProductCollection::definition() ); if ( $productCount > 0 ) { $cli->warning( "$productCount product collections still exists, must be a leak" ); }
function removeThis() { $ini = eZINI::instance(); $object = $this->object(); $nodeID = $this->attribute('node_id'); $objectID = $object->attribute('id'); if (eZAudit::isAuditEnabled()) { // Set audit params. $objectName = $object->attribute('name'); eZAudit::writeAudit('content-delete', array('Node ID' => $nodeID, 'Object ID' => $objectID, 'Content Name' => $objectName, 'Comment' => 'Removed the current node: eZContentObjectTreeNode::removeNode()')); } $db = eZDB::instance(); $db->begin(); $nodePath = $this->attribute('path_string'); $childrensPath = $nodePath; $pathString = " path_string like '{$childrensPath}%' "; $urlAlias = $this->attribute('url_alias'); // Remove static cache if ($ini->variable('ContentSettings', 'StaticCache') == 'enabled') { $optionArray = array('iniFile' => 'site.ini', 'iniSection' => 'ContentSettings', 'iniVariable' => 'StaticCacheHandler'); $options = new ezpExtensionOptions($optionArray); $staticCacheHandler = eZExtension::getHandlerClass($options); $staticCacheHandler->removeURL("/" . $urlAlias); $staticCacheHandler->generateAlwaysUpdatedCache(); $parent = $this->fetchParent(); } $db->query("DELETE FROM ezcontentobject_tree\n WHERE {$pathString} OR\n path_string = '{$nodePath}'"); // Re-cache parent node if ($ini->variable('ContentSettings', 'StaticCache') == 'enabled') { if ($parent) { $staticCacheHandler->cacheURL("/" . $parent->urlAlias()); } } // Clean up URL alias entries eZURLAliasML::removeByAction('eznode', $nodeID); // Clean up content cache eZContentCacheManager::clearContentCacheIfNeeded($this->attribute('contentobject_id')); // clean up user cache if (in_array($object->attribute('contentclass_id'), eZUser::contentClassIDs())) { eZUser::removeSessionData($objectID); eZUser::purgeUserCacheByUserId($objectID); } $parentNode = $this->attribute('parent'); if (is_object($parentNode)) { eZContentCacheManager::clearContentCacheIfNeeded($parentNode->attribute('contentobject_id')); $parentNode->updateAndStoreModified(); eZNodeAssignment::purgeByParentAndContentObjectID($parentNode->attribute('node_id'), $objectID); } // Clean up policies and limitations eZRole::cleanupByNode($this); // Clean up recent items eZContentBrowseRecent::removeRecentByNodeID($nodeID); // Clean up bookmarks eZContentBrowseBookmark::removeByNodeID($nodeID); // Clean up tip-a-friend counter eZTipafriendCounter::removeForNode($nodeID); // Clean up view counter eZViewCounter::removeCounter($nodeID); $db->commit(); }
public static function fetchTipafriendTopList($offset, $limit, $start_time, $end_time, $duration, $ascending, $extended) { $currentTime = time(); $conds = array(); if (is_numeric($start_time) and is_numeric($end_time)) { $conds = array('requested' => array(false, array($start_time, $end_time))); } else { if (is_numeric($start_time) and is_numeric($duration)) { $conds = array('requested' => array(false, array($start_time, $start_time + $duration))); } else { if (is_numeric($end_time) and is_numeric($duration)) { $conds = array('requested' => array(false, array($end_time - $duration, $end_time))); } else { if (is_numeric($start_time)) { $conds = array('requested' => array('>', $start_time)); } else { if (is_numeric($end_time)) { $conds = array('requested' => array('<', $end_time)); } else { if (is_numeric($duration)) { // substract passed duration from current time timestamp to get start_time stamp // end_timestamp is equal to current time in this case $conds = array('requested' => array('>', $currentTime - $duration)); } } } } } } $topList = eZPersistentObject::fetchObjectList(eZTipafriendCounter::definition(), array('node_id'), $conds, array('count' => $ascending ? 'asc' : 'desc'), array('length' => $limit, 'offset' => $offset), false, array('node_id'), array(array('operation' => 'count( * )', 'name' => 'count'))); if ($extended) { foreach (array_keys($topList) as $key) { $contentNode = eZContentObjectTreeNode::fetch($topList[$key]['node_id']); if (!is_object($contentNode)) { return array('error' => array('error_type' => 'kernel', 'error_code' => eZError::KERNEL_NOT_FOUND)); } $topList[$key]['node'] = $contentNode; } return array('result' => $topList); } else { $retList = array(); foreach ($topList as $entry) { $contentNode = eZContentObjectTreeNode::fetch($entry['node_id']); if (!is_object($contentNode)) { return array('error' => array('error_type' => 'kernel', 'error_code' => eZError::KERNEL_NOT_FOUND)); } $retList[] = $contentNode; } return array('result' => $retList); } }
$mailtpl->setVariable('your_email', $yourEmail); $mailtpl->setVariable('receivers_name', $receiversName); $mailtpl->setVariable('receivers_email', $receiversEmail); $mailtpl->setVariable('comment', $comment); $mailtext = $mailtpl->fetch('design:content/tipafriendmail.tpl'); if ($mailtpl->hasVariable('content_type')) { $mail->setContentType($mailtpl->variable('content_type')); } $mail->setBody($mailtext); // mail was sent ok if (eZMailTransport::send($mail)) { $tpl->setVariable('action', 'confirm'); $request = eZTipafriendRequest::create($receiversEmail); $request->store(); // Increase tipafriend count for this node $counter = eZTipafriendCounter::create($NodeID); $counter->store(); // Prevent user from sending tipafriend mail to same user on same node again for the rest of session $sessionSentTipList = $NodeID . '|' . $receiversEmail; if ($http->hasSessionVariable('ezpContentTipafriendList')) { $sessionSentTipList = $http->sessionVariable('ezpContentTipafriendList') . ',' . $sessionSentTipList; } $http->setSessionVariable('ezpContentTipafriendList', $sessionSentTipList); } else { $tpl->setVariable('action', 'error'); } if ($http->hasPostVariable('RedirectBack') && $http->postVariable('RedirectBack') == 1) { $Module->redirectTo($node->attribute('url_alias')); return; } }