/** * getUpdateInfo * * @return void */ public function getUpdateInfo() { @ob_end_clean(); header('Content-type: text/plain'); // No JInputJSON in J2.5 $raw = file_get_contents('php://input'); $data = json_decode($raw, true); $safeHtmlFilter = JFilterInput::getInstance(); $token = $data['token']; $token = $safeHtmlFilter->clean($token, 'ALNUM'); $this->input->set($token, 1); // CSRF prevention if ($this->csrfProtection) { $this->_csrfProtection(); } $updateModel = F0FModel::getTmpInstance('LiveUpdates', 'AutoTweetModel'); $updateInfo = (object) $updateModel->getUpdates(); $updateInfo->result = false; if ($updateInfo->hasUpdate) { $strings = array('header' => JText::sprintf('COM_AUTOTWEET_CPANEL_MSG_UPDATEFOUND', VersionHelper::getFlavourName(), $updateInfo->version), 'button' => JText::sprintf('COM_AUTOTWEET_CPANEL_MSG_UPDATENOW', $updateInfo->version), 'infourl' => $updateInfo->infoURL, 'infolbl' => JText::_('COM_AUTOTWEET_CPANEL_MSG_MOREINFO')); $strings['upgrade'] = null; if (!AUTOTWEETNG_JOOCIAL) { $strings['upgrade'] = ' ' . JText::_('COM_AUTOTWEET_UPDATE_TO_JOOCIAL_LABEL'); } $updateInfo->result = <<<ENDRESULT \t<div class="alert alert-warning"> \t\t<h3> \t\t\t<span class="xticon xticon-info-circle glyphicon glyphicon-exclamation-sign"></span> \t\t\t{$strings['header']} \t\t</h3> \t\t<p> \t\t\t<a href="index.php?option=com_installer&view=update" class="btn btn-primary"> \t\t\t\t{$strings['button']} \t\t\t</a> \t\t\t<a href="{$strings['infourl']}" target="_blank" class="btn btn-info"> \t\t\t\t{$strings['infolbl']} \t\t\t</a> \t\t\t{$strings['upgrade']} \t\t</p> \t</div> ENDRESULT; } $message = json_encode($updateInfo); echo EJSON_START . $message . EJSON_END; // Cut the execution short JFactory::getApplication()->close(); }
/** * Public constructor. Initialises the protected members as well. * * @param array $config Param */ public function __construct($config = array()) { parent::__construct($config); $dlid = EParameter::getComponentParam(CAUTOTWEETNG, 'update_dlid', ''); $this->extraQuery = ''; // If I have a valid Download ID I will need to use a non-blank extra_query in Joomla! 3.2+ if (preg_match('/^([0-9]{1,}:)?[0-9a-f]{32}$/i', $dlid)) { $this->extraQuery = 'dlid=' . $dlid; } $this->updateSiteName = VersionHelper::getFlavourName(); $this->updateSite = VersionHelper::getUpdatesSite(); $minstability = EParameter::getComponentParam(CAUTOTWEETNG, 'minstability'); if ($minstability == self::CONFIG_AUTOUPDATE_BETA) { // Live site $this->updateSite .= '-beta'; } // $this->updateSite = 'http://www.extly.com/update-autotweetng-free-test.xml'; // $this->updateSite = 'http://www.extly.com/update-autotweetng-joocial-test.xml'; }
/** * onManagersEdit. * * @return void */ public function onManagersEdit() { $this->title(VersionHelper::getTitle(JText::_('COM_AUTOTWEET_TITLE_MANAGERS_EDIT')), 'autotweet-logo.png'); // Set toolbar icons JToolBarHelper::apply(); JToolBarHelper::save(); JToolBarHelper::cancel(); }
/** * queueMessage * * @param string $articleid Param * @param string $source_plugin Param * @param string $publish_up Param * @param string $description Param * @param string $typeinfo Param * @param string $url Param * @param string $image_url Param * @param object &$native_object Param * @param string &$advanced_attrs Param * @param string &$params Param * @param string $content_language Param * * @return mixed - false, or id of request */ public static function insertRequest($articleid, $source_plugin, $publish_up, $description, $typeinfo = 0, $url = '', $image_url = '', &$native_object = null, &$advanced_attrs = null, &$params = null, $content_language = null) { $logger = AutotweetLogger::getInstance(); // Check if message is already queued (it makes no sense to queue message more than once when modfied) // if message is already queued, correct the publish date $requestsModel = F0FModel::getTmpInstance('Requests', 'AutoTweetModel'); $requestsModel->set('ref_id', $articleid); $requestsModel->set('plugin', $source_plugin); $requestsModel->set('typeinfo', $typeinfo); $row = $requestsModel->getFirstItem(); $id = $row->id; // Avoid databse warnings when desc is longer then expected if (!empty($description)) { $description = TextUtil::cleanText($description); $description = JString::substr($description, 0, SharingHelper::MAX_CHARS_TITLE); } $routeHelp = RouteHelp::getInstance(); if ($content_language) { $routeHelp->setContentLanguage($content_language); } if (AUTOTWEETNG_JOOCIAL && EParameter::getComponentParam(CAUTOTWEETNG, 'paywall_mode') && EParameter::getComponentParam(CAUTOTWEETNG, 'paywall_donot_post_url')) { $url = 'index.php'; } $url = $routeHelp->getAbsoluteUrl($url); if (AUTOTWEETNG_JOOCIAL && EParameter::getComponentParam(CAUTOTWEETNG, 'paywall_mode') && EParameter::getComponentParam(CAUTOTWEETNG, 'paywall_donot_image_url')) { $image_url = null; } if (empty($image_url)) { // Default image: used in media mode when no image is available $image_url = EParameter::getComponentParam(CAUTOTWEETNG, 'default_image', ''); } if (!empty($image_url)) { $image_url = $routeHelp->getAbsoluteUrl($image_url, true); } $row->reset(); if ($id) { $row->load($id); } // If there's no date, it means now if (empty($publish_up)) { $publish_up = JFactory::getDate()->toSql(); } $request = array('id' => $id, 'ref_id' => $articleid, 'plugin' => $source_plugin, 'publish_up' => $publish_up, 'description' => $description, 'typeinfo' => $typeinfo, 'url' => $url, 'image_url' => $image_url, 'native_object' => $native_object, 'params' => $params, 'published' => 0); $logger->log(JLog::INFO, 'Enqueued request', $request); // Saving the request $queued = $row->save($request); if (!$queued) { $logger->log(JLog::ERROR, 'queueMessage: error storing message to database message queue, article id = ' . $articleid . ', error message = ' . $row->getError()); } else { $logger->log(JLog::INFO, 'queueMessage: message stored/updated to database message queue, article id = ' . $articleid); } if (!$id) { $id = $row->id; } if ($advanced_attrs && isset($advanced_attrs->attr_id)) { $row = F0FModel::getTmpInstance('Advancedattrs', 'AutoTweetModel')->getTable(); $row->reset(); $row->load($advanced_attrs->attr_id); $attr = array('id' => $advanced_attrs->attr_id, 'request_id' => $id); // Updating attr $result = $row->save($attr); if (!$result) { $logger->log(JLog::ERROR, 'Updating attr, attr_id = ' . $advanced_attrs->attr_id . ', error message = ' . $row->getError()); } else { $logger->log(JLog::INFO, 'Updating attr, attr_id = ' . $advanced_attrs->attr_id); } } $app = JFactory::getApplication(); if ($app->isAdmin() && JFactory::getConfig()->get('show_req_notification', true)) { $msg = VersionHelper::getFlavourName() . ': ' . JText::sprintf('COM_AUTOTWEET_REQUEST_ENQUEUED_MSG', $id); $app->enqueueMessage($msg); } return $queued ? $id : false; }
/** * addItemeditorHelperApp * * @return string */ public static function addItemeditorHelperApp() { static $link = false; if ($link) { return $link; } $doc = JFactory::getDocument(); $app = JFactory::getApplication(); list($isAdmin, $option, $controller, $task, $view, $layout, $id) = AutotweetBaseHelper::getControllerParams(); $js = "var autotweetUrlRoot = '" . JUri::root() . "';\n"; $js .= "var autotweetUrlBase = '" . JUri::base() . "';\n"; $mediaPath = 'media/com_autotweet/js/itemeditor/templates/'; $ext = '.txt'; $joomlaPart = '.j' . (EXTLY_J3 ? '3' : '25'); $sitePart = $isAdmin ? '.admin' : '.site'; $tpl0 = $mediaPath . $option . $ext; $tpl1 = $mediaPath . $option . $joomlaPart . $ext; $tpl2 = $mediaPath . $option . $sitePart . $joomlaPart . $ext; $tpl3 = $mediaPath . $option . $sitePart . $ext; if (file_exists(JPATH_ROOT . '/' . $tpl2)) { $tpl = $tpl2; } elseif (file_exists(JPATH_ROOT . '/' . $tpl1)) { $tpl = $tpl1; } elseif (file_exists(JPATH_ROOT . '/' . $tpl3)) { $tpl = $tpl3; } elseif (file_exists(JPATH_ROOT . '/' . $tpl0)) { $tpl = $tpl0; } else { $tpl = $mediaPath . 'com_joocial-default' . $joomlaPart . $ext; } $tpl = JUri::root() . $tpl . '?version=' . CAUTOTWEETNG_VERSION; $js .= "var autotweetPanelTemplate = 'text!" . $tpl . "';\n"; $doc->addScriptDeclaration($js); $link = 'index.php?option=com_autotweet&view=itemeditor&layout=modal&tmpl=component&' . JSession::getFormToken() . '=1'; // Add Advanced Attributes $params = null; // Case Request edit page if ($option == CAUTOTWEETNG && $view == 'request' && $task == 'edit') { $params = AdvancedattrsHelper::getAdvancedAttrByReq($id); } elseif ($id > 0) { $params = AdvancedattrsHelper::getAdvancedAttrs($option, $id); } if (!$params) { $params = new StdClass(); $params->description = ''; $params->hashtags = ''; $params->fulltext = ''; $params->postthis = EParameter::getComponentParam(CAUTOTWEETNG, 'joocial_postthis', PlgAutotweetBase::POSTTHIS_DEFAULT); $params->evergreen = PlgAutotweetBase::POSTTHIS_NO; $params->agenda = array(); $params->unix_mhdmd = ''; $params->repeat_until = ''; $params->image = ''; $params->image_url = ''; $params->channels = ''; $params->channels_text = ''; } // Migrating old objects if (!isset($params->description)) { $params->description = ''; } // Migrating old objects if (!isset($params->hashtags)) { $params->hashtags = ''; } // Migrating old objects if (!isset($params->fulltext)) { $params->fulltext = ''; } // Migrating old objects if (!isset($params->image_url)) { $params->image_url = ''; } $params->editorTitle = VersionHelper::getFlavourName() . ' ' . JText::_('COM_AUTOTWEET_VIEW_ITEMEDITOR_TITLE'); $params->postthisLabel = JText::_('COM_AUTOTWEET_VIEW_ITEMEDITOR_POSTTHIS'); $params->evergreenLabel = JText::_('COM_AUTOTWEET_VIEW_ITEMEDITOR_EVERGREEN'); $params->agendaLabel = JText::_('COM_AUTOTWEET_VIEW_ITEMEDITOR_SCHEDULER'); $params->unix_mhdmdLabel = JText::_('COM_XTCRONJOB_TASKS_FIELD_UNIX_MHDMD'); $params->repeat_untilLabel = JText::_('COM_AUTOTWEET_VIEW_ITEMEDITOR_REPEAT_UNTIL'); $params->imageLabel = JText::_('COM_AUTOTWEET_VIEW_ITEMEDITOR_IMAGES'); $params->channelLabel = JText::_('COM_AUTOTWEET_VIEW_ITEMEDITOR_CHANNELS'); $params->postthisDefaultLabel = '<i class="xticon xticon-circle-o"></i> ' . JText::_('COM_AUTOTWEET_DEFAULT_LABEL'); $params->postthisYesLabel = '<i class="xticon xticon-check"></i> ' . JText::_('JYES'); $params->postthisNoLabel = '<i class="xticon xticon-times"></i> ' . JText::_('JNO'); $params->descriptionLabel = JText::_('COM_AUTOTWEET_VIEW_ITEMEDITOR_MSG'); $params->hashtagsLabel = JText::_('COM_AUTOTWEET_VIEW_ITEMEDITOR_HASHTAGS'); $params->fulltextLabel = JText::_('COM_AUTOTWEET_VIEW_ITEMEDITOR_FULLTEXT_DESC'); if (!isset($params->channels_text)) { $params->channels_text = ''; } AutotweetBaseHelper::convertUTCLocalAgenda($params->agenda); $js = 'var autotweetAdvancedAttrs = ' . json_encode($params) . ";\n"; $doc->addScriptDeclaration($js); $file = EHtml::getRelativeFile('js', 'com_autotweet/itemeditor.helper.min.js'); if ($file) { $paths = array(); $paths = array('text' => Extly::JS_LIB . 'require/text.min'); $deps = array('itemeditor.helper' => array('text', 'underscore')); Extly::getScriptManager(false); Extly::initApp(CAUTOTWEETNG_VERSION, $file, $deps, $paths); } return $link; }
?> <a href="http://support.extly.com" target="_blank">http://support.extly.com</a> </p> <p> <i class="xticon xticon-desktop"></i> Tutorials: <a href="http://www.extly.com/docs/autotweetng_joocial/index.html#tutorials" target="_blank"> How to AutoTweet from Joomla in 5 minutes</a> </p> <p> <i class="xticon xticon-info"></i> For more information: <a href="http://www.extly.com/docs/autotweetng_joocial/index.html" target="_blank"><?php echo VersionHelper::getFlavourName(); ?> Documentation</a> </p> <p> <i class="xticon xticon-group"></i> <?php echo JText::sprintf('COM_AUTOTWEET_VIEW_ABOUT_SUPPORT_JEDREVIEW', '<a href="' . JED_ID . '" target="_blank">Joomla! Extensions Directory: '); echo '</a>.'; ?> </p> <ul class="footer-links"> <li><a href="http://www.extly.com/blog.html" target="_blank">Read the Extly.com blog</a></li> <li><a href="http://support.extly.com" target="_blank">Submit
<?php } ?> <div class="row"> <div class="col-sm-12"> <?php if ($this->latestVersion == 'no_curl') { ?> <span class="btn btn-danger btn-mini"> <i class="glyphicon glyphicon-remove icon-white tip"></i> </span> <?php echo JText::_('COBALT_CURL_NOT_INSTALLED'); ?> <?php } elseif (VersionHelper::isUpToDate($this->installedVersion, $this->latestVersion)) { ?> <span class="btn btn-success btn-mini"> <i class="glyphicon glyphicon-ok icon-white"></i> </span> <?php echo JText::sprintf('COBALT_UP_TO_DATE', $this->installedVersion); ?> <?php } else { ?> <span class="btn btn-danger btn-mini"> <i class="glyphicon glyphicon-remove icon-white"></i> </span> <?php echo JText::sprintf('COBALT_UPDATE', $this->installedVersion, $this->latestVersion);