Example #1
0
 public static function getLink($type = 'ajax', $object_id = 0, $object_group = '', $lang = '')
 {
     global $iso_client_lang;
     $app = JCommentsFactory::getApplication();
     $config = JCommentsFactory::getConfig();
     switch ($type) {
         case 'rss':
             if (JCOMMENTS_JVERSION == '1.0') {
                 return $app->getCfg('live_site') . '/index2.php?option=com_jcomments&task=rss&object_id=' . $object_id . '&object_group=' . $object_group . '&no_html=1';
             } else {
                 $link = 'index.php?option=com_jcomments&task=rss&object_id=' . $object_id . '&object_group=' . $object_group . '&format=raw';
                 if ($app->isAdmin()) {
                     $link = JURI::root(true) . '/' . $link;
                 } else {
                     $link = JRoute::_($link);
                 }
                 return $link;
             }
             break;
         case 'noavatar':
             return $app->getCfg('live_site') . '/components/com_jcomments/images/no_avatar.png';
             break;
         case 'smiles':
             $smilesPath = str_replace(DS, '/', $config->get('smiles_path', '/components/com_jcomments/images/smiles/'));
             $smilesPath = $smilesPath[strlen($smilesPath) - 1] == '/' ? substr($smilesPath, 0, strlen($smilesPath) - 1) : $smilesPath;
             return $app->getCfg('live_site') . $smilesPath;
             // '/components/com_jcomments/images/smiles';
             break;
         case 'captcha':
             mt_srand((double) microtime() * 1000000);
             $random = mt_rand(10000, 99999);
             if (JCOMMENTS_JVERSION == '1.0') {
                 return $app->getCfg('live_site') . '/index2.php?option=com_jcomments&task=captcha&no_html=1&ac=' . $random;
             } else {
                 if (JCOMMENTS_JVERSION == '1.7') {
                     return JRoute::_('index.php?option=com_jcomments&task=captcha&format=raw&ac=' . $random);
                 } else {
                     return JURI::root(true) . '/index.php?option=com_jcomments&task=captcha&tmpl=component&ac=' . $random;
                 }
             }
             break;
         case 'ajax':
             $config = JCommentsFactory::getConfig();
             // support alternate language files
             $lsfx = $config->get('lsfx') != '' ? '&lsfx=' . $config->get('lsfx') : '';
             // support additional param for multilingual sites
             if (!empty($lang)) {
                 $lang = '&lang=' . $lang;
             } else {
                 $lang = $app->getCfg('multilingual_support') == 1 ? '&lang=' . $iso_client_lang : '';
             }
             if (JCOMMENTS_JVERSION == '1.0') {
                 $_Itemid = '&Itemid=' . (!empty($_REQUEST['Itemid']) ? $_REQUEST['Itemid'] : 1);
                 $link = $app->getCfg('live_site') . '/index2.php?option=com_jcomments&no_html=1' . $lang . $lsfx . $_Itemid;
             } else {
                 if (JCOMMENTS_JVERSION == '1.5') {
                     $link = JURI::root(true) . '/index.php?option=com_jcomments&tmpl=component' . $lang . $lsfx;
                 } else {
                     $link = JRoute::_('index.php?option=com_jcomments&tmpl=component' . $lang . $lsfx);
                 }
             }
             return JCommentsSecurity::fixAJAX($link);
             break;
         case 'ajax-backend':
             if (JCOMMENTS_JVERSION == '1.0') {
                 $link = $app->getCfg('live_site') . '/administrator/index3.php?option=com_jcomments&no_html=1';
             } else {
                 $link = $app->getCfg('live_site') . '/administrator/index.php?option=com_jcomments&tmpl=component&' . JCommentsSecurity::getToken() . '=1';
             }
             return JCommentsSecurity::fixAJAX($link);
             break;
         default:
             return '';
             break;
     }
 }
Example #2
0
 function getLink($type = 'ajax', $object_id = 0, $object_group = '')
 {
     global $mainframe, $iso_client_lang;
     switch ($type) {
         case 'rss':
             if (JCOMMENTS_JVERSION == '1.5') {
                 $link = 'index.php?option=com_jcomments&task=rss&object_id=' . $object_id . '&object_group=' . $object_group . '&format=raw';
                 if ($mainframe->isAdmin()) {
                     $link = JURI::root(true) . '/' . $link;
                 } else {
                     $link = JRoute::_($link);
                 }
                 return $link;
             }
             return $mainframe->getCfg('live_site') . '/index2.php?option=com_jcomments&task=rss&object_id=' . $object_id . '&object_group=' . $object_group . '&no_html=1';
             break;
         case 'noavatar':
             return $mainframe->getCfg('live_site') . '/components/com_jcomments/images/no_avatar.png';
             break;
         case 'smiles':
             return $mainframe->getCfg('live_site') . '/components/com_jcomments/images/smiles';
             break;
         case 'captcha':
             mt_srand((double) microtime() * 1000000);
             $random = mt_rand(10000, 99999);
             if (JCOMMENTS_JVERSION == '1.5') {
                 return JURI::root(true) . '/index.php?option=com_jcomments&task=captcha&tmpl=component&ac=' . $random;
             }
             return $mainframe->getCfg('live_site') . '/index2.php?option=com_jcomments&task=captcha&no_html=1&ac=' . $random;
             break;
         case 'ajax':
             $config =& JCommentsFactory::getConfig();
             // support alternate language files
             $lsfx = $config->get('lsfx') != '' ? '&lsfx=' . $config->get('lsfx') : '';
             // support additional param for multilingual sites
             $lang = $mainframe->getCfg('multilingual_support') == 1 ? '&lang=' . $iso_client_lang : '';
             if (JCOMMENTS_JVERSION == '1.5') {
                 $link = JURI::root(true) . '/index.php?option=com_jcomments&tmpl=component' . $lang . $lsfx;
             } else {
                 $_Itemid = '&Itemid=' . (!empty($_REQUEST['Itemid']) ? $_REQUEST['Itemid'] : 1);
                 $link = $mainframe->getCfg('live_site') . '/index2.php?option=com_jcomments&no_html=1' . $lang . $lsfx . $_Itemid;
             }
             return JCommentsSecurity::fixAJAX($link);
             break;
         case 'ajax-backend':
             if (JCOMMENTS_JVERSION == '1.5') {
                 $link = $mainframe->getCfg('live_site') . '/administrator/index.php?option=com_jcomments&tmpl=component';
             } else {
                 $link = $mainframe->getCfg('live_site') . '/administrator/index3.php?option=com_jcomments&no_html=1';
             }
             return JCommentsSecurity::fixAJAX($link);
             break;
         default:
             return '';
             break;
     }
 }