Example #1
0
 protected function addToolbar()
 {
     JHTML::stylesheet('administrator/components/com_jinc/assets/css/jinc_admin.css');
     JToolBarHelper::title(JText::_('COM_JINC_MENU_SUBSCRIBERS'), 'jinc');
     $bar = JToolBar::getInstance('toolbar');
     $bar->appendButton('Popup', 'addsubscriber', 'COM_JINC_ADDSUBSCRIBER', 'index.php?option=com_jinc&view=newsletter&tmpl=component&layout=addsubscriber', 875, 550, 0, 0, '');
     JToolBarHelper::custom('subscribers.approve', 'approve', 'approve', 'COM_JINC_APPROVE', true);
     JToolBarHelper::deleteList(JText::_('COM_JINC_WARNING_DELETE_ITEMS'), 'subscribers.delete');
     jincimport('utility.jinchelper');
     JINCHelper::helpOnLine(98);
 }
Example #2
0
 protected function addToolbar()
 {
     $state = $this->get('State');
     JHTML::stylesheet('administrator/components/com_jinc/assets/css/jinc_admin.css');
     JToolBarHelper::title(JText::_('COM_JINC_MENU_TEMPLATES'), 'jinc');
     JToolBarHelper::addNew('template.add', 'JTOOLBAR_NEW');
     JToolBarHelper::editList('template.edit', 'JTOOLBAR_EDIT');
     JToolBarHelper::deleteList(JText::_('COM_JINC_WARNING_DELETE_ITEMS'), 'templates.delete');
     jincimport('utility.jinchelper');
     JINCHelper::helpOnLine(95);
 }
Example #3
0
 function display($tpl = null)
 {
     JHTML::stylesheet('administrator/components/com_jinc/assets/css/jinc_admin.css');
     JToolBarHelper::title(JText::_('COM_JINC_CPANEL_JINC'), 'jinc');
     JToolBarHelper::preferences('com_jinc', '550');
     jincimport('utility.jinchelper');
     JINCHelper::helpOnLine(87);
     $version = JINCHelper::getJINCVersion();
     $copyright = JINCHelper::getJINCCopyright();
     $license = JINCHelper::getJINCLicense();
     $this->assignRef('version', $version);
     $this->assignRef('copyright', $copyright);
     $this->assignRef('license', $license);
     parent::display($tpl);
 }
Example #4
0
 protected function addToolbar()
 {
     JHTML::stylesheet('administrator/components/com_jinc/assets/css/jinc_admin.css');
     JToolBarHelper::title(JText::_('COM_JINC_MENU_NEWSLETTERS'), 'jinc');
     $bar = JToolBar::getInstance('toolbar');
     $bar->appendButton('Popup', 'attributes', 'COM_JINC_ATTRIBUTES', 'index.php?option=com_jinc&view=attributes&tmpl=component', 875, 550, 0, 0, '');
     JToolBarHelper::divider();
     JToolBarHelper::addNew('newsletter.add', 'JTOOLBAR_NEW');
     JToolBarHelper::editList('newsletter.edit', 'JTOOLBAR_EDIT');
     JToolBarHelper::deleteList(JText::_('COM_JINC_WARNING_DELETE_ITEMS'), 'newsletters.delete');
     JToolBarHelper::divider();
     JToolBarHelper::custom('newsletters.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
     JToolBarHelper::custom('newsletters.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true);
     jincimport('utility.jinchelper');
     JINCHelper::helpOnLine(88);
 }
Example #5
0
 protected function addToolbar()
 {
     $state = $this->get('State');
     JHTML::stylesheet('administrator/components/com_jinc/assets/css/jinc_admin.css');
     JToolBarHelper::title(JText::_('COM_JINC_MENU_MESSAGES'), 'jinc');
     // $bar = JToolBar::getInstance('toolbar');
     // $bar->appendButton('Popup', 'jincpreview', 'COM_JINC_JTOOLBAR_PREVIEW', 'index.php?option=com_jinc&view=message&tmpl=component&layout=preview', 875, 550, 0, 0, '');
     JToolBarHelper::custom('message.previewPage', 'jincpreview', 'jincpreview', 'COM_JINC_JTOOLBAR_PREVIEW', false);
     JToolBarHelper::custom('message.sendPage', 'jincsend', 'jincsend', 'COM_JINC_JTOOLBAR_SEND', false);
     JToolBarHelper::custom('message.history', 'jinchistory', 'jinchistory', 'COM_JINC_JTOOLBAR_HISTORY', false);
     JToolBarHelper::divider();
     JToolBarHelper::addNew('message.add', 'JTOOLBAR_NEW');
     JToolBarHelper::editList('message.edit', 'JTOOLBAR_EDIT');
     JToolBarHelper::deleteList(JText::_('COM_JINC_WARNING_DELETE_ITEMS'), 'messages.delete');
     jincimport('utility.jinchelper');
     JINCHelper::helpOnLine(89);
 }
Example #6
0
 protected function addToolbar()
 {
     JRequest::setVar('hidemainmenu', true);
     JHTML::stylesheet('administrator/components/com_jinc/assets/css/jinc_admin.css');
     $isNew = $this->item->id == 0;
     $text = $isNew ? JText::_('NEW') : JText::_('EDIT');
     JToolBarHelper::title(JText::_('COM_JINC_TEMPLATE') . ': <small><small>[ ' . $text . ' ]</small></small>', 'jinc');
     JToolBarHelper::apply('template.apply', 'JTOOLBAR_APPLY');
     JToolBarHelper::save('template.save', 'JTOOLBAR_SAVE');
     JToolBarHelper::addNew('template.save2new', 'JTOOLBAR_SAVE_AND_NEW');
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('template.cancel', 'JTOOLBAR_CANCEL');
     } else {
         JToolBarHelper::cancel('template.cancel', 'JTOOLBAR_CLOSE');
     }
     jincimport('utility.jinchelper');
     JINCHelper::helpOnLine(95);
 }
Example #7
0
 function display($tpl = null)
 {
     jincimport('statistics.statisticfactory');
     JHTML::stylesheet('administrator/components/com_jinc/assets/css/jinc_admin.css');
     JToolBarHelper::title(JText::_('COM_JINC_STATISTICS'), 'jinc');
     jincimport('utility.jinchelper');
     JINCHelper::helpOnLine(91);
     $session =& JFactory::getSession();
     $config =& JFactory::getConfig();
     $tzoffset = $config->getValue('config.offset');
     $this->news_id = JRequest::getInt('id', 0);
     $this->stat_type = JRequest::getInt('stat_type', STATISTICFACTORY_SUBS_TYPE);
     $this->time_type = JRequest::getInt('time_type', STATISTICFACTORY_STAT_DAILY);
     $start_date = JRequest::getFloat('start_date', time());
     $end_date = JRequest::getFloat('end_date', time());
     $sdate =& JFactory::getDate($start_date, $tzoffset);
     $edate =& JFactory::getDate($end_date, $tzoffset);
     $this->start_time = $sdate;
     $this->end_time = $edate;
     $this->values = $session->get('stats.values');
     $this->legend = $session->get('stats.legend');
     parent::display($tpl);
 }
Example #8
0
 function getJINCCopyright()
 {
     return JINCHelper::_getXMLInfos('copyright');
 }
Example #9
0
 /**
  * Method to subscribe a user to the newsletter. Implements the parent
  * abstract method.
  *
  * Hint: $subscriber_info array description:
  *
  * $subscriber_info[user_id] - User id of the user to subscribe.
  * $subscriber_info[username] - Username of the user to subscribe.
  * $subscriber_info[name] - Name of the user to subscribe.
  * $subscriber_info[email] - Email of the user to subscribe.
  * $subscriber_info[gid] - Group identifier in which the user will be subscribed.
  *
  * @access	public
  * @param   array $subscriber_info Subscriber info based on newsletter type.
  * @param   array $attributes Array of addictional attributes for subscription
  * @return  true if successfully subscribed. false if something wrong.
  * @since	0.6
  */
 function subscribe($subscriber_info, $attributes = null)
 {
     if (is_null($attributes) || !is_array($attributes)) {
         $attributes = array();
     }
     jincimport('utility.jincjoomlahelper');
     jincimport('utility.servicelocator');
     $servicelocator = ServiceLocator::getInstance();
     $logger = $servicelocator->getLogger();
     if (!isset($subscriber_info['user_id'])) {
         $this->setError('COM_JINC_ERR008');
         return false;
     }
     $news_id = $this->get('id');
     $user_id = $subscriber_info['user_id'];
     $user_info = JINCJoomlaHelper::getUserInfo($user_id);
     if (empty($user_info)) {
         $this->setError('COM_JINC_ERR008');
         return false;
     }
     $user =& JFactory::getUser($user_id);
     if (!$user->authorize('jinc.subscribe', 'com_jinc.newsletter.' . $news_id)) {
         $this->setError('COM_JINC_ERR006');
         return false;
     }
     if (!$this->checkMandatoryAttributes($attributes)) {
         $this->setError('COM_JINC_ERR048');
         return false;
     }
     if ($this->isSubscribed($subscriber_info) > 0) {
         $this->setError('COM_JINC_ERR015');
         return false;
     }
     jincimport('utility.jinchelper');
     $ip = JINCHelper::getRealIpAddr();
     $query = 'INSERT IGNORE INTO #__jinc_subscriber ' . '(news_id , user_id, datasub, ipaddr) ' . 'VALUES (' . (int) $news_id . ', ' . (int) $user_id . ', ' . 'now(), INET_ATON(\'' . $ip . '\'))';
     $logger->debug('PrivateNewsletter: Executing query: ' . $query);
     $dbo =& JFactory::getDBO();
     $dbo->setQuery($query);
     if (!$dbo->query()) {
         $this->setError('COM_JINC_ERR009');
         return false;
     }
     $sub_id = $dbo->insertid();
     $this->insertAttributeOnSubscription($sub_id, $attributes);
     $this->sendWelcome($user_info, $attributes);
     $dispatcher =& JDispatcher::getInstance();
     $params = array('news_id' => $this->get('id'), 'news_name' => $this->get('name'), 'subs_name' => $user_info['name'], 'news_notify' => $this->get('notify'));
     $result = $dispatcher->trigger('jinc_subscribe', $params);
     return true;
 }
Example #10
0
 /**
  * Method to subscribe a user to the newsletter. Implements the parent
  * abstract method.
  *
  * Hint: $subscriber_info array description:
  *
  * $subscriber_info[email] - Email of the user to subscribe.
  * $subscriber_info[noptin] - If true the optin won't be sent and the user
  *                            will be directly subscribed to the newsletter.
  *
  * @access	public
  * @param   array $subscriber_info Subscriber info based on newsletter type.
  * @param   array $attributes Array of addictional attributes for subscription
  * @return  true if successfully subscribed. false if something wrong.
  * @since	0.6
  */
 function subscribe($subscriber_info, $attributes = null)
 {
     if (is_null($attributes) || !is_array($attributes)) {
         $attributes = array();
     }
     jincimport('utility.randomizer');
     jincimport('utility.inputchecker');
     jincimport('utility.servicelocator');
     $servicelocator = ServiceLocator::getInstance();
     $logger = $servicelocator->getLogger();
     if (!isset($subscriber_info['email'])) {
         $this->setError('COM_JINC_ERR008');
         return false;
     }
     $email = $subscriber_info['email'];
     if (!InputChecker::checkMail($email)) {
         $this->setError('COM_JINC_ERR012');
         return false;
     }
     if (!$this->checkMandatoryAttributes($attributes)) {
         $this->setError('COM_JINC_ERR048');
         return false;
     }
     if (!$this->isSubscribed($subscriber_info)) {
         $email = $subscriber_info['email'];
         $news_id = $this->get('id');
         if (isset($subscriber_info['noptin']) && $subscriber_info['noptin']) {
             $datasub = 'now()';
             $random = '';
         } else {
             jincimport('utility.randomizer');
             $datasub = 'NULL';
             $random = Randomizer::getRandomString();
         }
         jincimport('utility.jinchelper');
         $ip = JINCHelper::getRealIpAddr();
         $dbo =& JFactory::getDBO();
         $query = 'INSERT IGNORE INTO #__jinc_subscriber ' . '(news_id , email, datasub, random, ipaddr) ' . 'VALUES (' . (int) $news_id . ', ' . $dbo->quote($email) . ', ' . $datasub . ', ' . $dbo->quote($random) . ', ' . 'INET_ATON(\'' . $ip . '\'))';
         $logger->debug('PublicNewsletter: Executing query: ' . $query);
         $dbo->setQuery($query);
         if (!$dbo->query()) {
             $this->setError('COM_JINC_ERR009');
             return false;
         }
         $sub_id = $dbo->insertid();
         $logger->finer('PublicNewsletter: Inserting attribute addictional info: ' . $sub_id);
         $this->insertAttributeOnSubscription($sub_id, $attributes);
         if (strlen($random) > 0) {
             $query = 'DELETE FROM #__jinc_subscriber ' . 'WHERE news_id = ' . (int) $news_id . ' ' . 'AND email = ' . $dbo->quote($email) . ' ' . 'AND random != ' . $dbo->quote($random) . ' ' . 'AND random != \'\'';
             $logger->debug('PublicNewsletter: executing query: ' . $query);
             $logger->finer('PublicNewsletter: other subscription requests.');
             $dbo->setQuery($query);
             if (!$dbo->query()) {
                 $logger->info('PublicNewsletter: error removing other subscription requests.');
                 $this->setError('COM_JINC_ERR009');
                 return false;
             }
             // Setting opt-in message
             $root_uri = JURI::root();
             $conf_url = $root_uri . 'index.php?option=com_jinc&task=newsletter.confirm&';
             $conf_url .= 'id=' . $news_id . '&';
             $conf_url .= 'random=' . urldecode($random) . '&';
             $conf_url .= 'user_mail=' . urldecode($email);
             $msg = $this->get('optin');
             $msg = preg_replace('/\\[SENDER\\]/s', $this->get('sendername'), $msg);
             $msg = preg_replace('/\\[SENDERMAIL\\]/s', $this->get('senderaddr'), $msg);
             $msg = preg_replace('/\\[NEWSLETTER\\]/s', $this->get('name'), $msg);
             $msg = preg_replace('/\\[EMAIL\\]/s', $email, $msg);
             $msg = preg_replace('/\\[OPTIN_URL\\]/s', $conf_url, $msg);
             foreach ($attributes as $attr_name => $attr_value) {
                 $msg = preg_replace('/\\[ATTR_' . strtoupper($attr_name) . '\\]/s', $attr_value, $msg);
             }
             $msg = preg_replace('#src[ ]*=[ ]*\\"(?!https?://)(?:\\.\\./|\\./|/)?#', 'src="' . $root_uri, $msg);
             $msg = preg_replace('#href[ ]*=[ ]*\\"(?!https?://)(?!mailto?:)(?!tel?:)(?:\\.\\./|\\./|/)?#', 'href="' . $root_uri, $msg);
             $msg = preg_replace('#url[ ]*\\(\'(?!https?://)(?:\\.\\./|\\./|/)?#', 'url(\'' . $root_uri, $msg);
             // Message composition
             $message =& JFactory::getMailer();
             $message->ContentType = "text/html";
             $message->setSubject($this->get('optin_subject'));
             $message->setBody($msg);
             if (strlen($this->get('senderaddr')) > 0) {
                 $message->setSender(array($this->get('senderaddr'), $this->get('sendername')));
             }
             if (strlen($this->get('replyto_addr')) > 0) {
                 $message->addReplyTo(array($this->get('replyto_addr'), $this->get('replyto_name')));
             }
             $message->addRecipient($email);
             $logger->finer('PublicNewsletter: Sending message to ' . $email . ' with body: ' . $msg);
             $result = $message->send();
             if (!$result) {
                 $this->setError(JText::_('COM_JINC_ERR001'));
                 return false;
             }
         }
     } else {
         $this->setError('COM_JINC_ERR015');
         return false;
     }
     if (isset($subscriber_info['noptin']) && $subscriber_info['noptin']) {
         $dispatcher =& JDispatcher::getInstance();
         $params = array('news_id' => $this->get('id'), 'news_name' => $this->get('name'), 'subs_name' => $subscriber_info['email'], 'news_notify' => $this->get('notify'));
         $result = $dispatcher->trigger('jinc_subscribe', $params);
     }
     return true;
 }
Example #11
0
 protected function addToolbar()
 {
     $isNew = $this->item->id == 0;
     $text = $isNew ? JText::_('NEW') : JText::_('EDIT');
     JToolBarHelper::title(JText::_('COM_JINC_MESSAGE') . ': <small><small>[ ' . $text . ' ]</small></small>', 'jinc');
     $bar = JToolBar::getInstance('toolbar');
     $id = JRequest::getInt('id', 0);
     $bar->appendButton('Popup', 'tags', 'COM_JINC_TAGS', 'index.php?option=com_jinc&amp;view=tags&amp;tmpl=component&msg_id=' . $id, 875, 550, 0, 0, '');
     $bar->appendButton('Popup', 'load-template', 'COM_JINC_LOAD_TEMPLATE', 'index.php?option=com_jinc&amp;view=templates&amp;layout=select&amp;tmpl=component', 875, 550, 0, 0, '');
     JToolBarHelper::divider();
     JToolBarHelper::apply('message.apply', 'JTOOLBAR_APPLY');
     JToolBarHelper::save('message.save', 'JTOOLBAR_SAVE');
     JToolBarHelper::addNew('message.save2new', 'JTOOLBAR_SAVE_AND_NEW');
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('message.cancel', 'JTOOLBAR_CANCEL');
     } else {
         JToolBarHelper::cancel('message.cancel', 'JTOOLBAR_CLOSE');
     }
     jincimport('utility.jinchelper');
     JINCHelper::helpOnLine(89);
 }
Example #12
0
 protected function addToolbar()
 {
     JRequest::setVar('hidemainmenu', true);
     $isNew = $this->item->id == 0;
     $text = $isNew ? JText::_('NEW') : JText::_('EDIT');
     JToolBarHelper::title(JText::_('COM_JINC_NEWSLETTER') . ': <small><small>[ ' . $text . ' ]</small></small>', 'jinc');
     $bar = JToolBar::getInstance('toolbar');
     $id = JRequest::getInt('id', 0);
     $bar->appendButton('Popup', 'tags', 'COM_JINC_TAGS', 'index.php?option=com_jinc&amp;view=tags&amp;tmpl=component&news_id=' . $id, 875, 550, 0, 0, '');
     JToolBarHelper::divider();
     JToolBarHelper::apply('newsletter.apply', 'JTOOLBAR_APPLY');
     JToolBarHelper::save('newsletter.save', 'JTOOLBAR_SAVE');
     JToolBarHelper::addNew('newsletter.save2new', 'JTOOLBAR_SAVE_AND_NEW');
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('newsletter.cancel', 'JTOOLBAR_CANCEL');
     } else {
         JToolBarHelper::cancel('newsletter.cancel', 'JTOOLBAR_CLOSE');
     }
     jincimport('utility.jinchelper');
     JINCHelper::helpOnLine(88);
 }