Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
PK Y[]S ! editors/codemirror/codemirror.xmlnu W+A
plg_editors_codemirror3.1528 March 2011Marijn HaverbekeN/APLG_CODEMIRROR_XML_DESCRIPTIONcodemirror.phpindex.htmlen-GB.plg_editors_codemirror.inien-GB.plg_editors_codemirror.sys.ini
PK Y[V editors/codemirror/index.htmlnu W+A
PK Y[NJ( ( ! editors/codemirror/codemirror.phpnu W+A _basePath . 'js/codemirror.js', false, false, false, false);
JHtml::_('script', $this->_basePath . 'js/fullscreen.js', false, false, false, false);
JHtml::_('stylesheet', $this->_basePath . 'css/codemirror.css');
JHtml::_('stylesheet', $this->_basePath . 'css/configuration.css');
return '';
}
/**
* Copy editor content to form field.
*
* @param string $id The id of the editor field.
*
* @return string Javascript
*/
public function onSave($id)
{
return "document.getElementById('$id').value = Joomla.editors.instances['$id'].getValue();\n";
}
/**
* Get the editor content.
*
* @param string $id The id of the editor field.
*
* @return string Javascript
*/
public function onGetContent($id)
{
return "Joomla.editors.instances['$id'].getValue();\n";
}
/**
* Set the editor content.
*
* @param string $id The id of the editor field.
* @param string $content The content to set.
*
* @return string Javascript
*/
public function onSetContent($id, $content)
{
return "Joomla.editors.instances['$id'].setValue($content);\n";
}
/**
* Adds the editor specific insert method.
*
* @return boolean
*/
public function onGetInsertMethod()
{
static $done = false;
// Do this only once.
if (!$done)
{
$done = true;
$doc = JFactory::getDocument();
$js = "\tfunction jInsertEditorText(text, editor)
{
Joomla.editors.instances[editor].replaceSelection(text);\n
}";
$doc->addScriptDeclaration($js);
}
return true;
}
/**
* Display the editor area.
*
* @param string $name The control name.
* @param string $content The contents of the text area.
* @param string $width The width of the text area (px or %).
* @param string $height The height of the text area (px or %).
* @param integer $col The number of columns for the textarea.
* @param integer $row The number of rows for the textarea.
* @param boolean $buttons True and the editor buttons will be displayed.
* @param string $id An optional ID for the textarea (note: since 1.6). If not supplied the name is used.
* @param string $asset Unused
* @param object $author Unused
* @param array $params Associative array of editor parameters.
*
* @return string HTML Output
*/
public function onDisplay($name, $content, $width, $height, $col, $row, $buttons = true, $id = null, $asset = null, $author = null, $params = array())
{
if (empty($id))
{
$id = $name;
}
// Only add "px" to width and height if they are not given as a percentage
if (is_numeric($width))
{
$width .= 'px';
}
if (is_numeric($height))
{
$height .= 'px';
}
// Must pass the field id to the buttons in this editor.
$buttons = $this->_displayButtons($id, $buttons, $asset, $author);
// Look if we need special syntax coloring.
$syntax = $this->params->get('syntax', 'php');
if ($syntax)
{
switch ($syntax)
{
case 'css':
$parserFile = array('css.js', 'closebrackets.js');
$mode = 'text/css';
$autoCloseBrackets = true;
$autoCloseTags = false;
$fold = true;
$matchTags = false;
$matchBrackets = true;
JHtml::_('script', $this->_basePath . 'js/brace-fold.js', false, false, false, false);
break;
case 'ini':
$parserFile = array('css.js');
$mode = 'text/css';
$autoCloseBrackets = false;
$autoCloseTags = false;
$fold = false;
$matchTags = false;
$matchBrackets = false;
break;
case 'xml':
$parserFile = array('xml.js', 'closetag.js');
$mode = 'application/xml';
$fold = true;
$autoCloseBrackets = false;
$autoCloseTags = true;
$matchTags = true;
$matchBrackets = false;
JHtml::_('script', $this->_basePath . 'js/xml-fold.js', false, false, false, false);
break;
case 'js':
$parserFile = array('javascript.js', 'closebrackets.js');
$mode = 'text/javascript';
$autoCloseBrackets = true;
$autoCloseTags = false;
$fold = true;
$matchTags = false;
$matchBrackets = true;
JHtml::_('script', $this->_basePath . 'js/brace-fold.js', false, false, false, false);
break;
case 'less':
$parserFile = array('less.js', 'css.js', 'closebrackets.js');
$mode = 'text/x-less';
$autoCloseBrackets = true;
$autoCloseTags = false;
$fold = true;
$matchTags = false;
$matchBrackets = true;
JHtml::_('script', $this->_basePath . 'js/brace-fold.js', false, false, false, false);
break;
case 'php':
$parserFile = array('xml.js', 'clike.js', 'css.js', 'javascript.js', 'htmlmixed.js', 'php.js', 'closebrackets.js', 'closetag.js');
$mode = 'application/x-httpd-php';
$autoCloseBrackets = true;
$autoCloseTags = true;
$fold = true;
$matchTags = true;
$matchBrackets = true;
JHtml::_('script', $this->_basePath . 'js/brace-fold.js', false, false, false, false);
JHtml::_('script', $this->_basePath . 'js/xml-fold.js', false, false, false, false);
break;
default:
$parserFile = false;
$mode = 'text/plain';
$autoCloseBrackets = false;
$autoCloseTags = false;
$fold = false;
$matchTags = false;
$matchBrackets = false;
break;
}
}
if ($parserFile)
{
foreach ($parserFile as $file)
{
JHtml::_('script', $this->_basePath . 'js/' . $file, false, false, false, false);
}
}
$options = new stdClass;
$options->mode = $mode;
$options->smartIndent = true;
// Enabled the line numbers.
if ($this->params->get('lineNumbers') == "1")
{
$options->lineNumbers = true;
}
if ($this->params->get('autoFocus') == "1")
{
$options->autofocus = true;
}
if ($this->params->get('autoCloseBrackets') == "1")
{
$options->autoCloseBrackets = $autoCloseBrackets;
}
if ($this->params->get('autoCloseTags') == "1")
{
$options->autoCloseTags = $autoCloseTags;
}
if ($this->params->get('matchTags') == "1")
{
$options->matchTags = $matchTags;
JHtml::_('script', $this->_basePath . 'js/matchtags.js', false, false, false, false);
}
if ($this->params->get('matchBrackets') == "1")
{
$options->matchBrackets = $matchBrackets;
JHtml::_('script', $this->_basePath . 'js/matchbrackets.js', false, false, false, false);
}
if ($this->params->get('marker-gutter') == "1")
{
$options->foldGutter = $fold;
$options->gutters = array('CodeMirror-linenumbers', 'CodeMirror-foldgutter', 'breakpoints');
JHtml::_('script', $this->_basePath . 'js/foldcode.js', false, false, false, false);
JHtml::_('script', $this->_basePath . 'js/foldgutter.js', false, false, false, false);
}
if ($this->params->get('theme', '') == 'ambiance')
{
$options->theme = 'ambiance';
JHtml::_('stylesheet', $this->_basePath . 'css/ambiance.css');
}
if ($this->params->get('lineWrapping') == "1")
{
$options->lineWrapping = true;
}
if ($this->params->get('tabmode', '') == 'shift')
{
$options->tabMode = 'shift';
}
$html = array();
$html[] = "";
$html[] = $buttons;
$html[] = '';
return implode("\n", $html);
}
/**
* Displays the editor buttons.
*
* @param string $name The editor name
* @param mixed $buttons [array with button objects | boolean true to display buttons]
* @param string $asset The object asset
* @param object $author The author.
*
* @return string HTML
*/
protected function _displayButtons($name, $buttons, $asset, $author)
{
$return = '';
$args = array(
'name' => $name,
'event' => 'onGetInsertMethod'
);
$results = (array) $this->update($args);
if ($results)
{
foreach ($results as $result)
{
if (is_string($result) && trim($result))
{
$return .= $result;
}
}
}
if (is_array($buttons) || (is_bool($buttons) && $buttons))
{
$buttons = $this->_subject->getButtons($name, $buttons, $asset, $author);
$return .= JLayoutHelper::render('joomla.editors.buttons', $buttons);
}
return $return;
}
}
PK Y[MIj2 2 editors/tinymce/tinymce.xmlnu W+A
plg_editors_tinymce4.0.222005-2013Moxiecode Systems ABN/Atinymce.moxiecode.comMoxiecode Systems ABLGPLPLG_TINY_XML_DESCRIPTIONtinymce.phpindex.htmlen-GB.plg_editors_tinymce.inien-GB.plg_editors_tinymce.sys.ini
PK Y[V editors/tinymce/index.htmlnu W+A
PK Y[ U U editors/tinymce/tinymce.phpnu W+A params->get('mode', 1);
$theme = 'modern';
$skin = $this->params->get('skin', '0');
switch ($skin)
{
case '0':
default:
$skin = 'skin : "lightgray",';
}
$entity_encoding = $this->params->get('entity_encoding', 'raw');
$langMode = $this->params->get('lang_mode', 0);
$langPrefix = $this->params->get('lang_code', 'en');
if ($langMode)
{
if (file_exists(JPATH_ROOT . "/media/editors/tinymce/langs/" . $language->getTag() . ".js"))
{
$langPrefix = $language->getTag();
}
elseif (file_exists(JPATH_ROOT . "/media/editors/tinymce/langs/" . substr($language->getTag(), 0, strpos($language->getTag(), '-')) . ".js"))
{
$langPrefix = substr($language->getTag(), 0, strpos($language->getTag(), '-'));
}
else
{
$langPrefix = "en";
}
}
$text_direction = 'ltr';
if ($language->isRTL())
{
$text_direction = 'rtl';
}
$use_content_css = $this->params->get('content_css', 1);
$content_css_custom = $this->params->get('content_css_custom', '');
/*
* Lets get the default template for the site application
*/
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('template')
->from('#__template_styles')
->where('client_id=0 AND home=' . $db->quote('1'));
$db->setQuery($query);
$template = $db->loadResult();
$content_css = '';
$templates_path = JPATH_SITE . '/templates';
// Loading of css file for 'styles' dropdown
if ( $content_css_custom )
{
// If URL, just pass it to $content_css
if (strpos($content_css_custom, 'http') !== false)
{
$content_css = 'content_css : "' . $content_css_custom . '",';
}
// If it is not a URL, assume it is a file name in the current template folder
else
{
$content_css = 'content_css : "' . JUri::root() . 'templates/' . $template . '/css/' . $content_css_custom . '",';
// Issue warning notice if the file is not found (but pass name to $content_css anyway to avoid TinyMCE error
if (!file_exists($templates_path . '/' . $template . '/css/' . $content_css_custom))
{
$msg = sprintf(JText::_('PLG_TINY_ERR_CUSTOMCSSFILENOTPRESENT'), $content_css_custom);
JLog::add($msg, JLog::WARNING, 'jerror');
}
}
}
else
{
// Process when use_content_css is Yes and no custom file given
if ($use_content_css)
{
// First check templates folder for default template
// if no editor.css file in templates folder, check system template folder
if (!file_exists($templates_path . '/' . $template . '/css/editor.css'))
{
// If no editor.css file in system folder, show alert
if (!file_exists($templates_path . '/system/css/editor.css'))
{
JLog::add(JText::_('PLG_TINY_ERR_EDITORCSSFILENOTPRESENT'), JLog::WARNING, 'jerror');
}
else
{
$content_css = 'content_css : "' . JUri::root() . 'templates/system/css/editor.css",';
}
}
else
{
$content_css = 'content_css : "' . JUri::root() . 'templates/' . $template . '/css/editor.css",';
}
}
}
$relative_urls = $this->params->get('relative_urls', '1');
if ($relative_urls)
{
// Relative
$relative_urls = "true";
}
else
{
// Absolute
$relative_urls = "false";
}
$newlines = $this->params->get('newlines', 0);
if ($newlines)
{
// Break
$forcenewline = "force_br_newlines : true, force_p_newlines : false, forced_root_block : '',";
}
else
{
// Paragraph
$forcenewline = "force_br_newlines : false, force_p_newlines : true, forced_root_block : 'p',";
}
$invalid_elements = $this->params->get('invalid_elements', 'script,applet,iframe');
$extended_elements = $this->params->get('extended_elements', '');
// Advanced Options
$html_height = $this->params->get('html_height', '550');
$html_width = $this->params->get('html_width', '750');
// Image advanced options
$image_advtab = $this->params->get('image_advtab', 1);
if ($image_advtab)
{
$image_advtab = "true";
}
else
{
$image_advtab = "false";
}
// The param is true false, so we turn true to both rather than showing vertical resize only
$resizing = $this->params->get('resizing', '1');
if ($resizing || $resizing == 'true')
{
$resizing = 'resize: "both",';
}
else
{
$resizing = 'resize: false,';
}
$toolbar1_add = array();
$toolbar2_add = array();
$toolbar3_add = array();
$toolbar4_add = array();
$elements = array();
$plugins = array('autolink', 'lists', 'image', 'charmap', 'print', 'preview', 'anchor', 'pagebreak', 'code', 'save', 'textcolor', 'importcss');
$toolbar1_add[] = 'bold';
$toolbar1_add[] = 'italic';
$toolbar1_add[] = 'underline';
$toolbar1_add[] = 'strikethrough';
// Alignment buttons
$alignment = $this->params->get('alignment', 1);
if ($alignment)
{
$toolbar1_add[] = '|';
$toolbar1_add[] = 'alignleft';
$toolbar1_add[] = 'aligncenter';
$toolbar1_add[] = 'alignright';
$toolbar1_add[] = 'alignjustify';
}
$toolbar1_add[] = '|';
$toolbar1_add[] = 'styleselect';
$toolbar1_add[] = '|';
$toolbar1_add[] = 'formatselect';
// Fonts
$fonts = $this->params->get('fonts', 1);
if ($fonts)
{
$toolbar1_add[] = 'fontselect';
$toolbar1_add[] = 'fontsizeselect';
}
// Search & replace
$searchreplace = $this->params->get('searchreplace', 1);
if ($searchreplace)
{
$plugins[] = 'searchreplace';
$toolbar2_add[] = 'searchreplace';
}
$toolbar2_add[] = '|';
$toolbar2_add[] = 'bullist';
$toolbar2_add[] = 'numlist';
$toolbar2_add[] = '|';
$toolbar2_add[] = 'outdent';
$toolbar2_add[] = 'indent';
$toolbar2_add[] = '|';
$toolbar2_add[] = 'undo';
$toolbar2_add[] = 'redo';
$toolbar2_add[] = '|';
// Insert date and/or time plugin
$insertdate = $this->params->get('insertdate', 1);
if ($insertdate)
{
$plugins[] = 'insertdatetime';
$toolbar4_add[] = 'inserttime';
}
// Link plugin
$link = $this->params->get('link', 1);
if ($link)
{
$plugins[] = 'link';
$toolbar2_add[] = 'link';
$toolbar2_add[] = 'unlink';
}
$toolbar2_add[] = 'anchor';
$toolbar2_add[] = 'image';
$toolbar2_add[] = '|';
$toolbar2_add[] = 'code';
// Colours
$colours = $this->params->get('colours', 1);
if ($colours)
{
$toolbar2_add[] = '|';
$toolbar2_add[] = 'forecolor,backcolor';
}
// Fullscreen
$fullscreen = $this->params->get('fullscreen', 1);
if ($fullscreen)
{
$plugins[] = 'fullscreen';
$toolbar2_add[] = '|';
$toolbar2_add[] = 'fullscreen';
}
// Table
$table = $this->params->get('table', 1);
if ($table)
{
$plugins[] = 'table';
$toolbar3_add[] = 'table';
$toolbar3_add[] = '|';
}
$toolbar3_add[] = 'subscript';
$toolbar3_add[] = 'superscript';
$toolbar3_add[] = '|';
$toolbar3_add[] = 'charmap';
// Emotions
$smilies = $this->params->get('smilies', 1);
if ($smilies)
{
$plugins[] = 'emoticons';
$toolbar3_add[] = 'emoticons';
}
// Media plugin
$media = $this->params->get('media', 1);
if ($media)
{
$plugins[] = 'media';
$toolbar3_add[] = 'media';
}
// Horizontal line
$hr = $this->params->get('hr', 1);
if ($hr)
{
$plugins[] = 'hr';
$elements[] = 'hr[id|title|alt|class|width|size|noshade]';
$toolbar3_add[] = 'hr';
}
else
{
$elements[] = 'hr[id|class|title|alt]';
}
// RTL/LTR buttons
$directionality = $this->params->get('directionality', 1);
if ($directionality)
{
$plugins[] = 'directionality';
$toolbar3_add[] = 'ltr rtl';
}
if ($extended_elements != "")
{
$elements = explode(',', $extended_elements);
}
$toolbar4_add[] = 'cut';
$toolbar4_add[] = 'copy';
// Paste
$paste = $this->params->get('paste', 1);
if ($paste)
{
$plugins[] = 'paste';
$toolbar4_add[] = 'paste';
}
$toolbar4_add[] = '|';
// Visualchars
$visualchars = $this->params->get('visualchars', 1);
if ($visualchars)
{
$plugins[] = 'visualchars';
$toolbar4_add[] = 'visualchars';
}
// Visualblocks
$visualblocks = $this->params->get('visualblocks', 1);
if ($visualblocks)
{
$plugins[] = 'visualblocks';
$toolbar4_add[] = 'visualblocks';
}
// Non-breaking
$nonbreaking = $this->params->get('nonbreaking', 1);
if ($nonbreaking)
{
$plugins[] = 'nonbreaking';
$toolbar4_add[] = 'nonbreaking';
}
// Blockquote
$blockquote = $this->params->get('blockquote', 1);
if ($blockquote)
{
$toolbar4_add[] = 'blockquote';
}
// Template
$template = $this->params->get('template', 1);
if ($template)
{
$plugins[] = 'template';
$toolbar4_add[] = 'template';
// Note this check for the template_list.js file will be removed in Joomla 4.0
if (is_file(JPATH_ROOT . "/media/editors/tinymce/templates/template_list.js"))
{
// If using the legacy file we need to include and input the files the new way
$str = file_get_contents(JPATH_ROOT . "/media/editors/tinymce/templates/template_list.js");
// Find from one [ to the last ]
preg_match_all('/\[.*\]/', $str, $matches);
$templates = "templates: [";
// Set variables
foreach ($matches['0'] as $match)
{
preg_match_all('/\".*\"/', $match, $values);
$result = trim($values["0"]["0"], '"');
$final_result = explode(',', $result);
$templates .= "{title: '" . trim($final_result['0'], ' " ') . "', description: '" . trim($final_result['2'], ' " ') . "', url: '" . JUri::root() . trim($final_result['1'], ' " ') . "'},";
}
$templates .= "],";
}
else
{
$templates = "templates: [
{title: 'Layout', description: 'HTMLLayout', url:'" . JUri::root() . "media/editors/tinymce/templates/layout1.html'},
{title: 'Simple snippet', description: 'Simple HTML snippet', url:'" . JUri::root() . "media/editors/tinymce/templates/snippet1.html'}
],";
}
}
else
{
$templates = '';
}
// Print
$print = $this->params->get('print', 1);
if ($print)
{
$plugins[] = 'print';
$toolbar4_add[] = '|';
$toolbar4_add[] = 'print';
$toolbar4_add[] = 'preview';
}
// Spellchecker
$spell = $this->params->get('spell', 0);
if ($spell)
{
$plugins[] = 'spellchecker';
$toolbar4_add[] = '|';
$toolbar4_add[] = 'spellchecker';
}
// Wordcount
$wordcount = $this->params->get('wordcount', 1);
if ($wordcount)
{
$plugins[] = 'wordcount';
}
// Advlist
$advlist = $this->params->get('advlist', 1);
if ($advlist)
{
$plugins[] = 'advlist';
}
// Autosave
$autosave = $this->params->get('autosave', 1);
if ($autosave)
{
$plugins[] = 'autosave';
}
// Context menu
$contextmenu = $this->params->get('contextmenu', 1);
if ($contextmenu)
{
$plugins[] = 'contextmenu';
}
$custom_plugin = $this->params->get('custom_plugin', '');
if ($custom_plugin != "")
{
$plugins[] = $custom_plugin;
}
$custom_button = $this->params->get('custom_button', '');
if ($custom_button != "")
{
$toolbar4_add[] = $custom_button;
}
// Prepare config variables
$plugins = implode(',', $plugins);
$elements = implode(',', $elements);
// Prepare config variables
$toolbar1 = implode(' ', $toolbar1_add);
$toolbar2 = implode(' ', $toolbar2_add);
$toolbar3 = implode(' ', $toolbar3_add);
$toolbar4 = implode(' ', $toolbar4_add);
// See if mobileVersion is activated
$mobileVersion = $this->params->get('mobile', 0);
$load = "\t\n";
/**
* Shrink the buttons if not on a mobile or if mobile view is off.
* If mobile view is on force into simple mode and enlarge the buttons
**/
if (!$this->app->client->mobile)
{
$smallButtons = 'toolbar_items_size: "small",';
}
elseif ($mobileVersion == false)
{
$smallButtons = '';
}
else
{
$smallButtons = '';
$mode = 0;
}
switch ($mode)
{
case 0: /* Simple mode*/
$return = $load .
"\t";
break;
case 1:
default: /* Advanced mode*/
$toolbar1 = "bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | formatselect | bullist numlist";
$toolbar2 = "outdent indent | undo redo | link unlink anchor image code | hr table | subscript superscript | charmap";
$return = $load .
"\t";
break;
case 2: /* Extended mode*/
$return = $load .
"\t";
break;
}
return $return;
}
/**
* TinyMCE WYSIWYG Editor - get the editor content
*
* @param string $editor The name of the editor
*
* @return string
*/
public function onGetContent($editor)
{
return 'tinyMCE.get(\'' . $editor . '\').getContent();';
}
/**
* TinyMCE WYSIWYG Editor - set the editor content
*
* @param string $editor The name of the editor
* @param string $html The html to place in the editor
*
* @return string
*/
public function onSetContent($editor, $html)
{
return 'tinyMCE.get(\'' . $editor . '\').setContent(' . $html . ');';
}
/**
* TinyMCE WYSIWYG Editor - copy editor content to form field
*
* @param string $editor The name of the editor
*
* @return string
*/
public function onSave($editor)
{
return 'if (tinyMCE.get("' . $editor . '").isHidden()) {tinyMCE.get("' . $editor . '").show()}; tinyMCE.get("' . $editor . '").save();';
}
/**
* Inserts html code into the editor
*
* @param string $name The name of the editor
*
* @return boolean
*/
public function onGetInsertMethod($name)
{
$doc = JFactory::getDocument();
$js = "
function isBrowserIE()
{
return navigator.appName==\"Microsoft Internet Explorer\";
}
function jInsertEditorText( text, editor )
{
if (isBrowserIE())
{
if (window.parent.tinyMCE)
{
window.parent.tinyMCE.selectedInstance.selection.moveToBookmark(window.parent.global_ie_bookmark);
}
}
tinyMCE.execCommand('mceInsertContent', false, text);
}
var global_ie_bookmark = false;
function IeCursorFix()
{
if (isBrowserIE())
{
tinyMCE.execCommand('mceInsertContent', false, '');
global_ie_bookmark = tinyMCE.activeEditor.selection.getBookmark(false);
}
return true;
}";
$doc->addScriptDeclaration($js);
return true;
}
/**
* Display the editor area.
*
* @param string $name The name of the editor area.
* @param string $content The content of the field.
* @param string $width The width of the editor area.
* @param string $height The height of the editor area.
* @param int $col The number of columns for the editor area.
* @param int $row The number of rows for the editor area.
* @param boolean $buttons True and the editor buttons will be displayed.
* @param string $id An optional ID for the textarea. If not supplied the name is used.
* @param string $asset The object asset
* @param object $author The author.
*
* @return string
*/
public function onDisplay($name, $content, $width, $height, $col, $row, $buttons = true, $id = null, $asset = null, $author = null)
{
if (empty($id))
{
$id = $name;
}
// Only add "px" to width and height if they are not given as a percentage
if (is_numeric($width))
{
$width .= 'px';
}
if (is_numeric($height))
{
$height .= 'px';
}
// Data object for the layout
$textarea = new stdClass;
$textarea->name = $name;
$textarea->id = $id;
$textarea->cols = $col;
$textarea->rows = $row;
$textarea->width = $width;
$textarea->height = $height;
$textarea->content = $content;
$editor = '
';
return $editor;
}
/**
* Displays the editor buttons.
*
* @param string $name The editor name
* @param mixed $buttons [array with button objects | boolean true to display buttons]
* @param string $asset The object asset
* @param object $author The author.
*
* @return string HTML
*/
private function _displayButtons($name, $buttons, $asset, $author)
{
$return = '';
$args = array(
'name' => $name,
'event' => 'onGetInsertMethod'
);
$results = (array) $this->update($args);
if ($results)
{
foreach ($results as $result)
{
if (is_string($result) && trim($result))
{
$return .= $result;
}
}
}
if (is_array($buttons) || (is_bool($buttons) && $buttons))
{
$buttons = $this->_subject->getButtons($name, $buttons, $asset, $author);
$return .= JLayoutHelper::render('joomla.editors.buttons', $buttons);
}
return $return;
}
/**
* Get the toggle editor button
*
* @param string $name Editor name
*
* @return string
*/
private function _toogleButton($name)
{
return JLayoutHelper::render('joomla.tinymce.togglebutton', $name);
}
}
PK Y[V editors/index.htmlnu W+A
PK Y[U editors/jce/jce.phpnu W+A setMetaData('X-UA-Compatible', 'IE=Edge', true);
// Check for existence of Admin Component
if (!is_dir(JPATH_SITE . '/components/com_jce') || !is_dir(JPATH_ADMINISTRATOR . '/components/com_jce')) {
JError::raiseWarning('SOME_ERROR_CODE', 'WF_COMPONENT_MISSING');
}
$language->load('plg_editors_jce', JPATH_ADMINISTRATOR);
$language->load('com_jce', JPATH_ADMINISTRATOR);
// load constants and loader
require_once(JPATH_ADMINISTRATOR . '/components/com_jce/includes/base.php');
wfimport('admin.models.editor');
$model = new WFModelEditor();
return $model->buildEditor();
}
/**
* JCE WYSIWYG Editor - get the editor content
*
* @vars string The name of the editor
*/
public function onGetContent($editor) {
//return "WFEditor.getContent('" . $editor . "');";
return $this->onSave($editor);
}
/**
* JCE WYSIWYG Editor - set the editor content
*
* @vars string The name of the editor
*/
public function onSetContent($editor, $html) {
return "WFEditor.setContent('" . $editor . "','" . $html . "');";
}
/**
* JCE WYSIWYG Editor - copy editor content to form field
*
* @vars string The name of the editor
*/
public function onSave($editor) {
return "WFEditor.getContent('" . $editor . "');";
}
/**
* JCE WYSIWYG Editor - display the editor
*
* @vars string The name of the editor area
* @vars string The content of the field
* @vars string The width of the editor area
* @vars string The height of the editor area
* @vars int The number of columns for the editor area
* @vars int The number of rows for the editor area
* @vars mixed Can be boolean or array.
*/
public function onDisplay($name, $content, $width, $height, $col, $row, $buttons = true, $id = null, $asset = null, $author = null) {
if (empty($id)) {
$id = $name;
}
// Only add "px" to width and height if they are not given as a percentage
if (is_numeric($width)) {
$width .= 'px';
}
if (is_numeric($height)) {
$height .= 'px';
}
if (empty($id)) {
$id = $name;
}
$editor = '';
$editor .= $this->_displayButtons($id, $buttons, $asset, $author);
return $editor;
}
public function onGetInsertMethod($name) {
}
private function _displayButtons($name, $buttons, $asset, $author) {
$return = '';
$args = array(
'name' => $name,
'event' => 'onGetInsertMethod'
);
$results = (array) $this->update($args);
foreach ($results as $result) {
if (is_string($result) && trim($result)) {
$return .= $result;
}
}
$version = new JVersion;
if (is_array($buttons) || (is_bool($buttons) && $buttons)) {
$buttons = $this->_subject->getButtons($name, $buttons, $asset, $author);
if ($version->isCompatible('3.0')) {
// fix for some buttons that do not include the class
foreach($buttons as $button) {
if (is_object($button)) {
if (isset($button->class)) {
if (preg_match('#\bbtn\b#', $button->class) === false) {
$button->class .= " btn";
}
} else {
$button->class = "btn";
}
}
}
$return .= JLayoutHelper::render('joomla.editors.buttons', $buttons);
} else {
// Load modal popup behavior
JHTML::_('behavior.modal', 'a.modal-button');
/*
* This will allow plugins to attach buttons or change the behavior on the fly using AJAX
*/
$return .= "\n
\n";
}
}
return $return;
}
}
?>PK Y[+ editors/jce/jce.xmlnu W+A
plg_editors_jce2.4.311 September 2014Ryan Demmerinfo@joomlacontenteditor.nethttp://www.joomlacontenteditor.net2006-2010 Ryan DemmerGNU/GPL Version 2 - http://www.gnu.org/licenses/gpl-2.0.htmlWF_EDITOR_PLUGIN_DESCjce.phpPK Y[N editors/none/none.phpnu W+A
function insertAtCursor(myField, myValue)
{
if (document.selection)
{
// IE support
myField.focus();
sel = document.selection.createRange();
sel.text = myValue;
} else if (myField.selectionStart || myField.selectionStart == '0')
{
// MOZILLA/NETSCAPE support
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
myField.value = myField.value.substring(0, startPos)
+ myValue
+ myField.value.substring(endPos, myField.value.length);
} else {
myField.value += myValue;
}
}
";
return $txt;
}
/**
* Copy editor content to form field.
*
* Not applicable in this editor.
*
* @return void
*/
public function onSave()
{
return;
}
/**
* Get the editor content.
*
* @param string $id The id of the editor field.
*
* @return string
*/
public function onGetContent($id)
{
return "document.getElementById('$id').value;\n";
}
/**
* Set the editor content.
*
* @param string $id The id of the editor field.
* @param string $html The content to set.
*
* @return string
*/
public function onSetContent($id, $html)
{
return "document.getElementById('$id').value = $html;\n";
}
/**
* Inserts html code into the editor
*
* @param string $id The id of the editor field
*
* @return boolean returns true when complete
*/
public function onGetInsertMethod($id)
{
static $done = false;
// Do this only once.
if (!$done)
{
$doc = JFactory::getDocument();
$js = "\tfunction jInsertEditorText(text, editor)
{
insertAtCursor(document.getElementById(editor), text);
}";
$doc->addScriptDeclaration($js);
}
return true;
}
/**
* Display the editor area.
*
* @param string $name The control name.
* @param string $content The contents of the text area.
* @param string $width The width of the text area (px or %).
* @param string $height The height of the text area (px or %).
* @param integer $col The number of columns for the textarea.
* @param integer $row The number of rows for the textarea.
* @param boolean $buttons True and the editor buttons will be displayed.
* @param string $id An optional ID for the textarea (note: since 1.6). If not supplied the name is used.
* @param string $asset The object asset
* @param object $author The author.
* @param array $params Associative array of editor parameters.
*
* @return string
*/
public function onDisplay($name, $content, $width, $height, $col, $row, $buttons = true, $id = null, $asset = null, $author = null, $params = array())
{
if (empty($id))
{
$id = $name;
}
// Only add "px" to width and height if they are not given as a percentage
if (is_numeric($width))
{
$width .= 'px';
}
if (is_numeric($height))
{
$height .= 'px';
}
$buttons = $this->_displayButtons($id, $buttons, $asset, $author);
$editor = "" . $buttons;
return $editor;
}
/**
* Displays the editor buttons.
*
* @param string $name The control name.
* @param mixed $buttons [array with button objects | boolean true to display buttons]
* @param string $asset The object asset
* @param object $author The author.
*
* @return string HTML
*/
public function _displayButtons($name, $buttons, $asset, $author)
{
$return = '';
$args = array(
'name' => $name,
'event' => 'onGetInsertMethod'
);
$results = (array) $this->update($args);
if ($results)
{
foreach ($results as $result)
{
if (is_string($result) && trim($result))
{
$return .= $result;
}
}
}
if (is_array($buttons) || (is_bool($buttons) && $buttons))
{
$buttons = $this->_subject->getButtons($name, $buttons, $asset, $author);
$return .= JLayoutHelper::render('joomla.editors.buttons', $buttons);
}
return $return;
}
}
PK Y[$ editors/none/none.xmlnu W+A
plg_editors_none3.0.0August 2004N/AGNU General Public License version 2 or later; see LICENSE.txtPLG_NONE_XML_DESCRIPTIONnone.phpindex.htmlen-GB.plg_editors_none.inien-GB.plg_editors_none.sys.ini
PK Y[V editors/none/index.htmlnu W+A
PK Y[_ _ .htaccessnu W+A
Order Allow,Deny
Deny from all
PK Y[V % twofactorauth/yubikey/tmpl/index.htmlnu W+A
PK Y[{o o # twofactorauth/yubikey/tmpl/form.phpnu W+A
PK Y[V twofactorauth/yubikey/index.htmlnu W+A
PK Y[JM ! twofactorauth/yubikey/yubikey.xmlnu W+A
plg_twofactorauth_yubikeyJoomla! ProjectSeptember 2013Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved.GNU General Public License version 2 or later; see LICENSE.txtadmin@joomla.orgwww.joomla.org3.2.0PLG_TWOFACTORAUTH_YUBIKEY_XML_DESCRIPTIONyubikey.phpindex.htmltmplen-GB.plg_twofactorauth_yubikey.inien-GB.plg_twofactorauth_yubikey.sys.ini
PK Y[t~# ~# ! twofactorauth/yubikey/yubikey.phpnu W+A params->get('section', 3);
$current_section = 0;
try
{
$app = JFactory::getApplication();
if ($app->isAdmin())
{
$current_section = 2;
}
elseif ($app->isSite())
{
$current_section = 1;
}
}
catch (Exception $exc)
{
$current_section = 0;
}
if (!($current_section & $section))
{
return false;
}
return (object) array(
'method' => $this->methodName,
'title' => JText::_('PLG_TWOFACTORAUTH_YUBIKEY_METHOD_TITLE'),
);
}
/**
* Shows the configuration page for this two factor authentication method.
*
* @param object $otpConfig The two factor auth configuration object
* @param integer $user_id The numeric user ID of the user whose form we'll display
*
* @return boolean|string False if the method is not ours, the HTML of the configuration page otherwise
*
* @see UsersModelUser::getOtpConfig
* @since 3.2
*/
public function onUserTwofactorShowConfiguration($otpConfig, $user_id = null)
{
if ($otpConfig->method == $this->methodName)
{
// This method is already activated. Reuse the same Yubikey ID.
$yubikey = $otpConfig->config['yubikey'];
}
else
{
// This methods is not activated yet. We'll need a Yubikey TOTP to setup this Yubikey.
$yubikey = '';
}
// Is this a new TOTP setup? If so, we'll have to show the code validation field.
$new_totp = $otpConfig->method != $this->methodName;
// Start output buffering
@ob_start();
// Include the form.php from a template override. If none is found use the default.
$path = FOFPlatform::getInstance()->getTemplateOverridePath('plg_twofactorauth_yubikey', true);
JLoader::import('joomla.filesystem.file');
if (JFile::exists($path . 'form.php'))
{
include_once $path . 'form.php';
}
else
{
include_once __DIR__ . '/tmpl/form.php';
}
// Stop output buffering and get the form contents
$html = @ob_get_clean();
// Return the form contents
return array(
'method' => $this->methodName,
'form' => $html,
);
}
/**
* The save handler of the two factor configuration method's configuration
* page.
*
* @param string $method The two factor auth method for which we'll show the config page
*
* @return boolean|stdClass False if the method doesn't match or we have an error, OTP config object if it succeeds
*
* @see UsersModelUser::setOtpConfig
* @since 3.2
*/
public function onUserTwofactorApplyConfiguration($method)
{
if ($method != $this->methodName)
{
return false;
}
// Get a reference to the input data object
$input = JFactory::getApplication()->input;
// Load raw data
$rawData = $input->get('jform', array(), 'array');
$data = $rawData['twofactor']['yubikey'];
// Warn if the securitycode is empty
if (array_key_exists('securitycode', $data) && empty($data['securitycode']))
{
try
{
$app = JFactory::getApplication();
$app->enqueueMessage(JText::_('PLG_TWOFACTORAUTH_YUBIKEY_ERR_VALIDATIONFAILED'), 'error');
}
catch (Exception $exc)
{
// This only happens when we are in a CLI application. We cannot
// enqueue a message, so just do nothing.
}
return false;
}
// Validate the Yubikey OTP
$check = $this->validateYubikeyOTP($data['securitycode']);
if (!$check)
{
$app = JFactory::getApplication();
$app->enqueueMessage(JText::_('PLG_TWOFACTORAUTH_YUBIKEY_ERR_VALIDATIONFAILED'), 'error');
// Check failed. Do not change two factor authentication settings.
return false;
}
// Remove the last 32 digits and store the rest in the user configuration parameters
$yubikey = substr($data['securitycode'], 0, -32);
// Check succeedeed; return an OTP configuration object
$otpConfig = (object) array(
'method' => $this->methodName,
'config' => array(
'yubikey' => $yubikey
),
'otep' => array()
);
return $otpConfig;
}
/**
* This method should handle any two factor authentication and report back
* to the subject.
*
* @param array $credentials Array holding the user credentials
* @param array $options Array of extra options
*
* @return boolean True if the user is authorised with this two-factor authentication method
*
* @since 3.2
*/
public function onUserTwofactorAuthenticate($credentials, $options)
{
// Get the OTP configuration object
$otpConfig = $options['otp_config'];
// Make sure it's an object
if (empty($otpConfig) || !is_object($otpConfig))
{
return false;
}
// Check if we have the correct method
if ($otpConfig->method != $this->methodName)
{
return false;
}
// Check if there is a security code
if (empty($credentials['secretkey']))
{
return false;
}
// Check if the Yubikey starts with the configured Yubikey user string
$yubikey_valid = $otpConfig->config['yubikey'];
$yubikey = substr($credentials['secretkey'], 0, -32);
$check = $yubikey == $yubikey_valid;
if ($check)
{
$check = $this->validateYubikeyOTP($credentials['secretkey']);
}
return $check;
}
/**
* Validates a Yubikey OTP against the Yubikey servers
*
* @param string $otp The OTP generated by your Yubikey
*
* @return boolean True if it's a valid OTP
*
* @since 3.2
*/
public function validateYubikeyOTP($otp)
{
$server_queue = array(
'api.yubico.com', 'api2.yubico.com', 'api3.yubico.com',
'api4.yubico.com', 'api5.yubico.com'
);
shuffle($server_queue);
$gotResponse = false;
$check = false;
$http = JHttpFactory::getHttp();
$token = JSession::getFormToken();
$nonce = md5($token . uniqid(rand()));
while (!$gotResponse && !empty($server_queue))
{
$server = array_shift($server_queue);
$uri = new JUri('https://' . $server . '/wsapi/2.0/verify');
// I don't see where this ID is used?
$uri->setVar('id', 1);
// The OTP we read from the user
$uri->setVar('otp', $otp);
// This prevents a REPLAYED_OTP status of the token doesn't change
// after a user submits an invalid OTP
$uri->setVar('nonce', $nonce);
// Minimum service level required: 50% (at least 50% of the YubiCloud
// servers must reply positively for the OTP to validate)
$uri->setVar('sl', 50);
// Timeou waiting for YubiCloud servers to reply: 5 seconds.
$uri->setVar('timeout', 5);
try
{
$response = $http->get($uri->toString(), null, 6);
if (!empty($response))
{
$gotResponse = true;
}
else
{
continue;
}
}
catch (Exception $exc)
{
// No response, continue with the next server
continue;
}
}
// No server replied; we can't validate this OTP
if (!$gotResponse)
{
return false;
}
// Parse response
$lines = explode("\n", $response->body);
$data = array();
foreach ($lines as $line)
{
$line = trim($line);
$parts = explode('=', $line, 2);
if (count($parts) < 2)
{
continue;
}
$data[$parts[0]] = $parts[1];
}
// Validate the response - We need an OK message reply
if ($data['status'] != 'OK')
{
return false;
}
// Validate the response - We need a confidence level over 50%
if ($data['sl'] < 50)
{
return false;
}
// Validate the response - The OTP must match
if ($data['otp'] != $otp)
{
return false;
}
// Validate the response - The token must match
if ($data['nonce'] != $nonce)
{
return false;
}
return true;
}
}
PK Y[V twofactorauth/index.htmlnu W+A
PK Y[V " twofactorauth/totp/tmpl/index.htmlnu W+A
PK Y[e twofactorauth/totp/tmpl/form.phpnu W+A
PK Y[L/M M twofactorauth/totp/totp.phpnu W+A params->get('section', 3);
$current_section = 0;
try
{
$app = JFactory::getApplication();
if ($app->isAdmin())
{
$current_section = 2;
}
elseif ($app->isSite())
{
$current_section = 1;
}
}
catch (Exception $exc)
{
$current_section = 0;
}
if (!($current_section & $section))
{
return false;
}
return (object) array(
'method' => $this->methodName,
'title' => JText::_('PLG_TWOFACTORAUTH_TOTP_METHOD_TITLE')
);
}
/**
* Shows the configuration page for this two factor authentication method.
*
* @param object $otpConfig The two factor auth configuration object
* @param integer $user_id The numeric user ID of the user whose form we'll display
*
* @return boolean|string False if the method is not ours, the HTML of the configuration page otherwise
*
* @see UsersModelUser::getOtpConfig
* @since 3.2
*/
public function onUserTwofactorShowConfiguration($otpConfig, $user_id = null)
{
// Create a new TOTP class with Google Authenticator compatible settings
$totp = new FOFEncryptTotp(30, 6, 10);
if ($otpConfig->method == $this->methodName)
{
// This method is already activated. Reuse the same secret key.
$secret = $otpConfig->config['code'];
}
else
{
// This methods is not activated yet. Create a new secret key.
$secret = $totp->generateSecret();
}
// These are used by Google Authenticator to tell accounts apart
$username = JFactory::getUser($user_id)->username;
$hostname = JFactory::getURI()->getHost();
// This is the URL to the QR code for Google Authenticator
$url = $totp->getUrl($username, $hostname, $secret);
// Is this a new TOTP setup? If so, we'll have to show the code validation field.
$new_totp = $otpConfig->method != 'totp';
// Start output buffering
@ob_start();
// Include the form.php from a template override. If none is found use the default.
$path = FOFPlatform::getInstance()->getTemplateOverridePath('plg_twofactorauth_totp', true);
JLoader::import('joomla.filesystem.file');
if (JFile::exists($path . 'form.php'))
{
include_once $path . 'form.php';
}
else
{
include_once __DIR__ . '/tmpl/form.php';
}
// Stop output buffering and get the form contents
$html = @ob_get_clean();
// Return the form contents
return array(
'method' => $this->methodName,
'form' => $html
);
}
/**
* The save handler of the two factor configuration method's configuration
* page.
*
* @param string $method The two factor auth method for which we'll show the config page
*
* @return boolean|stdClass False if the method doesn't match or we have an error, OTP config object if it succeeds
*
* @see UsersModelUser::setOtpConfig
* @since 3.2
*/
public function onUserTwofactorApplyConfiguration($method)
{
if ($method != $this->methodName)
{
return false;
}
// Get a reference to the input data object
$input = JFactory::getApplication()->input;
// Load raw data
$rawData = $input->get('jform', array(), 'array');
$data = $rawData['twofactor']['totp'];
// Warn if the securitycode is empty
if (array_key_exists('securitycode', $data) && empty($data['securitycode']))
{
try
{
$app = JFactory::getApplication();
$app->enqueueMessage(JText::_('PLG_TWOFACTORAUTH_TOTP_ERR_VALIDATIONFAILED'), 'error');
}
catch (Exception $exc)
{
// This only happens when we are in a CLI application. We cannot
// enqueue a message, so just do nothing.
}
return false;
}
// Create a new TOTP class with Google Authenticator compatible settings
$totp = new FOFEncryptTotp(30, 6, 10);
// Check the security code entered by the user (exact time slot match)
$code = $totp->getCode($data['key']);
$check = $code == $data['securitycode'];
/*
* If the check fails, test the previous 30 second slot. This allow the
* user to enter the security code when it's becoming red in Google
* Authenticator app (reaching the end of its 30 second lifetime)
*/
if (!$check)
{
$time = time() - 30;
$code = $totp->getCode($data['key'], $time);
$check = $code == $data['securitycode'];
}
/*
* If the check fails, test the next 30 second slot. This allows some
* time drift between the authentication device and the server
*/
if (!$check)
{
$time = time() + 30;
$code = $totp->getCode($data['key'], $time);
$check = $code == $data['securitycode'];
}
if (!$check)
{
// Check failed. Do not change two factor authentication settings.
return false;
}
// Check succeedeed; return an OTP configuration object
$otpConfig = (object) array(
'method' => 'totp',
'config' => array(
'code' => $data['key']
),
'otep' => array()
);
return $otpConfig;
}
/**
* This method should handle any two factor authentication and report back
* to the subject.
*
* @param array $credentials Array holding the user credentials
* @param array $options Array of extra options
*
* @return boolean True if the user is authorised with this two-factor authentication method
*
* @since 3.2
*/
public function onUserTwofactorAuthenticate($credentials, $options)
{
// Get the OTP configuration object
$otpConfig = $options['otp_config'];
// Make sure it's an object
if (empty($otpConfig) || !is_object($otpConfig))
{
return false;
}
// Check if we have the correct method
if ($otpConfig->method != $this->methodName)
{
return false;
}
// Check if there is a security code
if (empty($credentials['secretkey']))
{
return false;
}
// Create a new TOTP class with Google Authenticator compatible settings
$totp = new FOFEncryptTotp(30, 6, 10);
// Check the code
$code = $totp->getCode($otpConfig->config['code']);
$check = $code == $credentials['secretkey'];
/*
* If the check fails, test the previous 30 second slot. This allow the
* user to enter the security code when it's becoming red in Google
* Authenticator app (reaching the end of its 30 second lifetime)
*/
if (!$check)
{
$time = time() - 30;
$code = $totp->getCode($otpConfig->config['code'], $time);
$check = $code == $credentials['secretkey'];
}
/*
* If the check fails, test the next 30 second slot. This allows some
* time drift between the authentication device and the server
*/
if (!$check)
{
$time = time() + 30;
$code = $totp->getCode($otpConfig->config['code'], $time);
$check = $code == $credentials['secretkey'];
}
return $check;
}
}
PK Y[V twofactorauth/totp/index.htmlnu W+A
PK Y[mb{ { twofactorauth/totp/totp.xmlnu W+A
plg_twofactorauth_totpJoomla! ProjectAugust 2013Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved.GNU General Public License version 2 or later; see LICENSE.txtadmin@joomla.orgwww.joomla.org3.2.0PLG_TWOFACTORAUTH_TOTP_XML_DESCRIPTIONtotp.phpindex.htmlpostinstalltmplen-GB.plg_twofactorauth_totp.inien-GB.plg_twofactorauth_totp.sys.ini
PK Y[V ) twofactorauth/totp/postinstall/index.htmlnu W+A
PK Y[": : * twofactorauth/totp/postinstall/actions.phpnu W+A getQuery(true)
->select('*')
->from($db->qn('#__extensions'))
->where($db->qn('type') . ' = ' . $db->q('plugin'))
->where($db->qn('enabled') . ' = ' . $db->q('1'))
->where($db->qn('folder') . ' = ' . $db->q('twofactorauth'));
$db->setQuery($query);
$enabled_plugins = $db->loadObjectList();
return count($enabled_plugins) == 0;
}
/**
* Enables the two factor authentication plugin and redirects the user to their
* user profile page so that they can enable two factor authentication on their
* account.
*
* @return void
*
* @since 3.2
*/
function twofactorauth_postinstall_action()
{
// Enable the plugin
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->update($db->qn('#__extensions'))
->set($db->qn('enabled') . ' = ' . $db->q(1))
->where($db->qn('type') . ' = ' . $db->q('plugin'))
->where($db->qn('folder') . ' = ' . $db->q('twofactorauth'));
$db->setQuery($query);
$db->execute();
// Redirect the user to their profile editor page
$url = 'index.php?option=com_users&task=user.edit&id=' . JFactory::getUser()->id;
JFactory::getApplication()->redirect($url);
}
PK Y[$ extension/joomla/joomla.phpnu W+A getQuery(true)
->select('update_site_id')
->from('#__update_sites')
->where('location = ' . $db->quote($location));
$db->setQuery($query);
$update_site_id = (int) $db->loadResult();
// If it doesn't exist, add it!
if (!$update_site_id)
{
$query->clear()
->insert('#__update_sites')
->columns(array($db->quoteName('name'), $db->quoteName('type'), $db->quoteName('location'), $db->quoteName('enabled')))
->values($db->quote($name) . ', ' . $db->quote($type) . ', ' . $db->quote($location) . ', ' . (int) $enabled);
$db->setQuery($query);
if ($db->execute())
{
// Link up this extension to the update site
$update_site_id = $db->insertid();
}
}
// Check if it has an update site id (creation might have faileD)
if ($update_site_id)
{
// Look for an update site entry that exists
$query->clear()
->select('update_site_id')
->from('#__update_sites_extensions')
->where('update_site_id = ' . $update_site_id)
->where('extension_id = ' . $this->eid);
$db->setQuery($query);
$tmpid = (int) $db->loadResult();
if (!$tmpid)
{
// Link this extension to the relevant update site
$query->clear()
->insert('#__update_sites_extensions')
->columns(array($db->quoteName('update_site_id'), $db->quoteName('extension_id')))
->values($update_site_id . ', ' . $this->eid);
$db->setQuery($query);
$db->execute();
}
}
}
/**
* Handle post extension install update sites
*
* @param JInstaller $installer Installer object
* @param integer $eid Extension Identifier
*
* @return void
*
* @since 1.6
*/
public function onExtensionAfterInstall($installer, $eid )
{
if ($eid)
{
$this->installer = $installer;
$this->eid = $eid;
// After an install we only need to do update sites
$this->processUpdateSites();
}
}
/**
* Handle extension uninstall
*
* @param JInstaller $installer Installer instance
* @param integer $eid Extension id
* @param integer $result Installation result
*
* @return void
*
* @since 1.6
*/
public function onExtensionAfterUninstall($installer, $eid, $result)
{
if ($eid)
{
// Wipe out any update_sites_extensions links
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->delete('#__update_sites_extensions')
->where('extension_id = ' . $eid);
$db->setQuery($query);
$db->execute();
// Delete any unused update sites
$query->clear()
->select('update_site_id')
->from('#__update_sites_extensions');
$db->setQuery($query);
$results = $db->loadColumn();
if (is_array($results))
{
// So we need to delete the update sites and their associated updates
$updatesite_delete = $db->getQuery(true);
$updatesite_delete->delete('#__update_sites');
$updatesite_query = $db->getQuery(true);
$updatesite_query->select('update_site_id')
->from('#__update_sites');
// If we get results back then we can exclude them
if (count($results))
{
$updatesite_query->where('update_site_id NOT IN (' . implode(',', $results) . ')');
$updatesite_delete->where('update_site_id NOT IN (' . implode(',', $results) . ')');
}
// So let's find what update sites we're about to nuke and remove their associated extensions
$db->setQuery($updatesite_query);
$update_sites_pending_delete = $db->loadColumn();
if (is_array($update_sites_pending_delete) && count($update_sites_pending_delete))
{
// Nuke any pending updates with this site before we delete it
// TODO: investigate alternative of using a query after the delete below with a query and not in like above
$query->clear()
->delete('#__updates')
->where('update_site_id IN (' . implode(',', $update_sites_pending_delete) . ')');
$db->setQuery($query);
$db->execute();
}
// Note: this might wipe out the entire table if there are no extensions linked
$db->setQuery($updatesite_delete);
$db->execute();
}
// Last but not least we wipe out any pending updates for the extension
$query->clear()
->delete('#__updates')
->where('extension_id = ' . $eid);
$db->setQuery($query);
$db->execute();
}
}
/**
* After update of an extension
*
* @param JInstaller $installer Installer object
* @param integer $eid Extension identifier
*
* @return void
*
* @since 1.6
*/
public function onExtensionAfterUpdate($installer, $eid)
{
if ($eid)
{
$this->installer = $installer;
$this->eid = $eid;
// Handle any update sites
$this->processUpdateSites();
}
}
/**
* Processes the list of update sites for an extension.
*
* @return void
*
* @since 1.6
*/
private function processUpdateSites()
{
$manifest = $this->installer->getManifest();
$updateservers = $manifest->updateservers;
if ($updateservers)
{
$children = $updateservers->children();
}
else
{
$children = array();
}
if (count($children))
{
foreach ($children as $child)
{
$attrs = $child->attributes();
$this->addUpdateSite($attrs['name'], $attrs['type'], trim($child), true);
}
}
else
{
$data = trim((string) $updateservers);
if (strlen($data))
{
// We have a single entry in the update server line, let us presume this is an extension line
$this->addUpdateSite(JText::_('PLG_EXTENSION_JOOMLA_UNKNOWN_SITE'), 'extension', $data, true);
}
}
}
}
PK Y[V extension/joomla/index.htmlnu W+A
PK Y[G3@d4 4 extension/joomla/joomla.xmlnu W+A
plg_extension_joomlaJoomla! ProjectMay 2010Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved.http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLadmin@joomla.orgwww.joomla.org3.0.0PLG_EXTENSION_JOOMLA_XML_DESCRIPTIONjoomla.phpindex.htmlen-GB.plg_extension_joomla.inien-GB.plg_extension_joomla.sys.ini
PK Y[V extension/index.htmlnu W+A
PK Y[{R + extension/joomsefinstall/joomsefinstall.xmlnu W+A
Extension Install - ARTIO JoomSEFARTIO s.r.o.21. October 2011ARTIO s.r.o.GNU/GPLv3 http://www.artio.net/license/gnu-general-public-licenseinfo@artio.netwww.artio.net4.1.1PLG_JOOMSEFINSTALL_XML_DESCRIPTIONjoomsefinstall.php
PK Y[7R + extension/joomsefinstall/joomsefinstall.phpnu W+A _processUpdateSites($installer->manifest);
}
function onExtensionAfterUpdate($installer,$eid) {
$this->_processUpdateSites($installer->manifest);
}
private function _processUpdateSites($xml) {
if (!is_object($xml)) {
return;
}
$db=JFactory::getDBO();
$free=false;
$freecnt=array();
$pay=false;
if((string)$xml->name=='com_sef' || (string)$xml['type']=='sef_ext') {
if((string)$xml->name=='com_sef') {
$name='com_joomsef';
} else {
if (count($xml->files->children())) {
foreach ($xml->files->children() as $file) {
if ((string)$file->attributes()->sef_ext) {
$element = (string)$file->attributes()->sef_ext;
if(substr($element,0,13)!='ext_joomsef4_') {
$element='ext_joomsef4_'.$element;
}
break;
}
}
}
$name=$element;
}
$query=$db->getQuery(true);
$query->select('update_site_id, location')->from('#__update_sites')->where('name='.$db->quote($name));
$db->setQuery($query);
$updates=$db->loadObjectList();
if(count($updates)>0) {
for($i=0;$ilocation==(string)$xml->updateservers->server) {
$free=true;
$freecnt[]=$updates[$i]->update_site_id;
}
if($updates[$i]->location!=(string)$xml->updateservers->server) {
$pay=true;
}
}
}
if($free==true && $pay==true) {
$query=$db->getQuery(true);
$query->delete('#__update_sites')->where('location='.$db->quote((string)$xml->updateservers->server));
$db->setQUery($query);
$db->query();
} else if(count($freecnt)>1) {
array_shift($freecnt);
$query=$db->getQuery($query);
$query->delete('#__update_sites')->where('update_site_id IN('.implode(",",$freecnt).')');
$db->setQuery($query);
$db->query();
}
}
}
}
?>PK Y[1wY0 Y0 finder/contacts/contacts.phpnu W+A categoryStateChange($pks, $value);
}
}
/**
* Method to remove the link information for items that have been deleted.
*
* This event will fire when contacts are deleted and when an indexed item is deleted.
*
* @param string $context The context of the action being performed.
* @param JTable $table A JTable object containing the record to be deleted
*
* @return boolean True on success.
*
* @since 2.5
* @throws Exception on database error.
*/
public function onFinderAfterDelete($context, $table)
{
if ($context == 'com_contact.contact')
{
$id = $table->id;
}
elseif ($context == 'com_finder.index')
{
$id = $table->link_id;
}
else
{
return true;
}
// Remove the items.
return $this->remove($id);
}
/**
* Method to determine if the access level of an item changed.
*
* @param string $context The context of the content passed to the plugin.
* @param JTable $row A JTable object
* @param boolean $isNew If the content has just been created
*
* @return boolean True on success.
*
* @since 2.5
* @throws Exception on database error.
*/
public function onFinderAfterSave($context, $row, $isNew)
{
// We only want to handle contacts here
if ($context == 'com_contact.contact')
{
// Check if the access levels are different
if (!$isNew && $this->old_access != $row->access)
{
// Process the change.
$this->itemAccessChange($row);
}
// Reindex the item
$this->reindex($row->id);
}
// Check for access changes in the category
if ($context == 'com_categories.category')
{
// Check if the access levels are different
if (!$isNew && $this->old_cataccess != $row->access)
{
$this->categoryAccessChange($row);
}
}
return true;
}
/**
* Method to reindex the link information for an item that has been saved.
* This event is fired before the data is actually saved so we are going
* to queue the item to be indexed later.
*
* @param string $context The context of the content passed to the plugin.
* @param JTable $row A JTable object
* @param boolean $isNew If the content is just about to be created
*
* @return boolean True on success.
*
* @since 2.5
* @throws Exception on database error.
*/
public function onFinderBeforeSave($context, $row, $isNew)
{
// We only want to handle contacts here
if ($context == 'com_contact.contact')
{
// Query the database for the old access level if the item isn't new
if (!$isNew)
{
$this->checkItemAccess($row);
}
}
// Check for access levels from the category
if ($context == 'com_categories.category')
{
// Query the database for the old access level if the item isn't new
if (!$isNew)
{
$this->checkCategoryAccess($row);
}
}
return true;
}
/**
* Method to update the link information for items that have been changed
* from outside the edit screen. This is fired when the item is published,
* unpublished, archived, or unarchived from the list view.
*
* @param string $context The context for the content passed to the plugin.
* @param array $pks A list of primary key ids of the content that has changed state.
* @param integer $value The value of the state that the content has been changed to.
*
* @return void
*
* @since 2.5
*/
public function onFinderChangeState($context, $pks, $value)
{
// We only want to handle contacts here
if ($context == 'com_contact.contact')
{
$this->itemStateChange($pks, $value);
}
// Handle when the plugin is disabled
if ($context == 'com_plugins.plugin' && $value === 0)
{
$this->pluginDisable($pks);
}
}
/**
* Method to index an item. The item must be a FinderIndexerResult object.
*
* @param FinderIndexerResult $item The item to index as an FinderIndexerResult object.
* @param string $format The item format
*
* @return void
*
* @since 2.5
* @throws Exception on database error.
*/
protected function index(FinderIndexerResult $item, $format = 'html')
{
// Check if the extension is enabled
if (JComponentHelper::isEnabled($this->extension) == false)
{
return;
}
$item->setLanguage();
// Initialize the item parameters.
$registry = new JRegistry;
$registry->loadString($item->params);
$item->params = $registry;
// Build the necessary route and path information.
$item->url = $this->getURL($item->id, $this->extension, $this->layout);
$item->route = ContactHelperRoute::getContactRoute($item->slug, $item->catslug, $item->language);
$item->path = FinderIndexerHelper::getContentPath($item->route);
// Get the menu title if it exists.
$title = $this->getItemMenuTitle($item->url);
// Adjust the title if necessary.
if (!empty($title) && $this->params->get('use_menu_title', true))
{
$item->title = $title;
}
/*
* Add the meta-data processing instructions based on the contact
* configuration parameters.
*/
// Handle the contact position.
if ($item->params->get('show_position', true))
{
$item->addInstruction(FinderIndexer::META_CONTEXT, 'position');
}
// Handle the contact street address.
if ($item->params->get('show_street_address', true))
{
$item->addInstruction(FinderIndexer::META_CONTEXT, 'address');
}
// Handle the contact city.
if ($item->params->get('show_suburb', true))
{
$item->addInstruction(FinderIndexer::META_CONTEXT, 'city');
}
// Handle the contact region.
if ($item->params->get('show_state', true))
{
$item->addInstruction(FinderIndexer::META_CONTEXT, 'region');
}
// Handle the contact country.
if ($item->params->get('show_country', true))
{
$item->addInstruction(FinderIndexer::META_CONTEXT, 'country');
}
// Handle the contact zip code.
if ($item->params->get('show_postcode', true))
{
$item->addInstruction(FinderIndexer::META_CONTEXT, 'zip');
}
// Handle the contact telephone number.
if ($item->params->get('show_telephone', true))
{
$item->addInstruction(FinderIndexer::META_CONTEXT, 'telephone');
}
// Handle the contact fax number.
if ($item->params->get('show_fax', true))
{
$item->addInstruction(FinderIndexer::META_CONTEXT, 'fax');
}
// Handle the contact e-mail address.
if ($item->params->get('show_email', true))
{
$item->addInstruction(FinderIndexer::META_CONTEXT, 'email');
}
// Handle the contact mobile number.
if ($item->params->get('show_mobile', true))
{
$item->addInstruction(FinderIndexer::META_CONTEXT, 'mobile');
}
// Handle the contact webpage.
if ($item->params->get('show_webpage', true))
{
$item->addInstruction(FinderIndexer::META_CONTEXT, 'webpage');
}
// Handle the contact user name.
$item->addInstruction(FinderIndexer::META_CONTEXT, 'user');
// Add the type taxonomy data.
$item->addTaxonomy('Type', 'Contact');
// Add the category taxonomy data.
$item->addTaxonomy('Category', $item->category, $item->cat_state, $item->cat_access);
// Add the language taxonomy data.
$item->addTaxonomy('Language', $item->language);
// Add the region taxonomy data.
if (!empty($item->region) && $this->params->get('tax_add_region', true))
{
$item->addTaxonomy('Region', $item->region);
}
// Add the country taxonomy data.
if (!empty($item->country) && $this->params->get('tax_add_country', true))
{
$item->addTaxonomy('Country', $item->country);
}
// Get content extras.
FinderIndexerHelper::getContentExtras($item);
// Index the item.
$this->indexer->index($item);
}
/**
* Method to setup the indexer to be run.
*
* @return boolean True on success.
*
* @since 2.5
*/
protected function setup()
{
// Load dependent classes.
require_once JPATH_SITE . '/components/com_contact/helpers/route.php';
// This is a hack to get around the lack of a route helper.
FinderIndexerHelper::getContentPath('index.php?option=com_contact');
return true;
}
/**
* Method to get the SQL query used to retrieve the list of content items.
*
* @param mixed $query A JDatabaseQuery object or null.
*
* @return JDatabaseQuery A database object.
*
* @since 2.5
*/
protected function getListQuery($query = null)
{
$db = JFactory::getDbo();
// Check if we can use the supplied SQL query.
$query = $query instanceof JDatabaseQuery ? $query : $db->getQuery(true)
->select('a.id, a.name AS title, a.alias, a.con_position AS position, a.address, a.created AS start_date')
->select('a.created_by_alias, a.modified, a.modified_by')
->select('a.metakey, a.metadesc, a.metadata, a.language')
->select('a.sortname1, a.sortname2, a.sortname3')
->select('a.publish_up AS publish_start_date, a.publish_down AS publish_end_date')
->select('a.suburb AS city, a.state AS region, a.country, a.postcode AS zip')
->select('a.telephone, a.fax, a.misc AS summary, a.email_to AS email, a.mobile')
->select('a.webpage, a.access, a.published AS state, a.ordering, a.params, a.catid')
->select('c.title AS category, c.published AS cat_state, c.access AS cat_access');
// Handle the alias CASE WHEN portion of the query
$case_when_item_alias = ' CASE WHEN ';
$case_when_item_alias .= $query->charLength('a.alias', '!=', '0');
$case_when_item_alias .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when_item_alias .= $query->concatenate(array($a_id, 'a.alias'), ':');
$case_when_item_alias .= ' ELSE ';
$case_when_item_alias .= $a_id . ' END as slug';
$query->select($case_when_item_alias);
$case_when_category_alias = ' CASE WHEN ';
$case_when_category_alias .= $query->charLength('c.alias', '!=', '0');
$case_when_category_alias .= ' THEN ';
$c_id = $query->castAsChar('c.id');
$case_when_category_alias .= $query->concatenate(array($c_id, 'c.alias'), ':');
$case_when_category_alias .= ' ELSE ';
$case_when_category_alias .= $c_id . ' END as catslug';
$query->select($case_when_category_alias)
->select('u.name')
->from('#__contact_details AS a')
->join('LEFT', '#__categories AS c ON c.id = a.catid')
->join('LEFT', '#__users AS u ON u.id = a.user_id');
return $query;
}
}
PK Y[6 finder/contacts/index.htmlnu W+A PK Y[fs finder/contacts/contacts.xmlnu W+A
plg_finder_contactsJoomla! ProjectAugust 2011(C) 2005 - 2014 Open Source Matters. All rights reserved.GNU General Public License version 2 or later; see LICENSE.txtadmin@joomla.orgwww.joomla.org3.0.0PLG_FINDER_CONTACTS_XML_DESCRIPTIONscript.phpcontacts.phpindex.htmllanguage/en-GB/en-GB.plg_finder_contacts.inilanguage/en-GB/en-GB.plg_finder_contacts.sys.ini
PK Y[yup p finder/tags/tags.xmlnu W+A
plg_finder_tagsJoomla! ProjectFebruary 2013(C) 2005 - 2014 Open Source Matters. All rights reserved.GNU General Public License version 2 or later; see LICENSE.txtadmin@joomla.orgwww.joomla.org3.0.0PLG_FINDER_TAGS_XML_DESCRIPTIONscript.phptags.phpindex.htmllanguage/en-GB/en-GB.plg_finder_tags.inilanguage/en-GB/en-GB.plg_finder_tags.sys.iniPK Y[6 finder/tags/index.htmlnu W+A PK Y[`% % finder/tags/tags.phpnu W+A id;
}
elseif ($context == 'com_finder.index')
{
$id = $table->link_id;
}
else
{
return true;
}
// Remove the items.
return $this->remove($id);
}
/**
* Method to determine if the access level of an item changed.
*
* @param string $context The context of the content passed to the plugin.
* @param JTable $row A JTable object
* @param boolean $isNew If the content has just been created
*
* @return boolean True on success.
*
* @since 3.1
* @throws Exception on database error.
*/
public function onFinderAfterSave($context, $row, $isNew)
{
// We only want to handle tags here.
if ($context == 'com_tags.tag')
{
// Check if the access levels are different
if (!$isNew && $this->old_access != $row->access)
{
// Process the change.
$this->itemAccessChange($row);
}
// Reindex the item
$this->reindex($row->id);
}
return true;
}
/**
* Method to reindex the link information for an item that has been saved.
* This event is fired before the data is actually saved so we are going
* to queue the item to be indexed later.
*
* @param string $context The context of the content passed to the plugin.
* @param JTable $row A JTable object
* @param boolean $isNew If the content is just about to be created
*
* @return boolean True on success.
*
* @since 3.1
* @throws Exception on database error.
*/
public function onFinderBeforeSave($context, $row, $isNew)
{
// We only want to handle news feeds here
if ($context == 'com_tags.tag')
{
// Query the database for the old access level if the item isn't new
if (!$isNew)
{
$this->checkItemAccess($row);
}
}
return true;
}
/**
* Method to update the link information for items that have been changed
* from outside the edit screen. This is fired when the item is published,
* unpublished, archived, or unarchived from the list view.
*
* @param string $context The context for the content passed to the plugin.
* @param array $pks A list of primary key ids of the content that has changed state.
* @param integer $value The value of the state that the content has been changed to.
*
* @return void
*
* @since 3.1
*/
public function onFinderChangeState($context, $pks, $value)
{
// We only want to handle tags here
if ($context == 'com_tags.tag')
{
$this->itemStateChange($pks, $value);
}
// Handle when the plugin is disabled
if ($context == 'com_plugins.plugin' && $value === 0)
{
$this->pluginDisable($pks);
}
}
/**
* Method to index an item. The item must be a FinderIndexerResult object.
*
* @param FinderIndexerResult $item The item to index as an FinderIndexerResult object.
* @param string $format The item format
*
* @return void
*
* @since 3.1
* @throws Exception on database error.
*/
protected function index(FinderIndexerResult $item, $format = 'html')
{
// Check if the extension is enabled
if (JComponentHelper::isEnabled($this->extension) == false)
{
return;
}
$item->setLanguage();
// Initialize the item parameters.
$registry = new JRegistry;
$registry->loadString($item->params);
$item->params = JComponentHelper::getParams('com_tags', true);
$item->params->merge($registry);
$registry = new JRegistry;
$registry->loadString($item->metadata);
$item->metadata = $registry;
// Build the necessary route and path information.
$item->url = $this->getURL($item->id, $this->extension, $this->layout);
$item->route = TagsHelperRoute::getTagRoute($item->slug);
$item->path = FinderIndexerHelper::getContentPath($item->route);
// Get the menu title if it exists.
$title = $this->getItemMenuTitle($item->url);
// Adjust the title if necessary.
if (!empty($title) && $this->params->get('use_menu_title', true))
{
$item->title = $title;
}
// Add the meta-author.
$item->metaauthor = $item->metadata->get('author');
// Handle the link to the meta-data.
$item->addInstruction(FinderIndexer::META_CONTEXT, 'link');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metaauthor');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'created_by_alias');
// Add the type taxonomy data.
$item->addTaxonomy('Type', 'Tag');
// Add the author taxonomy data.
if (!empty($item->author) || !empty($item->created_by_alias))
{
$item->addTaxonomy('Author', !empty($item->created_by_alias) ? $item->created_by_alias : $item->author);
}
// Add the language taxonomy data.
$item->addTaxonomy('Language', $item->language);
// Index the item.
$this->indexer->index($item);
}
/**
* Method to setup the indexer to be run.
*
* @return boolean True on success.
*
* @since 3.1
*/
protected function setup()
{
// Load dependent classes.
require_once JPATH_SITE . '/components/com_tags/helpers/route.php';
return true;
}
/**
* Method to get the SQL query used to retrieve the list of content items.
*
* @param mixed $query A JDatabaseQuery object or null.
*
* @return JDatabaseQuery A database object.
*
* @since 3.1
*/
protected function getListQuery($query = null)
{
$db = JFactory::getDbo();
// Check if we can use the supplied SQL query.
$query = $query instanceof JDatabaseQuery ? $query : $db->getQuery(true)
->select('a.id, a.title, a.alias, a.description AS summary')
->select('a.created_time AS start_date, a.created_user_id AS created_by')
->select('a.metakey, a.metadesc, a.metadata, a.language, a.access')
->select('a.modified_time AS modified, a.modified_user_id AS modified_by')
->select('a.publish_up AS publish_start_date, a.publish_down AS publish_end_date')
->select('a.published AS state, a.access, a.created_time AS start_date, a.params');
// Handle the alias CASE WHEN portion of the query
$case_when_item_alias = ' CASE WHEN ';
$case_when_item_alias .= $query->charLength('a.alias', '!=', '0');
$case_when_item_alias .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when_item_alias .= $query->concatenate(array($a_id, 'a.alias'), ':');
$case_when_item_alias .= ' ELSE ';
$case_when_item_alias .= $a_id . ' END as slug';
$query->select($case_when_item_alias)
->from('#__tags AS a');
// Join the #__users table
$query->select('u.name AS author')
->join('LEFT', '#__users AS u ON u.id = b.created_user_id')
->from('#__tags AS b');
// Exclude the ROOT item
$query->where($db->quoteName('a.id') . ' > 1');
return $query;
}
/**
* Method to get a SQL query to load the published and access states for the given tag.
*
* @return JDatabaseQuery A database object.
*
* @since 3.1
*/
protected function getStateQuery()
{
$query = $this->db->getQuery(true);
$query->select($this->db->quoteName('a.id'))
->select($this->db->quoteName('a.' . $this->state_field, 'state') . ', ' . $this->db->quoteName('a.access'))
->select('NULL AS cat_state, NULL AS cat_access')
->from($this->db->quoteName($this->table, 'a'));
return $query;
}
/**
* Method to get the query clause for getting items to update by time.
*
* @param string $time The modified timestamp.
*
* @return JDatabaseQuery A database object.
*
* @since 3.1
*/
protected function getUpdateQueryByTime($time)
{
// Build an SQL query based on the modified time.
$query = $this->db->getQuery(true)
->where('a.date >= ' . $this->db->quote($time));
return $query;
}
}
PK Y[V finder/index.htmlnu W+A
PK Y[6 finder/categories/index.htmlnu W+A PK Y[%* * finder/categories/categories.phpnu W+A id;
}
elseif ($context == 'com_finder.index')
{
$id = $table->link_id;
}
else
{
return true;
}
// Remove item from the index.
return $this->remove($id);
}
/**
* Smart Search after save content method.
* Reindexes the link information for a category that has been saved.
* It also makes adjustments if the access level of the category has changed.
*
* @param string $context The context of the category passed to the plugin.
* @param JTable $row A JTable object.
* @param boolean $isNew True if the category has just been created.
*
* @return boolean True on success.
*
* @since 2.5
* @throws Exception on database error.
*/
public function onFinderAfterSave($context, $row, $isNew)
{
// We only want to handle categories here.
if ($context == 'com_categories.category')
{
// Check if the access levels are different.
if (!$isNew && $this->old_access != $row->access)
{
// Process the change.
$this->itemAccessChange($row);
// Reindex the category item.
$this->reindex($row->id);
}
// Check if the parent access level is different.
if (!$isNew && $this->old_cataccess != $row->access)
{
$this->categoryAccessChange($row);
}
}
return true;
}
/**
* Smart Search before content save method.
* This event is fired before the data is actually saved.
*
* @param string $context The context of the category passed to the plugin.
* @param JTable $row A JTable object.
* @param boolean $isNew True if the category is just about to be created.
*
* @return boolean True on success.
*
* @since 2.5
* @throws Exception on database error.
*/
public function onFinderBeforeSave($context, $row, $isNew)
{
// We only want to handle categories here.
if ($context == 'com_categories.category')
{
// Query the database for the old access level and the parent if the item isn't new.
if (!$isNew)
{
$this->checkItemAccess($row);
$this->checkCategoryAccess($row);
}
}
return true;
}
/**
* Method to update the link information for items that have been changed
* from outside the edit screen. This is fired when the item is published,
* unpublished, archived, or unarchived from the list view.
*
* @param string $context The context for the category passed to the plugin.
* @param array $pks An array of primary key ids of the category that has changed state.
* @param integer $value The value of the state that the category has been changed to.
*
* @return void
*
* @since 2.5
*/
public function onFinderChangeState($context, $pks, $value)
{
// We only want to handle categories here.
if ($context == 'com_categories.category')
{
/*
* The category published state is tied to the parent category
* published state so we need to look up all published states
* before we change anything.
*/
foreach ($pks as $pk)
{
/* TODO: The $item variable does not seem to be used at all
$query = clone($this->getStateQuery());
$query->where('a.id = ' . (int) $pk);
$this->db->setQuery($query);
$item = $this->db->loadObject();
*/
// Translate the state.
$state = null;
if ($item->parent_id != 1)
{
$state = $item->cat_state;
}
$temp = $this->translateState($value, $state);
// Update the item.
$this->change($pk, 'state', $temp);
// Reindex the item.
$this->reindex($pk);
}
}
// Handle when the plugin is disabled.
if ($context == 'com_plugins.plugin' && $value === 0)
{
$this->pluginDisable($pks);
}
}
/**
* Method to index an item. The item must be a FinderIndexerResult object.
*
* @param FinderIndexerResult $item The item to index as an FinderIndexerResult object.
* @param string $format The item format. Not used.
*
* @return void
*
* @since 2.5
* @throws Exception on database error.
*/
protected function index(FinderIndexerResult $item, $format = 'html')
{
// Check if the extension is enabled.
if (JComponentHelper::isEnabled($this->extension) == false)
{
return;
}
$item->setLanguage();
// Need to import component route helpers dynamically, hence the reason it's handled here.
$path = JPATH_SITE . '/components/' . $item->extension . '/helpers/route.php';
if (is_file($path))
{
include_once $path;
}
$extension = ucfirst(substr($item->extension, 4));
// Initialize the item parameters.
$registry = new JRegistry;
$registry->loadString($item->params);
$item->params = $registry;
$registry = new JRegistry;
$registry->loadString($item->metadata);
$item->metadata = $registry;
/*
* Add the meta-data processing instructions based on the category's
* configuration parameters.
*/
// Add the meta-author.
$item->metaauthor = $item->metadata->get('author');
// Handle the link to the meta-data.
$item->addInstruction(FinderIndexer::META_CONTEXT, 'link');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metaauthor');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
// Deactivated Methods
// $item->addInstruction(FinderIndexer::META_CONTEXT, 'created_by_alias');
// Trigger the onContentPrepare event.
$item->summary = FinderIndexerHelper::prepareContent($item->summary, $item->params);
// Build the necessary route and path information.
$item->url = $this->getURL($item->id, $item->extension, $this->layout);
$class = $extension . 'HelperRoute';
if (class_exists($class) && method_exists($class, 'getCategoryRoute'))
{
$item->route = $class::getCategoryRoute($item->id, $item->language);
}
else
{
$item->route = ContentHelperRoute::getCategoryRoute($item->slug, $item->catid);
}
$item->path = FinderIndexerHelper::getContentPath($item->route);
// Get the menu title if it exists.
$title = $this->getItemMenuTitle($item->url);
// Adjust the title if necessary.
if (!empty($title) && $this->params->get('use_menu_title', true))
{
$item->title = $title;
}
// Translate the state. Categories should only be published if the parent category is published.
$item->state = $this->translateState($item->state);
// Add the type taxonomy data.
$item->addTaxonomy('Type', 'Category');
// Add the language taxonomy data.
$item->addTaxonomy('Language', $item->language);
// Get content extras.
FinderIndexerHelper::getContentExtras($item);
// Index the item.
$this->indexer->index($item);
}
/**
* Method to setup the indexer to be run.
*
* @return boolean True on success.
*
* @since 2.5
*/
protected function setup()
{
// Load com_content route helper as it is the fallback for routing in the indexer in this instance.
include_once JPATH_SITE . '/components/com_content/helpers/route.php';
return true;
}
/**
* Method to get the SQL query used to retrieve the list of content items.
*
* @param mixed $query A JDatabaseQuery object or null.
*
* @return JDatabaseQuery A database object.
*
* @since 2.5
*/
protected function getListQuery($query = null)
{
$db = JFactory::getDbo();
// Check if we can use the supplied SQL query.
$query = $query instanceof JDatabaseQuery ? $query : $db->getQuery(true)
->select('a.id, a.title, a.alias, a.description AS summary, a.extension')
->select('a.created_user_id AS created_by, a.modified_time AS modified, a.modified_user_id AS modified_by')
->select('a.metakey, a.metadesc, a.metadata, a.language, a.lft, a.parent_id, a.level')
->select('a.created_time AS start_date, a.published AS state, a.access, a.params');
// Handle the alias CASE WHEN portion of the query.
$case_when_item_alias = ' CASE WHEN ';
$case_when_item_alias .= $query->charLength('a.alias', '!=', '0');
$case_when_item_alias .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when_item_alias .= $query->concatenate(array($a_id, 'a.alias'), ':');
$case_when_item_alias .= ' ELSE ';
$case_when_item_alias .= $a_id . ' END as slug';
$query->select($case_when_item_alias)
->from('#__categories AS a')
->where($db->quoteName('a.id') . ' > 1');
return $query;
}
/**
* Method to get a SQL query to load the published and access states for
* a category and its parents.
*
* @return JDatabaseQuery A database object.
*
* @since 2.5
*/
protected function getStateQuery()
{
$query = $this->db->getQuery(true)
->select($this->db->quoteName('a.id'))
->select('a.' . $this->state_field . ' AS state, c.published AS cat_state')
->select('a.access, c.access AS cat_access')
->from($this->db->quoteName('#__categories') . ' AS a')
->join('LEFT', '#__categories AS c ON c.id = a.parent_id');
return $query;
}
}
PK Y['j finder/categories/categories.xmlnu W+A
plg_finder_categoriesJoomla! ProjectAugust 2011(C) 2005 - 2014 Open Source Matters. All rights reserved.GNU General Public License version 2 or later; see LICENSE.txtadmin@joomla.orgwww.joomla.org3.0.0PLG_FINDER_CATEGORIES_XML_DESCRIPTIONscript.phpcategories.phpindex.htmllanguage/en-GB/en-GB.plg_finder_categories.inilanguage/en-GB/en-GB.plg_finder_categories.sys.ini
PK Y[6 finder/newsfeeds/index.htmlnu W+A PK Y[^b( ( finder/newsfeeds/newsfeeds.phpnu W+A categoryStateChange($pks, $value);
}
}
/**
* Method to remove the link information for items that have been deleted.
*
* @param string $context The context of the action being performed.
* @param JTable $table A JTable object containing the record to be deleted.
*
* @return boolean True on success.
*
* @since 2.5
* @throws Exception on database error.
*/
public function onFinderAfterDelete($context, $table)
{
if ($context == 'com_newsfeeds.newsfeed')
{
$id = $table->id;
}
elseif ($context == 'com_finder.index')
{
$id = $table->link_id;
}
else
{
return true;
}
// Remove the item from the index.
return $this->remove($id);
}
/**
* Smart Search after save content method.
* Reindexes the link information for a newsfeed that has been saved.
* It also makes adjustments if the access level of a newsfeed item or
* the category to which it belongs has beend changed.
*
* @param string $context The context of the content passed to the plugin.
* @param JTable $row A JTable object.
* @param boolean $isNew True if the content has just been created.
*
* @return boolean True on success.
*
* @since 2.5
* @throws Exception on database error.
*/
public function onFinderAfterSave($context, $row, $isNew)
{
// We only want to handle newsfeeds here.
if ($context == 'com_newsfeeds.newsfeed')
{
// Check if the access levels are different.
if (!$isNew && $this->old_access != $row->access)
{
// Process the change.
$this->itemAccessChange($row);
}
// Reindex the item.
$this->reindex($row->id);
}
// Check for access changes in the category.
if ($context == 'com_categories.category')
{
// Check if the access levels are different.
if (!$isNew && $this->old_cataccess != $row->access)
{
$this->categoryAccessChange($row);
}
}
return true;
}
/**
* Smart Search before content save method.
* This event is fired before the data is actually saved.
*
* @param string $context The context of the content passed to the plugin.
* @param JTable $row A JTable object.
* @param boolean $isNew True if the content is just about to be created.
*
* @return boolean True on success.
*
* @since 2.5
* @throws Exception on database error.
*/
public function onFinderBeforeSave($context, $row, $isNew)
{
// We only want to handle newsfeeds here.
if ($context == 'com_newsfeeds.newsfeed')
{
// Query the database for the old access level if the item isn't new.
if (!$isNew)
{
$this->checkItemAccess($row);
}
}
// Check for access levels from the category.
if ($context == 'com_categories.category')
{
// Query the database for the old access level if the item isn't new.
if (!$isNew)
{
$this->checkCategoryAccess($row);
}
}
return true;
}
/**
* Method to update the link information for items that have been changed
* from outside the edit screen. This is fired when the item is published,
* unpublished, archived, or unarchived from the list view.
*
* @param string $context The context for the content passed to the plugin.
* @param array $pks An array of primary key ids of the content that has changed state.
* @param integer $value The value of the state that the content has been changed to.
*
* @return void
*
* @since 2.5
*/
public function onFinderChangeState($context, $pks, $value)
{
// We only want to handle newsfeeds here.
if ($context == 'com_newsfeeds.newsfeed')
{
$this->itemStateChange($pks, $value);
}
// Handle when the plugin is disabled.
if ($context == 'com_plugins.plugin' && $value === 0)
{
$this->pluginDisable($pks);
}
}
/**
* Method to index an item. The item must be a FinderIndexerResult object.
*
* @param FinderIndexerResult $item The item to index as an FinderIndexerResult object.
* @param string $format The item format. Not used.
*
* @return void
*
* @since 2.5
* @throws Exception on database error.
*/
protected function index(FinderIndexerResult $item, $format = 'html')
{
// Check if the extension is enabled.
if (JComponentHelper::isEnabled($this->extension) == false)
{
return;
}
$item->setLanguage();
// Initialize the item parameters.
$registry = new JRegistry;
$registry->loadString($item->params);
$item->params = $registry;
$registry = new JRegistry;
$registry->loadString($item->metadata);
$item->metadata = $registry;
// Build the necessary route and path information.
$item->url = $this->getURL($item->id, $this->extension, $this->layout);
$item->route = NewsfeedsHelperRoute::getNewsfeedRoute($item->slug, $item->catslug, $item->language);
$item->path = FinderIndexerHelper::getContentPath($item->route);
/*
* Add the meta-data processing instructions based on the newsfeeds
* configuration parameters.
*/
// Add the meta-author.
$item->metaauthor = $item->metadata->get('author');
// Handle the link to the meta-data.
$item->addInstruction(FinderIndexer::META_CONTEXT, 'link');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metaauthor');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'created_by_alias');
// Add the type taxonomy data.
$item->addTaxonomy('Type', 'News Feed');
// Add the category taxonomy data.
$item->addTaxonomy('Category', $item->category, $item->cat_state, $item->cat_access);
// Add the language taxonomy data.
$item->addTaxonomy('Language', $item->language);
// Get content extras.
FinderIndexerHelper::getContentExtras($item);
// Index the item.
$this->indexer->index($item);
}
/**
* Method to setup the indexer to be run.
*
* @return boolean True on success.
*
* @since 2.5
*/
protected function setup()
{
// Load dependent classes.
require_once JPATH_SITE . '/components/com_newsfeeds/helpers/route.php';
return true;
}
/**
* Method to get the SQL query used to retrieve the list of content items.
*
* @param mixed $query A JDatabaseQuery object or null.
*
* @return JDatabaseQuery A database object.
*
* @since 2.5
*/
protected function getListQuery($query = null)
{
$db = JFactory::getDbo();
// Check if we can use the supplied SQL query.
$query = $query instanceof JDatabaseQuery ? $query : $db->getQuery(true)
->select('a.id, a.catid, a.name AS title, a.alias, a.link AS link')
->select('a.published AS state, a.ordering, a.created AS start_date, a.params, a.access')
->select('a.publish_up AS publish_start_date, a.publish_down AS publish_end_date')
->select('a.metakey, a.metadesc, a.metadata, a.language')
->select('a.created_by, a.created_by_alias, a.modified, a.modified_by')
->select('c.title AS category, c.published AS cat_state, c.access AS cat_access');
// Handle the alias CASE WHEN portion of the query.
$case_when_item_alias = ' CASE WHEN ';
$case_when_item_alias .= $query->charLength('a.alias', '!=', '0');
$case_when_item_alias .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when_item_alias .= $query->concatenate(array($a_id, 'a.alias'), ':');
$case_when_item_alias .= ' ELSE ';
$case_when_item_alias .= $a_id . ' END as slug';
$query->select($case_when_item_alias);
$case_when_category_alias = ' CASE WHEN ';
$case_when_category_alias .= $query->charLength('c.alias', '!=', '0');
$case_when_category_alias .= ' THEN ';
$c_id = $query->castAsChar('c.id');
$case_when_category_alias .= $query->concatenate(array($c_id, 'c.alias'), ':');
$case_when_category_alias .= ' ELSE ';
$case_when_category_alias .= $c_id . ' END as catslug';
$query->select($case_when_category_alias)
->from('#__newsfeeds AS a')
->join('LEFT', '#__categories AS c ON c.id = a.catid');
return $query;
}
}
PK Y[ finder/newsfeeds/newsfeeds.xmlnu W+A
plg_finder_newsfeedsJoomla! ProjectAugust 2011(C) 2005 - 2014 Open Source Matters. All rights reserved.GNU General Public License version 2 or later; see LICENSE.txtadmin@joomla.orgwww.joomla.org3.0.0PLG_FINDER_NEWSFEEDS_XML_DESCRIPTIONscript.phpnewsfeeds.phpindex.htmllanguage/en-GB/en-GB.plg_finder_newsfeeds.inilanguage/en-GB/en-GB.plg_finder_newsfeeds.sys.ini
PK Y[Уȉ ( finder/zoosmartsearch/zoosmartsearch.phpnu W+A enabled) {
return;
}
require_once(JPATH_ADMINISTRATOR.'/components/com_zoo/config.php');
// Get the ZOO App instance
$this->app = App::getInstance('zoo');
parent::__construct($subject, $config);
// load zoo frontend language file
$this->app->system->language->load('com_zoo');
}
protected function index(FinderIndexerResult $item, $format = 'html') {
// Check if the extension is enabled
if (JComponentHelper::isEnabled($this->extension) == false || !$item->id) {
return;
}
if (!$zoo_item = $this->app->table->item->get($item->id, true)) {
return;
}
$registry = new JRegistry;
$registry->loadArray($zoo_item->getParams()->get("metadata."));
$item->metadata = $registry;
$item->metaauthor = $zoo_item->getParams()->get("metadata.author");
$item->addInstruction(FinderIndexer::META_CONTEXT, 'link');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metaauthor');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'created_by_alias');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'element_data');
$item->summary = $this->renderer->render('item.default', array('item' => $zoo_item));
$item->url = $this->getURL($item->id, $this->extension, $this->layout);
$item->route = $this->app->route->item($zoo_item, false);
$item->path = FinderIndexerHelper::getContentPath($item->route);
$item->state = ($zoo_item->searchable == 1) && ($zoo_item->state == 1);
$item->element_data = $this->app->database->queryResultArray('SELECT value FROM '.ZOO_TABLE_SEARCH.' WHERE item_id = '.(int) $item->id);
$item->addTaxonomy('Type', $zoo_item->getType()->name);
foreach ($zoo_item->getRelatedCategories(true) as $category) {
$item->addTaxonomy('Category', $category->name);
}
foreach ($zoo_item->getTags() as $tag) {
$item->addTaxonomy('Tag', $tag);
}
FinderIndexerHelper::getContentExtras($item);
if ($this->app->joomla->version->isCompatible('3.0')) {
$this->indexer->index($item);
} else {
FinderIndexer::index($item);
}
}
protected function setup() {
// workaround to make sure JSite is loaded
$this->app->loader->register('JSite', 'root:includes/application.php');
$this->renderer = $this->app->renderer->create('item')->addPath(array($this->app->path->path('component.site:'), $this->app->path->path('plugins:finder/zoosmartsearch/')));
return true;
}
protected function getListQuery($sql = null) {
$db = JFactory::getDbo();
$sql = is_a($sql, 'JDatabaseQuery') ? $sql : $db->getQuery(true);
$sql->select('a.id, a.name AS title, a.alias');
$sql->select('a.created_by_alias, a.modified, a.modified_by');
$sql->select('a.publish_up AS publish_start_date, a.publish_down AS publish_end_date');
$sql->select('a.access, a.state, a.searchable');
$sql->from("$this->table AS a");
return $sql;
}
protected function getStateQuery() {
$sql = $this->db->getQuery(true);
$sql->select('a.id, a.state, a.access, a.searchable');
$sql->from($this->table . ' AS a');
return $sql;
}
public function onFinderAfterSave($context, $row) {
if ($context == $this->app->component->self->name.'.item') {
$this->reindex($row->id);
}
return true;
}
public function onFinderAfterDelete($context, $table) {
if ($context == $this->app->component->self->name.'.item') {
$id = $table->id;
} elseif ($context == 'com_finder.index') {
$id = $table->link_id;
} else {
return true;
}
return $this->remove((int) $id);
}
public function registerZOOEvents() {
if ($this->app) {
$this->app->event->dispatcher->connect('type:assignelements', array($this, 'assignElements'));
}
}
public function assignElements() {
$this->app->system->application->enqueueMessage(JText::_('Only text based elements are allowed in the search layouts'), 'notice');
}
}
PK Y[̮n n % finder/zoosmartsearch/file.script.phpnu W+A filesystem->readDirectoryFiles($parent->getParent()->getPath('source'), $parent->getParent()->getPath('source').'/', '/(positions\.(config|xml)|metadata\.xml)$/', true) as $file) {
JFile::delete($file);
}
}
}
public function postflight($type, $parent) {}
}PK Y[6 finder/zoosmartsearch/index.htmlnu W+A PK Y[6 ) finder/zoosmartsearch/renderer/index.htmlnu W+A PK Y[Rs 0 finder/zoosmartsearch/renderer/item/metadata.xmlnu W+A
DefaultAn item is rendered with the default layout in all default module themes.PK Y[N~N N / finder/zoosmartsearch/renderer/item/default.phpnu W+A renderPosition('description');PK Y[? 1 finder/zoosmartsearch/renderer/item/positions.xmlnu W+A
DescriptionPK Y[6 . finder/zoosmartsearch/renderer/item/index.htmlnu W+A PK Y[ 4 finder/zoosmartsearch/renderer/item/positions.confignu W+A {
"blog.article.default": {
"description": {
"0": {
"showlabel": "0",
"altlabel": "",
"separated_by": "separator=[ ]",
"element": "08795744-c2dc-4a68-8252-4e21c4c4c774"
},
"1": {
"showlabel": "0",
"altlabel": "",
"separated_by": "tag=[
%s<\/div>]",
"display": "all",
"element": "a552a157-ce11-4b11-ad34-5de19e065d53"
}
}
},
"product.product.default": {
"description": {
"0": {
"showlabel": "0",
"altlabel": "",
"date_format": "%A, %d %B %Y",
"custom_format": "",
"separated_by": "separator=[ ]",
"element": "667ea4d6-3745-40b5-b2a2-41fdc13b9a47"
}
}
}
}PK Y[*w ( finder/zoosmartsearch/zoosmartsearch.xmlnu W+A
Smart Search - ZOOYOOthemeFebuary 2012Copyright (C) YOOtheme GmbHhttp://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 onlyYOOtheme Proprietary Use License (http://www.yootheme.com/license)info@yootheme.comhttp://www.yootheme.com2.5.0Smart Search plugin for ZOO developed by YOOtheme (http://www.yootheme.com)zoosmartsearch.phpindex.htmlfile.script.phprendererfile.script.php
PK Y[ur) ) finder/weblinks/weblinks.phpnu W+A categoryStateChange($pks, $value);
}
}
/**
* Method to remove the link information for items that have been deleted.
*
* @param string $context The context of the action being performed.
* @param JTable $table A JTable object containing the record to be deleted.
*
* @return boolean True on success.
*
* @since 2.5
* @throws Exception on database error.
*/
public function onFinderAfterDelete($context, $table)
{
if ($context == 'com_weblinks.weblink')
{
$id = $table->id;
}
elseif ($context == 'com_finder.index')
{
$id = $table->link_id;
}
else
{
return true;
}
// Remove the item from the index.
return $this->remove($id);
}
/**
* Smart Search after content save method.
* Reindexes the link information for a weblink that has been saved.
* It also makes adjustments if the access level of a weblink item or
* the category to which it belongs has been changed.
*
* @param string $context The context of the content passed to the plugin.
* @param JTable $row A JTable object.
* @param boolean $isNew True if the content has just been created.
*
* @return boolean True on success.
*
* @since 2.5
* @throws Exception on database error.
*/
public function onFinderAfterSave($context, $row, $isNew)
{
// We only want to handle web links here. We need to handle front end and back end editing.
if ($context == 'com_weblinks.weblink' || $context == 'com_weblinks.form' )
{
// Check if the access levels are different.
if (!$isNew && $this->old_access != $row->access)
{
// Process the change.
$this->itemAccessChange($row);
}
// Reindex the item.
$this->reindex($row->id);
}
// Check for access changes in the category.
if ($context == 'com_categories.category')
{
// Check if the access levels are different.
if (!$isNew && $this->old_cataccess != $row->access)
{
$this->categoryAccessChange($row);
}
}
return true;
}
/**
* Smart Search before content save method.
* This event is fired before the data is actually saved.
*
* @param string $context The context of the content passed to the plugin.
* @param JTable $row A JTable object.
* @param boolean $isNew True if the content is just about to be created.
*
* @return boolean True on success.
*
* @since 2.5
* @throws Exception on database error.
*/
public function onFinderBeforeSave($context, $row, $isNew)
{
// We only want to handle web links here.
if ($context == 'com_weblinks.weblink' || $context == 'com_weblinks.form')
{
// Query the database for the old access level if the item isn't new.
if (!$isNew)
{
$this->checkItemAccess($row);
}
}
// Check for access levels from the category.
if ($context == 'com_categories.category')
{
// Query the database for the old access level if the item isn't new.
if (!$isNew)
{
$this->checkCategoryAccess($row);
}
}
return true;
}
/**
* Method to update the link information for items that have been changed
* from outside the edit screen. This is fired when the item is published,
* unpublished, archived, or unarchived from the list view.
*
* @param string $context The context for the content passed to the plugin.
* @param array $pks An array of primary key ids of the content that has changed state.
* @param integer $value The value of the state that the content has been changed to.
*
* @return void
*
* @since 2.5
*/
public function onFinderChangeState($context, $pks, $value)
{
// We only want to handle web links here.
if ($context == 'com_weblinks.weblink' || $context == 'com_weblinks.form')
{
$this->itemStateChange($pks, $value);
}
// Handle when the plugin is disabled.
if ($context == 'com_plugins.plugin' && $value === 0)
{
$this->pluginDisable($pks);
}
}
/**
* Method to index an item. The item must be a FinderIndexerResult object.
*
* @param FinderIndexerResult $item The item to index as an FinderIndexerResult object.
* @param string $format The item format. Not used.
*
* @return void
*
* @since 2.5
* @throws Exception on database error.
*/
protected function index(FinderIndexerResult $item, $format = 'html')
{
// Check if the extension is enabled
if (JComponentHelper::isEnabled($this->extension) == false)
{
return;
}
$item->setLanguage();
// Initialise the item parameters.
$registry = new JRegistry;
$registry->loadString($item->params);
$item->params = $registry;
$registry = new JRegistry;
$registry->loadString($item->metadata);
$item->metadata = $registry;
// Build the necessary route and path information.
$item->url = $this->getURL($item->id, $this->extension, $this->layout);
$item->route = WeblinksHelperRoute::getWeblinkRoute($item->slug, $item->catslug, $item->language);
$item->path = FinderIndexerHelper::getContentPath($item->route);
/*
* Add the meta-data processing instructions based on the newsfeeds
* configuration parameters.
*/
// Add the meta-author.
$item->metaauthor = $item->metadata->get('author');
// Handle the link to the meta-data.
$item->addInstruction(FinderIndexer::META_CONTEXT, 'link');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metaauthor');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'created_by_alias');
// Add the type taxonomy data.
$item->addTaxonomy('Type', 'Web Link');
// Add the category taxonomy data.
$item->addTaxonomy('Category', $item->category, $item->cat_state, $item->cat_access);
// Add the language taxonomy data.
$item->addTaxonomy('Language', $item->language);
// Get content extras.
FinderIndexerHelper::getContentExtras($item);
// Index the item.
$this->indexer->index($item);
}
/**
* Method to setup the indexer to be run.
*
* @return boolean True on success.
*
* @since 2.5
*/
protected function setup()
{
// Load dependent classes.
require_once JPATH_SITE . '/components/com_weblinks/helpers/route.php';
return true;
}
/**
* Method to get the SQL query used to retrieve the list of content items.
*
* @param mixed $query A JDatabaseQuery object or null.
*
* @return JDatabaseQuery A database object.
*
* @since 2.5
*/
protected function getListQuery($query = null)
{
$db = JFactory::getDbo();
// Check if we can use the supplied SQL query.
$query = $query instanceof JDatabaseQuery ? $query : $db->getQuery(true)
->select('a.id, a.catid, a.title, a.alias, a.url AS link, a.description AS summary')
->select('a.metakey, a.metadesc, a.metadata, a.language, a.access, a.ordering')
->select('a.created_by_alias, a.modified, a.modified_by')
->select('a.publish_up AS publish_start_date, a.publish_down AS publish_end_date')
->select('a.state AS state, a.created AS start_date, a.params')
->select('c.title AS category, c.published AS cat_state, c.access AS cat_access');
// Handle the alias CASE WHEN portion of the query.
$case_when_item_alias = ' CASE WHEN ';
$case_when_item_alias .= $query->charLength('a.alias', '!=', '0');
$case_when_item_alias .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when_item_alias .= $query->concatenate(array($a_id, 'a.alias'), ':');
$case_when_item_alias .= ' ELSE ';
$case_when_item_alias .= $a_id . ' END as slug';
$query->select($case_when_item_alias);
$case_when_category_alias = ' CASE WHEN ';
$case_when_category_alias .= $query->charLength('c.alias', '!=', '0');
$case_when_category_alias .= ' THEN ';
$c_id = $query->castAsChar('c.id');
$case_when_category_alias .= $query->concatenate(array($c_id, 'c.alias'), ':');
$case_when_category_alias .= ' ELSE ';
$case_when_category_alias .= $c_id . ' END as catslug';
$query->select($case_when_category_alias)
->from('#__weblinks AS a')
->join('LEFT', '#__categories AS c ON c.id = a.catid');
return $query;
}
/**
* Method to get the query clause for getting items to update by time.
*
* @param string $time The modified timestamp.
*
* @return JDatabaseQuery A database object.
*
* @since 2.5
*/
protected function getUpdateQueryByTime($time)
{
// Build an SQL query based on the modified time.
$query = $this->db->getQuery(true)
->where('a.date >= ' . $this->db->quote($time));
return $query;
}
}
PK Y[6 finder/weblinks/index.htmlnu W+A PK Y[)Bǯ finder/weblinks/weblinks.xmlnu W+A
plg_finder_weblinksJoomla! ProjectAugust 2011(C) 2005 - 2014 Open Source Matters. All rights reserved.GNU General Public License version 2 or later; see LICENSE.txtadmin@joomla.orgwww.joomla.org3.0.0PLG_FINDER_WEBLINKS_XML_DESCRIPTIONscript.phpweblinks.phpindex.htmllanguage/en-GB/en-GB.plg_finder_weblinks.inilanguage/en-GB/en-GB.plg_finder_weblinks.sys.ini
PK Y[6 finder/content/index.htmlnu W+A PK Y[v finder/content/content.xmlnu W+A
plg_finder_contentJoomla! ProjectAugust 2011(C) 2005 - 2014 Open Source Matters. All rights reserved.GNU General Public License version 2 or later; see LICENSE.txtadmin@joomla.orgwww.joomla.org3.0.0PLG_FINDER_CONTENT_XML_DESCRIPTIONscript.phpcontent.phpindex.htmllanguage/en-GB/en-GB.plg_finder_content.inilanguage/en-GB/en-GB.plg_finder_content.sys.ini
PK Y[˗%* * finder/content/content.phpnu W+A categoryStateChange($pks, $value);
}
}
/**
* Method to remove the link information for items that have been deleted.
*
* @param string $context The context of the action being performed.
* @param JTable $table A JTable object containing the record to be deleted
*
* @return boolean True on success.
*
* @since 2.5
* @throws Exception on database error.
*/
public function onFinderAfterDelete($context, $table)
{
if ($context == 'com_content.article')
{
$id = $table->id;
}
elseif ($context == 'com_finder.index')
{
$id = $table->link_id;
}
else
{
return true;
}
// Remove item from the index.
return $this->remove($id);
}
/**
* Smart Search after save content method.
* Reindexes the link information for an article that has been saved.
* It also makes adjustments if the access level of an item or the
* category to which it belongs has changed.
*
* @param string $context The context of the content passed to the plugin.
* @param JTable $row A JTable object.
* @param boolean $isNew True if the content has just been created.
*
* @return boolean True on success.
*
* @since 2.5
* @throws Exception on database error.
*/
public function onFinderAfterSave($context, $row, $isNew)
{
// We only want to handle articles here.
if ($context == 'com_content.article' || $context == 'com_content.form')
{
// Check if the access levels are different.
if (!$isNew && $this->old_access != $row->access)
{
// Process the change.
$this->itemAccessChange($row);
}
// Reindex the item.
$this->reindex($row->id);
}
// Check for access changes in the category.
if ($context == 'com_categories.category')
{
// Check if the access levels are different.
if (!$isNew && $this->old_cataccess != $row->access)
{
$this->categoryAccessChange($row);
}
}
return true;
}
/**
* Smart Search before content save method.
* This event is fired before the data is actually saved.
*
* @param string $context The context of the content passed to the plugin.
* @param JTable $row A JTable object.
* @param boolean $isNew If the content is just about to be created.
*
* @return boolean True on success.
*
* @since 2.5
* @throws Exception on database error.
*/
public function onFinderBeforeSave($context, $row, $isNew)
{
// We only want to handle articles here.
if ($context == 'com_content.article' || $context == 'com_content.form')
{
// Query the database for the old access level if the item isn't new.
if (!$isNew)
{
$this->checkItemAccess($row);
}
}
// Check for access levels from the category.
if ($context == 'com_categories.category')
{
// Query the database for the old access level if the item isn't new.
if (!$isNew)
{
$this->checkCategoryAccess($row);
}
}
return true;
}
/**
* Method to update the link information for items that have been changed
* from outside the edit screen. This is fired when the item is published,
* unpublished, archived, or unarchived from the list view.
*
* @param string $context The context for the content passed to the plugin.
* @param array $pks An array of primary key ids of the content that has changed state.
* @param integer $value The value of the state that the content has been changed to.
*
* @return void
*
* @since 2.5
*/
public function onFinderChangeState($context, $pks, $value)
{
// We only want to handle articles here.
if ($context == 'com_content.article' || $context == 'com_content.form')
{
$this->itemStateChange($pks, $value);
}
// Handle when the plugin is disabled.
if ($context == 'com_plugins.plugin' && $value === 0)
{
$this->pluginDisable($pks);
}
}
/**
* Method to index an item. The item must be a FinderIndexerResult object.
*
* @param FinderIndexerResult $item The item to index as an FinderIndexerResult object.
* @param string $format The item format. Not used.
*
* @return void
*
* @since 2.5
* @throws Exception on database error.
*/
protected function index(FinderIndexerResult $item, $format = 'html')
{
$item->setLanguage();
// Check if the extension is enabled.
if (JComponentHelper::isEnabled($this->extension) == false)
{
return;
}
// Initialise the item parameters.
$registry = new JRegistry;
$registry->loadString($item->params);
$item->params = JComponentHelper::getParams('com_content', true);
$item->params->merge($registry);
$registry = new JRegistry;
$registry->loadString($item->metadata);
$item->metadata = $registry;
// Trigger the onContentPrepare event.
$item->summary = FinderIndexerHelper::prepareContent($item->summary, $item->params);
$item->body = FinderIndexerHelper::prepareContent($item->body, $item->params);
// Build the necessary route and path information.
$item->url = $this->getURL($item->id, $this->extension, $this->layout);
$item->route = ContentHelperRoute::getArticleRoute($item->slug, $item->catslug, $item->language);
$item->path = FinderIndexerHelper::getContentPath($item->route);
// Get the menu title if it exists.
$title = $this->getItemMenuTitle($item->url);
// Adjust the title if necessary.
if (!empty($title) && $this->params->get('use_menu_title', true))
{
$item->title = $title;
}
// Add the meta-author.
$item->metaauthor = $item->metadata->get('author');
// Add the meta-data processing instructions.
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metaauthor');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'created_by_alias');
// Translate the state. Articles should only be published if the category is published.
$item->state = $this->translateState($item->state, $item->cat_state);
// Add the type taxonomy data.
$item->addTaxonomy('Type', 'Article');
// Add the author taxonomy data.
if (!empty($item->author) || !empty($item->created_by_alias))
{
$item->addTaxonomy('Author', !empty($item->created_by_alias) ? $item->created_by_alias : $item->author);
}
// Add the category taxonomy data.
$item->addTaxonomy('Category', $item->category, $item->cat_state, $item->cat_access);
// Add the language taxonomy data.
$item->addTaxonomy('Language', $item->language);
// Get content extras.
FinderIndexerHelper::getContentExtras($item);
// Index the item.
$this->indexer->index($item);
}
/**
* Method to setup the indexer to be run.
*
* @return boolean True on success.
*
* @since 2.5
*/
protected function setup()
{
// Load dependent classes.
include_once JPATH_SITE . '/components/com_content/helpers/route.php';
return true;
}
/**
* Method to get the SQL query used to retrieve the list of content items.
*
* @param mixed $query A JDatabaseQuery object or null.
*
* @return JDatabaseQuery A database object.
*
* @since 2.5
*/
protected function getListQuery($query = null)
{
$db = JFactory::getDbo();
// Check if we can use the supplied SQL query.
$query = $query instanceof JDatabaseQuery ? $query : $db->getQuery(true)
->select('a.id, a.title, a.alias, a.introtext AS summary, a.fulltext AS body')
->select('a.state, a.catid, a.created AS start_date, a.created_by')
->select('a.created_by_alias, a.modified, a.modified_by, a.attribs AS params')
->select('a.metakey, a.metadesc, a.metadata, a.language, a.access, a.version, a.ordering')
->select('a.publish_up AS publish_start_date, a.publish_down AS publish_end_date')
->select('c.title AS category, c.published AS cat_state, c.access AS cat_access');
// Handle the alias CASE WHEN portion of the query
$case_when_item_alias = ' CASE WHEN ';
$case_when_item_alias .= $query->charLength('a.alias', '!=', '0');
$case_when_item_alias .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when_item_alias .= $query->concatenate(array($a_id, 'a.alias'), ':');
$case_when_item_alias .= ' ELSE ';
$case_when_item_alias .= $a_id . ' END as slug';
$query->select($case_when_item_alias);
$case_when_category_alias = ' CASE WHEN ';
$case_when_category_alias .= $query->charLength('c.alias', '!=', '0');
$case_when_category_alias .= ' THEN ';
$c_id = $query->castAsChar('c.id');
$case_when_category_alias .= $query->concatenate(array($c_id, 'c.alias'), ':');
$case_when_category_alias .= ' ELSE ';
$case_when_category_alias .= $c_id . ' END as catslug';
$query->select($case_when_category_alias)
->select('u.name AS author')
->from('#__content AS a')
->join('LEFT', '#__categories AS c ON c.id = a.catid')
->join('LEFT', '#__users AS u ON u.id = a.created_by');
return $query;
}
}
PK Y[V user/profile/profiles/index.htmlnu W+A
PK Y[]Z
! user/profile/profiles/profile.xmlnu W+A
PK Y[V user/profile/index.htmlnu W+A
PK Y[SCb
b
user/profile/fields/tos.phpnu W+A hidden)
{
return $label;
}
// Get the label text from the XML element, defaulting to the element name.
$text = $this->element['label'] ? (string) $this->element['label'] : (string) $this->element['name'];
$text = $this->translateLabel ? JText::_($text) : $text;
// Set required to true as this field is not displayed at all if not required.
$this->required = true;
// Add CSS and JS for the TOS field
$doc = JFactory::getDocument();
$css = "#jform_profile_tos {width: 18em; margin: 0 !important; padding: 0 2px !important;}
#jform_profile_tos input {margin:0 5px 0 0 !important; width:10px !important;}
#jform_profile_tos label {margin:0 15px 0 0 !important; width:auto;}
";
$doc->addStyleDeclaration($css);
JHtml::_('behavior.modal');
// Build the class for the label.
$class = !empty($this->description) ? 'hasTip' : '';
$class = $class . ' required';
$class = !empty($this->labelClass) ? $class . ' ' . $this->labelClass : $class;
// Add the opening label tag and main attributes attributes.
$label .= '';
return $label;
}
}
PK Y[V user/profile/fields/index.htmlnu W+A
PK Y[=оc) c) user/profile/profile.phpnu W+A id) ? $data->id : 0;
if (!isset($data->profile) and $userId > 0)
{
// Load the profile data from the database.
$db = JFactory::getDbo();
$db->setQuery(
'SELECT profile_key, profile_value FROM #__user_profiles' .
' WHERE user_id = ' . (int) $userId . " AND profile_key LIKE 'profile.%'" .
' ORDER BY ordering'
);
try
{
$results = $db->loadRowList();
}
catch (RuntimeException $e)
{
$this->_subject->setError($e->getMessage());
return false;
}
// Merge the profile data.
$data->profile = array();
foreach ($results as $v)
{
$k = str_replace('profile.', '', $v[0]);
$data->profile[$k] = json_decode($v[1], true);
if ($data->profile[$k] === null)
{
$data->profile[$k] = $v[1];
}
}
}
if (!JHtml::isRegistered('users.url'))
{
JHtml::register('users.url', array(__CLASS__, 'url'));
}
if (!JHtml::isRegistered('users.calendar'))
{
JHtml::register('users.calendar', array(__CLASS__, 'calendar'));
}
if (!JHtml::isRegistered('users.tos'))
{
JHtml::register('users.tos', array(__CLASS__, 'tos'));
}
}
return true;
}
public static function url($value)
{
if (empty($value))
{
return JHtml::_('users.value', $value);
}
else
{
// Convert website url to utf8 for display
$value = JStringPunycode::urlToUTF8(htmlspecialchars($value));
if (substr($value, 0, 4) == "http")
{
return '' . $value . '';
}
else
{
return '' . $value . '';
}
}
}
public static function calendar($value)
{
if (empty($value))
{
return JHtml::_('users.value', $value);
}
else
{
return JHtml::_('date', $value, null, null);
}
}
public static function tos($value)
{
if ($value)
{
return JText::_('JYES');
}
else
{
return JText::_('JNO');
}
}
/**
* @param JForm $form The form to be altered.
* @param array $data The associated data for the form.
*
* @return boolean
* @since 1.6
*/
public function onContentPrepareForm($form, $data)
{
if (!($form instanceof JForm))
{
$this->_subject->setError('JERROR_NOT_A_FORM');
return false;
}
// Check we are manipulating a valid form.
$name = $form->getName();
if (!in_array($name, array('com_admin.profile', 'com_users.user', 'com_users.profile', 'com_users.registration')))
{
return true;
}
// Add the registration fields to the form.
JForm::addFormPath(__DIR__ . '/profiles');
$form->loadFile('profile', false);
$fields = array(
'address1',
'address2',
'city',
'region',
'country',
'postal_code',
'phone',
'website',
'favoritebook',
'aboutme',
'dob',
'tos',
);
//Change fields description when displayed in front-end
$app = JFactory::getApplication();
if ($app->isSite())
{
$form->setFieldAttribute('address1', 'description', 'PLG_USER_PROFILE_FILL_FIELD_DESC_SITE', 'profile');
$form->setFieldAttribute('address2', 'description', 'PLG_USER_PROFILE_FILL_FIELD_DESC_SITE', 'profile');
$form->setFieldAttribute('city', 'description', 'PLG_USER_PROFILE_FILL_FIELD_DESC_SITE', 'profile');
$form->setFieldAttribute('region', 'description', 'PLG_USER_PROFILE_FILL_FIELD_DESC_SITE', 'profile');
$form->setFieldAttribute('country', 'description', 'PLG_USER_PROFILE_FILL_FIELD_DESC_SITE', 'profile');
$form->setFieldAttribute('postal_code', 'description', 'PLG_USER_PROFILE_FILL_FIELD_DESC_SITE', 'profile');
$form->setFieldAttribute('phone', 'description', 'PLG_USER_PROFILE_FILL_FIELD_DESC_SITE', 'profile');
$form->setFieldAttribute('website', 'description', 'PLG_USER_PROFILE_FILL_FIELD_DESC_SITE', 'profile');
$form->setFieldAttribute('favoritebook', 'description', 'PLG_USER_PROFILE_FILL_FIELD_DESC_SITE', 'profile');
$form->setFieldAttribute('aboutme', 'description', 'PLG_USER_PROFILE_FILL_FIELD_DESC_SITE', 'profile');
$form->setFieldAttribute('dob', 'description', 'PLG_USER_PROFILE_FILL_FIELD_DESC_SITE', 'profile');
$form->setFieldAttribute('tos', 'description', 'PLG_USER_PROFILE_FIELD_TOS_DESC_SITE', 'profile');
}
$tosarticle = $this->params->get('register_tos_article');
$tosenabled = $this->params->get('register-require_tos', 0);
// We need to be in the registration form, field needs to be enabled and we need an article ID
if ($name != 'com_users.registration' || !$tosenabled || !$tosarticle)
{
// We only want the TOS in the registration form
$form->removeField('tos', 'profile');
}
else
{
// Push the TOS article ID into the TOS field.
$form->setFieldAttribute('tos', 'article', $tosarticle, 'profile');
}
foreach ($fields as $field)
{
// Case using the users manager in admin
if ($name == 'com_users.user')
{
// Remove the field if it is disabled in registration and profile
if ($this->params->get('register-require_' . $field, 1) == 0
&& $this->params->get('profile-require_' . $field, 1) == 0
)
{
$form->removeField($field, 'profile');
}
}
// Case registration
elseif ($name == 'com_users.registration')
{
// Toggle whether the field is required.
if ($this->params->get('register-require_' . $field, 1) > 0)
{
$form->setFieldAttribute($field, 'required', ($this->params->get('register-require_' . $field) == 2) ? 'required' : '', 'profile');
}
else
{
$form->removeField($field, 'profile');
}
if ($this->params->get('register-require_dob', 1) > 0)
{
$form->setFieldAttribute('spacer', 'type', 'spacer', 'profile');
}
}
// Case profile in site or admin
elseif ($name == 'com_users.profile' || $name == 'com_admin.profile')
{
// Toggle whether the field is required.
if ($this->params->get('profile-require_' . $field, 1) > 0)
{
$form->setFieldAttribute($field, 'required', ($this->params->get('profile-require_' . $field) == 2) ? 'required' : '', 'profile');
}
else
{
$form->removeField($field, 'profile');
}
if ($this->params->get('profile-require_dob', 1) > 0)
{
$form->setFieldAttribute('spacer', 'type', 'spacer', 'profile');
}
}
}
return true;
}
/**
* Method is called before user data is stored in the database
*
* @param array $user Holds the old user data.
* @param boolean $isnew True if a new user is stored.
* @param array $data Holds the new user data.
*
* @return boolean
*
* @since 3.1
* @throws InvalidArgumentException on invalid date.
*/
public function onUserBeforeSave($user, $isnew, $data)
{
// Check that the date is valid.
if (!empty($data['profile']['dob']))
{
try
{
// Convert website url to punycode
$data['profile']['website'] = JStringPunycode::urlToPunycode($data['profile']['website']);
$date = new JDate($data['profile']['dob']);
$this->_date = $date->format('Y-m-d');
}
catch (Exception $e)
{
// Throw an exception if date is not valid.
throw new InvalidArgumentException(JText::_('PLG_USER_PROFILE_ERROR_INVALID_DOB'));
}
}
return true;
}
public function onUserAfterSave($data, $isNew, $result, $error)
{
$userId = JArrayHelper::getValue($data, 'id', 0, 'int');
if ($userId && $result && isset($data['profile']) && (count($data['profile'])))
{
try
{
// Sanitize the date
$data['profile']['dob'] = $this->_date;
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->delete($db->quoteName('#__user_profiles'))
->where($db->quoteName('user_id') . ' = ' . (int) $userId)
->where($db->quoteName('profile_key') . ' LIKE ' . $db->quote('profile.%'));
$db->setQuery($query);
$db->execute();
$tuples = array();
$order = 1;
foreach ($data['profile'] as $k => $v)
{
$tuples[] = '(' . $userId . ', ' . $db->quote('profile.' . $k) . ', ' . $db->quote(json_encode($v)) . ', ' . $order++ . ')';
}
$db->setQuery('INSERT INTO #__user_profiles VALUES ' . implode(', ', $tuples));
$db->execute();
}
catch (RuntimeException $e)
{
$this->_subject->setError($e->getMessage());
return false;
}
}
return true;
}
/**
* Remove all user profile information for the given user ID
*
* Method is called after user data is deleted from the database
*
* @param array $user Holds the user data
* @param boolean $success True if user was succesfully stored in the database
* @param string $msg Message
*
* @return boolean
*/
public function onUserAfterDelete($user, $success, $msg)
{
if (!$success)
{
return false;
}
$userId = JArrayHelper::getValue($user, 'id', 0, 'int');
if ($userId)
{
try
{
$db = JFactory::getDbo();
$db->setQuery(
'DELETE FROM #__user_profiles WHERE user_id = ' . $userId .
" AND profile_key LIKE 'profile.%'"
);
$db->execute();
}
catch (Exception $e)
{
$this->_subject->setError($e->getMessage());
return false;
}
}
return true;
}
}
PK Y[a" " user/profile/profile.xmlnu W+A
plg_user_profileJoomla! ProjectJanuary 2008(C) 2005 - 2014 Open Source Matters. All rights reserved.GNU General Public License version 2 or later; see LICENSE.txtadmin@joomla.orgwww.joomla.org3.0.0PLG_USER_PROFILE_XML_DESCRIPTIONprofile.phpindex.htmlprofilesen-GB.plg_user_profile.inien-GB.plg_user_profile.sys.ini
PK Y[
4 user/joomla/joomla.phpnu W+A db->getQuery(true)
->delete($this->db->quoteName('#__session'))
->where($this->db->quoteName('userid') . ' = ' . (int) $user['id']);
$this->db->setQuery($query)->execute();
return true;
}
/**
* Utility method to act on a user after it has been saved.
*
* This method sends a registration email to new users created in the backend.
*
* @param array $user Holds the new user data.
* @param boolean $isnew True if a new user is stored.
* @param boolean $success True if user was succesfully stored in the database.
* @param string $msg Message.
*
* @return void
*
* @since 1.6
*/
public function onUserAfterSave($user, $isnew, $success, $msg)
{
$mail_to_user = $this->params->get('mail_to_user', 1);
if ($isnew)
{
// TODO: Suck in the frontend registration emails here as well. Job for a rainy day.
if ($this->app->isAdmin())
{
if ($mail_to_user)
{
$lang = JFactory::getLanguage();
$defaultLocale = $lang->getTag();
/**
* Look for user language. Priority:
* 1. User frontend language
* 2. User backend language
*/
$userParams = new JRegistry($user['params']);
$userLocale = $userParams->get('language', $userParams->get('admin_language', $defaultLocale));
if ($userLocale != $defaultLocale)
{
$lang->setLanguage($userLocale);
}
$lang->load('plg_user_joomla', JPATH_ADMINISTRATOR);
// Compute the mail subject.
$emailSubject = JText::sprintf(
'PLG_USER_JOOMLA_NEW_USER_EMAIL_SUBJECT',
$user['name'],
$config = $this->app->get('sitename')
);
// Compute the mail body.
$emailBody = JText::sprintf(
'PLG_USER_JOOMLA_NEW_USER_EMAIL_BODY',
$user['name'],
$this->app->get('sitename'),
JUri::root(),
$user['username'],
$user['password_clear']
);
// Assemble the email data...the sexy way!
$mail = JFactory::getMailer()
->setSender(
array(
$this->app->get('mailfrom'),
$this->app->get('fromname')
)
)
->addRecipient($user['email'])
->setSubject($emailSubject)
->setBody($emailBody);
// Set application language back to default if we changed it
if ($userLocale != $defaultLocale)
{
$lang->setLanguage($defaultLocale);
}
if (!$mail->Send())
{
$this->app->enqueueMessage(JText::_('JERROR_SENDING_EMAIL'), 'warning');
}
}
}
}
else
{
// Existing user - nothing to do...yet.
}
}
/**
* This method should handle any login logic and report back to the subject
*
* @param array $user Holds the user data
* @param array $options Array holding options (remember, autoregister, group)
*
* @return boolean True on success
*
* @since 1.5
*/
public function onUserLogin($user, $options = array())
{
$instance = $this->_getUser($user, $options);
// If _getUser returned an error, then pass it back.
if ($instance instanceof Exception)
{
return false;
}
// If the user is blocked, redirect with an error
if ($instance->get('block') == 1)
{
$this->app->enqueueMessage(JText::_('JERROR_NOLOGIN_BLOCKED'), 'warning');
return false;
}
// Authorise the user based on the group information
if (!isset($options['group']))
{
$options['group'] = 'USERS';
}
// Check the user can login.
$result = $instance->authorise($options['action']);
if (!$result)
{
$this->app->enqueueMessage(JText::_('JERROR_LOGIN_DENIED'), 'warning');
return false;
}
// Mark the user as logged in
$instance->set('guest', 0);
// Register the needed session variables
$session = JFactory::getSession();
$session->set('user', $instance);
// Check to see the the session already exists.
$this->app->checkSession();
// Update the user related fields for the Joomla sessions table.
$query = $this->db->getQuery(true)
->update($this->db->quoteName('#__session'))
->set($this->db->quoteName('guest') . ' = ' . $this->db->quote($instance->guest))
->set($this->db->quoteName('username') . ' = ' . $this->db->quote($instance->username))
->set($this->db->quoteName('userid') . ' = ' . (int) $instance->id)
->where($this->db->quoteName('session_id') . ' = ' . $this->db->quote($session->getId()));
$this->db->setQuery($query)->execute();
// Hit the user last visit field
$instance->setLastVisit();
return true;
}
/**
* This method should handle any logout logic and report back to the subject
*
* @param array $user Holds the user data.
* @param array $options Array holding options (client, ...).
*
* @return object True on success
*
* @since 1.5
*/
public function onUserLogout($user, $options = array())
{
$my = JFactory::getUser();
$session = JFactory::getSession();
// Make sure we're a valid user first
if ($user['id'] == 0 && !$my->get('tmp_user'))
{
return true;
}
// Check to see if we're deleting the current session
if ($my->get('id') == $user['id'] && $options['clientid'] == $this->app->getClientId())
{
// Hit the user last visit field
$my->setLastVisit();
// Destroy the php session for this user
$session->destroy();
}
// Force logout all users with that userid
$query = $this->db->getQuery(true)
->delete($this->db->quoteName('#__session'))
->where($this->db->quoteName('userid') . ' = ' . (int) $user['id'])
->where($this->db->quoteName('client_id') . ' = ' . (int) $options['clientid']);
$this->db->setQuery($query)->execute();
return true;
}
/**
* This method will return a user object
*
* If options['autoregister'] is true, if the user doesn't exist yet he will be created
*
* @param array $user Holds the user data.
* @param array $options Array holding options (remember, autoregister, group).
*
* @return object A JUser object
*
* @since 1.5
*/
protected function _getUser($user, $options = array())
{
$instance = JUser::getInstance();
$id = (int) JUserHelper::getUserId($user['username']);
if ($id)
{
$instance->load($id);
return $instance;
}
// TODO : move this out of the plugin
$config = JComponentHelper::getParams('com_users');
// Hard coded default to match the default value from com_users.
$defaultUserGroup = $config->get('new_usertype', 2);
$instance->set('id', 0);
$instance->set('name', $user['fullname']);
$instance->set('username', $user['username']);
$instance->set('password_clear', $user['password_clear']);
// Result should contain an email (check).
$instance->set('email', $user['email']);
$instance->set('groups', array($defaultUserGroup));
// If autoregister is set let's register the user
$autoregister = isset($options['autoregister']) ? $options['autoregister'] : $this->params->get('autoregister', 1);
if ($autoregister)
{
if (!$instance->save())
{
JLog::add('Error in autoregistration for user ' . $user['username'] . '.', JLog::WARNING, 'error');
}
}
else
{
// No existing user and autoregister off, this is a temporary user.
$instance->set('tmp_user', true);
}
return $instance;
}
}
PK Y[V user/joomla/index.htmlnu W+A
PK Y[^L user/joomla/joomla.xmlnu W+A
plg_user_joomlaJoomla! ProjectDecember 2006(C) 2005 - 2009 Open Source Matters. All rights reserved.GNU General Public License version 2 or later; see LICENSE.txtadmin@joomla.orgwww.joomla.org3.0.0PLG_USER_JOOMLA_XML_DESCRIPTIONjoomla.phpindex.htmlpostinstallen-GB.plg_user_joomla.inien-GB.plg_user_joomla.sys.ini
PK Y[V user/index.htmlnu W+A
PK Y[w~V V &