Example #1
0
 function display($tpl = null)
 {
     // No error reporting
     if (!LinkrHelper::debug()) {
         error_reporting(0);
         ini_set('display_errors', 0);
     }
     // Frontpage hack
     $this->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'views' . DS . 'request' . DS . 'tmpl');
     // JSON wrapper
     if (!function_exists('json_encode')) {
         $this->addHelperPath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers');
         // Services_JSON class
         if (!class_exists('Services_JSON')) {
             $this->loadHelper('json');
         }
         // JSON wrapper
         $this->loadHelper('jsonwrapper');
     }
     // Send results
     echo $this->get('Request');
     // Shutdown application
     global $mainframe;
     $mainframe->close();
 }
Example #2
0
 function display($tpl = null)
 {
     // Frontpage hack
     $this->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'views' . DS . 'link' . DS . 'tmpl');
     // Only allow "component" template
     JRequest::setVar('tmpl', 'component');
     // JFactory
     $user =& JFactory::getUser();
     $config =& JFactory::getConfig();
     $doc =& JFactory::getDocument();
     $lingo =& JFactory::getLanguage();
     // Include styles
     $doc->addStyleSheet(LINKR_ASSETS . 'css/modal.css?' . LINKR_VERSION_INC);
     // Template override
     global $mainframe;
     $tmpl = $mainframe->getTemplate();
     if (file_exists(JPATH_BASE . DS . 'templates' . DS . $tmpl . DS . 'linkr.css')) {
         $doc->addStyleSheet(JURI::base() . 'templates/' . $tmpl . '/linkr.css');
     } elseif (file_exists(JPATH_BASE . DS . 'templates' . DS . $tmpl . DS . 'css' . DS . 'linkr.css')) {
         $doc->addStyleSheet(JURI::base() . 'templates/' . $tmpl . '/css/linkr.css');
     }
     // Editor name, request endpoint, document base
     $editor = JRequest::getString('e_name', 'text');
     $rUrl = JURI::base() . 'index.php?option=com_linkr&view=request&' . JUtility::getToken() . '=1';
     // Include scripts
     JHTML::_('behavior.mootools');
     $unc = LinkrHelper::getParam('compress', 1) ? '.js' : '-UCP.js';
     $doc->addScript(LINKR_ASSETS . 'js/helper' . $unc . '?' . LINKR_VERSION_INC);
     $doc->addScriptDeclaration('var Linkr=new LinkrAPI(' . '[' . implode(',', explode('.', LINKR_VERSION_READ)) . '],' . '"' . $rUrl . '",' . '"' . $editor . '",' . '"' . JURI::root() . '",' . '[' . '"' . JRequest::getWord('mode', 'squeezebox') . '",' . '"' . $lingo->getTag() . '",' . '"' . LinkrHelper::UTF8Encode(JText::_('MISSING_TEXT', true)) . '",' . '"' . LinkrHelper::UTF8Encode(JText::_('IMG_ANCHOR', true)) . '",' . '"' . LINKR_ASSETS . 'img/",' . $user->get('aid') . ']' . ');' . 'var LinkrHelper=Linkr;');
     // Frontend fix
     if (LinkrHelper::isSite()) {
         //$doc->setBase(LinkrHelper::getLinkrUrl($editor));
     }
     // References
     $this->assign('links', $this->get('Links'));
     $this->assign('tools', $this->get('ToolLinks'));
     // Localize text
     if ($text = $this->get('L18N')) {
         $l18n = array();
         foreach ($text as $k => $v) {
             $l18n[] = '["' . $k . '","' . $v . '"]';
         }
         $doc->addScriptDeclaration('Linkr.setL18N([' . implode(',', $l18n) . ']);');
     }
     // 3rd party javascript
     if ($js = $this->get('Scripts')) {
         $doc->addScriptDeclaration($js);
     }
     // Load single link
     $load = '';
     $inc = $this->get('IncludedLinks');
     if (!$this->tools['count'] && $this->links['count'] == 1) {
         $load = 'Linkr.__fr=function(){' . $inc[$this->links['name'][0]] . '};';
     } elseif (!$this->links['count'] && $this->tools['count'] == 1) {
         $load = 'Linkr.__fr=function(){' . $inc[$this->tools['name'][0]] . '};';
     }
     // Fire "onLoad" event
     $doc->addScriptDeclaration('window.addEvent("domready",function(){' . $load . 'Linkr.fireEvent("onLoad");' . '});');
     parent::display($tpl);
 }
Example #3
0
 function loadScripts()
 {
     $d =& JFactory::getDocument();
     // CSS styles
     $d->addStyleDeclaration('#fileList{' . 'width:670px;' . 'height:220px;' . 'overflow:auto;' . 'clear:both;' . '}' . '#fileList div.item{' . 'float:left;' . 'width:70px;' . 'border:1px solid #fff;' . 'background-color:#fff;' . 'text-align:center;' . '}' . '#fileList div.item div.name{' . 'height:15px;' . '}' . '#fileList div.item div.icon div.border{' . 'margin-top:10px;' . 'height:45px;' . 'width:68px;' . 'vertical-align:middle;' . 'overflow:hidden;' . '}' . '#fileList div.item div.icon div.border a{' . 'height:45px;' . 'width:68px;' . 'display:block;' . '}' . '#fileList div.item:hover{' . 'border:1px solid #0B55C4;' . 'background-color:#d2d7e0;' . 'cursor:pointer;' . '}');
     // Javascript
     if (LinkrHelper::getMediaParam('enable_flash', 1)) {
         JHTML::_('behavior.uploader', 'file-upload', array('targetURL' => $this->form->uploadURL, 'types' => '{\'Pictures (*.bmp, *.gif, *.jpg, *.jpeg, *.png)\':\'*.bmp;*.gif;*.jpg;*.jpeg;*.png\'}', 'onAllComplete' => 'function(){ window.location.reload(true); }'));
     }
     $d->addScriptDeclaration('var selectIcon	= function(u, f)' . '{' . 'if (document.uploadForm.deli.checked == true) {' . 'if (confirm("' . JText::_('VALIDDELETEITEMS', true) . '")) {' . 'window.location.href = "' . $this->form->deleteURL . '"+ f;' . '}' . '} else {' . 'window.parent.document.adminForm.icon.value=u;' . 'window.parent.document.getElementById("sbox-window").close();' . '}' . '}');
 }
Example #4
0
 function display($tpl = null)
 {
     // Toolbar
     JToolBarHelper::save();
     JToolBarHelper::apply();
     JToolBarHelper::cancel();
     JToolBarHelper::title(JText::_('CONFIGURATION'), 'config');
     // Document
     JHTML::_('behavior.tooltip');
     JHTML::_('behavior.keepalive');
     $this->setTitle(JText::_('CONFIGURATION'));
     // References
     $this->assignRef('params', $this->get('Params'));
     // ToDo: finish moving plugin parameters to backend
     $this->assignRef('plgParams', LinkrHelper::getPluginParameters());
     // Slider pane
     jimport('joomla.html.pane');
     $pane =& JPane::getInstance('sliders');
     $this->assignRef('pane', $pane);
     parent::display($tpl);
 }
Example #5
0
 function log($msg)
 {
     if (empty($msg) || !LinkrHelper::debug()) {
         return;
     }
     static $log;
     if (is_null($log)) {
         $o = array('format' => '{DATE} {TIME} ({C-IP}), {COMMENT}');
         jimport('joomla.error.log');
         $log =& JLog::getInstance('linkr.php', $o);
     }
     $log->addEntry(array('comment' => $msg));
 }
Example #6
0
 /**
  * Returns HTML code for related articles settings
  *
  * @param array $s	Predefined settings i.e. {linkr:related; ...}
  * @return	string	HTML code for configuring related articles
  */
 function getRelatedConfig($s = array())
 {
     $p = LinkrHelper::getPluginParameters();
     $limit = !empty($s['limit']) ? $s['limit'] : JRequest::getInt('limit', $p->get('rel_limit', 5));
     $title = !empty($s['title']) ? $s['title'] : JString::trim(JRequest::getString('title', $p->get('rel_title', JText::_('Related Articles'))));
     return '<label for="title">' . JText::_('Title') . '</label>' . sp . '<input type="text"name="title"id="title"value="' . $title . '"/><br/><br/>' . '<label for="limit">' . JText::_('RL_CONFIG_LIMIT') . '</label>' . sp . '<input type="text"name="limit"id="limit"value="' . $limit . '"/>';
 }
Example #7
0
?>
</a>
	&nbsp;|&nbsp;
	<a href="index.php?option=com_linkr&view=docs&about=related#goto"><?php 
echo JText::_('RELATED_ARTICLES');
?>
</a>
	&nbsp;|&nbsp;
	<a href="index.php?option=com_linkr&view=docs&about=faqs#goto"><?php 
echo JText::_('FAQs');
?>
</a>
	&nbsp;|&nbsp;
<?php 
// Debug
if (LinkrHelper::getParam('debug', 0)) {
    ?>
	<a style="color:#990000;" href="index.php?option=com_linkr&view=docs&about=debug#goto"><?php 
    echo JText::_('PARAM_DEBUG');
    ?>
</a>
	&nbsp;|&nbsp;
<?php 
}
?>
	<a href="http://extensions.joomla.org/extensions/4010/details" target="_blank">JED &#187;</a>
	<!-- http://extensions.joomla.org/index.php?option=com_mtree&task=viewlink&link_id=4010 -->
</div>

<?php 
echo $this->loadTemplate($this->about);
Example #8
0
 function getFiles()
 {
     $b = $this->getBasePath();
     $e = '\\.(bmp|gif|jpg|jpeg|png)';
     return LinkrHelper::listFiles($b, $e);
 }
Example #9
0
 function onLinkrLoadJS($version, $inc = array())
 {
     // File append
     $append = $this->cp('compress', 1) ? '.js' : '-UCP.js';
     $append .= '?' . LINKR_VERSION_INC;
     // Initialize variables
     $js = '';
     $d =& JFactory::getDocument();
     $r = JURI::root() . 'components/com_linkr/assets/js/';
     // Base files
     $d->addScript($r . 'tree' . $append);
     $d->addScript($r . 'object' . $append);
     $js .= 'LinkrObject.options.defaultItemid=' . LinkrHelper::getParam('itemid', 0) . ';';
     // Plugin check
     // ToDo: use some other check
     $p = LinkrHelper::getPluginParam() ? 'true' : 'false';
     // Bookmarks
     if ($inc['bookmarks']) {
         $d->addScript($r . 'bookmarks' . $append);
         $bm = $this->cp('def_bm', 0) ? 'true' : 'false';
         $js .= 'LinkrBookmarks.loadedByDefault=' . $bm . ';' . 'LinkrBookmarks.isPluginInstalled=' . $p . ';';
     }
     // Related articles
     if ($inc['related']) {
         $d->addScript($r . 'related' . $append);
         $rl = $this->cp('def_rel', 0) ? 'true' : 'false';
         $js .= 'LinkrRelated.loadedByDefault=' . $rl . ';' . 'LinkrRelated.isPluginInstalled=' . $p . ';';
     }
     // Files
     if ($this->cp('link_file', 1) && $inc['file']) {
         $d->addScript($r . 'file' . $append);
         $u = (bool) $this->cp('frontend_upload', 0);
         $u = $u ? true : !LinkrHelper::isSite();
         $u = $u ? JURI::base() . 'index.php?option=com_linkr&controller=file&task=upload&e_name=' . JRequest::getString('e_name', 'text') . '&' . JUtility::getToken() . '=1' : false;
         // Upload
         $js .= 'LinkrFile.uploadURL=' . ($u ? '"' . $u . '"' : 'false') . ';';
         // Message
         if ($msg = JRequest::getString('msg', null)) {
             $js .= 'LinkrFile.msg="' . LinkrHelper::UTF8Encode($msg) . '";';
         }
         // Paths
         global $mainframe;
         $path = JRequest::getString('path', '', 'REQUEST');
         if (strlen($path)) {
             $mainframe->setUserState('linkr.path', $path);
         } else {
             $mainframe->setUserState('linkr.path', null);
         }
         // Simple list
         $simple = JRequest::getInt('simplelist', -1, 'REQUEST');
         if ($simple != -1) {
             $mainframe->setUserState('linkr.simplelist', $simple);
         } else {
             $mainframe->setUserState('linkr.simplelist', null);
         }
     }
     // Articles
     if ($this->cp('link_article', 1) && $inc['article']) {
         $d->addScript($r . 'article' . $append);
         $s = (bool) $this->cp('use_slug', 1);
         $js .= 'ArtOpts.slug=' . ($s ? 'true' : 'false') . ';' . 'var LinkrArticle=LinkrObject.getInstance(ArtOpts, ArtSrch, ArtLay, ArtTmpl);';
     }
     // Menu links
     if ($this->cp('link_menu', 1) && $inc['menu']) {
         $d->addScript($r . 'menu' . $append);
         // Get menus
         $db =& JFactory::getDBO();
         $db->setQuery('SELECT * FROM #__menu_types');
         $ml = (array) $db->loadObjectList();
         foreach ($ml as $m) {
             $ti = LinkrHelper::UTF8Encode($m->title);
             $de = LinkrHelper::UTF8Encode($m->description);
             $js .= 'MITree.include({' . 'id:"' . $m->menutype . '",' . 'name:"' . urlencode($ti) . '",' . 'description:"' . urlencode($de) . '"' . '});';
         }
         $js .= 'var LinkrMenu=LinkrTree.getInstance(MIOpts,MITree,MISrch,MITmpl);';
     }
     // Contacts
     if ($this->cp('link_contact', 1) && $inc['contact']) {
         $d->addScript($r . 'contact' . $append);
         $js .= 'var LinkrContact = LinkrObject.getInstance(ConOpts,ConSrch,ConLay,ConTmpl);';
     }
     // Automatic links
     /*if ($inc['auto'])
     		{
     			$d->addScript($r .'auto'. $append);
     			
     			// Get extensions
     			$db	= & JFactory::getDBO();
     			$db->setQuery(
     				'SELECT c.id, c.name, c.option '.
     				'FROM #__components AS c '.
     				'WHERE c.link <> "" AND c.parent = 0 '.
     				'AND c.enabled = 1');
     			$ex	= (array) $db->loadObjectList();
     			foreach ($ex as $e)
     			{
     				$js	.=
     				'_xr.include({'.
     					'id:'. $e->id .','.
     					'option:"'. $e->option .'",'.
     					'name:"'. urlencode(LinkrHelper::UTF8Encode($e->name)) .'"'.
     				'});';
     			}
     			
     			$js	.= 'var LinkrX=LinkrTree.getInstance(_xo,_xr,_xs,_xt);';
     		}*/
     // Debug
     $user =& JFactory::getUser();
     if ($this->cp('debug', 0) && $user->gid >= 23) {
         $d->addScript($r . 'debug.js?' . LINKR_VERSION_INC);
     }
     return $js;
 }
Example #10
0
 function end($code, $msg = null)
 {
     LinkrHelper::log("FileController::end {$code} {$msg}");
     // Flash
     if ($this->json) {
         $header = 'HTTP/1.0 ' . $code . ' ' . $msg;
         header($header);
         jexit($msg);
     } else {
         // Redirect
         global $mainframe;
         $redirect = $this->returnURL . '&msg=' . $msg;
         $mainframe->redirect($redirect);
     }
 }
Example #11
0
 function dbobject()
 {
     // Get query
     $q = $this->getQuery('q');
     if (is_array($q)) {
         return $q;
     }
     // Query database
     $r = $this->_getObj($q);
     if ($this->_db->getErrorNum()) {
         return $this->badRequest($this->_db->getErrorMsg());
     } elseif (is_string($r)) {
         return $this->badRequest($r);
     }
     // UTF8 encode values
     $r = LinkrHelper::UTF8Encode($r);
     // Return results
     return array('status' => 'ok', 'result' => $r);
 }
Example #12
0
 function getL18N()
 {
     // Trigger "onLinkrLoadL18N"
     JPluginHelper::importPlugin('content');
     $dispatcher =& JDispatcher::getInstance();
     $results = $dispatcher->trigger('onLinkrLoadL18N', array(LINKR_VERSION, $this->links));
     if (empty($results) || !is_array($results)) {
         return false;
     }
     // Get localized text
     $l18n = array();
     foreach ($results as $strings) {
         // Performance check
         if (empty($strings)) {
             continue;
         }
         // Include localized text (once)
         foreach ($strings as $s) {
             if (!isset($l18n[$s])) {
                 $l18n[$s] = LinkrHelper::UTF8Encode(JText::_($s, true));
             }
         }
     }
     // Return localized text
     return empty($l18n) ? false : $l18n;
 }
Example #13
0
<?php

defined('_JEXEC') or die;
// Check parameters
$p =& LinkrHelper::getPluginParameters();
if (!$p) {
    echo $this->loadTemplate('install');
} else {
    echo $this->loadTemplate('landing');
}
Example #14
0
 function end($code, $msg = null)
 {
     LinkrHelper::log("FileController::end {$code} {$msg}");
     // Flash
     if ($this->json) {
         $header = 'HTTP/1.0 ' . $code . ' ' . $msg;
         header($header);
         jexit($msg);
     } else {
         // Redirect
         global $mainframe;
         $rdir = JURI::getInstance($this->returnURL);
         $rdir->setVar('msg', $msg);
         $mainframe->redirect($rdir->toString());
     }
 }