File manager - Edit - /home/ferretapmx/public_html/com_contact.zip
Back
PK a �\�叧 � $ src/Serializer/ContactSerializer.phpnu �[��� <?php /** * Joomla! Content Management System * * @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Contact\Api\Serializer; use Joomla\CMS\Router\Route; use Joomla\CMS\Serializer\JoomlaSerializer; use Joomla\CMS\Tag\TagApiSerializerTrait; use Joomla\CMS\Uri\Uri; use Tobscure\JsonApi\Collection; use Tobscure\JsonApi\Relationship; use Tobscure\JsonApi\Resource; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Temporary serializer * * @since 4.0.0 */ class ContactSerializer extends JoomlaSerializer { use TagApiSerializerTrait; /** * Build content relationships by associations * * @param \stdClass $model Item model * * @return Relationship * * @since 4.0.0 */ public function languageAssociations($model) { $resources = []; // @todo: This can't be hardcoded in the future? $serializer = new JoomlaSerializer($this->type); foreach ($model->associations as $association) { $resources[] = (new Resource($association, $serializer)) ->addLink('self', Route::link('site', Uri::root() . 'api/index.php/v1/contacts/' . $association->id)); } $collection = new Collection($resources, $serializer); return new Relationship($collection); } /** * Build category relationship * * @param \stdClass $model Item model * * @return Relationship * * @since 4.0.0 */ public function category($model) { $serializer = new JoomlaSerializer('categories'); $resource = (new Resource($model->catid, $serializer)) ->addLink('self', Route::link('site', Uri::root() . 'api/index.php/v1/contacts/categories/' . $model->catid)); return new Relationship($resource); } /** * Build category relationship * * @param \stdClass $model Item model * * @return Relationship * * @since 4.0.0 */ public function createdBy($model) { $serializer = new JoomlaSerializer('users'); $resource = (new Resource($model->created_by, $serializer)) ->addLink('self', Route::link('site', Uri::root() . 'api/index.php/v1/users/' . $model->created_by)); return new Relationship($resource); } /** * Build editor relationship * * @param \stdClass $model Item model * * @return Relationship * * @since 4.0.0 */ public function modifiedBy($model) { $serializer = new JoomlaSerializer('users'); $resource = (new Resource($model->modified_by, $serializer)) ->addLink('self', Route::link('site', Uri::root() . 'api/index.php/v1/users/' . $model->modified_by)); return new Relationship($resource); } /** * Build contact user relationship * * @param \stdClass $model Item model * * @return Relationship * * @since 4.0.0 */ public function userId($model) { $serializer = new JoomlaSerializer('users'); $resource = (new Resource($model->user_id, $serializer)) ->addLink('self', Route::link('site', Uri::root() . 'api/index.php/v1/users/' . $model->user_id)); return new Relationship($resource); } } PK a �\�Sʉ� � src/Serializer/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK a �\W���� � ! src/View/Contacts/JsonapiView.phpnu �[��� <?php /** * @package Joomla.API * @subpackage com_contact * * @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Contact\Api\View\Contacts; use Joomla\CMS\Language\Multilanguage; use Joomla\CMS\MVC\View\JsonApiView as BaseApiView; use Joomla\Component\Contact\Api\Serializer\ContactSerializer; use Joomla\Component\Content\Api\Helper\ContentHelper; use Joomla\Component\Fields\Administrator\Helper\FieldsHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * The contacts view * * @since 4.0.0 */ class JsonapiView extends BaseApiView { /** * The fields to render item in the documents * * @var array * @since 4.0.0 */ protected $fieldsToRenderItem = [ 'id', 'alias', 'name', 'category', 'created', 'created_by', 'created_by_alias', 'modified', 'modified_by', 'image', 'tags', 'featured', 'publish_up', 'publish_down', 'version', 'hits', 'metakey', 'metadesc', 'metadata', 'con_position', 'address', 'suburb', 'state', 'country', 'postcode', 'telephone', 'fax', 'misc', 'email_to', 'default_con', 'user_id', 'access', 'mobile', 'webpage', 'sortname1', 'sortname2', 'sortname3', ]; /** * The fields to render items in the documents * * @var array * @since 4.0.0 */ protected $fieldsToRenderList = [ 'id', 'alias', 'name', 'category', 'created', 'created_by', 'created_by_alias', 'modified', 'modified_by', 'image', 'tags', 'user_id', ]; /** * The relationships the item has * * @var array * @since 4.0.0 */ protected $relationship = [ 'category', 'created_by', 'modified_by', 'user_id', 'tags', ]; /** * Constructor. * * @param array $config A named configuration array for object construction. * contentType: the name (optional) of the content type to use for the serialization * * @since 4.0.0 */ public function __construct($config = []) { if (\array_key_exists('contentType', $config)) { $this->serializer = new ContactSerializer($config['contentType']); } parent::__construct($config); } /** * Execute and display a template script. * * @param ?array $items Array of items * * @return string * * @since 4.0.0 */ public function displayList(?array $items = null) { foreach (FieldsHelper::getFields('com_contact.contact') as $field) { $this->fieldsToRenderList[] = $field->name; } return parent::displayList(); } /** * Execute and display a template script. * * @param object $item Item * * @return string * * @since 4.0.0 */ public function displayItem($item = null) { foreach (FieldsHelper::getFields('com_contact.contact') as $field) { $this->fieldsToRenderItem[] = $field->name; } if (Multilanguage::isEnabled()) { $this->fieldsToRenderItem[] = 'languageAssociations'; $this->relationship[] = 'languageAssociations'; } return parent::displayItem(); } /** * Prepare item before render. * * @param object $item The model item * * @return object * * @since 4.0.0 */ protected function prepareItem($item) { foreach (FieldsHelper::getFields('com_contact.contact', $item, true) as $field) { $item->{$field->name} = $field->apivalue ?? $field->rawvalue; } if (Multilanguage::isEnabled() && !empty($item->associations)) { $associations = []; foreach ($item->associations as $language => $association) { $itemId = explode(':', $association)[0]; $associations[] = (object) [ 'id' => $itemId, 'language' => $language, ]; } $item->associations = $associations; } if (!empty($item->tags->tags)) { $tagsIds = explode(',', $item->tags->tags); $tagsNames = $item->tagsHelper->getTagNames($tagsIds); $item->tags = array_combine($tagsIds, $tagsNames); } else { $item->tags = []; } if (isset($item->image)) { $item->image = ContentHelper::resolve($item->image); } return parent::prepareItem($item); } } PK a �\�Sʉ� � src/View/Contacts/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK a �\�Sʉ� � src/View/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK a �\!� ,� � $ src/Controller/ContactController.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_contact * * @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Contact\Administrator\Controller; use Joomla\CMS\MVC\Controller\FormController; use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\CMS\Router\Route; use Joomla\CMS\Versioning\VersionableControllerTrait; use Joomla\Utilities\ArrayHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Controller for a single contact * * @since 1.6 */ class ContactController extends FormController { use VersionableControllerTrait; /** * 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 = []) { $categoryId = ArrayHelper::getValue($data, 'catid', $this->input->getInt('filter_category_id'), 'int'); if ($categoryId) { // If the category has been passed in the URL check it. return $this->app->getIdentity()->authorise('core.create', $this->option . '.category.' . $categoryId); } // In the absence of better information, revert to the component permissions. return parent::allowAdd($data); } /** * 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 = [], $key = 'id') { $recordId = isset($data[$key]) ? (int) $data[$key] : 0; // Since there is no asset tracking, fallback to the component permissions. if (!$recordId) { return parent::allowEdit($data, $key); } // Get the item. $item = $this->getModel()->getItem($recordId); // Since there is no item, return false. if (empty($item)) { return false; } $user = $this->app->getIdentity(); // Check if can edit own core.edit.own. $canEditOwn = $user->authorise('core.edit.own', $this->option . '.category.' . (int) $item->catid) && $item->created_by == $user->id; // Check the category core.edit permissions. return $canEditOwn || $user->authorise('core.edit', $this->option . '.category.' . (int) $item->catid); } /** * Method to run batch operations. * * @param object $model The model. * * @return boolean True if successful, false otherwise and internal error is set. * * @since 2.5 */ public function batch($model = null) { $this->checkToken(); // Set the model /** @var \Joomla\Component\Contact\Administrator\Model\ContactModel $model */ $model = $this->getModel('Contact', 'Administrator', []); // Preset the redirect $this->setRedirect(Route::_('index.php?option=com_contact&view=contacts' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } /** * Function that allows child controller access to model data * after the data has been saved. * * @param BaseDatabaseModel $model The data model object. * @param array $validData The validated data. * * @return void * * @since 4.1.0 */ protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { if ($this->getTask() === 'save2menu') { $editState = []; $id = $model->getState('contact.id'); $link = 'index.php?option=com_contact&view=contact'; $type = 'component'; $editState['link'] = $link; $editState['title'] = $model->getItem($id)->name; $editState['type'] = $type; $editState['request']['id'] = $id; $this->app->setUserState( 'com_menus.edit.item', [ 'data' => $editState, 'type' => $type, 'link' => $link, ] ); $this->setRedirect(Route::_('index.php?option=com_menus&view=item&client_id=0&menutype=mainmenu&layout=edit', false)); } elseif ($this->input->get('layout') === 'modal' && $this->task === 'save') { // When editing in modal then redirect to modalreturn layout $id = $model->getState('contact.id', ''); $return = 'index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($id) . '&layout=modalreturn&from-task=save'; $this->setRedirect(Route::_($return, false)); } } /** * Method to cancel an edit. * * @param string $key The name of the primary key of the URL variable. * * @return boolean True if access level checks pass, false otherwise. * * @since 5.1.0 */ public function cancel($key = null) { $result = parent::cancel($key); // When editing in modal then redirect to modalreturn layout if ($result && $this->input->get('layout') === 'modal') { $id = $this->input->get('id'); $return = 'index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($id) . '&layout=modalreturn&from-task=cancel'; $this->setRedirect(Route::_($return, false)); } return $result; } } PK a �\�Sʉ� � src/Controller/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK a �\�Sʉ� � src/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK a �\�Sʉ� � .htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK � �\���)�_ �_ config.xmlnu �[��� <?xml version="1.0" encoding="UTF-8"?> <config> <help key="Contacts:_Options"/> <inlinehelp button="show"/> <fieldset name="contact" label="COM_CONTACT_FIELD_CONFIG_INDIVIDUAL_CONTACT_DISPLAY" description="COM_CONTACT_FIELD_CONFIG_INDIVIDUAL_CONTACT_DESC" > <field name="contact_layout" type="componentlayout" label="JGLOBAL_FIELD_LAYOUT_LABEL" class="form-select" menuitems="true" extension="com_contact" view="contact" /> <field name="show_contact_category" type="list" label="COM_CONTACT_FIELD_CONTACT_SHOW_CATEGORY_LABEL" default="hide" validate="options" > <option value="hide">JHIDE</option> <option value="show_no_link">COM_CONTACT_FIELD_VALUE_NO_LINK</option> <option value="show_with_link">COM_CONTACT_FIELD_VALUE_WITH_LINK</option> </field> <field name="save_history" type="radio" layout="joomla.form.field.radio.switcher" label="JGLOBAL_SAVE_HISTORY_OPTIONS_LABEL" default="0" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="history_limit" type="number" label="JGLOBAL_HISTORY_LIMIT_OPTIONS_LABEL" default="10" filter="integer" showon="save_history:1" /> <field name="show_contact_list" type="radio" layout="joomla.form.field.radio.switcher" label="COM_CONTACT_FIELD_CONTACT_SHOW_LIST_LABEL" default="0" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_tags" type="radio" layout="joomla.form.field.radio.switcher" label="COM_CONTACT_FIELD_SHOW_TAGS_LABEL" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_info" type="radio" layout="joomla.form.field.radio.switcher" label="COM_CONTACT_FIELD_SHOW_INFO_LABEL" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_name" type="radio" label="COM_CONTACT_FIELD_PARAMS_NAME_LABEL" default="1" layout="joomla.form.field.radio.switcher" showon="show_info:1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_position" type="radio" label="COM_CONTACT_FIELD_PARAMS_CONTACT_POSITION_LABEL" default="1" layout="joomla.form.field.radio.switcher" showon="show_info:1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_email" type="radio" label="JGLOBAL_EMAIL" default="0" layout="joomla.form.field.radio.switcher" showon="show_info:1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="add_mailto_link" type="radio" label="COM_CONTACT_FIELD_PARAMS_ADD_MAILTO_LINK_LABEL" layout="joomla.form.field.radio.switcher" showon="show_info:1[AND]show_email:1" default="1" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="show_street_address" type="radio" label="COM_CONTACT_FIELD_PARAMS_STREET_ADDRESS_LABEL" default="1" layout="joomla.form.field.radio.switcher" showon="show_info:1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_suburb" type="radio" label="COM_CONTACT_FIELD_PARAMS_TOWN-SUBURB_LABEL" default="1" layout="joomla.form.field.radio.switcher" showon="show_info:1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_state" type="radio" label="COM_CONTACT_FIELD_PARAMS_STATE-COUNTY_LABEL" default="1" layout="joomla.form.field.radio.switcher" showon="show_info:1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_postcode" type="radio" label="COM_CONTACT_FIELD_PARAMS_POST-ZIP_CODE_LABEL" default="1" layout="joomla.form.field.radio.switcher" showon="show_info:1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_country" type="radio" label="COM_CONTACT_FIELD_PARAMS_COUNTRY_LABEL" default="1" layout="joomla.form.field.radio.switcher" showon="show_info:1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_telephone" type="radio" label="COM_CONTACT_FIELD_PARAMS_TELEPHONE_LABEL" default="1" layout="joomla.form.field.radio.switcher" showon="show_info:1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_mobile" type="radio" label="COM_CONTACT_FIELD_PARAMS_MOBILE_LABEL" default="1" layout="joomla.form.field.radio.switcher" showon="show_info:1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_fax" type="radio" label="COM_CONTACT_FIELD_PARAMS_FAX_LABEL" default="1" layout="joomla.form.field.radio.switcher" showon="show_info:1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_webpage" type="radio" label="COM_CONTACT_FIELD_PARAMS_WEBPAGE_LABEL" default="1" layout="joomla.form.field.radio.switcher" showon="show_info:1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_image" type="radio" label="COM_CONTACT_FIELD_PARAMS_SHOW_IMAGE_LABEL" default="1" layout="joomla.form.field.radio.switcher" showon="show_info:1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="image" type="media" schemes="http,https,ftp,ftps,data,file" validate="url" relative="true" label="COM_CONTACT_FIELD_PARAMS_IMAGE_LABEL" default="" showon="show_info:1[AND]show_image:1" /> <field name="show_misc" type="radio" layout="joomla.form.field.radio.switcher" label="COM_CONTACT_FIELD_PARAMS_MISC_INFO_LABEL" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="allow_vcard" type="radio" layout="joomla.form.field.radio.switcher" label="COM_CONTACT_FIELD_PARAMS_VCARD_LABEL" default="0" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_articles" type="radio" layout="joomla.form.field.radio.switcher" label="COM_CONTACT_FIELD_ARTICLES_SHOW_LABEL" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="articles_display_num" type="list" label="COM_CONTACT_FIELD_ARTICLES_DISPLAY_NUM_LABEL" default="10" showon="show_articles:1" validate="options" > <option value="use_contact">COM_CONTACT_FIELD_VALUE_USE_CONTACT_SETTINGS</option> <option value="5">J5</option> <option value="10">J10</option> <option value="15">J15</option> <option value="20">J20</option> <option value="25">J25</option> <option value="30">J30</option> <option value="50">J50</option> <option value="75">J75</option> <option value="100">J100</option> <option value="150">J150</option> <option value="200">J200</option> <option value="250">J250</option> <option value="300">J300</option> <option value="0">JALL</option> </field> <field name="show_profile" type="radio" layout="joomla.form.field.radio.switcher" label="COM_CONTACT_FIELD_PROFILE_SHOW_LABEL" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_user_custom_fields" type="fieldgroups" label="COM_CONTACT_FIELD_USER_CUSTOM_FIELDS_SHOW_LABEL" multiple="true" context="com_users.user" addfieldprefix="Joomla\Component\Fields\Administrator\Field" layout="joomla.form.field.list-fancy-select" > <option value="-1">JALL</option> </field> <field name="show_links" type="radio" layout="joomla.form.field.radio.switcher" label="COM_CONTACT_FIELD_SHOW_LINKS_LABEL" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="linka_name" type="text" label="COM_CONTACT_FIELD_LINKA_NAME_LABEL" default="" showon="show_links:1" /> <field name="linkb_name" type="text" label="COM_CONTACT_FIELD_LINKB_NAME_LABEL" default="" showon="show_links:1" /> <field name="linkc_name" type="text" label="COM_CONTACT_FIELD_LINKC_NAME_LABEL" default="" showon="show_links:1" /> <field name="linkd_name" type="text" label="COM_CONTACT_FIELD_LINKD_NAME_LABEL" default="" showon="show_links:1" /> <field name="linke_name" type="text" label="COM_CONTACT_FIELD_LINKE_NAME_LABEL" default="" showon="show_links:1" /> </fieldset> <fieldset name="Icons" label="COM_CONTACT_ICONS_SETTINGS" description="COM_CONTACT_ICONS_SETTINGS_DESC" > <field name="contact_icons" type="list" label="COM_CONTACT_FIELD_ICONS_SETTINGS_LABEL" default="0" validate="options" > <option value="0">COM_CONTACT_FIELD_VALUE_ICONS</option> <option value="1">COM_CONTACT_FIELD_VALUE_TEXT</option> <option value="2">COM_CONTACT_FIELD_VALUE_NONE</option> </field> <field name="icon_address" type="media" schemes="http,https,ftp,ftps,data,file" validate="url" relative="true" label="COM_CONTACT_FIELD_ICONS_ADDRESS_LABEL" hide_none="1" default="" showon="contact_icons:0" /> <field name="icon_email" type="media" schemes="http,https,ftp,ftps,data,file" validate="url" relative="true" label="COM_CONTACT_FIELD_ICONS_EMAIL_LABEL" hide_none="1" default="" showon="contact_icons:0" /> <field name="icon_telephone" type="media" schemes="http,https,ftp,ftps,data,file" validate="url" relative="true" label="COM_CONTACT_FIELD_ICONS_TELEPHONE_LABEL" hide_none="1" default="" showon="contact_icons:0" /> <field name="icon_mobile" type="media" schemes="http,https,ftp,ftps,data,file" validate="url" relative="true" label="COM_CONTACT_FIELD_ICONS_MOBILE_LABEL" hide_none="1" default="" showon="contact_icons:0" /> <field name="icon_fax" type="media" schemes="http,https,ftp,ftps,data,file" validate="url" relative="true" label="COM_CONTACT_FIELD_ICONS_FAX_LABEL" hide_none="1" default="" showon="contact_icons:0" /> <field name="icon_webpage" type="media" schemes="http,https,ftp,ftps,data,file" validate="url" relative="true" label="COM_CONTACT_FIELD_ICONS_WEBPAGE_LABEL" hide_none="1" default="" showon="contact_icons:0" /> <field name="icon_misc" type="media" schemes="http,https,ftp,ftps,data,file" validate="url" relative="true" label="COM_CONTACT_FIELD_ICONS_MISC_LABEL" hide_none="1" default="" showon="contact_icons:0" /> </fieldset> <fieldset name="Category" label="JCATEGORY" description="COM_CONTACT_FIELD_CONFIG_CATEGORY_DESC" > <field name="category_layout" type="componentlayout" label="JGLOBAL_FIELD_LAYOUT_LABEL" class="form-select" menuitems="true" extension="com_contact" view="category" /> <field name="show_category_title" type="radio" layout="joomla.form.field.radio.switcher" label="JGLOBAL_SHOW_CATEGORY_TITLE" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_description" type="radio" layout="joomla.form.field.radio.switcher" label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_description_image" type="radio" layout="joomla.form.field.radio.switcher" label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL" default="0" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="maxLevel" type="list" label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL" default="-1" validate="options" > <option value="-1">JALL</option> <option value="0">JNONE</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_no_contacts" type="radio" label="COM_CONTACT_NO_CONTACTS_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_category_heading_title_text" type="radio" label="JGLOBAL_SHOW_SUBCATEGORY_HEADING" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_subcat_desc" type="radio" layout="joomla.form.field.radio.switcher" label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL" default="1" showon="maxLevel:-1,1,2,3,4,5" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_empty_categories" type="radio" layout="joomla.form.field.radio.switcher" label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL" default="0" showon="maxLevel:-1,1,2,3,4,5" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_cat_items" type="radio" layout="joomla.form.field.radio.switcher" label="COM_CONTACT_FIELD_SHOW_CAT_ITEMS_LABEL" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_cat_tags" type="radio" layout="joomla.form.field.radio.switcher" label="COM_CONTACT_FIELD_SHOW_CAT_TAGS_LABEL" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> </fieldset> <fieldset name="categories" label="JCATEGORIES" description="COM_CONTACT_FIELD_CONFIG_CATEGORIES_DESC" > <field name="show_base_description" type="radio" layout="joomla.form.field.radio.switcher" label="JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_LABEL" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="maxLevelcat" type="list" label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL" default="-1" validate="options" > <option value="-1">JALL</option> <option value="0">JNONE</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_subcat_desc_cat" type="radio" layout="joomla.form.field.radio.switcher" label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL" default="1" showon="maxLevelcat:-1,1,2,3,4,5" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_empty_categories_cat" type="radio" layout="joomla.form.field.radio.switcher" label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL" default="0" showon="maxLevelcat:-1,1,2,3,4,5" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_cat_items_cat" type="radio" layout="joomla.form.field.radio.switcher" label="COM_CONTACT_FIELD_SHOW_CAT_ITEMS_LABEL" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> </fieldset> <fieldset name="contacts" label="JGLOBAL_LIST_LAYOUT_OPTIONS" description="COM_CONTACT_FIELD_CONFIG_TABLE_OF_CONTACTS_DESC" > <field name="filter_field" type="radio" layout="joomla.form.field.radio.switcher" label="JGLOBAL_FILTER_FIELD_LABEL" default="0" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_pagination_limit" type="radio" layout="joomla.form.field.radio.switcher" label="JGLOBAL_DISPLAY_SELECT_LABEL" default="0" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_headings" type="radio" layout="joomla.form.field.radio.switcher" label="JGLOBAL_SHOW_HEADINGS_LABEL" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_image_heading" type="radio" layout="joomla.form.field.radio.switcher" label="COM_CONTACT_FIELD_CONFIG_SHOW_IMAGE_LABEL" default="0" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_position_headings" type="radio" layout="joomla.form.field.radio.switcher" label="COM_CONTACT_FIELD_CONFIG_POSITION_LABEL" default="1" showon="show_headings:1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_email_headings" type="radio" layout="joomla.form.field.radio.switcher" label="JGLOBAL_EMAIL" default="0" showon="show_headings:1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_telephone_headings" type="radio" layout="joomla.form.field.radio.switcher" label="COM_CONTACT_FIELD_CONFIG_PHONE_LABEL" default="1" showon="show_headings:1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_mobile_headings" type="radio" layout="joomla.form.field.radio.switcher" label="COM_CONTACT_FIELD_CONFIG_MOBILE_LABEL" default="0" showon="show_headings:1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_fax_headings" type="radio" layout="joomla.form.field.radio.switcher" label="COM_CONTACT_FIELD_CONFIG_FAX_LABEL" default="0" showon="show_headings:1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_suburb_headings" type="radio" layout="joomla.form.field.radio.switcher" label="COM_CONTACT_FIELD_CONFIG_SUBURB_LABEL" default="0" showon="show_headings:1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_state_headings" type="radio" layout="joomla.form.field.radio.switcher" label="COM_CONTACT_FIELD_CONFIG_STATE_LABEL" default="0" showon="show_headings:1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_country_headings" type="radio" layout="joomla.form.field.radio.switcher" label="COM_CONTACT_FIELD_CONFIG_COUNTRY_LABEL" default="0" showon="show_headings:1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_pagination" type="list" label="JGLOBAL_PAGINATION_LABEL" default="2" validate="options" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> <option value="2">JGLOBAL_AUTO</option> </field> <field name="show_pagination_results" type="radio" layout="joomla.form.field.radio.switcher" label="JGLOBAL_PAGINATION_RESULTS_LABEL" default="1" showon="show_pagination:1,2" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="contacts_display_num" type="list" label="COM_CONTACT_NUMBER_CONTACTS_LIST_LABEL" default="10" validate="options" > <option value="5">J5</option> <option value="10">J10</option> <option value="15">J15</option> <option value="20">J20</option> <option value="25">J25</option> <option value="30">J30</option> <option value="50">J50</option> <option value="100">J100</option> <option value="0">JALL</option> </field> <field name="initial_sort" type="list" label="COM_CONTACT_FIELD_INITIAL_SORT_LABEL" default="ordering" validate="options" > <option value="name">COM_CONTACT_FIELD_VALUE_NAME</option> <option value="sortname">COM_CONTACT_FIELD_VALUE_SORT_NAME</option> <option value="ordering">COM_CONTACT_FIELD_VALUE_ORDERING</option> <option value="featuredordering">COM_CONTACT_FIELD_VALUE_ORDERING_FEATURED</option> </field> </fieldset> <fieldset name="Contact_Form" label="COM_CONTACT_FIELD_CONFIG_CONTACT_FORM" description="COM_CONTACT_FIELD_CONFIG_INDIVIDUAL_CONTACT_DESC" > <field name="captcha" type="plugins" label="COM_CONTACT_FIELD_CAPTCHA_LABEL" folder="captcha" filter="cmd" useglobal="true" > <option value="0">JOPTION_DO_NOT_USE</option> </field> <field name="show_email_form" type="radio" layout="joomla.form.field.radio.switcher" label="COM_CONTACT_FIELD_EMAIL_SHOW_FORM_LABEL" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_email_copy" type="radio" label="COM_CONTACT_FIELD_EMAIL_EMAIL_COPY_LABEL" default="0" layout="joomla.form.field.radio.switcher" showon="show_email_form:1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="banned_email" type="textarea" label="COM_CONTACT_FIELD_CONFIG_BANNED_EMAIL_LABEL" description="COM_CONTACT_FIELD_CONFIG_BANNED_EMAIL_DESC" default="" rows="3" cols="30" showon="show_email_form:1" /> <field name="banned_subject" type="textarea" label="COM_CONTACT_FIELD_CONFIG_BANNED_SUBJECT_LABEL" description="COM_CONTACT_FIELD_CONFIG_BANNED_SUBJECT_DESC" default="" rows="3" cols="30" showon="show_email_form:1" /> <field name="banned_text" type="textarea" label="COM_CONTACT_FIELD_CONFIG_BANNED_TEXT_LABEL" description="COM_CONTACT_FIELD_CONFIG_BANNED_TEXT_DESC" default="" rows="3" cols="30" showon="show_email_form:1" /> <field name="validate_session" type="radio" layout="joomla.form.field.radio.switcher" label="COM_CONTACT_FIELD_CONFIG_SESSION_CHECK_LABEL" default="1" showon="show_email_form:1" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="custom_reply" type="radio" label="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_LABEL" description="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_DESC" layout="joomla.form.field.radio.switcher" default="0" showon="show_email_form:1" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="redirect" type="text" label="COM_CONTACT_FIELD_CONFIG_REDIRECT_LABEL" default="" showon="show_email_form:1" /> </fieldset> <fieldset name="integration" label="JGLOBAL_INTEGRATION_LABEL" description="COM_CONTACT_CONFIG_INTEGRATION_SETTINGS_DESC" > <fieldset name="integration_newsfeeds" label="JGLOBAL_FEED_TITLE" > <field name="show_feed_link" type="radio" layout="joomla.form.field.radio.switcher" label="JGLOBAL_SHOW_FEED_LINK_LABEL" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> </fieldset> <fieldset name="integration_sef" label="JGLOBAL_SEF_TITLE" > <field name="sef_ids" type="radio" layout="joomla.form.field.radio.switcher" default="0" label="JGLOBAL_SEF_NOIDS_LABEL" filter="integer"> <option value="0">JNO</option> <option value="1">JYES</option> </field> </fieldset> <fieldset name="integration_customfields" label="JGLOBAL_FIELDS_TITLE" > <field name="custom_fields_enable" type="radio" layout="joomla.form.field.radio.switcher" label="JGLOBAL_CUSTOM_FIELDS_ENABLE_LABEL" default="1" > <option value="0">JNO</option> <option value="1">JYES</option> </field> </fieldset> </fieldset> <fieldset name="permissions" label="JCONFIG_PERMISSIONS_LABEL" > <field name="rules" type="rules" label="JCONFIG_PERMISSIONS_LABEL" validate="rules" filter="rules" component="com_contact" section="component" /> </fieldset> </config> PK � �\��, , sql/uninstall.mysql.utf8.sqlnu �[��� DROP TABLE IF EXISTS `#__contact_details`; PK � �\q��� � sql/install.mysql.utf8.sqlnu �[��� -- -- Table structure for table `#__contact_details` -- CREATE TABLE IF NOT EXISTS `#__contact_details` ( `id` int NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `alias` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL, `con_position` varchar(255), `address` text, `suburb` varchar(100), `state` varchar(100), `country` varchar(100), `postcode` varchar(100), `telephone` varchar(255), `fax` varchar(255), `misc` mediumtext, `image` varchar(255), `email_to` varchar(255), `default_con` tinyint unsigned NOT NULL DEFAULT 0, `published` tinyint NOT NULL DEFAULT 0, `checked_out` int unsigned NOT NULL DEFAULT 0, `checked_out_time` datetime, `ordering` int NOT NULL DEFAULT 0, `params` text NOT NULL, `user_id` int NOT NULL DEFAULT 0, `catid` int NOT NULL DEFAULT 0, `access` int unsigned NOT NULL DEFAULT 0, `mobile` varchar(255) NOT NULL DEFAULT '', `webpage` varchar(255) NOT NULL DEFAULT '', `sortname1` varchar(255) NOT NULL DEFAULT '', `sortname2` varchar(255) NOT NULL DEFAULT '', `sortname3` varchar(255) NOT NULL DEFAULT '', `language` varchar(7) NOT NULL, `created` datetime NOT NULL, `created_by` int unsigned NOT NULL DEFAULT 0, `created_by_alias` varchar(255) NOT NULL DEFAULT '', `modified` datetime NOT NULL, `modified_by` int unsigned NOT NULL DEFAULT 0, `metakey` text NOT NULL, `metadesc` text NOT NULL, `metadata` text NOT NULL, `featured` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Set if contact is featured.', `publish_up` datetime, `publish_down` datetime, `version` int unsigned NOT NULL DEFAULT 1, `hits` int unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY `idx_access` (`access`), KEY `idx_checkout` (`checked_out`), KEY `idx_state` (`published`), KEY `idx_catid` (`catid`), KEY `idx_createdby` (`created_by`), KEY `idx_featured_catid` (`featured`,`catid`), KEY `idx_language` (`language`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; PK � �\�Sʉ� � sql/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK � �\����� � helpers/contact.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_contact * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt * * @phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace */ // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Contact component helper. * * @since 1.6 * * @deprecated 4.3 will be removed in 6.0 * Use \Joomla\Component\Contact\Administrator\Helper\ContactHelper instead */ class ContactHelper extends \Joomla\Component\Contact\Administrator\Helper\ContactHelper { } PK � �\�Sʉ� � helpers/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK � �\��]�Z Z src/Table/ContactTable.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_contact * * @copyright (C) 2005 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Contact\Administrator\Table; use Joomla\CMS\Application\ApplicationHelper; use Joomla\CMS\Factory; use Joomla\CMS\Filter\InputFilter; use Joomla\CMS\Language\Text; use Joomla\CMS\String\PunycodeHelper; use Joomla\CMS\Table\Table; use Joomla\CMS\Tag\TaggableTableInterface; use Joomla\CMS\Tag\TaggableTableTrait; use Joomla\CMS\User\CurrentUserInterface; use Joomla\CMS\User\CurrentUserTrait; use Joomla\CMS\Versioning\VersionableTableInterface; use Joomla\Database\DatabaseInterface; use Joomla\Event\DispatcherInterface; use Joomla\String\StringHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Contact Table class. * * @since 1.0 */ class ContactTable extends Table implements VersionableTableInterface, TaggableTableInterface, CurrentUserInterface { use TaggableTableTrait; use CurrentUserTrait; /** * Indicates that columns fully support the NULL value in the database * * @var boolean * @since 4.0.0 */ protected $_supportNullValue = true; /** * Ensure the params and metadata are json encoded in the bind method * * @var array * @since 3.3 */ protected $_jsonEncode = ['params', 'metadata']; /** * Constructor * * @param DatabaseInterface $db Database connector object * @param ?DispatcherInterface $dispatcher Event dispatcher for this table * * @since 1.0 */ public function __construct(DatabaseInterface $db, ?DispatcherInterface $dispatcher = null) { $this->typeAlias = 'com_contact.contact'; parent::__construct('#__contact_details', 'id', $db, $dispatcher); $this->setColumnAlias('title', 'name'); } /** * Stores a contact. * * @param boolean $updateNulls True to update fields even if they are null. * * @return boolean True on success, false on failure. * * @since 1.6 */ public function store($updateNulls = true) { $date = Factory::getDate()->toSql(); $userId = $this->getCurrentUser()->id; // Set created date if not set. if (!(int) $this->created) { $this->created = $date; } if ($this->id) { // Existing item $this->modified_by = $userId; $this->modified = $date; } else { // Field created_by field can be set by the user, so we don't touch it if it's set. if (empty($this->created_by)) { $this->created_by = $userId; } if (!(int) $this->modified) { $this->modified = $date; } if (empty($this->modified_by)) { $this->modified_by = $userId; } } // Store utf8 email as punycode if ($this->email_to !== null) { $this->email_to = PunycodeHelper::emailToPunycode($this->email_to); } // Convert IDN urls to punycode if ($this->webpage !== null) { $this->webpage = PunycodeHelper::urlToPunycode($this->webpage); } // Verify that the alias is unique $table = new self($this->getDatabase(), $this->getDispatcher()); if ($table->load(['alias' => $this->alias, 'catid' => $this->catid]) && ($table->id != $this->id || $this->id == 0)) { // Is the existing contact trashed? $this->setError(Text::_('COM_CONTACT_ERROR_UNIQUE_ALIAS')); if ($table->published === -2) { $this->setError(Text::_('COM_CONTACT_ERROR_UNIQUE_ALIAS_TRASHED')); } return false; } return parent::store($updateNulls); } /** * Overloaded check function * * @return boolean True on success, false on failure * * @see \Joomla\CMS\Table\Table::check * @since 1.5 */ public function check() { try { parent::check(); } catch (\Exception $e) { $this->setError($e->getMessage()); return false; } $this->default_con = (int) $this->default_con; if ($this->webpage !== null && InputFilter::checkAttribute(['href', $this->webpage])) { $this->setError(Text::_('COM_CONTACT_WARNING_PROVIDE_VALID_URL')); return false; } // Check for valid name if (trim($this->name) == '') { $this->setError(Text::_('COM_CONTACT_WARNING_PROVIDE_VALID_NAME')); return false; } // Generate a valid alias $this->generateAlias(); // Check for a valid category. if (!$this->catid = (int) $this->catid) { $this->setError(Text::_('JLIB_DATABASE_ERROR_CATEGORY_REQUIRED')); return false; } // Sanity check for user_id if (!$this->user_id) { $this->user_id = 0; } // Check the publish down date is not earlier than publish up. if ((int) $this->publish_down > 0 && $this->publish_down < $this->publish_up) { $this->setError(Text::_('JGLOBAL_START_PUBLISH_AFTER_FINISH')); return false; } if (!$this->id) { // Hits must be zero on a new item $this->hits = 0; } // Clean up description -- eliminate quotes and <> brackets if (!empty($this->metadesc)) { // Only process if not empty $badCharacters = ["\"", '<', '>']; $this->metadesc = StringHelper::str_ireplace($badCharacters, '', $this->metadesc); } else { $this->metadesc = ''; } if (empty($this->params)) { $this->params = '{}'; } if (empty($this->metadata)) { $this->metadata = '{}'; } // Set publish_up, publish_down to null if not set if (!$this->publish_up) { $this->publish_up = null; } if (!$this->publish_down) { $this->publish_down = null; } if (!$this->modified) { $this->modified = $this->created; } if (empty($this->modified_by)) { $this->modified_by = $this->created_by; } if (empty($this->hits)) { $this->hits = 0; } return true; } /** * Generate a valid alias from title / date. * Remains public to be able to check for duplicated alias before saving * * @return string */ public function generateAlias() { if (empty($this->alias)) { $this->alias = $this->name; } $this->alias = ApplicationHelper::stringURLSafe($this->alias, $this->language); if (trim(str_replace('-', '', $this->alias)) == '') { $this->alias = Factory::getDate()->format('Y-m-d-H-i-s'); } return $this->alias; } /** * Get the type alias for the history and tags mapping table * * @return string The alias as described above * * @since 4.0.0 */ public function getTypeAlias() { return $this->typeAlias; } } PK � �\�Sʉ� � src/Table/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK � �\��ؐ� � ) src/Service/HTML/AdministratorService.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_contact * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Contact\Administrator\Service\HTML; use Joomla\CMS\Factory; use Joomla\CMS\Language\Associations; use Joomla\CMS\Language\LanguageHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; use Joomla\CMS\Router\Route; use Joomla\Database\ParameterType; use Joomla\Utilities\ArrayHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Contact HTML helper class. * * @since 1.6 */ class AdministratorService { /** * Get the associated language flags * * @param integer $contactid The item id to search associations * * @return string The language HTML * * @throws \Exception */ public function association($contactid) { // Defaults $html = ''; // Get the associations if ($associations = Associations::getAssociations('com_contact', '#__contact_details', 'com_contact.item', $contactid)) { foreach ($associations as $tag => $associated) { $associations[$tag] = (int) $associated->id; } // Get the associated contact items $db = Factory::getDbo(); $query = $db->getQuery(true) ->select( [ $db->quoteName('c.id'), $db->quoteName('c.name', 'title'), $db->quoteName('l.sef', 'lang_sef'), $db->quoteName('lang_code'), $db->quoteName('cat.title', 'category_title'), $db->quoteName('l.image'), $db->quoteName('l.title', 'language_title'), ] ) ->from($db->quoteName('#__contact_details', 'c')) ->join('LEFT', $db->quoteName('#__categories', 'cat'), $db->quoteName('cat.id') . ' = ' . $db->quoteName('c.catid')) ->join('LEFT', $db->quoteName('#__languages', 'l'), $db->quoteName('c.language') . ' = ' . $db->quoteName('l.lang_code')) ->whereIn($db->quoteName('c.id'), array_values($associations)) ->where($db->quoteName('c.id') . ' != :id') ->bind(':id', $contactid, ParameterType::INTEGER); $db->setQuery($query); try { $items = $db->loadObjectList('id'); } catch (\RuntimeException $e) { throw new \Exception($e->getMessage(), 500, $e); } if ($items) { $languages = LanguageHelper::getContentLanguages([0, 1]); $content_languages = array_column($languages, 'lang_code'); foreach ($items as &$item) { if (\in_array($item->lang_code, $content_languages)) { $text = $item->lang_code; $url = Route::_('index.php?option=com_contact&task=contact.edit&id=' . (int) $item->id); $tooltip = '<strong>' . htmlspecialchars($item->language_title, ENT_QUOTES, 'UTF-8') . '</strong><br>' . htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8') . '<br>' . Text::sprintf('JCATEGORY_SPRINTF', $item->category_title); $classes = 'badge bg-secondary'; $item->link = '<a href="' . $url . '" class="' . $classes . '">' . $text . '</a>' . '<div role="tooltip" id="tip-' . (int) $contactid . '-' . (int) $item->id . '">' . $tooltip . '</div>'; } else { // Display warning if Content Language is trashed or deleted Factory::getApplication()->enqueueMessage(Text::sprintf('JGLOBAL_ASSOCIATIONS_CONTENTLANGUAGE_WARNING', $item->lang_code), 'warning'); } } } $html = LayoutHelper::render('joomla.content.associations', $items); } return $html; } /** * Show the featured/not-featured icon. * * @param integer $value The featured value. * @param integer $i Id of the item. * @param boolean $canChange Whether the value can be changed or not. * * @return string The anchor tag to toggle featured/unfeatured contacts. * * @since 1.6 */ public function featured($value, $i, $canChange = true) { Factory::getDocument()->getWebAssetManager()->useScript('list-view'); // Array of image, task, title, action $states = [ 0 => ['unfeatured', 'contacts.featured', 'COM_CONTACT_UNFEATURED', 'JGLOBAL_ITEM_FEATURE'], 1 => ['featured', 'contacts.unfeatured', 'JFEATURED', 'JGLOBAL_ITEM_UNFEATURE'], ]; $state = ArrayHelper::getValue($states, (int) $value, $states[1]); $icon = $state[0] === 'featured' ? 'star featured' : 'circle'; $tooltipText = Text::_($state[3]); if (!$canChange) { $tooltipText = Text::_($state[2]); } $html = '<button type="button" class="js-grid-item-action tbody-icon' . ($value == 1 ? ' active' : '') . '"' . ' aria-labelledby="cb' . $i . '-desc" data-item-id="cb' . $i . '" data-item-task="' . $state[1] . '">' . '<span class="icon-' . $icon . '" aria-hidden="true"></span>' . '</button>' . '<div role="tooltip" id="cb' . $i . '-desc">' . $tooltipText . '</div>'; return $html; } } PK � �\��O�� � src/Service/HTML/Icon.phpnu �[��� <?php /** * @package Joomla.Site * @subpackage com_contact * * @copyright (C) 2020 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Contact\Administrator\Service\HTML; use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; use Joomla\CMS\Router\Route; use Joomla\CMS\Uri\Uri; use Joomla\CMS\User\UserFactoryAwareTrait; use Joomla\CMS\User\UserFactoryInterface; use Joomla\Component\Contact\Site\Helper\RouteHelper; use Joomla\Registry\Registry; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Content Component HTML Helper * * @since 4.0.0 */ class Icon { use UserFactoryAwareTrait; /** * Service constructor * * @param UserFactoryInterface $userFactory The userFactory * * @since 4.0.0 */ public function __construct(UserFactoryInterface $userFactory) { $this->setUserFactory($userFactory); } /** * Method to generate a link to the create item page for the given category * * @param object $category The category information * @param Registry $params The item parameters * @param array $attribs Optional attributes for the link * * @return string The HTML markup for the create item link * * @since 4.0.0 */ public function create($category, $params, $attribs = []) { $uri = Uri::getInstance(); $url = 'index.php?option=com_contact&task=contact.add&return=' . base64_encode($uri) . '&id=0&catid=' . $category->id; $text = ''; if ($params->get('show_icons')) { $text .= '<span class="icon-plus icon-fw" aria-hidden="true"></span>'; } $text .= Text::_('COM_CONTACT_NEW_CONTACT'); // Add the button classes to the attribs array if (isset($attribs['class'])) { $attribs['class'] .= ' btn btn-primary'; } else { $attribs['class'] = 'btn btn-primary'; } $button = HTMLHelper::_('link', Route::_($url), $text, $attribs); return $button; } /** * Display an edit icon for the contact. * * This icon will not display in a popup window, nor if the contact is trashed. * Edit access checks must be performed in the calling code. * * @param object $contact The contact information * @param Registry $params The item parameters * @param array $attribs Optional attributes for the link * @param boolean $legacy True to use legacy images, false to use icomoon based graphic * * @return string The HTML for the contact edit icon. * * @since 4.0.0 */ public function edit($contact, $params, $attribs = [], $legacy = false) { $user = Factory::getUser(); $uri = Uri::getInstance(); // Ignore if in a popup window. if ($params && $params->get('popup')) { return ''; } // Ignore if the state is negative (trashed). if ($contact->published < 0) { return ''; } // Show checked_out icon if the contact is checked out by a different user if ( property_exists($contact, 'checked_out') && property_exists($contact, 'checked_out_time') && !\is_null($contact->checked_out) && $contact->checked_out !== $user->id ) { $checkoutUser = $this->getUserFactory()->loadUserById($contact->checked_out); $date = HTMLHelper::_('date', $contact->checked_out_time); $tooltip = Text::sprintf('COM_CONTACT_CHECKED_OUT_BY', $checkoutUser->name) . ' <br> ' . $date; $text = LayoutHelper::render('joomla.content.icons.edit_lock', ['contact' => $contact, 'tooltip' => $tooltip, 'legacy' => $legacy]); $attribs['aria-describedby'] = 'editcontact-' . (int) $contact->id; $output = HTMLHelper::_('link', '#', $text, $attribs); return $output; } $contactUrl = RouteHelper::getContactRoute($contact->slug, $contact->catid, $contact->language); $url = $contactUrl . '&task=contact.edit&id=' . $contact->id . '&return=' . base64_encode($uri); if ((int) $contact->published === 0) { $tooltip = Text::_('COM_CONTACT_EDIT_UNPUBLISHED_CONTACT'); } else { $tooltip = Text::_('COM_CONTACT_EDIT_PUBLISHED_CONTACT'); } $nowDate = strtotime(Factory::getDate()); $icon = $contact->published ? 'edit' : 'eye-slash'; if ( ($contact->publish_up !== null && strtotime($contact->publish_up) > $nowDate) || ($contact->publish_down !== null && strtotime($contact->publish_down) < $nowDate) ) { $icon = 'eye-slash'; } $aria_described = 'editcontact-' . (int) $contact->id; $text = '<span class="icon-' . $icon . '" aria-hidden="true"></span>'; $text .= Text::_('JGLOBAL_EDIT'); $text .= '<div role="tooltip" id="' . $aria_described . '">' . $tooltip . '</div>'; $attribs['aria-describedby'] = $aria_described; $output = HTMLHelper::_('link', Route::_($url), $text, $attribs); return $output; } } PK � �\�Sʉ� � src/Service/HTML/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK � �\�Sʉ� � src/Service/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK � �\p ��� � ! src/Helper/AssociationsHelper.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_contact * * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Contact\Administrator\Helper; use Joomla\CMS\Association\AssociationExtensionHelper; use Joomla\CMS\Language\Associations; use Joomla\CMS\Table\Table; use Joomla\Component\Contact\Site\Helper\AssociationHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Content associations helper. * * @since 3.7.0 */ class AssociationsHelper extends AssociationExtensionHelper { /** * The extension name * * @var array $extension * * @since 3.7.0 */ protected $extension = 'com_contact'; /** * Array of item types * * @var array $itemTypes * * @since 3.7.0 */ protected $itemTypes = ['contact', 'category']; /** * Has the extension association support * * @var boolean $associationsSupport * * @since 3.7.0 */ protected $associationsSupport = true; /** * Method to get the associations for a given item. * * @param integer $id Id of the item * @param string $view Name of the view * * @return array Array of associations for the item * * @since 4.0.0 */ public function getAssociationsForItem($id = 0, $view = null) { return AssociationHelper::getAssociations($id, $view); } /** * 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 = Associations::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 Table|null * * @since 3.7.0 */ public function getItem($typeName, $id) { if (empty($id)) { return null; } $table = null; switch ($typeName) { case 'contact': $table = Table::getInstance('ContactTable', 'Joomla\\Component\\Contact\\Administrator\\Table\\'); break; case 'category': $table = Table::getInstance('Category'); break; } if (empty($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 = []; $joins = []; $support = $this->getSupportTemplate(); $title = ''; if (\in_array($typeName, $this->itemTypes)) { switch ($typeName) { case 'contact': $fields['title'] = 'a.name'; $fields['state'] = 'a.published'; $support['state'] = true; $support['acl'] = true; $support['checkout'] = true; $support['category'] = true; $support['save2copy'] = true; $tables = [ 'a' => '#__contact_details', ]; $title = 'contact'; 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 = [ 'a' => '#__categories', ]; $title = 'category'; break; } } return [ 'fields' => $fields, 'support' => $support, 'tables' => $tables, 'joins' => $joins, 'title' => $title, ]; } } PK � �\=�̋ src/Helper/ContactHelper.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_contact * * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Contact\Administrator\Helper; use Joomla\CMS\Helper\ContentHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Contact component helper. * * @since 1.6 */ class ContactHelper extends ContentHelper { } PK � �\�Sʉ� � src/Helper/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK � �\wo� � src/Field/Modal/ContactField.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_contact * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Contact\Administrator\Field\Modal; use Joomla\CMS\Factory; use Joomla\CMS\Form\Field\ModalSelectField; use Joomla\CMS\Language\LanguageHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\Session\Session; use Joomla\CMS\Uri\Uri; use Joomla\Database\ParameterType; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Supports a modal contact picker. * * @since 1.6 */ class ContactField extends ModalSelectField { /** * The form field type. * * @var string * @since 1.6 */ protected $type = 'Modal_Contact'; /** * Method to attach a Form object to the field. * * @param \SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object. * @param mixed $value The form field value to validate. * @param string $group The field name group control value. * * @return boolean True on success. * * @see FormField::setup() * @since 5.1.0 */ public function setup(\SimpleXMLElement $element, $value, $group = null) { // Check if the value consist with id:alias, extract the id only if ($value && str_contains($value, ':')) { [$id] = explode(':', $value, 2); $value = (int) $id; } $result = parent::setup($element, $value, $group); if (!$result) { return $result; } Factory::getApplication()->getLanguage()->load('com_contact', JPATH_ADMINISTRATOR); $languages = LanguageHelper::getContentLanguages([0, 1], false); $language = (string) $this->element['language']; // Prepare enabled actions $this->canDo['propagate'] = ((string) $this->element['propagate'] == 'true') && \count($languages) > 2; // Prepare Urls $linkItems = (new Uri())->setPath(Uri::base(true) . '/index.php'); $linkItems->setQuery([ 'option' => 'com_contact', 'view' => 'contacts', 'layout' => 'modal', 'tmpl' => 'component', Session::getFormToken() => 1, ]); $linkItem = clone $linkItems; $linkItem->setVar('view', 'contact'); $linkCheckin = (new Uri())->setPath(Uri::base(true) . '/index.php'); $linkCheckin->setQuery([ 'option' => 'com_contact', 'task' => 'contacts.checkin', 'format' => 'json', Session::getFormToken() => 1, ]); if ($language) { $linkItems->setVar('forcedLanguage', $language); $linkItem->setVar('forcedLanguage', $language); $modalTitle = Text::_('COM_CONTACT_SELECT_A_CONTACT') . ' — ' . $this->getTitle(); $this->dataAttributes['data-language'] = $language; } else { $modalTitle = Text::_('COM_CONTACT_SELECT_A_CONTACT'); } $urlSelect = $linkItems; $urlEdit = clone $linkItem; $urlEdit->setVar('task', 'contact.edit'); $urlNew = clone $linkItem; $urlNew->setVar('task', 'contact.add'); $this->urls['select'] = (string) $urlSelect; $this->urls['new'] = (string) $urlNew; $this->urls['edit'] = (string) $urlEdit; $this->urls['checkin'] = (string) $linkCheckin; // Prepare titles $this->modalTitles['select'] = $modalTitle; $this->modalTitles['new'] = Text::_('COM_CONTACT_NEW_CONTACT'); $this->modalTitles['edit'] = Text::_('COM_CONTACT_EDIT_CONTACT'); $this->hint = $this->hint ?: Text::_('COM_CONTACT_SELECT_A_CONTACT'); return $result; } /** * Method to retrieve the title of selected item. * * @return string * * @since 5.1.0 */ protected function getValueTitle() { $value = (int) $this->value ?: ''; $title = ''; if ($value) { try { $db = $this->getDatabase(); $query = $db->getQuery(true) ->select($db->quoteName('name')) ->from($db->quoteName('#__contact_details')) ->where($db->quoteName('id') . ' = :value') ->bind(':value', $value, ParameterType::INTEGER); $db->setQuery($query); $title = $db->loadResult(); } catch (\Throwable $e) { Factory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } } return $title ?: $value; } /** * Method to get the data to be passed to the layout for rendering. * * @return array * * @since 5.1.0 */ protected function getLayoutData() { $data = parent::getLayoutData(); $data['language'] = (string) $this->element['language']; return $data; } /** * Get the renderer * * @param string $layoutId Id to load * * @return FileLayout * * @since 5.1.0 */ protected function getRenderer($layoutId = 'default') { $layout = parent::getRenderer($layoutId); $layout->setComponent('com_contact'); $layout->setClient(1); return $layout; } } PK � �\�Sʉ� � src/Field/Modal/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK � �\�Sʉ� � src/Field/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK � �\$��MM= M= src/Model/ContactModel.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_contact * * @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Contact\Administrator\Model; use Joomla\CMS\Factory; use Joomla\CMS\Form\Form; use Joomla\CMS\Helper\TagsHelper; use Joomla\CMS\Language\Associations; use Joomla\CMS\Language\LanguageHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Model\AdminModel; use Joomla\CMS\String\PunycodeHelper; use Joomla\CMS\Versioning\VersionableModelTrait; use Joomla\Component\Categories\Administrator\Helper\CategoriesHelper; use Joomla\Database\ParameterType; use Joomla\Registry\Registry; use Joomla\Utilities\ArrayHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Item Model for a Contact. * * @since 1.6 */ class ContactModel extends AdminModel { use VersionableModelTrait; /** * The type alias for this content type. * * @var string * @since 3.2 */ public $typeAlias = 'com_contact.contact'; /** * The context used for the associations table * * @var string * @since 3.4.4 */ protected $associationsContext = 'com_contact.item'; /** * Batch copy/move command. If set to false, the batch copy/move command is not supported * * @var string */ protected $batch_copymove = 'category_id'; /** * Allowed batch commands * * @var array */ protected $batch_commands = [ 'assetgroup_id' => 'batchAccess', 'language_id' => 'batchLanguage', 'tag' => 'batchTag', 'user_id' => 'batchUser', ]; /** * Name of the form * * @var string * @since 4.0.0 */ protected $formName = 'contact'; /** * Batch change a linked user. * * @param integer $value The new value matching a User ID. * @param array $pks An array of row IDs. * @param array $contexts An array of item contexts. * * @return boolean True if successful, false otherwise and internal error is set. * * @since 2.5 */ protected function batchUser($value, $pks, $contexts) { foreach ($pks as $pk) { if ($this->user->authorise('core.edit', $contexts[$pk])) { $this->table->reset(); $this->table->load($pk); $this->table->user_id = (int) $value; if (!$this->table->store()) { $this->setError($this->table->getError()); return false; } } else { $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } } // 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->published != -2) { return false; } return $this->getCurrentUser()->authorise('core.delete', 'com_contact.category.' . (int) $record->catid); } /** * 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) { // Check against the category. if (!empty($record->catid)) { return $this->getCurrentUser()->authorise('core.edit.state', 'com_contact.category.' . (int) $record->catid); } // Default to component settings if category not known. return parent::canEditState($record); } /** * Method to get the row 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 Form|boolean A Form object on success, false on failure * * @since 1.6 */ public function getForm($data = [], $loadData = true) { Form::addFieldPath(JPATH_ADMINISTRATOR . '/components/com_users/models/fields'); // Get the form. $form = $this->loadForm('com_contact.' . $this->formName, $this->formName, ['control' => 'jform', 'load_data' => $loadData]); if (empty($form)) { return false; } // Modify the form based on access controls. if (!$this->canEditState((object) $data)) { // Disable fields for display. $form->setFieldAttribute('featured', 'disabled', 'true'); $form->setFieldAttribute('ordering', 'disabled', 'true'); $form->setFieldAttribute('published', 'disabled', 'true'); // Disable fields while saving. // The controller has already verified this is a record you can edit. $form->setFieldAttribute('featured', 'filter', 'unset'); $form->setFieldAttribute('ordering', 'filter', 'unset'); $form->setFieldAttribute('published', 'filter', 'unset'); } // Don't allow to change the created_by user if not allowed to access com_users. if (!$this->getCurrentUser()->authorise('core.manage', 'com_users')) { $form->setFieldAttribute('created_by', 'filter', 'unset'); } return $form; } /** * Method to get a single record. * * @param integer $pk The id of the primary key. * * @return mixed Object on success, false on failure. * * @since 1.6 */ public function getItem($pk = null) { if ($item = parent::getItem($pk)) { // Convert the metadata field to an array. $registry = new Registry($item->metadata); $item->metadata = $registry->toArray(); } // Load associated contact items $assoc = Associations::isEnabled(); if ($assoc) { $item->associations = []; if ($item->id != null) { $associations = Associations::getAssociations('com_contact', '#__contact_details', 'com_contact.item', $item->id); foreach ($associations as $tag => $association) { $item->associations[$tag] = $association->id; } } } // Load item tags if (!empty($item->id)) { $item->tags = new TagsHelper(); $item->tags->getTagIds($item->id, 'com_contact.contact'); } return $item; } /** * 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() { $app = Factory::getApplication(); // Check the session for previously entered form data. $data = $app->getUserState('com_contact.edit.contact.data', []); if (empty($data)) { $data = $this->getItem(); // Prime some default values. if ($this->getState('contact.id') == 0) { $data->set('catid', $app->getInput()->get('catid', $app->getUserState('com_contact.contacts.filter.category_id'), 'int')); } } $this->preprocessData('com_contact.contact', $data); return $data; } /** * Method to save the form data. * * @param array $data The form data. * * @return boolean True on success. * * @since 3.0 */ public function save($data) { $input = Factory::getApplication()->getInput(); // 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_contact'); } // Save New Category if ($createCategory && $this->canCreateCategory()) { $category = [ // Remove #new# prefix, if exists. 'title' => str_starts_with($data['catid'], '#new#') ? substr($data['catid'], 5) : $data['catid'], 'parent_id' => 1, 'extension' => 'com_contact', 'language' => $data['language'], 'published' => 1, ]; /** @var \Joomla\Component\Categories\Administrator\Model\CategoryModel $categoryModel */ $categoryModel = Factory::getApplication()->bootComponent('com_categories') ->getMVCFactory()->createModel('Category', 'Administrator', ['ignore_request' => true]); // Create new category. if (!$categoryModel->save($category)) { $this->setError($categoryModel->getError()); return false; } // Get the Category ID. $data['catid'] = $categoryModel->getState('category.id'); } // Alter the name for save as copy if ($input->get('task') == 'save2copy') { $origTable = $this->getTable(); $origTable->load($input->getInt('id')); if ($data['name'] == $origTable->name) { [$name, $alias] = $this->generateNewTitle($data['catid'], $data['alias'], $data['name']); $data['name'] = $name; $data['alias'] = $alias; } else { if ($data['alias'] == $origTable->alias) { $data['alias'] = ''; } } $data['published'] = 0; } $links = ['linka', 'linkb', 'linkc', 'linkd', 'linke']; foreach ($links as $link) { if (!empty($data['params'][$link])) { $data['params'][$link] = PunycodeHelper::urlToPunycode($data['params'][$link]); } } return parent::save($data); } /** * Prepare and sanitise the table prior to saving. * * @param \Joomla\CMS\Table\Table $table The Table object * * @return void * * @since 1.6 */ protected function prepareTable($table) { $date = Factory::getDate()->toSql(); $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); $table->generateAlias(); if (empty($table->id)) { // Set the values $table->created = $date; $table->version = 1; // Set ordering to the last item if not set if (empty($table->ordering)) { $db = $this->getDatabase(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__contact_details')); $db->setQuery($query); $max = $db->loadResult(); $table->ordering = $max + 1; } } else { // Set the values $table->modified = $date; $table->modified_by = $this->getCurrentUser()->id; $table->version++; } } /** * A protected method to get a set of ordering conditions. * * @param \Joomla\CMS\Table\Table $table A record object. * * @return array An array of conditions to add to ordering queries. * * @since 1.6 */ protected function getReorderConditions($table) { return [ $this->getDatabase()->quoteName('catid') . ' = ' . (int) $table->catid, ]; } /** * Preprocess the form. * * @param Form $form Form object. * @param object $data Data object. * @param string $group Group name. * * @return void * * @since 3.0.3 */ protected function preprocessForm(Form $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 contact items if (Associations::isEnabled()) { $languages = LanguageHelper::getContentLanguages(false, false, 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_contact'); $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); } /** * Method to toggle the featured setting of contacts. * * @param array $pks The ids of the items to toggle. * @param integer $value The value to toggle to. * * @return boolean True on success. * * @since 1.6 */ public function featured($pks, $value = 0) { // Sanitize the ids. $pks = ArrayHelper::toInteger((array) $pks); if (empty($pks)) { $this->setError(Text::_('COM_CONTACT_NO_ITEM_SELECTED')); return false; } $table = $this->getTable(); try { $db = $this->getDatabase(); $query = $db->getQuery(true); $query->update($db->quoteName('#__contact_details')); $query->set($db->quoteName('featured') . ' = :featured'); $query->whereIn($db->quoteName('id'), $pks); $query->bind(':featured', $value, ParameterType::INTEGER); $db->setQuery($query); $db->execute(); } catch (\Exception $e) { $this->setError($e->getMessage()); return false; } $table->reorder(); // Clean component's cache $this->cleanCache(); return true; } /** * Is the user allowed to create an on the fly category? * * @return boolean * * @since 3.6.1 */ private function canCreateCategory() { return $this->getCurrentUser()->authorise('core.create', 'com_contact'); } } PK � �\�Sʉ� � src/Model/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK � �\�!�m�: �: src/Model/ContactsModel.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_contact * * @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Contact\Administrator\Model; use Joomla\CMS\Factory; use Joomla\CMS\Language\Associations; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\CMS\MVC\Model\ListModel; use Joomla\CMS\Table\Table; use Joomla\Database\ParameterType; use Joomla\Database\QueryInterface; use Joomla\Utilities\ArrayHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Methods supporting a list of contact records. * * @since 1.6 */ class ContactsModel extends ListModel { /** * Constructor. * * @param array $config An optional associative array of configuration settings. * @param ?MVCFactoryInterface $factory The factory. * * @since 1.6 */ public function __construct($config = [], ?MVCFactoryInterface $factory = null) { if (empty($config['filter_fields'])) { $config['filter_fields'] = [ 'id', 'a.id', 'name', 'a.name', 'alias', 'a.alias', 'checked_out', 'a.checked_out', 'checked_out_time', 'a.checked_out_time', 'catid', 'a.catid', 'category_id', 'category_title', 'user_id', 'a.user_id', 'published', 'a.published', 'access', 'a.access', 'access_level', 'created', 'a.created', 'created_by', 'a.created_by', 'ordering', 'a.ordering', 'featured', 'a.featured', 'language', 'a.language', 'language_title', 'publish_up', 'a.publish_up', 'publish_down', 'a.publish_down', 'ul.name', 'linked_user', 'tag', 'level', 'c.level', ]; if (Associations::isEnabled()) { $config['filter_fields'][] = 'association'; } } parent::__construct($config, $factory); } /** * 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.name', $direction = 'asc') { $app = Factory::getApplication(); $forcedLanguage = $app->getInput()->get('forcedLanguage', '', 'cmd'); // Adjust the context to support modal layouts. if ($layout = $app->getInput()->get('layout')) { $this->context .= '.' . $layout; } // Adjust the context to support forced languages. if ($forcedLanguage) { $this->context .= '.' . $forcedLanguage; } // List state information. parent::populateState($ordering, $direction); // Force a language. if (!empty($forcedLanguage)) { $this->setState('filter.language', $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 .= ':' . $this->getState('filter.published'); $id .= ':' . serialize($this->getState('filter.category_id')); $id .= ':' . $this->getState('filter.access'); $id .= ':' . $this->getState('filter.language'); $id .= ':' . serialize($this->getState('filter.tag')); $id .= ':' . $this->getState('filter.level'); return parent::getStoreId($id); } /** * Build an SQL query to load the list data. * * @return QueryInterface * * @since 1.6 */ protected function getListQuery() { // Create a new query object. $db = $this->getDatabase(); $query = $db->getQuery(true); $user = $this->getCurrentUser(); // Select the required fields from the table. $query->select( $db->quoteName( explode( ', ', $this->getState( 'list.select', 'a.id, a.name, a.alias, a.checked_out, a.checked_out_time, a.catid, a.user_id' . ', a.published, a.access, a.created, a.created_by, a.ordering, a.featured, a.language' . ', a.publish_up, a.publish_down, a.modified_by' ) ) ) ); $query->from($db->quoteName('#__contact_details', 'a')); // Join over the users for the linked user. $query->select( [ $db->quoteName('ul.name', 'linked_user'), $db->quoteName('ul.email'), ] ) ->join( 'LEFT', $db->quoteName('#__users', 'ul') . ' ON ' . $db->quoteName('ul.id') . ' = ' . $db->quoteName('a.user_id') ); // Join over the language $query->select($db->quoteName('l.title', 'language_title')) ->select($db->quoteName('l.image', 'language_image')) ->join( 'LEFT', $db->quoteName('#__languages', 'l') . ' ON ' . $db->quoteName('l.lang_code') . ' = ' . $db->quoteName('a.language') ); // Join over the users for the checked out user. $query->select($db->quoteName('uc.name', 'editor')) ->join( 'LEFT', $db->quoteName('#__users', 'uc') . ' ON ' . $db->quoteName('uc.id') . ' = ' . $db->quoteName('a.checked_out') ); // Join over the asset groups. $query->select($db->quoteName('ag.title', 'access_level')) ->join( 'LEFT', $db->quoteName('#__viewlevels', 'ag') . ' ON ' . $db->quoteName('ag.id') . ' = ' . $db->quoteName('a.access') ); // Join over the categories. $query->select($db->quoteName('c.title', 'category_title')) ->join( 'LEFT', $db->quoteName('#__categories', 'c') . ' ON ' . $db->quoteName('c.id') . ' = ' . $db->quoteName('a.catid') ); // Join over the associations. if (Associations::isEnabled()) { $subQuery = $db->getQuery(true) ->select('COUNT(' . $db->quoteName('asso1.id') . ') > 1') ->from($db->quoteName('#__associations', 'asso1')) ->join('INNER', $db->quoteName('#__associations', 'asso2'), $db->quoteName('asso1.key') . ' = ' . $db->quoteName('asso2.key')) ->where( [ $db->quoteName('asso1.id') . ' = ' . $db->quoteName('a.id'), $db->quoteName('asso1.context') . ' = ' . $db->quote('com_contact.item'), ] ); $query->select('(' . $subQuery . ') AS ' . $db->quoteName('association')); } // Filter by featured. $featured = (string) $this->getState('filter.featured'); if (\in_array($featured, ['0','1'])) { $query->where($db->quoteName('a.featured') . ' = ' . (int) $featured); } // Filter by access level. if ($access = $this->getState('filter.access')) { $query->where($db->quoteName('a.access') . ' = :access'); $query->bind(':access', $access, ParameterType::INTEGER); } // Implement View Level Access if (!$user->authorise('core.admin')) { $query->whereIn($db->quoteName('a.access'), $user->getAuthorisedViewLevels()); } // Filter by published state $published = (string) $this->getState('filter.published'); if (is_numeric($published)) { $query->where($db->quoteName('a.published') . ' = :published'); $query->bind(':published', $published, ParameterType::INTEGER); } elseif ($published === '') { $query->where('(' . $db->quoteName('a.published') . ' = 0 OR ' . $db->quoteName('a.published') . ' = 1)'); } // Filter by search in name. $search = $this->getState('filter.search'); if (!empty($search)) { if (stripos($search, 'id:') === 0) { $search = substr($search, 3); $query->where($db->quoteName('a.id') . ' = :id'); $query->bind(':id', $search, ParameterType::INTEGER); } else { $search = '%' . trim($search) . '%'; $query->where( '(' . $db->quoteName('a.name') . ' LIKE :name OR ' . $db->quoteName('a.alias') . ' LIKE :alias)' ); $query->bind(':name', $search); $query->bind(':alias', $search); } } // Filter on the language. if ($language = $this->getState('filter.language')) { $query->where($db->quoteName('a.language') . ' = :language'); $query->bind(':language', $language); } // Filter by a single or group of tags. $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); $includeNone = false; if (\in_array(0, $tag)) { $tag = array_filter($tag); $includeNone = true; } $subQuery = $db->getQuery(true) ->select('DISTINCT ' . $db->quoteName('content_item_id')) ->from($db->quoteName('#__contentitem_tag_map')) ->where( [ $db->quoteName('tag_id') . ' IN (' . implode(',', $query->bindArray($tag)) . ')', $db->quoteName('type_alias') . ' = ' . $db->quote('com_contact.contact'), ] ); $query->join( $includeNone ? 'LEFT' : 'INNER', '(' . $subQuery . ') AS ' . $db->quoteName('tagmap'), $db->quoteName('tagmap.content_item_id') . ' = ' . $db->quoteName('a.id') ); if ($includeNone) { $subQuery2 = $db->getQuery(true) ->select('DISTINCT ' . $db->quoteName('content_item_id')) ->from($db->quoteName('#__contentitem_tag_map')) ->where($db->quoteName('type_alias') . ' = ' . $db->quote('com_contact.contact')); $query->join( 'LEFT', '(' . $subQuery2 . ') AS ' . $db->quoteName('tagmap2'), $db->quoteName('tagmap2.content_item_id') . ' = ' . $db->quoteName('a.id') ) ->where( '(' . $db->quoteName('tagmap.content_item_id') . ' IS NOT NULL OR ' . $db->quoteName('tagmap2.content_item_id') . ' IS NULL)' ); } } elseif (is_numeric($tag)) { $tag = (int) $tag; if ($tag === 0) { $subQuery = $db->getQuery(true) ->select('DISTINCT ' . $db->quoteName('content_item_id')) ->from($db->quoteName('#__contentitem_tag_map')) ->where($db->quoteName('type_alias') . ' = ' . $db->quote('com_contact.contact')); // Only show contacts without tags $query->join( 'LEFT', '(' . $subQuery . ') AS ' . $db->quoteName('tagmap'), $db->quoteName('tagmap.content_item_id') . ' = ' . $db->quoteName('a.id') ) ->where($db->quoteName('tagmap.content_item_id') . ' IS NULL'); } else { $query->join( 'INNER', $db->quoteName('#__contentitem_tag_map', 'tagmap'), $db->quoteName('tagmap.content_item_id') . ' = ' . $db->quoteName('a.id') ) ->where( [ $db->quoteName('tagmap.tag_id') . ' = :tag', $db->quoteName('tagmap.type_alias') . ' = ' . $db->quote('com_contact.contact'), ] ) ->bind(':tag', $tag, ParameterType::INTEGER); } } // Filter by categories and by level $categoryId = $this->getState('filter.category_id', []); $level = $this->getState('filter.level'); if (!\is_array($categoryId)) { $categoryId = $categoryId ? [$categoryId] : []; } // Case: Using both categories filter and by level filter if (\count($categoryId)) { $categoryId = ArrayHelper::toInteger($categoryId); $categoryTable = Table::getInstance('Category', '\\Joomla\\CMS\\Table\\'); $subCatItemsWhere = []; // @todo: Convert to prepared statement 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) . ')'); } elseif ($level) { // Case: Using only the by level filter $query->where($db->quoteName('c.level') . ' <= :level'); $query->bind(':level', $level, ParameterType::INTEGER); } // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.name'); $orderDirn = $this->state->get('list.direction', 'asc'); if ($orderCol == 'a.ordering' || $orderCol == 'category_title') { $orderCol = $db->quoteName('c.title') . ' ' . $orderDirn . ', ' . $db->quoteName('a.ordering'); } $query->order($db->escape($orderCol . ' ' . $orderDirn)); return $query; } } PK � �\Q�x�� � src/View/Contact/HtmlView.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_contact * * @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Contact\Administrator\View\Contact; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Factory; use Joomla\CMS\Helper\ContentHelper; use Joomla\CMS\Language\Associations; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\View\GenericDataException; use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; use Joomla\CMS\Toolbar\Toolbar; use Joomla\CMS\Toolbar\ToolbarHelper; use Joomla\Component\Contact\Administrator\Model\ContactModel; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * View to edit a contact. * * @since 1.6 */ class HtmlView extends BaseHtmlView { /** * The Form object * * @var \Joomla\CMS\Form\Form */ protected $form; /** * The active item * * @var object */ protected $item; /** * The model state * * @var \Joomla\Registry\Registry */ protected $state; /** * Array of fieldsets not to display * * @var string[] * * @since 5.2.0 */ public $ignore_fieldsets = []; /** * Display the view. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return void */ public function display($tpl = null) { /** @var ContactModel $model */ $model = $this->getModel(); // Initialise variables. $this->form = $model->getForm(); $this->item = $model->getItem(); $this->state = $model->getState(); if ($this->getLayout() === 'modalreturn') { parent::display($tpl); return; } // Check for errors. if (\count($errors = $model->getErrors())) { throw new GenericDataException(implode("\n", $errors), 500); } // If we are forcing a language in modal (used for associations). if ($this->getLayout() === 'modal' && $forcedLanguage = Factory::getApplication()->getInput()->get('forcedLanguage', '', 'cmd')) { // Set the language field to the forcedLanguage and disable changing it. $this->form->setValue('language', null, $forcedLanguage); $this->form->setFieldAttribute('language', 'readonly', 'true'); // Only allow to select categories with All language or with the forced language. $this->form->setFieldAttribute('catid', 'language', '*,' . $forcedLanguage); // Only allow to select tags with All language or with the forced language. $this->form->setFieldAttribute('tags', 'language', '*,' . $forcedLanguage); } if ($this->getLayout() !== 'modal') { $this->addToolbar(); } else { $this->addModalToolbar(); } parent::display($tpl); } /** * Add the page title and toolbar. * * @return void * * @since 1.6 */ protected function addToolbar() { Factory::getApplication()->getInput()->set('hidemainmenu', true); $user = $this->getCurrentUser(); $userId = $user->id; $isNew = ($this->item->id == 0); $checkedOut = !(\is_null($this->item->checked_out) || $this->item->checked_out == $userId); $toolbar = $this->getDocument()->getToolbar(); // Since we don't track these assets at the item level, use the category id. $canDo = ContentHelper::getActions('com_contact', 'category', $this->item->catid); ToolbarHelper::title($isNew ? Text::_('COM_CONTACT_MANAGER_CONTACT_NEW') : Text::_('COM_CONTACT_MANAGER_CONTACT_EDIT'), 'address-book contact'); // Build the actions for new and existing records. if ($isNew) { // For new records, check the create permission. if (\count($user->getAuthorisedCategories('com_contact', 'core.create')) > 0) { $toolbar->apply('contact.apply'); $saveGroup = $toolbar->dropdownButton('save-group'); $saveGroup->configure( function (Toolbar $childBar) use ($user) { $childBar->save('contact.save'); if ($user->authorise('core.create', 'com_menus.menu')) { $childBar->save('contact.save2menu', 'JTOOLBAR_SAVE_TO_MENU'); } $childBar->save2new('contact.save2new'); } ); } $toolbar->cancel('contact.cancel', 'JTOOLBAR_CANCEL'); } else { // Since it's an existing record, check the edit permission, or fall back to edit own if the owner. $itemEditable = $canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_by == $userId); // Can't save the record if it's checked out and editable if (!$checkedOut && $itemEditable) { $toolbar->apply('contact.apply'); } $saveGroup = $toolbar->dropdownButton('save-group'); $saveGroup->configure( function (Toolbar $childBar) use ($checkedOut, $itemEditable, $canDo, $user) { // Can't save the record if it's checked out and editable if (!$checkedOut && $itemEditable) { $childBar->save('contact.save'); // We can save this record, but check the create permission to see if we can return to make a new one. if ($canDo->get('core.create')) { $childBar->save2new('contact.save2new'); } } // If checked out, we can still save2menu if ($user->authorise('core.create', 'com_menus.menu')) { $childBar->save('contact.save2menu', 'JTOOLBAR_SAVE_TO_MENU'); } // If checked out, we can still save if ($canDo->get('core.create')) { $childBar->save2copy('contact.save2copy'); } } ); $toolbar->cancel('contact.cancel'); if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->get('params')->get('save_history', 0) && $itemEditable) { $toolbar->versions('com_contact.contact', $this->item->id); } if (Associations::isEnabled() && ComponentHelper::isEnabled('com_associations')) { $toolbar->standardButton('contract', 'JTOOLBAR_ASSOCIATIONS', 'contact.editAssociations') ->icon('icon-contract') ->listCheck(false); } } $toolbar->divider(); $toolbar->help('Contacts:_Edit'); } /** * Add the modal toolbar. * * @return void * * @since 5.1.0 * * @throws \Exception */ protected function addModalToolbar() { $user = $this->getCurrentUser(); $userId = $user->id; $isNew = ($this->item->id == 0); $toolbar = $this->getDocument()->getToolbar(); // Since we don't track these assets at the item level, use the category id. $canDo = ContentHelper::getActions('com_contact', 'category', $this->item->catid); ToolbarHelper::title($isNew ? Text::_('COM_CONTACT_MANAGER_CONTACT_NEW') : Text::_('COM_CONTACT_MANAGER_CONTACT_EDIT'), 'address-book contact'); $canCreate = $isNew && (\count($user->getAuthorisedCategories('com_contact', 'core.create')) > 0); $canEdit = $canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_by == $userId); // For new records, check the create permission. if ($canCreate || $canEdit) { $toolbar->apply('contact.apply'); $toolbar->save('contact.save'); } $toolbar->cancel('contact.cancel'); } } PK � �\�Sʉ� � src/View/Contact/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK � �\q�Ԝ� � src/View/Contacts/HtmlView.phpnu �[��� <?php /** * @package Joomla.Administrator * @subpackage com_contact * * @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Contact\Administrator\View\Contacts; use Joomla\CMS\Factory; use Joomla\CMS\Helper\ContentHelper; use Joomla\CMS\Language\Multilanguage; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; use Joomla\CMS\Session\Session; use Joomla\CMS\Toolbar\Button\DropdownButton; use Joomla\CMS\Toolbar\ToolbarHelper; use Joomla\Component\Contact\Administrator\Model\ContactsModel; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * View class for a list of contacts. * * @since 1.6 */ class HtmlView extends BaseHtmlView { /** * An array of items * * @var array */ protected $items; /** * The pagination object * * @var \Joomla\CMS\Pagination\Pagination */ protected $pagination; /** * The model state * * @var \Joomla\Registry\Registry */ protected $state; /** * Form object for search filters * * @var \Joomla\CMS\Form\Form */ public $filterForm; /** * The active search filters * * @var array */ public $activeFilters; /** * Is this view an Empty State * * @var boolean * * @since 4.0.0 */ private $isEmptyState = false; /** * Display the view. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return void */ public function display($tpl = null) { /** @var ContactsModel $model */ $model = $this->getModel(); $model->setUseExceptions(true); $this->items = $model->getItems(); $this->pagination = $model->getPagination(); $this->state = $model->getState(); $this->filterForm = $model->getFilterForm(); $this->activeFilters = $model->getActiveFilters(); if (!\count($this->items) && $this->isEmptyState = $model->getIsEmptyState()) { $this->setLayout('emptystate'); } // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') { $this->addToolbar(); // We do not need to filter by language when multilingual is disabled if (!Multilanguage::isEnabled()) { unset($this->activeFilters['language']); $this->filterForm->removeField('language', 'filter'); } } else { // In article associations modal we need to remove language filter if forcing a language. // We also need to change the category filter to show show categories with All or the forced language. if ($forcedLanguage = Factory::getApplication()->getInput()->get('forcedLanguage', '', 'CMD')) { // If the language is forced we can't allow to select the language, so transform the language selector filter into a hidden field. $languageXml = new \SimpleXMLElement('<field name="language" type="hidden" default="' . $forcedLanguage . '" />'); $this->filterForm->setField($languageXml, 'filter', true); // Also, unset the active language filter so the search tools is not open by default with this filter. unset($this->activeFilters['language']); // One last changes needed is to change the category filter to just show categories with All language or with the forced language. $this->filterForm->setFieldAttribute('category_id', 'language', '*,' . $forcedLanguage, 'filter'); } /* * When loaded from the frontend, the modal template requires a valid CSRF token on every request. * Pagination links are plain GET anchor tags that bypass form submission, * so the token must be threaded into all pagination URLs via additionalUrlParams. */ if (Factory::getApplication()->isClient('site')) { $this->pagination->setAdditionalUrlParam(Session::getFormToken(), '1'); } } parent::display($tpl); } /** * Add the page title and toolbar. * * @return void * * @since 1.6 */ protected function addToolbar() { $canDo = ContentHelper::getActions('com_contact', 'category', $this->state->get('filter.category_id')); $user = $this->getCurrentUser(); // Get the toolbar object instance $toolbar = $this->getDocument()->getToolbar(); ToolbarHelper::title(Text::_('COM_CONTACT_MANAGER_CONTACTS'), 'address-book contact'); if ($canDo->get('core.create') || \count($user->getAuthorisedCategories('com_contact', 'core.create')) > 0) { $toolbar->addNew('contact.add'); } if (!$this->isEmptyState && $canDo->get('core.edit.state')) { /** @var DropdownButton $dropdown */ $dropdown = $toolbar->dropdownButton('status-group', 'JTOOLBAR_CHANGE_STATUS') ->toggleSplit(false) ->icon('icon-ellipsis-h') ->buttonClass('btn btn-action') ->listCheck(true); $childBar = $dropdown->getChildToolbar(); $childBar->publish('contacts.publish')->listCheck(true); $childBar->unpublish('contacts.unpublish')->listCheck(true); $childBar->standardButton('featured', 'JFEATURE', 'contacts.featured') ->listCheck(true); $childBar->standardButton('unfeatured', 'JUNFEATURE', 'contacts.unfeatured') ->listCheck(true); $childBar->archive('contacts.archive')->listCheck(true); if ($user->authorise('core.admin')) { $childBar->checkin('contacts.checkin'); } if ($this->state->get('filter.published') != -2) { $childBar->trash('contacts.trash')->listCheck(true); } // Add a batch button if ( $user->authorise('core.create', 'com_contact') && $user->authorise('core.edit', 'com_contact') && $user->authorise('core.edit.state', 'com_contact') ) { $childBar->popupButton('batch', 'JTOOLBAR_BATCH') ->popupType('inline') ->textHeader(Text::_('COM_CONTACT_BATCH_OPTIONS')) ->url('#joomla-dialog-batch') ->modalWidth('800px') ->modalHeight('fit-content') ->listCheck(true); } } if (!$this->isEmptyState && $this->state->get('filter.published') == -2 && $canDo->get('core.delete')) { $toolbar->delete('contacts.delete', 'JTOOLBAR_DELETE_FROM_TRASH') ->message('JGLOBAL_CONFIRM_DELETE') ->listCheck(true); } if ($user->authorise('core.admin', 'com_contact') || $user->authorise('core.options', 'com_contact')) { $toolbar->preferences('com_contact'); } $toolbar->help('Contacts'); } } PK � �\��uj^ ^ "