Файловый менеджер - Редактировать - /home/lmsyaran/public_html/pusher/com_content.zip
Назад
PK �E�[-T3�� � js/admin-article-pagebreak.jsnu �[��� /** * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ (function() { "use strict"; window.insertPagebreak = function(editor) { /** Get the pagebreak title **/ var alt, tag, title = document.getElementById('title').value; if (!window.parent.Joomla.getOptions('xtd-pagebreak')) { // Something went wrong! window.parent.jModalClose(); return false; } /** Get the pagebreak toc alias -- not inserting for now **/ /** don't know which attribute to use... **/ alt = document.getElementById('alt').value; title = (title != '') ? 'title="' + title + '"' : ''; alt = (alt != '') ? 'alt="' + alt + '"' : ''; tag = '<hr class="system-pagebreak" ' + title + ' ' + alt + '/>'; /** Use the API, if editor supports it **/ if (window.parent.Joomla && window.parent.Joomla.editors && window.parent.Joomla.editors.instances && window.parent.Joomla.editors.instances.hasOwnProperty(editor)) { window.parent.Joomla.editors.instances[editor].replaceSelection(tag) } else { window.parent.jInsertEditorText(tag, editor); } window.parent.jModalClose(); return false; }; })(); PK �E�[�h�mm m ! js/admin-article-pagebreak.min.jsnu �[��� !function(){"use strict";window.insertPagebreak=function(a){var b,c,d=document.getElementById("title").value;return window.parent.Joomla.getOptions("xtd-pagebreak")?(b=document.getElementById("alt").value,d=""!=d?'title="'+d+'"':"",b=""!=b?'alt="'+b+'"':"",c='<hr class="system-pagebreak" '+d+" "+b+"/>",window.parent.Joomla&&window.parent.Joomla.editors&&window.parent.Joomla.editors.instances&&window.parent.Joomla.editors.instances.hasOwnProperty(a)?window.parent.Joomla.editors.instances[a].replaceSelection(c):window.parent.jInsertEditorText(c,a),window.parent.jModalClose(),!1):(window.parent.jModalClose(),!1)}}();PK �E�[���Ts s js/admin-article-readmore.jsnu �[��� /** * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ window.insertReadmore = function(editor) { "use strict"; if (!Joomla.getOptions('xtd-readmore')) { // Something went wrong! return false; } var content, options = window.Joomla.getOptions('xtd-readmore'); if (window.Joomla && window.Joomla.editors && window.Joomla.editors.instances && window.Joomla.editors.instances.hasOwnProperty(editor)) { content = window.Joomla.editors.instances[editor].getValue(); } else { content = (new Function('return ' + options.editor))(); } if (content.match(/<hr\s+id=("|')system-readmore("|')\s*\/*>/i)) { alert(options.exists); return false; } else { /** Use the API, if editor supports it **/ if (window.Joomla && window.Joomla.editors && window.Joomla.editors.instances && window.Joomla.editors.instances.hasOwnProperty(editor)) { window.Joomla.editors.instances[editor].replaceSelection('<hr id="system-readmore" />'); } else { window.jInsertEditorText('<hr id="system-readmore" />', editor); } } }; PK �E�[_(zZ� � js/admin-article-readmore.min.jsnu �[��� window.insertReadmore=function(a){"use strict";if(!Joomla.getOptions("xtd-readmore"))return!1;var b,c=window.Joomla.getOptions("xtd-readmore");if(b=window.Joomla&&window.Joomla.editors&&window.Joomla.editors.instances&&window.Joomla.editors.instances.hasOwnProperty(a)?window.Joomla.editors.instances[a].getValue():new Function("return "+c.editor)(),b.match(/<hr\s+id=("|')system-readmore("|')\s*\/*>/i))return alert(c.exists),!1;window.Joomla&&window.Joomla.editors&&window.Joomla.editors.instances&&window.Joomla.editors.instances.hasOwnProperty(a)?window.Joomla.editors.instances[a].replaceSelection('<hr id="system-readmore" />'):window.jInsertEditorText('<hr id="system-readmore" />',a)};PK �E�[�Ƽ{� � js/admin-articles-modal.jsnu �[��� /** * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ (function() { "use strict"; /** * Javascript to insert the link * View element calls jSelectArticle when an article is clicked * jSelectArticle creates the link tag, sends it to the editor, * and closes the select frame. **/ window.jSelectArticle = function (id, title, catid, object, link, lang) { var hreflang = '', editor, tag; if (!Joomla.getOptions('xtd-articles')) { // Something went wrong! window.parent.jModalClose(); return false; } editor = Joomla.getOptions('xtd-articles').editor; if (lang !== '') { hreflang = ' hreflang="' + lang + '"'; } tag = '<a' + hreflang + ' href="' + link + '">' + title + '</a>'; /** Use the API, if editor supports it **/ if (window.parent.Joomla && window.parent.Joomla.editors && window.parent.Joomla.editors.instances && window.parent.Joomla.editors.instances.hasOwnProperty(editor)) { window.parent.Joomla.editors.instances[editor].replaceSelection(tag) } else { window.parent.jInsertEditorText(tag, editor); } window.parent.jModalClose(); }; document.addEventListener('DOMContentLoaded', function(){ // Get the elements var elements = document.querySelectorAll('.select-link'); for(var i = 0, l = elements.length; l>i; i++) { // Listen for click event elements[i].addEventListener('click', function (event) { event.preventDefault(); var functionName = event.target.getAttribute('data-function'); if (functionName === 'jSelectArticle') { // Used in xtd_contacts window[functionName](event.target.getAttribute('data-id'), event.target.getAttribute('data-title'), event.target.getAttribute('data-cat-id'), null, event.target.getAttribute('data-uri'), event.target.getAttribute('data-language')); } else { // Used in com_menus window.parent[functionName](event.target.getAttribute('data-id'), event.target.getAttribute('data-title'), event.target.getAttribute('data-cat-id'), null, event.target.getAttribute('data-uri'), event.target.getAttribute('data-language')); } }) } }); })(); PK �E�[��� � js/admin-articles-modal.min.jsnu �[��� !function(){"use strict";window.jSelectArticle=function(a,b,c,d,e,f){var h,i,g="";return Joomla.getOptions("xtd-articles")?(h=Joomla.getOptions("xtd-articles").editor,""!==f&&(g=' hreflang="'+f+'"'),i="<a"+g+' href="'+e+'">'+b+"</a>",window.parent.Joomla&&window.parent.Joomla.editors&&window.parent.Joomla.editors.instances&&window.parent.Joomla.editors.instances.hasOwnProperty(h)?window.parent.Joomla.editors.instances[h].replaceSelection(i):window.parent.jInsertEditorText(i,h),void window.parent.jModalClose()):(window.parent.jModalClose(),!1)},document.addEventListener("DOMContentLoaded",function(){for(var a=document.querySelectorAll(".select-link"),b=0,c=a.length;c>b;b++)a[b].addEventListener("click",function(a){a.preventDefault();var b=a.target.getAttribute("data-function");"jSelectArticle"===b?window[b](a.target.getAttribute("data-id"),a.target.getAttribute("data-title"),a.target.getAttribute("data-cat-id"),null,a.target.getAttribute("data-uri"),a.target.getAttribute("data-language")):window.parent[b](a.target.getAttribute("data-id"),a.target.getAttribute("data-title"),a.target.getAttribute("data-cat-id"),null,a.target.getAttribute("data-uri"),a.target.getAttribute("data-language"))})})}();PK Y��[��N-? ? access.xmlnu �[��� <?xml version="1.0" encoding="utf-8" ?> <access component="com_content"> <section name="component"> <action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" /> <action name="core.options" title="JACTION_OPTIONS" description="JACTION_OPTIONS_COMPONENT_DESC" /> <action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" /> <action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_COMPONENT_DESC" /> <action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_COMPONENT_DESC" /> <action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_COMPONENT_DESC" /> <action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_EDITSTATE_COMPONENT_DESC" /> <action name="core.edit.own" title="JACTION_EDITOWN" description="JACTION_EDITOWN_COMPONENT_DESC" /> <action name="core.edit.value" title="JACTION_EDITVALUE" description="JACTION_EDITVALUE_COMPONENT_DESC" /> </section> <section name="category"> <action name="core.create" title="JACTION_CREATE" description="COM_CATEGORIES_ACCESS_CREATE_DESC" /> <action name="core.delete" title="JACTION_DELETE" description="COM_CATEGORIES_ACCESS_DELETE_DESC" /> <action name="core.edit" title="JACTION_EDIT" description="COM_CATEGORIES_ACCESS_EDIT_DESC" /> <action name="core.edit.state" title="JACTION_EDITSTATE" description="COM_CATEGORIES_ACCESS_EDITSTATE_DESC" /> <action name="core.edit.own" title="JACTION_EDITOWN" description="COM_CATEGORIES_ACCESS_EDITOWN_DESC" /> </section> <section name="article"> <action name="core.delete" title="JACTION_DELETE" description="COM_CONTENT_ACCESS_DELETE_DESC" /> <action name="core.edit" title="JACTION_EDIT" description="COM_CONTENT_ACCESS_EDIT_DESC" /> <action name="core.edit.state" title="JACTION_EDITSTATE" description="COM_CONTENT_ACCESS_EDITSTATE_DESC" /> </section> <section name="fieldgroup"> <action name="core.create" title="JACTION_CREATE" description="COM_FIELDS_GROUP_PERMISSION_CREATE_DESC" /> <action name="core.delete" title="JACTION_DELETE" description="COM_FIELDS_GROUP_PERMISSION_DELETE_DESC" /> <action name="core.edit" title="JACTION_EDIT" description="COM_FIELDS_GROUP_PERMISSION_EDIT_DESC" /> <action name="core.edit.state" title="JACTION_EDITSTATE" description="COM_FIELDS_GROUP_PERMISSION_EDITSTATE_DESC" /> <action name="core.edit.own" title="JACTION_EDITOWN" description="COM_FIELDS_GROUP_PERMISSION_EDITOWN_DESC" /> <action name="core.edit.value" title="JACTION_EDITVALUE" description="COM_FIELDS_GROUP_PERMISSION_EDITVALUE_DESC" /> </section> <section name="field"> <action name="core.delete" title="JACTION_DELETE" description="COM_FIELDS_FIELD_PERMISSION_DELETE_DESC" /> <action name="core.edit" title="JACTION_EDIT" description="COM_FIELDS_FIELD_PERMISSION_EDIT_DESC" /> <action name="core.edit.state" title="JACTION_EDITSTATE" description="COM_FIELDS_FIELD_PERMISSION_EDITSTATE_DESC" /> <action name="core.edit.value" title="JACTION_EDITVALUE" description="COM_FIELDS_FIELD_PERMISSION_EDITVALUE_DESC" /> </section> </access> PK Y��[jd��o �o config.xmlnu �[��� <?xml version="1.0" encoding="utf-8"?> <config> <fieldset name="articles" label="JGLOBAL_ARTICLES" description="COM_CONTENT_CONFIG_ARTICLE_SETTINGS_DESC" > <field name="article_layout" type="componentlayout" label="JGLOBAL_FIELD_LAYOUT_LABEL" description="JGLOBAL_FIELD_LAYOUT_DESC" menuitems="true" extension="com_content" view="article" /> <field name="show_title" type="radio" label="JGLOBAL_SHOW_TITLE_LABEL" description="JGLOBAL_SHOW_TITLE_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="link_titles" type="radio" label="JGLOBAL_LINKED_TITLES_LABEL" description="JGLOBAL_LINKED_TITLES_DESC" class="btn-group btn-group-yesno" default="1" showon="show_title:1" > <option value="1">JYES</option> <option value="0">JNO</option> </field> <field name="show_intro" type="radio" label="JGLOBAL_SHOW_INTRO_LABEL" description="JGLOBAL_SHOW_INTRO_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="info_block_position" type="list" label="COM_CONTENT_FIELD_INFOBLOCK_POSITION_LABEL" description="COM_CONTENT_FIELD_INFOBLOCK_POSITION_DESC" default="0" > <option value="0">COM_CONTENT_FIELD_OPTION_ABOVE</option> <option value="1">COM_CONTENT_FIELD_OPTION_BELOW</option> <option value="2">COM_CONTENT_FIELD_OPTION_SPLIT</option> </field> <field name="info_block_show_title" type="radio" label="COM_CONTENT_FIELD_INFOBLOCK_TITLE_LABEL" description="COM_CONTENT_FIELD_INFOBLOCK_TITLE_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="show_category" type="radio" label="JGLOBAL_SHOW_CATEGORY_LABEL" description="JGLOBAL_SHOW_CATEGORY_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="link_category" type="radio" label="JGLOBAL_LINK_CATEGORY_LABEL" description="JGLOBAL_LINK_CATEGORY_DESC" class="btn-group btn-group-yesno" default="1" showon="show_category:1" > <option value="1">JYES</option> <option value="0">JNO</option> </field> <field name="show_parent_category" type="radio" label="JGLOBAL_SHOW_PARENT_CATEGORY_LABEL" description="JGLOBAL_SHOW_PARENT_CATEGORY_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="link_parent_category" type="radio" label="JGLOBAL_LINK_PARENT_CATEGORY_LABEL" description="JGLOBAL_LINK_PARENT_CATEGORY_DESC" class="btn-group btn-group-yesno" default="1" showon="show_parent_category:1" > <option value="1">JYES</option> <option value="0">JNO</option> </field> <field name="spacer1" type="spacer" hr="true" /> <field name="show_associations" type="radio" label="JGLOBAL_SHOW_ASSOCIATIONS_LABEL" description="JGLOBAL_SHOW_ASSOCIATIONS_DESC" class="btn-group btn-group-yesno" default="0" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="flags" type="radio" label="JGLOBAL_SHOW_FLAG_LABEL" description="JGLOBAL_SHOW_FLAG_DESC" class="btn-group btn-group-yesno" default="1" showon="show_associations:1" > <option value="1">JYES</option> <option value="0">JNO</option> </field> <field name="spacer3" type="spacer" hr="true" /> <field name="show_author" type="radio" label="JGLOBAL_SHOW_AUTHOR_LABEL" description="JGLOBAL_SHOW_AUTHOR_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="link_author" type="radio" label="JGLOBAL_LINK_AUTHOR_LABEL" description="JGLOBAL_LINK_AUTHOR_DESC" class="btn-group btn-group-yesno" default="0" showon="show_author:1" > <option value="1">JYES</option> <option value="0">JNO</option> </field> <field name="show_create_date" type="radio" label="JGLOBAL_SHOW_CREATE_DATE_LABEL" description="JGLOBAL_SHOW_CREATE_DATE_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="show_modify_date" type="radio" label="JGLOBAL_SHOW_MODIFY_DATE_LABEL" description="JGLOBAL_SHOW_MODIFY_DATE_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="show_publish_date" type="radio" label="JGLOBAL_SHOW_PUBLISH_DATE_LABEL" description="JGLOBAL_SHOW_PUBLISH_DATE_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="show_item_navigation" type="radio" label="JGLOBAL_SHOW_NAVIGATION_LABEL" description="JGLOBAL_SHOW_NAVIGATION_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="show_vote" type="radio" label="JGLOBAL_SHOW_VOTE_LABEL" description="JGLOBAL_SHOW_VOTE_DESC" class="btn-group btn-group-yesno" default="0" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="show_readmore" type="radio" label="JGLOBAL_SHOW_READMORE_LABEL" description="JGLOBAL_SHOW_READMORE_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="show_readmore_title" type="radio" label="JGLOBAL_SHOW_READMORE_TITLE_LABEL" description="JGLOBAL_SHOW_READMORE_TITLE_DESC" class="btn-group btn-group-yesno" default="1" showon="show_readmore:1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="readmore_limit" type="number" label="JGLOBAL_SHOW_READMORE_LIMIT_LABEL" description="JGLOBAL_SHOW_READMORE_LIMIT_DESC" default="100" showon="show_readmore:1[AND]show_readmore_title:1" /> <field name="show_tags" type="radio" label="COM_CONTENT_FIELD_SHOW_TAGS_LABEL" description="COM_CONTENT_FIELD_SHOW_TAGS_DESC" id="show_tags" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="spacer2" type="spacer" hr="true" /> <field name="show_icons" type="radio" label="JGLOBAL_SHOW_ICONS_LABEL" description="JGLOBAL_SHOW_ICONS_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="show_print_icon" type="radio" label="JGLOBAL_SHOW_PRINT_ICON_LABEL" description="JGLOBAL_SHOW_PRINT_ICON_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="show_email_icon" type="radio" label="JGLOBAL_SHOW_EMAIL_ICON_LABEL" description="JGLOBAL_SHOW_EMAIL_ICON_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="show_hits" type="radio" label="JGLOBAL_SHOW_HITS_LABEL" description="JGLOBAL_SHOW_HITS_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="record_hits" type="radio" label="JGLOBAL_RECORD_HITS_LABEL" description="JGLOBAL_RECORD_HITS_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JYES</option> <option value="0">JNO</option> </field> <field name="show_noauth" type="radio" label="JGLOBAL_SHOW_UNAUTH_LINKS_LABEL" description="JGLOBAL_SHOW_UNAUTH_LINKS_DESC" class="btn-group btn-group-yesno" default="0" > <option value="1">JYES</option> <option value="0">JNO</option> </field> <field name="urls_position" type="radio" label="COM_CONTENT_FIELD_URLSPOSITION_LABEL" description="COM_CONTENT_FIELD_URLSPOSITION_DESC" class="btn-group btn-group-yesno" default="0" > <option value="0">COM_CONTENT_FIELD_OPTION_ABOVE</option> <option value="1">COM_CONTENT_FIELD_OPTION_BELOW</option> </field> </fieldset> <fieldset name="editinglayout" label="COM_CONTENT_EDITING_LAYOUT" description="COM_CONTENT_CONFIG_EDITOR_LAYOUT" > <field name="captcha" type="plugins" label="COM_CONTENT_FIELD_CAPTCHA_LABEL" description="COM_CONTENT_FIELD_CAPTCHA_DESC" folder="captcha" filter="cmd" useglobal="true" > <option value="0">JOPTION_DO_NOT_USE</option> </field> <field name="show_publishing_options" type="radio" label="COM_CONTENT_SHOW_PUBLISHING_OPTIONS_LABEL" description="COM_CONTENT_SHOW_PUBLISHING_OPTIONS_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="show_article_options" type="radio" label="COM_CONTENT_SHOW_ARTICLE_OPTIONS_LABEL" description="COM_CONTENT_SHOW_ARTICLE_OPTIONS_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="save_history" type="radio" label="JGLOBAL_SAVE_HISTORY_OPTIONS_LABEL" description="JGLOBAL_SAVE_HISTORY_OPTIONS_DESC" class="btn-group btn-group-yesno" default="0" > <option value="1">JYES</option> <option value="0">JNO</option> </field> <field name="history_limit" type="number" label="JGLOBAL_HISTORY_LIMIT_OPTIONS_LABEL" description="JGLOBAL_HISTORY_LIMIT_OPTIONS_DESC" filter="integer" default="10" showon="save_history:1" /> <field name="show_urls_images_frontend" type="radio" label="COM_CONTENT_SHOW_IMAGES_URLS_FRONT_LABEL" description="COM_CONTENT_SHOW_IMAGES_URLS_FRONT_DESC" class="btn-group btn-group-yesno" default="0" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="show_urls_images_backend" type="radio" label="COM_CONTENT_SHOW_IMAGES_URLS_BACK_LABEL" description="COM_CONTENT_SHOW_IMAGES_URLS_BACK_DESC" class="btn-group btn-group-yesno" default="0" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="spacer3" type="spacer" hr="true" showon="show_urls_images_backend:1[OR]show_urls_images_frontend:1" /> <field name="targeta" type="list" label="COM_CONTENT_URL_FIELD_A_BROWSERNAV_LABEL" description="COM_CONTENT_URL_FIELD_BROWSERNAV_DESC" default="Parent" filter="int" showon="show_urls_images_backend:1[OR]show_urls_images_frontend:1" > <option value="0">JBROWSERTARGET_PARENT</option> <option value="1">JBROWSERTARGET_NEW</option> <option value="2">JBROWSERTARGET_POPUP</option> <option value="3">JBROWSERTARGET_MODAL</option> </field> <field name="targetb" type="list" label="COM_CONTENT_URL_FIELD_B_BROWSERNAV_LABEL" description="COM_CONTENT_URL_FIELD_BROWSERNAV_DESC" default="Parent" filter="int" showon="show_urls_images_backend:1[OR]show_urls_images_frontend:1" > <option value="0">JBROWSERTARGET_PARENT</option> <option value="1">JBROWSERTARGET_NEW</option> <option value="2">JBROWSERTARGET_POPUP</option> <option value="3">JBROWSERTARGET_MODAL</option> </field> <field name="targetc" type="list" label="COM_CONTENT_URL_FIELD_C_BROWSERNAV_LABEL" description="COM_CONTENT_URL_FIELD_BROWSERNAV_DESC" default="Parent" filter="int" showon="show_urls_images_backend:1[OR]show_urls_images_frontend:1" > <option value="0">JBROWSERTARGET_PARENT</option> <option value="1">JBROWSERTARGET_NEW</option> <option value="2">JBROWSERTARGET_POPUP</option> <option value="3">JBROWSERTARGET_MODAL</option> </field> <field name="spacer4" type="spacer" hr="true" showon="show_urls_images_backend:1[OR]show_urls_images_frontend:1" /> <field name="float_intro" type="list" label="COM_CONTENT_FLOAT_INTRO_LABEL" description="COM_CONTENT_FLOAT_DESC" showon="show_urls_images_backend:1[OR]show_urls_images_frontend:1" > <option value="right">COM_CONTENT_RIGHT</option> <option value="left">COM_CONTENT_LEFT</option> <option value="none">COM_CONTENT_NONE</option> </field> <field name="float_fulltext" type="list" label="COM_CONTENT_FLOAT_FULLTEXT_LABEL" description="COM_CONTENT_FLOAT_DESC" showon="show_urls_images_backend:1[OR]show_urls_images_frontend:1" > <option value="right">COM_CONTENT_RIGHT</option> <option value="left">COM_CONTENT_LEFT</option> <option value="none">COM_CONTENT_NONE</option> </field> </fieldset> <fieldset name="category" label="JCATEGORY" description="COM_CONTENT_CONFIG_CATEGORY_SETTINGS_DESC" > <field name="category_layout" type="componentlayout" label="JGLOBAL_FIELD_LAYOUT_LABEL" description="JGLOBAL_FIELD_LAYOUT_DESC" menuitems="true" extension="com_content" view="category" /> <field name="show_category_heading_title_text" type="radio" label="JGLOBAL_SHOW_CATEGORY_HEADING_TITLE_TEXT_LABEL" description="JGLOBAL_SHOW_CATEGORY_HEADING_TITLE_TEXT_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="show_category_title" type="radio" label="JGLOBAL_SHOW_CATEGORY_TITLE" description="JGLOBAL_SHOW_CATEGORY_TITLE_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="show_description" type="radio" label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL" description="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="show_description_image" type="radio" label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL" description="JGLOBAL_SHOW_CATEGORY_IMAGE_DESC" class="btn-group btn-group-yesno" default="0" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="maxLevel" type="list" label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL" description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC" default="-1" > <option value="0">JNONE</option> <option value="-1">JALL</option> <option value="1">J1</option> <option value="2">J2</option> <option value="3">J3</option> <option value="4">J4</option> <option value="5">J5</option> </field> <field name="show_empty_categories" type="radio" label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL" description="COM_CONTENT_SHOW_EMPTY_CATEGORIES_DESC" class="btn-group btn-group-yesno" default="0" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="show_no_articles" type="radio" label="COM_CONTENT_NO_ARTICLES_LABEL" description="COM_CONTENT_NO_ARTICLES_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="show_subcat_desc" type="radio" label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL" description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC" default="1" class="btn-group btn-group-yesno" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="show_cat_num_articles" type="radio" label="COM_CONTENT_NUMBER_CATEGORY_ITEMS_LABEL" description="COM_CONTENT_NUMBER_CATEGORY_ITEMS_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="show_cat_tags" type="radio" label="COM_CONTENT_FIELD_SHOW_CAT_TAGS_LABEL" description="COM_CONTENT_FIELD_SHOW_CAT_TAGS_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> </fieldset> <fieldset name="categories" label="JCATEGORIES" description="COM_CONTENT_CONFIG_CATEGORIES_SETTINGS_DESC" > <field name="show_base_description" type="radio" label="JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_LABEL" description="JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="maxLevelcat" type="list" label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL" description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC" default="-1" > <option value="0">JNONE</option> <option value="-1">JALL</option> <option value="1">J1</option> <option value="2">J2</option> <option value="3">J3</option> <option value="4">J4</option> <option value="5">J5</option> </field> <field name="show_empty_categories_cat" type="radio" label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL" description="COM_CONTENT_SHOW_EMPTY_CATEGORIES_DESC" class="btn-group btn-group-yesno" default="0" showon="maxLevelcat:-1,1,2,3,4,5" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="show_subcat_desc_cat" type="radio" label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL" description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC" class="btn-group btn-group-yesno" default="1" showon="maxLevelcat:-1,1,2,3,4,5" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="show_cat_num_articles_cat" type="radio" label="COM_CONTENT_NUMBER_CATEGORY_ITEMS_LABEL" description="COM_CONTENT_NUMBER_CATEGORY_ITEMS_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> </fieldset> <fieldset name="blog_default_parameters" label="COM_CONTENT_CONFIG_BLOG_SETTINGS_LABEL" description="COM_CONTENT_CONFIG_BLOG_SETTINGS_DESC" > <field name="num_leading_articles" type="number" label="JGLOBAL_NUM_LEADING_ARTICLES_LABEL" description="JGLOBAL_NUM_LEADING_ARTICLES_DESC" default="1" /> <field name="num_intro_articles" type="number" label="JGLOBAL_NUM_INTRO_ARTICLES_LABEL" description="JGLOBAL_NUM_INTRO_ARTICLES_DESC" default="4" /> <field name="num_columns" type="number" label="JGLOBAL_NUM_COLUMNS_LABEL" description="JGLOBAL_NUM_COLUMNS_DESC" default="2" /> <field name="num_links" type="number" label="JGLOBAL_NUM_LINKS_LABEL" description="JGLOBAL_NUM_LINKS_DESC" default="4" /> <field name="multi_column_order" type="list" label="JGLOBAL_MULTI_COLUMN_ORDER_LABEL" description="JGLOBAL_MULTI_COLUMN_ORDER_DESC" default="0" showon="num_columns!:,0,1" > <option value="0">JGLOBAL_DOWN</option> <option value="1">JGLOBAL_ACROSS</option> </field> <field name="spacer1" type="spacer" hr="true" /> <field name="show_subcategory_content" type="list" label="JGLOBAL_SHOW_SUBCATEGORY_CONTENT_LABEL" description="JGLOBAL_SHOW_SUBCATEGORY_CONTENT_DESC" default="0" > <option value="0">JNONE</option> <option value="-1">JALL</option> <option value="1">J1</option> <option value="2">J2</option> <option value="3">J3</option> <option value="4">J4</option> <option value="5">J5</option> </field> </fieldset> <fieldset name="list_default_parameters" label="JGLOBAL_LIST_LAYOUT_OPTIONS" description="COM_CONTENT_CONFIG_LIST_SETTINGS_DESC" addfieldpath="/administrator/components/com_content/models/fields" > <field name="show_pagination_limit" type="radio" label="JGLOBAL_DISPLAY_SELECT_LABEL" description="JGLOBAL_DISPLAY_SELECT_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="filter_field" type="list" label="JGLOBAL_FILTER_FIELD_LABEL" description="JGLOBAL_FILTER_FIELD_DESC" default="hide" > <option value="hide">JHIDE</option> <option value="title">JGLOBAL_TITLE</option> <option value="author">JAUTHOR</option> <option value="hits">JGLOBAL_HITS</option> <option value="tag">JTAG</option> <option value="month">JMONTH_PUBLISHED</option> </field> <field name="show_headings" type="radio" label="JGLOBAL_SHOW_HEADINGS_LABEL" description="JGLOBAL_SHOW_HEADINGS_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="list_show_date" type="list" label="JGLOBAL_SHOW_DATE_LABEL" description="JGLOBAL_SHOW_DATE_DESC" default="0" > <option value="0">JHIDE</option> <option value="created">JGLOBAL_CREATED</option> <option value="modified">JGLOBAL_MODIFIED</option> <option value="published">JPUBLISHED</option> </field> <field name="date_format" type="text" label="JGLOBAL_DATE_FORMAT_LABEL" description="JGLOBAL_DATE_FORMAT_DESC" size="15" showon="list_show_date:created,modified,published" /> <field name="list_show_hits" type="radio" label="JGLOBAL_LIST_HITS_LABEL" description="JGLOBAL_LIST_HITS_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="list_show_author" type="radio" label="JGLOBAL_LIST_AUTHOR_LABEL" description="JGLOBAL_LIST_AUTHOR_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="list_show_votes" type="voteradio" label="JGLOBAL_LIST_VOTES_LABEL" description="JGLOBAL_LIST_VOTES_DESC" class="btn-group btn-group-yesno" default="0" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="list_show_ratings" type="voteradio" label="JGLOBAL_LIST_RATINGS_LABEL" description="JGLOBAL_LIST_RATINGS_DESC" class="btn-group btn-group-yesno" default="0" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> </fieldset> <fieldset name="shared" label="COM_CONTENT_SHARED_LABEL" description="COM_CONTENT_SHARED_DESC" > <field name="orderby_pri" type="list" label="JGLOBAL_CATEGORY_ORDER_LABEL" description="JGLOBAL_CATEGORY_ORDER_DESC" default="none" > <option value="none">JGLOBAL_NO_ORDER</option> <option value="alpha">JGLOBAL_TITLE_ALPHABETICAL</option> <option value="ralpha">JGLOBAL_TITLE_REVERSE_ALPHABETICAL</option> <option value="order">JGLOBAL_CATEGORY_MANAGER_ORDER</option> </field> <field name="orderby_sec" type="list" label="JGLOBAL_ARTICLE_ORDER_LABEL" description="JGLOBAL_ARTICLE_ORDER_DESC" default="rdate" > <option value="rdate">JGLOBAL_MOST_RECENT_FIRST</option> <option value="date">JGLOBAL_OLDEST_FIRST</option> <option value="alpha">JGLOBAL_TITLE_ALPHABETICAL</option> <option value="ralpha">JGLOBAL_TITLE_REVERSE_ALPHABETICAL</option> <option value="author">JGLOBAL_AUTHOR_ALPHABETICAL</option> <option value="rauthor">JGLOBAL_AUTHOR_REVERSE_ALPHABETICAL</option> <option value="hits">JGLOBAL_MOST_HITS</option> <option value="rhits">JGLOBAL_LEAST_HITS</option> <option value="order">JGLOBAL_ARTICLE_MANAGER_ORDER</option> <option value="rorder">JGLOBAL_ARTICLE_MANAGER_REVERSE_ORDER</option> <option value="vote" requires="vote">JGLOBAL_VOTES_DESC</option> <option value="rvote" requires="vote">JGLOBAL_VOTES_ASC</option> <option value="rank" requires="vote">JGLOBAL_RATINGS_DESC</option> <option value="rrank" requires="vote">JGLOBAL_RATINGS_ASC</option> </field> <field name="order_date" type="list" label="JGLOBAL_ORDERING_DATE_LABEL" description="JGLOBAL_ORDERING_DATE_DESC" showon="orderby_sec:rdate,date" default="published" > <option value="created">JGLOBAL_CREATED</option> <option value="modified">JGLOBAL_MODIFIED</option> <option value="published">JPUBLISHED</option> </field> <field name="show_pagination" type="list" label="JGLOBAL_PAGINATION_LABEL" description="JGLOBAL_PAGINATION_DESC" default="2" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> <option value="2">JGLOBAL_AUTO</option> </field> <field name="show_pagination_results" type="radio" label="JGLOBAL_PAGINATION_RESULTS_LABEL" description="JGLOBAL_PAGINATION_RESULTS_DESC" class="btn-group btn-group-yesno" default="1" showon="show_pagination:1,2" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="show_featured" type="list" label="JGLOBAL_SHOW_FEATURED_ARTICLES_LABEL" description="JGLOBAL_SHOW_FEATURED_ARTICLES_DESC" default="show" > <option value="show">JSHOW</option> <option value="hide">JHIDE</option> <option value="only">JONLY</option> </field> </fieldset> <fieldset name="integration" label="JGLOBAL_INTEGRATION_LABEL" description="COM_CONTENT_CONFIG_INTEGRATION_SETTINGS_DESC" > <field name="integration_newsfeeds" type="note" label="JGLOBAL_FEED_TITLE" /> <field name="show_feed_link" type="radio" label="JGLOBAL_SHOW_FEED_LINK_LABEL" description="JGLOBAL_SHOW_FEED_LINK_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="feed_summary" type="list" label="JGLOBAL_FEED_SUMMARY_LABEL" description="JGLOBAL_FEED_SUMMARY_DESC" default="0" showon="show_feed_link:1" > <option value="0">JGLOBAL_INTRO_TEXT</option> <option value="1">JGLOBAL_FULL_TEXT</option> </field> <field name="feed_show_readmore" type="radio" label="JGLOBAL_FEED_SHOW_READMORE_LABEL" description="JGLOBAL_FEED_SHOW_READMORE_DESC" class="btn-group btn-group-yesno" default="0" showon="show_feed_link:1[AND]feed_summary:0" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="integration_sef" type="note" label="JGLOBAL_SEF_TITLE" /> <field name="sef_advanced" type="radio" class="btn-group btn-group-yesno btn-group-reversed" default="0" label="JGLOBAL_SEF_ADVANCED_LABEL" description="JGLOBAL_SEF_ADVANCED_DESC" filter="integer" > <option value="0">JGLOBAL_SEF_ADVANCED_LEGACY</option> <option value="1">JGLOBAL_SEF_ADVANCED_MODERN</option> </field> <field name="sef_ids" type="radio" class="btn-group btn-group-yesno" default="0" label="JGLOBAL_SEF_NOIDS_LABEL" description="JGLOBAL_SEF_NOIDS_DESC" showon="sef_advanced:1" filter="integer" > <option value="1">JYES</option> <option value="0">JNO</option> </field> <field name="integration_customfields" type="note" label="JGLOBAL_FIELDS_TITLE" /> <field name="custom_fields_enable" type="radio" label="JGLOBAL_CUSTOM_FIELDS_ENABLE_LABEL" description="JGLOBAL_CUSTOM_FIELDS_ENABLE_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JYES</option> <option value="0">JNO</option> </field> </fieldset> <fieldset name="permissions" label="JCONFIG_PERMISSIONS_LABEL" description="JCONFIG_PERMISSIONS_DESC" > <field name="rules" type="rules" label="JCONFIG_PERMISSIONS_LABEL" validate="rules" filter="rules" component="com_content" section="component" /> </fieldset> </config> PK Y��[�&��� � content.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JHtml::_('behavior.tabstate'); if (!JFactory::getUser()->authorise('core.manage', 'com_content')) { throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403); } JLoader::register('ContentHelper', __DIR__ . '/helpers/content.php'); $controller = JControllerLegacy::getInstance('Content'); $controller->execute(JFactory::getApplication()->input->get('task')); $controller->redirect(); PK Y��[��Ƈ � content.xmlnu �[��� <?xml version="1.0" encoding="utf-8"?> <extension type="component" version="3.1" method="upgrade"> <name>com_content</name> <author>Joomla! Project</author> <creationDate>April 2006</creationDate> <copyright>(C) 2005 - 2020 Open Source Matters. All rights reserved.</copyright> <license>GNU General Public License version 2 or later; see LICENSE.txt</license> <authorEmail>admin@joomla.org</authorEmail> <authorUrl>www.joomla.org</authorUrl> <version>3.0.0</version> <description>COM_CONTENT_XML_DESCRIPTION</description> <files folder="site"> <filename>content.php</filename> <filename>controller.php</filename> <filename>router.php</filename> <folder>helpers</folder> <folder>models</folder> </files> <languages folder="site"> <language tag="en-GB">language/en-GB.com_content.ini</language> </languages> <administration> <files folder="admin"> <filename>access.xml</filename> <filename>config.xml</filename> <filename>content.php</filename> <filename>controller.php</filename> <folder>controllers</folder> <folder>elements</folder> <folder>helpers</folder> <folder>models</folder> <folder>tables</folder> <folder>views</folder> </files> <languages folder="admin"> <language tag="en-GB">language/en-GB.com_content.ini</language> <language tag="en-GB">language/en-GB.com_content.sys.ini</language> </languages> </administration> </extension> PK Y��[CB&� � controller.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Component Controller * * @since 1.5 */ class ContentController extends JControllerLegacy { /** * The default view. * * @var string * @since 1.6 */ protected $default_view = 'articles'; /** * Method to display a view. * * @param boolean $cachable If true, the view output will be cached * @param array $urlparams An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}. * * @return ContentController This object to support chaining. * * @since 1.5 */ public function display($cachable = false, $urlparams = array()) { $view = $this->input->get('view', 'articles'); $layout = $this->input->get('layout', 'articles'); $id = $this->input->getInt('id'); // Check for edit form. if ($view == 'article' && $layout == 'edit' && !$this->checkEditId('com_content.edit.article', $id)) { // Somehow the person just went to the form - we don't allow that. $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); $this->setMessage($this->getError(), 'error'); $this->setRedirect(JRoute::_('index.php?option=com_content&view=articles', false)); return false; } return parent::display(); } } PK Y��[LI{� � controllers/ajax.json.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\Language\LanguageHelper; /** * The article controller for ajax requests * * @since 3.9.0 */ class ContentControllerAjax extends JControllerLegacy { /** * Method to fetch associations of an article * * The method assumes that the following http parameters are passed in an Ajax Get request: * token: the form token * assocId: the id of the article whose associations are to be returned * excludeLang: the association for this language is to be excluded * * @return null * * @since 3.9.0 */ public function fetchAssociations() { if (!JSession::checkToken('get')) { echo new JResponseJson(null, JText::_('JINVALID_TOKEN'), true); } else { $input = JFactory::getApplication()->input; $assocId = $input->getInt('assocId', 0); if ($assocId == 0) { echo new JResponseJson(null, JText::sprintf('JLIB_FORM_VALIDATE_FIELD_INVALID', 'assocId'), true); return; } $excludeLang = $input->get('excludeLang', '', 'STRING'); $associations = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', (int) $assocId); unset($associations[$excludeLang]); // Add the title to each of the associated records $contentTable = JTable::getInstance('Content', 'JTable'); foreach ($associations as $lang => $association) { $contentTable->load($association->id); $associations[$lang]->title = $contentTable->title; } $countContentLanguages = count(LanguageHelper::getContentLanguages(array(0, 1))); if (count($associations) == 0) { $message = JText::_('JGLOBAL_ASSOCIATIONS_PROPAGATE_MESSAGE_NONE'); } elseif ($countContentLanguages > count($associations) + 2) { $tags = implode(', ', array_keys($associations)); $message = JText::sprintf('JGLOBAL_ASSOCIATIONS_PROPAGATE_MESSAGE_SOME', $tags); } else { $message = JText::_('JGLOBAL_ASSOCIATIONS_PROPAGATE_MESSAGE_ALL'); } echo new JResponseJson($associations, $message); } } } PK Z��[WF5� � controllers/article.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\Utilities\ArrayHelper; /** * The article controller * * @since 1.6 */ class ContentControllerArticle extends JControllerForm { /** * Class constructor. * * @param array $config A named array of configuration variables. * * @since 1.6 */ public function __construct($config = array()) { parent::__construct($config); // An article edit form can come from the articles or featured view. // Adjust the redirect view on the value of 'return' in the request. if ($this->input->get('return') == 'featured') { $this->view_list = 'featured'; $this->view_item = 'article&return=featured'; } } /** * Method override to check if you can add a new record. * * @param array $data An array of input data. * * @return boolean * * @since 1.6 */ protected function allowAdd($data = array()) { $categoryId = ArrayHelper::getValue($data, 'catid', $this->input->getInt('filter_category_id'), 'int'); $allow = null; if ($categoryId) { // If the category has been passed in the data or URL check it. $allow = JFactory::getUser()->authorise('core.create', 'com_content.category.' . $categoryId); } if ($allow === null) { // In the absence of better information, revert to the component permissions. return parent::allowAdd(); } return $allow; } /** * Method override to check if you can edit an existing record. * * @param array $data An array of input data. * @param string $key The name of the key for the primary key. * * @return boolean * * @since 1.6 */ protected function allowEdit($data = array(), $key = 'id') { $recordId = (int) isset($data[$key]) ? $data[$key] : 0; $user = JFactory::getUser(); // Zero record (id:0), return component edit permission by calling parent controller method if (!$recordId) { return parent::allowEdit($data, $key); } // Check edit on the record asset (explicit or inherited) if ($user->authorise('core.edit', 'com_content.article.' . $recordId)) { return true; } // Check edit own on the record asset (explicit or inherited) if ($user->authorise('core.edit.own', 'com_content.article.' . $recordId)) { // Existing record already has an owner, get it $record = $this->getModel()->getItem($recordId); if (empty($record)) { return false; } // Grant if current user is owner of the record return $user->id == $record->created_by; } return false; } /** * Method to run batch operations. * * @param object $model The model. * * @return boolean True if successful, false otherwise and internal error is set. * * @since 1.6 */ public function batch($model = null) { $this->checkToken(); // Set the model /** @var ContentModelArticle $model */ $model = $this->getModel('Article', '', array()); // Preset the redirect $this->setRedirect(JRoute::_('index.php?option=com_content&view=articles' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } } PK Z��[j�� � controllers/articles.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\Utilities\ArrayHelper; /** * Articles list controller class. * * @since 1.6 */ class ContentControllerArticles extends JControllerAdmin { /** * Constructor. * * @param array $config An optional associative array of configuration settings. * * @see JControllerLegacy * @since 1.6 */ public function __construct($config = array()) { parent::__construct($config); // Articles default form can come from the articles or featured view. // Adjust the redirect view on the value of 'view' in the request. if ($this->input->get('view') == 'featured') { $this->view_list = 'featured'; } $this->registerTask('unfeatured', 'featured'); } /** * Method to toggle the featured setting of a list of articles. * * @return void * * @since 1.6 */ public function featured() { // Check for request forgeries $this->checkToken(); $user = JFactory::getUser(); $ids = $this->input->get('cid', array(), 'array'); $values = array('featured' => 1, 'unfeatured' => 0); $task = $this->getTask(); $value = ArrayHelper::getValue($values, $task, 0, 'int'); // Access checks. foreach ($ids as $i => $id) { if (!$user->authorise('core.edit.state', 'com_content.article.' . (int) $id)) { // Prune items that you can't change. unset($ids[$i]); JError::raiseNotice(403, JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED')); } } if (empty($ids)) { JError::raiseWarning(500, JText::_('JERROR_NO_ITEMS_SELECTED')); } else { // Get the model. /** @var ContentModelArticle $model */ $model = $this->getModel(); // Publish the items. if (!$model->featured($ids, $value)) { JError::raiseWarning(500, $model->getError()); } if ($value == 1) { $message = JText::plural('COM_CONTENT_N_ITEMS_FEATURED', count($ids)); } else { $message = JText::plural('COM_CONTENT_N_ITEMS_UNFEATURED', count($ids)); } } $view = $this->input->get('view', ''); if ($view == 'featured') { $this->setRedirect(JRoute::_('index.php?option=com_content&view=featured', false), $message); } else { $this->setRedirect(JRoute::_('index.php?option=com_content&view=articles', false), $message); } } /** * Proxy for getModel. * * @param string $name The model name. Optional. * @param string $prefix The class prefix. Optional. * @param array $config The array of possible config values. Optional. * * @return JModelLegacy * * @since 1.6 */ public function getModel($name = 'Article', $prefix = 'ContentModel', $config = array('ignore_request' => true)) { return parent::getModel($name, $prefix, $config); } } PK Z��[� ��P P controllers/featured.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JLoader::register('ContentControllerArticles', __DIR__ . '/articles.php'); /** * Featured content controller class. * * @since 1.6 */ class ContentControllerFeatured extends ContentControllerArticles { /** * Removes an item. * * @return void * * @since 1.6 */ public function delete() { // Check for request forgeries $this->checkToken(); $user = JFactory::getUser(); $ids = $this->input->get('cid', array(), 'array'); // Access checks. foreach ($ids as $i => $id) { if (!$user->authorise('core.delete', 'com_content.article.' . (int) $id)) { // Prune items that you can't delete. unset($ids[$i]); JError::raiseNotice(403, JText::_('JERROR_CORE_DELETE_NOT_PERMITTED')); } } if (empty($ids)) { JError::raiseWarning(500, JText::_('JERROR_NO_ITEMS_SELECTED')); } else { // Get the model. /** @var ContentModelFeature $model */ $model = $this->getModel(); // Remove the items. if (!$model->featured($ids, 0)) { JError::raiseWarning(500, $model->getError()); } } $this->setRedirect('index.php?option=com_content&view=featured'); } /** * Method to publish a list of articles. * * @return void * * @since 1.0 */ public function publish() { parent::publish(); $this->setRedirect('index.php?option=com_content&view=featured'); } /** * Method to get a model object, loading it if required. * * @param string $name The model name. Optional. * @param string $prefix The class prefix. Optional. * @param array $config Configuration array for model. Optional. * * @return JModelLegacy The model. * * @since 1.6 */ public function getModel($name = 'Feature', $prefix = 'ContentModel', $config = array('ignore_request' => true)) { return parent::getModel($name, $prefix, $config); } } PK Z��[�A�h� � helpers/associations.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\Association\AssociationExtensionHelper; /** * Content associations helper. * * @since 3.7.0 */ class ContentAssociationsHelper extends AssociationExtensionHelper { /** * The extension name * * @var array $extension * * @since 3.7.0 */ protected $extension = 'com_content'; /** * Array of item types * * @var array $itemTypes * * @since 3.7.0 */ protected $itemTypes = array('article', 'category'); /** * Has the extension association support * * @var boolean $associationsSupport * * @since 3.7.0 */ protected $associationsSupport = true; /** * Get the associated items for an item * * @param string $typeName The item type * @param int $id The id of item for which we need the associated items * * @return array * * @since 3.7.0 */ public function getAssociations($typeName, $id) { $type = $this->getType($typeName); $context = $this->extension . '.item'; $catidField = 'catid'; if ($typeName === 'category') { $context = 'com_categories.item'; $catidField = ''; } // Get the associations. $associations = JLanguageAssociations::getAssociations( $this->extension, $type['tables']['a'], $context, $id, 'id', 'alias', $catidField ); return $associations; } /** * Get item information * * @param string $typeName The item type * @param int $id The id of item for which we need the associated items * * @return JTable|null * * @since 3.7.0 */ public function getItem($typeName, $id) { if (empty($id)) { return null; } $table = null; switch ($typeName) { case 'article': $table = JTable::getInstance('Content'); break; case 'category': $table = JTable::getInstance('Category'); break; } if (is_null($table)) { return null; } $table->load($id); return $table; } /** * Get information about the type * * @param string $typeName The item type * * @return array Array of item types * * @since 3.7.0 */ public function getType($typeName = '') { $fields = $this->getFieldsTemplate(); $tables = array(); $joins = array(); $support = $this->getSupportTemplate(); $title = ''; if (in_array($typeName, $this->itemTypes)) { switch ($typeName) { case 'article': $support['state'] = true; $support['acl'] = true; $support['checkout'] = true; $support['category'] = true; $support['save2copy'] = true; $tables = array( 'a' => '#__content' ); $title = 'article'; break; case 'category': $fields['created_user_id'] = 'a.created_user_id'; $fields['ordering'] = 'a.lft'; $fields['level'] = 'a.level'; $fields['catid'] = ''; $fields['state'] = 'a.published'; $support['state'] = true; $support['acl'] = true; $support['checkout'] = true; $support['level'] = true; $tables = array( 'a' => '#__categories' ); $title = 'category'; break; } } return array( 'fields' => $fields, 'support' => $support, 'tables' => $tables, 'joins' => $joins, 'title' => $title ); } } PK Z��[ �ד� � helpers/content.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Content component helper. * * @since 1.6 */ class ContentHelper extends JHelperContent { public static $extension = 'com_content'; /** * Configure the Linkbar. * * @param string $vName The name of the active view. * * @return void * * @since 1.6 */ public static function addSubmenu($vName) { JHtmlSidebar::addEntry( JText::_('JGLOBAL_ARTICLES'), 'index.php?option=com_content&view=articles', $vName == 'articles' ); JHtmlSidebar::addEntry( JText::_('COM_CONTENT_SUBMENU_CATEGORIES'), 'index.php?option=com_categories&extension=com_content', $vName == 'categories' ); JHtmlSidebar::addEntry( JText::_('COM_CONTENT_SUBMENU_FEATURED'), 'index.php?option=com_content&view=featured', $vName == 'featured' ); if (JComponentHelper::isEnabled('com_fields') && JComponentHelper::getParams('com_content')->get('custom_fields_enable', '1')) { JHtmlSidebar::addEntry( JText::_('JGLOBAL_FIELDS'), 'index.php?option=com_fields&context=com_content.article', $vName == 'fields.fields' ); JHtmlSidebar::addEntry( JText::_('JGLOBAL_FIELD_GROUPS'), 'index.php?option=com_fields&view=groups&context=com_content.article', $vName == 'fields.groups' ); } } /** * Applies the content tag filters to arbitrary text as per settings for current user group * * @param text $text The string to filter * * @return string The filtered string * * @deprecated 4.0 Use JComponentHelper::filterText() instead. */ public static function filterText($text) { try { JLog::add( sprintf('%s() is deprecated. Use JComponentHelper::filterText() instead', __METHOD__), JLog::WARNING, 'deprecated' ); } catch (RuntimeException $exception) { // Informational log only } return JComponentHelper::filterText($text); } /** * Adds Count Items for Category Manager. * * @param stdClass[] &$items The category objects * * @return stdClass[] * * @since 3.5 */ public static function countItems(&$items) { $config = (object) array( 'related_tbl' => 'content', 'state_col' => 'state', 'group_col' => 'catid', 'relation_type' => 'category_or_group', ); return parent::countRelations($items, $config); } /** * Adds Count Items for Tag Manager. * * @param stdClass[] &$items The tag objects * @param string $extension The name of the active view. * * @return stdClass[] * * @since 3.6 */ public static function countTagItems(&$items, $extension) { $parts = explode('.', $extension); $section = count($parts) > 1 ? $parts[1] : null; $config = (object) array( 'related_tbl' => ($section === 'category' ? 'categories' : 'content'), 'state_col' => ($section === 'category' ? 'published' : 'state'), 'group_col' => 'tag_id', 'extension' => $extension, 'relation_type' => 'tag_assigments', ); return parent::countRelations($items, $config); } /** * Returns a valid section for articles. If it is not valid then null * is returned. * * @param string $section The section to get the mapping for * * @return string|null The new section * * @since 3.7.0 */ public static function validateSection($section) { if (JFactory::getApplication()->isClient('site')) { // On the front end we need to map some sections switch ($section) { // Editing an article case 'form': // Category list view case 'featured': case 'category': $section = 'article'; } } if ($section != 'article') { // We don't know other sections return null; } return $section; } /** * Returns valid contexts * * @return array * * @since 3.7.0 */ public static function getContexts() { JFactory::getLanguage()->load('com_content', JPATH_ADMINISTRATOR); $contexts = array( 'com_content.article' => JText::_('COM_CONTENT'), 'com_content.categories' => JText::_('JCATEGORY') ); return $contexts; } } PK Z��[H��� � % helpers/html/contentadministrator.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\Utilities\ArrayHelper; JLoader::register('ContentHelper', JPATH_ADMINISTRATOR . '/components/com_content/helpers/content.php'); /** * Content HTML helper * * @since 3.0 */ abstract class JHtmlContentAdministrator { /** * Render the list of associated items * * @param integer $articleid The article item id * * @return string The language HTML * * @throws Exception */ public static function association($articleid) { // Defaults $html = ''; // Get the associations if ($associations = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $articleid)) { foreach ($associations as $tag => $associated) { $associations[$tag] = (int) $associated->id; } // Get the associated menu items $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('c.*') ->select('l.sef as lang_sef') ->select('l.lang_code') ->from('#__content as c') ->select('cat.title as category_title') ->join('LEFT', '#__categories as cat ON cat.id=c.catid') ->where('c.id IN (' . implode(',', array_values($associations)) . ')') ->where('c.id != ' . $articleid) ->join('LEFT', '#__languages as l ON c.language=l.lang_code') ->select('l.image') ->select('l.title as language_title'); $db->setQuery($query); try { $items = $db->loadObjectList('id'); } catch (RuntimeException $e) { throw new Exception($e->getMessage(), 500, $e); } if ($items) { foreach ($items as &$item) { $text = $item->lang_sef ? strtoupper($item->lang_sef) : 'XX'; $url = JRoute::_('index.php?option=com_content&task=article.edit&id=' . (int) $item->id); $tooltip = htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8') . '<br />' . JText::sprintf('JCATEGORY_SPRINTF', $item->category_title); $classes = 'hasPopover label label-association label-' . $item->lang_sef; $item->link = '<a href="' . $url . '" title="' . $item->language_title . '" class="' . $classes . '" data-content="' . $tooltip . '" data-placement="top">' . $text . '</a>'; } } JHtml::_('bootstrap.popover'); $html = JLayoutHelper::render('joomla.content.associations', $items); } return $html; } /** * Show the feature/unfeature links * * @param integer $value The state value * @param integer $i Row number * @param boolean $canChange Is user allowed to change? * * @return string HTML code */ public static function featured($value = 0, $i = 0, $canChange = true) { JHtml::_('bootstrap.tooltip'); // Array of image, task, title, action $states = array( 0 => array('unfeatured', 'articles.featured', 'COM_CONTENT_UNFEATURED', 'JGLOBAL_TOGGLE_FEATURED'), 1 => array('featured', 'articles.unfeatured', 'COM_CONTENT_FEATURED', 'JGLOBAL_TOGGLE_FEATURED'), ); $state = ArrayHelper::getValue($states, (int) $value, $states[1]); $icon = $state[0]; if ($canChange) { $html = '<a href="#" onclick="return listItemTask(\'cb' . $i . '\',\'' . $state[1] . '\')" class="btn btn-micro hasTooltip' . ($value == 1 ? ' active' : '') . '" title="' . JHtml::_('tooltipText', $state[3]) . '"><span class="icon-' . $icon . '" aria-hidden="true"></span></a>'; } else { $html = '<a class="btn btn-micro hasTooltip disabled' . ($value == 1 ? ' active' : '') . '" title="' . JHtml::_('tooltipText', $state[2]) . '"><span class="icon-' . $icon . '" aria-hidden="true"></span></a>'; } return $html; } } PK Z��[��Iv` v` models/article.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\Registry\Registry; use Joomla\Utilities\ArrayHelper; JLoader::register('ContentHelper', JPATH_ADMINISTRATOR . '/components/com_content/helpers/content.php'); /** * Item Model for an Article. * * @since 1.6 */ class ContentModelArticle extends JModelAdmin { /** * The prefix to use with controller messages. * * @var string * @since 1.6 */ protected $text_prefix = 'COM_CONTENT'; /** * The type alias for this content type (for example, 'com_content.article'). * * @var string * @since 3.2 */ public $typeAlias = 'com_content.article'; /** * The context used for the associations table * * @var string * @since 3.4.4 */ protected $associationsContext = 'com_content.item'; /** * Function that can be overridden to do any data cleanup after batch copying data * * @param \JTableInterface $table The table object containing the newly created item * @param integer $newId The id of the new item * @param integer $oldId The original item id * * @return void * * @since 3.8.12 */ protected function cleanupPostBatchCopy(\JTableInterface $table, $newId, $oldId) { // Check if the article was featured and update the #__content_frontpage table if ($table->featured == 1) { $db = $this->getDbo(); $query = $db->getQuery(true) ->insert($db->quoteName('#__content_frontpage')) ->values($newId . ', 0'); $db->setQuery($query); $db->execute(); } // Register FieldsHelper JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php'); $oldItem = $this->getTable(); $oldItem->load($oldId); $fields = FieldsHelper::getFields('com_content.article', $oldItem, true); $fieldsData = array(); if (!empty($fields)) { $fieldsData['com_fields'] = array(); foreach ($fields as $field) { $fieldsData['com_fields'][$field->name] = $field->rawvalue; } } JEventDispatcher::getInstance()->trigger('onContentAfterSave', array('com_content.article', &$this->table, true, $fieldsData)); } /** * Batch move categories to a new category. * * @param integer $value The new category ID. * @param array $pks An array of row IDs. * @param array $contexts An array of item contexts. * * @return boolean True on success. * * @since 3.8.6 */ protected function batchMove($value, $pks, $contexts) { if (empty($this->batchSet)) { // Set some needed variables. $this->user = JFactory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->contentType = new JUcmType; $this->type = $this->contentType->getTypeByTable($this->tableClassName); } $categoryId = (int) $value; if (!$this->checkCategoryId($categoryId)) { return false; } JPluginHelper::importPlugin('system'); $dispatcher = JEventDispatcher::getInstance(); // Register FieldsHelper JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php'); // Parent exists so we proceed foreach ($pks as $pk) { if (!$this->user->authorise('core.edit', $contexts[$pk])) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } // Check that the row actually exists if (!$this->table->load($pk)) { if ($error = $this->table->getError()) { // Fatal error $this->setError($error); return false; } else { // Not fatal error $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } $fields = FieldsHelper::getFields('com_content.article', $this->table, true); $fieldsData = array(); if (!empty($fields)) { $fieldsData['com_fields'] = array(); foreach ($fields as $field) { $fieldsData['com_fields'][$field->name] = $field->rawvalue; } } // Set the new category ID $this->table->catid = $categoryId; // Check the row. if (!$this->table->check()) { $this->setError($this->table->getError()); return false; } if (!empty($this->type)) { $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); } // Store the row. if (!$this->table->store()) { $this->setError($this->table->getError()); return false; } // Run event for moved article $dispatcher->trigger('onContentAfterSave', array('com_content.article', &$this->table, false, $fieldsData)); } // Clean the cache $this->cleanCache(); return true; } /** * Method to test whether a record can be deleted. * * @param object $record A record object. * * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. * * @since 1.6 */ protected function canDelete($record) { if (empty($record->id) || $record->state != -2) { return false; } return JFactory::getUser()->authorise('core.delete', 'com_content.article.' . (int) $record->id); } /** * Method to test whether a record can have its state edited. * * @param object $record A record object. * * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. * * @since 1.6 */ protected function canEditState($record) { $user = JFactory::getUser(); // Check for existing article. if (!empty($record->id)) { return $user->authorise('core.edit.state', 'com_content.article.' . (int) $record->id); } // New article, so check against the category. if (!empty($record->catid)) { return $user->authorise('core.edit.state', 'com_content.category.' . (int) $record->catid); } // Default to component settings if neither article nor category known. return parent::canEditState($record); } /** * Prepare and sanitise the table data prior to saving. * * @param JTable $table A JTable object. * * @return void * * @since 1.6 */ protected function prepareTable($table) { // Set the publish date to now if ($table->state == 1 && (int) $table->publish_up == 0) { $table->publish_up = JFactory::getDate()->toSql(); } if ($table->state == 1 && intval($table->publish_down) == 0) { $table->publish_down = $this->getDbo()->getNullDate(); } // Increment the content version number. $table->version++; // Reorder the articles within the category so the new article is first if (empty($table->id)) { $table->reorder('catid = ' . (int) $table->catid . ' AND state >= 0'); } } /** * Returns a Table object, always creating it. * * @param string $type The table type to instantiate * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * * @return JTable A database object */ public function getTable($type = 'Content', $prefix = 'JTable', $config = array()) { return JTable::getInstance($type, $prefix, $config); } /** * Method to get a single record. * * @param integer $pk The id of the primary key. * * @return mixed Object on success, false on failure. */ public function getItem($pk = null) { if ($item = parent::getItem($pk)) { // Convert the params field to an array. $registry = new Registry($item->attribs); $item->attribs = $registry->toArray(); // Convert the metadata field to an array. $registry = new Registry($item->metadata); $item->metadata = $registry->toArray(); // Convert the images field to an array. $registry = new Registry($item->images); $item->images = $registry->toArray(); // Convert the urls field to an array. $registry = new Registry($item->urls); $item->urls = $registry->toArray(); $item->articletext = trim($item->fulltext) != '' ? $item->introtext . "<hr id=\"system-readmore\" />" . $item->fulltext : $item->introtext; if (!empty($item->id)) { $item->tags = new JHelperTags; $item->tags->getTagIds($item->id, 'com_content.article'); } } // Load associated content items $assoc = JLanguageAssociations::isEnabled(); if ($assoc) { $item->associations = array(); if ($item->id != null) { $associations = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $item->id); foreach ($associations as $tag => $association) { $item->associations[$tag] = $association->id; } } } return $item; } /** * Method to get the record form. * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * * @return JForm|boolean A JForm object on success, false on failure * * @since 1.6 */ public function getForm($data = array(), $loadData = true) { $app = JFactory::getApplication(); $user = JFactory::getUser(); // Get the form. $form = $this->loadForm('com_content.article', 'article', array('control' => 'jform', 'load_data' => $loadData)); if (empty($form)) { return false; } $jinput = JFactory::getApplication()->input; /* * The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. * The back end uses id so we use that the rest of the time and set it to 0 by default. */ $id = $jinput->get('a_id', $jinput->get('id', 0)); // Determine correct permissions to check. if ($this->getState('article.id')) { $id = $this->getState('article.id'); // Existing record. Can only edit in selected categories. $form->setFieldAttribute('catid', 'action', 'core.edit'); // Existing record. Can only edit own articles in selected categories. if ($app->isClient('administrator')) { $form->setFieldAttribute('catid', 'action', 'core.edit.own'); } else // Existing record. We can't edit the category in frontend if not edit.state. { if ($id != 0 && (!$user->authorise('core.edit.state', 'com_content.article.' . (int) $id)) || ($id == 0 && !$user->authorise('core.edit.state', 'com_content'))) { $form->setFieldAttribute('catid', 'readonly', 'true'); $form->setFieldAttribute('catid', 'filter', 'unset'); } } } else { // New record. Can only create in selected categories. $form->setFieldAttribute('catid', 'action', 'core.create'); } // Check for existing article. // Modify the form based on Edit State access controls. if ($id != 0 && (!$user->authorise('core.edit.state', 'com_content.article.' . (int) $id)) || ($id == 0 && !$user->authorise('core.edit.state', 'com_content'))) { // Disable fields for display. $form->setFieldAttribute('featured', 'disabled', 'true'); $form->setFieldAttribute('ordering', 'disabled', 'true'); $form->setFieldAttribute('publish_up', 'disabled', 'true'); $form->setFieldAttribute('publish_down', 'disabled', 'true'); $form->setFieldAttribute('state', 'disabled', 'true'); // Disable fields while saving. // The controller has already verified this is an article you can edit. $form->setFieldAttribute('featured', 'filter', 'unset'); $form->setFieldAttribute('ordering', 'filter', 'unset'); $form->setFieldAttribute('publish_up', 'filter', 'unset'); $form->setFieldAttribute('publish_down', 'filter', 'unset'); $form->setFieldAttribute('state', 'filter', 'unset'); } // Prevent messing with article language and category when editing existing article with associations $assoc = JLanguageAssociations::isEnabled(); // Check if article is associated if ($this->getState('article.id') && $app->isClient('site') && $assoc) { $associations = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $id); // Make fields read only if (!empty($associations)) { $form->setFieldAttribute('language', 'readonly', 'true'); $form->setFieldAttribute('catid', 'readonly', 'true'); $form->setFieldAttribute('language', 'filter', 'unset'); $form->setFieldAttribute('catid', 'filter', 'unset'); } } return $form; } /** * Method to get the data that should be injected in the form. * * @return mixed The data for the form. * * @since 1.6 */ protected function loadFormData() { // Check the session for previously entered form data. $app = JFactory::getApplication(); $data = $app->getUserState('com_content.edit.article.data', array()); if (empty($data)) { $data = $this->getItem(); // Pre-select some filters (Status, Category, Language, Access) in edit form if those have been selected in Article Manager: Articles if ($this->getState('article.id') == 0) { $filters = (array) $app->getUserState('com_content.articles.filter'); $data->set( 'state', $app->input->getInt( 'state', ((isset($filters['published']) && $filters['published'] !== '') ? $filters['published'] : null) ) ); $data->set('catid', $app->input->getInt('catid', (!empty($filters['category_id']) ? $filters['category_id'] : null))); $data->set('language', $app->input->getString('language', (!empty($filters['language']) ? $filters['language'] : null))); $data->set('access', $app->input->getInt('access', (!empty($filters['access']) ? $filters['access'] : JFactory::getConfig()->get('access'))) ); } } // If there are params fieldsets in the form it will fail with a registry object if (isset($data->params) && $data->params instanceof Registry) { $data->params = $data->params->toArray(); } $this->preprocessData('com_content.article', $data); return $data; } /** * Method to validate the form data. * * @param JForm $form The form to validate against. * @param array $data The data to validate. * @param string $group The name of the field group to validate. * * @return array|boolean Array of filtered data if valid, false otherwise. * * @see JFormRule * @see JFilterInput * @since 3.7.0 */ public function validate($form, $data, $group = null) { // Don't allow to change the users if not allowed to access com_users. if (JFactory::getApplication()->isClient('administrator') && !JFactory::getUser()->authorise('core.manage', 'com_users')) { if (isset($data['created_by'])) { unset($data['created_by']); } if (isset($data['modified_by'])) { unset($data['modified_by']); } } if (!JFactory::getUser()->authorise('core.admin', 'com_content')) { if (isset($data['rules'])) { unset($data['rules']); } } return parent::validate($form, $data, $group); } /** * Method to save the form data. * * @param array $data The form data. * * @return boolean True on success. * * @since 1.6 */ public function save($data) { $input = JFactory::getApplication()->input; $filter = JFilterInput::getInstance(); if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); } if (isset($data['created_by_alias'])) { $data['created_by_alias'] = $filter->clean($data['created_by_alias'], 'TRIM'); } if (isset($data['images']) && is_array($data['images'])) { $registry = new Registry($data['images']); $data['images'] = (string) $registry; } JLoader::register('CategoriesHelper', JPATH_ADMINISTRATOR . '/components/com_categories/helpers/categories.php'); // Create new category, if needed. $createCategory = true; // If category ID is provided, check if it's valid. if (is_numeric($data['catid']) && $data['catid']) { $createCategory = !CategoriesHelper::validateCategoryId($data['catid'], 'com_content'); } // Save New Category if ($createCategory && $this->canCreateCategory()) { $table = array(); // Remove #new# prefix, if exists. $table['title'] = strpos($data['catid'], '#new#') === 0 ? substr($data['catid'], 5) : $data['catid']; $table['parent_id'] = 1; $table['extension'] = 'com_content'; $table['language'] = $data['language']; $table['published'] = 1; // Create new category and get catid back $data['catid'] = CategoriesHelper::createCategory($table); } if (isset($data['urls']) && is_array($data['urls'])) { $check = $input->post->get('jform', array(), 'array'); foreach ($data['urls'] as $i => $url) { if ($url != false && ($i == 'urla' || $i == 'urlb' || $i == 'urlc')) { if (preg_match('~^#[a-zA-Z]{1}[a-zA-Z0-9-_:.]*$~', $check['urls'][$i]) == 1) { $data['urls'][$i] = $check['urls'][$i]; } else { $data['urls'][$i] = JStringPunycode::urlToPunycode($url); } } } unset($check); $registry = new Registry($data['urls']); $data['urls'] = (string) $registry; } // Alter the title for save as copy if ($input->get('task') == 'save2copy') { $origTable = clone $this->getTable(); $origTable->load($input->getInt('id')); if ($data['title'] == $origTable->title) { list($title, $alias) = $this->generateNewTitle($data['catid'], $data['alias'], $data['title']); $data['title'] = $title; $data['alias'] = $alias; } else { if ($data['alias'] == $origTable->alias) { $data['alias'] = ''; } } $data['state'] = 0; } // Automatic handling of alias for empty fields if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (!isset($data['id']) || (int) $data['id'] == 0)) { if ($data['alias'] == null) { if (JFactory::getConfig()->get('unicodeslugs') == 1) { $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['title']); } else { $data['alias'] = JFilterOutput::stringURLSafe($data['title']); } $table = JTable::getInstance('Content', 'JTable'); if ($table->load(array('alias' => $data['alias'], 'catid' => $data['catid']))) { $msg = JText::_('COM_CONTENT_SAVE_WARNING'); } list($title, $alias) = $this->generateNewTitle($data['catid'], $data['alias'], $data['title']); $data['alias'] = $alias; if (isset($msg)) { JFactory::getApplication()->enqueueMessage($msg, 'warning'); } } } if (parent::save($data)) { if (isset($data['featured'])) { $this->featured($this->getState($this->getName() . '.id'), $data['featured']); } return true; } return false; } /** * Method to toggle the featured setting of articles. * * @param array $pks The ids of the items to toggle. * @param integer $value The value to toggle to. * * @return boolean True on success. */ public function featured($pks, $value = 0) { // Sanitize the ids. $pks = (array) $pks; $pks = ArrayHelper::toInteger($pks); if (empty($pks)) { $this->setError(JText::_('COM_CONTENT_NO_ITEM_SELECTED')); return false; } $table = $this->getTable('Featured', 'ContentTable'); try { $db = $this->getDbo(); $query = $db->getQuery(true) ->update($db->quoteName('#__content')) ->set('featured = ' . (int) $value) ->where('id IN (' . implode(',', $pks) . ')'); $db->setQuery($query); $db->execute(); if ((int) $value == 0) { // Adjust the mapping table. // Clear the existing features settings. $query = $db->getQuery(true) ->delete($db->quoteName('#__content_frontpage')) ->where('content_id IN (' . implode(',', $pks) . ')'); $db->setQuery($query); $db->execute(); } else { // First, we find out which of our new featured articles are already featured. $query = $db->getQuery(true) ->select('f.content_id') ->from('#__content_frontpage AS f') ->where('content_id IN (' . implode(',', $pks) . ')'); $db->setQuery($query); $oldFeatured = $db->loadColumn(); // We diff the arrays to get a list of the articles that are newly featured $newFeatured = array_diff($pks, $oldFeatured); // Featuring. $tuples = array(); foreach ($newFeatured as $pk) { $tuples[] = $pk . ', 0'; } if (count($tuples)) { $columns = array('content_id', 'ordering'); $query = $db->getQuery(true) ->insert($db->quoteName('#__content_frontpage')) ->columns($db->quoteName($columns)) ->values($tuples); $db->setQuery($query); $db->execute(); } } } catch (Exception $e) { $this->setError($e->getMessage()); return false; } $table->reorder(); $this->cleanCache(); return true; } /** * A protected method to get a set of ordering conditions. * * @param object $table A record object. * * @return array An array of conditions to add to add to ordering queries. * * @since 1.6 */ protected function getReorderConditions($table) { return array('catid = ' . (int) $table->catid); } /** * Allows preprocessing of the JForm object. * * @param JForm $form The form object * @param array $data The data to be merged into the form object * @param string $group The plugin group to be executed * * @return void * * @since 3.0 */ protected function preprocessForm(JForm $form, $data, $group = 'content') { if ($this->canCreateCategory()) { $form->setFieldAttribute('catid', 'allowAdd', 'true'); // Add a prefix for categories created on the fly. $form->setFieldAttribute('catid', 'customPrefix', '#new#'); } // Association content items if (JLanguageAssociations::isEnabled()) { $languages = JLanguageHelper::getContentLanguages(false, true, null, 'ordering', 'asc'); if (count($languages) > 1) { $addform = new SimpleXMLElement('<form />'); $fields = $addform->addChild('fields'); $fields->addAttribute('name', 'associations'); $fieldset = $fields->addChild('fieldset'); $fieldset->addAttribute('name', 'item_associations'); foreach ($languages as $language) { $field = $fieldset->addChild('field'); $field->addAttribute('name', $language->lang_code); $field->addAttribute('type', 'modal_article'); $field->addAttribute('language', $language->lang_code); $field->addAttribute('label', $language->title); $field->addAttribute('translate_label', 'false'); $field->addAttribute('select', 'true'); $field->addAttribute('new', 'true'); $field->addAttribute('edit', 'true'); $field->addAttribute('clear', 'true'); $field->addAttribute('propagate', 'true'); } $form->load($addform, false); } } parent::preprocessForm($form, $data, $group); } /** * Custom clean the cache of com_content and content modules * * @param string $group The cache group * @param integer $clientId The ID of the client * * @return void * * @since 1.6 */ protected function cleanCache($group = null, $clientId = 0) { parent::cleanCache('com_content'); parent::cleanCache('mod_articles_archive'); parent::cleanCache('mod_articles_categories'); parent::cleanCache('mod_articles_category'); parent::cleanCache('mod_articles_latest'); parent::cleanCache('mod_articles_news'); parent::cleanCache('mod_articles_popular'); } /** * Void hit function for pagebreak when editing content from frontend * * @return void * * @since 3.6.0 */ public function hit() { return; } /** * Is the user allowed to create an on the fly category? * * @return boolean * * @since 3.6.1 */ private function canCreateCategory() { return JFactory::getUser()->authorise('core.create', 'com_content'); } /** * Delete #__content_frontpage items if the deleted articles was featured * * @param object $pks The primary key related to the contents that was deleted. * * @return boolean * * @since 3.7.0 */ public function delete(&$pks) { $return = parent::delete($pks); if ($return) { // Now check to see if this articles was featured if so delete it from the #__content_frontpage table $db = $this->getDbo(); $query = $db->getQuery(true) ->delete($db->quoteName('#__content_frontpage')) ->where('content_id IN (' . implode(',', $pks) . ')'); $db->setQuery($query); $db->execute(); } return $return; } } PK Z��[��1�3 �3 models/articles.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\Utilities\ArrayHelper; /** * Methods supporting a list of article records. * * @since 1.6 */ class ContentModelArticles extends JModelList { /** * Constructor. * * @param array $config An optional associative array of configuration settings. * * @since 1.6 * @see JControllerLegacy */ public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array( 'id', 'a.id', 'title', 'a.title', 'alias', 'a.alias', 'checked_out', 'a.checked_out', 'checked_out_time', 'a.checked_out_time', 'catid', 'a.catid', 'category_title', 'state', 'a.state', 'access', 'a.access', 'access_level', 'created', 'a.created', 'modified', 'a.modified', 'created_by', 'a.created_by', 'created_by_alias', 'a.created_by_alias', 'ordering', 'a.ordering', 'featured', 'a.featured', 'language', 'a.language', 'hits', 'a.hits', 'publish_up', 'a.publish_up', 'publish_down', 'a.publish_down', 'published', 'a.published', 'author_id', 'category_id', 'level', 'tag', 'rating_count', 'rating', ); if (JLanguageAssociations::isEnabled()) { $config['filter_fields'][] = 'association'; } } parent::__construct($config); } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering An optional ordering field. * @param string $direction An optional direction (asc|desc). * * @return void * * @since 1.6 */ protected function populateState($ordering = 'a.id', $direction = 'desc') { $app = JFactory::getApplication(); $forcedLanguage = $app->input->get('forcedLanguage', '', 'cmd'); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; } // Adjust the context to support forced languages. if ($forcedLanguage) { $this->context .= '.' . $forcedLanguage; } $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); $this->setState('filter.published', $published); $level = $this->getUserStateFromRequest($this->context . '.filter.level', 'filter_level'); $this->setState('filter.level', $level); $language = $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', ''); $this->setState('filter.language', $language); $formSubmited = $app->input->post->get('form_submited'); $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access'); $authorId = $this->getUserStateFromRequest($this->context . '.filter.author_id', 'filter_author_id'); $categoryId = $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id'); $tag = $this->getUserStateFromRequest($this->context . '.filter.tag', 'filter_tag', ''); if ($formSubmited) { $access = $app->input->post->get('access'); $this->setState('filter.access', $access); $authorId = $app->input->post->get('author_id'); $this->setState('filter.author_id', $authorId); $categoryId = $app->input->post->get('category_id'); $this->setState('filter.category_id', $categoryId); $tag = $app->input->post->get('tag'); $this->setState('filter.tag', $tag); } // List state information. parent::populateState($ordering, $direction); // Force a language if (!empty($forcedLanguage)) { $this->setState('filter.language', $forcedLanguage); $this->setState('filter.forcedLanguage', $forcedLanguage); } } /** * Method to get a store id based on model configuration state. * * This is necessary because the model is used by the component and * different modules that might need different sets of data or different * ordering requirements. * * @param string $id A prefix for the store id. * * @return string A store id. * * @since 1.6 */ protected function getStoreId($id = '') { // Compile the store id. $id .= ':' . $this->getState('filter.search'); $id .= ':' . serialize($this->getState('filter.access')); $id .= ':' . $this->getState('filter.published'); $id .= ':' . serialize($this->getState('filter.category_id')); $id .= ':' . serialize($this->getState('filter.author_id')); $id .= ':' . $this->getState('filter.language'); $id .= ':' . serialize($this->getState('filter.tag')); return parent::getStoreId($id); } /** * Build an SQL query to load the list data. * * @return JDatabaseQuery * * @since 1.6 */ protected function getListQuery() { // Create a new query object. $db = $this->getDbo(); $query = $db->getQuery(true); $user = JFactory::getUser(); // Select the required fields from the table. $query->select( $this->getState( 'list.select', 'a.id, a.title, a.alias, a.checked_out, a.checked_out_time, a.catid' . ', a.state, a.access, a.created, a.created_by, a.created_by_alias, a.modified, a.ordering, a.featured, a.language, a.hits' . ', a.publish_up, a.publish_down, a.note' ) ); $query->from('#__content AS a'); // Join over the language $query->select('l.title AS language_title, l.image AS language_image') ->join('LEFT', $db->quoteName('#__languages') . ' AS l ON l.lang_code = a.language'); // Join over the users for the checked out user. $query->select('uc.name AS editor') ->join('LEFT', '#__users AS uc ON uc.id=a.checked_out'); // Join over the asset groups. $query->select('ag.title AS access_level') ->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Join over the categories. $query->select('c.title AS category_title, c.created_user_id AS category_uid, c.level AS category_level') ->join('LEFT', '#__categories AS c ON c.id = a.catid'); // Join over the parent categories. $query->select('parent.title AS parent_category_title, parent.id AS parent_category_id, parent.created_user_id AS parent_category_uid, parent.level AS parent_category_level') ->join('LEFT', '#__categories AS parent ON parent.id = c.parent_id'); // Join over the users for the author. $query->select('ua.name AS author_name') ->join('LEFT', '#__users AS ua ON ua.id = a.created_by'); // Join on voting table if (JPluginHelper::isEnabled('content', 'vote')) { $query->select('COALESCE(NULLIF(ROUND(v.rating_sum / v.rating_count, 0), 0), 0) AS rating, COALESCE(NULLIF(v.rating_count, 0), 0) as rating_count') ->join('LEFT', '#__content_rating AS v ON a.id = v.content_id'); } // Join over the associations. if (JLanguageAssociations::isEnabled()) { $subQuery = $db->getQuery(true) ->select('COUNT(' . $db->quoteName('asso1.id') . ') > 1') ->from($db->quoteName('#__associations', 'asso1')) ->join('INNER', $db->quoteName('#__associations', 'asso2') . ' ON ' . $db->quoteName('asso1.key') . ' = ' . $db->quoteName('asso2.key')) ->where( array( $db->quoteName('asso1.id') . ' = ' . $db->quoteName('a.id'), $db->quoteName('asso1.context') . ' = ' . $db->quote('com_content.item'), ) ); $query->select('(' . $subQuery . ') AS ' . $db->quoteName('association')); } // Filter by access level. $access = $this->getState('filter.access'); if (is_numeric($access)) { $query->where('a.access = ' . (int) $access); } elseif (is_array($access)) { $access = ArrayHelper::toInteger($access); $access = implode(',', $access); $query->where('a.access IN (' . $access . ')'); } // Filter by access level on categories. if (!$user->authorise('core.admin')) { $groups = implode(',', $user->getAuthorisedViewLevels()); $query->where('a.access IN (' . $groups . ')'); $query->where('c.access IN (' . $groups . ')'); } // Filter by published state $published = $this->getState('filter.published'); if (is_numeric($published)) { $query->where('a.state = ' . (int) $published); } elseif ($published === '') { $query->where('(a.state = 0 OR a.state = 1)'); } // Filter by categories and by level $categoryId = $this->getState('filter.category_id', array()); $level = $this->getState('filter.level'); if (!is_array($categoryId)) { $categoryId = $categoryId ? array($categoryId) : array(); } // Case: Using both categories filter and by level filter if (count($categoryId)) { $categoryId = ArrayHelper::toInteger($categoryId); $categoryTable = JTable::getInstance('Category', 'JTable'); $subCatItemsWhere = array(); foreach ($categoryId as $filter_catid) { $categoryTable->load($filter_catid); $subCatItemsWhere[] = '(' . ($level ? 'c.level <= ' . ((int) $level + (int) $categoryTable->level - 1) . ' AND ' : '') . 'c.lft >= ' . (int) $categoryTable->lft . ' AND ' . 'c.rgt <= ' . (int) $categoryTable->rgt . ')'; } $query->where('(' . implode(' OR ', $subCatItemsWhere) . ')'); } // Case: Using only the by level filter elseif ($level) { $query->where('c.level <= ' . (int) $level); } // Filter by author $authorId = $this->getState('filter.author_id'); if (is_numeric($authorId)) { $type = $this->getState('filter.author_id.include', true) ? '= ' : '<>'; $query->where('a.created_by ' . $type . (int) $authorId); } elseif (is_array($authorId)) { $authorId = ArrayHelper::toInteger($authorId); $authorId = implode(',', $authorId); $query->where('a.created_by IN (' . $authorId . ')'); } // Filter by search in title. $search = $this->getState('filter.search'); if (!empty($search)) { if (stripos($search, 'id:') === 0) { $query->where('a.id = ' . (int) substr($search, 3)); } elseif (stripos($search, 'author:') === 0) { $search = $db->quote('%' . $db->escape(substr($search, 7), true) . '%'); $query->where('(ua.name LIKE ' . $search . ' OR ua.username LIKE ' . $search . ')'); } elseif (stripos($search, 'content:') === 0) { $search = $db->quote('%' . $db->escape(substr($search, 8), true) . '%'); $query->where('(a.introtext LIKE ' . $search . ' OR a.fulltext LIKE ' . $search . ')'); } else { $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%')); $query->where('(a.title LIKE ' . $search . ' OR a.alias LIKE ' . $search . ' OR a.note LIKE ' . $search . ')'); } } // Filter on the language. if ($language = $this->getState('filter.language')) { $query->where('a.language = ' . $db->quote($language)); } $tag = $this->getState('filter.tag'); // Run simplified query when filtering by one tag. if (\is_array($tag) && \count($tag) === 1) { $tag = $tag[0]; } if ($tag && \is_array($tag)) { $tag = ArrayHelper::toInteger($tag); $subQuery = $db->getQuery(true) ->select('DISTINCT ' . $db->quoteName('content_item_id')) ->from($db->quoteName('#__contentitem_tag_map')) ->where( array( $db->quoteName('tag_id') . ' IN (' . implode(',', $tag) . ')', $db->quoteName('type_alias') . ' = ' . $db->quote('com_content.article'), ) ); $query->join( 'INNER', '(' . $subQuery . ') AS ' . $db->quoteName('tagmap') . ' ON ' . $db->quoteName('tagmap.content_item_id') . ' = ' . $db->quoteName('a.id') ); } elseif ($tag = (int) $tag) { $query->join( 'INNER', $db->quoteName('#__contentitem_tag_map', 'tagmap') . ' ON ' . $db->quoteName('tagmap.content_item_id') . ' = ' . $db->quoteName('a.id') ) ->where( array( $db->quoteName('tagmap.tag_id') . ' = ' . $tag, $db->quoteName('tagmap.type_alias') . ' = ' . $db->quote('com_content.article'), ) ); } // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); $orderDirn = $this->state->get('list.direction', 'DESC'); if ($orderCol == 'a.ordering' || $orderCol == 'category_title') { $orderCol = $db->quoteName('c.title') . ' ' . $orderDirn . ', ' . $db->quoteName('a.ordering'); } $query->order($db->escape($orderCol) . ' ' . $db->escape($orderDirn)); return $query; } /** * Build a list of authors * * @return stdClass * * @since 1.6 * * @deprecated 4.0 To be removed with Hathor */ public function getAuthors() { // Create a new query object. $db = $this->getDbo(); $query = $db->getQuery(true); // Construct the query $query->select('u.id AS value, u.name AS text') ->from('#__users AS u') ->join('INNER', '#__content AS c ON c.created_by = u.id') ->group('u.id, u.name') ->order('u.name'); // Setup the query $db->setQuery($query); // Return the result return $db->loadObjectList(); } } PK Z��[Ce1�� � models/feature.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JLoader::register('ContentModelArticle', __DIR__ . '/article.php'); /** * Feature model. * * @since 1.6 */ class ContentModelFeature extends ContentModelArticle { /** * Returns a Table object, always creating it. * * @param string $type The table type to instantiate * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * * @return JTable A database object * * @since 1.6 */ public function getTable($type = 'Featured', $prefix = 'ContentTable', $config = array()) { return JTable::getInstance($type, $prefix, $config); } /** * A protected method to get a set of ordering conditions. * * @param object $table A record object. * * @return array An array of conditions to add to add to ordering queries. * * @since 1.6 */ protected function getReorderConditions($table) { return array(); } } PK Z��[b���! ! models/featured.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\Utilities\ArrayHelper; JLoader::register('ContentModelArticles', __DIR__ . '/articles.php'); /** * Methods supporting a list of featured article records. * * @since 1.6 */ class ContentModelFeatured extends ContentModelArticles { /** * Constructor. * * @param array $config An optional associative array of configuration settings. * * @see JControllerLegacy * @since 1.6 */ public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array( 'id', 'a.id', 'title', 'a.title', 'alias', 'a.alias', 'checked_out', 'a.checked_out', 'checked_out_time', 'a.checked_out_time', 'catid', 'a.catid', 'category_title', 'state', 'a.state', 'access', 'a.access', 'access_level', 'created', 'a.created', 'created_by', 'a.created_by', 'created_by_alias', 'a.created_by_alias', 'ordering', 'a.ordering', 'featured', 'a.featured', 'language', 'a.language', 'hits', 'a.hits', 'publish_up', 'a.publish_up', 'publish_down', 'a.publish_down', 'fp.ordering', 'published', 'a.published', 'author_id', 'category_id', 'level', 'tag', 'rating_count', 'rating', ); } parent::__construct($config); } /** * Build an SQL query to load the list data. * * @return JDatabaseQuery * * @since 1.6 */ protected function getListQuery() { // Create a new query object. $db = $this->getDbo(); $query = $db->getQuery(true); $user = JFactory::getUser(); // Select the required fields from the table. $query->select( $this->getState( 'list.select', 'a.id, a.title, a.alias, a.checked_out, a.checked_out_time, a.catid, a.state, a.access, a.created, a.hits,' . 'a.created_by, a.featured, a.language, a.created_by_alias, a.publish_up, a.publish_down, a.note' ) ); $query->from('#__content AS a'); // Join over the language $query->select('l.title AS language_title, l.image AS language_image') ->join('LEFT', $db->quoteName('#__languages') . ' AS l ON l.lang_code = a.language'); // Join over the content table. $query->select('fp.ordering') ->join('INNER', '#__content_frontpage AS fp ON fp.content_id = a.id'); // Join over the users for the checked out user. $query->select('uc.name AS editor') ->join('LEFT', '#__users AS uc ON uc.id=a.checked_out'); // Join over the asset groups. $query->select('ag.title AS access_level') ->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Join over the categories. $query->select('c.title AS category_title, c.created_user_id AS category_uid, c.level AS category_level') ->join('LEFT', '#__categories AS c ON c.id = a.catid'); // Join over the parent categories. $query->select('parent.title AS parent_category_title, parent.id AS parent_category_id, parent.created_user_id AS parent_category_uid, parent.level AS parent_category_level') ->join('LEFT', '#__categories AS parent ON parent.id = c.parent_id'); // Join over the users for the author. $query->select('ua.name AS author_name') ->join('LEFT', '#__users AS ua ON ua.id = a.created_by'); // Join on voting table if (JPluginHelper::isEnabled('content', 'vote')) { $query->select('COALESCE(NULLIF(ROUND(v.rating_sum / v.rating_count, 0), 0), 0) AS rating, COALESCE(NULLIF(v.rating_count, 0), 0) as rating_count') ->join('LEFT', '#__content_rating AS v ON a.id = v.content_id'); } // Filter by access level. $access = $this->getState('filter.access'); if (is_numeric($access)) { $query->where('a.access = ' . (int) $access); } elseif (is_array($access)) { $access = ArrayHelper::toInteger($access); $access = implode(',', $access); $query->where('a.access IN (' . $access . ')'); } // Filter by access level on categories. if (!$user->authorise('core.admin')) { $groups = implode(',', $user->getAuthorisedViewLevels()); $query->where('a.access IN (' . $groups . ')'); $query->where('c.access IN (' . $groups . ')'); } // Filter by published state $published = $this->getState('filter.published'); if (is_numeric($published)) { $query->where('a.state = ' . (int) $published); } elseif ($published === '') { $query->where('(a.state = 0 OR a.state = 1)'); } // Filter by a single or group of categories. $baselevel = 1; $categoryId = $this->getState('filter.category_id'); if (is_array($categoryId) && count($categoryId) === 1) { $cat_tbl = JTable::getInstance('Category', 'JTable'); $cat_tbl->load($categoryId[0]); $rgt = $cat_tbl->rgt; $lft = $cat_tbl->lft; $baselevel = (int) $cat_tbl->level; $query->where('c.lft >= ' . (int) $lft) ->where('c.rgt <= ' . (int) $rgt); } elseif (is_array($categoryId)) { $categoryId = implode(',', ArrayHelper::toInteger($categoryId)); $query->where('a.catid IN (' . $categoryId . ')'); } // Filter on the level. if ($level = $this->getState('filter.level')) { $query->where('c.level <= ' . ((int) $level + (int) $baselevel - 1)); } // Filter by author $authorId = $this->getState('filter.author_id'); if (is_numeric($authorId)) { $type = $this->getState('filter.author_id.include', true) ? '= ' : '<>'; $query->where('a.created_by ' . $type . (int) $authorId); } elseif (is_array($authorId)) { $authorId = ArrayHelper::toInteger($authorId); $authorId = implode(',', $authorId); $query->where('a.created_by IN (' . $authorId . ')'); } // Filter by search in title. $search = $this->getState('filter.search'); if (!empty($search)) { if (stripos($search, 'id:') === 0) { $query->where('a.id = ' . (int) substr($search, 3)); } elseif (stripos($search, 'author:') === 0) { $search = $db->quote('%' . $db->escape(substr($search, 7), true) . '%'); $query->where('(ua.name LIKE ' . $search . ' OR ua.username LIKE ' . $search . ')'); } elseif (stripos($search, 'content:') === 0) { $search = $db->quote('%' . $db->escape(substr($search, 8), true) . '%'); $query->where('(a.introtext LIKE ' . $search . ' OR a.fulltext LIKE ' . $search . ')'); } else { $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%')); $query->where('(a.title LIKE ' . $search . ' OR a.alias LIKE ' . $search . ' OR a.note LIKE ' . $search . ')'); } } // Filter on the language. if ($language = $this->getState('filter.language')) { $query->where('a.language = ' . $db->quote($language)); } // Filter by a single or group of tags. $tagId = $this->getState('filter.tag'); if (is_array($tagId) && count($tagId) === 1) { $tagId = current($tagId); } if (is_array($tagId)) { $tagId = implode(',', ArrayHelper::toInteger($tagId)); if ($tagId) { $subQuery = $db->getQuery(true) ->select('DISTINCT content_item_id') ->from($db->quoteName('#__contentitem_tag_map')) ->where('tag_id IN (' . $tagId . ')') ->where('type_alias = ' . $db->quote('com_content.article')); $query->join('INNER', '(' . (string) $subQuery . ') AS tagmap ON tagmap.content_item_id = a.id'); } } elseif ($tagId) { $query->join( 'INNER', $db->quoteName('#__contentitem_tag_map', 'tagmap') . ' ON tagmap.tag_id = ' . (int) $tagId . ' AND tagmap.content_item_id = a.id' . ' AND tagmap.type_alias = ' . $db->quote('com_content.article') ); } // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.title'); $orderDirn = $this->state->get('list.direction', 'ASC'); $query->order($db->escape($orderCol) . ' ' . $db->escape($orderDirn)); return $query; } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering An optional ordering field. * @param string $direction An optional direction (asc|desc). * * @return void * * @since 3.5 */ protected function populateState($ordering = 'a.title', $direction = 'asc') { parent::populateState($ordering, $direction); } } PK Z��[Tp?&e&