本文整理汇总了PHP中EasyBlogHelper::verifyBlogPassword方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyBlogHelper::verifyBlogPassword方法的具体用法?PHP EasyBlogHelper::verifyBlogPassword怎么用?PHP EasyBlogHelper::verifyBlogPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EasyBlogHelper
的用法示例。
在下文中一共展示了EasyBlogHelper::verifyBlogPassword方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItems
public function getItems()
{
$catid = $this->get('ezb_catfilter') ? $this->get('ezb_catid', NULL) : '';
$ordering = $this->get('ezb_ordering', 'latest');
$user = JFactory::getUser();
$category = EasyBlogHelper::getTable('Category', 'Table');
$category->load($catid);
if ($category->private && $user->id == 0) {
echo JText::_('This category is set to private');
return;
}
if (!class_exists('EasyBlogModelBlog')) {
jimport('joomla.application.component.model');
JLoader::import('blog', EBLOG_ROOT . '/' . 'models');
}
$model = EasyBlogHelper::getModel('Blog');
if ($this->get('ezfeatured')) {
$items = $model->getFeaturedBlog($catid, $this->get('count'));
} else {
$items = $model->getBlogsBy('category', $catid, $ordering, $this->get('count'), EBLOG_FILTER_PUBLISHED, null, false);
}
$config = EasyBlogHelper::getConfig();
if (!empty($items)) {
for ($i = 0; $i < count($items); $i++) {
$row =& $items[$i];
$author = EasyBlogHelper::getTable('Profile', 'Table');
$row->author = $author->load($row->created_by);
$row->commentCount = EasyBlogHelper::getCommentCount($row->id);
$requireVerification = false;
if ($config->get('main_password_protect', true) && !empty($row->blogpassword)) {
$row->title = JText::sprintf('COM_EASYBLOG_PASSWORD_PROTECTED_BLOG_TITLE', $row->title);
$requireVerification = true;
}
if ($requireVerification && !EasyBlogHelper::verifyBlogPassword($row->blogpassword, $row->id)) {
$theme = new CodeThemes();
$theme->set('id', $row->id);
$theme->set('return', base64_encode(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $row->id)));
$row->introtext = $theme->fetch('blog.protected.php');
$row->content = $row->introtext;
$row->showRating = false;
$row->protect = true;
} else {
$row->introtext = EasyBlogHelper::getHelper('Videos')->strip($row->content);
$row->showRating = true;
$row->protect = false;
}
}
//end foreach
}
//XEFUtility::debug($items);
$items = $this->prepareItems($items);
return $items;
}
示例2: vote
public function vote($value, $uid, $type, $elementId)
{
$ajax = new Ejax();
$my = JFactory::getUser();
$config = EasyBlogHelper::getConfig();
$blog = EasyBlogHelper::getTable('Blog', 'Table');
$blog->load($uid);
if ($config->get('main_password_protect', true) && !empty($blog->blogpassword)) {
if (!EasyBlogHelper::verifyBlogPassword($blog->blogpassword, $blog->id)) {
echo 'Invalid Access.';
exit;
}
}
$rating = EasyBlogHelper::getTable('Ratings', 'Table');
// Do not allow guest to vote, or if the voter already voted.
if ($rating->fill($my->id, $uid, $type, JFactory::getSession()->getId()) || $my->id < 1 && !$config->get('main_ratings_guests')) {
// We wouldn't allow user to vote more than once so don't do anything here
$ajax->send();
}
$rating->set('created_by', $my->id);
$rating->set('type', $type);
$rating->set('uid', $uid);
$rating->set('ip', @$_SERVER['REMOTE_ADDR']);
$rating->set('value', (int) $value);
$rating->set('sessionid', JFactory::getSession()->getId());
$rating->set('created', EasyBlogHelper::getDate()->toMySQL());
$rating->set('published', 1);
$rating->store();
$model = EasyBlogHelper::getModel('Ratings');
$ratingValue = $model->getRatingValues($uid, $type);
$total = $ratingValue->total;
$rating = $ratingValue->ratings;
// Assign badge for users that report blog post.
// Only give points if the viewer is viewing another person's blog post.
EasyBlogHelper::getHelper('EasySocial')->assignBadge('blog.rate', JText::_('COM_EASYBLOG_EASYSOCIAL_BADGE_RATED_BLOG'));
$ajax->script('eblog.loader.doneLoading("' . $elementId . '-command .ratings-text")');
$ajax->script('eblog.ratings.update("' . $elementId . '", "' . $type . '" , "' . $rating . '" , "' . JText::_('COM_EASYBLOG_RATINGS_RATED_THANK_YOU') . '");');
$ajax->assign($elementId . ' .ratings-value', '<i></i>' . $total . '<b>√</b>');
if (EasyBlogHelper::isAUPEnabled()) {
$id = AlphaUserPointsHelper::getAnyUserReferreID($my->id);
AlphaUserPointsHelper::newpoints('plgaup_easyblog_rate_blog', $id, '', JText::sprintf('COM_EASYBLOG_AUP_BLOG_RATED'), '');
}
$ajax->send();
}
示例3: showSocialButton
/**
* Get Tweetmeme and Google Buzz social button to show
*
* @params Object The blog item
*
* @return String HTML code to be shown
*/
public static function showSocialButton($blog, $frontpage = false)
{
require_once EBLOG_HELPERS . DIRECTORY_SEPARATOR . 'socialbutton.php';
$config = EasyBlogHelper::getConfig();
$document = JFactory::getDocument();
// get all required settings
$isBottom = false;
// RTL enabled?
$rtl = $config->get('social_rtl', 1);
$extraStyling = '';
// get prefered social button position
$pos = $config->get('main_socialbutton_position', 'left');
$isBottom = $pos == 'bottom' || $pos == 'top' ? true : false;
$extraStyling .= $pos == 'top' ? ' top' : '';
$extraStyling .= $pos == 'bottom' ? ' bottom' : '';
// in here, if the possition is bottom, we treat it as left for the css styling later.
$pos = $pos == 'bottom' || $pos == 'top' ? 'left' : $pos;
// if RTL setting is enabled
if ($rtl) {
// only process this if the direction is RTK
if ($document->direction == 'rtl') {
// if user set position to left, we change it to right.
// and the other way around too
if ($pos == 'left') {
$pos = 'right';
} else {
$pos = 'left';
}
}
}
$teamId = isset($blog->team) ? $blog->team : '';
// initializing social buttons class object for later use.
$button = EasyBlogHelper::getHelper('SocialButton');
$button->setBlog($blog);
$button->setFrontend($frontpage);
$button->setPosition($pos);
$button->setTeamId($teamId);
$button->setBottom($isBottom);
$html = '';
$loadsocialbutton = true;
if ($config->get('main_password_protect') && !empty($blog->blogpassword)) {
if (!EasyBlogHelper::verifyBlogPassword($blog->blogpassword, $blog->id)) {
$loadsocialbutton = false;
}
}
if ($loadsocialbutton) {
$extraStyling .= $isBottom ? ' width-full' : '';
// sorting social buttons based on configuration.
$socialButtons = explode(',', EBLOG_SOCIAL_BUTTONS);
$socialButtonOrders = array();
foreach ($socialButtons as $key) {
$config_key = 'integrations_order_' . $key;
$socialButtonOrders[$key] = $config->get($config_key, '0');
}
asort($socialButtonOrders);
foreach ($socialButtonOrders as $key => $val) {
$html .= $button->{$key}();
}
// only generate output if both or either one is enabled
if (!empty($html)) {
$html = '<div id="socialbutton" class="align' . $pos . $extraStyling . '">' . $html . '</div>';
}
}
echo $html;
}
示例4: addActivity
public function addActivity($blog, $new = false)
{
$config = EasyBlogHelper::getConfig();
// We do not want to add activities if new blog activity is disabled.
if ($new && !$config->get('integrations_mighty_activity_new_blog')) {
return false;
}
// We do not want to add activities if update blog activity is disabled.
if (!$new && !$config->get('integrations_mighty_activity_update_blog')) {
return false;
}
$file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'api.php';
if (!JFile::exists($file)) {
return false;
}
require_once $file;
$date = EasyBlogHelper::getDate();
$priority = 0;
$title = $blog->title;
$content = '';
if ($config->get('integrations_mighty_submit_content')) {
$requireVerification = false;
if ($config->get('main_password_protect', true) && !empty($blog->blogpassword)) {
$row->title = JText::sprintf('COM_EASYBLOG_PASSWORD_PROTECTED_BLOG_TITLE', $blog->title);
$requireVerification = true;
}
if ($requireVerification && !EasyBlogHelper::verifyBlogPassword($blog->blogpassword, $blog->id)) {
$theme = new CodeThemes();
$theme->set('id', $blog->id);
$theme->set('return', base64_encode($this->getBlogLink($blog)));
$output = $theme->fetch('blog.protected.php');
} else {
$content = $blog->intro . $blog->content;
$content = EasyBlogHelper::getHelper('Videos')->strip($content);
$pattern = '#<img[^>]*>#i';
preg_match($pattern, $content, $matches);
// Remove all html tags from the content as we want to chop it down.
$content = strip_tags($content);
$content = JString::substr($content, 0, $config->get('integrations_mighty_blogs_length', 250)) . ' ...';
$output = '<div style="background: #f4f4f4;border: 1px solid #eeee;border-radius: 5px;padding: 5px;margin-top:5px;">';
if ($matches) {
$matches[0] = JString::str_ireplace('img ', 'img style="margin: 0 5px 5px 0;float: left; height: auto; width: 120px !important;"', $matches[0]);
$output .= $matches[0] . $content . '<div style="clear: both;"></div>';
} else {
$output .= $content;
}
$output .= '<div style="text-align: right;"><a href="' . $this->getBlogLink($blog) . '">' . JText::_('COM_EASYBLOG_CONTINUE_READING') . '</a></div>';
$output .= '</div>';
}
}
if ($new) {
$title = JText::sprintf('COM_EASYBLOG_MIGHTY_ACTIVITY_BLOG', $this->getBlogLink($blog), $this->getBlogTitle($blog));
} else {
$title = JText::sprintf('COM_EASYBLOG_MIGHTY_ACTIVITY_BLOG_UPDATE', $this->getBlogLink($blog), $this->getBlogTitle($blog));
}
if ($config->get('integrations_mighty_show_category')) {
$title .= JText::sprintf('COM_EASYBLOG_MIGHTY_ACTIVITY_IN_CATEGORY', $this->getCategoryLink($blog), $this->getCategoryTitle($blog));
}
JSCommunityApi::registerActivity(0, $title . $output, $blog->created_by, null, 'user', null, 'com_easyblog', null, JText::_('COM_EASYBLOG_MIGHTYTOUCH_FILTER_BLOGS'));
return true;
}
示例5: display
function display($tmpl = null)
{
JPluginHelper::importPlugin('easyblog');
$dispatcher = JDispatcher::getInstance();
$mainframe = JFactory::getApplication();
$document = JFactory::getDocument();
$config = EasyBlogHelper::getConfig();
$my = JFactory::getUser();
$notice = '';
//for trigger
$params = $mainframe->getParams('com_easyblog');
$limitstart = JRequest::getInt('limitstart', 0, '');
$blogId = JRequest::getVar('id');
if (JRequest::getInt('print') == 1) {
// Add noindex for print view by default.
$document->setMetadata('robots', 'noindex,follow');
}
if (empty($blogId)) {
$mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=latest', false), JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND'));
$mainframe->close();
}
if ($my->id <= 0 && $config->get('main_login_read')) {
$mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $blogId . '&layout=login', false));
$mainframe->close();
}
$team = JRequest::getVar('team', '');
if (empty($team)) {
//try get from session.
$team = EasyBlogHelper::getSession('EASYBLOG_TEAMBLOG_ID');
}
// set meta tags for post
EasyBlogHelper::setMeta($blogId, META_TYPE_POST);
$print = JRequest::getBool('print');
if ($print) {
$document->setMetaData('robots', 'noindex, nofollow');
}
$my = JFactory::getUser();
$blog = EasyBlogHelper::getTable('Blog', 'Table');
if (!$blog->load($blogId)) {
$mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=latest', false), JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND'));
$mainframe->close();
}
if (!empty($blog->robots)) {
$document->setMetaData('robots', $blog->robots);
}
if (!empty($blog->copyrights)) {
$document->setMetaData('rights', $blog->copyrights);
}
//assign the teamid here.
$checkIsPrivate = false;
//check if blog is password protected.
if ($config->get('main_password_protect', true) && !empty($blog->blogpassword)) {
if (!EasyBlogHelper::verifyBlogPassword($blog->blogpassword, $blog->id)) {
$errmsg = '';
$jSession = JFactory::getSession();
if ($jSession->has('PROTECTEDBLOG_' . $blog->id, 'EASYBLOG')) {
$errmsg = JText::_('COM_EASYBLOG_PASSWORD_PROTECTED_BLOG_INVALID_PASSWORD');
}
$theme = new CodeThemes();
$theme->set('id', $blog->id);
$theme->set('return', base64_encode(JURI::getInstance()->toString()));
$theme->set('errmsg', $errmsg);
echo $theme->fetch('blog.protected.php');
return false;
}
}
//if team id provided, then we need to check if the user belong to the team or not.
if ($blog->issitewide) {
$checkIsPrivate = true;
} else {
if (empty($team)) {
// blog post is not sitewide and teamid is empty? this is not so right. need to check this post contributed to which team one more time.
$team = $blog->getTeamContributed();
}
/*
* if teamblog access set to 'member only' | 'registered user', team blog will supersede blog permision
* if teamblog access set to 'everyone' then blog's permission will supersede teamblog access (logged user vs guest)
*/
if (!empty($team)) {
$teamblog = EasyBlogHelper::getTable('TeamBlog', 'Table');
$teamblog->load($team);
if ($teamblog->access == '1') {
if (!EasyBlogHelper::isTeamBlogJoined($my->id, $team)) {
//show error.
EasyBlogHelper::showAccessDenied('teamblog', $teamblog->access);
return;
}
} else {
if ($teamblog->access == '2') {
if (!EasyBlogHelper::isLoggedIn()) {
EasyBlogHelper::showLogin();
return;
}
} else {
// if teamblog the access set to 'everyone' then blog permission will supersede teamblog access
$checkIsPrivate = true;
}
}
} else {
$checkIsPrivate = true;
//.........这里部分代码省略.........
示例6: display
function display($tmpl = null)
{
JPluginHelper::importPlugin('easyblog');
$dispatcher = JDispatcher::getInstance();
$mainframe = JFactory::getApplication();
$document = JFactory::getDocument();
$config = EasyBlogHelper::getConfig();
//for trigger
$params = $mainframe->getParams('com_easyblog');
$limitstart = JRequest::getVar('limitstart', 0, '', 'int');
$joomlaVersion = EasyBlogHelper::getJoomlaVersion();
$blogId = JRequest::getVar('id');
if (empty($blogId)) {
return JError::raiseError(404, JText::_('COM_EASYBLOG_BLOG_NOT_FOUND'));
}
$my = JFactory::getUser();
$blog = EasyBlogHelper::getTable('Blog', 'Table');
$blog->load($blogId);
//check if blog is password protected.
if ($config->get('main_password_protect', true) && !empty($blog->blogpassword)) {
if (!EasyBlogHelper::verifyBlogPassword($blog->blogpassword, $blog->id)) {
echo JText::_('COM_EASYBLOG_PASSWORD_PROTECTED_PDF_ERROR');
return false;
}
}
$blog->intro = EasyBlogHelper::getHelper('Videos')->strip($blog->intro);
$blog->content = EasyBlogHelper::getHelper('Videos')->strip($blog->content);
//onEasyBlogPrepareContent trigger start
$dispatcher->trigger('onEasyBlogPrepareContent', array(&$blog, &$params, $limitstart));
//onEasyBlogPrepareContent trigger end
//onPrepareContent trigger start
$blog->introtext = $blog->intro;
$blog->text = $blog->content;
if ($joomlaVersion >= '1.6') {
$dispatcher->trigger('onContentPrepare', array('easyblog.blog', &$blog, &$params, $limitstart));
} else {
$dispatcher->trigger('onPrepareContent', array(&$blog, &$params, $limitstart));
}
$blog->intro = $blog->introtext;
$blog->content = $blog->text;
//onPrepareContent trigger end
// @task: Retrieve tags output.
$modelPT = $this->getModel('PostTag');
$blogTags = $modelPT->getBlogTags($blog->id);
$theme = new CodeThemes();
$theme->set('tags', $blogTags);
$tags = $theme->fetch('tags.item.php');
//page setup
$blogHtml = '';
$commentHtml = '';
$blogHeader = '';
$blogFooter = '';
$adsenseHtml = '';
$trackbackHtml = '';
$blogger = null;
if ($blog->created_by != 0) {
$blogger = EasyBlogHelper::getTable('Profile', 'Table');
$blogger->load($blog->created_by);
$blogger->displayName = $blogger->getName();
}
//onAfterDisplayTitle, onBeforeDisplayContent, onAfterDisplayContent trigger start
$blog->event = new stdClass();
if ($joomlaVersion >= '1.6') {
$results = $dispatcher->trigger('onContentAfterTitle', array('easyblog.blog', &$blog, &$params, $limitstart));
$blog->event->afterDisplayTitle = JString::trim(implode("\n", $results));
$results = $dispatcher->trigger('onContentBeforeDisplay', array('easyblog.blog', &$blog, &$params, $limitstart));
$blog->event->beforeDisplayContent = JString::trim(implode("\n", $results));
$results = $dispatcher->trigger('onContentAfterDisplay', array('easyblog.blog', &$blog, &$params, $limitstart));
$blog->event->afterDisplayContent = JString::trim(implode("\n", $results));
} else {
$results = $dispatcher->trigger('onAfterDisplayTitle', array(&$blog, &$params, $limitstart));
$blog->event->afterDisplayTitle = JString::trim(implode("\n", $results));
$results = $dispatcher->trigger('onBeforeDisplayContent', array(&$blog, &$params, $limitstart));
$blog->event->beforeDisplayContent = JString::trim(implode("\n", $results));
$results = $dispatcher->trigger('onAfterDisplayContent', array(&$blog, &$params, $limitstart));
$blog->event->afterDisplayContent = JString::trim(implode("\n", $results));
}
//onAfterDisplayTitle, onBeforeDisplayContent, onAfterDisplayContent trigger end
$tplB = new CodeThemes();
$tplB->set('blog', $blog);
$tplB->set('tags', $tags);
$tplB->set('config', $config);
$tplB->set('blogger', $blogger);
$blogHtml = $tplB->fetch('blog.read.pdf.php');
//pdf page setup
$pageTitle = EasyBlogHelper::getPageTitle($config->get('main_title'));
$document->setTitle($blog->title . $pageTitle);
$document->setName($blog->permalink);
// Fix phoca pdf plugin.
if (method_exists($document, 'setArticleText')) {
$document->setArticleText($blogHtml);
}
echo $blogHtml;
}