diff --git a/deployed/slideshowck/administrator/components/com_slideshowck/access.xml b/deployed/slideshowck/administrator/components/com_slideshowck/access.xml new file mode 100644 index 00000000..3b83ae96 --- /dev/null +++ b/deployed/slideshowck/administrator/components/com_slideshowck/access.xml @@ -0,0 +1,6 @@ + + +
+ +
+
\ No newline at end of file diff --git a/deployed/slideshowck/administrator/components/com_slideshowck/backup/index.html b/deployed/slideshowck/administrator/components/com_slideshowck/backup/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/deployed/slideshowck/administrator/components/com_slideshowck/backup/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/deployed/slideshowck/administrator/components/com_slideshowck/config.xml b/deployed/slideshowck/administrator/components/com_slideshowck/config.xml new file mode 100644 index 00000000..2cc1b9de --- /dev/null +++ b/deployed/slideshowck/administrator/components/com_slideshowck/config.xml @@ -0,0 +1,15 @@ + + +
+ +
+ +
\ No newline at end of file diff --git a/deployed/slideshowck/administrator/components/com_slideshowck/controller.php b/deployed/slideshowck/administrator/components/com_slideshowck/controller.php new file mode 100644 index 00000000..1009febc --- /dev/null +++ b/deployed/slideshowck/administrator/components/com_slideshowck/controller.php @@ -0,0 +1,87 @@ +input->get('view', 'about'); + $this->input->set('view', $view); + + parent::display(); + + return $this; + } + + public static function ajaxCreateFolder() { + // security check + if (! CKFof::checkAjaxToken()) { + exit(); + } + + if (CKFof::userCan('create', 'com_media')) { + $input = CKFof::getInput(); + $path = $input->get('path', '', 'string'); + $name = $input->get('name', '', 'string'); + + require_once SLIDESHOWCK_PATH . '/helpers/ckbrowse.php'; + if ($result = CKBrowse::createFolder($path, $name)) { + $msg = CKText::_('CK_FOLDER_CREATED_SUCCESS'); + } else { + $msg = CKText::_('CK_FOLDER_CREATED_ERROR'); + } + + echo '{"status" : "' . ($result == false ? '0' : '1') . '", "message" : "' . $msg . '"}'; + } else { + echo '{"status" : "2", "message" : "' . CKText::_('CK_ERROR_USER_NO_AUTH') . '"}'; + } + exit; + } + + /** + * Get the file and store it on the server + * + * @return mixed, the method return + */ + public function ajaxAddPicture() { + require_once SLIDESHOWCK_PATH . '/helpers/ckbrowse.php'; + CKBrowse::ajaxAddPicture(); + } + + /** + * Ajax method to clean the name of the google font + */ + public function cleanGfontName() { + $input = new \Joomla\CMS\Input\Input(); + $gfont = $input->get('gfont', '', 'string'); + + // + // Open+Sans+Condensed:300 + // Open Sans + if ( preg_match( '/family=(.*?) /', $gfont . ' ', $matches) ) { + if ( isset($matches[1]) ) { + $gfont = $matches[1]; + } + } + + $gfont = str_replace(' ', '+', ucwords (trim($gfont))); + echo trim(trim($gfont, "'")); + die; + } +} diff --git a/deployed/slideshowck/administrator/components/com_slideshowck/controllers/ajax.php b/deployed/slideshowck/administrator/components/com_slideshowck/controllers/ajax.php new file mode 100644 index 00000000..86815db4 --- /dev/null +++ b/deployed/slideshowck/administrator/components/com_slideshowck/controllers/ajax.php @@ -0,0 +1,42 @@ +input->get('plugin', '', 'cmd'); + $task = $this->input->get('task', '', 'cmd'); + + if ($plugin) { + if (file_exists(SLIDESHOWCK_PLUGINS_PATH . '/' . $plugin . '/helper/helper_' . $plugin . '.php')) { + require_once(SLIDESHOWCK_PLUGINS_PATH . '/' . $plugin . '/helper/helper_' . $plugin . '.php'); + $className = 'SlideshowckHelpersource' . ucfirst($plugin); + //SlideshowckHelpersourceArticles + $class = new $className(); + if (method_exists($class, $task)) { + $class::$task(); + exit; + } + } + } + die; + } +} diff --git a/deployed/slideshowck/administrator/components/com_slideshowck/controllers/browse.php b/deployed/slideshowck/administrator/components/com_slideshowck/controllers/browse.php new file mode 100644 index 00000000..8ca92b16 --- /dev/null +++ b/deployed/slideshowck/administrator/components/com_slideshowck/controllers/browse.php @@ -0,0 +1,52 @@ +input->get('folder', '', 'string'); + $type = $this->input->get('type', '', 'string'); + $filetypes = CKBrowse::getFileTypes($type); + $files = CKBrowse::getImagesInFolder(JPATH_SITE . '/' . $folder, implode('|', $filetypes)); + + if ($type == 'folder') { + $pathway = str_replace('/', '', $folder); + ?> +
+

+
+ +
+ +
+
+ \ No newline at end of file diff --git a/deployed/slideshowck/administrator/components/com_slideshowck/controllers/menus.php b/deployed/slideshowck/administrator/components/com_slideshowck/controllers/menus.php new file mode 100644 index 00000000..e97c467e --- /dev/null +++ b/deployed/slideshowck/administrator/components/com_slideshowck/controllers/menus.php @@ -0,0 +1,55 @@ +input->get('parentid', 0, 'int'); + $menutype = $this->input->get('menutype', '', 'string'); + + $model = $this->getModel('Menus', 'Slideshowck', array()); + $items = $model->getChildrenItems($menutype, $parentId); + + $links = array(); + $imagespath = SLIDESHOWCK_MEDIA_URI .'/images/'; + ?> +
+ id; + if ($item->type == 'alias') { + $itemParams = new \Joomla\Registry\Registry($item->params); + $aliasId = $itemParams->get('aliasoptions', 0); + } + $Itemid = substr($item->link,-7,7) == 'Itemid=' ? $aliasId : '&Itemid=' . $aliasId; + ?> +
+
+
title; ?>
+
+ +
+ edit(0); + // Redirect to the edit screen. +// CKFof::redirect(SLIDESHOWCK_ADMIN_URL . '&view=style&layout=edit&id=0&tmpl=component&layout=modal'); +// } + +// public function edit($id = null, $appendUrl = '') { +// parent::edit($id, '&layout=modal&tmpl=component'); +// } +// +// public function copy() { +// parent::edit('&layout=modal&tmpl=component'); +// } + + /* + * Generate the CSS styles from the settings + */ + public function save() { + // security check + if (! CKFof::checkAjaxToken()) { + exit(); + } + + $id = $this->input->get('id', 0, 'int'); + + $model = $this->getModel(); + $row = $model->getItem($id); + + // get data + $fields = $this->input->get('fields', '', 'raw'); + $name = $this->input->get('name', '', 'string'); + if (! $name) $name = 'style' . $id; + $layoutcss = trim($this->input->get('layoutcss', '', 'html')); + // set data + $row->params = $fields; + $row->name = $name; + $row->layoutcss = $layoutcss; + + if (! $id = $model->save($row)) { + echo "{'result': '0', 'id': '" . $row->id . "', 'message': 'Error : Can not save the Styles !'}"; + echo($this->_db->getErrorMsg()); + exit; + } + echo '{"result": "1", "id": "' . $id . '", "message": "Styles saved successfully"}'; + exit; + } + + /** + * copy an existing page + * @return void + */ +// function copy() { +// $model = $this->getModel(); +// $cid = $this->input->get('cid', '', 'array'); +// $this->input->set('id', (int) $cid[0]); +// if (!$model->copy()) { +// $msg = \Joomla\CMS\Language\Text::_('CK_COPY_ERROR'); +// $type = 'error'; +// } else { +// $msg = \Joomla\CMS\Language\Text::_('CK_COPY_SUCCESS'); +// $type = 'message'; +// } +// +// $this->setRedirect('index.php?option=com_slideshowck&view=styles', $msg, $type); +// } + + /* + * Generate the CSS styles from the settings + */ + public function ajaxRenderCss() { + $fields = $this->input->get('fields', '', 'raw'); + $fields = json_decode($fields); + $customstyles = stripslashes( $this->input->get('customstyles', '', 'string')); + $customstyles = json_decode($customstyles); + $customcss = $this->input->get('customcss', '', 'html'); + + $css = $this->renderCss($fields, $customstyles); + echo $css . $customcss; + exit(); + } + + /* + * Render the CSS from the settings + */ + public function renderCss($fields, $customstyles) { + include_once SLIDESHOWCK_PATH . '/helpers/ckstyles.php'; + $ckstyles = new \Slideshowck\CKStyles(); + $css = $ckstyles->create($fields, $customstyles); + + return $css; + } + + /** + * Ajax method to save the json data into the .mmck file + * + * @return boolean - true on success for the file creation + * + */ + public function exportParams() { + // security check + if (! CKFof::checkAjaxToken()) { + exit(); + } + // create a backup file with all fields stored in it + $fields = $this->input->get('jsonfields', '', 'string'); + $backupfile_path = SLIDESHOWCK_PATH . '/export/exportParamsSlideshowckStyle'. $this->input->get('styleid',0,'int') .'.mmck'; + if (file_put_contents($backupfile_path, $fields)) { + echo '1'; + } else { + echo '0'; + } + + exit(); + } + + /** + * Ajax method to import the .mmck file into the interface + * + * @return boolean - true on success for the file creation + * + */ + public function uploadParamsFile() { + // security check + if (! CKFof::checkAjaxToken()) { + exit(); + } + + $file = $this->input->files->get('file', '', 'array'); + if (!is_array($file)) + exit(); + + $filename = \Joomla\CMS\Filesystem\File::makeSafe($file['name']); + + // check if the file exists + if (\Joomla\CMS\Filesystem\File::getExt($filename) != 'mmck') { + $msg = \Joomla\CMS\Language\Text::_('CK_NOT_MMCK_FILE', true); + echo json_encode(array('error'=> $msg)); + exit(); + } + + //Set up the source and destination of the file + $src = $file['tmp_name']; + + // check if the file exists + if (!$src || !\Joomla\CMS\Filesystem\File::exists($src)) { + $msg = \Joomla\CMS\Language\Text::_('CK_FILE_NOT_EXISTS', true); + echo json_encode(array('error'=> $msg)); + exit(); + } + + // read the file + if (!$filecontent = \Joomla\CMS\Filesystem\File::read($src)) { + $msg = \Joomla\CMS\Language\Text::_('CK_UNABLE_READ_FILE', true); + echo json_encode(array('error'=> $msg)); + exit(); + } + + // replace vars to allow data to be moved from another server + $filecontent = str_replace("|URIROOT|", \Joomla\CMS\Uri\Uri::root(true), $filecontent); +// $filecontent = str_replace("|qq|", '"', $filecontent); + +// echo $filecontent; + echo json_encode(array('data'=> $filecontent)); + exit(); + } + + /** + * Ajax method to read the fields values from the selected preset + * + * @return json - + * + */ + function loadPresetFields() { + // security check + if (! CKFof::checkAjaxToken()) { + exit(); + } + + $preset = $this->input->get('preset', '', 'string'); + $folder_path = SLIDESHOWCK_MEDIA_PATH . '/presets/'; + // load the fields + $fields = '{}'; + if ( file_exists($folder_path . $preset. '.mmck') ) { + $fields = @file_get_contents($folder_path . $preset. '.mmck'); + $fields = str_replace('\n','', $fields); +// $fields = str_replace("{", "|ob|", $fields); +// $fields = str_replace("}", "|cb|", $fields); + } else { + echo '{"result" : 0, "message" : "File Not found : '.$folder_path . $preset. '.mmck'.'"}'; + exit(); + } + + echo '{"result" : 1, "fields" : "'.$fields.'", "customcss" : ""}'; + exit(); + } +} \ No newline at end of file diff --git a/deployed/slideshowck/administrator/components/com_slideshowck/controllers/styles.php b/deployed/slideshowck/administrator/components/com_slideshowck/controllers/styles.php new file mode 100644 index 00000000..462de007 --- /dev/null +++ b/deployed/slideshowck/administrator/components/com_slideshowck/controllers/styles.php @@ -0,0 +1,29 @@ + true)); + return $model; + } + +} \ No newline at end of file diff --git a/deployed/slideshowck/administrator/components/com_slideshowck/elements/ckbackground.php b/deployed/slideshowck/administrator/components/com_slideshowck/elements/ckbackground.php new file mode 100644 index 00000000..ed0a46a3 --- /dev/null +++ b/deployed/slideshowck/administrator/components/com_slideshowck/elements/ckbackground.php @@ -0,0 +1,28 @@ +element['styles']; + $background = $this->element['background'] ? 'background: url(' . $this->mediaPath . $this->element['background'] . ') left top no-repeat;' : ''; + + $html = '

'; + return $html; + } + + protected function getLabel() { + return ''; + } +} diff --git a/deployed/slideshowck/administrator/components/com_slideshowck/elements/ckcolor.php b/deployed/slideshowck/administrator/components/com_slideshowck/elements/ckcolor.php new file mode 100644 index 00000000..5415935e --- /dev/null +++ b/deployed/slideshowck/administrator/components/com_slideshowck/elements/ckcolor.php @@ -0,0 +1,62 @@ +getPathToImages() . '/images/color.png" />'; + return $html; + } + + protected function getPathToImages() { + $localpath = dirname(__FILE__); + $rootpath = JPATH_ROOT; + $httppath = trim(\Joomla\CMS\Uri\Uri::root(), "/"); + $pathtoimages = str_replace("\\", "/", str_replace($rootpath, $httppath, $localpath)); + return $pathtoimages; + } + + protected function getLabel() { + $label = ''; + // Get the label text from the XML element, defaulting to the element name. + $text = $this->element['label'] ? (string) $this->element['label'] : (string) $this->element['name']; + $text = \Joomla\CMS\Language\Text::_($text); + + // Build the class for the label. + $class = !empty($this->description) ? 'hasTip hasTooltip' : ''; + + $label .= ''; + + return $label; + } + +} + diff --git a/deployed/slideshowck/administrator/components/com_slideshowck/elements/ckdocumentation.php b/deployed/slideshowck/administrator/components/com_slideshowck/elements/ckdocumentation.php new file mode 100644 index 00000000..8be7cb6e --- /dev/null +++ b/deployed/slideshowck/administrator/components/com_slideshowck/elements/ckdocumentation.php @@ -0,0 +1,31 @@ +element['icon'] ? $this->element['icon'] : 'file-alt'; + $url = $this->element['url'] ? $this->element['url'] : 'https://www.joomlack.fr/en/documentation'; + $html[] = '
' . \Joomla\CMS\Language\Text::_('SLIDESHOWCK_DOCUMENTATION') . '
'; + + return implode('', $html); + } +} + diff --git a/deployed/slideshowck/administrator/components/com_slideshowck/elements/ckfolderlist.php b/deployed/slideshowck/administrator/components/com_slideshowck/elements/ckfolderlist.php new file mode 100644 index 00000000..6f5e9667 --- /dev/null +++ b/deployed/slideshowck/administrator/components/com_slideshowck/elements/ckfolderlist.php @@ -0,0 +1,77 @@ +element['filter']; + $exclude = (string) $this->element['exclude']; + $hideNone = (string) $this->element['hide_none']; + $hideDefault = (string) $this->element['hide_default']; + + // Get the path in which to search for file options. + $path = (string) $this->element['directory']; + if (!is_dir($path)) { + $path = JPATH_ROOT.'/'.$path; + } + + // Prepend some default options based on field attributes. + if (!$hideNone) { + $options[] = \Joomla\CMS\HTML\HTMLHelper::_('select.option', '-1', \Joomla\CMS\Language\Text::alt('JOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname))); + } + if (!$hideDefault) { + $options[] = \Joomla\CMS\HTML\HTMLHelper::_('select.option', '', \Joomla\CMS\Language\Text::alt('JOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname))); + } + + // Get a list of folders in the search path with the given filter. + $folders = \Joomla\CMS\Filesystem\Folder::folders($path, $filter); + + // Build the options list from the list of folders. + if (is_array($folders)) { + foreach($folders as $folder) { + + // Check to see if the file is in the exclude mask. + if ($exclude) { + if (preg_match(chr(1).$exclude.chr(1), $folder)) { + continue; + } + } + + $options[] = \Joomla\CMS\HTML\HTMLHelper::_('select.option', $folder, $folder); + } + } + + // Merge any additional options in the XML definition. + $options = array_merge(parent::getOptions(), $options); + + return $options; + } +} diff --git a/deployed/slideshowck/administrator/components/com_slideshowck/elements/ckformfield.php b/deployed/slideshowck/administrator/components/com_slideshowck/elements/ckformfield.php new file mode 100644 index 00000000..2f06ef65 --- /dev/null +++ b/deployed/slideshowck/administrator/components/com_slideshowck/elements/ckformfield.php @@ -0,0 +1,77 @@ +mediaPath = \Joomla\CMS\Uri\Uri::root(true) . '/media/com_slideshowck/images/'; + // loads the language files from the frontend + $lang = \Joomla\CMS\Factory::getLanguage(); + $lang->load('com_slideshowck', JPATH_SITE . '/components/com_slideshowck', $lang->getTag(), false); + $lang->load('com_slideshowck', JPATH_SITE, $lang->getTag(), false); + parent::__construct(); + } + protected function getInput() { + return ''; + } + + protected function getLabel() { + return parent::getLabel(); + } + + /** + * Method to get the field options. + * + * @return array The field option objects. + * + * @since 11.1 + */ + protected function getOptions() { + $options = array(); + + foreach ($this->element->children() as $option) { + + // Only add