function confirmRejectBlog($draftId) { $my = JFactory::getUser(); $ajax = new Ejax(); $acl = EasyBlogACLHelper::getRuleSet(); $config = EasyBlogHelper::getConfig(); $ids = $draftId; if (!is_array($ids)) { $ids = array($ids); } JTable::addIncludePath(EBLOG_TABLES); foreach ($ids as $id) { $blog = EasyBlogHelper::getTable('Draft', 'Table'); $blog->load($id); // @rule: Check if the blog is really under pending if ($blog->pending_approval != 1) { $options = new stdClass(); $options->content = JText::_('COM_EASYBLOG_NOT_ALLOWED'); $ajax->dialog($options); return $ajax->send(); } } $content = ''; $content .= '<p>' . JText::_('COM_EASYBLOG_PENDING_REJECT_PENDING_ENTRIES_MESSAGE') . '</p>'; $content .= '<form name="reject-post" id="reject-post" action="' . JRoute::_('index.php?option=com_easyblog&c=pending&task=reject') . '" method="post">'; $content .= '<div class="mtm">'; $content .= ' <label for="message">' . JText::_('COM_EASYBLOG_PENDING_SPECIFY_REASON') . '</label>'; $content .= ' <textarea class="full" id="message" name="message"></textarea>'; $content .= '</div>'; $content .= '<div class="dialog-actions">'; $content .= JHTML::_('form.token'); foreach ($ids as $id) { $content .= ' <input type="hidden" name="draft_id[]" value="' . $id . '" />'; } $content .= ' <input type="button" value="' . JText::_('COM_EASYBLOG_PENDING_CANCEL_BUTTON') . '" class="button" id="edialog-cancel" name="edialog-cancel" onclick="ejax.closedlg();" />'; $content .= ' <input type="submit" value="' . JText::_('COM_EASYBLOG_PENDING_PROCEED_BUTTON') . '" class="button" />'; $content .= '</div>'; $options = new stdClass(); $options->title = JText::_('COM_EASYBLOG_PENDING_DIALOG_CONFIRM_REJECT_TITLE'); $options->content = $content; $ajax->dialog($options); return $ajax->send(); }
public function preview($blogId) { $ajax = new Ejax(); $mailq = EasyBlogHelper::getTable('Mailqueue'); $mailq->load($blogId); $url = JURI::root() . 'administrator/index.php?option=com_easyblog&c=spools&task=preview&id=' . $mailq->id . '&' . EasyBlogHelper::getToken() . '=1'; $options = new stdClass(); $options->title = JText::_('COM_EASYBLOG_EMAIL_PREVIEW'); $options->content = '<iframe src="' . $url . '" width="100%" height="500"></iframe>'; $options->width = '750'; $ajax->dialog($options); $ajax->send(); }
function showSubscription($bloggerId) { $my = JFactory::getUser(); $ejax = new Ejax(); $tpl = new CodeThemes(); $tpl->set('my', $my); $tpl->set('blogId', $bloggerId); $options = new stdClass(); $options->title = JText::_('COM_EASYBLOG_SUBSCRIBE_BLOGGER'); $options->content = $tpl->fetch('blogger.subscription.box.php'); $ejax->dialog($options); $ejax->send(); return; }
public function showVoters($elementId, $type) { $ajax = new Ejax(); $model = $this->getModel('Ratings'); $config = EasyBlogHelper::getConfig(); $voters = $model->getRatingUsers($elementId, $type, $config->get('main_ratings_display_raters_max')); $guests = false; $theme = new CodeThemes(); $theme->set('guests', $guests); $theme->set('voters', $voters); $options = new stdClass(); $options->title = JText::_('COM_EASYBLOG_DIALOG_TITLE_RECENT_VOTERS'); $options->content = $theme->fetch('ratings.users.php'); $ajax->dialog($options); return $ajax->send(); }
public function purgeCache() { $ajax = new Ejax(); $options = new stdClass(); $options->title = JText::_('COM_EASYBLOG_PURGE_CACHE_DIALOG_TITLE'); $content = ''; $content .= '<p>' . JText::_('COM_EASYBLOG_PURGE_CACHE_DIALOG_CONTENT') . '</p>'; $content .= '<form name="reject-post" id="reject-post" action="' . JRoute::_('index.php?option=com_easyblog&task=purgeCache') . '" method="post">'; $content .= '<div class="dialog-actions">'; $content .= JHTML::_('form.token'); $content .= ' <input type="button" value="' . JText::_('COM_EASYBLOG_PENDING_CANCEL_BUTTON') . '" class="button" id="edialog-cancel" name="edialog-cancel" onclick="ejax.closedlg();" />'; $content .= ' <input type="submit" value="' . JText::_('COM_EASYBLOG_PURGE_CACHE_BUTTON') . '" class="button" />'; $content .= '</div>'; $options->content = $content; $ajax->dialog($options); return $ajax->send(); }
public function preview($blogId) { $ajax = new Ejax(); $mailq = DiscussHelper::getTable('Mailqueue'); $mailq->load($blogId); $options = new stdClass(); $options->title = JText::_('COM_EASYDISCUSS_EMAIL_PREVIEW'); $options->content = $mailq->body; $buttons = array(); $button = new stdClass(); $button->title = JText::_('COM_EASYDISCUSS_OK'); $button->action = 'disjax.closedlg();'; $button->className = 'btn-primary'; $buttons[] = $button; $options->buttons = $buttons; $ajax->dialog($options); $ajax->send(); }
function import() { $my = JFactory::getUser(); $ajax = new Ejax(); $acl = EasyBlogACLHelper::getRuleSet(); $config = EasyBlogHelper::getConfig(); ob_start(); ?> <form name="import" id="import-settings" method="post" enctype="multipart/form-data"> <div class="mtm"> <label for="file"><?php echo JText::_('Exported File'); ?> </label> <input type="file" name="file" /> </div> <div class="dialog-actions"> <?php echo JHTML::_('form.token'); ?> <input type="hidden" name="option" value="com_easyblog" /> <input type="hidden" name="c" value="settings" /> <input type="hidden" name="task" value="import" /> <input type="button" value="<?php echo JText::_('COM_EASYBLOG_CANCEL_BUTTON'); ?> " class="button" id="edialog-cancel" name="edialog-cancel" onclick="ejax.closedlg();" /> <input type="submit" value="<?php echo JText::_('COM_EASYBLOG_IMPORT_BUTTON'); ?> " class="button" /> </div> </form> <?php $contents = ob_get_contents(); ob_end_clean(); $options = new stdClass(); $options->title = JText::_('COM_EASYBLOG_PENDING_DIALOG_CONFIRM_REJECT_TITLE'); $options->content = $contents; $ajax->dialog($options); return $ajax->send(); }
public function showVideoForm($editorName) { $ajax = new Ejax(); $my = JFactory::getUser(); if ($my->id <= 0) { $title = JText::_('COM_EASYBLOG_INFO'); $callback = JText::_('COM_EASYBLOG_NO_PERMISSION_TO_PUBLISH_OR_UNPUBLISH_COMMENT'); $width = '450'; $height = 'auto'; $ajax->alert($callback, $title, $width, $height); $ajax->send(); return; } $theme = new CodeThemes(true); $theme->set('editorName', $editorName); $content = $theme->fetch('ajax.dialog.videos.add.php'); $title = JText::_('COM_EASYBLOG_DASHBOARD_WRITE_INSERT_VIDEO_DIALOG_TITLE'); $ajax->dialog(EasyBlogHelper::getHelper('DialogOptions')->set('title', $title)->set('content', $content)->toObject()); return $ajax->send(); }
public function submitForm($type, $post) { $ejax = new Ejax(); $mainframe = JFactory::getApplication(); $my = JFactory::getUser(); $config = EasyBlogHelper::getConfig(); $acl = EasyBlogACLHelper::getRuleSet(); $id = isset($post['id']) ? $post['id'] : ''; if (empty($acl->rules->allow_subscription) && (empty($my->id) && !$config->get('main_allowguestsubscribe'))) { $theme = new CodeThemes(); $theme->set('message', JText::_('COM_EASYBLOG_NO_PERMISSION_TO_SUBSCRIBE_BLOG')); $theme->set('type', $type); $theme->set('id', $id); $options = EasyBlogHelper::getHelper('DialogOptions')->set('title', JText::_('COM_EASYBLOG_SUBSCRIPTION_ERROR_DIALOG_TITLE'))->set('content', $theme->fetch('ajax.dialog.subscribe.error.php'))->toObject(); $ejax->dialog($options); return $ejax->send(); } $isModerate = false; $userId = isset($post['userid']) ? $post['userid'] : ''; $email = JString::trim($post['email']); //registration $register = isset($post['esregister']) ? true : false; $fullname = isset($post['esfullname']) ? $post['esfullname'] : ''; $username = isset($post['esusername']) ? $post['esusername'] : ''; $newId = ''; $msg = ''; if (JString::trim($email) == '') { $theme = new CodeThemes(); $theme->set('message', JText::_('COM_EASYBLOG_SUBSCRIPTION_EMAIL_EMPTY_ERROR')); $theme->set('type', $type); $theme->set('id', $id); $options = EasyBlogHelper::getHelper('DialogOptions')->set('title', JText::_('COM_EASYBLOG_SUBSCRIPTION_ERROR_DIALOG_TITLE'))->set('content', $theme->fetch('ajax.dialog.subscribe.error.php'))->toObject(); $ejax->dialog($options); return $ejax->send(); } else { if (!EasyBlogHelper::getHelper('Email')->isValidInetAddress($email)) { $theme = new CodeThemes(); $theme->set('message', JText::_('COM_EASYBLOG_SUBSCRIPTION_EMAIL_INVALID_ERROR')); $theme->set('type', $type); $theme->set('id', $id); $options = EasyBlogHelper::getHelper('DialogOptions')->set('title', JText::_('COM_EASYBLOG_SUBSCRIPTION_ERROR_DIALOG_TITLE'))->set('content', $theme->fetch('ajax.dialog.subscribe.error.php'))->toObject(); $ejax->dialog($options); return $ejax->send(); } } if (JString::trim($fullname) == '') { $theme = new CodeThemes(); $theme->set('message', JText::_('COM_EASYBLOG_SUBSCRIPTION_NAME_EMPTY_ERROR')); $theme->set('type', $type); $theme->set('id', $id); $options = EasyBlogHelper::getHelper('DialogOptions')->set('title', JText::_('COM_EASYBLOG_SUBSCRIPTION_ERROR_DIALOG_TITLE'))->set('content', $theme->fetch('ajax.dialog.subscribe.error.php'))->toObject(); $ejax->dialog($options); return $ejax->send(); } if ($register && $my->id == 0) { if (JString::trim($username) == '') { $theme = new CodeThemes(); $theme->set('message', JText::_('COM_EASYBLOG_SUBSCRIPTION_USERNAME_EMPTY_ERROR')); $theme->set('type', $type); $theme->set('id', $id); $options = EasyBlogHelper::getHelper('DialogOptions')->set('title', JText::_('COM_EASYBLOG_SUBSCRIPTION_ERROR_DIALOG_TITLE'))->set('content', $theme->fetch('ajax.dialog.subscribe.error.php'))->toObject(); $ejax->dialog($options); return $ejax->send(); } $registor = EasyBlogHelper::getRegistor(); $options = array('username' => $username, 'email' => $email); $validate = $registor->validate($options); if ($validate !== true) { $theme = new CodeThemes(); $theme->set('message', $validate); $theme->set('type', $type); $theme->set('id', $id); $options = EasyBlogHelper::getHelper('DialogOptions')->set('title', JText::_('COM_EASYBLOG_SUBSCRIPTION_ERROR_DIALOG_TITLE'))->set('content', $theme->fetch('ajax.dialog.subscribe.error.php'))->toObject(); $ejax->dialog($options); return $ejax->send(); } else { $options['fullname'] = $fullname; $newId = $registor->addUser($options); if (!is_numeric($newId)) { // registration failed. $msg = $newId; } else { $userId = $newId; } } } // Real logic operation goes here. $method = 'subscribe' . ucfirst($type); // @rule: Process mailchimp subscriptions here. EasyBlogHelper::getHelper('Mailchimp')->subscribe($email, $fullname); if (!$this->{$method}($id, $userId, $email, $fullname)) { $theme = new CodeThemes(); $theme->set('message', JText::_('COM_EASYBLOG_SUBSCRIPTION_ALREADY_SUBSCRIBED_ERROR')); $theme->set('type', $type); $theme->set('id', $id); $options = EasyBlogHelper::getHelper('DialogOptions')->set('title', JText::_('COM_EASYBLOG_SUBSCRIPTION_ERROR_DIALOG_TITLE'))->set('content', $theme->fetch('ajax.dialog.subscribe.error.php'))->toObject(); $ejax->dialog($options); return $ejax->send(); } // message if ($register && is_numeric($newId)) { $message = JText::sprintf('COM_EASYBLOG_YOU_SUCCESSFULLY_SUBSCRIBED_AND_REGISTERED_AS_MEMBER'); } else { $message = JText::sprintf('COM_EASYBLOG_SUBSCRIPTION_SUBSCRIBED_SUCCESS', $email); } $theme = new CodeThemes(); $theme->set('message', $message); $options = EasyBlogHelper::getHelper('DialogOptions')->set('title', JText::_('COM_EASYBLOG_SUBSCRIPTION_SUCCESS_DIALOG_TITLE'))->set('content', $theme->fetch('ajax.dialog.subscribe.success.php'))->toObject(); $ejax->dialog($options); // Send email to notify admin upon successful subscriptions $user = EasyBlogHelper::getTable('Profile'); $user->load($userId); $date = EasyBlogDateHelper::getDate(); $subscriberName = $my->id == 0 ? $post['esfullname'] : $user->getName(); $data = array('title' => JText::_('COM_EASYBLOG_SUBSCRIPTION_SUCCESS_DIALOG_TITLE'), 'subscriber' => $subscriberName, 'subscriberLink' => EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $user->id, false, true), 'subscriberAvatar' => $user->getAvatar(), 'subscriberDate' => EasyBlogDateHelper::toFormat($date, '%A, %B %e, %Y'), 'type' => $type); if ($type == 'entry') { $data['reviewLink'] = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $id, false, true); } if ($type == 'category') { $data['reviewLink'] = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=categories&layout=listings&id=' . $id, false, true); } $emailTitle = JText::_('COM_EASYBLOG_NEW') . ' ' . JText::_('COM_EASYBLOG_SUBSCRIPTION_TYPE_' . strtoupper($type)) . ' ' . strtolower(JText::_('COM_EASYBLOG_SUBSCRIPTION')); $emails = array(); $notification = EasyBlogHelper::getHelper('Notification'); $config = EasyBlogHelper::getConfig(); // @rule: if custom_email_as_admin is enabled, use custom email as admin email if ($config->get('custom_email_as_admin')) { // @rule: Send to custom email addresses $notification->getCustomEmails($emails); } else { // @rule: Send to administrator's on the site. $notification->getAdminEmails($emails); } $notification->send($emails, $emailTitle, 'email.subscriptions', $data); return $ejax->send(); }
public function confirmUnsubscribeBlog($subscriptionId, $blogId) { $my = JFactory::getUser(); $ajax = new Ejax(); if ($my->id == 0 || !$subscriptionId || !$blogId) { $options = new stdClass(); $options->content = JText::_('COM_EASYBLOG_NOT_ALLOWED'); $ajax->dialog($options); return $ajax->send(); } $themes = new CodeThemes(); $themes->set('subscription_id', $subscriptionId); $themes->set('blog_id', $blogId); $options = new stdClass(); $options->title = JText::_('COM_EASYBLOG_UNSUBSCRIBE_BLOG_DIALOG_CONFIRM_DELETE_TITLE'); $options->content = $themes->fetch('ajax.dialog.blog.unsubscribe.php'); $ajax->dialog($options); //$ajax->script( 'easyblogApp.element.focus("subscribtion-message).hide()' ); return $ajax->send(); }
public function editComment($id) { $config = EasyBlogHelper::getConfig(); $my = JFactory::getUser(); $ajax = new Ejax(); $acl = EB::acl(); JTable::addIncludePath(EBLOG_TABLES); $comment = EB::table('Comment'); $comment->load($id); $tpl = EB::template(); $tpl->set('comment', $comment); $options = new stdClass(); $options->title = JText::_('COM_EASYBLOG_DASHBOARD_EDIT_COMMENT'); $options->content = $tpl->output('site/comments/dialog.edit'); $ajax->dialog($options); $ajax->send(); }
public function confirmAutopost($type, $id) { $ajax = new Ejax(); $options = new stdClass(); $options->title = JText::_('COM_EASYBLOG_AUTOPOST_DIALOG_INFO'); $action = EasyBlogHelper::getJoomlaVersion() >= '1.6' ? 'Joomla.submitbutton(\'autopost\');' : 'submitbutton(\'autopost\')'; ob_start(); ?> <p><?php echo JText::sprintf('COM_EASYBLOG_AUTOPOST_DIALOG_DESC', ucfirst($type)); ?> </p> <div class="dialog-actions"> <input type="button" onclick="ejax.closedlg();" name="edialog-cancel" id="edialog-cancel" class="button" value="<?php echo JText::_('COM_EASYBLOG_CANCEL_BUTTON'); ?> "> <input type="button" class="button" value="<?php echo JText::_('COM_EASYBLOG_SHARE_BUTTON'); ?> " onclick="<?php echo $action; ?> "> </div> <?php $options->content = ob_get_contents(); ob_end_clean(); $ajax->script('$("#adminForm input[name=autopost_type]").val("' . $type . '");'); $ajax->script('$("#adminForm input[name=autopost_selected]").val("' . $id . '");'); $ajax->dialog($options); $ajax->send(); }
/** * Responsible to submit a new team request. */ function addJoinRequest($post) { $ajax = new Ejax(); $app = JFactory::getApplication(); $my = JFactory::getUser(); $config = EasyBlogHelper::getConfig(); $now = EasyBlogHelper::getDate(); if (empty($post['id']) || $post['userid'] != $my->id || $my->id == 0) { $ajax->script('eblog.system.loader(false);'); $ajax->alert(JText::_('COM_EASYBLOG_NOT_ALLOWED'), JText::_('COM_EASYBLOG_ERROR'), '450', 'auto'); $ajax->send(); } $id = (int) $post['id']; $teamUser = EasyBlogHelper::getTable('TeamBlogUsers'); $teamUser->set('team_id', $id); $teamUser->set('user_id', $my->id); if ($teamUser->exists()) { $options = EasyBlogHelper::getHelper('DialogOptions')->set('title', JText::_('COM_EASYBLOG_INFO'))->set('content', JText::_('COM_EASYBLOG_TEAMBLOG_ALREADY_MEMBER'))->toObject(); $ajax->dialog($options); return $ajax->send(); } $request = EasyBlogHelper::getTable('TeamBlogRequest'); $request->team_id = $id; $request->user_id = $my->id; $request->ispending = '1'; $request->created = $now->toMySQL(); if ($request->exists()) { $options = EasyBlogHelper::getHelper('DialogOptions')->set('title', JText::_('COM_EASYBLOG_INFO'))->set('content', JText::_('COM_EASYBLOG_TEAMBLOG_REQUEST_ALREADY_SENT'))->toObject(); $ajax->dialog($options); return $ajax->send(); } if (!$request->store()) { $options = EasyBlogHelper::getHelper('DialogOptions')->set('title', JText::_('COM_EASYBLOG_ERROR'))->set('content', $request->getError())->toObject(); $ajax->dialog($options); return $ajax->send(); } // @rule: Send moderation emails out. $request->sendModerationEmail(); $options = EasyBlogHelper::getHelper('DialogOptions')->set('title', JText::_('COM_EASYBLOG_INFO'))->set('content', JText::_('COM_EASYBLOG_TEAMBLOG_REQUEST_SENT'))->toObject(); $ajax->dialog($options); $ajax->script('eblog.system.loader(false);'); $ajax->send(); return; }
function confirmRejectBlog($ids) { $my = JFactory::getUser(); $ajax = new Ejax(); $acl = EasyBlogACLHelper::getRuleSet(); $config = EasyBlogHelper::getConfig(); $ids = explode(',', $ids); if ($my->id == 0 || empty($acl->rules->manage_pending) && empty($acl->rules->publish_entry) && !EasyBlogHelper::isSiteAdmin()) { $options = new stdClass(); $options->content = JText::_('COM_EASYBLOG_NOT_ALLOWED'); $ajax->dialog($options); return $ajax->send(); } JTable::addIncludePath(EBLOG_TABLES); foreach ($ids as $id) { $blog = EasyBlogHelper::getTable('Draft', 'Table'); $blog->load($id); // @rule: Check if the blog is really under pending if ($blog->pending_approval != 1) { $options = new stdClass(); $options->content = JText::_('COM_EASYBLOG_NOT_ALLOWED'); $ajax->dialog($options); return $ajax->send(); } } $themes = new CodeThemes('dashboard'); $themes->set('ids', implode(',', $ids)); $themes->set('redirect', base64_encode('index.php?option=com_easyblog&view=dashboard&layout=pending')); $options = new stdClass(); $options->title = JText::_('COM_EASYBLOG_DASHBOARD_BLOG_DIALOG_CONFIRM_REJECT_TITLE'); $options->content = $themes->fetch('ajax.dialog.blog.reject.php'); $ajax->dialog($options); return $ajax->send(); }