diff --git a/deployed/k2/administrator/components/com_k2/access.xml b/deployed/k2/administrator/components/com_k2/access.xml new file mode 100644 index 00000000..d8219493 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/access.xml @@ -0,0 +1,12 @@ + + +
+ + + + + + + +
+
diff --git a/deployed/k2/administrator/components/com_k2/config.xml b/deployed/k2/administrator/components/com_k2/config.xml new file mode 100644 index 00000000..1d5779f1 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/config.xml @@ -0,0 +1,1076 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
diff --git a/deployed/k2/administrator/components/com_k2/controllers/categories.php b/deployed/k2/administrator/components/com_k2/controllers/categories.php new file mode 100644 index 00000000..fb90c5ab --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/controllers/categories.php @@ -0,0 +1,158 @@ +getModel('categories'); + $model->publish(); + } + + function unpublish() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('categories'); + $model->unpublish(); + } + + function saveorder() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('categories'); + $model->saveorder(); + $document = JFactory::getDocument(); + if ($document->getType() == 'raw') + { + echo '1'; + return $this; + } + else + { + $this->setRedirect('index.php?option=com_k2&view=categories', JText::_('K2_NEW_ORDERING_SAVED')); + } + } + + function orderup() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('categories'); + $model->orderup(); + } + + function orderdown() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('categories'); + $model->orderdown(); + } + + function accessregistered() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('categories'); + $model->accessregistered(); + } + + function accessspecial() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('categories'); + $model->accessspecial(); + } + + function accesspublic() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('categories'); + $model->accesspublic(); + } + + function trash() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('categories'); + $model->trash(); + } + + function restore() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('categories'); + $model->restore(); + } + + function remove() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('categories'); + $model->remove(); + } + + function add() + { + $application = JFactory::getApplication(); + $application->redirect('index.php?option=com_k2&view=category'); + } + + function edit() + { + $application = JFactory::getApplication(); + $cid = JRequest::getVar('cid'); + $application->redirect('index.php?option=com_k2&view=category&cid='.$cid[0]); + } + + function element() + { + JRequest::setVar('view', 'categories'); + JRequest::setVar('layout', 'element'); + parent::display(); + } + + function move() + { + $view = $this->getView('categories', 'html'); + $view->setLayout('move'); + $view->move(); + } + + function saveBatch() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('categories'); + $model->saveBatch(); + } + + function saveMove() + { + $model = $this->getModel('categories'); + $model->move(); + } + + function copy() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('categories'); + $model->copy(); + } + +} diff --git a/deployed/k2/administrator/components/com_k2/controllers/category.php b/deployed/k2/administrator/components/com_k2/controllers/category.php new file mode 100644 index 00000000..e65a5862 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/controllers/category.php @@ -0,0 +1,49 @@ +getModel('category'); + $model->save(); + } + + function saveAndNew() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('category'); + $model->save(); + } + + function apply() + { + $this->save(); + } + + function cancel() + { + $application = JFactory::getApplication(); + $application->redirect('index.php?option=com_k2&view=categories'); + } + +} diff --git a/deployed/k2/administrator/components/com_k2/controllers/comments.php b/deployed/k2/administrator/components/com_k2/controllers/comments.php new file mode 100644 index 00000000..810ce346 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/controllers/comments.php @@ -0,0 +1,60 @@ +getModel('comments'); + $model->publish(); + } + + function unpublish() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('comments'); + $model->unpublish(); + } + + function remove() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('comments'); + $model->remove(); + } + + function deleteUnpublished() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('comments'); + $model->deleteUnpublished(); + } + + function saveComment() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('comments'); + $model->save(); + } + +} diff --git a/deployed/k2/administrator/components/com_k2/controllers/controller.php b/deployed/k2/administrator/components/com_k2/controllers/controller.php new file mode 100644 index 00000000..061d6818 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/controllers/controller.php @@ -0,0 +1,44 @@ +getModel('extraField'); + $model->save(); + } + + function apply() + { + $this->save(); + } + + function cancel() + { + $application = JFactory::getApplication(); + $application->redirect('index.php?option=com_k2&view=extrafields'); + } + +} diff --git a/deployed/k2/administrator/components/com_k2/controllers/extrafields.php b/deployed/k2/administrator/components/com_k2/controllers/extrafields.php new file mode 100644 index 00000000..152345ba --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/controllers/extrafields.php @@ -0,0 +1,89 @@ +getModel('extraFields'); + $model->publish(); + } + + function unpublish() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('extraFields'); + $model->unpublish(); + } + + function saveorder() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('extraFields'); + $model->saveorder(); + $document = JFactory::getDocument(); + if ($document->getType() == 'raw') + { + echo '1'; + return $this; + } + else + { + $this->setRedirect('index.php?option=com_k2&view=extrafields', JText::_('K2_NEW_ORDERING_SAVED')); + } + } + + function orderup() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('extraFields'); + $model->orderup(); + } + + function orderdown() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('extraFields'); + $model->orderdown(); + } + + function remove() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('extraFields'); + $model->remove(); + } + + function add() + { + $application = JFactory::getApplication(); + $application->redirect('index.php?option=com_k2&view=extrafield'); + } + + function edit() + { + $application = JFactory::getApplication(); + $cid = JRequest::getVar('cid'); + $application->redirect('index.php?option=com_k2&view=extrafield&cid='.$cid[0]); + } + +} diff --git a/deployed/k2/administrator/components/com_k2/controllers/extrafieldsgroup.php b/deployed/k2/administrator/components/com_k2/controllers/extrafieldsgroup.php new file mode 100644 index 00000000..31854a52 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/controllers/extrafieldsgroup.php @@ -0,0 +1,47 @@ +getModel('extraFields'); + $view = $this->getView('extrafieldsgroup', 'html'); + $view->setModel($model, true); + parent::display(); + } + + function save() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('extraFields'); + $view = $this->getView('extrafieldsgroup', 'html'); + $view->setModel($model, true); + $model->saveGroup(); + } + + function apply() + { + $this->save(); + } + + function cancel() + { + $application = JFactory::getApplication(); + $application->redirect('index.php?option=com_k2&view=extrafieldsgroups'); + } + +} diff --git a/deployed/k2/administrator/components/com_k2/controllers/extrafieldsgroups.php b/deployed/k2/administrator/components/com_k2/controllers/extrafieldsgroups.php new file mode 100644 index 00000000..c0d26564 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/controllers/extrafieldsgroups.php @@ -0,0 +1,47 @@ +getModel('extraFields'); + $view = $this->getView('extrafieldsgroups', 'html'); + $view->setModel($model, true); + parent::display(); + } + + function add() + { + $application = JFactory::getApplication(); + $application->redirect('index.php?option=com_k2&view=extrafieldsgroup'); + } + + function edit() + { + $application = JFactory::getApplication(); + $cid = JRequest::getVar('cid'); + $application->redirect('index.php?option=com_k2&view=extrafieldsgroup&cid='.$cid[0]); + } + + function remove() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('extraFields'); + $model->removeGroups(); + } + +} diff --git a/deployed/k2/administrator/components/com_k2/controllers/info.php b/deployed/k2/administrator/components/com_k2/controllers/info.php new file mode 100644 index 00000000..f91718bb --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/controllers/info.php @@ -0,0 +1,24 @@ +getModel('item'); + $model->save(); + } + + function apply() + { + $this->save(); + } + + function cancel() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('item'); + $model->cancel(); + } + + function deleteAttachment() + { + $model = $this->getModel('item'); + $model->deleteAttachment(); + } + + function tag() + { + $model = $this->getModel('tag'); + $model->addTag(); + } + + function tags() + { + $user = JFactory::getUser(); + if($user->guest) + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + $model = $this->getModel('tag'); + $model->tags(); + } + + function download() + { + $model = $this->getModel('item'); + $model->download(); + } + + function extraFields() + { + $application = JFactory::getApplication(); + $itemID = JRequest::getInt('id', NULL); + $categoryModel = $this->getModel('category'); + $category = $categoryModel->getData(); + $extraFieldModel = $this->getModel('extraField'); + $extraFields = $extraFieldModel->getExtraFieldsByGroup($category->extraFieldsGroup); + + $counter = 0; + $output = ''; + if (count($extraFields)) + { + foreach ($extraFields as $extraField) + { + + if ($extraField->type == 'header') + { + $output .= '

'.$extraField->name.'

'; + } + else + { + $output .= ' +
+
+ +
+
'.$extraFieldModel->renderExtraField($extraField, $itemID).'
+
+ '; + } + $counter++; + } + } + + if ($counter == 0) + $output = JText::_('K2_THIS_CATEGORY_DOESNT_HAVE_ASSIGNED_EXTRA_FIELDS'); + + echo $output; + + $application->close(); + } + + function resetHits() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('item'); + $model->resetHits(); + } + + function resetRating() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('item'); + $model->resetRating(); + } +} diff --git a/deployed/k2/administrator/components/com_k2/controllers/items.php b/deployed/k2/administrator/components/com_k2/controllers/items.php new file mode 100644 index 00000000..a27fda5f --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/controllers/items.php @@ -0,0 +1,214 @@ +getModel('items'); + $model->publish(); + } + + function unpublish() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('items'); + $model->unpublish(); + } + + function saveorder() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('items'); + $result = $model->saveorder(); + $document = JFactory::getDocument(); + if ($document->getType() == 'raw') + { + echo '1'; + return $this; + } + else + { + $this->setRedirect('index.php?option=com_k2&view=items', JText::_('K2_NEW_ORDERING_SAVED')); + } + } + + function orderup() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('items'); + $model->orderup(); + } + + function orderdown() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('items'); + $model->orderdown(); + } + + function savefeaturedorder() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('items'); + $result = $model->savefeaturedorder(); + $document = JFactory::getDocument(); + if ($document->getType() == 'raw') + { + echo '1'; + return $this; + } + else + { + $this->setRedirect('index.php?option=com_k2&view=items', JText::_('K2_NEW_FEATURED_ORDERING_SAVED')); + } + } + + function featuredorderup() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('items'); + $model->featuredorderup(); + } + + function featuredorderdown() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('items'); + $model->featuredorderdown(); + } + + function accessregistered() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('items'); + $model->accessregistered(); + } + + function accessspecial() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('items'); + $model->accessspecial(); + } + + function accesspublic() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('items'); + $model->accesspublic(); + } + + function featured() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('items'); + $model->featured(); + } + + function trash() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('items'); + $model->trash(); + } + + function restore() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('items'); + $model->restore(); + } + + function remove() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('items'); + $model->remove(); + } + + function add() + { + $application = JFactory::getApplication(); + $application->redirect('index.php?option=com_k2&view=item'); + } + + function edit() + { + $application = JFactory::getApplication(); + $cid = JRequest::getVar('cid'); + $application->redirect('index.php?option=com_k2&view=item&cid='.$cid[0]); + } + + function copy() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('items'); + $model->copy(); + } + + function element() + { + JRequest::setVar('view', 'items'); + JRequest::setVar('layout', 'element'); + parent::display(); + } + + function import() + { + $model = $this->getModel('items'); + if (K2_JVERSION != '15') + { + $model->importJ16(); + } + else + { + $model->import(); + } + } + + function saveBatch() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('items'); + $model->saveBatch(); + } + + function logStats() + { + JRequest::checkToken() or jexit('Invalid Token'); + $status = JRequest::getInt('status'); + $response = JRequest::getString('response'); + $date = JFactory::getDate(); + $now = version_compare(JVERSION, '2.5', 'ge') ? $date->toSql() : $date->toMySQL(); + $db = JFactory::getDbo(); + + $query = 'DELETE FROM #__k2_log'; + $db->setQuery($query); + $db->query(); + + $query = 'INSERT INTO #__k2_log VALUES('.$status.', '.$db->quote($response).', '.$db->quote($now).')'; + $db->setQuery($query); + $db->query(); + + exit; + } +} diff --git a/deployed/k2/administrator/components/com_k2/controllers/media.php b/deployed/k2/administrator/components/com_k2/controllers/media.php new file mode 100644 index 00000000..54f9ee55 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/controllers/media.php @@ -0,0 +1,132 @@ +get('file_path', 'media'); + $folder = JRequest::getVar('folder', $root, 'default', 'path'); + $type = JRequest::getCmd('type', 'video'); + + if (JString::trim($folder) == "") + { + $folder = $root; + } + else + { + // Ensure that we are always below the root directory + if (strpos($folder, $root) !== 0) + { + $folder = $root; + } + } + + // Disable debug + JRequest::setVar('debug', false); + + $url = JURI::root(true).'/'.$folder; + $path = JPATH_SITE.'/'.JPath::clean($folder); + + JPath::check($path); + + require_once(JPATH_SITE.'/media/k2/assets/vendors/studio-42/elfinder/php/autoload.php'); + + function access($attr, $path, $data, $volume) + { + $application = JFactory::getApplication(); + + // Hide PHP files + $ext = strtolower(JFile::getExt(basename($path))); + + if ($ext == 'php') + { + return true; + } + + // Hide files and folders starting with . + if (strpos(basename($path), '.') === 0 && $attr == 'hidden') + { + return true; + } + + // Read only access for front-end. Full access for administration section. + switch($attr) + { + case 'read' : + return true; + break; + case 'write' : + return ($application->isSite()) ? false : true; + break; + case 'locked' : + return ($application->isSite()) ? true : false; + break; + case 'hidden' : + return false; + break; + } + + } + + if ($application->isAdmin()) + { + $permissions = array('read' => true, 'write' => true); + } + else + { + $permissions = array('read' => true, 'write' => false); + } + + $options = array( + 'debug' => false, + 'roots' => array( + array( + 'driver' => 'LocalFileSystem', + 'path' => $path, + 'URL' => $url, + 'accessControl' => 'access', + 'defaults' => $permissions, + 'mimeDetect' => 'internal', + 'uploadDeny' => array('all'), + 'uploadAllow' => array('image', 'video', 'audio', 'text/plain', 'text/html', 'application/json', 'application/pdf', 'application/zip', 'application/x-7z-compressed', 'application/x-bzip', 'application/x-bzip2', 'text/css', 'application/msword', 'application/vnd.ms-excel', 'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'), + 'uploadOrder' => array('deny', 'allow') + ) + ) + ); + $connector = new elFinderConnector(new elFinder($options)); + $connector->run(); + } + +} diff --git a/deployed/k2/administrator/components/com_k2/controllers/settings.php b/deployed/k2/administrator/components/com_k2/controllers/settings.php new file mode 100644 index 00000000..43cf77a1 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/controllers/settings.php @@ -0,0 +1,42 @@ +redirect('index.php?option=com_config&view=component&component=com_k2&path=&tmpl=component'); + } + else + { + JRequest::setVar('tmpl', 'component'); + parent::display(); + } + } + + function save() + { + $application = JFactory::getApplication(); + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('settings'); + $model->save(); + $application->redirect('index.php?option=com_k2&view=settings'); + + } + +} diff --git a/deployed/k2/administrator/components/com_k2/controllers/tag.php b/deployed/k2/administrator/components/com_k2/controllers/tag.php new file mode 100644 index 00000000..57d85ab1 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/controllers/tag.php @@ -0,0 +1,42 @@ +getModel('tag'); + $model->save(); + } + + function apply() + { + $this->save(); + } + + function cancel() + { + $application = JFactory::getApplication(); + $application->redirect('index.php?option=com_k2&view=tags'); + } + +} diff --git a/deployed/k2/administrator/components/com_k2/controllers/tags.php b/deployed/k2/administrator/components/com_k2/controllers/tags.php new file mode 100644 index 00000000..96f41ef3 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/controllers/tags.php @@ -0,0 +1,72 @@ +getModel('tags'); + $model->publish(); + } + + function unpublish() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('tags'); + $model->unpublish(); + } + + function remove() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('tags'); + $model->remove(); + } + + function add() + { + $application = JFactory::getApplication(); + $application->redirect('index.php?option=com_k2&view=tag'); + } + + function edit() + { + $application = JFactory::getApplication(); + $cid = JRequest::getVar('cid'); + $application->redirect('index.php?option=com_k2&view=tag&cid='.$cid[0]); + } + + function element() + { + JRequest::setVar('view', 'tags'); + JRequest::setVar('layout', 'element'); + parent::display(); + } + + function removeOrphans() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('tags'); + $model->removeOrphans(); + } + +} diff --git a/deployed/k2/administrator/components/com_k2/controllers/user.php b/deployed/k2/administrator/components/com_k2/controllers/user.php new file mode 100644 index 00000000..485a5cba --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/controllers/user.php @@ -0,0 +1,55 @@ +getModel('user'); + $model->save(); + } + + function apply() + { + $this->save(); + } + + function cancel() + { + $application = JFactory::getApplication(); + $application->redirect('index.php?option=com_k2&view=users'); + } + + function report() + { + $app = JFactory::getApplication(); + $model = K2Model::getInstance('User', 'K2Model'); + $model->setState('id', JRequest::getInt('id')); + $model->reportSpammer(); + if(JRequest::getCmd('context') == "modalselector"){ + $app->redirect('index.php?option=com_k2&view=users&tmpl=component&context=modalselector'); + + } else { + //$this->setRedirect('index.php?option=com_k2&view=users'); + $app->redirect('index.php?option=com_k2&view=users'); + } + } +} diff --git a/deployed/k2/administrator/components/com_k2/controllers/usergroup.php b/deployed/k2/administrator/components/com_k2/controllers/usergroup.php new file mode 100644 index 00000000..63a9b189 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/controllers/usergroup.php @@ -0,0 +1,42 @@ +getModel('userGroup'); + $model->save(); + } + + function apply() + { + $this->save(); + } + + function cancel() + { + $application = JFactory::getApplication(); + $application->redirect('index.php?option=com_k2&view=usergroups'); + } + +} diff --git a/deployed/k2/administrator/components/com_k2/controllers/usergroups.php b/deployed/k2/administrator/components/com_k2/controllers/usergroups.php new file mode 100644 index 00000000..ba680601 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/controllers/usergroups.php @@ -0,0 +1,44 @@ +redirect('index.php?option=com_k2&view=usergroup&cid='.$cid[0]); + } + + function add() + { + $application = JFactory::getApplication(); + $application->redirect('index.php?option=com_k2&view=usergroup'); + } + + function remove() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('userGroups'); + $model->remove(); + } + +} diff --git a/deployed/k2/administrator/components/com_k2/controllers/users.php b/deployed/k2/administrator/components/com_k2/controllers/users.php new file mode 100644 index 00000000..adf0a3b0 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/controllers/users.php @@ -0,0 +1,106 @@ +redirect('index.php?option=com_k2&view=user&cid='.$cid[0]); + } + + function remove() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('users'); + $model->remove(); + } + + function element() + { + JRequest::setVar('view', 'users'); + JRequest::setVar('layout', 'element'); + parent::display(); + } + + function enable() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('users'); + $model->enable(); + } + + function disable() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('users'); + $model->disable(); + } + + function delete() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('users'); + $model->delete(); + } + + function move() + { + $view = $this->getView('users', 'html'); + $view->setLayout('move'); + $model = $this->getModel('users'); + $view->setModel($model); + $view->move(); + } + + function saveMove() + { + JRequest::checkToken() or jexit('Invalid Token'); + $model = $this->getModel('users'); + $model->saveMove(); + } + + function import() + { + $model = $this->getModel('users'); + $model->import(); + } + + function search() + { + $application = JFactory::getApplication(); + $db = JFactory::getDbo(); + $word = JRequest::getString('q', null); + if (K2_JVERSION == '15') + { + $word = $db->Quote($db->getEscaped($word, true).'%', false); + } + else + { + $word = $db->Quote($db->escape($word, true).'%', false); + } + $query = "SELECT id,name FROM #__users WHERE name LIKE ".$word." OR username LIKE ".$word." OR email LIKE ".$word; + $db->setQuery($query); + $result = $db->loadObjectList(); + echo json_encode($result); + $application->close(); + } +} diff --git a/deployed/k2/administrator/components/com_k2/elements/base.php b/deployed/k2/administrator/components/com_k2/elements/base.php new file mode 100644 index 00000000..f4917825 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/elements/base.php @@ -0,0 +1,85 @@ +fetchElement($this->name, $this->value, $this->element, $this->options['control']); + } + return $this->fetchElementValue($this->name, $this->value, $this->element, $this->options['control']); + } + function getLabel() + { + if (method_exists($this, 'fetchTooltip')) // BC + { + return $this->fetchTooltip($this->element['label'], $this->description, $this->element, $this->options['control'], $this->element['name'] = ''); + } + if (method_exists($this, 'fetchElementName')) + { + return $this->fetchElementName($this->element['label'], $this->description, $this->element, $this->options['control'], $this->element['name'] = ''); + } + return parent::getLabel(); + } + function render($layoutId, $data = array()) + { + return $this->getInput(); + } + } + } + else + { + class K2Element extends JFormField + { + function getInput() + { + if (method_exists($this, 'fetchElement')) // BC + { + return $this->fetchElement($this->name, $this->value, $this->element, $this->options['control']); + } + return $this->fetchElementValue($this->name, $this->value, $this->element, $this->options['control']); + } + function getLabel() + { + if (method_exists($this, 'fetchTooltip')) // BC + { + return $this->fetchTooltip($this->element['label'], $this->description, $this->element, $this->options['control'], $this->element['name'] = ''); + } + if (method_exists($this, 'fetchElementName')) + { + return $this->fetchElementName($this->element['label'], $this->description, $this->element, $this->options['control'], $this->element['name'] = ''); + } + return parent::getLabel(); + } + function render() + { + return $this->getInput(); + } + } + } +} diff --git a/deployed/k2/administrator/components/com_k2/elements/categories.php b/deployed/k2/administrator/components/com_k2/elements/categories.php new file mode 100644 index 00000000..a52caf39 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/elements/categories.php @@ -0,0 +1,92 @@ +setQuery($query); + $mitems = $db->loadObjectList(); + $children = array(); + if ($mitems) + { + foreach ($mitems as $v) + { + if (K2_JVERSION != '15') + { + $v->title = $v->name; + $v->parent_id = $v->parent; + } + $pt = $v->parent; + $list = @$children[$pt] ? $children[$pt] : array(); + array_push($list, $v); + $children[$pt] = $list; + } + } + $list = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0); + $mitems = array(); + $mitems[] = JHTML::_('select.option', '0', JText::_('K2_NONE_ONSELECTLISTS')); + + foreach ($list as $item) + { + $item->treename = JString::str_ireplace(' ', ' -', $item->treename); + $mitems[] = JHTML::_('select.option', $item->id, $item->treename); + } + + $attributes = 'class="inputbox"'; + if (K2_JVERSION != '15') + { + $attribute = K2_JVERSION == '25' ? $node->getAttribute('multiple') : $node->attributes()->multiple; + if ($attribute) + { + $attributes .= ' multiple="multiple" size="10"'; + } + } + else + { + if ($node->attributes('multiple')) + { + $attributes .= ' multiple="multiple" size="10"'; + } + } + + if (K2_JVERSION != '15') + { + $fieldName = $name; + } + else + { + $fieldName = $control_name.'['.$name.']'; + if ($node->attributes('multiple')) + { + $fieldName .= '[]'; + } + } + + return JHTML::_('select.genericlist', $mitems, $fieldName, $attributes, 'value', 'text', $value); + } +} + +class JFormFieldCategories extends K2ElementCategories +{ + var $type = 'categories'; +} + +class JElementCategories extends K2ElementCategories +{ + var $_name = 'categories'; +} diff --git a/deployed/k2/administrator/components/com_k2/elements/categorieslatest.php b/deployed/k2/administrator/components/com_k2/elements/categorieslatest.php new file mode 100644 index 00000000..7ea7e33b --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/elements/categorieslatest.php @@ -0,0 +1,138 @@ +attributes()->multiple) + { + $fieldName .= '[]'; + } + $image = JURI::root(true).'/administrator/templates/'.$mainframe->getTemplate().'/images/admin/publish_x.png'; + } + else + { + $fieldName = $control_name.'['.$name.'][]'; + $image = JURI::root(true).'/administrator/images/publish_x.png'; + } + + $js = " + function jSelectCategory(id, title, object) { + var exists = false; + \$K2('#categoriesList input').each(function(){ + if(\$K2(this).val()==id){ + alert('".JText::_('K2_THE_SELECTED_CATEGORY_IS_ALREADY_IN_THE_LIST', true)."'); + exists = true; + } + }); + if(!exists){ + var container = \$K2('
  • ').appendTo(\$K2('#categoriesList')); + var img = \$K2('',{'class':'remove', src:'".$image."'}).appendTo(container); + img.click(function(){\$K2(this).parent().remove();}); + var span = \$K2('',{'class':'handle'}).html(title).appendTo(container); + var input = \$K2('',{value:id, type:'hidden', name:'".$fieldName."'}).appendTo(container); + var div = \$K2('
    ',{style:'clear:both;'}).appendTo(container); + \$K2('#categoriesList').sortable('refresh'); + alert('".JText::_('K2_CATEGORY_ADDED_IN_THE_LIST', true)."'); + } + } + + \$K2(document).ready(function(){ + \$K2('#categoriesList').sortable({ + containment: '#categoriesList', + items: 'li', + handle: 'span.handle' + }); + \$K2('#categoriesList .remove').click(function(){ + \$K2(this).parent().remove(); + }); + }); + "; + + $document->addScriptDeclaration($js); + $document->addStyleSheet(JURI::root(true).'/media/k2/assets/css/k2.modules.css?v=2.7.1'); + + $current = array(); + if (is_string($value) && !empty($value)) + { + $current[] = $value; + } + if (is_array($value)) + { + $current = $value; + } + + $output = ' + +
    + '; + + JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'tables'); + + $output .= '
      '; + foreach ($current as $id) + { + $row = JTable::getInstance('K2Category', 'Table'); + $row->load($id); + $output .= ' +
    • + + '.$row->name.' + + +
    • + '; + } + $output .= '
    '; + return $output; + } + +} + +class JFormFieldCategoriesLatest extends K2ElementCategoriesLatest +{ + var $type = 'categorieslatest'; +} + +class JElementCategoriesLatest extends K2ElementCategoriesLatest +{ + var $_name = 'categorieslatest'; +} diff --git a/deployed/k2/administrator/components/com_k2/elements/categoriesmultiple.php b/deployed/k2/administrator/components/com_k2/elements/categoriesmultiple.php new file mode 100644 index 00000000..f110bf01 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/elements/categoriesmultiple.php @@ -0,0 +1,146 @@ +setQuery($query); + $mitems = $db->loadObjectList(); + $children = array(); + if ($mitems) + { + foreach ($mitems as $v) + { + if (K2_JVERSION != '15') + { + $v->title = $v->name; + $v->parent_id = $v->parent; + } + $pt = $v->parent; + $list = @$children[$pt] ? $children[$pt] : array(); + array_push($list, $v); + $children[$pt] = $list; + } + } + $list = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0); + $mitems = array(); + + foreach ($list as $item) + { + $item->treename = JString::str_ireplace(' ', '- ', $item->treename); + $mitems[] = JHTML::_('select.option', $item->id, ' '.$item->treename); + } + + $doc = JFactory::getDocument(); + if (K2_JVERSION != '15') + { + $js = " + \$K2(document).ready(function(){ + + \$K2('#jform_params_catfilter0').click(function(){ + \$K2('#jformparamscategory_id').attr('disabled', 'disabled'); + \$K2('#jformparamscategory_id option').each(function() { + \$K2(this).attr('selected', 'selected'); + }); + \$K2('#jformparamscategory_id').trigger('liszt:updated'); + }); + + \$K2('#jform_params_catfilter1').click(function(){ + \$K2('#jformparamscategory_id').removeAttr('disabled'); + \$K2('#jformparamscategory_id option').each(function() { + \$K2(this).removeAttr('selected'); + }); + \$K2('#jformparamscategory_id').trigger('liszt:updated'); + }); + + if (\$K2('#jform_params_catfilter0').attr('checked')) { + \$K2('#jformparamscategory_id').attr('disabled', 'disabled'); + \$K2('#jformparamscategory_id option').each(function() { + \$K2(this).attr('selected', 'selected'); + }); + \$K2('#jformparamscategory_id').trigger('liszt:updated'); + } + + if (\$K2('#jform_params_catfilter1').attr('checked')) { + \$K2('#jformparamscategory_id').removeAttr('disabled'); + \$K2('#jformparamscategory_id').trigger('liszt:updated'); + } + + }); + "; + } + else + { + $js = " + \$K2(document).ready(function(){ + + \$K2('#paramscatfilter0').click(function(){ + \$K2('#paramscategory_id').attr('disabled', 'disabled'); + \$K2('#paramscategory_id option').each(function() { + \$K2(this).attr('selected', 'selected'); + }); + }); + + \$K2('#paramscatfilter1').click(function(){ + \$K2('#paramscategory_id').removeAttr('disabled'); + \$K2('#paramscategory_id option').each(function() { + \$K2(this).removeAttr('selected'); + }); + + }); + + if (\$K2('#paramscatfilter0').attr('checked')) { + \$K2('#paramscategory_id').attr('disabled', 'disabled'); + \$K2('#paramscategory_id option').each(function() { + \$K2(this).attr('selected', 'selected'); + }); + } + + if (\$K2('#paramscatfilter1').attr('checked')) { + \$K2('#paramscategory_id').removeAttr('disabled'); + } + + }); + "; + } + + if (K2_JVERSION != '15') + { + $fieldName = $name.'[]'; + } + else + { + $fieldName = $control_name.'['.$name.'][]'; + } + + $doc->addScriptDeclaration($js); + $output = JHTML::_('select.genericlist', $mitems, $fieldName, 'class="inputbox" multiple="multiple" size="10"', 'value', 'text', $value); + return $output; + } +} + +class JFormFieldCategoriesMultiple extends K2ElementCategoriesMultiple +{ + var $type = 'categoriesmultiple'; +} + +class JElementCategoriesMultiple extends K2ElementCategoriesMultiple +{ + var $_name = 'categoriesmultiple'; +} diff --git a/deployed/k2/administrator/components/com_k2/elements/category.php b/deployed/k2/administrator/components/com_k2/elements/category.php new file mode 100644 index 00000000..78c18218 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/elements/category.php @@ -0,0 +1,256 @@ +setQuery($query); + $mitems = $db->loadObjectList(); + $children = array(); + if ($mitems) + { + foreach ($mitems as $v) + { + if (K2_JVERSION != '15') + { + $v->title = $v->name; + $v->parent_id = $v->parent; + } + $pt = $v->parent; + $list = @$children[$pt] ? $children[$pt] : array(); + array_push($list, $v); + $children[$pt] = $list; + } + } + + $list = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0); + $mitems = array(); + $option = JRequest::getCmd('option'); + $prefix = ($option == 'com_joomfish') ? 'refField_' : ''; + if ($name == 'categories' || $name == 'jform[params][categories]') + { + if(version_compare(JVERSION, '3.5', 'ge')) { + JHtml::_('behavior.framework'); + } + $doc = JFactory::getDocument(); + $js = " + window.addEvent('domready', function(){ + setTask(); + }); + + function setTask() { + var counter=0; + $$('#".$prefix."paramscategories option').each(function(el) { + if (el.selected){ + value=el.value; + counter++; + } + }); + if (counter>1 || counter==0){ + $('urlparamsid').setProperty('value',''); + $('urlparamstask').setProperty('value',''); + $('".$prefix."paramssingleCatOrdering').setProperty('disabled', 'disabled'); + enableParams(); + } + if (counter==1){ + $('urlparamsid').setProperty('value',value); + $('urlparamstask').setProperty('value','category'); + $('".$prefix."paramssingleCatOrdering').removeProperty('disabled'); + disableParams(); + } + } + + function disableParams(){ + $('".$prefix."paramsnum_leading_items').setProperty('disabled','disabled'); + $('".$prefix."paramsnum_leading_columns').setProperty('disabled','disabled'); + $('".$prefix."paramsleadingImgSize').setProperty('disabled','disabled'); + $('".$prefix."paramsnum_primary_items').setProperty('disabled','disabled'); + $('".$prefix."paramsnum_primary_columns').setProperty('disabled','disabled'); + $('".$prefix."paramsprimaryImgSize').setProperty('disabled','disabled'); + $('".$prefix."paramsnum_secondary_items').setProperty('disabled','disabled'); + $('".$prefix."paramsnum_secondary_columns').setProperty('disabled','disabled'); + $('".$prefix."paramssecondaryImgSize').setProperty('disabled','disabled'); + $('".$prefix."paramsnum_links').setProperty('disabled','disabled'); + $('".$prefix."paramsnum_links_columns').setProperty('disabled','disabled'); + $('".$prefix."paramslinksImgSize').setProperty('disabled','disabled'); + $('".$prefix."paramscatCatalogMode').setProperty('disabled','disabled'); + $('".$prefix."paramscatFeaturedItems').setProperty('disabled','disabled'); + $('".$prefix."paramscatOrdering').setProperty('disabled','disabled'); + $('".$prefix."paramscatPagination').setProperty('disabled','disabled'); + $('".$prefix."paramscatPaginationResults0').setProperty('disabled','disabled'); + $('".$prefix."paramscatPaginationResults1').setProperty('disabled','disabled'); + $('".$prefix."paramscatFeedLink0').setProperty('disabled','disabled'); + $('".$prefix."paramscatFeedLink1').setProperty('disabled','disabled'); + $('".$prefix."paramscatFeedIcon0').setProperty('disabled','disabled'); + $('".$prefix."paramscatFeedIcon1').setProperty('disabled','disabled'); + $('".$prefix."paramstheme').setProperty('disabled','disabled'); + } + + function enableParams(){ + $('".$prefix."paramsnum_leading_items').removeProperty('disabled'); + $('".$prefix."paramsnum_leading_columns').removeProperty('disabled'); + $('".$prefix."paramsleadingImgSize').removeProperty('disabled'); + $('".$prefix."paramsnum_primary_items').removeProperty('disabled'); + $('".$prefix."paramsnum_primary_columns').removeProperty('disabled'); + $('".$prefix."paramsprimaryImgSize').removeProperty('disabled'); + $('".$prefix."paramsnum_secondary_items').removeProperty('disabled'); + $('".$prefix."paramsnum_secondary_columns').removeProperty('disabled'); + $('".$prefix."paramssecondaryImgSize').removeProperty('disabled'); + $('".$prefix."paramsnum_links').removeProperty('disabled'); + $('".$prefix."paramsnum_links_columns').removeProperty('disabled'); + $('".$prefix."paramslinksImgSize').removeProperty('disabled'); + $('".$prefix."paramscatCatalogMode').removeProperty('disabled'); + $('".$prefix."paramscatFeaturedItems').removeProperty('disabled'); + $('".$prefix."paramscatOrdering').removeProperty('disabled'); + $('".$prefix."paramscatPagination').removeProperty('disabled'); + $('".$prefix."paramscatPaginationResults0').removeProperty('disabled'); + $('".$prefix."paramscatPaginationResults1').removeProperty('disabled'); + $('".$prefix."paramscatFeedLink0').removeProperty('disabled'); + $('".$prefix."paramscatFeedLink1').removeProperty('disabled'); + $('".$prefix."paramscatFeedIcon0').removeProperty('disabled'); + $('".$prefix."paramscatFeedIcon1').removeProperty('disabled'); + $('".$prefix."paramstheme').removeProperty('disabled'); + } + "; + + if (K2_JVERSION != '15') + { + $js = " + function disableParams(){ + $('jform_params_num_leading_items').setProperty('disabled','disabled'); + $('jform_params_num_leading_columns').setProperty('disabled','disabled'); + $('jform_params_leadingImgSize').setProperty('disabled','disabled'); + $('jform_params_num_primary_items').setProperty('disabled','disabled'); + $('jform_params_num_primary_columns').setProperty('disabled','disabled'); + $('jform_params_primaryImgSize').setProperty('disabled','disabled'); + $('jform_params_num_secondary_items').setProperty('disabled','disabled'); + $('jform_params_num_secondary_columns').setProperty('disabled','disabled'); + $('jform_params_secondaryImgSize').setProperty('disabled','disabled'); + $('jform_params_num_links').setProperty('disabled','disabled'); + $('jform_params_num_links_columns').setProperty('disabled','disabled'); + $('jform_params_linksImgSize').setProperty('disabled','disabled'); + $('jform_params_catCatalogMode').setProperty('disabled','disabled'); + $('jform_params_catFeaturedItems').setProperty('disabled','disabled'); + $('jform_params_catOrdering').setProperty('disabled','disabled'); + $('jform_params_catPagination').setProperty('disabled','disabled'); + $('jform_params_catPaginationResults0').setProperty('disabled','disabled'); + $('jform_params_catPaginationResults1').setProperty('disabled','disabled'); + $('jform_params_catFeedLink0').setProperty('disabled','disabled'); + $('jform_params_catFeedLink1').setProperty('disabled','disabled'); + $('jform_params_catFeedIcon0').setProperty('disabled','disabled'); + $('jform_params_catFeedIcon1').setProperty('disabled','disabled'); + $('jformparamstheme').setProperty('disabled','disabled'); + } + + function enableParams(){ + $('jform_params_num_leading_items').removeProperty('disabled'); + $('jform_params_num_leading_columns').removeProperty('disabled'); + $('jform_params_leadingImgSize').removeProperty('disabled'); + $('jform_params_num_primary_items').removeProperty('disabled'); + $('jform_params_num_primary_columns').removeProperty('disabled'); + $('jform_params_primaryImgSize').removeProperty('disabled'); + $('jform_params_num_secondary_items').removeProperty('disabled'); + $('jform_params_num_secondary_columns').removeProperty('disabled'); + $('jform_params_secondaryImgSize').removeProperty('disabled'); + $('jform_params_num_links').removeProperty('disabled'); + $('jform_params_num_links_columns').removeProperty('disabled'); + $('jform_params_linksImgSize').removeProperty('disabled'); + $('jform_params_catCatalogMode').removeProperty('disabled'); + $('jform_params_catFeaturedItems').removeProperty('disabled'); + $('jform_params_catOrdering').removeProperty('disabled'); + $('jform_params_catPagination').removeProperty('disabled'); + $('jform_params_catPaginationResults0').removeProperty('disabled'); + $('jform_params_catPaginationResults1').removeProperty('disabled'); + $('jform_params_catFeedLink0').removeProperty('disabled'); + $('jform_params_catFeedLink1').removeProperty('disabled'); + $('jform_params_catFeedIcon0').removeProperty('disabled'); + $('jform_params_catFeedIcon1').removeProperty('disabled'); + $('jformparamstheme').removeProperty('disabled'); + } + + function setTask() { + var counter=0; + $$('#jformparamscategories option').each(function(el) { + if (el.selected){ + value=el.value; + counter++; + } + }); + if (counter>1 || counter==0){ + $('jform_request_id').setProperty('value',''); + $('jform_request_task').setProperty('value',''); + $('jform_params_singleCatOrdering').setProperty('disabled', 'disabled'); + enableParams(); + } + if (counter==1){ + $('jform_request_id').setProperty('value',value); + $('jform_request_task').setProperty('value','category'); + $('jform_params_singleCatOrdering').removeProperty('disabled'); + disableParams(); + } + } + + window.addEvent('domready', function(){ + if($('request-options')) { + $$('.panel')[0].setStyle('display', 'none'); + } + setTask(); + }); + "; + } + + $doc->addScriptDeclaration($js); + } + + foreach ($list as $item) + { + $item->treename = JString::str_ireplace(' ', '- ', $item->treename); + @$mitems[] = JHTML::_('select.option', $item->id, $item->treename); + } + + if (K2_JVERSION != '15') + { + $fieldName = $name.'[]'; + } + else + { + $fieldName = $control_name.'['.$name.'][]'; + } + + if ($name == 'categories' || $name == 'jform[params][categories]') + { + $onChange = 'onchange="setTask();"'; + } + else + { + $onChange = ''; + } + + return JHTML::_('select.genericlist', $mitems, $fieldName, $onChange.' class="inputbox" style="width:90%;" multiple="multiple" size="15"', 'value', 'text', $value); + + } +} + +class JFormFieldCategory extends K2ElementCategory +{ + var $type = 'category'; +} + +class JElementCategory extends K2ElementCategory +{ + var $_name = 'category'; +} diff --git a/deployed/k2/administrator/components/com_k2/elements/header.php b/deployed/k2/administrator/components/com_k2/elements/header.php new file mode 100644 index 00000000..afaa9633 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/elements/header.php @@ -0,0 +1,42 @@ +
    '.JText::_($value).'
    '; + } + else + { + return '
    '.JText::_($value).'
    '; + } + } + + public function fetchElementName($label, $description, &$node, $control_name, $name) + { + return NULL; + } +} + +class JFormFieldHeader extends K2ElementHeader +{ + var $type = 'header'; +} + +class JElementHeader extends K2ElementHeader +{ + var $_name = 'header'; +} diff --git a/deployed/k2/administrator/components/com_k2/elements/item.php b/deployed/k2/administrator/components/com_k2/elements/item.php new file mode 100644 index 00000000..8b5fc582 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/elements/item.php @@ -0,0 +1,100 @@ +load($value); + } + else + { + $item->title = JText::_('K2_SELECT_AN_ITEM'); + } + + $document->addScriptDeclaration(" + function jSelectItem(id, title, object) { + document.getElementById('".$name."' + '_id').value = id; + document.getElementById('".$name."' + '_name').value = title; + if(typeof(window.parent.SqueezeBox.close=='function')){ + window.parent.SqueezeBox.close(); + } + else { + document.getElementById('sbox-window').close(); + } + } + "); + + $link = 'index.php?option=com_k2&view=items&tmpl=component&context=modalselector&object='.$name; + JHTML::_('behavior.modal', 'a.modal'); + if (K2_JVERSION == '30') + { + $value = (int) $value; + if(!$value) { + $value = ''; + } + $class = ''; + if($node->attributes()->required) { + $class = 'required '; + } + $html = ' + + + + '.JText::_('K2_SELECT').' + + + + '; + } + else + { + $html = ' +
    + +
    + + + '; + } + + return $html; + } +} + +class JFormFieldItem extends K2ElementItem +{ + var $type = 'item'; +} + +class JElementItem extends K2ElementItem +{ + var $_name = 'item'; +} diff --git a/deployed/k2/administrator/components/com_k2/elements/itemform.php b/deployed/k2/administrator/components/com_k2/elements/itemform.php new file mode 100644 index 00000000..608d93fa --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/elements/itemform.php @@ -0,0 +1,59 @@ +addScriptDeclaration(" + /* Mootools Snippet */ + window.addEvent('domready', function() { + if($('request-options')) { + $$('.panel')[0].setStyle('display', 'none'); + } + if($('jform_browserNav')) { + $('jform_browserNav').setProperty('value', 2); + $('jform_browserNav').getElements('option')[0].destroy(); + } + if($('browserNav')) { + $('browserNav').setProperty('value', 2); + options = $('browserNav').getElements('option'); + if(options.length == 3) { + options[0].remove(); + } + } + }); + "); + return ''; + } + + function fetchElementName($label, $description, &$node, $control_name, $name) + { + return ''; + } +} + +class JFormFielditemform extends K2ElementItemForm +{ + var $type = 'itemform'; +} + +class JElementitemform extends K2ElementItemForm +{ + var $_name = 'itemform'; +} diff --git a/deployed/k2/administrator/components/com_k2/elements/items.php b/deployed/k2/administrator/components/com_k2/elements/items.php new file mode 100644 index 00000000..747ebbe6 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/elements/items.php @@ -0,0 +1,122 @@ +getAttribute('multiple') : $node->attributes()->multiple; + if (!$attribute) + { + $fieldName .= '[]'; + } + $image = JURI::root(true).'/administrator/templates/'.$mainframe->getTemplate().'/images/admin/publish_x.png'; + } + else + { + $fieldName = $control_name.'['.$name.'][]'; + $image = JURI::root(true).'/administrator/images/publish_x.png'; + } + + $js = " + function jSelectItem(id, title, object) { + var exists = false; + \$K2('#itemsList input').each(function(){ + if(\$K2(this).val()==id){ + alert('".JText::_('K2_THE_SELECTED_ITEM_IS_ALREADY_IN_THE_LIST')."'); + exists = true; + } + }); + if(!exists){ + var container = \$K2('
  • ').appendTo(\$K2('#itemsList')); + var img = \$K2('',{'class':'remove', src:'".$image."'}).appendTo(container); + img.click(function(){\$K2(this).parent().remove();}); + var span = \$K2('',{'class':'handle'}).html(title).appendTo(container); + var input = \$K2('',{value:id, type:'hidden', name:'".$fieldName."'}).appendTo(container); + var div = \$K2('
    ',{style:'clear:both;'}).appendTo(container); + \$K2('#itemsList').sortable('refresh'); + alert('".JText::_('K2_ITEM_ADDED_IN_THE_LIST', true)."'); + } + } + + \$K2(document).ready(function(){ + \$K2('#itemsList').sortable({ + containment: '#itemsList', + items: 'li', + handle: 'span.handle' + }); + \$K2('#itemsList .remove').click(function(){ + \$K2(this).parent().remove(); + }); + }); + "; + + $document->addScriptDeclaration($js); + $document->addStyleSheet(JURI::root(true).'/media/k2/assets/css/k2.modules.css?v=2.7.1'); + + $current = array(); + if (is_string($value) && !empty($value)) + { + $current[] = $value; + } + if (is_array($value)) + { + $current = $value; + } + + JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'tables'); + $output = '
      '; + foreach ($current as $id) + { + $row = JTable::getInstance('K2Item', 'Table'); + $row->load($id); + $output .= ' +
    • + '.JText::_('K2_REMOVE_ENTRY_FROM_LIST').' + '.$row->title.' + + +
    • + '; + } + $output .= '
    '; + return $output; + } + +} + +class JFormFieldItems extends K2ElementItems +{ + var $type = 'items'; +} + +class JElementItems extends K2ElementItems +{ + var $_name = 'items'; +} diff --git a/deployed/k2/administrator/components/com_k2/elements/k2category.php b/deployed/k2/administrator/components/com_k2/elements/k2category.php new file mode 100644 index 00000000..d8f0e503 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/elements/k2category.php @@ -0,0 +1,257 @@ +setQuery($query); + $mitems = $db->loadObjectList(); + $children = array(); + if ($mitems) + { + foreach ($mitems as $v) + { + if (K2_JVERSION != '15') + { + $v->title = $v->name; + $v->parent_id = $v->parent; + } + $pt = $v->parent; + $list = @$children[$pt] ? $children[$pt] : array(); + array_push($list, $v); + $children[$pt] = $list; + } + } + + $list = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0); + $mitems = array(); + $option = JRequest::getCmd('option'); + $prefix = ($option == 'com_joomfish') ? 'refField_' : ''; + if ($name == 'categories' || $name == 'jform[params][categories]') + { + if(version_compare(JVERSION, '3.5', 'ge')) { + JHtml::_('behavior.framework'); + } + $doc = JFactory::getDocument(); + $js = " + /* Mootools Snippet */ + window.addEvent('domready', function(){ + setTask(); + }); + + function setTask() { + var counter=0; + $$('#".$prefix."paramscategories option').each(function(el) { + if (el.selected){ + value=el.value; + counter++; + } + }); + if (counter>1 || counter==0){ + $('urlparamsid').setProperty('value',''); + $('urlparamstask').setProperty('value',''); + $('".$prefix."paramssingleCatOrdering').setProperty('disabled', 'disabled'); + enableParams(); + } + if (counter==1){ + $('urlparamsid').setProperty('value',value); + $('urlparamstask').setProperty('value','category'); + $('".$prefix."paramssingleCatOrdering').removeProperty('disabled'); + disableParams(); + } + } + + function disableParams(){ + $('".$prefix."paramsnum_leading_items').setProperty('disabled','disabled'); + $('".$prefix."paramsnum_leading_columns').setProperty('disabled','disabled'); + $('".$prefix."paramsleadingImgSize').setProperty('disabled','disabled'); + $('".$prefix."paramsnum_primary_items').setProperty('disabled','disabled'); + $('".$prefix."paramsnum_primary_columns').setProperty('disabled','disabled'); + $('".$prefix."paramsprimaryImgSize').setProperty('disabled','disabled'); + $('".$prefix."paramsnum_secondary_items').setProperty('disabled','disabled'); + $('".$prefix."paramsnum_secondary_columns').setProperty('disabled','disabled'); + $('".$prefix."paramssecondaryImgSize').setProperty('disabled','disabled'); + $('".$prefix."paramsnum_links').setProperty('disabled','disabled'); + $('".$prefix."paramsnum_links_columns').setProperty('disabled','disabled'); + $('".$prefix."paramslinksImgSize').setProperty('disabled','disabled'); + $('".$prefix."paramscatCatalogMode').setProperty('disabled','disabled'); + $('".$prefix."paramscatFeaturedItems').setProperty('disabled','disabled'); + $('".$prefix."paramscatOrdering').setProperty('disabled','disabled'); + $('".$prefix."paramscatPagination').setProperty('disabled','disabled'); + $('".$prefix."paramscatPaginationResults0').setProperty('disabled','disabled'); + $('".$prefix."paramscatPaginationResults1').setProperty('disabled','disabled'); + $('".$prefix."paramscatFeedLink0').setProperty('disabled','disabled'); + $('".$prefix."paramscatFeedLink1').setProperty('disabled','disabled'); + $('".$prefix."paramscatFeedIcon0').setProperty('disabled','disabled'); + $('".$prefix."paramscatFeedIcon1').setProperty('disabled','disabled'); + $('".$prefix."paramstheme').setProperty('disabled','disabled'); + } + + function enableParams(){ + $('".$prefix."paramsnum_leading_items').removeProperty('disabled'); + $('".$prefix."paramsnum_leading_columns').removeProperty('disabled'); + $('".$prefix."paramsleadingImgSize').removeProperty('disabled'); + $('".$prefix."paramsnum_primary_items').removeProperty('disabled'); + $('".$prefix."paramsnum_primary_columns').removeProperty('disabled'); + $('".$prefix."paramsprimaryImgSize').removeProperty('disabled'); + $('".$prefix."paramsnum_secondary_items').removeProperty('disabled'); + $('".$prefix."paramsnum_secondary_columns').removeProperty('disabled'); + $('".$prefix."paramssecondaryImgSize').removeProperty('disabled'); + $('".$prefix."paramsnum_links').removeProperty('disabled'); + $('".$prefix."paramsnum_links_columns').removeProperty('disabled'); + $('".$prefix."paramslinksImgSize').removeProperty('disabled'); + $('".$prefix."paramscatCatalogMode').removeProperty('disabled'); + $('".$prefix."paramscatFeaturedItems').removeProperty('disabled'); + $('".$prefix."paramscatOrdering').removeProperty('disabled'); + $('".$prefix."paramscatPagination').removeProperty('disabled'); + $('".$prefix."paramscatPaginationResults0').removeProperty('disabled'); + $('".$prefix."paramscatPaginationResults1').removeProperty('disabled'); + $('".$prefix."paramscatFeedLink0').removeProperty('disabled'); + $('".$prefix."paramscatFeedLink1').removeProperty('disabled'); + $('".$prefix."paramscatFeedIcon0').removeProperty('disabled'); + $('".$prefix."paramscatFeedIcon1').removeProperty('disabled'); + $('".$prefix."paramstheme').removeProperty('disabled'); + } + "; + + if (K2_JVERSION != '15') + { + $js = " + /* Mootools Snippet */ + function disableParams(){ + $('jform_params_num_leading_items').setProperty('disabled','disabled'); + $('jform_params_num_leading_columns').setProperty('disabled','disabled'); + $('jform_params_leadingImgSize').setProperty('disabled','disabled'); + $('jform_params_num_primary_items').setProperty('disabled','disabled'); + $('jform_params_num_primary_columns').setProperty('disabled','disabled'); + $('jform_params_primaryImgSize').setProperty('disabled','disabled'); + $('jform_params_num_secondary_items').setProperty('disabled','disabled'); + $('jform_params_num_secondary_columns').setProperty('disabled','disabled'); + $('jform_params_secondaryImgSize').setProperty('disabled','disabled'); + $('jform_params_num_links').setProperty('disabled','disabled'); + $('jform_params_num_links_columns').setProperty('disabled','disabled'); + $('jform_params_linksImgSize').setProperty('disabled','disabled'); + $('jform_params_catCatalogMode').setProperty('disabled','disabled'); + $('jform_params_catFeaturedItems').setProperty('disabled','disabled'); + $('jform_params_catOrdering').setProperty('disabled','disabled'); + $('jform_params_catPagination').setProperty('disabled','disabled'); + $('jform_params_catPaginationResults0').setProperty('disabled','disabled'); + $('jform_params_catPaginationResults1').setProperty('disabled','disabled'); + $('jform_params_catFeedLink0').setProperty('disabled','disabled'); + $('jform_params_catFeedLink1').setProperty('disabled','disabled'); + $('jform_params_catFeedIcon0').setProperty('disabled','disabled'); + $('jform_params_catFeedIcon1').setProperty('disabled','disabled'); + $('jformparamstheme').setProperty('disabled','disabled'); + } + + function enableParams(){ + $('jform_params_num_leading_items').removeProperty('disabled'); + $('jform_params_num_leading_columns').removeProperty('disabled'); + $('jform_params_leadingImgSize').removeProperty('disabled'); + $('jform_params_num_primary_items').removeProperty('disabled'); + $('jform_params_num_primary_columns').removeProperty('disabled'); + $('jform_params_primaryImgSize').removeProperty('disabled'); + $('jform_params_num_secondary_items').removeProperty('disabled'); + $('jform_params_num_secondary_columns').removeProperty('disabled'); + $('jform_params_secondaryImgSize').removeProperty('disabled'); + $('jform_params_num_links').removeProperty('disabled'); + $('jform_params_num_links_columns').removeProperty('disabled'); + $('jform_params_linksImgSize').removeProperty('disabled'); + $('jform_params_catCatalogMode').removeProperty('disabled'); + $('jform_params_catFeaturedItems').removeProperty('disabled'); + $('jform_params_catOrdering').removeProperty('disabled'); + $('jform_params_catPagination').removeProperty('disabled'); + $('jform_params_catPaginationResults0').removeProperty('disabled'); + $('jform_params_catPaginationResults1').removeProperty('disabled'); + $('jform_params_catFeedLink0').removeProperty('disabled'); + $('jform_params_catFeedLink1').removeProperty('disabled'); + $('jform_params_catFeedIcon0').removeProperty('disabled'); + $('jform_params_catFeedIcon1').removeProperty('disabled'); + $('jformparamstheme').removeProperty('disabled'); + } + + function setTask() { + var counter=0; + $$('#jformparamscategories option').each(function(el) { + if (el.selected){ + value=el.value; + counter++; + } + }); + if (counter>1 || counter==0){ + $('jform_request_id').setProperty('value',''); + $('jform_request_task').setProperty('value',''); + $('jform_params_singleCatOrdering').setProperty('disabled', 'disabled'); + enableParams(); + } + if (counter==1){ + $('jform_request_id').setProperty('value',value); + $('jform_request_task').setProperty('value','category'); + $('jform_params_singleCatOrdering').removeProperty('disabled'); + disableParams(); + } + } + + window.addEvent('domready', function(){ + if($('request-options')) { + $$('.panel')[0].setStyle('display', 'none'); + } + setTask(); + }); + "; + } + + $doc->addScriptDeclaration($js); + } + + foreach ($list as $item) + { + $item->treename = JString::str_ireplace(' ', '- ', $item->treename); + @$mitems[] = JHTML::_('select.option', $item->id, $item->treename); + } + + if (K2_JVERSION != '15') + { + $fieldName = $name.'[]'; + } + else + { + $fieldName = $control_name.'['.$name.'][]'; + } + + if ($name == 'categories' || $name == 'jform[params][categories]') + { + $onChange = 'onchange="setTask();"'; + } + else + { + $onChange = ''; + } + + return JHTML::_('select.genericlist', $mitems, $fieldName, $onChange.' class="inputbox" multiple="multiple" size="15"', 'value', 'text', $value); + } +} + +class JFormFieldK2Category extends K2ElementK2Category +{ + var $type = 'k2category'; +} + +class JElementK2Category extends K2ElementK2Category +{ + var $_name = 'k2category'; +} diff --git a/deployed/k2/administrator/components/com_k2/elements/k2modalselector.php b/deployed/k2/administrator/components/com_k2/elements/k2modalselector.php new file mode 100644 index 00000000..0eee3f18 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/elements/k2modalselector.php @@ -0,0 +1,210 @@ +attributes()->scope) + { + $scope = $node->attributes()->scope; + } + else + { + $scope = 'items'; + } + if($scope == 'items' || $scope == 'categories' || $scope == 'users' || $scope == 'tags') + { + $fieldName = $name.'[]'; + } + else + { + $fieldName = $name; + } + } + else + { + if($node->attributes('scope')){ + $scope = $node->attributes('scope'); + } + else + { + $scope = 'items'; + } + if($scope == 'items' || $scope == 'categories' || $scope == 'users' || $scope == 'tags') + { + $fieldName = $control_name.'['.$name.'][]'; + } + else + { + $fieldName = $control_name.'['.$name.']'; + } + } + if(!$value) + { + $value = ''; + } + $saved = array(); + if (is_string($value) && !empty($value)) + { + $saved[] = $value; + } + if (is_array($value)) + { + $saved = $value; + } + + // Output + $output = ''; + + // Output for lists + if($scope == 'items' || $scope == 'categories' || $scope == 'users' || $scope == 'tags') + { + $output = ' + +
      + '; + + foreach ($saved as $value) + { + if($scope == 'items') + { + $row = JTable::getInstance('K2Item', 'Table'); + $row->load($value); + $entryName = $row->title; + $entryValue = $row->id; + } + if($scope == 'categories') + { + $row = JTable::getInstance('K2Category', 'Table'); + $row->load($value); + $entryName = $row->name; + $entryValue = $row->id; + } + if($scope == 'users') + { + $row = JFactory::getUser($value); + $entryName = $row->name; + $entryValue = $row->id; + } + if($scope == 'tags') + { + $db = JFactory::getDbo(); + $query = 'SELECT * FROM #__k2_tags WHERE name='.$db->Quote($value); + $db->setQuery($query); + $row = $db->loadObject(); + $entryName = $row->name; + $entryValue = htmlspecialchars($row->name, ENT_QUOTES, 'utf-8'); + } + + $output .= '
    • '.$entryName.'
    • '; + } + $output .= ' +
    + '; + } + + // Output for single entities + if($scope == 'item' || $scope == 'category' || $scope == 'user' || $scope == 'tag') + { + if(count($saved)) $value = $saved[0]; else $value = ''; + + if($scope == 'item') + { + if($value) + { + $row = JTable::getInstance('K2Item', 'Table'); + $row->load($value); + $entryName = $row->title; + $entryValue = $row->id; + } + $view = "items"; + } + if($scope == 'category') + { + if($value) + { + $row = JTable::getInstance('K2Category', 'Table'); + $row->load($value); + $entryName = $row->name; + $entryValue = $row->id; + } + $view = "categories"; + } + if($scope == 'user') + { + if($value) + { + $row = JFactory::getUser($value); + $entryName = $row->name; + $entryValue = $row->id; + } + $view = "users"; + } + if($scope == 'tag') + { + if($value) + { + $db = JFactory::getDbo(); + $query = 'SELECT * FROM #__k2_tags WHERE name='.$db->Quote($value); + $db->setQuery($query); + $row = $db->loadObject(); + $entryName = $row->name; + $entryValue = htmlspecialchars($row->name, ENT_QUOTES, 'utf-8'); + } + $view = "tags"; + } + + $output = ' + +
    + '; + + if($value) + { + $output .= ''.$entryName.''; + } + $output .= ' +
    + '; + + } + + return $output; + } +} + +class JFormFieldK2modalselector extends K2ElementK2modalselector +{ + var $type = 'k2modalselector'; +} + +class JElementK2modalselector extends K2ElementK2modalselector +{ + var $_name = 'k2modalselector'; +} diff --git a/deployed/k2/administrator/components/com_k2/elements/k2tag.php b/deployed/k2/administrator/components/com_k2/elements/k2tag.php new file mode 100644 index 00000000..61234a08 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/elements/k2tag.php @@ -0,0 +1,89 @@ +Quote($value); + $db->setQuery($query); + $tag = $db->loadObject(); + } + if (is_null($tag)) + { + $tag = new stdClass; + $tag->name = JText::_('K2_SELECT_A_TAG'); + } + // Move this to main JS file + $js = " + function jSelectTag(id, title, object) { + document.getElementById('".$name."' + '_id').value = id; + document.getElementById('".$name."' + '_name').value = title; + if(typeof(window.parent.SqueezeBox.close=='function')){ + window.parent.SqueezeBox.close(); + } + else { + document.getElementById('sbox-window').close(); + } + } + "; + $doc->addScriptDeclaration($js); + $link = 'index.php?option=com_k2&view=tags&task=element&tmpl=component&object='.$name; + JHTML::_('behavior.modal', 'a.modal'); + if (K2_JVERSION == '30') + { + $html = ' + + '.JText::_('K2_SELECT').' + + '; + } + else + { + $html = ' +
    + +
    + + + '; + } + return $html; + } + +} + +class JFormFieldK2Tag extends K2ElementK2Tag +{ + var $type = 'k2tag'; +} + +class JElementK2Tag extends K2ElementK2Tag +{ + var $_name = 'k2tag'; +} diff --git a/deployed/k2/administrator/components/com_k2/elements/k2tags.php b/deployed/k2/administrator/components/com_k2/elements/k2tags.php new file mode 100644 index 00000000..cd8c0421 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/elements/k2tags.php @@ -0,0 +1,78 @@ +addStyleSheet('https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css'); + $document->addScript('https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js'); + $document->addScriptDeclaration(' + $K2(document).ready(function() { + if(typeof($K2(".k2TagsElement").chosen) == "function") { + $K2(".k2TagsElement").chosen("destroy"); + } + $K2(".k2TagsElement").select2({ + width : "300px", + minimumInputLength : 2, + ajax: { + dataType : "json", + url: "'.JURI::root(true).'/administrator/index.php?option=com_k2&view=item&task=tags&id=1", + cache: "true", + data: function (params) { + var queryParameters = {q: params.term}; + return queryParameters; + }, + processResults: function (data) { + var results = []; + jQuery.each(data, function(index, value) { + var row = { + id : value.id, + text : value.name + }; + results.push(row); + }); + return {results: results}; + } + + } + }); + }); + '); + + $options = array(); + if(is_array($value) && count($value)) + { + $db = JFactory::getDbo(); + $query = "SELECT id AS value, name AS text FROM #__k2_tags WHERE id IN(".implode(',', $value).")"; + $db->setQuery($query); + $options = $db->loadObjectList(); + } + + return JHTML::_('select.genericlist', $options, $fieldName, 'class="k2TagsElement" multiple="multiple" size="15"', 'value', 'text', $value); + } +} + +class JFormFieldK2Tags extends K2ElementK2Tags +{ + var $type = 'k2tags'; +} + +class JElementK2Tags extends K2ElementK2Tags +{ + var $_name = 'k2tags'; +} diff --git a/deployed/k2/administrator/components/com_k2/elements/k2textarea.php b/deployed/k2/administrator/components/com_k2/elements/k2textarea.php new file mode 100644 index 00000000..ba03c7fb --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/elements/k2textarea.php @@ -0,0 +1,67 @@ +attributes()->chars) + { + $chars = $node->attributes()->chars; + } + if($node->attributes()->cols) + { + $cols = $node->attributes()->cols; + } + if($node->attributes()->rows) + { + $rows = $node->attributes()->rows; + } + } + else + { + $fieldName = $control_name.'['.$name.']'; + if($node->attributes('chars')){ + $chars = $node->attributes('chars'); + } + if($node->attributes('cols')){ + $cols = $node->attributes('cols'); + } + if($node->attributes('rows')){ + $rows = $node->attributes('rows'); + } + } + if(!$value) + { + $value = ''; + } + + // Output + return ''; + } +} + +class JFormFieldK2textarea extends K2ElementK2textarea +{ + var $type = 'k2textarea'; +} + +class JElementK2textarea extends K2ElementK2textarea +{ + var $_name = 'k2textarea'; +} diff --git a/deployed/k2/administrator/components/com_k2/elements/k2user.php b/deployed/k2/administrator/components/com_k2/elements/k2user.php new file mode 100644 index 00000000..80253a09 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/elements/k2user.php @@ -0,0 +1,84 @@ +name = JText::_('K2_SELECT_A_USER'); + } + // Move this to main JS file + $js = " + function jSelectUser(id, title, object) { + document.getElementById('".$name."' + '_id').value = id; + document.getElementById('".$name."' + '_name').value = title; + if(typeof(window.parent.SqueezeBox.close=='function')){ + window.parent.SqueezeBox.close(); + } + else { + document.getElementById('sbox-window').close(); + } + } + "; + $doc->addScriptDeclaration($js); + $link = 'index.php?option=com_k2&view=users&task=element&tmpl=component&object='.$name; + JHTML::_('behavior.modal', 'a.modal'); + if (K2_JVERSION == '30') + { + $html = ' + + '.JText::_('K2_SELECT').' + + '; + } + else + { + $html = ' +
    + +
    + + + '; + } + return $html; + } + +} + +class JFormFieldK2User extends K2ElementK2User +{ + var $type = 'k2user'; +} + +class JElementK2User extends K2ElementK2User +{ + var $_name = 'k2user'; +} diff --git a/deployed/k2/administrator/components/com_k2/elements/k2users.php b/deployed/k2/administrator/components/com_k2/elements/k2users.php new file mode 100644 index 00000000..0d786f72 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/elements/k2users.php @@ -0,0 +1,78 @@ +addStyleSheet('https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css'); + $document->addScript('https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js'); + $document->addScriptDeclaration(' + $K2(document).ready(function() { + if(typeof($K2(".k2UsersElement").chosen) == "function") { + $K2(".k2UsersElement").chosen("destroy"); + } + $K2(".k2UsersElement").select2({ + width : "300px", + minimumInputLength : 2, + ajax: { + dataType : "json", + url: "'.JURI::root(true).'/administrator/index.php?option=com_k2&view=users&task=search&format=raw", + cache: "true", + data: function (params) { + var queryParameters = {q: params.term}; + return queryParameters; + }, + processResults: function (data) { + var results = []; + jQuery.each(data, function(index, value) { + var row = { + id : value.id, + text : value.name + }; + results.push(row); + }); + return {results: results}; + } + + } + }); + }); + '); + + $options = array(); + if(is_array($value) && count($value)) + { + $db = JFactory::getDbo(); + $query = "SELECT id AS value, name AS text FROM #__users WHERE id IN(".implode(',', $value).")"; + $db->setQuery($query); + $options = $db->loadObjectList(); + } + + return JHTML::_('select.genericlist', $options, $fieldName, 'class="k2UsersElement" multiple="multiple" size="15"', 'value', 'text', $value); + } +} + +class JFormFieldK2Users extends K2ElementK2Users +{ + var $type = 'k2users'; +} + +class JElementK2Users extends K2ElementK2Users +{ + var $_name = 'k2users'; +} diff --git a/deployed/k2/administrator/components/com_k2/elements/menuitem.php b/deployed/k2/administrator/components/com_k2/elements/menuitem.php new file mode 100644 index 00000000..214be790 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/elements/menuitem.php @@ -0,0 +1,150 @@ +setQuery($query); + $menuTypes = $db->loadObjectList(); + + $where = ''; + if ($state = $node->attributes('state')) + { + $where .= ' AND published = '.(int)$state; + } + + // load the list of menu items + // TODO: move query to model + if (K2_JVERSION != '15') + { + $query = 'SELECT id, parent_id, title, menutype, type, published'.' FROM #__menu'.$where.' ORDER BY menutype, parent_id, ordering'; + } + else + { + $query = 'SELECT id, parent, name, menutype, type, published'.' FROM #__menu'.$where.' ORDER BY menutype, parent, ordering'; + + } + + $db->setQuery($query); + $menuItems = $db->loadObjectList(); + + // establish the hierarchy of the menu + // TODO: use node model + $children = array(); + + if ($menuItems) + { + // first pass - collect children + foreach ($menuItems as $v) + { + if (K2_JVERSION != '15') + { + $v->parent = $v->parent_id; + $v->name = $v->title; + } + $pt = $v->parent; + $list = @$children[$pt] ? $children[$pt] : array(); + array_push($list, $v); + $children[$pt] = $list; + } + } + + // second pass - get an indent list of the items + $list = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0); + + foreach ($list as $item) + { + $item->treename = JString::str_ireplace(' ', ' -', $item->treename); + $mitems[] = JHTML::_('select.option', $item->id, ' '.$item->treename); + } + + // assemble into menutype groups + $n = count($list); + $groupedList = array(); + foreach ($list as $k => $v) + { + $groupedList[$v->menutype][] = &$list[$k]; + } + + // assemble menu items to the array + $options = array(); + $options[] = JHTML::_('select.option', '', '- '.JText::_('K2_SELECT_MENU_ITEM').' -'); + + foreach ($menuTypes as $type) + { + if ($type != '') + { + $options[] = JHTML::_('select.option', '0', ' ', 'value', 'text', true); + $options[] = JHTML::_('select.option', $type->menutype, $type->title.' - '.JText::_('K2_TOP'), 'value', 'text', true); + } + if (isset($groupedList[$type->menutype])) + { + $n = count($groupedList[$type->menutype]); + for ($i = 0; $i < $n; $i++) + { + $item = &$groupedList[$type->menutype][$i]; + + //If menutype is changed but item is not saved yet, use the new type in the list + if (JRequest::getString('option', '', 'get') == 'com_menus') + { + $currentItemArray = JRequest::getVar('cid', array(0), '', 'array'); + $currentItemId = (int)$currentItemArray[0]; + $currentItemType = JRequest::getString('type', $item->type, 'get'); + if ($currentItemId == $item->id && $currentItemType != $item->type) + { + $item->type = $currentItemType; + } + } + + $disable = @strpos($node->attributes('disable'), $item->type) !== false ? true : false; + + if ($item->published == 0) + $item->treename .= ' [**'.JText::_('K2_UNPUBLISHED').'**]'; + if ($item->published == -2) + $item->treename .= ' [**'.JText::_('K2_TRASHED').'**]'; + + $options[] = JHTML::_('select.option', $item->id, $item->treename, 'value', 'text', $disable); + + } + } + } + + if (K2_JVERSION != '15') + { + $fieldName = $name; + } + else + { + $fieldName = $control_name.'['.$name.']'; + } + + return JHTML::_('select.genericlist', $options, $fieldName, 'class="inputbox"', 'value', 'text', $value, $control_name.$name); + } +} + +class JFormFieldMenuItem extends K2ElementMenuItem +{ + var $type = 'MenuItem'; +} + +class JElementMenuItem extends K2ElementMenuItem +{ + var $_name = 'MenuItem'; +} diff --git a/deployed/k2/administrator/components/com_k2/elements/menus.php b/deployed/k2/administrator/components/com_k2/elements/menus.php new file mode 100644 index 00000000..30872d78 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/elements/menus.php @@ -0,0 +1,42 @@ +setQuery($query); + $menus = $db->loadObjectList(); + $options = array(); + $options[] = JHTML::_('select.option', '', JText::_('K2_NONE_ONSELECTLISTS')); + foreach ($menus as $menu) + { + $options[] = JHTML::_('select.option', $menu->menutype, $menu->title); + } + return JHTML::_('select.genericlist', $options, $fieldName, 'class="inputbox"', 'value', 'text', $value); + } +} + +class JFormFieldMenus extends K2ElementMenus +{ + var $type = 'menus'; +} + +class JElementMenus extends K2ElementMenus +{ + var $_name = 'menus'; +} diff --git a/deployed/k2/administrator/components/com_k2/elements/moduletemplate.php b/deployed/k2/administrator/components/com_k2/elements/moduletemplate.php new file mode 100644 index 00000000..8a79ad03 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/elements/moduletemplate.php @@ -0,0 +1,90 @@ +attributes()->modulename; + } + else + { + $moduleName = $node->_attributes['modulename']; + } + $moduleTemplatesPath = JPATH_SITE.'/modules/'.$moduleName.'/tmpl'; + $moduleTemplatesFolders = JFolder::folders($moduleTemplatesPath); + + $db = JFactory::getDbo(); + if (K2_JVERSION != '15') + { + $query = "SELECT template FROM #__template_styles WHERE client_id = 0 AND home = 1"; + } + else + { + $query = "SELECT template FROM #__templates_menu WHERE client_id = 0 AND menuid = 0"; + } + $db->setQuery($query); + $defaultemplate = $db->loadResult(); + $templatePath = JPATH_SITE.'/templates/'.$defaultemplate.'/html/'.$moduleName; + + if (JFolder::exists($templatePath)) + { + $templateFolders = JFolder::folders($templatePath); + $folders = @array_merge($templateFolders, $moduleTemplatesFolders); + $folders = @array_unique($folders); + } + else + { + $folders = $moduleTemplatesFolders; + } + + $exclude = 'Default'; + $options = array(); + + foreach ($folders as $folder) + { + if (preg_match(chr(1).$exclude.chr(1), $folder)) + { + continue; + } + $options[] = JHTML::_('select.option', $folder, $folder); + } + + array_unshift($options, JHTML::_('select.option', 'Default', '-- '.JText::_('K2_USE_DEFAULT').' --')); + + if (K2_JVERSION != '15') + { + $fieldName = $name; + } + else + { + $fieldName = $control_name.'['.$name.']'; + } + + return JHTML::_('select.genericlist', $options, $fieldName, 'class="inputbox"', 'value', 'text', $value, $control_name.$name); + } +} + +class JFormFieldModuleTemplate extends K2ElementModuleTemplate +{ + var $type = 'moduletemplate'; +} + +class JElementModuleTemplate extends K2ElementModuleTemplate +{ + var $_name = 'moduletemplate'; +} diff --git a/deployed/k2/administrator/components/com_k2/elements/template.php b/deployed/k2/administrator/components/com_k2/elements/template.php new file mode 100644 index 00000000..c16b26a7 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/elements/template.php @@ -0,0 +1,81 @@ +setQuery($query); + $defaultemplate = $db->loadResult(); + + if (JFolder::exists(JPATH_SITE.'/templates/'.$defaultemplate.'/html/com_k2/templates')) + { + $templatePath = JPATH_SITE.'/templates/'.$defaultemplate.'/html/com_k2/templates'; + } + else + { + $templatePath = JPATH_SITE.'/templates/'.$defaultemplate.'/html/com_k2'; + } + + if (JFolder::exists($templatePath)) + { + $templateFolders = JFolder::folders($templatePath); + $folders = @array_merge($templateFolders, $componentFolders); + $folders = @array_unique($folders); + } + else + { + $folders = $componentFolders; + } + + $exclude = 'default'; + $options = array(); + foreach ($folders as $folder) + { + if (preg_match(chr(1).$exclude.chr(1), $folder)) + { + continue; + } + $options[] = JHTML::_('select.option', $folder, $folder); + } + + array_unshift($options, JHTML::_('select.option', '', '-- '.JText::_('K2_USE_DEFAULT').' --')); + + return JHTML::_('select.genericlist', $options, $fieldName, 'class="inputbox"', 'value', 'text', $value, $control_name.$name); + } +} + +class JFormFieldTemplate extends K2ElementTemplate +{ + var $type = 'template'; +} + +class JElementTemplate extends K2ElementTemplate +{ + var $_name = 'template'; +} diff --git a/deployed/k2/administrator/components/com_k2/elements/user.php b/deployed/k2/administrator/components/com_k2/elements/user.php new file mode 100644 index 00000000..29c601ff --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/elements/user.php @@ -0,0 +1,84 @@ +name = JText::_('K2_SELECT_A_USER'); + } + // Move this to main JS file + $js = " + function jSelectUser(id, title, object) { + document.getElementById('".$name."' + '_id').value = id; + document.getElementById('".$name."' + '_name').value = title; + if(typeof(window.parent.SqueezeBox.close=='function')){ + window.parent.SqueezeBox.close(); + } + else { + document.getElementById('sbox-window').close(); + } + } + "; + $doc->addScriptDeclaration($js); + $link = 'index.php?option=com_k2&view=users&task=element&tmpl=component&object='.$name; + JHTML::_('behavior.modal', 'a.modal'); + if (K2_JVERSION == '30') + { + $html = ' + + '.JText::_('K2_SELECT').' + + '; + } + else + { + $html = ' +
    + +
    + + + '; + } + return $html; + } + +} + +class JFormFieldUser extends K2ElementUser +{ + var $type = 'k2user'; +} + +class JElementHeader extends K2ElementUser +{ + var $_name = 'k2user'; +} diff --git a/deployed/k2/administrator/components/com_k2/elements/users.php b/deployed/k2/administrator/components/com_k2/elements/users.php new file mode 100644 index 00000000..f8fb0e90 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/elements/users.php @@ -0,0 +1,121 @@ +attributes('multiple')) + { + $fieldName .= '[]'; + } + $image = JURI::root(true).'/administrator/templates/'.$mainframe->getTemplate().'/images/admin/publish_x.png'; + } + else + { + $fieldName = $control_name.'['.$name.'][]'; + $image = JURI::root(true).'/administrator/images/publish_x.png'; + } + + $js = " + function jSelectUser(id, title, object) { + var exists = false; + \$K2('#usersList input').each(function(){ + if(\$K2(this).val()==id){ + alert('".JText::_('K2_THE_SELECTED_USER_IS_ALREADY_IN_THE_LIST', true)."'); + exists = true; + } + }); + if(!exists){ + var container = \$K2('
  • ').appendTo(\$K2('#usersList')); + var img = \$K2('',{'class':'remove', src:'".$image."'}).appendTo(container); + img.click(function(){\$K2(this).parent().remove();}); + var span = \$K2('',{'class':'handle'}).html(title).appendTo(container); + var input = \$K2('',{value:id, type:'hidden', name:'".$fieldName."'}).appendTo(container); + var div = \$K2('
    ',{style:'clear:both;'}).appendTo(container); + \$K2('#usersList').sortable('refresh'); + alert('".JText::_('K2_USER_ADDED_IN_THE_LIST', true)."'); + } + } + + \$K2(document).ready(function(){ + \$K2('#usersList').sortable({ + containment: '#usersList', + items: 'li', + handle: 'span.handle' + }); + \$K2('#usersList .remove').click(function(){ + \$K2(this).parent().remove(); + }); + }); + "; + + $document->addScriptDeclaration($js); + $document->addStyleSheet(JURI::root(true).'/media/k2/assets/css/k2.modules.css?v=2.7.1'); + + $current = array(); + if (is_string($value) && !empty($value)) + { + $current[] = $value; + } + if (is_array($value)) + { + $current = $value; + } + + $output = '
      '; + foreach ($current as $id) + { + $row = JFactory::getUser($id); + $output .= ' +
    • + '.JText::_('K2_REMOVE_ENTRY_FROM_LIST').' + '.$row->name.' + +
      +
    • + '; + } + $output .= '
    '; + return $output; + } + +} + +class JFormFieldUsers extends K2ElementUsers +{ + var $type = 'users'; +} + +class JElementUsers extends K2ElementUsers +{ + var $_name = 'users'; +} diff --git a/deployed/k2/administrator/components/com_k2/elements/userslatest.php b/deployed/k2/administrator/components/com_k2/elements/userslatest.php new file mode 100644 index 00000000..5b5d7ed5 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/elements/userslatest.php @@ -0,0 +1,132 @@ +attributes('multiple')) + { + $fieldName .= '[]'; + } + $image = JURI::root(true).'/administrator/templates/'.$mainframe->getTemplate().'/images/admin/publish_x.png'; + } + else + { + $fieldName = $control_name.'['.$name.'][]'; + $image = JURI::root(true).'/administrator/images/publish_x.png'; + } + + $js = " + function jSelectUser(id, title, object) { + var exists = false; + \$K2('#usersList input').each(function(){ + if(\$K2(this).val()==id){ + alert('".JText::_('K2_THE_SELECTED_USER_IS_ALREADY_IN_THE_LIST', true)."'); + exists = true; + } + }); + if(!exists){ + var container = \$K2('
  • ').appendTo(\$K2('#usersList')); + var img = \$K2('',{'class':'remove', src:'".$image."'}).appendTo(container); + img.click(function(){\$K2(this).parent().remove();}); + var span = \$K2('',{'class':'handle'}).html(title).appendTo(container); + var input = \$K2('',{value:id, type:'hidden', name:'".$fieldName."'}).appendTo(container); + var div = \$K2('
    ',{style:'clear:both;'}).appendTo(container); + \$K2('#usersList').sortable('refresh'); + alert('".JText::_('K2_USER_ADDED_IN_THE_LIST', true)."'); + } + } + + \$K2(document).ready(function(){ + \$K2('#usersList').sortable({ + containment: '#usersList', + items: 'li', + handle: 'span.handle' + }); + \$K2('#usersList .remove').click(function(){ + \$K2(this).parent().remove(); + }); + }); + "; + + $document->addScriptDeclaration($js); + $document->addStyleSheet(JURI::root(true).'/media/k2/assets/css/k2.modules.css?v=2.7.1'); + + $current = array(); + if (is_string($value) && !empty($value)) + { + $current[] = $value; + } + if (is_array($value)) + { + $current = $value; + } + + $output = ' + +
    + '; + + $output .= '
      '; + foreach ($current as $id) + { + $row = JFactory::getUser($id); + $output .= ' +
    • + '.JText::_('K2_REMOVE_ENTRY_FROM_LIST').' + '.$row->name.' + + +
    • + '; + } + $output .= '
    '; + return $output; + } + +} + +class JFormFieldUsersLatest extends K2ElementUsersLatest +{ + var $type = 'userslatest'; +} + +class JElementUsersLatest extends K2ElementUsersLatest +{ + var $_name = 'userslatest'; +} diff --git a/deployed/k2/administrator/components/com_k2/helpers/html.php b/deployed/k2/administrator/components/com_k2/helpers/html.php new file mode 100644 index 00000000..40020c78 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/helpers/html.php @@ -0,0 +1,315 @@ +get('lockTags') || $user->gid > 23) + { + JSubMenuHelper::addEntry(JText::_('K2_TAGS'), 'index.php?option=com_k2&view=tags', $view == 'tags'); + } + JSubMenuHelper::addEntry(JText::_('K2_COMMENTS'), 'index.php?option=com_k2&view=comments', $view == 'comments'); + if ($user->gid > 23) + { + JSubMenuHelper::addEntry(JText::_('K2_USERS'), 'index.php?option=com_k2&view=users', $view == 'users'); + JSubMenuHelper::addEntry(JText::_('K2_USER_GROUPS'), 'index.php?option=com_k2&view=usergroups', $view == 'usergroups'); + JSubMenuHelper::addEntry(JText::_('K2_EXTRA_FIELDS'), 'index.php?option=com_k2&view=extrafields', $view == 'extrafields'); + JSubMenuHelper::addEntry(JText::_('K2_EXTRA_FIELD_GROUPS'), 'index.php?option=com_k2&view=extrafieldsgroups', $view == 'extrafieldsgroups'); + } + JSubMenuHelper::addEntry(JText::_('K2_MEDIA_MANAGER'), 'index.php?option=com_k2&view=media', $view == 'media'); + JSubMenuHelper::addEntry(JText::_('K2_INFORMATION'), 'index.php?option=com_k2&view=info', $view == 'info'); + } + + public static function stateToggler(&$row, $key, $property = 'published', $tasks = array('publish', 'unpublish'), $labels = array('K2_PUBLISH', 'K2_UNPUBLISH')) + { + $task = $row->$property ? $tasks[1] : $tasks[0]; + $action = $row->$property ? JText::_($labels[1]) : JText::_($labels[0]); + $class = 'k2Toggler'; + $status = $row->$property ? 'k2Active' : 'k2Inactive'; + $href = ''.$action.''; + return $href; + } + + public static function loadHeadIncludes($loadFramework = false, $jQueryUI = false, $adminHeadIncludes = false, $adminModuleIncludes = false) + { + $application = JFactory::getApplication(); + $document = JFactory::getDocument(); + $user = JFactory::getUser(); + + $params = K2HelperUtilities::getParams('com_k2'); + + $option = JRequest::getCmd('option'); + $view = strtolower(JRequest::getWord('view', 'items')); + $task = JRequest::getCmd('task'); + + $jQueryHandling = $params->get('jQueryHandling', '1.9.1'); + + if ($document->getType() == 'html') + { + + if ($loadFramework && $view != 'media') + { + if (version_compare(JVERSION, '1.6.0', 'ge')) + { + JHtml::_('behavior.framework'); + } + else + { + JHTML::_('behavior.mootools'); + } + } + + if (version_compare(JVERSION, '3.0.0', 'ge')) + { + if ($application->isAdmin() || ($application->isSite() && $params->get('jQueryHandling'))) + { + JHtml::_('jquery.framework'); + } + } + + // jQuery + if (version_compare(JVERSION, '3.0.0', 'lt')) + { + // Frontend + if ($application->isSite()) + { + // B/C for saved old options + if ($jQueryHandling == '1.7remote') $jQueryHandling = '1.7.2'; + if ($jQueryHandling == '1.8remote') $jQueryHandling = '1.8.3'; + if ($jQueryHandling == '1.9remote') $jQueryHandling = '1.9.1'; + if ($jQueryHandling == '1.10remote') $jQueryHandling = '1.10.2'; + if ($jQueryHandling == '1.11remote') $jQueryHandling = '1.11.3'; + if ($jQueryHandling == '1.12remote') $jQueryHandling = '1.12.4'; + $document->addScript('https://cdnjs.cloudflare.com/ajax/libs/jquery/'.$jQueryHandling.'/jquery.min.js'); + } + + // Backend + if ($application->isAdmin()) + { + if (($option == 'com_k2' && ($view == 'item' || $view == 'category')) || $option == 'com_menus') + { + $document->addScript('https://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js'); + } + else + { + $document->addScript('https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js'); + } + } + } + + // jQueryUI + if ($jQueryUI) + { + // Load version 1.8.24 for tabs & sortables (called the "old" way)... + if (($option == 'com_k2' && ($view == 'item' || $view == 'category')) || $option == 'com_menus') + { + $document->addScript('https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.8.24/jquery-ui.min.js'); + } + + // Load latest version for the "media" view & modules only + if (($option == 'com_k2' && $view == 'media') || $option == 'com_modules' || $option == 'com_advancedmodules') + { + $document->addStyleSheet('https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.min.css'); + $document->addScript('https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js'); + } + } + + // Everything else... + if ($application->isAdmin() || $adminHeadIncludes) + { + // JS + $isBackend = ($application->isAdmin()) ? ' k2IsBackend' : ''; + $isTask = ($task) ? ' k2TaskIs'.ucfirst($task) : ''; + $cssClass = 'isJ'.K2_JVERSION.' k2ViewIs'.ucfirst($view).''.$isTask.''.$isBackend; + $document->addScriptDeclaration(" + + // Set K2 version as global JS variable + K2JVersion = '".K2_JVERSION."'; + + // Set Joomla version as class in the 'html' tag + (function(){ + var addedClass = '".$cssClass."'; + if (document.getElementsByTagName('html')[0].className !== '') { + document.getElementsByTagName('html')[0].className += ' '+addedClass; + } else { + document.getElementsByTagName('html')[0].className = addedClass; + } + })(); + + // K2 Language Strings + var K2_THE_ENTRY_IS_ALREADY_IN_THE_LIST = '".JText::_('K2_THE_ENTRY_IS_ALREADY_IN_THE_LIST')."'; + var K2_REMOVE_THIS_ENTRY = '".JText::_('K2_REMOVE_THIS_ENTRY')."'; + var K2_THE_ENTRY_WAS_ADDED_IN_THE_LIST = '".JText::_('K2_THE_ENTRY_WAS_ADDED_IN_THE_LIST')."'; + + "); + $document->addScript(JURI::root(true).'/media/k2/assets/js/k2.backend.js?v='.K2_CURRENT_VERSION.'&sitepath='.JURI::root(true).'/'); + + // NicEdit + if ($option == 'com_k2' && $view == 'item') + { + $document->addScript(JURI::root(true).'/media/k2/assets/vendors/bkirchoff/nicedit/nicEdit.js?v='.K2_CURRENT_VERSION); + } + + // Media (elFinder) + if ($view == 'media') + { + $document->addStyleSheet(JURI::root(true).'/media/k2/assets/vendors/studio-42/elfinder/css/elfinder.min.css?v='.K2_CURRENT_VERSION); + $document->addStyleSheet(JURI::root(true).'/media/k2/assets/vendors/studio-42/elfinder/css/theme.css?v='.K2_CURRENT_VERSION); + $document->addScript(JURI::root(true).'/media/k2/assets/vendors/studio-42/elfinder/js/elfinder.min.js?v='.K2_CURRENT_VERSION); + } + else + { + JHTML::_('behavior.tooltip'); + if (version_compare(JVERSION, '3.0.0', 'ge')) + { + if ($view == 'item' && !$params->get('taggingSystem')) + { + JHtml::_('formbehavior.chosen', 'select:not(#selectedTags, #tags)'); + } + else + { + JHtml::_('formbehavior.chosen', 'select'); + } + } + } + + // Flatpickr + if ($view == 'item' || $view == 'extrafield') + { + $document->addStyleSheet('https://cdnjs.cloudflare.com/ajax/libs/flatpickr/2.6.3/flatpickr.min.css'); + $document->addScript('https://cdnjs.cloudflare.com/ajax/libs/flatpickr/2.6.3/flatpickr.min.js'); + $document->addCustomTag(''); + } + + // Magnific Popup + $document->addStyleSheet('https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.min.css'); + $document->addStyleDeclaration(' + /* K2 - Magnific Popup Overrides */ + .mfp-iframe-holder {padding:10px;} + .mfp-iframe-holder .mfp-content {max-width:100%;width:100%;height:100%;} + .mfp-iframe-scaler iframe {background:#fff;padding:10px;box-sizing:border-box;box-shadow:none;} + '); + $document->addScript('https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.min.js'); + + // Fancybox + if ($view == 'item' || $view == 'items' || $view == 'categories') + { + $document->addStyleSheet('https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.1.20/jquery.fancybox.min.css'); + $document->addScript('https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.1.20/jquery.fancybox.min.js'); + } + + // CSS + if ($option == 'com_k2' || $adminModuleIncludes) + { + $document->addStyleSheet('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css'); + } + if ($option == 'com_k2') + { + $document->addStyleSheet(JURI::root(true).'/media/k2/assets/css/k2.backend.css?v='.K2_CURRENT_VERSION); + } + if($adminModuleIncludes) + { + $document->addStyleSheet(JURI::root(true).'/media/k2/assets/css/k2.global.css?v='.K2_CURRENT_VERSION); + } + } + + // Frontend only + if($application->isSite()) + { + // Magnific Popup + if (!$user->guest || ($option == 'com_k2' && $view == 'item') || defined('K2_JOOMLA_MODAL_REQUIRED')){ + $document->addStyleSheet('https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.min.css'); + $document->addStyleDeclaration(' + /* K2 - Magnific Popup Overrides */ + .mfp-iframe-holder {padding:10px;} + .mfp-iframe-holder .mfp-content {max-width:100%;width:100%;height:100%;} + .mfp-iframe-scaler iframe {background:#fff;padding:10px;box-sizing:border-box;box-shadow:none;} + '); + $document->addScript('https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.min.js'); + } + + // JS + $document->addScript(JURI::root(true).'/media/k2/assets/js/k2.frontend.js?v='.K2_CURRENT_VERSION.'&sitepath='.JURI::root(true).'/'); + + // Google Search (deprecated - to remove) + if ($task == 'search' && $params->get('googleSearch')) + { + $language = JFactory::getLanguage(); + $lang = $language->getTag(); + // Fallback to the new container ID without breaking things + $googleSearchContainerID = trim($params->get('googleSearchContainer', 'k2GoogleSearchContainer')); + if($googleSearchContainerID == 'k2Container'){ + $googleSearchContainerID = 'k2GoogleSearchContainer'; + } + $document->addScript('https://www.google.com/jsapi'); + $document->addScriptDeclaration(' + google.load("search", "1", {"language" : "'.$lang.'"}); + function OnLoad(){ + var searchControl = new google.search.SearchControl(); + var siteSearch = new google.search.WebSearch(); + siteSearch.setUserDefinedLabel("'.$application->getCfg('sitename').'"); + siteSearch.setUserDefinedClassSuffix("k2"); + options = new google.search.SearcherOptions(); + options.setExpandMode(google.search.SearchControl.EXPAND_MODE_OPEN); + siteSearch.setSiteRestriction("'.JURI::root().'"); + searchControl.addSearcher(siteSearch, options); + searchControl.setResultSetSize(google.search.Search.LARGE_RESULTSET); + searchControl.setLinkTarget(google.search.Search.LINK_TARGET_SELF); + searchControl.draw(document.getElementById("'.$googleSearchContainerID.'")); + searchControl.execute("'.JRequest::getString('searchword').'"); + } + google.setOnLoadCallback(OnLoad); + '); + } + + // Add related CSS to the + if ($params->get('enable_css')) + { + jimport('joomla.filesystem.file'); + + // Simple Line Icons + $document->addStyleSheet('https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.4.1/css/simple-line-icons.min.css'); + + // k2.css + if (JFile::exists(JPATH_SITE.'/templates/'.$application->getTemplate().'/css/k2.css')) + { + $document->addStyleSheet(JURI::root(true).'/templates/'.$application->getTemplate().'/css/k2.css?v='.K2_CURRENT_VERSION); + } + else + { + $document->addStyleSheet(JURI::root(true).'/components/com_k2/css/k2.css?v='.K2_CURRENT_VERSION); + } + + // k2.print.css + if (JRequest::getInt('print') == 1) + { + if (JFile::exists(JPATH_SITE.'/templates/'.$application->getTemplate().'/css/k2.print.css')) + { + $document->addStyleSheet(JURI::root(true).'/templates/'.$application->getTemplate().'/css/k2.print.css?v='.K2_CURRENT_VERSION, 'text/css', 'print'); + } + else + { + $document->addStyleSheet(JURI::root(true).'/components/com_k2/css/k2.print.css?v='.K2_CURRENT_VERSION, 'text/css', 'print'); + } + } + } + } + } + } +} diff --git a/deployed/k2/administrator/components/com_k2/helpers/stats.php b/deployed/k2/administrator/components/com_k2/helpers/stats.php new file mode 100644 index 00000000..2ff4914f --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/helpers/stats.php @@ -0,0 +1,172 @@ +addScript('https://cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.4/jquery.xdomainrequest.min.js'); + $document->addScriptDeclaration(" + /* K2 - Metrics */ + (function(\$){ + function K2LogResult(xhr) { + \$.ajax({ + type: 'POST', + url: 'index.php', + data: { + 'option': 'com_k2', + 'view': 'items', + 'task': 'logStats', + '".$token."': '1', + 'status': xhr.status, + 'response': xhr.responseText + } + }); + } + \$(document).ready(function(){ + \$.ajax({ + crossDomain: true, + type: 'POST', + url: 'https://metrics.getk2.org/gather.php', + data: ".$data." + }).done(function(response, result, xhr) { + K2LogResult(xhr); + }).fail(function(xhr, result, response) { + K2LogResult(xhr); + }); + }); + })(jQuery); + "); + } + + public static function getData() + { + $data = new stdClass; + $data->identifier = self::getIdentifier(); + $data->php = self::getPhpVersion(); + $data->databaseType = self::getDbType(); + $data->databaseVersion = self::getDbVersion(); + $data->server = self::getServer(); + $data->serverInterface = self::getServerInterface(); + $data->cms = self::getCmsVersion(); + $data->extensionName = 'K2'; + $data->extensionVersion = self::getExtensionVersion(); + $data->caching = self::getCaching(); + $data->cachingDriver = self::getCachingDriver(); + return json_encode($data); + } + + public static function getIdentifier() + { + $configuration = JFactory::getConfig(); + $secret = version_compare(JVERSION, '2.5', 'ge') ? $configuration->get('secret') : $configuration->getValue('config.secret'); + return md5($secret.$_SERVER['SERVER_ADDR']); + } + + public static function getPhpVersion() + { + return phpversion(); + } + + public static function getDbType() + { + $configuration = JFactory::getConfig(); + $type = version_compare(JVERSION, '2.5', 'ge') ? $configuration->get('dbtype') : $configuration->getValue('config.dbtype'); + if($type == 'mysql' || $type == 'mysqli' || $type == 'pdomysql') + { + $db = JFactory::getDbo(); + $query = 'SELECT version();'; + $db->setQuery($query); + $result = $db->loadResult(); + $result = strtolower($result); + if(strpos($result, 'mariadb') !== false) + { + $type = 'mariadb'; + } + } + return $type; + } + + public static function getDbVersion() + { + $db = JFactory::getDbo(); + return $db->getVersion(); + } + + public static function getServer() + { + return isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : getenv('SERVER_SOFTWARE'); + } + + public static function getServerInterface() + { + return php_sapi_name(); + } + + public static function getCmsVersion() + { + return JVERSION; + } + + public static function getExtensionVersion() + { + return K2_CURRENT_VERSION; + } + + public static function getCaching() + { + $configuration = JFactory::getConfig(); + return version_compare(JVERSION, '2.5', 'ge') ? $configuration->get('caching') : $configuration->getValue('config.caching'); + } + + public static function getCachingDriver() + { + $configuration = JFactory::getConfig(); + return version_compare(JVERSION, '2.5', 'ge') ? $configuration->get('cache_handler') : $configuration->getValue('config.cache_handler'); + } + + public static function shouldLog() + { + $db = JFactory::getDbo(); + $query = 'SELECT * FROM #__k2_log'; + $db->setQuery($query, 0, 1); + $result = $db->loadObject(); + if (!$result) + { + return true; + } + $now = JFactory::getDate()->toUnix(); + $days = floor(($now - strtotime($result->timestamp)) / (60 * 60 * 24)); + if ($days >= 30 || $result->status != 200) + { + return true; + } + return false; + } +} diff --git a/deployed/k2/administrator/components/com_k2/install.mysql.sql b/deployed/k2/administrator/components/com_k2/install.mysql.sql new file mode 100644 index 00000000..eb3719ad --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/install.mysql.sql @@ -0,0 +1,187 @@ +CREATE TABLE IF NOT EXISTS `#__k2_attachments` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `itemID` int(11) NOT NULL, + `filename` varchar(255) NOT NULL, + `title` varchar(255) NOT NULL, + `titleAttribute` text NOT NULL, + `hits` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `hits` (`hits`), + KEY `itemID` (`itemID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `#__k2_categories` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `alias` varchar(255) NOT NULL, + `description` text NOT NULL, + `parent` int(11) DEFAULT '0', + `extraFieldsGroup` int(11) NOT NULL, + `published` smallint(6) NOT NULL DEFAULT '0', + `access` int(11) NOT NULL DEFAULT '0', + `ordering` int(11) NOT NULL DEFAULT '0', + `image` varchar(255) NOT NULL, + `params` text NOT NULL, + `trash` smallint(6) NOT NULL DEFAULT '0', + `plugins` text NOT NULL, + `language` char(7) NOT NULL, + PRIMARY KEY (`id`), + KEY `access` (`access`), + KEY `category` (`published`,`access`,`trash`), + KEY `language` (`language`), + KEY `ordering` (`ordering`), + KEY `parent` (`parent`), + KEY `published` (`published`), + KEY `trash` (`trash`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `#__k2_comments` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `itemID` int(11) NOT NULL, + `userID` int(11) NOT NULL, + `userName` varchar(255) NOT NULL, + `commentDate` datetime NOT NULL, + `commentText` text NOT NULL, + `commentEmail` varchar(255) NOT NULL, + `commentURL` varchar(255) NOT NULL, + `published` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `commentDate` (`commentDate`), + KEY `countComments` (`itemID`,`published`), + KEY `itemID` (`itemID`), + KEY `latestComments` (`published`,`commentDate`), + KEY `published` (`published`), + KEY `userID` (`userID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `#__k2_extra_fields` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `value` text NOT NULL, + `type` varchar(255) NOT NULL, + `group` int(11) NOT NULL, + `published` tinyint(4) NOT NULL, + `ordering` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `group` (`group`), + KEY `published` (`published`), + KEY `ordering` (`ordering`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `#__k2_extra_fields_groups` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `#__k2_items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(255) NOT NULL, + `alias` varchar(255) DEFAULT NULL, + `catid` int(11) NOT NULL, + `published` smallint(6) NOT NULL DEFAULT '0', + `introtext` mediumtext NOT NULL, + `fulltext` mediumtext NOT NULL, + `video` text, + `gallery` varchar(255) DEFAULT NULL, + `extra_fields` text CHARACTER SET utf8 COLLATE utf8_unicode_ci, + `extra_fields_search` text NOT NULL, + `created` datetime NOT NULL, + `created_by` int(11) NOT NULL DEFAULT '0', + `created_by_alias` varchar(255) NOT NULL, + `checked_out` int(10) unsigned NOT NULL, + `checked_out_time` datetime NOT NULL, + `modified` datetime NOT NULL, + `modified_by` int(11) NOT NULL DEFAULT '0', + `publish_up` datetime NOT NULL, + `publish_down` datetime NOT NULL, + `trash` smallint(6) NOT NULL DEFAULT '0', + `access` int(11) NOT NULL DEFAULT '0', + `ordering` int(11) NOT NULL DEFAULT '0', + `featured` smallint(6) NOT NULL DEFAULT '0', + `featured_ordering` int(11) NOT NULL DEFAULT '0', + `image_caption` text NOT NULL, + `image_credits` varchar(255) NOT NULL, + `video_caption` text NOT NULL, + `video_credits` varchar(255) NOT NULL, + `hits` int(10) unsigned NOT NULL, + `params` text NOT NULL, + `metadesc` text NOT NULL, + `metadata` text NOT NULL, + `metakey` text NOT NULL, + `plugins` text NOT NULL, + `language` char(7) NOT NULL, + PRIMARY KEY (`id`), + KEY `access` (`access`), + KEY `catid` (`catid`), + KEY `created_by` (`created_by`), + KEY `created` (`created`), + KEY `featured_ordering` (`featured_ordering`), + KEY `featured` (`featured`), + KEY `hits` (`hits`), + KEY `item` (`published`,`publish_up`,`publish_down`,`trash`,`access`), + KEY `language` (`language`), + KEY `ordering` (`ordering`), + KEY `published` (`published`), + KEY `publish_down` (`publish_down`), + KEY `publish_up` (`publish_up`), + KEY `trash` (`trash`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `#__k2_rating` ( + `itemID` int(11) NOT NULL DEFAULT '0', + `rating_sum` int(11) unsigned NOT NULL DEFAULT '0', + `rating_count` int(11) unsigned NOT NULL DEFAULT '0', + `lastip` varchar(50) NOT NULL DEFAULT '', + PRIMARY KEY (`itemID`), + KEY `rating_sum` (`rating_sum`), + KEY `rating_count` (`rating_count`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `#__k2_tags` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `published` smallint(6) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `published` (`published`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `#__k2_tags_xref` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `tagID` int(11) NOT NULL, + `itemID` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `tagID` (`tagID`), + KEY `itemID` (`itemID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `#__k2_users` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `userID` int(11) NOT NULL, + `userName` varchar(255) DEFAULT NULL, + `gender` enum('m','f') NOT NULL DEFAULT 'm', + `description` text NOT NULL, + `image` varchar(255) DEFAULT NULL, + `url` varchar(255) DEFAULT NULL, + `group` int(11) NOT NULL DEFAULT '0', + `plugins` text NOT NULL, + `ip` varchar(15) NOT NULL, + `hostname` varchar(255) NOT NULL, + `notes` text NOT NULL, + PRIMARY KEY (`id`), + KEY `userID` (`userID`), + KEY `group` (`group`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `#__k2_user_groups` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `permissions` text NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `#__k2_log` ( + `status` int(11) NOT NULL, + `response` text NOT NULL, + `timestamp` datetime NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/deployed/k2/administrator/components/com_k2/jupgrade/j16upgrade.php b/deployed/k2/administrator/components/com_k2/jupgrade/j16upgrade.php new file mode 100644 index 00000000..6e889827 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/jupgrade/j16upgrade.php @@ -0,0 +1,93 @@ + + * + * + * administrator/components/com_k2/jupgrade/j16upgrade.php + * jUpgradeComponentK2 + * + * + * For more information, see ./j16upgrade.xml + */ +class jUpgradeComponentK2 extends jUpgrade +{ + /** + * Check if K2 migration is supported. + */ + protected function detectExtension() + { + return true; + } + + /** + * Migrate custom information. + * + * This function gets called after all folders and tables have been copied. + * + * If you want to split this task into smaller chunks, + * please store your custom state variables into $this->state and return false. + * Returning false will force jUpgrade to call this function again, + * which allows you to continue import by reading $this->state before continuing. + * + * @return boolean Ready (true/false) + * @since 1.6.4 + * @throws Exception + */ + protected function migrateExtensionCustom() + { + return true; + } + + protected function copyTable_k2_categories($table) + { + $this->source = $this->destination = "#__{$table}"; + + // Clone table + $this->cloneTable($this->source, $this->destination); + + // Get data + $rows = parent::getSourceData('*'); + + // Do some custom post processing on the list. + foreach ($rows as &$row) { + $row['access'] = $row['access'] == 0 ? 1 : $row['access'] + 1; + $row['params'] = $this->convertParams($row['params']); + } + $this->setDestinationData($rows); + return true; + } + + protected function copyTable_k2_items($table) + { + $this->source = $this->destination = "#__{$table}"; + + // Clone table + $this->cloneTable($this->source, $this->destination); + + // Get data + $rows = parent::getSourceData('*'); + + // Do some custom post processing on the list. + foreach ($rows as &$row) { + $row['access'] = $row['access'] == 0 ? 1 : $row['access'] + 1; + $row['params'] = $this->convertParams($row['params']); + $row['plugins'] = $this->convertParams($row['plugins']); + } + $this->setDestinationData($rows); + return true; + } +} diff --git a/deployed/k2/administrator/components/com_k2/jupgrade/j16upgrade.xml b/deployed/k2/administrator/components/com_k2/jupgrade/j16upgrade.xml new file mode 100644 index 00000000..c80b0480 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/jupgrade/j16upgrade.xml @@ -0,0 +1,49 @@ + + + + http://getk2.org/app/collection.xml + + administrator/components/com_k2/jupgrade/j16upgrade.php + jUpgradeComponentK2 + + + + k2_attachments
    + k2_categories
    + k2_comments
    + k2_extra_fields
    + k2_extra_fields_groups
    + k2_items
    + k2_rating
    + k2_tags
    + k2_tags_xref
    + k2_users
    + k2_user_groups
    +
    + + + administrator/components/com_k2 + components/com_k2 + media/k2 + + + + mod_k2_comments + + + mod_k2_content + + + mod_k2_login + + + mod_k2_tools + + + mod_k2_user + + + mod_k2_users + + +
    \ No newline at end of file diff --git a/deployed/k2/administrator/components/com_k2/jupgrade/j25upgrade.php b/deployed/k2/administrator/components/com_k2/jupgrade/j25upgrade.php new file mode 100644 index 00000000..ed953c2d --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/jupgrade/j25upgrade.php @@ -0,0 +1,93 @@ + + * + * + * administrator/components/com_k2/jupgrade/j25upgrade.php + * jUpgradeComponentK2 + * + * + * For more information, see ./j25upgrade.xml + */ +class jUpgradeComponentK2 extends jUpgradeExtensions +{ + /** + * Check if K2 migration is supported. + */ + protected function detectExtension() + { + return true; + } + + /** + * Migrate custom information. + * + * This function gets called after all folders and tables have been copied. + * + * If you want to split this task into smaller chunks, + * please store your custom state variables into $this->state and return false. + * Returning false will force jUpgrade to call this function again, + * which allows you to continue import by reading $this->state before continuing. + * + * @return boolean Ready (true/false) + * @since 1.6.4 + * @throws Exception + */ + protected function migrateExtensionCustom() + { + return true; + } + + protected function copyTable_k2_categories($table) + { + $this->source = $this->destination = "#__{$table}"; + + // Clone table + $this->cloneTable($this->source, $this->destination); + + // Get data + $rows = parent::getSourceData('*'); + + // Do some custom post processing on the list. + foreach ($rows as &$row) { + $row['access'] = $row['access'] == 0 ? 1 : $row['access'] + 1; + $row['params'] = $this->convertParams($row['params']); + } + $this->setDestinationData($rows); + return true; + } + + protected function copyTable_k2_items($table) + { + $this->source = $this->destination = "#__{$table}"; + + // Clone table + $this->cloneTable($this->source, $this->destination); + + // Get data + $rows = parent::getSourceData('*'); + + // Do some custom post processing on the list. + foreach ($rows as &$row) { + $row['access'] = $row['access'] == 0 ? 1 : $row['access'] + 1; + $row['params'] = $this->convertParams($row['params']); + $row['plugins'] = $this->convertParams($row['plugins']); + } + $this->setDestinationData($rows); + return true; + } +} diff --git a/deployed/k2/administrator/components/com_k2/jupgrade/j25upgrade.xml b/deployed/k2/administrator/components/com_k2/jupgrade/j25upgrade.xml new file mode 100644 index 00000000..bac5adad --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/jupgrade/j25upgrade.xml @@ -0,0 +1,49 @@ + + + + http://getk2.org/app/collection.xml + + administrator/components/com_k2/jupgrade/j25upgrade.php + jUpgradeComponentK2 + + + + k2_attachments
    + k2_categories
    + k2_comments
    + k2_extra_fields
    + k2_extra_fields_groups
    + k2_items
    + k2_rating
    + k2_tags
    + k2_tags_xref
    + k2_users
    + k2_user_groups
    +
    + + + administrator/components/com_k2 + components/com_k2 + media/k2 + + + + mod_k2_comments + + + mod_k2_content + + + mod_k2_login + + + mod_k2_tools + + + mod_k2_user + + + mod_k2_users + + +
    \ No newline at end of file diff --git a/deployed/k2/administrator/components/com_k2/k2.php b/deployed/k2/administrator/components/com_k2/k2.php new file mode 100644 index 00000000..8851923f --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/k2.php @@ -0,0 +1,146 @@ +get('lockTags') && $user->gid<=23 && ($view=='tags' || $view=='tag')) || ($user->gid <= 23) && ( + $view=='extrafield' || + $view=='extrafields' || + $view=='extrafieldsgroup' || + $view=='extrafieldsgroups' || + $view=='user' || + ($view=='users' && $task != 'element') || + $view=='usergroup' || + $view=='usergroups' + ) + ) + { + JError::raiseError( 403, JText::_('K2_ALERTNOTAUTH') ); + } +} +else +{ + JLoader::register('K2HelperPermissions', JPATH_SITE.'/components/com_k2/helpers/permissions.j16.php'); + K2HelperPermissions::checkPermissions(); + + // Compatibility for gid variable + if($user->authorise('core.admin', 'com_k2')) + { + $user->gid = 1000; + } + else + { + $user->gid = 1; + } + + if( + ($params->get('lockTags') && !$user->authorise('core.admin', 'com_k2') && ($view=='tags' || $view=='tag')) || + (!$user->authorise('core.admin', 'com_k2')) && ( + $view=='extrafield' || + $view=='extrafields' || + $view=='extrafieldsgroup' || + $view=='extrafieldsgroups' || + $view=='user' || + ($view=='users' && $task != 'element') || + $view=='usergroup' || + $view=='usergroups' + ) + ) + { + JError::raiseError( 403, JText::_('K2_ALERTNOTAUTH') ); + } +} + +$document = JFactory::getDocument(); +K2HelperHTML::loadHeadIncludes(true, true); + +// Container CSS class definition +if(K2_JVERSION == '15') +{ + $k2CSSContainerClass = ' oldJ isJ15'; +} +elseif (K2_JVERSION == '25') +{ + $k2CSSContainerClass = ' oldJ isJ25'; +} +elseif (K2_JVERSION == '30') +{ + $k2CSSContainerClass = ' isJ25 isJ30'; +} +else +{ + $k2CSSContainerClass = ''; +} + +if(JRequest::getCmd('context') == "modalselector") +{ + $k2CSSContainerClass .= ' inModalSelector'; + $k2FooterClass = 'inModalSelector'; +} +else +{ + $k2FooterClass = ''; +} + +if( + $document->getType() != 'raw' && + JRequest::getWord('task')!='deleteAttachment' && + JRequest::getWord('task')!='connector' && + JRequest::getWord('task')!='tag' && + JRequest::getWord('task')!='tags' && + JRequest::getWord('task')!='extrafields' && + JRequest::getWord('task')!='download' && + JRequest::getWord('task')!='saveComment' +) +{ + $k2ComponentHeader = '
    '; + $k2ComponentFooter = ' +
    + +
    + K2 v'.K2_CURRENT_VERSION.K2_BUILD.' | Copyright © 2006-'.date('Y').' JoomlaWorks Ltd. +
    + + + + + '; +} +else +{ + $k2ComponentHeader = ''; + $k2ComponentFooter = ''; +} + +// Output +echo $k2ComponentHeader; + +JLoader::register('K2Controller', JPATH_COMPONENT.'/controllers/controller.php'); +JLoader::register('K2View', JPATH_COMPONENT.'/views/view.php'); +JLoader::register('K2Model', JPATH_COMPONENT.'/models/model.php'); + +$controller = JRequest::getWord('view', 'items'); +$controller = JString::strtolower($controller); +require_once(JPATH_COMPONENT.'/controllers/'.$controller.'.php'); +$classname = 'K2Controller'.$controller; +$controller = new $classname(); +$controller->registerTask('saveAndNew', 'save'); +$controller->execute(JRequest::getWord('task')); +$controller->redirect(); + +echo $k2ComponentFooter; diff --git a/deployed/k2/administrator/components/com_k2/k2.xml b/deployed/k2/administrator/components/com_k2/k2.xml new file mode 100644 index 00000000..b010e0da --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/k2.xml @@ -0,0 +1,304 @@ + + + COM_K2 + JoomlaWorks + August 18th, 2017 + Copyright (c) 2006 - 2017 JoomlaWorks Ltd. All rights reserved. + please-use-the-contact-form@joomlaworks.net + www.joomlaworks.net + 2.8.0 + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + Thank you for installing K2 by JoomlaWorks, the powerful content extension for Joomla + install.k2.php + uninstall.k2.php + script.k2.php + + + install.mysql.sql + install.mysql.sql + + + + + uninstall.mysql.sql + uninstall.mysql.sql + + + + http://getk2.org/app/update.xml + + + controllers + css + helpers + images + models + templates + views + k2.php + router.php + + + assets + attachments + categories + galleries + items + users + videos + + + en-GB.com_k2.ini + en-GB.mod_k2_comments.ini + en-GB.mod_k2_comments.sys.ini + en-GB.mod_k2_content.ini + en-GB.mod_k2_content.sys.ini + en-GB.mod_k2_tools.ini + en-GB.mod_k2_tools.sys.ini + en-GB.mod_k2_users.ini + en-GB.mod_k2_users.sys.ini + en-GB.mod_k2_user.ini + en-GB.mod_k2_user.sys.ini + + + COM_K2 + + K2_ITEMS + K2_CATEGORIES + K2_TAGS + K2_COMMENTS + K2_USERS + K2_USER_GROUPS + K2_EXTRA_FIELDS + K2_EXTRA_FIELD_GROUPS + K2_MEDIA_MANAGER + K2_INFORMATION + + + controllers + elements + helpers + jupgrade + lib + models + tables + views + access.xml + k2.php + config.xml + install.mysql.sql + uninstall.mysql.sql + + + en-GB.com_k2.dates.ini + en-GB.com_k2.ini + en-GB.com_k2.menu.ini + en-GB.mod_k2_quickicons.ini + en-GB.mod_k2_quickicons.sys.ini + en-GB.mod_k2_stats.ini + en-GB.mod_k2_stats.sys.ini + en-GB.plg_finder_k2.ini + en-GB.plg_finder_k2.sys.ini + en-GB.plg_search_k2.ini + en-GB.plg_search_k2.sys.ini + en-GB.plg_system_k2.ini + en-GB.plg_system_k2.sys.ini + en-GB.plg_user_k2.ini + en-GB.plg_user_k2.sys.ini + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    + + + + + + + + + + + + + + + + + k2_attachments.xml + k2_categories.xml + k2_extra_fields.xml + k2_items.xml + k2_tags.xml + k2_users.xml + +
    diff --git a/deployed/k2/administrator/components/com_k2/lib/JSON.php b/deployed/k2/administrator/components/com_k2/lib/JSON.php new file mode 100644 index 00000000..3be6d49a --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/lib/JSON.php @@ -0,0 +1,815 @@ + + * @author Matt Knapp + * @author Brett Stimmerman + * @copyright 2005 Michal Migurski + * @version CVS: $Id$ + * @license http://www.opensource.org/licenses/bsd-license.php + * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198 + */ + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +if(!defined('SERVICES_JSON_SLICE')) define('SERVICES_JSON_SLICE', 1); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +if(!defined('SERVICES_JSON_IN_STR')) define('SERVICES_JSON_IN_STR', 2); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +if(!defined('SERVICES_JSON_IN_ARR')) define('SERVICES_JSON_IN_ARR', 3); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +if(!defined('SERVICES_JSON_IN_OBJ')) define('SERVICES_JSON_IN_OBJ', 4); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +if(!defined('SERVICES_JSON_IN_CMT')) define('SERVICES_JSON_IN_CMT', 5); + +/** + * Behavior switch for Services_JSON::decode() + */ +if(!defined('SERVICES_JSON_LOOSE_TYPE')) define('SERVICES_JSON_LOOSE_TYPE', 16); + +/** + * Behavior switch for Services_JSON::decode() + */ +if(!defined('SERVICES_JSON_SUPPRESS_ERRORS')) define('SERVICES_JSON_SUPPRESS_ERRORS', 32); + +/** + * Converts to and from JSON format. + * + * Brief example of use: + * + * + * // create a new instance of Services_JSON + * $json = new Services_JSON(); + * + * // convert a complexe value to JSON notation, and send it to the browser + * $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4))); + * $output = $json->encode($value); + * + * print($output); + * // prints: ["foo","bar",[1,2,"baz"],[3,[4]]] + * + * // accept incoming POST data, assumed to be in JSON notation + * $input = file_get_contents('php://input', 1000000); + * $value = $json->decode($input); + * + */ +if(!class_exists('Services_JSON')){ + class Services_JSON + { + /** + * constructs a new JSON instance + * + * @param int $use object behavior flags; combine with boolean-OR + * + * possible values: + * - SERVICES_JSON_LOOSE_TYPE: loose typing. + * "{...}" syntax creates associative arrays + * instead of objects in decode(). + * - SERVICES_JSON_SUPPRESS_ERRORS: error suppression. + * Values which can't be encoded (e.g. resources) + * appear as NULL instead of throwing errors. + * By default, a deeply-nested resource will + * bubble up with an error, so all return values + * from encode() should be checked with isError() + */ + function Services_JSON($use = 0) + { + $this->use = $use; + } + + /** + * convert a string from one UTF-16 char to one UTF-8 char + * + * Normally should be handled by mb_convert_encoding, but + * provides a slower PHP-only method for installations + * that lack the multibye string extension. + * + * @param string $utf16 UTF-16 character + * @return string UTF-8 character + * @access private + */ + function utf162utf8($utf16) + { + // oh please oh please oh please oh please oh please + if(function_exists('mb_convert_encoding')) { + return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16'); + } + + $bytes = (ord($utf16{0}) << 8) | ord($utf16{1}); + + switch(true) { + case ((0x7F & $bytes) == $bytes): + // this case should never be reached, because we are in ASCII range + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0x7F & $bytes); + + case (0x07FF & $bytes) == $bytes: + // return a 2-byte UTF-8 character + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0xC0 | (($bytes >> 6) & 0x1F)) + . chr(0x80 | ($bytes & 0x3F)); + + case (0xFFFF & $bytes) == $bytes: + // return a 3-byte UTF-8 character + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0xE0 | (($bytes >> 12) & 0x0F)) + . chr(0x80 | (($bytes >> 6) & 0x3F)) + . chr(0x80 | ($bytes & 0x3F)); + } + + // ignoring UTF-32 for now, sorry + return ''; + } + + /** + * convert a string from one UTF-8 char to one UTF-16 char + * + * Normally should be handled by mb_convert_encoding, but + * provides a slower PHP-only method for installations + * that lack the multibye string extension. + * + * @param string $utf8 UTF-8 character + * @return string UTF-16 character + * @access private + */ + function utf82utf16($utf8) + { + // oh please oh please oh please oh please oh please + if(function_exists('mb_convert_encoding')) { + return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8'); + } + + switch(strlen($utf8)) { + case 1: + // this case should never be reached, because we are in ASCII range + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return $utf8; + + case 2: + // return a UTF-16 character from a 2-byte UTF-8 char + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0x07 & (ord($utf8{0}) >> 2)) + . chr((0xC0 & (ord($utf8{0}) << 6)) + | (0x3F & ord($utf8{1}))); + + case 3: + // return a UTF-16 character from a 3-byte UTF-8 char + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr((0xF0 & (ord($utf8{0}) << 4)) + | (0x0F & (ord($utf8{1}) >> 2))) + . chr((0xC0 & (ord($utf8{1}) << 6)) + | (0x7F & ord($utf8{2}))); + } + + // ignoring UTF-32 for now, sorry + return ''; + } + + /** + * encodes an arbitrary variable into JSON format + * + * @param mixed $var any number, boolean, string, array, or object to be encoded. + * see argument 1 to Services_JSON() above for array-parsing behavior. + * if var is a strng, note that encode() always expects it + * to be in ASCII or UTF-8 format! + * + * @return mixed JSON string representation of input var or an error if a problem occurs + * @access public + */ + function encode($var) + { + switch (gettype($var)) { + case 'boolean': + return $var ? 'true' : 'false'; + + case 'NULL': + return 'null'; + + case 'integer': + return (int) $var; + + case 'double': + case 'float': + return (float) $var; + + case 'string': + // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT + $ascii = ''; + $strlen_var = strlen($var); + + /* + * Iterate over every character in the string, + * escaping with a slash or encoding to UTF-8 where necessary + */ + for ($c = 0; $c < $strlen_var; ++$c) { + + $ord_var_c = ord($var{$c}); + + switch (true) { + case $ord_var_c == 0x08: + $ascii .= '\b'; + break; + case $ord_var_c == 0x09: + $ascii .= '\t'; + break; + case $ord_var_c == 0x0A: + $ascii .= '\n'; + break; + case $ord_var_c == 0x0C: + $ascii .= '\f'; + break; + case $ord_var_c == 0x0D: + $ascii .= '\r'; + break; + + case $ord_var_c == 0x22: + case $ord_var_c == 0x2F: + case $ord_var_c == 0x5C: + // double quote, slash, slosh + $ascii .= '\\'.$var{$c}; + break; + + case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)): + // characters U-00000000 - U-0000007F (same as ASCII) + $ascii .= $var{$c}; + break; + + case (($ord_var_c & 0xE0) == 0xC0): + // characters U-00000080 - U-000007FF, mask 110XXXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, ord($var{$c + 1})); + $c += 1; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xF0) == 0xE0): + // characters U-00000800 - U-0000FFFF, mask 1110XXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2})); + $c += 2; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xF8) == 0xF0): + // characters U-00010000 - U-001FFFFF, mask 11110XXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3})); + $c += 3; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xFC) == 0xF8): + // characters U-00200000 - U-03FFFFFF, mask 111110XX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3}), + ord($var{$c + 4})); + $c += 4; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xFE) == 0xFC): + // characters U-04000000 - U-7FFFFFFF, mask 1111110X + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3}), + ord($var{$c + 4}), + ord($var{$c + 5})); + $c += 5; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + } + } + + return '"'.$ascii.'"'; + + case 'array': + /* + * As per JSON spec if any array key is not an integer + * we must treat the the whole array as an object. We + * also try to catch a sparsely populated associative + * array with numeric keys here because some JS engines + * will create an array with empty indexes up to + * max_index which can cause memory issues and because + * the keys, which may be relevant, will be remapped + * otherwise. + * + * As per the ECMA and JSON specification an object may + * have any string as a property. Unfortunately due to + * a hole in the ECMA specification if the key is a + * ECMA reserved word or starts with a digit the + * parameter is only accessible using ECMAScript's + * bracket notation. + */ + + // treat as a JSON object + if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) { + $properties = array_map(array($this, 'name_value'), + array_keys($var), + array_values($var)); + + foreach($properties as $property) { + if(Services_JSON::isError($property)) { + return $property; + } + } + + return '{' . join(',', $properties) . '}'; + } + + // treat it like a regular array + $elements = array_map(array($this, 'encode'), $var); + + foreach($elements as $element) { + if(Services_JSON::isError($element)) { + return $element; + } + } + + return '[' . join(',', $elements) . ']'; + + case 'object': + $vars = get_object_vars($var); + + $properties = array_map(array($this, 'name_value'), + array_keys($vars), + array_values($vars)); + + foreach($properties as $property) { + if(Services_JSON::isError($property)) { + return $property; + } + } + + return '{' . join(',', $properties) . '}'; + + default: + return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS) + ? 'null' + : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string"); + } + } + + /** + * array-walking function for use in generating JSON-formatted name-value pairs + * + * @param string $name name of key to use + * @param mixed $value reference to an array element to be encoded + * + * @return string JSON-formatted name-value pair, like '"name":value' + * @access private + */ + function name_value($name, $value) + { + $encoded_value = $this->encode($value); + + if(Services_JSON::isError($encoded_value)) { + return $encoded_value; + } + + return $this->encode(strval($name)) . ':' . $encoded_value; + } + + /** + * reduce a string by removing leading and trailing comments and whitespace + * + * @param $str string string value to strip of comments and whitespace + * + * @return string string value stripped of comments and whitespace + * @access private + */ + function reduce_string($str) + { + $str = preg_replace(array( + + // eliminate single line comments in '// ...' form + '#^\s*//(.+)$#m', + + // eliminate multi-line comments in '/* ... */' form, at start of string + '#^\s*/\*(.+)\*/#Us', + + // eliminate multi-line comments in '/* ... */' form, at end of string + '#/\*(.+)\*/\s*$#Us' + + ), '', $str); + + // eliminate extraneous space + return trim($str); + } + + /** + * decodes a JSON string into appropriate variable + * + * @param string $str JSON-formatted string + * + * @return mixed number, boolean, string, array, or object + * corresponding to given JSON input string. + * See argument 1 to Services_JSON() above for object-output behavior. + * Note that decode() always returns strings + * in ASCII or UTF-8 format! + * @access public + */ + function decode($str) + { + $str = $this->reduce_string($str); + + switch (strtolower($str)) { + case 'true': + return true; + + case 'false': + return false; + + case 'null': + return null; + + default: + $m = array(); + + if (is_numeric($str)) { + // Lookie-loo, it's a number + + // This would work on its own, but I'm trying to be + // good about returning integers where appropriate: + // return (float)$str; + + // Return float or int, as appropriate + return ((float)$str == (integer)$str) + ? (integer)$str + : (float)$str; + + } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) { + // STRINGS RETURNED IN UTF-8 FORMAT + $delim = substr($str, 0, 1); + $chrs = substr($str, 1, -1); + $utf8 = ''; + $strlen_chrs = strlen($chrs); + + for ($c = 0; $c < $strlen_chrs; ++$c) { + + $substr_chrs_c_2 = substr($chrs, $c, 2); + $ord_chrs_c = ord($chrs{$c}); + + switch (true) { + case $substr_chrs_c_2 == '\b': + $utf8 .= chr(0x08); + ++$c; + break; + case $substr_chrs_c_2 == '\t': + $utf8 .= chr(0x09); + ++$c; + break; + case $substr_chrs_c_2 == '\n': + $utf8 .= chr(0x0A); + ++$c; + break; + case $substr_chrs_c_2 == '\f': + $utf8 .= chr(0x0C); + ++$c; + break; + case $substr_chrs_c_2 == '\r': + $utf8 .= chr(0x0D); + ++$c; + break; + + case $substr_chrs_c_2 == '\\"': + case $substr_chrs_c_2 == '\\\'': + case $substr_chrs_c_2 == '\\\\': + case $substr_chrs_c_2 == '\\/': + if (($delim == '"' && $substr_chrs_c_2 != '\\\'') || + ($delim == "'" && $substr_chrs_c_2 != '\\"')) { + $utf8 .= $chrs{++$c}; + } + break; + + case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)): + // single, escaped unicode character + $utf16 = chr(hexdec(substr($chrs, ($c + 2), 2))) + . chr(hexdec(substr($chrs, ($c + 4), 2))); + $utf8 .= $this->utf162utf8($utf16); + $c += 5; + break; + + case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F): + $utf8 .= $chrs{$c}; + break; + + case ($ord_chrs_c & 0xE0) == 0xC0: + // characters U-00000080 - U-000007FF, mask 110XXXXX + //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 2); + ++$c; + break; + + case ($ord_chrs_c & 0xF0) == 0xE0: + // characters U-00000800 - U-0000FFFF, mask 1110XXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 3); + $c += 2; + break; + + case ($ord_chrs_c & 0xF8) == 0xF0: + // characters U-00010000 - U-001FFFFF, mask 11110XXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 4); + $c += 3; + break; + + case ($ord_chrs_c & 0xFC) == 0xF8: + // characters U-00200000 - U-03FFFFFF, mask 111110XX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 5); + $c += 4; + break; + + case ($ord_chrs_c & 0xFE) == 0xFC: + // characters U-04000000 - U-7FFFFFFF, mask 1111110X + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 6); + $c += 5; + break; + + } + + } + + return $utf8; + + } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) { + // array, or object notation + + if ($str{0} == '[') { + $stk = array(SERVICES_JSON_IN_ARR); + $arr = array(); + } else { + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $stk = array(SERVICES_JSON_IN_OBJ); + $obj = array(); + } else { + $stk = array(SERVICES_JSON_IN_OBJ); + $obj = new stdClass(); + } + } + + array_push($stk, array('what' => SERVICES_JSON_SLICE, + 'where' => 0, + 'delim' => false)); + + $chrs = substr($str, 1, -1); + $chrs = $this->reduce_string($chrs); + + if ($chrs == '') { + if (reset($stk) == SERVICES_JSON_IN_ARR) { + return $arr; + + } else { + return $obj; + + } + } + + //print("\nparsing {$chrs}\n"); + + $strlen_chrs = strlen($chrs); + + for ($c = 0; $c <= $strlen_chrs; ++$c) { + + $top = end($stk); + $substr_chrs_c_2 = substr($chrs, $c, 2); + + if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) { + // found a comma that is not inside a string, array, etc., + // OR we've reached the end of the character list + $slice = substr($chrs, $top['where'], ($c - $top['where'])); + array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false)); + //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + if (reset($stk) == SERVICES_JSON_IN_ARR) { + // we are in an array, so just push an element onto the stack + array_push($arr, $this->decode($slice)); + + } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { + // we are in an object, so figure + // out the property name and set an + // element in an associative array, + // for now + $parts = array(); + + if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) { + // "name":value pair + $key = $this->decode($parts[1]); + $val = $this->decode($parts[2]); + + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $obj[$key] = $val; + } else { + $obj->$key = $val; + } + } elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) { + // name:value pair, where name is unquoted + $key = $parts[1]; + $val = $this->decode($parts[2]); + + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $obj[$key] = $val; + } else { + $obj->$key = $val; + } + } + + } + + } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) { + // found a quote, and we are not inside a string + array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c})); + //print("Found start of string at {$c}\n"); + + } elseif (($chrs{$c} == $top['delim']) && + ($top['what'] == SERVICES_JSON_IN_STR) && + ((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) { + // found a quote, we're in a string, and it's not escaped + // we know that it's not escaped becase there is _not_ an + // odd number of backslashes at the end of the string so far + array_pop($stk); + //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n"); + + } elseif (($chrs{$c} == '[') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a left-bracket, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false)); + //print("Found start of array at {$c}\n"); + + } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) { + // found a right-bracket, and we're in an array + array_pop($stk); + //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } elseif (($chrs{$c} == '{') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a left-brace, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false)); + //print("Found start of object at {$c}\n"); + + } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) { + // found a right-brace, and we're in an object + array_pop($stk); + //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } elseif (($substr_chrs_c_2 == '/*') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a comment start, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false)); + $c++; + //print("Found start of comment at {$c}\n"); + + } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) { + // found a comment end, and we're in one now + array_pop($stk); + $c++; + + for ($i = $top['where']; $i <= $c; ++$i) + $chrs = substr_replace($chrs, ' ', $i, 1); + + //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } + + } + + if (reset($stk) == SERVICES_JSON_IN_ARR) { + return $arr; + + } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { + return $obj; + + } + + } + } + } + + /** + * @todo Ultimately, this should just call PEAR::isError() + */ + function isError($data, $code = null) + { + if (class_exists('pear')) { + return PEAR::isError($data, $code); + } elseif (is_object($data) && (get_class($data) == 'services_json_error' || + is_subclass_of($data, 'services_json_error'))) { + return true; + } + + return false; + } + } +} + +if (!class_exists('Services_JSON_Error')) { + if (class_exists('PEAR_Error')) { + class Services_JSON_Error extends PEAR_Error + { + function Services_JSON_Error($message = 'unknown error', $code = null, + $mode = null, $options = null, $userinfo = null) + { + parent::PEAR_Error($message, $code, $mode, $options, $userinfo); + } + } + } else { + /** + * @todo Ultimately, this class shall be descended from PEAR_Error + */ + class Services_JSON_Error + { + function Services_JSON_Error($message = 'unknown error', $code = null, + $mode = null, $options = null, $userinfo = null) + { + + } + } + } +} diff --git a/deployed/k2/administrator/components/com_k2/lib/akismet.class.php b/deployed/k2/administrator/components/com_k2/lib/akismet.class.php new file mode 100644 index 00000000..502f3965 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/lib/akismet.class.php @@ -0,0 +1,536 @@ + + * $akismet = new Akismet('http://www.example.com/blog/', 'aoeu1aoue'); + * $akismet->setCommentAuthor($name); + * $akismet->setCommentAuthorEmail($email); + * $akismet->setCommentAuthorURL($url); + * $akismet->setCommentContent($comment); + * $akismet->setPermalink('http://www.example.com/blog/alex/someurl/'); + * + * if($akismet->isCommentSpam()) + * // store the comment but mark it as spam (in case of a mis-diagnosis) + * else + * // store the comment normally + * + * + * Optionally you may wish to check if your WordPress API key is valid as in the example below. + * + * + * $akismet = new Akismet('http://www.example.com/blog/', 'aoeu1aoue'); + * + * if($akismet->isKeyValid()) { + * // api key is okay + * } else { + * // api key is invalid + * } + * + * + * @package akismet + * @name Akismet + * @version 0.5 + * @author Alex Potsides + * @link http://www.achingbrain.net/ + */ +class Akismet +{ + private $version = '0.5'; + private $wordPressAPIKey; + private $blogURL; + private $comment; + private $apiPort; + private $akismetServer; + private $akismetVersion; + private $requestFactory; + + // This prevents some potentially sensitive information from being sent accross the wire. + private $ignore = array( + 'HTTP_COOKIE', + 'HTTP_X_FORWARDED_FOR', + 'HTTP_X_FORWARDED_HOST', + 'HTTP_MAX_FORWARDS', + 'HTTP_X_FORWARDED_SERVER', + 'REDIRECT_STATUS', + 'SERVER_PORT', + 'PATH', + 'DOCUMENT_ROOT', + 'SERVER_ADMIN', + 'QUERY_STRING', + 'PHP_SELF' + ); + + /** + * @param string $blogURL The URL of your blog. + * @param string $wordPressAPIKey WordPress API key. + */ + public function __construct($blogURL, $wordPressAPIKey) + { + $this->blogURL = $blogURL; + $this->wordPressAPIKey = $wordPressAPIKey; + + // Set some default values + $this->apiPort = 80; + $this->akismetServer = 'rest.akismet.com'; + $this->akismetVersion = '1.1'; + $this->requestFactory = new SocketWriteReadFactory(); + + // Start to populate the comment data + $this->comment['blog'] = $blogURL; + + if (isset($_SERVER['HTTP_USER_AGENT'])) + { + $this->comment['user_agent'] = $_SERVER['HTTP_USER_AGENT']; + } + + if (isset($_SERVER['HTTP_REFERER'])) + { + $this->comment['referrer'] = $_SERVER['HTTP_REFERER']; + } + + /* + * This is necessary if the server PHP5 is running on has been set up to run PHP4 and + * PHP5 concurently and is actually running through a separate proxy al a these instructions: + * http://www.schlitt.info/applications/blog/archives/83_How_to_run_PHP4_and_PHP_5_parallel.html + * and http://wiki.coggeshall.org/37.html + * Otherwise the user_ip appears as the IP address of the PHP4 server passing the requests to the + * PHP5 one... + */ + if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] != getenv('SERVER_ADDR')) + { + $this->comment['user_ip'] = $_SERVER['REMOTE_ADDR']; + } + else + { + $this->comment['user_ip'] = getenv('HTTP_X_FORWARDED_FOR'); + } + } + + /** + * Makes a request to the Akismet service to see if the API key passed to the constructor is valid. + * + * Use this method if you suspect your API key is invalid. + * + * @return bool True is if the key is valid, false if not. + */ + public function isKeyValid() + { + // Check to see if the key is valid + $response = $this->sendRequest('key='.$this->wordPressAPIKey.'&blog='.$this->blogURL, $this->akismetServer, '/'.$this->akismetVersion.'/verify-key'); + return $response[1] == 'valid'; + } + + // makes a request to the Akismet service + private function sendRequest($request, $host, $path) + { + $http_request = "POST ".$path." HTTP/1.0\r\n"; + $http_request .= "Host: ".$host."\r\n"; + $http_request .= "Content-Type: application/x-www-form-urlencoded; charset=utf-8\r\n"; + $http_request .= "Content-Length: ".strlen($request)."\r\n"; + $http_request .= "User-Agent: Akismet PHP5 Class ".$this->version." | Akismet/1.11\r\n"; + $http_request .= "\r\n"; + $http_request .= $request; + + $requestSender = $this->requestFactory->createRequestSender(); + $response = $requestSender->send($host, $this->apiPort, $http_request); + + return explode("\r\n\r\n", $response, 2); + } + + // Formats the data for transmission + private function getQueryString() + { + foreach ($_SERVER as $key => $value) + { + if (!in_array($key, $this->ignore)) + { + if ($key == 'REMOTE_ADDR') + { + $this->comment[$key] = $this->comment['user_ip']; + } + else + { + $this->comment[$key] = $value; + } + } + } + + $query_string = ''; + + foreach ($this->comment as $key => $data) + { + if (!is_array($data)) + { + $query_string .= $key.'='.urlencode(stripslashes($data)).'&'; + } + } + + return $query_string; + } + + /** + * Tests for spam. + * + * Uses the web service provided by {@link http://www.akismet.com Akismet} to see whether or not the submitted comment is spam. Returns a boolean value. + * + * @return bool True if the comment is spam, false if not + * @throws Will throw an exception if the API key passed to the constructor is invalid. + */ + public function isCommentSpam() + { + $response = $this->sendRequest($this->getQueryString(), $this->wordPressAPIKey.'.rest.akismet.com', '/'.$this->akismetVersion.'/comment-check'); + + if ($response[1] == 'invalid' && !$this->isKeyValid()) + { + throw new exception('The Wordpress API key passed to the Akismet constructor is invalid. Please obtain a valid one from http://wordpress.com/api-keys/'); + } + + return ($response[1] == 'true'); + } + + /** + * Submit spam that is incorrectly tagged as ham. + * + * Using this function will make you a good citizen as it helps Akismet to learn from its mistakes. This will improve the service for everybody. + */ + public function submitSpam() + { + $this->sendRequest($this->getQueryString(), $this->wordPressAPIKey.'.'.$this->akismetServer, '/'.$this->akismetVersion.'/submit-spam'); + } + + /** + * Submit ham that is incorrectly tagged as spam. + * + * Using this function will make you a good citizen as it helps Akismet to learn from its mistakes. This will improve the service for everybody. + */ + public function submitHam() + { + $this->sendRequest($this->getQueryString(), $this->wordPressAPIKey.'.'.$this->akismetServer, '/'.$this->akismetVersion.'/submit-ham'); + } + + /** + * To override the user IP address when submitting spam/ham later on + * + * @param string $userip An IP address. Optional. + */ + public function setUserIP($userip) + { + $this->comment['user_ip'] = $userip; + } + + /** + * To override the referring page when submitting spam/ham later on + * + * @param string $referrer The referring page. Optional. + */ + public function setReferrer($referrer) + { + $this->comment['referrer'] = $referrer; + } + + /** + * A permanent URL referencing the blog post the comment was submitted to. + * + * @param string $permalink The URL. Optional. + */ + public function setPermalink($permalink) + { + $this->comment['permalink'] = $permalink; + } + + /** + * The type of comment being submitted. + * + * May be blank, comment, trackback, pingback, or a made up value like "registration" or "wiki". + */ + public function setCommentType($commentType) + { + $this->comment['comment_type'] = $commentType; + } + + /** + * The name that the author submitted with the comment. + */ + public function setCommentAuthor($commentAuthor) + { + $this->comment['comment_author'] = $commentAuthor; + } + + /** + * The email address that the author submitted with the comment. + * + * The address is assumed to be valid. + */ + public function setCommentAuthorEmail($authorEmail) + { + $this->comment['comment_author_email'] = $authorEmail; + } + + /** + * The URL that the author submitted with the comment. + */ + public function setCommentAuthorURL($authorURL) + { + $this->comment['comment_author_url'] = $authorURL; + } + + /** + * The comment's body text. + */ + public function setCommentContent($commentBody) + { + $this->comment['comment_content'] = $commentBody; + } + + /** + * Lets you override the user agent used to submit the comment. + * you may wish to do this when submitting ham/spam. + * Defaults to $_SERVER['HTTP_USER_AGENT'] + */ + public function setCommentUserAgent($userAgent) + { + $this->comment['user_agent'] = $userAgent; + } + + /** + * Defaults to 80 + */ + public function setAPIPort($apiPort) + { + $this->apiPort = $apiPort; + } + + /** + * Defaults to rest.akismet.com + */ + public function setAkismetServer($akismetServer) + { + $this->akismetServer = $akismetServer; + } + + /** + * Defaults to '1.1' + * + * @param string $akismetVersion + */ + public function setAkismetVersion($akismetVersion) + { + $this->akismetVersion = $akismetVersion; + } + + /** + * Used by unit tests to mock transport layer + * + * @param AkismetRequestFactory $requestFactory + */ + public function setRequestFactory($requestFactory) + { + $this->requestFactory = $requestFactory; + } + +} + +/** + * Used internally by Akismet + * + * This class is used by Akismet to do the actual sending and receiving of data. It opens a connection to a remote host, sends some data and the reads the response and makes it available to the calling program. + * + * The code that makes up this class originates in the Akismet WordPress plugin, which is {@link http://akismet.com/download/ available on the Akismet website}. + * + * N.B. It is not necessary to call this class directly to use the Akismet class. + * + * @package akismet + * @name SocketWriteRead + * @version 0.5 + * @author Alex Potsides + * @link http://www.achingbrain.net/ + */ +class SocketWriteRead implements AkismetRequestSender +{ + private $response; + private $errorNumber; + private $errorString; + + public function __construct() + { + $this->errorNumber = 0; + $this->errorString = ''; + } + + /** + * Sends the data to the remote host. + * + * @param string $host The host to send/receive data. + * @param int $port The port on the remote host. + * @param string $request The data to send. + * @param int $responseLength The amount of data to read. Defaults to 1160 bytes. + * @throws An exception is thrown if a connection cannot be made to the remote host. + * @returns The server response + */ + public function send($host, $port, $request, $responseLength = 1160) + { + $response = ''; + + $fs = fsockopen($host, $port, $this->errorNumber, $this->errorString, 3); + + if ($this->errorNumber != 0) + { + throw new Exception('Error connecting to host: '.$host.' Error number: '.$this->errorNumber.' Error message: '.$this->errorString); + } + + if ($fs !== false) + { + @fwrite($fs, $request); + + while (!feof($fs)) + { + $response .= fgets($fs, $responseLength); + } + + fclose($fs); + } + + return $response; + } + + /** + * Returns the server response text + * + * @return string + */ + public function getResponse() + { + return $this->response; + } + + /** + * Returns the error number + * + * If there was no error, 0 will be returned. + * + * @return int + */ + public function getErrorNumner() + { + return $this->errorNumber; + } + + /** + * Returns the error string + * + * If there was no error, an empty string will be returned. + * + * @return string + */ + public function getErrorString() + { + return $this->errorString; + } + +} + +/** + * Used internally by the Akismet class and to mock the Akismet anti spam service in + * the unit tests. + * + * N.B. It is not necessary to call this class directly to use the Akismet class. + * + * @package akismet + * @name SocketWriteReadFactory + * @version 0.5 + * @author Alex Potsides + * @link http://www.achingbrain.net/ + */ +class SocketWriteReadFactory implements AkismetRequestFactory +{ + + public function createRequestSender() + { + return new SocketWriteRead(); + } + +} + +/** + * Used internally by the Akismet class and to mock the Akismet anti spam service in + * the unit tests. + * + * N.B. It is not necessary to implement this class to use the Akismet class. + * + * @package akismet + * @name AkismetRequestSender + * @version 0.5 + * @author Alex Potsides + * @link http://www.achingbrain.net/ + */ +interface AkismetRequestSender +{ + + /** + * Sends the data to the remote host. + * + * @param string $host The host to send/receive data. + * @param int $port The port on the remote host. + * @param string $request The data to send. + * @param int $responseLength The amount of data to read. Defaults to 1160 bytes. + * @throws An exception is thrown if a connection cannot be made to the remote host. + * @returns The server response + */ + public function send($host, $port, $request, $responseLength = 1160); +} + +/** + * Used internally by the Akismet class and to mock the Akismet anti spam service in + * the unit tests. + * + * N.B. It is not necessary to implement this class to use the Akismet class. + * + * @package akismet + * @name AkismetRequestFactory + * @version 0.5 + * @author Alex Potsides + * @link http://www.achingbrain.net/ + */ +interface AkismetRequestFactory +{ + + public function createRequestSender(); +} diff --git a/deployed/k2/administrator/components/com_k2/lib/class.upload.php b/deployed/k2/administrator/components/com_k2/lib/class.upload.php new file mode 100644 index 00000000..84cd8869 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/lib/class.upload.php @@ -0,0 +1,5325 @@ + + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + * @copyright Colin Verot + * @package cmf + * @subpackage external + */ + +/** + * Class upload + * + * What does it do? + * + * It manages file uploads for you. In short, it manages the uploaded file, + * and allows you to do whatever you want with the file, especially if it + * is an image, and as many times as you want. + * + * It is the ideal class to quickly integrate file upload in your site. + * If the file is an image, you can convert, resize, crop it in many ways. + * You can also apply filters, add borders, text, watermarks, etc... + * That's all you need for a gallery script for instance. Supported formats + * are PNG, JPG, GIF and BMP. + * + * You can also use the class to work on local files, which is especially + * useful to use the image manipulation features. The class also supports + * Flash uploaders. + * + * The class works with PHP 4 and 5, and its error messages can + * be localized at will. + * + * How does it work? + * + * You instanciate the class with the $_FILES['my_field'] array + * where my_field is the field name from your upload form. + * The class will check if the original file has been uploaded + * to its temporary location (alternatively, you can instanciate + * the class with a local filename). + * + * You can then set a number of processing variables to act on the file. + * For instance, you can rename the file, and if it is an image, + * convert and resize it in many ways. + * You can also set what will the class do if the file already exists. + * + * Then you call the function {@link process} to actually perform the actions + * according to the processing parameters you set above. + * It will create new instances of the original file, + * so the original file remains the same between each process. + * The file will be manipulated, and copied to the given location. + * The processing variables will be reset once it is done. + * + * You can repeat setting up a new set of processing variables, + * and calling {@link process} again as many times as you want. + * When you have finished, you can call {@link clean} to delete + * the original uploaded file. + * + * If you don't set any processing parameters and call {@link process} + * just after instanciating the class. The uploaded file will be simply + * copied to the given location without any alteration or checks. + * + * Don't forget to add enctype="multipart/form-data" in your form + * tag
    if you want your form to upload the file. + * + * How to use it?
    + * Create a simple HTML file, with a form such as: + *
    + * 
    + *   
    + *   
    + * 
    + * 
    + * Create a file called upload.php: + *
    + *  $handle = new upload($_FILES['image_field']);
    + *  if ($handle->uploaded) {
    + *      $handle->file_new_name_body   = 'image_resized';
    + *      $handle->image_resize         = true;
    + *      $handle->image_x              = 100;
    + *      $handle->image_ratio_y        = true;
    + *      $handle->process('/home/user/files/');
    + *      if ($handle->processed) {
    + *          echo 'image resized';
    + *          $handle->clean();
    + *      } else {
    + *          echo 'error : ' . $handle->error;
    + *      }
    + *  }
    + * 
    + * + * How to process a file uploaded via XMLHttpRequest?
    + * Use the class as following, the rest being the same as above: + *
    + *  $handle = new upload('php:'.$_SERVER['HTTP_X_FILE_NAME']);
    + * 
    + * Prefixing the argument with "php:" tells the class to retrieve the uploaded data + * in php://input, and the rest is the stream's filename, which is generally in + * $_SERVER['HTTP_X_FILE_NAME']. But you can use any other name you see fit: + *
    + *  $handle = new upload('php:mycustomname.ext');
    + * 
    + * + * How to process local files?
    + * Use the class as following, the rest being the same as above: + *
    + *  $handle = new upload('/home/user/myfile.jpg');
    + * 
    + * + * How to set the language?
    + * Instantiate the class with a second argument being the language code: + *
    + *  $handle = new upload($_FILES['image_field'], 'fr_FR');
    + *  $handle = new upload('/home/user/myfile.jpg', 'fr_FR');
    + * 
    + * + * How to output the resulting file or picture directly to the browser?
    + * Simply call {@link process}() without an argument (or with null as first argument): + *
    + *  $handle = new upload($_FILES['image_field']);
    + *  header('Content-type: ' . $handle->file_src_mime);
    + *  echo $handle->Process();
    + *  die();
    + * 
    + * Or if you want to force the download of the file: + *
    + *  $handle = new upload($_FILES['image_field']);
    + *  header('Content-type: ' . $handle->file_src_mime);
    + *  header("Content-Disposition: attachment; filename=".rawurlencode($handle->file_src_name).";");
    + *  echo $handle->Process();
    + *  die();
    + * 
    + * + * Processing parameters (reset after each process) + *
      + *
    • {@link file_new_name_body} replaces the name body (default: null)
      + *
      $handle->file_new_name_body = 'new name';
    • + *
    • {@link file_name_body_add} appends to the name body (default: null)
      + *
      $handle->file_name_body_add = '_uploaded';
    • + *
    • {@link file_name_body_pre} prepends to the name body (default: null)
      + *
      $handle->file_name_body_pre = 'thumb_';
    • + *
    • {@link file_new_name_ext} replaces the file extension (default: null)
      + *
      $handle->file_new_name_ext = 'txt';
    • + *
    • {@link file_safe_name} formats the filename (spaces changed to _) (default: true)
      + *
      $handle->file_safe_name = true;
    • + *
    • {@link file_force_extension} forces an extension if there is't any (default: true)
      + *
      $handle->file_force_extension = true;
    • + *
    • {@link file_overwrite} sets behaviour if file already exists (default: false)
      + *
      $handle->file_overwrite = true;
    • + *
    • {@link file_auto_rename} automatically renames file if it already exists (default: true)
      + *
      $handle->file_auto_rename = true;
    • + *
    • {@link dir_auto_create} automatically creates destination directory if missing (default: true)
      + *
      $handle->auto_create_dir = true;
    • + *
    • {@link dir_auto_chmod} automatically attempts to chmod the destination directory if not writeable (default: true)
      + *
      $handle->dir_auto_chmod = true;
    • + *
    • {@link dir_chmod} chmod used when creating directory or if directory not writeable (default: 0777)
      + *
      $handle->dir_chmod = 0777;
    • + *
    • {@link file_max_size} sets maximum upload size (default: upload_max_filesize from php.ini)
      + *
      $handle->file_max_size = '1024'; // 1KB
    • + *
    • {@link mime_check} sets if the class check the MIME against the {@link allowed} list (default: true)
      + *
      $handle->mime_check = true;
    • + *
    • {@link no_script} sets if the class turns scripts into text files (default: true)
      + *
      $handle->no_script = false;
    • + *
    • {@link allowed} array of allowed mime-types (or one string). wildcard accepted, as in image/* (default: check {@link Init})
      + *
      $handle->allowed = array('application/pdf','application/msword', 'image/*');
    • + *
    • {@link forbidden} array of forbidden mime-types (or one string). wildcard accepted, as in image/* (default: check {@link Init})
      + *
      $handle->forbidden = array('application/*');
    • + *
    + *
      + *
    • {@link image_convert} if set, image will be converted (possible values : ''|'png'|'jpeg'|'gif'|'bmp'; default: '')
      + *
      $handle->image_convert = 'jpg';
    • + *
    • {@link image_background_color} if set, will forcibly fill transparent areas with the color, in hexadecimal (default: null)
      + *
      $handle->image_background_color = '#FF00FF';
    • + *
    • {@link image_default_color} fallback color background color for non alpha-transparent output formats, such as JPEG or BMP, in hexadecimal (default: #FFFFFF)
      + *
      $handle->image_default_color = '#FF00FF';
    • + *
    • {@link png_compression} sets the compression level for PNG images, between 1 (fast but large files) and 9 (slow but smaller files) (default: null (Zlib default))
      + *
      $handle->png_compression = 9;
    • + *
    • {@link jpeg_quality} sets the compression quality for JPEG images (default: 85)
      + *
      $handle->jpeg_quality = 50;
    • + *
    • {@link jpeg_size} if set to a size in bytes, will approximate {@link jpeg_quality} so the output image fits within the size (default: null)
      + *
      $handle->jpeg_size = 3072;
    • + *
    • {@link image_interlace} if set to true, the image will be saved interlaced (default: false)
      + *
      $handle->image_interlace = true;
    • + *
    + * The following eight settings can be used to invalidate an upload if the file is an image (note that open_basedir restrictions prevent the use of these settings) + *
      + *
    • {@link image_max_width} if set to a dimension in pixels, the upload will be invalid if the image width is greater (default: null)
      + *
      $handle->image_max_width = 200;
    • + *
    • {@link image_max_height} if set to a dimension in pixels, the upload will be invalid if the image height is greater (default: null)
      + *
      $handle->image_max_height = 100;
    • + *
    • {@link image_max_pixels} if set to a number of pixels, the upload will be invalid if the image number of pixels is greater (default: null)
      + *
      $handle->image_max_pixels = 50000;
    • + *
    • {@link image_max_ratio} if set to a aspect ratio (width/height), the upload will be invalid if the image apect ratio is greater (default: null)
      + *
      $handle->image_max_ratio = 1.5;
    • + *
    • {@link image_min_width} if set to a dimension in pixels, the upload will be invalid if the image width is lower (default: null)
      + *
      $handle->image_min_width = 100;
    • + *
    • {@link image_min_height} if set to a dimension in pixels, the upload will be invalid if the image height is lower (default: null)
      + *
      $handle->image_min_height = 500;
    • + *
    • {@link image_min_pixels} if set to a number of pixels, the upload will be invalid if the image number of pixels is lower (default: null)
      + *
      $handle->image_min_pixels = 20000;
    • + *
    • {@link image_min_ratio} if set to a aspect ratio (width/height), the upload will be invalid if the image apect ratio is lower (default: null)
      + *
      $handle->image_min_ratio = 0.5;
    • + *
    + *
      + *
    • {@link image_resize} determines is an image will be resized (default: false)
      + *
      $handle->image_resize = true;
    • + *
    + * The following variables are used only if {@link image_resize} == true + *
      + *
    • {@link image_x} destination image width (default: 150)
      + *
      $handle->image_x = 100;
    • + *
    • {@link image_y} destination image height (default: 150)
      + *
      $handle->image_y = 200;
    • + *
    + * Use either one of the following + *
      + *
    • {@link image_ratio} if true, resize image conserving the original sizes ratio, using {@link image_x} AND {@link image_y} as max sizes if true (default: false)
      + *
      $handle->image_ratio = true;
    • + *
    • {@link image_ratio_crop} if true, resize image conserving the original sizes ratio, using {@link image_x} AND {@link image_y} as max sizes, and cropping excedent to fill the space. setting can also be a string, with one or more from 'TBLR', indicating which side of the image will be kept while cropping (default: false)
      + *
      $handle->image_ratio_crop = true;
    • + *
    • {@link image_ratio_fill} if true, resize image conserving the original sizes ratio, using {@link image_x} AND {@link image_y} as max sizes, fitting the image in the space and coloring the remaining space. setting can also be a string, with one or more from 'TBLR', indicating which side of the space the image will be in (default: false)
      + *
      $handle->image_ratio_fill = true;
    • + *
    • {@link image_ratio_no_zoom_in} same as {@link image_ratio}, but won't resize if the source image is smaller than {@link image_x} x {@link image_y} (default: false)
      + *
      $handle->image_ratio_no_zoom_in = true;
    • + *
    • {@link image_ratio_no_zoom_out} same as {@link image_ratio}, but won't resize if the source image is bigger than {@link image_x} x {@link image_y} (default: false)
      + *
      $handle->image_ratio_no_zoom_out = true;
    • + *
    • {@link image_ratio_x} if true, resize image, calculating {@link image_x} from {@link image_y} and conserving the original sizes ratio (default: false)
      + *
      $handle->image_ratio_x = true;
    • + *
    • {@link image_ratio_y} if true, resize image, calculating {@link image_y} from {@link image_x} and conserving the original sizes ratio (default: false)
      + *
      $handle->image_ratio_y = true;
    • + *
    • {@link image_ratio_pixels} if set to a long integer, resize image, calculating {@link image_y} and {@link image_x} to match a the number of pixels (default: false)
      + *
      $handle->image_ratio_pixels = 25000;
    • + *
    + * The following image manipulations require GD2+ + *
      + *
    • {@link image_brightness} if set, corrects the brightness. value between -127 and 127 (default: null)
      + *
      $handle->image_brightness = 40;
    • + *
    • {@link image_contrast} if set, corrects the contrast. value between -127 and 127 (default: null)
      + *
      $handle->image_contrast = 50;
    • + *
    • {@link image_opacity} if set, changes the image opacity. value between 0 and 100 (default: null)
      + *
      $handle->image_opacity = 50;
    • + *
    • {@link image_tint_color} if set, will tint the image with a color, value as hexadecimal #FFFFFF (default: null)
      + *
      $handle->image_tint_color = '#FF0000';
    • + *
    • {@link image_overlay_color} if set, will add a colored overlay, value as hexadecimal #FFFFFF (default: null)
      + *
      $handle->image_overlay_color = '#FF0000';
    • + *
    • {@link image_overlay_opacity} used when {@link image_overlay_color} is set, determines the opacity (default: 50)
      + *
      $handle->image_overlay_opacity = 20;
    • + *
    • {@link image_negative} inverts the colors in the image (default: false)
      + *
      $handle->image_negative = true;
    • + *
    • {@link image_greyscale} transforms an image into greyscale (default: false)
      + *
      $handle->image_greyscale = true;
    • + *
    • {@link image_threshold} applies a threshold filter. value between -127 and 127 (default: null)
      + *
      $handle->image_threshold = 20;
    • + *
    • {@link image_pixelate} pixelate an image, value is block size (default: null)
      + *
      $handle->image_pixelate = 10;
    • + *
    • {@link image_unsharp} applies an unsharp mask, with alpha transparency support (default: false)
      + *
      $handle->image_unsharp = true;
    • + *
    • {@link image_unsharp_amount} unsharp mask amount, typically 50 - 200 (default: 80)
      + *
      $handle->image_unsharp_amount = 120;
    • + *
    • {@link image_unsharp_radius} unsharp mask radius, typically 0.5 - 1 (default: 0.5)
      + *
      $handle->image_unsharp_radius = 1;
    • + *
    • {@link image_unsharp_threshold} unsharp mask threshold, typically 0 - 5 (default: 1)
      + *
      $handle->image_unsharp_threshold = 0;
    • + *
    + *
      + *
    • {@link image_text} creates a text label on the image, value is a string, with eventual replacement tokens (default: null)
      + *
      $handle->image_text = 'test';
    • + *
    • {@link image_text_direction} text label direction, either 'h' horizontal or 'v' vertical (default: 'h')
      + *
      $handle->image_text_direction = 'v';
    • + *
    • {@link image_text_color} text color for the text label, in hexadecimal (default: #FFFFFF)
      + *
      $handle->image_text_color = '#FF0000';
    • + *
    • {@link image_text_opacity} text opacity on the text label, integer between 0 and 100 (default: 100)
      + *
      $handle->image_text_opacity = 50;
    • + *
    • {@link image_text_background} text label background color, in hexadecimal (default: null)
      + *
      $handle->image_text_background = '#FFFFFF';
    • + *
    • {@link image_text_background_opacity} text label background opacity, integer between 0 and 100 (default: 100)
      + *
      $handle->image_text_background_opacity = 50;
    • + *
    • {@link image_text_font} built-in font for the text label, from 1 to 5. 1 is the smallest (default: 5)
      + *
      $handle->image_text_font = 4;
    • + *
    • {@link image_text_x} absolute text label position, in pixels from the left border. can be negative (default: null)
      + *
      $handle->image_text_x = 5;
    • + *
    • {@link image_text_y} absolute text label position, in pixels from the top border. can be negative (default: null)
      + *
      $handle->image_text_y = 5;
    • + *
    • {@link image_text_position} text label position withing the image, a combination of one or two from 'TBLR': top, bottom, left, right (default: null)
      + *
      $handle->image_text_position = 'LR';
    • + *
    • {@link image_text_padding} text label padding, in pixels. can be overridden by {@link image_text_padding_x} and {@link image_text_padding_y} (default: 0)
      + *
      $handle->image_text_padding = 5;
    • + *
    • {@link image_text_padding_x} text label horizontal padding (default: null)
      + *
      $handle->image_text_padding_x = 2;
    • + *
    • {@link image_text_padding_y} text label vertical padding (default: null)
      + *
      $handle->image_text_padding_y = 10;
    • + *
    • {@link image_text_alignment} text alignment when text has multiple lines, either 'L', 'C' or 'R' (default: 'C')
      + *
      $handle->image_text_alignment = 'R';
    • + *
    • {@link image_text_line_spacing} space between lines in pixels, when text has multiple lines (default: 0)
      + *
      $handle->image_text_line_spacing = 3;
    • + *
    + *
      + *
    • {@link image_flip} flips image, wither 'h' horizontal or 'v' vertical (default: null)
      + *
      $handle->image_flip = 'h';
    • + *
    • {@link image_rotate} rotates image. possible values are 90, 180 and 270 (default: null)
      + *
      $handle->image_rotate = 90;
    • + *
    • {@link image_crop} crops image. accepts 4, 2 or 1 values as 'T R B L' or 'TB LR' or 'TBLR'. dimension can be 20, or 20px or 20% (default: null)
      + *
      $handle->image_crop = array(50,40,30,20); OR '-20 20%'...
    • + *
    • {@link image_precrop} crops image, before an eventual resizing. accepts 4, 2 or 1 values as 'T R B L' or 'TB LR' or 'TBLR'. dimension can be 20, or 20px or 20% (default: null)
      + *
      $handle->image_precrop = array(50,40,30,20); OR '-20 20%'...
    • + *
    + *
      + *
    • {@link image_bevel} adds a bevel border to the image. value is thickness in pixels (default: null)
      + *
      $handle->image_bevel = 20;
    • + *
    • {@link image_bevel_color1} top and left bevel color, in hexadecimal (default: #FFFFFF)
      + *
      $handle->image_bevel_color1 = '#FFFFFF';
    • + *
    • {@link image_bevel_color2} bottom and right bevel color, in hexadecimal (default: #000000)
      + *
      $handle->image_bevel_color2 = '#000000';
    • + *
    • {@link image_border} adds a unicolor border to the image. accepts 4, 2 or 1 values as 'T R B L' or 'TB LR' or 'TBLR'. dimension can be 20, or 20px or 20% (default: null)
      + *
      $handle->image_border = '3px'; OR '-20 20%' OR array(3,2)...
    • + *
    • {@link image_border_color} border color, in hexadecimal (default: #FFFFFF)
      + *
      $handle->image_border_color = '#FFFFFF';
    • + *
    • {@link image_border_opacity} border opacity, integer between 0 and 100 (default: 100)
      + *
      $handle->image_border_opacity = 50;
    • + *
    • {@link image_border_transparent} adds a fading-to-transparent border to the image. accepts 4, 2 or 1 values as 'T R B L' or 'TB LR' or 'TBLR'. dimension can be 20, or 20px or 20% (default: null)
      + *
      $handle->image_border_transparent = '3px'; OR '-20 20%' OR array(3,2)...
    • + *
    • {@link image_frame} type of frame: 1=flat 2=crossed (default: null)
      + *
      $handle->image_frame = 2;
    • + *
    • {@link image_frame_colors} list of hex colors, in an array or a space separated string (default: '#FFFFFF #999999 #666666 #000000')
      + *
      $handle->image_frame_colors = array('#999999',  '#FF0000', '#666666', '#333333', '#000000');
    • + *
    • {@link image_frame_opacity} frame opacity, integer between 0 and 100 (default: 100)
      + *
      $handle->image_frame_opacity = 50;
    • + *
    + *
      + *
    • {@link image_watermark} adds a watermark on the image, value is a local filename. accepted files are GIF, JPG, BMP, PNG and PNG alpha (default: null)
      + *
      $handle->image_watermark = 'watermark.png';
    • + *
    • {@link image_watermark_x} absolute watermark position, in pixels from the left border. can be negative (default: null)
      + *
      $handle->image_watermark_x = 5;
    • + *
    • {@link image_watermark_y} absolute watermark position, in pixels from the top border. can be negative (default: null)
      + *
      $handle->image_watermark_y = 5;
    • + *
    • {@link image_watermark_position} watermark position withing the image, a combination of one or two from 'TBLR': top, bottom, left, right (default: null)
      + *
      $handle->image_watermark_position = 'LR';
    • + *
    • {@link image_watermark_no_zoom_in} prevents the watermark to be resized up if it is smaller than the image (default: true)
      + *
      $handle->image_watermark_no_zoom_in = false;
    • + *
    • {@link image_watermark_no_zoom_out} prevents the watermark to be resized down if it is bigger than the image (default: false)
      + *
      $handle->image_watermark_no_zoom_out = true;
    • + *
    + *
      + *
    • {@link image_reflection_height} if set, a reflection will be added. Format is either in pixels or percentage, such as 40, '40', '40px' or '40%' (default: null)
      + *
      $handle->image_reflection_height = '25%';
    • + *
    • {@link image_reflection_space} space in pixels between the source image and the reflection, can be negative (default: null)
      + *
      $handle->image_reflection_space = 3;
    • + *
    • {@link image_reflection_color} reflection background color, in hexadecimal. Now deprecated in favor of {@link image_default_color} (default: #FFFFFF)
      + *
      $handle->image_default_color = '#000000';
    • + *
    • {@link image_reflection_opacity} opacity level at which the reflection starts, integer between 0 and 100 (default: 60)
      + *
      $handle->image_reflection_opacity = 60;
    • + *
    + * + * Values that can be read before calling {@link process}() + *
      + *
    • {@link file_src_name} Source file name
    • + *
    • {@link file_src_name_body} Source file name body
    • + *
    • {@link file_src_name_ext} Source file extension
    • + *
    • {@link file_src_pathname} Source file complete path and name
    • + *
    • {@link file_src_mime} Source file mime type
    • + *
    • {@link file_src_size} Source file size in bytes
    • + *
    • {@link file_src_error} Upload error code
    • + *
    • {@link file_is_image} Boolean flag, true if the file is a supported image type
    • + *
    + * If the file is a supported image type (and open_basedir restrictions allow it) + *
      + *
    • {@link image_src_x} Source file width in pixels
    • + *
    • {@link image_src_y} Source file height in pixels
    • + *
    • {@link image_src_pixels} Source file number of pixels
    • + *
    • {@link image_src_type} Source file type (png, jpg, gif or bmp)
    • + *
    • {@link image_src_bits} Source file color depth
    • + *
    + * + * Values that can be read after calling {@link process}() + *
      + *
    • {@link file_dst_path} Destination file path
    • + *
    • {@link file_dst_name_body} Destination file name body
    • + *
    • {@link file_dst_name_ext} Destination file extension
    • + *
    • {@link file_dst_name} Destination file name
    • + *
    • {@link file_dst_pathname} Destination file complete path and name
    • + *
    + * If the file is a supported image type + *
      + *
    • {@link image_dst_type} Destination file type (png, jpg, gif or bmp)
    • + *
    • {@link image_dst_x} Destination file width
    • + *
    • {@link image_dst_y} Destination file height
    • + *
    + * + * Requirements + * + * Most of the image operations require GD. GD2 is greatly recommended + * + * The class requires PHP 4.3+, and is compatible with PHP5 + * + * Changelog + *
      + *
    • v 0.33dev 28/03/2014
      + * - added {@link image_dst_type}
      + * - fixed filesize when using XMLHttpRequest
      + * - added Hungarian translation
      + * - fixed Turkish translation
      + * - updated regex rules for MIME detection
      + * - added composer.json
    • + *
    • v 0.32 15/01/2013
      + * - add support for XMLHttpRequest uploads
      + * - added {@link image_pixelate}
      + * - added {@link image_interlace}
      + * - added {@link png_compression} to change PNG compressoin level
      + * - deactivate exec() if Suhosin is enabled
      + * - add more extension to dangerous scripts detection
      + * - imagejpeg takes null as second argument since PHP 5.4
      + * - default PECL Fileinfo MAGIC path to null
      + * - set gd.jpeg_ignore_warning to true by default
      + * - fixed file name normalization
    • + *
    • v 0.31 11/04/2011
      + * - added application/x-rar MIME type
      + * - make sure exec() and ini_get_all()function are not disabled if we want to use them
      + * - make sure that we don't divide by zero when calculating JPEG size
      + * - {@link allowed} and {@link forbidden} can now accept strings
      + * - try to guess the file extension from the MIME type if there is no file extension
      + * - better class properties when changing the file extension
      + * - added {@link file_force_extension} to allow extension-less files if needed
      + * - better file safe conversion of the filename
      + * - allow shorthand byte values, such as 1K, 2M, 3G for {@link file_max_size} and {@link jpeg_size}
      + * - added {@link image_opacity} to change picture opacity
      + * - added {@link image_border_opacity} to allow semi-transparent borders
      + * - added {@link image_frame_opacity} to allow semi-transparent frames
      + * - added {@link image_border_transparent} to allow borders fading to transparent
      + * - duplicated {@link image_overlay_percent} into {@link image_overlay_opacity}
      + * - duplicated {@link image_text_percent} into {@link image_text_opacity}
      + * - duplicated {@link image_text_background_percent} into {@link image_text_background_opacity}
    • + *
    • v 0.30 05/09/2010
      + * - implemented an unsharp mask, with alpha transparency support, activated if {@link image_unsharp} is true. added {@link image_unsharp_amount}, {@link image_unsharp_radius}, and {@link image_unsharp_threshold}
      + * - added text/rtf MIME type, and no_script exception
      + * - corrected bug when {@link no_script} is activated and several process() are called
      + * - better error handling for finfo
      + * - display upload_max_filesize information from php.ini in the log
      + * - automatic extension for extension-less images
      + * - fixed {@link image_ratio_fill} top and left filling
      + * - fixed alphablending issue when applying a transparent PNG watermark on a transparent PNG
      + * - added {@link image_watermark_no_zoom_in} and {@link image_watermark_no_zoom_out} to allow the watermark to be resized down (or up) to fit in the image. By default, the watermark may be resized down, but not up.
    • + *
    • v 0.29 03/02/2010
      + * - added protection against malicious images
      + * - added zip and torrent MIME type
      + * - replaced split() with explode()
      + * - initialise image_dst_x/y with image_src_x/y
      + * - removed {@link mime_fileinfo}, {@link mime_file}, {@link mime_magic} and {@link mime_getimagesize} from the docs since they are used before {@link process}
      + * - added more extensions and MIME types
      + * - improved MIME type validation
      + * - improved logging
    • + *
    • v 0.28 10/08/2009
      + * - replaced ereg functions to be compatible with PHP 5.3
      + * - added flv MIME type
      + * - improved MIME type detection
      + * - added {@link file_name_body_pre} to prepend a string to the file name
      + * - added {@link mime_fileinfo}, {@link mime_file}, {@link mime_magic} and {@link mime_getimagesize} so that it is possible to deactivate some MIME type checking method
      + * - use exec() rather than shell_exec(), to play better with safe mode
      + * - added some error messages
      + * - fix bug when checking on conditions, {@link processed} wasn't propagated properly
    • + *
    • v 0.27 14/05/2009
      + * - look for the language files directory from __FILE__
      + * - deactivate {@link file_auto_rename} if {@link file_overwrite} is set
      + * - improved transparency replacement for true color images
      + * - fixed calls to newer version of UNIX file utility
      + * - fixed error when using PECL Fileinfo extension in SAFE MODE, and when using the finfo class
      + * - added {@link image_precrop} to crop the image before an eventual resizing
    • + *
    • v 0.26 13/11/2008
      + * - rewrote conversion from palette to true color to handle transparency better
      + * - fixed imagecopymergealpha() when the overlayed image is of wrong dimensions
      + * - fixed imagecreatenew() when the image to create have less than 1 pixels width or height
      + * - rewrote MIME type detection to be more secure and not rely on browser information; now using Fileinfo PECL extension, UNIX file() command, MIME magic, and getimagesize(), in that order
      + * - added support for Flash uploaders
      + * - some bug fixing and error handling
    • + *
    • v 0.25 17/11/2007
      + * - added translation files and mechanism to instantiate the class with a language different from English
      + * - added {@link forbidden} to set an array of forbidden MIME types
      + * - implemented support for simple wildcards in {@link allowed} and {@link forbidden}, such as image/*
      + * - preset the file extension to the desired conversion format when converting an image
      + * - added read and write support for BMP images
      + * - added a flag {@link file_is_image} to determine if the file is a supported image type
      + * - the class now provides some information about the image, before calling {@link process}(). Available are {@link image_src_x}, {@link image_src_y} and the newly introduced {@link image_src_bits}, {@link image_src_pixels} and {@link image_src_type}. Note that this will not work if open_basedir restrictions are in place
      + * - improved logging; now provides useful system information
      + * - added some more pre-processing checks for files that are images: {@link image_max_width}, {@link image_max_height}, {@link image_max_pixels}, {@link image_max_ratio}, {@link image_min_width}, {@link image_min_height}, {@link image_min_pixels} and {@link image_min_ratio}
      + * - added {@link image_ratio_pixels} to resize an image to a number of pixels, keeping aspect ratio
      + * - added {@link image_is_palette} and {@link image_is_transparent} and {@link image_transparent_color} for GIF images
      + * - added {@link image_default_color} to define a fallback color for non alpha-transparent output formats, such as JPEG or BMP
      + * - changed {@link image_background_color}, which now forces transparent areas to be painted
      + * - improved reflections and color overlays so that it works with alpha transparent images
      + * - {@link image_reflection_color} is now deprecated in favour of {@link image_default_color}
      + * - transparent PNGs are now processed in true color, and fully preserving the alpha channel when doing merges
      + * - transparent GIFs are now automatically detected. {@link preserve_transparency} is deprecated
      + * - transparent true color images can be saved as GIF while retaining transparency, semi transparent areas being merged with {@link image_default_color}
      + * - transparent true color images can be saved as JPG/BMP with the semi transparent areas being merged with {@link image_default_color}
      + * - fixed conversion of images to true color
      + * - the class can now output the uploaded files content as the return value of process() if the function is called with an empty or null argumenti, or no argument
    • + *
    • v 0.24 25/05/2007
      + * - added {@link image_background_color}, to set the default background color of an image
      + * - added possibility of using replacement tokens in text labels
      + * - changed default JPEG quality to 85
      + * - fixed a small bug when using greyscale filter and associated filters
      + * - added {@link image_ratio_fill} in order to fit an image within some dimensions and color the remaining space. Very similar to {@link image_ratio_crop}
      + * - improved the recursive creation of directories
      + * - the class now converts palette based images to true colors before doing graphic manipulations
    • + *
    • v 0.23 23/12/2006
      + * - fixed a bug when processing more than once the same uploaded file. If there is an open_basedir restriction, the class now creates a temporary file for the first call to process(). This file will be used for subsequent processes, and will be deleted upon calling clean()
    • + *
    • v 0.22 16/12/2006
      + * - added automatic creation of a temporary file if the upload directory is not within open_basedir
      + * - fixed a bug which was preventing to work on a local file by overwriting it with its processed copy
      + * - added MIME types video/x-ms-wmv and image/x-png and fixed PNG support for IE weird MIME types
      + * - modified {@link image_ratio_crop} so it can accept one or more from string 'TBLR', determining which side of the image is kept while cropping
      + * - added support for multiple lines in the text, using "\n" as a line break
      + * - added {@link image_text_line_spacing} which allow to set the space between several lines of text
      + * - added {@link image_text_alignment} which allow to set the alignment when text has several lines
      + * - {@link image_text_font} can now be set to the path of a GDF font to load external fonts
      + * - added {@link image_reflection_height} to create a reflection of the source image, which height is in pixels or percentage
      + * - added {@link image_reflection_space} to set the space in pixels between the source image and the reflection
      + * - added {@link image_reflection_color} to set the reflection background color
      + * - added {@link image_reflection_opacity} to set the initial level of opacity of the reflection
    • + *
    • v 0.21 30/09/2006
      + * - added {@link image_ratio_crop} which resizes within {@link image_x} and {@link image_y}, keeping ratio, but filling the space by cropping excedent of image
      + * - added {@link mime_check}, which default is true, to set checks against {@link allowed} MIME list
      + * - if MIME is empty, the class now triggers an error
      + * - color #000000 is OK for {@link image_text_color}, and related text transparency bug fixed
      + * - {@link gd_version}() now uses gd_info(), or else phpinfo()
      + * - fixed path issue when the destination path has no trailing slash on Windows systems
      + * - removed inline functions to be fully PHP5 compatible
    • + *
    • v 0.20 11/08/2006
      + * - added some more error checking and messages (GD presence, permissions...)
      + * - fix when uploading files without extension
      + * - changed values for {@link image_brightness} and {@link image_contrast} to be between -127 and 127
      + * - added {@link dir_auto_create} to automatically and recursively create destination directory if missing.
      + * - added {@link dir_auto_chmod} to automatically chmod the destination directory if not writeable.
      + * - added {@link dir_chmod} to set the default chmod to use.
      + * - added {@link image_crop} to crop images
      + * - added {@link image_negative} to invert the colors on the image
      + * - added {@link image_greyscale} to turn the image into greyscale
      + * - added {@link image_threshold} to apply a threshold filter on the image
      + * - added {@link image_bevel}, {@link image_bevel_color1} and {@link image_bevel_color2} to add a bevel border
      + * - added {@link image_border} and {@link image_border_color} to add a single color border
      + * - added {@link image_frame} and {@link image_frame_colors} to add a multicolored frame
    • + *
    • v 0.19 29/03/2006
      + * - class is now compatible i18n (thanks Sylwester).
      + * - the class can mow manipulate local files, not only uploaded files (instanciate the class with a local filename).
      + * - {@link file_safe_name} has been improved a bit.
      + * - added {@link image_brightness}, {@link image_contrast}, {@link image_tint_color}, {@link image_overlay_color} and {@link image_overlay_percent} to do color manipulation on the images.
      + * - added {@link image_text} and all derivated settings to add a text label on the image.
      + * - added {@link image_watermark} and all derivated settings to add a watermark image on the image.
      + * - added {@link image_flip} and {@link image_rotate} for more image manipulations
      + * - added {@link jpeg_size} to calculate the JPG compression quality in order to fit within one filesize.
    • + *
    • v 0.18 02/02/2006
      + * - added {@link no_script} to turn dangerous scripts into text files.
      + * - added {@link mime_magic_check} to set the class to use mime_magic.
      + * - added {@link preserve_transparency} *experimental*. Thanks Gregor.
      + * - fixed size and mime checking, wasn't working :/ Thanks Willem.
      + * - fixed memory leak when resizing images.
      + * - when resizing, it is not necessary anymore to set {@link image_convert}.
      + * - il is now possible to simply convert an image, with no resizing.
      + * - sets the default {@link file_max_size} to upload_max_filesize from php.ini. Thanks Edward
    • + *
    • v 0.17 28/05/2005
      + * - the class can be used with any version of GD.
      + * - added security check on the file with a list of mime-types.
      + * - changed the license to GPL v2 only
    • + *
    • v 0.16 19/05/2005
      + * - added {@link file_auto_rename} automatic file renaming if the same filename already exists.
      + * - added {@link file_safe_name} safe formatting of the filename (spaces to _underscores so far).
      + * - added some more error reporting to avoid crash if GD is not present
    • + *
    • v 0.15 16/04/2005
      + * - added JPEG compression quality setting. Thanks Vad
    • + *
    • v 0.14 14/03/2005
      + * - reworked the class file to allow parsing with phpDocumentor
    • + *
    • v 0.13 07/03/2005
      + * - fixed a bug with {@link image_ratio}. Thanks Justin.
      + * - added {@link image_ratio_no_zoom_in} and {@link image_ratio_no_zoom_out}
    • + *
    • v 0.12 21/01/2005
      + * - added {@link image_ratio} to resize within max values, keeping image ratio
    • + *
    • v 0.11 22/08/2003
      + * - update for GD2 (changed imageresized() into imagecopyresampled() and imagecreate() into imagecreatetruecolor())
    • + *
    + * + * @package cmf + * @subpackage external + */ +class upload { + + + /** + * Class version + * + * @access public + * @var string + */ + var $version; + + /** + * Uploaded file name + * + * @access public + * @var string + */ + var $file_src_name; + + /** + * Uploaded file name body (i.e. without extension) + * + * @access public + * @var string + */ + var $file_src_name_body; + + /** + * Uploaded file name extension + * + * @access public + * @var string + */ + var $file_src_name_ext; + + /** + * Uploaded file MIME type + * + * @access public + * @var string + */ + var $file_src_mime; + + /** + * Uploaded file size, in bytes + * + * @access public + * @var double + */ + var $file_src_size; + + /** + * Holds eventual PHP error code from $_FILES + * + * @access public + * @var string + */ + var $file_src_error; + + /** + * Uloaded file name, including server path + * + * @access public + * @var string + */ + var $file_src_pathname; + + /** + * Uloaded file name temporary copy + * + * @access private + * @var string + */ + var $file_src_temp; + + /** + * Destination file name + * + * @access public + * @var string + */ + var $file_dst_path; + + /** + * Destination file name + * + * @access public + * @var string + */ + var $file_dst_name; + + /** + * Destination file name body (i.e. without extension) + * + * @access public + * @var string + */ + var $file_dst_name_body; + + /** + * Destination file extension + * + * @access public + * @var string + */ + var $file_dst_name_ext; + + /** + * Destination file name, including path + * + * @access public + * @var string + */ + var $file_dst_pathname; + + /** + * Source image width + * + * @access public + * @var integer + */ + var $image_src_x; + + /** + * Source image height + * + * @access public + * @var integer + */ + var $image_src_y; + + /** + * Source image color depth + * + * @access public + * @var integer + */ + var $image_src_bits; + + /** + * Number of pixels + * + * @access public + * @var long + */ + var $image_src_pixels; + + /** + * Type of image (png, gif, jpg or bmp) + * + * @access public + * @var string + */ + var $image_src_type; + + /** + * Destination image width + * + * @access public + * @var integer + */ + var $image_dst_x; + + /** + * Destination image height + * + * @access public + * @var integer + */ + var $image_dst_y; + + /** + * Destination image type (png, gif, jpg or bmp) + * + * @access public + * @var integer + */ + var $image_dst_type; + + /** + * Supported image formats + * + * @access private + * @var array + */ + var $image_supported; + + /** + * Flag to determine if the source file is an image + * + * @access public + * @var boolean + */ + var $file_is_image; + + /** + * Flag set after instanciating the class + * + * Indicates if the file has been uploaded properly + * + * @access public + * @var bool + */ + var $uploaded; + + /** + * Flag stopping PHP upload checks + * + * Indicates whether we instanciated the class with a filename, in which case + * we will not check on the validity of the PHP *upload* + * + * This flag is automatically set to true when working on a local file + * + * Warning: for uploads, this flag MUST be set to false for security reason + * + * @access public + * @var bool + */ + var $no_upload_check; + + /** + * Flag set after calling a process + * + * Indicates if the processing, and copy of the resulting file went OK + * + * @access public + * @var bool + */ + var $processed; + + /** + * Holds eventual error message in plain english + * + * @access public + * @var string + */ + var $error; + + /** + * Holds an HTML formatted log + * + * @access public + * @var string + */ + var $log; + + + // overiddable processing variables + + + /** + * Set this variable to replace the name body (i.e. without extension) + * + * @access public + * @var string + */ + var $file_new_name_body; + + /** + * Set this variable to append a string to the file name body + * + * @access public + * @var string + */ + var $file_name_body_add; + + /** + * Set this variable to prepend a string to the file name body + * + * @access public + * @var string + */ + var $file_name_body_pre; + + /** + * Set this variable to change the file extension + * + * @access public + * @var string + */ + var $file_new_name_ext; + + /** + * Set this variable to format the filename (spaces changed to _) + * + * @access public + * @var boolean + */ + var $file_safe_name; + + /** + * Forces an extension if the source file doesn't have one + * + * If the file is an image, then the correct extension will be added + * Otherwise, a .txt extension will be chosen + * + * @access public + * @var boolean + */ + var $file_force_extension; + + /** + * Set this variable to false if you don't want to check the MIME against the allowed list + * + * This variable is set to true by default for security reason + * + * @access public + * @var boolean + */ + var $mime_check; + + /** + * Set this variable to false in the init() function if you don't want to check the MIME + * with Fileinfo PECL extension. On some systems, Fileinfo is known to be buggy, and you + * may want to deactivate it in the class code directly. + * + * You can also set it with the path of the magic database file. + * If set to true, the class will try to read the MAGIC environment variable + * and if it is empty, will default to the system's default + * If set to an empty string, it will call finfo_open without the path argument + * + * This variable is set to true by default for security reason + * + * @access public + * @var boolean + */ + var $mime_fileinfo; + + /** + * Set this variable to false in the init() function if you don't want to check the MIME + * with UNIX file() command + * + * This variable is set to true by default for security reason + * + * @access public + * @var boolean + */ + var $mime_file; + + /** + * Set this variable to false in the init() function if you don't want to check the MIME + * with the magic.mime file + * + * The function mime_content_type() will be deprecated, + * and this variable will be set to false in a future release + * + * This variable is set to true by default for security reason + * + * @access public + * @var boolean + */ + var $mime_magic; + + /** + * Set this variable to false in the init() function if you don't want to check the MIME + * with getimagesize() + * + * The class tries to get a MIME type from getimagesize() + * If no MIME is returned, it tries to guess the MIME type from the file type + * + * This variable is set to true by default for security reason + * + * @access public + * @var boolean + */ + var $mime_getimagesize; + + /** + * Set this variable to false if you don't want to turn dangerous scripts into simple text files + * + * @access public + * @var boolean + */ + var $no_script; + + /** + * Set this variable to true to allow automatic renaming of the file + * if the file already exists + * + * Default value is true + * + * For instance, on uploading foo.ext,
    + * if foo.ext already exists, upload will be renamed foo_1.ext
    + * and if foo_1.ext already exists, upload will be renamed foo_2.ext
    + * + * Note that this option doesn't have any effect if {@link file_overwrite} is true + * + * @access public + * @var bool + */ + var $file_auto_rename; + + /** + * Set this variable to true to allow automatic creation of the destination + * directory if it is missing (works recursively) + * + * Default value is true + * + * @access public + * @var bool + */ + var $dir_auto_create; + + /** + * Set this variable to true to allow automatic chmod of the destination + * directory if it is not writeable + * + * Default value is true + * + * @access public + * @var bool + */ + var $dir_auto_chmod; + + /** + * Set this variable to the default chmod you want the class to use + * when creating directories, or attempting to write in a directory + * + * Default value is 0777 (without quotes) + * + * @access public + * @var bool + */ + var $dir_chmod; + + /** + * Set this variable tu true to allow overwriting of an existing file + * + * Default value is false, so no files will be overwritten + * + * @access public + * @var bool + */ + var $file_overwrite; + + /** + * Set this variable to change the maximum size in bytes for an uploaded file + * + * Default value is the value upload_max_filesize from php.ini + * + * Value in bytes (integer) or shorthand byte values (string) is allowed. + * The available options are K (for Kilobytes), M (for Megabytes) and G (for Gigabytes) + * + * @access public + * @var double + */ + var $file_max_size; + + /** + * Set this variable to true to resize the file if it is an image + * + * You will probably want to set {@link image_x} and {@link image_y}, and maybe one of the ratio variables + * + * Default value is false (no resizing) + * + * @access public + * @var bool + */ + var $image_resize; + + /** + * Set this variable to convert the file if it is an image + * + * Possibles values are : ''; 'png'; 'jpeg'; 'gif'; 'bmp' + * + * Default value is '' (no conversion)
    + * If {@link resize} is true, {@link convert} will be set to the source file extension + * + * @access public + * @var string + */ + var $image_convert; + + /** + * Set this variable to the wanted (or maximum/minimum) width for the processed image, in pixels + * + * Default value is 150 + * + * @access public + * @var integer + */ + var $image_x; + + /** + * Set this variable to the wanted (or maximum/minimum) height for the processed image, in pixels + * + * Default value is 150 + * + * @access public + * @var integer + */ + var $image_y; + + /** + * Set this variable to keep the original size ratio to fit within {@link image_x} x {@link image_y} + * + * Default value is false + * + * @access public + * @var bool + */ + var $image_ratio; + + /** + * Set this variable to keep the original size ratio to fit within {@link image_x} x {@link image_y} + * + * The image will be resized as to fill the whole space, and excedent will be cropped + * + * Value can also be a string, one or more character from 'TBLR' (top, bottom, left and right) + * If set as a string, it determines which side of the image is kept while cropping. + * By default, the part of the image kept is in the center, i.e. it crops equally on both sides + * + * Default value is false + * + * @access public + * @var mixed + */ + var $image_ratio_crop; + + /** + * Set this variable to keep the original size ratio to fit within {@link image_x} x {@link image_y} + * + * The image will be resized to fit entirely in the space, and the rest will be colored. + * The default color is white, but can be set with {@link image_default_color} + * + * Value can also be a string, one or more character from 'TBLR' (top, bottom, left and right) + * If set as a string, it determines in which side of the space the image is displayed. + * By default, the image is displayed in the center, i.e. it fills the remaining space equally on both sides + * + * Default value is false + * + * @access public + * @var mixed + */ + var $image_ratio_fill; + + /** + * Set this variable to a number of pixels so that {@link image_x} and {@link image_y} are the best match possible + * + * The image will be resized to have approximatively the number of pixels + * The aspect ratio wil be conserved + * + * Default value is false + * + * @access public + * @var mixed + */ + var $image_ratio_pixels; + + /** + * Set this variable to keep the original size ratio to fit within {@link image_x} x {@link image_y}, + * but only if original image is bigger + * + * Default value is false + * + * @access public + * @var bool + */ + var $image_ratio_no_zoom_in; + + /** + * Set this variable to keep the original size ratio to fit within {@link image_x} x {@link image_y}, + * but only if original image is smaller + * + * Default value is false + * + * @access public + * @var bool + */ + var $image_ratio_no_zoom_out; + + /** + * Set this variable to calculate {@link image_x} automatically , using {@link image_y} and conserving ratio + * + * Default value is false + * + * @access public + * @var bool + */ + var $image_ratio_x; + + /** + * Set this variable to calculate {@link image_y} automatically , using {@link image_x} and conserving ratio + * + * Default value is false + * + * @access public + * @var bool + */ + var $image_ratio_y; + + /** + * Set this variable to set a maximum image width, above which the upload will be invalid + * + * Default value is null + * + * @access public + * @var integer + */ + var $image_max_width; + + /** + * Set this variable to set a maximum image height, above which the upload will be invalid + * + * Default value is null + * + * @access public + * @var integer + */ + var $image_max_height; + + /** + * Set this variable to set a maximum number of pixels for an image, above which the upload will be invalid + * + * Default value is null + * + * @access public + * @var long + */ + var $image_max_pixels; + + /** + * Set this variable to set a maximum image aspect ratio, above which the upload will be invalid + * + * Note that ratio = width / height + * + * Default value is null + * + * @access public + * @var float + */ + var $image_max_ratio; + + /** + * Set this variable to set a minimum image width, below which the upload will be invalid + * + * Default value is null + * + * @access public + * @var integer + */ + var $image_min_width; + + /** + * Set this variable to set a minimum image height, below which the upload will be invalid + * + * Default value is null + * + * @access public + * @var integer + */ + var $image_min_height; + + /** + * Set this variable to set a minimum number of pixels for an image, below which the upload will be invalid + * + * Default value is null + * + * @access public + * @var long + */ + var $image_min_pixels; + + /** + * Set this variable to set a minimum image aspect ratio, below which the upload will be invalid + * + * Note that ratio = width / height + * + * Default value is null + * + * @access public + * @var float + */ + var $image_min_ratio; + + /** + * Compression level for PNG images + * + * Between 1 (fast but large files) and 9 (slow but smaller files) + * + * Default value is null (Zlib default) + * + * @access public + * @var integer + */ + var $png_compression; + + /** + * Quality of JPEG created/converted destination image + * + * Default value is 85 + * + * @access public + * @var integer + */ + var $jpeg_quality; + + /** + * Determines the quality of the JPG image to fit a desired file size + * + * The JPG quality will be set between 1 and 100% + * The calculations are approximations. + * + * Value in bytes (integer) or shorthand byte values (string) is allowed. + * The available options are K (for Kilobytes), M (for Megabytes) and G (for Gigabytes) + * + * Default value is null (no calculations) + * + * @access public + * @var integer + */ + var $jpeg_size; + + /** + * Turns the interlace bit on + * + * This is actually used only for JPEG images, and defaults to false + * + * @access public + * @var boolean + */ + var $image_interlace; + + /** + * Preserve transparency when resizing or converting an image (deprecated) + * + * Default value is automatically set to true for transparent GIFs + * This setting is now deprecated + * + * @access public + * @var integer + */ + var $preserve_transparency; + + /** + * Flag set to true when the image is transparent + * + * This is actually used only for transparent GIFs + * + * @access public + * @var boolean + */ + var $image_is_transparent; + + /** + * Transparent color in a palette + * + * This is actually used only for transparent GIFs + * + * @access public + * @var boolean + */ + var $image_transparent_color; + + /** + * Background color, used to paint transparent areas with + * + * If set, it will forcibly remove transparency by painting transparent areas with the color + * This setting will fill in all transparent areas in PNG and GIF, as opposed to {@link image_default_color} + * which will do so only in BMP, JPEG, and alpha transparent areas in transparent GIFs + * This setting overrides {@link image_default_color} + * + * Default value is null + * + * @access public + * @var string + */ + var $image_background_color; + + /** + * Default color for non alpha-transparent images + * + * This setting is to be used to define a background color for semi transparent areas + * of an alpha transparent when the output format doesn't support alpha transparency + * This is useful when, from an alpha transparent PNG image, or an image with alpha transparent features + * if you want to output it as a transparent GIFs for instance, you can set a blending color for transparent areas + * If you output in JPEG or BMP, this color will be used to fill in the previously transparent areas + * + * The default color white + * + * @access public + * @var boolean + */ + var $image_default_color; + + /** + * Flag set to true when the image is not true color + * + * @access public + * @var boolean + */ + var $image_is_palette; + + /** + * Corrects the image brightness + * + * Value can range between -127 and 127 + * + * Default value is null + * + * @access public + * @var integer + */ + var $image_brightness; + + /** + * Corrects the image contrast + * + * Value can range between -127 and 127 + * + * Default value is null + * + * @access public + * @var integer + */ + var $image_contrast; + + /** + * Changes the image opacity + * + * Value can range between 0 and 100 + * + * Default value is null + * + * @access public + * @var integer + */ + var $image_opacity; + + /** + * Applies threshold filter + * + * Value can range between -127 and 127 + * + * Default value is null + * + * @access public + * @var integer + */ + var $image_threshold; + + /** + * Applies a tint on the image + * + * Value is an hexadecimal color, such as #FFFFFF + * + * Default value is null + * + * @access public + * @var string; + */ + var $image_tint_color; + + /** + * Applies a colored overlay on the image + * + * Value is an hexadecimal color, such as #FFFFFF + * + * To use with {@link image_overlay_opacity} + * + * Default value is null + * + * @access public + * @var string; + */ + var $image_overlay_color; + + /** + * Sets the opacity for the colored overlay + * + * Value is a percentage, as an integer between 0 (transparent) and 100 (opaque) + * + * Unless used with {@link image_overlay_color}, this setting has no effect + * + * Default value is 50 + * + * @access public + * @var integer + */ + var $image_overlay_opacity; + + /** + * Soon to be deprecated old form of {@link image_overlay_opacity} + * + * @access public + * @var integer + */ + var $image_overlay_percent; + + /** + * Inverts the color of an image + * + * Default value is FALSE + * + * @access public + * @var boolean; + */ + var $image_negative; + + /** + * Turns the image into greyscale + * + * Default value is FALSE + * + * @access public + * @var boolean; + */ + var $image_greyscale; + + /** + * Pixelate an image + * + * Value is integer, represents the block size + * + * Default value is null + * + * @access public + * @var integer; + */ + var $image_pixelate; + + /** + * Applies an unsharp mask, with alpha transparency support + * + * Beware that this unsharp mask is quite resource-intensive + * + * Default value is FALSE + * + * @access public + * @var boolean; + */ + var $image_unsharp; + + /** + * Sets the unsharp mask amount + * + * Value is an integer between 0 and 500, typically between 50 and 200 + * + * Unless used with {@link image_unsharp}, this setting has no effect + * + * Default value is 80 + * + * @access public + * @var integer + */ + var $image_unsharp_amount; + + /** + * Sets the unsharp mask radius + * + * Value is an integer between 0 and 50, typically between 0.5 and 1 + * It is not recommended to change it, the default works best + * + * Unless used with {@link image_unsharp}, this setting has no effect + * + * From PHP 5.1, imageconvolution is used, and this setting has no effect + * + * Default value is 0.5 + * + * @access public + * @var integer + */ + var $image_unsharp_radius; + + /** + * Sets the unsharp mask threshold + * + * Value is an integer between 0 and 255, typically between 0 and 5 + * + * Unless used with {@link image_unsharp}, this setting has no effect + * + * Default value is 1 + * + * @access public + * @var integer + */ + var $image_unsharp_threshold; + + /** + * Adds a text label on the image + * + * Value is a string, any text. Text will not word-wrap, although you can use breaklines in your text "\n" + * + * If set, this setting allow the use of all other settings starting with image_text_ + * + * Replacement tokens can be used in the string: + *
    +     * gd_version    src_name       src_name_body src_name_ext
    +     * src_pathname  src_mime       src_x         src_y
    +     * src_type      src_bits       src_pixels
    +     * src_size      src_size_kb    src_size_mb   src_size_human
    +     * dst_path      dst_name_body  dst_pathname
    +     * dst_name      dst_name_ext   dst_x         dst_y
    +     * date          time           host          server        ip
    +     * 
    + * The tokens must be enclosed in square brackets: [dst_x] will be replaced by the width of the picture + * + * Default value is null + * + * @access public + * @var string; + */ + var $image_text; + + /** + * Sets the text direction for the text label + * + * Value is either 'h' or 'v', as in horizontal and vertical + * + * Default value is h (horizontal) + * + * @access public + * @var string; + */ + var $image_text_direction; + + /** + * Sets the text color for the text label + * + * Value is an hexadecimal color, such as #FFFFFF + * + * Default value is #FFFFFF (white) + * + * @access public + * @var string; + */ + var $image_text_color; + + /** + * Sets the text opacity in the text label + * + * Value is a percentage, as an integer between 0 (transparent) and 100 (opaque) + * + * Default value is 100 + * + * @access public + * @var integer + */ + var $image_text_opacity; + + /** + * Soon to be deprecated old form of {@link image_text_opacity} + * + * @access public + * @var integer + */ + var $image_text_percent; + + /** + * Sets the text background color for the text label + * + * Value is an hexadecimal color, such as #FFFFFF + * + * Default value is null (no background) + * + * @access public + * @var string; + */ + var $image_text_background; + + /** + * Sets the text background opacity in the text label + * + * Value is a percentage, as an integer between 0 (transparent) and 100 (opaque) + * + * Default value is 100 + * + * @access public + * @var integer + */ + var $image_text_background_opacity; + + /** + * Soon to be deprecated old form of {@link image_text_background_opacity} + * + * @access public + * @var integer + */ + var $image_text_background_percent; + + /** + * Sets the text font in the text label + * + * Value is a an integer between 1 and 5 for GD built-in fonts. 1 is the smallest font, 5 the biggest + * Value can also be a string, which represents the path to a GDF font. The font will be loaded into GD, and used as a built-in font. + * + * Default value is 5 + * + * @access public + * @var mixed; + */ + var $image_text_font; + + /** + * Sets the text label position within the image + * + * Value is one or two out of 'TBLR' (top, bottom, left, right) + * + * The positions are as following: + *
    +     *                        TL  T  TR
    +     *                        L       R
    +     *                        BL  B  BR
    +     * 
    + * + * Default value is null (centered, horizontal and vertical) + * + * Note that is {@link image_text_x} and {@link image_text_y} are used, this setting has no effect + * + * @access public + * @var string; + */ + var $image_text_position; + + /** + * Sets the text label absolute X position within the image + * + * Value is in pixels, representing the distance between the left of the image and the label + * If a negative value is used, it will represent the distance between the right of the image and the label + * + * Default value is null (so {@link image_text_position} is used) + * + * @access public + * @var integer + */ + var $image_text_x; + + /** + * Sets the text label absolute Y position within the image + * + * Value is in pixels, representing the distance between the top of the image and the label + * If a negative value is used, it will represent the distance between the bottom of the image and the label + * + * Default value is null (so {@link image_text_position} is used) + * + * @access public + * @var integer + */ + var $image_text_y; + + /** + * Sets the text label padding + * + * Value is in pixels, representing the distance between the text and the label background border + * + * Default value is 0 + * + * This setting can be overriden by {@link image_text_padding_x} and {@link image_text_padding_y} + * + * @access public + * @var integer + */ + var $image_text_padding; + + /** + * Sets the text label horizontal padding + * + * Value is in pixels, representing the distance between the text and the left and right label background borders + * + * Default value is null + * + * If set, this setting overrides the horizontal part of {@link image_text_padding} + * + * @access public + * @var integer + */ + var $image_text_padding_x; + + /** + * Sets the text label vertical padding + * + * Value is in pixels, representing the distance between the text and the top and bottom label background borders + * + * Default value is null + * + * If set, his setting overrides the vertical part of {@link image_text_padding} + * + * @access public + * @var integer + */ + var $image_text_padding_y; + + /** + * Sets the text alignment + * + * Value is a string, which can be either 'L', 'C' or 'R' + * + * Default value is 'C' + * + * This setting is relevant only if the text has several lines. + * + * @access public + * @var string; + */ + var $image_text_alignment; + + /** + * Sets the text line spacing + * + * Value is an integer, in pixels + * + * Default value is 0 + * + * This setting is relevant only if the text has several lines. + * + * @access public + * @var integer + */ + var $image_text_line_spacing; + + /** + * Sets the height of the reflection + * + * Value is an integer in pixels, or a string which format can be in pixels or percentage. + * For instance, values can be : 40, '40', '40px' or '40%' + * + * Default value is null, no reflection + * + * @access public + * @var mixed; + */ + var $image_reflection_height; + + /** + * Sets the space between the source image and its relection + * + * Value is an integer in pixels, which can be negative + * + * Default value is 2 + * + * This setting is relevant only if {@link image_reflection_height} is set + * + * @access public + * @var integer + */ + var $image_reflection_space; + + /** + * Sets the color of the reflection background (deprecated) + * + * Value is an hexadecimal color, such as #FFFFFF + * + * Default value is #FFFFFF + * + * This setting is relevant only if {@link image_reflection_height} is set + * + * This setting is now deprecated in favor of {@link image_default_color} + * + * @access public + * @var string; + */ + var $image_reflection_color; + + /** + * Sets the initial opacity of the reflection + * + * Value is an integer between 0 (no opacity) and 100 (full opacity). + * The reflection will start from {@link image_reflection_opacity} and end up at 0 + * + * Default value is 60 + * + * This setting is relevant only if {@link image_reflection_height} is set + * + * @access public + * @var integer + */ + var $image_reflection_opacity; + + /** + * Flips the image vertically or horizontally + * + * Value is either 'h' or 'v', as in horizontal and vertical + * + * Default value is null (no flip) + * + * @access public + * @var string; + */ + var $image_flip; + + /** + * Rotates the image by increments of 45 degrees + * + * Value is either 90, 180 or 270 + * + * Default value is null (no rotation) + * + * @access public + * @var string; + */ + var $image_rotate; + + /** + * Crops an image + * + * Values are four dimensions, or two, or one (CSS style) + * They represent the amount cropped top, right, bottom and left. + * These values can either be in an array, or a space separated string. + * Each value can be in pixels (with or without 'px'), or percentage (of the source image) + * + * For instance, are valid: + *
    +     * $foo->image_crop = 20                  OR array(20);
    +     * $foo->image_crop = '20px'              OR array('20px');
    +     * $foo->image_crop = '20 40'             OR array('20', 40);
    +     * $foo->image_crop = '-20 25%'           OR array(-20, '25%');
    +     * $foo->image_crop = '20px 25%'          OR array('20px', '25%');
    +     * $foo->image_crop = '20% 25%'           OR array('20%', '25%');
    +     * $foo->image_crop = '20% 25% 10% 30%'   OR array('20%', '25%', '10%', '30%');
    +     * $foo->image_crop = '20px 25px 2px 2px' OR array('20px', '25%px', '2px', '2px');
    +     * $foo->image_crop = '20 25% 40px 10%'   OR array(20, '25%', '40px', '10%');
    +     * 
    + * + * If a value is negative, the image will be expanded, and the extra parts will be filled with black + * + * Default value is null (no cropping) + * + * @access public + * @var string OR array; + */ + var $image_crop; + + /** + * Crops an image, before an eventual resizing + * + * See {@link image_crop} for valid formats + * + * Default value is null (no cropping) + * + * @access public + * @var string OR array; + */ + var $image_precrop; + + /** + * Adds a bevel border on the image + * + * Value is a positive integer, representing the thickness of the bevel + * + * If the bevel colors are the same as the background, it makes a fade out effect + * + * Default value is null (no bevel) + * + * @access public + * @var integer + */ + var $image_bevel; + + /** + * Top and left bevel color + * + * Value is a color, in hexadecimal format + * This setting is used only if {@link image_bevel} is set + * + * Default value is #FFFFFF + * + * @access public + * @var string; + */ + var $image_bevel_color1; + + /** + * Right and bottom bevel color + * + * Value is a color, in hexadecimal format + * This setting is used only if {@link image_bevel} is set + * + * Default value is #000000 + * + * @access public + * @var string; + */ + var $image_bevel_color2; + + /** + * Adds a single-color border on the outer of the image + * + * Values are four dimensions, or two, or one (CSS style) + * They represent the border thickness top, right, bottom and left. + * These values can either be in an array, or a space separated string. + * Each value can be in pixels (with or without 'px'), or percentage (of the source image) + * + * See {@link image_crop} for valid formats + * + * If a value is negative, the image will be cropped. + * Note that the dimensions of the picture will be increased by the borders' thickness + * + * Default value is null (no border) + * + * @access public + * @var integer + */ + var $image_border; + + /** + * Border color + * + * Value is a color, in hexadecimal format. + * This setting is used only if {@link image_border} is set + * + * Default value is #FFFFFF + * + * @access public + * @var string; + */ + var $image_border_color; + + /** + * Sets the opacity for the borders + * + * Value is a percentage, as an integer between 0 (transparent) and 100 (opaque) + * + * Unless used with {@link image_border}, this setting has no effect + * + * Default value is 100 + * + * @access public + * @var integer + */ + var $image_border_opacity; + + /** + * Adds a fading-to-transparent border on the image + * + * Values are four dimensions, or two, or one (CSS style) + * They represent the border thickness top, right, bottom and left. + * These values can either be in an array, or a space separated string. + * Each value can be in pixels (with or without 'px'), or percentage (of the source image) + * + * See {@link image_crop} for valid formats + * + * Note that the dimensions of the picture will not be increased by the borders' thickness + * + * Default value is null (no border) + * + * @access public + * @var integer + */ + var $image_border_transparent; + + /** + * Adds a multi-color frame on the outer of the image + * + * Value is an integer. Two values are possible for now: + * 1 for flat border, meaning that the frame is mirrored horizontally and vertically + * 2 for crossed border, meaning that the frame will be inversed, as in a bevel effect + * + * The frame will be composed of colored lines set in {@link image_frame_colors} + * + * Note that the dimensions of the picture will be increased by the borders' thickness + * + * Default value is null (no frame) + * + * @access public + * @var integer + */ + var $image_frame; + + /** + * Sets the colors used to draw a frame + * + * Values is a list of n colors in hexadecimal format. + * These values can either be in an array, or a space separated string. + * + * The colors are listed in the following order: from the outset of the image to its center + * + * For instance, are valid: + *
    +     * $foo->image_frame_colors = '#FFFFFF #999999 #666666 #000000';
    +     * $foo->image_frame_colors = array('#FFFFFF', '#999999', '#666666', '#000000');
    +     * 
    + * + * This setting is used only if {@link image_frame} is set + * + * Default value is '#FFFFFF #999999 #666666 #000000' + * + * @access public + * @var string OR array; + */ + var $image_frame_colors; + + /** + * Sets the opacity for the frame + * + * Value is a percentage, as an integer between 0 (transparent) and 100 (opaque) + * + * Unless used with {@link image_frame}, this setting has no effect + * + * Default value is 100 + * + * @access public + * @var integer + */ + var $image_frame_opacity; + + /** + * Adds a watermark on the image + * + * Value is a local image filename, relative or absolute. GIF, JPG, BMP and PNG are supported, as well as PNG alpha. + * + * If set, this setting allow the use of all other settings starting with image_watermark_ + * + * Default value is null + * + * @access public + * @var string; + */ + var $image_watermark; + + /** + * Sets the watermarkposition within the image + * + * Value is one or two out of 'TBLR' (top, bottom, left, right) + * + * The positions are as following: TL T TR + * L R + * BL B BR + * + * Default value is null (centered, horizontal and vertical) + * + * Note that is {@link image_watermark_x} and {@link image_watermark_y} are used, this setting has no effect + * + * @access public + * @var string; + */ + var $image_watermark_position; + + /** + * Sets the watermark absolute X position within the image + * + * Value is in pixels, representing the distance between the top of the image and the watermark + * If a negative value is used, it will represent the distance between the bottom of the image and the watermark + * + * Default value is null (so {@link image_watermark_position} is used) + * + * @access public + * @var integer + */ + var $image_watermark_x; + + /** + * Sets the twatermark absolute Y position within the image + * + * Value is in pixels, representing the distance between the left of the image and the watermark + * If a negative value is used, it will represent the distance between the right of the image and the watermark + * + * Default value is null (so {@link image_watermark_position} is used) + * + * @access public + * @var integer + */ + var $image_watermark_y; + + /** + * Prevents the watermark to be resized up if it is smaller than the image + * + * If the watermark if smaller than the destination image, taking in account the desired watermark position + * then it will be resized up to fill in the image (minus the {@link image_watermark_x} or {@link image_watermark_y} values) + * + * If you don't want your watermark to be resized in any way, then + * set {@link image_watermark_no_zoom_in} and {@link image_watermark_no_zoom_out} to true + * If you want your watermark to be resized up or doan to fill in the image better, then + * set {@link image_watermark_no_zoom_in} and {@link image_watermark_no_zoom_out} to false + * + * Default value is true (so the watermark will not be resized up, which is the behaviour most people expect) + * + * @access public + * @var integer + */ + var $image_watermark_no_zoom_in; + + /** + * Prevents the watermark to be resized down if it is bigger than the image + * + * If the watermark if bigger than the destination image, taking in account the desired watermark position + * then it will be resized down to fit in the image (minus the {@link image_watermark_x} or {@link image_watermark_y} values) + * + * If you don't want your watermark to be resized in any way, then + * set {@link image_watermark_no_zoom_in} and {@link image_watermark_no_zoom_out} to true + * If you want your watermark to be resized up or doan to fill in the image better, then + * set {@link image_watermark_no_zoom_in} and {@link image_watermark_no_zoom_out} to false + * + * Default value is false (so the watermark may be shrinked to fit in the image) + * + * @access public + * @var integer + */ + var $image_watermark_no_zoom_out; + + /** + * List of MIME types per extension + * + * @access private + * @var array + */ + var $mime_types; + + /** + * Allowed MIME types + * + * Default is a selection of safe mime-types, but you might want to change it + * + * Simple wildcards are allowed, such as image/* or application/* + * If there is only one MIME type allowed, then it can be a string instead of an array + * + * @access public + * @var array OR string + */ + var $allowed; + + /** + * Forbidden MIME types + * + * Default is a selection of safe mime-types, but you might want to change it + * To only check for forbidden MIME types, and allow everything else, set {@link allowed} to array('* / *') without the spaces + * + * Simple wildcards are allowed, such as image/* or application/* + * If there is only one MIME type forbidden, then it can be a string instead of an array + * + * @access public + * @var array OR string + */ + var $forbidden; + + /** + * Array of translated error messages + * + * By default, the language is english (en_GB) + * Translations can be in separate files, in a lang/ subdirectory + * + * @access public + * @var array + */ + var $translation; + + /** + * Language selected for the translations + * + * By default, the language is english ("en_GB") + * + * @access public + * @var array + */ + var $language; + + /** + * Init or re-init all the processing variables to their default values + * + * This function is called in the constructor, and after each call of {@link process} + * + * @access private + */ + function init() { + + // overiddable variables + $this->file_new_name_body = null; // replace the name body + $this->file_name_body_add = null; // append to the name body + $this->file_name_body_pre = null; // prepend to the name body + $this->file_new_name_ext = null; // replace the file extension + $this->file_safe_name = true; // format safely the filename + $this->file_force_extension = true; // forces extension if there isn't one + $this->file_overwrite = false; // allows overwritting if the file already exists + $this->file_auto_rename = true; // auto-rename if the file already exists + $this->dir_auto_create = true; // auto-creates directory if missing + $this->dir_auto_chmod = true; // auto-chmod directory if not writeable + $this->dir_chmod = 0777; // default chmod to use + + $this->no_script = true; // turns scripts into test files + $this->mime_check = true; // checks the mime type against the allowed list + + // these are the different MIME detection methods. if one of these method doesn't work on your + // system, you can deactivate it here; just set it to false + $this->mime_fileinfo = true; // MIME detection with Fileinfo PECL extension + $this->mime_file = true; // MIME detection with UNIX file() command + $this->mime_magic = true; // MIME detection with mime_magic (mime_content_type()) + $this->mime_getimagesize = true; // MIME detection with getimagesize() + + // get the default max size from php.ini + $this->file_max_size_raw = trim(ini_get('upload_max_filesize')); + $this->file_max_size = $this->getsize($this->file_max_size_raw); + + $this->image_resize = false; // resize the image + $this->image_convert = ''; // convert. values :''; 'png'; 'jpeg'; 'gif'; 'bmp' + + $this->image_x = 150; + $this->image_y = 150; + $this->image_ratio = false; // keeps aspect ratio with x and y dimensions + $this->image_ratio_crop = false; // keeps aspect ratio with x and y dimensions, filling the space + $this->image_ratio_fill = false; // keeps aspect ratio with x and y dimensions, fitting the image in the space, and coloring the rest + $this->image_ratio_pixels = false; // keeps aspect ratio, calculating x and y so that the image is approx the set number of pixels + $this->image_ratio_no_zoom_in = false; + $this->image_ratio_no_zoom_out = false; + $this->image_ratio_x = false; // calculate the $image_x if true + $this->image_ratio_y = false; // calculate the $image_y if true + $this->png_compression = null; + $this->jpeg_quality = 85; + $this->jpeg_size = null; + $this->image_interlace = false; + $this->preserve_transparency = false; + $this->image_is_transparent = false; + $this->image_transparent_color = null; + $this->image_background_color = null; + $this->image_default_color = '#ffffff'; + $this->image_is_palette = false; + + $this->image_max_width = null; + $this->image_max_height = null; + $this->image_max_pixels = null; + $this->image_max_ratio = null; + $this->image_min_width = null; + $this->image_min_height = null; + $this->image_min_pixels = null; + $this->image_min_ratio = null; + + $this->image_brightness = null; + $this->image_contrast = null; + $this->image_opacity = null; + $this->image_threshold = null; + $this->image_tint_color = null; + $this->image_overlay_color = null; + $this->image_overlay_opacity = null; + $this->image_overlay_percent = null; + $this->image_negative = false; + $this->image_greyscale = false; + $this->image_pixelate = null; + $this->image_unsharp = false; + $this->image_unsharp_amount = 80; + $this->image_unsharp_radius = 0.5; + $this->image_unsharp_threshold = 1; + + $this->image_text = null; + $this->image_text_direction = null; + $this->image_text_color = '#FFFFFF'; + $this->image_text_opacity = 100; + $this->image_text_percent = 100; + $this->image_text_background = null; + $this->image_text_background_opacity = 100; + $this->image_text_background_percent = 100; + $this->image_text_font = 5; + $this->image_text_x = null; + $this->image_text_y = null; + $this->image_text_position = null; + $this->image_text_padding = 0; + $this->image_text_padding_x = null; + $this->image_text_padding_y = null; + $this->image_text_alignment = 'C'; + $this->image_text_line_spacing = 0; + + $this->image_reflection_height = null; + $this->image_reflection_space = 2; + $this->image_reflection_color = '#ffffff'; + $this->image_reflection_opacity = 60; + + $this->image_watermark = null; + $this->image_watermark_x = null; + $this->image_watermark_y = null; + $this->image_watermark_position = null; + $this->image_watermark_no_zoom_in = true; + $this->image_watermark_no_zoom_out = false; + + $this->image_flip = null; + $this->image_rotate = null; + $this->image_crop = null; + $this->image_precrop = null; + + $this->image_bevel = null; + $this->image_bevel_color1 = '#FFFFFF'; + $this->image_bevel_color2 = '#000000'; + $this->image_border = null; + $this->image_border_color = '#FFFFFF'; + $this->image_border_opacity = 100; + $this->image_border_transparent = null; + $this->image_frame = null; + $this->image_frame_colors = '#FFFFFF #999999 #666666 #000000'; + $this->image_frame_opacity = 100; + + $this->forbidden = array(); + $this->allowed = array( + 'application/arj', + 'application/excel', + 'application/gnutar', + 'application/mspowerpoint', + 'application/msword', + 'application/octet-stream', + 'application/onenote', + 'application/pdf', + 'application/plain', + 'application/postscript', + 'application/powerpoint', + 'application/rar', + 'application/rtf', + 'application/vnd.ms-excel', + 'application/vnd.ms-excel.addin.macroEnabled.12', + 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', + 'application/vnd.ms-excel.sheet.macroEnabled.12', + 'application/vnd.ms-excel.template.macroEnabled.12', + 'application/vnd.ms-office', + 'application/vnd.ms-officetheme', + 'application/vnd.ms-powerpoint', + 'application/vnd.ms-powerpoint.addin.macroEnabled.12', + 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', + 'application/vnd.ms-powerpoint.slide.macroEnabled.12', + 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12', + 'application/vnd.ms-powerpoint.template.macroEnabled.12', + 'application/vnd.ms-word', + 'application/vnd.ms-word.document.macroEnabled.12', + 'application/vnd.ms-word.template.macroEnabled.12', + 'application/vnd.oasis.opendocument.chart', + 'application/vnd.oasis.opendocument.database', + 'application/vnd.oasis.opendocument.formula', + 'application/vnd.oasis.opendocument.graphics', + 'application/vnd.oasis.opendocument.graphics-template', + 'application/vnd.oasis.opendocument.image', + 'application/vnd.oasis.opendocument.presentation', + 'application/vnd.oasis.opendocument.presentation-template', + 'application/vnd.oasis.opendocument.spreadsheet', + 'application/vnd.oasis.opendocument.spreadsheet-template', + 'application/vnd.oasis.opendocument.text', + 'application/vnd.oasis.opendocument.text-master', + 'application/vnd.oasis.opendocument.text-template', + 'application/vnd.oasis.opendocument.text-web', + 'application/vnd.openofficeorg.extension', + 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'application/vnd.openxmlformats-officedocument.presentationml.slide', + 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', + 'application/vnd.openxmlformats-officedocument.presentationml.template', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', + 'application/vocaltec-media-file', + 'application/wordperfect', + 'application/x-bittorrent', + 'application/x-bzip', + 'application/x-bzip2', + 'application/x-compressed', + 'application/x-excel', + 'application/x-gzip', + 'application/x-latex', + 'application/x-midi', + 'application/xml', + 'application/x-msexcel', + 'application/x-rar', + 'application/x-rar-compressed', + 'application/x-rtf', + 'application/x-shockwave-flash', + 'application/x-sit', + 'application/x-stuffit', + 'application/x-troff-msvideo', + 'application/x-zip', + 'application/x-zip-compressed', + 'application/zip', + 'audio/*', + 'image/*', + 'multipart/x-gzip', + 'multipart/x-zip', + 'text/plain', + 'text/rtf', + 'text/richtext', + 'text/xml', + 'video/*' + ); + + $this->mime_types = array( + 'jpg' => 'image/jpeg', + 'jpeg' => 'image/jpeg', + 'jpe' => 'image/jpeg', + 'gif' => 'image/gif', + 'png' => 'image/png', + 'bmp' => 'image/bmp', + 'flv' => 'video/x-flv', + 'js' => 'application/x-javascript', + 'json' => 'application/json', + 'tiff' => 'image/tiff', + 'css' => 'text/css', + 'xml' => 'application/xml', + 'doc' => 'application/msword', + 'docx' => 'application/msword', + 'xls' => 'application/vnd.ms-excel', + 'xlt' => 'application/vnd.ms-excel', + 'xlm' => 'application/vnd.ms-excel', + 'xld' => 'application/vnd.ms-excel', + 'xla' => 'application/vnd.ms-excel', + 'xlc' => 'application/vnd.ms-excel', + 'xlw' => 'application/vnd.ms-excel', + 'xll' => 'application/vnd.ms-excel', + 'ppt' => 'application/vnd.ms-powerpoint', + 'pps' => 'application/vnd.ms-powerpoint', + 'rtf' => 'application/rtf', + 'pdf' => 'application/pdf', + 'html' => 'text/html', + 'htm' => 'text/html', + 'php' => 'text/html', + 'txt' => 'text/plain', + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'mpe' => 'video/mpeg', + 'mp3' => 'audio/mpeg3', + 'wav' => 'audio/wav', + 'aiff' => 'audio/aiff', + 'aif' => 'audio/aiff', + 'avi' => 'video/msvideo', + 'wmv' => 'video/x-ms-wmv', + 'mov' => 'video/quicktime', + 'zip' => 'application/zip', + 'tar' => 'application/x-tar', + 'swf' => 'application/x-shockwave-flash', + 'odt' => 'application/vnd.oasis.opendocument.text', + 'ott' => 'application/vnd.oasis.opendocument.text-template', + 'oth' => 'application/vnd.oasis.opendocument.text-web', + 'odm' => 'application/vnd.oasis.opendocument.text-master', + 'odg' => 'application/vnd.oasis.opendocument.graphics', + 'otg' => 'application/vnd.oasis.opendocument.graphics-template', + 'odp' => 'application/vnd.oasis.opendocument.presentation', + 'otp' => 'application/vnd.oasis.opendocument.presentation-template', + 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', + 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template', + 'odc' => 'application/vnd.oasis.opendocument.chart', + 'odf' => 'application/vnd.oasis.opendocument.formula', + 'odb' => 'application/vnd.oasis.opendocument.database', + 'odi' => 'application/vnd.oasis.opendocument.image', + 'oxt' => 'application/vnd.openofficeorg.extension', + 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'docm' => 'application/vnd.ms-word.document.macroEnabled.12', + 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', + 'dotm' => 'application/vnd.ms-word.template.macroEnabled.12', + 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12', + 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', + 'xltm' => 'application/vnd.ms-excel.template.macroEnabled.12', + 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', + 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12', + 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', + 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', + 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12', + 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', + 'potm' => 'application/vnd.ms-powerpoint.template.macroEnabled.12', + 'ppam' => 'application/vnd.ms-powerpoint.addin.macroEnabled.12', + 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide', + 'sldm' => 'application/vnd.ms-powerpoint.slide.macroEnabled.12', + 'thmx' => 'application/vnd.ms-officetheme', + 'onetoc' => 'application/onenote', + 'onetoc2' => 'application/onenote', + 'onetmp' => 'application/onenote', + 'onepkg' => 'application/onenote', + ); + + } + + /** + * Constructor. Checks if the file has been uploaded + * + * The constructor takes $_FILES['form_field'] array as argument + * where form_field is the form field name + * + * The constructor will check if the file has been uploaded in its temporary location, and + * accordingly will set {@link uploaded} (and {@link error} is an error occurred) + * + * If the file has been uploaded, the constructor will populate all the variables holding the upload + * information (none of the processing class variables are used here). + * You can have access to information about the file (name, size, MIME type...). + * + * + * Alternatively, you can set the first argument to be a local filename (string) + * This allows processing of a local file, as if the file was uploaded + * + * The optional second argument allows you to set the language for the error messages + * + * @access private + * @param array $file $_FILES['form_field'] + * or string $file Local filename + * @param string $lang Optional language code + */ + function upload($file, $lang = 'en_GB') { + + $this->version = '0.33dev'; + + $this->file_src_name = ''; + $this->file_src_name_body = ''; + $this->file_src_name_ext = ''; + $this->file_src_mime = ''; + $this->file_src_size = ''; + $this->file_src_error = ''; + $this->file_src_pathname = ''; + $this->file_src_temp = ''; + + $this->file_dst_path = ''; + $this->file_dst_name = ''; + $this->file_dst_name_body = ''; + $this->file_dst_name_ext = ''; + $this->file_dst_pathname = ''; + + $this->image_src_x = null; + $this->image_src_y = null; + $this->image_src_bits = null; + $this->image_src_type = null; + $this->image_src_pixels = null; + $this->image_dst_x = 0; + $this->image_dst_y = 0; + $this->image_dst_type = ''; + + $this->uploaded = true; + $this->no_upload_check = false; + $this->processed = true; + $this->error = ''; + $this->log = ''; + $this->allowed = array(); + $this->forbidden = array(); + $this->file_is_image = false; + $this->init(); + $info = null; + $mime_from_browser = null; + + // sets default language + $this->translation = array(); + $this->translation['file_error'] = 'File error. Please try again.'; + $this->translation['local_file_missing'] = 'Local file doesn\'t exist.'; + $this->translation['local_file_not_readable'] = 'Local file is not readable.'; + $this->translation['uploaded_too_big_ini'] = 'File upload error (the uploaded file exceeds the upload_max_filesize directive in php.ini).'; + $this->translation['uploaded_too_big_html'] = 'File upload error (the uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form).'; + $this->translation['uploaded_partial'] = 'File upload error (the uploaded file was only partially uploaded).'; + $this->translation['uploaded_missing'] = 'File upload error (no file was uploaded).'; + $this->translation['uploaded_no_tmp_dir'] = 'File upload error (missing a temporary folder).'; + $this->translation['uploaded_cant_write'] = 'File upload error (failed to write file to disk).'; + $this->translation['uploaded_err_extension'] = 'File upload error (file upload stopped by extension).'; + $this->translation['uploaded_unknown'] = 'File upload error (unknown error code).'; + $this->translation['try_again'] = 'File upload error. Please try again.'; + $this->translation['file_too_big'] = 'File too big.'; + $this->translation['no_mime'] = 'MIME type can\'t be detected.'; + $this->translation['incorrect_file'] = 'Incorrect type of file.'; + $this->translation['image_too_wide'] = 'Image too wide.'; + $this->translation['image_too_narrow'] = 'Image too narrow.'; + $this->translation['image_too_high'] = 'Image too tall.'; + $this->translation['image_too_short'] = 'Image too short.'; + $this->translation['ratio_too_high'] = 'Image ratio too high (image too wide).'; + $this->translation['ratio_too_low'] = 'Image ratio too low (image too high).'; + $this->translation['too_many_pixels'] = 'Image has too many pixels.'; + $this->translation['not_enough_pixels'] = 'Image has not enough pixels.'; + $this->translation['file_not_uploaded'] = 'File not uploaded. Can\'t carry on a process.'; + $this->translation['already_exists'] = '%s already exists. Please change the file name.'; + $this->translation['temp_file_missing'] = 'No correct temp source file. Can\'t carry on a process.'; + $this->translation['source_missing'] = 'No correct uploaded source file. Can\'t carry on a process.'; + $this->translation['destination_dir'] = 'Destination directory can\'t be created. Can\'t carry on a process.'; + $this->translation['destination_dir_missing'] = 'Destination directory doesn\'t exist. Can\'t carry on a process.'; + $this->translation['destination_path_not_dir'] = 'Destination path is not a directory. Can\'t carry on a process.'; + $this->translation['destination_dir_write'] = 'Destination directory can\'t be made writeable. Can\'t carry on a process.'; + $this->translation['destination_path_write'] = 'Destination path is not a writeable. Can\'t carry on a process.'; + $this->translation['temp_file'] = 'Can\'t create the temporary file. Can\'t carry on a process.'; + $this->translation['source_not_readable'] = 'Source file is not readable. Can\'t carry on a process.'; + $this->translation['no_create_support'] = 'No create from %s support.'; + $this->translation['create_error'] = 'Error in creating %s image from source.'; + $this->translation['source_invalid'] = 'Can\'t read image source. Not an image?.'; + $this->translation['gd_missing'] = 'GD doesn\'t seem to be present.'; + $this->translation['watermark_no_create_support'] = 'No create from %s support, can\'t read watermark.'; + $this->translation['watermark_create_error'] = 'No %s read support, can\'t create watermark.'; + $this->translation['watermark_invalid'] = 'Unknown image format, can\'t read watermark.'; + $this->translation['file_create'] = 'No %s create support.'; + $this->translation['no_conversion_type'] = 'No conversion type defined.'; + $this->translation['copy_failed'] = 'Error copying file on the server. copy() failed.'; + $this->translation['reading_failed'] = 'Error reading the file.'; + + // determines the language + $this->lang = $lang; + if ($this->lang != 'en_GB' && file_exists(dirname(__FILE__).'/lang') && file_exists(dirname(__FILE__).'/lang/class.upload.' . $lang . '.php')) { + $translation = null; + include(dirname(__FILE__).'/lang/class.upload.' . $lang . '.php'); + if (is_array($translation)) { + $this->translation = array_merge($this->translation, $translation); + } else { + $this->lang = 'en_GB'; + } + } + + + // determines the supported MIME types, and matching image format + $this->image_supported = array(); + if ($this->gdversion()) { + if (imagetypes() & IMG_GIF) { + $this->image_supported['image/gif'] = 'gif'; + } + if (imagetypes() & IMG_JPG) { + $this->image_supported['image/jpg'] = 'jpg'; + $this->image_supported['image/jpeg'] = 'jpg'; + $this->image_supported['image/pjpeg'] = 'jpg'; + } + if (imagetypes() & IMG_PNG) { + $this->image_supported['image/png'] = 'png'; + $this->image_supported['image/x-png'] = 'png'; + } + if (imagetypes() & IMG_WBMP) { + $this->image_supported['image/bmp'] = 'bmp'; + $this->image_supported['image/x-ms-bmp'] = 'bmp'; + $this->image_supported['image/x-windows-bmp'] = 'bmp'; + } + } + + // display some system information + if (empty($this->log)) { + $this->log .= 'system information
    '; + if (function_exists('ini_get_all')) { + $inis = ini_get_all(); + $open_basedir = (array_key_exists('open_basedir', $inis) && array_key_exists('local_value', $inis['open_basedir']) && !empty($inis['open_basedir']['local_value'])) ? $inis['open_basedir']['local_value'] : false; + } else { + $open_basedir = false; + } + $gd = $this->gdversion() ? $this->gdversion(true) : 'GD not present'; + $supported = trim((in_array('png', $this->image_supported) ? 'png' : '') . ' ' . (in_array('jpg', $this->image_supported) ? 'jpg' : '') . ' ' . (in_array('gif', $this->image_supported) ? 'gif' : '') . ' ' . (in_array('bmp', $this->image_supported) ? 'bmp' : '')); + $this->log .= '- class version : ' . $this->version . '
    '; + $this->log .= '- operating system : ' . PHP_OS . '
    '; + $this->log .= '- PHP version : ' . PHP_VERSION . '
    '; + $this->log .= '- GD version : ' . $gd . '
    '; + $this->log .= '- supported image types : ' . (!empty($supported) ? $supported : 'none') . '
    '; + $this->log .= '- open_basedir : ' . (!empty($open_basedir) ? $open_basedir : 'no restriction') . '
    '; + $this->log .= '- upload_max_filesize : ' . $this->file_max_size_raw . ' (' . $this->file_max_size . ' bytes)
    '; + $this->log .= '- language : ' . $this->lang . '
    '; + } + + if (!$file) { + $this->uploaded = false; + $this->error = $this->translate('file_error'); + } + + // check if we sent a local filename or a PHP stream rather than a $_FILE element + if (!is_array($file)) { + if (empty($file)) { + $this->uploaded = false; + $this->error = $this->translate('file_error'); + } else { + if (substr($file, 0, 4) == 'php:') { + // this is a local filename, i.e.not uploaded + $file = preg_replace('/^php:(.*)/i', '$1', $file); + if (!$file) $file = $_SERVER['HTTP_X_FILE_NAME']; + if (!$file) $file = 'unknown'; + $this->log .= '' . $this->translate("source is a PHP stream") . ' ' . $file . '
    '; + $this->no_upload_check = TRUE; + + $this->log .= '- this is a PHP stream, requires a temp file ... '; + $hash = $this->temp_dir() . md5($file . rand(1, 1000)); + if (file_put_contents($hash, file_get_contents('php://input'))) { + $this->file_src_pathname = $hash; + $this->log .= ' file created
    '; + $this->log .= '    temp file is: ' . $this->file_src_pathname . '
    '; + } else { + $this->log .= ' failed
    '; + $this->uploaded = false; + $this->error = $this->translate('temp_file'); + } + + if ($this->uploaded) { + $this->file_src_name = $file; + $this->log .= '- local file OK
    '; + preg_match('/\.([^\.]*$)/', $this->file_src_name, $extension); + if (is_array($extension) && sizeof($extension) > 0) { + $this->file_src_name_ext = strtolower($extension[1]); + $this->file_src_name_body = substr($this->file_src_name, 0, ((strlen($this->file_src_name) - strlen($this->file_src_name_ext)))-1); + } else { + $this->file_src_name_ext = ''; + $this->file_src_name_body = $this->file_src_name; + } + $this->file_src_size = (file_exists($this->file_src_pathname) ? filesize($this->file_src_pathname) : 0); + } + $this->file_src_error = 0; + + } else { + // this is a local filename, i.e.not uploaded + $this->log .= '' . $this->translate("source is a local file") . ' ' . $file . '
    '; + $this->no_upload_check = TRUE; + + if ($this->uploaded && !file_exists($file)) { + $this->uploaded = false; + $this->error = $this->translate('local_file_missing'); + } + + if ($this->uploaded && !is_readable($file)) { + $this->uploaded = false; + $this->error = $this->translate('local_file_not_readable'); + } + + if ($this->uploaded) { + $this->file_src_pathname = $file; + $this->file_src_name = basename($file); + $this->log .= '- local file OK
    '; + preg_match('/\.([^\.]*$)/', $this->file_src_name, $extension); + if (is_array($extension) && sizeof($extension) > 0) { + $this->file_src_name_ext = strtolower($extension[1]); + $this->file_src_name_body = substr($this->file_src_name, 0, ((strlen($this->file_src_name) - strlen($this->file_src_name_ext)))-1); + } else { + $this->file_src_name_ext = ''; + $this->file_src_name_body = $this->file_src_name; + } + $this->file_src_size = (file_exists($this->file_src_pathname) ? filesize($this->file_src_pathname) : 0); + } + $this->file_src_error = 0; + } + } + } else { + // this is an element from $_FILE, i.e. an uploaded file + $this->log .= 'source is an uploaded file
    '; + if ($this->uploaded) { + $this->file_src_error = trim($file['error']); + switch($this->file_src_error) { + case UPLOAD_ERR_OK: + // all is OK + $this->log .= '- upload OK
    '; + break; + case UPLOAD_ERR_INI_SIZE: + $this->uploaded = false; + $this->error = $this->translate('uploaded_too_big_ini'); + break; + case UPLOAD_ERR_FORM_SIZE: + $this->uploaded = false; + $this->error = $this->translate('uploaded_too_big_html'); + break; + case UPLOAD_ERR_PARTIAL: + $this->uploaded = false; + $this->error = $this->translate('uploaded_partial'); + break; + case UPLOAD_ERR_NO_FILE: + $this->uploaded = false; + $this->error = $this->translate('uploaded_missing'); + break; + case @UPLOAD_ERR_NO_TMP_DIR: + $this->uploaded = false; + $this->error = $this->translate('uploaded_no_tmp_dir'); + break; + case @UPLOAD_ERR_CANT_WRITE: + $this->uploaded = false; + $this->error = $this->translate('uploaded_cant_write'); + break; + case @UPLOAD_ERR_EXTENSION: + $this->uploaded = false; + $this->error = $this->translate('uploaded_err_extension'); + break; + default: + $this->uploaded = false; + $this->error = $this->translate('uploaded_unknown') . ' ('.$this->file_src_error.')'; + } + } + + if ($this->uploaded) { + $this->file_src_pathname = $file['tmp_name']; + $this->file_src_name = $file['name']; + if ($this->file_src_name == '') { + $this->uploaded = false; + $this->error = $this->translate('try_again'); + } + } + + if ($this->uploaded) { + $this->log .= '- file name OK
    '; + preg_match('/\.([^\.]*$)/', $this->file_src_name, $extension); + if (is_array($extension) && sizeof($extension) > 0) { + $this->file_src_name_ext = strtolower($extension[1]); + $this->file_src_name_body = substr($this->file_src_name, 0, ((strlen($this->file_src_name) - strlen($this->file_src_name_ext)))-1); + } else { + $this->file_src_name_ext = ''; + $this->file_src_name_body = $this->file_src_name; + } + $this->file_src_size = $file['size']; + $mime_from_browser = $file['type']; + } + } + + if ($this->uploaded) { + $this->log .= 'determining MIME type
    '; + $this->file_src_mime = null; + + // checks MIME type with Fileinfo PECL extension + if (!$this->file_src_mime || !is_string($this->file_src_mime) || empty($this->file_src_mime) || strpos($this->file_src_mime, '/') === FALSE) { + if ($this->mime_fileinfo) { + $this->log .= '- Checking MIME type with Fileinfo PECL extension
    '; + if (function_exists('finfo_open')) { + $path = null; + if ($this->mime_fileinfo !== '') { + if ($this->mime_fileinfo === true) { + if (getenv('MAGIC') === FALSE) { + if (substr(PHP_OS, 0, 3) == 'WIN') { + $path = realpath(ini_get('extension_dir') . '/../') . 'extras/magic'; + $this->log .= '    MAGIC path defaults to ' . $path . '
    '; + } + } else { + $path = getenv('MAGIC'); + $this->log .= '    MAGIC path is set to ' . $path . ' from MAGIC variable
    '; + } + } else { + $path = $this->mime_fileinfo; + $this->log .= '    MAGIC path is set to ' . $path . '
    '; + } + } + if ($path) { + $f = @finfo_open(FILEINFO_MIME, $path); + } else { + $this->log .= '    MAGIC path will not be used
    '; + $f = @finfo_open(FILEINFO_MIME); + } + if (is_resource($f)) { + $mime = finfo_file($f, realpath($this->file_src_pathname)); + finfo_close($f); + $this->file_src_mime = $mime; + $this->log .= '    MIME type detected as ' . $this->file_src_mime . ' by Fileinfo PECL extension
    '; + if (preg_match("/^([\.\-\w]+)\/([\.\-\w]+)(.*)$/i", $this->file_src_mime)) { + $this->file_src_mime = preg_replace("/^([\.\-\w]+)\/([\.\-\w]+)(.*)$/i", '$1/$2', $this->file_src_mime); + $this->log .= '- MIME validated as ' . $this->file_src_mime . '
    '; + } else { + $this->file_src_mime = null; + } + } else { + $this->log .= '    Fileinfo PECL extension failed (finfo_open)
    '; + } + } elseif (@class_exists('finfo')) { + $f = new finfo( FILEINFO_MIME ); + if ($f) { + $this->file_src_mime = $f->file(realpath($this->file_src_pathname)); + $this->log .= '- MIME type detected as ' . $this->file_src_mime . ' by Fileinfo PECL extension
    '; + if (preg_match("/^([\.\-\w]+)\/([\.\-\w]+)(.*)$/i", $this->file_src_mime)) { + $this->file_src_mime = preg_replace("/^([\.\-\w]+)\/([\.\-\w]+)(.*)$/i", '$1/$2', $this->file_src_mime); + $this->log .= '- MIME validated as ' . $this->file_src_mime . '
    '; + } else { + $this->file_src_mime = null; + } + } else { + $this->log .= '    Fileinfo PECL extension failed (finfo)
    '; + } + } else { + $this->log .= '    Fileinfo PECL extension not available
    '; + } + } else { + $this->log .= '- Fileinfo PECL extension deactivated
    '; + } + } + + // checks MIME type with shell if unix access is authorized + if (!$this->file_src_mime || !is_string($this->file_src_mime) || empty($this->file_src_mime) || strpos($this->file_src_mime, '/') === FALSE) { + if ($this->mime_file) { + $this->log .= '- Checking MIME type with UNIX file() command
    '; + if (substr(PHP_OS, 0, 3) != 'WIN') { + if (function_exists('exec') && function_exists('escapeshellarg') && !extension_loaded('suhosin')) { + if (strlen($mime = @exec("file -bi ".escapeshellarg($this->file_src_pathname))) != 0) { + $this->file_src_mime = trim($mime); + $this->log .= '    MIME type detected as ' . $this->file_src_mime . ' by UNIX file() command
    '; + if (preg_match("/^([\.\-\w]+)\/([\.\-\w]+)(.*)$/i", $this->file_src_mime)) { + $this->file_src_mime = preg_replace("/^([\.\-\w]+)\/([\.\-\w]+)(.*)$/i", '$1/$2', $this->file_src_mime); + $this->log .= '- MIME validated as ' . $this->file_src_mime . '
    '; + } else { + $this->file_src_mime = null; + } + } else { + $this->log .= '    UNIX file() command failed
    '; + } + } else { + $this->log .= '    PHP exec() function is disabled
    '; + } + } else { + $this->log .= '    UNIX file() command not availabled
    '; + } + } else { + $this->log .= '- UNIX file() command is deactivated
    '; + } + } + + // checks MIME type with mime_magic + if (!$this->file_src_mime || !is_string($this->file_src_mime) || empty($this->file_src_mime) || strpos($this->file_src_mime, '/') === FALSE) { + if ($this->mime_magic) { + $this->log .= '- Checking MIME type with mime.magic file (mime_content_type())
    '; + if (function_exists('mime_content_type')) { + $this->file_src_mime = mime_content_type($this->file_src_pathname); + $this->log .= '    MIME type detected as ' . $this->file_src_mime . ' by mime_content_type()
    '; + if (preg_match("/^([\.\-\w]+)\/([\.\-\w]+)(.*)$/i", $this->file_src_mime)) { + $this->file_src_mime = preg_replace("/^([\.\-\w]+)\/([\.\-\w]+)(.*)$/i", '$1/$2', $this->file_src_mime); + $this->log .= '- MIME validated as ' . $this->file_src_mime . '
    '; + } else { + $this->file_src_mime = null; + } + } else { + $this->log .= '    mime_content_type() is not available
    '; + } + } else { + $this->log .= '- mime.magic file (mime_content_type()) is deactivated
    '; + } + } + + // checks MIME type with getimagesize() + if (!$this->file_src_mime || !is_string($this->file_src_mime) || empty($this->file_src_mime) || strpos($this->file_src_mime, '/') === FALSE) { + if ($this->mime_getimagesize) { + $this->log .= '- Checking MIME type with getimagesize()
    '; + $info = getimagesize($this->file_src_pathname); + if (is_array($info) && array_key_exists('mime', $info)) { + $this->file_src_mime = trim($info['mime']); + if (empty($this->file_src_mime)) { + $this->log .= '    MIME empty, guessing from type
    '; + $mime = (is_array($info) && array_key_exists(2, $info) ? $info[2] : null); // 1 = GIF, 2 = JPG, 3 = PNG + $this->file_src_mime = ($mime==IMAGETYPE_GIF ? 'image/gif' : ($mime==IMAGETYPE_JPEG ? 'image/jpeg' : ($mime==IMAGETYPE_PNG ? 'image/png' : ($mime==IMAGETYPE_BMP ? 'image/bmp' : null)))); + } + $this->log .= '    MIME type detected as ' . $this->file_src_mime . ' by PHP getimagesize() function
    '; + if (preg_match("/^([\.\-\w]+)\/([\.\-\w]+)(.*)$/i", $this->file_src_mime)) { + $this->file_src_mime = preg_replace("/^([\.\-\w]+)\/([\.\-\w]+)(.*)$/i", '$1/$2', $this->file_src_mime); + $this->log .= '- MIME validated as ' . $this->file_src_mime . '
    '; + } else { + $this->file_src_mime = null; + } + } else { + $this->log .= '    getimagesize() failed
    '; + } + } else { + $this->log .= '- getimagesize() is deactivated
    '; + } + } + + // default to MIME from browser (or Flash) + if (!empty($mime_from_browser) && !$this->file_src_mime || !is_string($this->file_src_mime) || empty($this->file_src_mime)) { + $this->file_src_mime =$mime_from_browser; + $this->log .= '- MIME type detected as ' . $this->file_src_mime . ' by browser
    '; + if (preg_match("/^([\.\-\w]+)\/([\.\-\w]+)(.*)$/i", $this->file_src_mime)) { + $this->file_src_mime = preg_replace("/^([\.\-\w]+)\/([\.\-\w]+)(.*)$/i", '$1/$2', $this->file_src_mime); + $this->log .= '- MIME validated as ' . $this->file_src_mime . '
    '; + } else { + $this->file_src_mime = null; + } + } + + // we need to work some magic if we upload via Flash + if ($this->file_src_mime == 'application/octet-stream' || !$this->file_src_mime || !is_string($this->file_src_mime) || empty($this->file_src_mime) || strpos($this->file_src_mime, '/') === FALSE) { + if ($this->file_src_mime == 'application/octet-stream') $this->log .= '- Flash may be rewriting MIME as application/octet-stream
    '; + $this->log .= '- Try to guess MIME type from file extension (' . $this->file_src_name_ext . '): '; + if (array_key_exists($this->file_src_name_ext, $this->mime_types)) $this->file_src_mime = $this->mime_types[$this->file_src_name_ext]; + if ($this->file_src_mime == 'application/octet-stream') { + $this->log .= 'doesn\'t look like anything known
    '; + } else { + $this->log .= 'MIME type set to ' . $this->file_src_mime . '
    '; + } + } + + if (!$this->file_src_mime || !is_string($this->file_src_mime) || empty($this->file_src_mime) || strpos($this->file_src_mime, '/') === FALSE) { + $this->log .= '- MIME type couldn\'t be detected! (' . (string) $this->file_src_mime . ')
    '; + } + + // determine whether the file is an image + if ($this->file_src_mime && is_string($this->file_src_mime) && !empty($this->file_src_mime) && array_key_exists($this->file_src_mime, $this->image_supported)) { + $this->file_is_image = true; + $this->image_src_type = $this->image_supported[$this->file_src_mime]; + } + + // if the file is an image, we gather some useful data + if ($this->file_is_image) { + if ($h = fopen($this->file_src_pathname, 'r')) { + fclose($h); + $info = getimagesize($this->file_src_pathname); + if (is_array($info)) { + $this->image_src_x = $info[0]; + $this->image_src_y = $info[1]; + $this->image_dst_x = $this->image_src_x; + $this->image_dst_y = $this->image_src_y; + $this->image_src_pixels = $this->image_src_x * $this->image_src_y; + $this->image_src_bits = array_key_exists('bits', $info) ? $info['bits'] : null; + } else { + $this->file_is_image = false; + $this->uploaded = false; + $this->log .= '- can\'t retrieve image information, image may have been tampered with
    '; + $this->error = $this->translate('source_invalid'); + } + } else { + $this->log .= '- can\'t read source file directly. open_basedir restriction in place?
    '; + } + } + + $this->log .= 'source variables
    '; + $this->log .= '- You can use all these before calling process()
    '; + $this->log .= '    file_src_name : ' . $this->file_src_name . '
    '; + $this->log .= '    file_src_name_body : ' . $this->file_src_name_body . '
    '; + $this->log .= '    file_src_name_ext : ' . $this->file_src_name_ext . '
    '; + $this->log .= '    file_src_pathname : ' . $this->file_src_pathname . '
    '; + $this->log .= '    file_src_mime : ' . $this->file_src_mime . '
    '; + $this->log .= '    file_src_size : ' . $this->file_src_size . ' (max= ' . $this->file_max_size . ')
    '; + $this->log .= '    file_src_error : ' . $this->file_src_error . '
    '; + + if ($this->file_is_image) { + $this->log .= '- source file is an image
    '; + $this->log .= '    image_src_x : ' . $this->image_src_x . '
    '; + $this->log .= '    image_src_y : ' . $this->image_src_y . '
    '; + $this->log .= '    image_src_pixels : ' . $this->image_src_pixels . '
    '; + $this->log .= '    image_src_type : ' . $this->image_src_type . '
    '; + $this->log .= '    image_src_bits : ' . $this->image_src_bits . '
    '; + } + } + + } + + /** + * Returns the version of GD + * + * @access public + * @param boolean $full Optional flag to get precise version + * @return float GD version + */ + function gdversion($full = false) { + static $gd_version = null; + static $gd_full_version = null; + if ($gd_version === null) { + if (function_exists('gd_info')) { + $gd = gd_info(); + $gd = $gd["GD Version"]; + $regex = "/([\d\.]+)/i"; + } else { + ob_start(); + phpinfo(8); + $gd = ob_get_contents(); + ob_end_clean(); + $regex = "/\bgd\s+version\b[^\d\n\r]+?([\d\.]+)/i"; + } + if (preg_match($regex, $gd, $m)) { + $gd_full_version = (string) $m[1]; + $gd_version = (float) $m[1]; + } else { + $gd_full_version = 'none'; + $gd_version = 0; + } + } + if ($full) { + return $gd_full_version; + } else { + return $gd_version; + } + } + + /** + * Creates directories recursively + * + * @access private + * @param string $path Path to create + * @param integer $mode Optional permissions + * @return boolean Success + */ + function rmkdir($path, $mode = 0777) { + return is_dir($path) || ( $this->rmkdir(dirname($path), $mode) && $this->_mkdir($path, $mode) ); + } + + /** + * Creates directory + * + * @access private + * @param string $path Path to create + * @param integer $mode Optional permissions + * @return boolean Success + */ + function _mkdir($path, $mode = 0777) { + $old = umask(0); + $res = @mkdir($path, $mode); + umask($old); + return $res; + } + + /** + * Translate error messages + * + * @access private + * @param string $str Message to translate + * @param array $tokens Optional token values + * @return string Translated string + */ + function translate($str, $tokens = array()) { + if (array_key_exists($str, $this->translation)) $str = $this->translation[$str]; + if (is_array($tokens) && sizeof($tokens) > 0) $str = vsprintf($str, $tokens); + return $str; + } + + /** + * Returns the temp directory + * + * @access private + * @return string Temp directory string + */ + function temp_dir() { + $dir = ''; + if (function_exists('sys_get_temp_dir')) $dir = sys_get_temp_dir(); + if (!$dir && $tmp=getenv('TMP')) $dir = $tmp; + if (!$dir && $tmp=getenv('TEMP')) $dir = $tmp; + if (!$dir && $tmp=getenv('TMPDIR')) $dir = $tmp; + if (!$dir) { + $tmp = tempnam(__FILE__,''); + if (file_exists($tmp)) { + unlink($tmp); + $dir = dirname($tmp); + } + } + if (!$dir) return ''; + $slash = (strtolower(substr(PHP_OS, 0, 3)) === 'win' ? '\\' : '/'); + if (substr($dir, -1) != $slash) $dir = $dir . $slash; + return $dir; + } + + /** + * Decodes colors + * + * @access private + * @param string $color Color string + * @return array RGB colors + */ + function getcolors($color) { + $color = str_replace('#', '', $color); + if (strlen($color) == 3) $color = str_repeat(substr($color, 0, 1), 2) . str_repeat(substr($color, 1, 1), 2) . str_repeat(substr($color, 2, 1), 2); + $r = sscanf($color, "%2x%2x%2x"); + $red = (is_array($r) && array_key_exists(0, $r) && is_numeric($r[0]) ? $r[0] : 0); + $green = (is_array($r) && array_key_exists(1, $r) && is_numeric($r[1]) ? $r[1] : 0); + $blue = (is_array($r) && array_key_exists(2, $r) && is_numeric($r[2]) ? $r[2] : 0); + return array($red, $green, $blue); + } + + /** + * Decodes sizes + * + * @access private + * @param string $size Size in bytes, or shorthand byte options + * @return integer Size in bytes + */ + function getsize($size) { + $last = strtolower($size{strlen($size)-1}); + switch($last) { + case 'g': + $size *= 1024; + case 'm': + $size *= 1024; + case 'k': + $size *= 1024; + } + return $size; + } + + /** + * Decodes offsets + * + * @access private + * @param misc $offsets Offsets, as an integer, a string or an array + * @param integer $x Reference picture width + * @param integer $y Reference picture height + * @param boolean $round Round offsets before returning them + * @param boolean $negative Allow negative offsets to be returned + * @return array Array of four offsets (TRBL) + */ + function getoffsets($offsets, $x, $y, $round = true, $negative = true) { + if (!is_array($offsets)) $offsets = explode(' ', $offsets); + if (sizeof($offsets) == 4) { + $ct = $offsets[0]; $cr = $offsets[1]; $cb = $offsets[2]; $cl = $offsets[3]; + } else if (sizeof($offsets) == 2) { + $ct = $offsets[0]; $cr = $offsets[1]; $cb = $offsets[0]; $cl = $offsets[1]; + } else { + $ct = $offsets[0]; $cr = $offsets[0]; $cb = $offsets[0]; $cl = $offsets[0]; + } + if (strpos($ct, '%')>0) $ct = $y * (str_replace('%','',$ct) / 100); + if (strpos($cr, '%')>0) $cr = $x * (str_replace('%','',$cr) / 100); + if (strpos($cb, '%')>0) $cb = $y * (str_replace('%','',$cb) / 100); + if (strpos($cl, '%')>0) $cl = $x * (str_replace('%','',$cl) / 100); + if (strpos($ct, 'px')>0) $ct = str_replace('px','',$ct); + if (strpos($cr, 'px')>0) $cr = str_replace('px','',$cr); + if (strpos($cb, 'px')>0) $cb = str_replace('px','',$cb); + if (strpos($cl, 'px')>0) $cl = str_replace('px','',$cl); + $ct = (int) $ct; $cr = (int) $cr; $cb = (int) $cb; $cl = (int) $cl; + if ($round) { + $ct = round($ct); + $cr = round($cr); + $cb = round($cb); + $cl = round($cl); + } + if (!$negative) { + if ($ct < 0) $ct = 0; + if ($cr < 0) $cr = 0; + if ($cb < 0) $cb = 0; + if ($cl < 0) $cl = 0; + } + return array($ct, $cr, $cb, $cl); + } + + /** + * Creates a container image + * + * @access private + * @param integer $x Width + * @param integer $y Height + * @param boolean $fill Optional flag to draw the background color or not + * @param boolean $trsp Optional flag to set the background to be transparent + * @return resource Container image + */ + function imagecreatenew($x, $y, $fill = true, $trsp = false) { + if ($x < 1) $x = 1; if ($y < 1) $y = 1; + if ($this->gdversion() >= 2 && !$this->image_is_palette) { + // create a true color image + $dst_im = imagecreatetruecolor($x, $y); + // this preserves transparency in PNGs, in true color + if (empty($this->image_background_color) || $trsp) { + imagealphablending($dst_im, false ); + imagefilledrectangle($dst_im, 0, 0, $x, $y, imagecolorallocatealpha($dst_im, 0, 0, 0, 127)); + } + } else { + // creates a palette image + $dst_im = imagecreate($x, $y); + // preserves transparency for palette images, if the original image has transparency + if (($fill && $this->image_is_transparent && empty($this->image_background_color)) || $trsp) { + imagefilledrectangle($dst_im, 0, 0, $x, $y, $this->image_transparent_color); + imagecolortransparent($dst_im, $this->image_transparent_color); + } + } + // fills with background color if any is set + if ($fill && !empty($this->image_background_color) && !$trsp) { + list($red, $green, $blue) = $this->getcolors($this->image_background_color); + $background_color = imagecolorallocate($dst_im, $red, $green, $blue); + imagefilledrectangle($dst_im, 0, 0, $x, $y, $background_color); + } + return $dst_im; + } + + + /** + * Transfers an image from the container to the destination image + * + * @access private + * @param resource $src_im Container image + * @param resource $dst_im Destination image + * @return resource Destination image + */ + function imagetransfer($src_im, $dst_im) { + if (is_resource($dst_im)) imagedestroy($dst_im); + $dst_im = & $src_im; + return $dst_im; + } + + /** + * Merges two images + * + * If the output format is PNG, then we do it pixel per pixel to retain the alpha channel + * + * @access private + * @param resource $dst_img Destination image + * @param resource $src_img Overlay image + * @param int $dst_x x-coordinate of destination point + * @param int $dst_y y-coordinate of destination point + * @param int $src_x x-coordinate of source point + * @param int $src_y y-coordinate of source point + * @param int $src_w Source width + * @param int $src_h Source height + * @param int $pct Optional percentage of the overlay, between 0 and 100 (default: 100) + * @return resource Destination image + */ + function imagecopymergealpha(&$dst_im, &$src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h, $pct = 0) { + $dst_x = (int) $dst_x; + $dst_y = (int) $dst_y; + $src_x = (int) $src_x; + $src_y = (int) $src_y; + $src_w = (int) $src_w; + $src_h = (int) $src_h; + $pct = (int) $pct; + $dst_w = imagesx($dst_im); + $dst_h = imagesy($dst_im); + + for ($y = $src_y; $y < $src_h; $y++) { + for ($x = $src_x; $x < $src_w; $x++) { + + if ($x + $dst_x >= 0 && $x + $dst_x < $dst_w && $x + $src_x >= 0 && $x + $src_x < $src_w + && $y + $dst_y >= 0 && $y + $dst_y < $dst_h && $y + $src_y >= 0 && $y + $src_y < $src_h) { + + $dst_pixel = imagecolorsforindex($dst_im, imagecolorat($dst_im, $x + $dst_x, $y + $dst_y)); + $src_pixel = imagecolorsforindex($src_im, imagecolorat($src_im, $x + $src_x, $y + $src_y)); + + $src_alpha = 1 - ($src_pixel['alpha'] / 127); + $dst_alpha = 1 - ($dst_pixel['alpha'] / 127); + $opacity = $src_alpha * $pct / 100; + if ($dst_alpha >= $opacity) $alpha = $dst_alpha; + if ($dst_alpha < $opacity) $alpha = $opacity; + if ($alpha > 1) $alpha = 1; + + if ($opacity > 0) { + $dst_red = round(( ($dst_pixel['red'] * $dst_alpha * (1 - $opacity)) ) ); + $dst_green = round(( ($dst_pixel['green'] * $dst_alpha * (1 - $opacity)) ) ); + $dst_blue = round(( ($dst_pixel['blue'] * $dst_alpha * (1 - $opacity)) ) ); + $src_red = round((($src_pixel['red'] * $opacity)) ); + $src_green = round((($src_pixel['green'] * $opacity)) ); + $src_blue = round((($src_pixel['blue'] * $opacity)) ); + $red = round(($dst_red + $src_red ) / ($dst_alpha * (1 - $opacity) + $opacity)); + $green = round(($dst_green + $src_green) / ($dst_alpha * (1 - $opacity) + $opacity)); + $blue = round(($dst_blue + $src_blue ) / ($dst_alpha * (1 - $opacity) + $opacity)); + if ($red > 255) $red = 255; + if ($green > 255) $green = 255; + if ($blue > 255) $blue = 255; + $alpha = round((1 - $alpha) * 127); + $color = imagecolorallocatealpha($dst_im, $red, $green, $blue, $alpha); + imagesetpixel($dst_im, $x + $dst_x, $y + $dst_y, $color); + } + } + } + } + return true; + } + + + + /** + * Actually uploads the file, and act on it according to the set processing class variables + * + * This function copies the uploaded file to the given location, eventually performing actions on it. + * Typically, you can call {@link process} several times for the same file, + * for instance to create a resized image and a thumbnail of the same file. + * The original uploaded file remains intact in its temporary location, so you can use {@link process} several times. + * You will be able to delete the uploaded file with {@link clean} when you have finished all your {@link process} calls. + * + * According to the processing class variables set in the calling file, the file can be renamed, + * and if it is an image, can be resized or converted. + * + * When the processing is completed, and the file copied to its new location, the + * processing class variables will be reset to their default value. + * This allows you to set new properties, and perform another {@link process} on the same uploaded file + * + * If the function is called with a null or empty argument, then it will return the content of the picture + * + * It will set {@link processed} (and {@link error} is an error occurred) + * + * @access public + * @param string $server_path Optional path location of the uploaded file, with an ending slash + * @return string Optional content of the image + */ + function process($server_path = null) { + $this->error = ''; + $this->processed = true; + $return_mode = false; + $return_content = null; + + // clean up dst variables + $this->file_dst_path = ''; + $this->file_dst_pathname = ''; + $this->file_dst_name = ''; + $this->file_dst_name_body = ''; + $this->file_dst_name_ext = ''; + + // clean up some parameters + $this->file_max_size = $this->getsize($this->file_max_size); + $this->jpeg_size = $this->getsize($this->jpeg_size); + // some parameters are being deprecated, and replaced with others + if (is_null($this->image_overlay_opacity)) $this->image_overlay_opacity = $this->image_overlay_percent; + if ($this->image_text_opacity == 100) $this->image_text_opacity = $this->image_text_percent; + if ($this->image_text_background_opacity == 100) $this->image_text_background_opacity = $this->image_text_background_percent; + + // copy some variables as we need to keep them clean + $file_src_name = $this->file_src_name; + $file_src_name_body = $this->file_src_name_body; + $file_src_name_ext = $this->file_src_name_ext; + + if (!$this->uploaded) { + $this->error = $this->translate('file_not_uploaded'); + $this->processed = false; + } + + if ($this->processed) { + if (empty($server_path) || is_null($server_path)) { + $this->log .= 'process file and return the content
    '; + $return_mode = true; + } else { + if(strtolower(substr(PHP_OS, 0, 3)) === 'win') { + if (substr($server_path, -1, 1) != '\\') $server_path = $server_path . '\\'; + } else { + if (substr($server_path, -1, 1) != '/') $server_path = $server_path . '/'; + } + $this->log .= 'process file to ' . $server_path . '
    '; + } + } + + if ($this->processed) { + // checks file max size + if ($this->file_src_size > $this->file_max_size) { + $this->processed = false; + $this->error = $this->translate('file_too_big'); + } else { + $this->log .= '- file size OK
    '; + } + } + + if ($this->processed) { + // if we have an image without extension, set it + if ($this->file_force_extension && $this->file_is_image && !$this->file_src_name_ext) $file_src_name_ext = $this->image_src_type; + // turn dangerous scripts into text files + if ($this->no_script) { + // if the file has no extension, we try to guess it from the MIME type + if ($this->file_force_extension && empty($file_src_name_ext)) { + if ($key = array_search($this->file_src_mime, $this->mime_types)) { + $file_src_name_ext = $key; + $file_src_name = $file_src_name_body . '.' . $file_src_name_ext; + $this->log .= '- file renamed as ' . $file_src_name_body . '.' . $file_src_name_ext . '!
    '; + } + } + // if the file is text based, or has a dangerous extension, we rename it as .txt + if ((((substr($this->file_src_mime, 0, 5) == 'text/' && $this->file_src_mime != 'text/rtf') || strpos($this->file_src_mime, 'javascript') !== false) && (substr($file_src_name, -4) != '.txt')) + || preg_match('/\.(php|php5|php4|php3|phtml|pl|py|cgi|asp|js)$/i', $this->file_src_name) + || $this->file_force_extension && empty($file_src_name_ext)) { + $this->file_src_mime = 'text/plain'; + if ($this->file_src_name_ext) $file_src_name_body = $file_src_name_body . '.' . $this->file_src_name_ext; + $file_src_name_ext = 'txt'; + $file_src_name = $file_src_name_body . '.' . $file_src_name_ext; + $this->log .= '- script renamed as ' . $file_src_name_body . '.' . $file_src_name_ext . '!
    '; + } + } + + if ($this->mime_check && empty($this->file_src_mime)) { + $this->processed = false; + $this->error = $this->translate('no_mime'); + } else if ($this->mime_check && !empty($this->file_src_mime) && strpos($this->file_src_mime, '/') !== false) { + list($m1, $m2) = explode('/', $this->file_src_mime); + $allowed = false; + // check wether the mime type is allowed + if (!is_array($this->allowed)) $this->allowed = array($this->allowed); + foreach($this->allowed as $k => $v) { + list($v1, $v2) = explode('/', $v); + if (($v1 == '*' && $v2 == '*') || ($v1 == $m1 && ($v2 == $m2 || $v2 == '*'))) { + $allowed = true; + break; + } + } + // check wether the mime type is forbidden + if (!is_array($this->forbidden)) $this->forbidden = array($this->forbidden); + foreach($this->forbidden as $k => $v) { + list($v1, $v2) = explode('/', $v); + if (($v1 == '*' && $v2 == '*') || ($v1 == $m1 && ($v2 == $m2 || $v2 == '*'))) { + $allowed = false; + break; + } + } + if (!$allowed) { + $this->processed = false; + $this->error = $this->translate('incorrect_file'); + } else { + $this->log .= '- file mime OK : ' . $this->file_src_mime . '
    '; + } + } else { + $this->log .= '- file mime (not checked) : ' . $this->file_src_mime . '
    '; + } + + // if the file is an image, we can check on its dimensions + // these checks are not available if open_basedir restrictions are in place + if ($this->file_is_image) { + if (is_numeric($this->image_src_x) && is_numeric($this->image_src_y)) { + $ratio = $this->image_src_x / $this->image_src_y; + if (!is_null($this->image_max_width) && $this->image_src_x > $this->image_max_width) { + $this->processed = false; + $this->error = $this->translate('image_too_wide'); + } + if (!is_null($this->image_min_width) && $this->image_src_x < $this->image_min_width) { + $this->processed = false; + $this->error = $this->translate('image_too_narrow'); + } + if (!is_null($this->image_max_height) && $this->image_src_y > $this->image_max_height) { + $this->processed = false; + $this->error = $this->translate('image_too_high'); + } + if (!is_null($this->image_min_height) && $this->image_src_y < $this->image_min_height) { + $this->processed = false; + $this->error = $this->translate('image_too_short'); + } + if (!is_null($this->image_max_ratio) && $ratio > $this->image_max_ratio) { + $this->processed = false; + $this->error = $this->translate('ratio_too_high'); + } + if (!is_null($this->image_min_ratio) && $ratio < $this->image_min_ratio) { + $this->processed = false; + $this->error = $this->translate('ratio_too_low'); + } + if (!is_null($this->image_max_pixels) && $this->image_src_pixels > $this->image_max_pixels) { + $this->processed = false; + $this->error = $this->translate('too_many_pixels'); + } + if (!is_null($this->image_min_pixels) && $this->image_src_pixels < $this->image_min_pixels) { + $this->processed = false; + $this->error = $this->translate('not_enough_pixels'); + } + } else { + $this->log .= '- no image properties available, can\'t enforce dimension checks : ' . $this->file_src_mime . '
    '; + } + } + } + + if ($this->processed) { + $this->file_dst_path = $server_path; + + // repopulate dst variables from src + $this->file_dst_name = $file_src_name; + $this->file_dst_name_body = $file_src_name_body; + $this->file_dst_name_ext = $file_src_name_ext; + if ($this->file_overwrite) $this->file_auto_rename = false; + + if ($this->image_convert && $this->file_is_image) { // if we convert as an image + if ($this->file_src_name_ext) $this->file_dst_name_ext = $this->image_convert; + $this->log .= '- new file name ext : ' . $this->image_convert . '
    '; + } + if (!is_null($this->file_new_name_body)) { // rename file body + $this->file_dst_name_body = $this->file_new_name_body; + $this->log .= '- new file name body : ' . $this->file_new_name_body . '
    '; + } + if (!is_null($this->file_new_name_ext)) { // rename file ext + $this->file_dst_name_ext = $this->file_new_name_ext; + $this->log .= '- new file name ext : ' . $this->file_new_name_ext . '
    '; + } + if (!is_null($this->file_name_body_add)) { // append a string to the name + $this->file_dst_name_body = $this->file_dst_name_body . $this->file_name_body_add; + $this->log .= '- file name body append : ' . $this->file_name_body_add . '
    '; + } + if (!is_null($this->file_name_body_pre)) { // prepend a string to the name + $this->file_dst_name_body = $this->file_name_body_pre . $this->file_dst_name_body; + $this->log .= '- file name body prepend : ' . $this->file_name_body_pre . '
    '; + } + if ($this->file_safe_name) { // formats the name + $this->file_dst_name_body = utf8_encode(strtr(utf8_decode($this->file_dst_name_body), utf8_decode('ŠŽšžŸÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝà áâãäåçèéêëìíîïñòóôõöøùúûüýÿ'), 'SZszYAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy')); + $this->file_dst_name_body = strtr($this->file_dst_name_body, array('Þ' => 'TH', 'þ' => 'th', 'Ð' => 'DH', 'ð' => 'dh', 'ß' => 'ss', 'Œ' => 'OE', 'œ' => 'oe', 'Æ' => 'AE', 'æ' => 'ae', 'µ' => 'u')); + $this->file_dst_name_body = preg_replace(array('/\s/', '/\.[\.]+/', '/[^\w_\.\-]/'), array('_', '.', ''), $this->file_dst_name_body); + $this->log .= '- file name safe format
    '; + } + + $this->log .= '- destination variables
    '; + if (empty($this->file_dst_path) || is_null($this->file_dst_path)) { + $this->log .= '    file_dst_path : n/a
    '; + } else { + $this->log .= '    file_dst_path : ' . $this->file_dst_path . '
    '; + } + $this->log .= '    file_dst_name_body : ' . $this->file_dst_name_body . '
    '; + $this->log .= '    file_dst_name_ext : ' . $this->file_dst_name_ext . '
    '; + + // do we do some image manipulation? + $image_manipulation = ($this->file_is_image && ( + $this->image_resize + || $this->image_convert != '' + || is_numeric($this->image_brightness) + || is_numeric($this->image_contrast) + || is_numeric($this->image_opacity) + || is_numeric($this->image_threshold) + || !empty($this->image_tint_color) + || !empty($this->image_overlay_color) + || $this->image_pixelate + || $this->image_unsharp + || !empty($this->image_text) + || $this->image_greyscale + || $this->image_negative + || !empty($this->image_watermark) + || is_numeric($this->image_rotate) + || is_numeric($this->jpeg_size) + || !empty($this->image_flip) + || !empty($this->image_crop) + || !empty($this->image_precrop) + || !empty($this->image_border) + || !empty($this->image_border_transparent) + || $this->image_frame > 0 + || $this->image_bevel > 0 + || $this->image_reflection_height)); + + // set the destination file name + $this->file_dst_name = $this->file_dst_name_body . (!empty($this->file_dst_name_ext) ? '.' . $this->file_dst_name_ext : ''); + + if (!$return_mode) { + if (!$this->file_auto_rename) { + $this->log .= '- no auto_rename if same filename exists
    '; + $this->file_dst_pathname = $this->file_dst_path . $this->file_dst_name; + } else { + $this->log .= '- checking for auto_rename
    '; + $this->file_dst_pathname = $this->file_dst_path . $this->file_dst_name; + $body = $this->file_dst_name_body; + $ext = ''; + // if we have changed the extension, then we add our increment before + if ($file_src_name_ext != $this->file_src_name_ext) { + if (substr($this->file_dst_name_body, -1 - strlen($this->file_src_name_ext)) == '.' . $this->file_src_name_ext) { + $body = substr($this->file_dst_name_body, 0, strlen($this->file_dst_name_body) - 1 - strlen($this->file_src_name_ext)); + $ext = '.' . $this->file_src_name_ext; + } + } + $cpt = 1; + while (@file_exists($this->file_dst_pathname)) { + $this->file_dst_name_body = $body . '_' . $cpt . $ext; + $this->file_dst_name = $this->file_dst_name_body . (!empty($this->file_dst_name_ext) ? '.' . $this->file_dst_name_ext : ''); + $cpt++; + $this->file_dst_pathname = $this->file_dst_path . $this->file_dst_name; + } + if ($cpt>1) $this->log .= '    auto_rename to ' . $this->file_dst_name . '
    '; + } + + $this->log .= '- destination file details
    '; + $this->log .= '    file_dst_name : ' . $this->file_dst_name . '
    '; + $this->log .= '    file_dst_pathname : ' . $this->file_dst_pathname . '
    '; + + if ($this->file_overwrite) { + $this->log .= '- no overwrite checking
    '; + } else { + if (@file_exists($this->file_dst_pathname)) { + $this->processed = false; + $this->error = $this->translate('already_exists', array($this->file_dst_name)); + } else { + $this->log .= '- ' . $this->file_dst_name . ' doesn\'t exist already
    '; + } + } + } + } + + if ($this->processed) { + // if we have already moved the uploaded file, we use the temporary copy as source file, and check if it exists + if (!empty($this->file_src_temp)) { + $this->log .= '- use the temp file instead of the original file since it is a second process
    '; + $this->file_src_pathname = $this->file_src_temp; + if (!file_exists($this->file_src_pathname)) { + $this->processed = false; + $this->error = $this->translate('temp_file_missing'); + } + // if we haven't a temp file, and that we do check on uploads, we use is_uploaded_file() + } else if (!$this->no_upload_check) { + if (!is_uploaded_file($this->file_src_pathname)) { + $this->processed = false; + $this->error = $this->translate('source_missing'); + } + // otherwise, if we don't check on uploaded files (local file for instance), we use file_exists() + } else { + if (!file_exists($this->file_src_pathname)) { + $this->processed = false; + $this->error = $this->translate('source_missing'); + } + } + + // checks if the destination directory exists, and attempt to create it + if (!$return_mode) { + if ($this->processed && !file_exists($this->file_dst_path)) { + if ($this->dir_auto_create) { + $this->log .= '- ' . $this->file_dst_path . ' doesn\'t exist. Attempting creation:'; + if (!$this->rmkdir($this->file_dst_path, $this->dir_chmod)) { + $this->log .= ' failed
    '; + $this->processed = false; + $this->error = $this->translate('destination_dir'); + } else { + $this->log .= ' success
    '; + } + } else { + $this->error = $this->translate('destination_dir_missing'); + } + } + + if ($this->processed && !is_dir($this->file_dst_path)) { + $this->processed = false; + $this->error = $this->translate('destination_path_not_dir'); + } + + // checks if the destination directory is writeable, and attempt to make it writeable + $hash = md5($this->file_dst_name_body . rand(1, 1000)); + if ($this->processed && !($f = @fopen($this->file_dst_path . $hash . (!empty($this->file_dst_name_ext) ? '.' . $this->file_dst_name_ext : ''), 'a+'))) { + if ($this->dir_auto_chmod) { + $this->log .= '- ' . $this->file_dst_path . ' is not writeable. Attempting chmod:'; + if (!@chmod($this->file_dst_path, $this->dir_chmod)) { + $this->log .= ' failed
    '; + $this->processed = false; + $this->error = $this->translate('destination_dir_write'); + } else { + $this->log .= ' success
    '; + if (!($f = @fopen($this->file_dst_path . $hash . (!empty($this->file_dst_name_ext) ? '.' . $this->file_dst_name_ext : ''), 'a+'))) { // we re-check + $this->processed = false; + $this->error = $this->translate('destination_dir_write'); + } else { + @fclose($f); + } + } + } else { + $this->processed = false; + $this->error = $this->translate('destination_path_write'); + } + } else { + if ($this->processed) @fclose($f); + @unlink($this->file_dst_path . $hash . (!empty($this->file_dst_name_ext) ? '.' . $this->file_dst_name_ext : '')); + } + + + // if we have an uploaded file, and if it is the first process, and if we can't access the file directly (open_basedir restriction) + // then we create a temp file that will be used as the source file in subsequent processes + // the third condition is there to check if the file is not accessible *directly* (it already has positively gone through is_uploaded_file(), so it exists) + if (!$this->no_upload_check && empty($this->file_src_temp) && !@file_exists($this->file_src_pathname)) { + $this->log .= '- attempting to use a temp file:'; + $hash = md5($this->file_dst_name_body . rand(1, 1000)); + if (move_uploaded_file($this->file_src_pathname, $this->file_dst_path . $hash . (!empty($this->file_dst_name_ext) ? '.' . $this->file_dst_name_ext : ''))) { + $this->file_src_pathname = $this->file_dst_path . $hash . (!empty($this->file_dst_name_ext) ? '.' . $this->file_dst_name_ext : ''); + $this->file_src_temp = $this->file_src_pathname; + $this->log .= ' file created
    '; + $this->log .= '    temp file is: ' . $this->file_src_temp . '
    '; + } else { + $this->log .= ' failed
    '; + $this->processed = false; + $this->error = $this->translate('temp_file'); + } + } + } + } + + if ($this->processed) { + + // we do a quick check to ensure the file is really an image + // we can do this only now, as it would have failed before in case of open_basedir + if ($image_manipulation && !@getimagesize($this->file_src_pathname)) { + $this->log .= '- the file is not an image!
    '; + $image_manipulation = false; + } + + if ($image_manipulation) { + + // make sure GD doesn't complain too much + @ini_set("gd.jpeg_ignore_warning", 1); + + // checks if the source file is readable + if ($this->processed && !($f = @fopen($this->file_src_pathname, 'r'))) { + $this->processed = false; + $this->error = $this->translate('source_not_readable'); + } else { + @fclose($f); + } + + // we now do all the image manipulations + $this->log .= '- image resizing or conversion wanted
    '; + if ($this->gdversion()) { + switch($this->image_src_type) { + case 'jpg': + if (!function_exists('imagecreatefromjpeg')) { + $this->processed = false; + $this->error = $this->translate('no_create_support', array('JPEG')); + } else { + $image_src = @imagecreatefromjpeg($this->file_src_pathname); + if (!$image_src) { + $this->processed = false; + $this->error = $this->translate('create_error', array('JPEG')); + } else { + $this->log .= '- source image is JPEG
    '; + } + } + break; + case 'png': + if (!function_exists('imagecreatefrompng')) { + $this->processed = false; + $this->error = $this->translate('no_create_support', array('PNG')); + } else { + $image_src = @imagecreatefrompng($this->file_src_pathname); + if (!$image_src) { + $this->processed = false; + $this->error = $this->translate('create_error', array('PNG')); + } else { + $this->log .= '- source image is PNG
    '; + } + } + break; + case 'gif': + if (!function_exists('imagecreatefromgif')) { + $this->processed = false; + $this->error = $this->translate('no_create_support', array('GIF')); + } else { + $image_src = @imagecreatefromgif($this->file_src_pathname); + if (!$image_src) { + $this->processed = false; + $this->error = $this->translate('create_error', array('GIF')); + } else { + $this->log .= '- source image is GIF
    '; + } + } + break; + case 'bmp': + if (!method_exists($this, 'imagecreatefrombmp')) { + $this->processed = false; + $this->error = $this->translate('no_create_support', array('BMP')); + } else { + $image_src = @$this->imagecreatefrombmp($this->file_src_pathname); + if (!$image_src) { + $this->processed = false; + $this->error = $this->translate('create_error', array('BMP')); + } else { + $this->log .= '- source image is BMP
    '; + } + } + break; + default: + $this->processed = false; + $this->error = $this->translate('source_invalid'); + } + } else { + $this->processed = false; + $this->error = $this->translate('gd_missing'); + } + + if ($this->processed && $image_src) { + + // we have to set image_convert if it is not already + if (empty($this->image_convert)) { + $this->log .= '- setting destination file type to ' . $this->image_src_type . '
    '; + $this->image_convert = $this->image_src_type; + } + + if (!in_array($this->image_convert, $this->image_supported)) { + $this->image_convert = 'jpg'; + } + + // we set the default color to be the background color if we don't output in a transparent format + if ($this->image_convert != 'png' && $this->image_convert != 'gif' && !empty($this->image_default_color) && empty($this->image_background_color)) $this->image_background_color = $this->image_default_color; + if (!empty($this->image_background_color)) $this->image_default_color = $this->image_background_color; + if (empty($this->image_default_color)) $this->image_default_color = '#FFFFFF'; + + $this->image_src_x = imagesx($image_src); + $this->image_src_y = imagesy($image_src); + $gd_version = $this->gdversion(); + $ratio_crop = null; + + if (!imageistruecolor($image_src)) { // $this->image_src_type == 'gif' + $this->log .= '- image is detected as having a palette
    '; + $this->image_is_palette = true; + $this->image_transparent_color = imagecolortransparent($image_src); + if ($this->image_transparent_color >= 0 && imagecolorstotal($image_src) > $this->image_transparent_color) { + $this->image_is_transparent = true; + $this->log .= '    palette image is detected as transparent
    '; + } + // if the image has a palette (GIF), we convert it to true color, preserving transparency + $this->log .= '    convert palette image to true color
    '; + $true_color = imagecreatetruecolor($this->image_src_x, $this->image_src_y); + imagealphablending($true_color, false); + imagesavealpha($true_color, true); + for ($x = 0; $x < $this->image_src_x; $x++) { + for ($y = 0; $y < $this->image_src_y; $y++) { + if ($this->image_transparent_color >= 0 && imagecolorat($image_src, $x, $y) == $this->image_transparent_color) { + imagesetpixel($true_color, $x, $y, 127 << 24); + } else { + $rgb = imagecolorsforindex($image_src, imagecolorat($image_src, $x, $y)); + imagesetpixel($true_color, $x, $y, ($rgb['alpha'] << 24) | ($rgb['red'] << 16) | ($rgb['green'] << 8) | $rgb['blue']); + } + } + } + $image_src = $this->imagetransfer($true_color, $image_src); + imagealphablending($image_src, false); + imagesavealpha($image_src, true); + $this->image_is_palette = false; + } + + + $image_dst = & $image_src; + + // pre-crop image, before resizing + if ((!empty($this->image_precrop))) { + list($ct, $cr, $cb, $cl) = $this->getoffsets($this->image_precrop, $this->image_src_x, $this->image_src_y, true, true); + $this->log .= '- pre-crop image : ' . $ct . ' ' . $cr . ' ' . $cb . ' ' . $cl . '
    '; + $this->image_src_x = $this->image_src_x - $cl - $cr; + $this->image_src_y = $this->image_src_y - $ct - $cb; + if ($this->image_src_x < 1) $this->image_src_x = 1; + if ($this->image_src_y < 1) $this->image_src_y = 1; + $tmp = $this->imagecreatenew($this->image_src_x, $this->image_src_y); + + // we copy the image into the recieving image + imagecopy($tmp, $image_dst, 0, 0, $cl, $ct, $this->image_src_x, $this->image_src_y); + + // if we crop with negative margins, we have to make sure the extra bits are the right color, or transparent + if ($ct < 0 || $cr < 0 || $cb < 0 || $cl < 0 ) { + // use the background color if present + if (!empty($this->image_background_color)) { + list($red, $green, $blue) = $this->getcolors($this->image_background_color); + $fill = imagecolorallocate($tmp, $red, $green, $blue); + } else { + $fill = imagecolorallocatealpha($tmp, 0, 0, 0, 127); + } + // fills eventual negative margins + if ($ct < 0) imagefilledrectangle($tmp, 0, 0, $this->image_src_x, -$ct, $fill); + if ($cr < 0) imagefilledrectangle($tmp, $this->image_src_x + $cr, 0, $this->image_src_x, $this->image_src_y, $fill); + if ($cb < 0) imagefilledrectangle($tmp, 0, $this->image_src_y + $cb, $this->image_src_x, $this->image_src_y, $fill); + if ($cl < 0) imagefilledrectangle($tmp, 0, 0, -$cl, $this->image_src_y, $fill); + } + + // we transfert tmp into image_dst + $image_dst = $this->imagetransfer($tmp, $image_dst); + } + + // resize image (and move image_src_x, image_src_y dimensions into image_dst_x, image_dst_y) + if ($this->image_resize) { + $this->log .= '- resizing...
    '; + + if ($this->image_ratio_x) { + $this->log .= '    calculate x size
    '; + $this->image_dst_x = round(($this->image_src_x * $this->image_y) / $this->image_src_y); + $this->image_dst_y = $this->image_y; + } else if ($this->image_ratio_y) { + $this->log .= '    calculate y size
    '; + $this->image_dst_x = $this->image_x; + $this->image_dst_y = round(($this->image_src_y * $this->image_x) / $this->image_src_x); + } else if (is_numeric($this->image_ratio_pixels)) { + $this->log .= '    calculate x/y size to match a number of pixels
    '; + $pixels = $this->image_src_y * $this->image_src_x; + $diff = sqrt($this->image_ratio_pixels / $pixels); + $this->image_dst_x = round($this->image_src_x * $diff); + $this->image_dst_y = round($this->image_src_y * $diff); + } else if ($this->image_ratio || $this->image_ratio_crop || $this->image_ratio_fill || $this->image_ratio_no_zoom_in || $this->image_ratio_no_zoom_out) { + $this->log .= '    check x/y sizes
    '; + if ((!$this->image_ratio_no_zoom_in && !$this->image_ratio_no_zoom_out) + || ($this->image_ratio_no_zoom_in && ($this->image_src_x > $this->image_x || $this->image_src_y > $this->image_y)) + || ($this->image_ratio_no_zoom_out && $this->image_src_x < $this->image_x && $this->image_src_y < $this->image_y)) { + $this->image_dst_x = $this->image_x; + $this->image_dst_y = $this->image_y; + if ($this->image_ratio_crop) { + if (!is_string($this->image_ratio_crop)) $this->image_ratio_crop = ''; + $this->image_ratio_crop = strtolower($this->image_ratio_crop); + if (($this->image_src_x/$this->image_x) > ($this->image_src_y/$this->image_y)) { + $this->image_dst_y = $this->image_y; + $this->image_dst_x = intval($this->image_src_x*($this->image_y / $this->image_src_y)); + $ratio_crop = array(); + $ratio_crop['x'] = $this->image_dst_x - $this->image_x; + if (strpos($this->image_ratio_crop, 'l') !== false) { + $ratio_crop['l'] = 0; + $ratio_crop['r'] = $ratio_crop['x']; + } else if (strpos($this->image_ratio_crop, 'r') !== false) { + $ratio_crop['l'] = $ratio_crop['x']; + $ratio_crop['r'] = 0; + } else { + $ratio_crop['l'] = round($ratio_crop['x']/2); + $ratio_crop['r'] = $ratio_crop['x'] - $ratio_crop['l']; + } + $this->log .= '    ratio_crop_x : ' . $ratio_crop['x'] . ' (' . $ratio_crop['l'] . ';' . $ratio_crop['r'] . ')
    '; + if (is_null($this->image_crop)) $this->image_crop = array(0, 0, 0, 0); + } else { + $this->image_dst_x = $this->image_x; + $this->image_dst_y = intval($this->image_src_y*($this->image_x / $this->image_src_x)); + $ratio_crop = array(); + $ratio_crop['y'] = $this->image_dst_y - $this->image_y; + if (strpos($this->image_ratio_crop, 't') !== false) { + $ratio_crop['t'] = 0; + $ratio_crop['b'] = $ratio_crop['y']; + } else if (strpos($this->image_ratio_crop, 'b') !== false) { + $ratio_crop['t'] = $ratio_crop['y']; + $ratio_crop['b'] = 0; + } else { + $ratio_crop['t'] = round($ratio_crop['y']/2); + $ratio_crop['b'] = $ratio_crop['y'] - $ratio_crop['t']; + } + $this->log .= '    ratio_crop_y : ' . $ratio_crop['y'] . ' (' . $ratio_crop['t'] . ';' . $ratio_crop['b'] . ')
    '; + if (is_null($this->image_crop)) $this->image_crop = array(0, 0, 0, 0); + } + } else if ($this->image_ratio_fill) { + if (!is_string($this->image_ratio_fill)) $this->image_ratio_fill = ''; + $this->image_ratio_fill = strtolower($this->image_ratio_fill); + if (($this->image_src_x/$this->image_x) < ($this->image_src_y/$this->image_y)) { + $this->image_dst_y = $this->image_y; + $this->image_dst_x = intval($this->image_src_x*($this->image_y / $this->image_src_y)); + $ratio_crop = array(); + $ratio_crop['x'] = $this->image_dst_x - $this->image_x; + if (strpos($this->image_ratio_fill, 'l') !== false) { + $ratio_crop['l'] = 0; + $ratio_crop['r'] = $ratio_crop['x']; + } else if (strpos($this->image_ratio_fill, 'r') !== false) { + $ratio_crop['l'] = $ratio_crop['x']; + $ratio_crop['r'] = 0; + } else { + $ratio_crop['l'] = round($ratio_crop['x']/2); + $ratio_crop['r'] = $ratio_crop['x'] - $ratio_crop['l']; + } + $this->log .= '    ratio_fill_x : ' . $ratio_crop['x'] . ' (' . $ratio_crop['l'] . ';' . $ratio_crop['r'] . ')
    '; + if (is_null($this->image_crop)) $this->image_crop = array(0, 0, 0, 0); + } else { + $this->image_dst_x = $this->image_x; + $this->image_dst_y = intval($this->image_src_y*($this->image_x / $this->image_src_x)); + $ratio_crop = array(); + $ratio_crop['y'] = $this->image_dst_y - $this->image_y; + if (strpos($this->image_ratio_fill, 't') !== false) { + $ratio_crop['t'] = 0; + $ratio_crop['b'] = $ratio_crop['y']; + } else if (strpos($this->image_ratio_fill, 'b') !== false) { + $ratio_crop['t'] = $ratio_crop['y']; + $ratio_crop['b'] = 0; + } else { + $ratio_crop['t'] = round($ratio_crop['y']/2); + $ratio_crop['b'] = $ratio_crop['y'] - $ratio_crop['t']; + } + $this->log .= '    ratio_fill_y : ' . $ratio_crop['y'] . ' (' . $ratio_crop['t'] . ';' . $ratio_crop['b'] . ')
    '; + if (is_null($this->image_crop)) $this->image_crop = array(0, 0, 0, 0); + } + } else { + if (($this->image_src_x/$this->image_x) > ($this->image_src_y/$this->image_y)) { + $this->image_dst_x = $this->image_x; + $this->image_dst_y = intval($this->image_src_y*($this->image_x / $this->image_src_x)); + } else { + $this->image_dst_y = $this->image_y; + $this->image_dst_x = intval($this->image_src_x*($this->image_y / $this->image_src_y)); + } + } + } else { + $this->log .= '    doesn\'t calculate x/y sizes
    '; + $this->image_dst_x = $this->image_src_x; + $this->image_dst_y = $this->image_src_y; + } + } else { + $this->log .= '    use plain sizes
    '; + $this->image_dst_x = $this->image_x; + $this->image_dst_y = $this->image_y; + } + + if ($this->image_dst_x < 1) $this->image_dst_x = 1; + if ($this->image_dst_y < 1) $this->image_dst_y = 1; + $tmp = $this->imagecreatenew($this->image_dst_x, $this->image_dst_y); + + if ($gd_version >= 2) { + $res = imagecopyresampled($tmp, $image_src, 0, 0, 0, 0, $this->image_dst_x, $this->image_dst_y, $this->image_src_x, $this->image_src_y); + } else { + $res = imagecopyresized($tmp, $image_src, 0, 0, 0, 0, $this->image_dst_x, $this->image_dst_y, $this->image_src_x, $this->image_src_y); + } + + $this->log .= '    resized image object created
    '; + $this->log .= '    image_src_x y : ' . $this->image_src_x . ' x ' . $this->image_src_y . '
    '; + $this->log .= '    image_dst_x y : ' . $this->image_dst_x . ' x ' . $this->image_dst_y . '
    '; + // we transfert tmp into image_dst + $image_dst = $this->imagetransfer($tmp, $image_dst); + + } else { + $this->image_dst_x = $this->image_src_x; + $this->image_dst_y = $this->image_src_y; + } + + // crop image (and also crops if image_ratio_crop is used) + if ((!empty($this->image_crop) || !is_null($ratio_crop))) { + list($ct, $cr, $cb, $cl) = $this->getoffsets($this->image_crop, $this->image_dst_x, $this->image_dst_y, true, true); + // we adjust the cropping if we use image_ratio_crop + if (!is_null($ratio_crop)) { + if (array_key_exists('t', $ratio_crop)) $ct += $ratio_crop['t']; + if (array_key_exists('r', $ratio_crop)) $cr += $ratio_crop['r']; + if (array_key_exists('b', $ratio_crop)) $cb += $ratio_crop['b']; + if (array_key_exists('l', $ratio_crop)) $cl += $ratio_crop['l']; + } + $this->log .= '- crop image : ' . $ct . ' ' . $cr . ' ' . $cb . ' ' . $cl . '
    '; + $this->image_dst_x = $this->image_dst_x - $cl - $cr; + $this->image_dst_y = $this->image_dst_y - $ct - $cb; + if ($this->image_dst_x < 1) $this->image_dst_x = 1; + if ($this->image_dst_y < 1) $this->image_dst_y = 1; + $tmp = $this->imagecreatenew($this->image_dst_x, $this->image_dst_y); + + // we copy the image into the recieving image + imagecopy($tmp, $image_dst, 0, 0, $cl, $ct, $this->image_dst_x, $this->image_dst_y); + + // if we crop with negative margins, we have to make sure the extra bits are the right color, or transparent + if ($ct < 0 || $cr < 0 || $cb < 0 || $cl < 0 ) { + // use the background color if present + if (!empty($this->image_background_color)) { + list($red, $green, $blue) = $this->getcolors($this->image_background_color); + $fill = imagecolorallocate($tmp, $red, $green, $blue); + } else { + $fill = imagecolorallocatealpha($tmp, 0, 0, 0, 127); + } + // fills eventual negative margins + if ($ct < 0) imagefilledrectangle($tmp, 0, 0, $this->image_dst_x, -$ct-1, $fill); + if ($cr < 0) imagefilledrectangle($tmp, $this->image_dst_x + $cr, 0, $this->image_dst_x, $this->image_dst_y, $fill); + if ($cb < 0) imagefilledrectangle($tmp, 0, $this->image_dst_y + $cb, $this->image_dst_x, $this->image_dst_y, $fill); + if ($cl < 0) imagefilledrectangle($tmp, 0, 0, -$cl-1, $this->image_dst_y, $fill); + } + + // we transfert tmp into image_dst + $image_dst = $this->imagetransfer($tmp, $image_dst); + } + + // flip image + if ($gd_version >= 2 && !empty($this->image_flip)) { + $this->image_flip = strtolower($this->image_flip); + $this->log .= '- flip image : ' . $this->image_flip . '
    '; + $tmp = $this->imagecreatenew($this->image_dst_x, $this->image_dst_y); + for ($x = 0; $x < $this->image_dst_x; $x++) { + for ($y = 0; $y < $this->image_dst_y; $y++){ + if (strpos($this->image_flip, 'v') !== false) { + imagecopy($tmp, $image_dst, $this->image_dst_x - $x - 1, $y, $x, $y, 1, 1); + } else { + imagecopy($tmp, $image_dst, $x, $this->image_dst_y - $y - 1, $x, $y, 1, 1); + } + } + } + // we transfert tmp into image_dst + $image_dst = $this->imagetransfer($tmp, $image_dst); + } + + // rotate image + if ($gd_version >= 2 && is_numeric($this->image_rotate)) { + if (!in_array($this->image_rotate, array(0, 90, 180, 270))) $this->image_rotate = 0; + if ($this->image_rotate != 0) { + if ($this->image_rotate == 90 || $this->image_rotate == 270) { + $tmp = $this->imagecreatenew($this->image_dst_y, $this->image_dst_x); + } else { + $tmp = $this->imagecreatenew($this->image_dst_x, $this->image_dst_y); + } + $this->log .= '- rotate image : ' . $this->image_rotate . '
    '; + for ($x = 0; $x < $this->image_dst_x; $x++) { + for ($y = 0; $y < $this->image_dst_y; $y++){ + if ($this->image_rotate == 90) { + imagecopy($tmp, $image_dst, $y, $x, $x, $this->image_dst_y - $y - 1, 1, 1); + } else if ($this->image_rotate == 180) { + imagecopy($tmp, $image_dst, $x, $y, $this->image_dst_x - $x - 1, $this->image_dst_y - $y - 1, 1, 1); + } else if ($this->image_rotate == 270) { + imagecopy($tmp, $image_dst, $y, $x, $this->image_dst_x - $x - 1, $y, 1, 1); + } else { + imagecopy($tmp, $image_dst, $x, $y, $x, $y, 1, 1); + } + } + } + if ($this->image_rotate == 90 || $this->image_rotate == 270) { + $t = $this->image_dst_y; + $this->image_dst_y = $this->image_dst_x; + $this->image_dst_x = $t; + } + // we transfert tmp into image_dst + $image_dst = $this->imagetransfer($tmp, $image_dst); + } + } + + // pixelate image + if ((is_numeric($this->image_pixelate) && $this->image_pixelate > 0)) { + $this->log .= '- pixelate image (' . $this->image_pixelate . 'px)
    '; + $filter = $this->imagecreatenew($this->image_dst_x, $this->image_dst_y); + if ($gd_version >= 2) { + imagecopyresampled($filter, $image_dst, 0, 0, 0, 0, round($this->image_dst_x / $this->image_pixelate), round($this->image_dst_y / $this->image_pixelate), $this->image_dst_x, $this->image_dst_y); + imagecopyresampled($image_dst, $filter, 0, 0, 0, 0, $this->image_dst_x, $this->image_dst_y, round($this->image_dst_x / $this->image_pixelate), round($this->image_dst_y / $this->image_pixelate)); + } else { + imagecopyresized($filter, $image_dst, 0, 0, 0, 0, round($this->image_dst_x / $this->image_pixelate), round($this->image_dst_y / $this->image_pixelate), $this->image_dst_x, $this->image_dst_y); + imagecopyresized($image_dst, $filter, 0, 0, 0, 0, $this->image_dst_x, $this->image_dst_y, round($this->image_dst_x / $this->image_pixelate), round($this->image_dst_y / $this->image_pixelate)); + } + imagedestroy($filter); + } + + // unsharp mask + if ($gd_version >= 2 && $this->image_unsharp && is_numeric($this->image_unsharp_amount) && is_numeric($this->image_unsharp_radius) && is_numeric($this->image_unsharp_threshold)) { + // Unsharp Mask for PHP - version 2.1.1 + // Unsharp mask algorithm by Torstein Hønsi 2003-07. + // Used with permission + // Modified to support alpha transparency + if ($this->image_unsharp_amount > 500) $this->image_unsharp_amount = 500; + $this->image_unsharp_amount = $this->image_unsharp_amount * 0.016; + if ($this->image_unsharp_radius > 50) $this->image_unsharp_radius = 50; + $this->image_unsharp_radius = $this->image_unsharp_radius * 2; + if ($this->image_unsharp_threshold > 255) $this->image_unsharp_threshold = 255; + $this->image_unsharp_radius = abs(round($this->image_unsharp_radius)); + if ($this->image_unsharp_radius != 0) { + $this->image_dst_x = imagesx($image_dst); $this->image_dst_y = imagesy($image_dst); + $canvas = $this->imagecreatenew($this->image_dst_x, $this->image_dst_y, false, true); + $blur = $this->imagecreatenew($this->image_dst_x, $this->image_dst_y, false, true); + if (function_exists('imageconvolution')) { // PHP >= 5.1 + $matrix = array(array( 1, 2, 1 ), array( 2, 4, 2 ), array( 1, 2, 1 )); + imagecopy($blur, $image_dst, 0, 0, 0, 0, $this->image_dst_x, $this->image_dst_y); + imageconvolution($blur, $matrix, 16, 0); + } else { + for ($i = 0; $i < $this->image_unsharp_radius; $i++) { + imagecopy($blur, $image_dst, 0, 0, 1, 0, $this->image_dst_x - 1, $this->image_dst_y); // left + $this->imagecopymergealpha($blur, $image_dst, 1, 0, 0, 0, $this->image_dst_x, $this->image_dst_y, 50); // right + $this->imagecopymergealpha($blur, $image_dst, 0, 0, 0, 0, $this->image_dst_x, $this->image_dst_y, 50); // center + imagecopy($canvas, $blur, 0, 0, 0, 0, $this->image_dst_x, $this->image_dst_y); + $this->imagecopymergealpha($blur, $canvas, 0, 0, 0, 1, $this->image_dst_x, $this->image_dst_y - 1, 33.33333 ); // up + $this->imagecopymergealpha($blur, $canvas, 0, 1, 0, 0, $this->image_dst_x, $this->image_dst_y, 25); // down + } + } + $p_new = array(); + if($this->image_unsharp_threshold>0) { + for ($x = 0; $x < $this->image_dst_x-1; $x++) { + for ($y = 0; $y < $this->image_dst_y; $y++) { + $p_orig = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y)); + $p_blur = imagecolorsforindex($blur, imagecolorat($blur, $x, $y)); + $p_new['red'] = (abs($p_orig['red'] - $p_blur['red']) >= $this->image_unsharp_threshold) ? max(0, min(255, ($this->image_unsharp_amount * ($p_orig['red'] - $p_blur['red'])) + $p_orig['red'])) : $p_orig['red']; + $p_new['green'] = (abs($p_orig['green'] - $p_blur['green']) >= $this->image_unsharp_threshold) ? max(0, min(255, ($this->image_unsharp_amount * ($p_orig['green'] - $p_blur['green'])) + $p_orig['green'])) : $p_orig['green']; + $p_new['blue'] = (abs($p_orig['blue'] - $p_blur['blue']) >= $this->image_unsharp_threshold) ? max(0, min(255, ($this->image_unsharp_amount * ($p_orig['blue'] - $p_blur['blue'])) + $p_orig['blue'])) : $p_orig['blue']; + if (($p_orig['red'] != $p_new['red']) || ($p_orig['green'] != $p_new['green']) || ($p_orig['blue'] != $p_new['blue'])) { + $color = imagecolorallocatealpha($image_dst, $p_new['red'], $p_new['green'], $p_new['blue'], $p_orig['alpha']); + imagesetpixel($image_dst, $x, $y, $color); + } + } + } + } else { + for ($x = 0; $x < $this->image_dst_x; $x++) { + for ($y = 0; $y < $this->image_dst_y; $y++) { + $p_orig = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y)); + $p_blur = imagecolorsforindex($blur, imagecolorat($blur, $x, $y)); + $p_new['red'] = ($this->image_unsharp_amount * ($p_orig['red'] - $p_blur['red'])) + $p_orig['red']; + if ($p_new['red']>255) { $p_new['red']=255; } elseif ($p_new['red']<0) { $p_new['red']=0; } + $p_new['green'] = ($this->image_unsharp_amount * ($p_orig['green'] - $p_blur['green'])) + $p_orig['green']; + if ($p_new['green']>255) { $p_new['green']=255; } elseif ($p_new['green']<0) { $p_new['green']=0; } + $p_new['blue'] = ($this->image_unsharp_amount * ($p_orig['blue'] - $p_blur['blue'])) + $p_orig['blue']; + if ($p_new['blue']>255) { $p_new['blue']=255; } elseif ($p_new['blue']<0) { $p_new['blue']=0; } + $color = imagecolorallocatealpha($image_dst, $p_new['red'], $p_new['green'], $p_new['blue'], $p_orig['alpha']); + imagesetpixel($image_dst, $x, $y, $color); + } + } + } + imagedestroy($canvas); + imagedestroy($blur); + } + } + + // add color overlay + if ($gd_version >= 2 && (is_numeric($this->image_overlay_opacity) && $this->image_overlay_opacity > 0 && !empty($this->image_overlay_color))) { + $this->log .= '- apply color overlay
    '; + list($red, $green, $blue) = $this->getcolors($this->image_overlay_color); + $filter = imagecreatetruecolor($this->image_dst_x, $this->image_dst_y); + $color = imagecolorallocate($filter, $red, $green, $blue); + imagefilledrectangle($filter, 0, 0, $this->image_dst_x, $this->image_dst_y, $color); + $this->imagecopymergealpha($image_dst, $filter, 0, 0, 0, 0, $this->image_dst_x, $this->image_dst_y, $this->image_overlay_opacity); + imagedestroy($filter); + } + + // add brightness, contrast and tint, turns to greyscale and inverts colors + if ($gd_version >= 2 && ($this->image_negative || $this->image_greyscale || is_numeric($this->image_threshold)|| is_numeric($this->image_brightness) || is_numeric($this->image_contrast) || !empty($this->image_tint_color))) { + $this->log .= '- apply tint, light, contrast correction, negative, greyscale and threshold
    '; + if (!empty($this->image_tint_color)) list($tint_red, $tint_green, $tint_blue) = $this->getcolors($this->image_tint_color); + //imagealphablending($image_dst, true); + for($y=0; $y < $this->image_dst_y; $y++) { + for($x=0; $x < $this->image_dst_x; $x++) { + if ($this->image_greyscale) { + $pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y)); + $r = $g = $b = round((0.2125 * $pixel['red']) + (0.7154 * $pixel['green']) + (0.0721 * $pixel['blue'])); + $color = imagecolorallocatealpha($image_dst, $r, $g, $b, $pixel['alpha']); + imagesetpixel($image_dst, $x, $y, $color); + unset($color); unset($pixel); + } + if (is_numeric($this->image_threshold)) { + $pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y)); + $c = (round($pixel['red'] + $pixel['green'] + $pixel['blue']) / 3) - 127; + $r = $g = $b = ($c > $this->image_threshold ? 255 : 0); + $color = imagecolorallocatealpha($image_dst, $r, $g, $b, $pixel['alpha']); + imagesetpixel($image_dst, $x, $y, $color); + unset($color); unset($pixel); + } + if (is_numeric($this->image_brightness)) { + $pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y)); + $r = max(min(round($pixel['red'] + (($this->image_brightness * 2))), 255), 0); + $g = max(min(round($pixel['green'] + (($this->image_brightness * 2))), 255), 0); + $b = max(min(round($pixel['blue'] + (($this->image_brightness * 2))), 255), 0); + $color = imagecolorallocatealpha($image_dst, $r, $g, $b, $pixel['alpha']); + imagesetpixel($image_dst, $x, $y, $color); + unset($color); unset($pixel); + } + if (is_numeric($this->image_contrast)) { + $pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y)); + $r = max(min(round(($this->image_contrast + 128) * $pixel['red'] / 128), 255), 0); + $g = max(min(round(($this->image_contrast + 128) * $pixel['green'] / 128), 255), 0); + $b = max(min(round(($this->image_contrast + 128) * $pixel['blue'] / 128), 255), 0); + $color = imagecolorallocatealpha($image_dst, $r, $g, $b, $pixel['alpha']); + imagesetpixel($image_dst, $x, $y, $color); + unset($color); unset($pixel); + } + if (!empty($this->image_tint_color)) { + $pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y)); + $r = min(round($tint_red * $pixel['red'] / 169), 255); + $g = min(round($tint_green * $pixel['green'] / 169), 255); + $b = min(round($tint_blue * $pixel['blue'] / 169), 255); + $color = imagecolorallocatealpha($image_dst, $r, $g, $b, $pixel['alpha']); + imagesetpixel($image_dst, $x, $y, $color); + unset($color); unset($pixel); + } + if (!empty($this->image_negative)) { + $pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y)); + $r = round(255 - $pixel['red']); + $g = round(255 - $pixel['green']); + $b = round(255 - $pixel['blue']); + $color = imagecolorallocatealpha($image_dst, $r, $g, $b, $pixel['alpha']); + imagesetpixel($image_dst, $x, $y, $color); + unset($color); unset($pixel); + } + } + } + } + + // adds a border + if ($gd_version >= 2 && !empty($this->image_border)) { + list($ct, $cr, $cb, $cl) = $this->getoffsets($this->image_border, $this->image_dst_x, $this->image_dst_y, true, false); + $this->log .= '- add border : ' . $ct . ' ' . $cr . ' ' . $cb . ' ' . $cl . '
    '; + $this->image_dst_x = $this->image_dst_x + $cl + $cr; + $this->image_dst_y = $this->image_dst_y + $ct + $cb; + if (!empty($this->image_border_color)) list($red, $green, $blue) = $this->getcolors($this->image_border_color); + $opacity = (is_numeric($this->image_border_opacity) ? (int) (127 - $this->image_border_opacity / 100 * 127): 0); + // we now create an image, that we fill with the border color + $tmp = $this->imagecreatenew($this->image_dst_x, $this->image_dst_y); + $background = imagecolorallocatealpha($tmp, $red, $green, $blue, $opacity); + imagefilledrectangle($tmp, 0, 0, $this->image_dst_x, $this->image_dst_y, $background); + // we then copy the source image into the new image, without merging so that only the border is actually kept + imagecopy($tmp, $image_dst, $cl, $ct, 0, 0, $this->image_dst_x - $cr - $cl, $this->image_dst_y - $cb - $ct); + // we transfert tmp into image_dst + $image_dst = $this->imagetransfer($tmp, $image_dst); + } + + // adds a fading-to-transparent border + if ($gd_version >= 2 && !empty($this->image_border_transparent)) { + list($ct, $cr, $cb, $cl) = $this->getoffsets($this->image_border_transparent, $this->image_dst_x, $this->image_dst_y, true, false); + $this->log .= '- add transparent border : ' . $ct . ' ' . $cr . ' ' . $cb . ' ' . $cl . '
    '; + // we now create an image, that we fill with the border color + $tmp = $this->imagecreatenew($this->image_dst_x, $this->image_dst_y); + // we then copy the source image into the new image, without the borders + imagecopy($tmp, $image_dst, $cl, $ct, $cl, $ct, $this->image_dst_x - $cr - $cl, $this->image_dst_y - $cb - $ct); + // we now add the top border + $opacity = 100; + for ($y = $ct - 1; $y >= 0; $y--) { + $il = (int) ($ct > 0 ? ($cl * ($y / $ct)) : 0); + $ir = (int) ($ct > 0 ? ($cr * ($y / $ct)) : 0); + for ($x = $il; $x < $this->image_dst_x - $ir; $x++) { + $pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y)); + $alpha = (1 - ($pixel['alpha'] / 127)) * $opacity / 100; + if ($alpha > 0) { + if ($alpha > 1) $alpha = 1; + $color = imagecolorallocatealpha($tmp, $pixel['red'] , $pixel['green'], $pixel['blue'], round((1 - $alpha) * 127)); + imagesetpixel($tmp, $x, $y, $color); + } + } + if ($opacity > 0) $opacity = $opacity - (100 / $ct); + } + // we now add the right border + $opacity = 100; + for ($x = $this->image_dst_x - $cr; $x < $this->image_dst_x; $x++) { + $it = (int) ($cr > 0 ? ($ct * (($this->image_dst_x - $x - 1) / $cr)) : 0); + $ib = (int) ($cr > 0 ? ($cb * (($this->image_dst_x - $x - 1) / $cr)) : 0); + for ($y = $it; $y < $this->image_dst_y - $ib; $y++) { + $pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y)); + $alpha = (1 - ($pixel['alpha'] / 127)) * $opacity / 100; + if ($alpha > 0) { + if ($alpha > 1) $alpha = 1; + $color = imagecolorallocatealpha($tmp, $pixel['red'] , $pixel['green'], $pixel['blue'], round((1 - $alpha) * 127)); + imagesetpixel($tmp, $x, $y, $color); + } + } + if ($opacity > 0) $opacity = $opacity - (100 / $cr); + } + // we now add the bottom border + $opacity = 100; + for ($y = $this->image_dst_y - $cb; $y < $this->image_dst_y; $y++) { + $il = (int) ($cb > 0 ? ($cl * (($this->image_dst_y - $y - 1) / $cb)) : 0); + $ir = (int) ($cb > 0 ? ($cr * (($this->image_dst_y - $y - 1) / $cb)) : 0); + for ($x = $il; $x < $this->image_dst_x - $ir; $x++) { + $pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y)); + $alpha = (1 - ($pixel['alpha'] / 127)) * $opacity / 100; + if ($alpha > 0) { + if ($alpha > 1) $alpha = 1; + $color = imagecolorallocatealpha($tmp, $pixel['red'] , $pixel['green'], $pixel['blue'], round((1 - $alpha) * 127)); + imagesetpixel($tmp, $x, $y, $color); + } + } + if ($opacity > 0) $opacity = $opacity - (100 / $cb); + } + // we now add the left border + $opacity = 100; + for ($x = $cl - 1; $x >= 0; $x--) { + $it = (int) ($cl > 0 ? ($ct * ($x / $cl)) : 0); + $ib = (int) ($cl > 0 ? ($cb * ($x / $cl)) : 0); + for ($y = $it; $y < $this->image_dst_y - $ib; $y++) { + $pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y)); + $alpha = (1 - ($pixel['alpha'] / 127)) * $opacity / 100; + if ($alpha > 0) { + if ($alpha > 1) $alpha = 1; + $color = imagecolorallocatealpha($tmp, $pixel['red'] , $pixel['green'], $pixel['blue'], round((1 - $alpha) * 127)); + imagesetpixel($tmp, $x, $y, $color); + } + } + if ($opacity > 0) $opacity = $opacity - (100 / $cl); + } + // we transfert tmp into image_dst + $image_dst = $this->imagetransfer($tmp, $image_dst); + } + + // add frame border + if ($gd_version >= 2 && is_numeric($this->image_frame)) { + if (is_array($this->image_frame_colors)) { + $vars = $this->image_frame_colors; + $this->log .= '- add frame : ' . implode(' ', $this->image_frame_colors) . '
    '; + } else { + $this->log .= '- add frame : ' . $this->image_frame_colors . '
    '; + $vars = explode(' ', $this->image_frame_colors); + } + $nb = sizeof($vars); + $this->image_dst_x = $this->image_dst_x + ($nb * 2); + $this->image_dst_y = $this->image_dst_y + ($nb * 2); + $tmp = $this->imagecreatenew($this->image_dst_x, $this->image_dst_y); + imagecopy($tmp, $image_dst, $nb, $nb, 0, 0, $this->image_dst_x - ($nb * 2), $this->image_dst_y - ($nb * 2)); + $opacity = (is_numeric($this->image_frame_opacity) ? (int) (127 - $this->image_frame_opacity / 100 * 127): 0); + for ($i=0; $i<$nb; $i++) { + list($red, $green, $blue) = $this->getcolors($vars[$i]); + $c = imagecolorallocatealpha($tmp, $red, $green, $blue, $opacity); + if ($this->image_frame == 1) { + imageline($tmp, $i, $i, $this->image_dst_x - $i -1, $i, $c); + imageline($tmp, $this->image_dst_x - $i -1, $this->image_dst_y - $i -1, $this->image_dst_x - $i -1, $i, $c); + imageline($tmp, $this->image_dst_x - $i -1, $this->image_dst_y - $i -1, $i, $this->image_dst_y - $i -1, $c); + imageline($tmp, $i, $i, $i, $this->image_dst_y - $i -1, $c); + } else { + imageline($tmp, $i, $i, $this->image_dst_x - $i -1, $i, $c); + imageline($tmp, $this->image_dst_x - $nb + $i, $this->image_dst_y - $nb + $i, $this->image_dst_x - $nb + $i, $nb - $i, $c); + imageline($tmp, $this->image_dst_x - $nb + $i, $this->image_dst_y - $nb + $i, $nb - $i, $this->image_dst_y - $nb + $i, $c); + imageline($tmp, $i, $i, $i, $this->image_dst_y - $i -1, $c); + } + } + // we transfert tmp into image_dst + $image_dst = $this->imagetransfer($tmp, $image_dst); + } + + // add bevel border + if ($gd_version >= 2 && $this->image_bevel > 0) { + if (empty($this->image_bevel_color1)) $this->image_bevel_color1 = '#FFFFFF'; + if (empty($this->image_bevel_color2)) $this->image_bevel_color2 = '#000000'; + list($red1, $green1, $blue1) = $this->getcolors($this->image_bevel_color1); + list($red2, $green2, $blue2) = $this->getcolors($this->image_bevel_color2); + $tmp = $this->imagecreatenew($this->image_dst_x, $this->image_dst_y); + imagecopy($tmp, $image_dst, 0, 0, 0, 0, $this->image_dst_x, $this->image_dst_y); + imagealphablending($tmp, true); + for ($i=0; $i<$this->image_bevel; $i++) { + $alpha = round(($i / $this->image_bevel) * 127); + $c1 = imagecolorallocatealpha($tmp, $red1, $green1, $blue1, $alpha); + $c2 = imagecolorallocatealpha($tmp, $red2, $green2, $blue2, $alpha); + imageline($tmp, $i, $i, $this->image_dst_x - $i -1, $i, $c1); + imageline($tmp, $this->image_dst_x - $i -1, $this->image_dst_y - $i, $this->image_dst_x - $i -1, $i, $c2); + imageline($tmp, $this->image_dst_x - $i -1, $this->image_dst_y - $i -1, $i, $this->image_dst_y - $i -1, $c2); + imageline($tmp, $i, $i, $i, $this->image_dst_y - $i -1, $c1); + } + // we transfert tmp into image_dst + $image_dst = $this->imagetransfer($tmp, $image_dst); + } + + // add watermark image + if ($this->image_watermark!='' && file_exists($this->image_watermark)) { + $this->log .= '- add watermark
    '; + $this->image_watermark_position = strtolower($this->image_watermark_position); + $watermark_info = getimagesize($this->image_watermark); + $watermark_type = (array_key_exists(2, $watermark_info) ? $watermark_info[2] : null); // 1 = GIF, 2 = JPG, 3 = PNG + $watermark_checked = false; + if ($watermark_type == IMAGETYPE_GIF) { + if (!function_exists('imagecreatefromgif')) { + $this->error = $this->translate('watermark_no_create_support', array('GIF')); + } else { + $filter = @imagecreatefromgif($this->image_watermark); + if (!$filter) { + $this->error = $this->translate('watermark_create_error', array('GIF')); + } else { + $this->log .= '    watermark source image is GIF
    '; + $watermark_checked = true; + } + } + } else if ($watermark_type == IMAGETYPE_JPEG) { + if (!function_exists('imagecreatefromjpeg')) { + $this->error = $this->translate('watermark_no_create_support', array('JPEG')); + } else { + $filter = @imagecreatefromjpeg($this->image_watermark); + if (!$filter) { + $this->error = $this->translate('watermark_create_error', array('JPEG')); + } else { + $this->log .= '    watermark source image is JPEG
    '; + $watermark_checked = true; + } + } + } else if ($watermark_type == IMAGETYPE_PNG) { + if (!function_exists('imagecreatefrompng')) { + $this->error = $this->translate('watermark_no_create_support', array('PNG')); + } else { + $filter = @imagecreatefrompng($this->image_watermark); + if (!$filter) { + $this->error = $this->translate('watermark_create_error', array('PNG')); + } else { + $this->log .= '    watermark source image is PNG
    '; + $watermark_checked = true; + } + } + } else if ($watermark_type == IMAGETYPE_BMP) { + if (!method_exists($this, 'imagecreatefrombmp')) { + $this->error = $this->translate('watermark_no_create_support', array('BMP')); + } else { + $filter = @$this->imagecreatefrombmp($this->image_watermark); + if (!$filter) { + $this->error = $this->translate('watermark_create_error', array('BMP')); + } else { + $this->log .= '    watermark source image is BMP
    '; + $watermark_checked = true; + } + } + } else { + $this->error = $this->translate('watermark_invalid'); + } + if ($watermark_checked) { + $watermark_dst_width = $watermark_src_width = imagesx($filter); + $watermark_dst_height = $watermark_src_height = imagesy($filter); + + // if watermark is too large/tall, resize it first + if ((!$this->image_watermark_no_zoom_out && ($watermark_dst_width > $this->image_dst_x || $watermark_dst_height > $this->image_dst_y)) + || (!$this->image_watermark_no_zoom_in && $watermark_dst_width < $this->image_dst_x && $watermark_dst_height < $this->image_dst_y)) { + $canvas_width = $this->image_dst_x - abs($this->image_watermark_x); + $canvas_height = $this->image_dst_y - abs($this->image_watermark_y); + if (($watermark_src_width/$canvas_width) > ($watermark_src_height/$canvas_height)) { + $watermark_dst_width = $canvas_width; + $watermark_dst_height = intval($watermark_src_height*($canvas_width / $watermark_src_width)); + } else { + $watermark_dst_height = $canvas_height; + $watermark_dst_width = intval($watermark_src_width*($canvas_height / $watermark_src_height)); + } + $this->log .= '    watermark resized from '.$watermark_src_width.'x'.$watermark_src_height.' to '.$watermark_dst_width.'x'.$watermark_dst_height.'
    '; + + } + // determine watermark position + $watermark_x = 0; + $watermark_y = 0; + if (is_numeric($this->image_watermark_x)) { + if ($this->image_watermark_x < 0) { + $watermark_x = $this->image_dst_x - $watermark_dst_width + $this->image_watermark_x; + } else { + $watermark_x = $this->image_watermark_x; + } + } else { + if (strpos($this->image_watermark_position, 'r') !== false) { + $watermark_x = $this->image_dst_x - $watermark_dst_width; + } else if (strpos($this->image_watermark_position, 'l') !== false) { + $watermark_x = 0; + } else { + $watermark_x = ($this->image_dst_x - $watermark_dst_width) / 2; + } + } + if (is_numeric($this->image_watermark_y)) { + if ($this->image_watermark_y < 0) { + $watermark_y = $this->image_dst_y - $watermark_dst_height + $this->image_watermark_y; + } else { + $watermark_y = $this->image_watermark_y; + } + } else { + if (strpos($this->image_watermark_position, 'b') !== false) { + $watermark_y = $this->image_dst_y - $watermark_dst_height; + } else if (strpos($this->image_watermark_position, 't') !== false) { + $watermark_y = 0; + } else { + $watermark_y = ($this->image_dst_y - $watermark_dst_height) / 2; + } + } + imagealphablending($image_dst, true); + imagecopyresampled($image_dst, $filter, $watermark_x, $watermark_y, 0, 0, $watermark_dst_width, $watermark_dst_height, $watermark_src_width, $watermark_src_height); + } else { + $this->error = $this->translate('watermark_invalid'); + } + } + + // add text + if (!empty($this->image_text)) { + $this->log .= '- add text
    '; + + // calculate sizes in human readable format + $src_size = $this->file_src_size / 1024; + $src_size_mb = number_format($src_size / 1024, 1, ".", " "); + $src_size_kb = number_format($src_size, 1, ".", " "); + $src_size_human = ($src_size > 1024 ? $src_size_mb . " MB" : $src_size_kb . " kb"); + + $this->image_text = str_replace( + array('[src_name]', + '[src_name_body]', + '[src_name_ext]', + '[src_pathname]', + '[src_mime]', + '[src_size]', + '[src_size_kb]', + '[src_size_mb]', + '[src_size_human]', + '[src_x]', + '[src_y]', + '[src_pixels]', + '[src_type]', + '[src_bits]', + '[dst_path]', + '[dst_name_body]', + '[dst_name_ext]', + '[dst_name]', + '[dst_pathname]', + '[dst_x]', + '[dst_y]', + '[date]', + '[time]', + '[host]', + '[server]', + '[ip]', + '[gd_version]'), + array($this->file_src_name, + $this->file_src_name_body, + $this->file_src_name_ext, + $this->file_src_pathname, + $this->file_src_mime, + $this->file_src_size, + $src_size_kb, + $src_size_mb, + $src_size_human, + $this->image_src_x, + $this->image_src_y, + $this->image_src_pixels, + $this->image_src_type, + $this->image_src_bits, + $this->file_dst_path, + $this->file_dst_name_body, + $this->file_dst_name_ext, + $this->file_dst_name, + $this->file_dst_pathname, + $this->image_dst_x, + $this->image_dst_y, + date('Y-m-d'), + date('H:i:s'), + (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'n/a'), + (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'n/a'), + (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : 'n/a'), + $this->gdversion(true)), + $this->image_text); + + if (!is_numeric($this->image_text_padding)) $this->image_text_padding = 0; + if (!is_numeric($this->image_text_line_spacing)) $this->image_text_line_spacing = 0; + if (!is_numeric($this->image_text_padding_x)) $this->image_text_padding_x = $this->image_text_padding; + if (!is_numeric($this->image_text_padding_y)) $this->image_text_padding_y = $this->image_text_padding; + $this->image_text_position = strtolower($this->image_text_position); + $this->image_text_direction = strtolower($this->image_text_direction); + $this->image_text_alignment = strtolower($this->image_text_alignment); + + // if the font is a string, we assume that we might want to load a font + if (!is_numeric($this->image_text_font) && strlen($this->image_text_font) > 4 && substr(strtolower($this->image_text_font), -4) == '.gdf') { + $this->log .= '    try to load font ' . $this->image_text_font . '... '; + if ($this->image_text_font = @imageloadfont($this->image_text_font)) { + $this->log .= 'success
    '; + } else { + $this->log .= 'error
    '; + $this->image_text_font = 5; + } + } + + $text = explode("\n", $this->image_text); + $char_width = imagefontwidth($this->image_text_font); + $char_height = imagefontheight($this->image_text_font); + $text_height = 0; + $text_width = 0; + $line_height = 0; + $line_width = 0; + + foreach ($text as $k => $v) { + if ($this->image_text_direction == 'v') { + $h = ($char_width * strlen($v)); + if ($h > $text_height) $text_height = $h; + $line_width = $char_height; + $text_width += $line_width + ($k < (sizeof($text)-1) ? $this->image_text_line_spacing : 0); + } else { + $w = ($char_width * strlen($v)); + if ($w > $text_width) $text_width = $w; + $line_height = $char_height; + $text_height += $line_height + ($k < (sizeof($text)-1) ? $this->image_text_line_spacing : 0); + } + } + $text_width += (2 * $this->image_text_padding_x); + $text_height += (2 * $this->image_text_padding_y); + $text_x = 0; + $text_y = 0; + if (is_numeric($this->image_text_x)) { + if ($this->image_text_x < 0) { + $text_x = $this->image_dst_x - $text_width + $this->image_text_x; + } else { + $text_x = $this->image_text_x; + } + } else { + if (strpos($this->image_text_position, 'r') !== false) { + $text_x = $this->image_dst_x - $text_width; + } else if (strpos($this->image_text_position, 'l') !== false) { + $text_x = 0; + } else { + $text_x = ($this->image_dst_x - $text_width) / 2; + } + } + if (is_numeric($this->image_text_y)) { + if ($this->image_text_y < 0) { + $text_y = $this->image_dst_y - $text_height + $this->image_text_y; + } else { + $text_y = $this->image_text_y; + } + } else { + if (strpos($this->image_text_position, 'b') !== false) { + $text_y = $this->image_dst_y - $text_height; + } else if (strpos($this->image_text_position, 't') !== false) { + $text_y = 0; + } else { + $text_y = ($this->image_dst_y - $text_height) / 2; + } + } + + // add a background, maybe transparent + if (!empty($this->image_text_background)) { + list($red, $green, $blue) = $this->getcolors($this->image_text_background); + if ($gd_version >= 2 && (is_numeric($this->image_text_background_opacity)) && $this->image_text_background_opacity >= 0 && $this->image_text_background_opacity <= 100) { + $filter = imagecreatetruecolor($text_width, $text_height); + $background_color = imagecolorallocate($filter, $red, $green, $blue); + imagefilledrectangle($filter, 0, 0, $text_width, $text_height, $background_color); + $this->imagecopymergealpha($image_dst, $filter, $text_x, $text_y, 0, 0, $text_width, $text_height, $this->image_text_background_opacity); + imagedestroy($filter); + } else { + $background_color = imagecolorallocate($image_dst ,$red, $green, $blue); + imagefilledrectangle($image_dst, $text_x, $text_y, $text_x + $text_width, $text_y + $text_height, $background_color); + } + } + + $text_x += $this->image_text_padding_x; + $text_y += $this->image_text_padding_y; + $t_width = $text_width - (2 * $this->image_text_padding_x); + $t_height = $text_height - (2 * $this->image_text_padding_y); + list($red, $green, $blue) = $this->getcolors($this->image_text_color); + + // add the text, maybe transparent + if ($gd_version >= 2 && (is_numeric($this->image_text_opacity)) && $this->image_text_opacity >= 0 && $this->image_text_opacity <= 100) { + if ($t_width < 0) $t_width = 0; + if ($t_height < 0) $t_height = 0; + $filter = $this->imagecreatenew($t_width, $t_height, false, true); + $text_color = imagecolorallocate($filter ,$red, $green, $blue); + + foreach ($text as $k => $v) { + if ($this->image_text_direction == 'v') { + imagestringup($filter, + $this->image_text_font, + $k * ($line_width + ($k > 0 && $k < (sizeof($text)) ? $this->image_text_line_spacing : 0)), + $text_height - (2 * $this->image_text_padding_y) - ($this->image_text_alignment == 'l' ? 0 : (($t_height - strlen($v) * $char_width) / ($this->image_text_alignment == 'r' ? 1 : 2))) , + $v, + $text_color); + } else { + imagestring($filter, + $this->image_text_font, + ($this->image_text_alignment == 'l' ? 0 : (($t_width - strlen($v) * $char_width) / ($this->image_text_alignment == 'r' ? 1 : 2))), + $k * ($line_height + ($k > 0 && $k < (sizeof($text)) ? $this->image_text_line_spacing : 0)), + $v, + $text_color); + } + } + $this->imagecopymergealpha($image_dst, $filter, $text_x, $text_y, 0, 0, $t_width, $t_height, $this->image_text_opacity); + imagedestroy($filter); + + } else { + $text_color = imageColorAllocate($image_dst ,$red, $green, $blue); + foreach ($text as $k => $v) { + if ($this->image_text_direction == 'v') { + imagestringup($image_dst, + $this->image_text_font, + $text_x + $k * ($line_width + ($k > 0 && $k < (sizeof($text)) ? $this->image_text_line_spacing : 0)), + $text_y + $text_height - (2 * $this->image_text_padding_y) - ($this->image_text_alignment == 'l' ? 0 : (($t_height - strlen($v) * $char_width) / ($this->image_text_alignment == 'r' ? 1 : 2))), + $v, + $text_color); + } else { + imagestring($image_dst, + $this->image_text_font, + $text_x + ($this->image_text_alignment == 'l' ? 0 : (($t_width - strlen($v) * $char_width) / ($this->image_text_alignment == 'r' ? 1 : 2))), + $text_y + $k * ($line_height + ($k > 0 && $k < (sizeof($text)) ? $this->image_text_line_spacing : 0)), + $v, + $text_color); + } + } + } + } + + // add a reflection + if ($this->image_reflection_height) { + $this->log .= '- add reflection : ' . $this->image_reflection_height . '
    '; + // we decode image_reflection_height, which can be a integer, a string in pixels or percentage + $image_reflection_height = $this->image_reflection_height; + if (strpos($image_reflection_height, '%')>0) $image_reflection_height = $this->image_dst_y * (str_replace('%','',$image_reflection_height / 100)); + if (strpos($image_reflection_height, 'px')>0) $image_reflection_height = str_replace('px','',$image_reflection_height); + $image_reflection_height = (int) $image_reflection_height; + if ($image_reflection_height > $this->image_dst_y) $image_reflection_height = $this->image_dst_y; + if (empty($this->image_reflection_opacity)) $this->image_reflection_opacity = 60; + // create the new destination image + $tmp = $this->imagecreatenew($this->image_dst_x, $this->image_dst_y + $image_reflection_height + $this->image_reflection_space, true); + $transparency = $this->image_reflection_opacity; + + // copy the original image + imagecopy($tmp, $image_dst, 0, 0, 0, 0, $this->image_dst_x, $this->image_dst_y + ($this->image_reflection_space < 0 ? $this->image_reflection_space : 0)); + + // we have to make sure the extra bit is the right color, or transparent + if ($image_reflection_height + $this->image_reflection_space > 0) { + // use the background color if present + if (!empty($this->image_background_color)) { + list($red, $green, $blue) = $this->getcolors($this->image_background_color); + $fill = imagecolorallocate($tmp, $red, $green, $blue); + } else { + $fill = imagecolorallocatealpha($tmp, 0, 0, 0, 127); + } + // fill in from the edge of the extra bit + imagefill($tmp, round($this->image_dst_x / 2), $this->image_dst_y + $image_reflection_height + $this->image_reflection_space - 1, $fill); + } + + // copy the reflection + for ($y = 0; $y < $image_reflection_height; $y++) { + for ($x = 0; $x < $this->image_dst_x; $x++) { + $pixel_b = imagecolorsforindex($tmp, imagecolorat($tmp, $x, $y + $this->image_dst_y + $this->image_reflection_space)); + $pixel_o = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $this->image_dst_y - $y - 1 + ($this->image_reflection_space < 0 ? $this->image_reflection_space : 0))); + $alpha_o = 1 - ($pixel_o['alpha'] / 127); + $alpha_b = 1 - ($pixel_b['alpha'] / 127); + $opacity = $alpha_o * $transparency / 100; + if ($opacity > 0) { + $red = round((($pixel_o['red'] * $opacity) + ($pixel_b['red'] ) * $alpha_b) / ($alpha_b + $opacity)); + $green = round((($pixel_o['green'] * $opacity) + ($pixel_b['green']) * $alpha_b) / ($alpha_b + $opacity)); + $blue = round((($pixel_o['blue'] * $opacity) + ($pixel_b['blue'] ) * $alpha_b) / ($alpha_b + $opacity)); + $alpha = ($opacity + $alpha_b); + if ($alpha > 1) $alpha = 1; + $alpha = round((1 - $alpha) * 127); + $color = imagecolorallocatealpha($tmp, $red, $green, $blue, $alpha); + imagesetpixel($tmp, $x, $y + $this->image_dst_y + $this->image_reflection_space, $color); + } + } + if ($transparency > 0) $transparency = $transparency - ($this->image_reflection_opacity / $image_reflection_height); + } + + // copy the resulting image into the destination image + $this->image_dst_y = $this->image_dst_y + $image_reflection_height + $this->image_reflection_space; + $image_dst = $this->imagetransfer($tmp, $image_dst); + } + + // change opacity + if ($gd_version >= 2 && is_numeric($this->image_opacity) && $this->image_opacity < 100) { + $this->log .= '- change opacity
    '; + // create the new destination image + $tmp = $this->imagecreatenew($this->image_dst_x, $this->image_dst_y, true); + for($y=0; $y < $this->image_dst_y; $y++) { + for($x=0; $x < $this->image_dst_x; $x++) { + $pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y)); + $alpha = $pixel['alpha'] + round((127 - $pixel['alpha']) * (100 - $this->image_opacity) / 100); + if ($alpha > 127) $alpha = 127; + if ($alpha > 0) { + $color = imagecolorallocatealpha($tmp, $pixel['red'] , $pixel['green'], $pixel['blue'], $alpha); + imagesetpixel($tmp, $x, $y, $color); + } + } + } + // copy the resulting image into the destination image + $image_dst = $this->imagetransfer($tmp, $image_dst); + } + + // reduce the JPEG image to a set desired size + if (is_numeric($this->jpeg_size) && $this->jpeg_size > 0 && ($this->image_convert == 'jpeg' || $this->image_convert == 'jpg')) { + // inspired by: JPEGReducer class version 1, 25 November 2004, Author: Huda M ElMatsani, justhuda at netscape dot net + $this->log .= '- JPEG desired file size : ' . $this->jpeg_size . '
    '; + // calculate size of each image. 75%, 50%, and 25% quality + ob_start(); imagejpeg($image_dst,null,75); $buffer = ob_get_contents(); ob_end_clean(); + $size75 = strlen($buffer); + ob_start(); imagejpeg($image_dst,null,50); $buffer = ob_get_contents(); ob_end_clean(); + $size50 = strlen($buffer); + ob_start(); imagejpeg($image_dst,null,25); $buffer = ob_get_contents(); ob_end_clean(); + $size25 = strlen($buffer); + + // make sure we won't divide by 0 + if ($size50 == $size25) $size50++; + if ($size75 == $size50 || $size75 == $size25) $size75++; + + // calculate gradient of size reduction by quality + $mgrad1 = 25 / ($size50-$size25); + $mgrad2 = 25 / ($size75-$size50); + $mgrad3 = 50 / ($size75-$size25); + $mgrad = ($mgrad1 + $mgrad2 + $mgrad3) / 3; + // result of approx. quality factor for expected size + $q_factor = round($mgrad * ($this->jpeg_size - $size50) + 50); + + if ($q_factor<1) { + $this->jpeg_quality=1; + } elseif ($q_factor>100) { + $this->jpeg_quality=100; + } else { + $this->jpeg_quality=$q_factor; + } + $this->log .= '    JPEG quality factor set to ' . $this->jpeg_quality . '
    '; + } + + // converts image from true color, and fix transparency if needed + $this->log .= '- converting...
    '; + $this->image_dst_type = $this->image_convert; + switch($this->image_convert) { + case 'gif': + // if the image is true color, we convert it to a palette + if (imageistruecolor($image_dst)) { + $this->log .= '    true color to palette
    '; + // creates a black and white mask + $mask = array(array()); + for ($x = 0; $x < $this->image_dst_x; $x++) { + for ($y = 0; $y < $this->image_dst_y; $y++) { + $pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y)); + $mask[$x][$y] = $pixel['alpha']; + } + } + list($red, $green, $blue) = $this->getcolors($this->image_default_color); + // first, we merge the image with the background color, so we know which colors we will have + for ($x = 0; $x < $this->image_dst_x; $x++) { + for ($y = 0; $y < $this->image_dst_y; $y++) { + if ($mask[$x][$y] > 0){ + // we have some transparency. we combine the color with the default color + $pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y)); + $alpha = ($mask[$x][$y] / 127); + $pixel['red'] = round(($pixel['red'] * (1 -$alpha) + $red * ($alpha))); + $pixel['green'] = round(($pixel['green'] * (1 -$alpha) + $green * ($alpha))); + $pixel['blue'] = round(($pixel['blue'] * (1 -$alpha) + $blue * ($alpha))); + $color = imagecolorallocate($image_dst, $pixel['red'], $pixel['green'], $pixel['blue']); + imagesetpixel($image_dst, $x, $y, $color); + } + } + } + // transforms the true color image into palette, with its merged default color + if (empty($this->image_background_color)) { + imagetruecolortopalette($image_dst, true, 255); + $transparency = imagecolorallocate($image_dst, 254, 1, 253); + imagecolortransparent($image_dst, $transparency); + // make the transparent areas transparent + for ($x = 0; $x < $this->image_dst_x; $x++) { + for ($y = 0; $y < $this->image_dst_y; $y++) { + // we test wether we have enough opacity to justify keeping the color + if ($mask[$x][$y] > 120) imagesetpixel($image_dst, $x, $y, $transparency); + } + } + } + unset($mask); + } + break; + case 'jpg': + case 'bmp': + // if the image doesn't support any transparency, then we merge it with the default color + $this->log .= '    fills in transparency with default color
    '; + list($red, $green, $blue) = $this->getcolors($this->image_default_color); + $transparency = imagecolorallocate($image_dst, $red, $green, $blue); + // make the transaparent areas transparent + for ($x = 0; $x < $this->image_dst_x; $x++) { + for ($y = 0; $y < $this->image_dst_y; $y++) { + // we test wether we have some transparency, in which case we will merge the colors + if (imageistruecolor($image_dst)) { + $rgba = imagecolorat($image_dst, $x, $y); + $pixel = array('red' => ($rgba >> 16) & 0xFF, + 'green' => ($rgba >> 8) & 0xFF, + 'blue' => $rgba & 0xFF, + 'alpha' => ($rgba & 0x7F000000) >> 24); + } else { + $pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y)); + } + if ($pixel['alpha'] == 127) { + // we have full transparency. we make the pixel transparent + imagesetpixel($image_dst, $x, $y, $transparency); + } else if ($pixel['alpha'] > 0) { + // we have some transparency. we combine the color with the default color + $alpha = ($pixel['alpha'] / 127); + $pixel['red'] = round(($pixel['red'] * (1 -$alpha) + $red * ($alpha))); + $pixel['green'] = round(($pixel['green'] * (1 -$alpha) + $green * ($alpha))); + $pixel['blue'] = round(($pixel['blue'] * (1 -$alpha) + $blue * ($alpha))); + $color = imagecolorclosest($image_dst, $pixel['red'], $pixel['green'], $pixel['blue']); + imagesetpixel($image_dst, $x, $y, $color); + } + } + } + + break; + default: + break; + } + + // interlace options + if($this->image_interlace) imageinterlace($image_dst, true); + + // outputs image + $this->log .= '- saving image...
    '; + switch($this->image_convert) { + case 'jpeg': + case 'jpg': + if (!$return_mode) { + $result = @imagejpeg($image_dst, $this->file_dst_pathname, $this->jpeg_quality); + } else { + ob_start(); + $result = @imagejpeg($image_dst, null, $this->jpeg_quality); + $return_content = ob_get_contents(); + ob_end_clean(); + } + if (!$result) { + $this->processed = false; + $this->error = $this->translate('file_create', array('JPEG')); + } else { + $this->log .= '    JPEG image created
    '; + } + break; + case 'png': + imagealphablending( $image_dst, false ); + imagesavealpha( $image_dst, true ); + if (!$return_mode) { + if (is_numeric($this->png_compression) && version_compare(PHP_VERSION, '5.1.2') >= 0) { + $result = @imagepng($image_dst, $this->file_dst_pathname, $this->png_compression); + } else { + $result = @imagepng($image_dst, $this->file_dst_pathname); + } + } else { + ob_start(); + if (is_numeric($this->png_compression) && version_compare(PHP_VERSION, '5.1.2') >= 0) { + $result = @imagepng($image_dst, null, $this->png_compression); + } else { + $result = @imagepng($image_dst); + } + $return_content = ob_get_contents(); + ob_end_clean(); + } + if (!$result) { + $this->processed = false; + $this->error = $this->translate('file_create', array('PNG')); + } else { + $this->log .= '    PNG image created
    '; + } + break; + case 'gif': + if (!$return_mode) { + $result = @imagegif($image_dst, $this->file_dst_pathname); + } else { + ob_start(); + $result = @imagegif($image_dst); + $return_content = ob_get_contents(); + ob_end_clean(); + } + if (!$result) { + $this->processed = false; + $this->error = $this->translate('file_create', array('GIF')); + } else { + $this->log .= '    GIF image created
    '; + } + break; + case 'bmp': + if (!$return_mode) { + $result = $this->imagebmp($image_dst, $this->file_dst_pathname); + } else { + ob_start(); + $result = $this->imagebmp($image_dst); + $return_content = ob_get_contents(); + ob_end_clean(); + } + if (!$result) { + $this->processed = false; + $this->error = $this->translate('file_create', array('BMP')); + } else { + $this->log .= '    BMP image created
    '; + } + break; + + default: + $this->processed = false; + $this->error = $this->translate('no_conversion_type'); + } + if ($this->processed) { + if (is_resource($image_src)) imagedestroy($image_src); + if (is_resource($image_dst)) imagedestroy($image_dst); + $this->log .= '    image objects destroyed
    '; + } + } + + } else { + $this->log .= '- no image processing wanted
    '; + + if (!$return_mode) { + // copy the file to its final destination. we don't use move_uploaded_file here + // if we happen to have open_basedir restrictions, it is a temp file that we copy, not the original uploaded file + if (!copy($this->file_src_pathname, $this->file_dst_pathname)) { + $this->processed = false; + $this->error = $this->translate('copy_failed'); + } + } else { + // returns the file, so that its content can be received by the caller + $return_content = @file_get_contents($this->file_src_pathname); + if ($return_content === FALSE) { + $this->processed = false; + $this->error = $this->translate('reading_failed'); + } + } + } + } + + if ($this->processed) { + $this->log .= '- process OK
    '; + } else { + $this->log .= '- error: ' . $this->error . '
    '; + } + + // we reinit all the vars + $this->init(); + + // we may return the image content + if ($return_mode) return $return_content; + + } + + /** + * Deletes the uploaded file from its temporary location + * + * When PHP uploads a file, it stores it in a temporary location. + * When you {@link process} the file, you actually copy the resulting file to the given location, it doesn't alter the original file. + * Once you have processed the file as many times as you wanted, you can delete the uploaded file. + * If there is open_basedir restrictions, the uploaded file is in fact a temporary file + * + * You might want not to use this function if you work on local files, as it will delete the source file + * + * @access public + */ + function clean() { + $this->log .= 'cleanup
    '; + $this->log .= '- delete temp file ' . $this->file_src_pathname . '
    '; + @unlink($this->file_src_pathname); + } + + + /** + * Opens a BMP image + * + * This function has been written by DHKold, and is used with permission of the author + * + * @access public + */ + function imagecreatefrombmp($filename) { + if (! $f1 = fopen($filename,"rb")) return false; + + $file = unpack("vfile_type/Vfile_size/Vreserved/Vbitmap_offset", fread($f1,14)); + if ($file['file_type'] != 19778) return false; + + $bmp = unpack('Vheader_size/Vwidth/Vheight/vplanes/vbits_per_pixel'. + '/Vcompression/Vsize_bitmap/Vhoriz_resolution'. + '/Vvert_resolution/Vcolors_used/Vcolors_important', fread($f1,40)); + $bmp['colors'] = pow(2,$bmp['bits_per_pixel']); + if ($bmp['size_bitmap'] == 0) $bmp['size_bitmap'] = $file['file_size'] - $file['bitmap_offset']; + $bmp['bytes_per_pixel'] = $bmp['bits_per_pixel']/8; + $bmp['bytes_per_pixel2'] = ceil($bmp['bytes_per_pixel']); + $bmp['decal'] = ($bmp['width']*$bmp['bytes_per_pixel']/4); + $bmp['decal'] -= floor($bmp['width']*$bmp['bytes_per_pixel']/4); + $bmp['decal'] = 4-(4*$bmp['decal']); + if ($bmp['decal'] == 4) $bmp['decal'] = 0; + + $palette = array(); + if ($bmp['colors'] < 16777216) { + $palette = unpack('V'.$bmp['colors'], fread($f1,$bmp['colors']*4)); + } + + $im = fread($f1,$bmp['size_bitmap']); + $vide = chr(0); + + $res = imagecreatetruecolor($bmp['width'],$bmp['height']); + $P = 0; + $Y = $bmp['height']-1; + while ($Y >= 0) { + $X=0; + while ($X < $bmp['width']) { + if ($bmp['bits_per_pixel'] == 24) + $color = unpack("V",substr($im,$P,3).$vide); + elseif ($bmp['bits_per_pixel'] == 16) { + $color = unpack("n",substr($im,$P,2)); + $color[1] = $palette[$color[1]+1]; + } elseif ($bmp['bits_per_pixel'] == 8) { + $color = unpack("n",$vide.substr($im,$P,1)); + $color[1] = $palette[$color[1]+1]; + } elseif ($bmp['bits_per_pixel'] == 4) { + $color = unpack("n",$vide.substr($im,floor($P),1)); + if (($P*2)%2 == 0) $color[1] = ($color[1] >> 4) ; else $color[1] = ($color[1] & 0x0F); + $color[1] = $palette[$color[1]+1]; + } elseif ($bmp['bits_per_pixel'] == 1) { + $color = unpack("n",$vide.substr($im,floor($P),1)); + if (($P*8)%8 == 0) $color[1] = $color[1] >>7; + elseif (($P*8)%8 == 1) $color[1] = ($color[1] & 0x40)>>6; + elseif (($P*8)%8 == 2) $color[1] = ($color[1] & 0x20)>>5; + elseif (($P*8)%8 == 3) $color[1] = ($color[1] & 0x10)>>4; + elseif (($P*8)%8 == 4) $color[1] = ($color[1] & 0x8)>>3; + elseif (($P*8)%8 == 5) $color[1] = ($color[1] & 0x4)>>2; + elseif (($P*8)%8 == 6) $color[1] = ($color[1] & 0x2)>>1; + elseif (($P*8)%8 == 7) $color[1] = ($color[1] & 0x1); + $color[1] = $palette[$color[1]+1]; + } else + return FALSE; + imagesetpixel($res,$X,$Y,$color[1]); + $X++; + $P += $bmp['bytes_per_pixel']; + } + $Y--; + $P+=$bmp['decal']; + } + fclose($f1); + return $res; + } + + /** + * Saves a BMP image + * + * This function has been published on the PHP website, and can be used freely + * + * @access public + */ + function imagebmp(&$im, $filename = "") { + + if (!$im) return false; + $w = imagesx($im); + $h = imagesy($im); + $result = ''; + + // if the image is not true color, we convert it first + if (!imageistruecolor($im)) { + $tmp = imagecreatetruecolor($w, $h); + imagecopy($tmp, $im, 0, 0, 0, 0, $w, $h); + imagedestroy($im); + $im = & $tmp; + } + + $biBPLine = $w * 3; + $biStride = ($biBPLine + 3) & ~3; + $biSizeImage = $biStride * $h; + $bfOffBits = 54; + $bfSize = $bfOffBits + $biSizeImage; + + $result .= substr('BM', 0, 2); + $result .= pack ('VvvV', $bfSize, 0, 0, $bfOffBits); + $result .= pack ('VVVvvVVVVVV', 40, $w, $h, 1, 24, 0, $biSizeImage, 0, 0, 0, 0); + + $numpad = $biStride - $biBPLine; + for ($y = $h - 1; $y >= 0; --$y) { + for ($x = 0; $x < $w; ++$x) { + $col = imagecolorat ($im, $x, $y); + $result .= substr(pack ('V', $col), 0, 3); + } + for ($i = 0; $i < $numpad; ++$i) + $result .= pack ('C', 0); + } + + if($filename==""){ + echo $result; + } else { + $file = fopen($filename, "wb"); + fwrite($file, $result); + fclose($file); + } + return true; + } +} diff --git a/deployed/k2/administrator/components/com_k2/lib/elfinder/elFinder.class.php b/deployed/k2/administrator/components/com_k2/lib/elfinder/elFinder.class.php new file mode 100644 index 00000000..30c16c49 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/lib/elfinder/elFinder.class.php @@ -0,0 +1,1113 @@ + array('target' => false, 'tree' => false, 'init' => false, 'mimes' => false), + 'ls' => array('target' => true, 'mimes' => false), + 'tree' => array('target' => true), + 'parents' => array('target' => true), + 'tmb' => array('targets' => true), + 'file' => array('target' => true, 'download' => false), + 'size' => array('targets' => true), + 'mkdir' => array('target' => true, 'name' => true), + 'mkfile' => array('target' => true, 'name' => true, 'mimes' => false), + 'rm' => array('targets' => true), + 'rename' => array('target' => true, 'name' => true, 'mimes' => false), + 'duplicate' => array('targets' => true, 'suffix' => false), + 'paste' => array('dst' => true, 'targets' => true, 'cut' => false, 'mimes' => false), + 'upload' => array('target' => true, 'FILES' => true, 'mimes' => false, 'html' => false), + 'get' => array('target' => true), + 'put' => array('target' => true, 'content' => '', 'mimes' => false), + 'archive' => array('targets' => true, 'type' => true, 'mimes' => false), + 'extract' => array('target' => true, 'mimes' => false), + 'search' => array('q' => true, 'mimes' => false), + 'info' => array('targets' => true), + 'dim' => array('target' => true), + 'resize' => array('target' => true, 'width' => true, 'height' => true, 'mode' => false, 'x' => false, 'y' => false, 'degree' => false) + ); + + /** + * Commands listeners + * + * @var array + **/ + protected $listeners = array(); + + /** + * script work time for debug + * + * @var string + **/ + protected $time = 0; + /** + * Is elFinder init correctly? + * + * @var bool + **/ + protected $loaded = false; + /** + * Send debug to client? + * + * @var string + **/ + protected $debug = false; + + /** + * undocumented class variable + * + * @var string + **/ + protected $uploadDebug = ''; + + /** + * Errors from not mounted volumes + * + * @var array + **/ + public $mountErrors = array(); + + // Errors messages + const ERROR_UNKNOWN = 'errUnknown'; + const ERROR_UNKNOWN_CMD = 'errUnknownCmd'; + const ERROR_CONF = 'errConf'; + const ERROR_CONF_NO_JSON = 'errJSON'; + const ERROR_CONF_NO_VOL = 'errNoVolumes'; + const ERROR_INV_PARAMS = 'errCmdParams'; + const ERROR_OPEN = 'errOpen'; + const ERROR_DIR_NOT_FOUND = 'errFolderNotFound'; + const ERROR_FILE_NOT_FOUND = 'errFileNotFound'; // 'File not found.' + const ERROR_TRGDIR_NOT_FOUND = 'errTrgFolderNotFound'; // 'Target folder "$1" not found.' + const ERROR_NOT_DIR = 'errNotFolder'; + const ERROR_NOT_FILE = 'errNotFile'; + const ERROR_PERM_DENIED = 'errPerm'; + const ERROR_LOCKED = 'errLocked'; // '"$1" is locked and can not be renamed, moved or removed.' + const ERROR_EXISTS = 'errExists'; // 'File named "$1" already exists.' + const ERROR_INVALID_NAME = 'errInvName'; // 'Invalid file name.' + const ERROR_MKDIR = 'errMkdir'; + const ERROR_MKFILE = 'errMkfile'; + const ERROR_RENAME = 'errRename'; + const ERROR_COPY = 'errCopy'; + const ERROR_MOVE = 'errMove'; + const ERROR_COPY_FROM = 'errCopyFrom'; + const ERROR_COPY_TO = 'errCopyTo'; + const ERROR_COPY_ITSELF = 'errCopyInItself'; + const ERROR_REPLACE = 'errReplace'; // 'Unable to replace "$1".' + const ERROR_RM = 'errRm'; // 'Unable to remove "$1".' + const ERROR_RM_SRC = 'errRmSrc'; // 'Unable remove source file(s)' + const ERROR_UPLOAD = 'errUpload'; // 'Upload error.' + const ERROR_UPLOAD_FILE = 'errUploadFile'; // 'Unable to upload "$1".' + const ERROR_UPLOAD_NO_FILES = 'errUploadNoFiles'; // 'No files found for upload.' + const ERROR_UPLOAD_TOTAL_SIZE = 'errUploadTotalSize'; // 'Data exceeds the maximum allowed size.' + const ERROR_UPLOAD_FILE_SIZE = 'errUploadFileSize'; // 'File exceeds maximum allowed size.' + const ERROR_UPLOAD_FILE_MIME = 'errUploadMime'; // 'File type not allowed.' + const ERROR_UPLOAD_TRANSFER = 'errUploadTransfer'; // '"$1" transfer error.' + // const ERROR_ACCESS_DENIED = 'errAccess'; + const ERROR_NOT_REPLACE = 'errNotReplace'; // Object "$1" already exists at this location and can not be replaced with object of another type. + const ERROR_SAVE = 'errSave'; + const ERROR_EXTRACT = 'errExtract'; + const ERROR_ARCHIVE = 'errArchive'; + const ERROR_NOT_ARCHIVE = 'errNoArchive'; + const ERROR_ARCHIVE_TYPE = 'errArcType'; + const ERROR_ARC_SYMLINKS = 'errArcSymlinks'; + const ERROR_ARC_MAXSIZE = 'errArcMaxSize'; + const ERROR_RESIZE = 'errResize'; + const ERROR_UNSUPPORT_TYPE = 'errUsupportType'; + const ERROR_NOT_UTF8_CONTENT = 'errNotUTF8Content'; + + /** + * Constructor + * + * @param array elFinder and roots configurations + * @return void + * @author Dmitry (dio) Levashov + **/ + public function __construct($opts) { + + $this->time = $this->utime(); + $this->debug = (isset($opts['debug']) && $opts['debug'] ? true : false); + + setlocale(LC_ALL, !empty($opts['locale']) ? $opts['locale'] : 'en_US.UTF-8'); + + // bind events listeners + if (!empty($opts['bind']) && is_array($opts['bind'])) { + foreach ($opts['bind'] as $cmd => $handler) { + $this->bind($cmd, $handler); + } + } + + // "mount" volumes + if (isset($opts['roots']) && is_array($opts['roots'])) { + + foreach ($opts['roots'] as $i => $o) { + $class = 'elFinderVolume'.(isset($o['driver']) ? $o['driver'] : ''); + + if (class_exists($class)) { + $volume = new $class(); + + if ($volume->mount($o)) { + // unique volume id (ends on "_") - used as prefix to files hash + $id = $volume->id(); + + $this->volumes[$id] = $volume; + if (!$this->default && $volume->isReadable()) { + $this->default = $this->volumes[$id]; + } + } else { + $this->mountErrors[] = 'Driver "'.$class.'" : '.implode(' ', $volume->error()); + } + } else { + $this->mountErrors[] = 'Driver "'.$class.'" does not exists'; + } + } + } + // if at least one redable volume - ii desu >_< + $this->loaded = !empty($this->default); + } + + /** + * Return true if fm init correctly + * + * @return bool + * @author Dmitry (dio) Levashov + **/ + public function loaded() { + return $this->loaded; + } + + /** + * Return version (api) number + * + * @return string + * @author Dmitry (dio) Levashov + **/ + public function version() { + return $this->version; + } + + /** + * Add handler to elFinder command + * + * @param string command name + * @param string|array callback name or array(object, method) + * @return elFinder + * @author Dmitry (dio) Levashov + **/ + public function bind($cmd, $handler) { + $cmds = array_map('trim', explode(' ', $cmd)); + + foreach ($cmds as $cmd) { + if ($cmd) { + if (!isset($this->listeners[$cmd])) { + $this->listeners[$cmd] = array(); + } + + if ((is_array($handler) && count($handler) == 2 && is_object($handler[0]) && method_exists($handler[0], $handler[1])) + || function_exists($handler)) { + $this->listeners[$cmd][] = $handler; + } + } + } + + return $this; + } + + /** + * Remove event (command exec) handler + * + * @param string command name + * @param string|array callback name or array(object, method) + * @return elFinder + * @author Dmitry (dio) Levashov + **/ + public function unbind($cmd, $handler) { + if (!empty($this->listeners[$cmd])) { + foreach ($this->listeners[$cmd] as $i => $h) { + if ($h === $handler) { + unset($this->listeners[$cmd][$i]); + return $this; + } + } + } + return $this; + } + + /** + * Return true if command exists + * + * @param string command name + * @return bool + * @author Dmitry (dio) Levashov + **/ + public function commandExists($cmd) { + return $this->loaded && isset($this->commands[$cmd]) && method_exists($this, $cmd); + } + + /** + * Return command required arguments info + * + * @param string command name + * @return array + * @author Dmitry (dio) Levashov + **/ + public function commandArgsList($cmd) { + return $this->commandExists($cmd) ? $this->commands[$cmd] : array(); + } + + /** + * Exec command and return result + * + * @param string $cmd command name + * @param array $args command arguments + * @return array + * @author Dmitry (dio) Levashov + **/ + public function exec($cmd, $args) { + + if (!$this->loaded) { + return array('error' => $this->error(self::ERROR_CONF, self::ERROR_CONF_NO_VOL)); + } + + if (!$this->commandExists($cmd)) { + return array('error' => $this->error(self::ERROR_UNKNOWN_CMD)); + } + + if (!empty($args['mimes']) && is_array($args['mimes'])) { + foreach ($this->volumes as $id => $v) { + $this->volumes[$id]->setMimesFilter($args['mimes']); + } + } + + $result = $this->$cmd($args); + + if (isset($result['removed'])) { + foreach ($this->volumes as $volume) { + $result['removed'] = array_merge($result['removed'], $volume->removed()); + $volume->resetRemoved(); + } + } + + // call handlers for this command + if (!empty($this->listeners[$cmd])) { + foreach ($this->listeners[$cmd] as $handler) { + if ((is_array($handler) && $handler[0]->{$handler[1]}($cmd, $result, $args, $this)) + || (!is_array($handler) && $handler($cmd, $result, $args, $this))) { + // handler return true to force sync client after command completed + $result['sync'] = true; + } + } + } + + // replace removed files info with removed files hashes + if (!empty($result['removed'])) { + $removed = array(); + foreach ($result['removed'] as $file) { + $removed[] = $file['hash']; + } + $result['removed'] = array_unique($removed); + } + // remove hidden files and filter files by mimetypes + if (!empty($result['added'])) { + $result['added'] = $this->filter($result['added']); + } + // remove hidden files and filter files by mimetypes + if (!empty($result['changed'])) { + $result['changed'] = $this->filter($result['changed']); + } + + if ($this->debug || !empty($args['debug'])) { + $result['debug'] = array( + 'connector' => 'php', + 'phpver' => PHP_VERSION, + 'time' => $this->utime() - $this->time, + 'memory' => (function_exists('memory_get_peak_usage') ? ceil(memory_get_peak_usage()/1024).'Kb / ' : '').ceil(memory_get_usage()/1024).'Kb / '.ini_get('memory_limit'), + 'upload' => $this->uploadDebug, + 'volumes' => array(), + 'mountErrors' => $this->mountErrors + ); + + foreach ($this->volumes as $id => $volume) { + $result['debug']['volumes'][] = $volume->debug(); + } + } + + foreach ($this->volumes as $volume) { + $volume->umount(); + } + + return $result; + } + + /** + * Return file real path + * + * @param string $hash file hash + * @return string + * @author Dmitry (dio) Levashov + **/ + public function realpath($hash) { + if (($volume = $this->volume($hash)) == false) { + return false; + } + return $volume->realpath($hash); + } + + /***************************************************************************/ + /* commands */ + /***************************************************************************/ + + /** + * Normalize error messages + * + * @return array + * @author Dmitry (dio) Levashov + **/ + public function error() { + $errors = array(); + + foreach (func_get_args() as $msg) { + if (is_array($msg)) { + $errors = array_merge($errors, $msg); + } else { + $errors[] = $msg; + } + } + + return count($errors) ? $errors : array(self::ERROR_UNKNOWN); + } + + /** + * "Open" directory + * Return array with following elements + * - cwd - opened dir info + * - files - opened dir content [and dirs tree if $args[tree]] + * - api - api version (if $args[init]) + * - uplMaxSize - if $args[init] + * - error - on failed + * + * @param array command arguments + * @return array + * @author Dmitry (dio) Levashov + **/ + protected function open($args) { + $target = $args['target']; + $init = !empty($args['init']); + $tree = !empty($args['tree']); + $volume = $this->volume($target); + $cwd = $volume ? $volume->dir($target, true) : false; + $hash = $init ? 'default folder' : '#'.$target; + + // on init request we can get invalid dir hash - + // dir which can not be opened now, but remembered by client, + // so open default dir + if ((!$cwd || !$cwd['read']) && $init) { + $volume = $this->default; + $cwd = $volume->dir($volume->defaultPath(), true); + } + + if (!$cwd) { + return array('error' => $this->error(self::ERROR_OPEN, $hash, self::ERROR_DIR_NOT_FOUND)); + } + if (!$cwd['read']) { + return array('error' => $this->error(self::ERROR_OPEN, $hash, self::ERROR_PERM_DENIED)); + } + + $files = array(); + + // get folders trees + if ($args['tree']) { + foreach ($this->volumes as $id => $v) { + + if (($tree = $v->tree('', 0, $cwd['hash'])) != false) { + $files = array_merge($files, $tree); + } + } + } + + // get current working directory files list and add to $files if not exists in it + if (($ls = $volume->scandir($cwd['hash'])) === false) { + return array('error' => $this->error(self::ERROR_OPEN, $cwd['name'], $volume->error())); + } + + foreach ($ls as $file) { + if (!in_array($file, $files)) { + $files[] = $file; + } + } + + $result = array( + 'cwd' => $cwd, + 'options' => $volume->options($cwd['hash']), + 'files' => $files + ); + + if (!empty($args['init'])) { + $result['api'] = $this->version; + $result['uplMaxSize'] = ini_get('upload_max_filesize'); + } + + return $result; + } + + /** + * Return dir files names list + * + * @param array command arguments + * @return array + * @author Dmitry (dio) Levashov + **/ + protected function ls($args) { + $target = $args['target']; + + if (($volume = $this->volume($target)) == false + || ($list = $volume->ls($target)) === false) { + return array('error' => $this->error(self::ERROR_OPEN, '#'.$target)); + } + return array('list' => $list); + } + + /** + * Return subdirs for required directory + * + * @param array command arguments + * @return array + * @author Dmitry (dio) Levashov + **/ + protected function tree($args) { + $target = $args['target']; + + if (($volume = $this->volume($target)) == false + || ($tree = $volume->tree($target)) == false) { + return array('error' => $this->error(self::ERROR_OPEN, '#'.$target)); + } + + return array('tree' => $tree); + } + + /** + * Return parents dir for required directory + * + * @param array command arguments + * @return array + * @author Dmitry (dio) Levashov + **/ + protected function parents($args) { + $target = $args['target']; + + if (($volume = $this->volume($target)) == false + || ($tree = $volume->parents($target)) == false) { + return array('error' => $this->error(self::ERROR_OPEN, '#'.$target)); + } + + return array('tree' => $tree); + } + + /** + * Return new created thumbnails list + * + * @param array command arguments + * @return array + * @author Dmitry (dio) Levashov + **/ + protected function tmb($args) { + + $result = array('images' => array()); + $targets = $args['targets']; + + foreach ($targets as $target) { + if (($volume = $this->volume($target)) != false + && (($tmb = $volume->tmb($target)) != false)) { + $result['images'][$target] = $tmb; + } + } + return $result; + } + + /** + * Required to output file in browser when volume URL is not set + * Return array contains opened file pointer, root itself and required headers + * + * @param array command arguments + * @return array + * @author Dmitry (dio) Levashov + **/ + protected function file($args) { + $target = $args['target']; + $download = !empty($args['download']); + $h403 = 'HTTP/1.x 403 Access Denied'; + $h404 = 'HTTP/1.x 404 Not Found'; + + if (($volume = $this->volume($target)) == false) { + return array('error' => 'File not found', 'header' => $h404, 'raw' => true); + } + + if (($file = $volume->file($target)) == false) { + return array('error' => 'File not found', 'header' => $h404, 'raw' => true); + } + + if (!$file['read']) { + return array('error' => 'Access denied', 'header' => $h403, 'raw' => true); + } + + if (($fp = $volume->open($target)) == false) { + return array('error' => 'File not found', 'header' => $h404, 'raw' => true); + } + + if ($download) { + $disp = 'attachment'; + $mime = 'application/octet-stream'; + } else { + $disp = preg_match('/^(image|text)/i', $file['mime']) || $file['mime'] == 'application/x-shockwave-flash' + ? 'inline' + : 'attachment'; + $mime = $file['mime']; + } + + $filenameEncoded = rawurlencode($file['name']); + if (strpos($filenameEncoded, '%') === false) { // ASCII only + $filename = 'filename="'.$file['name'].'"'; + } else { + $ua = $_SERVER["HTTP_USER_AGENT"]; + if (preg_match('/MSIE [4-8]/', $ua)) { // IE < 9 do not support RFC 6266 (RFC 2231/RFC 5987) + $filename = 'filename="'.$filenameEncoded.'"'; + } else { // RFC 6266 (RFC 2231/RFC 5987) + $filename = 'filename*=UTF-8\'\''.$filenameEncoded; + } + } + + $result = array( + 'volume' => $volume, + 'pointer' => $fp, + 'info' => $file, + 'header' => array( + 'Content-Type: '.$mime, + 'Content-Disposition: '.$disp.'; '.$filename, + 'Content-Location: '.$file['name'], + 'Content-Transfer-Encoding: binary', + 'Content-Length: '.$file['size'], + 'Connection: close' + ) + ); + return $result; + } + + /** + * Count total files size + * + * @param array command arguments + * @return array + * @author Dmitry (dio) Levashov + **/ + protected function size($args) { + $size = 0; + + foreach ($args['targets'] as $target) { + if (($volume = $this->volume($target)) == false + || ($file = $volume->file($target)) == false + || !$file['read']) { + return array('error' => $this->error(self::ERROR_OPEN, '#'.$target)); + } + + $size += $volume->size($target); + } + return array('size' => $size); + } + + /** + * Create directory + * + * @param array command arguments + * @return array + * @author Dmitry (dio) Levashov + **/ + protected function mkdir($args) { + $target = $args['target']; + $name = $args['name']; + + if (($volume = $this->volume($target)) == false) { + return array('error' => $this->error(self::ERROR_MKDIR, $name, self::ERROR_TRGDIR_NOT_FOUND, '#'.$target)); + } + + return ($dir = $volume->mkdir($target, $name)) == false + ? array('error' => $this->error(self::ERROR_MKDIR, htmlspecialchars($name, ENT_QUOTES, 'UTF-8'), $volume->error())) + : array('added' => array($dir)); + } + + /** + * Create empty file + * + * @param array command arguments + * @return array + * @author Dmitry (dio) Levashov + **/ + protected function mkfile($args) { + $target = $args['target']; + $name = $args['name']; + + if (($volume = $this->volume($target)) == false) { + return array('error' => $this->error(self::ERROR_MKFILE, $name, self::ERROR_TRGDIR_NOT_FOUND, '#'.$target)); + } + + return ($file = $volume->mkfile($target, $args['name'])) == false + ? array('error' => $this->error(self::ERROR_MKFILE, htmlspecialchars($name, ENT_QUOTES, 'UTF-8'), $volume->error())) + : array('added' => array($file)); + } + + /** + * Rename file + * + * @param array $args + * @return array + * @author Dmitry (dio) Levashov + **/ + protected function rename($args) { + $target = $args['target']; + $name = $args['name']; + + if (($volume = $this->volume($target)) == false + || ($rm = $volume->file($target)) == false) { + return array('error' => $this->error(self::ERROR_RENAME, '#'.$target, self::ERROR_FILE_NOT_FOUND)); + } + $rm['realpath'] = $volume->realpath($target); + + return ($file = $volume->rename($target, $name)) == false + ? array('error' => $this->error(self::ERROR_RENAME, $rm['name'], $volume->error())) + : array('added' => array($file), 'removed' => array($rm)); + } + + /** + * Duplicate file - create copy with "copy %d" suffix + * + * @param array $args command arguments + * @return array + * @author Dmitry (dio) Levashov + **/ + protected function duplicate($args) { + $targets = is_array($args['targets']) ? $args['targets'] : array(); + $result = array('added' => array()); + $suffix = empty($args['suffix']) ? 'copy' : $args['suffix']; + + foreach ($targets as $target) { + if (($volume = $this->volume($target)) == false + || ($src = $volume->file($target)) == false) { + $result['warning'] = $this->error(self::ERROR_COPY, '#'.$target, self::ERROR_FILE_NOT_FOUND); + break; + } + + if (($file = $volume->duplicate($target, $suffix)) == false) { + $result['warning'] = $this->error($volume->error()); + break; + } + + $result['added'][] = $file; + } + + return $result; + } + + /** + * Remove dirs/files + * + * @param array command arguments + * @return array + * @author Dmitry (dio) Levashov + **/ + protected function rm($args) { + $targets = is_array($args['targets']) ? $args['targets'] : array(); + $result = array('removed' => array()); + + foreach ($targets as $target) { + if (($volume = $this->volume($target)) == false) { + $result['warning'] = $this->error(self::ERROR_RM, '#'.$target, self::ERROR_FILE_NOT_FOUND); + return $result; + } + if (!$volume->rm($target)) { + $result['warning'] = $this->error($volume->error()); + return $result; + } + } + + return $result; + } + + /** + * Save uploaded files + * + * @param array + * @return array + * @author Dmitry (dio) Levashov + **/ + protected function upload($args) { + $target = $args['target']; + $volume = $this->volume($target); + $files = isset($args['FILES']['upload']) && is_array($args['FILES']['upload']) ? $args['FILES']['upload'] : array(); + $result = array('added' => array(), 'header' => empty($args['html']) ? false : 'Content-Type: text/html; charset=utf-8'); + + if (empty($files)) { + return array('error' => $this->error(self::ERROR_UPLOAD, self::ERROR_UPLOAD_NO_FILES), 'header' => $header); + } + + if (!$volume) { + return array('error' => $this->error(self::ERROR_UPLOAD, self::ERROR_TRGDIR_NOT_FOUND, '#'.$target), 'header' => $header); + } + + foreach ($files['name'] as $i => $name) { + if (($error = $files['error'][$i]) > 0) { + $result['warning'] = $this->error(self::ERROR_UPLOAD_FILE, $name, $error == UPLOAD_ERR_INI_SIZE || $error == UPLOAD_ERR_FORM_SIZE ? self::ERROR_UPLOAD_FILE_SIZE : self::ERROR_UPLOAD_TRANSFER); + $this->uploadDebug = 'Upload error code: '.$error; + break; + } + + $tmpname = $files['tmp_name'][$i]; + + if (($fp = fopen($tmpname, 'rb')) == false) { + $result['warning'] = $this->error(self::ERROR_UPLOAD_FILE, $name, self::ERROR_UPLOAD_TRANSFER); + $this->uploadDebug = 'Upload error: unable open tmp file'; + break; + } + + if (($file = $volume->upload($fp, $target, $name, $tmpname)) === false) { + $result['warning'] = $this->error(self::ERROR_UPLOAD_FILE, $name, $volume->error()); + fclose($fp); + break; + } + + fclose($fp); + $result['added'][] = $file; + } + + return $result; + } + + /** + * Copy/move files into new destination + * + * @param array command arguments + * @return array + * @author Dmitry (dio) Levashov + **/ + protected function paste($args) { + $dst = $args['dst']; + $targets = is_array($args['targets']) ? $args['targets'] : array(); + $cut = !empty($args['cut']); + $error = $cut ? self::ERROR_MOVE : self::ERROR_COPY; + $result = array('added' => array(), 'removed' => array()); + + if (($dstVolume = $this->volume($dst)) == false) { + return array('error' => $this->error($error, '#'.$targets[0], self::ERROR_TRGDIR_NOT_FOUND, '#'.$dst)); + } + + foreach ($targets as $target) { + if (($srcVolume = $this->volume($target)) == false) { + $result['warning'] = $this->error($error, '#'.$target, self::ERROR_FILE_NOT_FOUND); + break; + } + + if (($file = $dstVolume->paste($srcVolume, $target, $dst, $cut)) == false) { + $result['warning'] = $this->error($dstVolume->error()); + break; + } + + $result['added'][] = $file; + } + return $result; + } + + /** + * Return file content + * + * @param array $args command arguments + * @return array + * @author Dmitry (dio) Levashov + **/ + protected function get($args) { + $target = $args['target']; + $volume = $this->volume($target); + + if (!$volume || ($file = $volume->file($target)) == false) { + return array('error' => $this->error(self::ERROR_OPEN, '#'.$target, self::ERROR_FILE_NOT_FOUND)); + } + + if (($content = $volume->getContents($target)) === false) { + return array('error' => $this->error(self::ERROR_OPEN, $volume->path($target), $volume->error())); + } + + $json = json_encode($content); + + if ($json == 'null' && strlen($json) < strlen($content)) { + return array('error' => $this->error(self::ERROR_NOT_UTF8_CONTENT, $volume->path($target))); + } + + return array('content' => $content); + } + + /** + * Save content into text file + * + * @return array + * @author Dmitry (dio) Levashov + **/ + protected function put($args) { + $target = $args['target']; + + if (($volume = $this->volume($target)) == false + || ($file = $volume->file($target)) == false) { + return array('error' => $this->error(self::ERROR_SAVE, '#'.$target, self::ERROR_FILE_NOT_FOUND)); + } + + if (($file = $volume->putContents($target, $args['content'])) == false) { + return array('error' => $this->error(self::ERROR_SAVE, $volume->path($target), $volume->error())); + } + + return array('changed' => array($file)); + } + + /** + * Extract files from archive + * + * @param array $args command arguments + * @return array + * @author Dmitry (dio) Levashov, + * @author Alexey Sukhotin + **/ + protected function extract($args) { + $target = $args['target']; + $mimes = !empty($args['mimes']) && is_array($args['mimes']) ? $args['mimes'] : array(); + $error = array(self::ERROR_EXTRACT, '#'.$target); + + if (($volume = $this->volume($target)) == false + || ($file = $volume->file($target)) == false) { + return array('error' => $this->error(self::ERROR_EXTRACT, '#'.$target, self::ERROR_FILE_NOT_FOUND)); + } + + return ($file = $volume->extract($target)) + ? array('added' => array($file)) + : array('error' => $this->error(self::ERROR_EXTRACT, $volume->path($target), $volume->error())); + } + + /** + * Create archive + * + * @param array $args command arguments + * @return array + * @author Dmitry (dio) Levashov, + * @author Alexey Sukhotin + **/ + protected function archive($args) { + $type = $args['type']; + $targets = isset($args['targets']) && is_array($args['targets']) ? $args['targets'] : array(); + + if (($volume = $this->volume($targets[0])) == false) { + return $this->error(self::ERROR_ARCHIVE, self::ERROR_TRGDIR_NOT_FOUND); + } + + return ($file = $volume->archive($targets, $args['type'])) + ? array('added' => array($file)) + : array('error' => $this->error(self::ERROR_ARCHIVE, $volume->error())); + } + + /** + * Search files + * + * @param array $args command arguments + * @return array + * @author Dmitry Levashov + **/ + protected function search($args) { + $q = trim($args['q']); + $mimes = !empty($args['mimes']) && is_array($args['mimes']) ? $args['mimes'] : array(); + $result = array(); + + foreach ($this->volumes as $volume) { + $result = array_merge($result, $volume->search($q, $mimes)); + } + + return array('files' => $result); + } + + /** + * Return file info (used by client "places" ui) + * + * @param array $args command arguments + * @return array + * @author Dmitry Levashov + **/ + protected function info($args) { + $files = array(); + + foreach ($args['targets'] as $hash) { + if (($volume = $this->volume($hash)) != false + && ($info = $volume->file($hash)) != false) { + $files[] = $info; + } + } + + return array('files' => $files); + } + + /** + * Return image dimmensions + * + * @param array $args command arguments + * @return array + * @author Dmitry (dio) Levashov + **/ + protected function dim($args) { + $target = $args['target']; + + if (($volume = $this->volume($target)) != false) { + $dim = $volume->dimensions($target); + return $dim ? array('dim' => $dim) : array(); + } + return array(); + } + + /** + * Resize image + * + * @param array command arguments + * @return array + * @author Dmitry (dio) Levashov + * @author Alexey Sukhotin + **/ + protected function resize($args) { + $target = $args['target']; + $width = $args['width']; + $height = $args['height']; + $x = (int)$args['x']; + $y = (int)$args['y']; + $mode = $args['mode']; + $bg = null; + $degree = (int)$args['degree']; + + if (($volume = $this->volume($target)) == false + || ($file = $volume->file($target)) == false) { + return array('error' => $this->error(self::ERROR_RESIZE, '#'.$target, self::ERROR_FILE_NOT_FOUND)); + } + + return ($file = $volume->resize($target, $width, $height, $x, $y, $mode, $bg, $degree)) + ? array('changed' => array($file)) + : array('error' => $this->error(self::ERROR_RESIZE, $volume->path($target), $volume->error())); + } + + /***************************************************************************/ + /* utils */ + /***************************************************************************/ + + /** + * Return root - file's owner + * + * @param string file hash + * @return elFinderStorageDriver + * @author Dmitry (dio) Levashov + **/ + protected function volume($hash) { + foreach ($this->volumes as $id => $v) { + if (strpos(''.$hash, $id) === 0) { + return $this->volumes[$id]; + } + } + return false; + } + + /** + * Return files info array + * + * @param array $data one file info or files info + * @return array + * @author Dmitry (dio) Levashov + **/ + protected function toArray($data) { + return isset($data['hash']) || !is_array($data) ? array($data) : $data; + } + + /** + * Return fils hashes list + * + * @param array $files files info + * @return array + * @author Dmitry (dio) Levashov + **/ + protected function hashes($files) { + $ret = array(); + foreach ($files as $file) { + $ret[] = $file['hash']; + } + return $ret; + } + + /** + * Remove from files list hidden files and files with required mime types + * + * @param array $files files info + * @return array + * @author Dmitry (dio) Levashov + **/ + protected function filter($files) { + foreach ($files as $i => $file) { + if (!empty($file['hidden']) || !$this->default->mimeAccepted($file['mime'])) { + unset($files[$i]); + } + } + return array_merge($files, array()); + } + + protected function utime() { + $time = explode(" ", microtime()); + return (double)$time[1] + (double)$time[0]; + } + +} // END class diff --git a/deployed/k2/administrator/components/com_k2/lib/elfinder/elFinderConnector.class.php b/deployed/k2/administrator/components/com_k2/lib/elfinder/elFinderConnector.class.php new file mode 100644 index 00000000..bc53f5e4 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/lib/elfinder/elFinderConnector.class.php @@ -0,0 +1,143 @@ +elFinder = $elFinder; + if ($debug) { + $this->header = 'Content-Type: text/html; charset=utf-8'; + } + } + + /** + * Execute elFinder command and output result + * + * @return void + * @author Dmitry (dio) Levashov + **/ + public function run() { + $isPost = $_SERVER["REQUEST_METHOD"] == 'POST'; + $src = $_SERVER["REQUEST_METHOD"] == 'POST' ? $_POST : $_GET; + $cmd = isset($src['cmd']) ? $src['cmd'] : ''; + $args = array(); + + if (!function_exists('json_encode')) { + $error = $this->elFinder->error(elFinder::ERROR_CONF, elFinder::ERROR_CONF_NO_JSON); + $this->output(array('error' => '{"error":["'.implode('","', $error).'"]}', 'raw' => true)); + } + + if (!$this->elFinder->loaded()) { + $this->output(array('error' => $this->elFinder->error(elFinder::ERROR_CONF, elFinder::ERROR_CONF_NO_VOL), 'debug' => $this->elFinder->mountErrors)); + } + + // telepat_mode: on + if (!$cmd && $isPost) { + $this->output(array('error' => $this->elFinder->error(elFinder::ERROR_UPLOAD, elFinder::ERROR_UPLOAD_TOTAL_SIZE), 'header' => 'Content-Type: text/html')); + } + // telepat_mode: off + + if (!$this->elFinder->commandExists($cmd)) { + $this->output(array('error' => $this->elFinder->error(elFinder::ERROR_UNKNOWN_CMD))); + } + + // collect required arguments to exec command + foreach ($this->elFinder->commandArgsList($cmd) as $name => $req) { + $arg = $name == 'FILES' + ? $_FILES + : (isset($src[$name]) ? $src[$name] : ''); + + if (!is_array($arg)) { + $arg = trim($arg); + } + if ($req && (!isset($arg) || $arg === '')) { + $this->output(array('error' => $this->elFinder->error(elFinder::ERROR_INV_PARAMS, $cmd))); + } + $args[$name] = $arg; + } + + $args['debug'] = isset($src['debug']) ? !!$src['debug'] : false; + + $this->output($this->elFinder->exec($cmd, $args)); + } + + /** + * Output json + * + * @param array data to output + * @return void + * @author Dmitry (dio) Levashov + **/ + protected function output(array $data) { + $header = isset($data['header']) ? $data['header'] : $this->header; + unset($data['header']); + if ($header) { + if (is_array($header)) { + foreach ($header as $h) { + header($h); + } + } else { + header($header); + } + } + + if (isset($data['pointer'])) { + rewind($data['pointer']); + fpassthru($data['pointer']); + if (!empty($data['volume'])) { + $data['volume']->close($data['pointer'], $data['info']['hash']); + } + exit(); + } else { + if (!empty($data['raw']) && !empty($data['error'])) { + exit($data['error']); + } else { + exit(json_encode($data)); + } + } + + } + +}// END class diff --git a/deployed/k2/administrator/components/com_k2/lib/elfinder/elFinderVolumeDriver.class.php b/deployed/k2/administrator/components/com_k2/lib/elfinder/elFinderVolumeDriver.class.php new file mode 100644 index 00000000..458684f0 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/lib/elfinder/elFinderVolumeDriver.class.php @@ -0,0 +1,3381 @@ + array(), + 'extract' => array() + ); + + /** + * How many subdirs levels return for tree + * + * @var int + **/ + protected $treeDeep = 1; + + /** + * Errors from last failed action + * + * @var array + **/ + protected $error = array(); + + /** + * Today 24:00 timestamp + * + * @var int + **/ + protected $today = 0; + + /** + * Yesterday 24:00 timestamp + * + * @var int + **/ + protected $yesterday = 0; + + /** + * Object configuration + * + * @var array + **/ + protected $options = array( + 'id' => '', + // root directory path + 'path' => '', + // open this path on initial request instead of root path + 'startPath' => '', + // how many subdirs levels return per request + 'treeDeep' => 1, + // root url, not set to disable sending URL to client (replacement for old "fileURL" option) + 'URL' => '', + // directory separator. required by client to show paths correctly + 'separator' => DIRECTORY_SEPARATOR, + // library to crypt/uncrypt files names (not implemented) + 'cryptLib' => '', + // how to detect files mimetypes. (auto/internal/finfo/mime_content_type) + 'mimeDetect' => 'auto', + // mime.types file path (for mimeDetect==internal) + 'mimefile' => '', + // directory for thumbnails + 'tmbPath' => '.tmb', + // mode to create thumbnails dir + 'tmbPathMode' => 0755, + // thumbnails dir URL. Set it if store thumbnails outside root directory + 'tmbURL' => '', + // thumbnails size (px) + 'tmbSize' => 48, + // thumbnails crop (true - crop, false - scale image to fit thumbnail size) + 'tmbCrop' => true, + // thumbnails background color (hex #rrggbb or 'transparent') + 'tmbBgColor' => '#ffffff', + // image manipulations library + 'imgLib' => 'auto', + // on paste file - if true - old file will be replaced with new one, if false new file get name - original_name-number.ext + 'copyOverwrite' => true, + // if true - join new and old directories content on paste + 'copyJoin' => true, + // on upload - if true - old file will be replaced with new one, if false new file get name - original_name-number.ext + 'uploadOverwrite' => true, + // mimetypes allowed to upload + 'uploadAllow' => array(), + // mimetypes not allowed to upload + 'uploadDeny' => array(), + // order to proccess uploadAllow and uploadDeny options + 'uploadOrder' => array('deny', 'allow'), + // maximum upload file size. NOTE - this is size for every uploaded files + 'uploadMaxSize' => 0, + // files dates format + 'dateFormat' => 'j M Y H:i', + // files time format + 'timeFormat' => 'H:i', + // if true - every folder will be check for children folders, otherwise all folders will be marked as having subfolders + 'checkSubfolders' => true, + // allow to copy from this volume to other ones? + 'copyFrom' => true, + // allow to copy from other volumes to this one? + 'copyTo' => true, + // list of commands disabled on this root + 'disabled' => array(), + // regexp or function name to validate new file name + 'acceptedName' => '/^\w[\w\s\.\%\-\(\)\[\]]*$/u', + // function/class method to control files permissions + 'accessControl' => null, + // some data required by access control + 'accessControlData' => null, + // default permissions. not set hidden/locked here - take no effect + 'defaults' => array( + 'read' => true, + 'write' => true + ), + // files attributes + 'attributes' => array(), + // Allowed archive's mimetypes to create. Leave empty for all available types. + 'archiveMimes' => array(), + // Manual config for archivers. See example below. Leave empty for auto detect + 'archivers' => array(), + // required to fix bug on macos + 'utf8fix' => false, + // й ё Й Ё Ø Å + 'utf8patterns' => array("\u0438\u0306", "\u0435\u0308", "\u0418\u0306", "\u0415\u0308", "\u00d8A", "\u030a"), + 'utf8replace' => array("\u0439", "\u0451", "\u0419", "\u0401", "\u00d8", "\u00c5") + ); + + /** + * Defaults permissions + * + * @var array + **/ + protected $defaults = array( + 'read' => true, + 'write' => true, + 'locked' => false, + 'hidden' => false + ); + + /** + * Access control function/class + * + * @var mixed + **/ + protected $attributes = array(); + + /** + * Access control function/class + * + * @var mixed + **/ + protected $access = null; + + /** + * Mime types allowed to upload + * + * @var array + **/ + protected $uploadAllow = array(); + + /** + * Mime types denied to upload + * + * @var array + **/ + protected $uploadDeny = array(); + + /** + * Order to validate uploadAllow and uploadDeny + * + * @var array + **/ + protected $uploadOrder = array(); + + /** + * Maximum allowed upload file size. + * Set as number or string with unit - "10M", "500K", "1G" + * + * @var int|string + **/ + protected $uploadMaxSize = 0; + + /** + * Mimetype detect method + * + * @var string + **/ + protected $mimeDetect = 'auto'; + + /** + * Flag - mimetypes from externail file was loaded + * + * @var bool + **/ + private static $mimetypesLoaded = false; + + /** + * Finfo object for mimeDetect == 'finfo' + * + * @var object + **/ + protected $finfo = null; + + /** + * List of disabled client's commands + * + * @var array + **/ + protected $diabled = array(); + + /** + * default extensions/mimetypes for mimeDetect == 'internal' + * + * @var array + **/ + protected static $mimetypes = array( + // applications + 'ai' => 'application/postscript', + 'eps' => 'application/postscript', + 'exe' => 'application/x-executable', + 'doc' => 'application/vnd.ms-word', + 'xls' => 'application/vnd.ms-excel', + 'ppt' => 'application/vnd.ms-powerpoint', + 'pps' => 'application/vnd.ms-powerpoint', + 'pdf' => 'application/pdf', + 'xml' => 'application/xml', + 'odt' => 'application/vnd.oasis.opendocument.text', + 'swf' => 'application/x-shockwave-flash', + 'torrent' => 'application/x-bittorrent', + 'jar' => 'application/x-jar', + // archives + 'gz' => 'application/x-gzip', + 'tgz' => 'application/x-gzip', + 'bz' => 'application/x-bzip2', + 'bz2' => 'application/x-bzip2', + 'tbz' => 'application/x-bzip2', + 'zip' => 'application/zip', + 'rar' => 'application/x-rar', + 'tar' => 'application/x-tar', + '7z' => 'application/x-7z-compressed', + // texts + 'txt' => 'text/plain', + 'php' => 'text/x-php', + 'html' => 'text/html', + 'htm' => 'text/html', + 'js' => 'text/javascript', + 'css' => 'text/css', + 'rtf' => 'text/rtf', + 'rtfd' => 'text/rtfd', + 'py' => 'text/x-python', + 'java' => 'text/x-java-source', + 'rb' => 'text/x-ruby', + 'sh' => 'text/x-shellscript', + 'pl' => 'text/x-perl', + 'xml' => 'text/xml', + 'sql' => 'text/x-sql', + 'c' => 'text/x-csrc', + 'h' => 'text/x-chdr', + 'cpp' => 'text/x-c++src', + 'hh' => 'text/x-c++hdr', + 'log' => 'text/plain', + 'csv' => 'text/x-comma-separated-values', + // images + 'bmp' => 'image/x-ms-bmp', + 'jpg' => 'image/jpeg', + 'jpeg' => 'image/jpeg', + 'gif' => 'image/gif', + 'png' => 'image/png', + 'tif' => 'image/tiff', + 'tiff' => 'image/tiff', + 'tga' => 'image/x-targa', + 'psd' => 'image/vnd.adobe.photoshop', + 'ai' => 'image/vnd.adobe.photoshop', + 'xbm' => 'image/xbm', + 'pxm' => 'image/pxm', + //audio + 'mp3' => 'audio/mpeg', + 'mid' => 'audio/midi', + 'ogg' => 'audio/ogg', + 'oga' => 'audio/ogg', + 'm4a' => 'audio/x-m4a', + 'wav' => 'audio/wav', + 'wma' => 'audio/x-ms-wma', + // video + 'avi' => 'video/x-msvideo', + 'dv' => 'video/x-dv', + 'mp4' => 'video/mp4', + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'mov' => 'video/quicktime', + 'wm' => 'video/x-ms-wmv', + 'flv' => 'video/x-flv', + 'mkv' => 'video/x-matroska', + 'webm' => 'video/webm', + 'ogv' => 'video/ogg', + 'ogm' => 'video/ogg' + ); + + /** + * Directory separator - required by client + * + * @var string + **/ + protected $separator = DIRECTORY_SEPARATOR; + + /** + * Mimetypes allowed to display + * + * @var array + **/ + protected $onlyMimes = array(); + + /** + * Store files moved or overwrited files info + * + * @var array + **/ + protected $removed = array(); + + /** + * Cache storage + * + * @var array + **/ + protected $cache = array(); + + /** + * Cache by folders + * + * @var array + **/ + protected $dirsCache = array(); + + /*********************************************************************/ + /* INITIALIZATION */ + /*********************************************************************/ + + /** + * Prepare driver before mount volume. + * Return true if volume is ready. + * + * @return bool + * @author Dmitry (dio) Levashov + **/ + protected function init() { + return true; + } + + /** + * Configure after successfull mount. + * By default set thumbnails path and image manipulation library. + * + * @return void + * @author Dmitry (dio) Levashov + **/ + protected function configure() { + // set thumbnails path + $path = $this->options['tmbPath']; + if ($path) { + if (!file_exists($path)) { + if (@mkdir($path)) { + chmod($path, $this->options['tmbPathMode']); + } else { + $path = ''; + } + } + + if (is_dir($path) && is_readable($path)) { + $this->tmbPath = $path; + $this->tmbPathWritable = is_writable($path); + } + } + + // set image manipulation library + $type = preg_match('/^(imagick|gd|auto)$/i', $this->options['imgLib']) + ? strtolower($this->options['imgLib']) + : 'auto'; + + if (($type == 'imagick' || $type == 'auto') && extension_loaded('imagick')) { + $this->imgLib = 'imagick'; + } else { + $this->imgLib = function_exists('gd_info') ? 'gd' : ''; + } + + } + + + /*********************************************************************/ + /* PUBLIC API */ + /*********************************************************************/ + + /** + * Return driver id. Used as a part of volume id. + * + * @return string + * @author Dmitry (dio) Levashov + **/ + public function driverId() { + return $this->driverId; + } + + /** + * Return volume id + * + * @return string + * @author Dmitry (dio) Levashov + **/ + public function id() { + return $this->id; + } + + /** + * Return debug info for client + * + * @return array + * @author Dmitry (dio) Levashov + **/ + public function debug() { + return array( + 'id' => $this->id(), + 'name' => strtolower(substr(get_class($this), strlen('elfinderdriver'))), + 'mimeDetect' => $this->mimeDetect, + 'imgLib' => $this->imgLib + ); + } + + /** + * "Mount" volume. + * Return true if volume available for read or write, + * false - otherwise + * + * @return bool + * @author Dmitry (dio) Levashov + * @author Alexey Sukhotin + **/ + public function mount(array $opts) { + if (!isset($opts['path']) || $opts['path'] === '') { + return false; + } + + $this->options = array_merge($this->options, $opts); + $this->id = $this->driverId.(!empty($this->options['id']) ? $this->options['id'] : elFinder::$volumesCnt++).'_'; + $this->root = $this->_normpath($this->options['path']); + $this->separator = isset($this->options['separator']) ? $this->options['separator'] : DIRECTORY_SEPARATOR; + + // default file attribute + $this->defaults = array( + 'read' => isset($this->options['defaults']['read']) ? !!$this->options['defaults']['read'] : true, + 'write' => isset($this->options['defaults']['write']) ? !!$this->options['defaults']['write'] : true, + 'locked' => false, + 'hidden' => false + ); + + // root attributes + $this->attributes[] = array( + 'pattern' => '~^'.preg_quote(DIRECTORY_SEPARATOR).'$~', + 'locked' => true, + 'hidden' => false + ); + // set files attributes + if (!empty($this->options['attributes']) && is_array($this->options['attributes'])) { + + foreach ($this->options['attributes'] as $a) { + // attributes must contain pattern and at least one rule + if (!empty($a['pattern']) || count($a) > 1) { + $this->attributes[] = $a; + } + } + } + + if (!empty($this->options['accessControl'])) { + if (is_string($this->options['accessControl']) + && function_exists($this->options['accessControl'])) { + $this->access = $this->options['accessControl']; + } elseif (is_array($this->options['accessControl']) + && count($this->options['accessControl']) > 1 + && is_object($this->options['accessControl'][0]) + && method_exists($this->options['accessControl'][0], $this->options['accessControl'][1])) { + $this->access = array($this->options['accessControl'][0], $this->options['accessControl'][1]); + } + } + + $this->today = mktime(0,0,0, date('m'), date('d'), date('Y')); + $this->yesterday = $this->today-86400; + + // debug($this->attributes); + if (!$this->init()) { + return false; + } + + // check some options is arrays + $this->uploadAllow = isset($this->options['uploadAllow']) && is_array($this->options['uploadAllow']) + ? $this->options['uploadAllow'] + : array(); + + $this->uploadDeny = isset($this->options['uploadDeny']) && is_array($this->options['uploadDeny']) + ? $this->options['uploadDeny'] + : array(); + + if (is_string($this->options['uploadOrder'])) { // telephat_mode on, compatibility with 1.x + $parts = explode(',', isset($this->options['uploadOrder']) ? $this->options['uploadOrder'] : 'deny,allow'); + $this->uploadOrder = array(trim($parts[0]), trim($parts[1])); + } else { // telephat_mode off + $this->uploadOrder = $this->options['uploadOrder']; + } + + if (!empty($this->options['uploadMaxSize'])) { + $size = ''.$this->options['uploadMaxSize']; + $unit = strtolower(substr($size, strlen($size) - 1)); + $n = 1; + switch ($unit) { + case 'k': + $n = 1024; + break; + case 'm': + $n = 1048576; + break; + case 'g': + $n = 1073741824; + } + $this->uploadMaxSize = intval($size)*$n; + } + + $this->disabled = isset($this->options['disabled']) && is_array($this->options['disabled']) + ? $this->options['disabled'] + : array(); + + $this->cryptLib = $this->options['cryptLib']; + $this->mimeDetect = $this->options['mimeDetect']; + + // find available mimetype detect method + $type = strtolower($this->options['mimeDetect']); + $type = preg_match('/^(finfo|mime_content_type|internal|auto)$/i', $type) ? $type : 'auto'; + $regexp = '/text\/x\-(php|c\+\+)/'; + + if (($type == 'finfo' || $type == 'auto') + && class_exists('finfo') + && @preg_match($regexp, array_shift(explode(';', @finfo_file(finfo_open(FILEINFO_MIME), __FILE__))))) { + $type = 'finfo'; + $this->finfo = finfo_open(FILEINFO_MIME); + } elseif (($type == 'mime_content_type' || $type == 'auto') + && function_exists('mime_content_type') + && preg_match($regexp, array_shift(explode(';', mime_content_type(__FILE__))))) { + $type = 'mime_content_type'; + } else { + $type = 'internal'; + } + $this->mimeDetect = $type; + + // load mimes from external file for mimeDetect == 'internal' + // based on Alexey Sukhotin idea and patch: http://elrte.org/redmine/issues/163 + // file must be in file directory or in parent one + if ($this->mimeDetect == 'internal' && !self::$mimetypesLoaded) { + self::$mimetypesLoaded = true; + $this->mimeDetect = 'internal'; + $file = false; + if (!empty($this->options['mimefile']) && file_exists($this->options['mimefile'])) { + $file = $this->options['mimefile']; + } elseif (file_exists(dirname(__FILE__).DIRECTORY_SEPARATOR.'mime.types')) { + $file = dirname(__FILE__).DIRECTORY_SEPARATOR.'mime.types'; + } elseif (file_exists(dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'mime.types')) { + $file = dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'mime.types'; + } + + if ($file && file_exists($file)) { + $mimecf = file($file); + + foreach ($mimecf as $line_num => $line) { + if (!preg_match('/^\s*#/', $line)) { + $mime = preg_split('/\s+/', $line, -1, PREG_SPLIT_NO_EMPTY); + for ($i = 1, $size = count($mime); $i < $size ; $i++) { + if (!isset(self::$mimetypes[$mime[$i]])) { + self::$mimetypes[$mime[$i]] = $mime[0]; + } + } + } + } + } + } + + $this->rootName = empty($this->options['alias']) ? $this->_basename($this->root) : $this->options['alias']; + $root = $this->stat($this->root); + + if (!$root) { + return $this->setError('Root folder does not exists.'); + } + if (!$root['read'] && !$root['write']) { + return $this->setError('Root folder has not read and write permissions.'); + } + + // debug($root); + + if ($root['read']) { + // check startPath - path to open by default instead of root + if ($this->options['startPath']) { + $start = $this->stat($this->options['startPath']); + if (!empty($start) + && $start['mime'] == 'directory' + && $start['read'] + && empty($start['hidden']) + && $this->_inpath($this->options['startPath'], $this->root)) { + $this->startPath = $this->options['startPath']; + if (substr($this->startPath, -1, 1) == $this->options['separator']) { + $this->startPath = substr($this->startPath, 0, -1); + } + } + } + } else { + $this->options['URL'] = ''; + $this->options['tmbURL'] = ''; + $this->options['tmbPath'] = ''; + // read only volume + array_unshift($this->attributes, array( + 'pattern' => '/.*/', + 'read' => false + )); + } + $this->treeDeep = $this->options['treeDeep'] > 0 ? (int)$this->options['treeDeep'] : 1; + $this->tmbSize = $this->options['tmbSize'] > 0 ? (int)$this->options['tmbSize'] : 48; + $this->URL = $this->options['URL']; + if ($this->URL && preg_match("|[^/?&=]$|", $this->URL)) { + $this->URL .= '/'; + } + + $this->tmbURL = !empty($this->options['tmbURL']) ? $this->options['tmbURL'] : ''; + if ($this->tmbURL && preg_match("|[^/?&=]$|", $this->tmbURL)) { + $this->tmbURL .= '/'; + } + + $this->nameValidator = is_string($this->options['acceptedName']) && !empty($this->options['acceptedName']) + ? $this->options['acceptedName'] + : ''; + + $this->_checkArchivers(); + // manual control archive types to create + if (!empty($this->options['archiveMimes']) && is_array($this->options['archiveMimes'])) { + foreach ($this->archivers['create'] as $mime => $v) { + if (!in_array($mime, $this->options['archiveMimes'])) { + unset($this->archivers['create'][$mime]); + } + } + } + + // manualy add archivers + if (!empty($this->options['archivers']['create']) && is_array($this->options['archivers']['create'])) { + foreach ($this->options['archivers']['create'] as $mime => $conf) { + if (strpos($mime, 'application/') === 0 + && !empty($conf['cmd']) + && isset($conf['argc']) + && !empty($conf['ext']) + && !isset($this->archivers['create'][$mime])) { + $this->archivers['create'][$mime] = $conf; + } + } + } + + if (!empty($this->options['archivers']['extract']) && is_array($this->options['archivers']['extract'])) { + foreach ($this->options['archivers']['extract'] as $mime => $conf) { + if (substr($mime, 'application/') === 0 + && !empty($cons['cmd']) + && isset($conf['argc']) + && !empty($conf['ext']) + && !isset($this->archivers['extract'][$mime])) { + $this->archivers['extract'][$mime] = $conf; + } + } + } + + $this->configure(); + // echo $this->uploadMaxSize; + // echo $this->options['uploadMaxSize']; + return $this->mounted = true; + } + + /** + * Some "unmount" stuffs - may be required by virtual fs + * + * @return void + * @author Dmitry (dio) Levashov + **/ + public function umount() { + } + + /** + * Return error message from last failed action + * + * @return array + * @author Dmitry (dio) Levashov + **/ + public function error() { + return $this->error; + } + + /** + * Set mimetypes allowed to display to client + * + * @param array $mimes + * @return void + * @author Dmitry (dio) Levashov + **/ + public function setMimesFilter($mimes) { + if (is_array($mimes)) { + $this->onlyMimes = $mimes; + } + } + + /** + * Return root folder hash + * + * @return string + * @author Dmitry (dio) Levashov + **/ + public function root() { + return $this->encode($this->root); + } + + /** + * Return root or startPath hash + * + * @return string + * @author Dmitry (dio) Levashov + **/ + public function defaultPath() { + return $this->encode($this->startPath ? $this->startPath : $this->root); + } + + /** + * Return volume options required by client: + * + * @return array + * @author Dmitry (dio) Levashov + **/ + public function options($hash) { + return array( + 'path' => $this->_path($this->decode($hash)), + 'url' => $this->URL, + 'tmbUrl' => $this->tmbURL, + 'disabled' => $this->disabled, + 'separator' => $this->separator, + 'copyOverwrite' => intval($this->options['copyOverwrite']), + 'archivers' => array( + 'create' => array_keys($this->archivers['create']), + 'extract' => array_keys($this->archivers['extract']) + ) + ); + } + + /** + * Return true if command disabled in options + * + * @param string $cmd command name + * @return bool + * @author Dmitry (dio) Levashov + **/ + public function commandDisabled($cmd) { + return in_array($cmd, $this->disabled); + } + + /** + * Return true if mime is required mimes list + * + * @param string $mime mime type to check + * @param array $mimes allowed mime types list or not set to use client mimes list + * @param bool|null $empty what to return on empty list + * @return bool|null + * @author Dmitry (dio) Levashov + * @author Troex Nevelin + **/ + public function mimeAccepted($mime, $mimes = array(), $empty = true) { + $mimes = is_array($mimes) ? $mimes : $this->onlyMimes; + if (empty($mimes)) { + return $empty; + } + return $mime == 'directory' + || in_array('all', $mimes) + || in_array('All', $mimes) + || in_array($mime, $mimes) + || in_array(substr($mime, 0, strpos($mime, '/')), $mimes); + } + + /** + * Return true if voume is readable. + * + * @return bool + * @author Dmitry (dio) Levashov + **/ + public function isReadable() { + $stat = $this->stat($this->root); + return $stat['read']; + } + + /** + * Return true if copy from this volume allowed + * + * @return bool + * @author Dmitry (dio) Levashov + **/ + public function copyFromAllowed() { + return !!$this->options['copyFrom']; + } + + /** + * Return file path related to root + * + * @param string $hash file hash + * @return string + * @author Dmitry (dio) Levashov + **/ + public function path($hash) { + return $this->_path($this->decode($hash)); + } + + /** + * Return file real path if file exists + * + * @param string $hash file hash + * @return string + * @author Dmitry (dio) Levashov + **/ + public function realpath($hash) { + $path = $this->decode($hash); + return $this->stat($path) ? $path : false; + } + + /** + * Return list of moved/overwrited files + * + * @return array + * @author Dmitry (dio) Levashov + **/ + public function removed() { + return $this->removed; + } + + /** + * Clean removed files list + * + * @return void + * @author Dmitry (dio) Levashov + **/ + public function resetRemoved() { + $this->removed = array(); + } + + /** + * Return file/dir hash or first founded child hash with required attr == $val + * + * @param string $hash file hash + * @param string $attr attribute name + * @param bool $val attribute value + * @return string|false + * @author Dmitry (dio) Levashov + **/ + public function closest($hash, $attr, $val) { + return ($path = $this->closestByAttr($this->decode($hash), $attr, $val)) ? $this->encode($path) : false; + } + + /** + * Return file info or false on error + * + * @param string $hash file hash + * @param bool $realpath add realpath field to file info + * @return array|false + * @author Dmitry (dio) Levashov + **/ + public function file($hash) { + $path = $this->decode($hash); + + return ($file = $this->stat($path)) ? $file : $this->setError(elFinder::ERROR_FILE_NOT_FOUND); + + if (($file = $this->stat($path)) != false) { + if ($realpath) { + $file['realpath'] = $path; + } + return $file; + } + return $this->setError(elFinder::ERROR_FILE_NOT_FOUND); + } + + /** + * Return folder info + * + * @param string $hash folder hash + * @param bool $hidden return hidden file info + * @return array|false + * @author Dmitry (dio) Levashov + **/ + public function dir($hash, $resolveLink=false) { + if (($dir = $this->file($hash)) == false) { + return $this->setError(elFinder::ERROR_DIR_NOT_FOUND); + } + + if ($resolveLink && !empty($dir['thash'])) { + $dir = $this->file($dir['thash']); + } + + return $dir && $dir['mime'] == 'directory' && empty($dir['hidden']) + ? $dir + : $this->setError(elFinder::ERROR_NOT_DIR); + } + + /** + * Return directory content or false on error + * + * @param string $hash file hash + * @return array|false + * @author Dmitry (dio) Levashov + **/ + public function scandir($hash) { + if (($dir = $this->dir($hash)) == false) { + return false; + } + + return $dir['read'] + ? $this->getScandir($this->decode($hash)) + : $this->setError(elFinder::ERROR_PERM_DENIED); + } + + /** + * Return dir files names list + * + * @param string $hash file hash + * @return array + * @author Dmitry (dio) Levashov + **/ + public function ls($hash) { + if (($dir = $this->dir($hash)) == false || !$dir['read']) { + return false; + } + + $list = array(); + $path = $this->decode($hash); + + foreach ($this->getScandir($path) as $stat) { + if (empty($stat['hidden']) && $this->mimeAccepted($stat['mime'])) { + $list[] = $stat['name']; + } + } + + return $list; + } + + /** + * Return subfolders for required folder or false on error + * + * @param string $hash folder hash or empty string to get tree from root folder + * @param int $deep subdir deep + * @param string $exclude dir hash which subfolders must be exluded from result, required to not get stat twice on cwd subfolders + * @return array|false + * @author Dmitry (dio) Levashov + **/ + public function tree($hash='', $deep=0, $exclude='') { + $path = $hash ? $this->decode($hash) : $this->root; + + if (($dir = $this->stat($path)) == false || $dir['mime'] != 'directory') { + return false; + } + + $dirs = $this->gettree($path, $deep > 0 ? $deep -1 : $this->treeDeep-1, $this->decode($exclude)); + array_unshift($dirs, $dir); + return $dirs; + } + + /** + * Return part of dirs tree from required dir up to root dir + * + * @param string $hash directory hash + * @return array + * @author Dmitry (dio) Levashov + **/ + public function parents($hash) { + if (($current = $this->dir($hash)) == false) { + return false; + } + + $path = $this->decode($hash); + $tree = array(); + + while ($path && $path != $this->root) { + $path = $this->_dirname($path); + $stat = $this->stat($path); + if (!empty($stat['hidden']) || !$stat['read']) { + return false; + } + + array_unshift($tree, $stat); + if ($path != $this->root) { + foreach ($this->gettree($path, 0) as $dir) { + if (!in_array($dir, $tree)) { + $tree[] = $dir; + } + } + } + } + + return $tree ? $tree : array($current); + } + + /** + * Create thumbnail for required file and return its name of false on failed + * + * @return string|false + * @author Dmitry (dio) Levashov + **/ + public function tmb($hash) { + $path = $this->decode($hash); + $stat = $this->stat($path); + + if (isset($stat['tmb'])) { + return $stat['tmb'] == "1" ? $this->createTmb($path, $stat) : $stat['tmb']; + } + return false; + } + + /** + * Return file size / total directory size + * + * @param string file hash + * @return int + * @author Dmitry (dio) Levashov + **/ + public function size($hash) { + return $this->countSize($this->decode($hash)); + } + + /** + * Open file for reading and return file pointer + * + * @param string file hash + * @return Resource + * @author Dmitry (dio) Levashov + **/ + public function open($hash) { + if (($file = $this->file($hash)) == false + || $file['mime'] == 'directory') { + return false; + } + + return $this->_fopen($this->decode($hash), 'rb'); + } + + /** + * Close file pointer + * + * @param Resource $fp file pointer + * @param string $hash file hash + * @return void + * @author Dmitry (dio) Levashov + **/ + public function close($fp, $hash) { + $this->_fclose($fp, $this->decode($hash)); + } + + /** + * Create directory and return dir info + * + * @param string $dst destination directory + * @param string $name directory name + * @return array|false + * @author Dmitry (dio) Levashov + **/ + public function mkdir($dst, $name) { + if ($this->commandDisabled('mkdir')) { + return $this->setError(elFinder::ERROR_PERM_DENIED); + } + + if (!$this->nameAccepted($name)) { + return $this->setError(elFinder::ERROR_INVALID_NAME); + } + + if (($dir = $this->dir($dst)) == false) { + return $this->setError(elFinder::ERROR_TRGDIR_NOT_FOUND, '#'.$dst); + } + + if (!$dir['write']) { + return $this->setError(elFinder::ERROR_PERM_DENIED); + } + + $path = $this->decode($dst); + $dst = $this->_joinPath($path, $name); + $stat = $this->stat($dst); + if (!empty($stat)) { + return $this->setError(elFinder::ERROR_EXISTS, $name); + } + $this->clearcache(); + return ($path = $this->_mkdir($path, $name)) ? $this->stat($path) : false; + } + + /** + * Create empty file and return its info + * + * @param string $dst destination directory + * @param string $name file name + * @return array|false + * @author Dmitry (dio) Levashov + **/ + public function mkfile($dst, $name) { + if ($this->commandDisabled('mkfile')) { + return $this->setError(elFinder::ERROR_PERM_DENIED); + } + + if (!$this->nameAccepted($name)) { + return $this->setError(elFinder::ERROR_INVALID_NAME); + } + + if (($dir = $this->dir($dst)) == false) { + return $this->setError(elFinder::ERROR_TRGDIR_NOT_FOUND, '#'.$dst); + } + + if (!$dir['write']) { + return $this->setError(elFinder::ERROR_PERM_DENIED); + } + + $path = $this->decode($dst); + + if ($this->stat($this->_joinPath($path, $name))) { + return $this->setError(elFinder::ERROR_EXISTS, $name); + } + $this->clearcache(); + return ($path = $this->_mkfile($path, $name)) ? $this->stat($path) : false; + } + + /** + * Rename file and return file info + * + * @param string $hash file hash + * @param string $name new file name + * @return array|false + * @author Dmitry (dio) Levashov + **/ + public function rename($hash, $name) { + if ($this->commandDisabled('rename')) { + return $this->setError(elFinder::ERROR_PERM_DENIED); + } + + if (!$this->nameAccepted($name)) { + return $this->setError(elFinder::ERROR_INVALID_NAME, $name); + } + + if (!($file = $this->file($hash))) { + return $this->setError(elFinder::ERROR_FILE_NOT_FOUND); + } + + if ($name == $file['name']) { + return $file; + } + + if (!empty($file['locked'])) { + return $this->setError(elFinder::ERROR_LOCKED, $file['name']); + } + + $path = $this->decode($hash); + $dir = $this->_dirname($path); + $stat = $this->stat($this->_joinPath($dir, $name)); + if ($stat) { + return $this->setError(elFinder::ERROR_EXISTS, $name); + } + + if (!$this->_move($path, $dir, $name)) { + return false; + } + + if (!empty($stat['tmb']) && $stat['tmb'] != "1") { + $this->rmTmb($stat['tmb']); + } + + $path = $this->_joinPath($dir, $name); + + $this->clearcache(); + return $this->stat($path); + } + + /** + * Create file copy with suffix "copy number" and return its info + * + * @param string $hash file hash + * @param string $suffix suffix to add to file name + * @return array|false + * @author Dmitry (dio) Levashov + **/ + public function duplicate($hash, $suffix='copy') { + if ($this->commandDisabled('duplicate')) { + return $this->setError(elFinder::ERROR_COPY, '#'.$hash, elFinder::ERROR_PERM_DENIED); + } + + if (($file = $this->file($hash)) == false) { + return $this->setError(elFinder::ERROR_COPY, elFinder::ERROR_FILE_NOT_FOUND); + } + + $path = $this->decode($hash); + $dir = $this->_dirname($path); + + return ($path = $this->copy($path, $dir, $this->uniqueName($dir, $this->_basename($path), ' '.$suffix.' '))) == false + ? false + : $this->stat($path); + } + + /** + * Save uploaded file. + * On success return array with new file stat and with removed file hash (if existed file was replaced) + * + * @param Resource $fp file pointer + * @param string $dst destination folder hash + * @param string $src file name + * @param string $tmpname file tmp name - required to detect mime type + * @return array|false + * @author Dmitry (dio) Levashov + **/ + public function upload($fp, $dst, $name, $tmpname) { + if ($this->commandDisabled('upload')) { + return $this->setError(elFinder::ERROR_PERM_DENIED); + } + + if (($dir = $this->dir($dst)) == false) { + return $this->setError(elFinder::ERROR_TRGDIR_NOT_FOUND, '#'.$dst); + } + + if (!$dir['write']) { + return $this->setError(elFinder::ERROR_PERM_DENIED); + } + + if (!$this->nameAccepted($name)) { + return $this->setError(elFinder::ERROR_INVALID_NAME); + } + + $mime = $this->mimetype($this->mimeDetect == 'internal' ? $name : $tmpname); + if ($mime == 'unknown' && $this->mimeDetect == 'internal') { + $mime = elFinderVolumeDriver::mimetypeInternalDetect($name); + } + + // logic based on http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html#order + $allow = $this->mimeAccepted($mime, $this->uploadAllow, null); + $deny = $this->mimeAccepted($mime, $this->uploadDeny, null); + $upload = true; // default to allow + if (strtolower($this->uploadOrder[0]) == 'allow') { // array('allow', 'deny'), default is to 'deny' + $upload = false; // default is deny + if (!$deny && ($allow === true)) { // match only allow + $upload = true; + }// else (both match | no match | match only deny) { deny } + } else { // array('deny', 'allow'), default is to 'allow' - this is the default rule + $upload = true; // default is allow + if (($deny === true) && !$allow) { // match only deny + $upload = false; + } // else (both match | no match | match only allow) { allow } + } + if (!$upload) { + return $this->setError(elFinder::ERROR_UPLOAD_FILE_MIME); + } + + if ($this->uploadMaxSize > 0 && filesize($tmpname) > $this->uploadMaxSize) { + return $this->setError(elFinder::ERROR_UPLOAD_FILE_SIZE); + } + + $dstpath = $this->decode($dst); + $test = $this->_joinPath($dstpath, $name); + + $file = $this->stat($test); + $this->clearcache(); + + if ($file) { // file exists + if ($this->options['uploadOverwrite']) { + if (!$file['write']) { + return $this->setError(elFinder::ERROR_PERM_DENIED); + } elseif ($file['mime'] == 'directory') { + return $this->setError(elFinder::ERROR_NOT_REPLACE, $name); + } + $this->remove($file); + } else { + $name = $this->uniqueName($dstpath, $name, '-', false); + } + } + + $w = $h = 0; + if (strpos($mime, 'image') === 0 && ($s = getimagesize($tmpname))) { + $w = $s[0]; + $h = $s[1]; + } + // $this->clearcache(); + if (($path = $this->_save($fp, $dstpath, $name, $mime, $w, $h)) == false) { + return false; + } + + + + return $this->stat($path); + } + + /** + * Paste files + * + * @param Object $volume source volume + * @param string $source file hash + * @param string $dst destination dir hash + * @param bool $rmSrc remove source after copy? + * @return array|false + * @author Dmitry (dio) Levashov + **/ + public function paste($volume, $src, $dst, $rmSrc = false) { + $err = $rmSrc ? elFinder::ERROR_MOVE : elFinder::ERROR_COPY; + + if ($this->commandDisabled('paste')) { + return $this->setError($err, '#'.$src, elFinder::ERROR_PERM_DENIED); + } + + if (($file = $volume->file($src, $rmSrc)) == false) { + return $this->setError($err, '#'.$src, elFinder::ERROR_FILE_NOT_FOUND); + } + + $name = $file['name']; + $errpath = $volume->path($src); + + if (($dir = $this->dir($dst)) == false) { + return $this->setError($err, $errpath, elFinder::ERROR_TRGDIR_NOT_FOUND, '#'.$dst); + } + + if (!$dir['write'] || !$file['read']) { + return $this->setError($err, $errpath, elFinder::ERROR_PERM_DENIED); + } + + $destination = $this->decode($dst); + + if (($test = $volume->closest($src, $rmSrc ? 'locked' : 'read', $rmSrc))) { + return $rmSrc + ? $this->setError($err, $errpath, elFinder::ERROR_LOCKED, $volume->path($test)) + : $this->setError($err, $errpath, elFinder::ERROR_PERM_DENIED); + } + + $test = $this->_joinPath($destination, $name); + $stat = $this->stat($test); + $this->clearcache(); + if ($stat) { + if ($this->options['copyOverwrite']) { + // do not replace file with dir or dir with file + if (!$this->isSameType($file['mime'], $stat['mime'])) { + return $this->setError(elFinder::ERROR_NOT_REPLACE, $this->_path($test)); + } + // existed file is not writable + if (!$stat['write']) { + return $this->setError($err, $errpath, elFinder::ERROR_PERM_DENIED); + } + // existed file locked or has locked child + if (($locked = $this->closestByAttr($test, 'locked', true))) { + return $this->setError(elFinder::ERROR_LOCKED, $this->_path($locked)); + } + // remove existed file + if (!$this->remove($test)) { + return $this->setError(elFinder::ERROR_REPLACE, $this->_path($test)); + } + } else { + $name = $this->uniqueName($destination, $name, ' ', false); + } + } + + // copy/move inside current volume + if ($volume == $this) { + $source = $this->decode($src); + // do not copy into itself + if ($this->_inpath($destination, $source)) { + return $this->setError(elFinder::ERROR_COPY_INTO_ITSELF, $path); + } + $method = $rmSrc ? 'move' : 'copy'; + + return ($path = $this->$method($source, $destination, $name)) ? $this->stat($path) : false; + } + + + // copy/move from another volume + if (!$this->options['copyTo'] || !$volume->copyFromAllowed()) { + return $this->setError(elFinder::ERROR_COPY, $errpath, elFinder::ERROR_PERM_DENIED); + } + + if (($path = $this->copyFrom($volume, $src, $destination, $name)) == false) { + return false; + } + + if ($rmSrc) { + if ($volume->rm($src)) { + $this->removed[] = $file; + } else { + return $this->setError(elFinder::ERROR_MOVE, $errpath, elFinder::ERROR_RM_SRC); + } + } + return $this->stat($path); + } + + /** + * Return file contents + * + * @param string $hash file hash + * @return string|false + * @author Dmitry (dio) Levashov + **/ + public function getContents($hash) { + $file = $this->file($hash); + + if (!$file) { + return $this->setError(elFinder::ERROR_FILE_NOT_FOUND); + } + + if ($file['mime'] == 'directory') { + return $this->setError(elFinder::ERROR_NOT_FILE); + } + + if (!$file['read']) { + return $this->setError(elFinder::ERROR_PERM_DENIED); + } + + return $this->_getContents($this->decode($hash)); + } + + /** + * Put content in text file and return file info. + * + * @param string $hash file hash + * @param string $content new file content + * @return array + * @author Dmitry (dio) Levashov + **/ + public function putContents($hash, $content) { + if ($this->commandDisabled('edit')) { + return $this->setError(elFinder::ERROR_PERM_DENIED); + } + + $path = $this->decode($hash); + + if (!($file = $this->file($hash))) { + return $this->setError(elFinder::ERROR_FILE_NOT_FOUND); + } + + if (!$file['write']) { + return $this->setError(elFinder::ERROR_PERM_DENIED); + } + $this->clearcache(); + return $this->_filePutContents($path, $content) ? $this->stat($path) : false; + } + + /** + * Extract files from archive + * + * @param string $hash archive hash + * @return array|bool + * @author Dmitry (dio) Levashov, + * @author Alexey Sukhotin + **/ + public function extract($hash) { + if ($this->commandDisabled('extract')) { + return $this->setError(elFinder::ERROR_PERM_DENIED); + } + + if (($file = $this->file($hash)) == false) { + return $this->setError(elFinder::ERROR_FILE_NOT_FOUND); + } + + $archiver = isset($this->archivers['extract'][$file['mime']]) + ? $this->archivers['extract'][$file['mime']] + : false; + + if (!$archiver) { + return $this->setError(elFinder::ERROR_NOT_ARCHIVE); + } + + $path = $this->decode($hash); + $parent = $this->stat($this->_dirname($path)); + + if (!$file['read'] || !$parent['write']) { + return $this->setError(elFinder::ERROR_PERM_DENIED); + } + $this->clearcache(); + return ($path = $this->_extract($path, $archiver)) ? $this->stat($path) : false; + } + + /** + * Add files to archive + * + * @return void + **/ + public function archive($hashes, $mime) { + if ($this->commandDisabled('archive')) { + return $this->setError(elFinder::ERROR_PERM_DENIED); + } + + $archiver = isset($this->archivers['create'][$mime]) + ? $this->archivers['create'][$mime] + : false; + + if (!$archiver) { + return $this->setError(elFinder::ERROR_ARCHIVE_TYPE); + } + + $files = array(); + + foreach ($hashes as $hash) { + if (($file = $this->file($hash)) == false) { + return $this->error(elFinder::ERROR_FILE_NOT_FOUND, '#'+$hash); + } + if (!$file['read']) { + return $this->error(elFinder::ERROR_PERM_DENIED); + } + $path = $this->decode($hash); + if (!isset($dir)) { + $dir = $this->_dirname($path); + $stat = $this->stat($dir); + if (!$stat['write']) { + return $this->error(elFinder::ERROR_PERM_DENIED); + } + } + + $files[] = $this->_basename($path); + } + + $name = (count($files) == 1 ? $files[0] : 'Archive').'.'.$archiver['ext']; + $name = $this->uniqueName($dir, $name, ''); + $this->clearcache(); + return ($path = $this->_archive($dir, $files, $name, $archiver)) ? $this->stat($path) : false; + } + + /** + * Resize image + * + * @param string $hash image file + * @param int $width new width + * @param int $height new height + * @param int $x X start poistion for crop + * @param int $y Y start poistion for crop + * @param string $mode action how to mainpulate image + * @return array|false + * @author Dmitry (dio) Levashov + * @author Alexey Sukhotin + * @author nao-pon + * @author Troex Nevelin + **/ + public function resize($hash, $width, $height, $x, $y, $mode = 'resize', $bg = '', $degree = 0) { + if ($this->commandDisabled('resize')) { + return $this->setError(elFinder::ERROR_PERM_DENIED); + } + + if (($file = $this->file($hash)) == false) { + return $this->setError(elFinder::ERROR_FILE_NOT_FOUND); + } + + if (!$file['write'] || !$file['read']) { + return $this->setError(elFinder::ERROR_PERM_DENIED); + } + + $path = $this->decode($hash); + + if (!$this->canResize($path, $file)) { + return $this->setError(elFinder::ERROR_UNSUPPORT_TYPE); + } + + switch($mode) { + + case 'propresize': + $result = $this->imgResize($path, $width, $height, true, true); + break; + + case 'crop': + $result = $this->imgCrop($path, $width, $height, $x, $y); + break; + + case 'fitsquare': + $result = $this->imgSquareFit($path, $width, $height, 'center', 'middle', ($bg ? $bg : $this->options['tmbBgColor'])); + break; + + case 'rotate': + $result = $this->imgRotate($path, $degree, ($bg ? $bg : $this->options['tmbBgColor'])); + break; + + default: + $result = $this->imgResize($path, $width, $height, false, true); + break; + } + + if ($result) { + if (!empty($file['tmb']) && $file['tmb'] != "1") { + $this->rmTmb($file['tmb']); + } + $this->clearcache(); + return $this->stat($path); + } + + return false; + } + + /** + * Remove file/dir + * + * @param string $hash file hash + * @return bool + * @author Dmitry (dio) Levashov + **/ + public function rm($hash) { + return $this->commandDisabled('rm') + ? array(elFinder::ERROR_ACCESS_DENIED) + : $this->remove($this->decode($hash)); + } + + /** + * Search files + * + * @param string $q search string + * @param array $mimes + * @return array + * @author Dmitry (dio) Levashov + **/ + public function search($q, $mimes) { + return $this->doSearch($this->root, $q, $mimes); + } + + /** + * Return image dimensions + * + * @param string $hash file hash + * @return array + * @author Dmitry (dio) Levashov + **/ + public function dimensions($hash) { + if (($file = $this->file($hash)) == false) { + return false; + } + + return $this->_dimensions($this->decode($hash), $file['mime']); + } + + /** + * Save error message + * + * @param array error + * @return false + * @author Dmitry(dio) Levashov + **/ + protected function setError($error) { + + $this->error = array(); + + foreach (func_get_args() as $err) { + if (is_array($err)) { + $this->error = array_merge($this->error, $err); + } else { + $this->error[] = $err; + } + } + + // $this->error = is_array($error) ? $error : func_get_args(); + return false; + } + + /*********************************************************************/ + /* FS API */ + /*********************************************************************/ + + /***************** paths *******************/ + + /** + * Encode path into hash + * + * @param string file path + * @return string + * @author Dmitry (dio) Levashov + * @author Troex Nevelin + **/ + protected function encode($path) { + if ($path !== '') { + + // cut ROOT from $path for security reason, even if hacker decodes the path he will not know the root + $p = $this->_relpath($path); + // if reqesting root dir $path will be empty, then assign '/' as we cannot leave it blank for crypt + if ($p === '') { + $p = DIRECTORY_SEPARATOR; + } + + // TODO crypt path and return hash + $hash = $this->crypt($p); + // hash is used as id in HTML that means it must contain vaild chars + // make base64 html safe and append prefix in begining + $hash = strtr(base64_encode($hash), '+/=', '-_.'); + // remove dots '.' at the end, before it was '=' in base64 + $hash = rtrim($hash, '.'); + // append volume id to make hash unique + return $this->id.$hash; + } + } + + /** + * Decode path from hash + * + * @param string file hash + * @return string + * @author Dmitry (dio) Levashov + * @author Troex Nevelin + **/ + protected function decode($hash) { + if (strpos($hash, $this->id) === 0) { + // cut volume id after it was prepended in encode + $h = substr($hash, strlen($this->id)); + // replace HTML safe base64 to normal + $h = base64_decode(strtr($h, '-_.', '+/=')); + // TODO uncrypt hash and return path + $path = $this->uncrypt($h); + // append ROOT to path after it was cut in encode + return $this->_abspath($path);//$this->root.($path == DIRECTORY_SEPARATOR ? '' : DIRECTORY_SEPARATOR.$path); + } + } + + /** + * Return crypted path + * Not implemented + * + * @param string path + * @return mixed + * @author Dmitry (dio) Levashov + **/ + protected function crypt($path) { + return $path; + } + + /** + * Return uncrypted path + * Not implemented + * + * @param mixed hash + * @return mixed + * @author Dmitry (dio) Levashov + **/ + protected function uncrypt($hash) { + return $hash; + } + + /** + * Validate file name based on $this->options['acceptedName'] regexp + * + * @param string $name file name + * @return bool + * @author Dmitry (dio) Levashov + **/ + protected function nameAccepted($name) { + if ($this->nameValidator) { + if (function_exists($this->nameValidator)) { + $f = $this->nameValidator; + return $f($name); + } + return preg_match($this->nameValidator, $name); + } + return true; + } + + /** + * Return new unique name based on file name and suffix + * + * @param string $path file path + * @param string $suffix suffix append to name + * @return string + * @author Dmitry (dio) Levashov + **/ + public function uniqueName($dir, $name, $suffix = ' copy', $checkNum=true) { + $ext = ''; + + if (preg_match('/\.((tar\.(gz|bz|bz2|z|lzo))|cpio\.gz|ps\.gz|xcf\.(gz|bz2)|[a-z0-9]{1,4})$/i', $name, $m)) { + $ext = '.'.$m[1]; + $name = substr($name, 0, strlen($name)-strlen($m[0])); + } + + if ($checkNum && preg_match('/('.$suffix.')(\d*)$/i', $name, $m)) { + $i = (int)$m[2]; + $name = substr($name, 0, strlen($name)-strlen($m[2])); + } else { + $i = 1; + $name .= $suffix; + } + $max = $i+100000; + + while ($i <= $max) { + $n = $name.($i > 0 ? $i : '').$ext; + + if (!$this->stat($this->_joinPath($dir, $n))) { + $this->clearcache(); + return $n; + } + $i++; + } + return $name.md5($dir).$ext; + } + + /*********************** file stat *********************/ + + /** + * Check file attribute + * + * @param string $path file path + * @param string $name attribute name (read|write|locked|hidden) + * @param bool $val attribute value returned by file system + * @return bool + * @author Dmitry (dio) Levashov + **/ + protected function attr($path, $name, $val=false) { + if (!isset($this->defaults[$name])) { + return false; + } + + + $perm = null; + + if ($this->access) { + if (is_array($this->access)) { + $obj = $this->access[0]; + $method = $this->access[1]; + $perm = $obj->{$method}($name, $path, $this->options['accessControlData'], $this); + } else { + $func = $this->access; + $perm = $func($name, $path, $this->options['accessControlData'], $this); + } + + if ($perm !== null) { + return !!$perm; + } + } + + for ($i = 0, $c = count($this->attributes); $i < $c; $i++) { + $attrs = $this->attributes[$i]; + $p = $this->separator.$this->_relpath($path); + if (isset($attrs[$name]) && isset($attrs['pattern']) && preg_match($attrs['pattern'], $p)) { + $perm = $attrs[$name]; + } + } + + return $perm === null ? $this->defaults[$name] : !!$perm; + } + + /** + * Return fileinfo + * + * @param string $path file cache + * @return array + * @author Dmitry (dio) Levashov + **/ + protected function stat($path) { + return isset($this->cache[$path]) + ? $this->cache[$path] + : $this->updateCache($path, $this->_stat($path)); + } + + /** + * Put file stat in cache and return it + * + * @param string $path file path + * @param array $stat file stat + * @return array + * @author Dmitry (dio) Levashov + **/ + protected function updateCache($path, $stat) { + if (empty($stat) || !is_array($stat)) { + return $this->cache[$path] = array(); + } + + $stat['hash'] = $this->encode($path); + + $root = $path == $this->root; + + if ($root) { + $stat['volumeid'] = $this->id; + if ($this->rootName) { + $stat['name'] = $this->rootName; + } + } else { + if (empty($stat['name'])) { + $stat['name'] = $this->_basename($path); + } + if (empty($stat['phash'])) { + $stat['phash'] = $this->encode($this->_dirname($path)); + } + } + + // fix name if required + if ($this->options['utf8fix'] && $this->options['utf8patterns'] && $this->options['utf8replace']) { + $stat['name'] = json_decode(str_replace($this->options['utf8patterns'], $this->options['utf8replace'], json_encode($stat['name']))); + } + + + if (empty($stat['mime'])) { + $stat['mime'] = $this->mimetype($stat['name']); + } + + // @todo move dateformat to client + $stat['date'] = isset($stat['ts']) + ? $this->formatDate($stat['ts']) + : 'unknown'; + + if (!isset($stat['size'])) { + $stat['size'] = 'unknown'; + } + + $stat['read'] = intval($this->attr($path, 'read', isset($stat['read']) ? !!$stat['read'] : false)); + $stat['write'] = intval($this->attr($path, 'write', isset($stat['write']) ? !!$stat['write'] : false)); + if ($root) { + $stat['locked'] = 1; + } elseif ($this->attr($path, 'locked', !empty($stat['locked']))) { + $stat['locked'] = 1; + } else { + unset($stat['locked']); + } + + if ($root) { + unset($stat['hidden']); + } elseif ($this->attr($path, 'hidden', !empty($stat['hidden'])) + || !$this->mimeAccepted($stat['mime'])) { + $stat['hidden'] = $root ? 0 : 1; + } else { + unset($stat['hidden']); + } + + if ($stat['read'] && empty($stat['hidden'])) { + + if ($stat['mime'] == 'directory') { + // for dir - check for subdirs + + if ($this->options['checkSubfolders']) { + if (isset($stat['dirs'])) { + if ($stat['dirs']) { + $stat['dirs'] = 1; + } else { + unset($stat['dirs']); + } + } elseif (!empty($stat['alias']) && !empty($stat['target'])) { + $stat['dirs'] = isset($this->cache[$stat['target']]) + ? intval(isset($this->cache[$stat['target']]['dirs'])) + : $this->_subdirs($stat['target']); + + } elseif ($this->_subdirs($path)) { + $stat['dirs'] = 1; + } + } else { + $stat['dirs'] = 1; + } + } else { + // for files - check for thumbnails + $p = isset($stat['target']) ? $stat['target'] : $path; + if ($this->tmbURL && !isset($stat['tmb']) && $this->canCreateTmb($p, $stat)) { + $tmb = $this->gettmb($p, $stat); + $stat['tmb'] = $tmb ? $tmb : 1; + } + + } + } + + if (!empty($stat['alias']) && !empty($stat['target'])) { + $stat['thash'] = $this->encode($stat['target']); + unset($stat['target']); + } + + return $this->cache[$path] = $stat; + } + + /** + * Get stat for folder content and put in cache + * + * @param string $path + * @return void + * @author Dmitry (dio) Levashov + **/ + protected function cacheDir($path) { + $this->dirsCache[$path] = array(); + + foreach ($this->_scandir($path) as $p) { + if (($stat = $this->stat($p)) && empty($stat['hidden'])) { + $this->dirsCache[$path][] = $p; + } + } + } + + /** + * Clean cache + * + * @return void + * @author Dmitry (dio) Levashov + **/ + protected function clearcache() { + $this->cache = $this->dirsCache = array(); + } + + /** + * Return file mimetype + * + * @param string $path file path + * @return string + * @author Dmitry (dio) Levashov + **/ + protected function mimetype($path) { + $type = ''; + + if ($this->mimeDetect == 'finfo') { + $type = @finfo_file($this->finfo, $path); + } elseif ($type == 'mime_content_type') { + $type = mime_content_type($path); + } else { + $type = elFinderVolumeDriver::mimetypeInternalDetect($path); + } + + $type = explode(';', $type); + $type = trim($type[0]); + + if ($type == 'application/x-empty') { + // finfo return this mime for empty files + $type = 'text/plain'; + } elseif ($type == 'application/x-zip') { + // http://elrte.org/redmine/issues/163 + $type = 'application/zip'; + } + + return $type == 'unknown' && $this->mimeDetect != 'internal' + ? elFinderVolumeDriver::mimetypeInternalDetect($path) + : $type; + + } + + /** + * Detect file mimetype using "internal" method + * + * @param string $path file path + * @return string + * @author Dmitry (dio) Levashov + **/ + static protected function mimetypeInternalDetect($path) { + $pinfo = pathinfo($path); + $ext = isset($pinfo['extension']) ? strtolower($pinfo['extension']) : ''; + return isset(elFinderVolumeDriver::$mimetypes[$ext]) ? elFinderVolumeDriver::$mimetypes[$ext] : 'unknown'; + + } + + /** + * Return file/total directory size + * + * @param string $path file path + * @return int + * @author Dmitry (dio) Levashov + **/ + protected function countSize($path) { + $stat = $this->stat($path); + + if (empty($stat) || !$stat['read'] || !empty($stat['hidden'])) { + return 'unknown'; + } + + if ($stat['mime'] != 'directory') { + return $stat['size']; + } + + $subdirs = $this->options['checkSubfolders']; + $this->options['checkSubfolders'] = true; + $result = 0; + foreach ($this->getScandir($path) as $stat) { + $size = $stat['mime'] == 'directory' && $stat['read'] + ? $this->countSize($this->_joinPath($path, $stat['name'])) + : $stat['size']; + if ($size > 0) { + $result += $size; + } + } + $this->options['checkSubfolders'] = $subdirs; + return $result; + } + + /** + * Return true if all mimes is directory or files + * + * @param string $mime1 mimetype + * @param string $mime2 mimetype + * @return bool + * @author Dmitry (dio) Levashov + **/ + protected function isSameType($mime1, $mime2) { + return ($mime1 == 'directory' && $mime1 == $mime2) || ($mime1 != 'directory' && $mime2 != 'directory'); + } + + /** + * If file has required attr == $val - return file path, + * If dir has child with has required attr == $val - return child path + * + * @param string $path file path + * @param string $attr attribute name + * @param bool $val attribute value + * @return string|false + * @author Dmitry (dio) Levashov + **/ + protected function closestByAttr($path, $attr, $val) { + $stat = $this->stat($path); + + if (empty($stat)) { + return false; + } + + $v = isset($stat[$attr]) ? $stat[$attr] : false; + + if ($v == $val) { + return $path; + } + + return $stat['mime'] == 'directory' + ? $this->childsByAttr($path, $attr, $val) + : false; + } + + /** + * Return first found children with required attr == $val + * + * @param string $path file path + * @param string $attr attribute name + * @param bool $val attribute value + * @return string|false + * @author Dmitry (dio) Levashov + **/ + protected function childsByAttr($path, $attr, $val) { + foreach ($this->_scandir($path) as $p) { + if (($_p = $this->closestByAttr($p, $attr, $val)) != false) { + return $_p; + } + } + return false; + } + + /***************** get content *******************/ + + /** + * Return required dir's files info. + * If onlyMimes is set - return only dirs and files of required mimes + * + * @param string $path dir path + * @return array + * @author Dmitry (dio) Levashov + **/ + protected function getScandir($path) { + $files = array(); + + !isset($this->dirsCache[$path]) && $this->cacheDir($path); + + foreach ($this->dirsCache[$path] as $p) { + if (($stat = $this->stat($p)) && empty($stat['hidden'])) { + $files[] = $stat; + } + } + + return $files; + } + + + /** + * Return subdirs tree + * + * @param string $path parent dir path + * @param int $deep tree deep + * @return array + * @author Dmitry (dio) Levashov + **/ + protected function gettree($path, $deep, $exclude='') { + $dirs = array(); + + !isset($this->dirsCache[$path]) && $this->cacheDir($path); + + foreach ($this->dirsCache[$path] as $p) { + $stat = $this->stat($p); + + if ($stat && empty($stat['hidden']) && $path != $exclude && $stat['mime'] == 'directory') { + $dirs[] = $stat; + if ($deep > 0 && !empty($stat['dirs'])) { + $dirs = array_merge($dirs, $this->gettree($p, $deep-1)); + } + } + } + + return $dirs; + } + + /** + * Recursive files search + * + * @param string $path dir path + * @param string $q search string + * @param array $mimes + * @return array + * @author Dmitry (dio) Levashov + **/ + protected function doSearch($path, $q, $mimes) { + $result = array(); + + foreach($this->_scandir($path) as $p) { + $stat = $this->stat($p); + + if (!$stat) { // invalid links + continue; + } + + if (!empty($stat['hidden']) || !$this->mimeAccepted($stat['mime'])) { + continue; + } + + $name = $stat['name']; + + if ($this->stripos($name, $q) !== false) { + $stat['path'] = $this->_path($p); + if ($this->URL && !isset($stat['url'])) { + $stat['url'] = $this->URL . str_replace($this->separator, '/', substr($p, strlen($this->root) + 1)); + } + + $result[] = $stat; + } + if ($stat['mime'] == 'directory' && $stat['read'] && !isset($stat['alias'])) { + $result = array_merge($result, $this->doSearch($p, $q, $mimes)); + } + } + + return $result; + } + + /********************** manuipulations ******************/ + + /** + * Copy file/recursive copy dir only in current volume. + * Return new file path or false. + * + * @param string $src source path + * @param string $dst destination dir path + * @param string $name new file name (optionaly) + * @return string|false + * @author Dmitry (dio) Levashov + **/ + protected function copy($src, $dst, $name) { + $srcStat = $this->stat($src); + $this->clearcache(); + + if (!empty($srcStat['thash'])) { + $target = $this->decode($srcStat['thash']); + $stat = $this->stat($target); + $this->clearcache(); + return $stat && $this->_symlink($target, $dst, $name) + ? $this->_joinPath($dst, $name) + : $this->setError(elFinder::ERROR_COPY, $this->_path($src)); + } + + if ($srcStat['mime'] == 'directory') { + $test = $this->stat($this->_joinPath($dst, $name)); + + if (($test && $test['mime'] != 'directory') || !$this->_mkdir($dst, $name)) { + return $this->setError(elFinder::ERROR_COPY, $this->_path($src)); + } + + $dst = $this->_joinPath($dst, $name); + + foreach ($this->getScandir($src) as $stat) { + if (empty($stat['hidden'])) { + $name = $stat['name']; + if (!$this->copy($this->_joinPath($src, $name), $dst, $name)) { + return false; + } + } + } + $this->clearcache(); + return $dst; + } + + return $this->_copy($src, $dst, $name) + ? $this->_joinPath($dst, $name) + : $this->setError(elFinder::ERROR_COPY, $this->_path($src)); + } + + /** + * Move file + * Return new file path or false. + * + * @param string $src source path + * @param string $dst destination dir path + * @param string $name new file name + * @return string|false + * @author Dmitry (dio) Levashov + **/ + protected function move($src, $dst, $name) { + $stat = $this->stat($src); + $stat['realpath'] = $src; + $this->clearcache(); + + if ($this->_move($src, $dst, $name)) { + $this->removed[] = $stat; + return $this->_joinPath($dst, $name); + } + + return $this->setError(elFinder::ERROR_MOVE, $this->_path($src)); + } + + /** + * Copy file from another volume. + * Return new file path or false. + * + * @param Object $volume source volume + * @param string $src source file hash + * @param string $destination destination dir path + * @param string $name file name + * @return string|false + * @author Dmitry (dio) Levashov + **/ + protected function copyFrom($volume, $src, $destination, $name) { + + if (($source = $volume->file($src)) == false) { + return $this->setError(elFinder::ERROR_COPY, '#'.$src, $volume->error()); + } + + $errpath = $volume->path($src); + + if (!$this->nameAccepted($source['name'])) { + return $this->setError(elFinder::ERROR_COPY, $errpath, elFinder::ERROR_INVALID_NAME); + } + + if (!$source['read']) { + return $this->setError(elFinder::ERROR_COPY, $errpath, elFinder::ERROR_PERM_DENIED); + } + + if ($source['mime'] == 'directory') { + $stat = $this->stat($this->_joinPath($destination, $name)); + $this->clearcache(); + if ((!$stat || $stat['mime'] != 'directory') && !$this->_mkdir($destination, $name)) { + return $this->setError(elFinder::ERROR_COPY, $errpath); + } + + $path = $this->_joinPath($destination, $name); + + foreach ($volume->scandir($src) as $entr) { + if (!$this->copyFrom($volume, $entr['hash'], $path, $entr['name'])) { + return false; + } + } + + } else { + $mime = $source['mime']; + $w = $h = 0; + if (strpos($mime, 'image') === 0 && ($dim = $volume->dimensions($src))) { + $s = explode('x', $dim); + $w = $s[0]; + $h = $s[1]; + } + + if (($fp = $volume->open($src)) == false + || ($path = $this->_save($fp, $destination, $name, $mime, $w, $h)) == false) { + $fp && $volume->close($fp, $src); + return $this->setError(elFinder::ERROR_COPY, $errpath); + } + $volume->close($fp, $src); + } + + return $path; + } + + /** + * Remove file/ recursive remove dir + * + * @param string $path file path + * @param bool $force try to remove even if file locked + * @return bool + * @author Dmitry (dio) Levashov + **/ + protected function remove($path, $force = false) { + $stat = $this->stat($path); + $stat['realpath'] = $path; + if (!empty($stat['tmb']) && $stat['tmb'] != "1") { + $this->rmTmb($stat['tmb']); + } + $this->clearcache(); + + if (empty($stat)) { + return $this->setError(elFinder::ERROR_RM, $this->_path($path), elFinder::ERROR_FILE_NOT_FOUND); + } + + if (!$force && !empty($stat['locked'])) { + return $this->setError(elFinder::ERROR_LOCKED, $this->_path($path)); + } + + if ($stat['mime'] == 'directory') { + foreach ($this->_scandir($path) as $p) { + $name = $this->_basename($p); + if ($name != '.' && $name != '..' && !$this->remove($p)) { + return false; + } + } + if (!$this->_rmdir($path)) { + return $this->setError(elFinder::ERROR_RM, $this->_path($path)); + } + + } else { + if (!$this->_unlink($path)) { + return $this->setError(elFinder::ERROR_RM, $this->_path($path)); + } + } + + $this->removed[] = $stat; + return true; + } + + + /************************* thumbnails **************************/ + + /** + * Return thumbnail file name for required file + * + * @param array $stat file stat + * @return string + * @author Dmitry (dio) Levashov + **/ + protected function tmbname($stat) { + return $stat['hash'].$stat['ts'].'.png'; + } + + /** + * Return thumnbnail name if exists + * + * @param string $path file path + * @param array $stat file stat + * @return string|false + * @author Dmitry (dio) Levashov + **/ + protected function gettmb($path, $stat) { + if ($this->tmbURL && $this->tmbPath) { + // file itself thumnbnail + if (strpos($path, $this->tmbPath) === 0) { + return basename($path); + } + + $name = $this->tmbname($stat); + if (file_exists($this->tmbPath.DIRECTORY_SEPARATOR.$name)) { + return $name; + } + } + return false; + } + + /** + * Return true if thumnbnail for required file can be created + * + * @param string $path thumnbnail path + * @param array $stat file stat + * @return string|bool + * @author Dmitry (dio) Levashov + **/ + protected function canCreateTmb($path, $stat) { + return $this->tmbPathWritable + && strpos($path, $this->tmbPath) === false // do not create thumnbnail for thumnbnail + && $this->imgLib + && strpos($stat['mime'], 'image') === 0 + && ($this->imgLib == 'gd' ? $stat['mime'] == 'image/jpeg' || $stat['mime'] == 'image/png' || $stat['mime'] == 'image/gif' : true); + } + + /** + * Return true if required file can be resized. + * By default - the same as canCreateTmb + * + * @param string $path thumnbnail path + * @param array $stat file stat + * @return string|bool + * @author Dmitry (dio) Levashov + **/ + protected function canResize($path, $stat) { + return $this->canCreateTmb($path, $stat); + } + + /** + * Create thumnbnail and return it's URL on success + * + * @param string $path file path + * @param string $mime file mime type + * @return string|false + * @author Dmitry (dio) Levashov + **/ + protected function createTmb($path, $stat) { + if (!$stat || !$this->canCreateTmb($path, $stat)) { + return false; + } + + $name = $this->tmbname($stat); + $tmb = $this->tmbPath.DIRECTORY_SEPARATOR.$name; + + // copy image into tmbPath so some drivers does not store files on local fs + if (($src = $this->_fopen($path, 'rb')) == false) { + return false; + } + + if (($trg = fopen($tmb, 'wb')) == false) { + $this->_fclose($src, $path); + return false; + } + + while (!feof($src)) { + fwrite($trg, fread($src, 8192)); + } + + $this->_fclose($src, $path); + fclose($trg); + + $result = false; + + $tmbSize = $this->tmbSize; + + if (($s = getimagesize($tmb)) == false) { + return false; + } + + /* If image smaller or equal thumbnail size - just fitting to thumbnail square */ + if ($s[0] <= $tmbSize && $s[1] <= $tmbSize) { + $result = $this->imgSquareFit($tmb, $tmbSize, $tmbSize, 'center', 'middle', $this->options['tmbBgColor'], 'png' ); + + } else { + + if ($this->options['tmbCrop']) { + + /* Resize and crop if image bigger than thumbnail */ + if (!(($s[0] > $tmbSize && $s[1] <= $tmbSize) || ($s[0] <= $tmbSize && $s[1] > $tmbSize) ) || ($s[0] > $tmbSize && $s[1] > $tmbSize)) { + $result = $this->imgResize($tmb, $tmbSize, $tmbSize, true, false, 'png'); + } + + if (($s = getimagesize($tmb)) != false) { + $x = $s[0] > $tmbSize ? intval(($s[0] - $tmbSize)/2) : 0; + $y = $s[1] > $tmbSize ? intval(($s[1] - $tmbSize)/2) : 0; + $result = $this->imgCrop($tmb, $tmbSize, $tmbSize, $x, $y, 'png'); + } + + } else { + $result = $this->imgResize($tmb, $tmbSize, $tmbSize, true, true, $this->imgLib, 'png'); + $result = $this->imgSquareFit($tmb, $tmbSize, $tmbSize, 'center', 'middle', $this->options['tmbBgColor'], 'png' ); + } + + } + if (!$result) { + unlink($tmb); + return false; + } + + return $name; + } + + /** + * Resize image + * + * @param string $path image file + * @param int $width new width + * @param int $height new height + * @param bool $keepProportions crop image + * @param bool $resizeByBiggerSide resize image based on bigger side if true + * @param string $destformat image destination format + * @return string|false + * @author Dmitry (dio) Levashov + * @author Alexey Sukhotin + **/ + protected function imgResize($path, $width, $height, $keepProportions = false, $resizeByBiggerSide = true, $destformat = null) { + if (($s = @getimagesize($path)) == false) { + return false; + } + + $result = false; + + list($size_w, $size_h) = array($width, $height); + + if ($keepProportions == true) { + + list($orig_w, $orig_h, $new_w, $new_h) = array($s[0], $s[1], $width, $height); + + /* Calculating image scale width and height */ + $xscale = $orig_w / $new_w; + $yscale = $orig_h / $new_h; + + /* Resizing by biggest side */ + + if ($resizeByBiggerSide) { + + if ($orig_w > $orig_h) { + $size_h = $orig_h * $width / $orig_w; + $size_w = $width; + } else { + $size_w = $orig_w * $height / $orig_h; + $size_h = $height; + } + + } else { + if ($orig_w > $orig_h) { + $size_w = $orig_w * $height / $orig_h; + $size_h = $height; + } else { + $size_h = $orig_h * $width / $orig_w; + $size_w = $width; + } + } + } + + switch ($this->imgLib) { + case 'imagick': + + try { + $img = new imagick($path); + } catch (Exception $e) { + + return false; + } + + $img->resizeImage($size_w, $size_h, Imagick::FILTER_LANCZOS, true); + + $result = $img->writeImage($path); + + return $result ? $path : false; + + break; + + case 'gd': + if ($s['mime'] == 'image/jpeg') { + $img = imagecreatefromjpeg($path); + } elseif ($s['mime'] == 'image/png') { + $img = imagecreatefrompng($path); + } elseif ($s['mime'] == 'image/gif') { + $img = imagecreatefromgif($path); + } elseif ($s['mime'] == 'image/xbm') { + $img = imagecreatefromxbm($path); + } + + if ($img && false != ($tmp = imagecreatetruecolor($size_w, $size_h))) { + if (!imagecopyresampled($tmp, $img, 0, 0, 0, 0, $size_w, $size_h, $s[0], $s[1])) { + return false; + } + + if ($destformat == 'jpg' || ($destformat == null && $s['mime'] == 'image/jpeg')) { + $result = imagejpeg($tmp, $path, 100); + } else if ($destformat == 'gif' || ($destformat == null && $s['mime'] == 'image/gif')) { + $result = imagegif($tmp, $path, 7); + } else { + $result = imagepng($tmp, $path, 7); + } + + imagedestroy($img); + imagedestroy($tmp); + + return $result ? $path : false; + + } + break; + } + + return false; + } + + /** + * Crop image + * + * @param string $path image file + * @param int $width crop width + * @param int $height crop height + * @param bool $x crop left offset + * @param bool $y crop top offset + * @param string $destformat image destination format + * @return string|false + * @author Dmitry (dio) Levashov + * @author Alexey Sukhotin + **/ + protected function imgCrop($path, $width, $height, $x, $y, $destformat = null) { + if (($s = @getimagesize($path)) == false) { + return false; + } + + $result = false; + + switch ($this->imgLib) { + case 'imagick': + + try { + $img = new imagick($path); + } catch (Exception $e) { + + return false; + } + + $img->cropImage($width, $height, $x, $y); + + $result = $img->writeImage($path); + + return $result ? $path : false; + + break; + + case 'gd': + if ($s['mime'] == 'image/jpeg') { + $img = imagecreatefromjpeg($path); + } elseif ($s['mime'] == 'image/png') { + $img = imagecreatefrompng($path); + } elseif ($s['mime'] == 'image/gif') { + $img = imagecreatefromgif($path); + } elseif ($s['mime'] == 'image/xbm') { + $img = imagecreatefromxbm($path); + } + + if ($img && false != ($tmp = imagecreatetruecolor($width, $height))) { + + if (!imagecopy($tmp, $img, 0, 0, $x, $y, $width, $height)) { + return false; + } + + if ($destformat == 'jpg' || ($destformat == null && $s['mime'] == 'image/jpeg')) { + $result = imagejpeg($tmp, $path, 100); + } else if ($destformat == 'gif' || ($destformat == null && $s['mime'] == 'image/gif')) { + $result = imagegif($tmp, $path, 7); + } else { + $result = imagepng($tmp, $path, 7); + } + + imagedestroy($img); + imagedestroy($tmp); + + return $result ? $path : false; + + } + break; + } + + return false; + } + + /** + * Put image to square + * + * @param string $path image file + * @param int $width square width + * @param int $height square height + * @param int $align reserved + * @param int $valign reserved + * @param string $bgcolor square background color in #rrggbb format + * @param string $destformat image destination format + * @return string|false + * @author Dmitry (dio) Levashov + * @author Alexey Sukhotin + **/ + protected function imgSquareFit($path, $width, $height, $align = 'center', $valign = 'middle', $bgcolor = '#0000ff', $destformat = null) { + if (($s = @getimagesize($path)) == false) { + return false; + } + + $result = false; + + /* Coordinates for image over square aligning */ + $y = ceil(abs($height - $s[1]) / 2); + $x = ceil(abs($width - $s[0]) / 2); + + switch ($this->imgLib) { + case 'imagick': + try { + $img = new imagick($path); + } catch (Exception $e) { + return false; + } + + $img1 = new Imagick(); + $img1->newImage($width, $height, new ImagickPixel($bgcolor)); + $img1->setImageColorspace($img->getImageColorspace()); + $img1->setImageFormat($destformat != null ? $destformat : $img->getFormat()); + $img1->compositeImage( $img, imagick::COMPOSITE_OVER, $x, $y ); + $result = $img1->writeImage($path); + return $result ? $path : false; + + break; + + case 'gd': + if ($s['mime'] == 'image/jpeg') { + $img = imagecreatefromjpeg($path); + } elseif ($s['mime'] == 'image/png') { + $img = imagecreatefrompng($path); + } elseif ($s['mime'] == 'image/gif') { + $img = imagecreatefromgif($path); + } elseif ($s['mime'] == 'image/xbm') { + $img = imagecreatefromxbm($path); + } + + if ($img && false != ($tmp = imagecreatetruecolor($width, $height))) { + + if ($bgcolor == 'transparent') { + list($r, $g, $b) = array(0, 0, 255); + } else { + list($r, $g, $b) = sscanf($bgcolor, "#%02x%02x%02x"); + } + + $bgcolor1 = imagecolorallocate($tmp, $r, $g, $b); + + if ($bgcolor == 'transparent') { + $bgcolor1 = imagecolortransparent($tmp, $bgcolor1); + } + + imagefill($tmp, 0, 0, $bgcolor1); + + if (!imagecopy($tmp, $img, $x, $y, 0, 0, $s[0], $s[1])) { + return false; + } + + if ($destformat == 'jpg' || ($destformat == null && $s['mime'] == 'image/jpeg')) { + $result = imagejpeg($tmp, $path, 100); + } else if ($destformat == 'gif' || ($destformat == null && $s['mime'] == 'image/gif')) { + $result = imagegif($tmp, $path, 7); + } else { + $result = imagepng($tmp, $path, 7); + } + + imagedestroy($img); + imagedestroy($tmp); + + return $result ? $path : false; + } + break; + } + + return false; + } + + /** + * Rotate image + * + * @param string $path image file + * @param int $degree rotete degrees + * @param string $bgcolor square background color in #rrggbb format + * @param string $destformat image destination format + * @return string|false + * @author nao-pon + * @author Troex Nevelin + **/ + protected function imgRotate($path, $degree, $bgcolor = '#ffffff', $destformat = null) { + if (($s = @getimagesize($path)) == false) { + return false; + } + + $result = false; + + switch ($this->imgLib) { + case 'imagick': + try { + $img = new imagick($path); + } catch (Exception $e) { + return false; + } + + $img->rotateImage(new ImagickPixel($bgcolor), $degree); + $result = $img->writeImage($path); + return $result ? $path : false; + + break; + + case 'gd': + if ($s['mime'] == 'image/jpeg') { + $img = imagecreatefromjpeg($path); + } elseif ($s['mime'] == 'image/png') { + $img = imagecreatefrompng($path); + } elseif ($s['mime'] == 'image/gif') { + $img = imagecreatefromgif($path); + } elseif ($s['mime'] == 'image/xbm') { + $img = imagecreatefromxbm($path); + } + + $degree = 360 - $degree; + list($r, $g, $b) = sscanf($bgcolor, "#%02x%02x%02x"); + $bgcolor = imagecolorallocate($img, $r, $g, $b); + $tmp = imageRotate($img, $degree, (int)$bgcolor); + + if ($destformat == 'jpg' || ($destformat == null && $s['mime'] == 'image/jpeg')) { + $result = imagejpeg($tmp, $path, 100); + } else if ($destformat == 'gif' || ($destformat == null && $s['mime'] == 'image/gif')) { + $result = imagegif($tmp, $path, 7); + } else { + $result = imagepng($tmp, $path, 7); + } + + imageDestroy($img); + imageDestroy($tmp); + + return $result ? $path : false; + + break; + } + + return false; + } + + /** + * Execute shell command + * + * @param string $command command line + * @param array $output stdout strings + * @param array $return_var process exit code + * @param array $error_output stderr strings + * @return int exit code + * @author Alexey Sukhotin + **/ + protected function procExec($command , array &$output = null, &$return_var = -1, array &$error_output = null) { + + $descriptorspec = array( + 0 => array("pipe", "r"), // stdin + 1 => array("pipe", "w"), // stdout + 2 => array("pipe", "w") // stderr + ); + + $process = proc_open($command, $descriptorspec, $pipes, null, null); + + if (is_resource($process)) { + + fclose($pipes[0]); + + $tmpout = ''; + $tmperr = ''; + + $output = stream_get_contents($pipes[1]); + $error_output = stream_get_contents($pipes[2]); + + fclose($pipes[1]); + fclose($pipes[2]); + $return_var = proc_close($process); + + + } + + return $return_var; + + } + + /** + * Remove thumbnail + * + * @param string $path file path + * @return void + * @author Dmitry (dio) Levashov + **/ + protected function rmTmb($tmb) { + $tmb = $this->tmbPath.DIRECTORY_SEPARATOR.$tmb; + file_exists($tmb) && @unlink($tmb); + clearstatcache(); + } + + /*********************** misc *************************/ + + /** + * Return smart formatted date + * + * @param int $ts file timestamp + * @return string + * @author Dmitry (dio) Levashov + **/ + protected function formatDate($ts) { + if ($ts > $this->today) { + return 'Today '.date($this->options['timeFormat'], $ts); + } + + if ($ts > $this->yesterday) { + return 'Yesterday '.date($this->options['timeFormat'], $ts); + } + + return date($this->options['dateFormat'], $ts); + } + + /** + * Find position of first occurrence of string in a string with multibyte support + * + * @param string $haystack The string being checked. + * @param string $needle The string to find in haystack. + * @param int $offset The search offset. If it is not specified, 0 is used. + * @return int|bool + * @author Alexey Sukhotin + **/ + protected function stripos($haystack , $needle , $offset = 0) { + if (function_exists('mb_stripos')) { + return mb_stripos($haystack , $needle , $offset); + } else if (function_exists('mb_strtolower') && function_exists('mb_strpos')) { + return mb_strpos(mb_strtolower($haystack), mb_strtolower($needle), $offset); + } + return stripos($haystack , $needle , $offset); + } + + /**==================================* abstract methods *====================================**/ + + /*********************** paths/urls *************************/ + + /** + * Return parent directory path + * + * @param string $path file path + * @return string + * @author Dmitry (dio) Levashov + **/ + abstract protected function _dirname($path); + + /** + * Return file name + * + * @param string $path file path + * @return string + * @author Dmitry (dio) Levashov + **/ + abstract protected function _basename($path); + + /** + * Join dir name and file name and return full path. + * Some drivers (db) use int as path - so we give to concat path to driver itself + * + * @param string $dir dir path + * @param string $name file name + * @return string + * @author Dmitry (dio) Levashov + **/ + abstract protected function _joinPath($dir, $name); + + /** + * Return normalized path + * + * @param string $path file path + * @return string + * @author Dmitry (dio) Levashov + **/ + abstract protected function _normpath($path); + + /** + * Return file path related to root dir + * + * @param string $path file path + * @return string + * @author Dmitry (dio) Levashov + **/ + abstract protected function _relpath($path); + + /** + * Convert path related to root dir into real path + * + * @param string $path rel file path + * @return string + * @author Dmitry (dio) Levashov + **/ + abstract protected function _abspath($path); + + /** + * Return fake path started from root dir. + * Required to show path on client side. + * + * @param string $path file path + * @return string + * @author Dmitry (dio) Levashov + **/ + abstract protected function _path($path); + + /** + * Return true if $path is children of $parent + * + * @param string $path path to check + * @param string $parent parent path + * @return bool + * @author Dmitry (dio) Levashov + **/ + abstract protected function _inpath($path, $parent); + + /** + * Return stat for given path. + * Stat contains following fields: + * - (int) size file size in b. required + * - (int) ts file modification time in unix time. required + * - (string) mime mimetype. required for folders, others - optionally + * - (bool) read read permissions. required + * - (bool) write write permissions. required + * - (bool) locked is object locked. optionally + * - (bool) hidden is object hidden. optionally + * - (string) alias for symlinks - link target path relative to root path. optionally + * - (string) target for symlinks - link target path. optionally + * + * If file does not exists - returns empty array or false. + * + * @param string $path file path + * @return array|false + * @author Dmitry (dio) Levashov + **/ + abstract protected function _stat($path); + + + /***************** file stat ********************/ + + + /** + * Return true if path is dir and has at least one childs directory + * + * @param string $path dir path + * @return bool + * @author Dmitry (dio) Levashov + **/ + abstract protected function _subdirs($path); + + /** + * Return object width and height + * Ususaly used for images, but can be realize for video etc... + * + * @param string $path file path + * @param string $mime file mime type + * @return string + * @author Dmitry (dio) Levashov + **/ + abstract protected function _dimensions($path, $mime); + + /******************** file/dir content *********************/ + + /** + * Return files list in directory + * + * @param string $path dir path + * @return array + * @author Dmitry (dio) Levashov + **/ + abstract protected function _scandir($path); + + /** + * Open file and return file pointer + * + * @param string $path file path + * @param bool $write open file for writing + * @return resource|false + * @author Dmitry (dio) Levashov + **/ + abstract protected function _fopen($path, $mode="rb"); + + /** + * Close opened file + * + * @param resource $fp file pointer + * @param string $path file path + * @return bool + * @author Dmitry (dio) Levashov + **/ + abstract protected function _fclose($fp, $path=''); + + /******************** file/dir manipulations *************************/ + + /** + * Create dir and return created dir path or false on failed + * + * @param string $path parent dir path + * @param string $name new directory name + * @return string|bool + * @author Dmitry (dio) Levashov + **/ + abstract protected function _mkdir($path, $name); + + /** + * Create file and return it's path or false on failed + * + * @param string $path parent dir path + * @param string $name new file name + * @return string|bool + * @author Dmitry (dio) Levashov + **/ + abstract protected function _mkfile($path, $name); + + /** + * Create symlink + * + * @param string $source file to link to + * @param string $targetDir folder to create link in + * @param string $name symlink name + * @return bool + * @author Dmitry (dio) Levashov + **/ + abstract protected function _symlink($source, $targetDir, $name); + + /** + * Copy file into another file (only inside one volume) + * + * @param string $source source file path + * @param string $target target dir path + * @param string $name file name + * @return bool + * @author Dmitry (dio) Levashov + **/ + abstract protected function _copy($source, $targetDir, $name); + + /** + * Move file into another parent dir. + * Return new file path or false. + * + * @param string $source source file path + * @param string $target target dir path + * @param string $name file name + * @return string|bool + * @author Dmitry (dio) Levashov + **/ + abstract protected function _move($source, $targetDir, $name); + + /** + * Remove file + * + * @param string $path file path + * @return bool + * @author Dmitry (dio) Levashov + **/ + abstract protected function _unlink($path); + + /** + * Remove dir + * + * @param string $path dir path + * @return bool + * @author Dmitry (dio) Levashov + **/ + abstract protected function _rmdir($path); + + /** + * Create new file and write into it from file pointer. + * Return new file path or false on error. + * + * @param resource $fp file pointer + * @param string $dir target dir path + * @param string $name file name + * @return bool|string + * @author Dmitry (dio) Levashov + **/ + abstract protected function _save($fp, $dir, $name, $mime, $w, $h); + + /** + * Get file contents + * + * @param string $path file path + * @return string|false + * @author Dmitry (dio) Levashov + **/ + abstract protected function _getContents($path); + + /** + * Write a string to a file + * + * @param string $path file path + * @param string $content new file content + * @return bool + * @author Dmitry (dio) Levashov + **/ + abstract protected function _filePutContents($path, $content); + + /** + * Extract files from archive + * + * @param string $path file path + * @param array $arc archiver options + * @return bool + * @author Dmitry (dio) Levashov, + * @author Alexey Sukhotin + **/ + abstract protected function _extract($path, $arc); + + /** + * Create archive and return its path + * + * @param string $dir target dir + * @param array $files files names list + * @param string $name archive name + * @param array $arc archiver options + * @return string|bool + * @author Dmitry (dio) Levashov, + * @author Alexey Sukhotin + **/ + abstract protected function _archive($dir, $files, $name, $arc); + + /** + * Detect available archivers + * + * @return void + * @author Dmitry (dio) Levashov, + * @author Alexey Sukhotin + **/ + abstract protected function _checkArchivers(); + +} // END class diff --git a/deployed/k2/administrator/components/com_k2/lib/elfinder/elFinderVolumeLocalFileSystem.class.php b/deployed/k2/administrator/components/com_k2/lib/elfinder/elFinderVolumeLocalFileSystem.class.php new file mode 100644 index 00000000..6004218a --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/lib/elfinder/elFinderVolumeLocalFileSystem.class.php @@ -0,0 +1,845 @@ +options['alias'] = ''; // alias to replace root dir name + $this->options['dirMode'] = 0755; // new dirs mode + $this->options['fileMode'] = 0644; // new files mode + $this->options['quarantine'] = '.quarantine'; // quarantine folder name - required to check archive (must be hidden) + $this->options['maxArcFilesSize'] = 0; // max allowed archive files size (0 - no limit) + } + + /*********************************************************************/ + /* INIT AND CONFIGURE */ + /*********************************************************************/ + + /** + * Configure after successfull mount. + * + * @return void + * @author Dmitry (dio) Levashov + **/ + protected function configure() { + $this->aroot = realpath($this->root); + $root = $this->stat($this->root); + + if ($this->options['quarantine']) { + $this->attributes[] = array( + 'pattern' => '~^'.preg_quote(DIRECTORY_SEPARATOR.$this->options['quarantine']).'$~', + 'read' => false, + 'write' => false, + 'locked' => true, + 'hidden' => true + ); + } + + // chek thumbnails path + if ($this->options['tmbPath']) { + $this->options['tmbPath'] = strpos($this->options['tmbPath'], DIRECTORY_SEPARATOR) === false + // tmb path set as dirname under root dir + ? $this->root.DIRECTORY_SEPARATOR.$this->options['tmbPath'] + // tmb path as full path + : $this->_normpath($this->options['tmbPath']); + } + + parent::configure(); + + // if no thumbnails url - try detect it + if ($root['read'] && !$this->tmbURL && $this->URL) { + if (strpos($this->tmbPath, $this->root) === 0) { + $this->tmbURL = $this->URL.str_replace(DIRECTORY_SEPARATOR, '/', substr($this->tmbPath, strlen($this->root)+1)); + if (preg_match("|[^/?&=]$|", $this->tmbURL)) { + $this->tmbURL .= '/'; + } + } + } + + // check quarantine dir + if (!empty($this->options['quarantine'])) { + $this->quarantine = $this->root.DIRECTORY_SEPARATOR.$this->options['quarantine']; + if ((!is_dir($this->quarantine) && !$this->_mkdir($this->root, $this->options['quarantine'])) || !is_writable($this->quarantine)) { + $this->archivers['extract'] = array(); + $this->disabled[] = 'extract'; + } + } else { + $this->archivers['extract'] = array(); + $this->disabled[] = 'extract'; + } + + } + + /*********************************************************************/ + /* FS API */ + /*********************************************************************/ + + /*********************** paths/urls *************************/ + + /** + * Return parent directory path + * + * @param string $path file path + * @return string + * @author Dmitry (dio) Levashov + **/ + protected function _dirname($path) { + return dirname($path); + } + + /** + * Return file name + * + * @param string $path file path + * @return string + * @author Dmitry (dio) Levashov + **/ + protected function _basename($path) { + return basename($path); + } + + /** + * Join dir name and file name and retur full path + * + * @param string $dir + * @param string $name + * @return string + * @author Dmitry (dio) Levashov + **/ + protected function _joinPath($dir, $name) { + return $dir.DIRECTORY_SEPARATOR.$name; + } + + /** + * Return normalized path, this works the same as os.path.normpath() in Python + * + * @param string $path path + * @return string + * @author Troex Nevelin + **/ + protected function _normpath($path) { + if (empty($path)) { + return '.'; + } + + if (strpos($path, '/') === 0) { + $initial_slashes = true; + } else { + $initial_slashes = false; + } + + if (($initial_slashes) + && (strpos($path, '//') === 0) + && (strpos($path, '///') === false)) { + $initial_slashes = 2; + } + + $initial_slashes = (int) $initial_slashes; + + $comps = explode('/', $path); + $new_comps = array(); + foreach ($comps as $comp) { + if (in_array($comp, array('', '.'))) { + continue; + } + + if (($comp != '..') + || (!$initial_slashes && !$new_comps) + || ($new_comps && (end($new_comps) == '..'))) { + array_push($new_comps, $comp); + } elseif ($new_comps) { + array_pop($new_comps); + } + } + $comps = $new_comps; + $path = implode('/', $comps); + if ($initial_slashes) { + $path = str_repeat('/', $initial_slashes) . $path; + } + + return $path ? $path : '.'; + } + + /** + * Return file path related to root dir + * + * @param string $path file path + * @return string + * @author Dmitry (dio) Levashov + **/ + protected function _relpath($path) { + return $path == $this->root ? '' : substr($path, strlen($this->root)+1); + } + + /** + * Convert path related to root dir into real path + * + * @param string $path file path + * @return string + * @author Dmitry (dio) Levashov + **/ + protected function _abspath($path) { + return $path == DIRECTORY_SEPARATOR ? $this->root : $this->root.DIRECTORY_SEPARATOR.$path; + } + + /** + * Return fake path started from root dir + * + * @param string $path file path + * @return string + * @author Dmitry (dio) Levashov + **/ + protected function _path($path) { + return $this->rootName.($path == $this->root ? '' : $this->separator.$this->_relpath($path)); + } + + /** + * Return true if $path is children of $parent + * + * @param string $path path to check + * @param string $parent parent path + * @return bool + * @author Dmitry (dio) Levashov + **/ + protected function _inpath($path, $parent) { + return $path == $parent || strpos($path, $parent.DIRECTORY_SEPARATOR) === 0; + } + + + + /***************** file stat ********************/ + + /** + * Return stat for given path. + * Stat contains following fields: + * - (int) size file size in b. required + * - (int) ts file modification time in unix time. required + * - (string) mime mimetype. required for folders, others - optionally + * - (bool) read read permissions. required + * - (bool) write write permissions. required + * - (bool) locked is object locked. optionally + * - (bool) hidden is object hidden. optionally + * - (string) alias for symlinks - link target path relative to root path. optionally + * - (string) target for symlinks - link target path. optionally + * + * If file does not exists - returns empty array or false. + * + * @param string $path file path + * @return array|false + * @author Dmitry (dio) Levashov + **/ + protected function _stat($path) { + $stat = array(); + + if (!file_exists($path)) { + return $stat; + } + + if ($path != $this->root && is_link($path)) { + if (($target = $this->readlink($path)) == false + || $target == $path) { + $stat['mime'] = 'symlink-broken'; + $stat['read'] = false; + $stat['write'] = false; + $stat['size'] = 0; + return $stat; + } + $stat['alias'] = $this->_path($target); + $stat['target'] = $target; + $path = $target; + $lstat = lstat($path); + $size = $lstat['size']; + } else { + $size = @filesize($path); + } + + $dir = is_dir($path); + + $stat['mime'] = $dir ? 'directory' : $this->mimetype($path); + $stat['ts'] = filemtime($path); + $stat['read'] = is_readable($path); + $stat['write'] = is_writable($path); + if ($stat['read']) { + $stat['size'] = $dir ? 0 : $size; + } + + return $stat; + } + + + /** + * Return true if path is dir and has at least one childs directory + * + * @param string $path dir path + * @return bool + * @author Dmitry (dio) Levashov + **/ + protected function _subdirs($path) { + + if (($dir = dir($path))) { + $dir = dir($path); + while (($entry = $dir->read()) !== false) { + $p = $dir->path.DIRECTORY_SEPARATOR.$entry; + if ($entry != '.' && $entry != '..' && is_dir($p) && !$this->attr($p, 'hidden')) { + $dir->close(); + return true; + } + } + $dir->close(); + } + return false; + } + + /** + * Return object width and height + * Ususaly used for images, but can be realize for video etc... + * + * @param string $path file path + * @param string $mime file mime type + * @return string + * @author Dmitry (dio) Levashov + **/ + protected function _dimensions($path, $mime) { + clearstatcache(); + return strpos($mime, 'image') === 0 && ($s = @getimagesize($path)) !== false + ? $s[0].'x'.$s[1] + : false; + } + /******************** file/dir content *********************/ + + /** + * Return symlink target file + * + * @param string $path link path + * @return string + * @author Dmitry (dio) Levashov + **/ + protected function readlink($path) { + if (!($target = @readlink($path))) { + return false; + } + + if (substr($target, 0, 1) != DIRECTORY_SEPARATOR) { + $target = dirname($path).DIRECTORY_SEPARATOR.$target; + } + + $atarget = realpath($target); + + if (!$atarget) { + return false; + } + + $root = $this->root; + $aroot = $this->aroot; + + if ($this->_inpath($atarget, $this->aroot)) { + return $this->_normpath($this->root.DIRECTORY_SEPARATOR.substr($atarget, strlen($this->aroot)+1)); + } + + return false; + } + + /** + * Return files list in directory. + * + * @param string $path dir path + * @return array + * @author Dmitry (dio) Levashov + **/ + protected function _scandir($path) { + $files = array(); + + foreach (scandir($path) as $name) { + if ($name != '.' && $name != '..') { + $files[] = $path.DIRECTORY_SEPARATOR.$name; + } + } + return $files; + } + + /** + * Open file and return file pointer + * + * @param string $path file path + * @param bool $write open file for writing + * @return resource|false + * @author Dmitry (dio) Levashov + **/ + protected function _fopen($path, $mode='rb') { + return @fopen($path, 'r'); + } + + /** + * Close opened file + * + * @param resource $fp file pointer + * @return bool + * @author Dmitry (dio) Levashov + **/ + protected function _fclose($fp, $path='') { + return @fclose($fp); + } + + /******************** file/dir manipulations *************************/ + + /** + * Create dir and return created dir path or false on failed + * + * @param string $path parent dir path + * @param string $name new directory name + * @return string|bool + * @author Dmitry (dio) Levashov + **/ + protected function _mkdir($path, $name) { + $path = $path.DIRECTORY_SEPARATOR.$name; + + if (@mkdir($path)) { + @chmod($path, $this->options['dirMode']); + return $path; + } + + return false; + } + + /** + * Create file and return it's path or false on failed + * + * @param string $path parent dir path + * @param string $name new file name + * @return string|bool + * @author Dmitry (dio) Levashov + **/ + protected function _mkfile($path, $name) { + $path = $path.DIRECTORY_SEPARATOR.$name; + + if (($fp = @fopen($path, 'w'))) { + @fclose($fp); + @chmod($path, $this->options['fileMode']); + return $path; + } + return false; + } + + /** + * Create symlink + * + * @param string $source file to link to + * @param string $targetDir folder to create link in + * @param string $name symlink name + * @return bool + * @author Dmitry (dio) Levashov + **/ + protected function _symlink($source, $targetDir, $name) { + return @symlink($source, $targetDir.DIRECTORY_SEPARATOR.$name); + } + + /** + * Copy file into another file + * + * @param string $source source file path + * @param string $targetDir target directory path + * @param string $name new file name + * @return bool + * @author Dmitry (dio) Levashov + **/ + protected function _copy($source, $targetDir, $name) { + return copy($source, $targetDir.DIRECTORY_SEPARATOR.$name); + } + + /** + * Move file into another parent dir. + * Return new file path or false. + * + * @param string $source source file path + * @param string $target target dir path + * @param string $name file name + * @return string|bool + * @author Dmitry (dio) Levashov + **/ + protected function _move($source, $targetDir, $name) { + $target = $targetDir.DIRECTORY_SEPARATOR.$name; + return @rename($source, $target) ? $target : false; + } + + /** + * Remove file + * + * @param string $path file path + * @return bool + * @author Dmitry (dio) Levashov + **/ + protected function _unlink($path) { + return @unlink($path); + } + + /** + * Remove dir + * + * @param string $path dir path + * @return bool + * @author Dmitry (dio) Levashov + **/ + protected function _rmdir($path) { + return @rmdir($path); + } + + /** + * Create new file and write into it from file pointer. + * Return new file path or false on error. + * + * @param resource $fp file pointer + * @param string $dir target dir path + * @param string $name file name + * @return bool|string + * @author Dmitry (dio) Levashov + **/ + protected function _save($fp, $dir, $name, $mime, $w, $h) { + $path = $dir.DIRECTORY_SEPARATOR.$name; + + if (!($target = @fopen($path, 'wb'))) { + return false; + } + + while (!feof($fp)) { + fwrite($target, fread($fp, 8192)); + } + fclose($target); + @chmod($path, $this->options['fileMode']); + clearstatcache(); + return $path; + } + + /** + * Get file contents + * + * @param string $path file path + * @return string|false + * @author Dmitry (dio) Levashov + **/ + protected function _getContents($path) { + return file_get_contents($path); + } + + /** + * Write a string to a file + * + * @param string $path file path + * @param string $content new file content + * @return bool + * @author Dmitry (dio) Levashov + **/ + protected function _filePutContents($path, $content) { + if (@file_put_contents($path, $content, LOCK_EX) !== false) { + clearstatcache(); + return true; + } + return false; + } + + /** + * Detect available archivers + * + * @return void + **/ + protected function _checkArchivers() { + if (!function_exists('exec')) { + $this->options['archivers'] = $this->options['archive'] = array(); + return; + } + $arcs = array( + 'create' => array(), + 'extract' => array() + ); + + //exec('tar --version', $o, $ctar); + $this->procExec('tar --version', $o, $ctar); + + if ($ctar == 0) { + $arcs['create']['application/x-tar'] = array('cmd' => 'tar', 'argc' => '-cf', 'ext' => 'tar'); + $arcs['extract']['application/x-tar'] = array('cmd' => 'tar', 'argc' => '-xf', 'ext' => 'tar'); + //$test = exec('gzip --version', $o, $c); + unset($o); + $test = $this->procExec('gzip --version', $o, $c); + + if ($c == 0) { + $arcs['create']['application/x-gzip'] = array('cmd' => 'tar', 'argc' => '-czf', 'ext' => 'tgz'); + $arcs['extract']['application/x-gzip'] = array('cmd' => 'tar', 'argc' => '-xzf', 'ext' => 'tgz'); + } + unset($o); + //$test = exec('bzip2 --version', $o, $c); + $test = $this->procExec('bzip2 --version', $o, $c); + if ($c == 0) { + $arcs['create']['application/x-bzip2'] = array('cmd' => 'tar', 'argc' => '-cjf', 'ext' => 'tbz'); + $arcs['extract']['application/x-bzip2'] = array('cmd' => 'tar', 'argc' => '-xjf', 'ext' => 'tbz'); + } + } + unset($o); + //exec('zip --version', $o, $c); + $this->procExec('zip -v', $o, $c); + if ($c == 0) { + $arcs['create']['application/zip'] = array('cmd' => 'zip', 'argc' => '-r9', 'ext' => 'zip'); + } + unset($o); + $this->procExec('unzip --help', $o, $c); + if ($c == 0) { + $arcs['extract']['application/zip'] = array('cmd' => 'unzip', 'argc' => '', 'ext' => 'zip'); + } + unset($o); + //exec('rar --version', $o, $c); + $this->procExec('rar --version', $o, $c); + if ($c == 0 || $c == 7) { + $arcs['create']['application/x-rar'] = array('cmd' => 'rar', 'argc' => 'a -inul', 'ext' => 'rar'); + $arcs['extract']['application/x-rar'] = array('cmd' => 'rar', 'argc' => 'x -y', 'ext' => 'rar'); + } else { + unset($o); + //$test = exec('unrar', $o, $c); + $test = $this->procExec('unrar', $o, $c); + if ($c==0 || $c == 7) { + $arcs['extract']['application/x-rar'] = array('cmd' => 'unrar', 'argc' => 'x -y', 'ext' => 'rar'); + } + } + unset($o); + //exec('7za --help', $o, $c); + $this->procExec('7za --help', $o, $c); + if ($c == 0) { + $arcs['create']['application/x-7z-compressed'] = array('cmd' => '7za', 'argc' => 'a', 'ext' => '7z'); + $arcs['extract']['application/x-7z-compressed'] = array('cmd' => '7za', 'argc' => 'e -y', 'ext' => '7z'); + + if (empty($arcs['create']['application/x-gzip'])) { + $arcs['create']['application/x-gzip'] = array('cmd' => '7za', 'argc' => 'a -tgzip', 'ext' => 'tar.gz'); + } + if (empty($arcs['extract']['application/x-gzip'])) { + $arcs['extract']['application/x-gzip'] = array('cmd' => '7za', 'argc' => 'e -tgzip -y', 'ext' => 'tar.gz'); + } + if (empty($arcs['create']['application/x-bzip2'])) { + $arcs['create']['application/x-bzip2'] = array('cmd' => '7za', 'argc' => 'a -tbzip2', 'ext' => 'tar.bz'); + } + if (empty($arcs['extract']['application/x-bzip2'])) { + $arcs['extract']['application/x-bzip2'] = array('cmd' => '7za', 'argc' => 'a -tbzip2 -y', 'ext' => 'tar.bz'); + } + if (empty($arcs['create']['application/zip'])) { + $arcs['create']['application/zip'] = array('cmd' => '7za', 'argc' => 'a -tzip -l', 'ext' => 'zip'); + } + if (empty($arcs['extract']['application/zip'])) { + $arcs['extract']['application/zip'] = array('cmd' => '7za', 'argc' => 'e -tzip -y', 'ext' => 'zip'); + } + if (empty($arcs['create']['application/x-tar'])) { + $arcs['create']['application/x-tar'] = array('cmd' => '7za', 'argc' => 'a -ttar -l', 'ext' => 'tar'); + } + if (empty($arcs['extract']['application/x-tar'])) { + $arcs['extract']['application/x-tar'] = array('cmd' => '7za', 'argc' => 'e -ttar -y', 'ext' => 'tar'); + } + } + + $this->archivers = $arcs; + } + + /** + * Unpack archive + * + * @param string $path archive path + * @param array $arc archiver command and arguments (same as in $this->archivers) + * @return void + * @author Dmitry (dio) Levashov + * @author Alexey Sukhotin + **/ + protected function _unpack($path, $arc) { + $cwd = getcwd(); + $dir = $this->_dirname($path); + chdir($dir); + $cmd = $arc['cmd'].' '.$arc['argc'].' '.escapeshellarg($this->_basename($path)); + $this->procExec($cmd, $o, $c); + chdir($cwd); + } + + /** + * Recursive symlinks search + * + * @param string $path file/dir path + * @return bool + * @author Dmitry (dio) Levashov + **/ + protected function _findSymlinks($path) { + if (is_link($path)) { + return true; + } + + if (is_dir($path)) { + foreach (scandir($path) as $name) { + if ($name != '.' && $name != '..') { + $p = $path.DIRECTORY_SEPARATOR.$name; + if (is_link($p)) { + return true; + } + if (is_dir($p) && $this->_findSymlinks($p)) { + return true; + } elseif (is_file($p)) { + $this->archiveSize += filesize($p); + } + } + } + } else { + $this->archiveSize += filesize($path); + } + + return false; + } + + /** + * Extract files from archive + * + * @param string $path archive path + * @param array $arc archiver command and arguments (same as in $this->archivers) + * @return true + * @author Dmitry (dio) Levashov, + * @author Alexey Sukhotin + **/ + protected function _extract($path, $arc) { + + if ($this->quarantine) { + $dir = $this->quarantine.DIRECTORY_SEPARATOR.str_replace(' ', '_', microtime()).basename($path); + $archive = $dir.DIRECTORY_SEPARATOR.basename($path); + + if (!@mkdir($dir)) { + return false; + } + + chmod($dir, 0755); + + // copy in quarantine + if (!copy($path, $archive)) { + return false; + } + + // extract in quarantine + $this->_unpack($archive, $arc); + @unlink($archive); + + // get files list + $ls = array(); + foreach (scandir($dir) as $i => $name) { + if ($name != '.' && $name != '..') { + $ls[] = $name; + } + } + + // no files - extract error ? + if (empty($ls)) { + return false; + } + + $this->archiveSize = 0; + + // find symlinks + $symlinks = $this->_findSymlinks($dir); + // remove arc copy + $this->remove($dir); + + if ($symlinks) { + return $this->setError(elFinder::ERROR_ARC_SYMLINKS); + } + + // check max files size + if ($this->options['maxArcFilesSize'] > 0 && $this->options['maxArcFilesSize'] < $this->archiveSize) { + return $this->setError(elFinder::ERROR_ARC_MAXSIZE); + } + + + + // archive contains one item - extract in archive dir + if (count($ls) == 1) { + $this->_unpack($path, $arc); + $result = dirname($path).DIRECTORY_SEPARATOR.$ls[0]; + + + } else { + // for several files - create new directory + // create unique name for directory + $name = basename($path); + if (preg_match('/\.((tar\.(gz|bz|bz2|z|lzo))|cpio\.gz|ps\.gz|xcf\.(gz|bz2)|[a-z0-9]{1,4})$/i', $name, $m)) { + $name = substr($name, 0, strlen($name)-strlen($m[0])); + } + $test = dirname($path).DIRECTORY_SEPARATOR.$name; + if (file_exists($test) || is_link($test)) { + $name = $this->uniqueName(dirname($path), $name, '-', false); + } + + $result = dirname($path).DIRECTORY_SEPARATOR.$name; + $archive = $result.DIRECTORY_SEPARATOR.basename($path); + + if (!$this->_mkdir(dirname($path), $name) || !copy($path, $archive)) { + return false; + } + + $this->_unpack($archive, $arc); + @unlink($archive); + } + + return file_exists($result) ? $result : false; + } + } + + /** + * Create archive and return its path + * + * @param string $dir target dir + * @param array $files files names list + * @param string $name archive name + * @param array $arc archiver options + * @return string|bool + * @author Dmitry (dio) Levashov, + * @author Alexey Sukhotin + **/ + protected function _archive($dir, $files, $name, $arc) { + $cwd = getcwd(); + chdir($dir); + + $files = array_map('escapeshellarg', $files); + + $cmd = $arc['cmd'].' '.$arc['argc'].' '.escapeshellarg($name).' '.implode(' ', $files); + $this->procExec($cmd, $o, $c); + chdir($cwd); + + $path = $dir.DIRECTORY_SEPARATOR.$name; + return file_exists($path) ? $path : false; + } + +} // END class diff --git a/deployed/k2/administrator/components/com_k2/lib/elfinder/mime.types b/deployed/k2/administrator/components/com_k2/lib/elfinder/mime.types new file mode 100644 index 00000000..94b99b77 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/lib/elfinder/mime.types @@ -0,0 +1,512 @@ +# This file controls what Internet media types are sent to the client for +# given file extension(s). Sending the correct media type to the client +# is important so they know how to handle the content of the file. +# For more information about Internet media types, please read +# RFC 2045, 2046, 2047, 2048, and 2077. The Internet media type +# registry is at . + +# MIME type Extension +application/andrew-inset ez +application/chemtool cht +application/dicom dcm +application/docbook+xml docbook +application/ecmascript ecma +application/flash-video flv +application/illustrator ai +application/javascript js +application/mac-binhex40 +application/mathematica nb +application/msword doc +application/octet-stream bin +application/oda oda +application/ogg ogg +application/pdf pdf +application/pgp pgp +application/pgp-encrypted +application/pgp-encrypted pgp gpg +application/pgp-keys +application/pgp-keys skr pkr +application/pgp-signature +application/pgp-signature sig +application/pkcs7-mime +application/pkcs7-signature p7s +application/postscript ps +application/rtf rtf +application/sdp sdp +application/smil smil smi sml +application/stuffit sit +application/vnd.corel-draw cdr +application/vnd.hp-hpgl hpgl +application/vnd.hp-pcl pcl +application/vnd.lotus-1-2-3 123 wk1 wk3 wk4 wks +application/vnd.mozilla.xul+xml xul +application/vnd.ms-excel xls xlc xll xlm xlw xla xlt xld +application/vnd.ms-powerpoint ppz ppt pps pot +application/vnd.oasis.opendocument.chart odc +application/vnd.oasis.opendocument.database odb +application/vnd.oasis.opendocument.formula odf +application/vnd.oasis.opendocument.graphics odg +application/vnd.oasis.opendocument.graphics-template otg +application/vnd.oasis.opendocument.image odi +application/vnd.oasis.opendocument.presentation odp +application/vnd.oasis.opendocument.presentation-template otp +application/vnd.oasis.opendocument.spreadsheet ods +application/vnd.oasis.opendocument.spreadsheet-template ots +application/vnd.oasis.opendocument.text odt +application/vnd.oasis.opendocument.text-master odm +application/vnd.oasis.opendocument.text-template ott +application/vnd.oasis.opendocument.text-web oth +application/vnd.palm pdb +application/vnd.rn-realmedia +application/vnd.rn-realmedia rm +application/vnd.rn-realmedia-secure rms +application/vnd.rn-realmedia-vbr rmvb +application/vnd.stardivision.calc sdc +application/vnd.stardivision.chart sds +application/vnd.stardivision.draw sda +application/vnd.stardivision.impress sdd sdp +application/vnd.stardivision.mail smd +application/vnd.stardivision.math smf +application/vnd.stardivision.writer sdw vor sgl +application/vnd.sun.xml.calc sxc +application/vnd.sun.xml.calc.template stc +application/vnd.sun.xml.draw sxd +application/vnd.sun.xml.draw.template std +application/vnd.sun.xml.impress sxi +application/vnd.sun.xml.impress.template sti +application/vnd.sun.xml.math sxm +application/vnd.sun.xml.writer sxw +application/vnd.sun.xml.writer.global sxg +application/vnd.sun.xml.writer.template stw +application/vnd.wordperfect wpd +application/x-abiword abw abw.CRASHED abw.gz zabw +application/x-amipro sam +application/x-anjuta-project prj +application/x-applix-spreadsheet as +application/x-applix-word aw +application/x-arc +application/x-archive a +application/x-arj arj +application/x-asax asax +application/x-ascx ascx +application/x-ashx ashx +application/x-asix asix +application/x-asmx asmx +application/x-asp asp +application/x-awk +application/x-axd axd +application/x-bcpio bcpio +application/x-bittorrent torrent +application/x-blender blender blend BLEND +application/x-bzip bz bz2 +application/x-bzip bz2 bz +application/x-bzip-compressed-tar tar.bz tar.bz2 +application/x-bzip-compressed-tar tar.bz tar.bz2 tbz tbz2 +application/x-cd-image iso +application/x-cgi cgi +application/x-chess-pgn pgn +application/x-chm chm +application/x-class-file +application/x-cmbx cmbx +application/x-compress Z +application/x-compressed-tar tar.gz tar.Z tgz taz +application/x-compressed-tar tar.gz tgz +application/x-config config +application/x-core +application/x-cpio cpio +application/x-cpio-compressed cpio.gz +application/x-csh csh +application/x-cue cue +application/x-dbase dbf +application/x-dbm +application/x-dc-rom dc +application/x-deb deb +application/x-designer ui +application/x-desktop desktop kdelnk +application/x-devhelp devhelp +application/x-dia-diagram dia +application/x-disco disco +application/x-dvi dvi +application/x-e-theme etheme +application/x-egon egon +application/x-executable exe +application/x-font-afm afm +application/x-font-bdf bdf +application/x-font-dos +application/x-font-framemaker +application/x-font-libgrx +application/x-font-linux-psf psf +application/x-font-otf +application/x-font-pcf pcf +application/x-font-pcf pcf.gz +application/x-font-speedo spd +application/x-font-sunos-news +application/x-font-tex +application/x-font-tex-tfm +application/x-font-ttf ttc TTC +application/x-font-ttf ttf +application/x-font-type1 pfa pfb gsf pcf.Z +application/x-font-vfont +application/x-frame +application/x-frontline aop +application/x-gameboy-rom gb +application/x-gdbm +application/x-gdesklets-display display +application/x-genesis-rom gen md +application/x-gettext-translation gmo +application/x-glabels glabels +application/x-glade glade +application/x-gmc-link +application/x-gnome-db-connection connection +application/x-gnome-db-database database +application/x-gnome-stones caves +application/x-gnucash gnucash gnc xac +application/x-gnumeric gnumeric +application/x-graphite gra +application/x-gtar gtar +application/x-gtktalog +application/x-gzip gz +application/x-gzpostscript ps.gz +application/x-hdf hdf +application/x-ica ica +application/x-ipod-firmware +application/x-jamin jam +application/x-jar jar +application/x-java class +application/x-java-archive jar ear war + +application/x-jbuilder-project jpr jpx +application/x-karbon karbon +application/x-kchart chrt +application/x-kformula kfo +application/x-killustrator kil +application/x-kivio flw +application/x-kontour kon +application/x-kpovmodeler kpm +application/x-kpresenter kpr kpt +application/x-krita kra +application/x-kspread ksp +application/x-kspread-crypt +application/x-ksysv-package +application/x-kugar kud +application/x-kword kwd kwt +application/x-kword-crypt +application/x-lha lha lzh +application/x-lha lzh +application/x-lhz lhz +application/x-linguist ts +application/x-lyx lyx +application/x-lzop lzo +application/x-lzop-compressed-tar tar.lzo tzo +application/x-macbinary +application/x-machine-config +application/x-magicpoint mgp +application/x-master-page master +application/x-matroska mkv +application/x-mdp mdp +application/x-mds mds +application/x-mdsx mdsx +application/x-mergeant mergeant +application/x-mif mif +application/x-mozilla-bookmarks +application/x-mps mps +application/x-ms-dos-executable exe +application/x-mswinurl +application/x-mswrite wri +application/x-msx-rom msx +application/x-n64-rom n64 +application/x-nautilus-link +application/x-nes-rom nes +application/x-netcdf cdf nc +application/x-netscape-bookmarks +application/x-object o +application/x-ole-storage +application/x-oleo oleo +application/x-palm-database +application/x-palm-database pdb prc +application/x-par2 PAR2 par2 +application/x-pef-executable +application/x-perl pl pm al perl +application/x-php php php3 php4 +application/x-pkcs12 p12 pfx +application/x-planner planner mrproject +application/x-planperfect pln +application/x-prjx prjx +application/x-profile +application/x-ptoptimizer-script pto +application/x-pw pw +application/x-python-bytecode pyc pyo +application/x-quattro-pro wb1 wb2 wb3 +application/x-quattropro wb1 wb2 wb3 +application/x-qw qif +application/x-rar rar +application/x-rar-compressed rar +application/x-rdp rdp +application/x-reject rej +application/x-remoting rem +application/x-resources resources +application/x-resourcesx resx +application/x-rpm rpm +application/x-ruby +application/x-sc +application/x-sc sc +application/x-scribus sla sla.gz scd scd.gz +application/x-shar shar +application/x-shared-library-la la +application/x-sharedlib so +application/x-shellscript sh +application/x-shockwave-flash swf +application/x-siag siag +application/x-slp +application/x-smil kino +application/x-smil smi smil +application/x-sms-rom sms gg +application/x-soap-remoting soap +application/x-streamingmedia ssm +application/x-stuffit +application/x-stuffit bin sit +application/x-sv4cpio sv4cpio +application/x-sv4crc sv4crc +application/x-tar tar +application/x-tarz tar.Z +application/x-tex-gf gf +application/x-tex-pk k +application/x-tgif obj +application/x-theme theme +application/x-toc toc +application/x-toutdoux +application/x-trash bak old sik +application/x-troff tr roff t +application/x-troff-man man +application/x-troff-man-compressed +application/x-tzo tar.lzo tzo +application/x-ustar ustar +application/x-wais-source src +application/x-web-config +application/x-wpg wpg +application/x-wsdl wsdl +application/x-x509-ca-cert der cer crt cert pem +application/x-xbel xbel +application/x-zerosize +application/x-zoo zoo +application/xhtml+xml xhtml +application/zip zip +audio/ac3 ac3 +audio/basic au snd +audio/midi mid midi +audio/mpeg mp3 +audio/prs.sid sid psid +audio/vnd.rn-realaudio ra +audio/x-aac aac +audio/x-adpcm +audio/x-aifc +audio/x-aiff aif aiff +audio/x-aiff aiff aif aifc +audio/x-aiffc +audio/x-flac flac +audio/x-m4a m4a +audio/x-mod mod ult uni XM m15 mtm 669 +audio/x-mp3-playlist +audio/x-mpeg +audio/x-mpegurl m3u +audio/x-ms-asx +audio/x-pn-realaudio ra ram rm +audio/x-pn-realaudio ram rmm +audio/x-riff +audio/x-s3m s3m +audio/x-scpls pls +audio/x-scpls pls xpl +audio/x-stm stm +audio/x-voc voc +audio/x-wav wav +audio/x-xi xi +audio/x-xm xm +image/bmp bmp +image/cgm cgm +image/dpx +image/fax-g3 g3 +image/g3fax +image/gif gif +image/ief ief +image/jpeg jpeg jpg jpe +image/jpeg2000 jp2 +image/png png +image/rle rle +image/svg+xml svg +image/tiff tif tiff +image/vnd.djvu djvu djv +image/vnd.dwg dwg +image/vnd.dxf dxf +image/x-3ds 3ds +image/x-applix-graphics ag +image/x-cmu-raster ras +image/x-compressed-xcf xcf.gz xcf.bz2 +image/x-dcraw bay BAY bmq BMQ cr2 CR2 crw CRW cs1 CS1 dc2 DC2 dcr DCR fff FFF k25 K25 kdc KDC mos MOS mrw MRW nef NEF orf ORF pef PEF raf RAF rdc RDC srf SRF x3f X3F +image/x-dib +image/x-eps eps epsi epsf +image/x-fits fits +image/x-fpx +image/x-icb icb +image/x-ico ico +image/x-iff iff +image/x-ilbm ilbm +image/x-jng jng +image/x-lwo lwo lwob +image/x-lws lws +image/x-msod msod +image/x-niff +image/x-pcx +image/x-photo-cd pcd +image/x-pict pict pict1 pict2 +image/x-portable-anymap pnm +image/x-portable-bitmap pbm +image/x-portable-graymap pgm +image/x-portable-pixmap ppm +image/x-psd psd +image/x-rgb rgb +image/x-sgi sgi +image/x-sun-raster sun +image/x-tga tga +image/x-win-bitmap cur +image/x-wmf wmf +image/x-xbitmap xbm +image/x-xcf xcf +image/x-xfig fig +image/x-xpixmap xpm +image/x-xwindowdump xwd +inode/blockdevice +inode/chardevice +inode/directory +inode/fifo +inode/mount-point +inode/socket +inode/symlink +message/delivery-status +message/disposition-notification +message/external-body +message/news +message/partial +message/rfc822 +message/x-gnu-rmail +model/vrml wrl +multipart/alternative +multipart/appledouble +multipart/digest +multipart/encrypted +multipart/mixed +multipart/related +multipart/report +multipart/signed +multipart/x-mixed-replace +text/calendar vcs ics +text/css css CSSL +text/directory vcf vct gcrd +text/enriched +text/html html htm +text/htmlh +text/mathml mml +text/plain txt asc +text/rdf rdf +text/rfc822-headers +text/richtext rtx +text/rss rss +text/sgml sgml sgm +text/spreadsheet sylk slk +text/tab-separated-values tsv +text/vnd.rn-realtext rt +text/vnd.wap.wml wml +text/x-adasrc adb ads +text/x-authors +text/x-bibtex bib +text/x-boo boo +text/x-c++hdr hh +text/x-c++src cpp cxx cc C c++ +text/x-chdr h h++ hp +text/x-comma-separated-values csv +text/x-copying +text/x-credits +text/x-csrc c +text/x-dcl dcl +text/x-dsl dsl +text/x-dsrc d +text/x-dtd dtd +text/x-emacs-lisp el +text/x-fortran f +text/x-gettext-translation po +text/x-gettext-translation-template pot +text/x-gtkrc +text/x-haskell hs +text/x-idl idl +text/x-install +text/x-java java +text/x-js js +text/x-ksysv-log +text/x-literate-haskell lhs +text/x-log log +text/x-makefile +text/x-moc moc +text/x-msil il +text/x-nemerle n +text/x-objcsrc m +text/x-pascal p pas +text/x-patch diff patch +text/x-python py +text/x-readme +text/x-rng rng +text/x-scheme scm +text/x-setext etx +text/x-speech +text/x-sql sql +text/x-suse-ymp ymp +text/x-suse-ymu ymu +text/x-tcl tcl tk +text/x-tex tex ltx sty cls +text/x-texinfo texi texinfo +text/x-texmacs tm ts +text/x-troff-me me +text/x-troff-mm mm +text/x-troff-ms ms +text/x-uil uil +text/x-uri uri url +text/x-vb vb +text/x-xds xds +text/x-xmi xmi +text/x-xsl xsl +text/x-xslfo fo xslfo +text/x-xslt xslt xsl +text/xmcd +text/xml xml +video/3gpp 3gp +video/dv dv dif +video/isivideo +video/mpeg mpeg mpg mp2 mpe vob dat +video/quicktime qt mov moov qtvr +video/vivo +video/vnd.rn-realvideo rv +video/wavelet +video/x-3gpp2 3g2 +video/x-anim anim[1-9j] +video/x-avi +video/x-flic fli flc +video/x-mng mng +video/x-ms-asf asf asx +video/x-ms-wmv wmv +video/x-msvideo avi +video/x-nsv nsv NSV +video/x-real-video +video/x-sgi-movie movie +application/x-java-jnlp-file jnlp +application/vnd.openxmlformats-officedocument.wordprocessingml.document docx +application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx +application/vnd.ms-word.document.macroEnabled.12 docm +application/vnd.ms-word.template.macroEnabled.12 dotm +application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx +application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx +application/vnd.ms-excel.sheet.macroEnabled.12 xlsm +application/vnd.ms-excel.template.macroEnabled.12 xltm +application/vnd.ms-excel.addin.macroEnabled.12 xlam +application/vnd.ms-excel.sheet.binary.macroEnabled.12 xlsb +application/vnd.openxmlformats-officedocument.presentationml.presentation pptx +application/vnd.openxmlformats-officedocument.presentationml.template potx +application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx +application/vnd.ms-powerpoint.addin.macroEnabled.12 ppam diff --git a/deployed/k2/administrator/components/com_k2/lib/k2parameter.php b/deployed/k2/administrator/components/com_k2/lib/k2parameter.php new file mode 100644 index 00000000..a20ece26 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/lib/k2parameter.php @@ -0,0 +1,257 @@ +namespace = $namespace; + $this->values = new JRegistry($data); + } + + function get($path, $default = null) + { + return $this->values->get($this->namespace.$path, $default); + } + + } + +} +else +{ + + jimport('joomla.html.parameter'); + + /** + * Parameter handler + * + * @package Joomla.Framework + * @subpackage Parameter + * @since 1.5 + */ + class K2Parameter extends JParameter + { + + /** + * optional namespace + * + * @access private + * @var array + * @since 1.5 + */ + var $namespace = null; + + /** + * Constructor + * + * @access protected + * @param string The raw parms text + * @param string Path to the xml setup file + * @param string Namespace to the xml setup file + * @since 1.5 + */ + function __construct($data, $path = '', $namespace) + { + parent::__construct('_default'); + + // Set base path + $this->_elementPath[] = JPATH_COMPONENT_ADMINISTRATOR.'/elements'; + + if (trim($data)) + { + $this->loadINI($data); + } + + if ($path) + { + @$this->loadSetupFile($path); + } + + if ($namespace) + { + $this->namespace = $namespace; + } + + $this->_raw = $data; + + if (K2_JVERSION != '15') + { + $this->bind($data); + } + } + + /** + * Get a value + * + * @access public + * @param string The name of the param + * @param mixed The default value if not found + * @return string + * @since 1.5 + */ + function get($key, $default = '', $group = '_default') + { + if (K2_JVERSION != '15') + { + return parent::get($this->namespace.$key, $default); + } + $value = $this->getValue($group.'.'.$this->namespace.$key); + $result = (empty($value) && ($value !== 0) && ($value !== '0')) ? $default : $value; + //if($group != '_default') { echo ($group); } + return $result; + } + + /** + * Render a parameter type + * + * @param object A param tag node + * @param string The control name + * @return array Any array of the label, the form element and the tooltip + * @since 1.5 + */ + function getParam(&$node, $control_name = 'params', $group = '_default') + { + //get the type of the parameter + $type = $node->attributes('type'); + + //remove any occurance of a mos_ prefix + $type = str_replace('mos_', '', $type); + + $element = $this->loadElement($type); + + // error happened + if ($element === false) + { + $result = array(); + $result[0] = $node->attributes('name'); + $result[1] = JText::_('K2_ELEMENT_NOT_DEFINED_FOR_TYPE').' = '.$type; + $result[5] = $result[0]; + return $result; + } + + //get value + $value = $this->get($node->attributes('name'), $node->attributes('default'), $group); + + //set name + $node->_attributes['name'] = $this->namespace.$node->_attributes['name']; + + return $element->render($node, $value, $control_name); + } + + /** + * Get a registry value + * + * @access public + * @param string $regpath Registry path (e.g. joomla.content.showauthor) + * @param mixed $default Optional default value + * @return mixed Value of entry or null + * @since 1.5 + */ + function getValue($regpath, $default = null) + { + $result = $default; + + // Explode the registry path into an array + if ($nodes = explode('.', $regpath)) + { + // Get the namespace + //$namespace = array_shift($nodes); + $count = count($nodes); + if ($count < 2) + { + $namespace = $this->_defaultNameSpace; + $nodes[1] = $nodes[0]; + } + else + { + $namespace = $nodes[0]; + } + + if (isset($this->_registry[$namespace])) + { + $ns = &$this->_registry[$namespace]['data']; + $pathNodes = $count - 1; + + //for ($i = 0; $i < $pathNodes; $i ++) { + for ($i = 1; $i < $pathNodes; $i++) + { + if ((isset($ns->$nodes[$i]))) + $ns = &$ns->$nodes[$i]; + } + + if (isset($ns->$nodes[$i])) + { + $result = $ns->$nodes[$i]; + } + } + } + return $result; + } + + /** + * Render + * + * @access public + * @param string The name of the control, or the default text area if a setup file is not found + * @return string HTML + * @since 1.5 + */ + function render($name = 'params', $group = '_default') + { + if (!isset($this->_xml[$group])) + { + return false; + } + + $params = $this->getParams($name, $group); + $html = array(); + $html[] = ''; + + if ($description = $this->_xml[$group]->attributes('description')) + { + // add the params description to the display + $desc = JText::_($description); + $html[] = ''; + } + + foreach ($params as $param) + { + $html[] = ''; + + if ($param[0]) + { + $html[] = ''; + $html[] = ''; + } + else + { + $html[] = ''; + } + + $html[] = ''; + } + + if (count($params) < 1) + { + $html[] = ""; + } + + $html[] = '
    '.$desc.'
    '.$param[0].''.$param[1].''.$param[1].'
    ".(K2_JVERSION != '15') ? JText::_('JLIB_HTML_NO_PARAMETERS_FOR_THIS_ITEM') : JText::_('There are no Parameters for this item')."
    '; + + return implode("\n", $html); + } + + } + +} diff --git a/deployed/k2/administrator/components/com_k2/lib/k2plugin.php b/deployed/k2/administrator/components/com_k2/lib/k2plugin.php new file mode 100644 index 00000000..109f38a9 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/lib/k2plugin.php @@ -0,0 +1,98 @@ +pluginName.'.xml' : JPATH_SITE.'/plugins/k2/'.$this->pluginName.'/'.$this->pluginName.'.xml'; + if (!empty($tab)) + { + $path = $type.'-'.$tab; + } + else + { + $path = $type; + } + if (!isset($item->plugins)) + { + $item->plugins = NULL; + } + + if (K2_JVERSION == '15') + { + + $form = new K2Parameter($item->plugins, $manifest, $this->pluginName); + $fields = $form->render('plugins', $path); + } + else + { + jimport('joomla.form.form'); + $form = JForm::getInstance('plg_k2_'.$this->pluginName.'_'.$path, $manifest, array(), true, 'fields[@group="'.$path.'"]'); + $values = array(); + if ($item->plugins) + { + foreach (json_decode($item->plugins) as $name => $value) + { + $count = 1; + $values[str_replace($this->pluginName, '', $name, $count)] = $value; + } + $form->bind($values); + } + $fields = ''; + foreach ($form->getFieldset() as $field) + { + + if (strpos($field->name, '[]') !== false) + { + $search = 'name="'.$field->name.'"'; + $replace = 'name="plugins['.$this->pluginName.str_replace('[]', '', $field->name).'][]"'; + } + else + { + $search = 'name="'.$field->name.'"'; + $replace = 'name="plugins['.$this->pluginName.$field->name.']"'; + } + $input = JString::str_ireplace($search, $replace, $field->__get('input')); + $fields .= $field->__get('label').' '.$input; + } + + // Legacy code to maintain compatibillity with existing plugins that use params instead of JForm + if (empty($fields) && K2_JVERSION == '25') + { + $form = new K2Parameter($item->plugins, $manifest, $this->pluginName); + $fields = $form->render('plugins', $path); + } + + } + if ($fields) + { + $plugin = new stdClass; + $plugin->name = $this->pluginNameHumanReadable; + $plugin->fields = $fields; + return $plugin; + } + } + +} diff --git a/deployed/k2/administrator/components/com_k2/lib/recaptchalib.php b/deployed/k2/administrator/components/com_k2/lib/recaptchalib.php new file mode 100644 index 00000000..ede634a6 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/lib/recaptchalib.php @@ -0,0 +1,290 @@ + $value ) + $req .= $key . '=' . urlencode( stripslashes($value) ) . '&'; + + // Cut the last '&' + $req=substr($req,0,strlen($req)-1); + return $req; +} + + + +/** + * Submits an HTTP POST to a reCAPTCHA server + * @param string $host + * @param string $path + * @param array $data + * @param int port + * @return array response + */ +function _recaptcha_http_post($host, $path, $data, $port = 80) { + + $req = _recaptcha_qsencode ($data); + + $http_request = "POST $path HTTP/1.0\r\n"; + $http_request .= "Host: $host\r\n"; + $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n"; + $http_request .= "Content-Length: " . strlen($req) . "\r\n"; + $http_request .= "User-Agent: reCAPTCHA/PHP\r\n"; + $http_request .= "\r\n"; + $http_request .= $req; + + $response = ''; + if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) { + die ('Could not open socket'); + } + + fwrite($fs, $http_request); + + while ( !feof($fs) ) + $response .= fgets($fs, 1160); // One TCP-IP packet + fclose($fs); + $response = explode("\r\n\r\n", $response, 2); + + return $response; +} + + + +/** + * Gets the challenge HTML (javascript and non-javascript version). + * This is called from the browser, and the resulting reCAPTCHA HTML widget + * is embedded within the HTML form it was called from. + * @param string $pubkey A public key for reCAPTCHA + * @param string $error The error given by reCAPTCHA (optional, default is null) + * @param boolean $use_ssl Should the request be made over ssl? (optional, default is false) + + * @return string - The HTML to be embedded in the user's form. + */ +function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false) +{ + if ($pubkey == null || $pubkey == '') { + die ("To use reCAPTCHA you must get an API key from https://www.google.com/recaptcha/admin/create"); + } + + if ($use_ssl) { + $server = RECAPTCHA_API_SECURE_SERVER; + } else { + $server = RECAPTCHA_API_SERVER; + } + + $errorpart = ""; + if ($error) { + $errorpart = "&error=" . $error; + } + return ' + + + '; +} + + + + +/** + * A ReCaptchaResponse is returned from recaptcha_check_answer() + */ +class ReCaptchaResponse { + var $is_valid; + var $error; +} + + +/** + * Calls an HTTP POST function to verify if the user's guess was correct + * @param string $privkey + * @param string $remoteip + * @param string $challenge + * @param string $response + * @param array $extra_params an array of extra variables to post to the server + * @return ReCaptchaResponse + */ +function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array()) +{ + if ($privkey == null || $privkey == '') { + die ("To use reCAPTCHA you must get an API key from https://www.google.com/recaptcha/admin/create"); + } + + if ($remoteip == null || $remoteip == '') { + die ("For security reasons, you must pass the remote ip to reCAPTCHA"); + } + + + + //discard spam submissions + if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) { + $recaptcha_response = new ReCaptchaResponse(); + $recaptcha_response->is_valid = false; + $recaptcha_response->error = 'incorrect-captcha-sol'; + return $recaptcha_response; + } + + $response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify", + array ( + 'privatekey' => $privkey, + 'remoteip' => $remoteip, + 'challenge' => $challenge, + 'response' => $response + ) + $extra_params + ); + + $answers = explode ("\n", $response [1]); + $recaptcha_response = new ReCaptchaResponse(); + + if (trim ($answers [0]) == 'true') { + $recaptcha_response->is_valid = true; + } + else { + $recaptcha_response->is_valid = false; + $recaptcha_response->error = $answers [1]; + } + return $recaptcha_response; + +} + +/** + * gets a URL where the user can sign up for reCAPTCHA. If your application + * has a configuration page where you enter a key, you should provide a link + * using this function. + * @param string $domain The domain where the page is hosted + * @param string $appname The name of your application + */ +function recaptcha_get_signup_url ($domain = null, $appname = null) { + return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname)); +} + +function _recaptcha_aes_pad($val) { + $block_size = 16; + $numpad = $block_size - (strlen ($val) % $block_size); + return str_pad($val, strlen ($val) + $numpad, chr($numpad)); +} + +/* Mailhide related code */ + +function _recaptcha_aes_encrypt($val,$ky) { + if (! function_exists ("mcrypt_encrypt")) { + die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed."); + } + $mode=MCRYPT_MODE_CBC; + $enc=MCRYPT_RIJNDAEL_128; + $val=_recaptcha_aes_pad($val); + return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"); +} + + +function _recaptcha_mailhide_urlbase64 ($x) { + return strtr(base64_encode ($x), '+/', '-_'); +} + +/* gets the reCAPTCHA Mailhide url for a given email, public key and private key */ +function recaptcha_mailhide_url($pubkey, $privkey, $email) { + if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) { + die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " . + "you can do so at http://www.google.com/recaptcha/mailhide/apikey"); + } + + + $ky = pack('H*', $privkey); + $cryptmail = _recaptcha_aes_encrypt ($email, $ky); + + return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail); +} + +/** + * gets the parts of the email to expose to the user. + * eg, given johndoe@example,com return ["john", "example.com"]. + * the email is then displayed as john...@example.com + */ +function _recaptcha_mailhide_email_parts ($email) { + $arr = preg_split("/@/", $email ); + + if (strlen ($arr[0]) <= 4) { + $arr[0] = substr ($arr[0], 0, 1); + } else if (strlen ($arr[0]) <= 6) { + $arr[0] = substr ($arr[0], 0, 3); + } else { + $arr[0] = substr ($arr[0], 0, 4); + } + return $arr; +} + +/** + * Gets html to display an email address given a public an private key. + * to get a key, go to: + * + * http://www.google.com/recaptcha/mailhide/apikey + */ +function recaptcha_mailhide_html($pubkey, $privkey, $email) { + $emailparts = _recaptcha_mailhide_email_parts ($email); + $url = recaptcha_mailhide_url ($pubkey, $privkey, $email); + + return htmlentities($emailparts[0]) . "...@" . htmlentities ($emailparts [1]); + +} + + +?> \ No newline at end of file diff --git a/deployed/k2/administrator/components/com_k2/models/categories.php b/deployed/k2/administrator/components/com_k2/models/categories.php new file mode 100644 index 00000000..746d6544 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/models/categories.php @@ -0,0 +1,818 @@ +getUserStateFromRequest('global.list.limit', 'limit', $application->getCfg('list_limit'), 'int'); + $limitstart = $application->getUserStateFromRequest($option.$view.'.limitstart', 'limitstart', 0, 'int'); + $search = $application->getUserStateFromRequest($option.$view.'search', 'search', '', 'string'); + $search = JString::strtolower($search); + $search = trim(preg_replace('/[^\p{L}\p{N}\s\"\-_]/u', '', $search)); + $filter_order = $application->getUserStateFromRequest($option.$view.'filter_order', 'filter_order', 'c.ordering', 'cmd'); + $filter_order_Dir = $application->getUserStateFromRequest($option.$view.'filter_order_Dir', 'filter_order_Dir', '', 'word'); + $filter_trash = $application->getUserStateFromRequest($option.$view.'filter_trash', 'filter_trash', 0, 'int'); + $filter_state = $application->getUserStateFromRequest($option.$view.'filter_state', 'filter_state', -1, 'int'); + $language = $application->getUserStateFromRequest($option.$view.'language', 'language', '', 'string'); + $filter_category = $application->getUserStateFromRequest($option.$view.'filter_category', 'filter_category', 0, 'int'); + + $query = "SELECT c.*, g.name AS groupname, exfg.name as extra_fields_group FROM #__k2_categories as c LEFT JOIN #__groups AS g ON g.id = c.access LEFT JOIN #__k2_extra_fields_groups AS exfg ON exfg.id = c.extraFieldsGroup WHERE c.id>0"; + + if (!$filter_trash) + { + $query .= " AND c.trash=0"; + } + + if ($search) + { + + // Detect exact search phrase using double quotes in search string + if(substr($search, 0, 1)=='"' && substr($search, -1)=='"') + { + $exact = true; + } + else + { + $exact = false; + } + + // Now completely strip double quotes + $search = trim(str_replace('"', '', $search)); + + // Escape remaining string + $escaped = K2_JVERSION == '15' ? $db->getEscaped($search, true) : $db->escape($search, true); + + // Full phrase or set of words + if(strpos($escaped, ' ')!==false && !$exact) + { + $escaped=explode(' ', $escaped); + $quoted = array(); + foreach($escaped as $key=>$escapedWord) + { + $quoted[] = $db->Quote('%'.$escapedWord.'%', false); + } + if ($params->get('adminSearch') == 'full') + { + foreach($quoted as $quotedWord) + { + $query .= " AND ( ". + "LOWER(c.name) LIKE ".$quotedWord." ". + "OR LOWER(c.description) LIKE ".$quotedWord." ". + " )"; + } + } + else + { + foreach($quoted as $quotedWord) + { + $query .= " AND LOWER(c.name) LIKE ".$quotedWord; + } + } + } + // Single word or exact phrase to search for (wrapped in double quotes in the search block) + else + { + $quoted = $db->Quote('%'.$escaped.'%', false); + + if ($params->get('adminSearch') == 'full') + { + $query .= " AND ( ". + "LOWER(c.name) LIKE ".$quoted." ". + "OR LOWER(c.description) LIKE ".$quoted." ". + " )"; + } + else + { + $query .= " AND LOWER(c.name) LIKE ".$quoted; + } + } + } + + if ($filter_state > -1) + { + $query .= " AND c.published={$filter_state}"; + } + if ($language) + { + $query .= " AND c.language = ".$db->Quote($language); + } + + if ($filter_category) + { + K2Model::addIncludePath(JPATH_SITE.'/components/com_k2/models'); + $ItemlistModel = K2Model::getInstance('Itemlist', 'K2Model'); + $tree = $ItemlistModel->getCategoryTree($filter_category); + $query .= " AND c.id IN (".implode(',', $tree).")"; + } + + $query .= " ORDER BY {$filter_order} {$filter_order_Dir}"; + + if (K2_JVERSION != '15') + { + $query = JString::str_ireplace('#__groups', '#__viewlevels', $query); + $query = JString::str_ireplace('g.name AS groupname', 'g.title AS groupname', $query); + } + + $db->setQuery($query); + $rows = $db->loadObjectList(); + if (K2_JVERSION != '15') + { + foreach ($rows as $row) + { + $row->parent_id = $row->parent; + $row->title = $row->name; + } + } + $categories = array(); + + if ($search) + { + foreach ($rows as $row) + { + $row->treename = $row->name; + $categories[] = $row; + } + + } + else + { + if ($filter_category) + { + $db->setQuery('SELECT parent FROM #__k2_categories WHERE id = '.$filter_category); + $root = $db->loadResult(); + } + else if($language && count($categories)) + { + $root = $categories[0]->parent; + } + else + { + $root = 0; + } + $categories = $this->indentRows($rows, $root); + } + if (isset($categories)) + { + $total = count($categories); + } + else + { + $total = 0; + } + jimport('joomla.html.pagination'); + $pageNav = new JPagination($total, $limitstart, $limit); + $categories = @array_slice($categories, $pageNav->limitstart, $pageNav->limit); + foreach ($categories as $category) + { + $category->parameters = class_exists('JParameter') ? new JParameter($category->params) : new JRegistry($category->params); + if ($category->parameters->get('inheritFrom')) + { + $db->setQuery("SELECT name FROM #__k2_categories WHERE id = ".(int)$category->parameters->get('inheritFrom')); + $category->inheritFrom = $db->loadResult(); + } + else + { + $category->inheritFrom = ''; + } + } + return $categories; + } + + function getTotal() + { + $application = JFactory::getApplication(); + $params = JComponentHelper::getParams('com_k2'); + $option = JRequest::getCmd('option'); + $view = JRequest::getCmd('view'); + $db = JFactory::getDbo(); + $limit = $application->getUserStateFromRequest('global.list.limit', 'limit', $application->getCfg('list_limit'), 'int'); + $limitstart = $application->getUserStateFromRequest($option.'.limitstart', 'limitstart', 0, 'int'); + $search = $application->getUserStateFromRequest($option.$view.'search', 'search', '', 'string'); + $search = JString::strtolower($search); + $search = trim(preg_replace('/[^\p{L}\p{N}\s\"\-_]/u', '', $search)); + $filter_trash = $application->getUserStateFromRequest($option.$view.'filter_trash', 'filter_trash', 0, 'int'); + $filter_state = $application->getUserStateFromRequest($option.$view.'filter_state', 'filter_state', 1, 'int'); + $language = $application->getUserStateFromRequest($option.$view.'language', 'language', '', 'string'); + $filter_category = $application->getUserStateFromRequest($option.$view.'filter_category', 'filter_category', 0, 'int'); + + $query = "SELECT COUNT(*) FROM #__k2_categories WHERE id>0"; + + if (!$filter_trash) + { + $query .= " AND trash=0"; + } + + if ($search) + { + // Detect exact search phrase using double quotes in search string + if(substr($search, 0, 1)=='"' && substr($search, -1)=='"') + { + $exact = true; + } + else + { + $exact = false; + } + + // Now completely strip double quotes + $search = trim(str_replace('"', '', $search)); + + // Escape remaining string + $escaped = K2_JVERSION == '15' ? $db->getEscaped($search, true) : $db->escape($search, true); + + // Full phrase or set of words + if(strpos($escaped, ' ')!==false && !$exact) + { + $escaped=explode(' ', $escaped); + $quoted = array(); + foreach($escaped as $key=>$escapedWord) + { + $quoted[] = $db->Quote('%'.$escapedWord.'%', false); + } + if ($params->get('adminSearch') == 'full') + { + foreach($quoted as $quotedWord) + { + $query .= " AND ( ". + "LOWER(name) LIKE ".$quotedWord." ". + "OR LOWER(description) LIKE ".$quotedWord." ". + " )"; + } + } + else + { + foreach($quoted as $quotedWord) + { + $query .= " AND LOWER(name) LIKE ".$quotedWord; + } + } + } + // Single word or exact phrase to search for (wrapped in double quotes in the search block) + else + { + $quoted = $db->Quote('%'.$escaped.'%', false); + + if ($params->get('adminSearch') == 'full') + { + $query .= " AND ( ". + "LOWER(name) LIKE ".$quoted." ". + "OR LOWER(description) LIKE ".$quoted." ". + " )"; + } + else + { + $query .= " AND LOWER(name) LIKE ".$quoted; + } + } + } + + if ($filter_state > -1) + { + $query .= " AND published={$filter_state}"; + } + + if ($language) + { + $query .= " AND language = ".$db->Quote($language); + } + + if ($filter_category) + { + K2Model::addIncludePath(JPATH_SITE.'/components/com_k2/models'); + $ItemlistModel = K2Model::getInstance('Itemlist', 'K2Model'); + $tree = $ItemlistModel->getCategoryTree($filter_category); + $query .= " AND id IN (".implode(',', $tree).")"; + } + + $db->setQuery($query); + $total = $db->loadResult(); + return $total; + + } + + function indentRows(&$rows, $root = 0) + { + $children = array(); + if (count($rows)) + { + foreach ($rows as $v) + { + $pt = $v->parent; + $list = @$children[$pt] ? $children[$pt] : array(); + array_push($list, $v); + $children[$pt] = $list; + } + } + $categories = JHTML::_('menu.treerecurse', $root, '', array(), $children); + return $categories; + } + + function publish() + { + $application = JFactory::getApplication(); + $cid = JRequest::getVar('cid'); + foreach ($cid as $id) + { + $row = JTable::getInstance('K2Category', 'Table'); + $row->load($id); + $row->published = 1; + $row->store(); + } + JPluginHelper::importPlugin('finder'); + $dispatcher = JDispatcher::getInstance(); + $dispatcher->trigger('onFinderChangeState', array('com_k2.category', $cid, 1)); + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + if(JRequest::getCmd('context') == "modalselector"){ + $application->redirect('index.php?option=com_k2&view=categories&tmpl=component&context=modalselector'); + } else { + $application->redirect('index.php?option=com_k2&view=categories'); + } + } + + function unpublish() + { + $application = JFactory::getApplication(); + $cid = JRequest::getVar('cid'); + foreach ($cid as $id) + { + $row = JTable::getInstance('K2Category', 'Table'); + $row->load($id); + $row->published = 0; + $row->store(); + } + JPluginHelper::importPlugin('finder'); + $dispatcher = JDispatcher::getInstance(); + $dispatcher->trigger('onFinderChangeState', array('com_k2.category', $cid, 0)); + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + if(JRequest::getCmd('context') == "modalselector"){ + $application->redirect('index.php?option=com_k2&view=categories&tmpl=component&context=modalselector'); + } else { + $application->redirect('index.php?option=com_k2&view=categories'); + } + } + + function saveorder() + { + $application = JFactory::getApplication(); + $params = JComponentHelper::getParams('com_k2'); + $db = JFactory::getDbo(); + $cid = JRequest::getVar('cid', array(0), 'post', 'array'); + $total = count($cid); + $order = JRequest::getVar('order', array(0), 'post', 'array'); + JArrayHelper::toInteger($order, array(0)); + $groupings = array(); + for ($i = 0; $i < $total; $i++) + { + $row = JTable::getInstance('K2Category', 'Table'); + $row->load(( int )$cid[$i]); + $groupings[] = $row->parent; + if ($row->ordering != $order[$i]) + { + $row->ordering = $order[$i]; + if (!$row->store()) + { + JError::raiseError(500, $db->getErrorMsg()); + } + } + } + if (!$params->get('disableCompactOrdering')) + { + $groupings = array_unique($groupings); + foreach ($groupings as $group) + { + $row = JTable::getInstance('K2Category', 'Table'); + $row->reorder('parent = '.( int )$group.' AND trash=0'); + } + } + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + return true; + } + + function orderup() + { + $application = JFactory::getApplication(); + $params = JComponentHelper::getParams('com_k2'); + $cid = JRequest::getVar('cid'); + $row = JTable::getInstance('K2Category', 'Table'); + $row->load($cid[0]); + $row->move(-1, 'parent = '.$row->parent.' AND trash=0'); + if (!$params->get('disableCompactOrdering')) + $row->reorder('parent = '.(int)$row->parent.' AND trash=0'); + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + $msg = JText::_('K2_NEW_ORDERING_SAVED'); + $application->enqueueMessage($msg); + if(JRequest::getCmd('context') == "modalselector"){ + $application->redirect('index.php?option=com_k2&view=categories&tmpl=component&context=modalselector'); + } else { + $application->redirect('index.php?option=com_k2&view=categories'); + } + } + + function orderdown() + { + $application = JFactory::getApplication(); + $params = JComponentHelper::getParams('com_k2'); + $cid = JRequest::getVar('cid'); + $row = JTable::getInstance('K2Category', 'Table'); + $row->load($cid[0]); + $row->move(1, 'parent = '.$row->parent.' AND trash=0'); + if (!$params->get('disableCompactOrdering')) + $row->reorder('parent = '.(int)$row->parent.' AND trash=0'); + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + $msg = JText::_('K2_NEW_ORDERING_SAVED'); + $application->enqueueMessage($msg); + if(JRequest::getCmd('context') == "modalselector"){ + $application->redirect('index.php?option=com_k2&view=categories&tmpl=component&context=modalselector'); + } else { + $application->redirect('index.php?option=com_k2&view=categories'); + } + } + + function accessregistered() + { + $application = JFactory::getApplication(); + $db = JFactory::getDbo(); + $row = JTable::getInstance('K2Category', 'Table'); + $cid = JRequest::getVar('cid'); + $row->load($cid[0]); + $row->access = 1; + if (!$row->check()) + { + return $row->getError(); + } + if (!$row->store()) + { + return $row->getError(); + } + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + $msg = JText::_('K2_NEW_ACCESS_SETTING_SAVED'); + $application->enqueueMessage($msg); + $application->redirect('index.php?option=com_k2&view=categories'); + } + + function accessspecial() + { + $application = JFactory::getApplication(); + $db = JFactory::getDbo(); + $row = JTable::getInstance('K2Category', 'Table'); + $cid = JRequest::getVar('cid'); + $row->load($cid[0]); + $row->access = 2; + if (!$row->check()) + { + return $row->getError(); + } + if (!$row->store()) + { + return $row->getError(); + } + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + $msg = JText::_('K2_NEW_ACCESS_SETTING_SAVED'); + $application->enqueueMessage($msg); + $application->redirect('index.php?option=com_k2&view=categories'); + } + + function accesspublic() + { + $application = JFactory::getApplication(); + $db = JFactory::getDbo(); + $row = JTable::getInstance('K2Category', 'Table'); + $cid = JRequest::getVar('cid'); + $row->load($cid[0]); + $row->access = 0; + if (!$row->check()) + { + return $row->getError(); + } + if (!$row->store()) + { + return $row->getError(); + } + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + $msg = JText::_('K2_NEW_ACCESS_SETTING_SAVED'); + $application->enqueueMessage($msg); + $application->redirect('index.php?option=com_k2&view=categories'); + } + + function trash() + { + $application = JFactory::getApplication(); + $db = JFactory::getDbo(); + $cid = JRequest::getVar('cid'); + $row = JTable::getInstance('K2Category', 'Table'); + JArrayHelper::toInteger($cid); + K2Model::addIncludePath(JPATH_SITE.'/components/com_k2/models'); + $model = K2Model::getInstance('Itemlist', 'K2Model'); + $categories = $model->getCategoryTree($cid); + $sql = @implode(',', $categories); + $db = JFactory::getDbo(); + $query = "UPDATE #__k2_categories SET trash=1 WHERE id IN ({$sql})"; + $db->setQuery($query); + $db->query(); + $query = "UPDATE #__k2_items SET trash=1 WHERE catid IN ({$sql})"; + $db->setQuery($query); + $db->query(); + + JPluginHelper::importPlugin('finder'); + $dispatcher = JDispatcher::getInstance(); + $dispatcher->trigger('onFinderChangeState', array('com_k2.category', $cid, 0)); + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + $application->enqueueMessage(JText::_('K2_CATEGORIES_MOVED_TO_TRASH')); + $application->redirect('index.php?option=com_k2&view=categories'); + } + + function restore() + { + $application = JFactory::getApplication(); + $db = JFactory::getDbo(); + $cid = JRequest::getVar('cid'); + $warning = false; + $restored = array(); + foreach ($cid as $id) + { + $row = JTable::getInstance('K2Category', 'Table'); + $row->load($id); + if ((int)$row->parent == 0) + { + $row->trash = 0; + $row->store(); + $restored[] = $id; + } + else + { + $query = "SELECT COUNT(*) FROM #__k2_categories WHERE id={$row->parent} AND trash = 0"; + $db->setQuery($query); + $result = $db->loadResult(); + if ($result) + { + $row->trash = 0; + $row->store(); + $restored[] = $id; + } + else + { + $warning = true; + } + + } + + } + // Restore also the items of the categories + if (count($restored)) + { + JArrayHelper::toInteger($restored); + $db->setQuery('UPDATE #__k2_items SET trash = 0 WHERE catid IN ('.implode(',', $restored).') AND trash = 1'); + $db->query(); + } + JPluginHelper::importPlugin('finder'); + $dispatcher = JDispatcher::getInstance(); + $dispatcher->trigger('onFinderChangeState', array('com_k2.category', $cid, 1)); + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + if ($warning) + $application->enqueueMessage(JText::_('K2_SOME_OF_THE_CATEGORIES_HAVE_NOT_BEEN_RESTORED_BECAUSE_THEIR_PARENT_CATEGORY_IS_IN_TRASH'), 'notice'); + $application->enqueueMessage(JText::_('K2_CATEGORIES_MOVED_TO_TRASH')); + $application->redirect('index.php?option=com_k2&view=categories'); + } + + function remove() + { + $application = JFactory::getApplication(); + jimport('joomla.filesystem.file'); + $db = JFactory::getDbo(); + $cid = JRequest::getVar('cid'); + JArrayHelper::toInteger($cid); + JPluginHelper::importPlugin('finder'); + $dispatcher = JDispatcher::getInstance(); + $warningItems = false; + $warningChildren = false; + $cid = array_reverse($cid); + for ($i = 0; $i < sizeof($cid); $i++) + { + $row = JTable::getInstance('K2Category', 'Table'); + $row->load($cid[$i]); + + $query = "SELECT COUNT(*) FROM #__k2_items WHERE catid={$cid[$i]}"; + $db->setQuery($query); + $num = $db->loadResult(); + + if ($num > 0) + { + $warningItems = true; + } + + $query = "SELECT COUNT(*) FROM #__k2_categories WHERE parent={$cid[$i]}"; + $db->setQuery($query); + $children = $db->loadResult(); + + if ($children > 0) + { + $warningChildren = true; + } + + if ($children == 0 && $num == 0) + { + + if ($row->image) + { + JFile::delete(JPATH_ROOT.'/media/k2/categories/'.$row->image); + } + $row->delete($cid[$i]); + $dispatcher->trigger('onFinderAfterDelete', array('com_k2.category', $row)); + + } + } + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + + if ($warningItems) + { + $application->enqueueMessage(JText::_('K2_SOME_OF_THE_CATEGORIES_HAVE_NOT_BEEN_DELETED_BECAUSE_THEY_HAVE_ITEMS'), 'notice'); + } + if ($warningChildren) + { + $application->enqueueMessage(JText::_('K2_SOME_OF_THE_CATEGORIES_HAVE_NOT_BEEN_DELETED_BECAUSE_THEY_HAVE_CHILD_CATEGORIES'), 'notice'); + } + + $application->enqueueMessage(JText::_('K2_DELETE_COMPLETED')); + $application->redirect('index.php?option=com_k2&view=categories'); + } + + function categoriesTree($row = NULL, $hideTrashed = false, $hideUnpublished = true) + { + $db = JFactory::getDbo(); + if (isset($row->id)) + { + $idCheck = ' AND id != '.( int )$row->id; + } + else + { + $idCheck = null; + } + if (!isset($row->parent)) + { + if (is_null($row)) + { + $row = new stdClass; + } + $row->parent = 0; + } + $query = "SELECT m.* FROM #__k2_categories m WHERE id > 0 {$idCheck}"; + + if ($hideUnpublished) + { + $query .= " AND published=1 "; + } + + if ($hideTrashed) + { + $query .= " AND trash=0 "; + } + + $query .= " ORDER BY parent, ordering"; + $db->setQuery($query); + $mitems = $db->loadObjectList(); + $children = array(); + if ($mitems) + { + foreach ($mitems as $v) + { + if (K2_JVERSION != '15') + { + $v->title = $v->name; + $v->parent_id = $v->parent; + } + $pt = $v->parent; + $list = @$children[$pt] ? $children[$pt] : array(); + array_push($list, $v); + $children[$pt] = $list; + } + } + $list = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0); + $mitems = array(); + foreach ($list as $item) + { + $item->treename = JString::str_ireplace(' ', '- ', $item->treename); + if (!$item->published) + $item->treename .= ' [**'.JText::_('K2_UNPUBLISHED_CATEGORY').'**]'; + if ($item->trash) + $item->treename .= ' [**'.JText::_('K2_TRASHED_CATEGORY').'**]'; + $mitems[] = JHTML::_('select.option', $item->id, $item->treename); + } + return $mitems; + } + + function copy($batch = false) + { + jimport('joomla.filesystem.file'); + $application = JFactory::getApplication(); + $cid = JRequest::getVar('cid'); + JArrayHelper::toInteger($cid); + $copies = array(); + foreach ($cid as $id) + { + // Load source category + $category = JTable::getInstance('K2Category', 'Table'); + $category->load($id); + + // Save target category + $row = JTable::getInstance('K2Category', 'Table'); + $row = $category; + $row->id = NULL; + $row->name = JText::_('K2_COPY_OF').' '.$category->name; + $row->published = 0; + $row->store(); + $copies[] = $row->id; + // Target image + if ($category->image && JFile::exists(JPATH_SITE.'/media/k2/categories/'.$category->image)) + { + JFile::copy(JPATH_SITE.'/media/k2/categories/'.$category->image, JPATH_SITE.'/media/k2/categories/'.$row->id.'.jpg'); + $row->image = $row->id.'.jpg'; + $row->store(); + } + } + if($batch) + { + return $copies; + } + else + { + $application->enqueueMessage(JText::_('K2_COPY_COMPLETED')); + $application->redirect('index.php?option=com_k2&view=categories'); + } + } + + function saveBatch() + { + $application = JFactory::getApplication(); + $cid = JRequest::getVar('cid'); + $batchMode = JRequest::getCmd('batchMode'); + $catid = JRequest::getCmd('batchCategory'); + $access = JRequest::getCmd('batchAccess'); + $extraFieldsGroups = JRequest::getCmd('batchExtraFieldsGroups'); + $language = JRequest::getVar('batchLanguage'); + if($batchMode == 'clone'){ + $cid = $this->copy(true); + } + if(in_array($catid, $cid)) + { + $application->redirect('index.php?option=com_k2&view=categories'); + return; + } + foreach ($cid as $id) + { + $row = JTable::getInstance('K2Category', 'Table'); + $row->load($id); + if(is_numeric($catid) && $catid != '') + { + $row->parent = $catid; + $row->ordering = $row->getNextOrder('parent = '.(int)$catid.' AND published = 1'); + } + if($access) + { + $row->access = $access; + } + if(is_numeric($extraFieldsGroups) && $extraFieldsGroups != '') + { + $row->extraFieldsGroup = intval($extraFieldsGroups); + } + if($language) + { + $row->language = $language; + } + $row->store(); + } + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + $application->enqueueMessage(JText::_('K2_BATCH_COMPLETED')); + $application->redirect('index.php?option=com_k2&view=categories'); + } +} diff --git a/deployed/k2/administrator/components/com_k2/models/category.php b/deployed/k2/administrator/components/com_k2/models/category.php new file mode 100644 index 00000000..a82cb398 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/models/category.php @@ -0,0 +1,176 @@ +load($cid); + return $row; + } + + function save() + { + $application = JFactory::getApplication(); + jimport('joomla.filesystem.file'); + require_once(JPATH_SITE.'/media/k2/assets/vendors/verot/class.upload.php/src/class.upload.php'); + $row = JTable::getInstance('K2Category', 'Table'); + $params = JComponentHelper::getParams('com_k2'); + + if (!$row->bind(JRequest::get('post'))) + { + $application->enqueueMessage($row->getError(), 'error'); + $application->redirect('index.php?option=com_k2&view=categories'); + } + + $isNew = ($row->id) ? false : true; + + //Trigger the finder before save event + $dispatcher = JDispatcher::getInstance(); + JPluginHelper::importPlugin('finder'); + $results = $dispatcher->trigger('onFinderBeforeSave', array('com_k2.category', $row, $isNew)); + + $row->description = JRequest::getVar('description', '', 'post', 'string', 2); + if ($params->get('xssFiltering')) + { + $filter = new JFilterInput( array(), array(), 1, 1, 0); + $row->description = $filter->clean($row->description); + } + + if (!$row->id) + { + $row->ordering = $row->getNextOrder('parent = '.(int)$row->parent.' AND trash=0'); + } + + if (!$row->check()) + { + $application->enqueueMessage($row->getError(), 'error'); + $application->redirect('index.php?option=com_k2&view=category&cid='.$row->id); + } + + if (!$row->store()) + { + $application->enqueueMessage($row->getError(), 'error'); + $application->redirect('index.php?option=com_k2&view=categories'); + } + + if (!$params->get('disableCompactOrdering')) + $row->reorder('parent = '.(int)$row->parent.' AND trash=0'); + + if ((int)$params->get('imageMemoryLimit')) + { + ini_set('memory_limit', (int)$params->get('imageMemoryLimit').'M'); + } + + $files = JRequest::get('files'); + + $savepath = JPATH_ROOT.'/media/k2/categories/'; + + $existingImage = JRequest::getVar('existingImage'); + if (($files['image']['error'] == 0 || $existingImage) && !JRequest::getBool('del_image')) + { + if ($files['image']['error'] == 0) + { + $image = $files['image']; + } + else + { + $image = JPATH_SITE.'/'.JPath::clean($existingImage); + } + + $handle = new Upload($image); + if ($handle->uploaded) + { + $handle->file_auto_rename = false; + $handle->jpeg_quality = $params->get('imagesQuality', '85'); + $handle->file_overwrite = true; + $handle->file_new_name_body = $row->id; + $handle->image_resize = true; + $handle->image_ratio_y = true; + $handle->image_x = $params->get('catImageWidth', '100'); + $handle->Process($savepath); + if ($files['image']['error'] == 0) + $handle->Clean(); + } + else + { + $application->enqueueMessage($handle->error, 'error'); + $application->redirect('index.php?option=com_k2&view=categories'); + } + $row->image = $handle->file_dst_name; + } + + if (JRequest::getBool('del_image')) + { + $currentRow = JTable::getInstance('K2Category', 'Table'); + $currentRow->load($row->id); + if (JFile::exists(JPATH_ROOT.'/media/k2/categories/'.$currentRow->image)) + { + JFile::delete(JPATH_ROOT.'/media/k2/categories/'.$currentRow->image); + } + $row->image = ''; + } + + if (!$row->store()) + { + $application->enqueueMessage($row->getError(), 'error'); + $application->redirect('index.php?option=com_k2&view=categories'); + } + + //Trigger the finder after save event + $dispatcher = JDispatcher::getInstance(); + JPluginHelper::importPlugin('finder'); + $results = $dispatcher->trigger('onFinderAfterSave', array('com_k2.category', $row, $isNew)); + + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + + switch(JRequest::getCmd('task')) + { + case 'apply' : + $msg = JText::_('K2_CHANGES_TO_CATEGORY_SAVED'); + $link = 'index.php?option=com_k2&view=category&cid='.$row->id; + break; + case 'saveAndNew' : + $msg = JText::_('K2_CATEGORY_SAVED'); + $link = 'index.php?option=com_k2&view=category'; + break; + case 'save' : + default : + $msg = JText::_('K2_CATEGORY_SAVED'); + $link = 'index.php?option=com_k2&view=categories'; + break; + } + $application->enqueueMessage($msg); + $application->redirect($link); + } + + function countCategoryItems($catid, $trash = 0) + { + + $db = JFactory::getDbo(); + $catid = (int)$catid; + $query = "SELECT COUNT(*) FROM #__k2_items WHERE catid={$catid} AND trash = ".(int)$trash; + $db->setQuery($query); + $result = $db->loadResult(); + return $result; + + } + +} diff --git a/deployed/k2/administrator/components/com_k2/models/category.xml b/deployed/k2/administrator/components/com_k2/models/category.xml new file mode 100644 index 00000000..4be74215 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/models/category.xml @@ -0,0 +1,958 @@ + +
    + K2_CATEGORY_EDIT_FORM + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + + + + + + +
    +
    +
    diff --git a/deployed/k2/administrator/components/com_k2/models/comments.php b/deployed/k2/administrator/components/com_k2/models/comments.php new file mode 100644 index 00000000..5b7731ed --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/models/comments.php @@ -0,0 +1,479 @@ +getUserStateFromRequest('global.list.limit', 'limit', $application->getCfg('list_limit'), 'int'); + $limitstart = $application->getUserStateFromRequest($option.$view.'.limitstart', 'limitstart', 0, 'int'); + $filter_order = $application->getUserStateFromRequest($option.$view.'filter_order', 'filter_order', 'c.id', 'cmd'); + $filter_order_Dir = $application->getUserStateFromRequest($option.$view.'filter_order_Dir', 'filter_order_Dir', 'DESC', 'word'); + $filter_state = $application->getUserStateFromRequest($option.$view.'filter_state', 'filter_state', -1, 'int'); + $filter_category = $application->getUserStateFromRequest($option.$view.'filter_category', 'filter_category', 0, 'int'); + $filter_author = $application->getUserStateFromRequest($option.$view.'filter_author', 'filter_author', 0, 'int'); + $search = $application->getUserStateFromRequest($option.$view.'search', 'search', '', 'string'); + $search = JString::strtolower($search); + $search = trim(preg_replace('/[^\p{L}\p{N}\s\"\.\@\-_]/u', '', $search)); + + $query = "SELECT c.*, i.title , i.catid, i.alias AS itemAlias, i.created_by, cat.alias AS catAlias, cat.name as catName FROM #__k2_comments AS c LEFT JOIN #__k2_items AS i ON c.itemID=i.id LEFT JOIN #__k2_categories AS cat ON cat.id=i.catid LEFT JOIN #__k2_users AS u ON c.userID=u.userID WHERE c.id>0"; + + if ($filter_state > - 1) { + $query .= " AND c.published={$filter_state}"; + } + + if ($filter_category) { + $query .= " AND i.catid={$filter_category}"; + } + + if ($filter_author) { + $query .= " AND i.created_by={$filter_author}"; + } + + if ($search) + { + + // Detect exact search phrase using double quotes in search string + if(substr($search, 0, 1)=='"' && substr($search, -1)=='"') + { + $exact = true; + } + else + { + $exact = false; + } + + // Now completely strip double quotes + $search = trim(str_replace('"', '', $search)); + + // Escape remaining string + $escaped = K2_JVERSION == '15' ? $db->getEscaped($search, true) : $db->escape($search, true); + + // Full phrase or set of words + if(strpos($escaped, ' ')!==false && !$exact) + { + $escaped=explode(' ', $escaped); + $quoted = array(); + foreach($escaped as $key=>$escapedWord) + { + $quoted[] = $db->Quote('%'.$escapedWord.'%', false); + } + if ($params->get('adminSearch') == 'full') + { + foreach($quoted as $quotedWord) + { + $query .= " AND ( ". + "LOWER(c.commentText) LIKE ".$quotedWord." ". + "OR LOWER(c.userName) LIKE ".$quotedWord." ". + "OR LOWER(c.commentEmail) LIKE ".$quotedWord." ". + "OR LOWER(c.commentURL) LIKE ".$quotedWord." ". + "OR LOWER(i.title) LIKE ".$quotedWord." ". + "OR LOWER(u.userName) LIKE ".$quotedWord." ". + "OR LOWER(u.ip) LIKE ".$quotedWord." ". + " )"; + } + } + else + { + foreach($quoted as $quotedWord) + { + $query .= " AND LOWER(c.commentText) LIKE ".$quotedWord; + } + } + } + // Single word or exact phrase to search for (wrapped in double quotes in the search block) + else + { + $quoted = $db->Quote('%'.$escaped.'%', false); + + if ($params->get('adminSearch') == 'full') + { + $query .= " AND ( ". + "LOWER(c.commentText) LIKE ".$quoted." ". + "OR LOWER(c.userName) LIKE ".$quoted." ". + "OR LOWER(c.commentEmail) LIKE ".$quoted." ". + "OR LOWER(c.commentURL) LIKE ".$quoted." ". + "OR LOWER(i.title) LIKE ".$quoted." ". + "OR LOWER(u.userName) LIKE ".$quoted." ". + "OR LOWER(u.ip) LIKE ".$quoted." ". + " )"; + } + else + { + $query .= " AND LOWER(c.commentText) LIKE ".$quoted; + } + } + } + + if (!$filter_order) { + $filter_order = "c.commentDate"; + } + + $query .= " ORDER BY {$filter_order} {$filter_order_Dir}"; + $db->setQuery($query, $limitstart, $limit); + $rows = $db->loadObjectList(); + return $rows; + } + + function getTotal() { + $application = JFactory::getApplication(); + $params = JComponentHelper::getParams('com_k2'); + $option = JRequest::getCmd('option'); + $view = JRequest::getCmd('view'); + $db = JFactory::getDbo(); + $limit = $application->getUserStateFromRequest('global.list.limit', 'limit', $application->getCfg('list_limit'), 'int'); + $limitstart = $application->getUserStateFromRequest($option.'.limitstart', 'limitstart', 0, 'int'); + $filter_state = $application->getUserStateFromRequest($option.$view.'filter_state', 'filter_state', 1, 'int'); + $filter_category = $application->getUserStateFromRequest($option.$view.'filter_category', 'filter_category', 0, 'int'); + $filter_author = $application->getUserStateFromRequest($option.$view.'filter_author', 'filter_author', 0, 'int'); + $search = $application->getUserStateFromRequest($option.$view.'search', 'search', '', 'string'); + $search = JString::strtolower($search); + $search = trim(preg_replace('/[^\p{L}\p{N}\s\"\.\@\-_]/u', '', $search)); + + $query = "SELECT COUNT(*) FROM #__k2_comments AS c LEFT JOIN #__k2_items AS i ON c.itemID=i.id LEFT JOIN #__k2_users AS u ON c.userID=u.userID WHERE c.id>0"; + + if ($filter_state > - 1) { + $query .= " AND c.published={$filter_state}"; + } + + if ($filter_category) { + $query .= " AND i.catid={$filter_category}"; + } + + if ($filter_author) { + $query .= " AND i.created_by={$filter_author}"; + } + + if ($search) + { + + // Detect exact search phrase using double quotes in search string + if(substr($search, 0, 1)=='"' && substr($search, -1)=='"') + { + $exact = true; + } + else + { + $exact = false; + } + + // Now completely strip double quotes + $search = trim(str_replace('"', '', $search)); + + // Escape remaining string + $escaped = K2_JVERSION == '15' ? $db->getEscaped($search, true) : $db->escape($search, true); + + // Full phrase or set of words + if(strpos($escaped, ' ')!==false && !$exact) + { + $escaped=explode(' ', $escaped); + $quoted = array(); + foreach($escaped as $key=>$escapedWord) + { + $quoted[] = $db->Quote('%'.$escapedWord.'%', false); + } + if ($params->get('adminSearch') == 'full') + { + foreach($quoted as $quotedWord) + { + $query .= " AND ( ". + "LOWER(c.commentText) LIKE ".$quotedWord." ". + "OR LOWER(c.userName) LIKE ".$quotedWord." ". + "OR LOWER(c.commentEmail) LIKE ".$quotedWord." ". + "OR LOWER(c.commentURL) LIKE ".$quotedWord." ". + "OR LOWER(i.title) LIKE ".$quotedWord." ". + "OR LOWER(u.userName) LIKE ".$quotedWord." ". + "OR LOWER(u.ip) LIKE ".$quotedWord." ". + " )"; + } + } + else + { + foreach($quoted as $quotedWord) + { + $query .= " AND LOWER(c.commentText) LIKE ".$quotedWord; + } + } + } + // Single word or exact phrase to search for (wrapped in double quotes in the search block) + else + { + $quoted = $db->Quote('%'.$escaped.'%', false); + + if ($params->get('adminSearch') == 'full') + { + $query .= " AND ( ". + "LOWER(c.commentText) LIKE ".$quoted." ". + "OR LOWER(c.userName) LIKE ".$quoted." ". + "OR LOWER(c.commentEmail) LIKE ".$quoted." ". + "OR LOWER(c.commentURL) LIKE ".$quoted." ". + "OR LOWER(i.title) LIKE ".$quoted." ". + "OR LOWER(u.userName) LIKE ".$quoted." ". + "OR LOWER(u.ip) LIKE ".$quoted." ". + " )"; + } + else + { + $query .= " AND LOWER(c.commentText) LIKE ".$quoted; + } + } + } + $db->setQuery($query); + $total = $db->loadresult(); + return $total; + } + + function publish() { + $application = JFactory::getApplication(); + $user = JFactory::getUser(); + $cid = JRequest::getVar('cid'); + if(!count($cid)){ + $cid[]=JRequest::getInt('commentID'); + } + + foreach ($cid as $id) { + $row = JTable::getInstance('K2Comment', 'Table'); + $row->load($id); + if($application->isSite()){ + $item = JTable::getInstance('K2Item', 'Table'); + $item->load($row->itemID); + if ($item->created_by != $user->id) { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + $application->close(); + } + } + $row->published = 1; + $row->store(); + } + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + if(JRequest::getCmd('format')=='raw'){ + echo 'true'; + $application->close(); + } + if(JRequest::getCmd('context') == "modalselector"){ + $application->redirect('index.php?option=com_k2&view=comments&tmpl=component&context=modalselector'); + } else { + $application->redirect('index.php?option=com_k2&view=comments'); + } + } + + function unpublish() { + $application = JFactory::getApplication(); + $user = JFactory::getUser(); + $cid = JRequest::getVar('cid'); + foreach ($cid as $id) { + $row = JTable::getInstance('K2Comment', 'Table'); + $row->load($id); + if($application->isSite()){ + $item = JTable::getInstance('K2Item', 'Table'); + $item->load($row->itemID); + if ($item->created_by != $user->id) { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + $application->close(); + } + } + $row->published = 0; + $row->store(); + } + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + if(JRequest::getCmd('context') == "modalselector"){ + $application->redirect('index.php?option=com_k2&view=comments&tmpl=component&context=modalselector'); + } else { + $application->redirect('index.php?option=com_k2&view=comments'); + } + } + + function remove() { + $application = JFactory::getApplication(); + $user = JFactory::getUser(); + $db = JFactory::getDbo(); + $cid = JRequest::getVar('cid'); + if(!count($cid)){ + $cid[]=JRequest::getInt('commentID'); + } + foreach ($cid as $id) { + $row = JTable::getInstance('K2Comment', 'Table'); + $row->load($id); + if($application->isSite()){ + $item = JTable::getInstance('K2Item', 'Table'); + $item->load($row->itemID); + if ($item->created_by != $user->id) { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + $application->close(); + } + } + $row->delete($id); + } + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + if(JRequest::getCmd('format')=='raw'){ + echo 'true'; + $application->close(); + } + $application->enqueueMessage(JText::_('K2_DELETE_COMPLETED')); + if(JRequest::getCmd('context') == "modalselector"){ + $application->redirect('index.php?option=com_k2&view=comments&tmpl=component&context=modalselector'); + } else { + $application->redirect('index.php?option=com_k2&view=comments'); + } + } + + function deleteUnpublished() { + $application = JFactory::getApplication(); + $db = JFactory::getDbo(); + $user = JFactory::getUser(); + $userID = $user->id; + if($application->isSite()){ + $query = "SELECT c.id FROM #__k2_comments AS c + LEFT JOIN #__k2_items AS i ON c.itemID=i.id + WHERE i.created_by = {$userID} AND c.published=0"; + $db->setQuery($query); + $ids = K2_JVERSION == '30' ? $db->loadColumn() : $db->loadResultArray(); + if (count($ids)){ + $query = "DELETE FROM #__k2_comments WHERE id IN(".implode(',', $ids).")"; + $db->setQuery($query); + $db->query(); + } + } + else { + $query = "DELETE FROM #__k2_comments WHERE published=0"; + $db->setQuery($query); + $db->query(); + } + + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + $application->enqueueMessage(JText::_('K2_DELETE_COMPLETED')); + if(JRequest::getCmd('context') == "modalselector"){ + $application->redirect('index.php?option=com_k2&view=comments&tmpl=component&context=modalselector'); + } else { + $application->redirect('index.php?option=com_k2&view=comments'); + } + } + + function save() { + $application = JFactory::getApplication(); + $user = JFactory::getUser(); + $db = JFactory::getDbo(); + $id = JRequest::getInt('commentID'); + $item = JTable::getInstance('K2Item', 'Table'); + $row = JTable::getInstance('K2Comment', 'Table'); + $row->load($id); + if($application->isSite()){ + $item->load($row->itemID); + if ($item->created_by != $user->id) { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + } + $row->commentText = JRequest::getVar('commentText', '', 'default', 'string', 4); + $row->store(); + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + $response = new JObject; + $response->comment = $row->commentText; + $response->message = JText::_('K2_COMMENT_SAVED'); + unset($response->_errors); + echo json_encode($response); + $application->close(); + } + + function report(){ + $id = $this->getState('id'); + $name = JString::trim($this->getState('name')); + $reportReason = JString::trim($this->getState('reportReason')); + $params = K2HelperUtilities::getParams('com_k2'); + $user = JFactory::getUser(); + $row = JTable::getInstance('K2Comment', 'Table'); + $row->load($id); + if(!$row->published){ + $this->setError(JText::_('K2_COMMENT_NOT_FOUND')); + return false; + } + if(empty($name)){ + $this->setError(JText::_('K2_PLEASE_TYPE_YOUR_NAME')); + return false; + } + if(empty($reportReason)){ + $this->setError(JText::_('K2_PLEASE_TYPE_THE_REPORT_REASON')); + return false; + } + if (($params->get('antispam') == 'recaptcha' || $params->get('antispam') == 'both') && $user->guest) { + + if($params->get('recaptchaV2')) + { + require_once JPATH_SITE.'/components/com_k2/helpers/utilities.php'; + if (!K2HelperUtilities::verifyRecaptcha()) + { + $this->setError(JText::_('K2_COULD_NOT_VERIFY_THAT_YOU_ARE_NOT_A_ROBOT')); + return false; + } + } + else + { + if(!function_exists('_recaptcha_qsencode')) + { + require_once(JPATH_SITE.'/media/k2/assets/vendors/google/recaptcha_legacy/recaptcha.php'); + } + $privatekey = $params->get('recaptcha_private_key'); + $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); + if (!$resp->is_valid) { + $this->setError(JText::_('K2_THE_WORDS_YOU_TYPED_DID_NOT_MATCH_THE_ONES_DISPLAYED_PLEASE_TRY_AGAIN')); + return false; + } + } + } + + $application = JFactory::getApplication(); + $mail = JFactory::getMailer(); + $senderEmail = $application->getCfg('mailfrom'); + $senderName = $application->getCfg('fromname'); + + $mail->setSender(array($senderEmail, $senderName)); + $mail->setSubject(JText::_('K2_COMMENT_REPORT')); + $mail->IsHTML(true); + + switch(substr(strtoupper(PHP_OS), 0, 3)) { + case 'WIN': + $mail->LE = "\r\n"; + break; + case 'MAC': + case 'DAR': + $mail->LE = "\r"; + default: + break; + } + + // K2 embedded email template (to do: move to separate HTML template/override) + $body = " + ".JText::_('K2_NAME').": ".$name."
    + ".JText::_('K2_REPORT_REASON').": ".$reportReason."
    + ".JText::_('K2_COMMENT').": ".nl2br($row->commentText)."
    + "; + + $mail->setBody($body); + $mail->ClearAddresses(); + $mail->AddAddress($params->get('commentsReportRecipient', $application->getCfg('mailfrom'))); + $mail->Send(); + + return true; + } +} diff --git a/deployed/k2/administrator/components/com_k2/models/extrafield.php b/deployed/k2/administrator/components/com_k2/models/extrafield.php new file mode 100644 index 00000000..35dde88c --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/models/extrafield.php @@ -0,0 +1,481 @@ +load($cid); + return $row; + } + + function save() + { + + $application = JFactory::getApplication(); + $row = JTable::getInstance('K2ExtraField', 'Table'); + if (!$row->bind(JRequest::get('post'))) + { + $application->enqueueMessage($row->getError(), 'error'); + $application->redirect('index.php?option=com_k2&view=extrafields'); + } + + $isNewGroup = JRequest::getInt('isNew'); + + if ($isNewGroup) + { + + $group = JTable::getInstance('K2ExtraFieldsGroup', 'Table'); + $group->set('name', JRequest::getVar('group')); + $group->store(); + $row->group = $group->id; + } + + if (!$row->id) + { + $row->ordering = $row->getNextOrder("`group` = ".(int)$row->group); + } + + $objects = array(); + $values = JRequest::getVar('option_value', null, 'default', 'none', 4); + $names = JRequest::getVar('option_name'); + $target = JRequest::getVar('option_target'); + $editor = JRequest::getVar('option_editor'); + $rows = JRequest::getVar('option_rows'); + $cols = JRequest::getVar('option_cols'); + $alias = JRequest::getWord('alias'); + $required = JRequest::getInt('required'); + $showNull = JRequest::getInt('showNull'); + $displayInFrontEnd = JRequest::getInt('displayInFrontEnd'); + + if (JString::strtolower($alias) == 'this') + { + $alias = ''; + } + $lastOptionId = 1; + for ($i = 0; $i < sizeof($values); $i++) + { + $object = new JObject; + $object->set('name', $names[$i]); + + if ($row->type == 'select' || $row->type == 'multipleSelect' || $row->type == 'radio') + { + if(!empty($values[$i])) + { + $object->set('value', $values[$i]); + $lastOptionId = intval($values[$i]); + } + else + { + $lastOptionId ++; + $object->set('value', $lastOptionId); + } + } + elseif ($row->type == 'link') + { + if (trim($values[$i]) != '') + { + if (substr($values[$i], 0, 7) == 'http://' || substr($values[$i], 0, 8) == 'https://' || substr($values[$i], 0, 2) == '//' || substr($values[$i], 0, 1) == '/' || substr($values[$i], 0, 7) == 'mailto:' || substr($values[$i], 0, 4) == 'tel:' ) + { + $values[$i] = $values[$i]; + } + else + { + $values[$i] = 'http://'.$values[$i]; + } + } + $object->set('value', trim($values[$i])); + } + elseif ($row->type == 'csv') + { + $file = JRequest::getVar('csv_file', NULL, 'FILES'); + $csvFile = $file['tmp_name']; + if (!empty($csvFile) && JFile::getExt($file['name']) == 'csv') + { + $handle = @fopen($csvFile, 'r'); + $csvData = array(); + while (($data = fgetcsv($handle, 1000)) !== FALSE) + { + $csvData[] = $data; + } + fclose($handle); + $object->set('value', $csvData); + } + else + { + $object->set('value', json_decode($values[$i])); + if (JRequest::getBool('K2ResetCSV')) + $object->set('value', null); + } + + } + elseif ($row->type == 'textarea') + { + $object->set('value', $values[$i]); + $object->set('editor', $editor[$i]); + $object->set('rows', $rows[$i]); + $object->set('cols', $cols[$i]); + } + elseif ($row->type == 'image') + { + $object->set('value', $values[$i]); + } + elseif ($row->type == 'header') + { + $object->set('value', JRequest::getString('name')); + $object->set('displayInFrontEnd', $displayInFrontEnd); + } + else + { + $object->set('value', $values[$i]); + } + + $object->set('target', $target[$i]); + $object->set('alias', $alias); + $object->set('required', $required); + $object->set('showNull', $showNull); + unset($object->_errors); + $objects[] = $object; + } + + $row->value = json_encode($objects); + + if (!$row->check()) + { + $application->enqueueMessage($row->getError(), 'error'); + $application->redirect('index.php?option=com_k2&view=extrafield&cid='.$row->id); + } + + if (!$row->store()) + { + $application->enqueueMessage($row->getError(), 'error'); + $application->redirect('index.php?option=com_k2&view=extrafields'); + } + + $params = JComponentHelper::getParams('com_k2'); + if (!$params->get('disableCompactOrdering')) + $row->reorder("`group` = ".(int)$row->group); + + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + + switch(JRequest::getCmd('task')) + { + case 'apply' : + $msg = JText::_('K2_CHANGES_TO_EXTRA_FIELD_SAVED'); + $link = 'index.php?option=com_k2&view=extrafield&cid='.$row->id; + break; + case 'save' : + default : + $msg = JText::_('K2_EXTRA_FIELD_SAVED'); + $link = 'index.php?option=com_k2&view=extrafields'; + break; + } + $application->enqueueMessage($msg); + $application->redirect($link); + } + + function getExtraFieldsByGroup($group) + { + + $db = JFactory::getDbo(); + $group = (int)$group; + $query = "SELECT * FROM #__k2_extra_fields WHERE `group`={$group} AND published=1 ORDER BY ordering"; + $db->setQuery($query); + $rows = $db->loadObjectList(); + return $rows; + } + + function renderExtraField($extraField, $itemID = NULL) + { + + $application = JFactory::getApplication(); + + if (!is_null($itemID)) + { + $item = JTable::getInstance('K2Item', 'Table'); + $item->load($itemID); + } + + $defaultValues = json_decode($extraField->value); + + foreach ($defaultValues as $value) + { + + $required = isset($value->required) ? $value->required : 0; + $showNull = isset($value->showNull) ? $value->showNull : 0; + + if ($extraField->type == 'textfield' || $extraField->type == 'csv' || $extraField->type == 'labels' || $extraField->type == 'date' || $extraField->type == 'image') + { + $active = $value->value; + } + elseif ($extraField->type == 'textarea') + { + $active[0] = $value->value; + $active[1] = $value->editor; + $active[2] = (int)$value->rows ? (int)$value->rows : 10; + $active[3] = (int)$value->cols ? (int)$value->cols : 40; + } + elseif ($extraField->type == 'link') + { + $active[0] = $value->name; + $active[1] = $value->value; + $active[2] = $value->target; + } + else + { + $active = ''; + } + + } + + if (!isset($active)) + { + $active = ''; + } + + if (isset($item)) + { + $currentValues = json_decode($item->extra_fields); + if (count($currentValues)) + { + foreach ($currentValues as $value) + { + if ($value->id == $extraField->id) + { + if ($extraField->type == 'textarea') + { + $active[0] = $value->value; + } + else if ($extraField->type == 'date') + { + $active = (is_array($value->value)) ? $value->value[0] : $value->value; + } + else if ($extraField->type == 'header') + { + continue; + } + else + { + $active = $value->value; + } + } + } + } + + } + $attributes = ''; + $arrayAttributes = array(); + if ($required) + { + $arrayAttributes['class'] = "k2Required"; + $attributes .= 'class="k2Required"'; + } + + + if ($showNull && in_array($extraField->type, array( + 'select', + 'multipleSelect' + ))) + { + $nullOption = new stdClass; + $nullOption->name = JText::_('K2_PLEASE_SELECT'); + $nullOption->value = ''; + array_unshift($defaultValues, $nullOption); + } + + if (in_array($extraField->type, array( + 'textfield', + 'labels', + 'date', + 'image' + ))) + { + $active = htmlspecialchars($active, ENT_QUOTES, 'UTF-8'); + } + + switch ($extraField->type) + { + + case 'textfield' : + $output = ''; + break; + + case 'labels' : + $output = ' '.JText::_('K2_COMMA_SEPARATED_VALUES'); + break; + + case 'textarea' : + if ($active[1]) + { + if ($required) + { + $attributes = 'class="k2ExtraFieldEditor k2Required"'; + } + else + { + $attributes = 'class="k2ExtraFieldEditor"'; + } + } + $output = ''; + break; + + case 'select' : + $attributes .= ' id="K2ExtraField_'.$extraField->id.'"'; + $arrayAttributes['id'] = 'K2ExtraField_'.$extraField->id; + $attrs = version_compare(JVERSION, '3.2', 'ge') ? $arrayAttributes : $attributes; + $output = JHTML::_('select.genericlist', $defaultValues, 'K2ExtraField_'.$extraField->id, $attrs, 'value', 'name', $active); + break; + + case 'multipleSelect' : + + $attributes .= ' id="K2ExtraField_'.$extraField->id.'" multiple="multiple"'; + $arrayAttributes['id'] = 'K2ExtraField_'.$extraField->id; + $arrayAttributes['multiple'] = "multiple"; + $attrs = version_compare(JVERSION, '3.2', 'ge') ? $arrayAttributes : $attributes; + $output = JHTML::_('select.genericlist', $defaultValues, 'K2ExtraField_'.$extraField->id.'[]', $attrs, 'value', 'name', $active); + break; + + case 'radio' : + if (!$active && isset($defaultValues[0])) + { + $active = $defaultValues[0]->value; + } + $attrs = version_compare(JVERSION, '3.2', 'ge') ? $arrayAttributes : $attributes; + $output = JHTML::_('select.radiolist', $defaultValues, 'K2ExtraField_'.$extraField->id, $attrs, 'value', 'name', $active); + break; + + case 'link' : + $output = ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $targetOptions[] = JHTML::_('select.option', 'same', JText::_('K2_SAME_WINDOW')); + $targetOptions[] = JHTML::_('select.option', 'new', JText::_('K2_NEW_WINDOW')); + $targetOptions[] = JHTML::_('select.option', 'popup', JText::_('K2_CLASSIC_JAVASCRIPT_POPUP')); + $targetOptions[] = JHTML::_('select.option', 'lightbox', JText::_('K2_LIGHTBOX_POPUP')); + $output .= JHTML::_('select.genericlist', $targetOptions, 'K2ExtraField_'.$extraField->id.'[]', '', 'value', 'text', $active[2]); + break; + + case 'csv' : + if ($active) + { + $attributes = ''; + } + $output = ''; + + if (is_array($active) && count($active)) + { + $output .= ''; + $output .= ''; + foreach ($active as $key => $row) + { + $output .= ''; + foreach ($row as $cell) + { + $output .= ($key > 0) ? '' : ''; + } + $output .= ''; + } + $output .= '
    '.$cell.''.$cell.'
    '; + $output .= ''; + $output .= ''; + } + break; + + case 'date' : + if ($required) + { + $cssClass = 'k2Calendar k2Required'; + } + else + { + $cssClass = 'k2Calendar'; + } + $output = ''; + break; + case 'image' : + $output = ' + '.JText::_('K2_SELECT').''; + break; + case 'header' : + $output = ''; + break; + } + + return $output; + + } + + function getExtraFieldInfo($fieldID) + { + + $db = JFactory::getDbo(); + $fieldID = (int)$fieldID; + $query = "SELECT * FROM #__k2_extra_fields WHERE published=1 AND id = ".$fieldID; + $db->setQuery($query, 0, 1); + $row = $db->loadObject(); + return $row; + } + + function getSearchValue($id, $currentValue) + { + + $row = JTable::getInstance('K2ExtraField', 'Table'); + $row->load($id); + + $jsonObject = json_decode($row->value); + + $value = ''; + if ($row->type == 'textfield' || $row->type == 'textarea') + { + $value = $currentValue; + } + else if ($row->type == 'multipleSelect') + { + foreach ($jsonObject as $option) + { + if (in_array($option->value, $currentValue)) + $value .= $option->name.' '; + } + } + else if ($row->type == 'link') + { + $value .= $currentValue[0].' '; + $value .= $currentValue[1].' '; + } + else if ($row->type == 'labels') + { + $parts = explode(',', $currentValue); + $value .= implode(' ', $parts); + } + else + { + foreach ($jsonObject as $option) + { + if ($option->value == $currentValue) + $value .= $option->name; + } + } + return $value; + } + +} diff --git a/deployed/k2/administrator/components/com_k2/models/extrafields.php b/deployed/k2/administrator/components/com_k2/models/extrafields.php new file mode 100644 index 00000000..a4f21d02 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/models/extrafields.php @@ -0,0 +1,373 @@ +getUserStateFromRequest('global.list.limit', 'limit', $application->getCfg('list_limit'), 'int'); + $limitstart = $application->getUserStateFromRequest($option.$view.'.limitstart', 'limitstart', 0, 'int'); + $filter_order = $application->getUserStateFromRequest($option.$view.'filter_order', 'filter_order', 'groupname', 'cmd'); + $filter_order_Dir = $application->getUserStateFromRequest($option.$view.'filter_order_Dir', 'filter_order_Dir', 'ASC', 'word'); + $filter_state = $application->getUserStateFromRequest($option.$view.'filter_state', 'filter_state', -1, 'int'); + $search = $application->getUserStateFromRequest($option.$view.'search', 'search', '', 'string'); + $search = JString::strtolower($search); + $search = trim(preg_replace('/[^\p{L}\p{N}\s\-_]/u', '', $search)); + $filter_type = $application->getUserStateFromRequest($option.$view.'filter_type', 'filter_type', '', 'string'); + $filter_group = $application->getUserStateFromRequest($option.$view.'filter_group', 'filter_group', 0, 'int'); + + $query = "SELECT exf.*, exfg.name as groupname FROM #__k2_extra_fields AS exf LEFT JOIN #__k2_extra_fields_groups exfg ON exf.group=exfg.id WHERE exf.id>0"; + + if ($filter_state > -1) + { + $query .= " AND published={$filter_state}"; + } + + if ($search) + { + $escaped = K2_JVERSION == '15' ? $db->getEscaped($search, true) : $db->escape($search, true); + $query .= " AND LOWER( exf.name ) LIKE ".$db->Quote('%'.$escaped.'%', false); + } + + if ($filter_type) + { + $query .= " AND `type`=".$db->Quote($filter_type); + } + + if ($filter_group) + { + $query .= " AND `group`={$filter_group}"; + } + + if (!$filter_order) + { + $filter_order = '`group`'; + } + + if ($filter_order == 'ordering') + { + $query .= " ORDER BY `group`, ordering {$filter_order_Dir}"; + } + else + { + $query .= " ORDER BY {$filter_order} {$filter_order_Dir}, `group`, ordering"; + } + + $db->setQuery($query, $limitstart, $limit); + $rows = $db->loadObjectList(); + return $rows; + } + + function getTotal() + { + + $application = JFactory::getApplication(); + $option = JRequest::getCmd('option'); + $view = JRequest::getCmd('view'); + $db = JFactory::getDbo(); + $limit = $application->getUserStateFromRequest('global.list.limit', 'limit', $application->getCfg('list_limit'), 'int'); + $limitstart = $application->getUserStateFromRequest($option.'.limitstart', 'limitstart', 0, 'int'); + $filter_state = $application->getUserStateFromRequest($option.$view.'filter_state', 'filter_state', 1, 'int'); + $search = $application->getUserStateFromRequest($option.$view.'search', 'search', '', 'string'); + $search = JString::strtolower($search); + $search = trim(preg_replace('/[^\p{L}\p{N}\s\-_]/u', '', $search)); + $filter_type = $application->getUserStateFromRequest($option.$view.'filter_type', 'filter_type', '', 'string'); + $filter_group = $application->getUserStateFromRequest($option.$view.'filter_group', 'filter_group', '', 'string'); + + $query = "SELECT COUNT(*) FROM #__k2_extra_fields WHERE id>0"; + + if ($filter_state > -1) + { + $query .= " AND published={$filter_state}"; + } + + if ($search) + { + $escaped = K2_JVERSION == '15' ? $db->getEscaped($search, true) : $db->escape($search, true); + $query .= " AND LOWER( name ) LIKE ".$db->Quote('%'.$escaped.'%', false); + } + + if ($filter_type) + { + $query .= " AND `type`=".$db->Quote($filter_type); + } + + if ($filter_group) + { + $query .= " AND `group`=".$db->Quote($filter_group); + } + + $db->setQuery($query); + $total = $db->loadresult(); + return $total; + } + + function publish() + { + + $application = JFactory::getApplication(); + $cid = JRequest::getVar('cid'); + foreach ($cid as $id) + { + $row = JTable::getInstance('K2ExtraField', 'Table'); + $row->load($id); + $row->published = 1; + $row->store(); + } + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + $application->redirect('index.php?option=com_k2&view=extrafields'); + } + + function unpublish() + { + + $application = JFactory::getApplication(); + $cid = JRequest::getVar('cid'); + foreach ($cid as $id) + { + $row = JTable::getInstance('K2ExtraField', 'Table'); + $row->load($id); + $row->published = 0; + $row->store(); + } + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + $application->redirect('index.php?option=com_k2&view=extrafields'); + } + + function saveorder() + { + + $application = JFactory::getApplication(); + $db = JFactory::getDbo(); + $cid = JRequest::getVar('cid', array(0), 'post', 'array'); + $total = count($cid); + $order = JRequest::getVar('order', array(0), 'post', 'array'); + JArrayHelper::toInteger($order, array(0)); + $groupings = array(); + for ($i = 0; $i < $total; $i++) + { + $row = JTable::getInstance('K2ExtraField', 'Table'); + $row->load((int)$cid[$i]); + $groupings[] = $row->group; + if ($row->ordering != $order[$i]) + { + $row->ordering = $order[$i]; + if (!$row->store()) + { + JError::raiseError(500, $db->getErrorMsg()); + } + } + } + $params = JComponentHelper::getParams('com_k2'); + if (!$params->get('disableCompactOrdering')) + { + $groupings = array_unique($groupings); + foreach ($groupings as $group) + { + $row = JTable::getInstance('K2ExtraField', 'Table'); + $row->reorder("`group` = ".(int)$group); + } + } + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + return true; + } + + function orderup() + { + + $application = JFactory::getApplication(); + $cid = JRequest::getVar('cid'); + $row = JTable::getInstance('K2ExtraField', 'Table'); + $row->load($cid[0]); + $row->move(-1, "`group` = '{$row->group}'"); + $params = JComponentHelper::getParams('com_k2'); + if (!$params->get('disableCompactOrdering')) + $row->reorder("`group` = ".(int)$row->group); + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + $msg = JText::_('K2_NEW_ORDERING_SAVED'); + $application->enqueueMessage($msg); + $application->redirect('index.php?option=com_k2&view=extrafields'); + } + + function orderdown() + { + + $application = JFactory::getApplication(); + $cid = JRequest::getVar('cid'); + $row = JTable::getInstance('K2ExtraField', 'Table'); + $row->load($cid[0]); + $row->move(1, "`group` = '{$row->group}'"); + $params = JComponentHelper::getParams('com_k2'); + if (!$params->get('disableCompactOrdering')) + $row->reorder("`group` = ".(int)$row->group); + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + $msg = JText::_('K2_NEW_ORDERING_SAVED'); + $application->enqueueMessage($msg); + $application->redirect('index.php?option=com_k2&view=extrafields'); + } + + function remove() + { + + $application = JFactory::getApplication(); + $db = JFactory::getDbo(); + $cid = JRequest::getVar('cid'); + foreach ($cid as $id) + { + $row = JTable::getInstance('K2ExtraField', 'Table'); + $row->load($id); + $row->delete($id); + } + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + $application->enqueueMessage(JText::_('K2_DELETE_COMPLETED')); + $application->redirect('index.php?option=com_k2&view=extrafields'); + } + + function getExtraFieldsGroup() + { + + $cid = JRequest::getVar('cid'); + $row = JTable::getInstance('K2ExtraFieldsGroup', 'Table'); + $row->load($cid); + return $row; + } + + function getGroups($filter = false) + { + + $application = JFactory::getApplication(); + $option = JRequest::getCmd('option'); + $view = JRequest::getCmd('view'); + $limit = $application->getUserStateFromRequest('global.list.limit', 'limit', $application->getCfg('list_limit'), 'int'); + $limitstart = $application->getUserStateFromRequest($option.$view.'.limitstart', 'limitstart', 0, 'int'); + $db = JFactory::getDbo(); + $query = "SELECT * FROM #__k2_extra_fields_groups ORDER BY `name`"; + if ($filter) + { + $db->setQuery($query); + } + else + { + $db->setQuery($query, $limitstart, $limit); + } + + $rows = $db->loadObjectList(); + for ($i = 0; $i < sizeof($rows); $i++) + { + $query = "SELECT name FROM #__k2_categories WHERE extraFieldsGroup=".(int)$rows[$i]->id; + $db->setQuery($query); + $categories = K2_JVERSION == '30' ? $db->loadColumn() : $db->loadResultArray(); + if (is_array($categories)) + { + $rows[$i]->categories = implode(', ', $categories); + } + else + { + $rows[$i]->categories = ''; + } + + } + return $rows; + } + + function getTotalGroups() + { + + $db = JFactory::getDbo(); + $query = "SELECT COUNT(*) FROM #__k2_extra_fields_groups"; + $db->setQuery($query); + $total = $db->loadResult(); + return $total; + } + + function saveGroup() + { + + $application = JFactory::getApplication(); + $id = JRequest::getInt('id'); + $row = JTable::getInstance('K2ExtraFieldsGroup', 'Table'); + if (!$row->bind(JRequest::get('post'))) + { + $application->enqueueMessage($row->getError(), 'error'); + $application->redirect('index.php?option=com_k2&view=extrafieldsgroups'); + } + + if (!$row->check()) + { + $application->enqueueMessage($row->getError(), 'error'); + $application->redirect('index.php?option=com_k2&view=extrafieldsgroup&cid='.$row->id); + } + + if (!$row->store()) + { + $application->enqueueMessage($row->getError(), 'error'); + $application->redirect('index.php?option=com_k2&view=extrafieldsgroup'); + } + + switch(JRequest::getCmd('task')) + { + case 'apply' : + $msg = JText::_('K2_CHANGES_TO_GROUP_SAVED'); + $link = 'index.php?option=com_k2&view=extrafieldsgroup&cid='.$row->id; + break; + case 'save' : + default : + $msg = JText::_('K2_GROUP_SAVED'); + $link = 'index.php?option=com_k2&view=extrafieldsgroups'; + break; + } + + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + $application->enqueueMessage($msg); + $application->redirect($link); + } + + function removeGroups() + { + + $application = JFactory::getApplication(); + $db = &JFactory::getDbo(); + $cid = JRequest::getVar('cid'); + JArrayHelper::toInteger($cid); + foreach ($cid as $id) + { + $row = JTable::getInstance('K2ExtraFieldsGroup', 'Table'); + $row->load($id); + $query = "DELETE FROM #__k2_extra_fields WHERE `group`={$id}"; + $db->setQuery($query); + $db->query(); + $row->delete($id); + } + $cache = &JFactory::getCache('com_k2'); + $cache->clean(); + $application->enqueueMessage(JText::_('K2_DELETE_COMPLETED')); + $application->redirect('index.php?option=com_k2&view=extrafieldsgroups'); + } + +} diff --git a/deployed/k2/administrator/components/com_k2/models/item.php b/deployed/k2/administrator/components/com_k2/models/item.php new file mode 100644 index 00000000..356dac4f --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/models/item.php @@ -0,0 +1,1329 @@ +load($cid); + return $row; + } + + function save($front = false) + { + $application = JFactory::getApplication(); + jimport('joomla.filesystem.file'); + jimport('joomla.filesystem.folder'); + jimport('joomla.filesystem.archive'); + require_once(JPATH_SITE.'/media/k2/assets/vendors/verot/class.upload.php/src/class.upload.php'); + $db = JFactory::getDbo(); + $user = JFactory::getUser(); + $row = JTable::getInstance('K2Item', 'Table'); + $params = JComponentHelper::getParams('com_k2'); + $nullDate = $db->getNullDate(); + + // Plugin Events + JPluginHelper::importPlugin('k2'); + JPluginHelper::importPlugin('content'); + JPluginHelper::importPlugin('finder'); + $dispatcher = JDispatcher::getInstance(); + + if (!$row->bind(JRequest::get('post'))) + { + $application->enqueueMessage($row->getError(), 'error'); + $application->redirect('index.php?option=com_k2&view=items'); + } + + if ($front && $row->id == NULL) + { + JLoader::register('K2HelperPermissions', JPATH_SITE.'/components/com_k2/helpers/permissions.php'); + if (!K2HelperPermissions::canAddItem($row->catid)) + { + $application->enqueueMessage(JText::_('K2_YOU_ARE_NOT_ALLOWED_TO_POST_TO_THIS_CATEGORY_SAVE_FAILED'), 'error'); + $application->redirect('index.php?option=com_k2&view=item&task=add&tmpl=component'); + } + } + + $isNew = ($row->id) ? false : true; + + // If we are in front-end and the item is not new we need to get it's current published state. + if (!$isNew && $front) + { + $id = JRequest::getInt('id'); + $currentRow = JTable::getInstance('K2Item', 'Table'); + $currentRow->load($id); + $isAlreadyPublished = $currentRow->published; + $currentFeaturedState = $currentRow->featured; + } + + if ($params->get('mergeEditors')) + { + $text = JRequest::getVar('text', '', 'post', 'string', 2); + if ($params->get('xssFiltering')) + { + $filter = new JFilterInput( array(), array(), 1, 1, 0); + $text = $filter->clean($text); + } + $pattern = '##i'; + $tagPos = preg_match($pattern, $text); + if ($tagPos == 0) + { + $row->introtext = $text; + $row->fulltext = ''; + } + else + list($row->introtext, $row->fulltext) = preg_split($pattern, $text, 2); + } + else + { + $row->introtext = JRequest::getVar('introtext', '', 'post', 'string', 2); + $row->fulltext = JRequest::getVar('fulltext', '', 'post', 'string', 2); + if ($params->get('xssFiltering')) + { + $filter = new JFilterInput( array(), array(), 1, 1, 0); + $row->introtext = $filter->clean($row->introtext); + $row->fulltext = $filter->clean($row->fulltext); + } + } + + if ($row->id) + { + $datenow = JFactory::getDate(); + $row->modified = K2_JVERSION == '15' ? $datenow->toMySQL() : $datenow->toSql(); + $row->modified_by = $user->get('id'); + } + else + { + $row->ordering = $row->getNextOrder("catid = ".(int)$row->catid." AND trash = 0"); + if ($row->featured) + $row->featured_ordering = $row->getNextOrder("featured = 1 AND trash = 0", 'featured_ordering'); + } + + $row->created_by = $row->created_by ? $row->created_by : $user->get('id'); + + if ($front) + { + $K2Permissions = K2Permissions::getInstance(); + if (!$K2Permissions->permissions->get('editAll')) + { + $row->created_by = $user->get('id'); + } + } + + if ($row->created && strlen(trim($row->created)) <= 10) + { + $row->created .= ' 00:00:00'; + } + + $config = JFactory::getConfig(); + $tzoffset = K2_JVERSION == '30' ? $config->get('offset') : $config->getValue('config.offset'); + $date = JFactory::getDate($row->created, $tzoffset); + $row->created = K2_JVERSION == '15' ? $date->toMySQL() : $date->toSql(); + + if (strlen(trim($row->publish_up)) <= 10) + { + $row->publish_up .= ' 00:00:00'; + } + + $date = JFactory::getDate($row->publish_up, $tzoffset); + $row->publish_up = K2_JVERSION == '15' ? $date->toMySQL() : $date->toSql(); + + if (trim($row->publish_down) == JText::_('K2_NEVER') || trim($row->publish_down) == '') + { + $row->publish_down = $nullDate; + } + else + { + if (strlen(trim($row->publish_down)) <= 10) + { + $row->publish_down .= ' 00:00:00'; + } + $date = JFactory::getDate($row->publish_down, $tzoffset); + $row->publish_down = K2_JVERSION == '15' ? $date->toMySQL() : $date->toSql(); + } + + $metadata = JRequest::getVar('meta', null, 'post', 'array'); + if (is_array($metadata)) + { + $txt = array(); + foreach ($metadata as $k => $v) + { + if ($k == 'description') + { + $row->metadesc = $v; + } + elseif ($k == 'keywords') + { + $row->metakey = $v; + } + else + { + $txt[] = "$k=$v"; + } + } + $row->metadata = implode("\n", $txt); + } + + if (!$row->check()) + { + $application->enqueueMessage($row->getError(), 'error'); + $application->redirect('index.php?option=com_k2&view=item&cid='.$row->id); + } + + // Trigger K2 plugins + $result = $dispatcher->trigger('onBeforeK2Save', array(&$row, $isNew)); + + if (in_array(false, $result, true)) + { + JError::raiseError(500, $row->getError()); + return false; + } + + // Trigger content & finder plugins before the save event + $dispatcher->trigger('onContentBeforeSave', array('com_k2.item', $row, $isNew)); + $dispatcher->trigger('onFinderBeforeSave', array('com_k2.item', $row, $isNew)); + + // Try to save the video if there is no need to wait for item ID + if (!JRequest::getBool('del_video')) + { + if (!isset($files['video'])) + { + + if (JRequest::getVar('remoteVideo')) + { + $fileurl = JRequest::getVar('remoteVideo'); + $filetype = JFile::getExt($fileurl); + $row->video = '{'.$filetype.'remote}'.$fileurl.'{/'.$filetype.'remote}'; + } + + if (JRequest::getVar('videoID')) + { + $provider = JRequest::getWord('videoProvider'); + $videoID = JRequest::getVar('videoID'); + $row->video = '{'.$provider.'}'.$videoID.'{/'.$provider.'}'; + } + + if (JRequest::getVar('embedVideo', '', 'post', 'string', JREQUEST_ALLOWRAW)) + { + $row->video = JRequest::getVar('embedVideo', '', 'post', 'string', JREQUEST_ALLOWRAW); + } + } + } + + // JoomFish front-end editing compatibility + if ($application->isSite() && JFile::exists(JPATH_ADMINISTRATOR.'/components/com_joomfish/joomfish.php')) + { + if (version_compare(phpversion(), '5.0') < 0) + { + $tmpRow = $row; + } + else + { + $tmpRow = clone($row); + } + } + + if (!$row->store()) + { + $application->enqueueMessage($row->getError(), 'error'); + $application->redirect('index.php?option=com_k2&view=items'); + } + + // JoomFish front-end editing compatibility + if ($application->isSite() && JFile::exists(JPATH_ADMINISTRATOR.'/components/com_joomfish/joomfish.php')) + { + $itemID = $row->id; + $row = $tmpRow; + $row->id = $itemID; + } + + if (!$params->get('disableCompactOrdering')) + { + $row->reorder("catid = ".(int)$row->catid." AND trash = 0"); + } + if ($row->featured && !$params->get('disableCompactOrdering')) + { + $row->reorder("featured = 1 AND trash = 0", 'featured_ordering'); + } + $files = JRequest::get('files'); + + // Image + if ((int)$params->get('imageMemoryLimit')) + { + ini_set('memory_limit', (int)$params->get('imageMemoryLimit').'M'); + } + $existingImage = JRequest::getVar('existingImage'); + if (($files['image']['error'] == 0 || $existingImage) && !JRequest::getBool('del_image')) + { + + if ($files['image']['error'] == 0) + { + $image = $files['image']; + } + else + { + $image = JPATH_SITE.'/'.JPath::clean($existingImage); + } + + $handle = new Upload($image); + $handle->allowed = array('image/*'); + $handle->forbidden = array('image/tiff'); + + if ($handle->file_is_image && $handle->uploaded) + { + // Image params + $category = JTable::getInstance('K2Category', 'Table'); + $category->load($row->catid); + $cparams = class_exists('JParameter') ? new JParameter($category->params) : new JRegistry($category->params); + + if ($cparams->get('inheritFrom')) + { + $masterCategoryID = $cparams->get('inheritFrom'); + $query = "SELECT * FROM #__k2_categories WHERE id=".(int)$masterCategoryID; + $db->setQuery($query, 0, 1); + $masterCategory = $db->loadObject(); + $cparams = class_exists('JParameter') ? new JParameter($masterCategory->params) : new JRegistry($masterCategory->params); + } + + $params->merge($cparams); + + // Original image + $savepath = JPATH_SITE.'/media/k2/items/src'; + $handle->image_convert = 'jpg'; + $handle->jpeg_quality = 100; + $handle->file_auto_rename = false; + $handle->file_overwrite = true; + $handle->file_new_name_body = md5("Image".$row->id); + $handle->Process($savepath); + + $filename = $handle->file_dst_name_body; + $savepath = JPATH_SITE.'/media/k2/items/cache'; + + // XLarge image + $handle->image_resize = true; + $handle->image_ratio_y = true; + $handle->image_convert = 'jpg'; + $handle->jpeg_quality = $params->get('imagesQuality'); + $handle->file_auto_rename = false; + $handle->file_overwrite = true; + $handle->file_new_name_body = $filename.'_XL'; + if (JRequest::getInt('itemImageXL')) + { + $imageWidth = JRequest::getInt('itemImageXL'); + } + else + { + $imageWidth = $params->get('itemImageXL', '800'); + } + $handle->image_x = $imageWidth; + $handle->Process($savepath); + + // Large image + $handle->image_resize = true; + $handle->image_ratio_y = true; + $handle->image_convert = 'jpg'; + $handle->jpeg_quality = $params->get('imagesQuality'); + $handle->file_auto_rename = false; + $handle->file_overwrite = true; + $handle->file_new_name_body = $filename.'_L'; + if (JRequest::getInt('itemImageL')) + { + $imageWidth = JRequest::getInt('itemImageL'); + } + else + { + $imageWidth = $params->get('itemImageL', '600'); + } + $handle->image_x = $imageWidth; + $handle->Process($savepath); + + // Medium image + $handle->image_resize = true; + $handle->image_ratio_y = true; + $handle->image_convert = 'jpg'; + $handle->jpeg_quality = $params->get('imagesQuality'); + $handle->file_auto_rename = false; + $handle->file_overwrite = true; + $handle->file_new_name_body = $filename.'_M'; + if (JRequest::getInt('itemImageM')) + { + $imageWidth = JRequest::getInt('itemImageM'); + } + else + { + $imageWidth = $params->get('itemImageM', '400'); + } + $handle->image_x = $imageWidth; + $handle->Process($savepath); + + // Small image + $handle->image_resize = true; + $handle->image_ratio_y = true; + $handle->image_convert = 'jpg'; + $handle->jpeg_quality = $params->get('imagesQuality'); + $handle->file_auto_rename = false; + $handle->file_overwrite = true; + $handle->file_new_name_body = $filename.'_S'; + if (JRequest::getInt('itemImageS')) + { + $imageWidth = JRequest::getInt('itemImageS'); + } + else + { + $imageWidth = $params->get('itemImageS', '200'); + } + $handle->image_x = $imageWidth; + $handle->Process($savepath); + + // XSmall image + $handle->image_resize = true; + $handle->image_ratio_y = true; + $handle->image_convert = 'jpg'; + $handle->jpeg_quality = $params->get('imagesQuality'); + $handle->file_auto_rename = false; + $handle->file_overwrite = true; + $handle->file_new_name_body = $filename.'_XS'; + if (JRequest::getInt('itemImageXS')) + { + $imageWidth = JRequest::getInt('itemImageXS'); + } + else + { + $imageWidth = $params->get('itemImageXS', '100'); + } + $handle->image_x = $imageWidth; + $handle->Process($savepath); + + // Generic image + $handle->image_resize = true; + $handle->image_ratio_y = true; + $handle->image_convert = 'jpg'; + $handle->jpeg_quality = $params->get('imagesQuality'); + $handle->file_auto_rename = false; + $handle->file_overwrite = true; + $handle->file_new_name_body = $filename.'_Generic'; + $imageWidth = $params->get('itemImageGeneric', '300'); + $handle->image_x = $imageWidth; + $handle->Process($savepath); + + if ($files['image']['error'] == 0) + $handle->Clean(); + + } + else + { + $application->enqueueMessage(JText::_('K2_IMAGE_WAS_NOT_UPLOADED'), 'notice'); + } + + } + + if (JRequest::getBool('del_image')) + { + $current = JTable::getInstance('K2Item', 'Table'); + $current->load($row->id); + $filename = md5("Image".$current->id); + + if (JFile::exists(JPATH_ROOT.'/media/k2/items/src/'.$filename.'.jpg')) + { + JFile::delete(JPATH_ROOT.'/media/k2/items/src/'.$filename.'.jpg'); + } + + if (JFile::exists(JPATH_ROOT.'/media/k2/items/cache/'.$filename.'_XS.jpg')) + { + JFile::delete(JPATH_ROOT.'/media/k2/items/cache/'.$filename.'_XS.jpg'); + } + + if (JFile::exists(JPATH_ROOT.'/media/k2/items/cache/'.$filename.'_S.jpg')) + { + JFile::delete(JPATH_ROOT.'/media/k2/items/cache/'.$filename.'_S.jpg'); + } + + if (JFile::exists(JPATH_ROOT.'/media/k2/items/cache/'.$filename.'_M.jpg')) + { + JFile::delete(JPATH_ROOT.'/media/k2/items/cache/'.$filename.'_M.jpg'); + } + + if (JFile::exists(JPATH_ROOT.'/media/k2/items/cache/'.$filename.'_L.jpg')) + { + JFile::delete(JPATH_ROOT.'/media/k2/items/cache/'.$filename.'_L.jpg'); + } + + if (JFile::exists(JPATH_ROOT.'/media/k2/items/cache/'.$filename.'_XL.jpg')) + { + JFile::delete(JPATH_ROOT.'/media/k2/items/cache/'.$filename.'_XL.jpg'); + } + + if (JFile::exists(JPATH_ROOT.'/media/k2/items/cache/'.$filename.'_Generic.jpg')) + { + JFile::delete(JPATH_ROOT.'/media/k2/items/cache/'.$filename.'_Generic.jpg'); + } + + $row->image_caption = ''; + $row->image_credits = ''; + } + + // Attachments + $attachments = JRequest::getVar('attachment_file', NULL, 'FILES', 'array'); + $attachments_names = JRequest::getVar('attachment_name', '', 'POST', 'array'); + $attachments_titles = JRequest::getVar('attachment_title', '', 'POST', 'array'); + $attachments_title_attributes = JRequest::getVar('attachment_title_attribute', '', 'POST', 'array'); + $attachments_existing_files = JRequest::getVar('attachment_existing_file', '', 'POST', 'array'); + + $attachmentFiles = array(); + + if (count($attachments)) + { + + foreach ($attachments as $k => $l) + { + foreach ($l as $i => $v) + { + if (!array_key_exists($i, $attachmentFiles)) + $attachmentFiles[$i] = array(); + $attachmentFiles[$i][$k] = $v; + } + + } + + $path = $params->get('attachmentsFolder', NULL); + if (is_null($path)) + { + $savepath = JPATH_ROOT.'/media/k2/attachments'; + } + else + { + $savepath = $path; + } + + $counter = 0; + + foreach ($attachmentFiles as $key => $file) + { + if ($file["tmp_name"] || $attachments_existing_files[$key]) + { + if ($attachments_existing_files[$key]) + { + $src = JPATH_SITE.'/'.JPath::clean($attachments_existing_files[$key]); + $copyName = basename($src); + $dest = $savepath.'/'.$copyName; + if (JFile::exists($dest)) + { + $existingFileName = JFile::getName($dest); + $ext = JFile::getExt($existingFileName); + $basename = JFile::stripExt($existingFileName); + $newFilename = $basename.'_'.time().'.'.$ext; + $copyName = $newFilename; + $dest = $savepath.'/'.$newFilename; + } + JFile::copy($src, $dest); + $attachment = JTable::getInstance('K2Attachment', 'Table'); + $attachment->itemID = $row->id; + $attachment->filename = $copyName; + $attachment->title = ( empty($attachments_titles[$counter])) ? $filename : $attachments_titles[$counter]; + $attachment->titleAttribute = ( empty($attachments_title_attributes[$counter])) ? $filename : $attachments_title_attributes[$counter]; + $attachment->store(); + } + else + { + $handle = new Upload($file); + if ($handle->uploaded) + { + $handle->file_auto_rename = true; + $handle->allowed[] = 'application/x-zip'; + $handle->allowed[] = 'application/download'; + $handle->Process($savepath); + $filename = $handle->file_dst_name; + $handle->Clean(); + $attachment = JTable::getInstance('K2Attachment', 'Table'); + $attachment->itemID = $row->id; + $attachment->filename = $filename; + $attachment->title = ( empty($attachments_titles[$counter])) ? $filename : $attachments_titles[$counter]; + $attachment->titleAttribute = ( empty($attachments_title_attributes[$counter])) ? $filename : $attachments_title_attributes[$counter]; + $attachment->store(); + } + else + { + $application->enqueueMessage($handle->error, 'error'); + $application->redirect('index.php?option=com_k2&view=items'); + } + } + } + $counter++; + } + } + + // Gallery + $flickrGallery = JRequest::getVar('flickrGallery'); + if ($flickrGallery) + { + $row->gallery = '{gallery}'.$flickrGallery.'{/gallery}'; + } + + if (isset($files['gallery']) && $files['gallery']['error'] == 0 && !JRequest::getBool('del_gallery')) + { + $handle = new Upload($files['gallery']); + $handle->file_auto_rename = true; + $savepath = JPATH_ROOT.'/media/k2/galleries'; + $handle->allowed = array( + "application/download", + "application/rar", + "application/x-rar-compressed", + "application/arj", + "application/gnutar", + "application/x-bzip", + "application/x-bzip2", + "application/x-compressed", + "application/x-gzip", + "application/x-zip-compressed", + "application/zip", + "multipart/x-zip", + "multipart/x-gzip", + "application/x-unknown", + "application/x-zip" + ); + + if ($handle->uploaded) + { + $handle->Process($savepath); + $handle->Clean(); + + if (JFolder::exists($savepath.'/'.$row->id)) + { + JFolder::delete($savepath.'/'.$row->id); + } + + if (!JArchive::extract($savepath.'/'.$handle->file_dst_name, $savepath.'/'.$row->id)) + { + $application->enqueueMessage(JText::_('K2_GALLERY_UPLOAD_ERROR_CANNOT_EXTRACT_ARCHIVE'), 'error'); + $application->redirect('index.php?option=com_k2&view=items'); + } + else + { + $imageDir = $savepath.'/'.$row->id; + $galleryDir = opendir($imageDir); + while ($filename = readdir($galleryDir)) + { + if ($filename != "." && $filename != "..") + { + $file = str_replace(" ", "_", $filename); + $safefilename = JFile::makeSafe($file); + rename($imageDir.'/'.$filename, $imageDir.'/'.$safefilename); + } + } + closedir($galleryDir); + $row->gallery = '{gallery}'.$row->id.'{/gallery}'; + } + JFile::delete($savepath.'/'.$handle->file_dst_name); + $handle->Clean(); + } + else + { + $application->enqueueMessage($handle->error, 'error'); + $application->redirect('index.php?option=com_k2&view=items'); + } + } + + if (JRequest::getBool('del_gallery')) + { + $current = JTable::getInstance('K2Item', 'Table'); + $current->load($row->id); + + if (JFolder::exists(JPATH_ROOT.'/media/k2/galleries/'.$current->id)) + { + JFolder::delete(JPATH_ROOT.'/media/k2/galleries/'.$current->id); + } + $row->gallery = ''; + } + + // Video + if (!JRequest::getBool('del_video')) + { + if (isset($files['video']) && $files['video']['error'] == 0) + { + $videoExtensions = array( + "flv", + "mp4", + "ogv", + "webm", + "f4v", + "m4v", + "3gp", + "3g2", + "mov", + "mpeg", + "mpg", + "avi", + "wmv", + "divx" + ); + $audioExtensions = array( + "mp3", + "aac", + "m4a", + "ogg", + "wma" + ); + $validExtensions = array_merge($videoExtensions, $audioExtensions); + $filetype = JFile::getExt($files['video']['name']); + + if (!in_array($filetype, $validExtensions)) + { + $application->enqueueMessage(JText::_('K2_INVALID_VIDEO_FILE'), 'error'); + $application->redirect('index.php?option=com_k2&view=items'); + } + + if (in_array($filetype, $videoExtensions)) + { + $savepath = JPATH_ROOT.'/media/k2/videos'; + } + else + { + $savepath = JPATH_ROOT.'/media/k2/audio'; + } + + $filename = JFile::stripExt($files['video']['name']); + + JFile::upload($files['video']['tmp_name'], $savepath.'/'.$row->id.'.'.$filetype); + $filetype = JFile::getExt($files['video']['name']); + $row->video = '{'.$filetype.'}'.$row->id.'{/'.$filetype.'}'; + } + } + else + { + $current = JTable::getInstance('K2Item', 'Table'); + $current->load($row->id); + + preg_match_all("#^{(.*?)}(.*?){#", $current->video, $matches, PREG_PATTERN_ORDER); + $videotype = $matches[1][0]; + $videofile = $matches[2][0]; + + if (in_array($videotype, $videoExtensions)) + { + if (JFile::exists(JPATH_ROOT.'/media/k2/videos/'.$videofile.'.'.$videotype)) + JFile::delete(JPATH_ROOT.'/media/k2/videos/'.$videofile.'.'.$videotype); + } + + if (in_array($videotype, $audioExtensions)) + { + if (JFile::exists(JPATH_ROOT.'/media/k2/audio/'.$videofile.'.'.$videotype)) + JFile::delete(JPATH_ROOT.'/media/k2/audio/'.$videofile.'.'.$videotype); + } + + $row->video = ''; + $row->video_caption = ''; + $row->video_credits = ''; + } + + // Extra fields + $objects = array(); + $variables = JRequest::get('post', 2); + foreach ($variables as $key => $value) + { + if (( bool )JString::stristr($key, 'K2ExtraField_')) + { + $object = new JObject; + $object->set('id', JString::substr($key, 13)); + if (is_string($value)) + { + $value = trim($value); + } + $object->set('value', $value); + unset($object->_errors); + $objects[] = $object; + } + } + + $csvFiles = JRequest::get('files'); + foreach ($csvFiles as $key => $file) + { + if ((bool) JString::stristr($key, 'K2ExtraField_')) + { + $object = new JObject; + $object->set('id', JString::substr($key, 13)); + $csvFile = $file['tmp_name'][0]; + if (!empty($csvFile) && JFile::getExt($file['name'][0]) == 'csv') + { + $handle = @fopen($csvFile, 'r'); + $csvData = array(); + while (($data = fgetcsv($handle, 1000)) !== FALSE) + { + $csvData[] = $data; + } + fclose($handle); + $object->set('value', $csvData); + } + else + { + $object->set('value', json_decode(JRequest::getVar('K2CSV_'.$object->id))); + if (JRequest::getBool('K2ResetCSV_'.$object->id)) + $object->set('value', null); + } + unset($object->_errors); + $objects[] = $object; + } + } + + $row->extra_fields = json_encode($objects); + + require_once(JPATH_COMPONENT_ADMINISTRATOR.'/models/extrafield.php'); + $extraFieldModel = K2Model::getInstance('ExtraField', 'K2Model'); + $row->extra_fields_search = ''; + + foreach ($objects as $object) + { + $row->extra_fields_search .= $extraFieldModel->getSearchValue($object->id, $object->value); + $row->extra_fields_search .= ' '; + } + + // Tags + if ($user->gid < 24 && $params->get('lockTags')) + $params->set('taggingSystem', 0); + $db = JFactory::getDbo(); + $query = "DELETE FROM #__k2_tags_xref WHERE itemID={intval($row->id)}"; + $db->setQuery($query); + $db->query(); + + if ($params->get('taggingSystem')) + { + if ($user->gid < 24 && $params->get('lockTags')) + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + + $tags = JRequest::getVar('tags', NULL, 'POST', 'array'); + if (count($tags)) + { + $tags = array_unique($tags); + foreach ($tags as $tag) + { + + $tag = JString::trim($tag); + if ($tag) + { + $tagID = false; + $K2Tag = JTable::getInstance('K2Tag', 'Table'); + $K2Tag->name = $tag; + // Tag has been filtred and does not exist + if ($K2Tag->check()) + { + $K2Tag->published = 1; + if ($K2Tag->store()) + { + $tagID = $K2Tag->id; + } + } + // Tag has been filtred and exists so try to find it's id + else if ($K2Tag->name) + { + $query = "SELECT id FROM #__k2_tags WHERE name=".$db->Quote($K2Tag->name); + $db->setQuery($query); + $tagID = $db->loadResult(); + } + if ($tagID) + { + $query = "INSERT INTO #__k2_tags_xref (`id`, `tagID`, `itemID`) VALUES (NULL, {intval($tagID)}, {intval($row->id)})"; + $db->setQuery($query); + $db->query(); + } + } + } + } + } + else + { + $tags = JRequest::getVar('selectedTags', NULL, 'POST', 'array'); + if (count($tags)) + { + foreach ($tags as $tagID) + { + $query = "INSERT INTO #__k2_tags_xref (`id`, `tagID`, `itemID`) VALUES (NULL, {intval($tagID)}, {intval($row->id)})"; + $db->setQuery($query); + $db->query(); + } + } + } + + // Check publishing permissions in frontend editing + if ($front) + { + // New items require the "Publish items" permission + if ($isNew && $row->published && !K2HelperPermissions::canPublishItem($row->catid)) + { + $row->published = 0; + $application->enqueueMessage(JText::_('K2_YOU_DONT_HAVE_THE_PERMISSION_TO_PUBLISH_ITEMS'), 'notice'); + } + + // Existing items require either the "Publish items" or the "Allow editing of already published items" permission + if (!$isNew && $row->published) + { + $canEditPublished = $isAlreadyPublished && K2HelperPermissions::canEditPublished($row->catid); + if (!K2HelperPermissions::canPublishItem($row->catid) && (!$canEditPublished)) + { + $row->published = 0; + $application->enqueueMessage(JText::_('K2_YOU_DONT_HAVE_THE_PERMISSION_TO_PUBLISH_ITEMS'), 'notice'); + } + } + + // If any user does not have the permissions to publish an item, + // then they should also not have the permissions to mark the item as featured + if (!K2HelperPermissions::canPublishItem($row->catid)) + { + if ($isNew) + { + $row->featured = 0; + } + else + { + $row->featured = $currentFeaturedState; + } + } + } + + $query = "UPDATE #__k2_items SET video_caption = ".$db->Quote($row->video_caption).", video_credits = ".$db->Quote($row->video_credits).", "; + + if (!is_null($row->video)) + { + $query .= " video = ".$db->Quote($row->video).", "; + } + if (!is_null($row->gallery)) + { + $query .= " gallery = ".$db->Quote($row->gallery).", "; + } + $query .= " extra_fields = ".$db->Quote($row->extra_fields).", extra_fields_search = ".$db->Quote($row->extra_fields_search)." , published = ".$db->Quote($row->published)." WHERE id = ".$row->id; + $db->setQuery($query); + + if (!$db->query()) + { + $application->enqueueMessage($db->getErrorMsg(), 'error'); + $application->redirect('index.php?option=com_k2&view=items'); + } + + $row->checkin(); + + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + + // Trigger K2 plugins + $dispatcher->trigger('onAfterK2Save', array(&$row, $isNew)); + + // Trigger content & finder plugins after the save event + if (K2_JVERSION != '15') + { + $dispatcher->trigger('onContentAfterSave', array('com_k2.item', &$row, $isNew)); + } + else + { + $dispatcher->trigger('onAfterContentSave', array(&$row, $isNew)); + } + $results = $dispatcher->trigger('onFinderAfterSave', array('com_k2.item', $row, $isNew)); + + switch (JRequest::getCmd('task')) + { + case 'apply' : + $msg = JText::_('K2_CHANGES_TO_ITEM_SAVED'); + $link = 'index.php?option=com_k2&view=item&cid='.$row->id; + break; + case 'saveAndNew' : + $msg = JText::_('K2_ITEM_SAVED'); + $link = 'index.php?option=com_k2&view=item'; + break; + case 'save' : + default : + $msg = JText::_('K2_ITEM_SAVED'); + if ($front) + $link = 'index.php?option=com_k2&view=item&task=edit&cid='.$row->id.'&tmpl=component&Itemid='.JRequest::getInt('Itemid'); + else + $link = 'index.php?option=com_k2&view=items'; + break; + } + $application->enqueueMessage($msg); + $application->redirect($link); + } + + function cancel() + { + $application = JFactory::getApplication(); + $cid = JRequest::getInt('id'); + if ($cid) + { + $row = JTable::getInstance('K2Item', 'Table'); + $row->load($cid); + $row->checkin(); + } + else + { + // Cleanup SIGPro + $sigProFolder = JRequest::getCmd('sigProFolder'); + if($sigProFolder && !is_numeric($sigProFolder) && JFolder::exists(JPATH_SITE.'/media/k2/galleries/'.$sigProFolder)) + { + JFolder::delete(JPATH_SITE.'/media/k2/galleries/'.$sigProFolder); + } + } + $application->redirect('index.php?option=com_k2&view=items'); + } + + function getVideoProviders() + { + jimport('joomla.filesystem.file'); + + if (K2_JVERSION != '15') + { + $file = JPATH_PLUGINS.'/content/jw_allvideos/jw_allvideos/includes/sources.php'; + } + else + { + $file = JPATH_PLUGINS.'/content/jw_allvideos/includes/sources.php'; + } + + if (JFile::exists($file)) + { + require $file; + $thirdPartyProviders = array_slice($tagReplace, 40); + $providersTmp = array_keys($thirdPartyProviders); + $providers = array(); + foreach ($providersTmp as $providerTmp) + { + if (stristr($providerTmp, 'google|google.co.uk|google.com.au|google.de|google.es|google.fr|google.it|google.nl|google.pl') !== false) + { + $provider = 'google'; + } + elseif (stristr($providerTmp, 'spike|ifilm') !== false) + { + $provider = 'spike'; + } + else + { + $provider = $providerTmp; + } + $providers[] = $provider; + } + return $providers; + } + else + { + return array(); + } + } + + function download() + { + $application = JFactory::getApplication(); + $user = JFactory::getUser(); + jimport('joomla.filesystem.file'); + $params = JComponentHelper::getParams('com_k2'); + $id = JRequest::getInt('id'); + + // Plugin Events + JPluginHelper::importPlugin('k2'); + $dispatcher = JDispatcher::getInstance(); + + $attachment = JTable::getInstance('K2Attachment', 'Table'); + if ($application->isSite()) + { + $token = JRequest::getVar('id'); + $check = JString::substr($token, JString::strpos($token, '_') + 1); + $hash = version_compare(JVERSION, '3.0', 'ge') ? JApplication::getHash($id) : JUtility::getHash($id); + if ($check != $hash) + { + JError::raiseError(404, JText::_('K2_NOT_FOUND')); + } + } + $attachment->load($id); + + // Frontend editing: Ensure the user has access to the item + if ($application->isSite()) + { + $item = JTable::getInstance('K2Item', 'Table'); + $item->load($attachment->itemID); + $category = JTable::getInstance('K2Category', 'Table'); + $category->load($item->catid); + if (!$item->id || !$category->id) + { + JError::raiseError(404, JText::_('K2_NOT_FOUND')); + } + + if (K2_JVERSION == '15' && ($item->access > $user->get('aid', 0) || $category->access > $user->get('aid', 0))) + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + + if (K2_JVERSION != '15' && (!in_array($category->access, $user->getAuthorisedViewLevels()) || !in_array($item->access, $user->getAuthorisedViewLevels()))) + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + } + + // Trigger K2 plugins + $dispatcher->trigger('onK2BeforeDownload', array(&$attachment, &$params)); + + $path = $params->get('attachmentsFolder', NULL); + if (is_null($path)) + { + $savepath = JPATH_ROOT.'/media/k2/attachments'; + } + else + { + $savepath = $path; + } + $file = $savepath.'/'.$attachment->filename; + + if (JFile::exists($file)) + { + require_once(JPATH_SITE.'/media/k2/assets/vendors/verot/class.upload.php/src/class.upload.php'); + $handle = new Upload($file); + + // Trigger K2 plugins + $dispatcher->trigger('onK2AfterDownload', array(&$attachment, &$params)); + + if ($application->isSite()) + { + $attachment->hit(); + } + $len = filesize($file); + $filename = basename($file); + ob_end_clean(); + JResponse::clearHeaders(); + JResponse::setHeader('Pragma', 'public', true); + JResponse::setHeader('Expires', '0', true); + JResponse::setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true); + JResponse::setHeader('Content-Type', $handle->file_src_mime, true); + JResponse::setHeader('Content-Disposition', 'attachment; filename='.$filename.';', true); + JResponse::setHeader('Content-Transfer-Encoding', 'binary', true); + JResponse::setHeader('Content-Length', $len, true); + JResponse::sendHeaders(); + readfile($file); + } + else + { + echo JText::_('K2_FILE_DOES_NOT_EXIST'); + } + $application->close(); + } + + function getAttachments($itemID) + { + $db = JFactory::getDbo(); + $query = "SELECT * FROM #__k2_attachments WHERE itemID=".(int)$itemID; + $db->setQuery($query); + $rows = $db->loadObjectList(); + foreach ($rows as $row) + { + $hash = version_compare(JVERSION, '3.0', 'ge') ? JApplication::getHash($row->id) : JUtility::getHash($row->id); + $row->link = JRoute::_('index.php?option=com_k2&view=item&task=download&id='.$row->id.'_'.$hash); + } + return $rows; + } + + function deleteAttachment() + { + $application = JFactory::getApplication(); + $params = JComponentHelper::getParams('com_k2'); + jimport('joomla.filesystem.file'); + $id = JRequest::getInt('id'); + $itemID = JRequest::getInt('cid'); + + $db = JFactory::getDbo(); + $query = "SELECT COUNT(*) FROM #__k2_attachments WHERE itemID={$itemID} AND id={$id}"; + $db->setQuery($query); + $result = $db->loadResult(); + + if (!$result) + { + $application->close(); + } + + $row = JTable::getInstance('K2Attachment', 'Table'); + $row->load($id); + + $path = $params->get('attachmentsFolder', NULL); + if (is_null($path)) + { + $savepath = JPATH_ROOT.'/media/k2/attachments'; + } + else + { + $savepath = $path; + } + + if (JFile::exists($savepath.'/'.$row->filename)) + { + JFile::delete($savepath.'/'.$row->filename); + } + + $row->delete($id); + $application->close(); + } + + function getAvailableTags($itemID = NULL) + { + $db = JFactory::getDbo(); + $query = "SELECT * FROM #__k2_tags as tags"; + if (!is_null($itemID)) + $query .= " WHERE tags.id NOT IN (SELECT tagID FROM #__k2_tags_xref WHERE itemID=".(int)$itemID.")"; + $db->setQuery($query); + $rows = $db->loadObjectList(); + return $rows; + } + + function getCurrentTags($itemID) + { + $db = JFactory::getDbo(); + $itemID = (int)$itemID; + $query = "SELECT tags.* FROM #__k2_tags AS tags JOIN #__k2_tags_xref AS xref ON tags.id = xref.tagID WHERE xref.itemID = ".(int)$itemID." ORDER BY xref.id ASC"; + $db->setQuery($query); + $rows = $db->loadObjectList(); + return $rows; + } + + function resetHits() + { + $application = JFactory::getApplication(); + $id = JRequest::getInt('id'); + $db = JFactory::getDbo(); + $query = "UPDATE #__k2_items SET hits=0 WHERE id={$id}"; + $db->setQuery($query); + $db->query(); + if ($application->isAdmin()) + $url = 'index.php?option=com_k2&view=item&cid='.$id; + else + $url = 'index.php?option=com_k2&view=item&task=edit&cid='.$id.'&tmpl=component'; + $application->enqueueMessage(JText::_('K2_SUCCESSFULLY_RESET_ITEM_HITS')); + $application->redirect($url); + } + + function resetRating() + { + $application = JFactory::getApplication(); + $id = JRequest::getInt('id'); + $db = JFactory::getDbo(); + $query = "DELETE FROM #__k2_rating WHERE itemID={$id}"; + $db->setQuery($query); + $db->query(); + if ($application->isAdmin()) + $url = 'index.php?option=com_k2&view=item&cid='.$id; + else + $url = 'index.php?option=com_k2&view=item&task=edit&cid='.$id.'&tmpl=component'; + $application->enqueueMessage(JText::_('K2_SUCCESSFULLY_RESET_ITEM_RATING')); + $application->redirect($url); + } + + function getRating() + { + $id = JRequest::getInt('cid'); + $db = JFactory::getDbo(); + $query = "SELECT * FROM #__k2_rating WHERE itemID={$id}"; + $db->setQuery($query, 0, 1); + $row = $db->loadObject(); + return $row; + } + + function checkSIG() + { + $application = JFactory::getApplication(); + if (K2_JVERSION != '15') + { + $check = JPATH_PLUGINS.'/content/jw_sigpro/jw_sigpro.php'; + } + else + { + $check = JPATH_PLUGINS.'/content/jw_sigpro.php'; + } + if (JFile::exists($check)) + { + return true; + } + else + { + return false; + } + } + + function checkAllVideos() + { + $application = JFactory::getApplication(); + if (K2_JVERSION != '15') + { + $check = JPATH_PLUGINS.'/content/jw_allvideos/jw_allvideos.php'; + } + else + { + $check = JPATH_PLUGINS.'/content/jw_allvideos.php'; + } + if (JFile::exists($check)) + { + return true; + } + else + { + return false; + } + } + + function cleanText($text) + { + if (version_compare(JVERSION, '2.5.0', 'ge')) + { + $text = JComponentHelper::filterText($text); + } + else if (version_compare(JVERSION, '2.5.0', 'lt') && version_compare(JVERSION, '1.6.0', 'ge')) + { + JLoader::register('ContentHelper', JPATH_ADMINISTRATOR.'/components/com_content/helpers/content.php'); + $text = ContentHelper::filterText($text); + } + else + { + $config = JComponentHelper::getParams('com_content'); + $user = JFactory::getUser(); + $gid = $user->get('gid'); + $filterGroups = $config->get('filter_groups'); + + // Convert to array if one group is selected + if ((!is_array($filterGroups) && (int)$filterGroups > 0)) + { + $filterGroups = array($filterGroups); + } + + if (is_array($filterGroups) && in_array($gid, $filterGroups)) + { + $filterType = $config->get('filter_type'); + $filterTags = preg_split('#[,\s]+#', trim($config->get('filter_tags'))); + $filterAttrs = preg_split('#[,\s]+#', trim($config->get('filter_attritbutes'))); + switch ($filterType) + { + case 'NH' : + $filter = new JFilterInput(); + break; + case 'WL' : + $filter = new JFilterInput($filterTags, $filterAttrs, 0, 0, 0); + break; + case 'BL' : + default : + $filter = new JFilterInput($filterTags, $filterAttrs, 1, 1); + break; + } + $text = $filter->clean($text); + } + elseif (empty($filterGroups) && $gid != '25') + { + // No default filtering for super admin (gid=25) + $filter = new JFilterInput( array(), array(), 1, 1); + $text = $filter->clean($text); + } + } + + return $text; + } +} diff --git a/deployed/k2/administrator/components/com_k2/models/item.xml b/deployed/k2/administrator/components/com_k2/models/item.xml new file mode 100644 index 00000000..b07ca5db --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/models/item.xml @@ -0,0 +1,786 @@ + +
    + K2_ITEM_EDIT_FORM + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    diff --git a/deployed/k2/administrator/components/com_k2/models/items.php b/deployed/k2/administrator/components/com_k2/models/items.php new file mode 100644 index 00000000..5a22f92e --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/models/items.php @@ -0,0 +1,1610 @@ +getUserStateFromRequest('global.list.limit', 'limit', $application->getCfg('list_limit'), 'int'); + $limitstart = $application->getUserStateFromRequest($option.$view.'.limitstart', 'limitstart', 0, 'int'); + $filter_order = $application->getUserStateFromRequest($option.$view.'filter_order', 'filter_order', 'i.id', 'cmd'); + $filter_order_Dir = $application->getUserStateFromRequest($option.$view.'filter_order_Dir', 'filter_order_Dir', 'DESC', 'word'); + $filter_trash = $application->getUserStateFromRequest($option.$view.'filter_trash', 'filter_trash', 0, 'int'); + $filter_featured = $application->getUserStateFromRequest($option.$view.'filter_featured', 'filter_featured', -1, 'int'); + $filter_category = $application->getUserStateFromRequest($option.$view.'filter_category', 'filter_category', 0, 'int'); + $filter_author = $application->getUserStateFromRequest($option.$view.'filter_author', 'filter_author', 0, 'int'); + $filter_state = $application->getUserStateFromRequest($option.$view.'filter_state', 'filter_state', -1, 'int'); + $search = $application->getUserStateFromRequest($option.$view.'search', 'search', '', 'string'); + $search = JString::strtolower($search); + $search = trim(preg_replace('/[^\p{L}\p{N}\s\"\-_]/u', '', $search)); + $tag = $application->getUserStateFromRequest($option.$view.'tag', 'tag', 0, 'int'); + $language = $application->getUserStateFromRequest($option.$view.'language', 'language', '', 'string'); + + $query = "SELECT i.*, g.name AS groupname, c.name AS category, v.name AS author, w.name as moderator, u.name AS editor FROM #__k2_items as i"; + + $query .= " LEFT JOIN #__k2_categories AS c ON c.id = i.catid"." LEFT JOIN #__groups AS g ON g.id = i.access"." LEFT JOIN #__users AS u ON u.id = i.checked_out"." LEFT JOIN #__users AS v ON v.id = i.created_by"." LEFT JOIN #__users AS w ON w.id = i.modified_by"; + + if ($params->get('showTagFilter') && $tag) + { + $query .= " LEFT JOIN #__k2_tags_xref AS tags_xref ON tags_xref.itemID = i.id"; + } + + $query .= " WHERE i.trash={$filter_trash}"; + + if ($search) + { + // Detect exact search phrase using double quotes in search string + if(substr($search, 0, 1)=='"' && substr($search, -1)=='"') + { + $exact = true; + } + else + { + $exact = false; + } + + // Now completely strip double quotes + $search = trim(str_replace('"', '', $search)); + + // Escape remaining string + $escaped = K2_JVERSION == '15' ? $db->getEscaped($search, true) : $db->escape($search, true); + + // Full phrase or set of words + if(strpos($escaped, ' ')!==false && !$exact) + { + $escaped=explode(' ', $escaped); + $quoted = array(); + foreach($escaped as $key=>$escapedWord) + { + $quoted[] = $db->Quote('%'.$escapedWord.'%', false); + } + if ($params->get('adminSearch') == 'full') + { + foreach($quoted as $quotedWord) + { + $query .= " AND ( ". + "LOWER(i.title) LIKE ".$quotedWord." ". + "OR LOWER(i.introtext) LIKE ".$quotedWord." ". + "OR LOWER(i.`fulltext`) LIKE ".$quotedWord." ". + "OR LOWER(i.extra_fields_search) LIKE ".$quotedWord." ". + "OR LOWER(i.image_caption) LIKE ".$quotedWord." ". + "OR LOWER(i.image_credits) LIKE ".$quotedWord." ". + "OR LOWER(i.video_caption) LIKE ".$quotedWord." ". + "OR LOWER(i.video_credits) LIKE ".$quotedWord." ". + "OR LOWER(i.metadesc) LIKE ".$quotedWord." ". + "OR LOWER(i.metakey) LIKE ".$quotedWord." ". + " )"; + } + } + else + { + foreach($quoted as $quotedWord) + { + $query .= " AND LOWER(i.title) LIKE ".$quotedWord; + } + } + } + // Single word or exact phrase to search for (wrapped in double quotes in the search block) + else + { + $quoted = $db->Quote('%'.$escaped.'%', false); + + if ($params->get('adminSearch') == 'full') + { + $query .= " AND ( ". + "LOWER(i.title) LIKE ".$quoted." ". + "OR LOWER(i.introtext) LIKE ".$quoted." ". + "OR LOWER(i.`fulltext`) LIKE ".$quoted." ". + "OR LOWER(i.extra_fields_search) LIKE ".$quoted." ". + "OR LOWER(i.image_caption) LIKE ".$quoted." ". + "OR LOWER(i.image_credits) LIKE ".$quoted." ". + "OR LOWER(i.video_caption) LIKE ".$quoted." ". + "OR LOWER(i.video_credits) LIKE ".$quoted." ". + "OR LOWER(i.metadesc) LIKE ".$quoted." ". + "OR LOWER(i.metakey) LIKE ".$quoted." ". + " )"; + } + else + { + $query .= " AND LOWER(i.title) LIKE ".$quoted; + } + } + } + + if ($filter_state > -1) + { + $query .= " AND i.published={$filter_state}"; + } + + if ($filter_featured > -1) + { + $query .= " AND i.featured={$filter_featured}"; + } + + if ($filter_category > 0) + { + if ($params->get('showChildCatItems')) + { + K2Model::addIncludePath(JPATH_SITE.'/components/com_k2/models'); + $itemListModel = K2Model::getInstance('Itemlist', 'K2Model'); + $categories = $itemListModel->getCategoryTree($filter_category); + $sql = @implode(',', $categories); + $query .= " AND i.catid IN ({$sql})"; + } + else + { + $query .= " AND i.catid={$filter_category}"; + } + } + + if ($filter_author > 0) + { + $query .= " AND i.created_by={$filter_author}"; + } + + if ($params->get('showTagFilter') && $tag) + { + $query .= " AND tags_xref.tagID = {$tag}"; + } + + if ($language) + { + $query .= " AND i.language = ".$db->Quote($language); + } + + if ($filter_order == 'i.ordering') + { + $query .= " ORDER BY i.catid, i.ordering {$filter_order_Dir}"; + } + else + { + $query .= " ORDER BY {$filter_order} {$filter_order_Dir} "; + } + + if (K2_JVERSION != '15') + { + $query = JString::str_ireplace('#__groups', '#__viewlevels', $query); + $query = JString::str_ireplace('g.name', 'g.title', $query); + } + + // Plugin Events + JPluginHelper::importPlugin('k2'); + $dispatcher = JDispatcher::getInstance(); + + // Trigger K2 plugins + $dispatcher->trigger('onK2BeforeSetQuery', array(&$query)); + + $db->setQuery($query, $limitstart, $limit); + $rows = $db->loadObjectList(); + return $rows; + } + + function getTotal() + { + $application = JFactory::getApplication(); + $params = JComponentHelper::getParams('com_k2'); + $option = JRequest::getCmd('option'); + $view = JRequest::getCmd('view'); + $db = JFactory::getDbo(); + $filter_trash = $application->getUserStateFromRequest($option.$view.'filter_trash', 'filter_trash', 0, 'int'); + $filter_featured = $application->getUserStateFromRequest($option.$view.'filter_featured', 'filter_featured', -1, 'int'); + $filter_category = $application->getUserStateFromRequest($option.$view.'filter_category', 'filter_category', 0, 'int'); + $filter_author = $application->getUserStateFromRequest($option.$view.'filter_author', 'filter_author', 0, 'int'); + $filter_state = $application->getUserStateFromRequest($option.$view.'filter_state', 'filter_state', -1, 'int'); + $search = $application->getUserStateFromRequest($option.$view.'search', 'search', '', 'string'); + $search = JString::strtolower($search); + $search = trim(preg_replace('/[^\p{L}\p{N}\s\"\-_]/u', '', $search)); + $tag = $application->getUserStateFromRequest($option.$view.'tag', 'tag', 0, 'int'); + $language = $application->getUserStateFromRequest($option.$view.'language', 'language', '', 'string'); + + $query = "SELECT COUNT(*) FROM #__k2_items AS i "; + + if ($params->get('showTagFilter') && $tag) + { + $query .= " LEFT JOIN #__k2_tags_xref AS tags_xref ON tags_xref.itemID = i.id"; + } + + $query .= " WHERE trash={$filter_trash} "; + + if ($search) + { + + // Detect exact search phrase using double quotes in search string + if(substr($search, 0, 1)=='"' && substr($search, -1)=='"') + { + $exact = true; + } + else + { + $exact = false; + } + + // Now completely strip double quotes + $search = trim(str_replace('"', '', $search)); + + // Escape remaining string + $escaped = K2_JVERSION == '15' ? $db->getEscaped($search, true) : $db->escape($search, true); + + // Full phrase or set of words + if(strpos($escaped, ' ')!==false && !$exact) + { + $escaped=explode(' ', $escaped); + $quoted = array(); + foreach($escaped as $key=>$escapedWord) + { + $quoted[] = $db->Quote('%'.$escapedWord.'%', false); + } + if ($params->get('adminSearch') == 'full') + { + foreach($quoted as $quotedWord) + { + $query .= " AND ( ". + "LOWER(i.title) LIKE ".$quotedWord." ". + "OR LOWER(i.introtext) LIKE ".$quotedWord." ". + "OR LOWER(i.`fulltext`) LIKE ".$quotedWord." ". + "OR LOWER(i.extra_fields_search) LIKE ".$quotedWord." ". + "OR LOWER(i.image_caption) LIKE ".$quotedWord." ". + "OR LOWER(i.image_credits) LIKE ".$quotedWord." ". + "OR LOWER(i.video_caption) LIKE ".$quotedWord." ". + "OR LOWER(i.video_credits) LIKE ".$quotedWord." ". + "OR LOWER(i.metadesc) LIKE ".$quotedWord." ". + "OR LOWER(i.metakey) LIKE ".$quotedWord." ". + " )"; + } + } + else + { + foreach($quoted as $quotedWord) + { + $query .= " AND LOWER(i.title) LIKE ".$quotedWord; + } + } + } + // Single word or exact phrase to search for (wrapped in double quotes in the search block) + else + { + $quoted = $db->Quote('%'.$escaped.'%', false); + + if ($params->get('adminSearch') == 'full') + { + $query .= " AND ( ". + "LOWER(i.title) LIKE ".$quoted." ". + "OR LOWER(i.introtext) LIKE ".$quoted." ". + "OR LOWER(i.`fulltext`) LIKE ".$quoted." ". + "OR LOWER(i.extra_fields_search) LIKE ".$quoted." ". + "OR LOWER(i.image_caption) LIKE ".$quoted." ". + "OR LOWER(i.image_credits) LIKE ".$quoted." ". + "OR LOWER(i.video_caption) LIKE ".$quoted." ". + "OR LOWER(i.video_credits) LIKE ".$quoted." ". + "OR LOWER(i.metadesc) LIKE ".$quoted." ". + "OR LOWER(i.metakey) LIKE ".$quoted." ". + " )"; + } + else + { + $query .= " AND LOWER(i.title) LIKE ".$quoted; + } + } + } + + if ($filter_state > -1) + { + $query .= " AND published={$filter_state}"; + } + + if ($filter_featured > -1) + { + $query .= " AND featured={$filter_featured}"; + } + + if ($filter_category > 0) + { + if ($params->get('showChildCatItems')) + { + K2Model::addIncludePath(JPATH_SITE.'/components/com_k2/models'); + $itemListModel = K2Model::getInstance('Itemlist', 'K2Model'); + $categories = $itemListModel->getCategoryTree($filter_category); + $sql = @implode(',', $categories); + $query .= " AND catid IN ({$sql})"; + } + else + { + $query .= " AND catid={$filter_category}"; + } + } + + if ($filter_author > 0) + { + $query .= " AND created_by={$filter_author}"; + } + + if ($params->get('showTagFilter') && $tag) + { + $query .= " AND tags_xref.tagID = {$tag}"; + } + + if ($language) + { + $query .= " AND language = ".$db->Quote($language); + } + + // Plugins Events + JPluginHelper::importPlugin('k2'); + $dispatcher = JDispatcher::getInstance(); + + // Trigger K2 plugins + $dispatcher->trigger('onK2BeforeSetQuery', array(&$query)); + + $db->setQuery($query); + $result = $db->loadResult(); + return $result; + } + + function publish() + { + $application = JFactory::getApplication(); + $cid = JRequest::getVar('cid'); + foreach ($cid as $id) + { + $row = JTable::getInstance('K2Item', 'Table'); + $row->load($id); + $row->published = 1; + $row->store(); + } + + // Plugins Events + JPluginHelper::importPlugin('content'); + JPluginHelper::importPlugin('finder'); + $dispatcher = JDispatcher::getInstance(); + + // Trigger content & finder plugins when state changes + $dispatcher->trigger('onContentChangeState', array('com_k2.item', $cid, 1)); + $dispatcher->trigger('onFinderChangeState', array('com_k2.item', $cid, 1)); + + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + + if(JRequest::getCmd('context') == "modalselector"){ + $application->redirect('index.php?option=com_k2&view=items&tmpl=component&context=modalselector'); + } else { + $application->redirect('index.php?option=com_k2&view=items'); + } + } + + function unpublish() + { + $application = JFactory::getApplication(); + $cid = JRequest::getVar('cid'); + foreach ($cid as $id) + { + $row = JTable::getInstance('K2Item', 'Table'); + $row->load($id); + $row->published = 0; + $row->store(); + } + + // Plugins Events + JPluginHelper::importPlugin('content'); + JPluginHelper::importPlugin('finder'); + $dispatcher = JDispatcher::getInstance(); + + // Trigger content & finder plugins when state changes + $dispatcher->trigger('onContentChangeState', array('com_k2.item', $cid, 0)); + $dispatcher->trigger('onFinderChangeState', array('com_k2.item', $cid, 0)); + + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + + if(JRequest::getCmd('context') == "modalselector"){ + $application->redirect('index.php?option=com_k2&view=items&tmpl=component&context=modalselector'); + } else { + $application->redirect('index.php?option=com_k2&view=items'); + } + } + + function saveorder() + { + $application = JFactory::getApplication(); + $params = JComponentHelper::getParams('com_k2'); + $db = JFactory::getDbo(); + $cid = JRequest::getVar('cid', array(0), 'post', 'array'); + $total = count($cid); + $order = JRequest::getVar('order', array(0), 'post', 'array'); + JArrayHelper::toInteger($order, array(0)); + $groupings = array(); + for ($i = 0; $i < $total; $i++) + { + $row = JTable::getInstance('K2Item', 'Table'); + $row->load((int)$cid[$i]); + $groupings[] = $row->catid; + if ($row->ordering != $order[$i]) + { + $row->ordering = $order[$i]; + if (!$row->store()) + { + JError::raiseError(500, $db->getErrorMsg()); + } + } + } + if (!$params->get('disableCompactOrdering')) + { + $groupings = array_unique($groupings); + foreach ($groupings as $group) + { + $row = JTable::getInstance('K2Item', 'Table'); + $row->reorder('catid = '.(int)$group.' AND trash=0'); + } + } + + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + + return true; + } + + function orderup() + { + $application = JFactory::getApplication(); + $params = JComponentHelper::getParams('com_k2'); + $cid = JRequest::getVar('cid'); + $row = JTable::getInstance('K2Item', 'Table'); + $row->load($cid[0]); + $row->move(-1, 'catid = '.(int)$row->catid.' AND trash=0'); + if (!$params->get('disableCompactOrdering')) + $row->reorder('catid = '.(int)$row->catid.' AND trash=0'); + + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + + $msg = JText::_('K2_NEW_ORDERING_SAVED'); + $application->enqueueMessage($msg); + if(JRequest::getCmd('context') == "modalselector"){ + $application->redirect('index.php?option=com_k2&view=items&tmpl=component&context=modalselector'); + } else { + $application->redirect('index.php?option=com_k2&view=items'); + } + } + + function orderdown() + { + $application = JFactory::getApplication(); + $params = JComponentHelper::getParams('com_k2'); + $cid = JRequest::getVar('cid'); + $row = JTable::getInstance('K2Item', 'Table'); + $row->load($cid[0]); + $row->move(1, 'catid = '.(int)$row->catid.' AND trash=0'); + if (!$params->get('disableCompactOrdering')) + $row->reorder('catid = '.(int)$row->catid.' AND trash=0'); + + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + + $msg = JText::_('K2_NEW_ORDERING_SAVED'); + $application->enqueueMessage($msg); + if(JRequest::getCmd('context') == "modalselector"){ + $application->redirect('index.php?option=com_k2&view=items&tmpl=component&context=modalselector'); + } else { + $application->redirect('index.php?option=com_k2&view=items'); + } + } + + function savefeaturedorder() + { + $application = JFactory::getApplication(); + $params = JComponentHelper::getParams('com_k2'); + $db = JFactory::getDbo(); + $cid = JRequest::getVar('cid', array(0), 'post', 'array'); + $total = count($cid); + $order = JRequest::getVar('order', array(0), 'post', 'array'); + JArrayHelper::toInteger($order, array(0)); + $groupings = array(); + for ($i = 0; $i < $total; $i++) + { + $row = JTable::getInstance('K2Item', 'Table'); + $row->load((int)$cid[$i]); + $groupings[] = $row->catid; + if ($row->featured_ordering != $order[$i]) + { + $row->featured_ordering = $order[$i]; + if (!$row->store()) + { + JError::raiseError(500, $db->getErrorMsg()); + } + } + } + if (!$params->get('disableCompactOrdering')) + { + $groupings = array_unique($groupings); + foreach ($groupings as $group) + { + $row = JTable::getInstance('K2Item', 'Table'); + $row->reorder('featured = 1 AND trash=0', 'featured_ordering'); + } + } + + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + + return true; + } + + function featuredorderup() + { + $application = JFactory::getApplication(); + $params = JComponentHelper::getParams('com_k2'); + $cid = JRequest::getVar('cid'); + $row = JTable::getInstance('K2Item', 'Table'); + $row->load($cid[0]); + $row->move(-1, 'featured=1 AND trash=0', 'featured_ordering'); + if (!$params->get('disableCompactOrdering')) + $row->reorder('featured=1 AND trash=0', 'featured_ordering'); + + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + + $msg = JText::_('K2_NEW_ORDERING_SAVED'); + $application->enqueueMessage($msg); + if(JRequest::getCmd('context') == "modalselector"){ + $application->redirect('index.php?option=com_k2&view=items&tmpl=component&context=modalselector'); + } else { + $application->redirect('index.php?option=com_k2&view=items'); + } + } + + function featuredorderdown() + { + $application = JFactory::getApplication(); + $params = JComponentHelper::getParams('com_k2'); + $cid = JRequest::getVar('cid'); + $row = JTable::getInstance('K2Item', 'Table'); + $row->load($cid[0]); + $row->move(1, 'featured=1 AND trash=0', 'featured_ordering'); + if (!$params->get('disableCompactOrdering')) + $row->reorder('featured=1 AND trash=0', 'featured_ordering'); + + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + + $msg = JText::_('K2_NEW_ORDERING_SAVED'); + $application->enqueueMessage($msg); + if(JRequest::getCmd('context') == "modalselector"){ + $application->redirect('index.php?option=com_k2&view=items&tmpl=component&context=modalselector'); + } else { + $application->redirect('index.php?option=com_k2&view=items'); + } + } + + function accessregistered() + { + $application = JFactory::getApplication(); + $db = JFactory::getDbo(); + $row = JTable::getInstance('K2Item', 'Table'); + $cid = JRequest::getVar('cid'); + $row->load($cid[0]); + $row->access = 1; + if (!$row->check()) + { + return $row->getError(); + } + if (!$row->store()) + { + return $row->getError(); + } + + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + + $msg = JText::_('K2_NEW_ACCESS_SETTING_SAVED'); + $application->enqueueMessage($msg); + $application->redirect('index.php?option=com_k2&view=items'); + } + + function accessspecial() + { + $application = JFactory::getApplication(); + $db = JFactory::getDbo(); + $row = JTable::getInstance('K2Item', 'Table'); + $cid = JRequest::getVar('cid'); + $row->load($cid[0]); + $row->access = 2; + if (!$row->check()) + { + return $row->getError(); + } + if (!$row->store()) + { + return $row->getError(); + } + + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + + $msg = JText::_('K2_NEW_ACCESS_SETTING_SAVED'); + $application->enqueueMessage($msg); + $application->redirect('index.php?option=com_k2&view=items'); + } + + function accesspublic() + { + $application = JFactory::getApplication(); + $db = JFactory::getDbo(); + $row = JTable::getInstance('K2Item', 'Table'); + $cid = JRequest::getVar('cid'); + $row->load($cid[0]); + $row->access = 0; + if (!$row->check()) + { + return $row->getError(); + } + if (!$row->store()) + { + return $row->getError(); + } + + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + + $msg = JText::_('K2_NEW_ACCESS_SETTING_SAVED'); + $application->enqueueMessage($msg); + $application->redirect('index.php?option=com_k2&view=items'); + } + + function copy($batch = false) + { + jimport('joomla.filesystem.file'); + jimport('joomla.filesystem.folder'); + $application = JFactory::getApplication(); + $params = JComponentHelper::getParams('com_k2'); + $itemModel = K2Model::getInstance('Item', 'K2Model'); + $db = JFactory::getDbo(); + $cid = JRequest::getVar('cid'); + JArrayHelper::toInteger($cid); + $row = JTable::getInstance('K2Item', 'Table'); + $copies = array(); + $nullDate = $db->getNullDate(); + + foreach ($cid as $id) + { + // Load source item + $item = JTable::getInstance('K2Item', 'Table'); + $item->load($id); + $item->id = (int)$item->id; + + // Source images + $sourceImage = JPATH_ROOT.'/media/k2/items/src/'.md5("Image".$item->id).'.jpg'; + $sourceImageXS = JPATH_ROOT.'/media/k2/items/cache/'.md5("Image".$item->id).'_XS.jpg'; + $sourceImageS = JPATH_ROOT.'/media/k2/items/cache/'.md5("Image".$item->id).'_S.jpg'; + $sourceImageM = JPATH_ROOT.'/media/k2/items/cache/'.md5("Image".$item->id).'_M.jpg'; + $sourceImageL = JPATH_ROOT.'/media/k2/items/cache/'.md5("Image".$item->id).'_L.jpg'; + $sourceImageXL = JPATH_ROOT.'/media/k2/items/cache/'.md5("Image".$item->id).'_XL.jpg'; + $sourceImageGeneric = JPATH_ROOT.'/media/k2/items/cache/'.md5("Image".$item->id).'_Generic.jpg'; + + // Source gallery + $sourceGallery = JPATH_ROOT.'/media/k2/galleries/'.$item->id; + $sourceGalleryTag = $item->gallery; + + // Source video + preg_match_all("#^{(.*?)}(.*?){#", $item->video, $matches, PREG_PATTERN_ORDER); + $videotype = $matches[1][0]; + $videofile = $matches[2][0]; + + if ($videotype == 'flv' || $videotype == 'swf' || $videotype == 'wmv' || $videotype == 'mov' || $videotype == 'mp4' || $videotype == '3gp' || $videotype == 'divx') + { + if (JFile::exists(JPATH_ROOT.'/media/k2/videos/'.$videofile.'.'.$videotype)) + { + $sourceVideo = $videofile.'.'.$videotype; + //$row->video='{'.$videotype.'}'.$row->id.'{/'.$videotype.'}'; + } + } + + // Source tags + $query = "SELECT * FROM #__k2_tags_xref WHERE itemID={$item->id}"; + $db->setQuery($query); + $sourceTags = $db->loadObjectList(); + + // Source Attachments + $sourceAttachments = $itemModel->getAttachments($item->id); + + // Save target item + $row = JTable::getInstance('K2Item', 'Table'); + $row = $item; + $row->id = NULL; + $row->title = JText::_('K2_COPY_OF').' '.$item->title; + $row->hits = 0; + $row->published = 0; + $datenow = JFactory::getDate(); + $row->created = K2_JVERSION == '15' ? $datenow->toMySQL() : $datenow->toSql(); + $row->modified = $nullDate; + $row->store(); + $copies[] = $row->id; + + // Target images + if (JFile::exists($sourceImage)) + JFile::copy($sourceImage, JPATH_ROOT.'/media/k2/items/src/'.md5("Image".$row->id).'.jpg'); + if (JFile::exists($sourceImageXS)) + JFile::copy($sourceImageXS, JPATH_ROOT.'/media/k2/items/cache/'.md5("Image".$row->id).'_XS.jpg'); + if (JFile::exists($sourceImageS)) + JFile::copy($sourceImageS, JPATH_ROOT.'/media/k2/items/cache/'.md5("Image".$row->id).'_S.jpg'); + if (JFile::exists($sourceImageM)) + JFile::copy($sourceImageM, JPATH_ROOT.'/media/k2/items/cache/'.md5("Image".$row->id).'_M.jpg'); + if (JFile::exists($sourceImageL)) + JFile::copy($sourceImageL, JPATH_ROOT.'/media/k2/items/cache/'.md5("Image".$row->id).'_L.jpg'); + if (JFile::exists($sourceImageXL)) + JFile::copy($sourceImageXL, JPATH_ROOT.'/media/k2/items/cache/'.md5("Image".$row->id).'_XL.jpg'); + if (JFile::exists($sourceImageGeneric)) + JFile::copy($sourceImageGeneric, JPATH_ROOT.'/media/k2/items/cache/'.md5("Image".$row->id).'_Generic.jpg'); + + // Target gallery + if ($sourceGalleryTag) + { + if (JString::strpos($sourceGalleryTag, 'http://') || JString::strpos($sourceGalleryTag, 'https://')) + { + $row->gallery = $sourceGalleryTag; + } + else + { + $row->gallery = '{gallery}'.$row->id.'{/gallery}'; + if (JFolder::exists($sourceGallery)) + { + JFolder::copy($sourceGallery, JPATH_ROOT.'/media/k2/galleries/'.$row->id); + } + } + } + + // Target video + if (isset($sourceVideo) && JFile::exists(JPATH_ROOT.'/media/k2/videos/'.$sourceVideo)) + { + JFile::copy(JPATH_ROOT.'/media/k2/videos/'.$sourceVideo, JPATH_ROOT.'/media/k2/videos/'.$row->id.'.'.$videotype); + $row->video = '{'.$videotype.'}'.$row->id.'{/'.$videotype.'}'; + } + + // Target attachments + $path = $params->get('attachmentsFolder', NULL); + if (is_null($path)) + $savepath = JPATH_ROOT.'/media/k2/attachments'; + else + $savepath = $path; + + foreach ($sourceAttachments as $attachment) + { + if (JFile::exists($savepath.'/'.$attachment->filename)) + { + JFile::copy($savepath.'/'.$attachment->filename, $savepath.'/'.$row->id.'_'.$attachment->filename); + $attachmentRow = JTable::getInstance('K2Attachment', 'Table'); + $attachmentRow->itemID = $row->id; + $attachmentRow->title = $attachment->title; + $attachmentRow->titleAttribute = $attachment->titleAttribute; + $attachmentRow->filename = $row->id.'_'.$attachment->filename; + $attachmentRow->hits = 0; + $attachmentRow->store(); + } + } + + // Target tags + foreach ($sourceTags as $tag) + { + $query = "INSERT INTO #__k2_tags_xref (`id`, `tagID`, `itemID`) VALUES (NULL, {intval($tag->tagID)}, {intval($row->id)})"; + $db->setQuery($query); + $db->query(); + } + + $row->store(); + } + if($batch) { + return $copies; + } else { + $application->enqueueMessage(JText::_('K2_COPY_COMPLETED')); + $application->redirect('index.php?option=com_k2&view=items'); + } + } + + function featured() + { + $application = JFactory::getApplication(); + $db = JFactory::getDbo(); + $cid = JRequest::getVar('cid'); + foreach ($cid as $id) + { + $row = JTable::getInstance('K2Item', 'Table'); + $row->load($id); + if ($row->featured == 1) + $row->featured = 0; + else + { + $row->featured = 1; + $row->featured_ordering = 1; + } + $row->store(); + } + + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + + $application->enqueueMessage(JText::_('K2_ITEMS_CHANGED')); + if(JRequest::getCmd('context') == "modalselector"){ + $application->redirect('index.php?option=com_k2&view=items&tmpl=component&context=modalselector'); + } else { + $application->redirect('index.php?option=com_k2&view=items'); + } + } + + function trash() + { + $application = JFactory::getApplication(); + $db = JFactory::getDbo(); + $cid = JRequest::getVar('cid'); + JArrayHelper::toInteger($cid); + foreach ($cid as $id) + { + $row = JTable::getInstance('K2Item', 'Table'); + $row->load($id); + $row->trash = 1; + $row->store(); + } + + // Plugins Events + JPluginHelper::importPlugin('content'); + JPluginHelper::importPlugin('finder'); + $dispatcher = JDispatcher::getInstance(); + + // Trigger content & finder plugins when state changes + $dispatcher->trigger('onContentChangeState', array('com_k2.item', $cid, -2)); + $dispatcher->trigger('onFinderChangeState', array('com_k2.item', $cid, 0)); + + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + + $application->enqueueMessage(JText::_('K2_ITEMS_MOVED_TO_TRASH')); + $application->redirect('index.php?option=com_k2&view=items'); + } + + function restore() + { + $application = JFactory::getApplication(); + $db = JFactory::getDbo(); + $cid = JRequest::getVar('cid'); + $warning = false; + foreach ($cid as $id) + { + $row = JTable::getInstance('K2Item', 'Table'); + $row->load($id); + $query = "SELECT COUNT(*) FROM #__k2_categories WHERE id=".(int)$row->catid." AND trash = 0"; + $db->setQuery($query); + $result = $db->loadResult(); + if ($result) + { + $row->trash = 0; + $row->store(); + } + else + { + $warning = true; + } + + } + + // Plugins Events + JPluginHelper::importPlugin('content'); + JPluginHelper::importPlugin('finder'); + $dispatcher = JDispatcher::getInstance(); + + // Trigger content & finder plugins when state changes + $dispatcher->trigger('onContentChangeState', array('com_k2.item', $cid, $row->published)); + $dispatcher->trigger('onFinderChangeState', array('com_k2.item', $cid, 1)); + + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + + if ($warning) + $application->enqueueMessage(JText::_('K2_SOME_OF_THE_ITEMS_HAVE_NOT_BEEN_RESTORED_BECAUSE_THEY_BELONG_TO_A_CATEGORY_WHICH_IS_IN_TRASH'), 'notice'); + $application->enqueueMessage(JText::_('K2_ITEMS_RESTORED')); + $application->redirect('index.php?option=com_k2&view=items'); + } + + function remove() + { + jimport('joomla.filesystem.file'); + jimport('joomla.filesystem.folder'); + $application = JFactory::getApplication(); + $params = JComponentHelper::getParams('com_k2'); + $itemModel = K2Model::getInstance('Item', 'K2Model'); + $db = JFactory::getDbo(); + $cid = JRequest::getVar('cid'); + + // Plugin Events + JPluginHelper::importPlugin('content'); + JPluginHelper::importPlugin('finder'); + $dispatcher = JDispatcher::getInstance(); + + foreach ($cid as $id) + { + $row = JTable::getInstance('K2Item', 'Table'); + $row->load($id); + $row->id = (int)$row->id; + + // Delete images + if (JFile::exists(JPATH_ROOT.'/media/k2/items/src/'.md5("Image".$row->id).'.jpg')) + { + JFile::delete(JPATH_ROOT.'/media/k2/items/src/'.md5("Image".$row->id).'.jpg'); + } + if (JFile::exists(JPATH_ROOT.'/media/k2/items/cache/'.md5("Image".$row->id).'_XS.jpg')) + { + JFile::delete(JPATH_ROOT.'/media/k2/items/cache/'.md5("Image".$row->id).'_XS.jpg'); + } + if (JFile::exists(JPATH_ROOT.'/media/k2/items/cache/'.md5("Image".$row->id).'_S.jpg')) + { + JFile::delete(JPATH_ROOT.'/media/k2/items/cache/'.md5("Image".$row->id).'_S.jpg'); + } + if (JFile::exists(JPATH_ROOT.'/media/k2/items/cache/'.md5("Image".$row->id).'_M.jpg')) + { + JFile::delete(JPATH_ROOT.'/media/k2/items/cache/'.md5("Image".$row->id).'_M.jpg'); + } + if (JFile::exists(JPATH_ROOT.'/media/k2/items/cache/'.md5("Image".$row->id).'_L.jpg')) + { + JFile::delete(JPATH_ROOT.'/media/k2/items/cache/'.md5("Image".$row->id).'_L.jpg'); + } + if (JFile::exists(JPATH_ROOT.'/media/k2/items/cache/'.md5("Image".$row->id).'_XL.jpg')) + { + JFile::delete(JPATH_ROOT.'/media/k2/items/cache/'.md5("Image".$row->id).'_XL.jpg'); + } + if (JFile::exists(JPATH_ROOT.'/media/k2/items/cache/'.md5("Image".$row->id).'_Generic.jpg')) + { + JFile::delete(JPATH_ROOT.'/media/k2/items/cache/'.md5("Image".$row->id).'_Generic.jpg'); + } + + // Delete gallery + if (JFolder::exists(JPATH_ROOT.'/media/k2/galleries/'.$row->id)) + JFolder::delete(JPATH_ROOT.'/media/k2/galleries/'.$row->id); + + // Delete video + preg_match_all("#^{(.*?)}(.*?){#", $row->video, $matches, PREG_PATTERN_ORDER); + $videotype = $matches[1][0]; + $videofile = $matches[2][0]; + + $videoExtensions = array( + 'flv', + 'mp4', + 'ogv', + 'webm', + 'f4v', + 'm4v', + '3gp', + '3g2', + 'mov', + 'mpeg', + 'mpg', + 'avi', + 'wmv', + 'divx', + 'swf' + ); + $audioExtensions = array( + 'mp3', + 'aac', + 'mp4', + 'ogg', + 'wma' + ); + + if (in_array($videotype, $videoExtensions) || in_array($videotype, $audioExtensions)) + { + if (JFile::exists(JPATH_ROOT.'/media/k2/videos/'.$videofile.'.'.$videotype)) + JFile::delete(JPATH_ROOT.'/media/k2/videos/'.$videofile.'.'.$videotype); + + if (JFile::exists(JPATH_ROOT.'/media/k2/audio/'.$videofile.'.'.$videotype)) + JFile::delete(JPATH_ROOT.'/media/k2/audio/'.$videofile.'.'.$videotype); + } + + // Delete attachments + $path = $params->get('attachmentsFolder', NULL); + if (is_null($path)) + $savepath = JPATH_ROOT.'/media/k2/attachments'; + else + $savepath = $path; + + $attachments = $itemModel->getAttachments($row->id); + + foreach ($attachments as $attachment) + { + if (JFile::exists($savepath.'/'.$attachment->filename)) + JFile::delete($savepath.'/'.$attachment->filename); + } + + $query = "DELETE FROM #__k2_attachments WHERE itemID={$row->id}"; + $db->setQuery($query); + $db->query(); + + // Delete tags + $query = "DELETE FROM #__k2_tags_xref WHERE itemID={$row->id}"; + $db->setQuery($query); + $db->query(); + + // Delete comments + $query = "DELETE FROM #__k2_comments WHERE itemID={$row->id}"; + $db->setQuery($query); + $db->query(); + + $row->delete($id); + + // Trigger content & finder plugins after the delete event + $dispatcher->trigger('onContentAfterDelete', array('com_k2.item', $row)); + $dispatcher->trigger('onFinderAfterDelete', array('com_k2.item', $row)); + } + + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + + $application->enqueueMessage(JText::_('K2_DELETE_COMPLETED')); + $application->redirect('index.php?option=com_k2&view=items'); + } + + function import() + { + $application = JFactory::getApplication(); + jimport('joomla.filesystem.file'); + $db = JFactory::getDbo(); + $query = "SELECT * FROM #__sections"; + $db->setQuery($query); + $sections = $db->loadObjectList(); + + $query = "SELECT COUNT(*) FROM #__k2_items"; + $db->setQuery($query); + $result = $db->loadResult(); + if ($result) + $preserveItemIDs = false; + else + $preserveItemIDs = true; + + $xml = new JSimpleXML; + $xml->loadFile(JPATH_COMPONENT.'/models/category.xml'); + $categoryParams = class_exists('JParameter') ? new JParameter('') : new JRegistry(''); + + foreach ($xml->document->params as $paramGroup) + { + foreach ($paramGroup->param as $param) + { + if ($param->attributes('type') != 'spacer' && $param->attributes('name')) + { + $categoryParams->set($param->attributes('name'), $param->attributes('default')); + } + } + } + $categoryParams = $categoryParams->toString(); + + $xml = new JSimpleXML; + $xml->loadFile(JPATH_COMPONENT.'/models/item.xml'); + $itemParams = class_exists('JParameter') ? new JParameter('') : new JRegistry(''); + + foreach ($xml->document->params as $paramGroup) + { + foreach ($paramGroup->param as $param) + { + if ($param->attributes('type') != 'spacer' && $param->attributes('name')) + { + $itemParams->set($param->attributes('name'), $param->attributes('default')); + } + } + } + $itemParams = $itemParams->toString(); + + $query = "SELECT id, name FROM #__k2_tags"; + $db->setQuery($query); + $tags = $db->loadObjectList(); + + if (is_null($tags)) + $tags = array(); + + foreach ($sections as $section) + { + $K2Category = JTable::getInstance('K2Category', 'Table'); + $K2Category->name = $section->title; + $K2Category->alias = $section->title; + $K2Category->description = $section->description; + $K2Category->parent = 0; + $K2Category->published = $section->published; + $K2Category->access = $section->access; + $K2Category->ordering = $section->ordering; + $K2Category->image = $section->image; + $K2Category->trash = 0; + $K2Category->params = $categoryParams; + $K2Category->check(); + $K2Category->store(); + if (JFile::exists(JPATH_SITE.'/images/stories/'.$section->image)) + { + JFile::copy(JPATH_SITE.'/images/stories/'.$section->image, JPATH_SITE.'/media/k2/categories/'.$K2Category->image); + } + $query = "SELECT * FROM #__categories WHERE section = ".(int)$section->id; + $db->setQuery($query); + $categories = $db->loadObjectList(); + + foreach ($categories as $category) + { + $K2Subcategory = JTable::getInstance('K2Category', 'Table'); + $K2Subcategory->name = $category->title; + $K2Subcategory->alias = $category->title; + $K2Subcategory->description = $category->description; + $K2Subcategory->parent = $K2Category->id; + $K2Subcategory->published = $category->published; + $K2Subcategory->access = $category->access; + $K2Subcategory->ordering = $category->ordering; + $K2Subcategory->image = $category->image; + $K2Subcategory->trash = 0; + $K2Subcategory->params = $categoryParams; + $K2Subcategory->check(); + $K2Subcategory->store(); + if (JFile::exists(JPATH_SITE.'/images/stories/'.$category->image)) + { + JFile::copy(JPATH_SITE.'/images/stories/'.$category->image, JPATH_SITE.'/media/k2/categories/'.$K2Subcategory->image); + } + + $query = "SELECT article.*, xref.content_id + FROM #__content AS article + LEFT JOIN #__content_frontpage AS xref ON article.id = xref.content_id + WHERE catid = ".(int)$category->id; + $db->setQuery($query); + $items = $db->loadObjectList(); + + foreach ($items as $item) + { + + $K2Item = JTable::getInstance('K2Item', 'Table'); + $K2Item->title = $item->title; + $K2Item->alias = $item->title; + $K2Item->catid = $K2Subcategory->id; + if ($item->state < 0) + { + $K2Item->trash = 1; + } + else + { + $K2Item->trash = 0; + $K2Item->published = $item->state; + } + $K2Item->featured = ($item->content_id) ? 1 : 0; + $K2Item->introtext = $item->introtext; + $K2Item->fulltext = $item->fulltext; + $K2Item->created = $item->created; + $K2Item->created_by = $item->created_by; + $K2Item->created_by_alias = $item->created_by_alias; + $K2Item->modified = $item->modified; + $K2Item->modified_by = $item->modified_by; + $K2Item->publish_up = $item->publish_up; + $K2Item->publish_down = $item->publish_down; + $K2Item->access = $item->access; + $K2Item->ordering = $item->ordering; + $K2Item->hits = $item->hits; + $K2Item->metadesc = $item->metadesc; + $K2Item->metadata = $item->metadata; + $K2Item->metakey = $item->metakey; + $K2Item->params = $itemParams; + $K2Item->check(); + if ($preserveItemIDs) + { + $K2Item->id = $item->id; + $db->insertObject('#__k2_items', $K2Item); + } + else + { + $K2Item->store(); + } + + if (!empty($item->metakey)) + { + $itemTags = explode(',', $item->metakey); + foreach ($itemTags as $itemTag) + { + $itemTag = JString::trim($itemTag); + if (in_array($itemTag, JArrayHelper::getColumn($tags, 'name'))) + { + $query = "SELECT id FROM #__k2_tags WHERE name=".$db->Quote($itemTag); + $db->setQuery($query); + $id = $db->loadResult(); + $query = "INSERT INTO #__k2_tags_xref (`id`, `tagID`, `itemID`) VALUES (NULL, {$id}, {$K2Item->id})"; + $db->setQuery($query); + $db->query(); + } + else + { + $K2Tag = JTable::getInstance('K2Tag', 'Table'); + $K2Tag->name = $itemTag; + $K2Tag->published = 1; + $K2Tag->store(); + $tags[] = $K2Tag; + $query = "INSERT INTO #__k2_tags_xref (`id`, `tagID`, `itemID`) VALUES (NULL, {$K2Tag->id}, {$K2Item->id})"; + $db->setQuery($query); + $db->query(); + } + } + } + } + } + } + + // Handle uncategorized articles + $query = "SELECT * FROM #__content WHERE sectionid = 0"; + $db->setQuery($query); + $items = $db->loadObjectList(); + + if ($items) + { + $K2Uncategorised = JTable::getInstance('K2Category', 'Table'); + $K2Uncategorised->name = 'Uncategorized'; + $K2Uncategorised->alias = 'Uncategorized'; + $K2Uncategorised->parent = 0; + $K2Uncategorised->published = 1; + $K2Uncategorised->access = 0; + $K2Uncategorised->ordering = 0; + $K2Uncategorised->trash = 0; + $K2Uncategorised->params = $categoryParams; + $K2Uncategorised->check(); + $K2Uncategorised->store(); + + foreach ($items as $item) + { + + $K2Item = JTable::getInstance('K2Item', 'Table'); + $K2Item->title = $item->title; + $K2Item->alias = $item->title; + $K2Item->catid = $K2Uncategorised->id; + if ($item->state < 0) + { + $K2Item->trash = 1; + } + else + { + $K2Item->trash = 0; + $K2Item->published = $item->state; + } + $K2Item->introtext = $item->introtext; + $K2Item->fulltext = $item->fulltext; + $K2Item->created = $item->created; + $K2Item->created_by = $item->created_by; + $K2Item->created_by_alias = $item->created_by_alias; + $K2Item->modified = $item->modified; + $K2Item->modified_by = $item->modified_by; + $K2Item->publish_up = $item->publish_up; + $K2Item->publish_down = $item->publish_down; + $K2Item->access = $item->access; + $K2Item->ordering = $item->ordering; + $K2Item->hits = $item->hits; + $K2Item->metadesc = $item->metadesc; + $K2Item->metadata = $item->metadata; + $K2Item->metakey = $item->metakey; + $K2Item->params = $itemParams; + $K2Item->check(); + if ($preserveItemIDs) + { + $K2Item->id = $item->id; + $db->insertObject('#__k2_items', $K2Item); + } + else + { + $K2Item->store(); + } + + if (!empty($item->metakey)) + { + $itemTags = explode(',', $item->metakey); + foreach ($itemTags as $itemTag) + { + $itemTag = JString::trim($itemTag); + if (in_array($itemTag, JArrayHelper::getColumn($tags, 'name'))) + { + $query = "SELECT id FROM #__k2_tags WHERE name=".$db->Quote($itemTag); + $db->setQuery($query); + $id = $db->loadResult(); + $query = "INSERT INTO #__k2_tags_xref (`id`, `tagID`, `itemID`) VALUES (NULL, {$id}, {$K2Item->id})"; + $db->setQuery($query); + $db->query(); + } + else + { + $K2Tag = JTable::getInstance('K2Tag', 'Table'); + $K2Tag->name = $itemTag; + $K2Tag->published = 1; + $K2Tag->store(); + $tags[] = $K2Tag; + $query = "INSERT INTO #__k2_tags_xref (`id`, `tagID`, `itemID`) VALUES (NULL, {$K2Tag->id}, {$K2Item->id})"; + $db->setQuery($query); + $db->query(); + } + } + } + } + } + $application->enqueueMessage(JText::_('K2_IMPORT_COMPLETED')); + $application->redirect('index.php?option=com_k2&view=items'); + } + + function importJ16() + { + jimport('joomla.filesystem.file'); + jimport('joomla.html.parameter'); + jimport('joomla.utilities.xmlelement'); + $application = JFactory::getApplication(); + $db = JFactory::getDbo(); + + $query = "SELECT COUNT(*) FROM #__k2_categories"; + $db->setQuery($query); + $result = $db->loadResult(); + if ($result) + { + $preserveCategoryIDs = false; + } + else + { + $preserveCategoryIDs = true; + } + + $query = "SELECT COUNT(*) FROM #__k2_items"; + $db->setQuery($query); + $result = $db->loadResult(); + if ($result) + { + $preserveItemIDs = false; + } + else + { + $preserveItemIDs = true; + } + $xml = new JXMLElement(JFile::read(JPATH_COMPONENT.'/models/category.xml')); + $categoryParams = class_exists('JParameter') ? new JParameter('') : new JRegistry(''); + foreach ($xml->params as $paramGroup) + { + foreach ($paramGroup->param as $param) + { + if ((string)$param->attributes()->type != 'spacer' && (string)$param->attributes()->name) + { + $categoryParams->set((string)$param->attributes()->name, (string)$param->attributes()->default); + } + } + } + $categoryParams = $categoryParams->toString(); + + $xml = new JXMLElement(JFile::read(JPATH_COMPONENT.'/models/item.xml')); + $itemParams = class_exists('JParameter') ? new JParameter('') : new JRegistry(''); + foreach ($xml->params as $paramGroup) + { + foreach ($paramGroup->param as $param) + { + if ((string)$param->attributes()->type != 'spacer' && (string)$param->attributes()->name) + { + $itemParams->set((string)$param->attributes()->name, (string)$param->attributes()->default); + } + } + } + $itemParams = $itemParams->toString(); + + $query = "SELECT id, name FROM #__k2_tags"; + $db->setQuery($query); + $tags = $db->loadObjectList(); + + if (is_null($tags)) + $tags = array(); + + $query = "SELECT * FROM #__categories WHERE extension = 'com_content'"; + $db->setQuery($query); + $categories = $db->loadObjectList(); + $mapping = array(); + foreach ($categories as $category) + { + $category->params = json_decode($category->params); + $category->image = $category->params->image; + $K2Category = JTable::getInstance('K2Category', 'Table'); + $K2Category->name = $category->title; + $K2Category->alias = $category->title; + $K2Category->description = $category->description; + $K2Category->parent = $category->parent_id; + if ($K2Category->parent == 1) + { + $K2Category->parent = 0; + } + $K2Category->published = $category->published; + $K2Category->access = $category->access; + $K2Category->ordering = $K2Category->getNextOrder('parent='.(int)$category->parent_id); + $K2Category->image = basename($category->image); + $K2Category->trash = 0; + $K2Category->language = $category->language; + $K2Category->params = $categoryParams; + $K2Category->check(); + if ($preserveCategoryIDs) + { + $K2Category->id = $category->id; + $db->insertObject('#__k2_categories', $K2Category); + } + else + { + $K2Category->store(); + $mapping[$category->id] = $K2Category->id; + } + + if ($K2Category->image && JFile::exists(realpath(JPATH_SITE.'/'.$category->image))) + { + JFile::copy(realpath(JPATH_SITE.'/'.$category->image), JPATH_SITE.'/media/k2/categories/'.$K2Category->image); + } + $query = "SELECT article.*, xref.content_id + FROM #__content AS article + LEFT JOIN #__content_frontpage AS xref ON article.id = xref.content_id + WHERE catid = ".(int)$category->id; + $db->setQuery($query); + $items = $db->loadObjectList(); + + foreach ($items as $item) + { + $K2Item = JTable::getInstance('K2Item', 'Table'); + $K2Item->title = $item->title; + $K2Item->alias = $item->title; + $K2Item->catid = $K2Category->id; + if ($item->state < 0) + { + $K2Item->trash = 1; + } + else + { + $K2Item->trash = 0; + } + $K2Item->published = 1; + if ($item->state == 0) + { + $K2Item->published = 0; + } + $K2Item->featured = ($item->content_id) ? 1 : 0; + $K2Item->introtext = $item->introtext; + $K2Item->fulltext = $item->fulltext; + $K2Item->created = $item->created; + $K2Item->created_by = $item->created_by; + $K2Item->created_by_alias = $item->created_by_alias; + $K2Item->modified = $item->modified; + $K2Item->modified_by = $item->modified_by; + $K2Item->publish_up = $item->publish_up; + $K2Item->publish_down = $item->publish_down; + $K2Item->access = $item->access; + $K2Item->ordering = $item->ordering; + $K2Item->hits = $item->hits; + $K2Item->metadesc = $item->metadesc; + $K2Item->metadata = $item->metadata; + $K2Item->metakey = $item->metakey; + $K2Item->params = $itemParams; + $K2Item->language = $item->language; + $K2Item->check(); + + if ($preserveItemIDs) + { + $K2Item->id = $item->id; + $db->insertObject('#__k2_items', $K2Item); + } + else + { + $K2Item->store(); + } + + $item->tags = array(); + if(class_exists('JHelperTags')) { + $tagsHelper = new JHelperTags; + $tagsHelper->getItemTags('com_content.article', $item->id); + $tags = $tagsHelper->itemTags; + foreach($tags as $tag) { + $item->tags[] = $tag->title; + } + } + + if (!empty($item->metakey) || count($item->tags)) + { + $itemTags = array_merge(explode(',', $item->metakey), $item->tags); + $itemTags = array_filter($itemTags); + $itemTags = array_unique($itemTags); + foreach ($itemTags as $itemTag) + { + $itemTag = JString::trim($itemTag); + if($itemTag) + { + if (in_array($itemTag, JArrayHelper::getColumn($tags, 'name'))) + { + + $query = "SELECT id FROM #__k2_tags WHERE name=".$db->Quote($itemTag); + $db->setQuery($query); + $id = $db->loadResult(); + if($id) + { + $query = "INSERT INTO #__k2_tags_xref (`id`, `tagID`, `itemID`) VALUES (NULL, {$id}, {$K2Item->id})"; + $db->setQuery($query); + $db->query(); + } + } + else + { + $K2Tag = JTable::getInstance('K2Tag', 'Table'); + $K2Tag->name = $itemTag; + $K2Tag->published = 1; + $K2Tag->store(); + $tags[] = $K2Tag; + $query = "INSERT INTO #__k2_tags_xref (`id`, `tagID`, `itemID`) VALUES (NULL, {$K2Tag->id}, {$K2Item->id})"; + $db->setQuery($query); + $db->query(); + } + } + } + } + } + } + + foreach ($mapping as $oldID => $newID) + { + $query = "UPDATE #__k2_categories SET parent=".$newID." WHERE parent=".$oldID; + $db->setQuery($query); + $db->query(); + } + $application->enqueueMessage(JText::_('K2_IMPORT_COMPLETED')); + $application->redirect('index.php?option=com_k2&view=items'); + } + + function getItemsAuthors() + { + $db = $this->getDBO(); + $query = "SELECT id, name, block FROM #__users WHERE id IN(SELECT DISTINCT(created_by) FROM #__k2_items) ORDER BY name"; + $db->setQuery($query); + $rows = $db->loadObjectList(); + return $rows; + } + + function saveBatch() + { + $application = JFactory::getApplication(); + $cid = JRequest::getVar('cid'); + $batchMode = JRequest::getCmd('batchMode'); + $catid = JRequest::getInt('batchCategory'); + $access = JRequest::getCmd('batchAccess'); + $author = JRequest::getInt('batchAuthor'); + $language = JRequest::getVar('batchLanguage'); + if($batchMode == 'clone'){ + $cid = $this->copy(true); + } + foreach ($cid as $id) + { + $row = JTable::getInstance('K2Item', 'Table'); + $row->load($id); + if($catid) + { + $row->catid = $catid; + $row->ordering = $row->getNextOrder('catid = '.(int)$row->catid.' AND published = 1'); + } + if($access) + { + $row->access = $access; + } + if($author) + { + $row->created_by = $author; + $row->created_by_alias = ''; + } + if($language) + { + $row->language = $language; + } + $row->store(); + } + + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + + $application->enqueueMessage(JText::_('K2_BATCH_COMPLETED')); + $application->redirect('index.php?option=com_k2&view=items'); + } +} diff --git a/deployed/k2/administrator/components/com_k2/models/model.php b/deployed/k2/administrator/components/com_k2/models/model.php new file mode 100644 index 00000000..7b1aa5d4 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/models/model.php @@ -0,0 +1,37 @@ +loadByOption('com_k2'); + $post = JRequest::get('post'); + $component->bind($post); + if (!$component->check()) + { + $application->enqueueMessage($component->getError(), 'error'); + return false; + } + if (!$component->store()) + { + $application->enqueueMessage($component->getError(), 'error'); + return false; + } + return true; + } + + function & getParams() + { + static $instance; + if ($instance == null) + { + $component = JTable::getInstance('component'); + $component->loadByOption('com_k2'); + $instance = new JParameter($component->params, JPATH_ADMINISTRATOR.'/components/com_k2/config.xml'); + } + return $instance; + } + +} diff --git a/deployed/k2/administrator/components/com_k2/models/tag.php b/deployed/k2/administrator/components/com_k2/models/tag.php new file mode 100644 index 00000000..0b6b5899 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/models/tag.php @@ -0,0 +1,157 @@ +load($cid); + return $row; + } + + function save() + { + + $application = JFactory::getApplication(); + $row = JTable::getInstance('K2Tag', 'Table'); + + if (!$row->bind(JRequest::get('post'))) + { + $application->enqueueMessage($row->getError(), 'error'); + $application->redirect('index.php?option=com_k2&view=tags'); + } + + if (!$row->check()) + { + $application->enqueueMessage($row->getError(), 'error'); + $application->redirect('index.php?option=com_k2&view=tag&cid='.$row->id); + } + + if (!$row->store()) + { + $application->enqueueMessage($row->getError(), 'error'); + $application->redirect('index.php?option=com_k2&view=tags'); + } + + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + + switch(JRequest::getCmd('task')) + { + case 'apply' : + $msg = JText::_('K2_CHANGES_TO_TAG_SAVED'); + $link = 'index.php?option=com_k2&view=tag&cid='.$row->id; + break; + case 'save' : + default : + $msg = JText::_('K2_TAG_SAVED'); + $link = 'index.php?option=com_k2&view=tags'; + break; + } + $application->enqueueMessage($msg); + $application->redirect($link); + } + + function addTag() + { + + $application = JFactory::getApplication(); + + $user = JFactory::getUser(); + $params = JComponentHelper::getParams('com_k2'); + if ($user->gid < 24 && $params->get('lockTags')) + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + + $tag = JRequest::getString('tag'); + $tag = str_replace('-', '', $tag); + $tag = str_replace('.', '', $tag); + + $response = new JObject; + $response->set('name', $tag); + + if (empty($tag)) + { + $response->set('msg', JText::_('K2_YOU_NEED_TO_ENTER_A_TAG', true)); + echo json_encode($response); + $application->close(); + } + + $db = JFactory::getDbo(); + $query = "SELECT COUNT(*) FROM #__k2_tags WHERE name=".$db->Quote($tag); + $db->setQuery($query); + $result = $db->loadResult(); + + if ($result > 0) + { + $response->set('msg', JText::_('K2_TAG_ALREADY_EXISTS', true)); + echo json_encode($response); + $application->close(); + } + + $row = JTable::getInstance('K2Tag', 'Table'); + $row->name = $tag; + $row->published = 1; + $row->store(); + + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + + $response->set('id', $row->id); + $response->set('status', 'success'); + $response->set('msg', JText::_('K2_TAG_ADDED_TO_AVAILABLE_TAGS_LIST', true)); + echo json_encode($response); + + $application->close(); + + } + + function tags() + { + $application = JFactory::getApplication(); + $db = JFactory::getDbo(); + $word = JRequest::getString('q', null); + $id = JRequest::getInt('id'); + if (K2_JVERSION == '15') + { + $word = $db->Quote($db->getEscaped($word, true).'%', false); + } + else + { + $word = $db->Quote($db->escape($word, true).'%', false); + } + + if($id) + { + $query = "SELECT id,name FROM #__k2_tags WHERE name LIKE ".$word; + $db->setQuery($query); + $result = $db->loadObjectList(); + } + else + { + $query = "SELECT name FROM #__k2_tags WHERE name LIKE ".$word; + $db->setQuery($query); + $result = K2_JVERSION == '30' ? $db->loadColumn() : $db->loadResultArray(); + } + + echo json_encode($result); + $application->close(); + } + +} diff --git a/deployed/k2/administrator/components/com_k2/models/tags.php b/deployed/k2/administrator/components/com_k2/models/tags.php new file mode 100644 index 00000000..b2ada831 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/models/tags.php @@ -0,0 +1,180 @@ +getUserStateFromRequest('global.list.limit', 'limit', $application->getCfg('list_limit'), 'int'); + $limitstart = $application->getUserStateFromRequest($option.$view.'.limitstart', 'limitstart', 0, 'int'); + $filter_order = $application->getUserStateFromRequest($option.$view.'filter_order', 'filter_order', 'id', 'cmd'); + $filter_order_Dir = $application->getUserStateFromRequest($option.$view.'filter_order_Dir', 'filter_order_Dir', 'DESC', 'word'); + $filter_state = $application->getUserStateFromRequest($option.$view.'filter_state', 'filter_state', -1, 'int'); + $search = $application->getUserStateFromRequest($option.$view.'search', 'search', '', 'string'); + $search = JString::strtolower($search); + $search = trim(preg_replace('/[^\p{L}\p{N}\s\-_]/u', '', $search)); + + $query = "SELECT #__k2_tags.*, (SELECT COUNT(*) FROM #__k2_tags_xref WHERE #__k2_tags_xref.tagID = #__k2_tags.id) AS numOfItems FROM #__k2_tags"; + + $conditions = array(); + + if ($filter_state > -1) + { + $conditions[] = "published={$filter_state}"; + } + if ($search) + { + $escaped = K2_JVERSION == '15' ? $db->getEscaped($search, true) : $db->escape($search, true); + $conditions[] = "LOWER( name ) LIKE ".$db->Quote('%'.$escaped.'%', false); + } + + if (count($conditions)) + { + $query .= " WHERE ".implode(' AND ', $conditions); + } + + if (!$filter_order) + { + $filter_order = "name"; + } + + $query .= " ORDER BY {$filter_order} {$filter_order_Dir}"; + + $db->setQuery($query, $limitstart, $limit); + $rows = $db->loadObjectList(); + return $rows; + } + + function getTotal() + { + $application = JFactory::getApplication(); + $option = JRequest::getCmd('option'); + $view = JRequest::getCmd('view'); + $db = JFactory::getDbo(); + $limit = $application->getUserStateFromRequest('global.list.limit', 'limit', $application->getCfg('list_limit'), 'int'); + $limitstart = $application->getUserStateFromRequest($option.'.limitstart', 'limitstart', 0, 'int'); + $filter_state = $application->getUserStateFromRequest($option.$view.'filter_state', 'filter_state', 1, 'int'); + $search = $application->getUserStateFromRequest($option.$view.'search', 'search', '', 'string'); + $search = JString::strtolower($search); + $search = trim(preg_replace('/[^\p{L}\p{N}\s\-_]/u', '', $search)); + + $query = "SELECT COUNT(*) FROM #__k2_tags WHERE id>0"; + + if ($filter_state > -1) + { + $query .= " AND published={$filter_state}"; + } + + if ($search) + { + $escaped = K2_JVERSION == '15' ? $db->getEscaped($search, true) : $db->escape($search, true); + $query .= " AND LOWER( name ) LIKE ".$db->Quote('%'.$escaped.'%', false); + } + + $db->setQuery($query); + $total = $db->loadresult(); + return $total; + } + + function publish() + { + $application = JFactory::getApplication(); + $cid = JRequest::getVar('cid'); + foreach ($cid as $id) + { + $row = JTable::getInstance('K2Tag', 'Table'); + $row->load($id); + $row->published = 1; + $row->store(); + } + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + if(JRequest::getCmd('context') == "modalselector"){ + $application->redirect('index.php?option=com_k2&view=tags&tmpl=component&context=modalselector'); + } else { + $application->redirect('index.php?option=com_k2&view=tags'); + } + } + + function unpublish() + { + $application = JFactory::getApplication(); + $cid = JRequest::getVar('cid'); + foreach ($cid as $id) + { + $row = JTable::getInstance('K2Tag', 'Table'); + $row->load($id); + $row->published = 0; + $row->store(); + } + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + if(JRequest::getCmd('context') == "modalselector"){ + $application->redirect('index.php?option=com_k2&view=tags&tmpl=component&context=modalselector'); + } else { + $application->redirect('index.php?option=com_k2&view=tags'); + } + } + + function remove() + { + $application = JFactory::getApplication(); + $db = JFactory::getDbo(); + $cid = JRequest::getVar('cid'); + foreach ($cid as $id) + { + $row = JTable::getInstance('K2Tag', 'Table'); + $row->load($id); + $row->delete($id); + } + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + $application->enqueueMessage(JText::_('K2_DELETE_COMPLETED')); + $application->redirect('index.php?option=com_k2&view=tags'); + } + + function getFilter() + { + $db = JFactory::getDbo(); + $query = "SELECT name, id FROM #__k2_tags ORDER BY name"; + $db->setQuery($query); + $rows = $db->loadObjectList(); + return $rows; + } + + function countTagItems($id) + { + $db = JFactory::getDbo(); + $query = "SELECT COUNT(*) FROM #__k2_tags_xref WHERE tagID = ".(int)$id; + $db->setQuery($query); + $result = $db->loadResult(); + return $result; + } + + function removeOrphans() + { + $db = JFactory::getDbo(); + $db->setQuery("DELETE FROM #__k2_tags WHERE id NOT IN (SELECT DISTINCT tagID FROM #__k2_tags_xref)"); + $db->query(); + $application = JFactory::getApplication(); + $application->enqueueMessage(JText::_('K2_DELETE_COMPLETED')); + $application->redirect('index.php?option=com_k2&view=tags'); + } +} diff --git a/deployed/k2/administrator/components/com_k2/models/user.php b/deployed/k2/administrator/components/com_k2/models/user.php new file mode 100644 index 00000000..82e78bd0 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/models/user.php @@ -0,0 +1,199 @@ +setQuery($query); + $row = $db->loadObject(); + if (!$row) + { + $row = JTable::getInstance('K2User', 'Table'); + } + return $row; + } + + function save() + { + $application = JFactory::getApplication(); + jimport('joomla.filesystem.file'); + require_once(JPATH_SITE.'/media/k2/assets/vendors/verot/class.upload.php/src/class.upload.php'); + $row = JTable::getInstance('K2User', 'Table'); + $params = JComponentHelper::getParams('com_k2'); + + if (!$row->bind(JRequest::get('post'))) + { + $application->enqueueMessage($row->getError(), 'error'); + $application->redirect('index.php?option=com_k2&view=users'); + } + + $row->description = JRequest::getVar('description', '', 'post', 'string', 2); + if ($params->get('xssFiltering')) + { + $filter = new JFilterInput( array(), array(), 1, 1, 0); + $row->description = $filter->clean($row->description); + } + $jUser = JFactory::getUser($row->userID); + $row->userName = $jUser->name; + + if (!$row->store()) + { + $application->enqueueMessage($row->getError(), 'error'); + $application->redirect('index.php?option=com_k2&view=users'); + } + + // Image + if ((int)$params->get('imageMemoryLimit')) + { + ini_set('memory_limit', (int)$params->get('imageMemoryLimit').'M'); + } + + $file = JRequest::get('files'); + + $savepath = JPATH_ROOT.'/media/k2/users/'; + + if ($file['image']['error'] == 0 && !JRequest::getBool('del_image')) + { + $handle = new Upload($file['image']); + if ($handle->uploaded) + { + $handle->file_auto_rename = false; + $handle->file_overwrite = true; + $handle->file_new_name_body = $row->id; + $handle->image_resize = true; + $handle->image_ratio_y = true; + $handle->image_x = $params->get('userImageWidth', '100'); + $handle->Process($savepath); + $handle->Clean(); + } + else + { + $application->enqueueMessage($handle->error, 'error'); + $application->redirect('index.php?option=com_k2&view=users'); + } + $row->image = $handle->file_dst_name; + } + + if (JRequest::getBool('del_image')) + { + + $current = JTable::getInstance('K2User', 'Table'); + $current->load($row->id); + if (JFile::exists(JPATH_ROOT.'/media/k2/users/'.$current->image)) + { + JFile::delete(JPATH_ROOT.'/media/k2/users/'.$current->image); + } + $row->image = ''; + } + + if (!$row->check()) + { + $application->enqueueMessage($row->getError(), 'error'); + $application->redirect('index.php?option=com_k2&view=user&cid='.$row->id); + } + + if (!$row->store()) + { + $application->enqueueMessage($row->getError(), 'error'); + $application->redirect('index.php?option=com_k2&view=users'); + } + + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + + switch(JRequest::getCmd('task')) + { + case 'apply' : + $msg = JText::_('K2_CHANGES_TO_USER_SAVED'); + $link = 'index.php?option=com_k2&view=user&cid='.$row->userID; + break; + case 'save' : + default : + $msg = JText::_('K2_USER_SAVED'); + $link = 'index.php?option=com_k2&view=users'; + break; + } + $application->enqueueMessage($msg); + $application->redirect($link); + } + + function getUserGroups() + { + $db = JFactory::getDbo(); + $query = "SELECT * FROM #__k2_user_groups"; + $db->setQuery($query); + $rows = $db->loadObjectList(); + return $rows; + } + + function reportSpammer() + { + $application = JFactory::getApplication(); + $params = JComponentHelper::getParams('com_k2'); + $id = (int)$this->getState('id'); + if (!$id) + { + return false; + } + $user = JFactory::getUser(); + if ($user->id == $id) + { + $application->enqueueMessage(JText::_('K2_YOU_CANNOT_REPORT_YOURSELF'), 'error'); + return false; + } + $db = JFactory::getDbo(); + + // Unpublish user comments + $db->setQuery("UPDATE #__k2_comments SET published = 0 WHERE userID = ".$id); + $db->query(); + $application->enqueueMessage(JText::_('K2_USER_COMMENTS_UNPUBLISHED')); + + // Unpublish user items + $db->setQuery("UPDATE #__k2_items SET published = 0 WHERE created_by = ".$id); + $db->query(); + $application->enqueueMessage(JText::_('K2_USER_ITEMS_UNPUBLISHED')); + + // Report the user to stopforumspam.com + // We need the IP for this, so the user has to be a registered K2 user + $spammer = JFactory::getUser($id); + $db->setQuery("SELECT ip FROM #__k2_users WHERE userID=".$id, 0, 1); + $ip = $db->loadResult(); + $stopForumSpamApiKey = trim($params->get('stopForumSpamApiKey')); + if ($ip && function_exists('fsockopen') && $stopForumSpamApiKey) + { + $data = "username=".$spammer->username."&ip_addr=".$ip."&email=".$spammer->email."&api_key=".$stopForumSpamApiKey; + $fp = fsockopen("www.stopforumspam.com", 80); + fputs($fp, "POST /add.php HTTP/1.1\n"); + fputs($fp, "Host: www.stopforumspam.com\n"); + fputs($fp, "Content-type: application/x-www-form-urlencoded\n"); + fputs($fp, "Content-length: ".strlen($data)."\n"); + fputs($fp, "Connection: close\n\n"); + fputs($fp, $data); + fclose($fp); + $application->enqueueMessage(JText::_('K2_USER_DATA_SUBMITTED_TO_STOPFORUMSPAM')); + } + + // Finally block the user + $db->setQuery("UPDATE #__users SET block = 1 WHERE id=".$id); + $db->query(); + $application->enqueueMessage(JText::_('K2_USER_BLOCKED')); + return true; + } +} diff --git a/deployed/k2/administrator/components/com_k2/models/usergroup.php b/deployed/k2/administrator/components/com_k2/models/usergroup.php new file mode 100644 index 00000000..71dc50a5 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/models/usergroup.php @@ -0,0 +1,70 @@ +load($cid); + return $row; + } + + function save() + { + $application = JFactory::getApplication(); + $row = JTable::getInstance('K2UserGroup', 'Table'); + + if (!$row->bind(JRequest::get('post'))) + { + $application->enqueueMessage($row->getError(), 'error'); + $application->redirect('index.php?option=com_k2&view=usergroups'); + } + + if (!$row->check()) + { + $application->enqueueMessage($row->getError(), 'error'); + $application->redirect('index.php?option=com_k2&view=usergroup&cid='.$row->id); + } + + if (!$row->store()) + { + $application->enqueueMessage($row->getError(), 'error'); + $application->redirect('index.php?option=com_k2&view=usergroups'); + } + + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + + switch(JRequest::getCmd('task')) + { + case 'apply' : + $msg = JText::_('K2_CHANGES_TO_USER_GROUP_SAVED'); + $link = 'index.php?option=com_k2&view=usergroup&cid='.$row->id; + break; + case 'save' : + default : + $msg = JText::_('K2_USER_GROUP_SAVED'); + $link = 'index.php?option=com_k2&view=usergroups'; + break; + } + $application->enqueueMessage($msg); + $application->redirect($link); + } + +} diff --git a/deployed/k2/administrator/components/com_k2/models/usergroup.xml b/deployed/k2/administrator/components/com_k2/models/usergroup.xml new file mode 100644 index 00000000..745d0128 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/models/usergroup.xml @@ -0,0 +1,66 @@ + +
    + K2_USER_GROUP_EDIT_FORM + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    \ No newline at end of file diff --git a/deployed/k2/administrator/components/com_k2/models/usergroups.php b/deployed/k2/administrator/components/com_k2/models/usergroups.php new file mode 100644 index 00000000..93a0e7c3 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/models/usergroups.php @@ -0,0 +1,79 @@ +getUserStateFromRequest('global.list.limit', 'limit', $application->getCfg('list_limit'), 'int'); + $limitstart = $application->getUserStateFromRequest($option.$view.'.limitstart', 'limitstart', 0, 'int'); + $filter_order = $application->getUserStateFromRequest($option.$view.'filter_order', 'filter_order', '', 'cmd'); + $filter_order_Dir = $application->getUserStateFromRequest($option.$view.'filter_order_Dir', 'filter_order_Dir', '', 'word'); + + $query = "SELECT userGroup.*, (SELECT COUNT(DISTINCT userID) FROM #__k2_users WHERE `group`=userGroup.id) AS numOfUsers FROM #__k2_user_groups AS userGroup"; + + if (!$filter_order) + { + $filter_order = "name"; + } + + $query .= " ORDER BY {$filter_order} {$filter_order_Dir}"; + + $db->setQuery($query, $limitstart, $limit); + $rows = $db->loadObjectList(); + return $rows; + } + + function getTotal() + { + + $application = JFactory::getApplication(); + $option = JRequest::getCmd('option'); + $view = JRequest::getCmd('view'); + $db = JFactory::getDbo(); + + $query = "SELECT COUNT(*) FROM #__k2_user_groups"; + + $db->setQuery($query); + $total = $db->loadresult(); + return $total; + } + + function remove() + { + + $application = JFactory::getApplication(); + $db = JFactory::getDbo(); + $cid = JRequest::getVar('cid'); + foreach ($cid as $id) + { + $row = JTable::getInstance('K2UserGroup', 'Table'); + $row->load($id); + $row->delete($id); + } + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + $application->enqueueMessage(JText::_('K2_DELETE_COMPLETED')); + $application->redirect('index.php?option=com_k2&view=usergroups'); + } + +} diff --git a/deployed/k2/administrator/components/com_k2/models/users.php b/deployed/k2/administrator/components/com_k2/models/users.php new file mode 100644 index 00000000..fc123739 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/models/users.php @@ -0,0 +1,570 @@ +getUserStateFromRequest('global.list.limit', 'limit', $application->getCfg('list_limit'), 'int'); + $limitstart = $application->getUserStateFromRequest($option.$view.'.limitstart', 'limitstart', 0, 'int'); + $filter_order = $application->getUserStateFromRequest($option.$view.'filter_order', 'filter_order', 'juser.name', 'cmd'); + $filter_order_Dir = $application->getUserStateFromRequest($option.$view.'filter_order_Dir', 'filter_order_Dir', '', 'word'); + $filter_status = $application->getUserStateFromRequest($option.$view.'filter_status', 'filter_status', -1, 'int'); + $filter_group = $application->getUserStateFromRequest($option.$view.'filter_group', 'filter_group', '', 'string'); + $filter_group_k2 = $application->getUserStateFromRequest($option.$view.'filter_group_k2', 'filter_group_k2', '', 'string'); + $search = $application->getUserStateFromRequest($option.$view.'search', 'search', '', 'string'); + $search = JString::strtolower($search); + $search = trim(preg_replace('/[^\p{L}\p{N}\s\-_]/u', '', $search)); + + $query = "SELECT juser.*, k2user.group, k2group.name as groupname FROM #__users as juser "."LEFT JOIN #__k2_users as k2user ON juser.id=k2user.userID "."LEFT JOIN #__k2_user_groups as k2group ON k2user.group=k2group.id "; + + if (K2_JVERSION != '15' && $filter_group) + { + $query .= " LEFT JOIN #__user_usergroup_map as `map` ON juser.id=map.user_id "; + } + + $query .= " WHERE juser.id>0"; + + if ($filter_status > -1) + { + $query .= " AND juser.block = {$filter_status}"; + } + + if ($filter_group) + { + if (K2_JVERSION != '15') + { + $query .= " AND `map`.group_id =".(int)$filter_group; + } + else + { + switch($filter_group) + { + case 'Public Frontend' : + $query .= " AND juser.usertype IN ('Registered', 'Author', 'Editor', 'Publisher')"; + break; + + case 'Public Backend' : + $query .= " AND juser.usertype IN ('Manager', 'Administrator', 'Super Administrator')"; + break; + + default : + $filter_group = strtolower(trim($filter_group)); + $query .= " AND juser.usertype = ".$db->Quote($filter_group); + } + } + + } + + if ($filter_group_k2) + { + $query .= " AND k2user.group = ".$db->Quote($filter_group_k2); + } + + if ($search) + { + $escaped = K2_JVERSION == '15' ? $db->getEscaped($search, true) : $db->escape($search, true); + $query .= " AND (LOWER( juser.name ) LIKE ".$db->Quote('%'.$escaped.'%', false)." OR LOWER( juser.email ) LIKE ".$db->Quote('%'.$escaped.'%', false).")"; + } + + if (!$filter_order) + { + $filter_order = "juser.name"; + } + + $query .= " ORDER BY {$filter_order} {$filter_order_Dir}"; + + $db->setQuery($query, $limitstart, $limit); + $rows = $db->loadObjectList(); + + if (K2_JVERSION != '15' && count($rows)) + { + foreach ($rows as $row) + { + $IDs[] = $row->id; + } + $query = "SELECT map.user_id, COUNT(map.group_id) AS group_count,GROUP_CONCAT(g2.title SEPARATOR '\n') AS group_names + FROM #__user_usergroup_map AS map + LEFT JOIN #__usergroups AS g2 + ON g2.id = map.group_id + WHERE map.user_id IN (".implode(',', $IDs).") + GROUP BY map.user_id"; + $db->setQuery($query); + $groups = $db->loadObjectList(); + foreach ($rows as $row) + { + foreach ($groups as $group) + { + if ($row->id == $group->user_id) + { + $row->usertype = nl2br($group->group_names); + } + } + } + } + + return $rows; + } + + function getTotal() + { + + $application = JFactory::getApplication(); + $option = JRequest::getCmd('option'); + $view = JRequest::getCmd('view'); + $db = JFactory::getDbo(); + $limit = $application->getUserStateFromRequest('global.list.limit', 'limit', $application->getCfg('list_limit'), 'int'); + $limitstart = $application->getUserStateFromRequest($option.'.limitstart', 'limitstart', 0, 'int'); + $filter_status = $application->getUserStateFromRequest($option.$view.'filter_status', 'filter_status', -1, 'int'); + $filter_group = $application->getUserStateFromRequest($option.$view.'filter_group', 'filter_group', '', 'string'); + $filter_group_k2 = $application->getUserStateFromRequest($option.$view.'filter_group_k2', 'filter_group_k2', '', 'string'); + $search = $application->getUserStateFromRequest($option.$view.'search', 'search', '', 'string'); + $search = JString::strtolower($search); + $search = trim(preg_replace('/[^\p{L}\p{N}\s\-_]/u', '', $search)); + + $query = "SELECT COUNT(DISTINCT juser.id) FROM #__users as juser "."LEFT JOIN #__k2_users as k2user ON juser.id=k2user.userID "."LEFT JOIN #__k2_user_groups as k2group ON k2user.group=k2group.id "; + + if (K2_JVERSION != '15' && $filter_group) + { + $query .= " LEFT JOIN #__user_usergroup_map as `map` ON juser.id=map.user_id "; + } + + $query .= " WHERE juser.id>0"; + + if ($filter_status > -1) + { + $query .= " AND juser.block = {$filter_status}"; + } + + if ($filter_group) + { + if (K2_JVERSION != '15') + { + $query .= " AND `map`.group_id =".(int)$filter_group; + } + else + { + switch($filter_group) + { + case 'Public Frontend' : + $query .= " AND juser.usertype IN ('Registered', 'Author', 'Editor', 'Publisher')"; + break; + + case 'Public Backend' : + $query .= " AND juser.usertype IN ('Manager', 'Administrator', 'Super Administrator')"; + break; + + default : + $filter_group = strtolower(trim($filter_group)); + $query .= " AND juser.usertype = ".$db->Quote($filter_group); + } + } + } + + if ($filter_group_k2) + { + $query .= " AND k2user.group = ".$db->Quote($filter_group_k2); + } + + if ($search) + { + $escaped = K2_JVERSION == '15' ? $db->getEscaped($search, true) : $db->escape($search, true); + $query .= " AND (LOWER( juser.name ) LIKE ".$db->Quote('%'.$escaped.'%', false)." OR LOWER( juser.email ) LIKE ".$db->Quote('%'.$escaped.'%', false).")"; + + } + + $db->setQuery($query); + $total = $db->loadResult(); + return $total; + } + + function remove() + { + + $application = JFactory::getApplication(); + $cid = JRequest::getVar('cid'); + JArrayHelper::toInteger($cid); + $db = JFactory::getDbo(); + $query = "DELETE FROM #__k2_users WHERE userID IN(".implode(',', $cid).")"; + $db->setQuery($query); + $db->query(); + $cache = JFactory::getCache('com_k2'); + $cache->clean(); + $application->enqueueMessage(JText::_('K2_USER_PROFILE_DELETED')); + $application->redirect('index.php?option=com_k2&view=users'); + } + + function getUserGroups($type = 'joomla') + { + + $db = JFactory::getDbo(); + + if ($type == 'joomla') + { + + $query = 'SELECT (lft - 3) AS lft, name AS value, name AS text'.' FROM #__core_acl_aro_groups'.' WHERE name != "ROOT"'.' AND name != "USERS"'.' ORDER BY `lft` ASC'; + + if (K2_JVERSION != '15') + { + $query = "SELECT a.lft AS lft, a.id AS value, a.title AS text, COUNT(DISTINCT b.id) AS level + FROM #__usergroups AS a + LEFT JOIN #__usergroups AS b + ON a.lft > b.lft + AND a.rgt < b.rgt + GROUP BY a.id + ORDER BY a.lft ASC"; + } + + $db->setQuery($query); + $groups = $db->loadObjectList(); + $userGroups = array(); + + foreach ($groups as $group) + { + if ($group->lft >= 10) + $group->lft = (int)$group->lft - 10; + if (K2_JVERSION != '15') + { + $group->text = $this->indent($group->level, '- ').$group->text; + } + else + { + $group->text = $this->indent($group->lft).$group->text; + } + + array_push($userGroups, $group); + } + + } + else + { + $query = "SELECT * FROM #__k2_user_groups"; + $db->setQuery($query); + $userGroups = $db->loadObjectList(); + + } + + return $userGroups; + } + + function indent($times, $char = '    ', $start_char = '', $end_char = '') + { + $return = $start_char; + for ($i = 0; $i < $times; $i++) + $return .= $char; + $return .= $end_char; + return $return; + } + + function checkLogin($id) + { + + $db = JFactory::getDbo(); + $query = "SELECT COUNT(s.userid) FROM #__session AS s WHERE s.userid = ".(int)$id; + $db->setQuery($query); + $result = $db->loadResult(); + return $result; + } + + function hasProfile($id) + { + + $db = JFactory::getDbo(); + $query = "SELECT id FROM #__k2_users WHERE userID = ".(int)$id; + $db->setQuery($query); + $result = $db->loadResult(); + return $result; + } + + function enable() + { + $application = JFactory::getApplication(); + $cid = JRequest::getVar('cid'); + JArrayHelper::toInteger($cid); + $db = JFactory::getDbo(); + $query = "UPDATE #__users SET block=0 WHERE id IN(".implode(',', $cid).")"; + $db->setQuery($query); + $db->query(); + $application->enqueueMessage(JText::_('K2_USERS_ENABLED')); + if(JRequest::getCmd('context') == "modalselector"){ + $application->redirect('index.php?option=com_k2&view=users&tmpl=component&context=modalselector'); + } else { + $application->redirect('index.php?option=com_k2&view=users'); + } + } + + function disable() + { + $application = JFactory::getApplication(); + $cid = JRequest::getVar('cid'); + JArrayHelper::toInteger($cid); + $db = JFactory::getDbo(); + $query = "UPDATE #__users SET block=1 WHERE id IN(".implode(',', $cid).")"; + $db->setQuery($query); + $db->query(); + $application->enqueueMessage(JText::_('K2_USERS_DISABLED')); + if(JRequest::getCmd('context') == "modalselector"){ + $application->redirect('index.php?option=com_k2&view=users&tmpl=component&context=modalselector'); + } else { + $application->redirect('index.php?option=com_k2&view=users'); + } + } + + function delete() + { + $application = JFactory::getApplication(); + $user = JFactory::getUser(); + $cid = JRequest::getVar('cid'); + JArrayHelper::toInteger($cid); + $db = JFactory::getDbo(); + if (in_array($user->id, $cid)) + { + foreach ($cid as $key => $id) + { + if ($id == $user->id) + { + unset($cid[$key]); + } + } + $application->enqueueMessage(JText::_('K2_YOU_CANNOT_DELETE_YOURSELF'), 'notice'); + } + if (count($cid) < 1) + { + $application->enqueueMessage(JText::_('K2_DELETE_COMPLETED')); + $application->redirect('index.php?option=com_k2&view=users'); + } + if (K2_JVERSION != '15') + { + JPluginHelper::importPlugin('user'); + $dispatcher = JDispatcher::getInstance(); + $iAmSuperAdmin = $user->authorise('core.admin'); + foreach ($cid as $key => $id) + { + $table = JTable::getInstance('user'); + $table->load($id); + $allow = $user->authorise('core.delete', 'com_users'); + // Don't allow non-super-admin to delete a super admin + $allow = (!$iAmSuperAdmin && JAccess::check($id, 'core.admin')) ? false : $allow; + if ($allow) + { + // Get users data for the users to delete. + $user_to_delete = JFactory::getUser($id); + // Fire the onUserBeforeDelete event. + $dispatcher->trigger('onUserBeforeDelete', array($table->getProperties())); + if (!$table->delete($id)) + { + $this->setError($table->getError()); + return false; + } + else + { + // Trigger the onUserAfterDelete event. + $dispatcher->trigger('onUserAfterDelete', array($user_to_delete->getProperties(), true, $this->getError())); + } + } + else + { + // Prune items that you can't change. + unset($cid[$key]); + JError::raiseWarning(403, JText::_('JERROR_CORE_DELETE_NOT_PERMITTED')); + } + } + $IDsToDelete = $cid; + } + else + { + $query = "SELECT * FROM #__users WHERE id IN(".implode(',', $cid).") AND gid<={$user->gid}"; + $db->setQuery($query); + $IDsToDelete = K2_JVERSION == '30' ? $db->loadColumn() : $db->loadResultArray(); + + $query = "DELETE FROM #__users WHERE id IN(".implode(',', $IDsToDelete).") AND id!={$user->id}"; + $db->setQuery($query); + $db->query(); + } + $query = "DELETE FROM #__k2_users WHERE userID IN(".implode(',', $IDsToDelete).") AND userID!={$user->id}"; + $db->setQuery($query); + $db->query(); + $application->enqueueMessage(JText::_('K2_DELETE_COMPLETED')); + $application->redirect('index.php?option=com_k2&view=users'); + } + + function saveMove() + { + $application = JFactory::getApplication(); + $db = JFactory::getDbo(); + $cid = JRequest::getVar('cid'); + JArrayHelper::toInteger($cid); + $group = JRequest::getVar('group'); + $k2group = JRequest::getInt('k2group'); + if (K2_JVERSION != '15') + { + JArrayHelper::toInteger($group); + $group = array_filter($group); + if (count($group)) + { + foreach ($cid as $id) + { + $query = "DELETE FROM #__user_usergroup_map WHERE user_id = ".$id; + $db->setQuery($query); + $db->query(); + $query = "INSERT INTO #__user_usergroup_map VALUES (".$id.", ".implode("), (".$id.", ", $group).")"; + $db->setQuery($query); + $db->query(); + } + } + } + else + { + if ($group) + { + $query = "SELECT id FROM #__core_acl_aro_groups WHERE name=".$db->Quote($group); + $db->setQuery($query); + $gid = $db->loadResult(); + $query = "UPDATE #__users SET gid={$gid}, usertype=".$db->Quote($group)." WHERE id IN(".implode(',', $cid).")"; + $db->setQuery($query); + $db->query(); + } + } + + if ($k2group) + { + foreach ($cid as $id) + { + $query = "SELECT COUNT(*) FROM #__k2_users WHERE userID = ".$id; + $db->setQuery($query); + $result = $db->loadResult(); + if ($result) + { + $query = "UPDATE #__k2_users SET `group`={$k2group} WHERE userID = ".$id; + } + else + { + $user = JFactory::getUser($id); + $query = "INSERT INTO #__k2_users VALUES ('', {$id}, {$db->Quote($user->username)}, '', '', '', '', {$k2group}, '', '', '', '')"; + } + $db->setQuery($query); + $db->query(); + } + } + $application->enqueueMessage(JText::_('K2_MOVE_COMPLETED')); + $application->redirect('index.php?option=com_k2&view=users'); + + } + + function import() + { + + $application = JFactory::getApplication(); + $db = JFactory::getDbo(); + if (K2_JVERSION != '15') + { + $db->setQuery("SELECT id, title AS name FROM #__usergroups"); + $usergroups = $db->loadObjectList(); + $xml = new JXMLElement(JFile::read(JPATH_COMPONENT.'/models/usergroup.xml')); + $permissions = class_exists('JParameter') ? new JParameter('') : new JRegistry(''); + foreach ($xml->params as $paramGroup) + { + foreach ($paramGroup->param as $param) + { + $attribute = K2_JVERSION == '30' ? $param->attributes()->type : $param->getAttribute('type'); + if ($attribute != 'spacer') + { + if (K2_JVERSION == '30') + { + $permissions->set((string)$param->attributes()->name, (string)$param->attributes()->default); + } + else + { + $permissions->set($param->getAttribute('name'), $param->getAttribute('default')); + } + + } + } + } + } + else + { + $acl = JFactory::getACL(); + $frontEndGroups = $acl->_getBelow('#__core_acl_aro_groups', 'g1.id, g1.name, COUNT(g2.name) AS level', 'g1.name', false, 'Public Frontend', false); + $backEndGroups = $acl->_getBelow('#__core_acl_aro_groups', 'g1.id, g1.name, COUNT(g2.name) AS level', 'g1.name', false, 'Public Backend', false); + $usergroups = array_merge($frontEndGroups, $backEndGroups); + + $xml = new JSimpleXML; + $xml->loadFile(JPATH_COMPONENT.'/models/usergroup.xml'); + $permissions = class_exists('JParameter') ? new JParameter('') : new JRegistry(''); + foreach ($xml->document->params as $paramGroup) + { + foreach ($paramGroup->param as $param) + { + if ($param->attributes('type') != 'spacer') + { + $permissions->set($param->attributes('name'), $param->attributes('default')); + } + } + } + } + + $permissions->set('inheritance', 0); + $permissions->set('categories', 'all'); + $permissions = $permissions->toString(); + + foreach ($usergroups as $usergroup) + { + $K2UserGroup = JTable::getInstance('K2UserGroup', 'Table'); + $K2UserGroup->name = JString::trim($usergroup->name)." (Imported from Joomla)"; + $K2UserGroup->permissions = $permissions; + $K2UserGroup->store(); + + if (K2_JVERSION != '15') + { + $query = "SELECT * FROM #__users AS user JOIN #__user_usergroup_map AS map ON user.id = map.user_id + WHERE map.group_id = ".$usergroup->id; + } + else + { + $query = "SELECT * FROM #__users WHERE gid={$usergroup->id}"; + } + + $db->setQuery($query); + $users = $db->loadObjectList(); + + foreach ($users as $user) + { + + $query = "SELECT COUNT(*) FROM #__k2_users WHERE userID={$user->id}"; + $db->setQuery($query); + $result = $db->loadResult(); + if (!$result) + { + $K2User = JTable::getInstance('K2User', 'Table'); + $K2User->userID = $user->id; + $K2User->group = $K2UserGroup->id; + $K2User->store(); + } + } + } + $application->enqueueMessage(JText::_('K2_IMPORT_COMPLETED')); + $application->redirect('index.php?option=com_k2&view=users'); + + } + +} diff --git a/deployed/k2/administrator/components/com_k2/script.k2.php b/deployed/k2/administrator/components/com_k2/script.k2.php new file mode 100644 index 00000000..a4e810c8 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/script.k2.php @@ -0,0 +1,452 @@ +modules = array(); + $status->plugins = array(); + $src = $parent->getParent()->getPath('source'); + $manifest = $parent->getParent()->manifest; + $plugins = $manifest->xpath('plugins/plugin'); + foreach ($plugins as $plugin) + { + $name = (string)$plugin->attributes()->plugin; + $group = (string)$plugin->attributes()->group; + $path = $src.'/plugins/'.$group; + if (JFolder::exists($src.'/plugins/'.$group.'/'.$name)) + { + $path = $src.'/plugins/'.$group.'/'.$name; + } + $installer = new JInstaller; + $result = $installer->install($path); + if ($result && $group != 'finder') + { + if (JFile::exists(JPATH_SITE.'/plugins/'.$group.'/'.$name.'/'.$name.'.xml')) + { + JFile::delete(JPATH_SITE.'/plugins/'.$group.'/'.$name.'/'.$name.'.xml'); + } + JFile::move(JPATH_SITE.'/plugins/'.$group.'/'.$name.'/'.$name.'.j25.xml', JPATH_SITE.'/plugins/'.$group.'/'.$name.'/'.$name.'.xml'); + } + if($group != 'finder') + { + $query = "UPDATE #__extensions SET enabled=1 WHERE type='plugin' AND element=".$db->Quote($name)." AND folder=".$db->Quote($group); + $db->setQuery($query); + $db->query(); + } + $status->plugins[] = array('name' => $name, 'group' => $group, 'result' => $result); + } + $modules = $manifest->xpath('modules/module'); + foreach ($modules as $module) + { + $name = (string)$module->attributes()->module; + $client = (string)$module->attributes()->client; + if (is_null($client)) + { + $client = 'site'; + } + ($client == 'administrator') ? $path = $src.'/administrator/modules/'.$name : $path = $src.'/modules/'.$name; + + if($client == 'administrator') + { + $db->setQuery("SELECT id FROM #__modules WHERE `module` = ".$db->quote($name)); + $isUpdate = (int)$db->loadResult(); + } + + $installer = new JInstaller; + $result = $installer->install($path); + if ($result) + { + $root = $client == 'administrator' ? JPATH_ADMINISTRATOR : JPATH_SITE; + if (JFile::exists($root.'/modules/'.$name.'/'.$name.'.xml')) + { + JFile::delete($root.'/modules/'.$name.'/'.$name.'.xml'); + } + JFile::move($root.'/modules/'.$name.'/'.$name.'.j25.xml', $root.'/modules/'.$name.'/'.$name.'.xml'); + } + $status->modules[] = array('name' => $name, 'client' => $client, 'result' => $result); + if($client == 'administrator' && !$isUpdate) + { + $position = version_compare(JVERSION, '3.0', '<') && $name == 'mod_k2_quickicons'? 'icon' : 'cpanel'; + $db->setQuery("UPDATE #__modules SET `position`=".$db->quote($position).",`published`='1' WHERE `module`=".$db->quote($name)); + $db->query(); + + $db->setQuery("SELECT id FROM #__modules WHERE `module` = ".$db->quote($name)); + $id = (int)$db->loadResult(); + + $db->setQuery("INSERT IGNORE INTO #__modules_menu (`moduleid`,`menuid`) VALUES (".$id.", 0)"); + $db->query(); + } + } + + if (JFile::exists(JPATH_ADMINISTRATOR.'/components/com_k2/admin.k2.php')) + { + JFile::delete(JPATH_ADMINISTRATOR.'/components/com_k2/admin.k2.php'); + } + + if (JFile::exists(JPATH_ADMINISTRATOR.'/components/com_k2/models/cpanel.php')) + { + JFile::delete(JPATH_ADMINISTRATOR.'/components/com_k2/models/cpanel.php'); + } + + if (version_compare(JVERSION, '3.0', 'lt') && JFolder::exists(JPATH_ADMINISTRATOR.'/components/com_joomfish/contentelements')) + { + $elements = $manifest->xpath('joomfish/file'); + foreach ($elements as $element) + { + JFile::copy($src.'/administrator/components/com_joomfish/contentelements/'.$element->data(), JPATH_ADMINISTRATOR.'/components/com_joomfish/contentelements/'.$element->data()); + } + } + + // Clean up empty entries in #__k2_users table caused by an issue in the K2 user plugin. Fix details: http://code.google.com/p/getk2/source/detail?r=1966 + $query = "DELETE FROM #__k2_users WHERE userID = 0"; + $db->setQuery($query); + $db->query(); + + /* + // TO DO: Check main folders for 0755 first and then apply this fix + // Fix media manager folder permissions + set_time_limit(0); + jimport('joomla.filesystem.folder'); + jimport('joomla.filesystem.path'); + $params = JComponentHelper::getParams('com_media'); + $root = $params->get('file_path', 'media'); + $mediaPath = JPATH_SITE.'/'.JPath::clean($root); + $folders = JFolder::folders($mediaPath, '.', true, true, array()); + foreach($folders as $folder) + { + @chmod($folder, 0755); + } + if(JFolder::exists($mediaPath.'/'.'.tmb')) + { + @chmod($mediaPath.'/'.'.tmb', 0755); + } + if(JFolder::exists($mediaPath.'/'.'.quarantine')) + { + @chmod($mediaPath.'/'.'.quarantine', 0755); + } + */ + + $this->installationResults($status); + } + + public function uninstall($parent) + { + $db = JFactory::getDbo(); + $status = new stdClass; + $status->modules = array(); + $status->plugins = array(); + $manifest = $parent->getParent()->manifest; + $plugins = $manifest->xpath('plugins/plugin'); + foreach ($plugins as $plugin) + { + $name = (string)$plugin->attributes()->plugin; + $group = (string)$plugin->attributes()->group; + $query = "SELECT `extension_id` FROM #__extensions WHERE `type`='plugin' AND element = ".$db->Quote($name)." AND folder = ".$db->Quote($group); + $db->setQuery($query); + $extensions = $db->loadColumn(); + if (count($extensions)) + { + foreach ($extensions as $id) + { + $installer = new JInstaller; + $result = $installer->uninstall('plugin', $id); + } + $status->plugins[] = array('name' => $name, 'group' => $group, 'result' => $result); + } + } + $modules = $manifest->xpath('modules/module'); + foreach ($modules as $module) + { + $name = (string)$module->attributes()->module; + $client = (string)$module->attributes()->client; + $db = JFactory::getDbo(); + $query = "SELECT `extension_id` FROM `#__extensions` WHERE `type`='module' AND element = ".$db->Quote($name).""; + $db->setQuery($query); + $extensions = $db->loadColumn(); + if (count($extensions)) + { + foreach ($extensions as $id) + { + $installer = new JInstaller; + $result = $installer->uninstall('module', $id); + } + $status->modules[] = array('name' => $name, 'client' => $client, 'result' => $result); + } + } + $this->uninstallationResults($status); + } + + public function update($type) + { + $db = JFactory::getDbo(); + + $fields = $db->getTableColumns('#__k2_categories'); + if (!array_key_exists('language', $fields)) + { + $query = "ALTER TABLE #__k2_categories ADD `language` CHAR(7) NOT NULL"; + $db->setQuery($query); + $db->query(); + + $query = "ALTER TABLE #__k2_categories ADD INDEX (`language`)"; + $db->setQuery($query); + $db->query(); + } + + $fields = $db->getTableColumns('#__k2_items'); + if (!array_key_exists('featured_ordering', $fields)) + { + $query = "ALTER TABLE #__k2_items ADD `featured_ordering` INT(11) NOT NULL default '0' AFTER `featured`"; + $db->setQuery($query); + $db->query(); + } + if (!array_key_exists('language', $fields)) + { + $query = "ALTER TABLE #__k2_items ADD `language` CHAR(7) NOT NULL"; + $db->setQuery($query); + $db->query(); + + $query = "ALTER TABLE #__k2_items ADD INDEX (`language`)"; + $db->setQuery($query); + $db->query(); + } + if ($fields['video'] != 'text') + { + $query = "ALTER TABLE #__k2_items MODIFY `video` TEXT"; + $db->setQuery($query); + $db->query(); + } + if ($fields['introtext'] == 'text') + { + $query = "ALTER TABLE #__k2_items MODIFY `introtext` MEDIUMTEXT"; + $db->setQuery($query); + $db->query(); + } + if ($fields['fulltext'] == 'text') + { + $query = "ALTER TABLE #__k2_items MODIFY `fulltext` MEDIUMTEXT"; + $db->setQuery($query); + $db->query(); + } + + /* + // TO DO: Use the following info to remove FULLTEXT attributes from the items & tags tables + $query = "SHOW INDEX FROM #__k2_items"; + $db->setQuery($query); + $indexes = $db->loadObjectList(); + $indexExists = false; + foreach ($indexes as $index) + { + if ($index->Key_name == 'search') + $indexExists = true; + } + + if (!$indexExists) + { + $query = "ALTER TABLE #__k2_items ADD FULLTEXT `search` (`title`,`introtext`,`fulltext`,`extra_fields_search`,`image_caption`,`image_credits`,`video_caption`,`video_credits`,`metadesc`,`metakey`)"; + $db->setQuery($query); + $db->query(); + + $query = "ALTER TABLE #__k2_items ADD FULLTEXT (`title`)"; + $db->setQuery($query); + $db->query(); + } + + $query = "SHOW INDEX FROM #__k2_tags"; + $db->setQuery($query); + $indexes = $db->loadObjectList(); + $indexExists = false; + foreach ($indexes as $index) + { + if ($index->Key_name == 'name') + $indexExists = true; + } + + if (!$indexExists) + { + $query = "ALTER TABLE #__k2_tags ADD FULLTEXT (`name`)"; + $db->setQuery($query); + $db->query(); + } + */ + + // Add index for comments count + $query = "SHOW INDEX FROM #__k2_comments"; + $db->setQuery($query); + $indexes = $db->loadObjectList(); + $indexExists = false; + foreach ($indexes as $index) + { + if ($index->Key_name == 'countComments') + $indexExists = true; + } + + if (!$indexExists) + { + $query = "ALTER TABLE #__k2_comments ADD INDEX `countComments` (`itemID`, `published`)"; + $db->setQuery($query); + $db->query(); + } + + $query = "SELECT COUNT(*) FROM #__k2_user_groups"; + $db->setQuery($query); + $num = $db->loadResult(); + + if ($num == 0) + { + $query = "INSERT INTO #__k2_user_groups (`id`, `name`, `permissions`) VALUES('', 'Registered', '{\"comment\":\"1\",\"frontEdit\":\"0\",\"add\":\"0\",\"editOwn\":\"0\",\"editAll\":\"0\",\"publish\":\"0\",\"inheritance\":0,\"categories\":\"all\"}')"; + $db->setQuery($query); + $db->query(); + + $query = "INSERT INTO #__k2_user_groups (`id`, `name`, `permissions`) VALUES('', 'Site Owner', '{\"comment\":\"1\",\"frontEdit\":\"1\",\"add\":\"1\",\"editOwn\":\"1\",\"editAll\":\"1\",\"publish\":\"1\",\"inheritance\":1,\"categories\":\"all\"}')"; + $db->setQuery($query); + $db->query(); + } + + $fields = $db->getTableColumns('#__k2_users'); + if (!array_key_exists('ip', $fields)) + { + $query = "ALTER TABLE `#__k2_users` + ADD `ip` VARCHAR( 15 ) NOT NULL , + ADD `hostname` VARCHAR( 255 ) NOT NULL , + ADD `notes` TEXT NOT NULL"; + $db->setQuery($query); + $db->query(); + } + + $query = "CREATE TABLE IF NOT EXISTS `#__k2_log` ( + `status` int(11) NOT NULL, + `response` text NOT NULL, + `timestamp` datetime NOT NULL + ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"; + $db->setQuery($query); + $db->query(); + } + + private function installationResults($status) + { + $language = JFactory::getLanguage(); + $language->load('com_k2'); + $rows = 0; ?> + K2 +

    + + + + + + + + + + + + + + + + + + modules)): ?> + + + + + + modules as $module): ?> + + + + + + + + plugins)): ?> + + + + + + plugins as $plugin): ?> + + + + + + + + +
    + load('com_k2'); + $rows = 0; + ?> +

    + + + + + + + + + + + + + + + + + + modules)): ?> + + + + + + modules as $module): ?> + + + + + + + + + plugins)): ?> + + + + + + plugins as $plugin): ?> + + + + + + + + +
    + bind($K2CategoriesInstances[$oid]); + } + + $k = $this->_tbl_key; + + if ($oid !== null) + { + $this->$k = $oid; + } + + $oid = $this->$k; + + if ($oid === null) + { + return false; + } + $this->reset(); + + $db = $this->getDBO(); + + $query = 'SELECT *'.' FROM '.$this->_tbl.' WHERE '.$this->_tbl_key.' = '.$db->Quote($oid); + $db->setQuery($query); + $result = $db->loadAssoc(); + if ($result) + { + $K2CategoriesInstances[$oid] = $result; + return $this->bind($K2CategoriesInstances[$oid]); + } + else + { + $this->setError($db->getErrorMsg()); + return false; + } + } + + function check() + { + + jimport('joomla.filter.output'); + $params = JComponentHelper::getParams('com_k2'); + $this->name = JString::trim($this->name); + if ($this->name == '') + { + $this->setError(JText::_('K2_CATEGORY_MUST_HAVE_A_NAME')); + return false; + } + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + if (K2_JVERSION == '15') + { + if (JPluginHelper::isEnabled('system', 'unicodeslug') || JPluginHelper::isEnabled('system', 'jw_unicodeSlugsExtended')) + { + $this->alias = JFilterOutput::stringURLSafe($this->alias); + } + else + { + mb_internal_encoding("UTF-8"); + mb_regex_encoding("UTF-8"); + $this->alias = trim(mb_strtolower($this->alias)); + $this->alias = str_replace('-', ' ', $this->alias); + $this->alias = str_replace('/', '-', $this->alias); + $this->alias = mb_ereg_replace('[[:space:]]+', ' ', $this->alias); + $this->alias = trim(str_replace(' ', '-', $this->alias)); + $this->alias = str_replace('.', '', $this->alias); + $this->alias = str_replace('"', '', $this->alias); + $this->alias = str_replace("'", '', $this->alias); + $stripthese = ',|~|!|@|%|^|(|)|<|>|:|;|{|}|[|]|&|`|„|‹|’|‘|“|â€�|•|›|«|´|»|°|«|»|…'; + $strips = explode('|', $stripthese); + foreach ($strips as $strip) + { + $this->alias = str_replace($strip, '', $this->alias); + } + if (trim(str_replace('-', '', $this->alias)) == '') + { + $datenow = JFactory::getDate(); + $this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S"); + } + $this->alias = trim($this->alias, '-.'); + } + } + else + { + if (JFactory::getConfig()->get('unicodeslugs') == 1) + { + $this->alias = JFilterOutput::stringURLUnicodeSlug($this->alias); + } + // Transliterate properly... + else + { + // Detect the site language we will transliterate + if ($this->language == '*') + { + $langParams = JComponentHelper::getParams('com_languages'); + $languageTag = $langParams->get('site'); + } + else + { + $languageTag = $this->language; + } + $language = JLanguage::getInstance($languageTag); + $this->alias = $language->transliterate($this->alias); + $this->alias = JFilterOutput::stringURLSafe($this->alias); + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + } + } + + if (K2_JVERSION == '15' || $params->get('enforceSEFReplacements')) + { + + $SEFReplacements = array(); + $items = explode(',', $params->get('SEFReplacements')); + foreach ($items as $item) + { + if (!empty($item)) + { + @list($src, $dst) = explode('|', trim($item)); + $SEFReplacements[trim($src)] = trim($dst); + } + } + + foreach ($SEFReplacements as $key => $value) + { + $this->alias = str_replace($key, $value, $this->alias); + } + + $this->alias = trim($this->alias, '-.'); + } + + if (K2_JVERSION == '15') + { + if (trim(str_replace('-', '', $this->alias)) == '') + { + $datenow = JFactory::getDate(); + $this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S"); + } + } + + // Check if alias already exists. If so warn the user + $params = JComponentHelper::getParams('com_k2'); + if ($params->get('k2Sef') && !$params->get('k2SefInsertCatId')) + { + $db = JFactory::getDbo(); + $db->setQuery("SELECT id FROM #__k2_categories WHERE alias = ".$db->quote($this->alias)." AND id != ".(int)$this->id); + $result = count($db->loadObjectList()); + if ($result > 0) + { + $this->alias .= '-'.((int)$result + 1); + $application = JFactory::getApplication(); + $application->enqueueMessage(JText::_('K2_WARNING_DUPLICATE_TITLE_ALIAS_DETECTED'), 'notice'); + } + } + + return true; + + } + + function bind($array, $ignore = '') + { + + if (key_exists('params', $array) && is_array($array['params'])) + { + $registry = new JRegistry(); + $registry->loadArray($array['params']); + $array['params'] = $registry->toString(); + } + + if (key_exists('plugins', $array) && is_array($array['plugins'])) + { + $registry = new JRegistry(); + $registry->loadArray($array['plugins']); + $array['plugins'] = $registry->toString(); + } + + return parent::bind($array, $ignore); + } + +} diff --git a/deployed/k2/administrator/components/com_k2/tables/k2comment.php b/deployed/k2/administrator/components/com_k2/tables/k2comment.php new file mode 100644 index 00000000..f34433df --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/tables/k2comment.php @@ -0,0 +1,37 @@ +commentText = JString::trim($this->commentText); + } + +} diff --git a/deployed/k2/administrator/components/com_k2/tables/k2extrafield.php b/deployed/k2/administrator/components/com_k2/tables/k2extrafield.php new file mode 100644 index 00000000..635a818e --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/tables/k2extrafield.php @@ -0,0 +1,41 @@ +name = JString::trim($this->name); + if ($this->name == '') + { + $this->setError(JText::_('K2_NAME_CANNOT_BE_EMPTY')); + return false; + } + return true; + } +} diff --git a/deployed/k2/administrator/components/com_k2/tables/k2extrafieldsgroup.php b/deployed/k2/administrator/components/com_k2/tables/k2extrafieldsgroup.php new file mode 100644 index 00000000..8300706d --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/tables/k2extrafieldsgroup.php @@ -0,0 +1,37 @@ +name = JString::trim($this->name); + if ($this->name == '') + { + $this->setError(JText::_('K2_GROUP_MUST_HAVE_A_NAME')); + return false; + } + return true; + } + +} diff --git a/deployed/k2/administrator/components/com_k2/tables/k2item.php b/deployed/k2/administrator/components/com_k2/tables/k2item.php new file mode 100644 index 00000000..f172dcef --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/tables/k2item.php @@ -0,0 +1,326 @@ +title = JString::trim($this->title); + if ($this->title == '') + { + $this->setError(JText::_('K2_ITEM_MUST_HAVE_A_TITLE')); + return false; + } + if (!$this->catid) + { + $this->setError(JText::_('K2_ITEM_MUST_HAVE_A_CATEGORY')); + return false; + } + if (empty($this->alias)) + { + $this->alias = $this->title; + } + + if (K2_JVERSION == '15') + { + if (JPluginHelper::isEnabled('system', 'unicodeslug') || JPluginHelper::isEnabled('system', 'jw_unicodeSlugsExtended')) + { + $this->alias = JFilterOutput::stringURLSafe($this->alias); + } + else + { + mb_internal_encoding("UTF-8"); + mb_regex_encoding("UTF-8"); + $this->alias = trim(mb_strtolower($this->alias)); + $this->alias = str_replace('-', ' ', $this->alias); + $this->alias = str_replace('/', '-', $this->alias); + $this->alias = mb_ereg_replace('[[:space:]]+', ' ', $this->alias); + $this->alias = trim(str_replace(' ', '-', $this->alias)); + $this->alias = str_replace('.', '', $this->alias); + $this->alias = str_replace('"', '', $this->alias); + $this->alias = str_replace("'", '', $this->alias); + $stripthese = ',|~|!|@|%|^|(|)|<|>|:|;|{|}|[|]|&|`|„|‹|’|‘|“|â€�|•|›|«|´|»|°|«|»|…'; + $strips = explode('|', $stripthese); + foreach ($strips as $strip) + { + $this->alias = str_replace($strip, '', $this->alias); + } + if (trim(str_replace('-', '', $this->alias)) == '') + { + $datenow = JFactory::getDate(); + $this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S"); + } + $this->alias = trim($this->alias, '-.'); + } + } + else + { + if (JFactory::getConfig()->get('unicodeslugs') == 1) + { + $this->alias = JFilterOutput::stringURLUnicodeSlug($this->alias); + } + // Transliterate properly... + else + { + // Detect the site language we will transliterate + if ($this->language == '*') + { + $langParams = JComponentHelper::getParams('com_languages'); + $languageTag = $langParams->get('site'); + } + else + { + $languageTag = $this->language; + } + $language = JLanguage::getInstance($languageTag); + $this->alias = $language->transliterate($this->alias); + $this->alias = JFilterOutput::stringURLSafe($this->alias); + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + } + } + + if (K2_JVERSION == '15' || $params->get('enforceSEFReplacements')) + { + + $SEFReplacements = array(); + $items = explode(',', $params->get('SEFReplacements')); + foreach ($items as $item) + { + if (!empty($item)) + { + @list($src, $dst) = explode('|', trim($item)); + $SEFReplacements[trim($src)] = trim($dst); + } + } + + foreach ($SEFReplacements as $key => $value) + { + $this->alias = str_replace($key, $value, $this->alias); + } + + $this->alias = trim($this->alias, '-.'); + } + + if (K2_JVERSION == '15') + { + if (trim(str_replace('-', '', $this->alias)) == '') + { + $datenow = JFactory::getDate(); + $this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S"); + } + } + + // Check if alias already exists. If so warn the user + $params = JComponentHelper::getParams('com_k2'); + if ($params->get('k2Sef') && !$params->get('k2SefInsertItemId')) + { + $db = JFactory::getDbo(); + $db->setQuery("SELECT id FROM #__k2_items WHERE alias = ".$db->quote($this->alias)." AND id != ".(int)$this->id); + $result = count($db->loadObjectList()); + if ($result > 0) + { + $this->alias .= '-'.((int)$result + 1); + $application = JFactory::getApplication(); + $application->enqueueMessage(JText::_('K2_WARNING_DUPLICATE_TITLE_ALIAS_DETECTED'), 'notice'); + } + } + return true; + + } + + function bind($array, $ignore = '') + { + + if (key_exists('params', $array) && is_array($array['params'])) + { + $registry = new JRegistry(); + $registry->loadArray($array['params']); + $array['params'] = $registry->toString(); + } + + if (key_exists('plugins', $array) && is_array($array['plugins'])) + { + $registry = new JRegistry(); + $registry->loadArray($array['plugins']); + $array['plugins'] = $registry->toString(); + } + + return parent::bind($array, $ignore); + } + + function getNextOrder($where = '', $column = 'ordering') + { + + $query = "SELECT MAX({$column}) FROM #__k2_items"; + $query .= ($where ? " WHERE ".$where : ""); + $this->_db->setQuery($query); + $maxord = $this->_db->loadResult(); + if ($this->_db->getErrorNum()) + { + $this->setError($this->_db->getErrorMsg()); + return false; + } + return $maxord + 1; + } + + function reorder($where = '', $column = 'ordering') + { + + $k = $this->_tbl_key; + $query = "SELECT {$this->_tbl_key}, {$column} FROM #__k2_items WHERE {$column}>0"; + $query .= ($where ? " AND ".$where : ""); + $query .= " ORDER BY {$column}"; + + $this->_db->setQuery($query); + if (!($orders = $this->_db->loadObjectList())) + { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + for ($i = 0, $n = count($orders); $i < $n; $i++) + { + if ($orders[$i]->$column >= 0) + { + if ($orders[$i]->$column != $i + 1) + { + $orders[$i]->$column = $i + 1; + $query = "UPDATE #__k2_items SET {$column}=".(int)$orders[$i]->$column; + $query .= ' WHERE '.$k.' = '.$this->_db->Quote($orders[$i]->$k); + $this->_db->setQuery($query); + $this->_db->query(); + } + } + } + + return true; + } + + function move($dirn, $where = '', $column = 'ordering') + { + + $k = $this->_tbl_key; + + $sql = "SELECT $this->_tbl_key, {$column} FROM $this->_tbl"; + + if ($dirn < 0) + { + $sql .= ' WHERE '.$column.' < '.(int)$this->$column; + $sql .= ($where ? ' AND '.$where : ''); + $sql .= ' ORDER BY '.$column.' DESC'; + } + else if ($dirn > 0) + { + $sql .= ' WHERE '.$column.' > '.(int)$this->$column; + $sql .= ($where ? ' AND '.$where : ''); + $sql .= ' ORDER BY '.$column; + } + else + { + $sql .= ' WHERE '.$column.' = '.(int)$this->$column; + $sql .= ($where ? ' AND '.$where : ''); + $sql .= ' ORDER BY '.$column; + } + + $this->_db->setQuery($sql, 0, 1); + + $row = null; + $row = $this->_db->loadObject(); + + if (isset($row)) + { + $query = 'UPDATE '.$this->_tbl.' SET '.$column.' = '.(int)$row->$column.' WHERE '.$this->_tbl_key.' = '.$this->_db->Quote($this->$k); + $this->_db->setQuery($query); + + if (!$this->_db->query()) + { + $err = $this->_db->getErrorMsg(); + JError::raiseError(500, $err); + } + + $query = 'UPDATE '.$this->_tbl.' SET '.$column.' = '.(int)$this->$column.' WHERE '.$this->_tbl_key.' = '.$this->_db->Quote($row->$k); + $this->_db->setQuery($query); + + if (!$this->_db->query()) + { + $err = $this->_db->getErrorMsg(); + JError::raiseError(500, $err); + } + $this->$column = $row->$column; + } + else + { + $query = 'UPDATE '.$this->_tbl.' SET '.$column.' = '.(int)$this->$column.' WHERE '.$this->_tbl_key.' = '.$this->_db->Quote($this->$k); + $this->_db->setQuery($query); + + if (!$this->_db->query()) + { + $err = $this->_db->getErrorMsg(); + JError::raiseError(500, $err); + } + } + return true; + } + +} diff --git a/deployed/k2/administrator/components/com_k2/tables/k2tag.php b/deployed/k2/administrator/components/com_k2/tables/k2tag.php new file mode 100644 index 00000000..386ce0de --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/tables/k2tag.php @@ -0,0 +1,99 @@ +name = JString::trim($this->name); + $this->name = JString::str_ireplace('-', '', $this->name); + $this->name = JString::str_ireplace('.', '', $this->name); + + $params = JComponentHelper::getParams('com_k2'); + if ($params->get('k2TagNorm')) + { + $searches = array('À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'à', 'á', 'â', 'ã', 'ä', 'å', 'Ā', 'ā', 'Ă', 'ă', 'Ą', 'ą', 'Ç', 'ç', 'Ć', 'ć', 'Ĉ', 'ĉ', 'Ċ', 'ċ', 'Č', 'č', 'Ð', 'ð', 'Ď', 'ď', 'Đ', 'đ', 'È', 'É', 'Ê', 'Ë', 'è', 'é', 'ê', 'ë', 'Ē', 'ē', 'Ĕ', 'ĕ', 'Ė', 'ė', 'Ę', 'ę', 'Ě', 'ě', 'Ĝ', 'ĝ', 'Ğ', 'ğ', 'Ġ', 'ġ', 'Ģ', 'ģ', 'Ĥ', 'ĥ', 'Ħ', 'ħ', 'Ì', 'Í', 'Î', 'Ï', 'ì', 'í', 'î', 'ï', 'Ĩ', 'ĩ', 'Ī', 'ī', 'Ĭ', 'ĭ', 'Į', 'į', 'İ', 'ı', 'Ĵ', 'ĵ', 'Ķ', 'ķ', 'ĸ', 'Ĺ', 'ĺ', 'Ļ', 'ļ', 'Ľ', 'ľ', 'Ŀ', 'ŀ', 'Ł', 'ł', 'Ñ', 'ñ', 'Ń', 'ń', 'Ņ', 'ņ', 'Ň', 'ň', 'ʼn', 'Ŋ', 'ŋ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'Ō', 'ō', 'Ŏ', 'ŏ', 'Ő', 'ő', 'Ŕ', 'ŕ', 'Ŗ', 'ŗ', 'Ř', 'ř', 'Ś', 'ś', 'Ŝ', 'ŝ', 'Ş', 'ş', 'Š', 'š', 'ſ', 'Ţ', 'ţ', 'Ť', 'ť', 'Ŧ', 'ŧ', 'Ù', 'Ú', 'Û', 'Ü', 'ù', 'ú', 'û', 'ü', 'Ũ', 'ũ', 'Ū', 'ū', 'Ŭ', 'ŭ', 'Ů', 'ů', 'Ű', 'ű', 'Ų', 'ų', 'Ŵ', 'ŵ', 'Ý', 'ý', 'ÿ', 'Ŷ', 'ŷ', 'Ÿ', 'Ź', 'ź', 'Ż', 'ż', 'Ž', 'ž', 'Ά', 'ά', 'Έ', 'έ', 'Ή', 'ή', 'Ί', 'ί', 'Ό', 'ό', 'Ύ', 'ύ', 'Ώ', 'ώ', 'ϋ', 'ϊ', 'ΐ'); + $replacements = array('A', 'A', 'A', 'A', 'A', 'A', 'a', 'a', 'a', 'a', 'a', 'a', 'A', 'a', 'A', 'a', 'A', 'a', 'C', 'c', 'C', 'c', 'C', 'c', 'C', 'c', 'C', 'c', 'D', 'd', 'D', 'd', 'D', 'd', 'E', 'E', 'E', 'E', 'e', 'e', 'e', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'G', 'g', 'G', 'g', 'G', 'g', 'G', 'g', 'H', 'h', 'H', 'h', 'I', 'I', 'I', 'I', 'i', 'i', 'i', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'J', 'j', 'K', 'k', 'k', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'N', 'n', 'N', 'n', 'N', 'n', 'N', 'n', 'n', 'N', 'n', 'O', 'O', 'O', 'O', 'O', 'O', 'o', 'o', 'o', 'o', 'o', 'o', 'O', 'o', 'O', 'o', 'O', 'o', 'R', 'r', 'R', 'r', 'R', 'r', 'S', 's', 'S', 's', 'S', 's', 'S', 's', 's', 'T', 't', 'T', 't', 'T', 't', 'U', 'U', 'U', 'U', 'u', 'u', 'u', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'W', 'w', 'Y', 'y', 'y', 'Y', 'y', 'Y', 'Z', 'z', 'Z', 'z', 'Z', 'z', 'Α', 'α', 'Ε', 'ε', 'Η', 'η', 'Ι', 'ι', 'Ο', 'ο', 'Υ', 'υ', 'Ω', 'ω', 'υ', 'ι', 'ι'); + $additionalReplacements = $params->get('k2TagNormAdditionalReplacements'); + $pairs = @explode(',', $additionalReplacements); + if(is_array($pairs)) + { + foreach ($pairs as $pair) { + @list($search, $replace) = @explode('|', $pair); + if(isset($search) && $search && isset($replace) && $replace) + { + $searches[] = $search; + $replacements[] = $replace; + } + } + } + + //$this->name = JString::str_ireplace($searches, $replacements, $this->name); // This causes character stripping in J!1.5!! + $this->name = str_ireplace($searches, $replacements, $this->name); + + // Switch case + if ($params->get('k2TagNormCase') == 'upper') + { + $this->name = JString::strtoupper($this->name); + } + else + { + $this->name = JString::strtolower($this->name); + + // Special case for Greek letter s final + $this->name = JString::str_ireplace('σ ', 'ς ', $this->name); + if(JString::substr($this->name, -1) == 'σ') + { + $this->name = JString::substr($this->name, 0, -1); + $this->name .= 'ς'; + } + } + } + + $this->name = JString::trim($this->name); + if ($this->name == '') + { + $this->setError(JText::_('K2_TAG_CANNOT_BE_EMPTY')); + return false; + } + + if (strlen(utf8_decode($this->name)) < 2) + { + $this->setError(JText::_('K2_TAG_CANNOT_BE_A_SINGLE_CHARACTER')); + return false; + } + + // Check if a tag exists already before adding a new one + if (!$this->id) + { + $this->_db->setQuery("SELECT id FROM #__k2_tags WHERE name = ".$this->_db->Quote($this->name)); + if ($this->_db->loadResult()) + { + $this->setError(JText::_('K2_THIS_TAG_EXISTS_ALREADY')); + return false; + } + } + + return true; + } +} diff --git a/deployed/k2/administrator/components/com_k2/tables/k2user.php b/deployed/k2/administrator/components/com_k2/tables/k2user.php new file mode 100644 index 00000000..631e1521 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/tables/k2user.php @@ -0,0 +1,53 @@ +url) != '' && substr($this->url, 0, 7) != 'http://') + $this->url = 'http://'.$this->url; + return true; + } + + function bind($array, $ignore = '') + { + if (key_exists('plugins', $array) && is_array($array['plugins'])) + { + $registry = new JRegistry(); + $registry->loadArray($array['plugins']); + $array['plugins'] = $registry->toString(); + } + + return parent::bind($array, $ignore); + } +} diff --git a/deployed/k2/administrator/components/com_k2/tables/k2usergroup.php b/deployed/k2/administrator/components/com_k2/tables/k2usergroup.php new file mode 100644 index 00000000..3f76b678 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/tables/k2usergroup.php @@ -0,0 +1,53 @@ +name = JString::trim($this->name); + if ($this->name == '') + { + $this->setError(JText::_('K2_GROUP_CANNOT_BE_EMPTY')); + return false; + } + return true; + } + + function bind($array, $ignore = '') + { + + if (key_exists('params', $array) && is_array($array['params'])) + { + $registry = new JRegistry(); + $registry->loadArray($array['params']); + if (JRequest::getVar('categories') == 'all' || JRequest::getVar('categories') == 'none') + $registry->set('categories', JRequest::getVar('categories')); + $array['permissions'] = $registry->toString(); + } + return parent::bind($array, $ignore); + } + +} diff --git a/deployed/k2/administrator/components/com_k2/tables/table.php b/deployed/k2/administrator/components/com_k2/tables/table.php new file mode 100644 index 00000000..9c233fd0 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/tables/table.php @@ -0,0 +1,27 @@ + + +isSite() || $context == "modalselector"): ?> + +
    +
    + + + + + +
    + + + +
    +
    + + +
    + + + + + +
    + +
    + + + +
    +
    + lists['trash']; ?> + lists['state']; ?> + lists['categories']; ?> + lists['language'])): ?> + lists['language']; ?> + +
    +
    +
    + + + + + + + + + > + + + + + + + + + + + + + lists['language'])): ?> + + + + + + lists['language'])) $tfootColspan++; + if($context == "modalselector") $tfootColspan--; + ?> + + + + + + + rows as $key => $row) : ?> + + + + + + + + + + + + + + + + + + + lists['language'])): ?> + + + + + + +
    + ', 'c.ordering', @$this->lists['order_Dir'], @$this->lists['order'], null, 'asc', 'K2_ORDER'); ?> + # + lists['order_Dir'], @$this->lists['order'] ); ?> + + lists['order_Dir'], @$this->lists['order'] ); ?> ordering ?JHTML::_('grid.order', $this->rows ,'filesave.png' ):''; ?> + + + + lists['order_Dir'], @$this->lists['order'] ); ?> + + + + lists['order_Dir'], @$this->lists['order'] ); ?> + + lists['order_Dir'], @$this->lists['order'] ); ?> + + + lists['order_Dir'], @$this->lists['order']); ?> + lists['order_Dir'], @$this->lists['order'] ); ?> +
    + +
    + page->getLimitBox(); ?> +
    + + page->getListFooter(); ?> +
    + canChange): ?> + + + + + + "> + filter_trash || $row->trash) { $row->checked_out = 0; echo @JHTML::_('grid.checkedout', $row, $key );}?> + + filter_trash): ?> + trash): ?> + treename; ?> (numOfTrashedItems; ?>) + + treename; ?> (numOfItems.' '.JText::_('K2_ACTIVE'); ?> / numOfTrashedItems.' '.JText::_('K2_TRASHED'); ?>) + + + + id.'\', \''.str_replace(array("'", "\""), array("\\'", ""), $row->name).'\', \''.JRequest::getCmd('fid').'\', \''.JRequest::getVar('fname').'\', \''.JRequest::getCmd('output').'\'); return false;'; + } else { + $onClick = 'window.parent.k2ModalSelector(\''.$row->id.'\', \''.str_replace(array("'", "\""), array("\\'", ""), $row->name).'\'); return false;'; + } + ?> + + treename; ?> + params->get('showItemsCounterAdmin')): ?> + (numOfItems.' '.JText::_('K2_ACTIVE'); ?> / numOfTrashedItems.' '.JText::_('K2_TRASHED'); ?>) + + + + + treename; ?> + params->get('showItemsCounterAdmin')): ?> + (numOfItems.' '.JText::_('K2_ACTIVE'); ?> / numOfTrashedItems.' '.JText::_('K2_TRASHED'); ?>) + + + + + + page->orderUpIcon( $key, $row->parent == 0 || $row->parent == @$this->rows[$key-1]->parent, 'orderup', 'K2_MOVE_UP', $this->ordering); ?> page->orderDownIcon( $key, count($this->rows), $row->parent == 0 || $row->parent == @$this->rows[$key+1]->parent, 'orderdown', 'K2_MOVE_DOWN', $this->ordering ); ?> + ordering)?'':'disabled="disabled"'; ?> class="text_area k2OrderBox" /> + + inheritFrom; ?> + + extra_fields_group; ?> + + template; ?> + + filter_trash || K2_JVERSION != '15')? $row->groupname:JHTML::_('grid.access', $row, $key ); ?> + + status; ?> + + image): ?> + + + + + <?php echo JText::_('K2_PREVIEW_IMAGE'); ?> + + + + language; ?> + id; ?> +
    +
    +
    + + +
    +
    +
    +
    +

    + + 0 + + +
    +
    +
    +
    +
    +
    +
    + + +
    +
    + + +
    +
    +
    +
    +
    +
    +
    +
    +
    + + lists['batchCategories']; ?> +
    +
    + + lists['batchAccess']; ?> +
    +
    + + lists['batchExtraFieldsGroups']; ?> +
    +
    + lists['language'])): ?> + + lists['batchLanguage']; ?> + +
    +
    +
    +
    + +
    +
    + + + + + + + + + + + + + + + +
    + +isSite() || $context == "modalselector"): ?> +
    + diff --git a/deployed/k2/administrator/components/com_k2/views/categories/tmpl/element.php b/deployed/k2/administrator/components/com_k2/views/categories/tmpl/element.php new file mode 100644 index 00000000..4dabec54 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/categories/tmpl/element.php @@ -0,0 +1,73 @@ + +
    +

    + + + + + +
    + +
    + + + +
    +
    + lists['state']; ?> +
    + + + + + + + + + + + + + rows as $key => $row): ?> + + + + + + + + + + + + + + + +
    # lists['order_Dir'], @$this->lists['order'], 'element'); ?>lists['order_Dir'], @$this->lists['order'], 'element' ); ?>lists['order_Dir'], @$this->lists['order'], 'element' ); ?>lists['order_Dir'], @$this->lists['order'], 'element' ); ?>lists['order_Dir'], @$this->lists['order'], 'element' ); ?>
    name); ?>', 'id');">treename; ?>extra_fields_group; ?>groupname; ?>status; ?>id; ?>
    + +
    + page->getLimitBox(); ?> +
    + + page->getListFooter(); ?> +
    + + + + + + + +
    \ No newline at end of file diff --git a/deployed/k2/administrator/components/com_k2/views/categories/tmpl/move.php b/deployed/k2/administrator/components/com_k2/views/categories/tmpl/move.php new file mode 100644 index 00000000..b8ef1d73 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/categories/tmpl/move.php @@ -0,0 +1,46 @@ +addScriptDeclaration(" + Joomla.submitbutton = function(pressbutton) { + if (pressbutton == 'cancel') { + submitform( pressbutton ); + return; + } + if (\$K2.trim(\$K2('#category').val()) == '') { + alert( '".JText::_('K2_YOU_MUST_SELECT_A_PARENT_CATEGORY', true)."' ); + } else { + submitform( pressbutton ); + } + }; +"); + +?> + +
    +
    + + lists['categories']; ?> +
    +
    + (rows); ?>) +
      + rows as $row): ?> +
    1. name; ?>
    2. + +
    +
    + + + +
    diff --git a/deployed/k2/administrator/components/com_k2/views/categories/view.html.php b/deployed/k2/administrator/components/com_k2/views/categories/view.html.php new file mode 100644 index 00000000..141b481a --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/categories/view.html.php @@ -0,0 +1,274 @@ +getUserStateFromRequest('global.list.limit', 'limit', $application->getCfg('list_limit'), 'int'); + $limitstart = $application->getUserStateFromRequest($option.$view.'.limitstart', 'limitstart', 0, 'int'); + $filter_order = $application->getUserStateFromRequest($option.$view.'filter_order', 'filter_order', 'c.ordering', 'cmd'); + $filter_order_Dir = $application->getUserStateFromRequest($option.$view.'filter_order_Dir', 'filter_order_Dir', '', 'word'); + $filter_trash = $application->getUserStateFromRequest($option.$view.'filter_trash', 'filter_trash', 0, 'int'); + $filter_category = $application->getUserStateFromRequest($option.$view.'filter_category', 'filter_category', 0, 'int'); + $filter_state = $application->getUserStateFromRequest($option.$view.'filter_state', 'filter_state', -1, 'int'); + $language = $application->getUserStateFromRequest($option.$view.'language', 'language', '', 'string'); + $search = $application->getUserStateFromRequest($option.$view.'search', 'search', '', 'string'); + $search = JString::strtolower($search); + $search = trim(preg_replace('/[^\p{L}\p{N}\s\"\-_]/u', '', $search)); + $model = $this->getModel(); + $total = $model->getTotal(); + $task = JRequest::getCmd('task'); + if ($limitstart > $total - $limit) + { + $limitstart = max(0, (int)(ceil($total / $limit) - 1) * $limit); + JRequest::setVar('limitstart', $limitstart); + } + + $categories = $model->getData(); + $categoryModel = K2Model::getInstance('Category', 'K2Model'); + + // JS + $document->addScriptDeclaration(" + var K2SelectItemsError = '".JText::_('K2_SELECT_SOME_ITEMS_FIRST')."'; + + Joomla.submitbutton = function(pressbutton) { + if (pressbutton == 'trash') { + var answer = confirm('".JText::_('K2_WARNING_YOU_ARE_ABOUT_TO_TRASH_THE_SELECTED_CATEGORIES_THEIR_CHILDREN_CATEGORIES_AND_ALL_THEIR_INCLUDED_ITEMS', true)."') + if (answer){ + submitform(pressbutton); + } else { + return; + } + } else { + submitform(pressbutton); + } + }; + "); + + $this->assignRef('params', $params); + + if (K2_JVERSION != '15') + { + $langs = JLanguageHelper::getLanguages(); + $langsMapping = array(); + $langsMapping['*'] = JText::_('K2_ALL'); + foreach ($langs as $lang) + { + $langsMapping[$lang->lang_code] = $lang->title; + } + } + + for ($i = 0; $i < sizeof($categories); $i++) + { + $categories[$i]->status = K2_JVERSION == '15' ? JHTML::_('grid.published', $categories[$i], $i) : JHtml::_('jgrid.published', $categories[$i]->published, $i, '', $filter_trash == 0 && $task != 'element'); + if ($params->get('showItemsCounterAdmin')) + { + $categories[$i]->numOfItems = $categoryModel->countCategoryItems($categories[$i]->id); + $categories[$i]->numOfTrashedItems = $categoryModel->countCategoryItems($categories[$i]->id, 1); + } + if (K2_JVERSION == '30') + { + $categories[$i]->canChange = $user->authorise('core.edit.state', 'com_k2.category.'.$categories[$i]->id); + } + + // Detect the category template + if (K2_JVERSION != '15') + { + $categoryParams = json_decode($categories[$i]->params); + $categories[$i]->template = $categoryParams->theme; + $categories[$i]->language = $categories[$i]->language ? $categories[$i]->language : '*'; + if (isset($langsMapping)) + { + $categories[$i]->language = $langsMapping[$categories[$i]->language]; + } + } + else + { + if (function_exists('parse_ini_string')) + { + $categoryParams = parse_ini_string($categories[$i]->params); + $categories[$i]->template = $categoryParams['theme']; + } + else + { + $categoryParams = new JParameter($categories[$i]->params); + $categories[$i]->template = $categoryParams->get('theme'); + } + } + if (!$categories[$i]->template) + { + $categories[$i]->template = 'default'; + } + } + + $this->assignRef('rows', $categories); + + // Show message for trash entries in Categories + if(count($categories) && $filter_trash) { + $application->enqueueMessage(JText::_('K2_ALL_TRASHED_ITEMS_IN_A_CATEGORY_MUST_BE_DELETED_FIRST')); + } + + jimport('joomla.html.pagination'); + $pageNav = new JPagination($total, $limitstart, $limit); + $this->assignRef('page', $pageNav); + + $lists = array(); + + // Detect exact search phrase using double quotes in search string + if(substr($search, 0, 1)=='"' && substr($search, -1)=='"') + { + $lists['search'] = "\"".trim(str_replace('"', '', $search))."\""; + } + else + { + $lists['search'] = trim(str_replace('"', '', $search)); + } + + $lists['order_Dir'] = $filter_order_Dir; + $lists['order'] = $filter_order; + + $filter_trash_options[] = JHTML::_('select.option', 0, JText::_('K2_CURRENT')); + $filter_trash_options[] = JHTML::_('select.option', 1, JText::_('K2_TRASHED')); + $lists['trash'] = JHTML::_('select.genericlist', $filter_trash_options, 'filter_trash', '', 'value', 'text', $filter_trash); + + $filter_state_options[] = JHTML::_('select.option', -1, JText::_('K2_SELECT_STATE')); + $filter_state_options[] = JHTML::_('select.option', 1, JText::_('K2_PUBLISHED')); + $filter_state_options[] = JHTML::_('select.option', 0, JText::_('K2_UNPUBLISHED')); + $lists['state'] = JHTML::_('select.genericlist', $filter_state_options, 'filter_state', '', 'value', 'text', $filter_state); + + require_once JPATH_ADMINISTRATOR.'/components/com_k2/models/categories.php'; + $categoriesModel = K2Model::getInstance('Categories', 'K2Model'); + $categories_option[] = JHTML::_('select.option', 0, JText::_('K2_SELECT_CATEGORY')); + $categoriesFilter = $categoriesModel->categoriesTree(NULL, true, false); + $categoriesTree = $categoriesFilter; + $categories_options = @array_merge($categories_option, $categoriesFilter); + $lists['categories'] = JHTML::_('select.genericlist', $categories_options, 'filter_category', '', 'value', 'text', $filter_category); + + // Batch Operations + $extraFieldsModel = K2Model::getInstance('ExtraFields', 'K2Model'); + $extraFieldsGroups = $extraFieldsModel->getGroups(); + $options = array(); + $options[] = JHTML::_('select.option', '', JText::_('K2_LEAVE_UNCHANGED')); + $options[] = JHTML::_('select.option', '0', JText::_('K2_NONE_ONSELECTLISTS')); + foreach ($extraFieldsGroups as $extraFieldsGroup) + { + $name = $extraFieldsGroup->name; + $options[] = JHTML::_('select.option', $extraFieldsGroup->id, $name); + } + $lists['batchExtraFieldsGroups'] = JHTML::_('select.genericlist', $options, 'batchExtraFieldsGroups', '', 'value', 'text', null); + + array_unshift($categoriesTree, JHtml::_('select.option', '0', JText::_('K2_NONE_ONSELECTLISTS'))); + array_unshift($categoriesTree, JHtml::_('select.option', '', JText::_('K2_LEAVE_UNCHANGED'))); + + $lists['batchCategories'] = JHTML::_('select.genericlist', $categoriesTree, 'batchCategory', 'class="inputbox" size="8"', 'value', 'text', null); + + $lists['batchAccess'] = version_compare(JVERSION, '2.5', 'ge') ? JHTML::_('access.level', 'batchAccess', null, '', array(JHtml::_('select.option', '', JText::_('K2_LEAVE_UNCHANGED')))) : str_replace('size="3"', "", JHTML::_('list.accesslevel', '')); + + if (version_compare(JVERSION, '2.5.0', 'ge')) + { + $languages = JHTML::_('contentlanguage.existing', true, true); + array_unshift($languages, JHtml::_('select.option', '', JText::_('K2_LEAVE_UNCHANGED'))); + $lists['batchLanguage'] = JHTML::_('select.genericlist', $languages, 'batchLanguage', '', 'value', 'text', null); + } + + if (version_compare(JVERSION, '1.6.0', 'ge')) + { + $languages = JHTML::_('contentlanguage.existing', true, true); + array_unshift($languages, JHTML::_('select.option', '', JText::_('K2_SELECT_LANGUAGE'))); + $lists['language'] = JHTML::_('select.genericlist', $languages, 'language', '', 'value', 'text', $language); + } + $this->assignRef('lists', $lists); + + // Toolbar + JToolBarHelper::title(JText::_('K2_CATEGORIES'), 'k2.png'); + $toolbar = JToolBar::getInstance('toolbar'); + + if ($filter_trash == 1) + { + JToolBarHelper::deleteList('K2_ARE_YOU_SURE_YOU_WANT_TO_DELETE_SELECTED_CATEGORIES', 'remove', 'K2_DELETE'); + JToolBarHelper::custom('restore', 'publish.png', 'publish_f2.png', 'K2_RESTORE', true); + } + else + { + JToolBarHelper::addNew(); + JToolBarHelper::editList(); + JToolBarHelper::publishList(); + JToolBarHelper::unpublishList(); + JToolBarHelper::trash('trash'); + JToolBarHelper::custom('copy', 'copy.png', 'copy_f2.png', 'K2_COPY', true); + if (K2_JVERSION == '30') + { + $batchButton = ''.JText::_('K2_BATCH').''; + } + else + { + $batchButton = ''.JText::_('K2_BATCH').''; + } + $toolbar->appendButton('Custom', $batchButton); + } + + // Preferences (Parameters/Settings) + if (K2_JVERSION != '15') + { + JToolBarHelper::preferences('com_k2', 580, 800, 'K2_PARAMETERS'); + } + else + { + $toolbar->appendButton('Popup', 'config', 'K2_PARAMETERS', 'index.php?option=com_k2&view=settings', 800, 580); + } + + $this->loadHelper('html'); + K2HelperHTML::subMenu(); + + $this->assignRef('filter_trash', $filter_trash); + $template = $application->getTemplate(); + $this->assignRef('template', $template); + $ordering = (($this->lists['order'] == 'c.ordering' || $this->lists['order'] == 'c.parent, c.ordering') && (!$this->filter_trash)); + $this->assignRef('ordering', $ordering); + + // Joomla 3.0 drag-n-drop sorting variables + if (K2_JVERSION == '30') + { + if ($ordering) + { + JHtml::_('sortablelist.sortable', 'k2CategoriesList', 'adminForm', strtolower($this->lists['order_Dir']), 'index.php?option=com_k2&view=categories&task=saveorder&format=raw'); + } + $document->addScriptDeclaration(' + Joomla.orderTable = function() { + table = document.getElementById("sortTable"); + direction = document.getElementById("directionTable"); + order = table.options[table.selectedIndex].value; + if (order != \''.$this->lists['order'].'\') { + dirn = \'asc\'; + } else { + dirn = direction.options[direction.selectedIndex].value; + } + Joomla.tableOrdering(order, dirn, ""); + } + '); + } + + parent::display($tpl); + } +} diff --git a/deployed/k2/administrator/components/com_k2/views/category/tmpl/default.php b/deployed/k2/administrator/components/com_k2/views/category/tmpl/default.php new file mode 100644 index 00000000..2b2ab623 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/category/tmpl/default.php @@ -0,0 +1,414 @@ + + +
    + + +
    + +
      +
    • +
    • +
    • +
    + + +
    + +
    +
    + +
    +
    + +
    + +
    + +
    +
    + +
    + + +
    +
    + +
    +
    + lists['parent']; ?> +
    + +
    + +
    +
    + lists['inheritFrom']; ?> +
    +
    +
    + +
    +
    + +
    +
    + lists['extraFieldsGroup']; ?> +
    + +
    + +
    +
    + lists['published']; ?> +
    +
    + +
    + +
    +
    + +
    +
    + lists['access']; ?> +
    + + lists['language'])): ?> +
    + +
    +
    + lists['language']; ?> +
    + +
    +
    + +
    + + +
    + + + +
    +
    editor; ?> +
    +
    +
    +
    +
    + + +
    + + row->image)): ?> +
    +
    + +
    +
    + <?php echo $this->row->name; ?> + + +
    +
    + + +
    +
    + +
    +
    + + (: ) + + + +
    +
    +
    + +
    + + + + K2Plugins)): ?> +
    + K2Plugins as $K2Plugin): ?> + +
    + name; ?> + fields; ?> +
    + + +
    + +
    + +
    + + +
    +
    +

    +
    +
      + + form->getFieldset('category-metadata-information') as $field): ?> + type=='header') echo ' class="headerElement"';?>> + type=='header'): ?> +
      input; ?>
      + type=='Spacer'): ?> +
       
      +
      + +
      label; ?>
      +
      input; ?>
      +
      + + + + + form->getParams('params', 'category-metadata-information') as $param): ?> +
    • + +
      + +
      +
      +
      + +
    • + + +
    +
    +
    +
    + + +
    + +
      +
    • +
    • +
    • +
    • +
    • +
    + + +
    + +

    +
    +
    +
      + + form->getFieldset('category-item-layout') as $field): ?> + type=='header') echo ' class="headerElement"';?>> + type=='header'): ?> +
      input; ?>
      + type=='Spacer'): ?> +
       
      +
      + +
      label; ?>
      +
      input; ?>
      +
      + + + + + form->getParams('params', 'category-item-layout') as $param): ?> + type=='header') echo ' class="headerElement"';?>> + +
      + +
      +
      +
      + + + + +
    +
    +
    + +

    +
    +
    +
      + + form->getFieldset('category-view-options') as $field): ?> + type=='header') echo ' class="headerElement"';?>> + type=='header'): ?> +
      input; ?>
      + type=='Spacer'): ?> +
       
      +
      + +
      label; ?>
      +
      input; ?>
      +
      + + + + + form->getParams('params', 'category-view-options') as $param): ?> +
    • + +
      + +
      +
      +
      + +
    • + + +
    +
    +
    + +

    +
    +
    +
      + + form->getFieldset('item-image-options') as $field): ?> + type=='header') echo ' class="headerElement"';?>> + type=='header'): ?> +
      input; ?>
      + type=='Spacer'): ?> +
       
      +
      + +
      label; ?>
      +
      input; ?>
      +
      + + + + + form->getParams('params', 'item-image-options') as $param): ?> +
    • + +
      + +
      +
      +
      + +
    • + + +
    +
    +
    + +

    +
    +
    +
      + + form->getFieldset('item-view-options-listings') as $field): ?> + type=='header') echo ' class="headerElement"';?>> + type=='header'): ?> +
      input; ?>
      + type=='Spacer'): ?> +
       
      +
      + +
      label; ?>
      +
      input; ?>
      +
      + + + + + form->getParams('params', 'item-view-options-listings') as $param): ?> +
    • + +
      + +
      +
      +
      + +
    • + + +
    +
    +
    + +

    +
    +
    +
      + + form->getFieldset('item-view-options') as $field): ?> + type=='header') echo ' class="headerElement"';?>> + type=='header'): ?> +
      input; ?>
      + type=='Spacer'): ?> +
       
      +
      + +
      label; ?>
      +
      input; ?>
      +
      + + + + + form->getParams('params', 'item-view-options') as $param): ?> +
    • + +
      + +
      +
      +
      + +
    • + + +
    +
    +
    + + +
    +
    +
    + + + + + +
    diff --git a/deployed/k2/administrator/components/com_k2/views/category/view.html.php b/deployed/k2/administrator/components/com_k2/views/category/view.html.php new file mode 100644 index 00000000..0006cb15 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/category/view.html.php @@ -0,0 +1,139 @@ +getModel(); + $category = $model->getData(); + if (K2_JVERSION == '15') + { + JFilterOutput::objectHTMLSafe($category); + } + else + { + JFilterOutput::objectHTMLSafe($category, ENT_QUOTES, array('params', 'plugins')); + } + if (!$category->id) + $category->published = 1; + $this->assignRef('row', $category); + + // Editor + $wysiwyg = JFactory::getEditor(); + $editor = $wysiwyg->display('description', $category->description, '100%', '250px', '', '', array('pagebreak', 'readmore')); + $this->assignRef('editor', $editor); + $onSave = ''; + if(K2_JVERSION == '30') + { + $onSave = $wysiwyg->save('description'); + } + $this->assignRef('onSave', $onSave); + + // JS + $document->addScriptDeclaration(" + var K2BasePath = '".JURI::base(true)."/'; + + Joomla.submitbutton = function(pressbutton){ + if (pressbutton == 'cancel') { + submitform(pressbutton); + return; + } + if (\$K2.trim(\$K2('#name').val()) == '') { + alert( '".JText::_('K2_A_CATEGORY_MUST_AT_LEAST_HAVE_A_TITLE', true)."' ); + } else { + ".$onSave." + submitform(pressbutton); + } + }; + "); + + $lists = array(); + $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $category->published); + $lists['access'] = version_compare(JVERSION, '2.5', 'ge') ? JHTML::_('access.level', 'access', $category->access, '', false) : str_replace('size="3"', "", JHTML::_('list.accesslevel', $category)); + $query = 'SELECT ordering AS value, name AS text FROM #__k2_categories ORDER BY ordering'; + $lists['ordering'] = version_compare(JVERSION, '3.0', 'ge') ? NUll : JHTML::_('list.specificordering', $category, $category->id, $query); + $categories[] = JHTML::_('select.option', '0', JText::_('K2_NONE_ONSELECTLISTS')); + + require_once JPATH_ADMINISTRATOR.'/components/com_k2/models/categories.php'; + $categoriesModel = K2Model::getInstance('Categories', 'K2Model'); + $tree = $categoriesModel->categoriesTree($category, true, false); + $categories = array_merge($categories, $tree); + $lists['parent'] = JHTML::_('select.genericlist', $categories, 'parent', 'class="inputbox"', 'value', 'text', $category->parent); + + $extraFieldsModel = K2Model::getInstance('ExtraFields', 'K2Model'); + $groups = $extraFieldsModel->getGroups(); + $group[] = JHTML::_('select.option', '0', JText::_('K2_NONE_ONSELECTLISTS'), 'id', 'name'); + $group = array_merge($group, $groups); + $lists['extraFieldsGroup'] = JHTML::_('select.genericlist', $group, 'extraFieldsGroup', 'class="inputbox" size="1" ', 'id', 'name', $category->extraFieldsGroup); + + if (version_compare(JVERSION, '1.6.0', 'ge')) + { + $languages = JHTML::_('contentlanguage.existing', true, true); + $lists['language'] = JHTML::_('select.genericlist', $languages, 'language', '', 'value', 'text', $category->language); + } + + // Plugin Events + JPluginHelper::importPlugin('k2'); + $dispatcher = JDispatcher::getInstance(); + $K2Plugins = $dispatcher->trigger('onRenderAdminForm', array(&$category, 'category')); + $this->assignRef('K2Plugins', $K2Plugins); + + // Parameters + $params = JComponentHelper::getParams('com_k2'); + $this->assignRef('params', $params); + + if (version_compare(JVERSION, '1.6.0', 'ge')) + { + jimport('joomla.form.form'); + $form = JForm::getInstance('categoryForm', JPATH_COMPONENT_ADMINISTRATOR.'/models/category.xml'); + $values = array('params' => json_decode($category->params)); + $form->bind($values); + $inheritFrom = (isset($values['params']->inheritFrom)) ? $values['params']->inheritFrom : 0; + } + else + { + $form = new JParameter('', JPATH_COMPONENT_ADMINISTRATOR.'/models/category.xml'); + $form->loadINI($category->params); + $inheritFrom = $form->get('inheritFrom'); + } + $this->assignRef('form', $form); + + $categories[0] = JHTML::_('select.option', '0', JText::_('K2_NONE_ONSELECTLISTS')); + $lists['inheritFrom'] = JHTML::_('select.genericlist', $categories, 'params[inheritFrom]', 'class="inputbox"', 'value', 'text', $inheritFrom); + + $this->assignRef('lists', $lists); + + // Disable Joomla menu + JRequest::setVar('hidemainmenu', 1); + + // Toolbar + (JRequest::getInt('cid')) ? $title = JText::_('K2_EDIT_CATEGORY') : $title = JText::_('K2_ADD_CATEGORY'); + JToolBarHelper::title($title, 'k2.png'); + + JToolBarHelper::apply(); + JToolBarHelper::save(); + $saveNewIcon = version_compare(JVERSION, '2.5.0', 'ge') ? 'save-new.png' : 'save.png'; + JToolBarHelper::custom('saveAndNew', $saveNewIcon, 'save_f2.png', 'K2_SAVE_AND_NEW', false); + JToolBarHelper::cancel(); + + parent::display($tpl); + } + +} diff --git a/deployed/k2/administrator/components/com_k2/views/comments/tmpl/default.php b/deployed/k2/administrator/components/com_k2/views/comments/tmpl/default.php new file mode 100644 index 00000000..80e91b24 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/comments/tmpl/default.php @@ -0,0 +1,234 @@ + + +isSite() || $context == "modalselector"): ?> + +
    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    +
    + + +
    + + + + + +
    + +
    + + + +
    +
    + lists['state']; ?> + lists['categories']; ?> + mainframe->isAdmin()): ?> + lists['authors']; ?> + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + rows as $key=>$row): ?> + + + + + + + + + + + + + + + + + + +
    + # + + + + lists['order_Dir'], @$this->lists['order'] ); ?> + + lists['order_Dir'], @$this->lists['order'] ); ?> + + lists['order_Dir'], @$this->lists['order'] ); ?> + + lists['order_Dir'], @$this->lists['order'] ); ?> + + lists['order_Dir'], @$this->lists['order'] ); ?> + + IP + + + + lists['order_Dir'], @$this->lists['order'] ); ?> + + lists['order_Dir'], @$this->lists['order'] ); ?> + + + + lists['order_Dir'], @$this->lists['order'] ); ?> + + lists['order_Dir'], @$this->lists['order'] ); ?> +
    +
    + +
    + page->getLimitBox(); ?> +
    + + page->getListFooter(); ?> +
    +
    + + + checked_out = 0; echo @JHTML::_('grid.checkedout', $row, $key ); ?> + +
    commentText; ?>
    +
    + + +
    + + + +
    +
    +
    + +
    + status; ?> + + mainframe->isAdmin() && $row->userID): ?> + userName; ?> + + userName; ?> + + + + + commentURL): ?> + + + + + + commenterLastVisitIP): ?> + + commenterLastVisitIP; ?> + + + + reportUserLink): ?> + + + + itemID.':'.urlencode($row->itemAlias),$row->catid.':'.urlencode($row->catAlias)); ?> + title; ?> + + catName; ?> + + created_by); echo $user->name; ?> + + commentDate , $this->dateFormat); ?> + + id; ?> +
    + + + + + + + + + + + + + + isSite()): ?> + + + + +
    + +isSite() || $context == "modalselector"): ?> +
    + diff --git a/deployed/k2/administrator/components/com_k2/views/comments/view.html.php b/deployed/k2/administrator/components/com_k2/views/comments/view.html.php new file mode 100644 index 00000000..42934174 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/comments/view.html.php @@ -0,0 +1,265 @@ +getUserStateFromRequest('global.list.limit', 'limit', $application->getCfg('list_limit'), 'int'); + $limitstart = $application->getUserStateFromRequest($option.$view.'.limitstart', 'limitstart', 0, 'int'); + $filter_order = $application->getUserStateFromRequest($option.$view.'filter_order', 'filter_order', 'c.id', 'cmd'); + $filter_order_Dir = $application->getUserStateFromRequest($option.$view.'filter_order_Dir', 'filter_order_Dir', 'DESC', 'word'); + $filter_state = $application->getUserStateFromRequest($option.$view.'filter_state', 'filter_state', -1, 'int'); + $filter_category = $application->getUserStateFromRequest($option.$view.'filter_category', 'filter_category', 0, 'int'); + $filter_author = $application->getUserStateFromRequest($option.$view.'filter_author', 'filter_author', 0, 'int'); + $search = $application->getUserStateFromRequest($option.$view.'search', 'search', '', 'string'); + $search = JString::strtolower($search); + $search = trim(preg_replace('/[^\p{L}\p{N}\s\"\.\@\-_]/u', '', $search)); + if ($application->isSite()) + { + $filter_author = $user->id; + JRequest::setVar('filter_author', $user->id); + } + $this->loadHelper('html'); + + // Head includes + K2HelperHTML::loadHeadIncludes(true, false, true, true); + + // JS + $document->addScriptDeclaration(" + var K2Language = [ + '".JText::_('K2_YOU_CANNOT_EDIT_TWO_COMMENTS_AT_THE_SAME_TIME', true)."', + '".JText::_('K2_THIS_WILL_PERMANENTLY_DELETE_ALL_UNPUBLISHED_COMMENTS_ARE_YOU_SURE', true)."', + '".JText::_('K2_REPORT_USER_WARNING', true)."' + ]; + + Joomla.submitbutton = function(pressbutton) { + if (pressbutton == 'remove') { + if (document.adminForm.boxchecked.value==0){ + alert('".JText::_('K2_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST_TO_DELETE', true)."'); + return false; + } + if (confirm('".JText::_('K2_ARE_YOU_SURE_YOU_WANT_TO_DELETE_SELECTED_COMMENTS', true)."')){ + submitform(pressbutton); + } + } else if (pressbutton == 'deleteUnpublished') { + if (confirm('".JText::_('K2_THIS_WILL_PERMANENTLY_DELETE_ALL_UNPUBLISHED_COMMENTS_ARE_YOU_SURE', true)."')){ + submitform(pressbutton); + } + } else if (pressbutton == 'publish') { + if (document.adminForm.boxchecked.value==0){ + alert('".JText::_('K2_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST_TO_PUBLISH', true)."'); + return false; + } + submitform(pressbutton); + } else if (pressbutton == 'unpublish') { + if (document.adminForm.boxchecked.value==0){ + alert('".JText::_('K2_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST_TO_UNPUBLISH', true)."'); + return false; + } + submitform(pressbutton); + } else { + submitform(pressbutton); + } + }; + "); + + K2Model::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.'/models'); + $model = K2Model::getInstance('Comments', 'K2Model'); + $total = $model->getTotal(); + $comments = $model->getData(); + + if ($limitstart > $total - $limit) + { + $limitstart = max(0, (int)(ceil($total / $limit) - 1) * $limit); + JRequest::setVar('limitstart', $limitstart); + } + + $reportLink = $application->isAdmin() ? 'index.php?option=com_k2&view=user&task=report&id=' : 'index.php?option=com_k2&view=comments&task=reportSpammer&id='; + foreach ($comments as $key => $comment) + { + $comment->reportUserLink = false; + $comment->commenterLastVisitIP = NULL; + if ($comment->userID) + { + $db = JFactory::getDbo(); + $db->setQuery("SELECT ip FROM #__k2_users WHERE userID = ".$comment->userID); + $comment->commenterLastVisitIP = $db->loadResult(); + + $commenter = JFactory::getUser($comment->userID); + if ($commenter->name) + { + $comment->userName = $commenter->name; + } + if ($application->isSite()) + { + if (K2_JVERSION != '15') + { + if ($user->authorise('core.admin', 'com_k2')) + { + $comment->reportUserLink = JRoute::_($reportLink.$comment->userID); + } + } + else + { + if ($user->gid > 24) + { + $comment->reportUserLink = JRoute::_($reportLink.$comment->userID); + } + } + } + else + { + $comment->reportUserLink = JRoute::_($reportLink.$comment->userID); + } + } + + if ($application->isSite()) + { + $comment->status = K2HelperHTML::stateToggler($comment, $key); + } + else + { + $comment->status = K2_JVERSION == '15' ? JHTML::_('grid.published', $comment, $key) : JHtml::_('jgrid.published', $comment->published, $key); + } + + } + $this->assignRef('rows', $comments); + + // Pagination + jimport('joomla.html.pagination'); + $pageNav = new JPagination($total, $limitstart, $limit); + $this->assignRef('page', $pageNav); + + $lists = array(); + + // Detect exact search phrase using double quotes in search string + if(substr($search, 0, 1)=='"' && substr($search, -1)=='"') + { + $lists['search'] = "\"".trim(str_replace('"', '', $search))."\""; + } + else + { + $lists['search'] = trim(str_replace('"', '', $search)); + } + + $lists['order_Dir'] = $filter_order_Dir; + $lists['order'] = $filter_order; + + $filter_state_options[] = JHTML::_('select.option', -1, JText::_('K2_SELECT_STATE')); + $filter_state_options[] = JHTML::_('select.option', 1, JText::_('K2_PUBLISHED')); + $filter_state_options[] = JHTML::_('select.option', 0, JText::_('K2_UNPUBLISHED')); + $lists['state'] = JHTML::_('select.genericlist', $filter_state_options, 'filter_state', '', 'value', 'text', $filter_state); + + require_once JPATH_ADMINISTRATOR.'/components/com_k2/models/categories.php'; + $categoriesModel = K2Model::getInstance('Categories', 'K2Model'); + $categories_option[] = JHTML::_('select.option', 0, JText::_('K2_SELECT_CATEGORY')); + $categories = $categoriesModel->categoriesTree(null, true, false); + $categories_options = @array_merge($categories_option, $categories); + $lists['categories'] = JHTML::_('select.genericlist', $categories_options, 'filter_category', '', 'value', 'text', $filter_category); + + require_once JPATH_ADMINISTRATOR.'/components/com_k2/models/items.php'; + $itemsModel = K2Model::getInstance('Items', 'K2Model'); + $authors = $itemsModel->getItemsAuthors(); + $options = array(); + $options[] = JHTML::_('select.option', 0, JText::_('K2_NO_USER')); + foreach ($authors as $author) + { + $name = $author->name; + if ($author->block) + { + $name .= ' ['.JText::_('K2_USER_DISABLED').']'; + } + $options[] = JHTML::_('select.option', $author->id, $name); + } + $lists['authors'] = JHTML::_('select.genericlist', $options, 'filter_author', '', 'value', 'text', $filter_author); + $this->assignRef('lists', $lists); + $this->assignRef('mainframe', $application); + + if (K2_JVERSION != '15') + { + $dateFormat = JText::_('K2_J16_DATE_FORMAT'); + } + else + { + $dateFormat = JText::_('K2_DATE_FORMAT'); + } + $this->assignRef('dateFormat', $dateFormat); + + if ($application->isAdmin()) + { + // Toolbar + $toolbar = JToolBar::getInstance('toolbar'); + JToolBarHelper::title(JText::_('K2_COMMENTS'), 'k2.png'); + + JToolBarHelper::publishList(); + JToolBarHelper::unpublishList(); + JToolBarHelper::deleteList('', 'remove', 'K2_DELETE'); + JToolBarHelper::custom('deleteUnpublished', 'delete', 'delete', 'K2_DELETE_ALL_UNPUBLISHED', false); + + // Preferences (Parameters/Settings) + if (K2_JVERSION != '15') + { + JToolBarHelper::preferences('com_k2', 580, 800, 'K2_PARAMETERS'); + } + else + { + $toolbar->appendButton('Popup', 'config', 'K2_PARAMETERS', 'index.php?option=com_k2&view=settings', 800, 580); + } + K2HelperHTML::subMenu(); + + $userEditLink = JURI::base().'index.php?option=com_k2&view=user&cid='; + $this->assignRef('userEditLink', $userEditLink); + } + + if ($application->isSite()) + { + // Enforce the "system" template in the frontend + JRequest::setVar('template', 'system'); + + // JS + $document->addScriptDeclaration(" + /* K2 - Fix pagination in comment editing in the frontend */ + (function(\$){ + \$(document).ready(function(){ + var currentPageUrl = window.location.href; + if (currentPageUrl.indexOf('?') > 0) { + var concatenator = '&limitstart='; + } else { + var concatenator = '?limitstart='; + } + \$('.pagenav').each(function(){ + var counter = \$(this).attr('href').split('start='); + \$(this).attr('href', currentPageUrl+''+concatenator+''+counter[1]); + }); + }); + })(jQuery); + "); + + // CSS + $document->addStyleSheet(JURI::root(true).'/templates/system/css/general.css'); + $document->addStyleSheet(JURI::root(true).'/templates/system/css/system.css'); + } + + parent::display($tpl); + } +} diff --git a/deployed/k2/administrator/components/com_k2/views/extrafield/tmpl/default.php b/deployed/k2/administrator/components/com_k2/views/extrafield/tmpl/default.php new file mode 100644 index 00000000..c1194908 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/extrafield/tmpl/default.php @@ -0,0 +1,144 @@ +addScriptDeclaration(" + Joomla.submitbutton = function(pressbutton) { + if (pressbutton == 'cancel') { + submitform( pressbutton ); + return; + } + if (\$K2.trim(\$K2('#group').val()) == '') { + alert( '".JText::_('K2_PLEASE_SELECT_A_GROUP_OR_CREATE_A_NEW_ONE', true)."' ); + } + else if (\$K2.trim(\$K2('#name').val()) == '') { + alert( '".JText::_('K2_NAME_CANNOT_BE_EMPTY', true)."' ); + } + else if (\$K2('#type').val() == '0') { + alert( '".JText::_('K2_PLEASE_SELECT_THE_TYPE_OF_THE_EXTRA_FIELD', true)."' ); + } + else { + submitform( pressbutton ); + } + }; +"); + +?> + +
    +
    +

    + row->id): ?> + + + + +

    +
      +
    • +
      + +
      +
      + +
      +
    • +
    • +
      + +
      +
      + +
      +
    • +
    • +
      + +
      +
      + lists['published']; ?> +
      +
    • +
    • +
      + +
      +
      + lists['group']; ?> +
      +
      + + +
      +
    • +
    • +
      + +
      +
      + lists['type']; ?> +
      +
    • +
    • row->type == 'header') echo ' style="display:none;"'; ?>> +
      + +
      +
      + row->required) echo ' checked="checked"'; ?> /> + + row->required) echo ' checked="checked"'; ?> /> + +
      +
    • +
    • row->type != 'select' && $this->row->type != 'multipleSelect') echo ' style="display: none;"'; ?>> +
      + +
      + +
      + row->showNull) echo ' checked="checked"'; ?> /> + + row->showNull) echo ' checked="checked"'; ?> /> + +
      +
    • +
    • row->type != 'header') echo ' style="display:none;"'; ?>> +
      + +
      + +
      + row->displayInFrontEnd) echo ' checked="checked"'; ?> /> + + row->displayInFrontEnd) echo ' checked="checked"'; ?> /> + +
      +
    • +
    • +
      + +
      +
      +
      +
      +
    • +
    +
    + + + + + + + + +
    diff --git a/deployed/k2/administrator/components/com_k2/views/extrafield/view.html.php b/deployed/k2/administrator/components/com_k2/views/extrafield/view.html.php new file mode 100644 index 00000000..a43042b0 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/extrafield/view.html.php @@ -0,0 +1,145 @@ +addScriptDeclaration(' + var K2BasePath = "'.JURI::base(true).'/"; + var K2Language = [ + "'.JText::_('K2_REMOVE', true).'", + "'.JText::_('K2_OPTIONAL', true).'", + "'.JText::_('K2_COMMA_SEPARATED_VALUES', true).'", + "'.JText::_('K2_USE_EDITOR', true).'", + "'.JText::_('K2_ALL_SETTINGS_ABOVE_ARE_OPTIONAL', true).'", + "'.JText::_('K2_ADD_AN_OPTION', true).'", + "'.JText::_('K2_LINK_TEXT', true).'", + "'.JText::_('K2_URL', true).'", + "'.JText::_('K2_OPEN_IN', true).'", + "'.JText::_('K2_SAME_WINDOW', true).'", + "'.JText::_('K2_NEW_WINDOW', true).'", + "'.JText::_('K2_CLASSIC_JAVASCRIPT_POPUP', true).'", + "'.JText::_('K2_LIGHTBOX_POPUP', true).'", + "'.JText::_('K2_RESET_VALUE', true).'", + "'.JText::_('K2_CALENDAR', true).'", + "'.JText::_('K2_PLEASE_SELECT_A_FIELD_TYPE_FROM_THE_LIST_ABOVE', true).'", + "'.JText::_('K2_COLUMNS', true).'", + "'.JText::_('K2_ROWS', true).'", + ]; + '); + + $model = $this->getModel(); + $extraField = $model->getData(); + if (!$extraField->id) + { + $extraField->published = 1; + $extraField->alias = ''; + $extraField->required = 1; + $extraField->showNull = 0; + $extraField->displayInFrontEnd = 1; + } + else + { + $values = json_decode($extraField->value); + if (isset($values[0]->alias) && !empty($values[0]->alias)) + { + $extraField->alias = $values[0]->alias; + } + else + { + $extraField->alias = $extraField->name; + } + $searches = array('À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'à', 'á', 'â', 'ã', 'ä', 'å', 'Ā', 'ā', 'Ă', 'ă', 'Ą', 'ą', 'Ç', 'ç', 'Ć', 'ć', 'Ĉ', 'ĉ', 'Ċ', 'ċ', 'Č', 'č', 'Ð', 'ð', 'Ď', 'ď', 'Đ', 'đ', 'È', 'É', 'Ê', 'Ë', 'è', 'é', 'ê', 'ë', 'Ē', 'ē', 'Ĕ', 'ĕ', 'Ė', 'ė', 'Ę', 'ę', 'Ě', 'ě', 'Ĝ', 'ĝ', 'Ğ', 'ğ', 'Ġ', 'ġ', 'Ģ', 'ģ', 'Ĥ', 'ĥ', 'Ħ', 'ħ', 'Ì', 'Í', 'Î', 'Ï', 'ì', 'í', 'î', 'ï', 'Ĩ', 'ĩ', 'Ī', 'ī', 'Ĭ', 'ĭ', 'Į', 'į', 'İ', 'ı', 'Ĵ', 'ĵ', 'Ķ', 'ķ', 'ĸ', 'Ĺ', 'ĺ', 'Ļ', 'ļ', 'Ľ', 'ľ', 'Ŀ', 'ŀ', 'Ł', 'ł', 'Ñ', 'ñ', 'Ń', 'ń', 'Ņ', 'ņ', 'Ň', 'ň', 'ʼn', 'Ŋ', 'ŋ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'Ō', 'ō', 'Ŏ', 'ŏ', 'Ő', 'ő', 'Ŕ', 'ŕ', 'Ŗ', 'ŗ', 'Ř', 'ř', 'Ś', 'ś', 'Ŝ', 'ŝ', 'Ş', 'ş', 'Š', 'š', 'ſ', 'Ţ', 'ţ', 'Ť', 'ť', 'Ŧ', 'ŧ', 'Ù', 'Ú', 'Û', 'Ü', 'ù', 'ú', 'û', 'ü', 'Ũ', 'ũ', 'Ū', 'ū', 'Ŭ', 'ŭ', 'Ů', 'ů', 'Ű', 'ű', 'Ų', 'ų', 'Ŵ', 'ŵ', 'Ý', 'ý', 'ÿ', 'Ŷ', 'ŷ', 'Ÿ', 'Ź', 'ź', 'Ż', 'ż', 'Ž', 'ž', 'α', 'β', 'γ', 'δ', 'ε', 'ζ', 'η', 'θ', 'ι', 'κ', 'λ', 'μ', 'ν', 'ξ', 'ο', 'π', 'ρ', 'σ', 'τ', 'υ', 'φ', 'χ', 'ψ', 'ω', 'Α', 'Β', 'Γ', 'Δ', 'Ε', 'Ζ', 'Η', 'Θ', 'Ι', 'Κ', 'Λ', 'Μ', 'Ξ', 'Ο', 'Π', 'Ρ', 'Σ', 'Τ', 'Υ', 'Φ', 'Χ', 'Ψ', 'Ω', 'ά', 'έ', 'ή', 'ί', 'ό', 'ύ', 'ώ', 'Ά', 'Έ', 'Ή', 'Ί', 'Ό', 'Ύ', 'Ώ', 'ϊ', 'ΐ', 'ϋ', 'ς', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'А', 'Ӑ', 'Ӓ', 'Ә', 'Ӛ', 'Ӕ', 'Б', 'В', 'Г', 'Ґ', 'Ѓ', 'Ғ', 'Ӷ', 'Д', 'Е', 'Ѐ', 'Ё', 'Ӗ', 'Ҽ', 'Ҿ', 'Є', 'Ж', 'Ӂ', 'Җ', 'Ӝ', 'З', 'Ҙ', 'Ӟ', 'Ӡ', 'Ѕ', 'И', 'Ѝ', 'Ӥ', 'Ӣ', 'І', 'Ї', 'Ӏ', 'Й', 'Ҋ', 'Ј', 'К', 'Қ', 'Ҟ', 'Ҡ', 'Ӄ', 'Ҝ', 'Л', 'Ӆ', 'Љ', 'М', 'Ӎ', 'Н', 'Ӊ', 'Ң', 'Ӈ', 'Ҥ', 'Њ', 'О', 'Ӧ', 'Ө', 'Ӫ', 'Ҩ', 'П', 'Ҧ', 'Р', 'Ҏ', 'С', 'Ҫ', 'Т', 'Ҭ', 'Ћ', 'Ќ', 'У', 'Ў', 'Ӳ', 'Ӱ', 'Ӯ', 'Ү', 'Ұ', 'Ф', 'Х', 'Ҳ', 'Һ', 'Ц', 'Ҵ', 'Ч', 'Ӵ', 'Ҷ', 'Ӌ', 'Ҹ', 'Џ', 'Ш', 'Щ', 'Ъ', 'Ы', 'Ӹ', 'Ь', 'Ҍ', 'Э', 'Ӭ', 'Ю', 'Я', 'а', 'ӑ', 'ӓ', 'ә', 'ӛ', 'ӕ', 'б', 'в', 'г', 'ґ', 'ѓ', 'ғ', 'ӷ', 'y', 'д', 'е', 'ѐ', 'ё', 'ӗ', 'ҽ', 'ҿ', 'є', 'ж', 'ӂ', 'җ', 'ӝ', 'з', 'ҙ', 'ӟ', 'ӡ', 'ѕ', 'и', 'ѝ', 'ӥ', 'ӣ', 'і', 'ї', 'Ӏ', 'й', 'ҋ', 'ј', 'к', 'қ', 'ҟ', 'ҡ', 'ӄ', 'ҝ', 'л', 'ӆ', 'љ', 'м', 'ӎ', 'н', 'ӊ', 'ң', 'ӈ', 'ҥ', 'њ', 'о', 'ӧ', 'ө', 'ӫ', 'ҩ', 'п', 'ҧ', 'р', 'ҏ', 'с', 'ҫ', 'т', 'ҭ', 'ћ', 'ќ', 'у', 'ў', 'ӳ', 'ӱ', 'ӯ', 'ү', 'ұ', 'ф', 'х', 'ҳ', 'һ', 'ц', 'ҵ', 'ч', 'ӵ', 'ҷ', 'ӌ', 'ҹ', 'џ', 'ш', 'щ', 'ъ', 'ы', 'ӹ', 'ь', 'ҍ', 'э', 'ӭ', 'ю', 'я'); + $replacements = array('A', 'A', 'A', 'A', 'A', 'A', 'a', 'a', 'a', 'a', 'a', 'a', 'A', 'a', 'A', 'a', 'A', 'a', 'C', 'c', 'C', 'c', 'C', 'c', 'C', 'c', 'C', 'c', 'D', 'd', 'D', 'd', 'D', 'd', 'E', 'E', 'E', 'E', 'e', 'e', 'e', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'G', 'g', 'G', 'g', 'G', 'g', 'G', 'g', 'H', 'h', 'H', 'h', 'I', 'I', 'I', 'I', 'i', 'i', 'i', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'J', 'j', 'K', 'k', 'k', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'N', 'n', 'N', 'n', 'N', 'n', 'N', 'n', 'n', 'N', 'n', 'O', 'O', 'O', 'O', 'O', 'O', 'o', 'o', 'o', 'o', 'o', 'o', 'O', 'o', 'O', 'o', 'O', 'o', 'R', 'r', 'R', 'r', 'R', 'r', 'S', 's', 'S', 's', 'S', 's', 'S', 's', 's', 'T', 't', 'T', 't', 'T', 't', 'U', 'U', 'U', 'U', 'u', 'u', 'u', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'W', 'w', 'Y', 'y', 'y', 'Y', 'y', 'Y', 'Z', 'z', 'Z', 'z', 'Z', 'z', 'a', 'b', 'g', 'd', 'e', 'z', 'h', 'th', 'i', 'k', 'l', 'm', 'n', 'x', 'o', 'p', 'r', 's', 't', 'y', 'f', 'ch', 'ps', 'w', 'A', 'B', 'G', 'D', 'E', 'Z', 'H', 'Th', 'I', 'K', 'L', 'M', 'X', 'O', 'P', 'R', 'S', 'T', 'Y', 'F', 'Ch', 'Ps', 'W', 'a', 'e', 'h', 'i', 'o', 'y', 'w', 'A', 'E', 'H', 'I', 'O', 'Y', 'W', 'i', 'i', 'y', 's', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Zero', 'A', 'A', 'A', 'E', 'E', 'E', 'B', 'V', 'G', 'G', 'G', 'G', 'G', 'D', 'E', 'E', 'YO', 'E', 'E', 'E', 'YE', 'ZH', 'DZH', 'ZH', 'DZH', 'Z', 'Z', 'DZ', 'DZ', 'DZ', 'I', 'I', 'I', 'I', 'I', 'JI', 'I', 'Y', 'Y', 'J', 'K', 'Q', 'Q', 'K', 'Q', 'K', 'L', 'L', 'L', 'M', 'M', 'N', 'N', 'N', 'N', 'N', 'N', 'O', 'O', 'O', 'O', 'O', 'P', 'PF', 'P', 'P', 'S', 'S', 'T', 'TH', 'T', 'K', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'F', 'H', 'H', 'H', 'TS', 'TS', 'CH', 'CH', 'CH', 'CH', 'CH', 'DZ', 'SH', 'SHT', 'A', 'Y', 'Y', 'Y', 'Y', 'E', 'E', 'YU', 'YA', 'a', 'a', 'a', 'e', 'e', 'e', 'b', 'v', 'g', 'g', 'g', 'g', 'g', 'y', 'd', 'e', 'e', 'yo', 'e', 'e', 'e', 'ye', 'zh', 'dzh', 'zh', 'dzh', 'z', 'z', 'dz', 'dz', 'dz', 'i', 'i', 'i', 'i', 'i', 'ji', 'i', 'y', 'y', 'j', 'k', 'q', 'q', 'k', 'q', 'k', 'l', 'l', 'l', 'm', 'm', 'n', 'n', 'n', 'n', 'n', 'n', 'o', 'o', 'o', 'o', 'o', 'p', 'pf', 'p', 'p', 's', 's', 't', 'th', 't', 'k', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'f', 'h', 'h', 'h', 'ts', 'ts', 'ch', 'ch', 'ch', 'ch', 'ch', 'dz', 'sh', 'sht', 'a', 'y', 'y', 'y', 'y', 'e', 'e', 'yu', 'ya'); + $extraField->alias = str_replace($searches, $replacements, $extraField->alias); + $filter = JFilterInput::getInstance(); + $extraField->alias = $filter->clean($extraField->alias, 'WORD'); + + if (isset($values[0]->required)) + { + $extraField->required = $values[0]->required; + } + else + { + $extraField->required = 0; + } + if (isset($values[0]->showNull)) + { + $extraField->showNull = $values[0]->showNull; + } + else + { + $extraField->showNull = 0; + } + if (isset($values[0]->displayInFrontEnd)) + { + $extraField->displayInFrontEnd = $values[0]->displayInFrontEnd; + } + else + { + $extraField->displayInFrontEnd = 0; + } + } + $extraField->name = htmlspecialchars($extraField->name, ENT_QUOTES, 'UTF-8'); + $this->assignRef('row', $extraField); + + $lists = array(); + $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $extraField->published); + + $groups[] = JHTML::_('select.option', 0, JText::_('K2_CREATE_NEW_GROUP')); + + $extraFieldModel = K2Model::getInstance('ExtraFields', 'K2Model'); + $uniqueGroups = $extraFieldModel->getGroups(true); + foreach ($uniqueGroups as $group) + { + $groups[] = JHTML::_('select.option', $group->id, $group->name); + } + + $lists['group'] = JHTML::_('select.genericlist', $groups, 'groups', '', 'value', 'text', $extraField->group); + + $typeOptions[] = JHTML::_('select.option', 0, JText::_('K2_SELECT_TYPE')); + $typeOptions[] = JHTML::_('select.option', 'textfield', JText::_('K2_TEXT_FIELD')); + $typeOptions[] = JHTML::_('select.option', 'textarea', JText::_('K2_TEXTAREA')); + $typeOptions[] = JHTML::_('select.option', 'select', JText::_('K2_DROPDOWN_SELECTION')); + $typeOptions[] = JHTML::_('select.option', 'multipleSelect', JText::_('K2_MULTISELECT_LIST')); + $typeOptions[] = JHTML::_('select.option', 'radio', JText::_('K2_RADIO_BUTTONS')); + $typeOptions[] = JHTML::_('select.option', 'link', JText::_('K2_LINK')); + $typeOptions[] = JHTML::_('select.option', 'csv', JText::_('K2_CSV_DATA')); + $typeOptions[] = JHTML::_('select.option', 'labels', JText::_('K2_SEARCHABLE_LABELS')); + $typeOptions[] = JHTML::_('select.option', 'date', JText::_('K2_DATE')); + $typeOptions[] = JHTML::_('select.option', 'image', JText::_('K2_IMAGE')); + $typeOptions[] = JHTML::_('select.option', 'header', JText::_('K2_HEADER')); + $lists['type'] = JHTML::_('select.genericlist', $typeOptions, 'type', '', 'value', 'text', $extraField->type); + + $this->assignRef('lists', $lists); + + // Disable Joomla menu + JRequest::setVar('hidemainmenu', 1); + + // Toolbar + $title = (JRequest::getInt('cid')) ? JText::_('K2_EDIT_EXTRA_FIELD') : JText::_('K2_ADD_EXTRA_FIELD'); + JToolBarHelper::title($title, 'k2.png'); + + JToolBarHelper::apply(); + JToolBarHelper::save(); + JToolBarHelper::cancel(); + + parent::display($tpl); + } +} diff --git a/deployed/k2/administrator/components/com_k2/views/extrafields/tmpl/default.php b/deployed/k2/administrator/components/com_k2/views/extrafields/tmpl/default.php new file mode 100644 index 00000000..58da33cd --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/extrafields/tmpl/default.php @@ -0,0 +1,101 @@ + +
    + + + + + +
    + +
    + + + +
    +
    + lists['type']; ?> + lists['group']; ?> + lists['state']; ?> +
    + + + + + + + + + + + + + + + + + + + + + rows as $key=>$row): ?> + + + + + + + + + + + + + + + + + + + + + + + +
    + ', 'ordering', @$this->lists['order_Dir'], @$this->lists['order'], null, 'asc', 'K2_ORDER'); ?> + #lists['order_Dir'], @$this->lists['order'] ); ?>lists['order_Dir'], @$this->lists['order'] ); ?>lists['order_Dir'], @$this->lists['order']); ?> ordering) echo JHTML::_('grid.order', $this->rows ); ?>lists['order_Dir'], @$this->lists['order'] ); ?>lists['order_Dir'], @$this->lists['order'] ); ?>lists['order_Dir'], @$this->lists['order'] ); ?>
    + + + checked_out = 0; echo @JHTML::_('grid.checkedout', $row, $key ); ?>name; ?>
    : alias; ?>
    groupname; ?> + page->orderUpIcon($key, ($row->group == @$this->rows[$key-1]->group), 'orderup', 'Move Up', $this->ordering); ?> + page->orderDownIcon($key, count($this->rows), ($row->group == @$this->rows[$key+1]->group), 'orderdown', 'Move Down', $this->ordering); ?> + ordering ? '' : 'disabled="disabled"'; ?> + class="text_area" style="text-align: center" /> + type)); ?>status; ?>id; ?>
    + +
    + page->getLimitBox(); ?> +
    + + page->getListFooter(); ?> +
    + + + + + + + +
    \ No newline at end of file diff --git a/deployed/k2/administrator/components/com_k2/views/extrafields/view.html.php b/deployed/k2/administrator/components/com_k2/views/extrafields/view.html.php new file mode 100644 index 00000000..11451938 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/extrafields/view.html.php @@ -0,0 +1,146 @@ +getUserStateFromRequest('global.list.limit', 'limit', $application->getCfg('list_limit'), 'int'); + $limitstart = $application->getUserStateFromRequest($option.$view.'.limitstart', 'limitstart', 0, 'int'); + $filter_order = $application->getUserStateFromRequest($option.$view.'filter_order', 'filter_order', 'groupname', 'cmd'); + $filter_order_Dir = $application->getUserStateFromRequest($option.$view.'filter_order_Dir', 'filter_order_Dir', 'ASC', 'word'); + $filter_state = $application->getUserStateFromRequest($option.$view.'filter_state', 'filter_state', -1, 'int'); + $search = $application->getUserStateFromRequest($option.$view.'search', 'search', '', 'string'); + $search = JString::strtolower($search); + $search = trim(preg_replace('/[^\p{L}\p{N}\s\-_]/u', '', $search)); + $filter_type = $application->getUserStateFromRequest($option.$view.'filter_type', 'filter_type', '', 'string'); + $filter_group = $application->getUserStateFromRequest($option.$view.'filter_group', 'filter_group', '', 'string'); + + $model = $this->getModel(); + $total = $model->getTotal(); + if ($limitstart > $total - $limit) + { + $limitstart = max(0, (int)(ceil($total / $limit) - 1) * $limit); + JRequest::setVar('limitstart', $limitstart); + } + $extraFields = $model->getData(); + foreach ($extraFields as $key => $extraField) + { + $extraField->status = K2_JVERSION == '15' ? JHTML::_('grid.published', $extraField, $key) : JHtml::_('jgrid.published', $extraField->published, $key); + $values = json_decode($extraField->value); + if (isset($values[0]->alias) && !empty($values[0]->alias)) + { + $extraField->alias = $values[0]->alias; + } + else + { + $filter = JFilterInput::getInstance(); + $extraField->alias = $filter->clean($extraField->name, 'WORD'); + } + } + $this->assignRef('rows', $extraFields); + + jimport('joomla.html.pagination'); + $pageNav = new JPagination($total, $limitstart, $limit); + $this->assignRef('page', $pageNav); + + $lists = array(); + $lists['search'] = $search; + $lists['order_Dir'] = $filter_order_Dir; + $lists['order'] = $filter_order; + $filter_state_options[] = JHTML::_('select.option', -1, JText::_('K2_SELECT_STATE')); + $filter_state_options[] = JHTML::_('select.option', 1, JText::_('K2_PUBLISHED')); + $filter_state_options[] = JHTML::_('select.option', 0, JText::_('K2_UNPUBLISHED')); + $lists['state'] = JHTML::_('select.genericlist', $filter_state_options, 'filter_state', '', 'value', 'text', $filter_state); + + $extraFieldGroups = $model->getGroups(true); + $groups[] = JHTML::_('select.option', '0', JText::_('K2_SELECT_GROUP')); + + foreach ($extraFieldGroups as $extraFieldGroup) + { + $groups[] = JHTML::_('select.option', $extraFieldGroup->id, $extraFieldGroup->name); + } + $lists['group'] = JHTML::_('select.genericlist', $groups, 'filter_group', '', 'value', 'text', $filter_group); + + $typeOptions[] = JHTML::_('select.option', 0, JText::_('K2_SELECT_TYPE')); + $typeOptions[] = JHTML::_('select.option', 'textfield', JText::_('K2_TEXT_FIELD')); + $typeOptions[] = JHTML::_('select.option', 'textarea', JText::_('K2_TEXTAREA')); + $typeOptions[] = JHTML::_('select.option', 'select', JText::_('K2_DROPDOWN_SELECTION')); + $typeOptions[] = JHTML::_('select.option', 'multipleSelect', JText::_('K2_MULTISELECT_LIST')); + $typeOptions[] = JHTML::_('select.option', 'radio', JText::_('K2_RADIO_BUTTONS')); + $typeOptions[] = JHTML::_('select.option', 'link', JText::_('K2_LINK')); + $typeOptions[] = JHTML::_('select.option', 'csv', JText::_('K2_CSV_DATA')); + $typeOptions[] = JHTML::_('select.option', 'labels', JText::_('K2_SEARCHABLE_LABELS')); + $typeOptions[] = JHTML::_('select.option', 'date', JText::_('K2_DATE')); + $typeOptions[] = JHTML::_('select.option', 'image', JText::_('K2_IMAGE')); + $typeOptions[] = JHTML::_('select.option', 'header', JText::_('K2_HEADER')); + $lists['type'] = JHTML::_('select.genericlist', $typeOptions, 'filter_type', '', 'value', 'text', $filter_type); + + $this->assignRef('lists', $lists); + + // Toolbar + JToolBarHelper::title(JText::_('K2_EXTRA_FIELDS'), 'k2.png'); + + JToolBarHelper::addNew(); + JToolBarHelper::editList(); + JToolBarHelper::publishList(); + JToolBarHelper::unpublishList(); + JToolBarHelper::deleteList('K2_ARE_YOU_SURE_YOU_WANT_TO_DELETE_SELECTED_EXTRA_FIELDS', 'remove', 'K2_DELETE'); + + if (K2_JVERSION != '15') + { + JToolBarHelper::preferences('com_k2', 580, 800, 'K2_PARAMETERS'); + } + else + { + $toolbar = JToolBar::getInstance('toolbar'); + $toolbar->appendButton('Popup', 'config', 'K2_PARAMETERS', 'index.php?option=com_k2&view=settings', 800, 580); + } + + $this->loadHelper('html'); + K2HelperHTML::subMenu(); + + $ordering = ($this->lists['order'] == 'ordering'); + $this->assignRef('ordering', $ordering); + + // Joomla 3.x drag-n-drop sorting variables + if (K2_JVERSION == '30') + { + if ($ordering) + { + JHtml::_('sortablelist.sortable', 'k2ExtraFieldsList', 'adminForm', strtolower($this->lists['order_Dir']), 'index.php?option=com_k2&view=extrafields&task=saveorder&format=raw'); + } + $document = JFactory::getDocument(); + $document->addScriptDeclaration(' + Joomla.orderTable = function() { + table = document.getElementById("sortTable"); + direction = document.getElementById("directionTable"); + order = table.options[table.selectedIndex].value; + if (order != \''.$this->lists['order'].'\') { + dirn = \'asc\'; + } else { + dirn = direction.options[direction.selectedIndex].value; + } + Joomla.tableOrdering(order, dirn, ""); + } + '); + } + + parent::display($tpl); + } +} diff --git a/deployed/k2/administrator/components/com_k2/views/extrafieldsgroup/tmpl/default.php b/deployed/k2/administrator/components/com_k2/views/extrafieldsgroup/tmpl/default.php new file mode 100644 index 00000000..0593f73b --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/extrafieldsgroup/tmpl/default.php @@ -0,0 +1,55 @@ +addScriptDeclaration(" + Joomla.submitbutton = function(pressbutton){ + if (pressbutton == 'cancel') { + submitform( pressbutton ); + return; + } + if (\$K2.trim(\$K2('#name').val()) == '') { + alert( '".JText::_('K2_GROUP_NAME_CANNOT_BE_EMPTY', true)."' ); + } else { + submitform( pressbutton ); + } + }; +"); + +?> + +
    +
    +

    + row->id): ?> + + + + +

    +
      +
    • +
      + +
      +
      + +
      +
    • +
    +
    + + + + + +
    diff --git a/deployed/k2/administrator/components/com_k2/views/extrafieldsgroup/view.html.php b/deployed/k2/administrator/components/com_k2/views/extrafieldsgroup/view.html.php new file mode 100644 index 00000000..d82ff152 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/extrafieldsgroup/view.html.php @@ -0,0 +1,37 @@ +getModel(); + $extraFieldsGroup = $model->getExtraFieldsGroup(); + JFilterOutput::objectHTMLSafe($extraFieldsGroup); + $this->assignRef('row', $extraFieldsGroup); + + // Disable Joomla menu + JRequest::setVar('hidemainmenu', 1); + + // Toolbar + $title = (JRequest::getInt('cid')) ? JText::_('K2_EDIT_EXTRA_FIELD_GROUP') : JText::_('K2_ADD_EXTRA_FIELD_GROUP'); + JToolBarHelper::title($title, 'k2.png'); + + JToolBarHelper::apply(); + JToolBarHelper::save(); + JToolBarHelper::cancel(); + + parent::display($tpl); + } +} diff --git a/deployed/k2/administrator/components/com_k2/views/extrafieldsgroups/tmpl/default.php b/deployed/k2/administrator/components/com_k2/views/extrafieldsgroups/tmpl/default.php new file mode 100644 index 00000000..bcd7a7eb --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/extrafieldsgroups/tmpl/default.php @@ -0,0 +1,66 @@ +addScriptDeclaration(" + Joomla.submitbutton = function(pressbutton) { + if (pressbutton == 'remove') { + if (confirm('".JText::_('K2_WARNING_ARE_YOU_SURE_YOU_WANT_TO_DELETE_SELECTED_EXTRA_FIELDS_GROUPS_DELETING_THE_GROUPS_WILL_ALSO_DELETE_THE_ASSIGNED_EXTRA_FIELDS', true)."')){ + submitform( pressbutton ); + } + } else { + submitform( pressbutton ); + } + }; +"); + +?> + +
    + + + + + + + + + + + + + + + + rows as $key=>$row): ?> + + + + + + + + +
    #
    + +
    + page->getLimitBox(); ?> +
    + + page->getListFooter(); ?> +
    checked_out = 0; echo @JHTML::_('grid.checkedout', $row, $key ); ?>name; ?>categories; ?>
    + + + + + +
    diff --git a/deployed/k2/administrator/components/com_k2/views/extrafieldsgroups/view.html.php b/deployed/k2/administrator/components/com_k2/views/extrafieldsgroups/view.html.php new file mode 100644 index 00000000..17d63356 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/extrafieldsgroups/view.html.php @@ -0,0 +1,65 @@ +getUserStateFromRequest('global.list.limit', 'limit', $application->getCfg('list_limit'), 'int'); + $limitstart = $application->getUserStateFromRequest($option.$view.'.limitstart', 'limitstart', 0, 'int'); + $filter_order = $application->getUserStateFromRequest($option.$view.'filter_order', 'filter_order', '', 'cmd'); + $filter_order_Dir = $application->getUserStateFromRequest($option.$view.'filter_order_Dir', 'filter_order_Dir', '', 'word'); + + $model = $this->getModel(); + $total = $model->getTotalGroups(); + if ($limitstart > $total - $limit) + { + $limitstart = max(0, (int)(ceil($total / $limit) - 1) * $limit); + JRequest::setVar('limitstart', $limitstart); + } + $extraFieldGroups = $model->getGroups(); + + $this->assignRef('rows', $extraFieldGroups); + + jimport('joomla.html.pagination'); + $pageNav = new JPagination($total, $limitstart, $limit); + $this->assignRef('page', $pageNav); + + // Toolbar + JToolBarHelper::title(JText::_('K2_EXTRA_FIELD_GROUPS'), 'k2.png'); + + JToolBarHelper::addNew(); + JToolBarHelper::editList(); + JToolBarHelper::deleteList('', 'remove', 'K2_DELETE'); + + if (K2_JVERSION != '15') + { + JToolBarHelper::preferences('com_k2', 580, 800, 'K2_PARAMETERS'); + } + else + { + $toolbar = JToolBar::getInstance('toolbar'); + $toolbar->appendButton('Popup', 'config', 'K2_PARAMETERS', 'index.php?option=com_k2&view=settings', 800, 580); + } + + $this->loadHelper('html'); + K2HelperHTML::subMenu(); + + parent::display($tpl); + } +} diff --git a/deployed/k2/administrator/components/com_k2/views/info/tmpl/default.php b/deployed/k2/administrator/components/com_k2/views/info/tmpl/default.php new file mode 100644 index 00000000..2244d8c4 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/info/tmpl/default.php @@ -0,0 +1,524 @@ + + +
    +
    +
      +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    + +
    + + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
     
    class.upload.php0.34devGNU/GPL v2
    PHP5 Akismet0.5BSD
    jQuery1.7.2 - 1.12.4MIT
    jQuery UI1.8.24 & 1.11.4MIT
    elFinder2.1.28BSD
    Select24.0.3MIT
    Magnific Popup1.1.0MIT
    fancyBox3.1.20GNU/GPL v3
    flatpickr2.6.3MIT
    NicEdit0.9 r25MIT
    Font Awesome4.7.0MIT
    Simple Line Icons2.4.1MIT
    Ionicons2.0.1MIT
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
     
    server; ?>
    php_version; ?>
    db_version; ?>
    gd_check) { $gdinfo=gd_info(); echo $gdinfo["GD Version"]; } else echo JText::_('K2_DISABLED'); ?>
    mb_check) echo JText::_('K2_ENABLED'); else echo JText::_('K2_DISABLED'); ?>
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
     
    cache + cache_folder_check): ?> + + + + +
    media/k2 + media_folder_check): ?> + + + + +
    media/k2/attachments + attachments_folder_check): ?> + + + + +
    media/k2/categories + categories_folder_check): ?> + + + + +
    media/k2/galleries + galleries_folder_check): ?> + + + + +
    media/k2/items + items_folder_check): ?> + + + + +
    media/k2/users + users_folder_check): ?> + + + + +
    media/k2/videos + videos_folder_check): ?> + + + + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
     
    mod_k2_comments + + + + + +
    mod_k2_content + + + + + +
    mod_k2_tools + + + + + +
    mod_k2_user + + + + + +
    mod_k2_users + + + + + +
    mod_k2_quickicons (administrator) + + + + + +
    mod_k2_stats (administrator) + + + + + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
     
    Finder - K2 + + + + + +  -  + + + + + +
    Search - K2 + + + + + +  -  + + + + + +
    System - K2 + + + + + +  -  + + + + + +
    User - K2 + + + + + +  -  + + + + + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + +
     
    + + + + + + + +
    + + + + + + + +
    +
    +
    +
    +
    +
    diff --git a/deployed/k2/administrator/components/com_k2/views/info/view.html.php b/deployed/k2/administrator/components/com_k2/views/info/view.html.php new file mode 100644 index 00000000..61020bf4 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/info/view.html.php @@ -0,0 +1,87 @@ +getVersion(); + $php_version = phpversion(); + $server = $this->get_server_software(); + $gd_check = extension_loaded('gd'); + $mb_check = extension_loaded('mbstring'); + + $media_folder_check = is_writable(JPATH_ROOT.'/media/k2'); + $attachments_folder_check = is_writable(JPATH_ROOT.'/media/k2/attachments'); + $categories_folder_check = is_writable(JPATH_ROOT.'/media/k2/categories'); + $galleries_folder_check = is_writable(JPATH_ROOT.'/media/k2/galleries'); + $items_folder_check = is_writable(JPATH_ROOT.'/media/k2/items'); + $users_folder_check = is_writable(JPATH_ROOT.'/media/k2/users'); + $videos_folder_check = is_writable(JPATH_ROOT.'/media/k2/videos'); + $cache_folder_check = is_writable(JPATH_ROOT.'/cache'); + + $this->assignRef('server', $server); + $this->assignRef('php_version', $php_version); + $this->assignRef('db_version', $db_version); + $this->assignRef('gd_check', $gd_check); + $this->assignRef('mb_check', $mb_check); + + $this->assignRef('media_folder_check', $media_folder_check); + $this->assignRef('attachments_folder_check', $attachments_folder_check); + $this->assignRef('categories_folder_check', $categories_folder_check); + $this->assignRef('galleries_folder_check', $galleries_folder_check); + $this->assignRef('items_folder_check', $items_folder_check); + $this->assignRef('users_folder_check', $users_folder_check); + $this->assignRef('videos_folder_check', $videos_folder_check); + $this->assignRef('cache_folder_check', $cache_folder_check); + + JToolBarHelper::title(JText::_('K2_INFORMATION'), 'k2.png'); + + if (K2_JVERSION != '15') + { + JToolBarHelper::preferences('com_k2', 580, 800, 'K2_PARAMETERS'); + } + else + { + $toolbar = JToolBar::getInstance('toolbar'); + $toolbar->appendButton('Popup', 'config', 'K2_PARAMETERS', 'index.php?option=com_k2&view=settings', 800, 580); + } + + $this->loadHelper('html'); + K2HelperHTML::subMenu(); + + parent::display($tpl); + } + + function get_server_software() + { + if (isset($_SERVER['SERVER_SOFTWARE'])) + { + return $_SERVER['SERVER_SOFTWARE']; + } + else if (($sf = getenv('SERVER_SOFTWARE'))) + { + return $sf; + } + else + { + return JText::_('K2_NA'); + } + } + +} diff --git a/deployed/k2/administrator/components/com_k2/views/item/tmpl/default.php b/deployed/k2/administrator/components/com_k2/views/item/tmpl/default.php new file mode 100644 index 00000000..e8aaa70d --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/item/tmpl/default.php @@ -0,0 +1,1098 @@ + + +mainframe->isSite()): ?> + +
    +
    + + + + + + +
    + + + + + + + +
    +
    + + +
    + + mainframe->isSite() && !$this->permissions->get('publish')): ?> +
    +

    +
    + + + +
    + + row->id): ?> +
    row->id; ?>
    + + +
      +
    • +
    • + mainframe->isAdmin()): ?> +
    • + +
    + + +
    + +
    +
    + +
    +
    + +
    + +
    + +
    +
    + +
    + +
    + +
    +
    + lists['categories']; ?> + + mainframe->isAdmin() || ($this->mainframe->isSite() && $this->permissions->get('publish'))): ?> +
    +
    + +
    +
    + lists['featured']; ?> +
    + +
    + +
    +
    + lists['published']; ?> +
    +
    + +
    + +
    + +
    +
    + params->get('taggingSystem')): ?> + +
      + row->tags) && count($this->row->tags)): ?> + row->tags as $tag): ?> +
    • + name; ?> + × + +
    • + + +
    • + +
    • +
    • +
    +

    + +

    + + + params->get('lockTags') || $this->user->gid>23): ?> +
    + + +
    +
    +
    + + + + + + + + + + +
    + lists['tags']; ?> + + +
    +
    + +
    + lists['selectedTags']; ?> +
    + +
    + +
    + +
    +
    +
    +
    + + row->author; ?> + + + mainframe->isAdmin() || ($this->mainframe->isSite() && $this->permissions->get('editAll'))): ?> + + + + + +
    + +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + lists['access']; ?> +
    + lists['language'])): ?> +
    + +
    +
    + lists['language']; ?> +
    + +
    +
    +
    + + +
    +

    +
      +
    • +
    +
    + + +
    +
      +
    • + params->get('showImageTab')): ?> +
    • + + params->get('showImageGalleryTab')): ?> +
    • + + params->get('showVideoTab')): ?> +
    • + + params->get('showExtraFieldsTab')): ?> +
    • + + params->get('showAttachmentsTab')): ?> +
    • + + K2PluginsItemOther)) && $this->params->get('showK2Plugins')): ?> +
    • + +
    + + +
    + params->get('mergeEditors')): ?> +
    + text; ?> +
    +
    +
    + +
    + + introtext; ?> +
    +
    +
    +
    + + fulltext; ?> +
    +
    +
    + + K2PluginsItemContent)): ?> +
    + K2PluginsItemContent as $K2Plugin): ?> + +
    + name; ?> +
    + fields; ?> +
    +
    + + +
    + +
    +
    + params->get('showImageTab')): ?> + +
    + +
    +
    + +
    + +
    + + (: ) + + + + + +
    +
    + + row->image)): ?> +
    +
    + +
    + +
    + + <?php echo $this->row->title; ?> + + + +
    +
    + + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + + K2PluginsItemImage)): ?> +
    + K2PluginsItemImage as $K2Plugin): ?> + +
    +
    +
    + +
    +
    + fields; ?> +
    +
    +
    + + +
    + +
    + + + params->get('showImageGalleryTab')): ?> + + +
    + lists['checkSIG']): ?> + + + + +
    +
    +
    +
      +
    • +
    +
    +
    + +
    +
    +
    +
    +
      +
    • +
    +
    +
    +
    + +
    +

    +

    +
    + + + K2PluginsItemGallery)): ?> +
    + K2PluginsItemGallery as $K2Plugin): ?> + +
    +
    + name; ?> +
    + fields; ?> +
    +
    +
    + + +
    + +
    + + params->get('showVideoTab')): ?> + + +
    + lists['checkAllVideos']): ?> +
    +
    +
    + +
    + +
    +
    +
      +
    • +
    • +
    • +
    • +
    + +
    +
    + + (: ) +
    +
    + +
    +
    +
    + + + +
    + +
    + +
    + +
    + +
    + +
    + +
    +
    +
    + +
    + +
    + +
    + +
    +
    + lists['providers']; ?> +
    + +
    + +
    +
    + +
    + + +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +
    + + row->video): ?> +
    +
    + +
    +
    + row->video; ?> +
    + + +
    +
    + + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    + + + + +
    +
    +
    +
      +
    • +
    +
    +
    + +
    +
    +
    +
    +
      +
    • +
    +
    +
    +
    + +
    +

    +

    +
    + + + +
    +
      +
    • +
    + +
    +
    + +
    + +
    +
    +
    + + row->video): ?> +
    +
    + +
    +
    + row->video; ?> + + +
    +
    + + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + + + + K2PluginsItemVideo)): ?> +
    + K2PluginsItemVideo as $K2Plugin): ?> + +
    + name; ?> +
    + fields; ?> +
    +
    + + +
    + + +
    + + params->get('showExtraFieldsTab')): ?> + +
    +
    + + extraFields)): ?> +
    + extraFields as $extraField): ?> +
    + + type == 'header'): ?> +

    name; ?>

    + + +
    + +
    +
    + element; ?> +
    + +
    + +
    + + + +
    +
    +
    +
      +
    • +
    +
    +
    + +
    +
    +
    +
    +
      +
    • +
    +
    +
    +
    + +
    +

    +
    +

    +
    +
    + + +
    + K2PluginsItemExtraFields)): ?> +
    + K2PluginsItemExtraFields as $K2Plugin): ?> + +
    + name; ?> +
    fields; ?>
    +
    + + +
    + +
    + + params->get('showAttachmentsTab')): ?> + +
    +
    + row->attachments)): ?> + + + + + + + + + row->attachments as $attachment): ?> + + + + + + + + +
    + + + + + + + + + +
    + filename; ?> + + title; ?> + + titleAttribute; ?> + + hits; ?> + + + + + + + + + +
    + +
    +
    + + (: ) +
    +
    + + K2PluginsItemAttachments)): ?> +
    + K2PluginsItemAttachments as $K2Plugin): ?> + +
    + name; ?> +
    fields; ?>
    +
    + + +
    + +
    + + K2PluginsItemOther)) && $this->params->get('showK2Plugins')): ?> + +
    +
    + K2PluginsItemOther as $K2Plugin): ?> + +
    + name; ?> + fields; ?> +
    + + +
    +
    + +
    + + + + mainframe->isSite()): ?> + + + + + + + + + +
    + + +
    + +
      + row->id): ?> +
    • + +
    • +
    • +
    + +
    + + row->id): ?> +

    +
    +
    + +
      +
    • + + +
    • + +
    • + + +
    • +
    • + + +
    • +
    • + + +
    • +
    • + + +
    • +
    • + + +
    • + row->moderator): ?> +
    • + + +
    • + +
    +
    + +
    +
    + + + row->hits; ?> + row->hits): ?> +
    + +
    + +
    +
    + +
    +
    + + + row->ratingCount): ?> + row->ratingSum/$this->row->ratingCount), 2); ?>/5.00 + + 0.00/5.00 + + + row->ratingCount; ?> row->ratingCount == 1) ? JText::_('K2_VOTE') : JText::_('K2_VOTES'); ?> + +
    + +
    +
    +
    +
    + + +
    + +

    +
      +
    • +
      + +
      +
      + + +
      +
    • +
      + +
      +
      + + +
      +
    • +
    • +
      + +
      +
      + + +
      +
    • +
    + +
    + + +

    +
      +
    • +
      + +
      +
      + +
      +
    • + +
    • +
      + +
      +
      + +
      +
    • +
    • +
      + +
      +
      + lists['metarobots']; ?> +
      +
    • +
    • +
      + +
      +
      + +
      +
    • +
        +
    +
    +
    + + mainframe->isAdmin()): ?> +
    + +
      +
    • +
    • +
    + +
    + +

    +
    +
    +
      + + form->getFieldset('item-view-options-listings') as $field): ?> + type=='header') echo ' class="headerElement"'; ?>> + type=='header'): ?> +
      input; ?>
      + type=='Spacer'): ?> +
       
      +
      + +
      label; ?>
      +
      input; ?>
      +
      + + + + + form->getParams('params', 'item-view-options-listings') as $param): ?> + > + +
      + +
      +
      +
      + + + + +
    +
    +
    + +

    +
    +
    +
      + + form->getFieldset('item-view-options') as $field): ?> + type=='header') echo ' class="headerElement"'; ?>> + type=='header'): ?> +
      input; ?>
      + type=='Spacer'): ?> +
       
      +
      + +
      label; ?>
      +
      input; ?>
      +
      + + + + + form->getParams('params', 'item-view-options') as $param): ?> + > + +
      + +
      +
      +
      + + + + +
    +
    +
    + +
    + +
    + +
    + +
    + +mainframe->isSite()): ?> +
    + diff --git a/deployed/k2/administrator/components/com_k2/views/item/view.html.php b/deployed/k2/administrator/components/com_k2/views/item/view.html.php new file mode 100644 index 00000000..91d59d8a --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/item/view.html.php @@ -0,0 +1,631 @@ +addScriptDeclaration(" + var K2BasePath = '".JURI::base(true)."/'; + var K2Language = [ + '".JText::_('K2_REMOVE', true)."', + '".JText::_('K2_LINK_TITLE_OPTIONAL', true)."', + '".JText::_('K2_LINK_TITLE_ATTRIBUTE_OPTIONAL', true)."', + '".JText::_('K2_ARE_YOU_SURE', true)."', + '".JText::_('K2_YOU_ARE_NOT_ALLOWED_TO_POST_TO_THIS_CATEGORY', true)."', + '".JText::_('K2_OR_SELECT_A_FILE_ON_THE_SERVER', true)."' + ]; + + Joomla.submitbutton = function(pressbutton){ + if (pressbutton == 'cancel') { + submitform( pressbutton ); + return; + } + if (\$K2.trim(\$K2('#title').val()) == '') { + alert( '".JText::_('K2_ITEM_MUST_HAVE_A_TITLE', true)."' ); + } + else if (\$K2.trim(\$K2('#catid').val()) == '0') { + alert( '".JText::_('K2_PLEASE_SELECT_A_CATEGORY', true)."' ); + } + else { + syncExtraFieldsEditor(); + var validation = validateExtraFields(); + if(validation === true) { + \$K2('#selectedTags option').attr('selected', 'selected'); + submitform( pressbutton ); + } + } + }; + "); + + K2Model::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.'/models'); + $model = K2Model::getInstance('Item', 'K2Model', array('table_path' => JPATH_COMPONENT_ADMINISTRATOR.'/tables')); + $item = $model->getData(); + JFilterOutput::objectHTMLSafe($item, ENT_QUOTES, array( + 'video', + 'params', + 'plugins' + )); + + // Permissions check for frontend editing + if ($application->isSite()) + { + JLoader::register('K2HelperPermissions', JPATH_COMPONENT.'/helpers/permissions.php'); + if ($task == 'edit' && !K2HelperPermissions::canEditItem($item->created_by, $item->catid)) + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + if ($task == 'add' && !K2HelperPermissions::canAddItem()) + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + + // Get user permissions + $K2Permissions = K2Permissions::getInstance(); + $this->assignRef('permissions', $K2Permissions->permissions); + + // Build permissions message + $permissionsLabels = array(); + if ($this->permissions->get('add')) + { + $permissionsLabels[] = JText::_('K2_ADD_ITEMS'); + } + if ($this->permissions->get('editOwn')) + { + $permissionsLabels[] = JText::_('K2_EDIT_OWN_ITEMS'); + } + if ($this->permissions->get('editAll')) + { + $permissionsLabels[] = JText::_('K2_EDIT_ANY_ITEM'); + } + if ($this->permissions->get('publish')) + { + $permissionsLabels[] = JText::_('K2_PUBLISH_ITEMS'); + } + if ($this->permissions->get('editPublished')) + { + $permissionsLabels[] = JText::_('K2_ALLOW_EDITING_OF_ALREADY_PUBLISHED_ITEMS'); + } + + $permissionsMessage = JText::_('K2_YOU_ARE_ALLOWED_TO').' '.implode(', ', $permissionsLabels); + + $this->assignRef('permissionsMessage', $permissionsMessage); + } + + if ($item->isCheckedOut($user->get('id'), $item->checked_out)) + { + $message = JText::_('K2_THE_ITEM').': '.$item->title.' '.JText::_('K2_IS_CURRENTLY_BEING_EDITED_BY_ANOTHER_ADMINISTRATOR'); + $url = ($application->isSite()) ? 'index.php?option=com_k2&view=item&id='.$item->id.'&tmpl=component' : 'index.php?option=com_k2'; + $application->enqueueMessage($message); + $application->redirect($url); + } + + if ($item->id) + { + $item->checkout($user->get('id')); + } + else + { + $item->published = 1; + $item->publish_down = $db->getNullDate(); + $item->modified = $db->getNullDate(); + $date = JFactory::getDate(); + $now = K2_JVERSION == '15' ? $date->toMySQL() : $date->toSql(); + $item->created = $now; + $item->publish_up = $item->created; + } + + $lists = array(); + if (version_compare(JVERSION, '1.6.0', 'ge')) + { + $dateFormat = 'Y-m-d H:i:s'; + } + else + { + $dateFormat = '%Y-%m-%d %H:%M:%S'; + } + + // Date/time + $created = $item->created; + $publishUp = $item->publish_up; + $publishDown = $item->publish_down; + + $created = JHTML::_('date', $item->created, $dateFormat); + $publishUp = JHTML::_('date', $item->publish_up, $dateFormat); + if ((int)$item->publish_down) + { + $publishDown = JHTML::_('date', $item->publish_down, $dateFormat); + } + else + { + $publishDown = ''; + } + + $lists['createdCalendar'] = $created; + $lists['publish_up'] = $publishUp; + $lists['publish_down'] = $publishDown; + + if ($item->id) + { + $lists['created'] = JHTML::_('date', $item->created, JText::_('DATE_FORMAT_LC2')); + } + else + { + $lists['created'] = JText::_('K2_NEW_DOCUMENT'); + } + + if ($item->modified == $db->getNullDate() || !$item->id) + { + $lists['modified'] = JText::_('K2_NEVER'); + } + else + { + $lists['modified'] = JHTML::_('date', $item->modified, JText::_('DATE_FORMAT_LC2')); + } + + // Editors + $wysiwyg = JFactory::getEditor(); + $onSave = ''; + if ($params->get("mergeEditors")) + { + + if (JString::strlen($item->fulltext) > 1) + { + $textValue = $item->introtext."
    ".$item->fulltext; + } + else + { + $textValue = $item->introtext; + } + $text = $wysiwyg->display('text', $textValue, '100%', '400px', '', ''); + $this->assignRef('text', $text); + if (K2_JVERSION == '30') + { + $onSave = $wysiwyg->save('text'); + } + } + else + { + $introtext = $wysiwyg->display('introtext', $item->introtext, '100%', '400px', '', '', array('readmore')); + $this->assignRef('introtext', $introtext); + $fulltext = $wysiwyg->display('fulltext', $item->fulltext, '100%', '400px', '', '', array('readmore')); + $this->assignRef('fulltext', $fulltext); + if (K2_JVERSION == '30') + { + $onSave = $wysiwyg->save('introtext'); + $onSave .= $wysiwyg->save('fulltext'); + } + } + $document->addScriptDeclaration("function onK2EditorSave(){ ".$onSave." }"); + + // Publishing + $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $item->published); + $lists['featured'] = JHTML::_('select.booleanlist', 'featured', 'class="inputbox"', $item->featured); + $lists['access'] = version_compare(JVERSION, '2.5', 'ge') ? JHTML::_('access.level', 'access', $item->access, '', false) : str_replace('size="3"', "", JHTML::_('list.accesslevel', $item)); + + $query = "SELECT ordering AS value, title AS text FROM #__k2_items WHERE catid={$item->catid}"; + $lists['ordering'] = version_compare(JVERSION, '3.0', 'ge') ? NUll : JHTML::_('list.specificordering', $item, $item->id, $query); + + if (!$item->id) + $item->catid = $application->getUserStateFromRequest('com_k2itemsfilter_category', 'catid', 0, 'int'); + + require_once JPATH_ADMINISTRATOR.'/components/com_k2/models/categories.php'; + $categoriesModel = K2Model::getInstance('Categories', 'K2Model'); + $categories = $categoriesModel->categoriesTree(); + $lists['catid'] = JHTML::_('select.genericlist', $categories, 'catid', 'class="inputbox"', 'value', 'text', $item->catid); + + if (version_compare(JVERSION, '1.6.0', 'ge')) + { + $languages = JHTML::_('contentlanguage.existing', true, true); + $lists['language'] = JHTML::_('select.genericlist', $languages, 'language', '', 'value', 'text', $item->language); + } + + $lists['checkSIG'] = $model->checkSIG(); + $lists['checkAllVideos'] = $model->checkAllVideos(); + + $remoteVideo = false; + $providerVideo = false; + $embedVideo = false; + + if (stristr($item->video, 'remote}') !== false) + { + $remoteVideo = true; + $options['startOffset'] = 1; + } + + $providers = $model->getVideoProviders(); + + if (count($providers)) + { + + foreach ($providers as $provider) + { + $providersOptions[] = JHTML::_('select.option', $provider, ucfirst($provider)); + if (stristr($item->video, "{{$provider}}") !== false) + { + $providerVideo = true; + $options['startOffset'] = 2; + } + } + + } + + if (JString::substr($item->video, 0, 1) !== '{') + { + $embedVideo = true; + $options['startOffset'] = 3; + } + + $lists['uploadedVideo'] = (!$remoteVideo && !$providerVideo && !$embedVideo) ? true : false; + if ($lists['uploadedVideo'] || $item->video == '') + { + $options['startOffset'] = 0; + } + $document->addScriptDeclaration("var K2ActiveMediaTab = ".$options['startOffset']); + + $lists['remoteVideo'] = ($remoteVideo) ? preg_replace('%\{[a-z0-9-_]*\}(.*)\{/[a-z0-9-_]*\}%i', '\1', $item->video) : ''; + $lists['remoteVideoType'] = ($remoteVideo) ? preg_replace('%\{([a-z0-9-_]*)\}.*\{/[a-z0-9-_]*\}%i', '\1', $item->video) : ''; + $lists['providerVideo'] = ($providerVideo) ? preg_replace('%\{[a-z0-9-_]*\}(.*)\{/[a-z0-9-_]*\}%i', '\1', $item->video) : ''; + $lists['providerVideoType'] = ($providerVideo) ? preg_replace('%\{([a-z0-9-_]*)\}.*\{/[a-z0-9-_]*\}%i', '\1', $item->video) : ''; + $lists['embedVideo'] = ($embedVideo) ? $item->video : ''; + + if (isset($providersOptions)) + { + $lists['providers'] = JHTML::_('select.genericlist', $providersOptions, 'videoProvider', '', 'value', 'text', $lists['providerVideoType']); + } + + JPluginHelper::importPlugin('content', 'jw_sigpro'); + JPluginHelper::importPlugin('content', 'jw_allvideos'); + + $dispatcher = JDispatcher::getInstance(); + + // Detect gallery type + if (JString::strpos($item->gallery, 'http://') || JString::strpos($item->gallery, 'https://')) + { + $item->galleryType = 'flickr'; + $item->galleryValue = JString::substr($item->gallery, 9); + $item->galleryValue = JString::substr($item->galleryValue, 0, -10); + } + else + { + $item->galleryType = 'server'; + $item->galleryValue = ''; + } + + $params->set('galleries_rootfolder', 'media/k2/galleries'); + $item->text = $item->gallery; + if (K2_JVERSION == '15') + { + $dispatcher->trigger('onPrepareContent', array( + &$item, + &$params, + null + )); + } + else + { + $dispatcher->trigger('onContentPrepare', array( + 'com_k2.'.$view, + &$item, + &$params, + null + )); + } + $item->gallery = $item->text; + + if (!$embedVideo) + { + $params->set('vfolder', 'media/k2/videos'); + $params->set('afolder', 'media/k2/audio'); + if (JString::strpos($item->video, 'remote}')) + { + preg_match("#}(.*?){/#s", $item->video, $matches); + if (JString::substr($matches[1], 0, 7) != 'http://' || JString::substr($matches[1], 0, 8) != 'https://') + { + $item->video = str_replace($matches[1], JURI::root().$matches[1], $item->video); + } + } + $item->text = $item->video; + + if (K2_JVERSION == '15') + { + $dispatcher->trigger('onPrepareContent', array( + &$item, + &$params, + null + )); + } + else + { + $dispatcher->trigger('onContentPrepare', array( + 'com_k2.'.$view, + &$item, + &$params, + null + )); + } + + $item->video = $item->text; + } + + if (isset($item->created_by)) + { + $author = JUser::getInstance($item->created_by); + $item->author = $author->name; + } + else + { + $item->author = $user->name; + } + if (isset($item->modified_by)) + { + $moderator = JUser::getInstance($item->modified_by); + $item->moderator = $moderator->name; + } + + if ($item->id) + { + $active = $item->created_by; + } + else + { + $active = $user->id; + } + + $categories_option[] = JHTML::_('select.option', 0, JText::_('K2_SELECT_CATEGORY')); + $categories = $categoriesModel->categoriesTree(NUll, true, false); + if ($application->isSite()) + { + JLoader::register('K2HelperPermissions', JPATH_SITE.'/components/com_k2/helpers/permissions.php'); + if (($task == 'add' || $task == 'edit') && !K2HelperPermissions::canAddToAll()) + { + for ($i = 0; $i < sizeof($categories); $i++) + { + if (!K2HelperPermissions::canAddItem($categories[$i]->value) && $task == 'add') + { + $categories[$i]->disable = true; + } + if (!K2HelperPermissions::canEditItem($item->created_by, $categories[$i]->value) && $task == 'edit') + { + $categories[$i]->disable = true; + } + } + } + } + $categories_options = @array_merge($categories_option, $categories); + $lists['categories'] = JHTML::_('select.genericlist', $categories_options, 'catid', '', 'value', 'text', $item->catid); + + JTable::addIncludePath(JPATH_COMPONENT.'/tables'); + $category = JTable::getInstance('K2Category', 'Table'); + $category->load($item->catid); + + // Extra fields + $extraFieldModel = K2Model::getInstance('ExtraField', 'K2Model'); + if ($category->id) + { + $extraFields = $extraFieldModel->getExtraFieldsByGroup($category->extraFieldsGroup); + } + else + { + $extraFields = NULL; + } + + for ($i = 0; $i < sizeof($extraFields); $i++) + { + $extraFields[$i]->element = $extraFieldModel->renderExtraField($extraFields[$i], $item->id); + } + + // Attachments + if ($item->id) + { + $item->attachments = $model->getAttachments($item->id); + $rating = $model->getRating(); + if (is_null($rating)) + { + $item->ratingSum = 0; + $item->ratingCount = 0; + } + else + { + $item->ratingSum = (int)$rating->rating_sum; + $item->ratingCount = (int)$rating->rating_count; + } + } + else + { + $item->attachments = NULL; + $item->ratingSum = 0; + $item->ratingCount = 0; + } + + // Tags + if ($user->gid < 24 && $params->get('lockTags')) + { + $params->set('taggingSystem', 0); + } + + $tags = $model->getAvailableTags($item->id); + $lists['tags'] = JHTML::_('select.genericlist', $tags, 'tags', 'multiple="multiple" size="10" ', 'id', 'name'); + + if (isset($item->id)) + { + $item->tags = $model->getCurrentTags($item->id); + $lists['selectedTags'] = JHTML::_('select.genericlist', $item->tags, 'selectedTags[]', 'multiple="multiple" size="10" ', 'id', 'name'); + } + else + { + $lists['selectedTags'] = ''; + } + + // Metadata + $lists['metadata'] = class_exists('JParameter') ? new JParameter($item->metadata) : new JRegistry($item->metadata); + $metaRobotsOptions = array( + '' => JText::_('K2_USE_GLOBAL'), + 'index, follow' => JText::_('K2_METADATA_ROBOTS_INDEX_FOLLOW'), + 'index, nofollow' => JText::_('K2_METADATA_ROBOTS_INDEX_NOFOLLOW'), + 'noindex, follow' => JText::_('K2_METADATA_ROBOTS_NOINDEX_FOLLOW'), + 'noindex, nofollow' => JText::_('K2_METADATA_ROBOTS_NOINDEX_NOFOLLOW') + ); + $lists['metarobots'] = JHTML::_('select.genericlist', $metaRobotsOptions, 'meta[robots]', 'class="inputbox" ', 'value', 'text', $lists['metadata']->get('robots')); + + // Image + $date = JFactory::getDate($item->modified); + $timestamp = '?t='.$date->toUnix(); + + if (JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.md5("Image".$item->id).'_S.jpg')) + { + $item->thumb = JURI::root().'media/k2/items/cache/'.md5("Image".$item->id).'_S.jpg'.$timestamp; + } + if (JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.md5("Image".$item->id).'_XL.jpg')) + { + $item->image = JURI::root().'media/k2/items/cache/'.md5("Image".$item->id).'_XL.jpg'.$timestamp; + } + + // Plugin Events + JPluginHelper::importPlugin('k2'); + $dispatcher = JDispatcher::getInstance(); + + $K2PluginsItemContent = $dispatcher->trigger('onRenderAdminForm', array( + &$item, + 'item', + 'content' + )); + $this->assignRef('K2PluginsItemContent', $K2PluginsItemContent); + + $K2PluginsItemImage = $dispatcher->trigger('onRenderAdminForm', array( + &$item, + 'item', + 'image' + )); + $this->assignRef('K2PluginsItemImage', $K2PluginsItemImage); + + $K2PluginsItemGallery = $dispatcher->trigger('onRenderAdminForm', array( + &$item, + 'item', + 'gallery' + )); + $this->assignRef('K2PluginsItemGallery', $K2PluginsItemGallery); + + $K2PluginsItemVideo = $dispatcher->trigger('onRenderAdminForm', array( + &$item, + 'item', + 'video' + )); + $this->assignRef('K2PluginsItemVideo', $K2PluginsItemVideo); + + $K2PluginsItemExtraFields = $dispatcher->trigger('onRenderAdminForm', array( + &$item, + 'item', + 'extra-fields' + )); + $this->assignRef('K2PluginsItemExtraFields', $K2PluginsItemExtraFields); + + $K2PluginsItemAttachments = $dispatcher->trigger('onRenderAdminForm', array( + &$item, + 'item', + 'attachments' + )); + $this->assignRef('K2PluginsItemAttachments', $K2PluginsItemAttachments); + + $K2PluginsItemOther = $dispatcher->trigger('onRenderAdminForm', array( + &$item, + 'item', + 'other' + )); + $this->assignRef('K2PluginsItemOther', $K2PluginsItemOther); + + // Parameters + if (version_compare(JVERSION, '1.6.0', 'ge')) + { + jimport('joomla.form.form'); + $form = JForm::getInstance('itemForm', JPATH_COMPONENT_ADMINISTRATOR.'/models/item.xml'); + $values = array('params' => json_decode($item->params)); + $form->bind($values); + } + else + { + $form = new JParameter('', JPATH_COMPONENT_ADMINISTRATOR.'/models/item.xml'); + $form->loadINI($item->params); + } + $this->assignRef('form', $form); + + $nullDate = $db->getNullDate(); + $this->assignRef('nullDate', $nullDate); + + $this->assignRef('extraFields', $extraFields); + $this->assignRef('options', $options); + $this->assignRef('row', $item); + $this->assignRef('lists', $lists); + $this->assignRef('params', $params); + $this->assignRef('user', $user); + (JRequest::getInt('cid')) ? $title = JText::_('K2_EDIT_ITEM') : $title = JText::_('K2_ADD_ITEM'); + $this->assignRef('title', $title); + $this->assignRef('mainframe', $application); + + // Disable Joomla menu + JRequest::setVar('hidemainmenu', 1); + + if ($application->isAdmin()) + { + // Toolbar + JToolBarHelper::title($title, 'k2.png'); + + JToolBarHelper::apply(); + JToolBarHelper::save(); + $saveNewIcon = version_compare(JVERSION, '2.5.0', 'ge') ? 'save-new.png' : 'save.png'; + JToolBarHelper::custom('saveAndNew', $saveNewIcon, 'save_f2.png', 'K2_SAVE_AND_NEW', false); + JToolBarHelper::cancel(); + + // Tabs + $this->params->set('showImageTab', true); + $this->params->set('showImageGalleryTab', true); + $this->params->set('showVideoTab', true); + $this->params->set('showExtraFieldsTab', true); + $this->params->set('showAttachmentsTab', true); + $this->params->set('showK2Plugins', true); + } + + // For SIGPro + if (JPluginHelper::isEnabled('k2', 'jw_sigpro')) + { + $sigPro = true; + $sigProFolder = ($this->row->id) ? $this->row->id : uniqid(); + $this->assignRef('sigProFolder', $sigProFolder); + } + else + { + $sigPro = false; + } + $this->assignRef('sigPro', $sigPro); + + parent::display($tpl); + } +} diff --git a/deployed/k2/administrator/components/com_k2/views/items/tmpl/batch.php b/deployed/k2/administrator/components/com_k2/views/items/tmpl/batch.php new file mode 100644 index 00000000..1e14172b --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/items/tmpl/batch.php @@ -0,0 +1,74 @@ + + +
    +
    +
    +

    + + ids); ?> + + +
    +
    +
    +
    +
    +
    +
    + + +
    +
    + + +
    +
    +
    +
    +
    +
    +
    +
    +
    + + lists['categories']; ?> +
    +
    + + lists['access']; ?> +
    +
    + + lists['author']; ?> +
    +
    + lists['language'])): ?> + + lists['language']; ?> + +
    +
    +
    +
    + + ids as $id): ?> + + + + + + + +
    diff --git a/deployed/k2/administrator/components/com_k2/views/items/tmpl/default.php b/deployed/k2/administrator/components/com_k2/views/items/tmpl/default.php new file mode 100644 index 00000000..44e123cb --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/items/tmpl/default.php @@ -0,0 +1,349 @@ + + +isSite() || $context == "modalselector"): ?> + +
    +
    + + + + + +
    + + + +
    +
    + + +
    + + + + + +
    + +
    + + + +
    +
    + lists['trash']; ?> + lists['featured']; ?> + lists['state']; ?> + lists['categories']; ?> + lists['tag'])): ?> + lists['tag']; ?> + + lists['authors']; ?> + lists['language'])): ?> + lists['language']; ?> + + + filters as $filter):?> + + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + lists['language'])): ?> + + + + columns as $column):?> + + + + + columns); + if(K2_JVERSION != '30') $tfootColspan++; + if(isset($this->lists['language'])) $tfootColspan++; + if($context == "modalselector") $tfootColspan--; + ?> + + + + + + + rows as $key => $row): ?> + filter_featured!='1') echo ' sortable-group-id="'.$row->catid.'"'; ?>> + + + + + + + + + + + + + + + + + + + + + lists['language'])): ?> + + + + columns as $column):?> + class) echo ' class="'.$column->class.'"'; ?>> + property; echo $row->$property; ?> + + + + + +
    + filter_featured=='1'): ?> + ', 'i.featured_ordering', @$this->lists['order_Dir'], @$this->lists['order'], null, 'asc', 'K2_FEATURED_ORDER'); ?> + + ', 'i.ordering', @$this->lists['order_Dir'], @$this->lists['order'], null, 'asc', 'K2_ORDER'); ?> + + #"> + + + lists['order_Dir'], @$this->lists['order']); ?> + + lists['order_Dir'], @$this->lists['order']); ?> + + lists['order_Dir'], @$this->lists['order']); ?> + + filter_featured=='1'): ?> + lists['order_Dir'], @$this->lists['order']); ?> + ordering) {echo JHTML::_('grid.order', $this->rows, 'filesave.png','savefeaturedorder');} ?> + + lists['order_Dir'], @$this->lists['order']); ?> + ordering) {echo JHTML::_('grid.order', $this->rows);} ?> + + + lists['order_Dir'], @$this->lists['order']); ?> + + lists['order_Dir'], @$this->lists['order']); ?> + + lists['order_Dir'], @$this->lists['order']); ?> + + lists['order_Dir'], @$this->lists['order']); ?> + + lists['order_Dir'], @$this->lists['order']); ?> + + lists['order_Dir'], @$this->lists['order']); ?> + + lists['order_Dir'], @$this->lists['order']); ?> + + + + lists['order_Dir'], @$this->lists['order']); ?> + + lists['order_Dir'], @$this->lists['order']); ?> + + label, $column->property, @$this->lists['order_Dir'], @$this->lists['order']); ?> +
    + +
    + page->getLimitBox(); ?> +
    + + page->getListFooter(); ?> +
    + canChange): ?> + + + + + + "> + + id.'\', \''.str_replace(array("'", "\""), array("\\'", ""), $row->title).'\', \''.JRequest::getCmd('fid').'\', \''.JRequest::getVar('fname').'\', \''.JRequest::getCmd('output').'\'); return false;'; + } else { + $onClick = 'window.parent.k2ModalSelector(\''.$row->id.'\', \''.str_replace(array("'", "\""), array("\\'", ""), $row->title).'\', \''.JRequest::getCmd('fid').'\', \''.JRequest::getVar('fname').'\'); return false;'; + } + ?> + + title; ?> + + + table->isCheckedOut($this->user->get('id'), $row->checked_out)): ?> + title; ?> + + filter_trash): ?> + title; ?> + + title; ?> + + + + featuredStatus; ?>status; ?> + filter_featured=='1'): ?> + page->orderUpIcon($key, true, 'featuredorderup', 'K2_MOVE_UP', $this->ordering); ?> page->orderDownIcon($key, count($this->rows), true, 'featuredorderdown', 'K2_MOVE_DOWN', $this->ordering); ?> + ordering) ? '' : 'disabled="disabled"' ?> class="text_area k2OrderBox" /> + + page->orderUpIcon($key, ($row->catid == @$this->rows[$key-1]->catid), 'orderup', 'K2_MOVE_UP', $this->ordering); ?> page->orderDownIcon($key, count($this->rows), ($row->catid == @$this->rows[$key+1]->catid), 'orderdown', 'K2_MOVE_DOWN', $this->ordering); ?> + ordering)? '' : 'disabled="disabled"' ?> class="text_area k2OrderBox" /> + + + + category; ?> + + category; ?> + + + user->gid>23 && $context != "modalselector"): ?> + author; ?> + + author; ?> + + + user->gid>23 && $context != "modalselector"): ?> + moderator; ?> + + moderator; ?> + + filter_trash || K2_JVERSION != '15')? $row->groupname:JHTML::_('grid.access', $row, $key); ?>created , $this->dateFormat); ?>modified == $this->nullDate) ? JText::_('K2_NEVER') : JHTML::_('date', $row->modified , $this->dateFormat); ?>hits ?> + id).'_XL.jpg')): ?> + id).'_XL.jpg'; ?>" title="" data-fancybox="gallery" data-caption="<b>title; ?></b> - <b>category; ?></b> <b>author; ?></b>"> + + + + <?php echo JText::_('K2_PREVIEW_IMAGE'); ?> + + + + language; ?>id; ?>
    +
    +
    + + +
    +
    +
    +
    +

    + + 0 + + +
    +
    +
    +
    +
    +
    +
    + + +
    +
    + + +
    +
    +
    +
    +
    +
    +
    +
    +
    + + lists['batchCategories']; ?> +
    +
    + + lists['batchAccess']; ?> +
    +
    + + lists['batchAuthor']; ?> +
    +
    + lists['language'])): ?> + + lists['batchLanguage']; ?> + +
    +
    +
    +
    + +
    +
    + + + + + + + + + + + + + + + +
    + +isSite() || $context == "modalselector"): ?> +
    + diff --git a/deployed/k2/administrator/components/com_k2/views/items/tmpl/element.php b/deployed/k2/administrator/components/com_k2/views/items/tmpl/element.php new file mode 100644 index 00000000..b012b228 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/items/tmpl/element.php @@ -0,0 +1,84 @@ + +
    +

    + + + + + +
    + +
    + + + +
    +
    + lists['trash']; ?> + lists['featured']; ?> | + lists['categories']; ?> + lists['tag'])): ?> + lists['tag']; ?> + + lists['authors']; ?> + lists['state']; ?> + lists['language'])): ?> + lists['language']; ?> + +
    + + + + + + + + + + + + + + rows as $key => $row): ?> + + + + + + + + + + + + + + + + +
    lists['order_Dir'], @$this->lists['order'], 'element'); ?>lists['order_Dir'], @$this->lists['order'], 'element'); ?>lists['order_Dir'], @$this->lists['order'], 'element'); ?>lists['order_Dir'], @$this->lists['order'], 'element'); ?>lists['order_Dir'], @$this->lists['order'], 'element'); ?>lists['order_Dir'], @$this->lists['order'], 'element'); ?>
    title); ?>', '');">title; ?>category; ?>author; ?>groupname; ?>created; ?>id; ?>
    + +
    + page->getLimitBox(); ?> +
    + + page->getListFooter(); ?> +
    + + + + + + +
    \ No newline at end of file diff --git a/deployed/k2/administrator/components/com_k2/views/items/tmpl/move.php b/deployed/k2/administrator/components/com_k2/views/items/tmpl/move.php new file mode 100644 index 00000000..6d9fa439 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/items/tmpl/move.php @@ -0,0 +1,63 @@ +addScriptDeclaration(" + Joomla.submitbutton = function(pressbutton) { + if (pressbutton == 'cancel') { + submitform( pressbutton ); + return; + } + if (\$K2.trim(\$K2('#category').val()) == '') { + alert( '".JText::_('K2_YOU_MUST_SELECT_A_TARGET_CATEGORY', true)."' ); + } else { + submitform( pressbutton ); + } + }; +"); + +?> + +
    +
    +
    +

    +
    +
    +
    +
    +
    +
    + + lists['categories']; ?> +
    +
    + +
      + rows as $row): ?> +
    1. title; ?>
    2. + +
    +
    +
    +
    +
    + + + +
    diff --git a/deployed/k2/administrator/components/com_k2/views/items/view.html.php b/deployed/k2/administrator/components/com_k2/views/items/view.html.php new file mode 100644 index 00000000..bd892344 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/items/view.html.php @@ -0,0 +1,405 @@ +getUserStateFromRequest('global.list.limit', 'limit', $application->getCfg('list_limit'), 'int'); + $limitstart = $application->getUserStateFromRequest($option.$view.'.limitstart', 'limitstart', 0, 'int'); + $filter_order = $application->getUserStateFromRequest($option.$view.'filter_order', 'filter_order', 'i.id', 'cmd'); + $filter_order_Dir = $application->getUserStateFromRequest($option.$view.'filter_order_Dir', 'filter_order_Dir', 'DESC', 'word'); + $filter_trash = $application->getUserStateFromRequest($option.$view.'filter_trash', 'filter_trash', 0, 'int'); + $filter_featured = $application->getUserStateFromRequest($option.$view.'filter_featured', 'filter_featured', -1, 'int'); + $filter_category = $application->getUserStateFromRequest($option.$view.'filter_category', 'filter_category', 0, 'int'); + $filter_author = $application->getUserStateFromRequest($option.$view.'filter_author', 'filter_author', 0, 'int'); + $filter_state = $application->getUserStateFromRequest($option.$view.'filter_state', 'filter_state', -1, 'int'); + $search = $application->getUserStateFromRequest($option.$view.'search', 'search', '', 'string'); + $search = JString::strtolower($search); + $search = trim(preg_replace('/[^\p{L}\p{N}\s\"\-_]/u', '', $search)); + $tag = $application->getUserStateFromRequest($option.$view.'tag', 'tag', 0, 'int'); + $language = $application->getUserStateFromRequest($option.$view.'language', 'language', '', 'string'); + + $db = JFactory::getDbo(); + $nullDate = $db->getNullDate(); + + // JS + $document->addScriptDeclaration(" + var K2SelectItemsError = '".JText::_('K2_SELECT_SOME_ITEMS_FIRST')."'; + \$K2(document).ready(function(){ + \$K2('#K2ImportContentButton').click(function(event){ + var answer = confirm('".JText::_('K2_WARNING_YOU_ARE_ABOUT_TO_IMPORT_ALL_SECTIONS_CATEGORIES_AND_ARTICLES_FROM_JOOMLAS_CORE_CONTENT_COMPONENT_COM_CONTENT_INTO_K2_IF_THIS_IS_THE_FIRST_TIME_YOU_IMPORT_CONTENT_TO_K2_AND_YOUR_SITE_HAS_MORE_THAN_A_FEW_THOUSAND_ARTICLES_THE_PROCESS_MAY_TAKE_A_FEW_MINUTES_IF_YOU_HAVE_EXECUTED_THIS_OPERATION_BEFORE_DUPLICATE_CONTENT_MAY_BE_PRODUCED', true)."'); + if(!answer){ + event.preventDefault(); + } + }); + }); + "); + + $this->assignRef('nullDate', $nullDate); + + if(K2_JVERSION == '30' && $filter_featured == 1 && $filter_order == 'i.ordering') + { + $filter_order = 'i.featured_ordering'; + JRequest::setVar('filter_order', 'i.featured_ordering'); + } + + if(K2_JVERSION == '30' && $filter_featured != 1 && $filter_order == 'i.featured_ordering') + { + $filter_order = 'i.ordering'; + JRequest::setVar('filter_order', 'i.ordering'); + } + + $model = $this->getModel(); + $total = $model->getTotal(); + if ($limitstart > $total - $limit) + { + $limitstart = max(0, (int)(ceil($total / $limit) - 1) * $limit); + JRequest::setVar('limitstart', $limitstart); + } + $items = $model->getData(); + + if (K2_JVERSION != '15') + { + $langs = JLanguageHelper::getLanguages(); + $langsMapping = array(); + $langsMapping['*'] = JText::_('K2_ALL'); + foreach ($langs as $lang) + { + $langsMapping[$lang->lang_code] = $lang->title; + } + } + + foreach ($items as $key => $item) + { + if (K2_JVERSION != '15') + { + $item->status = JHtml::_('jgrid.published', $item->published, $key, '', ($filter_trash == 0), 'cb', $item->publish_up, $item->publish_down); + $states = array( + 1 => array( + 'featured', + 'K2_FEATURED', + 'K2_REMOVE_FEATURED_FLAG', + 'K2_FEATURED', + false, + 'publish', + 'publish' + ), + 0 => array( + 'featured', + 'K2_NOT_FEATURED', + 'K2_FLAG_AS_FEATURED', + 'K2_NOT_FEATURED', + false, + 'unpublish', + 'unpublish' + ), + ); + $item->featuredStatus = JHtml::_('jgrid.state', $states, $item->featured, $key, '', $filter_trash == 0); + $item->canChange = $user->authorise('core.edit.state', 'com_k2.item.'.$item->id); + $item->language = $item->language ? $item->language : '*'; + if (isset($langsMapping)) + { + $item->language = $langsMapping[$item->language]; + } + } + else + { + $now = JFactory::getDate(); + $config = JFactory::getConfig(); + $publish_up = JFactory::getDate($item->publish_up); + $publish_down = JFactory::getDate($item->publish_down); + $publish_up->setOffset($config->getValue('config.offset')); + $publish_down->setOffset($config->getValue('config.offset')); + $img = 'tick.png'; + if ($now->toUnix() <= $publish_up->toUnix() && $item->published == 1) + { + $img = 'publish_y.png'; + } + else if (($now->toUnix() <= $publish_down->toUnix() || $item->publish_down == $nullDate) && $item->published == 1) + { + $img = 'tick.png'; + } + else if ($now->toUnix() > $publish_down->toUnix() && $item->published == 1) + { + $img = 'publish_r.png'; + } + $item->status = JHTML::_('grid.published', $item, $key, $img); + if ($filter_trash) + { + $item->status = strip_tags($item->status, ''); + } + + $item->featuredStatus = ''; + if (!$filter_trash) + { + $tmpTitle = $item->featured ? JText::_('K2_REMOVE_FEATURED_FLAG') : JText::_('K2_FLAG_AS_FEATURED'); + $item->featuredStatus .= ''; + + } + $item->state = $item->published; + $item->published = $item->featured; + $item->featuredStatus .= strip_tags(JHTML::_('grid.published', $item, $key), ''); + $item->published = $item->state; + if (!$filter_trash) + { + $item->featuredStatus .= ''; + } + + } + } + $this->assignRef('rows', $items); + + $lists = array(); + + // Detect exact search phrase using double quotes in search string + if(substr($search, 0, 1)=='"' && substr($search, -1)=='"') + { + $lists['search'] = "\"".trim(str_replace('"', '', $search))."\""; + } + else + { + $lists['search'] = trim(str_replace('"', '', $search)); + } + + if (!$filter_order) + { + $filter_order = 'category'; + } + $lists['order_Dir'] = $filter_order_Dir; + $lists['order'] = $filter_order; + + $filter_trash_options[] = JHTML::_('select.option', 0, JText::_('K2_CURRENT')); + $filter_trash_options[] = JHTML::_('select.option', 1, JText::_('K2_TRASHED')); + $lists['trash'] = JHTML::_('select.genericlist', $filter_trash_options, 'filter_trash', '', 'value', 'text', $filter_trash); + + require_once JPATH_ADMINISTRATOR.'/components/com_k2/models/categories.php'; + $categoriesModel = K2Model::getInstance('Categories', 'K2Model'); + $categories_option[] = JHTML::_('select.option', 0, JText::_('K2_SELECT_CATEGORY')); + $categories = $categoriesModel->categoriesTree(NULL, true, false); + $categories_options = @array_merge($categories_option, $categories); + $lists['categories'] = JHTML::_('select.genericlist', $categories_options, 'filter_category', '', 'value', 'text', $filter_category); + + $authors = $model->getItemsAuthors(); + $options = array(); + $options[] = JHTML::_('select.option', 0, JText::_('K2_NO_USER')); + foreach ($authors as $author) + { + $name = $author->name; + if ($author->block) + { + $name .= ' ['.JText::_('K2_USER_DISABLED').']'; + } + $options[] = JHTML::_('select.option', $author->id, $name); + } + $lists['authors'] = JHTML::_('select.genericlist', $options, 'filter_author', '', 'value', 'text', $filter_author); + + $filter_state_options[] = JHTML::_('select.option', -1, JText::_('K2_SELECT_PUBLISHING_STATE')); + $filter_state_options[] = JHTML::_('select.option', 1, JText::_('K2_PUBLISHED')); + $filter_state_options[] = JHTML::_('select.option', 0, JText::_('K2_UNPUBLISHED')); + $lists['state'] = JHTML::_('select.genericlist', $filter_state_options, 'filter_state', '', 'value', 'text', $filter_state); + + $filter_featured_options[] = JHTML::_('select.option', -1, JText::_('K2_SELECT_FEATURED_STATE')); + $filter_featured_options[] = JHTML::_('select.option', 1, JText::_('K2_FEATURED')); + $filter_featured_options[] = JHTML::_('select.option', 0, JText::_('K2_NOT_FEATURED')); + $lists['featured'] = JHTML::_('select.genericlist', $filter_featured_options, 'filter_featured', '', 'value', 'text', $filter_featured); + + if ($params->get('showTagFilter')) + { + $tagsModel = K2Model::getInstance('Tags', 'K2Model'); + $options = $tagsModel->getFilter(); + $option = new JObject(); + $option->id = 0; + $option->name = JText::_('K2_SELECT_TAG'); + array_unshift($options, $option); + $lists['tag'] = JHTML::_('select.genericlist', $options, 'tag', '', 'id', 'name', $tag); + } + + if (version_compare(JVERSION, '1.6.0', 'ge')) + { + $languages = JHTML::_('contentlanguage.existing', true, true); + array_unshift($languages, JHTML::_('select.option', '', JText::_('K2_SELECT_LANGUAGE'))); + $lists['language'] = JHTML::_('select.genericlist', $languages, 'language', '', 'value', 'text', $language); + } + + // Batch Operations + $categoriesModel = K2Model::getInstance('Categories', 'K2Model'); + $categories = $categoriesModel->categoriesTree(null, true, false); + array_unshift($categories, JHtml::_('select.option', '', JText::_('K2_LEAVE_UNCHANGED'))); + $lists['batchCategories'] = JHTML::_('select.genericlist', $categories, 'batchCategory', 'class="inputbox" size="8"', 'value', 'text'); + $lists['batchAccess'] = version_compare(JVERSION, '2.5', 'ge') ? JHTML::_('access.level', 'batchAccess', null, '', array(JHtml::_('select.option', '', JText::_('K2_LEAVE_UNCHANGED')))) : str_replace('size="3"', "", JHTML::_('list.accesslevel', $item)); + + if (version_compare(JVERSION, '2.5.0', 'ge')) + { + $languages = JHTML::_('contentlanguage.existing', true, true); + array_unshift($languages, JHtml::_('select.option', '', JText::_('K2_LEAVE_UNCHANGED'))); + $lists['batchLanguage'] = JHTML::_('select.genericlist', $languages, 'batchLanguage', '', 'value', 'text', null); + } + + $model = $this->getModel('items'); + $authors = $model->getItemsAuthors(); + $options = array(); + $options[] = JHTML::_('select.option', '', JText::_('K2_LEAVE_UNCHANGED')); + foreach ($authors as $author) + { + $name = $author->name; + if ($author->block) + { + $name .= ' ['.JText::_('K2_USER_DISABLED').']'; + } + $options[] = JHTML::_('select.option', $author->id, $name); + } + $lists['batchAuthor'] = JHTML::_('select.genericlist', $options, 'batchAuthor', '', 'value', 'text', null); + $this->assignRef('lists', $lists); + + // Pagination + jimport('joomla.html.pagination'); + $pageNav = new JPagination($total, $limitstart, $limit); + $this->assignRef('page', $pageNav); + + // Augment with plugin events + $filters = array(); + $columns = array(); + $dispatcher = JDispatcher::getInstance(); + JPluginHelper::importPlugin('k2'); + $dispatcher->trigger('onK2BeforeAssignFilters', array(&$filters)); + $this->assignRef('filters', $filters); + $dispatcher->trigger('onK2BeforeAssignColumns', array(&$columns)); + $this->assignRef('columns', $columns); + + // Toolbar + $toolbar = JToolBar::getInstance('toolbar'); + JToolBarHelper::title(JText::_('K2_ITEMS'), 'k2.png'); + + if ($filter_trash == 1) + { + JToolBarHelper::deleteList('K2_ARE_YOU_SURE_YOU_WANT_TO_DELETE_SELECTED_ITEMS', 'remove', 'K2_DELETE'); + JToolBarHelper::custom('restore', 'publish.png', 'publish_f2.png', 'K2_RESTORE', true); + } + else + { + JToolBarHelper::addNew(); + JToolBarHelper::editList(); + if(K2_JVERSION == '30') + { + JToolBarHelper::custom('featured', 'featured.png', 'featured_f2.png', 'K2_TOGGLE_FEATURED_STATE', true); + } + else + { + JToolBarHelper::custom('featured', 'default.png', 'default_f2.png', 'K2_TOGGLE_FEATURED_STATE', true); + } + JToolBarHelper::publishList(); + JToolBarHelper::unpublishList(); + JToolBarHelper::trash('trash'); + JToolBarHelper::custom('copy', 'copy.png', 'copy_f2.png', 'K2_COPY', true); + // Batch button in modal + if (K2_JVERSION == '30') + { + $batchButton = ''.JText::_('K2_BATCH').''; + } + else + { + $batchButton = ''.JText::_('K2_BATCH').''; + } + $toolbar->appendButton('Custom', $batchButton); + + // Display import button for Joomla content + if ($user->gid > 23 && !$params->get('hideImportButton')) + { + $buttonUrl = JURI::base().'index.php?option=com_k2&view=items&task=import'; + $buttonText = JText::_('K2_IMPORT_JOOMLA_CONTENT'); + if (K2_JVERSION == '30') + { + $button = ''.$buttonText.''; + } + else + { + $button = ''.$buttonText.''; + } + $toolbar->appendButton('Custom', $button); + } + } + + // Preferences (Parameters/Settings) + if (K2_JVERSION != '15') + { + JToolBarHelper::preferences('com_k2', 580, 800, 'K2_PARAMETERS'); + } + else + { + $toolbar->appendButton('Popup', 'config', 'K2_PARAMETERS', 'index.php?option=com_k2&view=settings', 800, 580); + } + + $this->loadHelper('html'); + K2HelperHTML::subMenu(); + + $template = $application->getTemplate(); + $this->assignRef('template', $template); + $this->assignRef('filter_featured', $filter_featured); + $this->assignRef('filter_trash', $filter_trash); + $this->assignRef('user', $user); + if (K2_JVERSION != '15') + { + $dateFormat = JText::_('K2_J16_DATE_FORMAT'); + } + else + { + $dateFormat = JText::_('K2_DATE_FORMAT'); + } + $this->assignRef('dateFormat', $dateFormat); + + $ordering = (($this->lists['order'] == 'i.ordering' || $this->lists['order'] == 'category' || ($this->filter_featured > 0 && $this->lists['order'] == 'i.featured_ordering')) && (!$this->filter_trash)); + $this->assignRef('ordering', $ordering); + + JTable::addIncludePath(JPATH_COMPONENT.'/tables'); + $table = JTable::getInstance('K2Item', 'Table'); + $this->assignRef('table', $table); + + // Joomla 3.x drag-n-drop sorting variables + if (K2_JVERSION == '30') + { + if ($ordering) + { + $action = $this->filter_featured == 1 ? 'savefeaturedorder' : 'saveorder'; + JHtml::_('sortablelist.sortable', 'k2ItemsList', 'adminForm', strtolower($this->lists['order_Dir']), 'index.php?option=com_k2&view=items&task='.$action.'&format=raw'); + } + $document->addScriptDeclaration(' + /* K2 */ + Joomla.orderTable = function() { + table = document.getElementById("sortTable"); + direction = document.getElementById("directionTable"); + order = table.options[table.selectedIndex].value; + if (order != \''.$this->lists['order'].'\') { + dirn = \'asc\'; + } else { + dirn = direction.options[direction.selectedIndex].value; + } + Joomla.tableOrdering(order, dirn, ""); + } + '); + } + + parent::display($tpl); + } +} diff --git a/deployed/k2/administrator/components/com_k2/views/media/tmpl/default.php b/deployed/k2/administrator/components/com_k2/views/media/tmpl/default.php new file mode 100644 index 00000000..39a13416 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/media/tmpl/default.php @@ -0,0 +1,41 @@ + + +
    +
    +
    diff --git a/deployed/k2/administrator/components/com_k2/views/media/view.html.php b/deployed/k2/administrator/components/com_k2/views/media/view.html.php new file mode 100644 index 00000000..65c08919 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/media/view.html.php @@ -0,0 +1,63 @@ +assignRef('mimes', $mimes); + $this->assignRef('type', $type); + $this->assignRef('fieldID', $fieldID); + $this->assignRef('token', $token); + + if ($application->isAdmin()) + { + // Toolbar + JToolBarHelper::title(JText::_('K2_MEDIA_MANAGER'), 'k2.png'); + if (K2_JVERSION != '15') + { + JToolBarHelper::preferences('com_k2', 580, 800, 'K2_PARAMETERS'); + } + else + { + $toolbar = JToolBar::getInstance('toolbar'); + $toolbar->appendButton('Popup', 'config', 'K2_PARAMETERS', 'index.php?option=com_k2&view=settings', 800, 580); + } + + $this->loadHelper('html'); + K2HelperHTML::subMenu(); + } + + parent::display($tpl); + } +} diff --git a/deployed/k2/administrator/components/com_k2/views/settings/tmpl/default.php b/deployed/k2/administrator/components/com_k2/views/settings/tmpl/default.php new file mode 100644 index 00000000..2d4cf630 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/settings/tmpl/default.php @@ -0,0 +1,37 @@ + + +
    +
    +
    + + +
    +
    + +
    +
    +
    + pane->startPane('settings'); ?> + params->getGroups() as $group=>$value): ?> + pane->startPanel(JText::_($group), $group.'-tab'); ?> + params->render('params', $group); ?> + pane->endPanel(); ?> + + pane->endPane(); ?> + + + + + +
    diff --git a/deployed/k2/administrator/components/com_k2/views/settings/view.html.php b/deployed/k2/administrator/components/com_k2/views/settings/view.html.php new file mode 100644 index 00000000..69ed0608 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/settings/view.html.php @@ -0,0 +1,33 @@ +getModel(); + + $params = $model->getParams(); + $this->assignRef('params', $params); + + $pane = JPane::getInstance('Tabs'); + $this->assignRef('pane', $pane); + + parent::display($tpl); + } +} diff --git a/deployed/k2/administrator/components/com_k2/views/tag/tmpl/default.php b/deployed/k2/administrator/components/com_k2/views/tag/tmpl/default.php new file mode 100644 index 00000000..9cc6502d --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/tag/tmpl/default.php @@ -0,0 +1,65 @@ +addScriptDeclaration(" + Joomla.submitbutton = function(pressbutton){ + if (pressbutton == 'cancel') { + submitform( pressbutton ); + return; + } + if (\$K2.trim(\$K2('#name').val())=='') { + alert( '".JText::_('K2_TAG_CANNOT_BE_EMPTY', true)."' ); + } else { + submitform( pressbutton ); + } + }; +"); + +?> + +
    +
    +

    + row->id): ?> + + + + +

    + +
      +
    • +
      + +
      +
      + +
      +
    • +
    • +
      + +
      +
      + lists['published']; ?> +
      +
    • +
    +
    + + + + + + +
    diff --git a/deployed/k2/administrator/components/com_k2/views/tag/view.html.php b/deployed/k2/administrator/components/com_k2/views/tag/view.html.php new file mode 100644 index 00000000..0f03c520 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/tag/view.html.php @@ -0,0 +1,43 @@ +getModel(); + $tag = $model->getData(); + JFilterOutput::objectHTMLSafe($tag); + if (!$tag->id) + $tag->published = 1; + $this->assignRef('row', $tag); + + $lists = array(); + $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $tag->published); + $this->assignRef('lists', $lists); + + // Disable Joomla menu + JRequest::setVar('hidemainmenu', 1); + + // Toolbar + $title = (JRequest::getInt('cid')) ? JText::_('K2_EDIT_TAG') : JText::_('K2_ADD_TAG'); + JToolBarHelper::title($title, 'k2.png'); + + JToolBarHelper::apply(); + JToolBarHelper::save(); + JToolBarHelper::cancel(); + + parent::display($tpl); + } +} diff --git a/deployed/k2/administrator/components/com_k2/views/tags/tmpl/default.php b/deployed/k2/administrator/components/com_k2/views/tags/tmpl/default.php new file mode 100644 index 00000000..607f4163 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/tags/tmpl/default.php @@ -0,0 +1,117 @@ + + +isSite() || $context == "modalselector"): ?> + +
    +
    + + + + + +
    + + + +
    +
    + + +
    + + + + + +
    + +
    + + + +
    +
    lists['state']; ?>
    + + + + + + + + + + + + + + + + + + rows as $key => $row): ?> + + + + + + + + + + +
    #">lists['order_Dir'], @$this->lists['order'] ); ?>lists['order_Dir'], @$this->lists['order'] ); ?>lists['order_Dir'], @$this->lists['order'] ); ?>lists['order_Dir'], @$this->lists['order'] ); ?>
    + +
    + page->getLimitBox(); ?> +
    + + page->getListFooter(); ?> +
    ">checked_out = 0; echo @JHTML::_('grid.checkedout', $row, $key ); ?> + + name).'\', \''.str_replace(array("'", "\""), array("\\'", ""), $row->name).'\', \''.JRequest::getCmd('fid').'\', \''.JRequest::getVar('fname').'\', \''.JRequest::getCmd('output').'\'); return false;'; + } else { + $onClick = 'window.parent.k2ModalSelector(\''.urlencode($row->name).'\', \''.str_replace(array("'", "\""), array("\\'", ""), $row->name).'\', \''.JRequest::getCmd('fid').'\', \''.JRequest::getVar('fname').'\'); return false;'; + } + ?> + name; ?> + + name; ?> + + status; ?>numOfItems; ?>id; ?>
    + + + + + + + + + + + + + + + +
    + +isSite() || $context == "modalselector"): ?> +
    + diff --git a/deployed/k2/administrator/components/com_k2/views/tags/tmpl/element.php b/deployed/k2/administrator/components/com_k2/views/tags/tmpl/element.php new file mode 100644 index 00000000..54c0352a --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/tags/tmpl/element.php @@ -0,0 +1,68 @@ + +
    + + + + + +
    + +
    + + + +
    +
    + lists['state']; ?> +
    + + + + + + + + + + + rows as $key => $row): ?> + + + + + + + + + + + + + +
    lists['order_Dir'], @$this->lists['order'], 'element' ); ?> lists['order_Dir'], @$this->lists['order'], 'element' ); ?> lists['order_Dir'], @$this->lists['order'], 'element' ); ?>
    name); ?>', 'tag');">name; ?>status; ?>id; ?>
    + +
    + page->getLimitBox(); ?> +
    + + page->getListFooter(); ?> +
    + + + + + + + +
    \ No newline at end of file diff --git a/deployed/k2/administrator/components/com_k2/views/tags/view.html.php b/deployed/k2/administrator/components/com_k2/views/tags/view.html.php new file mode 100644 index 00000000..fc2a0955 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/tags/view.html.php @@ -0,0 +1,107 @@ +getUserStateFromRequest('global.list.limit', 'limit', $application->getCfg('list_limit'), 'int'); + $limitstart = $application->getUserStateFromRequest($option.$view.'.limitstart', 'limitstart', 0, 'int'); + $filter_order = $application->getUserStateFromRequest($option.$view.'filter_order', 'filter_order', 'id', 'cmd'); + $filter_order_Dir = $application->getUserStateFromRequest($option.$view.'filter_order_Dir', 'filter_order_Dir', 'DESC', 'word'); + $filter_state = $application->getUserStateFromRequest($option.$view.'filter_state', 'filter_state', -1, 'int'); + $search = $application->getUserStateFromRequest($option.$view.'search', 'search', '', 'string'); + $search = JString::strtolower($search); + $search = trim(preg_replace('/[^\p{L}\p{N}\s\-_]/u', '', $search)); + + $model = $this->getModel(); + $total = $model->getTotal(); + $tags = $model->getData(); + + if ($limitstart > $total - $limit) + { + $limitstart = max(0, (int)(ceil($total / $limit) - 1) * $limit); + JRequest::setVar('limitstart', $limitstart); + } + + foreach ($tags as $key => $tag) + { + $tag->status = K2_JVERSION == '15' ? JHTML::_('grid.published', $tag, $key) : JHtml::_('jgrid.published', $tag->published, $key, '', $task != 'element'); + } + $this->assignRef('rows', $tags); + + jimport('joomla.html.pagination'); + $pageNav = new JPagination($total, $limitstart, $limit); + $this->assignRef('page', $pageNav); + + $lists = array(); + $lists['search'] = $search; + $lists['order_Dir'] = $filter_order_Dir; + $lists['order'] = $filter_order; + + $filter_state_options[] = JHTML::_('select.option', -1, JText::_('K2_SELECT_STATE')); + $filter_state_options[] = JHTML::_('select.option', 1, JText::_('K2_PUBLISHED')); + $filter_state_options[] = JHTML::_('select.option', 0, JText::_('K2_UNPUBLISHED')); + $lists['state'] = JHTML::_('select.genericlist', $filter_state_options, 'filter_state', '', 'value', 'text', $filter_state); + + $this->assignRef('lists', $lists); + + // JS + $document->addScriptDeclaration(" + Joomla.submitbutton = function(pressbutton) { + if (pressbutton == 'remove') { + if (confirm('".JText::_('K2_ARE_YOU_SURE_YOU_WANT_TO_DELETE_SELECTED_TAGS', true)."')){ + submitform( pressbutton ); + } + } else { + submitform( pressbutton ); + } + }; + "); + + // Toolbar + JToolBarHelper::title(JText::_('K2_TAGS'), 'k2.png'); + + JToolBarHelper::addNew(); + JToolBarHelper::editList(); + JToolBarHelper::publishList(); + JToolBarHelper::unpublishList(); + JToolBarHelper::deleteList('', 'remove', 'K2_DELETE'); + JToolBarHelper::custom('removeOrphans', 'delete', 'delete', 'K2_DELETE_ORPHAN_TAGS', false); + + // Preferences (Parameters/Settings) + if (K2_JVERSION != '15') + { + JToolBarHelper::preferences('com_k2', 580, 800, 'K2_PARAMETERS'); + } + else + { + $toolbar = JToolBar::getInstance('toolbar'); + $toolbar->appendButton('Popup', 'config', 'K2_PARAMETERS', 'index.php?option=com_k2&view=settings', 800, 580); + } + + $this->loadHelper('html'); + K2HelperHTML::subMenu(); + + parent::display($tpl); + } +} diff --git a/deployed/k2/administrator/components/com_k2/views/user/tmpl/default.php b/deployed/k2/administrator/components/com_k2/views/user/tmpl/default.php new file mode 100644 index 00000000..d1a5cb54 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/user/tmpl/default.php @@ -0,0 +1,108 @@ + + +
    +
    +

    +
      +
    • +
      + +
      +
      + row->name; ?> +
      +
    • +
    • +
      + +
      +
      +
      lists['gender']; ?>
      +
      +
    • +
    • +
      + +
      +
      + lists['userGroup']; ?> +
      +
    • +
    • +
      + +
      +
      + +
      +
      +
      +
    • +
    • +
      + +
      +
      + +
      +
    • + row->image): ?> +
    • + <?php echo $this->row->name; ?> +
      + + +
      +
    • + +
    • +
      + +
      +
      + +
      +
    • +
    • +
      + +
      +
      + +
      +
    • + K2Plugins))): ?> + K2Plugins as $K2Plugin): ?> + +
    • +
      + name; ?> + fields; ?> +
      +
    • + + + +
    +
    + + + + + + + + +
    \ No newline at end of file diff --git a/deployed/k2/administrator/components/com_k2/views/user/view.html.php b/deployed/k2/administrator/components/com_k2/views/user/view.html.php new file mode 100644 index 00000000..83afad25 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/user/view.html.php @@ -0,0 +1,83 @@ +getModel(); + $user = $model->getData(); + if (K2_JVERSION == '15') + { + JFilterOutput::objectHTMLSafe($user); + } + else + { + JFilterOutput::objectHTMLSafe($user, ENT_QUOTES, array('params', 'plugins')); + } + $joomlaUser = JUser::getInstance(JRequest::getInt('cid')); + + $user->name = $joomlaUser->name; + $user->userID = $joomlaUser->id; + $this->assignRef('row', $user); + + $wysiwyg = JFactory::getEditor(); + $editor = $wysiwyg->display('description', $user->description, '480px', '250px', '', '', false); + $this->assignRef('editor', $editor); + + $lists = array(); + $genderOptions[] = JHTML::_('select.option', 'm', JText::_('K2_MALE')); + $genderOptions[] = JHTML::_('select.option', 'f', JText::_('K2_FEMALE')); + $lists['gender'] = JHTML::_('select.radiolist', $genderOptions, 'gender', '', 'value', 'text', $user->gender); + + $userGroupOptions = $model->getUserGroups(); + $lists['userGroup'] = JHTML::_('select.genericlist', $userGroupOptions, 'group', 'class="inputbox"', 'id', 'name', $user->group); + + $this->assignRef('lists', $lists); + + $params = JComponentHelper::getParams('com_k2'); + $this->assignRef('params', $params); + + // Plugins + JPluginHelper::importPlugin('k2'); + $dispatcher = JDispatcher::getInstance(); + $K2Plugins = $dispatcher->trigger('onRenderAdminForm', array(&$user, 'user')); + $this->assignRef('K2Plugins', $K2Plugins); + + // Disable Joomla menu + JRequest::setVar('hidemainmenu', 1); + + // Toolbar + $toolbar = JToolBar::getInstance('toolbar'); + JToolBarHelper::title(JText::_('K2_USER'), 'k2.png'); + + JToolBarHelper::apply(); + JToolBarHelper::save(); + JToolBarHelper::cancel(); + + if (K2_JVERSION != '15') + { + $buttonUrl = JURI::base().'index.php?option=com_users&view=user&task=user.edit&id='.$user->userID; + } + else + { + $buttonUrl = JURI::base().'index.php?option=com_users&view=user&task=edit&cid[]='.$user->userID; + } + $buttonText = JText::_('K2_EDIT_JOOMLA_USER'); + $button = ''.$buttonText.''; + $toolbar->prependButton('Custom', $button); + + parent::display($tpl); + } +} diff --git a/deployed/k2/administrator/components/com_k2/views/usergroup/tmpl/default.php b/deployed/k2/administrator/components/com_k2/views/usergroup/tmpl/default.php new file mode 100644 index 00000000..73588390 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/usergroup/tmpl/default.php @@ -0,0 +1,107 @@ +addScriptDeclaration(" + Joomla.submitbutton = function(pressbutton){ + if (pressbutton == 'cancel') { + submitform( pressbutton ); + return; + } + if (\$K2.trim(\$K2('#name').val()) == '') { + alert( '".JText::_('K2_GROUP_NAME_CANNOT_BE_EMPTY', true)."' ); + } else { + submitform( pressbutton ); + } + }; +"); + +?> + +
    + +
    +
    +
      +
    • +
      + +
      +
      + +
      +
    • +
    +
    + +
    +

    + + form->render('params'); ?> + +
    +
      + form->getFieldset('user-permissions') as $field): ?> +
    • + type=='header'): ?> +
      input; ?>
      + type=='Spacer'): ?> +
       
      +
      + +
      label; ?>
      +
      input; ?>
      +
      + +
    • + +
    +
    + +
    + +
    +

    +
    +
      +
    • +
      +
      + categories == 'all') echo ' checked="checked"'; ?> /> + + categories == 'none') echo ' checked="checked"'; ?> /> + + categories != 'all' && $this->categories != 'none') echo ' checked="checked"'; ?> /> + +
      +
      +
    • +
    • +
      +
      lists['categories']; ?>
      +
      +
    • +
    • +
      +
      lists['inheritance']; ?>
      +
      +
    • +
    +
    +
    +
    + + + + + +
    diff --git a/deployed/k2/administrator/components/com_k2/views/usergroup/view.html.php b/deployed/k2/administrator/components/com_k2/views/usergroup/view.html.php new file mode 100644 index 00000000..378717f8 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/usergroup/view.html.php @@ -0,0 +1,73 @@ +getModel(); + $userGroup = $model->getData(); + if (K2_JVERSION == '15') + { + JFilterOutput::objectHTMLSafe($userGroup); + } + else + { + JFilterOutput::objectHTMLSafe($userGroup, ENT_QUOTES, 'permissions'); + } + $this->assignRef('row', $userGroup); + + if (K2_JVERSION == '15') + { + $form = new JParameter('', JPATH_COMPONENT.'/models/usergroup.xml'); + $form->loadINI($userGroup->permissions); + $appliedCategories = $form->get('categories'); + $inheritance = $form->get('inheritance'); + } + else + { + jimport('joomla.form.form'); + $form = JForm::getInstance('permissions', JPATH_COMPONENT_ADMINISTRATOR.'/models/usergroup.xml'); + $values = array('params' => json_decode($userGroup->permissions)); + $form->bind($values); + $inheritance = isset($values['params']->inheritance) ? $values['params']->inheritance : 0; + $appliedCategories = isset($values['params']->categories) ? $values['params']->categories : ''; + } + $this->assignRef('form', $form); + $this->assignRef('categories', $appliedCategories); + + $lists = array(); + require_once JPATH_ADMINISTRATOR.'/components/com_k2/models/categories.php'; + $categoriesModel = K2Model::getInstance('Categories', 'K2Model'); + $categories = $categoriesModel->categoriesTree(NULL, true); + $categories_options = @array_merge($categories_option, $categories); + $lists['categories'] = JHTML::_('select.genericlist', $categories, 'params[categories][]', 'multiple="multiple" size="15"', 'value', 'text', $appliedCategories); + $lists['inheritance'] = JHTML::_('select.booleanlist', 'params[inheritance]', NULL, $inheritance); + $this->assignRef('lists', $lists); + + // Disable Joomla menu + JRequest::setVar('hidemainmenu', 1); + + // Toolbar + $title = (JRequest::getInt('cid')) ? JText::_('K2_EDIT_USER_GROUP') : JText::_('K2_ADD_USER_GROUP'); + JToolBarHelper::title($title, 'k2.png'); + JToolBarHelper::apply(); + JToolBarHelper::save(); + JToolBarHelper::cancel(); + + parent::display($tpl); + } +} diff --git a/deployed/k2/administrator/components/com_k2/views/usergroups/tmpl/default.php b/deployed/k2/administrator/components/com_k2/views/usergroups/tmpl/default.php new file mode 100644 index 00000000..710f7646 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/usergroups/tmpl/default.php @@ -0,0 +1,70 @@ +addScriptDeclaration(" + Joomla.submitbutton = function(pressbutton) { + if (pressbutton == 'remove') { + if (confirm('".JText::_('K2_ARE_YOU_SURE_YOU_WANT_TO_DELETE_SELECTED_GROUPS', true)."')){ + submitform( pressbutton ); + } + } else { + submitform( pressbutton ); + } + }; +"); + +?> + +
    + + + + + + + + + + + + + + + + + rows as $key => $row): ?> + + + + + + + + + +
    #lists['order_Dir'], @$this->lists['order'] ); ?>lists['order_Dir'], @$this->lists['order'] ); ?>lists['order_Dir'], @$this->lists['order'] ); ?>
    + +
    + page->getLimitBox(); ?> +
    + + page->getListFooter(); ?> +
    checked_out = 0; echo @JHTML::_('grid.checkedout', $row, $key ); ?>name; ?>numOfUsers; ?>id; ?>
    + + + + + + + +
    diff --git a/deployed/k2/administrator/components/com_k2/views/usergroups/view.html.php b/deployed/k2/administrator/components/com_k2/views/usergroups/view.html.php new file mode 100644 index 00000000..ec375a4e --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/usergroups/view.html.php @@ -0,0 +1,72 @@ +getUserStateFromRequest('global.list.limit', 'limit', $application->getCfg('list_limit'), 'int'); + $limitstart = $application->getUserStateFromRequest($option.$view.'.limitstart', 'limitstart', 0, 'int'); + $filter_order = $application->getUserStateFromRequest($option.$view.'filter_order', 'filter_order', '', 'cmd'); + $filter_order_Dir = $application->getUserStateFromRequest($option.$view.'filter_order_Dir', 'filter_order_Dir', '', 'word'); + + $model = $this->getModel(); + $total = $model->getTotal(); + if ($limitstart > $total - $limit) + { + $limitstart = max(0, (int)(ceil($total / $limit) - 1) * $limit); + JRequest::setVar('limitstart', $limitstart); + } + $userGroups = $model->getData(); + + $this->assignRef('rows', $userGroups); + + jimport('joomla.html.pagination'); + $pageNav = new JPagination($total, $limitstart, $limit); + $this->assignRef('page', $pageNav); + + $lists = array(); + + $lists['order_Dir'] = $filter_order_Dir; + $lists['order'] = $filter_order; + + $this->assignRef('lists', $lists); + + // Toolbar + JToolBarHelper::title(JText::_('K2_USER_GROUPS'), 'k2.png'); + + JToolBarHelper::addNew(); + JToolBarHelper::editList(); + JToolBarHelper::deleteList('', 'remove', 'K2_DELETE'); + + if (K2_JVERSION != '15') + { + JToolBarHelper::preferences('com_k2', 580, 800, 'K2_PARAMETERS'); + } + else + { + $toolbar = JToolBar::getInstance('toolbar'); + $toolbar->appendButton('Popup', 'config', 'K2_PARAMETERS', 'index.php?option=com_k2&view=settings', 800, 580); + } + + $this->loadHelper('html'); + K2HelperHTML::subMenu(); + + parent::display($tpl); + } +} diff --git a/deployed/k2/administrator/components/com_k2/views/users/tmpl/default.php b/deployed/k2/administrator/components/com_k2/views/users/tmpl/default.php new file mode 100644 index 00000000..132e06c6 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/users/tmpl/default.php @@ -0,0 +1,157 @@ + + +isSite() || $context == "modalselector"): ?> + +
    +
    + + + + + +
    + + + +
    +
    + + +
    + + + + + +
    + +
    + + + +
    +
    + lists['status']; ?> + lists['filter_group_k2']; ?> + lists['filter_group']; ?> +
    + + + + + > + + + + + + + + + + + + + + + + + + + + + + + + rows as $key => $row): ?> + + + + + + + + + + + + + + + + + +
    #lists['order_Dir'], @$this->lists['order'] ); ?>lists['order_Dir'], @$this->lists['order'] ); ?>lists['order_Dir'], @$this->lists['order'] ); ?>lists['order_Dir'], @$this->lists['order'] ); ?>lists['order_Dir'], @$this->lists['order'] ); ?>lists['order_Dir'], @$this->lists['order'] ); ?>lists['order_Dir'], @$this->lists['order'] ); ?>IPlists['order_Dir'], @$this->lists['order'] ); ?>
    "> +
    + +
    + page->getLimitBox(); ?> +
    + + page->getListFooter(); ?> +
    +
    ">checked_out = 0; echo JHTML::_('grid.id', $key, $row->id ); ?> + + id.'\', \''.str_replace(array("'", "\""), array("\\'", ""), $row->name).'\', \''.JRequest::getCmd('fid').'\', \''.JRequest::getVar('fname').'\', \''.JRequest::getCmd('output').'\'); return false;'; + } else { + $onClick = 'window.parent.k2ModalSelector(\''.$row->id.'\', \''.str_replace(array("'", "\""), array("\\'", ""), $row->name).'\', \''.JRequest::getCmd('fid').'\', \''.JRequest::getVar('fname').'\'); return false;'; + } + ?> + name; ?> + + name; ?> + + username; ?>loggedInStatus; ?>blockStatus; ?>usertype; ?>groupname; ?>email; ?>lvisit) ? JHTML::_('date', $row->lvisit , $this->dateFormat):JText::_('K2_NEVER'); ?> + ip): ?> + ip; ?> + + + block): ?> + + + + + + + + + + + id; ?>
    + + + + + + + + + + + + + + + +
    + +isSite() || $context == "modalselector"): ?> +
    + diff --git a/deployed/k2/administrator/components/com_k2/views/users/tmpl/element.php b/deployed/k2/administrator/components/com_k2/views/users/tmpl/element.php new file mode 100644 index 00000000..90574d65 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/users/tmpl/element.php @@ -0,0 +1,109 @@ + + +
    +

    + + + + + +
    + +
    + + + +
    +
    + lists['filter_group_k2']; ?> lists['filter_group']; ?> lists['status']; ?> +
    + + + + + + + + + + + + + + + + + + + rows as $key => $row): ?> + + + + + + + + + + + +
    + + + lists['order_Dir'], @$this->lists['order'], 'element' ); ?> + + lists['order_Dir'], @$this->lists['order'], 'element' ); ?> + + lists['order_Dir'], @$this->lists['order'], 'element' ); ?> + + lists['order_Dir'], @$this->lists['order'], 'element' ); ?> + + lists['order_Dir'], @$this->lists['order'], 'element' ); ?> + + lists['order_Dir'], @$this->lists['order'], 'element' ); ?> +
    + +
    + page->getLimitBox(); ?> +
    + + page->getListFooter(); ?> +
    + + + name); ?>', 'id');">name; ?> + + username; ?> + + blockStatus; ?> + + usertype; ?> + + groupname; ?> + + id; ?> +
    + + isAdmin): ?> + + + + + + + + + +
    diff --git a/deployed/k2/administrator/components/com_k2/views/users/tmpl/move.php b/deployed/k2/administrator/components/com_k2/views/users/tmpl/move.php new file mode 100644 index 00000000..adab2104 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/users/tmpl/move.php @@ -0,0 +1,39 @@ + + +
    +
    + + lists['group']; ?> +
    +
    + + lists['k2group']; ?> +
    +
    + (rows); ?>) +
      + rows as $row): ?> +
    1. + name; ?> + +
    2. + +
    +
    + + + + +
    diff --git a/deployed/k2/administrator/components/com_k2/views/users/view.html.php b/deployed/k2/administrator/components/com_k2/views/users/view.html.php new file mode 100644 index 00000000..821a7179 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/users/view.html.php @@ -0,0 +1,287 @@ +getUserStateFromRequest('global.list.limit', 'limit', $application->getCfg('list_limit'), 'int'); + $limitstart = $application->getUserStateFromRequest($option.$view.'.limitstart', 'limitstart', 0, 'int'); + $filter_order = $application->getUserStateFromRequest($option.$view.'filter_order', 'filter_order', 'juser.name', 'cmd'); + $filter_order_Dir = $application->getUserStateFromRequest($option.$view.'filter_order_Dir', 'filter_order_Dir', '', 'word'); + $filter_status = $application->getUserStateFromRequest($option.$view.'filter_status', 'filter_status', -1, 'int'); + $filter_group = $application->getUserStateFromRequest($option.$view.'filter_group', 'filter_group', '', 'string'); + $filter_group_k2 = $application->getUserStateFromRequest($option.$view.'filter_group_k2', 'filter_group_k2', '', 'string'); + $search = $application->getUserStateFromRequest($option.$view.'search', 'search', '', 'string'); + $search = JString::strtolower($search); + $search = trim(preg_replace('/[^\p{L}\p{N}\s\-_]/u', '', $search)); + + K2Model::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.'/models'); + $model = K2Model::getInstance('Users', 'K2Model'); + $total = $model->getTotal(); + if ($limitstart > $total - $limit) + { + $limitstart = max(0, (int)(ceil($total / $limit) - 1) * $limit); + JRequest::setVar('limitstart', $limitstart); + } + $users = $model->getData(); + for ($i = 0; $i < sizeof($users); $i++) + { + $users[$i]->loggedin = $model->checkLogin($users[$i]->id); + $users[$i]->profileID = $model->hasProfile($users[$i]->id); + if ($users[$i]->profileID) + { + $db->setQuery("SELECT ip FROM #__k2_users WHERE id = ".$users[$i]->profileID); + $users[$i]->ip = $db->loadResult(); + } + else + { + $users[$i]->ip = ''; + } + + if ($users[$i]->lastvisitDate == "0000-00-00 00:00:00") + { + $users[$i]->lvisit = false; + } + else + { + $users[$i]->lvisit = $users[$i]->lastvisitDate; + } + $users[$i]->link = JRoute::_('index.php?option=com_k2&view=user&cid='.$users[$i]->id); + if (K2_JVERSION == '15') + { + $users[$i]->published = $users[$i]->loggedin; + $users[$i]->loggedInStatus = strip_tags(JHTML::_('grid.published', $users[$i], $i), ''); + $users[$i]->blockStatus = ''; + if ($users[$i]->block) + { + $users[$i]->blockStatus .= ''.JText::_('K2_ENABLED').''; + } + else + { + $users[$i]->blockStatus .= ''.JText::_('K2_DISABLED').''; + } + if ($task == 'element') + { + $users[$i]->blockStatus = strip_tags($users[$i]->blockStatus, ''); + } + } + else + { + $states = array(1 => array('', 'K2_LOGGED_IN', 'K2_LOGGED_IN', 'K2_LOGGED_IN', false, 'publish', 'publish'), 0 => array('', 'K2_NOT_LOGGED_IN', 'K2_NOT_LOGGED_IN', 'K2_NOT_LOGGED_IN', false, 'unpublish', 'unpublish'), ); + $users[$i]->loggedInStatus = JHtml::_('jgrid.state', $states, $users[$i]->loggedin, $i, '', false); + $states = array( + 0 => array('disable', 'K2_ENABLED', 'K2_DISABLE', 'K2_ENABLED', false, 'publish', 'publish'), + 1 => array('enable', 'K2_DISABLED', 'K2_ENABLE', 'K2_DISABLED', false, 'unpublish', 'unpublish')); + $users[$i]->blockStatus = JHtml::_('jgrid.state', $states, $users[$i]->block, $i, '', $task != 'element'); + } + } + + $this->assignRef('rows', $users); + + jimport('joomla.html.pagination'); + $pageNav = new JPagination($total, $limitstart, $limit); + $this->assignRef('page', $pageNav); + + $lists = array(); + $lists['search'] = $search; + $lists['order_Dir'] = $filter_order_Dir; + $lists['order'] = $filter_order; + + $filter_status_options[] = JHTML::_('select.option', -1, JText::_('K2_SELECT_STATE')); + $filter_status_options[] = JHTML::_('select.option', 0, JText::_('K2_ENABLED')); + $filter_status_options[] = JHTML::_('select.option', 1, JText::_('K2_BLOCKED')); + $lists['status'] = JHTML::_('select.genericlist', $filter_status_options, 'filter_status', '', 'value', 'text', $filter_status); + + $userGroups = $model->getUserGroups(); + $groups[] = JHTML::_('select.option', '0', JText::_('K2_SELECT_JOOMLA_GROUP')); + + foreach ($userGroups as $userGroup) + { + $groups[] = JHTML::_('select.option', $userGroup->value, $userGroup->text); + } + + $lists['filter_group'] = JHTML::_('select.genericlist', $groups, 'filter_group', '', 'value', 'text', $filter_group); + + $K2userGroups = $model->getUserGroups('k2'); + $K2groups[] = JHTML::_('select.option', '0', JText::_('K2_SELECT_K2_GROUP')); + + foreach ($K2userGroups as $K2userGroup) + { + $K2groups[] = JHTML::_('select.option', $K2userGroup->id, $K2userGroup->name); + } + + $lists['filter_group_k2'] = JHTML::_('select.genericlist', $K2groups, 'filter_group_k2', '', 'value', 'text', $filter_group_k2); + + $this->assignRef('lists', $lists); + + if (K2_JVERSION != '15') + { + $dateFormat = JText::_('K2_J16_DATE_FORMAT'); + } + else + { + $dateFormat = JText::_('K2_DATE_FORMAT'); + } + $this->assignRef('dateFormat', $dateFormat); + + $template = $application->getTemplate(); + $this->assignRef('template', $template); + + if ($application->isAdmin()) + { + // JS + $document->addScriptDeclaration(" + var K2Language = ['".JText::_('K2_REPORT_USER_WARNING', true)."']; + + \$K2(document).ready(function(){ + \$K2('#K2ImportUsersButton').click(function(event){ + var answer = confirm('".JText::_('K2_WARNING_YOU_ARE_ABOUT_TO_IMPORT_JOOMLA_USERS_TO_K2_GENERATING_CORRESPONDING_K2_USER_GROUPS_IF_YOU_HAVE_EXECUTED_THIS_OPERATION_BEFORE_DUPLICATE_CONTENT_MAY_BE_PRODUCED', true)."'); + if (!answer){ + event.preventDefault(); + } + }); + }); + "); + + // Toolbar + $toolbar = JToolBar::getInstance('toolbar'); + JToolBarHelper::title(JText::_('K2_USERS'), 'k2.png'); + + JToolBarHelper::editList(); + JToolBarHelper::publishList('enable', 'K2_ENABLE'); + JToolBarHelper::unpublishList('disable', 'K2_DISABLE'); + JToolBarHelper::deleteList('K2_WARNING_YOU_ARE_ABOUT_TO_DELETE_THE_SELECTED_USERS_PERMANENTLY_FROM_THE_SYSTEM', 'delete', 'K2_DELETE'); + JToolBarHelper::deleteList('K2_ARE_YOU_SURE_YOU_WANT_TO_RESET_SELECTED_USERS', 'remove', 'K2_RESET_USER_DETAILS'); + JToolBarHelper::custom('move', 'move.png', 'move_f2.png', 'K2_MOVE', true); + + $canImport = false; + if (K2_JVERSION == '15') + { + $canImport = $user->gid > 23; + } + else + { + $canImport = $user->authorise('core.admin', 'com_k2'); + } + if ($canImport) + { + if (!$params->get('hideImportButton')) + { + $buttonUrl = JURI::base().'index.php?option=com_k2&view=users&task=import'; + $buttonText = JText::_('K2_IMPORT_JOOMLA_USERS'); + if (K2_JVERSION == '30') + { + $button = ''.$buttonText.''; + } + else + { + $button = ''.$buttonText.''; + + } + $toolbar->appendButton('Custom', $button); + } + } + + $this->loadHelper('html'); + K2HelperHTML::subMenu(); + + // Preferences (Parameters/Settings) + if (K2_JVERSION != '15') + { + JToolBarHelper::preferences('com_k2', 580, 800, 'K2_PARAMETERS'); + } + else + { + $toolbar->appendButton('Popup', 'config', 'K2_PARAMETERS', 'index.php?option=com_k2&view=settings', 800, 580); + } + } + $isAdmin = $application->isAdmin(); + $this->assignRef('isAdmin', $isAdmin); + + // Head includes + K2HelperHTML::loadHeadIncludes(true, false, true, true); + if ($application->isSite()) + { + // CSS + $document->addStyleSheet(JURI::root(true).'/templates/system/css/general.css'); + $document->addStyleSheet(JURI::root(true).'/templates/system/css/system.css'); + } + + parent::display($tpl); + } + + function move() + { + $application = JFactory::getApplication(); + + $cid = JRequest::getVar('cid'); + JArrayHelper::toInteger($cid); + JTable::addIncludePath(JPATH_COMPONENT.'/tables'); + + foreach ($cid as $id) + { + $row = JFactory::getUser($id); + $rows[] = $row; + } + $this->assignRef('rows', $rows); + + $model = $this->getModel('users'); + $lists = array(); + $userGroups = $model->getUserGroups(); + $groups[] = JHTML::_('select.option', '', JText::_('K2_DO_NOT_CHANGE')); + foreach ($userGroups as $userGroup) + { + $groups[] = JHTML::_('select.option', $userGroup->value, JText::_($userGroup->text)); + } + $fieldName = 'group'; + $attributes = 'size="10"'; + if (K2_JVERSION != '15') + { + $attributes .= 'multiple="multiple"'; + $fieldName .= '[]'; + } + + $lists['group'] = JHTML::_('select.genericlist', $groups, $fieldName, $attributes, 'value', 'text', ''); + + $K2userGroups = $model->getUserGroups('k2'); + $K2groups[] = JHTML::_('select.option', '0', JText::_('K2_DO_NOT_CHANGE')); + foreach ($K2userGroups as $K2userGroup) + { + $K2groups[] = JHTML::_('select.option', $K2userGroup->id, $K2userGroup->name); + } + $lists['k2group'] = JHTML::_('select.genericlist', $K2groups, 'k2group', 'size="10"', 'value', 'text', 0); + + $this->assignRef('lists', $lists); + + // Toolbar + JToolBarHelper::title(JText::_('K2_MOVE_USERS'), 'k2.png'); + + JToolBarHelper::custom('saveMove', 'save.png', 'save_f2.png', 'K2_SAVE', false); + JToolBarHelper::cancel(); + + parent::display(); + } +} diff --git a/deployed/k2/administrator/components/com_k2/views/view.php b/deployed/k2/administrator/components/com_k2/views/view.php new file mode 100644 index 00000000..61d10ae5 --- /dev/null +++ b/deployed/k2/administrator/components/com_k2/views/view.php @@ -0,0 +1,25 @@ + \ No newline at end of file diff --git a/deployed/k2/administrator/modules/mod_k2_quickicons/mod_k2_quickicons.php b/deployed/k2/administrator/modules/mod_k2_quickicons/mod_k2_quickicons.php new file mode 100644 index 00000000..0b04f370 --- /dev/null +++ b/deployed/k2/administrator/modules/mod_k2_quickicons/mod_k2_quickicons.php @@ -0,0 +1,76 @@ +authorise('core.manage', 'com_k2')) + { + return; + } + $language = JFactory::getLanguage(); + $language->load('com_k2.dates', JPATH_ADMINISTRATOR); + if ($user->authorise('core.admin', 'com_k2')) + { + $user->gid = 1000; + } + else + { + $user->gid = 1; + } +} + +// JoomlaWorks reference parameters +$mod_name = "mod_k2_quickicons"; +$mod_copyrights_start = "\n\n\n"; +$mod_copyrights_end = "\n\n\n"; + +// API +$application = JFactory::getApplication(); +$document = JFactory::getDocument(); +$user = JFactory::getUser(); + +// Module parameters +$moduleclass_sfx = $params->get('moduleclass_sfx', ''); +$modCSSStyling = (int)$params->get('modCSSStyling', 1); +$modLogo = (int)$params->get('modLogo', 1); + +// Component parameters +$componentParams = JComponentHelper::getParams('com_k2'); + +$onlineImageEditor = $componentParams->get('onlineImageEditor', 'picozu'); + +switch($onlineImageEditor) +{ + default: + case 'picozu': + $onlineImageEditorName = JText::_('K2_IMG_EDITOR_PICOZU'); + $onlineImageEditorLink = 'https://www.picozu.com/editor/'; + break; + case 'gravit': + $onlineImageEditorName = JText::_('K2_IMG_EDITOR_GRAVIT'); + $onlineImageEditorLink = 'https://app.designer.io/'; + break; +} + +// Load CSS & JS +K2HelperHTML::loadHeadIncludes(true, false, true, false); +if ($modCSSStyling) +{ + $document->addStyleSheet(JURI::base(true).'/modules/'.$mod_name.'/tmpl/css/style.css?v='.K2_CURRENT_VERSION); +} + +// Output content with template +echo $mod_copyrights_start; +require(JModuleHelper::getLayoutPath($mod_name, 'default')); +echo $mod_copyrights_end; diff --git a/deployed/k2/administrator/modules/mod_k2_quickicons/mod_k2_quickicons.xml b/deployed/k2/administrator/modules/mod_k2_quickicons/mod_k2_quickicons.xml new file mode 100644 index 00000000..a6648cbb --- /dev/null +++ b/deployed/k2/administrator/modules/mod_k2_quickicons/mod_k2_quickicons.xml @@ -0,0 +1,36 @@ + + + K2 Quick Icons (admin) + JoomlaWorks + August 18th, 2017 + Copyright (c) 2006 - 2017 JoomlaWorks Ltd. All rights reserved. + please-use-the-contact-form@joomlaworks.net + www.joomlaworks.net + 2.8.0 + K2_QUICKICONS_FOR_USE_IN_THE_JOOMLA_CONTROL_PANEL_DASHBOARD_PAGE + + mod_k2_quickicons.php + tmpl + + + +
    + + + + + + + + +
    +
    + + + + + +
    +
    +
    +
    diff --git a/deployed/k2/administrator/modules/mod_k2_quickicons/tmpl/css/style.css b/deployed/k2/administrator/modules/mod_k2_quickicons/tmpl/css/style.css new file mode 100644 index 00000000..8bd03437 --- /dev/null +++ b/deployed/k2/administrator/modules/mod_k2_quickicons/tmpl/css/style.css @@ -0,0 +1,54 @@ +/** + * @version 2.8.x + * @package K2 + * @author JoomlaWorks http://www.joomlaworks.net + * @copyright Copyright (c) 2006 - 2017 JoomlaWorks Ltd. All rights reserved. + * @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html + */ + +.clr {clear:both;height:0;line-height:0;display:block;float:none;} +div#k2QuickIconsTitle {margin:16px 0 0;padding:0;position:relative;z-index:9;} +div#k2QuickIconsTitle a {display:block;clear:both;float:none;background-color:#f9f9f9 ;width:46px;height:18px;padding:2px 6px;margin:0 0 0 24px;border:1px solid #d5d5d5;border-bottom:1px solid #f9f9f9;} +div#k2QuickIconsTitle a span {display:none;} + +/* Sprite */ +.dashicon {display:inline-block;background:url('../../../../../media/k2/assets/images/backend/dashboard.png') no-repeat;overflow:hidden;text-indent:-9999px;text-align:left;margin:10px auto;} + .categories-trashed {background-position:-10px -0px;width:48px;height:48px;} + .categories {background-position:-10px -58px;width:48px;height:48px;} + .comments {background-position:-10px -116px;width:48px;height:48px;} + .documentation {background-position:-10px -174px;width:48px;height:48px;} + .extend {background-position:-10px -232px;width:48px;height:48px;} + .extra-field-groups {background-position:-10px -290px;width:48px;height:48px;} + .extra-fields {background-position:-10px -348px;width:48px;height:48px;} + .help {background-position:-10px -406px;width:48px;height:48px;} + .image-editing {background-position:-10px -464px;width:48px;height:48px;} + .item-new {background-position:-10px -522px;width:48px;height:48px;} + .items-featured {background-position:-10px -580px;width:48px;height:48px;} + .items-trashed {background-position:-10px -638px;width:48px;height:48px;} + .items {background-position:-10px -696px;width:48px;height:48px;} + .joomlareader {background-position:-10px -754px;width:48px;height:48px;} + .mediamanager {background-position:-10px -812px;width:48px;height:48px;} + .tags {background-position:-10px -870px;width:48px;height:48px;} + .k2logo {background-position:-4px -924px;} + +/* Joomla 1.5 */ +#k2QuickIcons15 {clear:both;margin:-1px 0 8px 0;padding:8px 0;border-top:1px solid #d5d5d5;position:relative;z-index:8;} +#k2QuickIcons15.k2NoLogo {margin:0 0 8px 0;padding:0;border:none;} + #k2QuickIcons15 div.icon-wrapper {float:left;} + #k2QuickIcons15 div.icon {text-align:center;float:left;margin:0 5px 5px 0;} + #k2QuickIcons15 div.icon a {display:block;float:left;border:1px solid #f0f0f0;height:97px;width:108px;color:#666;vertical-align:middle;text-decoration:none;} + #k2QuickIcons15 div.icon a:hover {border-left:1px solid #eee;border-top:1px solid #eee;border-right:1px solid #ccc;border-bottom:1px solid #ccc;background:#f9f9f9;color:#0B55C4;} + #k2QuickIcons15 div.icon a img {padding:10px 0;margin:0 auto;} + #k2QuickIcons15 div.icon a span {display:block;text-align:center;} + +/* Joomla 1.6+ */ +#k2QuickIcons {clear:both;margin:-1px 0 8px;padding:8px 0;border-top:1px solid #d5d5d5;position:relative;z-index:8;} +#k2QuickIcons.k2NoLogo {margin:0 0 8px;padding:0;border:none;} + #k2QuickIcons div.icon-wrapper {float:left;display:block !important;width:auto !important;height :auto!important;line-height:12px !important;background:none;} + #k2QuickIcons div.icon {text-align:center;margin-right:15px;float:left;margin-bottom:15px;} + #k2QuickIcons div.icon a {background-color:#fff;background-position:-30px;display:block;float:left;height:97px;width:108px;color:#565656;vertical-align:middle;text-decoration:none;border:1px solid #CCC;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;-webkit-transition-property:background-position, 0 0;-moz-transition-property:background-position, 0 0;-webkit-transition-duration:.8s;-moz-transition-duration:.8s;} + #k2QuickIcons div.icon a:hover, + #cpanel div.icon a:focus, + #cpanel div.icon a:active {background-position:0;-webkit-border-bottom-left-radius:50% 20px;-moz-border-radius-bottomleft:50% 20px;border-bottom-left-radius:50% 20px;-webkit-box-shadow:-5px 10px 15px rgba(0,0,0,0.25);-moz-box-shadow:-5px 10px 15px rgba(0,0,0,0.25);box-shadow:-5px 10px 15px rgba(0,0,0,0.25);position:relative;z-index:10;} + #k2QuickIcons div.icon a img {padding:10px 0;margin:0 auto;} + #k2QuickIcons div.icon a span {display:block;text-align:center;} diff --git a/deployed/k2/administrator/modules/mod_k2_quickicons/tmpl/default.php b/deployed/k2/administrator/modules/mod_k2_quickicons/tmpl/default.php new file mode 100644 index 00000000..4c2dbfec --- /dev/null +++ b/deployed/k2/administrator/modules/mod_k2_quickicons/tmpl/default.php @@ -0,0 +1,161 @@ + + +
    + + + + + +
    class="k2NoLogo"> +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    + get('lockTags') || $user->gid>23): ?> +
    + +
    + +
    + +
    + gid>23): ?> +
    + +
    +
    + +
    + +
    + +
    +
    + +
    +
    + +
    + gid>23): ?> +
    + +
    +
    + +
    +
    + +
    + +
    +
    diff --git a/deployed/k2/administrator/modules/mod_k2_quickicons/tmpl/images/bg.jpg b/deployed/k2/administrator/modules/mod_k2_quickicons/tmpl/images/bg.jpg new file mode 100644 index 00000000..e1652ec5 Binary files /dev/null and b/deployed/k2/administrator/modules/mod_k2_quickicons/tmpl/images/bg.jpg differ diff --git a/deployed/k2/administrator/modules/mod_k2_quickicons/tmpl/images/k2_logo_46x18.png b/deployed/k2/administrator/modules/mod_k2_quickicons/tmpl/images/k2_logo_46x18.png new file mode 100644 index 00000000..03464c03 Binary files /dev/null and b/deployed/k2/administrator/modules/mod_k2_quickicons/tmpl/images/k2_logo_46x18.png differ diff --git a/deployed/k2/administrator/modules/mod_k2_stats/helper.php b/deployed/k2/administrator/modules/mod_k2_stats/helper.php new file mode 100644 index 00000000..869e1512 --- /dev/null +++ b/deployed/k2/administrator/modules/mod_k2_stats/helper.php @@ -0,0 +1,164 @@ +setQuery($query, 0, 10); + $rows = $db->loadObjectList(); + return $rows; + } + + public static function getPopularItems() + { + $db = JFactory::getDbo(); + $query = "SELECT i.*, v.name AS author FROM #__k2_items as i + LEFT JOIN #__k2_categories AS c ON c.id = i.catid + LEFT JOIN #__users AS v ON v.id = i.created_by + WHERE i.trash = 0 AND c.trash = 0 + ORDER BY i.hits DESC"; + $db->setQuery($query, 0, 10); + $rows = $db->loadObjectList(); + return $rows; + } + + public static function getMostCommentedItems() + { + $db = JFactory::getDbo(); + $query = "SELECT i.*, v.name AS author, (SELECT COUNT(*) FROM #__k2_comments WHERE itemID = i.id) AS numOfComments FROM #__k2_items as i + LEFT JOIN #__k2_categories AS c ON c.id = i.catid + LEFT JOIN #__users AS v ON v.id = i.created_by + WHERE i.trash = 0 AND c.trash = 0 + ORDER BY numOfComments DESC"; + $db->setQuery($query, 0, 10); + $rows = $db->loadObjectList(); + return $rows; + } + + public static function getLatestComments() + { + $db = JFactory::getDbo(); + $query = "SELECT * FROM #__k2_comments ORDER BY commentDate DESC"; + $db->setQuery($query, 0, 10); + $rows = $db->loadObjectList(); + return $rows; + } + + public static function getStatistics() + { + $statistics = new stdClass; + $statistics->numOfItems = self::countItems(); + $statistics->numOfTrashedItems = self::countTrashedItems(); + $statistics->numOfFeaturedItems = self::countFeaturedItems(); + $statistics->numOfComments = self::countComments(); + $statistics->numOfCategories = self::countCategories(); + $statistics->numOfTrashedCategories = self::countTrashedCategories(); + $statistics->numOfUsers = self::countUsers(); + $statistics->numOfUserGroups = self::countUserGroups(); + $statistics->numOfTags = self::countTags(); + return $statistics; + } + + public static function countItems() + { + $db = JFactory::getDbo(); + $query = "SELECT COUNT(*) FROM #__k2_items"; + $db->setQuery($query); + $result = $db->loadResult(); + return $result; + } + + public static function countTrashedItems() + { + $db = JFactory::getDbo(); + $query = "SELECT COUNT(*) FROM #__k2_items WHERE trash=1"; + $db->setQuery($query); + $result = $db->loadResult(); + return $result; + } + + public static function countFeaturedItems() + { + $db = JFactory::getDbo(); + $query = "SELECT COUNT(*) FROM #__k2_items WHERE featured=1"; + $db->setQuery($query); + $result = $db->loadResult(); + return $result; + } + + public static function countComments() + { + $db = JFactory::getDbo(); + $query = "SELECT COUNT(*) FROM #__k2_comments"; + $db->setQuery($query); + $result = $db->loadResult(); + return $result; + } + + public static function countCategories() + { + $db = JFactory::getDbo(); + $query = "SELECT COUNT(*) FROM #__k2_categories"; + $db->setQuery($query); + $result = $db->loadResult(); + return $result; + } + + public static function countTrashedCategories() + { + $db = JFactory::getDbo(); + $query = "SELECT COUNT(*) FROM #__k2_categories WHERE trash=1"; + $db->setQuery($query); + $result = $db->loadResult(); + return $result; + } + + public static function countUsers() + { + $db = JFactory::getDbo(); + $query = "SELECT COUNT(*) FROM #__k2_users"; + $db->setQuery($query); + $result = $db->loadResult(); + return $result; + } + + public static function countUserGroups() + { + $db = JFactory::getDbo(); + $query = "SELECT COUNT(*) FROM #__k2_user_groups"; + $db->setQuery($query); + $result = $db->loadResult(); + return $result; + } + + public static function countTags() + { + $db = JFactory::getDbo(); + $query = "SELECT COUNT(*) FROM #__k2_tags"; + $db->setQuery($query); + $result = $db->loadResult(); + return $result; + } + +} diff --git a/deployed/k2/administrator/modules/mod_k2_stats/mod_k2_stats.php b/deployed/k2/administrator/modules/mod_k2_stats/mod_k2_stats.php new file mode 100644 index 00000000..1fef78c2 --- /dev/null +++ b/deployed/k2/administrator/modules/mod_k2_stats/mod_k2_stats.php @@ -0,0 +1,52 @@ +authorise('core.manage', 'com_k2')) + { + return; + } +} + +if (K2_JVERSION != '15') +{ + $language = JFactory::getLanguage(); + $language->load('com_k2.dates', JPATH_ADMINISTRATOR); +} + +require_once(dirname(__FILE__).'/helper.php'); + +if ($params->get('latestItems', 1)) +{ + $latestItems = modK2StatsHelper::getLatestItems(); +} +if ($params->get('popularItems', 1)) +{ + $popularItems = modK2StatsHelper::getPopularItems(); +} +if ($params->get('mostCommentedItems', 1)) +{ + $mostCommentedItems = modK2StatsHelper::getMostCommentedItems(); +} +if ($params->get('latestComments', 1)) +{ + $latestComments = modK2StatsHelper::getLatestComments(); +} +if ($params->get('statistics', 1)) +{ + $statistics = modK2StatsHelper::getStatistics(); +} + +require(JModuleHelper::getLayoutPath('mod_k2_stats')); diff --git a/deployed/k2/administrator/modules/mod_k2_stats/mod_k2_stats.xml b/deployed/k2/administrator/modules/mod_k2_stats/mod_k2_stats.xml new file mode 100644 index 00000000..2bff1cb0 --- /dev/null +++ b/deployed/k2/administrator/modules/mod_k2_stats/mod_k2_stats.xml @@ -0,0 +1,49 @@ + + + K2 Stats (admin) + JoomlaWorks + August 18th, 2017 + Copyright (c) 2006 - 2017 JoomlaWorks Ltd. All rights reserved. + please-use-the-contact-form@joomlaworks.net + www.joomlaworks.net + 2.8.0 + K2_STATS_FOR_USE_IN_THE_K2_DASHBOARD_PAGE + + mod_k2_stats.php + helper.php + tmpl + + + +
    + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + +
    +
    +
    +
    diff --git a/deployed/k2/administrator/modules/mod_k2_stats/tmpl/default.php b/deployed/k2/administrator/modules/mod_k2_stats/tmpl/default.php new file mode 100644 index 00000000..fbff9a0b --- /dev/null +++ b/deployed/k2/administrator/modules/mod_k2_stats/tmpl/default.php @@ -0,0 +1,173 @@ +addStyleDeclaration(' + dl.tabs {float:left;margin:10px 0 -1px 0;z-index:50;} + dl.tabs dt {float:left;padding:4px 10px;border:1px solid #ccc;margin-left:3px;background:#e9e9e9;color:#666;} + dl.tabs dt.open {background:#f9f9f9;border-bottom:1px solid #f9f9f9;z-index:100;color:#000;} + div.current {clear:both;border:1px solid #ccc;padding:10px 10px;background:#f9f9f9;} + dl.tabs h3 {font-size:12px;line-height:12px;margin:4px;} + '); +} + +// Import Joomla tabs +jimport('joomla.html.pane'); + +?> + + + +
    + +startPane('myPane'); ?> + +get('latestItems', 1)): ?> +startPanel(JText::_('K2_LATEST_ITEMS'), 'latestItemsTab'); ?> + + + + + + + + + + + + + + + + + +
    title; ?>created , JText::_('K2_DATE_FORMAT')); ?>author; ?>
    +endPanel(); ?> + + +get('popularItems', 1)): ?> +startPanel(JText::_('K2_POPULAR_ITEMS'), 'popularItemsTab'); ?> + + + + + + + + + + + + + + + + + + + +
    title; ?>hits; ?>created , JText::_('K2_DATE_FORMAT')); ?>author; ?>
    +endPanel(); ?> + + +get('mostCommentedItems', 1)): ?> +startPanel(JText::_('K2_MOST_COMMENTED_ITEMS'), 'mostCommentedItemsTab'); ?> + + + + + + + + + + + + + + + + + + + +
    title; ?>numOfComments; ?>created , JText::_('K2_DATE_FORMAT')); ?>author; ?>
    +endPanel(); ?> + + +get('latestComments', 1)): ?> +startPanel(JText::_('K2_LATEST_COMMENTS'), 'latestCommentsTab'); ?> + + + + + + + + + + + + + + + + + +
    commentText; ?>commentDate , JText::_('K2_DATE_FORMAT')); ?>userName; ?>
    +endPanel(); ?> + + +get('statistics', 1)): ?> +startPanel(JText::_('K2_STATISTICS'), 'statsTab'); ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    numOfItems; ?> (numOfFeaturedItems.' '.JText::_('K2_FEATURED').' - '.$statistics->numOfTrashedItems.' '.JText::_('K2_TRASHED'); ?>)
    numOfCategories; ?> (numOfTrashedCategories.' '.JText::_('K2_TRASHED'); ?>)
    numOfTags; ?>
    numOfComments; ?>
    numOfUsers; ?>
    numOfUserGroups; ?>
    +endPanel(); ?> + + +endPane() : JHtml::_('tabs.end'); ?> diff --git a/deployed/k2/components/com_k2/controllers/comments.php b/deployed/k2/components/com_k2/controllers/comments.php new file mode 100644 index 00000000..6952620b --- /dev/null +++ b/deployed/k2/components/com_k2/controllers/comments.php @@ -0,0 +1,204 @@ +guest) + { + $uri = JFactory::getURI(); + if (K2_JVERSION != '15') + { + $url = 'index.php?option=com_users&view=login&return='.base64_encode($uri->toString()); + } + else + { + $url = 'index.php?option=com_user&view=login&return='.base64_encode($uri->toString()); + } + $application = JFactory::getApplication(); + $application->enqueueMessage(JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'), 'notice'); + $application->redirect(JRoute::_($url, false)); + } + + JRequest::setVar('tmpl', 'component'); + + // Language + $language = JFactory::getLanguage(); + $language->load('com_k2', JPATH_ADMINISTRATOR); + + $this->addViewPath(JPATH_COMPONENT_ADMINISTRATOR.'/views'); + $this->addModelPath(JPATH_COMPONENT_ADMINISTRATOR.'/models'); + + $view = $this->getView('comments', 'html'); + $view->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR.'/views/comments/tmpl'); + $view->addHelperPath(JPATH_COMPONENT_ADMINISTRATOR.'/helpers'); + $view->display(); + } + + function publish() + { + JRequest::checkToken() or jexit('Invalid Token'); + $language = JFactory::getLanguage(); + $language->load('com_k2', JPATH_ADMINISTRATOR); + $user = JFactory::getUser(); + if ($user->guest) + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + K2Model::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.'/models'); + $model = K2Model::getInstance('Comments', 'K2Model'); + $model->publish(); + } + + function unpublish() + { + JRequest::checkToken() or jexit('Invalid Token'); + $language = JFactory::getLanguage(); + $language->load('com_k2', JPATH_ADMINISTRATOR); + $user = JFactory::getUser(); + if ($user->guest) + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + K2Model::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.'/models'); + $model = K2Model::getInstance('Comments', 'K2Model'); + $model->unpublish(); + } + + function remove() + { + JRequest::checkToken() or jexit('Invalid Token'); + $language = JFactory::getLanguage(); + $language->load('com_k2', JPATH_ADMINISTRATOR); + $user = JFactory::getUser(); + if ($user->guest) + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + K2Model::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.'/models'); + $model = K2Model::getInstance('Comments', 'K2Model'); + $model->remove(); + } + + function deleteUnpublished() + { + JRequest::checkToken() or jexit('Invalid Token'); + $language = JFactory::getLanguage(); + $language->load('com_k2', JPATH_ADMINISTRATOR); + $user = JFactory::getUser(); + if ($user->guest) + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + K2Model::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.'/models'); + $model = K2Model::getInstance('Comments', 'K2Model'); + $model->deleteUnpublished(); + } + + function saveComment() + { + JRequest::checkToken() or jexit('Invalid Token'); + $language = JFactory::getLanguage(); + $language->load('com_k2', JPATH_ADMINISTRATOR); + $user = JFactory::getUser(); + if ($user->guest) + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + K2Model::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.'/models'); + $model = K2Model::getInstance('Comments', 'K2Model'); + $model->save(); + $application->close(); + } + + function report() + { + JRequest::setVar('tmpl', 'component'); + $view = $this->getView('comments', 'html'); + $view->setLayout('report'); + $view->report(); + } + + function sendReport() + { + JRequest::checkToken() or jexit('Invalid Token'); + $params = K2HelperUtilities::getParams('com_k2'); + $user = JFactory::getUser(); + if (!$params->get('comments') || !$params->get('commentsReporting') || ($params->get('commentsReporting') == '2' && $user->guest)) + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + K2Model::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.'/models'); + $model = K2Model::getInstance('Comments', 'K2Model'); + $model->setState('id', JRequest::getInt('id')); + $model->setState('name', JRequest::getString('name')); + $model->setState('reportReason', JRequest::getString('reportReason')); + if (!$model->report()) + { + echo $model->getError(); + } + else + { + echo JText::_('K2_REPORT_SUBMITTED'); + } + $application = JFactory::getApplication(); + $application->close(); + } + + function reportSpammer() + { + $application = JFactory::getApplication(); + $user = JFactory::getUser(); + $format = JRequest::getVar('format'); + $errors = array(); + if (K2_JVERSION != '15') + { + if (!$user->authorise('core.admin', 'com_k2')) + { + $format == 'raw' ? die(JText::_('K2_ALERTNOTAUTH')) : JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + } + else + { + if ($user->gid < 25) + { + $format == 'raw' ? die(JText::_('K2_ALERTNOTAUTH')) : JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + } + K2Model::addIncludePath(JPATH_ADMINISTRATOR.'/components/com_k2/models'); + $model = K2Model::getInstance('User', 'K2Model'); + $model->setState('id', JRequest::getInt('id')); + $model->reportSpammer(); + if ($format == 'raw') + { + $response = ''; + $messages = $application->getMessageQueue(); + foreach ($messages as $message) + { + $response .= $message['message']."\n"; + } + die($response); + + } + $this->setRedirect('index.php?option=com_k2&view=comments&tmpl=component'); + } +} diff --git a/deployed/k2/components/com_k2/controllers/controller.php b/deployed/k2/components/com_k2/controllers/controller.php new file mode 100644 index 00000000..2fd6c5a2 --- /dev/null +++ b/deployed/k2/components/com_k2/controllers/controller.php @@ -0,0 +1,49 @@ +getModel('itemlist'); + $document = JFactory::getDocument(); + $viewType = $document->getType(); + $view = $this->getView('item', $viewType); + $view->setModel($model); + JRequest::setVar('view', 'item'); + $user = JFactory::getUser(); + if ($user->guest) + { + $cache = true; + } + else + { + $cache = true; + JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.'/tables'); + $row = JTable::getInstance('K2Item', 'Table'); + $row->load(JRequest::getInt('id')); + if (K2HelperPermissions::canEditItem($row->created_by, $row->catid)) + { + $cache = false; + } + $params = K2HelperUtilities::getParams('com_k2'); + if ($row->created_by == $user->id && $params->get('inlineCommentsModeration')) + { + $cache = false; + } + if ($row->access > 0) + { + $cache = false; + } + $category = JTable::getInstance('K2Category', 'Table'); + $category->load($row->catid); + if ($category->access > 0) + { + $cache = false; + } + if ($params->get('comments') && $document->getType() == 'html') + { + $itemListModel = K2Model::getInstance('Itemlist', 'K2Model'); + $profile = $itemListModel->getUserProfile($user->id); + $script = " + \$K2(document).ready(function() { + \$K2('#userName').val(".json_encode($user->name).").attr('disabled', 'disabled'); + \$K2('#commentEmail').val('".$user->email."').attr('disabled', 'disabled'); + "; + if (is_object($profile) && $profile->url) + { + $script .= " + \$K2('#commentURL').val('".htmlspecialchars($profile->url, ENT_QUOTES, 'UTF-8')."').attr('disabled', 'disabled'); + "; + } + $script .= " + }); + "; + $document->addScriptDeclaration($script); + } + } + + if (K2_JVERSION != '15') + { + $urlparams['id'] = 'INT'; + $urlparams['print'] = 'INT'; + $urlparams['lang'] = 'CMD'; + $urlparams['Itemid'] = 'INT'; + } + parent::display($cache, $urlparams); + } + + function edit() + { + JRequest::setVar('tmpl', 'component'); + $application = JFactory::getApplication(); + $params = K2HelperUtilities::getParams('com_k2'); + $language = JFactory::getLanguage(); + $language->load('com_k2', JPATH_ADMINISTRATOR); + + $document = JFactory::getDocument(); + + K2HelperHTML::loadHeadIncludes(true, true, true); + + // CSS + $document->addStyleSheet(JURI::root(true).'/templates/system/css/general.css'); + $document->addStyleSheet(JURI::root(true).'/templates/system/css/system.css'); + + $this->addViewPath(JPATH_COMPONENT_ADMINISTRATOR.'/views'); + $this->addModelPath(JPATH_COMPONENT_ADMINISTRATOR.'/models'); + $view = $this->getView('item', 'html'); + $view->setLayout('itemform'); + + if ($params->get('category')) + { + JRequest::setVar('catid', $params->get('category')); + } + + // Look for template files in component folders + $view->addTemplatePath(JPATH_COMPONENT.'/templates'); + $view->addTemplatePath(JPATH_COMPONENT.'/templates/default'); + + // Look for overrides in template folder (K2 template structure) + $view->addTemplatePath(JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/templates'); + $view->addTemplatePath(JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/templates/default'); + + // Look for overrides in template folder (Joomla template structure) + $view->addTemplatePath(JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/default'); + $view->addTemplatePath(JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2'); + + // Look for specific K2 theme files + if ($params->get('theme')) + { + $view->addTemplatePath(JPATH_COMPONENT.'/templates/'.$params->get('theme')); + $view->addTemplatePath(JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/templates/'.$params->get('theme')); + $view->addTemplatePath(JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/'.$params->get('theme')); + } + $view->display(); + } + + function add() + { + $this->edit(); + } + + function cancel() + { + $this->setRedirect(JURI::root(true)); + return false; + } + + function save() + { + $application = JFactory::getApplication(); + JRequest::checkToken() or jexit('Invalid Token'); + JRequest::setVar('tmpl', 'component'); + $language = JFactory::getLanguage(); + $language->load('com_k2', JPATH_ADMINISTRATOR); + require_once(JPATH_COMPONENT_ADMINISTRATOR.'/models/item.php'); + $model = new K2ModelItem; + $model->save(true); + $application->close(); + + } + + function deleteAttachment() + { + require_once(JPATH_COMPONENT_ADMINISTRATOR.'/models/item.php'); + $model = new K2ModelItem; + $model->deleteAttachment(); + } + + function tag() + { + require_once(JPATH_COMPONENT_ADMINISTRATOR.'/models/tag.php'); + $model = new K2ModelTag; + $model->addTag(); + } + + function tags() + { + $user = JFactory::getUser(); + if($user->guest) + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + require_once(JPATH_COMPONENT_ADMINISTRATOR.'/models/tag.php'); + $model = new K2ModelTag; + $model->tags(); + } + + function download() + { + require_once(JPATH_COMPONENT_ADMINISTRATOR.'/models/item.php'); + $model = new K2ModelItem; + $model->download(); + } + + function extraFields() + { + $application = JFactory::getApplication(); + $language = JFactory::getLanguage(); + $language->load('com_k2', JPATH_ADMINISTRATOR); + $itemID = JRequest::getInt('id', NULL); + + JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.'/tables'); + $catid = JRequest::getInt('cid'); + $category = JTable::getInstance('K2Category', 'Table'); + $category->load($catid); + + require_once(JPATH_COMPONENT_ADMINISTRATOR.'/models/extrafield.php'); + $extraFieldModel = new K2ModelExtraField; + + $extraFields = $extraFieldModel->getExtraFieldsByGroup($category->extraFieldsGroup); + + $output = ''; + $counter = 0; + if (count($extraFields)) + { + foreach ($extraFields as $extraField) + { + + if ($extraField->type == 'header') + { + $output .= ''; + } + else + { + $output .= ''; + $output .= ''; + + } + $counter++; + } + } + $output .= '

    '.$extraField->name.'

    '.$extraFieldModel->renderExtraField($extraField, $itemID).'
    '; + + if ($counter == 0) + $output = JText::_('K2_THIS_CATEGORY_DOESNT_HAVE_ASSIGNED_EXTRA_FIELDS'); + + echo $output; + $application->close(); + } + + function checkin() + { + $model = $this->getModel('item'); + $model->checkin(); + } + + function vote() + { + $model = $this->getModel('item'); + $model->vote(); + } + + function getVotesNum() + { + $model = $this->getModel('item'); + $model->getVotesNum(); + } + + function getVotesPercentage() + { + $model = $this->getModel('item'); + $model->getVotesPercentage(); + } + + function comment() + { + $model = $this->getModel('item'); + $model->comment(); + } + + function resetHits() + { + JRequest::checkToken() or jexit('Invalid Token'); + JRequest::setVar('tmpl', 'component'); + require_once(JPATH_COMPONENT_ADMINISTRATOR.'/models/item.php'); + $language = JFactory::getLanguage(); + $language->load('com_k2', JPATH_ADMINISTRATOR); + $model = new K2ModelItem; + $model->resetHits(); + } + + function resetRating() + { + JRequest::checkToken() or jexit('Invalid Token'); + JRequest::setVar('tmpl', 'component'); + require_once(JPATH_COMPONENT_ADMINISTRATOR.'/models/item.php'); + $language = JFactory::getLanguage(); + $language->load('com_k2', JPATH_ADMINISTRATOR); + $model = new K2ModelItem; + $model->resetRating(); + } + + function media() + { + JRequest::setVar('tmpl', 'component'); + $params = K2HelperUtilities::getParams('com_k2'); + $document = JFactory::getDocument(); + $language = JFactory::getLanguage(); + $language->load('com_k2', JPATH_ADMINISTRATOR); + $user = JFactory::getUser(); + if ($user->guest) + { + $uri = JFactory::getURI(); + if (K2_JVERSION != '15') + { + $url = 'index.php?option=com_users&view=login&return='.base64_encode($uri->toString()); + } + else + { + $url = 'index.php?option=com_user&view=login&return='.base64_encode($uri->toString()); + } + $application = JFactory::getApplication(); + $application->enqueueMessage(JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'), 'notice'); + $application->redirect(JRoute::_($url, false)); + } + + K2HelperHTML::loadHeadIncludes(false, true, true); + + $this->addViewPath(JPATH_COMPONENT_ADMINISTRATOR.'/views'); + $view = $this->getView('media', 'html'); + $view->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR.'/views/media/tmpl'); + $view->setLayout('default'); + $view->display(); + } + + function connector() + { + JRequest::setVar('tmpl', 'component'); + $user = JFactory::getUser(); + if ($user->guest) + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + require_once(JPATH_COMPONENT_ADMINISTRATOR.'/controllers/media.php'); + $controller = new K2ControllerMedia(); + $controller->connector(); + } + + function users() + { + $itemID = JRequest::getInt('itemID'); + JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.'/tables'); + $item = JTable::getInstance('K2Item', 'Table'); + $item->load($itemID); + if (!K2HelperPermissions::canAddItem() && !K2HelperPermissions::canEditItem($item->created_by, $item->catid)) + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + $K2Permissions = K2Permissions::getInstance(); + if (!$K2Permissions->permissions->get('editAll')) + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + JRequest::setVar('tmpl', 'component'); + $application = JFactory::getApplication(); + $params = JComponentHelper::getParams('com_k2'); + $language = JFactory::getLanguage(); + $language->load('com_k2', JPATH_ADMINISTRATOR); + + $document = JFactory::getDocument(); + + K2HelperHTML::loadHeadIncludes(true, true, true); + + $this->addViewPath(JPATH_COMPONENT_ADMINISTRATOR.'/views'); + $this->addModelPath(JPATH_COMPONENT_ADMINISTRATOR.'/models'); + $view = $this->getView('users', 'html'); + $view->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR.'/views/users/tmpl'); + $view->display(); + } +} diff --git a/deployed/k2/components/com_k2/controllers/itemlist.php b/deployed/k2/components/com_k2/controllers/itemlist.php new file mode 100644 index 00000000..473749b4 --- /dev/null +++ b/deployed/k2/components/com_k2/controllers/itemlist.php @@ -0,0 +1,89 @@ +getModel('item'); + $format = JRequest::getWord('format', 'html'); + $document = JFactory::getDocument(); + $viewType = $document->getType(); + $view = $this->getView('itemlist', $viewType); + $view->setModel($model); + $user = JFactory::getUser(); + if ($user->guest) + { + $cache = true; + } + else + { + $cache = false; + } + if (K2_JVERSION != '15') + { + $urlparams['limit'] = 'UINT'; + $urlparams['limitstart'] = 'UINT'; + $urlparams['id'] = 'INT'; + $urlparams['tag'] = 'STRING'; + $urlparams['searchword'] = 'STRING'; + $urlparams['day'] = 'INT'; + $urlparams['year'] = 'INT'; + $urlparams['month'] = 'INT'; + $urlparams['print'] = 'INT'; + $urlparams['lang'] = 'CMD'; + $urlparams['Itemid'] = 'INT'; + $urlparams['ordering'] = 'CMD'; + } + parent::display($cache, $urlparams); + } + + function calendar() + { + require_once(JPATH_SITE.'/media/k2/assets/vendors/cascade/calendar/calendar.php'); + require_once(JPATH_SITE.'/modules/mod_k2_tools/helper.php'); + $application = JFactory::getApplication(); + $month = JRequest::getInt('month'); + $year = JRequest::getInt('year'); + $months = array(JText::_('K2_JANUARY'), JText::_('K2_FEBRUARY'), JText::_('K2_MARCH'), JText::_('K2_APRIL'), JText::_('K2_MAY'), JText::_('K2_JUNE'), JText::_('K2_JULY'), JText::_('K2_AUGUST'), JText::_('K2_SEPTEMBER'), JText::_('K2_OCTOBER'), JText::_('K2_NOVEMBER'), JText::_('K2_DECEMBER'), ); + $days = array(JText::_('K2_SUN'), JText::_('K2_MON'), JText::_('K2_TUE'), JText::_('K2_WED'), JText::_('K2_THU'), JText::_('K2_FRI'), JText::_('K2_SAT'), ); + $cal = new MyCalendar; + $cal->setMonthNames($months); + $cal->setDayNames($days); + $cal->category = JRequest::getInt('catid'); + $cal->setStartDay(1); + if (($month) && ($year)) + { + echo $cal->getMonthView($month, $year); + } + else + { + echo $cal->getCurrentMonthView(); + } + $application->close(); + } + + function module() + { + $document = JFactory::getDocument(); + $view = $this->getView('itemlist', 'raw'); + $model = $this->getModel('itemlist'); + $view->setModel($model); + $model = $this->getModel('item'); + $view->setModel($model); + $view->module(); + } + +} diff --git a/deployed/k2/components/com_k2/controllers/latest.php b/deployed/k2/components/com_k2/controllers/latest.php new file mode 100644 index 00000000..b570bebd --- /dev/null +++ b/deployed/k2/components/com_k2/controllers/latest.php @@ -0,0 +1,39 @@ +getView('latest', 'html'); + $model = $this->getModel('itemlist'); + $view->setModel($model); + $itemModel = $this->getModel('item'); + $view->setModel($itemModel); + $user = JFactory::getUser(); + if ($user->guest) + { + $cache = true; + } + else + { + $cache = false; + } + if (K2_JVERSION != '15') + { + $urlparams['Itemid'] = 'INT'; + } + parent::display($cache, $urlparams); + } + +} diff --git a/deployed/k2/components/com_k2/css/k2.css b/deployed/k2/components/com_k2/css/k2.css new file mode 100644 index 00000000..2aa60be9 --- /dev/null +++ b/deployed/k2/components/com_k2/css/k2.css @@ -0,0 +1,1100 @@ +/** + * @version 2.8.x + * @package K2 + * @author JoomlaWorks http://www.joomlaworks.net + * @copyright Copyright (c) 2006 - 2017 JoomlaWorks Ltd. All rights reserved. + * @license GNU/GPL license:http://www.gnu.org/copyleft/gpl.html + */ + +/* + ### Legend ### + Colors used: + #fafafa (light grey) used as background on all toolbars, category and user/author boxes +*/ + + + +/*------------------------------------------------------------------------------ + Common Elements +--------------------------------------------------------------------------------*/ + +/* --- Basic typography --- */ +a:active, +a:focus {outline:0;} +img {border:none;} + +/* --- Global K2 container --- */ +#k2Container {padding:0 0 24px 0;} +body.contentpane #k2Container {padding:16px;} /* used in popups */ + +/* --- General padding --- */ +.k2Padding {padding:4px;} + +/* --- Clearing --- */ +.clr {clear:both;height:0;line-height:0;display:block;float:none;padding:0;margin:0;border:none;} + +/* --- Striped rows (add a different background color enable stripped rows in various listings with K2 content) --- */ +.even {padding:2px;} +.odd {padding:2px;} + +/* --- RSS feed icon --- */ +div.k2FeedIcon {padding:4px 8px;} +div.k2FeedIcon a, +div.k2FeedIcon a:hover {display:block;float:right;margin:0;padding:0;width:16px;height:16px;} +div.k2FeedIcon a span, +div.k2FeedIcon a:hover span {display:none;} + +/* --- Rating --- */ +.itemRatingForm {display:block;vertical-align:middle;line-height:25px;float:left;} +.itemRatingLog {font-size:11px;margin:0;padding:0 0 0 4px;float:left;} +div.itemRatingForm .formLogLoading {background:url(../images/loaders/generic.gif) no-repeat left center;height:25px;padding:0 0 0 20px;} +.itemRatingList, +.itemRatingList a:hover, +.itemRatingList .itemCurrentRating {background:transparent url(../images/ratingstars.gif) left -1000px repeat-x;} +.itemRatingList {position:relative;float:left;width:125px;height:25px;overflow:hidden;list-style:none;margin:0;padding:0;background-position:left top;} +.itemRatingList li {display:inline;background:none;padding:0;} +.itemRatingList a, +.itemRatingList .itemCurrentRating {position:absolute;top:0;left:0;text-indent:-1000px;height:25px;line-height:25px;outline:none;overflow:hidden;border:none;cursor:pointer;} +.itemRatingList a:hover {background-position:left bottom;} +.itemRatingList a.one-star {width:20%;z-index:6;} +.itemRatingList a.two-stars {width:40%;z-index:5;} +.itemRatingList a.three-stars {width:60%;z-index:4;} +.itemRatingList a.four-stars {width:80%;z-index:3;} +.itemRatingList a.five-stars {width:100%;z-index:2;} +.itemRatingList .itemCurrentRating {z-index:1;background-position:0 center;margin:0;padding:0;} +span.siteRoot {display:none;} + +/* --- CSS added with JavaScript --- */ +.smallerFontSize {font-size:100%;line-height:inherit;} +.largerFontSize {font-size:150%;line-height:140%;} + +/* --- ReCaptcha --- */ +.recaptchatable .recaptcha_image_cell, +#recaptcha_table {background-color:#fff !important;} +#recaptcha_table {border-color:#ccc !important;} +#recaptcha_response_field {border-color:#ccc !important;background-color:#fff !important;} +.k2-recaptcha-v2 {margin-top:12px;} + +/* --- Icon Font Support --- */ +/* Reset for users with older overrides */ +div.itemToolbar ul li a#fontDecrease, +div.itemToolbar ul li a#fontIncrease {font-size:14px;} +div.itemToolbar ul li a#fontDecrease img, +div.itemToolbar ul li a#fontIncrease img {background:none;} +a.ubUserFeedIcon, +a.ubUserFeedIcon:hover, +a.ubUserURL, +a.ubUserURL:hover, +span.ubUserEmail, +div.itemIsFeatured:before, +div.catItemIsFeatured:before, +div.userItemIsFeatured:before, +div.k2FeedIcon a, +div.k2FeedIcon a:hover, +div.itemToolbar ul li a#fontDecrease, +div.itemToolbar ul li a#fontIncrease {background:none;text-decoration:none;vertical-align:middle;font-family:'simple-line-icons';speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;} + +/* Font assignments */ +div.catItemIsFeatured:before, +div.userItemIsFeatured:before, +div.itemIsFeatured:before {content:"\e09b";} +a#fontIncrease:before {content:"\e091";} +a#fontDecrease:before {content:"\e092";} +div.k2FeedIcon a:before, +a.ubUserFeedIcon:before {content:"\e03b";} +a.ubUserURL:before {content:"\e037";} +span.ubUserEmail:before {content:"\e086";} + +/* --- Primary lists in modules --- */ +div.k2LatestCommentsBlock ul, +div.k2TopCommentersBlock ul, +div.k2ItemsBlock ul, +div.k2LoginBlock ul, +div.k2UserBlock ul.k2UserBlockActions, +div.k2UserBlock ul.k2UserBlockRenderedMenu, +div.k2ArchivesBlock ul, +div.k2AuthorsListBlock ul, +div.k2CategoriesListBlock ul, +div.k2UsersBlock ul {margin:0;padding:0 4px;list-style:none;} /* Example CSS: padding:0;margin:0;list-style:none; */ + +div.k2LatestCommentsBlock ul li, +div.k2TopCommentersBlock ul li, +div.k2ItemsBlock ul li, +div.k2LoginBlock ul li, +div.k2ArchivesBlock ul li, +div.k2AuthorsListBlock ul li, +div.k2CategoriesListBlock ul li, +div.k2UsersBlock ul li {display:block;padding:0;margin:0 0 24px 0;} /* Example CSS: display:block;clear:both;padding:2px 0;border-bottom:1px dotted #ccc; */ + +.clearList {display:none;float:none;clear:both;} /* this class is used to clear all previous floating list elements */ +.lastItem {border:none;} /* class appended on last list item */ + +/* --- Avatars --- */ +.k2Avatar img {display:block;float:left;background:#fff;border:1px solid #ddd;border-radius:50%;padding:2px;margin:2px 4px 4px 0;} + +/* --- Read more --- */ +a.k2ReadMore {} +a.k2ReadMore:hover {} + +/* --- Pagination --- */ +div.k2Pagination {padding:8px;margin:24px 0 4px 0;text-align:center;} +div.k2Pagination ul {text-align:center;} +div.k2Pagination ul li {display:inline-block;margin:0;padding:0;} +div.k2Pagination ul li a {display:inline-block;padding:4px 8px;margin:0 8px;border:1px solid #ddd;border-radius:4px;vertical-align:middle;background:#fff;text-decoration:none;} +div.k2Pagination ul li a:hover {background:#fafafa;cursor:pointer;} +div.k2Pagination ul li.active a {background:#fafafa;} +div.k2Pagination ul li a span {vertical-align:middle;} + +/* --- Extra fields: CSV data styling --- */ +table.csvData {} +table.csvData tr th {} +table.csvData tr td {} + +/* --- Featured flags: the classes are repeated further below to indicate placement in the CSS structure --- */ +div.itemIsFeatured, +div.catItemIsFeatured, +div.userItemIsFeatured {position:relative;} +div.itemIsFeatured:before, +div.catItemIsFeatured:before, +div.userItemIsFeatured:before {position:absolute;top:10px;right:10px;color:#CF1919;font-size:20px;} + +/* --- Separators --- */ +.k2HorizontalSep {border:0;padding:0;margin:0 8px;} + +/* --- Edit Buttons --- */ +span.itemEditLink, +span.catItemEditLink, +span.userItemEditLink, +span.userItemAddLink {float:right;display:block;padding:0;margin:0;width:120px;text-align:right;} + span.itemEditLink a, + span.catItemEditLink a, + span.userItemEditLink a, + span.userItemAddLink a {display:inline-block;padding:4px 8px;margin:0;background:#2d96dd;color:#fff;border:0;border-radius:4px;font-size:11px;line-height:100%;font-weight:bold;text-align:center;text-decoration:none;} + span.itemEditLink a:hover, + span.catItemEditLink a:hover, + span.userItemEditLink a:hover, + span.userItemAddLink a:hover {background:#217dbb;} + + + +/*------------------------------------------------------------------------------ + Component - Item view +--------------------------------------------------------------------------------*/ +a.itemPrintThisPage {display:block;width:160px;margin:4px auto 16px;padding:8px;border:1px solid #ddd;border-radius:4px;text-align:center;font-size:14px;} +a.itemPrintThisPage:hover {background:#fafafa;text-decoration:none;} + +div.itemView {padding:8px 0 24px 0;margin:0 0 24px 0;} /* this is the item container for this view */ +div.itemIsFeatured {} /* Attach a class for each featured item */ + +span.itemEditLink {} + span.itemEditLink a {} + span.itemEditLink a:hover {} + +div.itemHeader {} + div.itemHeader span.itemDateCreated {color:#999;font-size:11px;} + div.itemHeader h2.itemTitle {padding:10px 0 4px 0;margin:0;} + div.itemHeader h2.itemTitle span {} + div.itemHeader h2.itemTitle span sup {font-size:12px;color:#CF1919;text-decoration:none;} /* "Featured" presented in superscript */ + div.itemHeader span.itemAuthor {display:block;padding:0;margin:0;} + div.itemHeader span.itemAuthor a:before {content:" ";} + div.itemHeader span.itemAuthor a {} + div.itemHeader span.itemAuthor a:hover {} + +div.itemToolbar {padding:8px;margin:16px 0 0 0;background:#fafafa;border-radius:4px;} + div.itemToolbar ul {text-align:right;list-style:none;padding:0;margin:0;} + div.itemToolbar ul li {display:inline;list-style:none;padding:0 4px 0 8px;margin:0;border-left:1px solid #ccc;text-align:center;background:none;font-size:12px;} + div.itemToolbar ul > li:first-child {border:none;} /* remove the first CSS border from the left of the toolbar */ + div.itemToolbar ul li a {font-size:12px;font-weight:normal;} + div.itemToolbar ul li a:hover {} + div.itemToolbar ul li a span {} + div.itemToolbar ul li a.itemPrintLink {} + div.itemToolbar ul li a.itemPrintLink span {} + div.itemToolbar ul li a.itemEmailLink {} + div.itemToolbar ul li a.itemEmailLink span {} + div.itemToolbar ul li a.itemVideoLink {} + div.itemToolbar ul li a.itemVideoLink span {} + div.itemToolbar ul li a.itemImageGalleryLink {} + div.itemToolbar ul li a.itemImageGalleryLink span {} + div.itemToolbar ul li a.itemCommentsLink {} + div.itemToolbar ul li a.itemCommentsLink span {} + div.itemToolbar ul li a img {vertical-align:middle;} + div.itemToolbar ul li span.itemTextResizerTitle {} + div.itemToolbar ul li a#fontDecrease {margin:0 0 0 2px;} + div.itemToolbar ul li a#fontDecrease img {width:13px;height:13px;font-size:13px;} + div.itemToolbar ul li a#fontIncrease {margin:0 0 0 2px;} + div.itemToolbar ul li a#fontIncrease img {width:13px;height:13px;font-size:13px;} + div.itemToolbar ul li a#fontDecrease span, + div.itemToolbar ul li a#fontIncrease span {display:none;} + +div.itemRatingBlock {padding:8px 0;} + div.itemRatingBlock span {display:block;float:left;font-style:normal;padding:0 4px 0 0;margin:0;color:#999;} + +div.itemBody {padding:8px 0;margin:0;} + +div.itemImageBlock {padding:8px 0;margin:0 0 16px 0;} + span.itemImage {display:block;text-align:center;margin:0 0 8px 0;} + span.itemImage img {max-width:100%;height:auto;} + span.itemImageCaption {color:#666;float:left;display:block;font-size:11px;} + span.itemImageCredits {color:#999;float:right;display:block;font-style:italic;font-size:11px;} + @media screen and ( max-width:600px ){ + span.itemImageCaption, + span.itemImageCredits {float:none;text-align:center;} + } + +div.itemIntroText {color:#444;font-size:18px;font-weight:bold;line-height:24px;padding:4px 0 12px 0;} + div.itemIntroText img {} + +div.itemFullText {} + div.itemFullText h3 {margin:0;padding:16px 0 4px 0;} + div.itemFullText p {} + div.itemFullText img {} + +div.itemExtraFields {margin:16px 0 0 0;padding:8px 0 0 0;border-top:1px dotted #ddd;} + div.itemExtraFields h3 {margin:0;padding:0 0 8px 0;} + div.itemExtraFields ul {margin:0;padding:0;list-style:none;} + div.itemExtraFields ul li {display:block;} + div.itemExtraFields ul li span.itemExtraFieldsLabel {display:block;float:left;font-weight:bold;margin:0 4px 0 0;width:30%;} + div.itemExtraFields ul li span.itemExtraFieldsValue {} + +div.itemContentFooter {display:block;text-align:right;padding:4px 0;margin:16px 0 4px 0;color:#999;} + span.itemHits {float:left;} + span.itemDateModified {} + +div.itemSocialSharing {padding:8px 0;} + div.itemTwitterButton {float:left;margin:2px 24px 0 0;} + div.itemFacebookButton {float:left;margin-right:24px;width:200px;} + div.itemGooglePlusOneButton {} + +div.itemLinks {margin:16px 0;padding:0;} + +div.itemCategory {} + div.itemCategory span {font-weight:bold;color:#555;padding:0 4px 0 0;} + div.itemCategory a {} +div.itemTagsBlock {} + div.itemTagsBlock span {font-weight:bold;color:#555;padding:0 4px 0 0;} + div.itemTagsBlock ul.itemTags {list-style:none;padding:0;margin:0;display:inline;} + div.itemTagsBlock ul.itemTags li {display:inline;list-style:none;padding:0 4px 0 0;margin:0;text-align:center;} + div.itemTagsBlock ul.itemTags li a:before {content:"#";} + div.itemTagsBlock ul.itemTags li a {} + div.itemTagsBlock ul.itemTags li a:hover {} + +div.itemAttachmentsBlock {padding:4px;border-bottom:1px dotted #ccc;} + div.itemAttachmentsBlock span {font-weight:bold;color:#555;padding:0 4px 0 0;} + div.itemAttachmentsBlock ul.itemAttachments {list-style:none;padding:0;margin:0;display:inline;} + div.itemAttachmentsBlock ul.itemAttachments li {display:inline;list-style:none;padding:0 4px;margin:0;text-align:center;} + div.itemAttachmentsBlock ul.itemAttachments li a {} + div.itemAttachmentsBlock ul.itemAttachments li a:hover {} + div.itemAttachmentsBlock ul.itemAttachments li span {font-size:10px;color:#999;font-weight:normal;} + +/* Author block */ +div.itemAuthorBlock {background:#fafafa;border:1px solid #ddd;border-radius:4px;margin:0 0 16px 0;padding:8px;} + div.itemAuthorBlock img.itemAuthorAvatar {float:left;display:block;background:#fff;padding:4px;border:1px solid #ddd;margin:0 8px 0 0;border-radius:50%;} + div.itemAuthorBlock div.itemAuthorDetails {margin:0;padding:4px 0 0 0;} + div.itemAuthorBlock div.itemAuthorDetails h3.authorName {margin:0 0 4px 0;padding:0;} + div.itemAuthorBlock div.itemAuthorDetails h3.authorName a {font-size:16px;} + div.itemAuthorBlock div.itemAuthorDetails h3.authorName a:hover {} + div.itemAuthorBlock div.itemAuthorDetails p {} + div.itemAuthorBlock div.itemAuthorDetails span.itemAuthorUrl {font-weight:bold;color:#555;} + div.itemAuthorBlock div.itemAuthorDetails span.itemAuthorEmail {font-weight:bold;color:#555;} + div.itemAuthorBlock div.itemAuthorDetails span.itemAuthorUrl a, + div.itemAuthorBlock div.itemAuthorDetails span.itemAuthorEmail a {font-weight:normal;} + +/* Author latest */ +div.itemAuthorLatest {margin-bottom:16px;padding:0;} + div.itemAuthorLatest h3 {} + div.itemAuthorLatest ul {} + div.itemAuthorLatest ul li {} + div.itemAuthorLatest ul li a {} + div.itemAuthorLatest ul li a:hover {} + +/* Related by tag */ +div.itemRelated {margin-bottom:16px;padding:0;} /* Add overflow-x:scroll; if you want to enable the scrolling features, as explained in item.php */ + div.itemRelated h3 {} + div.itemRelated ul {} + div.itemRelated ul li {} + div.itemRelated ul li.k2ScrollerElement {float:left;overflow:hidden;border:1px solid #ddd;padding:4px;margin:0 4px 4px 0;background:#fff;} /* you need to insert this class in the related li element in item.php for this styling to take effect */ + div.itemRelated ul li.clr {clear:both;height:0;line-height:0;display:block;float:none;padding:0;margin:0;border:none;} + a.itemRelTitle {} + div.itemRelCat {} + div.itemRelCat a {} + div.itemRelAuthor {} + div.itemRelAuthor a {} + img.itemRelImg {} + div.itemRelIntrotext {} + div.itemRelFulltext {} + div.itemRelMedia {} + div.itemRelImageGallery {} + +/* Video */ +div.itemVideoBlock {margin:0 0 16px 0;padding:16px;background:#010101 url(../images/videobg.gif) repeat-x bottom;color:#eee;} + div.itemVideoBlock div.itemVideoEmbedded {text-align:center;} /* for embedded videos (not using AllVideos) */ + div.itemVideoBlock span.itemVideo {display:block;overflow:hidden;} + div.itemVideoBlock span.itemVideoCaption {color:#eee;float:left;display:block;font-size:11px;font-weight:bold;width:60%;} + div.itemVideoBlock span.itemVideoCredits {color:#eee;float:right;display:block;font-style:italic;font-size:11px;width:35%;text-align:right;} + @media screen and ( max-width:600px ){ + div.itemVideoBlock span.itemVideoCaption, + div.itemVideoBlock span.itemVideoCredits {float:none;text-align:center;width:auto;} + } + +/* Image Gallery */ +div.itemImageGallery {margin:0 0 16px 0;padding:0;} + +/* Article navigation */ +div.itemNavigation {padding:8px;margin:0 0 24px 0;background:#fafafa;border-radius:4px;} + div.itemNavigation span.itemNavigationTitle {color:#999;} + div.itemNavigation a.itemPrevious {padding:0 12px;} + div.itemNavigation a.itemNext {padding:0 12px;} + +/* Comments */ +div.itemComments {background:#fafafa;border:1px solid #ddd;border-radius:4px;padding:16px;} + + div.itemComments ul.itemCommentsList {margin:0 0 16px;padding:0;list-style:none;} + div.itemComments ul.itemCommentsList li {display:block;padding:4px;margin:0 0 8px 0;border-bottom:1px solid #ddd;background:#fff;} + div.itemComments ul.itemCommentsList li.authorResponse {background:#f5fdff;} + div.itemComments ul.itemCommentsList li.unpublishedComment {background:#ffeaea;} + div.itemComments ul.itemCommentsList li img {float:left;margin:4px 4px 4px 0;padding:4px;} + div.itemComments ul.itemCommentsList li span.commentDate {padding:0 4px 0 0;margin:0 8px 0 0;border-right:1px solid #ccc;font-weight:bold;font-size:14px;} + div.itemComments ul.itemCommentsList li span.commentAuthorName {font-weight:bold;font-size:14px;} + div.itemComments ul.itemCommentsList li p {padding:4px 0;} + div.itemComments ul.itemCommentsList li span.commentAuthorEmail {display:none;} + div.itemComments ul.itemCommentsList li span.commentLink {float:right;margin-left:8px;} + div.itemComments ul.itemCommentsList li span.commentLink a {font-size:11px;color:#999;text-decoration:underline;} + div.itemComments ul.itemCommentsList li span.commentLink a:hover {font-size:11px;color:#555;text-decoration:underline;} + + div.itemComments ul.itemCommentsList li span.commentToolbar {display:block;clear:both;} + div.itemComments ul.itemCommentsList li span.commentToolbar a {font-size:11px;color:#999;text-decoration:underline;margin-right:4px;} + div.itemComments ul.itemCommentsList li span.commentToolbar a:hover {font-size:11px;color:#555;text-decoration:underline;} + div.itemComments ul.itemCommentsList li span.commentToolbarLoading {background:url(../images/loaders/search.gif) no-repeat 100% 50%;} + +div.itemCommentsPagination {padding:4px;margin:0 0 24px 0;} + /* Joomla 1.5 - 2.5 */ + div.itemCommentsPagination span.pagination {display:block;float:right;clear:both;} + /* Joomla 3.x */ + div.itemCommentsPagination ul {text-align:center;} + div.itemCommentsPagination ul li {display:inline-block;margin:0;padding:0;} + div.itemCommentsPagination ul li a {display:inline-block;padding:4px 8px;margin:0 8px;border:1px solid #ddd;border-radius:4px;vertical-align:middle;background:#fff;text-decoration:none;} + div.itemCommentsPagination ul li a:hover {background:#fafafa;cursor:pointer;} + div.itemCommentsPagination ul li.active a {background:#fafafa;} + div.itemCommentsPagination ul li a span {vertical-align:middle;} + +div.itemCommentsForm h3 {margin:0;padding:0 0 4px 0;} + div.itemCommentsForm p.itemCommentsFormNotes {border-top:2px solid #ccc;padding:8px 0;} + div.itemCommentsForm form {margin:0;padding:0;width:100%;} + div.itemCommentsForm form label.formComment, + div.itemCommentsForm form label.formName, + div.itemCommentsForm form label.formEmail, + div.itemCommentsForm form label.formUrl, + div.itemCommentsForm form label.formRecaptcha {display:block;margin:12px 0 0 2px;} + div.itemCommentsForm form textarea.inputbox {display:block;width:100%;height:200px;margin:0;padding:8px;box-sizing:border-box;} + div.itemCommentsForm form input.inputbox {display:block;width:100%;margin:0;padding:8px;line-height:150%;height:auto;box-sizing:border-box;} + div.itemCommentsForm form input#submitCommentButton {display:block;margin:16px 0 0 0;padding:8px 16px;background:#2d96dd;color:#fff;border:0;border-radius:4px;font-size:16px;font-weight:bold;} + div.itemCommentsForm form input#submitCommentButton:hover {background:#217dbb;} + div.itemCommentsForm form span#formLog {margin:24px;padding:8px 12px;border-radius:4px;text-align:center;display:none;} + div.itemCommentsForm form span#formLog.k2FormLogError {display:block;background:#f00;color:#fff;} + div.itemCommentsForm form span#formLog.k2FormLogSuccess {display:block;background:#18ac00;color:#fff;} + div.itemCommentsForm form .formLogLoading {background:url(../images/loaders/generic.gif) no-repeat left center;} + +div.itemCommentsLoginFirst {display:block;margin:24px;padding:8px 12px;background:#f00;color:#fff;border-radius:4px;} + +/* "Report comment" form */ +div.k2ReportCommentFormContainer {padding:8px;width:480px;margin:0 auto;} + div.k2ReportCommentFormContainer blockquote {width:462px;background:#fafafa;border:1px solid #ddd;padding:8px;margin:0 0 8px 0;} + div.k2ReportCommentFormContainer blockquote span.quoteIconLeft {font-style:italic;font-weight:bold;font-size:40px;color:#135CAE;line-height:30px;vertical-align:top;display:block;float:left;} + div.k2ReportCommentFormContainer blockquote span.quoteIconRight {font-style:italic;font-weight:bold;font-size:40px;color:#135CAE;line-height:30px;vertical-align:top;display:block;float:right;} + div.k2ReportCommentFormContainer blockquote span.theComment {font-style:italic;font-size:12px;font-weight:normal;color:#000;padding:0 4px;} + div.k2ReportCommentFormContainer form label {display:block;font-weight:bold;} + div.k2ReportCommentFormContainer form input, + div.k2ReportCommentFormContainer form textarea {display:block;border:1px solid #ddd;font-size:12px;padding:2px;margin:0 0 8px 0;width:474px;} + div.k2ReportCommentFormContainer form #recaptcha {margin-bottom:24px;} + div.k2ReportCommentFormContainer form span#formLog {margin:24px;padding:8px 12px;background:#fafafa;border-radius:4px;text-align:center;display:none;} + div.k2ReportCommentFormContainer form .formLogLoading {background:url(../images/loaders/generic.gif) no-repeat left center;} + +/* Back to top link */ +div.itemBackToTop {text-align:right;} + div.itemBackToTop a {text-decoration:underline;} + div.itemBackToTop a:hover {text-decoration:underline;} + + + +/*------------------------------------------------------------------------------ + Component - Itemlist view (category) +--------------------------------------------------------------------------------*/ + +div.itemListCategoriesBlock {} + +/* --- Category block --- */ +div.itemListCategory {background:#fafafa;border:1px solid #ddd;border-radius:4px;margin:0 0 24px 0;padding:8px;} + span.catItemAddLink {display:block;padding:8px 0;margin:0 0 4px 0;border-bottom:1px dotted #ccc;text-align:right;} + span.catItemAddLink a {padding:4px 16px;border:1px solid #ddd;background:#fafafa;text-decoration:none;} + span.catItemAddLink a:hover {background:#ffffcc;} + div.itemListCategory img {float:left;display:block;margin:0 8px 0 0;} + div.itemListCategory h2 {} + div.itemListCategory p {} + +/* --- Sub-category block --- */ +div.itemListSubCategories {} + div.itemListSubCategories h3 {} + div.subCategoryContainer {float:left;} + div.subCategoryContainerLast {} /* this class is appended to the last container on each row of items (useful when you want to set 0 padding/margin to the last container) */ + div.subCategory {background:#fafafa;border:1px solid #ddd;margin:4px;padding:8px;} + div.subCategory a.subCategoryImage, + div.subCategory a.subCategoryImage:hover {text-align:center;display:block;} + div.subCategory a.subCategoryImage img, + div.subCategory a.subCategoryImage:hover img {margin:0 8px 0 0;} + div.subCategory h2 {} + div.subCategory h2 a {} + div.subCategory h2 a:hover {} + div.subCategory p {} + +/* --- Item groups --- */ +div.itemList {} + div#itemListLeading {} + div#itemListPrimary {} + div#itemListSecondary {} + div#itemListLinks {background:#fafafa;border:1px solid #ddd;margin:8px 0;padding:8px;} + + div.itemContainer {float:left;} + div.itemContainerLast {} /* this class is appended to the last container on each row of items (useful when you want to set 0 padding/margin to the last container) */ + @media screen and ( max-width:600px ){ + div.itemContainer, div.subCategoryContainer {float:none;display:block;width:100%!important;} + } + +/* --- Item block for each item group --- */ +div.catItemView {margin-bottom:48px;padding:4px;} /* this is the container for each K2 item on this view */ + + /* Additional class appended to the element above for further styling per group item */ + div.groupLeading {} + div.groupPrimary {} + div.groupSecondary {} + div.groupLinks {padding:0;margin:0;} + + div.catItemIsFeatured {} /* Attach a class for each featured item */ + +span.catItemEditLink {} + span.catItemEditLink a {} + span.catItemEditLink a:hover {} + +div.catItemHeader {} + div.catItemHeader span.catItemDateCreated {color:#999;font-size:11px;} + div.catItemHeader h3.catItemTitle {padding:10px 0 4px 0;margin:0;} + div.catItemHeader h3.catItemTitle span {} + div.catItemHeader h3.catItemTitle span sup {font-size:12px;color:#CF1919;text-decoration:none;} /* superscript */ + div.catItemHeader span.catItemAuthor {display:block;padding:0;margin:0;} + div.catItemHeader span.catItemAuthor a {} + div.catItemHeader span.catItemAuthor a:hover {} + +div.catItemRatingBlock {padding:8px 0;} + div.catItemRatingBlock span {display:block;float:left;font-style:normal;padding:0 4px 0 0;margin:0;color:#999;} + +div.catItemBody {padding:8px 0;margin:0;} + +div.catItemImageBlock {padding:8px 0;margin:0 0 16px 0;} + span.catItemImage {display:block;text-align:center;margin:0 0 8px 0;} + span.catItemImage img {max-width:100%;height:auto;} + +div.catItemIntroText {font-size:inherit;font-weight:normal;line-height:inherit;padding:4px 0 12px 0;} + div.catItemIntroText img {} + +div.catItemExtraFields, +div.genericItemExtraFields {margin:16px 0 0 0;padding:8px 0 0 0;border-top:1px dotted #ddd;} + div.catItemExtraFields h4, + div.genericItemExtraFields h4 {margin:0;padding:0 0 8px 0;} + div.catItemExtraFields ul, + div.genericItemExtraFields ul {margin:0;padding:0;list-style:none;} + div.catItemExtraFields ul li, + div.genericItemExtraFields ul li {display:block;} + div.catItemExtraFields ul li span.catItemExtraFieldsLabel, + div.genericItemExtraFields ul li span.genericItemExtraFieldsLabel {display:block;float:left;font-weight:bold;margin:0 4px 0 0;width:30%;} + div.catItemExtraFields ul li span.catItemExtraFieldsValue {} + +div.catItemLinks {margin:0 0 16px 0;padding:0;} + +div.catItemHitsBlock {padding:4px 0;} + span.catItemHits {} + +div.catItemCategory {padding:4px 0;} + div.catItemCategory span {font-weight:bold;padding:0 4px 0 0;} + div.catItemCategory a {} + +div.catItemTagsBlock {padding:4px 0;} + div.catItemTagsBlock span {font-weight:bold;padding:0 4px 0 0;} + div.catItemTagsBlock ul.catItemTags {list-style:none;padding:0;margin:0;display:inline;} + div.catItemTagsBlock ul.catItemTags li {display:inline;list-style:none;padding:0 4px 0 0;margin:0;text-align:center;} + div.catItemTagsBlock ul.catItemTags li a:before {content:"#";} + div.catItemTagsBlock ul.catItemTags li a {} + div.catItemTagsBlock ul.catItemTags li a:hover {} + +div.catItemAttachmentsBlock {padding:4px;border-bottom:1px dotted #ccc;} + div.catItemAttachmentsBlock span {font-weight:bold;color:#555;padding:0 4px 0 0;} + div.catItemAttachmentsBlock ul.catItemAttachments {list-style:none;padding:0;margin:0;display:inline;} + div.catItemAttachmentsBlock ul.catItemAttachments li {display:inline;list-style:none;padding:0 4px;margin:0;text-align:center;} + div.catItemAttachmentsBlock ul.catItemAttachments li a {} + div.catItemAttachmentsBlock ul.catItemAttachments li a:hover {} + div.catItemAttachmentsBlock ul.catItemAttachments li span {font-size:10px;color:#999;font-weight:normal;} + +/* Video */ +div.catItemVideoBlock {margin:0 0 16px 0;padding:16px;background:#010101 url(../images/videobg.gif) repeat-x bottom;} + div.catItemVideoBlock div.catItemVideoEmbedded {text-align:center;} /* for embedded videos (not using AllVideos) */ + div.catItemVideoBlock span.catItemVideo {display:block;} + +/* Image Gallery */ +div.catItemImageGallery {margin:0 0 16px 0;padding:0;} + +/* Anchor link to comments */ +div.catItemCommentsLink {display:inline;margin:0 8px 0 0;padding:0 8px 0 0;border-right:1px solid #ccc;} + div.catItemCommentsLink a {} + div.catItemCommentsLink a:hover {} + +/* Read more link */ +div.catItemReadMore {display:inline;} + div.catItemReadMore a {} + div.catItemReadMore a:hover {} + +/* Modified date */ +span.catItemDateModified {display:block;text-align:right;padding:4px;margin:4px 0;color:#999;border-top:1px solid #ddd;} + + + +/*------------------------------------------------------------------------------ + Component - Itemlist view (user) +--------------------------------------------------------------------------------*/ + +/* User info block */ +div.userView {} + div.userBlock {background:#fafafa;border:1px solid #ddd;border-radius:4px;margin:0 0 24px 0;padding:8px;} + + div.userBlock img {display:block;float:left;background:#fff;padding:4px;border:1px solid #ddd;margin:0 8px 0 0;border-radius:50%;} + div.userBlock h2 {} + div.userBlock div.userDescription {padding:4px 0;} + div.userBlock div.userAdditionalInfo {padding:4px 0;margin:8px 0 0 0;} + span.userURL {font-weight:bold;color:#555;display:block;} + span.userEmail {font-weight:bold;color:#555;display:block;} + + div.userItemList {} + +/* User items */ +div.userItemView {margin-bottom:48px;} /* this is the item container for this view */ +div.userItemIsFeatured {} /* Attach a class for each featured item */ + +div.userItemViewUnpublished {opacity:0.9;border:4px dashed #ccc;background:#fffff2;padding:8px;margin:8px 0;} + +span.userItemEditLink {} + span.userItemEditLink a {} + span.userItemEditLink a:hover {} + +div.userItemHeader {} + div.userItemHeader span.userItemDateCreated {color:#999;font-size:11px;} + div.userItemHeader h3.userItemTitle {padding:10px 0 4px 0;margin:0;} + div.userItemHeader h3.userItemTitle span sup {font-size:12px;color:#CF1919;text-decoration:none;} /* "Unpublished" presented in superscript */ + +div.userItemBody {padding:8px 0;margin:0;} + +div.userItemImageBlock {padding:0;margin:0;float:left;} + span.userItemImage {display:block;text-align:center;margin:0 8px 8px 0;} + span.userItemImage img {max-width:100%;height:auto;} + +div.userItemIntroText {font-size:inherit;font-weight:normal;line-height:inherit;padding:4px 0 12px 0;} + div.userItemIntroText img {} + +div.userItemLinks {margin:0 0 16px 0;padding:0;} + +div.userItemCategory {padding:4px 0;} + div.userItemCategory span {font-weight:bold;color:#555;padding:0 4px 0 0;} + div.userItemCategory a {} + +div.userItemTagsBlock {padding:4px 0;} + div.userItemTagsBlock span {font-weight:bold;color:#555;padding:0 4px 0 0;} + div.userItemTagsBlock ul.userItemTags {list-style:none;padding:0;margin:0;display:inline;} + div.userItemTagsBlock ul.userItemTags li {display:inline;list-style:none;padding:0 4px 0 0;margin:0;text-align:center;} + div.userItemTagsBlock ul.userItemTags li a:before {content:"#";} + div.userItemTagsBlock ul.userItemTags li a {} + div.userItemTagsBlock ul.userItemTags li a:hover {} + +/* Anchor link to comments */ +div.userItemCommentsLink {display:inline;margin:0 8px 0 0;padding:0 8px 0 0;border-right:1px solid #ccc;} + div.userItemCommentsLink a {} + div.userItemCommentsLink a:hover {} + +/* Read more link */ +div.userItemReadMore {display:inline;} + div.userItemReadMore a {} + div.userItemReadMore a:hover {} + + + +/*------------------------------------------------------------------------------ + Component - Itemlist view (tag) +--------------------------------------------------------------------------------*/ +div.tagView {} + +div.tagItemList {} + +div.tagItemView {margin-bottom:48px;} /* this is the item container for this view */ + +div.tagItemHeader {} + div.tagItemHeader span.tagItemDateCreated {color:#999;font-size:11px;} + div.tagItemHeader h2.tagItemTitle {padding:10px 0 4px 0;margin:0;} + +div.tagItemBody {padding:8px 0;margin:0;} + +div.tagItemImageBlock {padding:0;margin:0;float:left;} + span.tagItemImage {display:block;text-align:center;margin:0 8px 8px 0;} + span.tagItemImage img {max-width:100%;height:auto;} + +div.tagItemIntroText {font-size:inherit;font-weight:normal;line-height:inherit;padding:4px 0 12px 0;} + div.tagItemIntroText img {} + + div.tagItemExtraFields {} + div.tagItemExtraFields h4 {} + div.tagItemExtraFields ul {} + div.tagItemExtraFields ul li {} + div.tagItemExtraFields ul li span.tagItemExtraFieldsLabel {} + div.tagItemExtraFields ul li span.tagItemExtraFieldsValue {} + + div.tagItemCategory {display:inline;margin:0 8px 0 0;padding:0 8px 0 0;border-right:1px solid #ccc;} + div.tagItemCategory span {font-weight:bold;color:#555;padding:0 4px 0 0;} + div.tagItemCategory a {} + +/* Read more link */ +div.tagItemReadMore {display:inline;} + div.tagItemReadMore a {} + div.tagItemReadMore a:hover {} + + + +/*------------------------------------------------------------------------------ + Component - Itemlist view (generic) +--------------------------------------------------------------------------------*/ +div.genericView {} + +div.genericItemList {} + +div.genericItemView {margin-bottom:48px;} /* this is the item container for this view */ + +div.genericItemHeader {} + div.genericItemHeader span.genericItemDateCreated {color:#999;font-size:11px;} + div.genericItemHeader h2.genericItemTitle {padding:10px 0 4px 0;margin:0;} + +div.genericItemBody {padding:8px 0;margin:0;} + +div.genericItemImageBlock {padding:0;margin:0;float:left;} + span.genericItemImage {display:block;text-align:center;margin:0 8px 8px 0;} + span.genericItemImage img {max-width:100%;height:auto;} + +div.genericItemIntroText {font-size:inherit;font-weight:normal;line-height:inherit;padding:4px 0 12px 0;} + div.genericItemIntroText img {} + + div.genericItemExtraFields {} + div.genericItemExtraFields h4 {} + div.genericItemExtraFields ul {} + div.genericItemExtraFields ul li {} + div.genericItemExtraFields ul li span.genericItemExtraFieldsLabel {} + div.genericItemExtraFields ul li span.genericItemExtraFieldsValue {} + + div.genericItemCategory {display:inline;margin:0 8px 0 0;padding:0 8px 0 0;border-right:1px solid #ccc;} + div.genericItemCategory span {font-weight:bold;color:#555;padding:0 4px 0 0;} + div.genericItemCategory a {} + +/* Read more link */ +div.genericItemReadMore {display:inline;} + div.genericItemReadMore a {} + div.genericItemReadMore a:hover {} + +/* No results found message */ +div#genericItemListNothingFound {padding:40px;text-align:center;} + div#genericItemListNothingFound p {font-size:20px;color:#999;} + +/* --- Google Search (use Firebug or similar tools to inspect the generated HTML, then style accordingly --- */ +#k2GoogleSearchContainer .gsc-control {width:auto !important;} +#k2GoogleSearchContainer .gsc-control .gsc-above-wrapper-area, +#k2GoogleSearchContainer .gsc-control .gsc-resultsHeader, +#k2GoogleSearchContainer .gsc-control .gsc-url-bottom {display:none !important;} /* Hide unneeded elements of the results page */ + + + +/*------------------------------------------------------------------------------ + Component - Latest view +--------------------------------------------------------------------------------*/ + +div.latestItemsContainer {float:left;} +@media screen and ( max-width:600px ){ + div.latestItemsContainer {float:none;display:block;width:100%!important;} +} + +/* Category info block */ +div.latestItemsCategory {background:#fafafa;border:1px solid #ddd;border-radius:4px;margin:0 8px 24px 0;padding:8px;} + div.latestItemsCategoryImage {text-align:center;} + div.latestItemsCategoryImage img {margin:0 8px 0 0;} +div.latestItemsCategory h2 {} +div.latestItemsCategory p {} + +/* User info block */ +div.latestItemsUser {background:#fafafa;border:1px solid #ddd;border-radius:4px;margin:0 8px 24px 0;padding:8px;} + div.latestItemsUser img {display:block;float:left;background:#fff;padding:4px;border:1px solid #ddd;margin:0 8px 0 0;border-radius:50%;} + div.latestItemsUser h2 {} + div.latestItemsUser p.latestItemsUserDescription {padding:4px 0;} + div.latestItemsUser p.latestItemsUserAdditionalInfo {padding:4px 0;margin:8px 0 0 0;} + span.latestItemsUserURL {font-weight:bold;color:#555;display:block;} + span.latestItemsUserEmail {font-weight:bold;color:#555;display:block;} + +/* Latest items list */ +div.latestItemList {padding:0 8px 8px 0;} + +div.latestItemView {} /* this is the item container for this view */ + +div.latestItemHeader {} + div.latestItemHeader h3.latestItemTitle {padding:10px 0 4px 0;margin:0;} + +span.latestItemDateCreated {color:#999;font-size:11px;} + +div.latestItemBody {padding:8px 0;margin:0;} + +div.latestItemImageBlock {padding:0;margin:0;float:left;} + span.latestItemImage {display:block;text-align:center;margin:0 8px 8px 0;} + span.latestItemImage img {max-width:100%;height:auto;} + @media screen and ( max-width:600px ){ + div.latestItemImageBlock {float:none;display:block;} + } + +div.latestItemIntroText {font-size:inherit;font-weight:normal;line-height:inherit;padding:4px 0 12px 0;} + div.latestItemIntroText img {} + +div.latestItemLinks {margin:0 0 16px 0;padding:0;} + +div.latestItemCategory {padding:4px 0;} + div.latestItemCategory span {font-weight:bold;color:#555;padding:0 4px 0 0;} + div.latestItemCategory a {} + +div.latestItemTagsBlock {padding:4px 0;} + div.latestItemTagsBlock span {font-weight:bold;color:#555;padding:0 4px 0 0;} + div.latestItemTagsBlock ul.latestItemTags {list-style:none;padding:0;margin:0;display:inline;} + div.latestItemTagsBlock ul.latestItemTags li {display:inline;list-style:none;padding:0 4px 0 0;margin:0;text-align:center;} + div.latestItemTagsBlock ul.latestItemTags li a:before {content:"#";} + div.latestItemTagsBlock ul.latestItemTags li a {} + div.latestItemTagsBlock ul.latestItemTags li a:hover {} + +/* Video */ +div.latestItemVideoBlock {margin:0 0 16px 0;padding:16px;background:#010101 url(../images/videobg.gif) repeat-x bottom;} + div.latestItemVideoBlock span.latestItemVideo {display:block;} + +/* Anchor link to comments */ +div.latestItemCommentsLink {display:inline;margin:0 8px 0 0;padding:0 8px 0 0;border-right:1px solid #ccc;} + div.latestItemCommentsLink a {} + div.latestItemCommentsLink a:hover {} + +/* Read more link */ +div.latestItemReadMore {display:inline;} + div.latestItemReadMore a {} + div.latestItemReadMore a:hover {} + +/* Items presented in a list */ +h2.latestItemTitleList {padding:2px 0;margin:8px 0 2px 0;border-bottom:1px dotted #ccc;} + + + +/*------------------------------------------------------------------------------ + Component - Register & profile page views (register.php & profile.php) +--------------------------------------------------------------------------------*/ +.k2AccountPage {} +.k2AccountPage table {} +.k2AccountPage table tr th {} +.k2AccountPage table tr td {} +.k2AccountPage table tr td label {white-space:nowrap;} +img.k2AccountPageImage {border:4px solid #ddd;margin:10px 0;padding:0;display:block;} +.k2AccountPage div.k2AccountPageNotice {padding:8px;} +.k2AccountPage div.k2AccountPageUpdate {border-top:1px dotted #ddd;margin:8px 0;padding:8px;text-align:right;} + +.k2AccountPage th.k2ProfileHeading {text-align:left;font-size:18px;padding:8px;background:#f6f6f6;} +.k2AccountPage td#userAdminParams {padding:0;margin:0;} +.k2AccountPage table.admintable td.key, +.k2AccountPage table.admintable td.paramlist_key {background:#f6f6f6;border-bottom:1px solid #e9e9e9;border-right:1px solid #e9e9e9;color:#666;font-weight:bold;text-align:right;font-size:11px;width:140px;} + +/* Profile edit */ +.k2AccountPage table.admintable {} +.k2AccountPage table.admintable tr td {} +.k2AccountPage table.admintable tr td span {} +.k2AccountPage table.admintable tr td span label {} + + + +/*------------------------------------------------------------------------------ + Modules - mod_k2_comments +--------------------------------------------------------------------------------*/ + +/* Latest Comments */ +div.k2LatestCommentsBlock {} +div.k2LatestCommentsBlock ul {} +div.k2LatestCommentsBlock ul li {} +div.k2LatestCommentsBlock ul li.lastItem {} +div.k2LatestCommentsBlock ul li a.lcAvatar img {} +div.k2LatestCommentsBlock ul li a {} +div.k2LatestCommentsBlock ul li a:hover {} +div.k2LatestCommentsBlock ul li span.lcComment {} +div.k2LatestCommentsBlock ul li span.lcUsername {} +div.k2LatestCommentsBlock ul li span.lcCommentDate {color:#999;} +div.k2LatestCommentsBlock ul li span.lcItemTitle {} +div.k2LatestCommentsBlock ul li span.lcItemCategory {} + +/* Top Commenters */ +div.k2TopCommentersBlock {} +div.k2TopCommentersBlock ul {} +div.k2TopCommentersBlock ul li {} +div.k2TopCommentersBlock ul li.lastItem {} +div.k2TopCommentersBlock ul li a.tcAvatar img {} +div.k2TopCommentersBlock ul li a.tcLink {} +div.k2TopCommentersBlock ul li a.tcLink:hover {} +div.k2TopCommentersBlock ul li span.tcUsername {} +div.k2TopCommentersBlock ul li span.tcCommentsCounter {} +div.k2TopCommentersBlock ul li a.tcLatestComment {} +div.k2TopCommentersBlock ul li a.tcLatestComment:hover {} +div.k2TopCommentersBlock ul li span.tcLatestCommentDate {color:#999;} + + + +/*------------------------------------------------------------------------------ + Modules - mod_k2_content +--------------------------------------------------------------------------------*/ + +div.k2ItemsBlock {} + +div.k2ItemsBlock p.modulePretext {} + +div.k2ItemsBlock ul {} +div.k2ItemsBlock ul li {} +div.k2ItemsBlock ul li a {} +div.k2ItemsBlock ul li a:hover {} +div.k2ItemsBlock ul li.lastItem {} + +div.k2ItemsBlock ul li a.moduleItemTitle {} +div.k2ItemsBlock ul li a.moduleItemTitle:hover {} + +div.k2ItemsBlock ul li div.moduleItemAuthor {} +div.k2ItemsBlock ul li div.moduleItemAuthor a {} +div.k2ItemsBlock ul li div.moduleItemAuthor a:hover {} + +div.k2ItemsBlock ul li a.moduleItemAuthorAvatar img {} + +div.k2ItemsBlock ul li div.moduleItemIntrotext {display:block;padding:4px 0;} +div.k2ItemsBlock ul li div.moduleItemIntrotext a.moduleItemImage img {float:right;margin:2px 0 4px 4px;padding:0;} + +div.k2ItemsBlock ul li div.moduleItemExtraFields {} + div.moduleItemExtraFields ul {} + div.moduleItemExtraFields ul li {} + div.moduleItemExtraFields ul li span.moduleItemExtraFieldsLabel {display:block;float:left;font-weight:bold;margin:0 4px 0 0;width:30%;} + div.moduleItemExtraFields ul li span.moduleItemExtraFieldsValue {} + +div.k2ItemsBlock ul li div.moduleItemVideo {} +div.k2ItemsBlock ul li div.moduleItemVideo span.moduleItemVideoCaption {} +div.k2ItemsBlock ul li div.moduleItemVideo span.moduleItemVideoCredits {} + +div.k2ItemsBlock ul li span.moduleItemDateCreated {} + +div.k2ItemsBlock ul li a.moduleItemCategory {} + +div.k2ItemsBlock ul li div.moduleItemTags {} +div.k2ItemsBlock ul li div.moduleItemTags b {} +div.k2ItemsBlock ul li div.moduleItemTags a {padding:0 2px;} +div.k2ItemsBlock ul li div.moduleItemTags a:hover {} + +div.k2ItemsBlock ul li div.moduleAttachments {} + +div.k2ItemsBlock ul li a.moduleItemComments {border-right:1px solid #ccc;padding:0 4px 0 0;margin:0 8px 0 0;} +div.k2ItemsBlock ul li a.moduleItemComments:hover {} +div.k2ItemsBlock ul li span.moduleItemHits {border-right:1px solid #ccc;padding:0 4px 0 0;margin:0 8px 0 0;} +div.k2ItemsBlock ul li a.moduleItemReadMore {} +div.k2ItemsBlock ul li a.moduleItemReadMore:hover {} + +div.k2ItemsBlock a.moduleCustomLink {} +div.k2ItemsBlock a.moduleCustomLink:hover {} + + + +/*------------------------------------------------------------------------------ + Modules - mod_k2_tools +--------------------------------------------------------------------------------*/ + +/* --- Archives --- */ +div.k2ArchivesBlock {} +div.k2ArchivesBlock ul {} +div.k2ArchivesBlock ul li {} +div.k2ArchivesBlock ul li a {} +div.k2ArchivesBlock ul li a:hover {} + +/* --- Authors --- */ +div.k2AuthorsListBlock {} +div.k2AuthorsListBlock ul {} +div.k2AuthorsListBlock ul li {} +div.k2AuthorsListBlock ul li a.abAuthorAvatar img {} +div.k2AuthorsListBlock ul li a.abAuthorName {} +div.k2AuthorsListBlock ul li a.abAuthorName:hover {} +div.k2AuthorsListBlock ul li a.abAuthorLatestItem {display:block;clear:both;} +div.k2AuthorsListBlock ul li a.abAuthorLatestItem:hover {} +div.k2AuthorsListBlock ul li span.abAuthorCommentsCount {} + +/* --- Breadcrumbs --- */ +div.k2BreadcrumbsBlock {} +div.k2BreadcrumbsBlock span.bcTitle {padding:0 4px 0 0;color:#999;} +div.k2BreadcrumbsBlock a {} +div.k2BreadcrumbsBlock a:hover {} +div.k2BreadcrumbsBlock span.bcSeparator {padding:0 4px;font-size:14px;} + +/* --- Calendar --- */ +div.k2CalendarBlock {height:190px;margin-bottom:8px;} /* use this height value so that the calendar height won't change on Month change via ajax */ +div.k2CalendarLoader {background:#fff url(../images/loaders/calendar.gif) no-repeat 50% 50%;} +table.calendar {margin:0 auto;background:#fff;border-collapse:collapse;} +table.calendar tr td {text-align:center;vertical-align:middle;padding:2px;border:1px solid #f4f4f4;background:#fff;} +table.calendar tr td.calendarNavMonthPrev {background:#fafafa;text-align:left;} +table.calendar tr td.calendarNavMonthPrev a {font-size:20px;text-decoration:none;} +table.calendar tr td.calendarNavMonthPrev a:hover {font-size:20px;text-decoration:none;} +table.calendar tr td.calendarCurrentMonth {background:#fafafa;} +table.calendar tr td.calendarNavMonthNext {background:#fafafa;text-align:right;} +table.calendar tr td.calendarNavMonthNext a {font-size:20px;text-decoration:none;} +table.calendar tr td.calendarNavMonthNext a:hover {font-size:20px;text-decoration:none;} +table.calendar tr td.calendarDayName {background:#e9e9e9;font-size:11px;width:14.2%;} +table.calendar tr td.calendarDateEmpty {background:#fbfbfb;} +table.calendar tr td.calendarDate {} +table.calendar tr td.calendarDateLinked {padding:0;} +table.calendar tr td.calendarDateLinked a {display:block;padding:2px;text-decoration:none;background:#fafafa;} +table.calendar tr td.calendarDateLinked a:hover {display:block;background:#135cae;color:#fff;padding:2px;text-decoration:none;} +table.calendar tr td.calendarToday {background:#135cae;color:#fff;} +table.calendar tr td.calendarTodayLinked {background:#135cae;color:#fff;padding:0;} +table.calendar tr td.calendarTodayLinked a {display:block;padding:2px;color:#fff;text-decoration:none;} +table.calendar tr td.calendarTodayLinked a:hover {display:block;background:#BFD9FF;padding:2px;text-decoration:none;} + +/* --- Category Tree Select Box --- */ +div.k2CategorySelectBlock {} +div.k2CategorySelectBlock form select {width:auto;} +div.k2CategorySelectBlock form select option {} + +/* --- Category List/Menu --- */ +div.k2CategoriesListBlock {} +div.k2CategoriesListBlock ul {} +div.k2CategoriesListBlock ul li {} +div.k2CategoriesListBlock ul li a {} +div.k2CategoriesListBlock ul li a:hover {} +div.k2CategoriesListBlock ul li a span.catTitle {padding-right:4px;} +div.k2CategoriesListBlock ul li a span.catCounter {} +div.k2CategoriesListBlock ul li a:hover span.catTitle {} +div.k2CategoriesListBlock ul li a:hover span.catCounter {} +div.k2CategoriesListBlock ul li.activeCategory {} +div.k2CategoriesListBlock ul li.activeCategory a {font-weight:bold;} + + /* Root level (0) */ + ul.level0 {} + ul.level0 li {} + ul.level0 li a {} + ul.level0 li a:hover {} + ul.level0 li a span {} + ul.level0 li a:hover span {} + + /* First level (1) */ + ul.level1 {} + ul.level1 li {} + ul.level1 li a {} + ul.level1 li a:hover {} + ul.level1 li a span {} + ul.level1 li a:hover span {} + + /* n level (n) - like the above... */ + +/* --- Search Box --- */ +div.k2SearchBlock {position:relative;} +div.k2SearchBlock form {} +div.k2SearchBlock form input.inputbox {} +div.k2SearchBlock form input.button {} +div.k2SearchBlock form input.k2SearchLoading {background:url(../images/loaders/search.gif) no-repeat 100% 50%;} +div.k2SearchBlock div.k2LiveSearchResults {display:none;background:#fff;position:absolute;z-index:99;border:1px solid #ddd;margin-top:-1px;} + /* Live search results (fetched via ajax) */ + div.k2SearchBlock div.k2LiveSearchResults ul.liveSearchResults {list-style:none;margin:0;padding:0;} + div.k2SearchBlock div.k2LiveSearchResults ul.liveSearchResults li {border:none;margin:0;padding:0;} + div.k2SearchBlock div.k2LiveSearchResults ul.liveSearchResults li a {display:block;padding:1px 2px;border-top:1px dotted #ddd;} + div.k2SearchBlock div.k2LiveSearchResults ul.liveSearchResults li a:hover {background:#fffff0;} + +/* --- Tag Cloud --- */ +div.k2TagCloudBlock {padding:8px 0;} +div.k2TagCloudBlock a {padding:4px;float:left;display:block;} +div.k2TagCloudBlock a:hover {padding:4px;float:left;display:block;background:#135cae;color:#fff;text-decoration:none;} + +/* --- Custom Code --- */ +div.k2CustomCodeBlock {} + + + +/*------------------------------------------------------------------------------ + Modules - mod_k2_user (mod_k2_login is removed since v2.6.x) +--------------------------------------------------------------------------------*/ + +div.k2LoginBlock {} + div.k2LoginBlock p.preText {} + + div.k2LoginBlock fieldset.input {margin:0;padding:0 0 8px 0;} + div.k2LoginBlock fieldset.input p {margin:0;padding:0 0 4px 0;} + div.k2LoginBlock fieldset.input p label {display:block;} + div.k2LoginBlock fieldset.input p input {display:block;} + div.k2LoginBlock fieldset.input p#form-login-remember label, + div.k2LoginBlock fieldset.input p#form-login-remember input {display:inline;} + div.k2LoginBlock fieldset.input input.button {} + + div.k2LoginBlock ul {} + div.k2LoginBlock ul li {} + + div.k2LoginBlock p.postText {} + +div.k2UserBlock {} + div.k2UserBlock p.ubGreeting {border-bottom:1px dotted #ccc;} + div.k2UserBlock div.k2UserBlockDetails a.ubAvatar img {} + div.k2UserBlock div.k2UserBlockDetails span.ubName {display:block;font-weight:bold;font-size:14px;} + div.k2UserBlock div.k2UserBlockDetails span.ubCommentsCount {} + + div.k2UserBlock ul.k2UserBlockActions {} + div.k2UserBlock ul.k2UserBlockActions li {} + div.k2UserBlock ul.k2UserBlockActions li a {} + div.k2UserBlock ul.k2UserBlockActions li a:hover {} + + div.k2UserBlock ul.k2UserBlockRenderedMenu {} + div.k2UserBlock ul.k2UserBlockRenderedMenu li {} + div.k2UserBlock ul.k2UserBlockRenderedMenu li a {} + div.k2UserBlock ul.k2UserBlockRenderedMenu li a:hover {} + div.k2UserBlock ul.k2UserBlockRenderedMenu li ul {} /* 2nd level ul */ + div.k2UserBlock ul.k2UserBlockRenderedMenu li ul li {} + div.k2UserBlock ul.k2UserBlockRenderedMenu li ul li a {} + div.k2UserBlock ul.k2UserBlockRenderedMenu li ul ul {} /* 3rd level ul (and so on...) */ + div.k2UserBlock ul.k2UserBlockRenderedMenu li ul ul li {} + div.k2UserBlock ul.k2UserBlockRenderedMenu li ul ul li a {} + + div.k2UserBlock form {} + div.k2UserBlock form input.ubLogout {} + + + +/*------------------------------------------------------------------------------ + Modules - mod_k2_users +--------------------------------------------------------------------------------*/ + +div.k2UsersBlock {} +div.k2UsersBlock ul {} +div.k2UsersBlock ul li {} +div.k2UsersBlock ul li.lastItem {} +div.k2UsersBlock ul li a.ubUserAvatar img {} +div.k2UsersBlock ul li a.ubUserName {} +div.k2UsersBlock ul li a.ubUserName:hover {} +div.k2UsersBlock ul li div.ubUserDescription {} +div.k2UsersBlock ul li div.ubUserAdditionalInfo {} + a.ubUserFeedIcon, + a.ubUserFeedIcon:hover {display:inline-block;margin:0 2px 0 0;padding:0;font-size:15px;} + a.ubUserFeedIcon span, + a.ubUserFeedIcon:hover span {display:none;} + a.ubUserURL, + a.ubUserURL:hover {display:inline-block;margin:0 2px 0 0;padding:0;font-size:15px;} + a.ubUserURL span, + a.ubUserURL:hover span {display:none;} + span.ubUserEmail {display:inline-block;margin:0 2px 0 0;padding:0;overflow:hidden;font-size:15px;} + span.ubUserEmail a {display:inline-block;margin:0;padding:0;width:16px;height:16px;text-indent:-9999px;} + +div.k2UsersBlock ul li h3 {clear:both;margin:8px 0 0 0;padding:0;} +div.k2UsersBlock ul li ul.ubUserItems {} +div.k2UsersBlock ul li ul.ubUserItems li {} + + + +/* --- END --- */ diff --git a/deployed/k2/components/com_k2/css/k2.print.css b/deployed/k2/components/com_k2/css/k2.print.css new file mode 100644 index 00000000..bd042c32 --- /dev/null +++ b/deployed/k2/components/com_k2/css/k2.print.css @@ -0,0 +1,21 @@ +/** + * @version 2.8.x + * @package K2 + * @author JoomlaWorks http://www.joomlaworks.net + * @copyright Copyright (c) 2006 - 2017 JoomlaWorks Ltd. All rights reserved. + * @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html + */ + +/* Print-specific CSS for K2 */ +a.itemPrintThisPage, +div.itemHeader h2.itemTitle span sup, +div.itemToolbar, +div.itemRatingBlock, +div.itemLinks, +div.itemSocialLinksBlock, +div.itemAttachmentsBlock, +div.itemRelated, +div.itemAuthorLatest, +div.itemVideoBlock, +div.itemImageGallery, +div.itemNavigation {display:none;} diff --git a/deployed/k2/components/com_k2/helpers/permissions.j16.php b/deployed/k2/components/com_k2/helpers/permissions.j16.php new file mode 100644 index 00000000..9e692b94 --- /dev/null +++ b/deployed/k2/components/com_k2/helpers/permissions.j16.php @@ -0,0 +1,88 @@ +authorise('core.manage', $option)) + { + JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); + $application->redirect('index.php'); + } + + // Determine action for rest checks + $action = false; + if ($application->isAdmin() && $view != '' && $view != 'info') + { + switch($task) + { + case '' : + case 'save' : + case 'apply' : + if (!$id) + { + $action = 'core.create'; + } + else + { + $action = 'core.edit'; + } + break; + case 'trash' : + case 'remove' : + $action = 'core.delete'; + break; + case 'publish' : + case 'unpublish' : + case 'featured': + $action = 'core.edit.state'; + } + + // Edit or Edit own action + if ($action == 'core.edit' && $view == 'item' && $id) + { + JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.'/tables'); + $item = JTable::getInstance('K2Item', 'Table'); + $item->load($id); + if ($item->created_by == $user->id) + { + $action = 'core.edit.own'; + } + } + + // Check the determined action + if ($action) + { + if (!$user->authorise($action, $option)) + { + JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); + $application->redirect('index.php?option=com_k2'); + } + } + + } + } + +} diff --git a/deployed/k2/components/com_k2/helpers/permissions.php b/deployed/k2/components/com_k2/helpers/permissions.php new file mode 100644 index 00000000..3dd5d2b2 --- /dev/null +++ b/deployed/k2/components/com_k2/helpers/permissions.php @@ -0,0 +1,358 @@ +guest) + { + return; + } + $K2User = K2HelperPermissions::getK2User($user->id); + if (!is_object($K2User)) + { + return; + } + $K2UserGroup = K2HelperPermissions::getK2UserGroup($K2User->group); + if (is_null($K2UserGroup)) + { + return; + } + $K2Permissions = K2Permissions::getInstance(); + $permissions = K2_JVERSION == '15' ? new JParameter($K2UserGroup->permissions) : new JRegistry($K2UserGroup->permissions); + $K2Permissions->permissions = $permissions; + if ($permissions->get('categories') == 'none') + { + return; + } + else if ($permissions->get('categories') == 'all') + { + if ($permissions->get('add') && $permissions->get('frontEdit') && $params->get('frontendEditing')) + { + $K2Permissions->actions[] = 'add.category.all'; + $K2Permissions->actions[] = 'tag'; + $K2Permissions->actions[] = 'extraFields'; + } + if ($permissions->get('editOwn') && $permissions->get('frontEdit') && $params->get('frontendEditing')) + { + $K2Permissions->actions[] = 'editOwn.item.'.$user->id; + $K2Permissions->actions[] = 'tag'; + $K2Permissions->actions[] = 'extraFields'; + } + if ($permissions->get('editAll') && $permissions->get('frontEdit') && $params->get('frontendEditing')) + { + $K2Permissions->actions[] = 'editAll.category.all'; + $K2Permissions->actions[] = 'tag'; + $K2Permissions->actions[] = 'extraFields'; + } + if ($permissions->get('publish') && $permissions->get('frontEdit') && $params->get('frontendEditing')) + { + $K2Permissions->actions[] = 'publish.category.all'; + } + if ($permissions->get('comment')) + { + $K2Permissions->actions[] = 'comment.category.all'; + } + if ($permissions->get('editPublished')) + { + $K2Permissions->actions[] = 'editPublished.category.all'; + } + } + else + { + $selectedCategories = $permissions->get('categories', NULL); + if (is_string($selectedCategories)) + { + $searchIDs[] = $selectedCategories; + } + else + { + $searchIDs = $selectedCategories; + } + if ($permissions->get('inheritance')) + { + $model = K2Model::getInstance('Itemlist', 'K2Model'); + $categories = $model->getCategoryTree($searchIDs); + } + else + { + $categories = $searchIDs; + } + if (is_array($categories) && count($categories)) + { + foreach ($categories as $category) + { + if ($permissions->get('add') && $permissions->get('frontEdit') && $params->get('frontendEditing')) + { + $K2Permissions->actions[] = 'add.category.'.$category; + $K2Permissions->actions[] = 'tag'; + $K2Permissions->actions[] = 'extraFields'; + } + if ($permissions->get('editOwn') && $permissions->get('frontEdit') && $params->get('frontendEditing')) + { + $K2Permissions->actions[] = 'editOwn.item.'.$user->id.'.'.$category; + $K2Permissions->actions[] = 'tag'; + $K2Permissions->actions[] = 'extraFields'; + } + if ($permissions->get('editAll') && $permissions->get('frontEdit') && $params->get('frontendEditing')) + { + $K2Permissions->actions[] = 'editAll.category.'.$category; + $K2Permissions->actions[] = 'tag'; + $K2Permissions->actions[] = 'extraFields'; + } + if ($permissions->get('publish') && $permissions->get('frontEdit') && $params->get('frontendEditing')) + { + $K2Permissions->actions[] = 'publish.category.'.$category; + } + if ($permissions->get('comment')) + { + $K2Permissions->actions[] = 'comment.category.'.$category; + } + if ($permissions->get('editPublished')) + { + $K2Permissions->actions[] = 'editPublished.category.'.$category; + } + } + } + } + return; + } + + public static function checkPermissions() + { + $view = JRequest::getCmd('view'); + if ($view != 'item') + { + return; + } + $task = JRequest::getCmd('task'); + $user = JFactory::getUser(); + $application = JFactory::getApplication(); + if ($user->guest && ($task == 'add' || $task == 'edit')) + { + $uri = JURI::getInstance(); + $return = base64_encode($uri->toString()); + $application->enqueueMessage(JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'), 'notice'); + if (K2_JVERSION == '15') + { + $application->redirect('index.php?option=com_user&view=login&return='.$return.'&tmpl=component'); + } + else + { + $application->redirect('index.php?option=com_users&view=login&return='.$return.'&tmpl=component'); + } + } + + switch ($task) + { + + case 'add' : + if (!K2HelperPermissions::canAddItem()) + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + break; + + case 'edit' : + case 'deleteAttachment' : + case 'checkin' : + $cid = JRequest::getInt('cid'); + if($cid) + { + JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.'/tables'); + $item = JTable::getInstance('K2Item', 'Table'); + $item->load($cid); + + if (!K2HelperPermissions::canEditItem($item->created_by, $item->catid)) + { + // Handle in a different way the case when user can add an item but not edit it. + if($task == 'edit' && !$user->guest && $item->created_by == $user->id && (int)$item->modified == 0 && K2HelperPermissions::canAddItem()) + { + echo ''; + exit; + } + else + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + + } + + } + break; + + case 'save' : + $cid = JRequest::getInt('id'); + if ($cid) + { + + JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.'/tables'); + $item = JTable::getInstance('K2Item', 'Table'); + $item->load($cid); + + if (!K2HelperPermissions::canEditItem($item->created_by, $item->catid)) + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + else + { + if (!K2HelperPermissions::canAddItem()) + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + + break; + + case 'tag' : + if (!K2HelperPermissions::canAddTag()) + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + break; + + case 'extraFields' : + if (!K2HelperPermissions::canRenderExtraFields()) + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + break; + } + } + + public static function getK2User($userID) + { + + $db = JFactory::getDbo(); + $query = "SELECT * FROM #__k2_users WHERE userID = ".(int)$userID; + $db->setQuery($query); + $row = $db->loadObject(); + return $row; + } + + public static function getK2UserGroup($id) + { + + $db = JFactory::getDbo(); + $query = "SELECT * FROM #__k2_user_groups WHERE id = ".(int)$id; + $db->setQuery($query); + $row = $db->loadObject(); + return $row; + } + + public static function canAddItem($category = false) + { + + $user = JFactory::getUser(); + $K2Permissions = K2Permissions::getInstance(); + if (in_array('add.category.all', $K2Permissions->actions)) + { + return true; + } + if ($category) + { + return in_array('add.category.'.$category, $K2Permissions->actions); + } + $db = JFactory::getDbo(); + $query = "SELECT id FROM #__k2_categories WHERE published=1 AND trash=0"; + if (K2_JVERSION != '15') + { + $query .= " AND access IN(".implode(',', $user->getAuthorisedViewLevels()).")"; + } + else + { + $aid = (int)$user->get('aid'); + $query .= " AND access<={$aid}"; + } + $db->setQuery($query); + $categories = K2_JVERSION == '30' ? $db->loadColumn() : $db->loadResultArray(); + foreach ($categories as $category) + { + if (in_array('add.category.'.$category, $K2Permissions->actions)) + { + return true; + } + } + + return false; + } + + public static function canAddToAll() + { + $K2Permissions = K2Permissions::getInstance(); + return in_array('add.category.all', $K2Permissions->actions); + } + + public static function canEditItem($itemOwner, $itemCategory) + { + $K2Permissions = K2Permissions::getInstance(); + if (in_array('editAll.category.all', $K2Permissions->actions) || in_array('editOwn.item.'.$itemOwner, $K2Permissions->actions) || in_array('editOwn.item.'.$itemOwner.'.'.$itemCategory, $K2Permissions->actions) || in_array('editAll.category.'.$itemCategory, $K2Permissions->actions)) + { + return true; + } + else + { + return false; + } + } + + public static function canPublishItem($itemCategory) + { + $K2Permissions = K2Permissions::getInstance(); + if (in_array('publish.category.all', $K2Permissions->actions) || in_array('publish.category.'.$itemCategory, $K2Permissions->actions)) + { + return true; + } + else + { + return false; + } + } + + public static function canAddTag() + { + $K2Permissions = K2Permissions::getInstance(); + return in_array('tag', $K2Permissions->actions); + } + + public static function canRenderExtraFields() + { + $K2Permissions = K2Permissions::getInstance(); + return in_array('extraFields', $K2Permissions->actions); + } + + public static function canAddComment($itemCategory) + { + $K2Permissions = K2Permissions::getInstance(); + return in_array('comment.category.all', $K2Permissions->actions) || in_array('comment.category.'.$itemCategory, $K2Permissions->actions); + } + + public static function canEditPublished($itemCategory) + { + $K2Permissions = K2Permissions::getInstance(); + return in_array('editPublished.category.all', $K2Permissions->actions) || in_array('editPublished.category.'.$itemCategory, $K2Permissions->actions); + } + +} + +class K2Permissions +{ + var $actions = array(); + var $permissions = null; + public static function getInstance() + { + static $instance; + if (!is_object($instance)) + { + $instance = new K2Permissions(); + } + return $instance; + } + +} diff --git a/deployed/k2/components/com_k2/helpers/route.php b/deployed/k2/components/com_k2/helpers/route.php new file mode 100644 index 00000000..9d5e465a --- /dev/null +++ b/deployed/k2/components/com_k2/helpers/route.php @@ -0,0 +1,341 @@ + array(), + 'category' => array(), + 'user' => array(), + 'tag' => array() + ); + + public static function getItemRoute($id, $catid = 0) + { + $key = (string)(int)$id.'|'.(int)$catid; + if (isset(self::$cache['item'][$key])) + { + return self::$cache['item'][$key]; + } + + $needles = array( + 'item' => (int)$id, + 'category' => (int)$catid, + ); + $link = 'index.php?option=com_k2&view=item&id='.$id; + if ($item = K2HelperRoute::_findItem($needles)) + { + $link .= '&Itemid='.$item->id; + } + self::$cache['item'][$key] = $link; + return $link; + } + + public static function getCategoryRoute($catid) + { + $key = (int)$catid; + if (isset(self::$cache['category'][$key])) + { + return self::$cache['category'][$key]; + } + $needles = array('category' => (int)$catid); + $link = 'index.php?option=com_k2&view=itemlist&task=category&id='.$catid; + if ($item = K2HelperRoute::_findItem($needles)) + { + $link .= '&Itemid='.$item->id; + } + self::$cache['category'][$key] = $link; + return $link; + } + + public static function getUserRoute($userID) + { + $key = (int)$userID; + if (isset(self::$cache['user'][$key])) + { + return self::$cache['user'][$key]; + } + + $needles = array('user' => (int)$userID); + $user = JFactory::getUser($userID); + if (K2_JVERSION != '15' && JFactory::getConfig()->get('unicodeslugs') == 1) + { + $alias = JApplication::stringURLSafe($user->name); + } + else if (JPluginHelper::isEnabled('system', 'unicodeslug') || JPluginHelper::isEnabled('system', 'jw_unicodeSlugsExtended')) + { + $alias = JFilterOutput::stringURLSafe($user->name); + } + else + { + mb_internal_encoding("UTF-8"); + mb_regex_encoding("UTF-8"); + $alias = trim(mb_strtolower($user->name)); + $alias = str_replace('-', ' ', $alias); + $alias = mb_ereg_replace('[[:space:]]+', ' ', $alias); + $alias = trim(str_replace(' ', '', $alias)); + $alias = str_replace('.', '', $alias); + + $stripthese = ',|~|!|@|%|^|(|)|<|>|:|;|{|}|[|]|&|`|„|‹|’|‘|“|â€�|•|›|«|´|»|°|«|»|…'; + $strips = explode('|', $stripthese); + foreach ($strips as $strip) + { + $alias = str_replace($strip, '', $alias); + } + $params = K2HelperUtilities::getParams('com_k2'); + $SEFReplacements = array(); + $items = explode(',', $params->get('SEFReplacements', NULL)); + foreach ($items as $item) + { + if (!empty($item)) + { + @list($src, $dst) = explode('|', trim($item)); + $SEFReplacements[trim($src)] = trim($dst); + } + } + foreach ($SEFReplacements as $key => $value) + { + $alias = str_replace($key, $value, $alias); + } + $alias = trim($alias, '-.'); + if (trim(str_replace('-', '', $alias)) == '') + { + $datenow = JFactory::getDate(); + $alias = K2_JVERSION == '15' ? $datenow->toFormat("%Y-%m-%d-%H-%M-%S") : $datenow->format("Y-m-d-H-i-s"); + } + } + $link = 'index.php?option=com_k2&view=itemlist&task=user&id='.$userID.':'.$alias; + if ($item = K2HelperRoute::_findItem($needles)) + { + $link .= '&Itemid='.$item->id; + } + self::$cache['user'][$key] = $link; + return $link; + } + + public static function getTagRoute($tag) + { + $key = $tag; + if (isset(self::$cache['tag'][$key])) + { + return self::$cache['tag'][$key]; + } + + $needles = array('tag' => $tag); + $link = 'index.php?option=com_k2&view=itemlist&task=tag&tag='.urlencode($tag); + if ($item = K2HelperRoute::_findItem($needles)) + { + $link .= '&Itemid='.$item->id; + } + self::$cache['tag'][$key] = $link; + return $link; + } + + public static function getDateRoute($year, $month, $day = null, $catid = null) + { + $needles = array('year' => $year); + $link = 'index.php?option=com_k2&view=itemlist&task=date&year='.$year.'&month='.$month; + if ($day) + { + $link .= '&day='.$day; + } + if ($catid) + { + $link .= '&catid='.$catid; + } + if ($item = K2HelperRoute::_findItem($needles)) + { + $link .= '&Itemid='.$item->id; + } + return $link; + } + + public static function getSearchRoute() + { + $needles = array('search' => 'search'); + $link = 'index.php?option=com_k2&view=itemlist&task=search'; + if ($item = K2HelperRoute::_findItem($needles)) + { + $link .= '&Itemid='.$item->id; + } + return $link; + } + + public static function _findItem($needles) + { + $component = JComponentHelper::getComponent('com_k2'); + $application = JFactory::getApplication(); + $menus = $application->getMenu('site', array()); + if (K2_JVERSION != '15') + { + $items = $menus->getItems('component_id', $component->id); + } + else + { + $items = $menus->getItems('componentid', $component->id); + } + $match = null; + foreach ($needles as $needle => $id) + { + if (count($items)) + { + foreach ($items as $item) + { + + // Detect multiple K2 categories link and set the generic K2 link ( if any ) + if (@$item->query['view'] == 'itemlist' && @$item->query['task'] == '') + { + + if (!isset(self::$multipleCategoriesMapping[$item->id])) + { + if (K2_JVERSION == '15') + { + $menuparams = explode("\n", $item->params); + foreach ($menuparams as $param) + { + if (strpos($param, 'categories=') === 0) + { + $array = explode('categories=', $param); + $item->K2Categories = explode('|', $array[1]); + } + } + if (!isset($item->K2Categories)) + { + $item->K2Categories = array(); + } + } + else + { + $menuparams = json_decode($item->params); + $item->K2Categories = isset($menuparams->categories) ? $menuparams->categories : array(); + } + + self::$multipleCategoriesMapping[$item->id] = $item->K2Categories; + + if (count($item->K2Categories) === 0) + { + + self::$anyK2Link = $item; + } + + } + } + + if ($needle == 'user' || $needle == 'category') + { + if ((@$item->query['task'] == $needle) && (@$item->query['id'] == $id)) + { + $match = $item; + break; + } + + } + else if ($needle == 'tag') + { + if ((@$item->query['task'] == $needle) && (@$item->query['tag'] == $id)) + { + $match = $item; + break; + } + } + else + { + if ((@$item->query['view'] == $needle) && (@$item->query['id'] == $id)) + { + $match = $item; + break; + } + } + + if (!is_null($match)) + { + break; + } + } + // Second pass [START] + // Only for multiple categories links. Triggered only if we do not have find any match (link to direct category) + if (is_null($match) && $needle == 'category') + { + foreach ($items as $item) + { + if (@$item->query['view'] == 'itemlist' && @$item->query['task'] == '') + { + if (isset(self::$multipleCategoriesMapping[$item->id]) && is_array(self::$multipleCategoriesMapping[$item->id])) + { + foreach (self::$multipleCategoriesMapping[$item->id] as $catid) + { + if ((int)$catid == $id) + { + $match = $item; + break; + } + } + } + if (!is_null($match)) + { + break; + } + } + } + } + // Second pass [END] + } + if (!is_null($match)) + { + break; + } + } + + if (is_null($match)) + { + // Try to detect any parent category menu item.... + if ($needle == 'category') + { + if (is_null(self::$tree)) + { + K2Model::addIncludePath(JPATH_SITE.'/components/com_k2/models'); + $model = K2Model::getInstance('Itemlist', 'K2Model'); + self::$model = $model; + self::$tree = $model->getCategoriesTree(); + } + $parents = self::$model->getTreePath(self::$tree, $id); + if (is_array($parents)) + { + foreach ($parents as $categoryID) + { + if ($categoryID != $id) + { + $match = K2HelperRoute::_findItem(array('category' => $categoryID)); + if (!is_null($match)) + { + break; + } + } + } + } + } + if (is_null($match) && !is_null(self::$anyK2Link)) + { + $match = self::$anyK2Link; + } + } + + return $match; + } + +} diff --git a/deployed/k2/components/com_k2/helpers/utilities.php b/deployed/k2/components/com_k2/helpers/utilities.php new file mode 100644 index 00000000..db6fdf74 --- /dev/null +++ b/deployed/k2/components/com_k2/helpers/utilities.php @@ -0,0 +1,347 @@ +getTemplate().'/images/placeholder/user.png')) + { + $avatarPath = 'templates/'.$application->getTemplate().'/images/placeholder/user.png'; + } + else + { + $avatarPath = 'components/com_k2/images/placeholder/user.png'; + } + + // Continue with default K2 avatar determination + if ($userID == 'alias') + { + $avatar = JURI::root(true).'/'.$avatarPath; + } + else if ($userID == 0) + { + if ($params->get('gravatar') && !is_null($email)) + { + $avatar = 'https://secure.gravatar.com/avatar/'.md5($email).'?s='.$width.'&default='.urlencode(JURI::root().$avatarPath); + } + else + { + $avatar = JURI::root(true).'/'.$avatarPath; + } + } + else if (is_numeric($userID) && $userID > 0) + { + K2Model::addIncludePath(JPATH_SITE.'/components/com_k2/models'); + $model = K2Model::getInstance('Item', 'K2Model'); + $profile = $model->getUserProfile($userID); + $avatar = (is_null($profile)) ? '' : $profile->image; + if (empty($avatar)) + { + if ($params->get('gravatar') && !is_null($email)) + { + $avatar = 'https://secure.gravatar.com/avatar/'.md5($email).'?s='.$width.'&default='.urlencode(JURI::root().$avatarPath); + } + else + { + $avatar = JURI::root(true).'/'.$avatarPath; + } + } + else + { + $avatar = JURI::root(true).'/media/k2/users/'.$avatar; + } + + } + + if (!$params->get('userImageDefault') && $avatar == JURI::root(true).'/'.$avatarPath) + { + $avatar = ''; + } + + return $avatar; + } + + public static function getCategoryImage($image, $params) + { + jimport('joomla.filesystem.file'); + $application = JFactory::getApplication(); + $categoryImage = NULL; + if (!empty($image)) + { + $categoryImage = JURI::root(true).'/media/k2/categories/'.$image; + } + else + { + if ($params->get('catImageDefault')) + { + if (JFile::exists(JPATH_SITE.'/templates/'.$application->getTemplate().'/images/placeholder/category.png')) + { + $categoryImage = JURI::root(true).'/templates/'.$application->getTemplate().'/images/placeholder/category.png'; + } + else + { + $categoryImage = JURI::root(true).'/components/com_k2/images/placeholder/category.png'; + } + + } + } + return $categoryImage; + } + + // Word limit + public static function wordLimit($str, $limit = 100, $end_char = '…') + { + if (JString::trim($str) == '') + return $str; + + // always strip tags for text + $str = strip_tags($str); + + $find = array("/\r|\n/u", "/\t/u", "/\s\s+/u"); + $replace = array(" ", " ", " "); + $str = preg_replace($find, $replace, $str); + + preg_match('/\s*(?:\S*\s*){'.(int)$limit.'}/u', $str, $matches); + if (JString::strlen($matches[0]) == JString::strlen($str)) + $end_char = ''; + return JString::rtrim($matches[0]).$end_char; + } + + // Character limit + public static function characterLimit($str, $limit = 150, $end_char = '...') + { + if (JString::trim($str) == '') + return $str; + + // always strip tags for text + $str = strip_tags(JString::trim($str)); + + $find = array("/\r|\n/u", "/\t/u", "/\s\s+/u"); + $replace = array(" ", " ", " "); + $str = preg_replace($find, $replace, $str); + + if (JString::strlen($str) > $limit) + { + $str = JString::substr($str, 0, $limit); + return JString::rtrim($str).$end_char; + } + else + { + return $str; + } + } + + // Cleanup HTML entities + public static function cleanHtml($text) + { + return htmlentities($text, ENT_QUOTES, 'UTF-8'); + } + + // Gender + public static function writtenBy($gender) + { + if (is_null($gender)) + return JText::_('K2_WRITTEN_BY'); + if ($gender == 'm') + return JText::_('K2_WRITTEN_BY_MALE'); + if ($gender == 'f') + return JText::_('K2_WRITTEN_BY_FEMALE'); + } + + public static function setDefaultImage(&$item, $view, $params = NULL) + { + if ($view == 'item') + { + $image = 'image'.$item->params->get('itemImgSize'); + $item->image = $item->$image; + switch ($item->params->get('itemImgSize')) + { + case 'XSmall' : + $item->imageWidth = $item->params->get('itemImageXS'); + break; + case 'Small' : + $item->imageWidth = $item->params->get('itemImageS'); + break; + case 'Medium' : + $item->imageWidth = $item->params->get('itemImageM'); + break; + case 'Large' : + $item->imageWidth = $item->params->get('itemImageL'); + break; + case 'XLarge' : + $item->imageWidth = $item->params->get('itemImageXL'); + break; + } + } + + if ($view == 'itemlist') + { + $image = 'image'.$params->get($item->itemGroup.'ImgSize'); + $item->image = isset($item->$image) ? $item->$image : ''; + switch ($params->get($item->itemGroup.'ImgSize')) + { + case 'XSmall' : + $item->imageWidth = $item->params->get('itemImageXS'); + break; + case 'Small' : + $item->imageWidth = $item->params->get('itemImageS'); + break; + case 'Medium' : + $item->imageWidth = $item->params->get('itemImageM'); + break; + case 'Large' : + $item->imageWidth = $item->params->get('itemImageL'); + break; + case 'XLarge' : + $item->imageWidth = $item->params->get('itemImageXL'); + break; + } + } + + if ($view == 'latest') + { + $image = 'image'.$params->get('latestItemImageSize'); + $item->image = $item->$image; + switch ($params->get('latestItemImageSize')) + { + case 'XSmall' : + $item->imageWidth = $item->params->get('itemImageXS'); + break; + case 'Small' : + $item->imageWidth = $item->params->get('itemImageS'); + break; + case 'Medium' : + $item->imageWidth = $item->params->get('itemImageM'); + break; + case 'Large' : + $item->imageWidth = $item->params->get('itemImageL'); + break; + case 'XLarge' : + $item->imageWidth = $item->params->get('itemImageXL'); + break; + } + } + + if ($view == 'relatedByTag' && $params->get('itemRelatedImageSize')) + { + $image = 'image'.$params->get('itemRelatedImageSize'); + $item->image = $item->$image; + switch ($params->get('itemRelatedImageSize')) + { + case 'XSmall' : + $item->imageWidth = $item->params->get('itemImageXS'); + break; + case 'Small' : + $item->imageWidth = $item->params->get('itemImageS'); + break; + case 'Medium' : + $item->imageWidth = $item->params->get('itemImageM'); + break; + case 'Large' : + $item->imageWidth = $item->params->get('itemImageL'); + break; + case 'XLarge' : + $item->imageWidth = $item->params->get('itemImageXL'); + break; + } + } + } + + public static function getParams($option) + { + if (K2_JVERSION != '15') + { + $application = JFactory::getApplication(); + if ($application->isSite()) + { + $params = $application->getParams($option); + } + else + { + $params = JComponentHelper::getParams($option); + } + } + else + { + $params = JComponentHelper::getParams($option); + } + return $params; + } + + public static function cleanTags($string, $allowed_tags) + { + $allowed_htmltags = array(); + foreach ($allowed_tags as $tag) + { + $allowed_htmltags[] .= "<".$tag.">"; + } + $allowed_htmltags = implode("", $allowed_htmltags); + $string = strip_tags($string, $allowed_htmltags); + return $string; + } + + // Clean HTML Tag Attributes + // e.g. cleanupAttributes($string,"img,hr,h1,h2,h3,h4","style,width,height,hspace,vspace,border,class,id"); + public static function cleanAttributes($string, $tag_array, $attr_array) + { + $attr = implode("|", $attr_array); + foreach ($tag_array as $tag) + { + preg_match_all("#<($tag) .+?>#", $string, $matches, PREG_PATTERN_ORDER); + foreach ($matches[0] as $match) + { + preg_match_all('/('.$attr.')=([\\"\\\']).+?([\\"\\\'])/', $match, $matchesAttr, PREG_PATTERN_ORDER); + foreach ($matchesAttr[0] as $attrToClean) + { + $string = str_replace($attrToClean, '', $string); + $string = preg_replace('| +|', ' ', $string); + $string = str_replace(' >', '>', $string); + } + } + } + return $string; + } + + public static function verifyRecaptcha() + { + $params = JComponentHelper::getParams('com_k2'); + $vars = array(); + $vars['secret'] = $params->get('recaptcha_private_key'); + $vars['response'] = $_POST['g-recaptcha-response']; + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, 'https://www.google.com/recaptcha/api/siteverify'); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($vars, '', '&')); + $result = curl_exec($ch); + $info = curl_getinfo($ch); + curl_close($ch); + $response = json_decode($result); + if($result && $info['http_code'] == 200 && is_object($response) && isset($response->success) && $response->success == true) + { + return true; + } + else + { + return false; + } + } +} diff --git a/deployed/k2/components/com_k2/images/fugue/feed.png b/deployed/k2/components/com_k2/images/fugue/feed.png new file mode 100644 index 00000000..10161702 Binary files /dev/null and b/deployed/k2/components/com_k2/images/fugue/feed.png differ diff --git a/deployed/k2/components/com_k2/images/fugue/globe.png b/deployed/k2/components/com_k2/images/fugue/globe.png new file mode 100644 index 00000000..2cef329e Binary files /dev/null and b/deployed/k2/components/com_k2/images/fugue/globe.png differ diff --git a/deployed/k2/components/com_k2/images/fugue/mail.png b/deployed/k2/components/com_k2/images/fugue/mail.png new file mode 100644 index 00000000..be6ed904 Binary files /dev/null and b/deployed/k2/components/com_k2/images/fugue/mail.png differ diff --git a/deployed/k2/components/com_k2/images/fugue/search.png b/deployed/k2/components/com_k2/images/fugue/search.png new file mode 100644 index 00000000..5389af47 Binary files /dev/null and b/deployed/k2/components/com_k2/images/fugue/search.png differ diff --git a/deployed/k2/components/com_k2/images/loaders/calendar.gif b/deployed/k2/components/com_k2/images/loaders/calendar.gif new file mode 100644 index 00000000..d18c015f Binary files /dev/null and b/deployed/k2/components/com_k2/images/loaders/calendar.gif differ diff --git a/deployed/k2/components/com_k2/images/loaders/generic.gif b/deployed/k2/components/com_k2/images/loaders/generic.gif new file mode 100644 index 00000000..53c70063 Binary files /dev/null and b/deployed/k2/components/com_k2/images/loaders/generic.gif differ diff --git a/deployed/k2/components/com_k2/images/loaders/search.gif b/deployed/k2/components/com_k2/images/loaders/search.gif new file mode 100644 index 00000000..09d621ed Binary files /dev/null and b/deployed/k2/components/com_k2/images/loaders/search.gif differ diff --git a/deployed/k2/components/com_k2/images/placeholder/category.png b/deployed/k2/components/com_k2/images/placeholder/category.png new file mode 100644 index 00000000..79d67daf Binary files /dev/null and b/deployed/k2/components/com_k2/images/placeholder/category.png differ diff --git a/deployed/k2/components/com_k2/images/placeholder/user.png b/deployed/k2/components/com_k2/images/placeholder/user.png new file mode 100644 index 00000000..aa3067e1 Binary files /dev/null and b/deployed/k2/components/com_k2/images/placeholder/user.png differ diff --git a/deployed/k2/components/com_k2/images/ratingstars.gif b/deployed/k2/components/com_k2/images/ratingstars.gif new file mode 100644 index 00000000..9a1e5c51 Binary files /dev/null and b/deployed/k2/components/com_k2/images/ratingstars.gif differ diff --git a/deployed/k2/components/com_k2/images/search.png b/deployed/k2/components/com_k2/images/search.png new file mode 100644 index 00000000..5389af47 Binary files /dev/null and b/deployed/k2/components/com_k2/images/search.png differ diff --git a/deployed/k2/components/com_k2/images/social/delicious.png b/deployed/k2/components/com_k2/images/social/delicious.png new file mode 100644 index 00000000..fa131b14 Binary files /dev/null and b/deployed/k2/components/com_k2/images/social/delicious.png differ diff --git a/deployed/k2/components/com_k2/images/social/delicious_16.png b/deployed/k2/components/com_k2/images/social/delicious_16.png new file mode 100644 index 00000000..e4ebb981 Binary files /dev/null and b/deployed/k2/components/com_k2/images/social/delicious_16.png differ diff --git a/deployed/k2/components/com_k2/images/social/digg.png b/deployed/k2/components/com_k2/images/social/digg.png new file mode 100644 index 00000000..7a436ab4 Binary files /dev/null and b/deployed/k2/components/com_k2/images/social/digg.png differ diff --git a/deployed/k2/components/com_k2/images/social/digg_16.png b/deployed/k2/components/com_k2/images/social/digg_16.png new file mode 100644 index 00000000..fa2efee1 Binary files /dev/null and b/deployed/k2/components/com_k2/images/social/digg_16.png differ diff --git a/deployed/k2/components/com_k2/images/social/email.png b/deployed/k2/components/com_k2/images/social/email.png new file mode 100644 index 00000000..958dd26a Binary files /dev/null and b/deployed/k2/components/com_k2/images/social/email.png differ diff --git a/deployed/k2/components/com_k2/images/social/facebook.png b/deployed/k2/components/com_k2/images/social/facebook.png new file mode 100644 index 00000000..f6437cdf Binary files /dev/null and b/deployed/k2/components/com_k2/images/social/facebook.png differ diff --git a/deployed/k2/components/com_k2/images/social/facebook_16.png b/deployed/k2/components/com_k2/images/social/facebook_16.png new file mode 100644 index 00000000..f0faf29a Binary files /dev/null and b/deployed/k2/components/com_k2/images/social/facebook_16.png differ diff --git a/deployed/k2/components/com_k2/images/social/feed.png b/deployed/k2/components/com_k2/images/social/feed.png new file mode 100644 index 00000000..738081a8 Binary files /dev/null and b/deployed/k2/components/com_k2/images/social/feed.png differ diff --git a/deployed/k2/components/com_k2/images/social/friendfeed.png b/deployed/k2/components/com_k2/images/social/friendfeed.png new file mode 100644 index 00000000..70daf1b4 Binary files /dev/null and b/deployed/k2/components/com_k2/images/social/friendfeed.png differ diff --git a/deployed/k2/components/com_k2/images/social/googlebuzz_16.png b/deployed/k2/components/com_k2/images/social/googlebuzz_16.png new file mode 100644 index 00000000..66673468 Binary files /dev/null and b/deployed/k2/components/com_k2/images/social/googlebuzz_16.png differ diff --git a/deployed/k2/components/com_k2/images/social/myspace.png b/deployed/k2/components/com_k2/images/social/myspace.png new file mode 100644 index 00000000..27cecf43 Binary files /dev/null and b/deployed/k2/components/com_k2/images/social/myspace.png differ diff --git a/deployed/k2/components/com_k2/images/social/myspace_16.png b/deployed/k2/components/com_k2/images/social/myspace_16.png new file mode 100644 index 00000000..5e1b417b Binary files /dev/null and b/deployed/k2/components/com_k2/images/social/myspace_16.png differ diff --git a/deployed/k2/components/com_k2/images/social/reddit.png b/deployed/k2/components/com_k2/images/social/reddit.png new file mode 100644 index 00000000..3074745f Binary files /dev/null and b/deployed/k2/components/com_k2/images/social/reddit.png differ diff --git a/deployed/k2/components/com_k2/images/social/reddit_16.png b/deployed/k2/components/com_k2/images/social/reddit_16.png new file mode 100644 index 00000000..9ca90386 Binary files /dev/null and b/deployed/k2/components/com_k2/images/social/reddit_16.png differ diff --git a/deployed/k2/components/com_k2/images/social/stumble.png b/deployed/k2/components/com_k2/images/social/stumble.png new file mode 100644 index 00000000..44a33724 Binary files /dev/null and b/deployed/k2/components/com_k2/images/social/stumble.png differ diff --git a/deployed/k2/components/com_k2/images/social/stumbleupon_16.png b/deployed/k2/components/com_k2/images/social/stumbleupon_16.png new file mode 100644 index 00000000..484ba490 Binary files /dev/null and b/deployed/k2/components/com_k2/images/social/stumbleupon_16.png differ diff --git a/deployed/k2/components/com_k2/images/social/technorati.png b/deployed/k2/components/com_k2/images/social/technorati.png new file mode 100644 index 00000000..0b5d315b Binary files /dev/null and b/deployed/k2/components/com_k2/images/social/technorati.png differ diff --git a/deployed/k2/components/com_k2/images/social/technorati_16.png b/deployed/k2/components/com_k2/images/social/technorati_16.png new file mode 100644 index 00000000..21673623 Binary files /dev/null and b/deployed/k2/components/com_k2/images/social/technorati_16.png differ diff --git a/deployed/k2/components/com_k2/images/social/twitter.png b/deployed/k2/components/com_k2/images/social/twitter.png new file mode 100644 index 00000000..dc551ed4 Binary files /dev/null and b/deployed/k2/components/com_k2/images/social/twitter.png differ diff --git a/deployed/k2/components/com_k2/images/social/twitter_16.png b/deployed/k2/components/com_k2/images/social/twitter_16.png new file mode 100644 index 00000000..2bcd957c Binary files /dev/null and b/deployed/k2/components/com_k2/images/social/twitter_16.png differ diff --git a/deployed/k2/components/com_k2/images/system/blank.gif b/deployed/k2/components/com_k2/images/system/blank.gif new file mode 100644 index 00000000..35d42e80 Binary files /dev/null and b/deployed/k2/components/com_k2/images/system/blank.gif differ diff --git a/deployed/k2/components/com_k2/images/system/featuredItem.png b/deployed/k2/components/com_k2/images/system/featuredItem.png new file mode 100644 index 00000000..471d4d2b Binary files /dev/null and b/deployed/k2/components/com_k2/images/system/featuredItem.png differ diff --git a/deployed/k2/components/com_k2/images/system/featuredItem_withShadow.png b/deployed/k2/components/com_k2/images/system/featuredItem_withShadow.png new file mode 100644 index 00000000..b1f424c7 Binary files /dev/null and b/deployed/k2/components/com_k2/images/system/featuredItem_withShadow.png differ diff --git a/deployed/k2/components/com_k2/images/system/feed-icon-14x14.gif b/deployed/k2/components/com_k2/images/system/feed-icon-14x14.gif new file mode 100644 index 00000000..2d328846 Binary files /dev/null and b/deployed/k2/components/com_k2/images/system/feed-icon-14x14.gif differ diff --git a/deployed/k2/components/com_k2/images/system/font_decrease.gif b/deployed/k2/components/com_k2/images/system/font_decrease.gif new file mode 100644 index 00000000..0f61de2b Binary files /dev/null and b/deployed/k2/components/com_k2/images/system/font_decrease.gif differ diff --git a/deployed/k2/components/com_k2/images/system/font_increase.gif b/deployed/k2/components/com_k2/images/system/font_increase.gif new file mode 100644 index 00000000..e88deeaf Binary files /dev/null and b/deployed/k2/components/com_k2/images/system/font_increase.gif differ diff --git a/deployed/k2/components/com_k2/images/system/k2CalendarLoader.gif b/deployed/k2/components/com_k2/images/system/k2CalendarLoader.gif new file mode 100644 index 00000000..d18c015f Binary files /dev/null and b/deployed/k2/components/com_k2/images/system/k2CalendarLoader.gif differ diff --git a/deployed/k2/components/com_k2/images/system/loading.gif b/deployed/k2/components/com_k2/images/system/loading.gif new file mode 100644 index 00000000..53c70063 Binary files /dev/null and b/deployed/k2/components/com_k2/images/system/loading.gif differ diff --git a/deployed/k2/components/com_k2/images/system/searchLoader.gif b/deployed/k2/components/com_k2/images/system/searchLoader.gif new file mode 100644 index 00000000..09d621ed Binary files /dev/null and b/deployed/k2/components/com_k2/images/system/searchLoader.gif differ diff --git a/deployed/k2/components/com_k2/images/system/star.gif b/deployed/k2/components/com_k2/images/system/star.gif new file mode 100644 index 00000000..32633e30 Binary files /dev/null and b/deployed/k2/components/com_k2/images/system/star.gif differ diff --git a/deployed/k2/components/com_k2/images/system/stripes.png b/deployed/k2/components/com_k2/images/system/stripes.png new file mode 100644 index 00000000..3987ad37 Binary files /dev/null and b/deployed/k2/components/com_k2/images/system/stripes.png differ diff --git a/deployed/k2/components/com_k2/images/system/transparent_star.gif b/deployed/k2/components/com_k2/images/system/transparent_star.gif new file mode 100644 index 00000000..9a1e5c51 Binary files /dev/null and b/deployed/k2/components/com_k2/images/system/transparent_star.gif differ diff --git a/deployed/k2/components/com_k2/images/system/videoplayer-bg.gif b/deployed/k2/components/com_k2/images/system/videoplayer-bg.gif new file mode 100644 index 00000000..25e139bb Binary files /dev/null and b/deployed/k2/components/com_k2/images/system/videoplayer-bg.gif differ diff --git a/deployed/k2/components/com_k2/images/videobg.gif b/deployed/k2/components/com_k2/images/videobg.gif new file mode 100644 index 00000000..25e139bb Binary files /dev/null and b/deployed/k2/components/com_k2/images/videobg.gif differ diff --git a/deployed/k2/components/com_k2/k2.php b/deployed/k2/components/com_k2/k2.php new file mode 100644 index 00000000..e1b75d7d --- /dev/null +++ b/deployed/k2/components/com_k2/k2.php @@ -0,0 +1,74 @@ +authorise('core.admin', 'com_k2')) + { + $user->gid = 1000; + } + else + { + $user->gid = 1; + } +} + +JLoader::register('K2Controller', JPATH_COMPONENT.'/controllers/controller.php'); +JLoader::register('K2Model', JPATH_COMPONENT_ADMINISTRATOR.'/models/model.php'); +JLoader::register('K2View', JPATH_COMPONENT_ADMINISTRATOR.'/views/view.php'); +JLoader::register('K2HelperRoute', JPATH_COMPONENT.'/helpers/route.php'); +JLoader::register('K2HelperPermissions', JPATH_COMPONENT.'/helpers/permissions.php'); +JLoader::register('K2HelperUtilities', JPATH_COMPONENT.'/helpers/utilities.php'); + +K2HelperPermissions::setPermissions(); +K2HelperPermissions::checkPermissions(); + +$controller = JRequest::getWord('view', 'itemlist'); +$task = JRequest::getWord('task'); + +if ($controller == 'media') +{ + $controller = 'item'; + if ($task != 'connector') + { + $task = 'media'; + } +} + +if ($controller == 'users') +{ + $controller = 'item'; + $task = 'users'; +} + +jimport('joomla.filesystem.file'); +jimport('joomla.html.parameter'); + +if (JFile::exists(JPATH_COMPONENT.'/controllers/'.$controller.'.php')) +{ + $classname = 'K2Controller'.$controller; + if(!class_exists($classname)) + require_once(JPATH_COMPONENT.'/controllers/'.$controller.'.php'); + $controller = new $classname(); + $controller->execute($task); + $controller->redirect(); +} +else +{ + JError::raiseError(404, JText::_('K2_NOT_FOUND')); +} + +if (JRequest::getCmd('format') != 'json') +{ + echo "\n\n\n"; +} diff --git a/deployed/k2/components/com_k2/models/item.php b/deployed/k2/components/com_k2/models/item.php new file mode 100644 index 00000000..f381cfe7 --- /dev/null +++ b/deployed/k2/components/com_k2/models/item.php @@ -0,0 +1,1857 @@ +getLanguageFilter(); + if ($languageFilter) + { + $languageTag = JFactory::getLanguage()->getTag(); + $query .= " AND language IN (".$db->Quote($languageTag).",".$db->Quote('*').")"; + } + } + $db->setQuery($query, 0, 1); + $row = $db->loadObject(); + return $row; + } + + function prepareItem($item, $view, $task) + { + jimport('joomla.filesystem.file'); + JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.'/tables'); + $limitstart = JRequest::getInt('limitstart'); + $application = JFactory::getApplication(); + //Initialize params + if ($view != 'item') + { + if (K2_JVERSION == '30') + { + $params = $application->getParams('com_k2'); + } + else + { + $component = JComponentHelper::getComponent('com_k2'); + $params = class_exists('JParameter') ? new JParameter($component->params) : new JRegistry($component->params); + $itemid = JRequest::getInt('Itemid'); + if ($itemid) + { + $menu = $application->getMenu(); + $menuparams = $menu->getParams($itemid); + $params->merge($menuparams); + } + } + } + else + { + $params = K2HelperUtilities::getParams('com_k2'); + } + + //Category + $db = JFactory::getDbo(); + $category = JTable::getInstance('K2Category', 'Table'); + $category->load($item->catid); + + $item->category = $category; + $item->category->link = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($category->id.':'.urlencode($category->alias)))); + + //Read more link + $link = K2HelperRoute::getItemRoute($item->id.':'.urlencode($item->alias), $item->catid.':'.urlencode($item->category->alias)); + $item->link = urldecode(JRoute::_($link)); + + //Print link + $item->printLink = urldecode(JRoute::_($link.'&tmpl=component&print=1')); + + //Params + $cparams = class_exists('JParameter') ? new JParameter($category->params) : new JRegistry($category->params); + $iparams = class_exists('JParameter') ? new JParameter($item->params) : new JRegistry($item->params); + $item->params = version_compare(PHP_VERSION, '5.0.0', '>=') ? clone $params : $params; + + if ($cparams->get('inheritFrom')) + { + $masterCategoryID = $cparams->get('inheritFrom'); + $masterCategory = JTable::getInstance('K2Category', 'Table'); + $masterCategory->load((int)$masterCategoryID); + $cparams = class_exists('JParameter') ? new JParameter($masterCategory->params) : new JRegistry($masterCategory->params); + } + $item->params->merge($cparams); + $item->params->merge($iparams); + + // Edit link + if (K2HelperPermissions::canEditItem($item->created_by, $item->catid)) + $item->editLink = JRoute::_('index.php?option=com_k2&view=item&task=edit&cid='.$item->id.'&tmpl=component'); + + // Tags + if (($view == 'item' && ($item->params->get('itemTags') || $item->params->get('itemRelated'))) || ($view == 'itemlist' && ($task == '' || $task == 'category') && $item->params->get('catItemTags')) || ($view == 'itemlist' && $task == 'user' && $item->params->get('userItemTags')) || ($view == 'latest' && $params->get('latestItemTags'))) + { + $tags = $this->getItemTags($item->id); + for ($i = 0; $i < sizeof($tags); $i++) + { + $tags[$i]->link = JRoute::_(K2HelperRoute::getTagRoute($tags[$i]->name)); + } + $item->tags = $tags; + } + + // Image + $item->imageXSmall = ''; + $item->imageSmall = ''; + $item->imageMedium = ''; + $item->imageLarge = ''; + $item->imageXLarge = ''; + + $date = JFactory::getDate($item->modified); + $timestamp = '?t='.$date->toUnix(); + + if (JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.md5("Image".$item->id).'_XS.jpg')) + { + $item->imageXSmall = JURI::base(true).'/media/k2/items/cache/'.md5("Image".$item->id).'_XS.jpg'; + if ($params->get('imageTimestamp')) + { + $item->imageXSmall .= $timestamp; + } + } + + if (JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.md5("Image".$item->id).'_S.jpg')) + { + $item->imageSmall = JURI::base(true).'/media/k2/items/cache/'.md5("Image".$item->id).'_S.jpg'; + if ($params->get('imageTimestamp')) + { + $item->imageSmall .= $timestamp; + } + } + + if (JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.md5("Image".$item->id).'_M.jpg')) + { + $item->imageMedium = JURI::base(true).'/media/k2/items/cache/'.md5("Image".$item->id).'_M.jpg'; + if ($params->get('imageTimestamp')) + { + $item->imageMedium .= $timestamp; + } + } + + if (JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.md5("Image".$item->id).'_L.jpg')) + { + $item->imageLarge = JURI::base(true).'/media/k2/items/cache/'.md5("Image".$item->id).'_L.jpg'; + if ($params->get('imageTimestamp')) + { + $item->imageLarge .= $timestamp; + } + } + + if (JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.md5("Image".$item->id).'_XL.jpg')) + { + $item->imageXLarge = JURI::base(true).'/media/k2/items/cache/'.md5("Image".$item->id).'_XL.jpg'; + if ($params->get('imageTimestamp')) + { + $item->imageXLarge .= $timestamp; + } + } + + if (JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.md5("Image".$item->id).'_Generic.jpg')) + { + $item->imageGeneric = JURI::base(true).'/media/k2/items/cache/'.md5("Image".$item->id).'_Generic.jpg'; + if ($params->get('imageTimestamp')) + { + $item->imageGeneric .= $timestamp; + } + } + + // Extra fields + if ((($view == 'item' || $view == 'relatedByTag') && $item->params->get('itemExtraFields')) || ($view == 'itemlist' && ($task == '' || $task == 'category') && $item->params->get('catItemExtraFields')) || ($view == 'itemlist' && $task == 'tag' && $item->params->get('tagItemExtraFields')) || ($view == 'itemlist' && ($task == 'search' || $task == 'date') && $item->params->get('genericItemExtraFields'))) + { + $item->extra_fields = $this->getItemExtraFields($item->extra_fields, $item); + } + + // Attachments + if (($view == 'item' && $item->params->get('itemAttachments')) || ($view == 'itemlist' && ($task == '' || $task == 'category') && $item->params->get('catItemAttachments'))) + { + $item->attachments = $this->getItemAttachments($item->id); + } + + // Rating + if (($view == 'item' && $item->params->get('itemRating')) || ($view == 'itemlist' && ($task == '' || $task == 'category') && $item->params->get('catItemRating'))) + { + $item->votingPercentage = $this->getVotesPercentage($item->id); + $item->numOfvotes = $this->getVotesNum($item->id); + + } + + // Filtering + if ($params->get('introTextCleanup')) + { + $filterTags = preg_split('#[,\s]+#', trim($params->get('introTextCleanupExcludeTags'))); + $filterAttrs = preg_split('#[,\s]+#', trim($params->get('introTextCleanupTagAttr'))); + $filterAttrs = array_filter($filterAttrs); + $item->introtext = K2HelperUtilities::cleanTags($item->introtext, $filterTags); + if (count($filterAttrs)) + { + $item->introtext = K2HelperUtilities::cleanAttributes($item->introtext, $filterTags, $filterAttrs); + } + } + + if ($params->get('fullTextCleanup')) + { + $filterTags = preg_split('#[,\s]+#', trim($params->get('fullTextCleanupExcludeTags'))); + $filterAttrs = preg_split('#[,\s]+#', trim($params->get('fullTextCleanupTagAttr'))); + $filterAttrs = array_filter($filterAttrs); + $item->fulltext = K2HelperUtilities::cleanTags($item->fulltext, $filterTags); + if (count($filterAttrs)) + { + $item->fulltext = K2HelperUtilities::cleanAttributes($item->fulltext, $filterTags, $filterAttrs); + } + } + + if ($item->params->get('catItemIntroTextWordLimit') && $task == 'category') + { + $item->introtext = K2HelperUtilities::wordLimit($item->introtext, $item->params->get('catItemIntroTextWordLimit')); + } + + $item->cleanTitle = $item->title; + $item->title = htmlspecialchars($item->title, ENT_QUOTES); + $item->image_caption = htmlspecialchars($item->image_caption, ENT_QUOTES); + + // Author + $metaAuthor = K2_JVERSION != '15' && $application->getCfg('MetaAuthor'); + if ($metaAuthor || ($view == 'item' && ($item->params->get('itemAuthorBlock') || $item->params->get('itemAuthor'))) || ($view == 'itemlist' && ($task == '' || $task == 'category') && ($item->params->get('catItemAuthorBlock') || $item->params->get('catItemAuthor'))) || ($view == 'itemlist' && $task == 'user') || ($view == 'relatedByTag')) + { + if (!empty($item->created_by_alias)) + { + $item->author = new stdClass; + $item->author->name = $item->created_by_alias; + $item->author->avatar = K2HelperUtilities::getAvatar('alias'); + $item->author->link = JURI::root(); + } + else + { + $author = JFactory::getUser($item->created_by); + $item->author = $author; + $item->author->link = JRoute::_(K2HelperRoute::getUserRoute($item->created_by)); + $item->author->profile = $this->getUserProfile($item->created_by); + $item->author->avatar = K2HelperUtilities::getAvatar($author->id, $author->email, $params->get('userImageWidth')); + } + + if (!isset($item->author->profile) || is_null($item->author->profile)) + { + + $item->author->profile = new JObject; + $item->author->profile->gender = NULL; + + } + + } + + // Num of comments + if ($params->get('comments', 0) > 0) + { + $user = JFactory::getUser(); + if (!$user->guest && $user->id == $item->created_by && $params->get('inlineCommentsModeration')) + { + $item->numOfComments = $this->countItemComments($item->id, false); + } + else + { + $item->numOfComments = $this->countItemComments($item->id); + } + } + + return $item; + } + + function prepareFeedItem(&$item) + { + JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.'/tables'); + $params = K2HelperUtilities::getParams('com_k2'); + $limitstart = 0; + $view = JRequest::getCmd('view'); + // Category + $category = JTable::getInstance('K2Category', 'Table'); + $category->load($item->catid); + $item->category = $category; + + // Read more link + $item->link = urldecode(JRoute::_(K2HelperRoute::getItemRoute($item->id.':'.$item->alias, $item->catid.':'.urlencode($item->category->alias)))); + + // Filtering + if ($params->get('introTextCleanup')) + { + $filterTags = preg_split('#[,\s]+#', trim($params->get('introTextCleanupExcludeTags'))); + $filterAttrs = preg_split('#[,\s]+#', trim($params->get('introTextCleanupTagAttr'))); + $filter = new JFilterInput($filterTags, $filterAttrs, 0, 1); + $item->introtext = $filter->clean($item->introtext); + } + + if ($params->get('fullTextCleanup')) + { + $filterTags = preg_split('#[,\s]+#', trim($params->get('fullTextCleanupExcludeTags'))); + $filterAttrs = preg_split('#[,\s]+#', trim($params->get('fullTextCleanupTagAttr'))); + $filter = new JFilterInput($filterTags, $filterAttrs, 0, 1); + $item->fulltext = $filter->clean($item->fulltext); + } + + // Description + $item->description = ''; + + // Item image + if ($params->get('feedItemImage') && JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.md5("Image".$item->id).'_'.$params->get('feedImgSize').'.jpg')) + { + $altText = $item->image_caption ? $item->image_caption : $item->title; + $item->description .= '
    '.$altText.'
    '; + } + + // Item Introtext + if ($params->get('feedItemIntroText')) + { + // Introtext word limit + if ($params->get('feedTextWordLimit') && $item->introtext) + { + $item->introtext = K2HelperUtilities::wordLimit($item->introtext, $params->get('feedTextWordLimit')); + } + $item->description .= '
    '.$item->introtext.'
    '; + } + + // Item Fulltext + if ($params->get('feedItemFullText') && $item->fulltext) + { + $item->description .= '
    '.$item->fulltext.'
    '; + } + + // Item Tags + if ($params->get('feedItemTags')) + { + $tags = $this->getItemTags($item->id); + if (count($tags)) + { + $item->description .= '
      '; + foreach ($tags as $tag) + { + $item->description .= '
    • '.$tag->name.'
    • '; + } + $item->description .= '
      '; + } + } + + // Item Video + if ($params->get('feedItemVideo') && $item->video) + { + if (!empty($item->video) && JString::substr($item->video, 0, 1) !== '{') + { + $item->description .= '
      '.$item->video.'
      '; + } + else + { + $params->set('vfolder', 'media/k2/videos'); + $params->set('afolder', 'media/k2/audio'); + if (JString::strpos($item->video, 'remote}')) + { + preg_match("#}(.*?){/#s", $item->video, $matches); + if (!JString::strpos($matches[1], 'http://}')) + $item->video = str_replace($matches[1], JURI::root().$matches[1], $item->video); + } + $dispatcher = JDispatcher::getInstance(); + JPluginHelper::importPlugin('content'); + $item->text = $item->video; + if (K2_JVERSION == '15') + { + $dispatcher->trigger('onPrepareContent', array( + &$item, + &$params, + $limitstart + )); + } + else + { + $dispatcher->trigger('onContentPrepare', array( + 'com_k2.'.$view, + &$item, + &$params, + $limitstart + )); + } $item->description .= '
      '.$item->text.'
      '; + } + } + + // Item gallery + if ($params->get('feedItemGallery') && $item->gallery) + { + $params->set('galleries_rootfolder', 'media/k2/galleries'); + $params->set('enabledownload', '0'); + $dispatcher = JDispatcher::getInstance(); + JPluginHelper::importPlugin('content'); + $item->text = $item->gallery; + if (K2_JVERSION == '15') + { + $dispatcher->trigger('onPrepareContent', array( + &$item, + &$params, + $limitstart + )); + } + else + { + $dispatcher->trigger('onContentPrepare', array( + 'com_k2.'.$view, + &$item, + &$params, + $limitstart + )); + } + $item->description .= '
      '.$item->text.'
      '; + } + + // Item attachments + if ($params->get('feedItemAttachments')) + { + $attachments = $this->getItemAttachments($item->id); + if (count($attachments)) + { + $item->description .= '
        '; + foreach ($attachments as $attachment) + { + $item->description .= '
      • '.$attachment->title.'
      • '; + } + $item->description .= '
        '; + } + } + + // Author + if (!empty($item->created_by_alias)) + { + if(!isset($item->author)) + { + $item->author = new stdClass; + } + $item->author->name = $item->created_by_alias; + $item->author->email = ''; + } + else + { + $author = JFactory::getUser($item->created_by); + $item->author = $author; + $item->author->link = JRoute::_(K2HelperRoute::getUserRoute($item->created_by)); + $item->author->profile = $this->getUserProfile($item->created_by); + } + + return $item; + } + + function prepareJSONItem($item) + { + $row = new JObject(); + unset($row->_errors); + $row->id = $item->id; + $row->title = $item->title; + $row->alias = $item->alias; + $row->link = $item->link; + $row->catid = $item->catid; + $row->introtext = $item->introtext; + $row->fulltext = $item->fulltext; + $row->extra_fields = $item->extra_fields; + $row->created = $item->created; + //$row->created_by = $item->created_by; + $row->created_by_alias = $item->created_by_alias; + $row->modified = $item->modified; + //$row->modified_by = $item->modified_by; + $row->featured = $item->featured; + //$row->ordering = $item->ordering; + //$row->featured_ordering = $item->featured_ordering; + $row->image = isset($item->image) ? $item->image : ''; + $row->imageWidth = isset($item->imageWidth) ? $item->imageWidth : ''; + $row->image_caption = $item->image_caption; + $row->image_credits = $item->image_credits; + $row->imageXSmall = $item->imageXSmall; + $row->imageSmall = $item->imageSmall; + $row->imageMedium = $item->imageMedium; + $row->imageLarge = $item->imageLarge; + $row->imageXLarge = $item->imageXLarge; + $row->video = $item->video; + $row->video_caption = $item->video_caption; + $row->video_credits = $item->video_credits; + $row->gallery = $item->gallery; + $row->hits = $item->hits; + //$row->plugins = $item->plugins; + $row->category = new stdClass; + $row->category->id = $item->category->id; + $row->category->name = $item->category->name; + $row->category->alias = $item->category->alias; + $row->category->link = $item->category->link; + $row->category->description = $item->category->description; + $row->category->image = $item->category->image; + $row->category->ordering = $item->category->ordering; + //$row->category->plugins = $item->category->plugins; + $row->tags = isset($item->tags) ? $item->tags : array(); + $row->attachments = isset($item->attachments) ? $item->attachments : array(); + $row->votingPercentage = isset($item->votingPercentage) ? $item->votingPercentage : ''; + $row->numOfvotes = isset($item->numOfvotes) ? $item->numOfvotes : ''; + if (isset($item->author)) + { + $row->author = new stdClass; + //$row->author->id = $item->author->id; + $row->author->name = $item->author->name; + //$row->author->username = $item->author->username; + $row->author->link = $item->author->link; + $row->author->avatar = $item->author->avatar; + if (isset($item->author->profile)) + { + unset($item->author->profile->plugins); + } + $row->author->profile = $item->author->profile; + if (isset($row->author->profile->url)) + { + $row->author->profile->url = htmlspecialchars($row->author->profile->url, ENT_QUOTES, 'UTF-8'); + } + } + $row->numOfComments = $item->numOfComments; + $row->events = $item->event; + $row->language = $item->language; + return $row; + } + + function execPlugins($item, $view, $task) + { + jimport('joomla.filesystem.file'); + jimport('joomla.filesystem.folder'); + $params = K2HelperUtilities::getParams('com_k2'); + $limitstart = JRequest::getInt('limitstart'); + // Import plugins + $dispatcher = JDispatcher::getInstance(); + JPluginHelper::importPlugin('content'); + + if (!isset($this->isSigInstalled)) + { + $this->isSigInstalled = ( + JFile::exists(JPATH_SITE.'/plugins/content/jw_sigpro.php') || + JFile::exists(JPATH_SITE.'/plugins/content/jw_sigpro/jw_sigpro.php') || + JFile::exists(JPATH_SITE.'/plugins/content/jw_sigpro/jw_sigpro/jw_sigpro.php') + ); + } + + if (!$this->isSigInstalled) + { + $item->gallery = null; + } + + // Gallery + if (($view == 'item' && $item->params->get('itemImageGallery')) || ($view == 'itemlist' && ($task == '' || $task == 'category') && $item->params->get('catItemImageGallery')) || ($view == 'relatedByTag')) + { + if ($item->gallery) + { + if (JString::strpos($item->gallery, 'flickr.com') === false) + { + $item->gallery = "{gallery}{$item->id}{/gallery}"; + if (!JFolder::exists(JPATH_SITE.'/media/k2/galleries/'.$item->id)) + { + $item->gallery = null; + } + } + $params->set('galleries_rootfolder', 'media/k2/galleries'); + + if ($view == 'item') + { + $width = (int)$item->params->get('itemImageGalleryWidth'); + $height = (int)$item->params->get('itemImageGalleryHeight'); + } + else + { + $width = (int)$item->params->get('catItemImageGalleryWidth'); + $height = (int)$item->params->get('catItemImageGalleryHeight'); + } + + if($width && $height) { + if (JString::strpos($item->gallery, 'flickr.com') !== false) + { + $sigParams = JComponentHelper::getParams('com_sigpro'); + $item->gallery = str_replace('{/gallery}', ':'.$sigParams->get('flickrImageCount', 20).':'.$width.':'.$height.'{/gallery}', $item->gallery); + } + else + { + $item->gallery = str_replace('{/gallery}', ':'.$width.':'.$height.'{/gallery}', $item->gallery); + } + } + + $item->text = $item->gallery; + if (K2_JVERSION == '15') + { + $dispatcher->trigger('onPrepareContent', array( + &$item, + &$params, + $limitstart + )); + } + else + { + $dispatcher->trigger('onContentPrepare', array( + 'com_k2.'.$view.'-gallery', + &$item, + &$params, + $limitstart + )); + } + $item->gallery = $item->text; + } + } + + // Video + if (($view == 'item' && $item->params->get('itemVideo')) || ($view == 'itemlist' && ($task == '' || $task == 'category') && $item->params->get('catItemVideo')) || ($view == 'latest' && $item->params->get('latestItemVideo')) || ($view == 'relatedByTag')) + { + if (!empty($item->video) && JString::substr($item->video, 0, 1) !== '{') + { + $item->video = $item->video; + $item->videoType = 'embedded'; + } + else + { + $item->videoType = 'allvideos'; + $params->set('afolder', 'media/k2/audio'); + $params->set('vfolder', 'media/k2/videos'); + + if (JString::strpos($item->video, 'remote}')) + { + preg_match("#}(.*?){/#s", $item->video, $matches); + if (JString::substr($matches[1], 0, 7) != 'http://') + $item->video = str_replace($matches[1], JURI::root().$matches[1], $item->video); + } + + if ($view == 'item') + { + $params->set('vwidth', $item->params->get('itemVideoWidth')); + $params->set('vheight', $item->params->get('itemVideoHeight')); + $params->set('autoplay', $item->params->get('itemVideoAutoPlay')); + } + else if ($view == 'latest') + { + $params->set('vwidth', $item->params->get('latestItemVideoWidth')); + $params->set('vheight', $item->params->get('latestItemVideoHeight')); + $params->set('autoplay', $item->params->get('latestItemVideoAutoPlay')); + } + else + { + $params->set('vwidth', $item->params->get('catItemVideoWidth')); + $params->set('vheight', $item->params->get('catItemVideoHeight')); + $params->set('autoplay', $item->params->get('catItemVideoAutoPlay')); + } + + $item->text = $item->video; + if (K2_JVERSION == '15') + { + $dispatcher->trigger('onPrepareContent', array( + &$item, + &$params, + $limitstart + )); + } + else + { + $dispatcher->trigger('onContentPrepare', array( + 'com_k2.'.$view.'-media', + &$item, + &$params, + $limitstart + )); + } + $item->video = $item->text; + } + + } + + // Plugins + $item->text = ''; + $params->set('vfolder', NULL); + $params->set('afolder', NULL); + $params->set('vwidth', NULL); + $params->set('vheight', NULL); + $params->set('autoplay', NULL); + $params->set('galleries_rootfolder', NULL); + $params->set('enabledownload', NULL); + + if ($view == 'item') + { + + if ($item->params->get('itemIntroText')) + $item->text .= $item->introtext; + if ($item->params->get('itemFullText')) + $item->text .= '{K2Splitter}'.$item->fulltext; + } + else if($view == 'latest') { + if ($item->params->get('latestItemIntroText')) + $item->text .= $item->introtext; + } + else + { + + switch($task) + { + case '' : + case 'category' : + if ($item->params->get('catItemIntroText')) + $item->text .= $item->introtext; + break; + + case 'user' : + if ($item->params->get('userItemIntroText')) + $item->text .= $item->introtext; + break; + + case 'tag' : + if ($item->params->get('tagItemIntroText')) + $item->text .= $item->introtext; + break; + + default : + if ($item->params->get('genericItemIntroText')) + $item->text .= $item->introtext; + break; + } + + } + $item->event = new stdClass; + if (K2_JVERSION != '15') + { + + $item->event->BeforeDisplay = ''; + $item->event->AfterDisplay = ''; + + $dispatcher->trigger('onContentPrepare', array( + 'com_k2.'.$view, + &$item, + &$params, + $limitstart + )); + + $results = $dispatcher->trigger('onContentAfterTitle', array( + 'com_k2.'.$view, + &$item, + &$params, + $limitstart + )); + $item->event->AfterDisplayTitle = trim(implode("\n", $results)); + + $results = $dispatcher->trigger('onContentBeforeDisplay', array( + 'com_k2.'.$view, + &$item, + &$params, + $limitstart + )); + $item->event->BeforeDisplayContent = trim(implode("\n", $results)); + + $results = $dispatcher->trigger('onContentAfterDisplay', array( + 'com_k2.'.$view, + &$item, + &$params, + $limitstart + )); + $item->event->AfterDisplayContent = trim(implode("\n", $results)); + + } + else + { + $results = $dispatcher->trigger('onBeforeDisplay', array( + &$item, + &$params, + $limitstart + )); + $item->event->BeforeDisplay = trim(implode("\n", $results)); + + $results = $dispatcher->trigger('onAfterDisplay', array( + &$item, + &$params, + $limitstart + )); + $item->event->AfterDisplay = trim(implode("\n", $results)); + + $results = $dispatcher->trigger('onAfterDisplayTitle', array( + &$item, + &$params, + $limitstart + )); + $item->event->AfterDisplayTitle = trim(implode("\n", $results)); + + $results = $dispatcher->trigger('onBeforeDisplayContent', array( + &$item, + &$params, + $limitstart + )); + $item->event->BeforeDisplayContent = trim(implode("\n", $results)); + + $results = $dispatcher->trigger('onAfterDisplayContent', array( + &$item, + &$params, + $limitstart + )); + $item->event->AfterDisplayContent = trim(implode("\n", $results)); + + $dispatcher->trigger('onPrepareContent', array( + &$item, + &$params, + $limitstart + )); + + } + + // K2 plugins + $item->event->K2BeforeDisplay = ''; + $item->event->K2AfterDisplay = ''; + $item->event->K2AfterDisplayTitle = ''; + $item->event->K2BeforeDisplayContent = ''; + $item->event->K2AfterDisplayContent = ''; + + if (($view == 'item' && $item->params->get('itemK2Plugins')) || ($view == 'itemlist' && ($task == '' || $task == 'category') && $item->params->get('catItemK2Plugins')) || ($view == 'itemlist' && $task == 'user' && $item->params->get('userItemK2Plugins')) || ($view == 'itemlist' && ($task == 'search' || $task == 'tag' || $task == 'date'))) + { + + JPluginHelper::importPlugin('k2'); + + $results = $dispatcher->trigger('onK2BeforeDisplay', array( + &$item, + &$params, + $limitstart + )); + $item->event->K2BeforeDisplay = trim(implode("\n", $results)); + + $results = $dispatcher->trigger('onK2AfterDisplay', array( + &$item, + &$params, + $limitstart + )); + $item->event->K2AfterDisplay = trim(implode("\n", $results)); + + $results = $dispatcher->trigger('onK2AfterDisplayTitle', array( + &$item, + &$params, + $limitstart + )); + $item->event->K2AfterDisplayTitle = trim(implode("\n", $results)); + + $results = $dispatcher->trigger('onK2BeforeDisplayContent', array( + &$item, + &$params, + $limitstart + )); + $item->event->K2BeforeDisplayContent = trim(implode("\n", $results)); + + $results = $dispatcher->trigger('onK2AfterDisplayContent', array( + &$item, + &$params, + $limitstart + )); + $item->event->K2AfterDisplayContent = trim(implode("\n", $results)); + + $dispatcher->trigger('onK2PrepareContent', array( + &$item, + &$params, + $limitstart + )); + + } + + if ($view == 'item') + { + @list($item->introtext, $item->fulltext) = explode('{K2Splitter}', $item->text); + } + else + { + $item->introtext = $item->text; + } + + // Extra fields plugins + if (($view == 'item' && $item->params->get('itemExtraFields')) || ($view == 'itemlist' && ($task == '' || $task == 'category') && $item->params->get('catItemExtraFields')) || ($view == 'itemlist' && $task == 'tag' && $item->params->get('tagItemExtraFields')) || ($view == 'itemlist' && ($task == 'search' || $task == 'date') && $item->params->get('genericItemExtraFields'))) + { + if (count($item->extra_fields) && is_array($item->extra_fields)) + { + foreach ($item->extra_fields as $key => $extraField) + { + if ($extraField->type == 'textarea' || $extraField->type == 'textfield') + { + $tmp = new JObject(); + $tmp->text = $extraField->value; + if (K2_JVERSION != '15') + { + $dispatcher->trigger('onContentPrepare', array( + 'com_k2.'.$view, + &$tmp, + &$params, + $limitstart + )); + } + else + { + $dispatcher->trigger('onPrepareContent', array( + &$tmp, + &$params, + $limitstart + )); + } + $dispatcher->trigger('onK2PrepareContent', array( + &$tmp, + &$params, + $limitstart + )); + $extraField->value = $tmp->text; + } + } + } + } + return $item; + } + + function hit($id) + { + $row = JTable::getInstance('K2Item', 'Table'); + $row->hit($id); + } + + function vote() + { + $application = JFactory::getApplication(); + JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.'/tables'); + + // Get item + $item = JTable::getInstance('K2Item', 'Table'); + $item->load(JRequest::getInt('itemID')); + + // Get category + $category = JTable::getInstance('K2Category', 'Table'); + $category->load($item->catid); + + // Access check + $user = JFactory::getUser(); + if (K2_JVERSION != '15') + { + if (!in_array($item->access, $user->getAuthorisedViewLevels()) || !in_array($category->access, $user->getAuthorisedViewLevels())) + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + } + else + { + if ($item->access > $user->get('aid', 0) || $category->access > $user->get('aid', 0)) + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + } + + // Published check + if (!$item->published || $item->trash) + { + JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); + } + if (!$category->published || $category->trash) + { + JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); + } + + $rate = JRequest::getVar('user_rating', 0, '', 'int'); + + if ($rate >= 1 && $rate <= 5) + { + $db = JFactory::getDbo(); + $userIP = $_SERVER['REMOTE_ADDR']; + $query = "SELECT * FROM #__k2_rating WHERE itemID =".(int)$item->id; + $db->setQuery($query); + $rating = $db->loadObject(); + + if (!$rating) + { + $query = "INSERT INTO #__k2_rating ( itemID, lastip, rating_sum, rating_count ) VALUES ( ".(int)$item->id.", ".$db->Quote($userIP).", {$rate}, 1 )"; + $db->setQuery($query); + $db->query(); + echo JText::_('K2_THANKS_FOR_RATING'); + + } + + else + { + if ($userIP != ($rating->lastip)) + { + $query = "UPDATE #__k2_rating"." SET rating_count = rating_count + 1, rating_sum = rating_sum + {$rate}, lastip = ".$db->Quote($userIP)." WHERE itemID = {$item->id}"; + $db->setQuery($query); + $db->query(); + echo JText::_('K2_THANKS_FOR_RATING'); + + } + else + { + echo JText::_('K2_YOU_HAVE_ALREADY_RATED_THIS_ITEM'); + } + } + + } + $application->close(); + } + + function getRating($id) + { + $id = (int)$id; + static $K2RatingsInstances = array(); + if (array_key_exists($id, $K2RatingsInstances)) + { + return $K2RatingsInstances[$id]; + } + $db = JFactory::getDbo(); + $query = "SELECT * FROM #__k2_rating WHERE itemID = ".$id; + $db->setQuery($query); + $vote = $db->loadObject(); + $K2RatingsInstances[$id] = $vote; + return $K2RatingsInstances[$id]; + } + + function getVotesNum($itemID = NULL) + { + $application = JFactory::getApplication(); + $user = JFactory::getUser(); + $xhr = false; + if (is_null($itemID)) + { + $itemID = JRequest::getInt('itemID'); + $xhr = true; + } + $vote = $this->getRating($itemID); + if (!is_null($vote)) + { + $rating_count = intval($vote->rating_count); + } + else + { + $rating_count = 0; + } + if ($rating_count != 1) + { + $result = "(".$rating_count." ".JText::_('K2_VOTES').")"; + } + else + { + $result = "(".$rating_count." ".JText::_('K2_VOTE').")"; + } + if ($xhr) + { + echo $result; + $application->close(); + } + else + { + return $result; + } + } + + function getVotesPercentage($itemID = NULL) + { + $application = JFactory::getApplication(); + $user = JFactory::getUser(); + $db = JFactory::getDbo(); + $xhr = false; + $result = 0; + if (is_null($itemID)) + { + $itemID = JRequest::getInt('itemID'); + $xhr = true; + } + $vote = $this->getRating($itemID); + if (!is_null($vote) && $vote->rating_count != 0) + { + $result = number_format(intval($vote->rating_sum) / intval($vote->rating_count), 2) * 20; + } + if ($xhr) + { + echo $result; + $application->close(); + } + else + { + return $result; + } + } + + function comment() + { + $application = JFactory::getApplication(); + jimport('joomla.mail.helper'); + JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.'/tables'); + $params = K2HelperUtilities::getParams('com_k2'); + $user = JFactory::getUser(); + $config = JFactory::getConfig(); + $response = new JObject(); + + // Get item + $item = JTable::getInstance('K2Item', 'Table'); + $item->load(JRequest::getInt('itemID')); + + // Get category + $category = JTable::getInstance('K2Category', 'Table'); + $category->load($item->catid); + + // Access check + if (K2_JVERSION != '15') + { + if (!in_array($item->access, $user->getAuthorisedViewLevels()) || !in_array($category->access, $user->getAuthorisedViewLevels())) + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + } + else + { + if ($item->access > $user->get('aid', 0) || $category->access > $user->get('aid', 0)) + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + } + + // Published check + if (!$item->published || $item->trash) + { + JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); + } + if (!$category->published || $category->trash) + { + JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); + } + + // Check permissions + if ((($params->get('comments') == '2') && ($user->id > 0) && K2HelperPermissions::canAddComment($item->catid)) || ($params->get('comments') == '1')) + { + + // If new antispam settings are not saved, show a message to the comments form and stop the comment submission + $antispamProtection = $params->get('antispam', null); + if( + $antispamProtection === null || + (($antispamProtection == 'recaptcha' || $antispamProtection == 'both') && !$params->get('recaptcha_private_key')) || + (($antispamProtection == 'akismet' || $antispamProtection == 'both') && !$params->get('akismetApiKey')) + ) + { + $response->message = JText::_('K2_ANTISPAM_SETTINGS_ERROR'); + $response->cssClass = 'k2FormLogError'; + echo json_encode($response); + $application->close(); + } + + $row = JTable::getInstance('K2Comment', 'Table'); + + if (!$row->bind(JRequest::get('post'))) + { + $response->message = $row->getError(); + $response->cssClass = 'k2FormLogError'; + echo json_encode($response); + $application->close(); + } + + $row->commentText = JRequest::getString('commentText', '', 'default'); + $row->commentText = strip_tags($row->commentText); + + // Clean vars + $filter = JFilterInput::getInstance(); + $row->userName = $filter->clean($row->userName, 'username'); + if ($row->commentURL && preg_match('/^((http|https|ftp):\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,6}((:[0-9]{1,5})?\/.*)?$/i', $row->commentURL)) + { + $url = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $row->commentURL); + $url = str_replace(';//', '://', $url); + if ($url != '') + { + $url = (!strstr($url, '://')) ? 'http://'.$url : $url; + $url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&$1', $url); + $row->commentURL = $url; + } + } + else + { + $row->commentURL = ''; + } + + $datenow = JFactory::getDate(); + $row->commentDate = K2_JVERSION == '15' ? $datenow->toMySQL() : $datenow->toSql(); + + if (!$user->guest) + { + $row->userID = $user->id; + $row->commentEmail = $user->email; + $row->userName = $user->name; + } + + $userName = trim($row->userName); + $commentEmail = trim($row->commentEmail); + $commentText = trim($row->commentText); + $commentURL = trim($row->commentURL); + + if (empty($userName) || $userName == JText::_('K2_ENTER_YOUR_NAME') || empty($commentText) || $commentText == JText::_('K2_ENTER_YOUR_MESSAGE_HERE') || empty($commentEmail) || $commentEmail == JText::_('K2_ENTER_YOUR_EMAIL_ADDRESS')) + { + $response->message = JText::_('K2_YOU_NEED_TO_FILL_IN_ALL_REQUIRED_FIELDS'); + $response->cssClass = 'k2FormLogError'; + echo json_encode($response); + $application->close(); + } + + if (!JMailHelper::isEmailAddress($commentEmail)) + { + $response->message = JText::_('K2_INVALID_EMAIL_ADDRESS'); + $response->cssClass = 'k2FormLogError'; + echo json_encode($response); + $application->close(); + } + + if ($user->guest) + { + $db = JFactory::getDbo(); + $query = "SELECT COUNT(*) FROM #__users WHERE name=".$db->Quote($userName)." OR email=".$db->Quote($commentEmail); + $db->setQuery($query); + $result = $db->loadresult(); + if ($result > 0) + { + $response->message = JText::_('K2_THE_NAME_OR_EMAIL_ADDRESS_YOU_TYPED_IS_ALREADY_IN_USE'); + $response->cssClass = 'k2FormLogError'; + echo json_encode($response); + $application->close(); + } + + } + + // Google reCAPTCHA + if ($params->get('antispam') == 'recaptcha' || $params->get('antispam') == 'both') + { + if ($user->guest || $params->get('recaptchaForRegistered', 1)) + { + if($params->get('recaptchaV2')) + { + require_once JPATH_SITE.'/components/com_k2/helpers/utilities.php'; + if (!K2HelperUtilities::verifyRecaptcha()) + { + $response->message = JText::_('K2_COULD_NOT_VERIFY_THAT_YOU_ARE_NOT_A_ROBOT'); + $response->cssClass = 'k2FormLogError'; + echo json_encode($response); + $application->close(); + } + } + else + { + if (!function_exists('_recaptcha_qsencode')) + { + require_once(JPATH_SITE.'/media/k2/assets/vendors/google/recaptcha_legacy/recaptcha.php'); + } + $privatekey = trim($params->get('recaptcha_private_key')); + $recaptcha_challenge_field = isset($_POST["recaptcha_challenge_field"]) ? $_POST["recaptcha_challenge_field"] : ''; + $recaptcha_response_field = isset($_POST["recaptcha_response_field"]) ? $_POST["recaptcha_response_field"] : ''; + $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $recaptcha_challenge_field, $recaptcha_response_field); + if (!$resp->is_valid) + { + $response->message = JText::_('K2_THE_WORDS_YOU_TYPED_DID_NOT_MATCH_THE_ONES_DISPLAYED_PLEASE_TRY_AGAIN'); + $response->cssClass = 'k2FormLogError'; + echo json_encode($response); + $application->close(); + } + } + + } + } + + // Akismet + if ($params->get('antispam') == 'akismet' || $params->get('antispam') == 'both') + { + if ($user->guest || $params->get('akismetForRegistered', 1)) + { + if ($params->get('akismetApiKey')) + { + require_once(JPATH_SITE.'/media/k2/assets/vendors/achingbrain/php5-akismet/akismet.class.php'); + $akismetApiKey = trim($params->get('akismetApiKey')); + $akismet = new Akismet(JURI::root(false), $akismetApiKey); + $akismet->setCommentAuthor($userName); + $akismet->setCommentAuthorEmail($commentEmail); + $akismet->setCommentAuthorURL($commentURL); + $akismet->setCommentContent($commentText); + $akismet->setPermalink(JURI::root(false).'index.php?option=com_k2&view=item&id='.JRequest::getInt('itemID')); + try + { + if ($akismet->isCommentSpam()) + { + $response->message = JText::_('K2_SPAM_ATTEMPT_HAS_BEEN_DETECTED_THE_COMMENT_HAS_BEEN_REJECTED'); + $response->cssClass = 'k2FormLogError'; + echo json_encode($response); + $application->close(); + } + } + catch(Exception $e) + { + $response->message = $e->getMessage(); + $response->cssClass = 'k2FormLogSuccess'; + echo json_encode($response); + $application->close(); + } + + } + } + } + + if ($commentURL == JText::_('K2_ENTER_YOUR_SITE_URL') || $commentURL == "") + { + $row->commentURL = NULL; + } + else + { + if (substr($commentURL, 0, 7) != 'http://') + { + $row->commentURL = 'http://'.$commentURL; + } + } + + if ($params->get('commentsPublishing', false)) + { + $row->published = 1; + } + else + { + $row->published = 0; + // Auto publish comments for users with administrative permissions + if (K2_JVERSION != '15') + { + if ($user->authorise('core.admin')) + { + $row->published = 1; + } + } + else + { + if ($user->gid > 23) + { + $row->published = 1; + } + } + } + + if (!$row->store()) + { + $response->message = $row->getError(); + $response->cssClass = 'k2FormLogError'; + echo json_encode($response); + $application->close(); + } + + if ($row->published) + { + $caching = K2_JVERSION == '30' ? $config->get('caching') : $config->getValue('config.caching'); + if ($caching && $user->guest) + { + $response->message = JText::_('K2_THANK_YOU_YOUR_COMMENT_WILL_BE_PUBLISHED_SHORTLY'); + $response->cssClass = 'k2FormLogSuccess'; + echo json_encode($response); + } + else + { + $response->message = JText::_('K2_COMMENT_ADDED_REFRESHING_PAGE'); + $response->cssClass = 'k2FormLogSuccess'; + $response->refresh = 1; + echo json_encode($response); + } + + } + else + { + $response->message = JText::_('K2_COMMENT_ADDED_AND_WAITING_FOR_APPROVAL'); + $response->cssClass = 'k2FormLogSuccess'; + echo json_encode($response); + } + + } + $application->close(); + } + + function getItemTags($itemID) + { + $itemID = (int)$itemID; + static $K2ItemTagsInstances = array(); + if (isset($K2ItemTagsInstances[$itemID])) + { + return $K2ItemTagsInstances[$itemID]; + } + $db = JFactory::getDbo(); + $query = "SELECT tag.* + FROM #__k2_tags AS tag + JOIN #__k2_tags_xref AS xref ON tag.id = xref.tagID + WHERE tag.published=1 + AND xref.itemID = ".(int)$itemID." ORDER BY xref.id ASC"; + + $db->setQuery($query); + $rows = $db->loadObjectList(); + $K2ItemTagsInstances[$itemID] = $rows; + return $K2ItemTagsInstances[$itemID]; + } + + function getItemExtraFields($itemExtraFields, &$item = null) + { + static $K2ItemExtraFieldsInstances = array(); + if ($item && isset($K2ItemExtraFieldsInstances[$item->id])) + { + $this->buildAliasBasedExtraFields($K2ItemExtraFieldsInstances[$item->id], $item); + return $K2ItemExtraFieldsInstances[$item->id]; + } + + jimport('joomla.filesystem.file'); + $db = JFactory::getDbo(); + $jsonObjects = json_decode($itemExtraFields); + $imgExtensions = array( + 'jpg', + 'jpeg', + 'gif', + 'png' + ); + $params = K2HelperUtilities::getParams('com_k2'); + + if (count($jsonObjects) < 1) + { + return NULL; + } + + foreach ($jsonObjects as $object) + { + $extraFieldsIDs[] = $object->id; + } + JArrayHelper::toInteger($extraFieldsIDs); + $condition = @implode(',', $extraFieldsIDs); + + $query = "SELECT extraFieldsGroup FROM #__k2_categories WHERE id=".(int)$item->catid; + $db->setQuery($query); + $group = $db->loadResult(); + + $query = "SELECT * FROM #__k2_extra_fields WHERE `group` = ".(int)$group." AND published=1 AND (id IN ({$condition}) OR `type` = 'header') ORDER BY ordering ASC"; + $db->setQuery($query); + $rows = $db->loadObjectList(); + $size = count($rows); + + for ($i = 0; $i < $size; $i++) + { + $value = ''; + $rawValue = ''; + $values = array(); + foreach ($jsonObjects as $object) + { + if ($rows[$i]->id == $object->id) + { + if ($rows[$i]->type == 'textfield' || $rows[$i]->type == 'textarea' || $rows[$i]->type == 'date') + { + $value = $object->value; + if ($rows[$i]->type == 'date' && $value) + { + $rawValue = $value; + $offset = (K2_JVERSION != '15') ? null : 0; + $value = JHTML::_('date', $value, JText::_('K2_DATE_FORMAT_LC'), $offset); + } + + } + else if ($rows[$i]->type == 'image') + { + if ($object->value) + { + $src = ''; + if (JString::strpos('http://', $object->value) === false) + { + $src .= JURI::root(true); + } + $src .= $object->value; + $value = ''.$rows[$i]->name.''; + } + else + { + $value = false; + } + + } + else if ($rows[$i]->type == 'labels') + { + $labels = explode(',', $object->value); + if (!is_array($labels)) + { + $labels = (array)$labels; + } + $value = ''; + foreach ($labels as $label) + { + $label = JString::trim($label); + if($label != '') + { + $label = str_replace('-', ' ', $label); + $value .= ''.$label.''; + } + } + + } + else if ($rows[$i]->type == 'select' || $rows[$i]->type == 'radio') + { + foreach (json_decode($rows[$i]->value) as $option) + { + if ($option->value == $object->value) + { + $value .= $option->name; + } + + } + } + else if ($rows[$i]->type == 'multipleSelect') + { + foreach (json_decode($rows[$i]->value) as $option) + { + if (@in_array($option->value, $object->value)) + { + $values[] = $option->name; + } + + } + $value = @implode(', ', $values); + } + else if ($rows[$i]->type == 'csv') + { + $array = $object->value; + if (count($array)) + { + $value .= ''; + foreach ($array as $key => $row) + { + $value .= ''; + foreach ($row as $cell) + { + $value .= ($key > 0) ? '' : ''; + } + $value .= ''; + } + $value .= '
        '.$cell.''.$cell.'
        '; + } + + } + else + { + + switch ($object->value[2]) + { + case 'same' : + default : + $attributes = ''; + break; + + case 'new' : + $attributes = 'target="_blank"'; + break; + + case 'popup' : + $attributes = 'class="classicPopup" rel="{\'x\':'.$params->get('linkPopupWidth').',\'y\':'.$params->get('linkPopupHeight').'}"'; + break; + + case 'lightbox' : + + // Joomla modal required + if (!defined('K2_JOOMLA_MODAL_REQUIRED')) + define('K2_JOOMLA_MODAL_REQUIRED', true); + + $filename = @basename($object->value[1]); + $extension = JFile::getExt($filename); + if (!empty($extension) && in_array($extension, $imgExtensions)) + { + $attributes = 'data-k2-modal="image"'; + } + else + { + $attributes = 'data-k2-modal="iframe"'; + } + break; + } + $object->value[0] = JString::trim($object->value[0]); + $object->value[1] = JString::trim($object->value[1]); + + if ($object->value[1] && $object->value[1] != 'http://' && $object->value[1] != 'https://') + { + if ($object->value[0] == '') + { + $object->value[0] = $object->value[1]; + } + $rows[$i]->url = $object->value[1]; + $rows[$i]->text = $object->value[0]; + $rows[$i]->attributes = $attributes; + $value = ''.$object->value[0].''; + } + else + { + $value = false; + } + } + + } + + } + + if ($rows[$i]->type == 'header') + { + $tmp = json_decode($rows[$i]->value); + if (!$tmp[0]->displayInFrontEnd) + { + $value = null; + } + else + { + $value = $tmp[0]->value; + } + } + + // Detect alias + $tmpValues = json_decode($rows[$i]->value); + if (isset($tmpValues[0]) && isset($tmpValues[0]->alias) && !empty($tmpValues[0]->alias)) + { + $rows[$i]->alias = $tmpValues[0]->alias; + } + else + { + $filter = JFilterInput::getInstance(); + $rows[$i]->alias = $filter->clean($rows[$i]->name, 'WORD'); + if (!$rows[$i]->alias) + { + $rows[$i]->alias = 'extraField'.$rows[$i]->id; + } + } + + if (JString::trim($value) != '') + { + if (JString::trim($rawValue) != '') + { + $rows[$i]->rawValue = $rawValue; + } + $rows[$i]->value = $value; + if (!is_null($item)) + { + if (!isset($item->extraFields)) + { + $item->extraFields = new stdClass; + } + $tmpAlias = $rows[$i]->alias; + $item->extraFields->$tmpAlias = $rows[$i]; + } + } + else + { + unset($rows[$i]); + } + } + + if ($item) + { + $K2ItemExtraFieldsInstances[$item->id] = $rows; + } + $this->buildAliasBasedExtraFields($K2ItemExtraFieldsInstances[$item->id], $item); + return $K2ItemExtraFieldsInstances[$item->id]; + } + + function buildAliasBasedExtraFields($extraFields, &$item) + { + if (is_null($item)) + { + return false; + } + if (!isset($item->extraFields)) + { + $item->extraFields = new stdClass; + } + foreach ($extraFields as $extraField) + { + $tmpAlias = $extraField->alias; + $item->extraFields->$tmpAlias = $extraField; + } + } + + function getItemAttachments($itemID) + { + $itemID = (int)$itemID; + static $K2ItemAttachmentsInstances = array(); + if (isset($K2ItemAttachmentsInstances[$itemID])) + { + return $K2ItemAttachmentsInstances[$itemID]; + } + $db = JFactory::getDbo(); + $query = "SELECT * FROM #__k2_attachments WHERE itemID=".$itemID; + $db->setQuery($query); + $rows = $db->loadObjectList(); + foreach ($rows as $row) + { + $hash = version_compare(JVERSION, '3.0', 'ge') ? JApplication::getHash($row->id) : JUtility::getHash($row->id); + $row->link = JRoute::_('index.php?option=com_k2&view=item&task=download&id='.$row->id.'_'.$hash); + } + $K2ItemAttachmentsInstances[$itemID] = $rows; + return $K2ItemAttachmentsInstances[$itemID]; + } + + function getItemComments($itemID, $limitstart, $limit, $published = true) + { + $params = K2HelperUtilities::getParams('com_k2'); + $order = $params->get('commentsOrdering', 'DESC'); + $ordering = ($order == 'DESC') ? 'DESC' : 'ASC'; + $db = JFactory::getDbo(); + $query = "SELECT * FROM #__k2_comments WHERE itemID=".(int)$itemID; + if ($published) + { + $query .= " AND published=1 "; + } + $query .= " ORDER BY commentDate {$ordering}"; + $db->setQuery($query, $limitstart, $limit); + $rows = $db->loadObjectList(); + return $rows; + } + + function countItemComments($itemID, $published = true) + { + $itemID = (int)$itemID; + $index = $itemID.'_'.(int)$published; + static $K2ItemCommentsCountInstances = array(); + if (isset($K2ItemCommentsCountInstances[$index])) + { + return $K2ItemCommentsCountInstances[$index]; + } + $db = JFactory::getDbo(); + $query = "SELECT COUNT(*) FROM #__k2_comments WHERE itemID=".$itemID; + if ($published) + { + $query .= " AND published=1 "; + } + $db->setQuery($query); + $result = $db->loadResult(); + $K2ItemCommentsCountInstances[$index] = $result; + return $K2ItemCommentsCountInstances[$index]; + } + + function checkin() + { + $application = JFactory::getApplication(); + $id = JRequest::getInt('cid'); + if($id) + { + $row = JTable::getInstance('K2Item', 'Table'); + $row->load($id); + $row->checkin(); + } + else + { + // Clean up SIGPro + $sigProFolder = JRequest::getCmd('sigProFolder'); + if($sigProFolder && !is_numeric($sigProFolder) && JFolder::exists(JPATH_SITE.'/media/k2/galleries/'.$sigProFolder)) + { + JFolder::delete(JPATH_SITE.'/media/k2/galleries/'.$sigProFolder); + } + } + $application->close(); + } + + function getPreviousItem($id, $catid, $ordering) + { + $application = JFactory::getApplication(); + $user = JFactory::getUser(); + $id = (int)$id; + $catid = (int)$catid; + $ordering = (int)$ordering; + $db = JFactory::getDbo(); + + $jnow = JFactory::getDate(); + $now = K2_JVERSION == '15' ? $jnow->toMySQL() : $jnow->toSql(); + $nullDate = $db->getNullDate(); + + if (K2_JVERSION != '15') + { + $accessCondition = ' AND access IN('.implode(',', $user->getAuthorisedViewLevels()).')'; + } + else + { + $accessCondition = ' AND access <= '.$user->aid; ; + } + + $languageCondition = ''; + if (K2_JVERSION != '15') + { + if ($application->getLanguageFilter()) + { + $languageCondition = "AND language IN (".$db->quote(JFactory::getLanguage()->getTag()).",".$db->quote('*').")"; + } + } + + if ($ordering == "0") + { + $query = "SELECT * FROM #__k2_items WHERE id < {$id} AND catid={$catid} AND published=1 AND ( publish_up = ".$db->Quote($nullDate)." OR publish_up <= ".$db->Quote($now)." ) AND ( publish_down = ".$db->Quote($nullDate)." OR publish_down >= ".$db->Quote($now)." ) {$accessCondition} AND trash=0 {$languageCondition} ORDER BY ordering DESC"; + } + else + { + $query = "SELECT * FROM #__k2_items WHERE id != {$id} AND catid={$catid} AND ordering < {$ordering} AND published=1 AND ( publish_up = ".$db->Quote($nullDate)." OR publish_up <= ".$db->Quote($now)." ) AND ( publish_down = ".$db->Quote($nullDate)." OR publish_down >= ".$db->Quote($now)." ) {$accessCondition} AND trash=0 {$languageCondition} ORDER BY ordering DESC"; + } + + $db->setQuery($query, 0, 1); + $row = $db->loadObject(); + return $row; + } + + function getNextItem($id, $catid, $ordering) + { + $application = JFactory::getApplication(); + $user = JFactory::getUser(); + $id = (int)$id; + $catid = (int)$catid; + $ordering = (int)$ordering; + $db = JFactory::getDbo(); + + $jnow = JFactory::getDate(); + $now = K2_JVERSION == '15' ? $jnow->toMySQL() : $jnow->toSql(); + $nullDate = $db->getNullDate(); + + if (K2_JVERSION != '15') + { + $accessCondition = ' AND access IN('.implode(',', $user->getAuthorisedViewLevels()).')'; + } + else + { + $accessCondition = ' AND access <= '.$user->aid; ; + } + + $languageCondition = ''; + if (K2_JVERSION != '15') + { + if ($application->getLanguageFilter()) + { + $languageCondition = "AND language IN (".$db->quote(JFactory::getLanguage()->getTag()).",".$db->quote('*').")"; + } + } + + if ($ordering == "0") + { + $query = "SELECT * FROM #__k2_items WHERE id > {$id} AND catid={$catid} AND published=1 AND ( publish_up = ".$db->Quote($nullDate)." OR publish_up <= ".$db->Quote($now)." ) AND ( publish_down = ".$db->Quote($nullDate)." OR publish_down >= ".$db->Quote($now)." ) {$accessCondition} AND trash=0 {$languageCondition} ORDER BY ordering ASC"; + } + else + { + $query = "SELECT * FROM #__k2_items WHERE id != {$id} AND catid={$catid} AND ordering > {$ordering} AND published=1 AND ( publish_up = ".$db->Quote($nullDate)." OR publish_up <= ".$db->Quote($now)." ) AND ( publish_down = ".$db->Quote($nullDate)." OR publish_down >= ".$db->Quote($now)." ) {$accessCondition} AND trash=0 {$languageCondition} ORDER BY ordering ASC"; + } + $db->setQuery($query, 0, 1); + $row = $db->loadObject(); + return $row; + } + + function getUserProfile($id = NULL) + { + $db = JFactory::getDbo(); + if (is_null($id)) + $id = JRequest::getInt('id'); + + static $K2UsersInstances = array(); + if (isset($K2UsersInstances[$id])) + { + return $K2UsersInstances[$id]; + } + + $query = "SELECT id, gender, description, image, url, `group`, plugins FROM #__k2_users WHERE userID={$id}"; + $db->setQuery($query); + $row = $db->loadObject(); + $K2UsersInstances[$id] = $row; + return $row; + } +} diff --git a/deployed/k2/components/com_k2/models/itemlist.php b/deployed/k2/components/com_k2/models/itemlist.php new file mode 100644 index 00000000..65e237de --- /dev/null +++ b/deployed/k2/components/com_k2/models/itemlist.php @@ -0,0 +1,1295 @@ +get('aid'); + $db = JFactory::getDbo(); + $params = K2HelperUtilities::getParams('com_k2'); + $limitstart = JRequest::getInt('limitstart'); + $limit = JRequest::getInt('limit'); + $task = JRequest::getCmd('task'); + if ($task == 'search' && $params->get('googleSearch')) + return array(); + + $jnow = JFactory::getDate(); + $now = K2_JVERSION == '15' ? $jnow->toMySQL() : $jnow->toSql(); + $nullDate = $db->getNullDate(); + + if (JRequest::getWord('format') == 'feed') + $limit = $params->get('feedLimit'); + + $query = "SELECT i.*,"; + + if($ordering == 'modified') + { + $query .= " CASE WHEN i.modified = 0 THEN i.created ELSE i.modified END as lastChanged, "; + } + + $query .= " c.name as categoryname,c.id as categoryid, c.alias as categoryalias, c.params as categoryparams"; + + + + if ($ordering == 'best') + $query .= ", (r.rating_sum/r.rating_count) AS rating"; + + $query .= " FROM #__k2_items as i RIGHT JOIN #__k2_categories AS c ON c.id = i.catid"; + + if ($ordering == 'best') + $query .= " LEFT JOIN #__k2_rating r ON r.itemID = i.id"; + + //Changed the query for the tag case for better performance + //if ($task == 'tag') + // $query .= " LEFT JOIN #__k2_tags_xref AS tags_xref ON tags_xref.itemID = i.id LEFT JOIN #__k2_tags AS tags ON tags.id = tags_xref.tagID"; + + if ($task == 'user' && !$user->guest && $user->id == JRequest::getInt('id')) + { + $query .= " WHERE "; + } + else + { + $query .= " WHERE i.published = 1 AND "; + } + + if (K2_JVERSION != '15') + { + + $query .= "i.access IN(".implode(',', $user->getAuthorisedViewLevels()).")"." AND i.trash = 0"." AND c.published = 1"." AND c.access IN(".implode(',', $user->getAuthorisedViewLevels()).")"." AND c.trash = 0"; + + $application = JFactory::getApplication(); + $languageFilter = $application->getLanguageFilter(); + if ($languageFilter) + { + $languageTag = JFactory::getLanguage()->getTag(); + $query .= " AND c.language IN (".$db->quote($languageTag).",".$db->quote('*').") + AND i.language IN (".$db->quote($languageTag).",".$db->quote('*').")"; + } + } + else + { + $query .= "i.access <= {$aid}"." AND i.trash = 0"." AND c.published = 1"." AND c.access <= {$aid}"." AND c.trash = 0"; + } + + if (!($task == 'user' && !$user->guest && $user->id == JRequest::getInt('id'))) + { + $query .= " AND ( i.publish_up = ".$db->Quote($nullDate)." OR i.publish_up <= ".$db->Quote($now)." )"; + $query .= " AND ( i.publish_down = ".$db->Quote($nullDate)." OR i.publish_down >= ".$db->Quote($now)." )"; + } + + //Build query depending on task + switch ($task) + { + + case 'category' : + $id = JRequest::getInt('id'); + + $category = JTable::getInstance('K2Category', 'Table'); + $category->load($id); + $cparams = class_exists('JParameter') ? new JParameter($category->params) : new JRegistry($category->params); + + if ($cparams->get('inheritFrom')) + { + + $parent = JTable::getInstance('K2Category', 'Table'); + $parent->load($cparams->get('inheritFrom')); + $cparams = class_exists('JParameter') ? new JParameter($parent->params) : new JRegistry($parent->params); + } + + if ($cparams->get('catCatalogMode')) + { + $query .= " AND c.id={$id} "; + } + else + { + $categories = $this->getCategoryTree($id); + $sql = @implode(',', $categories); + $query .= " AND c.id IN ({$sql})"; + } + + break; + + case 'user' : + $id = JRequest::getInt('id'); + $query .= " AND i.created_by={$id} AND i.created_by_alias=''"; + $categories = $params->get('userCategoriesFilter', NULL); + if (is_array($categories)) + { + $categories = array_filter($categories); + JArrayHelper::toInteger($categories); + if(count($categories)) + { + $query .= " AND c.id IN(".implode(',', $categories).")"; + } + } + if (is_string($categories) && $categories > 0) + { + $query .= " AND c.id = {$categories}"; + } + break; + + case 'search' : + $badchars = array( + '#', + '>', + '<', + '\\' + ); + $search = JString::trim(JString::str_ireplace($badchars, '', JRequest::getString('searchword', null))); + $sql = $this->prepareSearch($search); + if (!empty($sql)) + { + $query .= $sql; + } + else + { + $rows = array(); + return $rows; + } + break; + + case 'date' : + if ((JRequest::getInt('month')) && (JRequest::getInt('year'))) + { + $month = JRequest::getInt('month'); + $year = JRequest::getInt('year'); + $query .= " AND MONTH(i.created) = {$month} AND YEAR(i.created)={$year} "; + if (JRequest::getInt('day')) + { + $day = JRequest::getInt('day'); + $query .= " AND DAY(i.created) = {$day}"; + } + + if (JRequest::getInt('catid')) + { + $catid = JRequest::getInt('catid'); + $query .= " AND c.id={$catid}"; + } + + } + break; + + case 'tag' : + $tag = JRequest::getString('tag'); + jimport('joomla.filesystem.file'); + if (JFile::exists(JPATH_ADMINISTRATOR.'/components/com_joomfish/joomfish.php') && $task == 'tag') + { + + $registry = JFactory::getConfig(); + $lang = K2_JVERSION == '30' ? $registry->get('jflang') : $registry->getValue('config.jflang'); + + $sql = " SELECT reference_id FROM #__jf_content as jfc LEFT JOIN #__languages as jfl ON jfc.language_id = jfl.".K2_JF_ID; + $sql .= " WHERE jfc.value = ".$db->Quote($tag); + $sql .= " AND jfc.reference_table = 'k2_tags'"; + $sql .= " AND jfc.reference_field = 'name' AND jfc.published=1"; + + $db->setQuery($sql, 0, 1); + $result = $db->loadResult(); + + } + + if (JFile::exists(JPATH_ADMINISTRATOR.'/components/com_falang/falang.php') && $task == 'tag') + { + + $registry = JFactory::getConfig(); + $lang = K2_JVERSION == '30' ? $registry->get('jflang') : $registry->getValue('config.jflang'); + + $sql = " SELECT reference_id FROM #__falang_content as fc LEFT JOIN #__languages as fl ON fc.language_id = fl.lang_id"; + $sql .= " WHERE fc.value = ".$db->Quote($tag); + $sql .= " AND fc.reference_table = 'k2_tags'"; + $sql .= " AND fc.reference_field = 'name' AND fc.published=1"; + + $db->setQuery($sql, 0, 1); + $result = $db->loadResult(); + + } + + if (!isset($result) || $result < 1) + { + $sql = "SELECT id FROM #__k2_tags WHERE name=".$db->Quote($tag); + $db->setQuery($sql, 0, 1); + $result = $db->loadResult(); + } + + $query .= " AND i.id IN (SELECT itemID FROM #__k2_tags_xref WHERE tagID=".(int)$result.")"; + + /*if (isset($result) && $result > 0) { + $query .= " AND (tags.id) = {$result}"; + } else { + $query .= " AND (tags.name) = ".$db->Quote($tag); + }*/ + + $categories = $params->get('categoriesFilter', NULL); + if (is_array($categories)) + { + JArrayHelper::toInteger($categories); + $query .= " AND c.id IN(".implode(',', $categories).")"; + } + if (is_string($categories)) + $query .= " AND c.id = {$categories}"; + break; + + default : + $searchIDs = $params->get('categories'); + + if (is_array($searchIDs) && count($searchIDs)) + { + + if ($params->get('catCatalogMode')) + { + $sql = @implode(',', $searchIDs); + $query .= " AND c.id IN ({$sql})"; + } + else + { + + $result = $this->getCategoryTree($searchIDs); + if (count($result)) + { + $sql = @implode(',', $result); + $query .= " AND c.id IN ({$sql})"; + } + } + } + + break; + } + + //Set featured flag + if ($task == 'category' || empty($task)) + { + if (JRequest::getInt('featured') == '0') + { + $query .= " AND i.featured != 1"; + } + else if (JRequest::getInt('featured') == '2') + { + $query .= " AND i.featured = 1"; + } + } + + //Remove duplicates + //$query .= " GROUP BY i.id"; + + //Set ordering + switch ($ordering) + { + + case 'date' : + $orderby = 'i.created ASC'; + break; + + case 'rdate' : + $orderby = 'i.created DESC'; + break; + + case 'alpha' : + $orderby = 'i.title'; + break; + + case 'ralpha' : + $orderby = 'i.title DESC'; + break; + + case 'order' : + if (JRequest::getInt('featured') == '2') + $orderby = 'i.featured_ordering'; + else + $orderby = 'c.ordering, i.ordering'; + break; + + case 'rorder' : + if (JRequest::getInt('featured') == '2') + $orderby = 'i.featured_ordering DESC'; + else + $orderby = 'c.ordering DESC, i.ordering DESC'; + break; + + case 'featured' : + $orderby = 'i.featured DESC, i.created DESC'; + break; + + case 'hits' : + $orderby = 'i.hits DESC'; + break; + + case 'rand' : + $orderby = 'RAND()'; + break; + + case 'best' : + $orderby = 'rating DESC'; + break; + + case 'modified' : + $orderby = 'lastChanged DESC'; + break; + + case 'publishUp' : + $orderby = 'i.publish_up DESC'; + break; + + case 'id' : + default : + $orderby = 'i.id DESC'; + break; + } + + $query .= " ORDER BY ".$orderby; + $dispatcher = JDispatcher::getInstance(); + JPluginHelper::importPlugin('k2'); + $dispatcher->trigger('onK2BeforeSetQuery', array(&$query)); + $db->setQuery($query, $limitstart, $limit); + $rows = $db->loadObjectList(); + return $rows; + } + + function getTotal() + { + + $user = JFactory::getUser(); + $aid = $user->get('aid'); + $db = JFactory::getDbo(); + $params = K2HelperUtilities::getParams('com_k2'); + $task = JRequest::getCmd('task'); + + if ($task == 'search' && $params->get('googleSearch')) + return 0; + + $jnow = JFactory::getDate(); + $now = K2_JVERSION == '15' ? $jnow->toMySQL() : $jnow->toSql(); + $nullDate = $db->getNullDate(); + + $query = "SELECT COUNT(*) FROM #__k2_items as i RIGHT JOIN #__k2_categories c ON c.id = i.catid"; + + if ($task == 'tag') + $query .= " LEFT JOIN #__k2_tags_xref tags_xref ON tags_xref.itemID = i.id LEFT JOIN #__k2_tags tags ON tags.id = tags_xref.tagID"; + + if ($task == 'user' && !$user->guest && $user->id == JRequest::getInt('id')) + { + $query .= " WHERE "; + } + else + { + $query .= " WHERE i.published = 1 AND "; + } + + if (K2_JVERSION != '15') + { + $query .= "i.access IN(".implode(',', $user->getAuthorisedViewLevels()).")"." AND i.trash = 0"." AND c.published = 1"." AND c.access IN(".implode(',', $user->getAuthorisedViewLevels()).")"." AND c.trash = 0"; + + $application = JFactory::getApplication(); + $languageFilter = $application->getLanguageFilter(); + if ($languageFilter) + { + $languageTag = JFactory::getLanguage()->getTag(); + $query .= " AND c.language IN (".$db->quote($languageTag).",".$db->quote('*').") + AND i.language IN (".$db->quote($languageTag).",".$db->quote('*').")"; + } + } + else + { + $query .= "i.access <= {$aid}"." AND i.trash = 0"." AND c.published = 1"." AND c.access <= {$aid}"." AND c.trash = 0"; + } + + $query .= " AND ( i.publish_up = ".$db->Quote($nullDate)." OR i.publish_up <= ".$db->Quote($now)." )"; + $query .= " AND ( i.publish_down = ".$db->Quote($nullDate)." OR i.publish_down >= ".$db->Quote($now)." )"; + + //Build query depending on task + switch ($task) + { + + case 'category' : + $id = JRequest::getInt('id'); + + $category = JTable::getInstance('K2Category', 'Table'); + $category->load($id); + $cparams = class_exists('JParameter') ? new JParameter($category->params) : new JRegistry($category->params); + + if ($cparams->get('inheritFrom')) + { + + $parent = JTable::getInstance('K2Category', 'Table'); + $parent->load($cparams->get('inheritFrom')); + $cparams = class_exists('JParameter') ? new JParameter($parent->params) : new JRegistry($parent->params); + } + + if ($cparams->get('catCatalogMode')) + { + $query .= " AND c.id={$id} "; + } + else + { + $categories = $this->getCategoryTree($id); + $sql = @implode(',', $categories); + $query .= " AND c.id IN ({$sql})"; + } + + break; + + case 'user' : + $id = JRequest::getInt('id'); + $query .= " AND i.created_by={$id} AND i.created_by_alias=''"; + $categories = $params->get('userCategoriesFilter', NULL); + if (is_array($categories)) + { + $categories = array_filter($categories); + JArrayHelper::toInteger($categories); + if(count($categories)) + { + $query .= " AND c.id IN(".implode(',', $categories).")"; + } + } + if (is_string($categories) && $categories > 0) + { + $query .= " AND c.id = {$categories}"; + } + break; + + case 'search' : + $badchars = array( + '#', + '>', + '<', + '\\' + ); + $search = trim(str_replace($badchars, '', JRequest::getString('searchword', null))); + $sql = $this->prepareSearch($search); + if (!empty($sql)) + { + $query .= $sql; + } + else + { + $result = 0; + return $result; + } + break; + + case 'date' : + if ((JRequest::getInt('month')) && (JRequest::getInt('year'))) + { + $month = JRequest::getInt('month'); + $year = JRequest::getInt('year'); + $query .= " AND MONTH(i.created) = {$month} AND YEAR(i.created)={$year} "; + if (JRequest::getInt('day')) + { + $day = JRequest::getInt('day'); + $query .= " AND DAY(i.created) = {$day}"; + } + + if (JRequest::getInt('catid')) + { + $catid = JRequest::getInt('catid'); + $query .= " AND c.id={$catid}"; + } + + } + break; + + case 'tag' : + $tag = JRequest::getString('tag'); + jimport('joomla.filesystem.file'); + if (JFile::exists(JPATH_ADMINISTRATOR.'/components/com_joomfish/joomfish.php') && $task == 'tag') + { + + $registry = JFactory::getConfig(); + $lang = K2_JVERSION == '30' ? $registry->get('jflang') : $registry->getValue('config.jflang'); + + $sql = " SELECT reference_id FROM #__jf_content as jfc LEFT JOIN #__languages as jfl ON jfc.language_id = jfl.".K2_JF_ID; + $sql .= " WHERE jfc.value = ".$db->Quote($tag); + $sql .= " AND jfc.reference_table = 'k2_tags'"; + $sql .= " AND jfc.reference_field = 'name' AND jfc.published=1"; + + $db->setQuery($sql, 0, 1); + $result = $db->loadResult(); + + } + + if (JFile::exists(JPATH_ADMINISTRATOR.'/components/com_falang/falang.php') && $task == 'tag') + { + + $registry = JFactory::getConfig(); + $lang = K2_JVERSION == '30' ? $registry->get('jflang') : $registry->getValue('config.jflang'); + + $sql = " SELECT reference_id FROM #__falang_content as fc LEFT JOIN #__languages as fl ON fc.language_id = fl.lang_id"; + $sql .= " WHERE fc.value = ".$db->Quote($tag); + $sql .= " AND fc.reference_table = 'k2_tags'"; + $sql .= " AND fc.reference_field = 'name' AND fc.published=1"; + + $db->setQuery($sql, 0, 1); + $result = $db->loadResult(); + + } + + if (isset($result) && $result > 0) + { + $query .= " AND (tags.id) = {$result}"; + } + else + { + $query .= " AND (tags.name) = ".$db->Quote($tag); + } + $categories = $params->get('categoriesFilter', NULL); + if (is_array($categories)) + $query .= " AND c.id IN(".implode(',', $categories).")"; + if (is_string($categories)) + $query .= " AND c.id = {$categories}"; + break; + + default : + $searchIDs = $params->get('categories'); + + if (is_array($searchIDs) && count($searchIDs)) + { + + if ($params->get('catCatalogMode')) + { + $sql = @implode(',', $searchIDs); + $query .= " AND c.id IN ({$sql})"; + } + else + { + $result = $this->getCategoryTree($searchIDs); + if (count($result)) + { + $sql = @implode(',', $result); + $query .= " AND c.id IN ({$sql})"; + } + } + } + + break; + } + + //Set featured flag + if ($task == 'category' || empty($task)) + { + if (JRequest::getVar('featured') == '0') + { + $query .= " AND i.featured != 1"; + } + else if (JRequest::getVar('featured') == '2') + { + $query .= " AND i.featured = 1"; + } + } + $dispatcher = JDispatcher::getInstance(); + JPluginHelper::importPlugin('k2'); + $dispatcher->trigger('onK2BeforeSetQuery', array(&$query)); + $db->setQuery($query); + $result = $db->loadResult(); + return $result; + } + + function getCategoryTree($categories, $associations = false) + { + $application = JFactory::getApplication(); + $db = JFactory::getDbo(); + $user = JFactory::getUser(); + $aid = (int)$user->get('aid'); + if (!is_array($categories)) + { + $categories = (array)$categories; + } + JArrayHelper::toInteger($categories); + $categories = array_unique($categories); + sort($categories); + $key = implode('|', $categories); + $clientID = $application->getClientId(); + static $K2CategoryTreeInstances = array(); + if (isset($K2CategoryTreeInstances[$clientID]) && array_key_exists($key, $K2CategoryTreeInstances[$clientID])) + { + return $K2CategoryTreeInstances[$clientID][$key]; + } + $array = $categories; + while (count($array)) + { + $query = "SELECT id + FROM #__k2_categories + WHERE parent IN (".implode(',', $array).") + AND id NOT IN (".implode(',', $array).") "; + if ($application->isSite()) + { + $query .= " + AND published=1 + AND trash=0"; + if (K2_JVERSION != '15') + { + $query .= " AND access IN(".implode(',', $user->getAuthorisedViewLevels()).")"; + if ($application->getLanguageFilter()) + { + $query .= " AND language IN(".$db->Quote(JFactory::getLanguage()->getTag()).", ".$db->Quote('*').")"; + } + } + else + { + $query .= " AND access<={$aid}"; + } + } + $db->setQuery($query); + $array = K2_JVERSION == '30' ? $db->loadColumn() : $db->loadResultArray(); + $categories = array_merge($categories, $array); + } + JArrayHelper::toInteger($categories); + $categories = array_unique($categories); + $K2CategoryTreeInstances[$clientID][$key] = $categories; + return $categories; + } + + // Deprecated function, left for compatibility reasons + function getCategoryChildren($catid, $clear = false) + { + + static $array = array(); + if ($clear) + $array = array(); + $user = JFactory::getUser(); + $aid = (int)$user->get('aid'); + $catid = (int)$catid; + $db = JFactory::getDbo(); + $query = "SELECT * FROM #__k2_categories WHERE parent={$catid} AND published=1 AND trash=0 AND access<={$aid} ORDER BY ordering "; + $db->setQuery($query); + $rows = $db->loadObjectList(); + + foreach ($rows as $row) + { + array_push($array, $row->id); + if ($this->hasChildren($row->id)) + { + $this->getCategoryChildren($row->id); + } + } + return $array; + } + + // Deprecated function, left for compatibility reasons + function hasChildren($id) + { + + $user = JFactory::getUser(); + $aid = (int)$user->get('aid'); + $id = (int)$id; + $db = JFactory::getDbo(); + $query = "SELECT * FROM #__k2_categories WHERE parent={$id} AND published=1 AND trash=0 AND access<={$aid} "; + $db->setQuery($query); + $rows = $db->loadObjectList(); + + if (count($rows)) + { + return true; + } + else + { + return false; + } + } + + function getCategoryFirstChildren($catid, $ordering = NULL) + { + + $application = JFactory::getApplication(); + $user = JFactory::getUser(); + $aid = $user->get('aid'); + $db = JFactory::getDbo(); + $query = "SELECT * FROM #__k2_categories WHERE parent={$catid} AND published=1 AND trash=0"; + + if (K2_JVERSION != '15') + { + $query .= " AND access IN(".implode(',', $user->getAuthorisedViewLevels()).") "; + if ($application->getLanguageFilter()) + { + $query .= " AND language IN(".$db->Quote(JFactory::getLanguage()->getTag()).", ".$db->Quote('*').")"; + } + } + else + { + $query .= " AND access<={$aid} "; + } + + switch ($ordering) + { + + case 'order' : + $order = " ordering ASC"; + break; + + case 'alpha' : + $order = " name ASC"; + break; + + case 'ralpha' : + $order = " name DESC"; + break; + + case 'reversedefault' : + $order = " id DESC"; + break; + + default : + $order = " id ASC"; + break; + } + + $query .= " ORDER BY {$order}"; + + $db->setQuery($query); + $rows = $db->loadObjectList(); + if ($db->getErrorNum()) + { + echo $db->stderr(); + return false; + } + + return $rows; + } + + function countCategoryItems($id) + { + + $application = JFactory::getApplication(); + $user = JFactory::getUser(); + $aid = (int)$user->get('aid'); + $id = (int)$id; + $db = JFactory::getDbo(); + + $jnow = JFactory::getDate(); + $now = K2_JVERSION == '15' ? $jnow->toMySQL() : $jnow->toSql(); + $nullDate = $db->getNullDate(); + + $categories = $this->getCategoryTree($id); + $query = "SELECT COUNT(*) FROM #__k2_items WHERE catid IN (".implode(',', $categories).") AND published=1 AND trash=0"; + + if (K2_JVERSION != '15') + { + $query .= " AND access IN(".implode(',', $user->getAuthorisedViewLevels()).") "; + if ($application->getLanguageFilter()) + { + $query .= " AND language IN(".$db->Quote(JFactory::getLanguage()->getTag()).", ".$db->Quote('*').")"; + } + } + else + { + $query .= " AND access<=".$aid; + } + + $query .= " AND ( publish_up = ".$db->Quote($nullDate)." OR publish_up <= ".$db->Quote($now)." )"; + $query .= " AND ( publish_down = ".$db->Quote($nullDate)." OR publish_down >= ".$db->Quote($now)." )"; + $db->setQuery($query); + $total = $db->loadResult(); + return $total; + } + + function getUserProfile($id = NULL) + { + + $db = JFactory::getDbo(); + if (is_null($id)) + $id = JRequest::getInt('id'); + else + $id = (int)$id; + $query = "SELECT id, gender, description, image, url, `group`, plugins FROM #__k2_users WHERE userID={$id}"; + $db->setQuery($query); + $row = $db->loadObject(); + return $row; + } + + function getAuthorLatest($itemID, $limit, $userID) + { + + $application = JFactory::getApplication(); + $user = JFactory::getUser(); + $aid = (int)$user->get('aid'); + $itemID = (int)$itemID; + $userID = (int)$userID; + $limit = (int)$limit; + $db = JFactory::getDbo(); + + $jnow = JFactory::getDate(); + $now = K2_JVERSION == '15' ? $jnow->toMySQL() : $jnow->toSql(); + $nullDate = $db->getNullDate(); + + $query = "SELECT i.*, c.alias as categoryalias FROM #__k2_items as i + LEFT JOIN #__k2_categories c ON c.id = i.catid + WHERE i.id != {$itemID} + AND i.published = 1 + AND ( i.publish_up = ".$db->Quote($nullDate)." OR i.publish_up <= ".$db->Quote($now)." ) + AND ( i.publish_down = ".$db->Quote($nullDate)." OR i.publish_down >= ".$db->Quote($now)." ) "; + + if (K2_JVERSION != '15') + { + $query .= " AND i.access IN(".implode(',', $user->getAuthorisedViewLevels()).") "; + if ($application->getLanguageFilter()) + { + $query .= " AND i.language IN(".$db->Quote(JFactory::getLanguage()->getTag()).", ".$db->Quote('*').")"; + } + } + else + { + $query .= " AND i.access <= {$aid} "; + } + + $query .= " AND i.trash = 0 + AND i.created_by = {$userID} + AND i.created_by_alias='' + AND c.published = 1 "; + + if (K2_JVERSION != '15') + { + $query .= " AND c.access IN(".implode(',', $user->getAuthorisedViewLevels()).") "; + if ($application->getLanguageFilter()) + { + $query .= " AND c.language IN(".$db->Quote(JFactory::getLanguage()->getTag()).", ".$db->Quote('*').")"; + } + } + else + { + $query .= " AND c.access <= {$aid} "; + } + + $query .= " AND c.trash = 0 + ORDER BY i.created DESC"; + + $db->setQuery($query, 0, $limit); + $rows = $db->loadObjectList(); + + foreach ($rows as $item) + { + //Image + $item->imageXSmall = ''; + $item->imageSmall = ''; + $item->imageMedium = ''; + $item->imageLarge = ''; + $item->imageXLarge = ''; + + if (JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.md5("Image".$item->id).'_XS.jpg')) + $item->imageXSmall = JURI::root(true).'/media/k2/items/cache/'.md5("Image".$item->id).'_XS.jpg'; + + if (JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.md5("Image".$item->id).'_S.jpg')) + $item->imageSmall = JURI::root(true).'/media/k2/items/cache/'.md5("Image".$item->id).'_S.jpg'; + + if (JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.md5("Image".$item->id).'_M.jpg')) + $item->imageMedium = JURI::root(true).'/media/k2/items/cache/'.md5("Image".$item->id).'_M.jpg'; + + if (JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.md5("Image".$item->id).'_L.jpg')) + $item->imageLarge = JURI::root(true).'/media/k2/items/cache/'.md5("Image".$item->id).'_L.jpg'; + + if (JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.md5("Image".$item->id).'_XL.jpg')) + $item->imageXLarge = JURI::root(true).'/media/k2/items/cache/'.md5("Image".$item->id).'_XL.jpg'; + + if (JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.md5("Image".$item->id).'_Generic.jpg')) + $item->imageGeneric = JURI::root(true).'/media/k2/items/cache/'.md5("Image".$item->id).'_Generic.jpg'; + } + + return $rows; + } + + function getRelatedItems($itemID, $tags, $params) + { + + $application = JFactory::getApplication(); + $limit = $params->get('itemRelatedLimit', 10); + $itemID = (int)$itemID; + foreach ($tags as $tag) + { + $tagIDs[] = $tag->id; + } + JArrayHelper::toInteger($tagIDs); + $sql = implode(',', $tagIDs); + + $user = JFactory::getUser(); + $aid = (int)$user->get('aid'); + $db = JFactory::getDbo(); + + $jnow = JFactory::getDate(); + $now = K2_JVERSION == '15' ? $jnow->toMySQL() : $jnow->toSql(); + $nullDate = $db->getNullDate(); + + $query = "SELECT DISTINCT itemID FROM #__k2_tags_xref WHERE tagID IN ({$sql}) AND itemID!={$itemID}"; + $db->setQuery($query); + $itemsIDs = K2_JVERSION == '30' ? $db->loadColumn() : $db->loadResultArray(); + + if (!count($itemsIDs)) + return array(); + + $sql = implode(',', $itemsIDs); + + $query = "SELECT i.*, c.alias as categoryalias FROM #__k2_items as i + LEFT JOIN #__k2_categories c ON c.id = i.catid + WHERE i.published = 1 + AND ( i.publish_up = ".$db->Quote($nullDate)." OR i.publish_up <= ".$db->Quote($now)." ) + AND ( i.publish_down = ".$db->Quote($nullDate)." OR i.publish_down >= ".$db->Quote($now)." ) "; + + if (K2_JVERSION != '15') + { + $query .= " AND i.access IN(".implode(',', $user->getAuthorisedViewLevels()).") "; + if ($application->getLanguageFilter()) + { + $query .= " AND i.language IN(".$db->Quote(JFactory::getLanguage()->getTag()).", ".$db->Quote('*').")"; + } + + } + else + { + $query .= " AND i.access <= {$aid} "; + } + + $query .= " AND i.trash = 0 + AND c.published = 1 "; + + if (K2_JVERSION != '15') + { + $query .= " AND c.access IN(".implode(',', $user->getAuthorisedViewLevels()).") "; + if ($application->getLanguageFilter()) + { + $query .= " AND c.language IN(".$db->Quote(JFactory::getLanguage()->getTag()).", ".$db->Quote('*').")"; + } + } + else + { + $query .= " AND c.access <= {$aid} "; + } + + $query .= " AND c.trash = 0 + AND (i.id) IN ({$sql}) + ORDER BY i.created DESC"; + + $db->setQuery($query, 0, $limit); + $rows = $db->loadObjectList(); + K2Model::addIncludePath(JPATH_COMPONENT.'/models'); + $model = K2Model::getInstance('Item', 'K2Model'); + for ($key = 0; $key < sizeof($rows); $key++) + { + if (!$params->get('itemRelatedMedia')) + { + $rows[$key]->video = null; + } + if (!$params->get('itemRelatedImageGallery')) + { + $rows[$key]->gallery = null; + } + $rows[$key] = $model->prepareItem($rows[$key], 'relatedByTag', ''); + $rows[$key] = $model->execPlugins($rows[$key], 'relatedByTag', ''); + K2HelperUtilities::setDefaultImage($rows[$key], 'relatedByTag', $params); + } + return $rows; + } + + function prepareSearch($search) + { + + jimport('joomla.filesystem.file'); + $db = JFactory::getDbo(); + $language = JFactory::getLanguage(); + $defaultLang = $language->getDefault(); + $currentLang = $language->getTag(); + $length = JString::strlen($search); + $sql = ''; + + if (JRequest::getVar('categories')) + { + $categories = @explode(',', JRequest::getVar('categories')); + JArrayHelper::toInteger($categories); + $sql .= " AND c.id IN (".@implode(',', $categories).") "; + } + + if (empty($search)) + { + return $sql; + } + + if (JString::substr($search, 0, 1) == '"' && JString::substr($search, $length - 1, 1) == '"') + { + $type = 'exact'; + } + else + { + $type = 'any'; + } + + if (JFile::exists(JPATH_ADMINISTRATOR.'/components/com_joomfish/joomfish.php') && $currentLang != $defaultLang) + { + + $conditions = array(); + $search_ignore = array(); + + $ignoreFile = $language->getLanguagePath().'/'.$currentLang.'/'.$currentLang.'.ignore.php'; + + if (JFile::exists($ignoreFile)) + { + include $ignoreFile; + } + + if ($type == 'exact') + { + + $word = JString::substr($search, 1, $length - 2); + + if (JString::strlen($word) > 3 && !in_array($word, $search_ignore)) + { + $escaped = K2_JVERSION == '15' ? $db->getEscaped($word, true) : $db->escape($word, true); + $langField = K2_JVERSION == '15' ? 'code' : 'lang_code'; + $word = $db->Quote('%'.$escaped.'%', false); + + $jfQuery = " SELECT reference_id FROM #__jf_content as jfc LEFT JOIN #__languages as jfl ON jfc.language_id = jfl.".K2_JF_ID; + $jfQuery .= " WHERE jfc.reference_table = 'k2_items'"; + $jfQuery .= " AND jfl.".$langField."=".$db->Quote($currentLang); + $jfQuery .= " AND jfc.published=1"; + $jfQuery .= " AND jfc.value LIKE ".$word; + $jfQuery .= " AND (jfc.reference_field = 'title' + OR jfc.reference_field = 'introtext' + OR jfc.reference_field = 'fulltext' + OR jfc.reference_field = 'image_caption' + OR jfc.reference_field = 'image_credits' + OR jfc.reference_field = 'video_caption' + OR jfc.reference_field = 'video_credits' + OR jfc.reference_field = 'extra_fields_search' + OR jfc.reference_field = 'metadesc' + OR jfc.reference_field = 'metakey' + )"; + $db->setQuery($jfQuery); + $result = K2_JVERSION == '30' ? $db->loadColumn() : $db->loadResultArray(); + $result = @array_unique($result); + JArrayHelper::toInteger($result); + if (count($result)) + { + $conditions[] = "i.id IN(".implode(',', $result).")"; + } + + } + + } + else + { + $search = explode(' ', JString::strtolower($search)); + foreach ($search as $searchword) + { + + if (JString::strlen($searchword) > 3 && !in_array($searchword, $search_ignore)) + { + + $escaped = K2_JVERSION == '15' ? $db->getEscaped($searchword, true) : $db->escape($searchword, true); + $word = $db->Quote('%'.$escaped.'%', false); + $langField = K2_JVERSION == '15' ? 'code' : 'lang_code'; + + $jfQuery = " SELECT reference_id FROM #__jf_content as jfc LEFT JOIN #__languages as jfl ON jfc.language_id = jfl.".K2_JF_ID; + $jfQuery .= " WHERE jfc.reference_table = 'k2_items'"; + $jfQuery .= " AND jfl.".$langField."=".$db->Quote($currentLang); + $jfQuery .= " AND jfc.published=1"; + $jfQuery .= " AND jfc.value LIKE ".$word; + $jfQuery .= " AND (jfc.reference_field = 'title' + OR jfc.reference_field = 'introtext' + OR jfc.reference_field = 'fulltext' + OR jfc.reference_field = 'image_caption' + OR jfc.reference_field = 'image_credits' + OR jfc.reference_field = 'video_caption' + OR jfc.reference_field = 'video_credits' + OR jfc.reference_field = 'extra_fields_search' + OR jfc.reference_field = 'metadesc' + OR jfc.reference_field = 'metakey' + )"; + $db->setQuery($jfQuery); + $result = K2_JVERSION == '30' ? $db->loadColumn() : $db->loadResultArray(); + $result = @array_unique($result); + foreach ($result as $id) + { + $allIDs[] = $id; + } + + if (JFile::exists(JPATH_ADMINISTRATOR.'/components/com_joomfish/joomfish.php') && $currentLang != $defaultLang) + { + + if (isset($allIDs) && count($allIDs)) + { + JArrayHelper::toInteger($allIDs); + $conditions[] = "i.id IN(".implode(',', $allIDs).")"; + } + + } + + } + + } + + } + + if (count($conditions)) + { + $sql .= " AND (".implode(" OR ", $conditions).")"; + } + + } + else + { + + $escaped = K2_JVERSION == '15' ? $db->getEscaped($search, true) : $db->escape($search, true); + $quoted = $db->Quote('%'.$escaped.'%', false); + + if ($type == 'exact') + { + $text = JString::trim($search, '"'); + $escaped = K2_JVERSION == '15' ? $db->getEscaped($text, true) : $db->escape($text, true); + $quoted = $db->Quote('%'.$escaped.'%', false); + $sql .= " AND ( LOWER(i.title) = ".$quoted." OR LOWER(i.introtext) = ".$quoted." OR LOWER(i.`fulltext`) = ".$quoted." OR LOWER(i.extra_fields_search) = ".$quoted." OR LOWER(i.image_caption) = ".$quoted." OR LOWER(i.image_credits) = ".$quoted." OR LOWER(i.video_caption) = ".$quoted." OR LOWER(i.video_credits) = ".$quoted." OR LOWER(i.metadesc) = ".$quoted." OR LOWER(i.metakey) = ".$quoted.") "; + } + else + { + $escaped = K2_JVERSION == '15' ? $db->getEscaped($search, true) : $db->escape($search, true); + $text = $db->Quote($escaped); + $sql .= " AND ( LOWER(i.title) LIKE ".$quoted." OR LOWER(i.introtext) LIKE ".$quoted." OR LOWER(i.`fulltext`) LIKE ".$quoted." OR LOWER(i.extra_fields_search) LIKE ".$quoted." OR LOWER(i.image_caption) LIKE ".$quoted." OR LOWER(i.image_credits) LIKE ".$quoted." OR LOWER(i.video_caption) LIKE ".$quoted." OR LOWER(i.video_credits) LIKE ".$quoted." OR LOWER(i.metadesc) LIKE ".$quoted." OR LOWER(i.metakey) LIKE ".$quoted.") "; + } + + } + + return $sql; + } + + function getModuleItems($moduleID) + { + + $db = JFactory::getDbo(); + $query = "SELECT * FROM #__modules WHERE id={$moduleID} AND published=1 AND client_id=0"; + $db->setQuery($query, 0, 1); + $module = $db->loadObject(); + $format = JRequest::getWord('format'); + if (is_null($module)) + JError::raiseError(404, JText::_('K2_NOT_FOUND')); + else + { + $params = class_exists('JParameter') ? new JParameter($module->params) : new JRegistry($module->params); + switch ($module->module) + { + + case 'mod_k2_content' : + require_once(JPATH_SITE.'/modules/mod_k2_content/helper.php'); + $helper = new modK2ContentHelper; + $items = $helper->getItems($params, $format); + break; + + case 'mod_k2_comments' : + if ($params->get('module_usage') == 1) + JError::raiseError(404, JText::_('K2_NOT_FOUND')); + + require_once(JPATH_SITE.'/modules/mod_k2_comments/helper.php'); + $helper = new modK2CommentsHelper; + $items = $helper->getLatestComments($params); + + foreach ($items as $item) + { + $item->title = $item->userName.' '.JText::_('K2_COMMENTED_ON').' '.$item->title; + $item->introtext = $item->commentText; + $item->created = $item->commentDate; + $item->id = $item->itemID; + } + break; + + default : + JError::raiseError(404, JText::_('K2_NOT_FOUND')); + } + + $result = new JObject; + $result->items = $items; + $result->title = $module->title; + $result->module = $module->module; + $result->params = $module->params; + return $result; + + } + + } + + public function getCategoriesTree() + { + $application = JFactory::getApplication(); + $clientID = $application->getClientId(); + $db = JFactory::getDbo(); + $user = JFactory::getUser(); + $aid = (int)$user->get('aid'); + + $query = "SELECT id, name, parent FROM #__k2_categories"; + if ($application->isSite()) + { + $query .= " WHERE published=1 AND trash=0"; + if (K2_JVERSION != '15') + { + $query .= " AND access IN(".implode(',', $user->getAuthorisedViewLevels()).")"; + if ($application->getLanguageFilter()) + { + $query .= " AND language IN(".$db->Quote(JFactory::getLanguage()->getTag()).", ".$db->Quote('*').")"; + } + } + else + { + $query .= " AND access<={$aid}"; + } + } + $query .= " ORDER BY parent "; + $db->setQuery($query); + $categories = $db->loadObjectList(); + $tree = array(); + return $this->buildTree($categories); + } + + public function buildTree(array &$categories, $parent = 0) + { + $branch = array(); + + foreach ($categories as &$category) + { + if ($category->parent == $parent) + { + $children = $this->buildTree($categories, $category->id); + if ($children) + { + $category->children = $children; + } + $branch[$category->id] = $category; + } + } + return $branch; + } + + public function getTreePath($tree, $id) + { + if (array_key_exists($id, $tree)) + { + return array($id); + } + else + { + foreach ($tree as $key => $root) + { + if (isset($root->children) && is_array($root->children)) + { + $retry = $this->getTreePath($root->children, $id); + + if ($retry) + { + $retry[] = $key; + return $retry; + } + } + } + } + + return null; + } + +} diff --git a/deployed/k2/components/com_k2/router.php b/deployed/k2/components/com_k2/router.php new file mode 100644 index 00000000..a14eff1c --- /dev/null +++ b/deployed/k2/components/com_k2/router.php @@ -0,0 +1,719 @@ +get('k2Sef')) +{ + + /** + * Build the SEF route from the query + * + * @param array &$query The array of query string values for which to build a route + * + * @return array The URL arguments to use to assemble the subsequent URL. + * + * @since 1.5 + */ + function k2BuildRoute(&$query) + { + // Initialize + $segments = array(); + + // Get params + $params = JComponentHelper::getParams('com_k2'); + + // Get the menu + $menu = JFactory::getApplication()->getMenu(); + + // Detect the active menu item + if (empty($query['Itemid'])) + { + $menuItem = $menu->getActive(); + } + else + { + $menuItem = $menu->getItem($query['Itemid']); + } + + // Load data from the current menu item + $mView = ( empty($menuItem->query['view'])) ? null : $menuItem->query['view']; + $mTask = ( empty($menuItem->query['task'])) ? null : $menuItem->query['task']; + $mId = ( empty($menuItem->query['id'])) ? null : $menuItem->query['id']; + $mTag = ( empty($menuItem->query['tag'])) ? null : $menuItem->query['tag']; + + if (isset($query['layout'])) + { + unset($query['layout']); + } + + if ($mView == @$query['view'] && $mTask == @$query['task'] && $mId == @intval($query['id']) && @intval($query['id']) > 0) + { + unset($query['view']); + unset($query['task']); + unset($query['id']); + } + + if ($mView == @$query['view'] && $mTask == @$query['task'] && $mTag == @$query['tag'] && isset($query['tag'])) + { + unset($query['view']); + unset($query['task']); + unset($query['tag']); + } + + if (isset($query['view'])) + { + $segments[] = $query['view']; + unset($query['view']); + } + + if (isset($query['task'])) + { + $segments[] = $query['task']; + unset($query['task']); + } + + if (isset($query['id'])) + { + $segments[] = $query['id']; + unset($query['id']); + } + + if (isset($query['cid'])) + { + $segments[] = $query['cid']; + unset($query['cid']); + } + + if (isset($query['tag'])) + { + $segments[] = $query['tag']; + unset($query['tag']); + } + + if (isset($query['year'])) + { + $segments[] = $query['year']; + unset($query['year']); + } + + if (isset($query['month'])) + { + $segments[] = $query['month']; + unset($query['month']); + } + + if (isset($query['day'])) + { + $segments[] = $query['day']; + unset($query['day']); + } + + if (isset($query['task'])) + { + $segments[] = $query['task']; + unset($query['task']); + } + + // Item view + if (isset($segments[0]) && $segments[0] == 'item' && @$segments[1] != 'add') + { + // Enabled category prefix for items + if ($params->get('k2SefLabelItem')) + { + // Tasks available for an item + $itemTasks = array('edit', 'download'); + + // If it's a task pick the next key + if (in_array($segments[1], $itemTasks)) + { + $ItemId = $segments[2]; + } + else + { + $ItemId = $segments[1]; + } + + // Replace the item with the category slug + if ($params->get('k2SefLabelItem') == '1') + { + + // Remove the id from the slug + if ($params->get('k2SefInsertCatId') == '0') + { + + // Try to split the slug + $segments[0] = getCategorySlug((int)$ItemId); + $temp = @explode('-', $segments[0]); + + // If the slug contained an item id do not use it + if (count($temp) > 1) + { + @$segments[0] = $temp[1]; + } + + } + else + { + // Apply the link including the id + $segments[0] = getCategorySlug((int)$ItemId); + } + + } + else + { + $segments[0] = $params->get('k2SefLabelItemCustomPrefix'); + } + + } + // Remove "item" from the URL + else + { + unset($segments[0]); + } + + // Handle item id and alias + if ($params->get('k2SefInsertItemId')) + { + if ($params->get('k2SefUseItemTitleAlias')) + { + if ($params->get('k2SefItemIdTitleAliasSep') == 'slash') + { + $segments[1] = JString::str_ireplace(':', '/', $segments[1]); + } + } + else + { + $temp = @explode(':', $segments[1]); + $segments[1] = $temp[0]; + } + + } + else + { + if (isset($segments[1]) && $segments[1] != 'download') + { + // Try to split the slud + $temp = @explode(':', $segments[1]); + + // If the slug contained an item id do not use it + if (count($temp) > 1) + { + $segments[1] = $temp[1]; + } + + } + } + } + // Itemlist view. Check for prefix segments + elseif (isset($segments[0]) && $segments[0] == 'itemlist') + { + if (isset($segments[1])) + { + switch ($segments[1]) + { + case 'category' : + $segments[0] = $params->get('k2SefLabelCat', 'content'); + unset($segments[1]); + // Handle category id and alias + if ($params->get('k2SefInsertCatId')) + { + if ($params->get('k2SefUseCatTitleAlias')) + { + if ($params->get('k2SefCatIdTitleAliasSep') == 'slash') + { + $segments[2] = JString::str_ireplace(':', '/', $segments[2]); + } + } + else + { + $temp = @explode(':', $segments[2]); + $segments[2] = (int)$temp[0]; + } + + } + else + { + // Try to split the slud + $temp = @explode(':', $segments[2]); + unset($segments[2]); + + // If the slug contained an item id do not use it + if (count($temp) > 1) + { + @$segments[1] = $temp[1]; + } + } + + break; + case 'tag' : + $segments[0] = $params->get('k2SefLabelTag', 'tag'); + unset($segments[1]); + break; + case 'user' : + $segments[0] = $params->get('k2SefLabelUser', 'author'); + unset($segments[1]); + break; + case 'date' : + $segments[0] = $params->get('k2SefLabelDate', 'date'); + unset($segments[1]); + break; + case 'search' : + $segments[0] = $params->get('k2SefLabelSearch', 'search'); + unset($segments[1]); + break; + default : + $segments[0] = 'itemlist'; + break; + } + } + + } + // Return reordered segments array + return array_values($segments); + } + + /** + * Get back the url from the segments + * + * @param array $segments Segments in the SEF URL + * + * @return array Generated vars for the query + */ + function k2ParseRoute($segments) + { + + // Initialize + $vars = array(); + + $params = JComponentHelper::getParams('com_k2'); + + $reservedViews = array('item', 'itemlist', 'media', 'users', 'comments', 'latest'); + + if (!in_array($segments[0], $reservedViews)) + { + // Category view + if ($segments[0] == $params->get('k2SefLabelCat', 'content')) + { + $segments[0] = 'itemlist'; + array_splice($segments, 1, 0, 'category'); + } + // Tag view + elseif ($segments[0] == $params->get('k2SefLabelTag', 'tag')) + { + $segments[0] = 'itemlist'; + array_splice($segments, 1, 0, 'tag'); + } + // User view + elseif ($segments[0] == $params->get('k2SefLabelUser', 'author')) + { + $segments[0] = 'itemlist'; + array_splice($segments, 1, 0, 'user'); + } + // Date view + elseif ($segments[0] == $params->get('k2SefLabelDate', 'date')) + { + $segments[0] = 'itemlist'; + array_splice($segments, 1, 0, 'date'); + } + // Search view + elseif ($segments[0] == $params->get('k2SefLabelSearch', 'search')) + { + $segments[0] = 'itemlist'; + array_splice($segments, 1, 0, 'search'); + } + // Item view + else + { + // Replace the category prefix with item + if ($params->get('k2SefLabelItem')) + { + $segments[0] = 'item'; + } + // Reinsert the removed item segment + else + { + array_splice($segments, 0, 0, 'item'); + } + // Reinsert item id to the item alias + if (!$params->get('k2SefInsertItemId') && @$segments[1] != 'download' && @$segments[1] != 'edit') + { + $segments[1] = str_replace(':', '-', $segments[1]); + $ItemId = getItemId($segments[1]); + $segments[1] = $ItemId.':'.$segments[1]; + } + } + + } + + $vars['view'] = $segments[0]; + + if (!isset($segments[1])) + { + $segments[1] = ''; + } + $vars['task'] = $segments[1]; + if ($segments[0] == 'itemlist') + { + switch ($segments[1]) + { + + case 'category' : + if (isset($segments[2])) + { + // Reinsert item id to the item alias + if (!$params->get('k2SefInsertCatId')) + { + $segments[2] = str_replace(':', '-', $segments[2]); + $catId = getCatId($segments[2]); + $segments[2] = $catId.':'.$segments[2]; + } + $vars['id'] = $segments[2]; + } + break; + + case 'tag' : + if (isset($segments[2])) + { + $vars['tag'] = $segments[2]; + } + break; + + case 'user' : + if (isset($segments[2])) + { + $vars['id'] = $segments[2]; + } + break; + + case 'date' : + if (isset($segments[2])) + { + $vars['year'] = $segments[2]; + } + if (isset($segments[3])) + { + $vars['month'] = $segments[3]; + } + if (isset($segments[4])) + { + $vars['day'] = $segments[4]; + } + break; + } + + } + elseif ($segments[0] == 'item') + { + switch ($segments[1]) + { + case 'add' : + case 'edit' : + if (isset($segments[2])) + { + $vars['cid'] = $segments[2]; + } + break; + + case 'download' : + if (isset($segments[2])) + { + $vars['id'] = $segments[2]; + } + break; + + default : + $vars['id'] = $segments[1]; + if (isset($segments[2])) + { + $vars['id'] .= ':'.str_replace(':', '-', $segments[2]); + } + unset($vars['task']); + break; + } + + } + + if ($segments[0] == 'comments' && isset($segments[1]) && $segments[1] == 'reportSpammer') + { + $vars['id'] = $segments[2]; + } + + return $vars; + } + + /** + * Get a category alias + * + * @param integer $ItemId The category id + * + * @return string The category alias + */ + function getCategorySlug($ItemId = null) + { + $slug = null; + + $db = JFactory::getDbo(); + $query = "SELECT items.id, categories.id AS catid, CASE WHEN CHAR_LENGTH(categories.alias) THEN CONCAT_WS('-', categories.id, categories.alias) ELSE categories.id END AS catslug FROM #__k2_items AS items INNER JOIN #__k2_categories AS categories ON items.catid = categories.id WHERE items.id = ".(int)$ItemId; + $db->setQuery($query); + + try + { + if ($result = $db->loadObject()) + { + $slug = $result->catslug; + } + } + catch (Exception $e) + { + $this->setError($e->getMessage()); + + return false; + } + + return $slug; + } + + /** + * Get id K2. + * + * @param string $alias The K2 item alias + * + * @return integer + */ + function getItemId($alias) + { + $id = null; + $db = JFactory::getDbo(); + $query = "SELECT id FROM #__k2_items WHERE alias = ".$db->quote($alias); + $db->setQuery($query); + try + { + $id = $db->loadResult(); + } + catch (Exception $e) + { + $this->setError($e->getMessage()); + return false; + } + return $id; + } + + /** + * Get id K2. + * + * @param string $alias The K2 category alias + * + * @return integer + */ + function getCatId($alias) + { + $id = null; + $db = JFactory::getDbo(); + $query = "SELECT id FROM #__k2_categories WHERE alias = ".$db->quote($alias); + $db->setQuery($query); + try + { + $id = $db->loadResult(); + } + catch (Exception $e) + { + $this->setError($e->getMessage()); + return false; + } + return $id; + } + +} +else +{ + function K2BuildRoute(&$query) + { + $segments = array(); + $application = JFactory::getApplication(); + $menu = $application->getMenu(); + if (empty($query['Itemid'])) + { + $menuItem = $menu->getActive(); + } + else + { + $menuItem = $menu->getItem($query['Itemid']); + } + $mView = ( empty($menuItem->query['view'])) ? null : $menuItem->query['view']; + $mTask = ( empty($menuItem->query['task'])) ? null : $menuItem->query['task']; + $mId = ( empty($menuItem->query['id'])) ? null : $menuItem->query['id']; + $mTag = ( empty($menuItem->query['tag'])) ? null : $menuItem->query['tag']; + + if (isset($query['layout'])) + { + unset($query['layout']); + } + + if ($mView == @$query['view'] && $mTask == @$query['task'] && $mId == @intval($query['id']) && @intval($query['id']) > 0) + { + unset($query['view']); + unset($query['task']); + unset($query['id']); + } + + if ($mView == @$query['view'] && $mTask == @$query['task'] && $mTag == @$query['tag'] && isset($query['tag'])) + { + unset($query['view']); + unset($query['task']); + unset($query['tag']); + } + + if (isset($query['view'])) + { + $view = $query['view']; + $segments[] = $view; + unset($query['view']); + } + + if (@ isset($query['task'])) + { + $task = $query['task']; + $segments[] = $task; + unset($query['task']); + } + + if (isset($query['id'])) + { + $id = $query['id']; + $segments[] = $id; + unset($query['id']); + } + + if (isset($query['cid'])) + { + $cid = $query['cid']; + $segments[] = $cid; + unset($query['cid']); + } + + if (isset($query['tag'])) + { + $tag = $query['tag']; + $segments[] = $tag; + unset($query['tag']); + } + + if (isset($query['year'])) + { + $year = $query['year']; + $segments[] = $year; + unset($query['year']); + } + + if (isset($query['month'])) + { + $month = $query['month']; + $segments[] = $month; + unset($query['month']); + } + + if (isset($query['day'])) + { + $day = $query['day']; + $segments[] = $day; + unset($query['day']); + } + + if (isset($query['task'])) + { + $task = $query['task']; + $segments[] = $task; + unset($query['task']); + } + + return $segments; + } + + function K2ParseRoute($segments) + { + $vars = array(); + $vars['view'] = $segments[0]; + if (!isset($segments[1])) + $segments[1] = ''; + $vars['task'] = $segments[1]; + + if ($segments[0] == 'itemlist') + { + + switch($segments[1]) + { + + case 'category' : + if (isset($segments[2])) + $vars['id'] = $segments[2]; + break; + + case 'tag' : + if (isset($segments[2])) + $vars['tag'] = $segments[2]; + break; + + case 'user' : + if (isset($segments[2])) + $vars['id'] = $segments[2]; + break; + + case 'date' : + if (isset($segments[2])) + $vars['year'] = $segments[2]; + if (isset($segments[3])) + $vars['month'] = $segments[3]; + if (isset($segments[4])) + { + $vars['day'] = $segments[4]; + } + break; + } + + } + else if ($segments[0] == 'item') + { + + switch($segments[1]) + { + + case 'add' : + case 'edit' : + if (isset($segments[2])) + $vars['cid'] = $segments[2]; + break; + + case 'download' : + if (isset($segments[2])) + $vars['id'] = $segments[2]; + break; + + default : + $vars['id'] = $segments[1]; + unset($vars['task']); + break; + } + + } + + if ($segments[0] == 'comments' && isset($segments[1]) && $segments[1] == 'reportSpammer') + { + $vars['id'] = $segments[2]; + } + + return $vars; + } + +} diff --git a/deployed/k2/components/com_k2/templates/default/category.php b/deployed/k2/components/com_k2/templates/default/category.php new file mode 100644 index 00000000..8afb0c11 --- /dev/null +++ b/deployed/k2/components/com_k2/templates/default/category.php @@ -0,0 +1,263 @@ + + + +
        + + params->get('show_page_title')): ?> + +
        + escape($this->params->get('page_title')); ?> +
        + + + params->get('catFeedIcon')): ?> + +
        + + + +
        +
        + + + category) || ( $this->params->get('subCategories') && isset($this->subCategories) && count($this->subCategories) )): ?> + +
        + + category) && ( $this->params->get('catImage') || $this->params->get('catTitle') || $this->params->get('catDescription') || $this->category->event->K2CategoryDisplay )): ?> + +
        + + addLink)): ?> + + + + + + + + + params->get('catImage') && $this->category->image): ?> + + <?php echo K2HelperUtilities::cleanHtml($this->category->name); ?> + + + params->get('catTitle')): ?> + +

        category->name; ?>params->get('catTitleItemCounter')) echo ' ('.$this->pagination->total.')'; ?>

        + + + params->get('catDescription')): ?> + +
        category->description; ?>
        + + + + category->event->K2CategoryDisplay; ?> + +
        +
        + + + params->get('subCategories') && isset($this->subCategories) && count($this->subCategories)): ?> + +
        +

        + + subCategories as $key=>$subCategory): ?> + + params->get('subCatColumns'))==0)) + $lastContainer= ' subCategoryContainerLast'; + else + $lastContainer=''; + ?> + +
        subCategories)==1) ? '' : ' style="width:'.number_format(100/$this->params->get('subCatColumns'), 1).'%;"'; ?>> +
        + params->get('subCatImage') && $subCategory->image): ?> + + + <?php echo K2HelperUtilities::cleanHtml($subCategory->name); ?> + + + + params->get('subCatTitle')): ?> + +

        + + name; ?>params->get('subCatTitleItemCounter')) echo ' ('.$subCategory->numOfItems.')'; ?> + +

        + + + params->get('subCatDescription')): ?> + +
        description; ?>
        + + + + + + + +
        +
        +
        + params->get('subCatColumns'))==0): ?> +
        + + + +
        +
        + + +
        + + + leading) || isset($this->primary) || isset($this->secondary) || isset($this->links)) && (count($this->leading) || count($this->primary) || count($this->secondary) || count($this->links))): ?> + +
        + + leading) && count($this->leading)): ?> + +
        + leading as $key=>$item): ?> + + params->get('num_leading_columns'))==0) || count($this->leading)<$this->params->get('num_leading_columns')) + $lastContainer= ' itemContainerLast'; + else + $lastContainer=''; + ?> + +
        leading)==1) ? '' : ' style="width:'.number_format(100/$this->params->get('num_leading_columns'), 1).'%;"'; ?>> + item = $item; + echo $this->loadTemplate('item'); + ?> +
        + params->get('num_leading_columns'))==0): ?> +
        + + +
        +
        + + + primary) && count($this->primary)): ?> + +
        + primary as $key=>$item): ?> + + params->get('num_primary_columns'))==0) || count($this->primary)<$this->params->get('num_primary_columns') ) + $lastContainer= ' itemContainerLast'; + else + $lastContainer=''; + ?> + +
        primary)==1) ? '' : ' style="width:'.number_format(100/$this->params->get('num_primary_columns'), 1).'%;"'; ?>> + item = $item; + echo $this->loadTemplate('item'); + ?> +
        + params->get('num_primary_columns'))==0): ?> +
        + + +
        +
        + + + secondary) && count($this->secondary)): ?> + +
        + secondary as $key=>$item): ?> + + params->get('num_secondary_columns'))==0) || count($this->secondary)<$this->params->get('num_secondary_columns') ) + $lastContainer= ' itemContainerLast'; + else + $lastContainer=''; + ?> + +
        secondary)==1) ? '' : ' style="width:'.number_format(100/$this->params->get('num_secondary_columns'), 1).'%;"'; ?>> + item = $item; + echo $this->loadTemplate('item'); + ?> +
        + params->get('num_secondary_columns'))==0): ?> +
        + + +
        +
        + + + links) && count($this->links)): ?> + + + + +
        + + + pagination->getPagesLinks()): ?> +
        + params->get('catPagination')) echo $this->pagination->getPagesLinks(); ?> +
        + params->get('catPaginationResults')) echo $this->pagination->getPagesCounter(); ?> +
        + + + +
        + + diff --git a/deployed/k2/components/com_k2/templates/default/category_item.php b/deployed/k2/components/com_k2/templates/default/category_item.php new file mode 100644 index 00000000..6fc8bf78 --- /dev/null +++ b/deployed/k2/components/com_k2/templates/default/category_item.php @@ -0,0 +1,300 @@ +item, 'itemlist', $this->params); + +?> + + +
        + + + item->event->BeforeDisplay; ?> + + + item->event->K2BeforeDisplay; ?> + +
        + item->params->get('catItemDateCreated')): ?> + + + item->created , JText::_('K2_DATE_FORMAT_LC2')); ?> + + + + item->params->get('catItemTitle')): ?> + +

        + item->editLink)): ?> + + + + + + + + + item->params->get('catItemTitleLinked')): ?> + + item->title; ?> + + + item->title; ?> + + + item->params->get('catItemFeaturedNotice') && $this->item->featured): ?> + + + + + + + +

        + + + item->params->get('catItemAuthor')): ?> + + + item->author->profile->gender); ?> + item->author->link) && $this->item->author->link): ?> + + + item->author->name; ?> + + + +
        + + + item->event->AfterDisplayTitle; ?> + + + item->event->K2AfterDisplayTitle; ?> + + item->params->get('catItemRating')): ?> + +
        + +
        +
          +
        • +
        • 1
        • +
        • 2
        • +
        • 3
        • +
        • 4
        • +
        • 5
        • +
        +
        item->numOfvotes; ?>
        +
        +
        +
        +
        + + +
        + + + item->event->BeforeDisplayContent; ?> + + + item->event->K2BeforeDisplayContent; ?> + + item->params->get('catItemImage') && !empty($this->item->image)): ?> + +
        + + + <?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?> + + +
        +
        + + + item->params->get('catItemIntroText')): ?> + +
        + item->introtext; ?> +
        + + +
        + + item->params->get('catItemExtraFields') && count($this->item->extra_fields)): ?> + +
        +

        +
          + item->extra_fields as $key=>$extraField): ?> + value != ''): ?> +
        • typetype); ?> groupgroup; ?>"> + type == 'header'): ?> +

          name; ?>

          + + name; ?> + value; ?> + +
        • + + +
        +
        +
        + + + + item->event->AfterDisplayContent; ?> + + + item->event->K2AfterDisplayContent; ?> + +
        +
        + + item->params->get('catItemHits') || + $this->item->params->get('catItemCategory') || + $this->item->params->get('catItemTags') || + $this->item->params->get('catItemAttachments') + ): ?> + + + +
        + + item->params->get('catItemVideo') && !empty($this->item->video)): ?> + +
        +

        + item->videoType=='embedded'): ?> +
        + item->video; ?> +
        + + item->video; ?> + +
        + + + item->params->get('catItemImageGallery') && !empty($this->item->gallery)): ?> + +
        +

        + item->gallery; ?> +
        + + +
        + + item->params->get('catItemCommentsAnchor') && ( ($this->item->params->get('comments') == '2' && !$this->user->guest) || ($this->item->params->get('comments') == '1')) ): ?> + + + + + item->params->get('catItemReadMore')): ?> + +
        + + + +
        + + +
        + + item->params->get('catItemDateModified')): ?> + + item->modified != $this->nullDate && $this->item->modified != $this->item->created ): ?> + + item->modified, JText::_('K2_DATE_FORMAT_LC2')); ?> + + + + + + item->event->AfterDisplay; ?> + + + item->event->K2AfterDisplay; ?> + +
        +
        + diff --git a/deployed/k2/components/com_k2/templates/default/category_item_links.php b/deployed/k2/components/com_k2/templates/default/category_item_links.php new file mode 100644 index 00000000..c6a9cd2f --- /dev/null +++ b/deployed/k2/components/com_k2/templates/default/category_item_links.php @@ -0,0 +1,46 @@ +item, 'itemlist', $this->params); + +?> + + +
        + item->params->get('catItemTitle')): ?> + +

        + item->params->get('catItemTitleLinked')): ?> + + item->title; ?> + + + item->title; ?> + +

        + + item->params->get('catItemImage') && !empty($this->item->image)): ?> + +
        + + + <?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?> + + +
        +
        + + + +
        + diff --git a/deployed/k2/components/com_k2/templates/default/item.php b/deployed/k2/components/com_k2/templates/default/item.php new file mode 100644 index 00000000..a15a74dc --- /dev/null +++ b/deployed/k2/components/com_k2/templates/default/item.php @@ -0,0 +1,682 @@ + + + + + + + + + + + + +
        + + + item->event->BeforeDisplay; ?> + + + item->event->K2BeforeDisplay; ?> + +
        + + item->params->get('itemDateCreated')): ?> + + + item->created , JText::_('K2_DATE_FORMAT_LC2')); ?> + + + + item->params->get('itemTitle')): ?> + +

        + item->editLink)): ?> + + + + + + + item->title; ?> + + item->params->get('itemFeaturedNotice') && $this->item->featured): ?> + + + + + + + +

        + + + item->params->get('itemAuthor')): ?> + + + item->author->profile->gender); ?> + item->created_by_alias)): ?> + + + item->author->name; ?> + + + + +
        + + + item->event->AfterDisplayTitle; ?> + + + item->event->K2AfterDisplayTitle; ?> + + item->params->get('itemFontResizer') || + $this->item->params->get('itemPrintButton') || + $this->item->params->get('itemEmailButton') || + $this->item->params->get('itemSocialButton') || + ($this->item->params->get('itemVideoAnchor') && !empty($this->item->video)) || + ($this->item->params->get('itemImageGalleryAnchor') && !empty($this->item->gallery)) || + ($this->item->params->get('itemCommentsAnchor') && $this->item->params->get('itemComments') && $this->item->params->get('comments')) + ): ?> +
        +
          + item->params->get('itemFontResizer')): ?> + +
        • + + + + + + + +
        • + + + item->params->get('itemPrintButton') && !JRequest::getInt('print')): ?> + +
        • + + + +
        • + + + item->params->get('itemEmailButton') && !JRequest::getInt('print')): ?> + +
        • + + + +
        • + + + item->params->get('itemSocialButton') && !is_null($this->item->params->get('socialButtonCode', NULL))): ?> + +
        • + item->params->get('socialButtonCode'); ?> +
        • + + + item->params->get('itemVideoAnchor') && !empty($this->item->video)): ?> + +
        • + +
        • + + + item->params->get('itemImageGalleryAnchor') && !empty($this->item->gallery)): ?> + +
        • + +
        • + + + item->params->get('itemCommentsAnchor') && $this->item->params->get('itemComments') && ( ($this->item->params->get('comments') == '2' && !$this->user->guest) || ($this->item->params->get('comments') == '1')) ): ?> + +
        • + item->event->K2CommentsCounter)): ?> + + item->event->K2CommentsCounter; ?> + + item->numOfComments > 0): ?> + + item->numOfComments; ?> item->numOfComments>1) ? JText::_('K2_COMMENTS') : JText::_('K2_COMMENT'); ?> + + + + + +
        • + +
        +
        +
        + + + item->params->get('itemRating')): ?> + +
        + +
        +
          +
        • +
        • 1
        • +
        • 2
        • +
        • 3
        • +
        • 4
        • +
        • 5
        • +
        +
        item->numOfvotes; ?>
        +
        +
        +
        +
        + + +
        + + + item->event->BeforeDisplayContent; ?> + + + item->event->K2BeforeDisplayContent; ?> + + item->params->get('itemImage') && !empty($this->item->image)): ?> + +
        + + + <?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?> + + + + item->params->get('itemImageMainCaption') && !empty($this->item->image_caption)): ?> + + item->image_caption; ?> + + + item->params->get('itemImageMainCredits') && !empty($this->item->image_credits)): ?> + + item->image_credits; ?> + + +
        +
        + + + item->fulltext)): ?> + + item->params->get('itemIntroText')): ?> + +
        + item->introtext; ?> +
        + + + item->params->get('itemFullText')): ?> + +
        + item->fulltext; ?> +
        + + + + + +
        + item->introtext; ?> +
        + + + +
        + + item->params->get('itemExtraFields') && count($this->item->extra_fields)): ?> + +
        +

        +
          + item->extra_fields as $key=>$extraField): ?> + value != ''): ?> +
        • typetype); ?> groupgroup; ?>"> + type == 'header'): ?> +

          name; ?>

          + + name; ?>: + value; ?> + +
        • + + +
        +
        +
        + + + item->params->get('itemHits') || ($this->item->params->get('itemDateModified') && intval($this->item->modified)!=0)): ?> +
        + + item->params->get('itemHits')): ?> + + + item->hits; ?> + + + + item->params->get('itemDateModified') && intval($this->item->modified)!=0): ?> + + + item->modified, JText::_('K2_DATE_FORMAT_LC2')); ?> + + + +
        +
        + + + + item->event->AfterDisplayContent; ?> + + + item->event->K2AfterDisplayContent; ?> + +
        + +
        + + item->params->get('itemTwitterButton',1) || + $this->item->params->get('itemFacebookButton',1) || + $this->item->params->get('itemGooglePlusOneButton',1) + ): ?> + +
        + + item->params->get('itemTwitterButton',1)): ?> + +
        + + +
        + + + item->params->get('itemFacebookButton',1)): ?> + +
        +
        + +
        +
        + + + item->params->get('itemGooglePlusOneButton',1)): ?> + +
        +
        + +
        + + +
        + +
        + + + item->params->get('itemCategory') || + $this->item->params->get('itemTags') || + $this->item->params->get('itemAttachments') + ): ?> + + + + item->params->get('itemAuthorBlock') && empty($this->item->created_by_alias)): ?> + +
        + item->params->get('itemAuthorImage') && !empty($this->item->author->avatar)): ?> + <?php echo K2HelperUtilities::cleanHtml($this->item->author->name); ?> + + +
        +

        + +

        + + item->params->get('itemAuthorDescription') && !empty($this->item->author->profile->description)): ?> +

        item->author->profile->description; ?>

        + + + item->params->get('itemAuthorURL') && !empty($this->item->author->profile->url)): ?> + item->author->profile->url); ?> + + + item->params->get('itemAuthorURL') && !empty($this->item->author->profile->url) && $this->item->params->get('itemAuthorEmail')): ?> + | + + + item->params->get('itemAuthorEmail')): ?> + item->author->email); ?> + + +
        + + + item->event->K2UserDisplay; ?> + +
        +
        +
        +
        + + + item->params->get('itemAuthorLatest') && empty($this->item->created_by_alias) && isset($this->authorLatestItems)): ?> + +
        +

        item->author->name; ?>

        +
          + authorLatestItems as $key=>$item): ?> +
        • "> + title; ?> +
        • + +
        +
        +
        + + + imageWidth; ?>px;"' to the li element inside the foreach loop below + ...then your Related Items will be transformed into a vertical-scrolling block, inside which, all items have the same height (equal column heights). This can be very useful if you want to show your related articles or products with title/author/category/image etc., which would take a significant amount of space in the classic list-style display. + */ + ?> + + item->params->get('itemRelated') && isset($this->relatedItems)): ?> + +
        +

        +
          + relatedItems as $key=>$item): ?> +
        • "> + + item->params->get('itemRelatedTitle', 1)): ?> + title; ?> + + + item->params->get('itemRelatedCategory')): ?> + + + + item->params->get('itemRelatedAuthor')): ?> + + + + item->params->get('itemRelatedImageSize')): ?> + <?php echo K2HelperUtilities::cleanHtml($item->title); ?> + + + item->params->get('itemRelatedIntrotext')): ?> +
          introtext; ?>
          + + + item->params->get('itemRelatedFulltext')): ?> +
          fulltext; ?>
          + + + item->params->get('itemRelatedMedia')): ?> + videoType=='embedded'): ?> +
          video; ?>
          + +
          video; ?>
          + + + + item->params->get('itemRelatedImageGallery')): ?> +
          gallery; ?>
          + +
        • + +
        • +
        +
        +
        + + +
        + + item->params->get('itemVideo') && !empty($this->item->video)): ?> + + +
        +

        + + item->videoType=='embedded'): ?> +
        + item->video; ?> +
        + + item->video; ?> + + + item->params->get('itemVideoCaption') && !empty($this->item->video_caption)): ?> + item->video_caption; ?> + + + item->params->get('itemVideoCredits') && !empty($this->item->video_credits)): ?> + item->video_credits; ?> + + +
        +
        + + + item->params->get('itemImageGallery') && !empty($this->item->gallery)): ?> + + +
        +

        + item->gallery; ?> +
        + + + item->params->get('itemNavigation') && !JRequest::getCmd('print') && (isset($this->item->nextLink) || isset($this->item->previousLink))): ?> + +
        + + + item->previousLink)): ?> + « item->previousTitle; ?> + + + item->nextLink)): ?> + item->nextTitle; ?> » + +
        + + + + item->event->AfterDisplay; ?> + + + item->event->K2AfterDisplay; ?> + + item->params->get('itemComments') && + (($this->item->params->get('comments') == '2' && !$this->user->guest) || ($this->item->params->get('comments') == '1')) + ): ?> + + item->event->K2CommentsBlock; ?> + + + item->params->get('itemComments') && + ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2')) && empty($this->item->event->K2CommentsBlock) + ): ?> + + +
        + item->params->get('commentsFormPosition')=='above' && $this->item->params->get('itemComments') && !JRequest::getInt('print') && ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2' && K2HelperPermissions::canAddComment($this->item->catid)))): ?> + +
        + loadTemplate('comments_form'); ?> +
        + + + item->numOfComments>0 && $this->item->params->get('itemComments') && ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2'))): ?> + +

        + item->numOfComments; ?> item->numOfComments>1) ? JText::_('K2_COMMENTS') : JText::_('K2_COMMENT'); ?> +

        + +
          + item->comments as $key=>$comment): ?> +
        • item->created_by_alias && $comment->userID==$this->item->created_by) ? " authorResponse" : ""; echo($comment->published) ? '':' unpublishedComment'; ?>"> + + + + + + + userImage): ?> + <?php echo JFilterOutput::cleanText($comment->userName); ?> + + + commentDate, JText::_('K2_DATE_FORMAT_LC2')); ?> + + + + userLink)): ?> + userName; ?> + + userName; ?> + + + +

          commentText; ?>

          + + inlineCommentsModeration || + ($comment->published && ($this->params->get('commentsReporting')=='1' || ($this->params->get('commentsReporting')=='2' && !$this->user->guest))) + ): ?> + + inlineCommentsModeration): ?> + published): ?> + + + + + + + published && ($this->params->get('commentsReporting')=='1' || ($this->params->get('commentsReporting')=='2' && !$this->user->guest))): ?> + + + + reportUserLink): ?> + + + + + +
          +
        • + +
        + + +
        + pagination->getPagesLinks(); ?> +
        +
        + + + item->params->get('commentsFormPosition')=='below' && + $this->item->params->get('itemComments') && + !JRequest::getInt('print') && + ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2' && K2HelperPermissions::canAddComment($this->item->catid))) + ): ?> + +
        + loadTemplate('comments_form'); ?> +
        + + + item->params->get('comments') == '2' && $user->guest): ?> +
        + + +
        + + + +
        + + + +
        + + +
        + +
        + diff --git a/deployed/k2/components/com_k2/templates/default/item_comments_form.php b/deployed/k2/components/com_k2/templates/default/item_comments_form.php new file mode 100644 index 00000000..48330b10 --- /dev/null +++ b/deployed/k2/components/com_k2/templates/default/item_comments_form.php @@ -0,0 +1,57 @@ + + + +

        + +params->get('commentsFormNotes')): ?> +

        + params->get('commentsFormNotesText')): ?> + params->get('commentsFormNotesText')); ?> + + + +

        + + +
        + + + + + + + + + + + + + params->get('recaptcha') && ($this->user->guest || $this->params->get('recaptchaForRegistered', 1))): ?> + params->get('recaptchaV2')): ?> + + +
        + + + + + + + + + + + +
        diff --git a/deployed/k2/components/com_k2/templates/default/itemform.php b/deployed/k2/components/com_k2/templates/default/itemform.php new file mode 100644 index 00000000..bedb6b56 --- /dev/null +++ b/deployed/k2/components/com_k2/templates/default/itemform.php @@ -0,0 +1,20 @@ + + + +
        + + params->get('show_page_title')): ?> + +
        + escape($this->params->get('page_title')); ?> +
        + + + blocks as $key=>$block): ?> +
        + + source=='categories'): $category=$block; ?> + + params->get('categoryFeed') || $this->params->get('categoryImage') || $this->params->get('categoryTitle') || $this->params->get('categoryDescription')): ?> + +
        + params->get('categoryFeed')): ?> + +
        + + + +
        +
        + + + params->get('categoryImage') && !empty($category->image)): ?> +
        + <?php echo K2HelperUtilities::cleanHtml($category->name); ?> +
        + + + params->get('categoryTitle')): ?> +

        name; ?>

        + + + params->get('categoryDescription') && isset($category->description)): ?> +

        description; ?>

        + + +
        + + + event->K2CategoryDisplay; ?> +
        +
        + + + + + + params->get('userFeed') || $this->params->get('userImage') || $this->params->get('userName') || $this->params->get('userDescription') || $this->params->get('userURL') || $this->params->get('userEmail')): ?> + +
        + + params->get('userFeed')): ?> + +
        + + + +
        +
        + + + params->get('userImage') && !empty($user->avatar)): ?> + <?php echo $user->name; ?> + + + params->get('userName')): ?> +

        + + + params->get('userDescription') && isset($user->profile->description)): ?> +

        profile->description; ?>

        + + + params->get('userURL') || $this->params->get('userEmail')): ?> +

        + params->get('userURL') && isset($user->profile->url)): ?> + + : profile->url; ?> + + + + params->get('userEmail')): ?> + + : email); ?> + + +

        + + +
        + + event->K2UserDisplay; ?> + +
        +
        + + + + + + +
        + params->get('latestItemsDisplayEffect')=="first"): ?> + + items as $itemCounter=>$item): K2HelperUtilities::setDefaultImage($item, 'latest', $this->params); ?> + + item=$item; echo $this->loadTemplate('item'); ?> + +

        + params->get('latestItemTitleLinked')): ?> + title; ?> + + title; ?> + +

        + + + + + + items as $item): K2HelperUtilities::setDefaultImage($item, 'latest', $this->params); ?> + item=$item; echo $this->loadTemplate('item'); ?> + + + +
        + + +
        + + params->get('latestItemsCols'))==0): ?> +
        + + + +
        +
        + + diff --git a/deployed/k2/components/com_k2/templates/default/latest_item.php b/deployed/k2/components/com_k2/templates/default/latest_item.php new file mode 100644 index 00000000..6cd3e39e --- /dev/null +++ b/deployed/k2/components/com_k2/templates/default/latest_item.php @@ -0,0 +1,167 @@ + + + +
        + + + item->event->BeforeDisplay; ?> + + + item->event->K2BeforeDisplay; ?> + +
        + item->params->get('latestItemTitle')): ?> + +

        + item->params->get('latestItemTitleLinked')): ?> + + item->title; ?> + + + item->title; ?> + +

        + +
        + + item->params->get('latestItemDateCreated')): ?> + + + item->created , JText::_('K2_DATE_FORMAT_LC2')); ?> + + + + + item->event->AfterDisplayTitle; ?> + + + item->event->K2AfterDisplayTitle; ?> + +
        + + + item->event->BeforeDisplayContent; ?> + + + item->event->K2BeforeDisplayContent; ?> + + item->params->get('latestItemImage') && !empty($this->item->image)): ?> + +
        + + + <?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?> + + +
        +
        + + + item->params->get('latestItemIntroText')): ?> + +
        + item->introtext; ?> +
        + + +
        + + + item->event->AfterDisplayContent; ?> + + + item->event->K2AfterDisplayContent; ?> + +
        +
        + + item->params->get('latestItemCategory') || $this->item->params->get('latestItemTags')): ?> + + + +
        + + params->get('latestItemVideo') && !empty($this->item->video)): ?> + +
        +

        + item->video; ?> +
        + + + item->params->get('latestItemCommentsAnchor') && ( ($this->item->params->get('comments') == '2' && !$this->user->guest) || ($this->item->params->get('comments') == '1')) ): ?> + + + + + item->params->get('latestItemReadMore')): ?> + +
        + + + +
        + + +
        + + + item->event->AfterDisplay; ?> + + + item->event->K2AfterDisplay; ?> + +
        +
        + diff --git a/deployed/k2/components/com_k2/templates/default/tag.php b/deployed/k2/components/com_k2/templates/default/tag.php new file mode 100644 index 00000000..5fa79f34 --- /dev/null +++ b/deployed/k2/components/com_k2/templates/default/tag.php @@ -0,0 +1,147 @@ + + + +
        + + params->get('show_page_title')): ?> + +
        + escape($this->params->get('page_title')); ?> +
        + + + params->get('tagFeedIcon',1)): ?> + +
        + + + +
        +
        + + + items)): ?> +
        + items as $item): ?> + + +
        + +
        + params->get('tagItemDateCreated',1)): ?> + + + created , JText::_('K2_DATE_FORMAT_LC2')); ?> + + + + params->get('tagItemTitle',1)): ?> + +

        + params->get('tagItemTitleLinked',1)): ?> + + title; ?> + + + title; ?> + +

        + +
        + +
        + params->get('tagItemImage',1) && !empty($item->imageGeneric)): ?> + +
        + + + <?php if(!empty($item->image_caption)) echo K2HelperUtilities::cleanHtml($item->image_caption); else echo K2HelperUtilities::cleanHtml($item->title); ?> + + +
        +
        + + + params->get('tagItemIntroText',1)): ?> + +
        + introtext; ?> +
        + + +
        +
        + +
        + + params->get('tagItemExtraFields',0) && count($item->extra_fields)): ?> + +
        +

        +
          + extra_fields as $key=>$extraField): ?> + value != ''): ?> +
        • typetype); ?> groupgroup; ?>"> + type == 'header'): ?> +

          name; ?>

          + + name; ?> + value; ?> + +
        • + + +
        +
        +
        + + + params->get('tagItemCategory')): ?> + + + + + params->get('tagItemReadMore')): ?> + +
        + + + +
        + + +
        +
        + + + +
        + + + pagination->getPagesLinks()): ?> +
        + pagination->getPagesLinks(); ?> +
        + pagination->getPagesCounter(); ?> +
        + + + + +
        + diff --git a/deployed/k2/components/com_k2/templates/default/user.php b/deployed/k2/components/com_k2/templates/default/user.php new file mode 100644 index 00000000..46ca6708 --- /dev/null +++ b/deployed/k2/components/com_k2/templates/default/user.php @@ -0,0 +1,272 @@ + + + + +
        + + params->get('show_page_title') && $this->params->get('page_title')!=$this->user->name): ?> + +
        + escape($this->params->get('page_title')); ?> +
        + + + params->get('userFeedIcon',1)): ?> + +
        + + + +
        +
        + + + params->get('userImage') || $this->params->get('userName') || $this->params->get('userDescription') || $this->params->get('userURL') || $this->params->get('userEmail')): ?> +
        + + addLink) && JRequest::getInt('id')==$user->id): ?> + + + + + + + + + params->get('userImage') && !empty($this->user->avatar)): ?> + <?php echo htmlspecialchars($this->user->name, ENT_QUOTES, 'UTF-8'); ?> + + + params->get('userName')): ?> +

        user->name; ?>

        + + + params->get('userDescription') && isset($this->user->profile->description) && trim($this->user->profile->description)!=''): ?> +
        user->profile->description; ?>
        + + + params->get('userURL') && isset($this->user->profile->url) && $this->user->profile->url) || $this->params->get('userEmail')): ?> +
        + params->get('userURL') && isset($this->user->profile->url) && $this->user->profile->url): ?> + + : user->profile->url; ?> + + + + params->get('userEmail')): ?> + + : user->email); ?> + + +
        + + +
        + + user->event->K2UserDisplay; ?> + +
        +
        + + + + + items)): ?> + +
        + items as $item): ?> + + +
        + + + event->BeforeDisplay; ?> + + + event->K2BeforeDisplay; ?> + +
        + params->get('userItemDateCreated')): ?> + + + created , JText::_('K2_DATE_FORMAT_LC2')); ?> + + + + params->get('userItemTitle')): ?> + +

        + editLink)): ?> + + + + + + + + + params->get('userItemTitleLinked') && $item->published): ?> + + title; ?> + + + title; ?> + + published || ($item->publish_up != $this->nullDate && $item->publish_up > $this->now) || ($item->publish_down != $this->nullDate && $item->publish_down < $this->now)): ?> + + + + + + +

        + +
        + + + event->AfterDisplayTitle; ?> + + + event->K2AfterDisplayTitle; ?> + +
        + + + event->BeforeDisplayContent; ?> + + + event->K2BeforeDisplayContent; ?> + + params->get('userItemImage') && !empty($item->imageGeneric)): ?> + +
        + + + <?php if(!empty($item->image_caption)) echo K2HelperUtilities::cleanHtml($item->image_caption); else echo K2HelperUtilities::cleanHtml($item->title); ?> + + +
        +
        + + + params->get('userItemIntroText')): ?> + +
        + introtext; ?> +
        + + +
        + + + event->AfterDisplayContent; ?> + + + event->K2AfterDisplayContent; ?> + +
        +
        + + params->get('userItemCategory') || $this->params->get('userItemTags')): ?> + + + +
        + + params->get('userItemCommentsAnchor') && ( ($this->params->get('comments') == '2' && !$this->user->guest) || ($this->params->get('comments') == '1')) ): ?> + + + + + params->get('userItemReadMore')): ?> + +
        + + + +
        + + +
        + + + event->AfterDisplay; ?> + + + event->K2AfterDisplay; ?> + +
        +
        + + + +
        + + + pagination->getPagesLinks())): ?> +
        + pagination->getPagesLinks(); ?> +
        + pagination->getPagesCounter(); ?> +
        + + + + +
        + + diff --git a/deployed/k2/components/com_k2/templates/generic.php b/deployed/k2/components/com_k2/templates/generic.php new file mode 100644 index 00000000..86f14977 --- /dev/null +++ b/deployed/k2/components/com_k2/templates/generic.php @@ -0,0 +1,162 @@ + + + +
        + + params->get('show_page_title') || JRequest::getCmd('task')=='search' || JRequest::getCmd('task')=='date'): ?> + +
        + escape($this->params->get('page_title')); ?> +
        + + + params->get('googleSearch')): ?> + +
        + + + items) && $this->params->get('genericFeedIcon',1)): ?> + +
        + + + +
        +
        + + + items)): ?> + +
        + items as $item): ?> + + +
        + +
        + params->get('genericItemDateCreated')): ?> + + + created , JText::_('K2_DATE_FORMAT_LC2')); ?> + + + + params->get('genericItemTitle')): ?> + +

        + params->get('genericItemTitleLinked')): ?> + + title; ?> + + + title; ?> + +

        + +
        + +
        + params->get('genericItemImage') && !empty($item->imageGeneric)): ?> + +
        + + + <?php if(!empty($item->image_caption)) echo K2HelperUtilities::cleanHtml($item->image_caption); else echo K2HelperUtilities::cleanHtml($item->title); ?> + + +
        +
        + + + params->get('genericItemIntroText')): ?> + +
        + introtext; ?> +
        + + +
        +
        + +
        + + params->get('genericItemExtraFields') && count($item->extra_fields)): ?> + +
        +

        +
          + extra_fields as $key=>$extraField): ?> + value != ''): ?> +
        • typetype); ?> groupgroup; ?>"> + type == 'header'): ?> +

          name; ?>

          + + name; ?> + value; ?> + +
        • + + +
        +
        +
        + + + params->get('genericItemCategory')): ?> + + + + + params->get('genericItemReadMore')): ?> + +
        + + + +
        + + +
        +
        + + + +
        + + + pagination->getPagesLinks()): ?> +
        + pagination->getPagesLinks(); ?> +
        + pagination->getPagesCounter(); ?> +
        + + + + + params->get('googleSearch')): ?> + +
        +

        +
        + + + + +
        + diff --git a/deployed/k2/components/com_k2/templates/generic_search.php b/deployed/k2/components/com_k2/templates/generic_search.php new file mode 100644 index 00000000..551d352d --- /dev/null +++ b/deployed/k2/components/com_k2/templates/generic_search.php @@ -0,0 +1,21 @@ + + +items)): ?> + + diff --git a/deployed/k2/components/com_k2/templates/profile.php b/deployed/k2/components/com_k2/templates/profile.php new file mode 100644 index 00000000..a300eb5e --- /dev/null +++ b/deployed/k2/components/com_k2/templates/profile.php @@ -0,0 +1,198 @@ + + + +
        + params->def('show_page_title',1)): ?> +
        + escape($this->params->get('page_title')); ?> +
        + +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + K2Plugins))): ?> + + + + + K2Plugins as $K2Plugin): ?> + + + + + + + + params) && version_compare(JVERSION, '1.6', 'lt')): ?> + + + + + + + + + form)): ?> + form->getFieldsets() as $fieldset): // Iterate through the form fieldsets and display each one.?> + name != 'core'): ?> + form->getFieldset($fieldset->name);?> + + label)):// If the fieldset has a label set, display it as the legend.?> + + + + + + hidden):// If the field is hidden, just display the input.?> + + + + + + + + + + + + +
        + +
        + + + user->get('username'); ?> +
        + + + +
        + + + +
        + + + + * +
        + + + +
        + + + +
        + +
        + + + lists['gender']; ?> +
        + + + editor; ?> +
        + + + + K2User->image): ?> + <?php echo $this->user->name; ?> + + + +
        + + + +
        + +
        + fields; ?> +
        + +
        + params->render('params'); ?> +
        + label);?> +
        input;?>
        + label; ?> + required && $field->type != 'Spacer'): ?> + + + input;?>
        +
        + +
        +
        + + + + + + + +
        diff --git a/deployed/k2/components/com_k2/templates/register.php b/deployed/k2/components/com_k2/templates/register.php new file mode 100644 index 00000000..d3c40683 --- /dev/null +++ b/deployed/k2/components/com_k2/templates/register.php @@ -0,0 +1,203 @@ + + + +message)) $this->display('message'); ?> + +
        + params->def('show_page_title',1)): ?> +
        + escape($this->params->get('page_title')); ?> +
        + +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + K2Plugins))): ?> + + + + + K2Plugins as $K2Plugin): ?> + + + + + + + + + + form)): ?> + form->getFieldsets() as $fieldset): // Iterate through the form fieldsets and display each one.?> + name != 'default'): ?> + form->getFieldset($fieldset->name);?> + + label)):// If the fieldset has a label set, display it as the legend.?> + + + + + + hidden):// If the field is hidden, just display the input.?> + + + + + + + + + + + + + +
        + +
        + + + + * +
        + + + + * +
        + + + + * +
        + + + + * +
        + + + + * +
        + + + + * +
        + +
        + + + lists['gender']; ?> +
        + + + editor; ?> +
        + + + + K2User->image): ?> + <?php echo $this->user->name; ?> + + + +
        + + + +
        + +
        + fields; ?> +
        + label);?> +
        input;?>
        + label; ?> + required && $field->type != 'Spacer'): ?> + + + input;?>
        + + K2Params->get('recaptchaOnRegistration') && $this->K2Params->get('recaptcha_public_key')): ?> + K2Params->get('recaptchaV2')): ?> + + +
        + + +
        +
        + +
        +
        + + + + + + +
        diff --git a/deployed/k2/components/com_k2/views/comments/metadata.xml b/deployed/k2/components/com_k2/views/comments/metadata.xml new file mode 100644 index 00000000..06d6a083 --- /dev/null +++ b/deployed/k2/components/com_k2/views/comments/metadata.xml @@ -0,0 +1,4 @@ + + + diff --git a/deployed/k2/components/com_k2/views/comments/tmpl/report.php b/deployed/k2/components/com_k2/views/comments/tmpl/report.php new file mode 100644 index 00000000..8e234d2d --- /dev/null +++ b/deployed/k2/components/com_k2/views/comments/tmpl/report.php @@ -0,0 +1,49 @@ + + +
        +

        + +

        +
        + + row->commentText); ?> + +
        +
        + + + + + + + params->get('recaptcha') && $this->user->guest): ?> + params->get('recaptchaV2')): ?> + + +
        + + + + + + + + + + + + +
        +
        diff --git a/deployed/k2/components/com_k2/views/comments/view.html.php b/deployed/k2/components/com_k2/views/comments/view.html.php new file mode 100644 index 00000000..43ace45d --- /dev/null +++ b/deployed/k2/components/com_k2/views/comments/view.html.php @@ -0,0 +1,77 @@ +load(JRequest::getInt('commentID')); + if (!$row->published) + { + JError::raiseError(404, JText::_('K2_NOT_FOUND')); + } + $this->assignRef('row', $row); + $user = JFactory::getUser(); + $this->assignRef('user', $user); + $params = K2HelperUtilities::getParams('com_k2'); + if (!$params->get('comments') || !$params->get('commentsReporting') || ($params->get('commentsReporting') == '2' && $user->guest)) + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + // Pass the old parameter to the view in order to avoid layout changes + if ($params->get('antispam') == 'recaptcha' || $params->get('antispam') == 'both') + { + $params->set('recaptcha', true); + } + else + { + $params->set('recaptcha', false); + } + + $this->assignRef('params', $params); + if ($params->get('recaptcha') && $user->guest) + { + $document = JFactory::getDocument(); + if($params->get('recaptchaV2')) { + $document->addScript('https://www.google.com/recaptcha/api.js?onload=onK2RecaptchaLoaded&render=explicit'); + $js = 'function onK2RecaptchaLoaded(){grecaptcha.render("recaptcha", {"sitekey" : "'.$params->get('recaptcha_public_key').'"});}'; + $document->addScriptDeclaration($js); + $this->recaptchaClass = 'k2-recaptcha-v2'; + } + else + { + $document->addScript('https://www.google.com/recaptcha/api/js/recaptcha_ajax.js'); + $js = ' + function showRecaptcha(){ + Recaptcha.create("'.$params->get('recaptcha_public_key').'", "recaptcha", { + theme: "'.$params->get('recaptcha_theme', 'clean').'" + }); + } + $K2(window).load(function() { + showRecaptcha(); + }); + '; + $document->addScriptDeclaration($js); + $this->recaptchaClass = 'k2-recaptcha-v1'; + } + + } + + parent::display($tpl); + } + +} diff --git a/deployed/k2/components/com_k2/views/item/metadata.xml b/deployed/k2/components/com_k2/views/item/metadata.xml new file mode 100644 index 00000000..d5208733 --- /dev/null +++ b/deployed/k2/components/com_k2/views/item/metadata.xml @@ -0,0 +1,6 @@ + + + + K2_CREATE_A_MENU_ITEM_LINKING_DIRECTLY_TO_AN_ITEM_IN_K2 + + diff --git a/deployed/k2/components/com_k2/views/item/tmpl/item.php b/deployed/k2/components/com_k2/views/item/tmpl/item.php new file mode 100644 index 00000000..486c09cf --- /dev/null +++ b/deployed/k2/components/com_k2/views/item/tmpl/item.php @@ -0,0 +1,13 @@ + diff --git a/deployed/k2/components/com_k2/views/item/tmpl/item.xml b/deployed/k2/components/com_k2/views/item/tmpl/item.xml new file mode 100644 index 00000000..40e092c3 --- /dev/null +++ b/deployed/k2/components/com_k2/views/item/tmpl/item.xml @@ -0,0 +1,19 @@ + + + + K2_CREATE_A_MENU_ITEM_LINKING_DIRECTLY_TO_AN_ITEM_IN_K2 + + + K2_ITEM + K2_CREATE_A_MENU_ITEM_LINKING_DIRECTLY_TO_AN_ITEM_IN_K2 + + + + + +
        + +
        +
        +
        +
        diff --git a/deployed/k2/components/com_k2/views/item/tmpl/item_comments_form.php b/deployed/k2/components/com_k2/views/item/tmpl/item_comments_form.php new file mode 100644 index 00000000..486c09cf --- /dev/null +++ b/deployed/k2/components/com_k2/views/item/tmpl/item_comments_form.php @@ -0,0 +1,13 @@ + diff --git a/deployed/k2/components/com_k2/views/item/tmpl/itemform.php b/deployed/k2/components/com_k2/views/item/tmpl/itemform.php new file mode 100644 index 00000000..486c09cf --- /dev/null +++ b/deployed/k2/components/com_k2/views/item/tmpl/itemform.php @@ -0,0 +1,13 @@ + diff --git a/deployed/k2/components/com_k2/views/item/tmpl/itemform.xml b/deployed/k2/components/com_k2/views/item/tmpl/itemform.xml new file mode 100644 index 00000000..d3cdc9d8 --- /dev/null +++ b/deployed/k2/components/com_k2/views/item/tmpl/itemform.xml @@ -0,0 +1,31 @@ + + + + K2_CREATE_A_MENU_ITEM_LINKING_TO_ITEM_EDIT_FORM + + + K2_ITEM_EDIT_FORM + K2_CREATE_A_MENU_ITEM_LINKING_TO_ITEM_EDIT_FORM + + + + + + + + + + +
        + + + +
        +
        + +
        + +
        +
        +
        +
        diff --git a/deployed/k2/components/com_k2/views/item/view.html.php b/deployed/k2/components/com_k2/views/item/view.html.php new file mode 100644 index 00000000..c83e2ed9 --- /dev/null +++ b/deployed/k2/components/com_k2/views/item/view.html.php @@ -0,0 +1,632 @@ +toMySQL() : $jnow->toSql(); + $nullDate = $db->getNullDate(); + + $this->setLayout('item'); + + // Add link + if (K2HelperPermissions::canAddItem()) + $addLink = JRoute::_('index.php?option=com_k2&view=item&task=add&tmpl=component'); + $this->assignRef('addLink', $addLink); + + // Get item + $model = $this->getModel(); + $item = $model->getData(); + + // Does the item exists? + if (!is_object($item) || !$item->id) + { + JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); + } + + // Prepare item + $item = $model->prepareItem($item, $view, $task); + + // Plugins + $item = $model->execPlugins($item, $view, $task); + + // User K2 plugins + $item->event->K2UserDisplay = ''; + if (isset($item->author) && is_object($item->author->profile) && isset($item->author->profile->id)) + { + $dispatcher = JDispatcher::getInstance(); + JPluginHelper::importPlugin('k2'); + $results = $dispatcher->trigger('onK2UserDisplay', array( + &$item->author->profile, + &$params, + $limitstart + )); + $item->event->K2UserDisplay = trim(implode("\n", $results)); + $item->author->profile->url = htmlspecialchars($item->author->profile->url, ENT_QUOTES, 'UTF-8'); + } + + // Access check + if ($this->getLayout() == 'form') + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + if (K2_JVERSION != '15') + { + if (!in_array($item->access, $user->getAuthorisedViewLevels()) || !in_array($item->category->access, $user->getAuthorisedViewLevels())) + { + if ($user->guest) + { + $uri = JFactory::getURI(); + $url = 'index.php?option=com_users&view=login&return='.base64_encode($uri->toString()); + $application->enqueueMessage(JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'), 'notice'); + $application->redirect(JRoute::_($url, false)); + } + else + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + return; + } + } + } + else + { + if ($item->access > $user->get('aid', 0) || $item->category->access > $user->get('aid', 0)) + { + + if ($user->guest) + { + $uri = JFactory::getURI(); + $url = 'index.php?option=com_user&view=login&return='.base64_encode($uri->toString()); + $application->enqueueMessage(JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'), 'notice'); + $application->redirect(JRoute::_($url, false)); + } + else + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + return; + } + } + } + + // Published check + if (!$item->published || $item->trash) + { + JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); + } + + if ($item->publish_up != $nullDate && $item->publish_up > $now) + { + JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); + } + + if ($item->publish_down != $nullDate && $item->publish_down < $now) + { + JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); + } + + if (!$item->category->published || $item->category->trash) + { + JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); + } + + // Increase hits counter + $model->hit($item->id); + + // Set default image + K2HelperUtilities::setDefaultImage($item, $view); + + // Pass the old parameter to the view in order to avoid layout changes + if ($params->get('antispam') == 'recaptcha' || $params->get('antispam') == 'both') + { + $params->set('recaptcha', true); + $item->params->set('recaptcha', true); + } + else + { + $params->set('recaptcha', false); + $item->params->set('recaptcha', false); + } + + // Comments + $item->event->K2CommentsCounter = ''; + $item->event->K2CommentsBlock = ''; + if ($item->params->get('itemComments')) + { + // Trigger comments events + $dispatcher = JDispatcher::getInstance(); + JPluginHelper::importPlugin('k2'); + $results = $dispatcher->trigger('onK2CommentsCounter', array( + &$item, + &$params, + $limitstart + )); + $item->event->K2CommentsCounter = trim(implode("\n", $results)); + $results = $dispatcher->trigger('onK2CommentsBlock', array( + &$item, + &$params, + $limitstart + )); + $item->event->K2CommentsBlock = trim(implode("\n", $results)); + + // Load K2 native comments system only if there are no plugins overriding it + if (empty($item->event->K2CommentsCounter) && empty($item->event->K2CommentsBlock)) + { + + // Load reCAPTCHA script + if (!JRequest::getInt('print') && ($item->params->get('comments') == '1' || ($item->params->get('comments') == '2' && K2HelperPermissions::canAddComment($item->catid)))) + { + if ($params->get('recaptcha') && ($user->guest || $params->get('recaptchaForRegistered', 1))) + { + if($params->get('recaptchaV2')) { + $document->addScript('https://www.google.com/recaptcha/api.js?onload=onK2RecaptchaLoaded&render=explicit'); + $js = 'function onK2RecaptchaLoaded(){grecaptcha.render("recaptcha", {"sitekey" : "'.$item->params->get('recaptcha_public_key').'"});}'; + $document->addScriptDeclaration($js); + $this->recaptchaClass = 'k2-recaptcha-v2'; + } + else + { + $document->addScript('https://www.google.com/recaptcha/api/js/recaptcha_ajax.js'); + $js = ' + function showRecaptcha(){ + Recaptcha.create("'.$item->params->get('recaptcha_public_key').'", "recaptcha", { + theme: "'.$item->params->get('recaptcha_theme', 'clean').'" + }); + } + $K2(window).load(function() { + showRecaptcha(); + }); + '; + $document->addScriptDeclaration($js); + $this->recaptchaClass = 'k2-recaptcha-v1'; + } + + } + } + + // Check for inline comment moderation + if (!$user->guest && $user->id == $item->created_by && $params->get('inlineCommentsModeration')) + { + $inlineCommentsModeration = true; + $commentsPublished = false; + } + else + { + $inlineCommentsModeration = false; + $commentsPublished = true; + } + $this->assignRef('inlineCommentsModeration', $inlineCommentsModeration); + + // Flag spammer link + $reportSpammerFlag = false; + if (K2_JVERSION != '15') + { + if ($user->authorise('core.admin', 'com_k2')) + { + $reportSpammerFlag = true; + $document = JFactory::getDocument(); + $document->addScriptDeclaration('var K2Language = ["'.JText::_('K2_REPORT_USER_WARNING', true).'"];'); + } + } + else + { + if ($user->gid > 24) + { + $reportSpammerFlag = true; + } + } + + $limit = $params->get('commentsLimit'); + $comments = $model->getItemComments($item->id, $limitstart, $limit, $commentsPublished); + + for ($i = 0; $i < sizeof($comments); $i++) + { + $comments[$i]->commentText = nl2br($comments[$i]->commentText); + + // Convert URLs to links properly + $comments[$i]->commentText = preg_replace("/([^\w\/])(www\.[a-z0-9\-]+\.[a-z0-9\-]+)/i", "$1http://$2", $comments[$i]->commentText); + $comments[$i]->commentText = preg_replace("/([\w]+:\/\/[\w-?&;#~=\.\/\@]+[\w\/])/i", "$1", $comments[$i]->commentText); + $comments[$i]->commentText = preg_replace("/([\w-?&;#~=\.\/]+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?))/i", "$1", $comments[$i]->commentText); + + $comments[$i]->userImage = K2HelperUtilities::getAvatar($comments[$i]->userID, $comments[$i]->commentEmail, $params->get('commenterImgWidth')); + if ($comments[$i]->userID > 0) + { + $comments[$i]->userLink = K2HelperRoute::getUserRoute($comments[$i]->userID); + } + else + { + $comments[$i]->userLink = $comments[$i]->commentURL; + } + if ($reportSpammerFlag && $comments[$i]->userID > 0) + { + $comments[$i]->reportUserLink = JRoute::_('index.php?option=com_k2&view=comments&task=reportSpammer&id='.$comments[$i]->userID.'&format=raw'); + } + else + { + $comments[$i]->reportUserLink = false; + } + } + + $item->comments = $comments; + + if(!isset($item->numOfComments)) + { + $item->numOfComments = 0; + } + + jimport('joomla.html.pagination'); + $total = $item->numOfComments; + $pagination = new JPagination($total, $limitstart, $limit); + + } + + } + + // Author's latest items + if ($item->params->get('itemAuthorLatest') && $item->created_by_alias == '') + { + $model = $this->getModel('itemlist'); + $authorLatestItems = $model->getAuthorLatest($item->id, $item->params->get('itemAuthorLatestLimit'), $item->created_by); + if (count($authorLatestItems)) + { + for ($i = 0; $i < sizeof($authorLatestItems); $i++) + { + $authorLatestItems[$i]->link = urldecode(JRoute::_(K2HelperRoute::getItemRoute($authorLatestItems[$i]->id.':'.urlencode($authorLatestItems[$i]->alias), $authorLatestItems[$i]->catid.':'.urlencode($authorLatestItems[$i]->categoryalias)))); + } + $this->assignRef('authorLatestItems', $authorLatestItems); + } + } + + // Related items + if ($item->params->get('itemRelated') && isset($item->tags) && count($item->tags)) + { + $model = $this->getModel('itemlist'); + $relatedItems = $model->getRelatedItems($item->id, $item->tags, $item->params); + if (count($relatedItems)) + { + for ($i = 0; $i < sizeof($relatedItems); $i++) + { + $relatedItems[$i]->link = urldecode(JRoute::_(K2HelperRoute::getItemRoute($relatedItems[$i]->id.':'.urlencode($relatedItems[$i]->alias), $relatedItems[$i]->catid.':'.urlencode($relatedItems[$i]->categoryalias)))); + } + $this->assignRef('relatedItems', $relatedItems); + } + + } + + // Navigation (previous and next item) + if ($item->params->get('itemNavigation')) + { + $model = $this->getModel('item'); + + $nextItem = $model->getNextItem($item->id, $item->catid, $item->ordering); + if (!is_null($nextItem)) + { + $item->nextLink = urldecode(JRoute::_(K2HelperRoute::getItemRoute($nextItem->id.':'.urlencode($nextItem->alias), $nextItem->catid.':'.urlencode($item->category->alias)))); + $item->nextTitle = $nextItem->title; + + $date = JFactory::getDate($item->modified); + $timestamp = '?t='.$date->toUnix(); + + if (JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.md5("Image".$nextItem->id).'_XS.jpg')) + { + $item->nextImageXSmall = JURI::base(true).'/media/k2/items/cache/'.md5("Image".$nextItem->id).'_XS.jpg'.$timestamp; + + } + if (JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.md5("Image".$nextItem->id).'_S.jpg')) + { + $item->nextImageSmall = JURI::base(true).'/media/k2/items/cache/'.md5("Image".$nextItem->id).'_S.jpg'.$timestamp; + } + + if (JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.md5("Image".$nextItem->id).'_M.jpg')) + { + $item->nextImageMedium = JURI::base(true).'/media/k2/items/cache/'.md5("Image".$nextItem->id).'_M.jpg'.$timestamp; + } + + if (JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.md5("Image".$nextItem->id).'_L.jpg')) + { + $item->nextImageLarge = JURI::base(true).'/media/k2/items/cache/'.md5("Image".$nextItem->id).'_L.jpg'.$timestamp; + } + + if (JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.md5("Image".$nextItem->id).'_XL.jpg')) + { + $item->nextImageXLarge = JURI::base(true).'/media/k2/items/cache/'.md5("Image".$nextItem->id).'_XL.jpg'.$timestamp; + } + + if (JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.md5("Image".$nextItem->id).'_Generic.jpg')) + { + $item->nextImageGeneric = JURI::base(true).'/media/k2/items/cache/'.md5("Image".$nextItem->id).'_Generic.jpg'.$timestamp; + } + + } + + $previousItem = $model->getPreviousItem($item->id, $item->catid, $item->ordering); + if (!is_null($previousItem)) + { + $item->previousLink = urldecode(JRoute::_(K2HelperRoute::getItemRoute($previousItem->id.':'.urlencode($previousItem->alias), $previousItem->catid.':'.urlencode($item->category->alias)))); + $item->previousTitle = $previousItem->title; + + $date = JFactory::getDate($item->modified); + $timestamp = '?t='.$date->toUnix(); + + if (JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.md5("Image".$previousItem->id).'_XS.jpg')) + { + $item->previousImageXSmall = JURI::base(true).'/media/k2/items/cache/'.md5("Image".$previousItem->id).'_XS.jpg'.$timestamp; + + } + if (JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.md5("Image".$previousItem->id).'_S.jpg')) + { + $item->previousImageSmall = JURI::base(true).'/media/k2/items/cache/'.md5("Image".$previousItem->id).'_S.jpg'.$timestamp; + } + + if (JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.md5("Image".$previousItem->id).'_M.jpg')) + { + $item->previousImageMedium = JURI::base(true).'/media/k2/items/cache/'.md5("Image".$previousItem->id).'_M.jpg'.$timestamp; + } + + if (JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.md5("Image".$previousItem->id).'_L.jpg')) + { + $item->previousImageLarge = JURI::base(true).'/media/k2/items/cache/'.md5("Image".$previousItem->id).'_L.jpg'.$timestamp; + } + + if (JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.md5("Image".$previousItem->id).'_XL.jpg')) + { + $item->previousImageXLarge = JURI::base(true).'/media/k2/items/cache/'.md5("Image".$previousItem->id).'_XL.jpg'.$timestamp; + } + + if (JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.md5("Image".$previousItem->id).'_Generic.jpg')) + { + $item->previousImageGeneric = JURI::base(true).'/media/k2/items/cache/'.md5("Image".$previousItem->id).'_Generic.jpg'.$timestamp; + } + } + + } + + // Absolute URL + $uri = JURI::getInstance(); + $item->absoluteURL = $uri->toString(); + + // Email link + if (K2_JVERSION != '15') + { + require_once(JPATH_SITE.'/components/com_mailto/helpers/mailto.php'); + $template = $application->getTemplate(); + $item->emailLink = JRoute::_('index.php?option=com_mailto&tmpl=component&template='.$template.'&link='.MailToHelper::addLink($item->absoluteURL)); + } + else + { + require_once(JPATH_SITE.'/components/com_mailto/helpers/mailto.php'); + $item->emailLink = JRoute::_('index.php?option=com_mailto&tmpl=component&link='.MailToHelper::addLink($item->absoluteURL)); + } + + // Twitter link (legacy code) + if ($params->get('twitterUsername')) + { + $item->twitterURL = 'http://twitter.com/intent/tweet?text='.urlencode($item->title).'&url='.urlencode($item->absoluteURL).'&via='.$params->get('twitterUsername'); + } + else + { + $item->twitterURL = 'http://twitter.com/intent/tweet?text='.urlencode($item->title).'&url='.urlencode($item->absoluteURL); + } + + // Social link + $item->socialLink = urlencode($item->absoluteURL); + + // Set page title + $menus = $application->getMenu(); + $menu = $menus->getActive(); + if (is_object($menu) && isset($menu->query['view']) && $menu->query['view'] == 'item' && isset($menu->query['id']) && $menu->query['id'] == $item->id) + { + if (is_string($menu->params)) + { + $menu_params = K2_JVERSION == '15' ? new JParameter($menu->params) : new JRegistry($menu->params); + } + else + { + $menu_params = $menu->params; + } + if (!$menu_params->get('page_title')) + { + $params->set('page_title', $item->cleanTitle); + } + } + else + { + $params->set('page_title', $item->cleanTitle); + } + + if (K2_JVERSION != '15') + { + if ($application->getCfg('sitename_pagetitles', 0) == 1) + { + $title = JText::sprintf('JPAGETITLE', $application->getCfg('sitename'), $params->get('page_title')); + $params->set('page_title', $title); + } + elseif ($application->getCfg('sitename_pagetitles', 0) == 2) + { + $title = JText::sprintf('JPAGETITLE', $params->get('page_title'), $application->getCfg('sitename')); + $params->set('page_title', $title); + } + } + $document->setTitle($params->get('page_title')); + + // Set pathway + $menus = $application->getMenu(); + $menu = $menus->getActive(); + $pathway = $application->getPathWay(); + if ($menu) + { + if (isset($menu->query['view']) && ($menu->query['view'] != 'item' || $menu->query['id'] != $item->id)) + { + if (!isset($menu->query['task']) || $menu->query['task'] != 'category' || $menu->query['id'] != $item->catid) + $pathway->addItem($item->category->name, $item->category->link); + $pathway->addItem($item->cleanTitle, ''); + } + } + + // Set metadata + if ($item->metadesc) + { + $document->setDescription((K2_JVERSION == '15') ? htmlspecialchars($item->metadesc, ENT_QUOTES, 'UTF-8') : $item->metadesc); + } + else + { + $metaDescItem = preg_replace("#{(.*?)}(.*?){/(.*?)}#s", '', $item->introtext.' '.$item->fulltext); + $metaDescItem = preg_replace("/]*>(.*?)<\/script>/is", '', $item->introtext.' '.$item->fulltext); + $metaDescItem = strip_tags($metaDescItem); + $metaDescItem = K2HelperUtilities::characterLimit($metaDescItem, $params->get('metaDescLimit', 150)); + $document->setDescription(K2_JVERSION == '15' ? $metaDescItem : html_entity_decode($metaDescItem)); + } + if ($item->metakey) + { + $document->setMetadata('keywords', $item->metakey); + } + else + { + if (isset($item->tags) && count($item->tags)) + { + $tmp = array(); + foreach ($item->tags as $tag) + { + $tmp[] = $tag->name; + } + $document->setMetadata('keywords', implode(',', $tmp)); + } + } + + // Menu metadata for Joomla 2.5+ (overrides the current metadata if set) + if (K2_JVERSION != '15') + { + + if ($params->get('menu-meta_description')) + { + $document->setDescription($params->get('menu-meta_description')); + } + + if ($params->get('menu-meta_keywords')) + { + $document->setMetadata('keywords', $params->get('menu-meta_keywords')); + } + + if ($params->get('robots')) + { + $document->setMetadata('robots', $params->get('robots')); + } + + // Menu page display options + if ($params->get('page_heading')) + { + $params->set('page_title', $params->get('page_heading')); + } + $params->set('show_page_title', $params->get('show_page_heading')); + + } + + if ($application->getCfg('MetaTitle') == '1') + { + $document->setMetadata('title', $item->cleanTitle); + } + if ($application->getCfg('MetaAuthor') == '1' && isset($item->author->name)) + { + $document->setMetadata('author', $item->author->name); + } + $mdata = class_exists('JParameter') ? new JParameter($item->metadata) : new JRegistry($item->metadata); + $mdata = $mdata->toArray(); + foreach ($mdata as $k => $v) + { + if ($k == 'robots' || $k == 'author') + { + if ($v) + $document->setMetadata($k, $v); + } + } + + // Set Facebook meta data + if($params->get('facebookMetatags', '1')) + { + $document = JFactory::getDocument(); + $uri = JURI::getInstance(); + $document->setMetaData('og:url', $uri->toString()); + $document->setMetaData('og:title', (K2_JVERSION == '15') ? htmlspecialchars($document->getTitle(), ENT_QUOTES, 'UTF-8') : $document->getTitle()); + $document->setMetaData('og:type', 'article'); + $facebookImage = 'image'.$params->get('facebookImage', 'Small'); + if ($item->$facebookImage) + { + $basename = basename($item->$facebookImage); + if(strpos($basename, '?t=')!==false) + { + $tmpBasename = explode('?t=', $basename); + $basenameWithNoTimestamp = $tmpBasename[0]; + } + else + { + $basenameWithNoTimestamp = $basename; + } + if (JFile::exists(JPATH_SITE.'/media/k2/items/cache/'.$basenameWithNoTimestamp)) + { + $image = JURI::root().'media/k2/items/cache/'.$basename; + $document->setMetaData('og:image', $image); + $document->setMetaData('image', $image); + } + } + $document->setMetaData('og:description', strip_tags($document->getDescription())); + } + + // Get the frontend's language for use in social media buttons - use explicit variable references for future update flexibility + $getSiteLanguage = JFactory::getLanguage(); + $languageTag = $getSiteLanguage->getTag(); + $item->langTagForFB = str_replace('-', '_', $languageTag); + $item->langTagForTW = strtolower($languageTag); + $item->langTagForGP = $languageTag; + + // Look for template files in component folders + $this->_addPath('template', JPATH_COMPONENT.'/templates'); + $this->_addPath('template', JPATH_COMPONENT.'/templates/default'); + + // Look for overrides in template folder (K2 template structure) + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/templates'); + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/templates/default'); + + // Look for overrides in template folder (Joomla template structure) + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/default'); + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2'); + + // Look for specific K2 theme files + if ($item->params->get('theme')) + { + $this->_addPath('template', JPATH_COMPONENT.'/templates/'.$item->params->get('theme')); + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/templates/'.$item->params->get('theme')); + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/'.$item->params->get('theme')); + } + + // Assign data + $this->assignRef('item', $item); + $this->assignRef('user', $user); + $this->assignRef('params', $item->params); + $this->assignRef('pagination', $pagination); + + parent::display($tpl); + } + +} diff --git a/deployed/k2/components/com_k2/views/item/view.json.php b/deployed/k2/components/com_k2/views/item/view.json.php new file mode 100644 index 00000000..35039d76 --- /dev/null +++ b/deployed/k2/components/com_k2/views/item/view.json.php @@ -0,0 +1,138 @@ +setMimeEncoding('application/json'); + $document->setType('json'); + } + $params = K2HelperUtilities::getParams('com_k2'); + $view = JRequest::getWord('view'); + $task = JRequest::getWord('task'); + + $db = JFactory::getDbo(); + $jnow = JFactory::getDate(); + $now = K2_JVERSION == '15'?$jnow->toMySQL():$jnow->toSql(); + $nullDate = $db->getNullDate(); + + // Get item + $model = $this->getModel(); + $item = $model->getData(); + + // Does the item exists? + if (!is_object($item) || !$item->id) + { + JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); + } + + // Override some params because we want to show all elements in JSON + $itemParams = class_exists('JParameter') ? new JParameter($item->params) : new JRegistry($item->params); + $itemParams->set('itemIntroText', true); + $itemParams->set('itemFullText', true); + $itemParams->set('itemTags', true); + $itemParams->set('itemExtraFields', true); + $itemParams->set('itemAttachments', true); + $itemParams->set('itemRating', true); + $itemParams->set('itemAuthor', true); + $itemParams->set('itemImageGallery', true); + $itemParams->set('itemVideo', true); + $item->params = $itemParams->toString(); + + // Prepare item + $item = $model->prepareItem($item, $view, $task); + + // Plugins + $item = $model->execPlugins($item, $view, $task); + + // Access check + if (K2_JVERSION != '15') + { + if (!in_array($item->access, $user->getAuthorisedViewLevels()) || !in_array($item->category->access, $user->getAuthorisedViewLevels())) + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + } + else + { + if ($item->access > $user->get('aid', 0) || $item->category->access > $user->get('aid', 0)) + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + } + + // Published check + if (!$item->published || $item->trash) + { + JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); + } + + if ($item->publish_up != $nullDate && $item->publish_up > $now) + { + JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); + } + + if ($item->publish_down != $nullDate && $item->publish_down < $now) + { + JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); + } + + if (!$item->category->published || $item->category->trash) + { + JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); + } + + // Increase hits counter + $model->hit($item->id); + + // Set default image + K2HelperUtilities::setDefaultImage($item, $view); + + // Build the output object + $row = $model->prepareJSONItem($item); + + // Output + $response = new stdClass(); + + // Site + $response->site = new stdClass(); + $uri = JURI::getInstance(); + $response->site->url = $uri->toString(array('scheme', 'host', 'port')); + $config = JFactory::getConfig(); + $response->site->name = K2_JVERSION == '30' ? $config->get('sitename') : $config->getValue('config.sitename'); + + $response->item = $row; + + $json = json_encode($response); + $callback = JRequest::getCmd('callback'); + if ($callback) + { + $document->setMimeEncoding('application/javascript'); + echo $callback.'('.$json.')'; + } + else + { + echo $json; + } + } + +} diff --git a/deployed/k2/components/com_k2/views/item/view.raw.php b/deployed/k2/components/com_k2/views/item/view.raw.php new file mode 100644 index 00000000..c3b10ad2 --- /dev/null +++ b/deployed/k2/components/com_k2/views/item/view.raw.php @@ -0,0 +1,291 @@ +toMySQL():$jnow->toSql(); + $nullDate = $db->getNullDate(); + + $this->setLayout('item'); + + // Add link + if (K2HelperPermissions::canAddItem()) + $addLink = JRoute::_('index.php?option=com_k2&view=item&task=add&tmpl=component'); + $this->assignRef('addLink', $addLink); + + // Get item + $model = $this->getModel(); + $item = $model->getData(); + $item->event = new stdClass; + + // Does the item exists? + if (!is_object($item) || !$item->id) + { + JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); + } + + // Prepare item + $item = $model->prepareItem($item, $view, $task); + + // Plugins + $item = $model->execPlugins($item, $view, $task); + + // User K2 plugins + $item->event->K2UserDisplay = ''; + if (isset($item->author) && is_object($item->author->profile) && isset($item->author->profile->id)) + { + $dispatcher = JDispatcher::getInstance(); + JPluginHelper::importPlugin('k2'); + $results = $dispatcher->trigger('onK2UserDisplay', array(&$item->author->profile, &$params, $limitstart)); + $item->event->K2UserDisplay = trim(implode("\n", $results)); + $item->author->profile->url = htmlspecialchars($item->author->profile->url, ENT_QUOTES, 'UTF-8'); + } + + // Access check + if ($this->getLayout() == 'form') + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + if (K2_JVERSION != '15') + { + if (!in_array($item->access, $user->getAuthorisedViewLevels()) || !in_array($item->category->access, $user->getAuthorisedViewLevels())) + { + if ($user->guest) + { + $uri = JFactory::getURI(); + $url = 'index.php?option=com_users&view=login&return='.base64_encode($uri->toString()); + $application->enqueueMessage(JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'), 'notice'); + $application->redirect(JRoute::_($url, false)); + } + else + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + return; + } + } + } + else + { + if ($item->access > $user->get('aid', 0) || $item->category->access > $user->get('aid', 0)) + { + if ($user->guest) + { + $uri = JFactory::getURI(); + $url = 'index.php?option=com_user&view=login&return='.base64_encode($uri->toString()); + $application->enqueueMessage(JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'), 'notice'); + $application->redirect(JRoute::_($url, false)); + } + else + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + return; + } + } + } + + // Published check + if (!$item->published || $item->trash) + { + JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); + } + + if ($item->publish_up != $nullDate && $item->publish_up > $now) + { + JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); + } + + if ($item->publish_down != $nullDate && $item->publish_down < $now) + { + JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); + } + + if (!$item->category->published || $item->category->trash) + { + JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); + } + + // Increase hits counter + $model->hit($item->id); + + // Set default image + K2HelperUtilities::setDefaultImage($item, $view); + + // Comments + $item->event->K2CommentsCounter = ''; + $item->event->K2CommentsBlock = ''; + if ($item->params->get('itemComments')) + { + + // Trigger comments events + $dispatcher = JDispatcher::getInstance(); + JPluginHelper::importPlugin('k2'); + $results = $dispatcher->trigger('onK2CommentsCounter', array(&$item, &$params, $limitstart)); + $item->event->K2CommentsCounter = trim(implode("\n", $results)); + $results = $dispatcher->trigger('onK2CommentsBlock', array(&$item, &$params, $limitstart)); + $item->event->K2CommentsBlock = trim(implode("\n", $results)); + + // Load K2 native comments system only if there are no plugins overriding it + if (empty($item->event->K2CommentsCounter) && empty($item->event->K2CommentsBlock)) + { + + $limit = $params->get('commentsLimit'); + $comments = $model->getItemComments($item->id, $limitstart, $limit); + $pattern = "@\b(https?://)?(([0-9a-zA-Z_!~*'().&=+$%-]+:)?[0-9a-zA-Z_!~*'().&=+$%-]+\@)?(([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-zA-Z_!~*'()-]+\.)*([0-9a-zA-Z][0-9a-zA-Z-]{0,61})?[0-9a-zA-Z]\.[a-zA-Z]{2,6})(:[0-9]{1,4})?((/[0-9a-zA-Z_!~*'().;?:\@&=+$,%#-]+)*/?)@"; + + for ($i = 0; $i < sizeof($comments); $i++) + { + + $comments[$i]->commentText = nl2br($comments[$i]->commentText); + $comments[$i]->commentText = preg_replace($pattern, '\0', $comments[$i]->commentText); + $comments[$i]->userImage = K2HelperUtilities::getAvatar($comments[$i]->userID, $comments[$i]->commentEmail, $params->get('commenterImgWidth')); + if ($comments[$i]->userID > 0) + $comments[$i]->userLink = K2HelperRoute::getUserRoute($comments[$i]->userID); + else + $comments[$i]->userLink = $comments[$i]->commentURL; + } + + $item->comments = $comments; + + jimport('joomla.html.pagination'); + $total = $item->numOfComments; + $pagination = new JPagination($total, $limitstart, $limit); + } + + } + + // Author's latest items + if ($item->params->get('itemAuthorLatest') && $item->created_by_alias == '') + { + $model = $this->getModel('itemlist'); + $authorLatestItems = $model->getAuthorLatest($item->id, $item->params->get('itemAuthorLatestLimit'), $item->created_by); + if (count($authorLatestItems)) + { + for ($i = 0; $i < sizeof($authorLatestItems); $i++) + { + $authorLatestItems[$i]->link = urldecode(JRoute::_(K2HelperRoute::getItemRoute($authorLatestItems[$i]->id.':'.urlencode($authorLatestItems[$i]->alias), $authorLatestItems[$i]->catid.':'.urlencode($authorLatestItems[$i]->categoryalias)))); + } + $this->assignRef('authorLatestItems', $authorLatestItems); + } + } + + // Related items + if ($item->params->get('itemRelated') && isset($item->tags) && count($item->tags)) + { + $model = $this->getModel('itemlist'); + $relatedItems = $model->getRelatedItems($item->id, $item->tags, $item->params); + if (count($relatedItems)) + { + for ($i = 0; $i < sizeof($relatedItems); $i++) + { + $relatedItems[$i]->link = urldecode(JRoute::_(K2HelperRoute::getItemRoute($relatedItems[$i]->id.':'.urlencode($relatedItems[$i]->alias), $relatedItems[$i]->catid.':'.urlencode($relatedItems[$i]->categoryalias)))); + } + $this->assignRef('relatedItems', $relatedItems); + } + + } + + // Navigation (previous and next item) + if ($item->params->get('itemNavigation')) + { + $model = $this->getModel('item'); + + $nextItem = $model->getNextItem($item->id, $item->catid, $item->ordering); + if (!is_null($nextItem)) + { + $item->nextLink = urldecode(JRoute::_(K2HelperRoute::getItemRoute($nextItem->id.':'.urlencode($nextItem->alias), $nextItem->catid.':'.urlencode($item->category->alias)))); + $item->nextTitle = $nextItem->title; + } + + $previousItem = $model->getPreviousItem($item->id, $item->catid, $item->ordering); + if (!is_null($previousItem)) + { + $item->previousLink = urldecode(JRoute::_(K2HelperRoute::getItemRoute($previousItem->id.':'.urlencode($previousItem->alias), $previousItem->catid.':'.urlencode($item->category->alias)))); + $item->previousTitle = $previousItem->title; + } + + } + + // Absolute URL + $uri = JURI::getInstance(); + $item->absoluteURL = $uri->toString(); + + // Email link + if (K2_JVERSION != '15') + { + require_once(JPATH_SITE.'/components/com_mailto/helpers/mailto.php'); + $template = $application->getTemplate(); + $item->emailLink = JRoute::_('index.php?option=com_mailto&tmpl=component&template='.$template.'&link='.MailToHelper::addLink($item->absoluteURL)); + } + else + { + require_once(JPATH_SITE.'/components/com_mailto/helpers/mailto.php'); + $item->emailLink = JRoute::_('index.php?option=com_mailto&tmpl=component&link='.MailToHelper::addLink($item->absoluteURL)); + } + + // Twitter link (legacy code) + if ($params->get('twitterUsername')) + { + $item->twitterURL = 'http://twitter.com/intent/tweet?text='.urlencode($item->title).'&url='.urlencode($item->absoluteURL).'&via='.$params->get('twitterUsername'); + } + else + { + $item->twitterURL = 'http://twitter.com/intent/tweet?text='.urlencode($item->title).'&url='.urlencode($item->absoluteURL); + } + + // Social link + $item->socialLink = urlencode($item->absoluteURL); + + // Look for template files in component folders + $this->_addPath('template', JPATH_COMPONENT.'/templates'); + $this->_addPath('template', JPATH_COMPONENT.'/templates/default'); + + // Look for overrides in template folder (K2 template structure) + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/templates'); + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/templates/default'); + + // Look for overrides in template folder (Joomla template structure) + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/default'); + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2'); + + // Look for specific K2 theme files + if ($item->params->get('theme')) + { + $this->_addPath('template', JPATH_COMPONENT.'/templates/'.$item->params->get('theme')); + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/templates/'.$item->params->get('theme')); + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/'.$item->params->get('theme')); + } + + // Assign data + $this->assignRef('item', $item); + $this->assignRef('user', $user); + $this->assignRef('params', $item->params); + $this->assignRef('pagination', $pagination); + + parent::display($tpl); + } + +} diff --git a/deployed/k2/components/com_k2/views/itemlist/metadata.xml b/deployed/k2/components/com_k2/views/itemlist/metadata.xml new file mode 100644 index 00000000..282b9c90 --- /dev/null +++ b/deployed/k2/components/com_k2/views/itemlist/metadata.xml @@ -0,0 +1,6 @@ + + + + K2_CREATE_A_MENU_ITEM_LINKING_TO_A_GRID_PAGE_WITH_THE_LATEST_ITEMS_FROM_SPECIFIC_USERS_OR_CATEGORIES_IN_K2 + + diff --git a/deployed/k2/components/com_k2/views/itemlist/tmpl/category.php b/deployed/k2/components/com_k2/views/itemlist/tmpl/category.php new file mode 100644 index 00000000..486c09cf --- /dev/null +++ b/deployed/k2/components/com_k2/views/itemlist/tmpl/category.php @@ -0,0 +1,13 @@ + diff --git a/deployed/k2/components/com_k2/views/itemlist/tmpl/category.xml b/deployed/k2/components/com_k2/views/itemlist/tmpl/category.xml new file mode 100644 index 00000000..f2b4d57e --- /dev/null +++ b/deployed/k2/components/com_k2/views/itemlist/tmpl/category.xml @@ -0,0 +1,242 @@ + + + + + + + + + K2_CATEGORIES + K2_DISPLAYS_A_LIST_OF_ITEMS_FROM_ONE_OR_MORE_CATEGORIES + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        + + +
        +
        + +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        +
        +
        +
        diff --git a/deployed/k2/components/com_k2/views/itemlist/tmpl/category_item.php b/deployed/k2/components/com_k2/views/itemlist/tmpl/category_item.php new file mode 100644 index 00000000..486c09cf --- /dev/null +++ b/deployed/k2/components/com_k2/views/itemlist/tmpl/category_item.php @@ -0,0 +1,13 @@ + diff --git a/deployed/k2/components/com_k2/views/itemlist/tmpl/generic.xml b/deployed/k2/components/com_k2/views/itemlist/tmpl/generic.xml new file mode 100644 index 00000000..3949b408 --- /dev/null +++ b/deployed/k2/components/com_k2/views/itemlist/tmpl/generic.xml @@ -0,0 +1,9 @@ + + + + + diff --git a/deployed/k2/components/com_k2/views/itemlist/tmpl/generic_item.php b/deployed/k2/components/com_k2/views/itemlist/tmpl/generic_item.php new file mode 100644 index 00000000..486c09cf --- /dev/null +++ b/deployed/k2/components/com_k2/views/itemlist/tmpl/generic_item.php @@ -0,0 +1,13 @@ + diff --git a/deployed/k2/components/com_k2/views/itemlist/tmpl/tag.php b/deployed/k2/components/com_k2/views/itemlist/tmpl/tag.php new file mode 100644 index 00000000..486c09cf --- /dev/null +++ b/deployed/k2/components/com_k2/views/itemlist/tmpl/tag.php @@ -0,0 +1,13 @@ + diff --git a/deployed/k2/components/com_k2/views/itemlist/tmpl/tag.xml b/deployed/k2/components/com_k2/views/itemlist/tmpl/tag.xml new file mode 100644 index 00000000..666b3589 --- /dev/null +++ b/deployed/k2/components/com_k2/views/itemlist/tmpl/tag.xml @@ -0,0 +1,78 @@ + + + + + + + + + K2_TAG + K2_CREATE_A_MENU_ITEM_LINKING_TO_A_TAG_IN_K2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        + + +
        +
        + +
        + + + + + + + + + + + + + + + + + + + + + + + + + +
        +
        +
        +
        diff --git a/deployed/k2/components/com_k2/views/itemlist/tmpl/user.php b/deployed/k2/components/com_k2/views/itemlist/tmpl/user.php new file mode 100644 index 00000000..486c09cf --- /dev/null +++ b/deployed/k2/components/com_k2/views/itemlist/tmpl/user.php @@ -0,0 +1,13 @@ + diff --git a/deployed/k2/components/com_k2/views/itemlist/tmpl/user.xml b/deployed/k2/components/com_k2/views/itemlist/tmpl/user.xml new file mode 100644 index 00000000..4c5a8312 --- /dev/null +++ b/deployed/k2/components/com_k2/views/itemlist/tmpl/user.xml @@ -0,0 +1,76 @@ + + + + + + + + + K2_USER_PAGE_BLOG + K2_CREATE_A_MENU_ITEM_LINKING_TO_A_USER_PAGE_BLOG + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        + + +
        +
        + +
        + + + + + + + + + + + + + + + + + + + + + + + + +
        +
        +
        +
        diff --git a/deployed/k2/components/com_k2/views/itemlist/tmpl/user_item.php b/deployed/k2/components/com_k2/views/itemlist/tmpl/user_item.php new file mode 100644 index 00000000..486c09cf --- /dev/null +++ b/deployed/k2/components/com_k2/views/itemlist/tmpl/user_item.php @@ -0,0 +1,13 @@ + diff --git a/deployed/k2/components/com_k2/views/itemlist/view.feed.php b/deployed/k2/components/com_k2/views/itemlist/view.feed.php new file mode 100644 index 00000000..3f21cd8f --- /dev/null +++ b/deployed/k2/components/com_k2/views/itemlist/view.feed.php @@ -0,0 +1,290 @@ +getModel('itemlist'); + $limitstart = JRequest::getInt('limitstart'); + $moduleID = JRequest::getInt('moduleID'); + + if ($moduleID) + { + + $result = $model->getModuleItems($moduleID); + $items = $result->items; + $title = $result->title; + + } + else + { + + //Get data depending on task + $task = JRequest::getCmd('task'); + switch ($task) + { + + case 'category' : + //Get category + $id = JRequest::getInt('id'); + JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.'/tables'); + $category = JTable::getInstance('K2Category', 'Table'); + $category->load($id); + + // State check + if (!$category->published || $category->trash) + { + JError::raiseError(404, JText::_('K2_CATEGORY_NOT_FOUND')); + } + + //Access check + $user = JFactory::getUser(); + if (K2_JVERSION != '15') + { + if (!in_array($category->access, $user->getAuthorisedViewLevels())) + { + if ($user->guest) + { + $uri = JFactory::getURI(); + $url = 'index.php?option=com_users&view=login&return='.base64_encode($uri->toString()); + $application->enqueueMessage(JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'), 'notice'); + $application->redirect(JRoute::_($url, false)); + } + else + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + return; + } + } + $languageFilter = $application->getLanguageFilter(); + $languageTag = JFactory::getLanguage()->getTag(); + if ($languageFilter && $category->language != $languageTag && $category->language != '*') + { + return; + } + } + else + { + if ($category->access > $user->get('aid', 0)) + { + if ($user->guest) + { + $uri = JFactory::getURI(); + $url = 'index.php?option=com_user&view=login&return='.base64_encode($uri->toString()); + $application->enqueueMessage(JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'), 'notice'); + $application->redirect(JRoute::_($url, false)); + } + else + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + return; + } + } + } + + //Merge params + $cparams = class_exists('JParameter') ? new JParameter($category->params) : new JRegistry($category->params); + if ($cparams->get('inheritFrom')) + { + $masterCategory = JTable::getInstance('K2Category', 'Table'); + $masterCategory->load($cparams->get('inheritFrom')); + $cparams = class_exists('JParameter') ? new JParameter($masterCategory->params) : new JRegistry($masterCategory->params); + } + $params->merge($cparams); + + //Category link + $category->link = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($category->id.':'.urlencode($category->alias)))); + + //Set featured flag + JRequest::setVar('featured', $params->get('catFeaturedItems')); + + //Set title + $title = $category->name; + + // Set ordering + if ($params->get('singleCatOrdering')) + { + $ordering = $params->get('singleCatOrdering'); + } + else + { + $ordering = $params->get('catOrdering'); + } + + break; + + case 'user' : + //Get user + $id = JRequest::getInt('id'); + $userObject = JFactory::getUser($id); + + //Check user status + if ($userObject->block) + { + JError::raiseError(404, JText::_('K2_USER_NOT_FOUND')); + } + + //Set title + $title = $userObject->name; + + // Set ordering + $ordering = $params->get('userOrdering'); + + break; + + case 'tag' : + + // Prevent spammers from using the tag view + $tag = JRequest::getString('tag'); + $db = JFactory::getDbo(); + $db->setQuery('SELECT id, name FROM #__k2_tags WHERE name = '.$db->quote($tag)); + $tag = $db->loadObject(); + if (!$tag->id) + { + JError::raiseError(404, JText::_('K2_NOT_FOUND')); + return false; + } + + //set title + $title = JText::_('K2_DISPLAYING_ITEMS_BY_TAG').' '.$tag->name; + + // Set ordering + $ordering = $params->get('tagOrdering'); + break; + + case 'search' : + //Set title + $title = JText::_('K2_SEARCH_RESULTS_FOR').' '.JRequest::getVar('searchword'); + break; + + case 'date' : + // Set title + if (JRequest::getInt('day')) + { + $date = strtotime(JRequest::getInt('year').'-'.JRequest::getInt('month').'-'.JRequest::getInt('day')); + $dateFormat = (K2_JVERSION == '15') ? '%A, %d %B %Y' : 'l, d F Y'; + $title = JText::_('K2_ITEMS_FILTERED_BY_DATE').' '.JHTML::_('date', $date, $dateFormat); + } + else + { + $date = strtotime(JRequest::getInt('year').'-'.JRequest::getInt('month')); + $dateFormat = (K2_JVERSION == '15') ? '%B %Y' : 'F Y'; + $title = JText::_('K2_ITEMS_FILTERED_BY_DATE').' '.JHTML::_('date', $date, $dateFormat); + } + // Set ordering + $ordering = 'rdate'; + break; + + default : + + //Set featured flag + JRequest::setVar('featured', $params->get('catFeaturedItems')); + + //Set title + $title = $params->get('page_title'); + + // Set ordering + $ordering = $params->get('catOrdering'); + + break; + } + + // Various Feed Validations + $title = JFilterOutput::ampReplace($title); + + // Get items + if (!isset($ordering)) + { + $items = $model->getData(); + } + else + { + $items = $model->getData($ordering); + } + + } + + // Prepare feed items + $model = $this->getModel('item'); + foreach ($items as $item) + { + + $item = $model->prepareFeedItem($item); + $item->title = $this->escape($item->title); + $item->title = html_entity_decode($item->title); + $feedItem = new JFeedItem(); + $feedItem->title = $item->title; + $feedItem->link = $item->link; + $feedItem->description = $item->description; + $feedItem->date = $item->created; + $feedItem->category = $item->category->name; + $feedItem->author = $item->author->name; + if ($params->get('feedBogusEmail')) + { + $feedItem->authorEmail = $params->get('feedBogusEmail'); + } + else + { + if ($application->getCfg('feed_email') == 'author') + { + $feedItem->authorEmail = $item->author->email; + } + else + { + $feedItem->authorEmail = $application->getCfg('mailfrom'); + } + } + + // Add item + $document->addItem($feedItem); + } + + // Set title + $document = JFactory::getDocument(); + $menus = $application->getMenu(); + $menu = $menus->getActive(); + if (is_object($menu)) + { + $menu_params = class_exists('JParameter') ? new JParameter($menu->params) : new JRegistry($menu->params); + if (!$menu_params->get('page_title')) + $params->set('page_title', $title); + } + else + { + $params->set('page_title', $title); + } + if (K2_JVERSION != '15') + { + if ($application->getCfg('sitename_pagetitles', 0) == 1) + { + $title = JText::sprintf('JPAGETITLE', $application->getCfg('sitename'), $params->get('page_title')); + $params->set('page_title', $title); + } + elseif ($application->getCfg('sitename_pagetitles', 0) == 2) + { + $title = JText::sprintf('JPAGETITLE', $params->get('page_title'), $application->getCfg('sitename')); + $params->set('page_title', $title); + } + } + $document->setTitle($params->get('page_title')); + + } + +} diff --git a/deployed/k2/components/com_k2/views/itemlist/view.html.php b/deployed/k2/components/com_k2/views/itemlist/view.html.php new file mode 100644 index 00000000..87cdfb98 --- /dev/null +++ b/deployed/k2/components/com_k2/views/itemlist/view.html.php @@ -0,0 +1,773 @@ +getModel('itemlist'); + $limitstart = JRequest::getInt('limitstart'); + $view = JRequest::getWord('view'); + $task = JRequest::getWord('task'); + $db = JFactory::getDbo(); + + // Add link + if (K2HelperPermissions::canAddItem()) + $addLink = JRoute::_('index.php?option=com_k2&view=item&task=add&tmpl=component'); + $this->assignRef('addLink', $addLink); + + // Get data depending on task + switch ($task) + { + + case 'category' : + // Get category + $id = JRequest::getInt('id'); + JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.'/tables'); + $category = JTable::getInstance('K2Category', 'Table'); + $category->load($id); + $category->event = new stdClass; + + // State check + if (!$category->published || $category->trash) + { + JError::raiseError(404, JText::_('K2_CATEGORY_NOT_FOUND')); + } + + // Access check + $user = JFactory::getUser(); + if (K2_JVERSION != '15') + { + if (!in_array($category->access, $user->getAuthorisedViewLevels())) + { + + if ($user->guest) + { + $uri = JFactory::getURI(); + $url = 'index.php?option=com_users&view=login&return='.base64_encode($uri->toString()); + $application->enqueueMessage(JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'), 'notice'); + $application->redirect(JRoute::_($url, false)); + } + else + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + return; + } + + } + $languageFilter = $application->getLanguageFilter(); + $languageTag = JFactory::getLanguage()->getTag(); + if ($languageFilter && $category->language != $languageTag && $category->language != '*') + { + return; + } + } + else + { + if ($category->access > $user->get('aid', 0)) + { + if ($user->guest) + { + $uri = JFactory::getURI(); + $url = 'index.php?option=com_user&view=login&return='.base64_encode($uri->toString()); + $application->enqueueMessage(JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'), 'notice'); + $application->redirect(JRoute::_($url, false)); + } + else + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + return; + } + } + } + + // Hide the add new item link if user cannot post in the specific category + if (!K2HelperPermissions::canAddItem($id)) + { + unset($this->addLink); + } + + // Merge params + $cparams = class_exists('JParameter') ? new JParameter($category->params) : new JRegistry($category->params); + + // Get the meta information before merging params since we do not want them to be inherited + $category->metaDescription = $cparams->get('catMetaDesc'); + $category->metaKeywords = $cparams->get('catMetaKey'); + $category->metaRobots = $cparams->get('catMetaRobots'); + $category->metaAuthor = $cparams->get('catMetaAuthor'); + + if ($cparams->get('inheritFrom')) + { + $masterCategory = JTable::getInstance('K2Category', 'Table'); + $masterCategory->load($cparams->get('inheritFrom')); + $cparams = class_exists('JParameter') ? new JParameter($masterCategory->params) : new JRegistry($masterCategory->params); + } + $params->merge($cparams); + + // Category link + $category->link = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($category->id.':'.urlencode($category->alias)))); + + // Category image + $category->image = K2HelperUtilities::getCategoryImage($category->image, $params); + + // Category plugins + $dispatcher = JDispatcher::getInstance(); + JPluginHelper::importPlugin('content'); + $category->text = $category->description; + if (K2_JVERSION != '15') + { + $dispatcher->trigger('onContentPrepare', array( + 'com_k2.category', + &$category, + &$params, + $limitstart + )); + } + else + { + $dispatcher->trigger('onPrepareContent', array( + &$category, + &$params, + $limitstart + )); + } + + $category->description = $category->text; + + // Category K2 plugins + $category->event->K2CategoryDisplay = ''; + JPluginHelper::importPlugin('k2'); + $results = $dispatcher->trigger('onK2CategoryDisplay', array( + &$category, + &$params, + $limitstart + )); + $category->event->K2CategoryDisplay = trim(implode("\n", $results)); + $category->text = $category->description; + $dispatcher->trigger('onK2PrepareContent', array( + &$category, + &$params, + $limitstart + )); + $category->description = $category->text; + + $this->assignRef('category', $category); + $this->assignRef('user', $user); + + // Category children + $ordering = $params->get('subCatOrdering'); + $children = $model->getCategoryFirstChildren($id, $ordering); + if (count($children)) + { + foreach ($children as $child) + { + if ($params->get('subCatTitleItemCounter')) + { + $child->numOfItems = $model->countCategoryItems($child->id); + } + $child->image = K2HelperUtilities::getCategoryImage($child->image, $params); + $child->name = htmlspecialchars($child->name, ENT_QUOTES); + $child->link = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($child->id.':'.urlencode($child->alias)))); + $subCategories[] = $child; + } + $this->assignRef('subCategories', $subCategories); + } + + // Set limit + $limit = $params->get('num_leading_items') + $params->get('num_primary_items') + $params->get('num_secondary_items') + $params->get('num_links'); + + // Set featured flag + JRequest::setVar('featured', $params->get('catFeaturedItems')); + + // Set layout + $this->setLayout('category'); + + // Set title + $title = $category->name; + $category->name = htmlspecialchars($category->name, ENT_QUOTES); + + // Set ordering + if ($params->get('singleCatOrdering')) + { + $ordering = $params->get('singleCatOrdering'); + } + else + { + $ordering = $params->get('catOrdering'); + } + + $addHeadFeedLink = $params->get('catFeedLink'); + + break; + + case 'user' : + // Get user + $id = JRequest::getInt('id'); + $userObject = JFactory::getUser($id); + $userObject->event = new stdClass; + + // Check user status + if ($userObject->block) + { + JError::raiseError(404, JText::_('K2_USER_NOT_FOUND')); + } + + // Get K2 user profile + $userObject->profile = $model->getUserProfile(); + + // User image + $userObject->avatar = K2HelperUtilities::getAvatar($userObject->id, $userObject->email, $params->get('userImageWidth')); + + // User K2 plugins + $userObject->event->K2UserDisplay = ''; + if (is_object($userObject->profile) && $userObject->profile->id > 0) + { + $dispatcher = JDispatcher::getInstance(); + JPluginHelper::importPlugin('k2'); + $results = $dispatcher->trigger('onK2UserDisplay', array( + &$userObject->profile, + &$params, + $limitstart + )); + $userObject->event->K2UserDisplay = trim(implode("\n", $results)); + $userObject->profile->url = htmlspecialchars($userObject->profile->url, ENT_QUOTES, 'UTF-8'); + } + $this->assignRef('user', $userObject); + + $date = JFactory::getDate(); + $now = K2_JVERSION == '15' ? $date->toMySQL() : $date->toSql(); + $this->assignRef('now', $now); + + // Set layout + $this->setLayout('user'); + + // Set limit + $limit = $params->get('userItemCount'); + + // Set title + $title = $userObject->name; + + // Set ordering + $ordering = $params->get('userOrdering'); + + $addHeadFeedLink = $params->get('userFeedLink', 1); + + break; + + case 'tag' : + // Set layout + $this->setLayout('tag'); + + // Set limit + $limit = $params->get('tagItemCount'); + + // Prevent spammers from using the tag view + $tag = JRequest::getString('tag'); + $db = JFactory::getDbo(); + $db->setQuery('SELECT id, name FROM #__k2_tags WHERE name = '.$db->quote($tag)); + $tag = $db->loadObject(); + if (!$tag || !$tag->id) + { + JError::raiseError(404, JText::_('K2_NOT_FOUND')); + return false; + } + + // Set title + $title = JText::_('K2_DISPLAYING_ITEMS_BY_TAG').' '.$tag->name; + + // Set ordering + $ordering = $params->get('tagOrdering'); + + $addHeadFeedLink = $params->get('tagFeedLink', 1); + + break; + + case 'search' : + // Set layout + $this->setLayout('generic'); + + // Set limit + $limit = $params->get('genericItemCount'); + + // Set title + $title = JText::_('K2_SEARCH_RESULTS_FOR').' '.JRequest::getVar('searchword'); + + $addHeadFeedLink = $params->get('genericFeedLink', 1); + + break; + + case 'date' : + // Set layout + $this->setLayout('generic'); + + // Set limit + $limit = $params->get('genericItemCount'); + + // Fix wrong timezone + if (function_exists('date_default_timezone_get')) + { + $originalTimezone = date_default_timezone_get(); + } + if (function_exists('date_default_timezone_set')) + { + date_default_timezone_set('UTC'); + } + + // Set title + if (JRequest::getInt('day')) + { + $date = strtotime(JRequest::getInt('year').'-'.JRequest::getInt('month').'-'.JRequest::getInt('day')); + $dateFormat = (K2_JVERSION == '15') ? '%A, %d %B %Y' : 'l, d F Y'; + $title = JText::_('K2_ITEMS_FILTERED_BY_DATE').' '.JHTML::_('date', $date, $dateFormat); + } + else + { + $date = strtotime(JRequest::getInt('year').'-'.JRequest::getInt('month')); + $dateFormat = (K2_JVERSION == '15') ? '%B %Y' : 'F Y'; + $title = JText::_('K2_ITEMS_FILTERED_BY_DATE').' '.JHTML::_('date', $date, $dateFormat); + } + + // Restore the original timezone + if (function_exists('date_default_timezone_set') && isset($originalTimezone)) + { + date_default_timezone_set($originalTimezone); + } + + // Set ordering + $ordering = 'rdate'; + + $addHeadFeedLink = $params->get('genericFeedLink', 1); + + break; + + default : + // Set layout + $this->setLayout('category'); + $user = JFactory::getUser(); + $this->assignRef('user', $user); + + // Set limit + $limit = $params->get('num_leading_items') + $params->get('num_primary_items') + $params->get('num_secondary_items') + $params->get('num_links'); + // Set featured flag + JRequest::setVar('featured', $params->get('catFeaturedItems')); + + // Set title + $title = $params->get('page_title'); + + // Set ordering + $ordering = $params->get('catOrdering'); + + $addHeadFeedLink = $params->get('catFeedLink', 1); + + break; + } + + // Set limit for model + if (!$limit) + $limit = 10; + JRequest::setVar('limit', $limit); + + // Get items + if (!isset($ordering)) + { + $items = $model->getData(); + } + else + { + $items = $model->getData($ordering); + } + + // If a user has no published items, do not display their K2 user page (in the frontend) and redirect to the homepage of the site. + $user = JFactory::getUser(); + $userPageDisplay = 0; + switch($params->get('profilePageDisplay', 0)) + { + case 1: + $userPageDisplay = 1; + break; + case 2: + if($user->id > 0) + { + $userPageDisplay = 1; + } + break; + } + if((count($items) == 0 && $task == 'user') && $userPageDisplay == 0) { + $application->redirect(JUri::root()); + } + + // Pagination + jimport('joomla.html.pagination'); + $total = count($items) ? $model->getTotal() : 0; + $pagination = new JPagination($total, $limitstart, $limit); + + //Prepare items + $cache = JFactory::getCache('com_k2_extended'); + $model = $this->getModel('item'); + + for ($i = 0; $i < sizeof($items); $i++) + { + + // Ensure that all items have a group. If an item with no group is found then assign to it the leading group + $items[$i]->itemGroup = 'leading'; + + //Item group + if ($task == "category" || $task == "") + { + if ($i < ($params->get('num_links') + $params->get('num_leading_items') + $params->get('num_primary_items') + $params->get('num_secondary_items'))) + $items[$i]->itemGroup = 'links'; + if ($i < ($params->get('num_secondary_items') + $params->get('num_leading_items') + $params->get('num_primary_items'))) + $items[$i]->itemGroup = 'secondary'; + if ($i < ($params->get('num_primary_items') + $params->get('num_leading_items'))) + $items[$i]->itemGroup = 'primary'; + if ($i < $params->get('num_leading_items')) + $items[$i]->itemGroup = 'leading'; + } + + // Check if the model should use the cache for preparing the item even if the user is logged in + if ($user->guest || $task == 'tag' || $task == 'search' || $task == 'date') + { + $cacheFlag = true; + } + else + { + $cacheFlag = true; + if (K2HelperPermissions::canEditItem($items[$i]->created_by, $items[$i]->catid)) + { + $cacheFlag = false; + } + } + + // Prepare item + if ($cacheFlag) + { + $hits = $items[$i]->hits; + $items[$i]->hits = 0; + JTable::getInstance('K2Category', 'Table'); + $items[$i] = $cache->call(array( + $model, + 'prepareItem' + ), $items[$i], $view, $task); + $items[$i]->hits = $hits; + } + else + { + $items[$i] = $model->prepareItem($items[$i], $view, $task); + } + + // Plugins + $items[$i] = $model->execPlugins($items[$i], $view, $task); + + // Trigger comments counter event if needed + if ($params->get('catItemK2Plugins') && + ($params->get('catItemCommentsAnchor') || + $params->get('itemCommentsAnchor') || + $params->get('itemComments'))) + { + // Trigger comments counter event + $dispatcher = JDispatcher::getInstance(); + JPluginHelper::importPlugin('k2'); + $results = $dispatcher->trigger('onK2CommentsCounter', array( + &$items[$i], + &$params, + $limitstart + )); + $items[$i]->event->K2CommentsCounter = trim(implode("\n", $results)); + } + } + + // Set title + $document = JFactory::getDocument(); + $application = JFactory::getApplication(); + $menus = $application->getMenu(); + $menu = $menus->getActive(); + if (is_object($menu)) + { + if (is_string($menu->params)) + { + $menu_params = K2_JVERSION == '15' ? new JParameter($menu->params) : new JRegistry($menu->params); + } + else + { + $menu_params = $menu->params; + } + if (!$menu_params->get('page_title')) + { + $params->set('page_title', $title); + } + } + else + { + $params->set('page_title', $title); + } + + // We're adding a new variable here which won't get the appended/prepended site title, + // when enabled via Joomla's SEO/SEF settings + $params->set('page_title_clean', $title); + + if (K2_JVERSION != '15') + { + if ($application->getCfg('sitename_pagetitles', 0) == 1) + { + $tmpTitle = JText::sprintf('JPAGETITLE', $application->getCfg('sitename'), $params->get('page_title')); + $params->set('page_title', $tmpTitle); + } + elseif ($application->getCfg('sitename_pagetitles', 0) == 2) + { + $tmpTitle = JText::sprintf('JPAGETITLE', $params->get('page_title'), $application->getCfg('sitename')); + $params->set('page_title', $tmpTitle); + } + } + $document->setTitle($params->get('page_title')); + + // Search - Update the Google Search results container + if ($task == 'search') + { + $googleSearchContainerID = trim($params->get('googleSearchContainer', 'k2GoogleSearchContainer')); + if ($googleSearchContainerID == 'k2Container') + { + $googleSearchContainerID = 'k2GoogleSearchContainer'; + } + $params->set('googleSearchContainer', $googleSearchContainerID); + } + + // Set metadata for category + if ($task == 'category') + { + if ($category->metaDescription) + { + $document->setDescription($category->metaDescription); + } + else + { + $metaDescItem = preg_replace("#{(.*?)}(.*?){/(.*?)}#s", '', $this->category->description); + $metaDescItem = strip_tags($metaDescItem); + $metaDescItem = K2HelperUtilities::characterLimit($metaDescItem, $params->get('metaDescLimit', 150)); + if (K2_JVERSION != '15') + { + $metaDescItem = html_entity_decode($metaDescItem); + } + $document->setDescription($metaDescItem); + } + if ($category->metaKeywords) + { + $document->setMetadata('keywords', $category->metaKeywords); + } + if ($category->metaRobots) + { + $document->setMetadata('robots', $category->metaRobots); + } + if ($category->metaAuthor) + { + $document->setMetadata('author', $category->metaAuthor); + } + } + + if (K2_JVERSION != '15') + { + + // Menu metadata options + if ($params->get('menu-meta_description')) + { + $document->setDescription($params->get('menu-meta_description')); + } + + if ($params->get('menu-meta_keywords')) + { + $document->setMetadata('keywords', $params->get('menu-meta_keywords')); + } + + if ($params->get('robots')) + { + $document->setMetadata('robots', $params->get('robots')); + } + + // Menu page display options + if ($params->get('page_heading')) + { + $params->set('page_title', $params->get('page_heading')); + } + $params->set('show_page_title', $params->get('show_page_heading')); + + } + + // Pathway + $pathway = $application->getPathWay(); + if (!isset($menu->query['task'])) + $menu->query['task'] = ''; + if ($menu) + { + switch ($task) + { + case 'category' : + if ($menu->query['task'] != 'category' || $menu->query['id'] != JRequest::getInt('id')) + $pathway->addItem($title, ''); + break; + case 'user' : + if ($menu->query['task'] != 'user' || $menu->query['id'] != JRequest::getInt('id')) + $pathway->addItem($title, ''); + break; + + case 'tag' : + if ($menu->query['task'] != 'tag' || $menu->query['tag'] != JRequest::getVar('tag')) + $pathway->addItem($title, ''); + break; + + case 'search' : + case 'date' : + $pathway->addItem($title, ''); + break; + } + } + + // Feed link + $config = JFactory::getConfig(); + $menu = $application->getMenu(); + $default = $menu->getDefault(); + $active = $menu->getActive(); + if ($task == 'tag') + { + $link = K2HelperRoute::getTagRoute(JRequest::getVar('tag')); + } + else + { + $link = ''; + } + $sef = K2_JVERSION == '30' ? $config->get('sef') : $config->getValue('config.sef'); + if (!is_null($active) && $active->id == $default->id && $sef) + { + $link .= '&Itemid='.$active->id.'&format=feed&limitstart='; + } + else + { + $link .= '&format=feed&limitstart='; + } + + $feed = JRoute::_($link); + $this->assignRef('feed', $feed); + + // Add head feed link + if ($addHeadFeedLink) + { + $attribs = array( + 'type' => 'application/rss+xml', + 'title' => 'RSS 2.0' + ); + $document->addHeadLink(JRoute::_($link.'&type=rss'), 'alternate', 'rel', $attribs); + $attribs = array( + 'type' => 'application/atom+xml', + 'title' => 'Atom 1.0' + ); + $document->addHeadLink(JRoute::_($link.'&type=atom'), 'alternate', 'rel', $attribs); + } + + // Assign data + if ($task == "category" || $task == "") + { + + // Leading items + $offset = 0; + $length = $params->get('num_leading_items'); + $leading = array_slice($items, $offset, $length); + + // Primary + $offset = (int)$params->get('num_leading_items'); + $length = (int)$params->get('num_primary_items'); + $primary = array_slice($items, $offset, $length); + + // Secondary + $offset = (int)($params->get('num_leading_items') + $params->get('num_primary_items')); + $length = (int)$params->get('num_secondary_items'); + $secondary = array_slice($items, $offset, $length); + + // Links + $offset = (int)($params->get('num_leading_items') + $params->get('num_primary_items') + $params->get('num_secondary_items')); + $length = (int)$params->get('num_links'); + $links = array_slice($items, $offset, $length); + + // Assign data + $this->assignRef('leading', $leading); + $this->assignRef('primary', $primary); + $this->assignRef('secondary', $secondary); + $this->assignRef('links', $links); + } + else + { + $this->assignRef('items', $items); + } + + // Set default values to avoid division by zero + if ($params->get('num_leading_columns') == 0) + $params->set('num_leading_columns', 1); + if ($params->get('num_primary_columns') == 0) + $params->set('num_primary_columns', 1); + if ($params->get('num_secondary_columns') == 0) + $params->set('num_secondary_columns', 1); + if ($params->get('num_links_columns') == 0) + $params->set('num_links_columns', 1); + + $this->assignRef('params', $params); + $this->assignRef('pagination', $pagination); + + // Set Facebook meta data + if($params->get('facebookMetatags', '1')) + { + $document = JFactory::getDocument(); + $uri = JURI::getInstance(); + $document->setMetaData('og:url', $uri->toString()); + $document->setMetaData('og:title', (K2_JVERSION == '15') ? htmlspecialchars($document->getTitle(), ENT_QUOTES, 'UTF-8') : $document->getTitle()); + $document->setMetaData('og:type', 'website'); + if ($task == 'category' && $this->category->image && strpos($this->category->image, 'placeholder/category.png') === false) + { + $image = substr(JURI::root(), 0, -1).str_replace(JURI::root(true), '', $this->category->image); + $document->setMetaData('og:image', $image); + $document->setMetaData('image', $image); + } + $document->setMetaData('og:description', strip_tags($document->getDescription())); + } + + + // Look for template files in component folders + $this->_addPath('template', JPATH_COMPONENT.'/templates'); + $this->_addPath('template', JPATH_COMPONENT.'/templates/default'); + + // Look for overrides in template folder (K2 template structure) + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/templates'); + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/templates/default'); + + // Look for overrides in template folder (Joomla template structure) + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/default'); + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2'); + + // Look for specific K2 theme files + if ($params->get('theme')) + { + $this->_addPath('template', JPATH_COMPONENT.'/templates/'.$params->get('theme')); + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/templates/'.$params->get('theme')); + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/'.$params->get('theme')); + } + + $nullDate = $db->getNullDate(); + $this->assignRef('nullDate', $nullDate); + $dispatcher = JDispatcher::getInstance(); + JPluginHelper::importPlugin('k2'); + $dispatcher->trigger('onK2BeforeViewDisplay'); + + parent::display($tpl); + } + +} diff --git a/deployed/k2/components/com_k2/views/itemlist/view.json.php b/deployed/k2/components/com_k2/views/itemlist/view.json.php new file mode 100644 index 00000000..9a68da69 --- /dev/null +++ b/deployed/k2/components/com_k2/views/itemlist/view.json.php @@ -0,0 +1,474 @@ +setMimeEncoding('application/json'); + $document->setType('json'); + } + $model = $this->getModel('itemlist'); + + //Set limit for model + $limit = JRequest::getInt('limit'); + if ($limit > 100 || $limit == 0) + { + $limit = 100; + JRequest::setVar('limit', $limit); + } + $page = JRequest::getInt('page'); + if ($page <= 0) + { + $limitstart = 0; + } + else + { + $page--; + $limitstart = $page * $limit; + } + JRequest::setVar('limitstart', $limitstart); + + $view = JRequest::getWord('view'); + $task = JRequest::getWord('task'); + + $response = new JObject(); + unset($response->_errors); + + // Site + $response->site = new stdClass(); + $uri = JURI::getInstance(); + $response->site->url = $uri->toString(array('scheme', 'host', 'port')); + $config = JFactory::getConfig(); + $response->site->name = K2_JVERSION == '30' ? $config->get('sitename') : $config->getValue('config.sitename'); + + $moduleID = JRequest::getInt('moduleID'); + if ($moduleID) + { + + $result = $model->getModuleItems($moduleID); + $items = $result->items; + $title = $result->title; + $prefix = 'cat'; + + } + else + { + + //Get data depending on task + switch ($task) + { + + case 'category' : + //Get category + $id = JRequest::getInt('id'); + JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.'/tables'); + $category = JTable::getInstance('K2Category', 'Table'); + $category->load($id); + + // State Check + if (!$category->published || $category->trash) + { + JError::raiseError(404, JText::_('K2_CATEGORY_NOT_FOUND')); + } + + //Access check + $user = JFactory::getUser(); + if (K2_JVERSION != '15') + { + if (!in_array($category->access, $user->getAuthorisedViewLevels())) + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + $languageFilter = $application->getLanguageFilter(); + $languageTag = JFactory::getLanguage()->getTag(); + if ($languageFilter && $category->language != $languageTag && $category->language != '*') + { + return; + } + } + else + { + if ($category->access > $user->get('aid', 0)) + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + } + } + + //Merge params + $cparams = class_exists('JParameter') ? new JParameter($category->params) : new JRegistry($category->params); + if ($cparams->get('inheritFrom')) + { + $masterCategory = JTable::getInstance('K2Category', 'Table'); + $masterCategory->load($cparams->get('inheritFrom')); + $cparams = class_exists('JParameter') ? new JParameter($masterCategory->params) : new JRegistry($masterCategory->params); + } + $params->merge($cparams); + + //Category link + $category->link = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($category->id.':'.urlencode($category->alias)))); + + //Category image + $category->image = K2HelperUtilities::getCategoryImage($category->image, $params); + + //Category plugins + $dispatcher = JDispatcher::getInstance(); + JPluginHelper::importPlugin('content'); + $category->text = $category->description; + + if (K2_JVERSION != '15') + { + $dispatcher->trigger('onContentPrepare', array('com_k2.category', &$category, &$params, $limitstart)); + } + else + { + $dispatcher->trigger('onPrepareContent', array(&$category, &$params, $limitstart)); + } + + $category->description = $category->text; + + //Category K2 plugins + $category->event = new stdClass; + $category->event->K2CategoryDisplay = ''; + JPluginHelper::importPlugin('k2'); + $results = $dispatcher->trigger('onK2CategoryDisplay', array(&$category, &$params, $limitstart)); + $category->event->K2CategoryDisplay = trim(implode("\n", $results)); + $category->text = $category->description; + $dispatcher->trigger('onK2PrepareContent', array(&$category, &$params, $limitstart)); + $category->description = $category->text; + + //Category children + $ordering = $params->get('subCatOrdering'); + $children = $model->getCategoryFirstChildren($id, $ordering); + $subCategories = array(); + if (count($children)) + { + foreach ($children as $child) + { + if ($params->get('subCatTitleItemCounter')) + { + $child->numOfItems = $model->countCategoryItems($child->id); + } + $child->image = K2HelperUtilities::getCategoryImage($child->image, $params); + $child->link = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($child->id.':'.urlencode($child->alias)))); + unset($child->params); + unset($child->access); + unset($child->published); + unset($child->trash); + unset($child->language); + $subCategories[] = $child; + } + } + + //Set featured flag + JRequest::setVar('featured', $params->get('catFeaturedItems')); + + //Set title + $title = $category->name; + + // Set ordering + if ($params->get('singleCatOrdering')) + { + $ordering = $params->get('singleCatOrdering'); + } + else + { + $ordering = $params->get('catOrdering'); + } + + // Set parameters prefix + $prefix = 'cat'; + // Prepare the JSON category object; + $row = new JObject(); + unset($row->_errors); + $row->id = $category->id; + $row->name = $category->name; + $row->alias = $category->alias; + $row->link = $category->link; + $row->parent = $category->parent; + $row->extraFieldsGroup = $category->extraFieldsGroup; + $row->image = $category->image; + $row->ordering = $category->ordering; + //$row->plugins = $category->plugins; + $row->events = $category->event; + $row->children = $subCategories; + $response->category = $row; + break; + + case 'user' : + //Get user + $id = JRequest::getInt('id'); + $userObject = JFactory::getUser($id); + + //Check user status + if ($userObject->block) + { + JError::raiseError(404, JText::_('K2_USER_NOT_FOUND')); + } + + //Get K2 user profile + $userObject->profile = $model->getUserProfile(); + + //User image + $userObject->avatar = K2HelperUtilities::getAvatar($userObject->id, $userObject->email, $params->get('userImageWidth')); + + //User K2 plugins + $userObject->event->K2UserDisplay = ''; + if (is_object($userObject->profile) && $userObject->profile->id > 0) + { + $dispatcher = JDispatcher::getInstance(); + JPluginHelper::importPlugin('k2'); + $results = $dispatcher->trigger('onK2UserDisplay', array(&$userObject->profile, &$params, $limitstart)); + $userObject->event->K2UserDisplay = trim(implode("\n", $results)); + $userObject->profile->url = htmlspecialchars($userObject->profile->url, ENT_QUOTES, 'UTF-8'); + + } + + //Set title + $title = $userObject->name; + + // Set ordering + $ordering = $params->get('userOrdering'); + + // Set parameters prefix + $prefix = 'user'; + // Prepare the JSON user object; + $row = new JObject(); + unset($row->_errors); + //$row->id = $userObject->id; + $row->name = $userObject->name; + //$row->username = $userObject->username; + if (isset($userObject->profile->plugins)) + { + unset($userObject->profile->plugins); + } + $row->profile = $userObject->profile; + $row->avatar = $userObject->avatar; + $row->events = $userObject->event; + $response->user = $row; + break; + + case 'tag' : + //Set limit + $limit = $params->get('tagItemCount'); + + //set title + $title = JText::_('K2_DISPLAYING_ITEMS_BY_TAG').' '.JRequest::getVar('tag'); + + // Set ordering + $ordering = $params->get('tagOrdering'); + + // Set parameters prefix + $prefix = 'tag'; + $response->tag = JRequest::getVar('tag'); + break; + + case 'search' : + + //Set title + $title = JText::_('K2_SEARCH_RESULTS_FOR').' '.JRequest::getVar('searchword'); + + // Set parameters prefix + $prefix = 'generic'; + $response->search = JRequest::getVar('searchword'); + break; + + case 'date' : + + // Set title + if (JRequest::getInt('day')) + { + $date = strtotime(JRequest::getInt('year').'-'.JRequest::getInt('month').'-'.JRequest::getInt('day')); + $dateFormat = (K2_JVERSION == '15') ? '%A, %d %B %Y' : 'l, d F Y'; + $title = JText::_('K2_ITEMS_FILTERED_BY_DATE').' '.JHTML::_('date', $date, $dateFormat); + } + else + { + $date = strtotime(JRequest::getInt('year').'-'.JRequest::getInt('month')); + $dateFormat = (K2_JVERSION == '15') ? '%B %Y' : 'F Y'; + $title = JText::_('K2_ITEMS_FILTERED_BY_DATE').' '.JHTML::_('date', $date, $dateFormat); + } + // Set ordering + $ordering = 'rdate'; + + // Set parameters prefix + $prefix = 'generic'; + $response->date = JHTML::_('date', $date, $dateFormat); + break; + + default : + $user = JFactory::getUser(); + + //Set limit + $limit = $params->get('num_leading_items') + $params->get('num_primary_items') + $params->get('num_secondary_items') + $params->get('num_links'); + //Set featured flag + JRequest::setVar('featured', $params->get('catFeaturedItems')); + + //Set title + $title = $params->get('page_title'); + + // Set ordering + $ordering = $params->get('catOrdering'); + + // Set parameters prefix + $prefix = 'cat'; + + break; + } + + if (!isset($ordering)) + { + $items = $model->getData(); + } + else + { + $items = $model->getData($ordering); + } + + } + + //Prepare items + $user = JFactory::getUser(); + $cache = JFactory::getCache('com_k2_extended'); + $model = $this->getModel('item'); + $rows = array(); + for ($i = 0; $i < sizeof($items); $i++) + { + + //Item group + if ($task == "category" || $task == "") + { + $items[$i]->itemGroup = 'links'; + + if ($i < ($params->get('num_links') + $params->get('num_leading_items') + $params->get('num_primary_items') + $params->get('num_secondary_items'))) + $items[$i]->itemGroup = 'links'; + if ($i < ($params->get('num_secondary_items') + $params->get('num_leading_items') + $params->get('num_primary_items'))) + $items[$i]->itemGroup = 'secondary'; + if ($i < ($params->get('num_primary_items') + $params->get('num_leading_items'))) + $items[$i]->itemGroup = 'primary'; + if ($i < $params->get('num_leading_items')) + $items[$i]->itemGroup = 'leading'; + } + else + { + $items[$i]->itemGroup = ''; + } + + $itemParams = class_exists('JParameter') ? new JParameter($items[$i]->params) : new JRegistry($items[$i]->params); + $itemParams->set($prefix.'ItemIntroText', true); + $itemParams->set($prefix.'ItemFullText', true); + $itemParams->set($prefix.'ItemTags', true); + $itemParams->set($prefix.'ItemExtraFields', true); + $itemParams->set($prefix.'ItemAttachments', true); + $itemParams->set($prefix.'ItemRating', true); + $itemParams->set($prefix.'ItemAuthor', true); + $itemParams->set($prefix.'ItemImageGallery', true); + $itemParams->set($prefix.'ItemVideo', true); + $itemParams->set($prefix.'ItemImage', true); + $items[$i]->params = $itemParams->toString(); + + //Check if model should use cache for preparing item even if user is logged in + if ($user->guest || $task == 'tag' || $task == 'search' || $task == 'date') + { + $cacheFlag = true; + } + else + { + $cacheFlag = true; + if (K2HelperPermissions::canEditItem($items[$i]->created_by, $items[$i]->catid)) + { + $cacheFlag = false; + } + } + + //Prepare item + if ($cacheFlag) + { + $hits = $items[$i]->hits; + $items[$i]->hits = 0; + JTable::getInstance('K2Category', 'Table'); + $items[$i] = $cache->call(array($model, 'prepareItem'), $items[$i], $view, $task); + $items[$i]->hits = $hits; + } + else + { + $items[$i] = $model->prepareItem($items[$i], $view, $task); + } + + //Plugins + $items[$i] = $model->execPlugins($items[$i], $view, $task); + + //Trigger comments counter event + $dispatcher = JDispatcher::getInstance(); + JPluginHelper::importPlugin('k2'); + $results = $dispatcher->trigger('onK2CommentsCounter', array(&$items[$i], &$params, $limitstart)); + $items[$i]->event->K2CommentsCounter = trim(implode("\n", $results)); + + // Set default image + if ($task == 'user' || $task == 'tag' || $task == 'search' || $task == 'date') + { + $items[$i]->image = (isset($items[$i]->imageGeneric)) ? $items[$i]->imageGeneric : ''; + } + else + { + if (!$moduleID) + { + K2HelperUtilities::setDefaultImage($items[$i], $view, $params); + + } + } + + $rows[] = $model->prepareJSONItem($items[$i]); + + } + + $response->items = $rows; + + // Prevent spammers from using the tag view + if ($task == 'tag' && !count($response->items)) + { + $tag = JRequest::getString('tag'); + $db = JFactory::getDbo(); + $db->setQuery('SELECT id FROM #__k2_tags WHERE name = '.$db->quote($tag)); + $tagID = $db->loadResult(); + if (!$tagID) + { + JError::raiseError(404, JText::_('K2_NOT_FOUND')); + return false; + } + } + + // Output + $json = json_encode($response); + $callback = JRequest::getCmd('callback'); + if ($callback) + { + $document->setMimeEncoding('application/javascript'); + echo $callback.'('.$json.')'; + } + else + { + echo $json; + } + + } + +} diff --git a/deployed/k2/components/com_k2/views/itemlist/view.raw.php b/deployed/k2/components/com_k2/views/itemlist/view.raw.php new file mode 100644 index 00000000..9dd739dc --- /dev/null +++ b/deployed/k2/components/com_k2/views/itemlist/view.raw.php @@ -0,0 +1,505 @@ +getModel('itemlist'); + $limitstart = JRequest::getInt('limitstart'); + $view = JRequest::getWord('view'); + $task = JRequest::getWord('task'); + + //Add link + if (K2HelperPermissions::canAddItem()) + $addLink = JRoute::_('index.php?option=com_k2&view=item&task=add&tmpl=component'); + $this->assignRef('addLink', $addLink); + + //Get data depending on task + switch ($task) + { + + case 'category' : + //Get category + $id = JRequest::getInt('id'); + JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.'/tables'); + $category = JTable::getInstance('K2Category', 'Table'); + $category->load($id); + + // State Check + if (!$category->published || $category->trash) + { + JError::raiseError(404, JText::_('K2_CATEGORY_NOT_FOUND')); + } + + //Access check + $user = JFactory::getUser(); + if (K2_JVERSION != '15') + { + if (!in_array($category->access, $user->getAuthorisedViewLevels())) + { + if ($user->guest) + { + $uri = JFactory::getURI(); + $url = 'index.php?option=com_user&view=login&return='.base64_encode($uri->toString()); + $application->enqueueMessage(JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'), 'notice'); + $application->redirect(JRoute::_($url, false)); + } + else + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + return; + } + } + $languageFilter = $application->getLanguageFilter(); + $languageTag = JFactory::getLanguage()->getTag(); + if ($languageFilter && $category->language != $languageTag && $category->language != '*') + { + return; + } + } + else + { + if ($category->access > $user->get('aid', 0)) + { + if ($user->guest) + { + $uri = JFactory::getURI(); + $url = 'index.php?option=com_user&view=login&return='.base64_encode($uri->toString()); + $application->enqueueMessage(JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'), 'notice'); + $application->redirect(JRoute::_($url, false)); + } + else + { + JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); + return; + } + } + } + + // Hide the add new item link if user cannot post in the specific category + if (!K2HelperPermissions::canAddItem($id)) + { + unset($this->addLink); + } + + //Merge params + $cparams = class_exists('JParameter') ? new JParameter($category->params) : new JRegistry($category->params); + if ($cparams->get('inheritFrom')) + { + $masterCategory = JTable::getInstance('K2Category', 'Table'); + $masterCategory->load($cparams->get('inheritFrom')); + $cparams = class_exists('JParameter') ? new JParameter($masterCategory->params) : new JRegistry($masterCategory->params); + } + $params->merge($cparams); + + //Category link + $category->link = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($category->id.':'.urlencode($category->alias)))); + + //Category image + $category->image = K2HelperUtilities::getCategoryImage($category->image, $params); + + //Category plugins + $dispatcher = JDispatcher::getInstance(); + JPluginHelper::importPlugin('content'); + $category->text = $category->description; + + if (K2_JVERSION != '15') + { + $dispatcher->trigger('onContentPrepare', array('com_k2.category', &$category, &$params, $limitstart)); + } + else + { + $dispatcher->trigger('onPrepareContent', array(&$category, &$params, $limitstart)); + } + + $category->description = $category->text; + + //Category K2 plugins + $category->event->K2CategoryDisplay = ''; + JPluginHelper::importPlugin('k2'); + $results = $dispatcher->trigger('onK2CategoryDisplay', array(&$category, &$params, $limitstart)); + $category->event->K2CategoryDisplay = trim(implode("\n", $results)); + $category->text = $category->description; + $dispatcher->trigger('onK2PrepareContent', array(&$category, &$params, $limitstart)); + $category->description = $category->text; + + $this->assignRef('category', $category); + $this->assignRef('user', $user); + + //Category children + $ordering = $params->get('subCatOrdering'); + $children = $model->getCategoryFirstChildren($id, $ordering); + if (count($children)) + { + foreach ($children as $child) + { + if ($params->get('subCatTitleItemCounter')) + { + $child->numOfItems = $model->countCategoryItems($child->id); + } + $child->image = K2HelperUtilities::getCategoryImage($child->image, $params); + $child->link = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($child->id.':'.urlencode($child->alias)))); + $subCategories[] = $child; + } + $this->assignRef('subCategories', $subCategories); + } + + //Set limit + $limit = $params->get('num_leading_items') + $params->get('num_primary_items') + $params->get('num_secondary_items') + $params->get('num_links'); + + //Set featured flag + JRequest::setVar('featured', $params->get('catFeaturedItems')); + + //Set layout + $this->setLayout('category'); + + //Set title + $title = $category->name; + + // Set ordering + if ($params->get('singleCatOrdering')) + { + $ordering = $params->get('singleCatOrdering'); + } + else + { + $ordering = $params->get('catOrdering'); + } + + break; + + case 'user' : + //Get user + $id = JRequest::getInt('id'); + $userObject = JFactory::getUser($id); + + //Check user status + if ($userObject->block) + { + JError::raiseError(404, JText::_('K2_USER_NOT_FOUND')); + } + + //Get K2 user profile + $userObject->profile = $model->getUserProfile(); + + //User image + $userObject->avatar = K2HelperUtilities::getAvatar($userObject->id, $userObject->email, $params->get('userImageWidth')); + + //User K2 plugins + $userObject->event->K2UserDisplay = ''; + if (is_object($userObject->profile) && $userObject->profile->id > 0) + { + + $dispatcher = JDispatcher::getInstance(); + JPluginHelper::importPlugin('k2'); + $results = $dispatcher->trigger('onK2UserDisplay', array(&$userObject->profile, &$params, $limitstart)); + $userObject->event->K2UserDisplay = trim(implode("\n", $results)); + $userObject->profile->url = htmlspecialchars($userObject->profile->url, ENT_QUOTES, 'UTF-8'); + + } + + $this->assignRef('user', $userObject); + + //Set layout + $this->setLayout('user'); + + //Set limit + $limit = $params->get('userItemCount'); + + //Set title + $title = $userObject->name; + + // Set ordering + $ordering = $params->get('userOrdering'); + + break; + + case 'tag' : + //Set layout + $this->setLayout('tag'); + + //Set limit + $limit = $params->get('tagItemCount'); + + // Prevent spammers from using the tag view + $tag = JRequest::getString('tag'); + $db = JFactory::getDbo(); + $db->setQuery('SELECT id, name FROM #__k2_tags WHERE name = '.$db->quote($tag)); + $tag = $db->loadObject(); + if (!$tag->id) + { + JError::raiseError(404, JText::_('K2_NOT_FOUND')); + return false; + } + + //set title + $title = JText::_('K2_DISPLAYING_ITEMS_BY_TAG').' '.$tag->name; + + // Set ordering + $ordering = $params->get('tagOrdering'); + break; + + case 'search' : + //Set layout + $this->setLayout('generic'); + $tpl = JRequest::getCmd('tpl', null); + + //Set limit + $limit = $params->get('genericItemCount'); + + //Set title + $title = JText::_('K2_SEARCH_RESULTS_FOR').' '.JRequest::getVar('searchword'); + break; + + case 'date' : + //Set layout + $this->setLayout('generic'); + + //Set limit + $limit = $params->get('genericItemCount'); + + // Set title + if (JRequest::getInt('day')) + { + $date = strtotime(JRequest::getInt('year').'-'.JRequest::getInt('month').'-'.JRequest::getInt('day')); + $dateFormat = (K2_JVERSION == '15') ? '%A, %d %B %Y' : 'l, d F Y'; + $title = JText::_('K2_ITEMS_FILTERED_BY_DATE').' '.JHTML::_('date', $date, $dateFormat); + } + else + { + $date = strtotime(JRequest::getInt('year').'-'.JRequest::getInt('month')); + $dateFormat = (K2_JVERSION == '15') ? '%B %Y' : 'F Y'; + $title = JText::_('K2_ITEMS_FILTERED_BY_DATE').' '.JHTML::_('date', $date, $dateFormat); + } + // Set ordering + $ordering = 'rdate'; + break; + + default : + //Set layout + $this->setLayout('category'); + $user = JFactory::getUser(); + $this->assignRef('user', $user); + + //Set limit + $limit = $params->get('num_leading_items') + $params->get('num_primary_items') + $params->get('num_secondary_items') + $params->get('num_links'); + //Set featured flag + JRequest::setVar('featured', $params->get('catFeaturedItems')); + + //Set title + $title = $params->get('page_title'); + + // Set ordering + $ordering = $params->get('catOrdering'); + + break; + } + + //Set limit for model + JRequest::setVar('limit', $limit); + + if (!isset($ordering)) + { + $items = $model->getData(); + } + else + { + $items = $model->getData($ordering); + } + + //Pagination + jimport('joomla.html.pagination'); + $total = count($items) ? $model->getTotal() : 0; + $pagination = new JPagination($total, $limitstart, $limit); + + //Prepare items + $user = JFactory::getUser(); + $cache = JFactory::getCache('com_k2_extended'); + $model = $this->getModel('item'); + for ($i = 0; $i < sizeof($items); $i++) + { + + //Item group + if ($task == "category" || $task == "") + { + if ($i < ($params->get('num_links') + $params->get('num_leading_items') + $params->get('num_primary_items') + $params->get('num_secondary_items'))) + $items[$i]->itemGroup = 'links'; + if ($i < ($params->get('num_secondary_items') + $params->get('num_leading_items') + $params->get('num_primary_items'))) + $items[$i]->itemGroup = 'secondary'; + if ($i < ($params->get('num_primary_items') + $params->get('num_leading_items'))) + $items[$i]->itemGroup = 'primary'; + if ($i < $params->get('num_leading_items')) + $items[$i]->itemGroup = 'leading'; + } + + //Check if model should use cache for preparing item even if user is logged in + if ($user->guest || $task == 'tag' || $task == 'search' || $task == 'date') + { + $cacheFlag = true; + } + else + { + $cacheFlag = true; + if (K2HelperPermissions::canEditItem($items[$i]->created_by, $items[$i]->catid)) + { + $cacheFlag = false; + } + } + + //Prepare item + if ($cacheFlag) + { + $hits = $items[$i]->hits; + $items[$i]->hits = 0; + JTable::getInstance('K2Category', 'Table'); + $items[$i] = $cache->call(array($model, 'prepareItem'), $items[$i], $view, $task); + $items[$i]->hits = $hits; + } + else + { + $items[$i] = $model->prepareItem($items[$i], $view, $task); + } + + //Plugins + $items[$i] = $model->execPlugins($items[$i], $view, $task); + + //Trigger comments counter event + $dispatcher = JDispatcher::getInstance(); + JPluginHelper::importPlugin('k2'); + $results = $dispatcher->trigger('onK2CommentsCounter', array(&$items[$i], &$params, $limitstart)); + $items[$i]->event->K2CommentsCounter = trim(implode("\n", $results)); + + } + + //Pathway + $pathway = $application->getPathWay(); + $pathway->addItem($title); + + //Feed link + $config = JFactory::getConfig(); + $menu = $application->getMenu(); + $default = $menu->getDefault(); + $active = $menu->getActive(); + if ($task == 'tag') + { + $link = K2HelperRoute::getTagRoute(JRequest::getVar('tag')); + } + else + { + $link = ''; + } + $sef = K2_JVERSION == '30' ? $config->get('sef') : $config->getValue('config.sef'); + if (!is_null($active) && $active->id == $default->id && $sef) + { + $link .= '&Itemid='.$active->id.'&format=feed&limitstart='; + } + else + { + $link .= '&format=feed&limitstart='; + } + + $feed = JRoute::_($link); + $this->assignRef('feed', $feed); + + //Assign data + if ($task == "category" || $task == "") + { + $leading = @array_slice($items, 0, $params->get('num_leading_items')); + $primary = @array_slice($items, $params->get('num_leading_items'), $params->get('num_primary_items')); + $secondary = @array_slice($items, $params->get('num_leading_items') + $params->get('num_primary_items'), $params->get('num_secondary_items')); + $links = @array_slice($items, $params->get('num_leading_items') + $params->get('num_primary_items') + $params->get('num_secondary_items'), $params->get('num_links')); + $this->assignRef('leading', $leading); + $this->assignRef('primary', $primary); + $this->assignRef('secondary', $secondary); + $this->assignRef('links', $links); + } + else + { + $this->assignRef('items', $items); + } + + //Set default values to avoid division by zero + if ($params->get('num_leading_columns') == 0) + $params->set('num_leading_columns', 1); + if ($params->get('num_primary_columns') == 0) + $params->set('num_primary_columns', 1); + if ($params->get('num_secondary_columns') == 0) + $params->set('num_secondary_columns', 1); + if ($params->get('num_links_columns') == 0) + $params->set('num_links_columns', 1); + + $this->assignRef('params', $params); + $this->assignRef('pagination', $pagination); + + //Look for template files in component folders + $this->_addPath('template', JPATH_COMPONENT.'/templates'); + $this->_addPath('template', JPATH_COMPONENT.'/templates/default'); + + //Look for overrides in template folder (K2 template structure) + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/templates'); + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/templates/default'); + + //Look for overrides in template folder (Joomla template structure) + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/default'); + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2'); + + //Look for specific K2 theme files + if ($params->get('theme')) + { + $this->_addPath('template', JPATH_COMPONENT.'/templates/'.$params->get('theme')); + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/templates/'.$params->get('theme')); + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/'.$params->get('theme')); + } + + $db = JFactory::getDbo(); + $nullDate = $db->getNullDate(); + $this->assignRef('nullDate', $nullDate); + + parent::display($tpl); + } + + function module() + { + jimport('joomla.application.module.helper'); + $application = JFactory::getApplication(); + $moduleID = JRequest::getInt('moduleID'); + $model = K2Model::getInstance('Itemlist', 'K2Model'); + if ($moduleID) + { + $result = $model->getModuleItems($moduleID); + $items = $result->items; + $componentParams = JComponentHelper::getParams('com_k2'); + if (is_string($result->params)) + { + $params = class_exists('JParameter') ? new JParameter($result->params) : new JRegistry($result->params); + } + else + { + $params = $result->params; + } + + if ($params->get('getTemplate')) + require(JModuleHelper::getLayoutPath('mod_k2_content', $params->get('getTemplate').'/default')); + else + require(JModuleHelper::getLayoutPath($result->module, 'default')); + } + $application->close(); + } + +} diff --git a/deployed/k2/components/com_k2/views/latest/metadata.xml b/deployed/k2/components/com_k2/views/latest/metadata.xml new file mode 100644 index 00000000..e23c35f0 --- /dev/null +++ b/deployed/k2/components/com_k2/views/latest/metadata.xml @@ -0,0 +1,6 @@ + + + + K2_CREATE_A_MENU_ITEM_LINKING_TO_A_GRID_PAGE_WITH_THE_LATEST_ITEMS_FROM_SPECIFIC_CATEGORIES_OR_USERS_IN_K2 + + diff --git a/deployed/k2/components/com_k2/views/latest/tmpl/latest.php b/deployed/k2/components/com_k2/views/latest/tmpl/latest.php new file mode 100644 index 00000000..486c09cf --- /dev/null +++ b/deployed/k2/components/com_k2/views/latest/tmpl/latest.php @@ -0,0 +1,13 @@ + diff --git a/deployed/k2/components/com_k2/views/latest/tmpl/latest.xml b/deployed/k2/components/com_k2/views/latest/tmpl/latest.xml new file mode 100644 index 00000000..53e24e5d --- /dev/null +++ b/deployed/k2/components/com_k2/views/latest/tmpl/latest.xml @@ -0,0 +1,260 @@ + + + + + + + + + K2_LATEST_ITEMS_FROM_ONE_OR_MORE_USERS_OR_CATEGORIES + K2_CREATE_A_MENU_ITEM_LINKING_TO_A_GRID_PAGE_WITH_THE_LATEST_ITEMS_FROM_SPECIFIC_CATEGORIES_OR_USERS_IN_K2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        +
        +
        +
        diff --git a/deployed/k2/components/com_k2/views/latest/tmpl/latest_item.php b/deployed/k2/components/com_k2/views/latest/tmpl/latest_item.php new file mode 100644 index 00000000..486c09cf --- /dev/null +++ b/deployed/k2/components/com_k2/views/latest/tmpl/latest_item.php @@ -0,0 +1,13 @@ + diff --git a/deployed/k2/components/com_k2/views/latest/view.html.php b/deployed/k2/components/com_k2/views/latest/view.html.php new file mode 100644 index 00000000..4c1c1cf1 --- /dev/null +++ b/deployed/k2/components/com_k2/views/latest/view.html.php @@ -0,0 +1,313 @@ +get('latestItemsLimit'); + $limitstart = JRequest::getInt('limitstart'); + $model = $this->getModel('itemlist'); + $itemModel = $this->getModel('item'); + $theme = $params->get('theme'); + + if ($params->get('source')) + { + $categoryIDs = $params->get('categoryIDs'); + if (is_string($categoryIDs) && !empty($categoryIDs)) + { + $categoryIDs = array(); + $categoryIDs[] = $params->get('categoryIDs'); + } + $categories = array(); + JTable::addIncludePath(JPATH_ADMINISTRATOR.'/components/com_k2/tables'); + if (is_array($categoryIDs)) + { + foreach ($categoryIDs as $categoryID) + { + $category = JTable::getInstance('K2Category', 'Table'); + $category->load($categoryID); + $category->event = new stdClass; + $languageCheck = true; + if (K2_JVERSION != '15') + { + $accessCheck = in_array($category->access, $user->getAuthorisedViewLevels()); + if ($application->getLanguageFilter()) + { + $languageTag = JFactory::getLanguage()->getTag(); + $languageCheck = in_array($category->language, array($languageTag, '*')); + } + } + else + { + $accessCheck = $category->access <= $user->get('aid', 0); + } + + if ($category->published && $accessCheck && $languageCheck) + { + + //Merge params + $cparams = class_exists('JParameter') ? new JParameter($category->params) : new JRegistry($category->params); + if ($cparams->get('inheritFrom')) + { + $masterCategory = JTable::getInstance('K2Category', 'Table'); + $masterCategory->load($cparams->get('inheritFrom')); + $cparams = class_exists('JParameter') ? new JParameter($masterCategory->params) : new JRegistry($masterCategory->params); + } + $params->merge($cparams); + + //Category image + $category->image = K2HelperUtilities::getCategoryImage($category->image, $params); + + //Category plugins + $dispatcher = JDispatcher::getInstance(); + JPluginHelper::importPlugin('content'); + $category->text = $category->description; + + if (K2_JVERSION != '15') + { + $dispatcher->trigger('onContentPrepare', array('com_k2.category', &$category, &$params, $limitstart)); + } + else + { + $dispatcher->trigger('onPrepareContent', array(&$category, &$params, $limitstart)); + } + $category->description = $category->text; + + //Category K2 plugins + $category->event->K2CategoryDisplay = ''; + JPluginHelper::importPlugin('k2'); + $results = $dispatcher->trigger('onK2CategoryDisplay', array(&$category, &$params, $limitstart)); + $category->event->K2CategoryDisplay = trim(implode("\n", $results)); + $category->text = $category->description; + $dispatcher->trigger('onK2PrepareContent', array(&$category, &$params, $limitstart)); + $category->description = $category->text; + + //Category link + $link = urldecode(K2HelperRoute::getCategoryRoute($category->id.':'.urlencode($category->alias))); + $category->link = JRoute::_($link); + $category->feed = JRoute::_($link.'&format=feed'); + + JRequest::setVar('view', 'itemlist'); + JRequest::setVar('task', 'category'); + JRequest::setVar('id', $category->id); + JRequest::setVar('featured', 1); + JRequest::setVar('limit', $limit); + JRequest::setVar('clearFlag', true); + + $category->name = htmlspecialchars($category->name, ENT_QUOTES); + if ($limit) + { + $category->items = $model->getData('rdate'); + + JRequest::setVar('view', 'latest'); + JRequest::setVar('task', ''); + + for ($i = 0; $i < sizeof($category->items); $i++) + { + + $hits = $category->items[$i]->hits; + $category->items[$i]->hits = 0; + $category->items[$i] = $cache->call(array($itemModel, 'prepareItem'), $category->items[$i], 'latest', ''); + $category->items[$i]->hits = $hits; + $category->items[$i] = $itemModel->execPlugins($category->items[$i], 'latest', ''); + + //Trigger comments counter event + $dispatcher = JDispatcher::getInstance(); + JPluginHelper::importPlugin('k2'); + $results = $dispatcher->trigger('onK2CommentsCounter', array(&$category->items[$i], &$params, $limitstart)); + $category->items[$i]->event->K2CommentsCounter = trim(implode("\n", $results)); + + } + } + else + { + $category->items = array(); + } + $categories[] = $category; + } + + } + } + $source = 'categories'; + $this->assignRef('blocks', $categories); + + } + else + { + + $usersIDs = $params->get('userIDs'); + if (is_string($usersIDs) && !empty($usersIDs)) + { + $usersIDs = array(); + $usersIDs[] = $params->get('userIDs'); + } + + $users = array(); + if (is_array($usersIDs)) + { + foreach ($usersIDs as $userID) + { + + $userObject = JFactory::getUser($userID); + if (!$userObject->block) + { + $userObject->event = new stdClass; + + //User profile + $userObject->profile = $model->getUserProfile($userID); + + //User image + $userObject->avatar = K2HelperUtilities::getAvatar($userObject->id, $userObject->email, $params->get('userImageWidth')); + + //User K2 plugins + $userObject->event->K2UserDisplay = ''; + if (is_object($userObject->profile) && $userObject->profile->id > 0) + { + $dispatcher = JDispatcher::getInstance(); + JPluginHelper::importPlugin('k2'); + $results = $dispatcher->trigger('onK2UserDisplay', array(&$userObject->profile, &$params, $limitstart)); + $userObject->event->K2UserDisplay = trim(implode("\n", $results)); + $userObject->profile->url = htmlspecialchars($userObject->profile->url, ENT_QUOTES, 'UTF-8'); + } + + $link = K2HelperRoute::getUserRoute($userObject->id); + $userObject->link = JRoute::_($link); + $userObject->feed = JRoute::_($link.'&format=feed'); + $userObject->name = htmlspecialchars($userObject->name, ENT_QUOTES); + if ($limit) + { + $userObject->items = $model->getAuthorLatest(0, $limit, $userID); + + for ($i = 0; $i < sizeof($userObject->items); $i++) + { + $hits = $userObject->items[$i]->hits; + $userObject->items[$i]->hits = 0; + $userObject->items[$i] = $cache->call(array($itemModel, 'prepareItem'), $userObject->items[$i], 'latest', ''); + $userObject->items[$i]->hits = $hits; + + //Plugins + $userObject->items[$i] = $itemModel->execPlugins($userObject->items[$i], 'latest', ''); + + //Trigger comments counter event + $dispatcher = JDispatcher::getInstance(); + JPluginHelper::importPlugin('k2'); + $results = $dispatcher->trigger('onK2CommentsCounter', array(&$userObject->items[$i], &$params, $limitstart)); + $userObject->items[$i]->event->K2CommentsCounter = trim(implode("\n", $results)); + } + } + else + { + $userObject->items = array(); + } + $users[] = $userObject; + } + + } + } + $source = 'users'; + $this->assignRef('blocks', $users); + } + + // Browser title + $browserTitle = $params->get('page_title'); + if (K2_JVERSION != '15') + { + if ($application->getCfg('sitename_pagetitles', 0) == 1) + { + $browserTitle = JText::sprintf('JPAGETITLE', $application->getCfg('sitename'), $params->get('page_title')); + } + elseif ($application->getCfg('sitename_pagetitles', 0) == 2) + { + $browserTitle = JText::sprintf('JPAGETITLE', $params->get('page_title'), $application->getCfg('sitename')); + } + } + $document->setTitle($browserTitle); + + + // Set menu metadata for Joomla 2.5+ + if (K2_JVERSION != '15') + { + if ($params->get('menu-meta_description')) + { + $document->setDescription($params->get('menu-meta_description')); + } + + if ($params->get('menu-meta_keywords')) + { + $document->setMetadata('keywords', $params->get('menu-meta_keywords')); + } + + if ($params->get('robots')) + { + $document->setMetadata('robots', $params->get('robots')); + } + + // Menu page display options + if ($params->get('page_heading')) + { + $params->set('page_title', $params->get('page_heading')); + } + $params->set('show_page_title', $params->get('show_page_heading')); + } + + // Set Facebook meta data + if($params->get('facebookMetatags', '1')) + { + $document = JFactory::getDocument(); + $uri = JURI::getInstance(); + $document->setMetaData('og:url', $uri->toString()); + $document->setMetaData('og:title', (K2_JVERSION == '15') ? htmlspecialchars($document->getTitle(), ENT_QUOTES, 'UTF-8') : $document->getTitle()); + $document->setMetaData('og:type', 'website'); + $document->setMetaData('og:description', strip_tags($document->getDescription())); + } + + //Look for template files in component folders + $this->_addPath('template', JPATH_COMPONENT.'/templates'); + $this->_addPath('template', JPATH_COMPONENT.'/templates/default'); + + //Look for overrides in template folder (K2 template structure) + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/templates'); + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/templates/default'); + + //Look for overrides in template folder (Joomla template structure) + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/default'); + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2'); + + // Look for specific K2 theme files + if ($theme) + { + $this->_addPath('template', JPATH_COMPONENT.'/templates/'.$theme); + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/templates/'.$theme); + $this->_addPath('template', JPATH_SITE.'/templates/'.$application->getTemplate().'/html/com_k2/'.$theme); + } + + //Assign params + $this->assignRef('params', $params); + $this->assignRef('source', $source); + + //Set layout + $this->setLayout('latest'); + + //Display + parent::display($tpl); + } + +} diff --git a/deployed/k2/media/k2/assets/css/elfinder.min.css b/deployed/k2/media/k2/assets/css/elfinder.min.css new file mode 100644 index 00000000..9e20923a --- /dev/null +++ b/deployed/k2/media/k2/assets/css/elfinder.min.css @@ -0,0 +1,9 @@ +/*! + * elFinder - file manager for web + * Version 2.0 rc1 (2012-04-10) + * http://elfinder.org + * + * Copyright 2009-2012, Studio 42 + * Licensed under a 3 clauses BSD license + */ +.elfinder-dialog-resize{margin-top:.3em}.elfinder-resize-type{float:left;margin-bottom:.4em}.elfinder-resize-control{padding-top:3em}.elfinder-resize-control input[type=text]{border:1px solid #aaa;text-align:right}.elfinder-resize-preview{width:400px;height:400px;padding:10px;background:#fff;border:1px solid #aaa;float:right;position:relative;overflow:auto}.elfinder-resize-handle{position:relative}.elfinder-resize-handle-hline,.elfinder-resize-handle-vline{position:absolute;background-image:url("../images/elfinder/crop.gif")}.elfinder-resize-handle-hline{width:100%;height:1px!important;background-repeat:repeat-x}.elfinder-resize-handle-vline{width:1px!important;height:100%;background-repeat:repeat-y}.elfinder-resize-handle-hline-top{top:0;left:0}.elfinder-resize-handle-hline-bottom{bottom:0;left:0}.elfinder-resize-handle-vline-left{top:0;left:0}.elfinder-resize-handle-vline-right{top:0;right:0}.elfinder-resize-handle-point{position:absolute;width:8px;height:8px;border:1px solid #777;background:0 0}.elfinder-resize-handle-point-n{top:0;left:50%;margin-top:-5px;margin-left:-5px}.elfinder-resize-handle-point-ne{top:0;right:0;margin-top:-5px;margin-right:-5px}.elfinder-resize-handle-point-e{top:50%;right:0;margin-top:-5px;margin-right:-5px}.elfinder-resize-handle-point-se{bottom:0;right:0;margin-bottom:-5px;margin-right:-5px}.elfinder-resize-handle-point-s{bottom:0;left:50%;margin-bottom:-5px;margin-left:-5px}.elfinder-resize-handle-point-sw{bottom:0;left:0;margin-bottom:-5px;margin-left:-5px}.elfinder-resize-handle-point-w{top:50%;left:0;margin-top:-5px;margin-left:-5px}.elfinder-resize-handle-point-nw{top:0;left:0;margin-top:-5px;margin-left:-5px}.elfinder-resize-spinner{position:absolute;width:200px;height:30px;top:50%;margin-top:-25px;left:50%;margin-left:-100px;text-align:center;background:url(../images/elfinder/progress.gif) center bottom repeat-x}.elfinder-resize-row{margin-bottom:7px;position:relative}.elfinder-resize-label{float:left;width:80px;padding-top:3px}.elfinder-resize-reset{width:16px;height:16px;position:absolute;margin-top:-8px}.elfinder-dialog .elfinder-dialog-resize .ui-resizable-e{height:100%;width:10px}.elfinder-dialog .elfinder-dialog-resize .ui-resizable-s{width:100%;height:10px}.elfinder-dialog .elfinder-dialog-resize .ui-resizable-se{background:0 0;bottom:0;right:0;margin-right:-7px;margin-bottom:-7px}.elfinder-dialog-resize .ui-icon-grip-solid-vertical{position:absolute;top:50%;right:0;margin-top:-8px;margin-right:-11px}.elfinder-dialog-resize .ui-icon-grip-solid-horizontal{position:absolute;left:50%;bottom:0;margin-left:-8px;margin-bottom:-11px}.elfinder-resize-row .elfinder-buttonset{float:right}.elfinder-resize-rotate-slider{float:left;width:195px;margin:7px 7px 0}.elfinder-file-edit{width:99%;height:99%;margin:0;padding:2px;border:1px solid #ccc}.elfinder-help{margin-bottom:.5em}.elfinder-help .ui-tabs-panel{padding:.5em}.elfinder-dialog .ui-tabs .ui-tabs-nav li a{padding:.2em 1em}.elfinder-help-shortcuts{height:300px;padding:1em;margin:.5em 0;overflow:auto}.elfinder-help-shortcut{white-space:nowrap;clear:both}.elfinder-help-shortcut-pattern{float:left;width:160px}.elfinder-help-logo{width:100px;height:96px;float:left;margin-right:1em;background:url('../images/elfinder/logo.png') center center no-repeat}.elfinder-help h3{font-size:1.5em;margin:.2em 0 .3em}.elfinder-help-separator{clear:both;padding:.5em}.elfinder-help-link{padding:2px}.elfinder-help .ui-priority-secondary{font-size:.9em}.elfinder-help .ui-priority-primary{margin-bottom:7px}.elfinder-help-team{clear:both;text-align:right;border-bottom:1px solid #ccc;margin:.5em 0;font-size:.9em}.elfinder-help-team div{float:left}.elfinder-help-license{font-size:.9em}.elfinder-help-disabled{font-weight:700;text-align:center;margin:90px 0}.elfinder-help .elfinder-dont-panic{display:block;border:1px solid transparent;width:200px;height:200px;margin:30px auto;text-decoration:none;text-align:center;position:relative;background:#d90004;-moz-box-shadow:5px 5px 9px #111;-webkit-box-shadow:5px 5px 9px #111;box-shadow:5px 5px 9px #111;background:-moz-radial-gradient(80px 80px,circle farthest-corner,#d90004 35%,#960004 100%);background:-webkit-gradient(radial,80 80,60,80 80,120,from(#d90004),to(#960004));-moz-border-radius:100px;-webkit-border-radius:100px;border-radius:100px;outline:none}.elfinder-help .elfinder-dont-panic span{font-size:3em;font-weight:700;text-align:center;color:#fff;position:absolute;left:0;top:45px}.elfinder{padding:0;position:relative;display:block}.elfinder-rtl{text-align:right;direction:rtl}.elfinder-workzone{padding:0;position:relative;overflow:hidden}.elfinder-perms,.elfinder-symlink{position:absolute;width:16px;height:16px;background-image:url(../images/elfinder/toolbar.png);background-repeat:no-repeat;background-position:0 -528px}.elfinder-na .elfinder-perms{background-position:0 -96px}.elfinder-ro .elfinder-perms{background-position:0 -64px}.elfinder-wo .elfinder-perms{background-position:0 -80px}.elfinder-drag-helper{width:60px;height:50px;padding:0 0 0 25px;z-index:100000}.elfinder-drag-helper-icon-plus{position:absolute;width:16px;height:16px;left:43px;top:55px;background:url('../images/elfinder/toolbar.png') 0 -544px no-repeat;display:none}.elfinder-drag-helper-plus .elfinder-drag-helper-icon-plus{display:block}.elfinder-drag-num{position:absolute;top:0;left:0;width:16px;height:14px;text-align:center;padding-top:2px;font-size:12px;font-weight:700;color:#fff;background-color:red;-moz-border-radius:8px;-webkit-border-radius:8px;border-radius:8px}.elfinder-drag-helper .elfinder-cwd-icon{margin:0 0 0 -24px;float:left}.elfinder-overlay{opacity:0;filter:Alpha(Opacity=0)}.elfinder .elfinder-panel{position:relative;background-image:none;padding:7px 12px}.elfinder-contextmenu,.elfinder-contextmenu-sub{display:none;position:absolute;border:1px solid #aaa;background:#fff;color:#555;padding:4px 0}.elfinder-contextmenu-sub{top:5px}.elfinder-contextmenu-ltr .elfinder-contextmenu-sub{margin-left:-5px}.elfinder-contextmenu-rtl .elfinder-contextmenu-sub{margin-right:-5px}.elfinder-contextmenu-item{position:relative;display:block;padding:4px 30px;text-decoration:none;white-space:nowrap;cursor:default}.elfinder-contextmenu .elfinder-contextmenu-item span{font-size:.76em;display:block}.elfinder-contextmenu-ltr .elfinder-contextmenu-item{text-align:left}.elfinder-contextmenu-rtl .elfinder-contextmenu-item{text-align:right}.elfinder-contextmenu-ltr .elfinder-contextmenu-sub .elfinder-contextmenu-item{padding-left:12px}.elfinder-contextmenu-rtl .elfinder-contextmenu-sub .elfinder-contextmenu-item{padding-right:12px}.elfinder-contextmenu-arrow,.elfinder-contextmenu-icon{position:absolute;top:50%;margin-top:-8px}.elfinder-contextmenu-ltr .elfinder-contextmenu-icon{left:8px}.elfinder-contextmenu-rtl .elfinder-contextmenu-icon{right:8px}.elfinder-contextmenu-arrow{width:16px;height:16px;background:url('../images/elfinder/arrows-normal.png') 5px 4px no-repeat}.elfinder-contextmenu-ltr .elfinder-contextmenu-arrow{right:5px}.elfinder-contextmenu-rtl .elfinder-contextmenu-arrow{left:5px;background-position:0 -10px}.elfinder-contextmenu .ui-state-hover{border:0 solid;background-image:none}.elfinder-contextmenu-separator{height:0;border-top:1px solid #ccc;margin:0 1px}.elfinder-cwd-wrapper{overflow:auto;position:relative;padding:2px;margin:0}.elfinder-cwd-wrapper-list{padding:0}.elfinder-cwd{position:relative;font-size:.7em;cursor:default;padding:0;margin:0;-moz-user-select:-moz-none;-khtml-user-select:none;-webkit-user-select:none;user-select:none}.elfinder .elfinder-cwd-wrapper.elfinder-droppable-active{padding:0;border:2px solid #8cafed}.elfinder-cwd-view-icons .elfinder-cwd-file{width:120px;height:80px;padding-bottom:2px;cursor:default;overflow:hidden}.elfinder-ltr .elfinder-cwd-view-icons .elfinder-cwd-file{float:left;margin:0 3px 12px 0}.elfinder-rtl .elfinder-cwd-view-icons .elfinder-cwd-file{float:right;margin:0 0 5px 3px}.elfinder-cwd-view-icons .elfinder-cwd-file .ui-state-hover{border:0 solid}.elfinder-cwd-view-icons .elfinder-cwd-file-wrapper{width:52px;height:52px;margin:1px auto;padding:2px;position:relative}.elfinder-cwd-view-icons .elfinder-cwd-filename{text-align:center;white-space:pre;overflow:hidden;text-overflow:ellipsis;-o-text-overflow:ellipsis;margin:3px 1px 0;padding:1px;-moz-border-radius:8px;-webkit-border-radius:8px;border-radius:8px}.elfinder-cwd-view-icons .elfinder-perms{bottom:4px;right:2px}.elfinder-cwd-view-icons .elfinder-symlink{bottom:6px;left:0}.elfinder-cwd-icon{display:block;width:48px;height:48px;margin:0 auto;background:url('../images/elfinder/icons-big.png') 0 0 no-repeat;-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box}.elfinder-cwd .elfinder-droppable-active .elfinder-cwd-icon{background-position:0 -100px}.elfinder-cwd-icon-directory{background-position:0 -50px}.elfinder-cwd-icon-application{background-position:0 -150px}.elfinder-cwd-icon-x-empty,.elfinder-cwd-icon-text{background-position:0 -200px}.elfinder-cwd-icon-image,.elfinder-cwd-icon-vnd-adobe-photoshop,.elfinder-cwd-icon-postscript{background-position:0 -250px}.elfinder-cwd-icon-audio{background-position:0 -300px}.elfinder-cwd-icon-video,.elfinder-cwd-icon-flash-video{background-position:0 -350px}.elfinder-cwd-icon-rtf,.elfinder-cwd-icon-rtfd{background-position:0 -401px}.elfinder-cwd-icon-pdf{background-position:0 -450px}.elfinder-cwd-icon-vnd-ms-office,.elfinder-cwd-icon-msword,.elfinder-cwd-icon-vnd-ms-word,.elfinder-cwd-icon-vnd-oasis-opendocument-text,.elfinder-cwd-icon-ms-excel,.elfinder-cwd-icon-vnd-ms-excel,.elfinder-cwd-icon-vnd-oasis-opendocument-spreadsheet,.elfinder-cwd-icon-vnd-ms-powerpoint,.elfinder-cwd-icon-vnd-oasis-opendocument-presentation{background-position:0 -500px}.elfinder-cwd-icon-html{background-position:0 -550px}.elfinder-cwd-icon-css{background-position:0 -600px}.elfinder-cwd-icon-javascript,.elfinder-cwd-icon-x-javascript{background-position:0 -650px}.elfinder-cwd-icon-x-perl{background-position:0 -700px}.elfinder-cwd-icon-x-python{background-position:0 -750px}.elfinder-cwd-icon-x-ruby{background-position:0 -800px}.elfinder-cwd-icon-x-sh,.elfinder-cwd-icon-x-shellscript{background-position:0 -850px}.elfinder-cwd-icon-x-c,.elfinder-cwd-icon-x-csrc,.elfinder-cwd-icon-x-chdr,.elfinder-cwd-icon-x-c--,.elfinder-cwd-icon-x-c--src,.elfinder-cwd-icon-x-c--hdr,.elfinder-cwd-icon-x-java,.elfinder-cwd-icon-x-java-source{background-position:0 -900px}.elfinder-cwd-icon-x-php{background-position:0 -950px}.elfinder-cwd-icon-xml{background-position:0 -1000px}.elfinder-cwd-icon-zip,.elfinder-cwd-icon-x-zip,.elfinder-cwd-icon-x-7z-compressed{background-position:0 -1050px}.elfinder-cwd-icon-x-gzip,.elfinder-cwd-icon-x-tar{background-position:0 -1100px}.elfinder-cwd-icon-x-bzip,.elfinder-cwd-icon-x-bzip2{background-position:0 -1150px}.elfinder-cwd-icon-x-rar,.elfinder-cwd-icon-x-rar-compressed{background-position:0 -1200px}.elfinder-cwd-icon-x-shockwave-flash{background-position:0 -1250px}.elfinder-cwd-icon-group{background-position:0 -1300px}.elfinder-cwd input{width:100%;border:0 solid;margin:0;padding:0}.elfinder-cwd-view-icons input,.elfinder-cwd-view-icons{text-align:center}.elfinder-cwd table{width:100%;border-collapse:collapse;border:0 solid;margin:0 0 10px}.elfinder .elfinder-cwd table thead tr{border-left:0 solid;border-top:0 solid;border-right:0 solid}.elfinder .elfinder-cwd table thead td{font-size:.9em}.elfinder .elfinder-cwd table td{padding:3px 12px;white-space:pre;overflow:hidden;text-align:right;cursor:default;border:0 solid}.elfinder-ltr .elfinder-cwd table td{text-align:right}.elfinder-ltr .elfinder-cwd table td:first-child{text-align:left}.elfinder-rtl .elfinder-cwd table td{text-align:left}.elfinder-rtl .elfinder-cwd table td:first-child{text-align:right}.elfinder-odd-row{background:#eee}.elfinder-cwd-view-list .elfinder-cwd-file-wrapper{width:97%;position:relative}.elfinder-ltr .elfinder-cwd-view-list .elfinder-cwd-file-wrapper{padding-left:23px}.elfinder-rtl .elfinder-cwd-view-list .elfinder-cwd-file-wrapper{padding-right:23px}.elfinder-cwd-view-list .elfinder-perms,.elfinder-cwd-view-list .elfinder-symlink{top:50%;margin-top:-6px}.elfinder-ltr .elfinder-cwd-view-list .elfinder-perms{left:7px}.elfinder-ltr .elfinder-cwd-view-list .elfinder-symlink{left:-7px}.elfinder-cwd-view-list td .elfinder-cwd-icon{width:16px;height:16px;position:absolute;top:50%;margin-top:-8px;background-image:url(../images/elfinder/icons-small.png)}.elfinder-ltr .elfinder-cwd-view-list .elfinder-cwd-icon{left:0}.elfinder-rtl .elfinder-cwd-view-list .elfinder-cwd-icon{right:0}.std42-dialog{padding:0}.std42-dialog .ui-dialog-titlebar{border-left:0 solid transparent;border-top:0 solid transparent;border-right:0 solid transparent;-moz-border-radius-bottomleft:0;-webkit-border-bottom-left-radius:0;border-bottom-left-radius:0;-moz-border-radius-bottomright:0;-webkit-border-bottom-right-radius:0;border-bottom-right-radius:0;font-size:.82em;font-weight:400;padding:.2em 1em}.std42-dialog .ui-dialog-titlebar-close,.std42-dialog .ui-dialog-titlebar-close:hover{padding:1px}.elfinder-rtl .elfinder-dialog .ui-dialog-titlebar{text-align:right}.elfinder-rtl .elfinder-dialog .ui-dialog-titlebar .ui-dialog-titlebar-close{right:auto;left:.3em}.std42-dialog .ui-dialog-content{padding:.3em .5em;font-size:.72em}.std42-dialog .ui-dialog-buttonpane{border:0 solid;margin:0;padding:.5em .7em;font-size:.76em}.std42-dialog .ui-dialog-buttonpane button{margin:0 0 0 .4em;padding:0;outline:0 solid}.std42-dialog .ui-dialog-buttonpane button span{padding:2px 9px}.elfinder-dialog .ui-resizable-e,.elfinder-dialog .ui-resizable-s{width:0;height:0}.std42-dialog .ui-button input{cursor:pointer}.elfinder-dialog-icon{position:absolute;width:32px;height:32px;left:12px;top:50%;margin-top:-15px;background:url("../images/elfinder/dialogs.png") 0 0 no-repeat}.elfinder-rtl .elfinder-dialog-icon{left:auto;right:12px}.elfinder-dialog-error .ui-dialog-content,.elfinder-dialog-confirm .ui-dialog-content{padding-left:56px;min-height:35px}.elfinder-rtl .elfinder-dialog-error .ui-dialog-content,.elfinder-rtl .elfinder-dialog-confirm .ui-dialog-content{padding-left:0;padding-right:56px}.elfinder-dialog-notify .ui-dialog-titlebar-close{display:none}.elfinder-dialog-notify .ui-dialog-content{padding:0}.elfinder-notify{border-bottom:1px solid #ccc;position:relative;padding:.5em;text-align:center;overflow:hidden}.elfinder-ltr .elfinder-notify{padding-left:30px}.elfinder-rtl .elfinder-notify{padding-right:30px}.elfinder-notify:last-child{border:0 solid}.elfinder-notify-progressbar{width:180px;height:8px;border:1px solid #aaa;background:#f5f5f5;margin:5px auto;overflow:hidden}.elfinder-notify-progress{width:100%;height:8px;background:url(../images/elfinder/progress.gif) center center repeat-x}.elfinder-notify-progressbar,.elfinder-notify-progress{-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px}.elfinder-dialog-icon-open,.elfinder-dialog-icon-file,.elfinder-dialog-icon-reload{background-position:0 -225px}.elfinder-dialog-icon-mkdir{background-position:0 -64px}.elfinder-dialog-icon-mkfile{background-position:0 -96px}.elfinder-dialog-icon-copy,.elfinder-dialog-icon-prepare,.elfinder-dialog-icon-move{background-position:0 -128px}.elfinder-dialog-icon-upload{background-position:0 -160px}.elfinder-dialog-icon-rm{background-position:0 -192px}.elfinder-dialog-icon-download{background-position:0 -260px}.elfinder-dialog-icon-save{background-position:0 -295px}.elfinder-dialog-icon-rename{background-position:0 -330px}.elfinder-dialog-icon-archive,.elfinder-dialog-icon-extract{background-position:0 -365px}.elfinder-dialog-icon-search{background-position:0 -402px}.elfinder-dialog-confirm-applyall{padding-top:3px}.elfinder-dialog-confirm .elfinder-dialog-icon{background-position:0 -32px}.elfinder-info-title .elfinder-cwd-icon{float:left;width:48px;height:48px;margin-right:1em}.elfinder-info-title strong{display:block;padding:.3em 0 .5em}.elfinder-info-tb{min-width:200px;border:0 solid;margin:1em .2em;font-size:.9em}.elfinder-info-tb td{white-space:nowrap;padding:2px}.elfinder-info-tb tr td:first-child{text-align:right}.elfinder-info-tb span{float:left}.elfinder-info-tb a{outline:none;text-decoration:underline}.elfinder-info-tb a:hover{text-decoration:none}.elfinder-info-spinner{width:14px;height:14px;float:left;background:url("../images/elfinder/spinner-mini.gif") center center no-repeat;margin:0 5px}.elfinder-upload-dropbox{font-size:1.2em;text-align:center;padding:2em 0;border:3px dashed #aaa}.elfinder-upload-dropbox.ui-state-hover{background:#dfdfdf;border:3px dashed #555}.elfinder-upload-dialog-or{font-size:1.2em;margin:.3em 0;text-align:center}.elfinder-upload-dialog-wrapper{text-align:center}.elfinder-upload-dialog-wrapper .ui-button{position:relative;overflow:hidden}.elfinder-upload-dialog-wrapper .ui-button form{position:absolute;right:0;top:0;opacity:0;filter:Alpha(Opacity=0)}.elfinder-upload-dialog-wrapper .ui-button form input{padding:0 20px;font-size:3em}.dialogelfinder .dialogelfinder-drag{border-left:0 solid;border-top:0 solid;border-right:0 solid;font-weight:400;font-size:.9em;padding:2px 12px;cursor:move;position:relative;text-align:left}.elfinder-rtl .dialogelfinder-drag{text-align:right}.dialogelfinder-drag-close{position:absolute;top:50%;margin-top:-8px}.elfinder-ltr .dialogelfinder-drag-close{right:12px}.elfinder-rtl .dialogelfinder-drag-close{left:12px}.elfinder .elfinder-navbar{width:230px;padding:3px 5px;font-size:.72em;background-image:none;border-top:0 solid;border-bottom:0 solid;overflow:auto;display:none;position:relative;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;user-select:none}.elfinder-ltr .elfinder-navbar{float:left;border-left:0 solid}.elfinder-rtl .elfinder-navbar{float:right;border-right:0 solid}.elfinder-ltr .ui-resizable-e{margin-left:10px}.elfinder-tree{display:table;width:100%;margin:0 0 .5em}.elfinder-navbar-dir{position:relative;display:block;white-space:nowrap;padding:3px 12px;margin:0;outline:0 solid;border:1px solid transparent;cursor:default}.elfinder-ltr .elfinder-navbar-dir{padding-left:35px}.elfinder-rtl .elfinder-navbar-dir{padding-right:35px}.elfinder-navbar-arrow{width:12px;height:14px;position:absolute;display:none;top:50%;margin-top:-8px;background-image:url("../images/elfinder/arrows-normal.png");background-repeat:no-repeat}.ui-state-active .elfinder-navbar-arrow{background-image:url("../images/elfinder/arrows-active.png")}.elfinder-navbar-collapsed .elfinder-navbar-arrow{display:block}.elfinder-ltr .elfinder-navbar-collapsed .elfinder-navbar-arrow{background-position:0 4px;left:0}.elfinder-rtl .elfinder-navbar-collapsed .elfinder-navbar-arrow{background-position:0 -10px;right:0}.elfinder-ltr .elfinder-navbar-expanded .elfinder-navbar-arrow,.elfinder-rtl .elfinder-navbar-expanded .elfinder-navbar-arrow{background-position:0 -21px}.elfinder-navbar-icon{width:16px;height:16px;position:absolute;top:50%;margin-top:-8px;background-image:url("../images/elfinder/toolbar.png");background-repeat:no-repeat;background-position:0 -16px}.elfinder-ltr .elfinder-navbar-icon{left:14px}.elfinder-rtl .elfinder-navbar-icon{right:14px}.elfinder-tree .elfinder-navbar-root .elfinder-navbar-icon{background-position:0 0}.elfinder-places .elfinder-navbar-root .elfinder-navbar-icon{background-position:0 -48px}.ui-state-active .elfinder-navbar-icon,.elfinder-droppable-active .elfinder-navbar-icon,.ui-state-hover .elfinder-navbar-icon{background-position:0 -32px}.elfinder-navbar-subtree{display:none}.elfinder-ltr .elfinder-navbar-subtree{margin-left:12px}.elfinder-rtl .elfinder-navbar-subtree{margin-right:12px}.elfinder-navbar-spinner{width:14px;height:14px;position:absolute;display:block;top:50%;margin-top:-7px;background:url("../images/elfinder/spinner-mini.gif") center center no-repeat}.elfinder-ltr .elfinder-navbar-spinner{left:0;margin-left:-2px}.elfinder-rtl .elfinder-navbar-spinner{right:0;margin-right:-2px}.elfinder-navbar .elfinder-perms{top:50%;margin-top:-8px}.elfinder-ltr .elfinder-navbar .elfinder-perms{left:18px}.elfinder-rtl .elfinder-navbar .elfinder-perms{right:18px}.elfinder-ltr .elfinder-navbar .elfinder-symlink{left:8px}.elfinder-rtl .elfinder-navbar .elfinder-symlink{right:8px}.elfinder-navbar .ui-resizable-handle{width:12px;background:url('../images/elfinder/resize.png') center center no-repeat;left:0}.elfinder-nav-handle-icon{position:absolute;top:50%;margin:-8px 2px 0;opacity:.5;filter:Alpha(Opacity=50)}.elfinder-places{border:1px solid transparent}.elfinder-places.elfinder-droppable-active{border:1px solid #8cafed}.elfinder-place-drag .elfinder-navbar-dir{font-size:.9em}.elfinder-quicklook{position:absolute;background:url("../images/elfinder/quicklook-bg.png");display:none;overflow:hidden;border-radius:7px;-moz-border-radius:7px;-webkit-border-radius:7px;padding:20px 0 40px}.elfinder-quicklook .ui-resizable-se{width:14px;height:14px;right:5px;bottom:3px;background:url("../images/elfinder/toolbar.png") 0 -496px no-repeat}.elfinder-quicklook-fullscreen{border-radius:0;-moz-border-radius:0;-webkit-border-radius:0;-webkit-background-clip:padding-box;padding:0;background:#000;z-index:90000;display:block}.elfinder-quicklook-fullscreen .elfinder-quicklook-titlebar{display:none}.elfinder-quicklook-fullscreen .elfinder-quicklook-preview{border:0 solid}.elfinder-quicklook-titlebar{text-align:center;background:#777;position:absolute;left:0;top:0;width:100%;height:20px;-moz-border-radius-topleft:7px;-webkit-border-top-left-radius:7px;border-top-left-radius:7px;-moz-border-radius-topright:7px;-webkit-border-top-right-radius:7px;border-top-right-radius:7px;cursor:move}.elfinder-quicklook-title{font-size:.7em;color:#fff;white-space:nowrap;overflow:hidden;padding:2px 0}.elfinder-quicklook-titlebar .ui-icon{position:absolute;left:4px;top:50%;margin-top:-8px;width:16px;height:16px;cursor:default}.elfinder-quicklook-preview{overflow:hidden;position:relative;border:0 solid;border-left:1px solid transparent;border-right:1px solid transparent;height:100%}.elfinder-quicklook-info-wrapper{position:absolute;width:100%;left:0;top:50%;margin-top:-50px}.elfinder-quicklook-info{padding:0 12px 0 112px}.elfinder-quicklook-info .elfinder-quicklook-info-data:first-child{color:#fff;font-weight:700;padding-bottom:.5em}.elfinder-quicklook-info-data{font-size:.72em;padding-bottom:.2em;color:#fff}.elfinder-quicklook .elfinder-cwd-icon{position:absolute;left:32px;top:50%;margin-top:-20px}.elfinder-quicklook-preview img{display:block;margin:0 auto}.elfinder-quicklook-navbar{position:absolute;left:50%;bottom:4px;width:140px;height:32px;padding:0;margin-left:-70px;border:1px solid transparent;border-radius:19px;-moz-border-radius:19px;-webkit-border-radius:19px}.elfinder-quicklook-fullscreen .elfinder-quicklook-navbar{width:188px;margin-left:-94px;padding:5px;border:1px solid #eee;background:#000}.elfinder-quicklook-fullscreen .elfinder-quicklook-navbar-icon-close,.elfinder-quicklook-fullscreen .elfinder-quicklook-navbar-separator{display:inline}.elfinder-quicklook-navbar-icon{width:32px;height:32px;margin:0 7px;float:left;background:url("../images/elfinder/quicklook-icons.png") 0 0 no-repeat}.elfinder-quicklook-navbar-icon-fullscreen{background-position:0 -64px}.elfinder-quicklook-navbar-icon-fullscreen-off{background-position:0 -96px}.elfinder-quicklook-navbar-icon-prev{background-position:0 0}.elfinder-quicklook-navbar-icon-next{background-position:0 -32px}.elfinder-quicklook-navbar-icon-close{background-position:0 -128px;display:none}.elfinder-quicklook-navbar-separator{width:1px;height:32px;float:left;border-left:1px solid #fff;display:none}.elfinder-quicklook-preview-text-wrapper{width:100%;height:100%;background:#fff;color:#222;font-size:.9em;overflow:auto}pre.elfinder-quicklook-preview-text{margin:0;padding:3px 9px}.elfinder-quicklook-preview-html,.elfinder-quicklook-preview-pdf{width:100%;height:100%;background:#fff;border:0 solid;margin:0}.elfinder-quicklook-preview-flash{width:100%;height:100%}.elfinder-quicklook-preview-audio{width:100%;position:absolute;bottom:0;left:0}embed.elfinder-quicklook-preview-audio{height:30px;background:0 0}.elfinder-quicklook-preview-video{width:100%;height:100%}.elfinder-statusbar{text-align:center;font-weight:400;padding:.2em .5em;border-right:0 solid transparent;border-bottom:0 solid transparent;border-left:0 solid transparent}.elfinder-statusbar a{text-decoration:none}.elfinder-statusbar div{font-size:.7em}.elfinder-path{max-width:30%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;-o-text-overflow:ellipsis}.elfinder-ltr .elfinder-path{float:left}.elfinder-rtl .elfinder-path{float:right}.elfinder-stat-size{white-space:nowrap}.elfinder-ltr .elfinder-stat-size{float:right}.elfinder-rtl .elfinder-stat-size{float:left}.elfinder-stat-selected{white-space:nowrap;overflow:hidden}.elfinder-toolbar{padding:4px 0 3px;border-left:0 solid transparent;border-top:0 solid transparent;border-right:0 solid transparent}.elfinder-buttonset{margin:1px 4px;float:left;background:0 0;padding:0;-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px}.elfinder .elfinder-button{width:16px;height:16px;margin:0;padding:4px;float:left;overflow:hidden;position:relative;border:0 solid}.elfinder .ui-icon-search{cursor:pointer}.elfinder-button:first-child{-moz-border-radius-topleft:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-bottomleft:4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px}.elfinder-button:last-child{-moz-border-radius-topright:4px;-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-moz-border-radius-bottomright:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px}.elfinder-toolbar-button-separator{float:left;padding:0;height:24px;border-top:0 solid;border-right:0 solid;border-bottom:0 solid;width:0}.elfinder .elfinder-button.ui-state-disabled{opacity:1;filter:Alpha(Opacity=100)}.elfinder .elfinder-button.ui-state-disabled .elfinder-button-icon{opacity:.4;filter:Alpha(Opacity=40)}.elfinder-rtl .elfinder-buttonset{float:right}.elfinder-button-icon{width:16px;height:16px;display:block;background:url('../images/elfinder/toolbar.png') no-repeat}.elfinder-button-icon-home{background-position:0 0}.elfinder-button-icon-back{background-position:0 -112px}.elfinder-button-icon-forward{background-position:0 -128px}.elfinder-button-icon-up{background-position:0 -144px}.elfinder-button-icon-reload{background-position:0 -160px}.elfinder-button-icon-open{background-position:0 -176px}.elfinder-button-icon-mkdir{background-position:0 -192px}.elfinder-button-icon-mkfile{background-position:0 -208px}.elfinder-button-icon-rm{background-position:0 -224px}.elfinder-button-icon-copy{background-position:0 -240px}.elfinder-button-icon-cut{background-position:0 -256px}.elfinder-button-icon-paste{background-position:0 -272px}.elfinder-button-icon-getfile{background-position:0 -288px}.elfinder-button-icon-duplicate{background-position:0 -304px}.elfinder-button-icon-rename{background-position:0 -320px}.elfinder-button-icon-edit{background-position:0 -336px}.elfinder-button-icon-quicklook{background-position:0 -352px}.elfinder-button-icon-upload{background-position:0 -368px}.elfinder-button-icon-download{background-position:0 -384px}.elfinder-button-icon-info{background-position:0 -400px}.elfinder-button-icon-extract{background-position:0 -416px}.elfinder-button-icon-archive{background-position:0 -432px}.elfinder-button-icon-view{background-position:0 -448px}.elfinder-button-icon-view-list{background-position:0 -464px}.elfinder-button-icon-help{background-position:0 -480px}.elfinder-button-icon-resize{background-position:0 -512px}.elfinder-button-icon-search{background-position:0 -561px}.elfinder-button-icon-sort{background-position:0 -577px}.elfinder-button-icon-rotate-r{background-position:0 -625px}.elfinder-button-icon-rotate-l{background-position:0 -641px}.elfinder .elfinder-menubutton{overflow:visible}.elfinder-button-menu{position:absolute;left:0;top:26px;padding:3px 0}.elfinder-button-menu-item{white-space:nowrap;font-size:.72em;cursor:default;padding:5px 19px;position:relative}.elfinder-button-menu .ui-state-hover{border:0 solid}.elfinder-menu-item-sort-dir{width:16px;height:16px;position:absolute;left:2px;top:50%;margin-top:-8px;background:url("../images/elfinder/toolbar.png") 0 -594px no-repeat;display:none}.elfinder-button-menu-item-selected .elfinder-menu-item-sort-dir{display:block}.elfinder-menu-item-sort-desc .elfinder-menu-item-sort-dir{background-position:0 -608px}.elfinder-button form{position:absolute;top:0;right:0;opacity:0;filter:Alpha(Opacity=0);cursor:pointer}.elfinder .elfinder-button form input{background:0 0;cursor:default}.elfinder .elfinder-button-search{border:0 solid;background:0 0;padding:0;margin:1px 4px;height:auto;min-height:26px;float:right;width:202px}.elfinder-ltr .elfinder-button-search{float:right;margin-right:10px}.elfinder-rtl .elfinder-button-search{float:left;margin-left:10px}.elfinder-button-search input{width:160px;height:22px;padding:0 20px;font-size:.8em;line-height:22px;border:1px solid #aaa;-moz-border-radius:12px;-webkit-border-radius:12px;border-radius:12px;outline:0 solid}.elfinder-rtl .elfinder-button-search input{direction:rtl}.elfinder-button-search .ui-icon{position:absolute;height:18px;top:50%;margin:-9px 4px 0;opacity:.6;filter:Alpha(Opacity=60)}.elfinder-ltr .elfinder-button-search .ui-icon-search{left:0}.elfinder-rtl .elfinder-button-search .ui-icon-search,.elfinder-ltr .elfinder-button-search .ui-icon-close{right:0}.elfinder-rtl .elfinder-button-search .ui-icon-close{left:0} \ No newline at end of file diff --git a/deployed/k2/media/k2/assets/css/k2.backend.css b/deployed/k2/media/k2/assets/css/k2.backend.css new file mode 100644 index 00000000..7a7292e9 --- /dev/null +++ b/deployed/k2/media/k2/assets/css/k2.backend.css @@ -0,0 +1,1008 @@ +/** + * @version 2.8.x + * @package K2 + * @author JoomlaWorks http://www.joomlaworks.net + * @copyright Copyright (c) 2006 - 2017 JoomlaWorks Ltd. All rights reserved. + * @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html + */ + +/* Import Open Sans */ +@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,800italic,800,700italic,700,600,600italic,400italic,300italic,300&subset=latin,greek,vietnamese,cyrillic-ext,cyrillic); + +/* Common */ +a:active,a:focus {outline:0;} +.clr, +.k2clr {clear:both;height:0;line-height:0;border:none;float:none;background:none;padding:0;margin:0;} +hr.sep {line-height:0;height:0;border:none;border-bottom:1px dotted #ccc;padding:0;margin:4px 0;} + +.isJ30 body {padding-right:0;padding-left:0;} +.com_k2 select[multiple], +.com_k2 select[size], +.com_k2 select {min-height:40px;height:40px;max-width:100%;} + +/* Reset Bootstrap responsive stuff */ +.isJ30 .header, +.isJ30 .navbar-fixed-top, +.isJ30 .navbar-fixed-bottom, +.isJ30 .navbar-static-top, +.isJ30 .btn-subhead, +.isJ30 .subhead {margin-left:0;margin-right:0;} + + + +/* -------------- Admin Common -------------- */ + +.k2Center {text-align:center;} +.k2Left {text-align:left;} +.k2Right {text-align:right;} +.k2FLeft {float:left;} +.k2FRight {float:right;} +.k2ForceWrap {white-space:normal!important;max-width:120px;overflow:hidden;} +.k2NoWrap {white-space:nowrap;} +.k2Date {white-space:nowrap;text-align:center;} +.k2Order {white-space:nowrap!important;text-align:right;width:auto!important;min-width:80px;} +.k2Order span {} +.k2OrderBox {text-align:center;} +.k2OptionSep {color:#999;font-style:normal;} +.k2IsIcon {font-family:Arial,Helvetica,sans-serif!important;font-size:16px!important;} +.k2IsIcon:hover {color:#BB3A00;text-decoration:none;} +.k2TitleBox {font-size:20px!important;height:35px!important;padding:5px 6px!important;width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} +.k2TitleAliasBox {width:60%;font-size:12px;} +.k2TextBox {background:#fff;padding:4px;} +.k2ListItemDisabled {cursor:pointer;color:#0B55C4;} /* used in popup lists */ +.k2VisuallyHidden, +.visually-hidden {position:absolute;overflow:hidden;clip:rect(0, 0, 0, 0);} + +.k2CharCounter {margin:0 0 0 8px;color:#2ecc40;} + .k2CharsExceeded {color:#ff4136;} + +/* Simple grid based on Foundation */ +#k2AdminContainer .row {margin-left:auto;margin-right:auto;width:100%;max-width:1200px;} +#k2AdminContainer .row .row {margin-left:-0.625em;margin-right:-0.625em;width:auto;} +#k2AdminContainer .row.row-nomax {max-width:100%;} +.column, +.columns {float:left;padding-left:0.625em;padding-right:0.625em;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} +.small-12 {width:100%;} +@media screen and (min-width:60em) { + .large-6 {width:50%;} + .large-8 {width:75%;} + .large-9 {width:66.67%;} + .large-10 {width:83%;} +} +.column.small-centered, +.columns.small-centered {float:none;margin-left:auto;margin-right:auto;} + +/* Sprite */ +.icon-48-k2, +body.com_k2 .page-title, +.k2Inactive, +span.k2GalleryNotice , +.k2Active {display:inline-block;background:url('../images/backend/sprite.png') no-repeat;overflow:hidden;text-align:left;} +#k2ExtraFieldsValidationResults:before {background:url('../images/backend/sprite.png') no-repeat;overflow:hidden;text-align:left;} +span.k2GalleryNotice {background-position:-79px -118px;width:16px;height:16px;} +#k2ExtraFieldsValidationResults:before {content:'';float:left;margin-right:10px;background-position:-10px -92px;width:59px;height:54px;} +.icon-48-k2 {background-position:-10px -0px;height:36px;} +.isJ15 .icon-48-k2, +.isJ25 .icon-48-k2 {height:48px;} +body.com_k2 .page-title {background-position:-10px -46px;width:auto;height:36px;} +.k2Inactive {background-position:-79px -92px;width:16px;height:16px;} +.k2Active {background-position:-79px -144px;width:16px;height:16px;} +/* End of the sprite */ + +.k2Toggler {display:block;width:16px;height:16px;margin:0 auto;padding:0;background-repeat:no-repeat;background-position:0 0;text-indent:-500px;overflow:hidden;} +.k2Active {background-image:url(../images/backend/tick.png);} +.k2Inactive {background-image:url(../images/backend/cross.png);} + +div#k2AdminContainer {font-family:'Open Sans',sans-serif;} + +/* Common image styling */ +img.k2AdminImage {border:4px solid #ddd;margin:10px 0;padding:0;display:block;} +img.k2UserAvatar {margin:10px 20px;} + +.paramHeader {padding:6px 8px;} + +ul.k2GenericList {list-style:square;margin:0 8px 8px;padding:2px 8px;} +ul.k2GenericList li {list-style:square;padding:2px 0;} + +/* Generic button */ +.k2Selector {background:#f0f2f2;border:1px solid #d4d7d9;border-radius:3px;display:inline-block;margin:0;padding:4px 8px;color:#555;font-weight:bold;font-size:12px;cursor:pointer;text-decoration:none;box-shadow:0 0 1px 0 rgba(41,40,42,0.2);} +.k2Selector:hover {color:#222;text-decoration:none;border-color:rgba(82,168,236,0.8);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,0.6);-webkit-transition:box-shadow 300ms ease;transition:box-shadow 300ms ease;} + +/* Date/time picker */ +.k2DateTimePickerControl {position:relative;} +.k2DateTimePickerControl .fa-calendar {position:absolute;top:8px;right:8px;} + +/* Header */ +.subhead .btn-toolbar {padding-right:10px;} +.icon-48-k2 {color:#222!important;padding-left:120px!important;font-size:24px!important;} +.icon-48-k2 h2 {color:#222!important;font-size:24px!important;margin-left:10px!important;} + +/* Normalize all Joomla radio controls? +div.controls label.radio {} +div.controls label.radio input[type="radio"] {} +*/ + +div#k2AdminContainer h1 {padding:0 0 8px 0;margin:0;} +span.k2Notice {cursor:pointer;font-weight:bold;} +.k2LimitBox {float:left;margin:0 10px 0 0;} + +/* Fixes pagination issue for the limitbox */ +.k2LimitBox .chzn-drop {top:auto!important;bottom:38px!important;} +.k2LimitBox .chzn-container-active.chzn-with-drop .chzn-single {border-radius:0 0 5px 5px!important;} +.k2LimitBox .chzn-container .chzn-drop {padding-top:10px;border-bottom:0;border-top:1px solid #aaa;border-radius:4px 4px 0 0;} + +/* Common for Joomla 2.5 */ +div.isJ25 table.admintable {} +div.isJ25 table.admintable td.key {background:#f6f6f6;/*border-bottom:1px solid #e9e9e9;border-right:1px solid #e9e9e9;*/color:#666;font-weight:bold;text-align:right;font-size:11px;width:140px;} +div.isJ25 table.admintable td.key label {margin:0;padding:0;} + +/* Common for Joomla 3.x */ +body.com_k2 .container-fluid {padding:0!important;} +body.com_k2 .page-title {padding-left:100px;} +@media (max-width:767px) { + body.com_k2 .page-title {padding-left:0;text-indent:-800px} +} +div.controls label.radio {display:inline-block;} +.isJ30 table.adminlist tfoot tr td .pagination {text-align:center;} + +/* Footer */ +#k2AdminFooter {text-align:center;margin:20px auto 4px auto;width:100%;clear:both;float:left;} +@media screen and (min-width:767px) { + #k2AdminFooter {margin-bottom:45px;} +} + +/* div tables */ +div.k2Table {margin:0 0 20px 0;} +div.k2Table .k2TableLabel > label {font-weight:normal;color:#777;} +div.k2Table .k2TableValue {} +div.k2Table .k2TableValue input[type="text"] {min-height:40px;line-height:40px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} +div.k2Table .k2TableValue:after {content:" ";display:block;margin-bottom:8px;} +div.k2SubTable {margin-bottom:15px;} +div.k2SubTable .k2SubTableLabel {display:inline-block;text-align:right;vertical-align:top;} +div.k2SubTable .k2SubTableLabel > label {font-weight:normal;color:#777;} + +div.k2SubTable .k2SubTableValue label {padding-left:4px!important;} +div.k2SubTable .k2SubTableValue input[type="radio"] {margin:2px 8px 0 0!important;} + +.k2TableValue, +.k2SubTableValue {margin-bottom:15px;} + +@media screen and (max-width:1240px) { + .k2TableRightTop {margin-top:20px;} +} +@media screen and (min-width:1240px) { + div.k2TableInline {display:inline-block;} + div.k2TableLeft {float:left;} + div.k2TableRight {float:right;text-align:right;} + div.k2TableRight .chzn-container {text-align:left;} + .k2ViewIsItem div.k2SubTable .k2SubTableLabel:first-child {margin-left:0;width:auto;} + .k2ItemTableRightPad {padding-left:16px;} +} +/* +@media screen and (min-width:1660px) { + div.k2CatTableLeft {float:left;} + div.k2CatTableRight {float:right;text-align:right;} + div.k2ItemTableLeft {float:left;} + div.k2ItemTableRight {float:right;text-align:right;} +} +*/ +@media screen and (min-width:1000px) { + div.k2Table .k2TableValue {margin-left:120px;vertical-align:top;} + div.k2Table .k2TableLabel {position:absolute;width:100px;vertical-align:top;text-align:right;} + div.k2SubTable .k2SubTableValue {display:inline-block;vertical-align:top;} + div.k2SubTable .k2SubTableLabel {margin:0 0 0 20px;padding:9px 8px 0;} + div.k2SubTable .k2SubTableValue {width:210px;} + .k2ViewIsCategory div.k2SubTable .k2SubTableLabel {width:150px;} + .k2ViewIsItem div.k2SubTable .k2SubTableLabel {width:90px;} +} +@media screen and (min-width:767px) { + div.k2Table .k2TableLabel {display:block;padding:10px 0;} + .k2ViewIsItem div.k2SubTable .k2SubTableLabel:first-child {margin-left:-107px;} + /* Category specific styling */ + .k2CategoryForm div.k2Table .k2TableLabel > label {width:125px;max-width:125px;} + .k2CategoryForm div.k2Table .k2TableValue {margin-left:145px;} + label[for="title"] {font-size:18px;} + label[for="tags"] {padding:20px 0 0 0;} +} + +/* Generic Tabs Layout */ +.ui-tabs-hide {display:none;} +div.k2Tabs {clear:both;padding:10px 0;} +ul.k2TabsNavigation {margin:0;padding:0;text-align:left;list-style:none;} +ul.k2TabsNavigation li {display:inline-block;margin:0 -2px 0 0;padding:0;width:49%} +ul.k2TabsNavigation li a {display:block;padding:10px;margin:0;background:#f0f2f2;font-size:14px;text-decoration:none;font-weight:normal;outline:0;border-radius:3px 3px 0 0;color:#6d6f71;border-bottom:1px solid #d4d7d9;} +ul.k2TabsNavigation li a:hover {text-decoration:none;background-color:#f6f6f6;} +ul.k2TabsNavigation li a i {margin-right:8px;color:#6d6f71;display:none;} +ul.k2TabsNavigation li.ui-tabs-selected a {padding:10px 20px;background:#fff;color:#58595b;border:1px solid #d4d7d9;border-bottom:1px solid #fff;} +ul.k2TabsNavigation li.ui-tabs-selected a i {color:#0091ff;} +ul.k2TabsNavigation li.ui-tabs-selected a:hover {background-color:#fff;} +#k2MediaTabs ul.k2TabsNavigation li {width:100%;font-size:12px;} + +@media screen and (min-width:480px) { + ul.k2TabsNavigation li {width:32.3333%;} +} +@media screen and (min-width:600px) { + ul.k2TabsNavigation li {width:auto;} +} +@media screen and (min-width:800px) { + ul.k2TabsNavigation li a i {display:inline-block;} + ul.k2TabsNavigation li a {padding:10px 21px;} + #k2MediaTabs ul.k2TabsNavigation li {width:50%;} +} + +/* Media Tabs */ +@media screen and (min-width:1024px) { + #k2MediaTabs ul.k2TabsNavigation li {width:auto;font-size:16px;} +} +div.k2TabsContent {background:#fff;border:1px solid #d4d7d9;padding:10px;margin-top:-1px;margin-bottom:10px;} +.k2TabsContent.k2TabsContentLower {padding:25px 30px;} +div.isJ25 div.k2TabsContent {} +div.isJ30 div.k2TabsContent {} +div.k2TabsContent {width:100%;float:left;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;} + +/* Entity ID */ +div#k2ID {position:absolute;right:0;top:0;font-size:18px;font-weight:normal;padding:21px 24px;color:#0091ff;display:none;} +div#k2ID strong {color:#a8c5dd;} + +/* Top Nav Tabs */ +#k2FormTopNav {padding:0;} +#k2FormTopNav ul.k2NavTabs {margin:0;padding:0;text-align:left;white-space:nowrap;background:#f0f2f2;border-bottom:1px solid #d4d7d9;} +#k2FormTopNav ul.k2NavTabs li {list-style:none;display:inline-block;margin:0;padding:0;color:#414042;} +#k2FormTopNav ul.k2NavTabs li a {display:block;font-size:14px;text-decoration:none;font-weight:normal;outline:0;padding:21px 10px;margin:0;border-right:1px solid #d4d7d9;color:#414042;} +#k2FormTopNav ul.k2NavTabs li a:hover {text-decoration:none;color:#0091ff;} +#k2FormTopNav ul.k2NavTabs li:last-child a {border-right:0;} +#k2FormTopNav ul.k2NavTabs li a i {font-size:18px;margin-right:12px;color:#9cbcd3;display:none;} +#k2FormTopNav ul.k2NavTabs li a:hover i {color:#0091ff;} +#k2FormTopNav ul.k2NavTabs li.ui-tabs-selected a {position:relative;color:#122747;} +#k2FormTopNav ul.k2NavTabs li.ui-tabs-selected a:before {content:"\f0d8";font-family:"FontAwesome";font-style:normal;font-weight:normal;text-decoration:inherit;color:#fff;font-size:32px;position:absolute;bottom:-5px;left:50%;margin-left:-16px;width:32px;text-shadow:0px -1px 1px #ccc;} +#k2FormTopNav ul.k2NavTabs li.ui-tabs-selected a i {color:#0091ff;} + +@media screen and ( min-width:640px ) { + #k2FormTopNav ul.k2NavTabs li a {font-size:18px;padding:21px 24px;} + #k2FormTopNav ul.k2NavTabs li a i {display:inline-block;} +} +@media screen and ( min-width:500px ) { + div#k2ID {display:block;} + #k2FormTopNav ul.k2NavTabs li a {} +} +div.k2NavTabContent {padding:20px;} + +/* XML Parameter Rendering */ +form#adminForm {} +#k2TabDisplaySet, +#k2TabPubAndMeta {padding:0;} + +/* Metadata specific styling */ +#k2TabPubAndMeta .row {margin-left:0;max-width:100%;} + +/* ScrollSpy */ +ul.k2ScrollSpyMenu {display:none;} +div.k2ScrollingContent {margin-left:0;padding:20px 20px 0;} +div.K2ScrollingContent h3 {margin-top:20px;} +@media screen and (min-width:900px) { + ul.k2ScrollSpyMenu {display:block;position:fixed;list-style:none;padding:20px 0 0;margin:0;width:320px;} + ul.k2ScrollSpyMenu li a {display:block;font-size:16px; + color:#00afec;padding:14px 28px;text-decoration:none;-webkit-transition:.5s all ease-out;-moz-transition:.5s all ease-out;transition:.5s all ease-out;} + ul.k2ScrollSpyMenu li a:hover {color:#000;} + ul.k2ScrollSpyMenu li.active a {background:#f7f7f7;} + div.k2ScrollingContent {margin-left:320px;padding:20px 30px 0 30px;border-left:1px solid #e3e4e4;} +} + +/* The fields */ +.xmlParamsFields {} +.xmlParamsFields.limitWidth {max-width:850px;padding:0 20px;} +.xmlParamsFields ul {list-style:none outside none;margin:0;padding:0;clear:both;} +.xmlParamsFields ul li {display:block;float:left;width:100%;clear:both;border-radius:3px;margin:0;padding:10px 20px 10px 0;} +.xmlParamsFields ul li:nth-child(2n-2) {background:#f7f7f7;} +.xmlParamsFields ul li.headerElement {padding:0;background:#fff;} + +.xmlParamsFields .paramValue label {min-width:85px;width:auto;text-align:center;border:1px solid #d4d6d8;line-height:33px;vertical-align:top;height:33px;font-size:12px;margin:0 -2px;padding:0 13px; +color:#8a8c8c;display:inline-block;vertical-align:middle;white-space:nowrap;background-color:#eff1f1; +box-shadow:0 1px 1px rgba(65,64,66,.14),inset 0 1px 0 #fff;} +.xmlParamsFields .paramValue label:hover {cursor:pointer;box-shadow:0 1px 1px rgba(65,64,66,.14),inset 0 0 10px rgba(0,0,0,.15);} +.xmlParamsFields .paramValue input[type="radio"] {opacity:0;position:absolute;clip:rect(0,0,0,0);} +.xmlParamsFields .paramValue input[type="text"], +.xmlParamsFields .paramValue textarea, +.xmlParamsFields .paramValue select, +.xmlParamsFields .paramValue div.chzn-container {/*margin-left:20px;*/} + +/* Check boxes - generic */ +.xmlParamsFields .paramValue input:checked + label {background:#63696f;color:#fff;box-shadow:0 1px 1px rgba(65,64,66,.14);} +/* Check boxes - show */ +.xmlParamsFields .paramValue input[value="1"]:checked + label {background:#3fa800;color:#fff;box-shadow:0 1px 1px rgba(65,64,66,.14);} +/* Check boxes - hide */ +.xmlParamsFields .paramValue input[value="0"]:checked + label {background:#bd362f;color:#fff;box-shadow:0 1px 1px rgba(65,64,66,.14);} +/* Check boxes - inherit */ +.xmlParamsFields .paramValue input[value=""]:checked + label {background:#63696f;color:#fff;box-shadow:0 1px 1px rgba(65,64,66,.14);} +.xmlParamsFields .paramValue input[value=""] + label {border-radius:3px 0 0 3px;} +.xmlParamsFields .paramValue input[value="1"] + label {border-radius:0 3px 3px 0;} + +/* the labels */ +.xmlParamsFields .paramLabel label {font-size:13px;font-weight:700;color:#777778;padding:10px 10px 10px 20px;line-height:1;margin:0;display:inline-block;vertical-align:middle;} +.xmlParamsFields .paramValue, +.xmlParamsFields .paramLabel {display:inline-block;vertical-align:middle;} +.xmlParamsFields .paramLabel {width:30%;} +.xmlParamsFields .paramLabel input[type="checkbox"] {margin-left:20px;display:inline-block;vertical-align:middle;position:relative;top:-2px;} +.xmlParamsFields .paramLabel input[type="checkbox"] + label {padding-left:5px;} + +.k2ScrollingContent > h3, +.k2NavTabContent h3 {font-size:16px;font-weight:300;padding-bottom:16px;margin-top:25px;margin-bottom:15px;border-bottom:2px solid #dddedf;color:#00afec;} +@media screen and (min-width:767px) { + .xmlParamsFields .paramValue {width:auto;} + .k2ScrollingContent > h3, + .k2NavTabContent h3 {font-size:24px;} + .xmlParamsFields .paramValue input[type="text"], + .xmlParamsFields .paramValue textarea {/*float:right;*/} +} + +div#k2AdminContainer.isJ25 form#adminForm div.xmlParamsFields fieldset input {float:none!important;} +div.paramValueSpacer {background:#f6f6f6;border-bottom:1px solid #e9e9e9;border-right:1px solid #e9e9e9;color:#666;font-weight:bold;text-align:right;font-size:11px;} + +/* Generic form additional styling - tags, users, usergroups etc. */ +.k2GenericForm {width:850px;max-width:100%;padding:0 20px;} +.k2GenericForm h3 {font-size:24px;font-weight:300;padding-bottom:16px;margin-top:25px;margin-bottom:15px;border-bottom:2px solid #dddedf;color:#00afec;} +.k2GenericForm .k2ItemFormEditor {padding:20px 0 20px 20px;} + +/* Additional parameters styling for the item form */ +.additionalParams {border-bottom:2px solid #f1f1f1;border-radius:3px;position:relative;overflow:hidden;margin:0;padding:0;} +.additionalParams > li {background:#ededed;padding-top:3px;padding-bottom:4px;display:block;overflow:hidden;padding:5px 12px 5px 25px;border-radius:3px;font-size:16px;} +.additionalParams > li:nth-child(2n-2) {background:#f7f7f7;} +.additionalParams label {font-size:13px;font-weight:700;color:#777778;padding:10px 0;line-height:1;margin:0;} + +/* Hits */ +.itemHits {text-align:center;color:#296d86;text-transform:uppercase;font-size:12px;font-weight:700;padding-top:20px;overflow:hidden;background:#2fbbec;border-radius:3px;} +.itemHits span {color:#fff;font-weight:300;font-size:70px;line-height:1;display:block;margin-bottom:15px;} +.itemHitsReset {background:#ededed;padding:8px;border-radius:0 0 3px 3px;} +#resetHitsButton {border-radius:3px;display:block;width:100%;font-weight:700;max-width:none;padding:5px 0;font-size:11px;color:#414042;border-color:#d4d7d9;background-color:#f0f2f2;box-shadow:0 1px 1px rgba(65,64,66,.14),inset 0 1px 0 #fff;} + +/* Rating */ +.itemRating {text-align:center;color:#8d6e3c;text-transform:uppercase;font-size:12px;font-weight:700;padding-top:20px;background:#f7be59;border-radius:3px;} +.itemRating span {color:#fff;font-weight:300;font-size:30px;line-height:1;display:block;margin:11px 0;} +.itemRatingReset {background:#ededed;padding:8px;border-radius:0 0 3px 3px;margin-top:15px;} +#resetRatingButton {border-radius:3px;display:block;width:100%;font-weight:700;max-width:none;padding:5px 0;font-size:11px;color:#414042;border-color:#d4d7d9;background-color:#f0f2f2;box-shadow:0 1px 1px rgba(65,64,66,.14),inset 0 1px 0 #fff;} + +/* Small - responsive blocks */ +@media screen and (min-width:767px) { + .row-resposive > .col:first-child {padding-left:0;} + .row-resposive > .col:last-child {padding-right:0;} + .row-resposive {overflow:hidden;width:100%;} + .col {float:left;padding:0 15px;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;} + .col6 {width:50%;} + .col3 {width:25%;} +} +.row-resposive {margin-bottom:45px;} + +/* Extrafields - newly generated elements */ +#exFieldsTypesDiv {padding-top:15px;} +#exFieldsTypesDiv input[type="text"] {min-height:30px;line-height:40px;} +#exFieldsTypesDiv input[type="button"], +#exFieldsTypesDiv button {margin-bottom:20px;display:inline-block;vertical-align:top;margin-right:10px;color:#414042;min-width:100px;padding:10px 15px;border-radius:3px;border:1px solid #dedede;border-bottom-color:#cacaca;background:#fdfdfd;white-space:normal;position:relative;font-weight:700;background:-moz-linear-gradient(top,#fdfdfd 0%,#f5f5f5 100%);background:-webkit-linear-gradient(top,#fdfdfd 0%,#f5f5f5 100%);background:linear-gradient(to bottom,#fdfdfd 0%,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdfdfd',endColorstr='#f5f5f5',GradientType=0);box-shadow:0 1px 1px rgba(65,64,66,.14),inset 0 1px 0 #fff;} +#exFieldsTypesDiv input[type="button"]:hover, +#exFieldsTypesDiv button:hover {background:#d4d7d9;} +#exFieldsTypesDiv .k2ExtraFieldNotice {color:#999;margin-left:10px;} + +#groupContainer {text-align:right;width:100%;clear:both;float:left;margin:20px 0 0;} +#groupContainer > span, +#groupContainer > label {font-weight:700;color:#777;padding-right:10px;} +.oldJ #groupContainer input[type="text"] {width:auto;} + + + +/* ====================================================================================================== */ +/* ====================================================================================================== */ +/* ====================================== Backend View Specific CSS ===================================== */ +/* ====================================================================================================== */ +/* ====================================================================================================== */ + +/* Settings - Joomla 3.x, 2.5 & 1.5 */ +.paramHeaderContent {background:#e5f7fd;border-radius:3px;line-height:1;padding:18px 25px;margin:25px 0 10px 0;color:#346b93;font-size:18px;} +.tab-pane > .control-group:first-child .paramHeaderContent {margin-top:0;} + +.form-horizontal .controls label, +.controls label, +.k2Table .k2SubTableValue label {min-width:85px;width:auto;text-align:center;border:1px solid #d4d6d8;line-height:33px;vertical-align:top;height:33px;font-size:12px;margin:0 -2px;padding:0 13px!important; +color:#8a8c8c;display:inline-block;vertical-align:middle;white-space:nowrap;background-color:#eff1f1; +box-shadow:0 1px 1px rgba(65,64,66,.14),inset 0 1px 0 #fff;} + +.controls label:hover, +.k2Table .k2SubTableValue label:hover {cursor:pointer;box-shadow:0 1px 1px rgba(65,64,66,.14),inset 0 0 10px rgba(0,0,0,.15);} +.controls input[type="radio"],.k2Table .k2SubTableValue input[type="radio"] {opacity:0;position:absolute;clip:rect(0,0,0,0);} + +.controls label:first-of-type, +.k2Table .k2SubTableValue label:first-of-type {border-radius:3px 0 0 3px;} +.controls label:last-of-type, +.k2Table .k2SubTableValue label:last-of-type {border-radius:0 3px 3px 0;} + +/* Check boxes - show/Yes */ +.controls input[value="1"]:checked + label, +.k2Table .k2SubTableValue input[value="1"]:checked + label, +label[id*="1-"].radio.isChecked {background:#3fa800;color:#fff;box-shadow:0 1px 1px rgba(65,64,66,.14);} + +/* Check boxes - hide/No */ +.controls input[value="0"]:checked + label, +.k2Table .k2SubTableValue input[value="0"]:checked + label, +label[id*="0-"].radio.isChecked {background:#bd362f;color:#fff;box-shadow:0 1px 1px rgba(65,64,66,.14);} + +/* Check boxes - Generic */ +.xmlParamsFields .paramValue label.isChecked, +.k2Table .k2SubTableValue label.isChecked, +.controls label.isChecked {background:#63696f;color:#fff;box-shadow:0 1px 1px rgba(65,64,66,.14);} + +/* Redefining the form */ +.form-horizontal .control-label:empty {display:none;} +.form-horizontal .controls {margin-left:0!important;} +.form-horizontal .control-label {min-width:350px;max-width:350px;} +.form-horizontal .control-label label {font-size:13px;font-weight:700;color:#777778;padding:15px 10px 10px;line-height:1;margin:0;} +.controls .radio, +.controls .checkbox {padding-left:0;} + +/* Bootstrap resets */ +.form-horizontal .control-group {margin-bottom:0!important;border-radius:3px;} +.form-horizontal .control-group:nth-child(2n-2) {background:#f7f7f7;} +.form-horizontal .controls > .radio:first-child, +.form-horizontal .controls > .checkbox:first-child {padding-top:10px;} +.k2Table .controls > .radio:first-child, +.k2Table .controls > .checkbox:first-child, +.k2GenericForm .controls > .radio:first-child, +.k2GenericForm .controls > .checkbox:first-child {padding-top:0px;} +.form-horizontal .controls fieldset {padding:10px 0;} +.form-horizontal .controls .chzn-container {margin:15px 0;} +.form-horizontal .controls input[type="text"], +.form-horizontal .controls textarea {margin:10px 0 15px 0;} + +.tab-pane {padding-top:25px;} + +/* Permissions */ +#permissions-sliders, +.rule-desc {padding:15px 15px 0;} +#permissions .alert {margin:5px 0 0;} +#permissions-sliders {border-radius:3px;} + +/* Item - Overrides */ +.K2AdminViewItem {} +#k2Author {font-weight:bold;color:#333;display:inline-block;margin-top:10px;margin-right:10px;} +div#k2TabContent {padding:0;} +span.k2ItemFormEditorTitle {display:block;color:#58595b;font-size:20px;font-weight:bold;padding:24px 0 12px 24px;} +.k2ItemFormEditor .editor {background:#f0f2f2;border-top:1px solid #d7d9d9;border-bottom:1px solid #e9ebec;} +.k2ItemFormEditor .editor .btn-toolbar {padding:4px 20px;} +input#del_image {display:block;} + +/* Flatpickr Overrides */ +.com_k2 input.numInput {height:auto;} +.com_k2 .flatpickr-calendar.showTimeInput.hasTime .flatpickr-time {padding:2px 10px 0px;} +.com_k2 .flatpickr-time.hasSeconds .numInputWrapper {padding:0 5px;} +.com_k2 .numInputWrapper span {max-height:35%;right:5px;} +.com_k2 .numInputWrapper span.arrowDown {top:auto;bottom:9px;border-radius:0 0px 5px 0;} +.com_k2 .numInputWrapper span.arrowUp {top:4px;border-radius:0 5px 0 0 } + +/* System Messages */ +.view-item #system-message-container {padding:0;} +.view-item #system-message-container .alert {margin-bottom:0;border-radius:0;} + +/* Item - Free tagging */ +ul.tags {background:#fff;border:1px solid #ccc;cursor:default;min-height:48px;height:auto;display:inline-block;margin:0;padding:4px 6px;border-radius:3px;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-sizing:border-box;width:100%;} +ul.tags li {border-radius:3px;background:#d1e8fc;color:#0f4776;line-height:14px;list-style:none;float:left;clear:none;padding:10px;margin:2px 2px 2px 0;font-size:14px;font-weight:bold;font-family:"Lucida Grande";vertical-align:middle;} +ul.tags li span.tagRemove {font-size:12px;font-family:"Lucida Grande";color:#0b4373;cursor:pointer;} +ul.tags li span.tagRemove:hover {color:#505050;cursor:pointer;} +ul.tags li input {border:none;padding-top:2px;background:none;font-size:12px;font-weight:normal;font-family:"Lucida Grande";float:left;clear:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;} +ul.tags li input:focus {background:none;} +ul.tags li input.tagsLoading {background:url(../images/backend/loader.gif) no-repeat 50% 50%;} +ul.tags li.clr {clear:both;height:0;line-height:0;border:none;float:none;background:none;padding:0;margin:0;} +ul.tags li.tagAdd {border:none;padding:0;background:none;height:35px;} +ul.tags li.tagAdd input#search-field {border:none;height:35px;min-height:0;line-height:35px;}ul.tags li.tagAdd input {border:none;} +p.k2TagsNotice {display:block;font-size:11px;font-weight:bold;margin:0;padding:0;color:#999;} + +.ui-autocomplete {position:absolute;margin:0;padding:0;list-style:none;border:1px solid #eee;background-color:white;border-right-color:#ddd;border-bottom-color:#ddd;text-align:left;z-index:50;} +* html .ui-autocomplete {width:1px;} /* without this the menu expands to 100% in IE6 */ + +.ui-menu {list-style:none;padding:2px; margin:0; margin-top:-3px;display:block; float:left;} +.ui-menu .ui-menu-item {margin:0;padding:0;zoom:0;float:left;clear:left;width:99%;} +.ui-menu .ui-menu-item a {text-decoration:none; display:block; padding:.2em .4em; line-height:1.5;zoom:1;font-weight:bold;} +.ui-menu .ui-menu-item a.ui-state-hover, +.ui-menu .ui-menu-item a.ui-state-active {margin:-1px;background-color:#444;color:#fff;} + +/* Item - Selection based tagging */ +#tagsLog {float:left;padding-left:4px;font-weight:bold;line-height:16px;vertical-align:middle;} +#tagsLog.tagsLoading {background:url(../images/backend/loader.gif) no-repeat 50% 50%;margin-left:4px;padding:0;width:16px;height:16px;display:block;float:left;} + +table#tagLists {width:100%;} +table#tagLists tr td span {display:block;font-weight:bold;} +table#tagLists tr td#tagListsLeft {width:40%;} +table#tagLists tr td#tagListsLeft select {width:99%;height:106px;} +table#tagLists tr td#tagListsButtons {vertical-align:middle;width:20%;} +table#tagLists tr td#tagListsButtons input {width:99%;} +table#tagLists tr td#tagListsRight {width:40%;} +table#tagLists tr td#tagListsRight select {width:99%;height:106px;} + +/* Item - Extra Fields Validation */ +#k2ExtraFieldsValidationResults {clear:both;font-weight:bold;font-size:12px;color:#369;margin:12px 0 4px;padding:16px;background-color:#d5e7fa;border-top:4px solid #96b0cb;display:none;} +#k2ExtraFieldsValidationResults h3 {padding:0;margin:0;font-size:20px;color:#369;border:0;} +ul#k2ExtraFieldsMissing {margin:8px;padding:0 18px;overflow:hidden;} +ul#k2ExtraFieldsMissing li {font-weight:normal;} +.k2Invalid {border-color:red;} + +/* Item - Attachments */ +#itemAttachments {margin-top:15px;padding-top:10px;} +#itemAttachments label {font-weight:bold;} +#itemAttachments input {margin-bottom:10px;} +#itemAttachments input.linkTitle {width:200px;} +#itemAttachments textarea {width:200px;} +#itemAttachments a.k2AttachmentBrowseServer {margin-right:8px;} +td.k2ItemFormDateField {white-space:nowrap;} +td.k2ItemFormDateField input {} +td.k2ItemFormDateField img.calendar {vertical-align:bottom;margin-left:2px;} + +@media screen and (min-width:767px) { + #itemAttachments label {margin-right:10px;width:170px;float:left;clear:left;text-align:right;} +} + +.itemAttachmentsTable {width:100%;margin:0 0 20px;} +.itemAttachmentsTable th {border-bottom:3px solid #d7d9d9;border-top:0;color:#6d6f71;font-size:14px;font-weight:700;text-align:left;line-height:1;padding:12px 14px 12px 0;} +.itemAttachmentsTable th.k2Center {text-align:center;} +.itemAttachmentsTable td {padding:12px 14px 12px 0;font-size:13px;} +.itemAttachmentsTable td input {padding:8px 10px 7px;border:1px solid #d7d9d9;border-radius:3px;height:auto;} +.deleteAttachmentButton {font-size:18px;color:#9e0b0f;} +.downloadAttachmentButton {padding-right:10px;font-size:18px;} + +/* New attachments form */ +.itemNewAttachment {border-top:3px solid #d7d9d9;padding:20px 0;} +.itemNewAttachment button {background:none;float:right;border:0;font-size:16px;color:#9e0b0f;font-size:18px;} +.itemNewAttachment .attachmentGap {margin-bottom:20px;} +.itemNewAttachment button + input[type="text"] {min-height:30px;line-height:40px;vertical-align:top;} + +/* Item - Extrafields & Image Fields */ +#extraFields {padding-top:20px;} +.itemAdditionalField {margin-bottom:25px;clear:both;width:100%;float:left;} +.itemAdditionalField .itemAdditionalValue {margin-right:15px;margin-bottom:10px;} +.itemAdditionalField label {font-size:13px;color:#68696b;font-weight:700;display:block;margin-top:0;margin-bottom:0;padding-top:5px;} +.itemAdditionalField .sep, +.itemAdditionalField label.sep {display:block;font-weight:700;margin:25px 0;font-size:15px;text-transform:uppercase;} +.itemAdditionalField .itemAdditionalData {} +.itemAdditionalField input[type="text"], +.itemAdditionalField input[type="email"] {width:100%;max-width:100%;min-height:40px;line-height:40px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} +.itemAdditionalField textarea {width:100%;max-width:100%;min-height:40px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} +.itemAdditionalField input[type="text"]#existingImageValue {width:100%;display:block;margin-bottom:15px;} +.nicEdit-main {outline:0;} +.k2ExtraFieldHeader {font-size:16px;color:#68696b;font-weight:300;display:block;margin-top:0;margin-bottom:0;padding-top:5px;} + +/* padding correction for the calendar */ +#extraFieldsContainer .k2Calendar + .btn {padding:10px 12px;} +#extraFieldsContainer .icon-calendar {margin-right:0;} + +@media screen and (min-width:767px) { + .itemAdditionalField .itemAdditionalValue {width:100px;margin-bottom:0 } + .itemAdditionalField label {display:inline-block;vertical-align:middle;} + .itemAdditionalField .itemAdditionalData {min-width:75%;float:left;} + .itemNewAttachment button + input[type="text"] {margin-left:-12px;} + .itemAdditionalField .sep, + .itemAdditionalField label.sep {display:inline-block;vertical-align:middle;margin:0 25px;} + .itemAdditionalField input[type="text"]#existingImageValue {width:auto;display:inline-block;vertical-align:middle;margin-right:-10px;margin-bottom:0;} + .k2ExtraFieldHeader {margin-left:120px;} +} + +/* Item Buttons */ +.itemAdditionalField .itemAdditionalData > button, +.itemAdditionalField .itemAdditionalData > input[type="button"], +.itemAdditionalField .itemAdditionalData > input[type="submit"], +.k2Button {color:#414042;min-width:150px;padding:10px 15px;border-radius:3px;;border:1px solid #dedede;border-bottom-color:#cacaca;background:#fdfdfd;white-space:normal;display:inline-block;vertical-align:middle;position:relative;font-weight:700;background:-moz-linear-gradient(top,#fdfdfd 0%,#f5f5f5 100%);background:-webkit-linear-gradient(top,#fdfdfd 0%,#f5f5f5 100%);background:linear-gradient(to bottom,#fdfdfd 0%,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdfdfd',endColorstr='#f5f5f5',GradientType=0);box-shadow:0 1px 1px rgba(65,64,66,.14),inset 0 1px 0 #fff;} +.itemAdditionalField .itemAdditionalData > button:hover, +.itemAdditionalField .itemAdditionalData > input[type="button"]:hover, +.itemAdditionalField .itemAdditionalData > input[type="submit"]:hover, +.itemAdditionalField .k2Button:hover {text-decoration:none;border-color:#dedede;border-bottom-color:#cacaca;background:#fdfdfd;background:-moz-linear-gradient(top,#fdfdfd 0%,#f5f5f5 100%);background:-webkit-linear-gradient(top,#fdfdfd 0%,#f5f5f5 100%);background:linear-gradient(to bottom,#fdfdfd 0%,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdfdfd',endColorstr='#f5f5f5',GradientType=0);} + +/* Additional item secondary fields */ +.itemAdditionalBlock {display:inline-block;vertical-align:middle;margin-right:15px;} +.itemAdditionalBlock.sep {margin:0 25px 0 0;color:#2f98f3;} +.itemAdditionalBlock label {font-weight:700;padding:0;} +.itemAdditionalBlock input[type="text"], +.itemAdditionalBlock input[type="email"], +.itemAdditionalBlock textarea {margin-bottom:0;} + +.k2DocLink {font-weight:700;margin-top:15px;} +.k2DocLink a {} +.k2DocLink span {} + +/* Item - Gallery */ +.itemGalleryBlock {margin-bottom:20px;} +.itemGalleryBlock label {display:block;margin-bottom:10px;} +#itemGallery label {display:inline;} +.itemGalleryBlock input[type="text"] {max-width:300px;} +.itemGalleryBlock.separator {text-transform:uppercase;font-weight:700;color:#46afff;} +span.k2GalleryNotice {cursor:pointer;text-indent:-99px;width:16px;height:16px;line-height:16px;padding:0;margin:0 0 -4px 0;display:inline-block;overflow-x:hidden;} + +/* Admin - Item */ +.itemPlugins {margin-top:20px;clear:both;} +.itemPlugins label {font-size:13px;color:#68696b;font-weight:700;display:block;margin-top:0;margin-bottom:0;padding-top:5px;padding-bottom:10px;} +.itemPluginsContent {padding:0 20px;} + +/* Admin - Media Manager */ +.K2AdminViewMedia {border-left:1px solid #d3d3d3;border-bottom:1px solid #d3d3d3;} + #elfinderContainer {width:auto;padding:4px;margin:0;} + .isJ30.k2IsBackend #elfinder input {width:95%;} /* Fix for Joomla 3.2+ */ + +/* Lists - Generic styling */ +#k2AdminContainer {position:relative;width:auto;clear:both;margin-bottom:10px;} + +.com_k2.view-items, +.com_k2.view-categories, +.com_k2.view-tags, +.com_k2.view-comments, +.com_k2.view-usergroups, +.com_k2.view-users, +.com_k2.view-extrafields, +.com_k2.view-extrafieldsgroups {background:#f0f2f2;} + +.isJ30 .row-fluid .span2 {max-width:12%;} +.isJ30 .row-fluid .span10 {margin-left:0;width:88%;} + +/* Lists - filters */ +#k2AdminContainer .k2AdminTableFilters {margin-bottom:0;width:100%;border-left:1px solid #dbdcdc;} +#k2AdminContainer .k2AdminTableFilters .chzn-container {margin-bottom:5px;} +#k2AdminContainer .k2AdminTableFilters tr td {background:#fff;padding-top:15px;} + +/* Filters on smaller viewports */ +#k2AdminContainer .k2AdminTableFiltersSelects, +#k2AdminContainer .k2AdminTableFiltersSearch {display:block;width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} +#k2AdminContainer .k2AdminTableFiltersSelects select {max-width:48%;} + +@media screen and (min-width:920px) { + #k2AdminContainer .k2AdminTableFiltersSelects, + #k2AdminContainer .k2AdminTableFiltersSearch {display:table-cell;width:auto;} + #k2AdminContainer .k2AdminTableFilters tr td {border-bottom:1px solid #dbdcdc;border-top:0;} + table.k2AdminTableFilters tr td.k2AdminTableFiltersSelects {text-align:right;} + #k2AdminContainer .k2AdminTableFiltersSelects select {max-width:none;} +} + +/* Legacy styling */ +table.k2AdminTableFilters {width:100%;} +table.k2AdminTableFilters tr td.k2AdminTableFiltersSearch {white-space:nowrap;} +table.k2AdminTableFilters tr td.k2AdminTableFiltersSelects .chzn-container {text-align:left;} +table.k2AdminTableFilters tr td.k2AdminTableFiltersSelects select {margin:1px 0 5px 0;} + +/* Edit Forms */ +table.adminFormK2 {width:100%;margin-bottom:16px;} + +/* Lists - items */ +#k2AdminContainer .adminlist {margin-bottom:0;border-left:1px solid #dbdcdc;} +#k2AdminContainer .adminlist input[type="checkbox"] {margin-top:0;} +#k2AdminContainer .adminlist thead tr th {background:#fff;border-bottom:1px solid #dbdcdc;} +#k2AdminContainer .adminlist tbody tr td {padding-top:15px;padding-bottom:15px;} +#k2AdminContainer .adminlist tfoot tr td {background:#fff;border-bottom:1px solid #dbdcdc;border-top:1px solid #dbdcdc;} +#k2AdminContainer .adminlist a {text-decoration:none;color:#636b6e;cursor:pointer;} +#k2AdminContainer .adminlist a.editComment {color:#46afff;} +#k2AdminContainer .adminlist a:hover {color:#46afff;} + +.isJ15 #k2AdminContainer .adminlist tr td, +.isJ25 #k2AdminContainer .adminlist tr td {background:#f0f2f2;border-bottom:1px solid #dbdcdc;} + +.table-responsive-wrap {position:relative;} +.table-responsive {width:100%;margin-bottom:15px;overflow-y:hidden;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar;} + +/* minimal modal */ +.jw-modal {display:none;position:fixed;z-index:9999;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.3);} +.jw-modal.jw-modal-open {display:block;} +.jw-modal-main {padding-top:40px;} +.jw-modal-header {color:#fff;padding:25px 20px;font-size:20px;font-weight:300;letter-spacing:-1px;background-color:#63696f;box-shadow:0 1px 0 rgba(0,0,0,.18);overflow:hidden;} +.jw-modal-header h3 {margin:0;font-size:20px;} +.jw-modal-content {position:absolute;left:50%;width:650px;border:1px solid rgba(0,0,0,.8);background-color:#fdfdfd;box-shadow:0 0 29px rgba(0,0,0,.16); +z-index:100;margin:25px auto 25px -325px;font-family:'Open Sans',sans-serif;-webkit-font-smoothing:antialiased;font-smoothing:antialiased;} +.jw-modal-footer {padding:16px 0;background-color:#eff1f1;box-shadow:0 1px 0 rgba(0,0,0,.18);clear:both;width:100%;overflow:hidden;} + +/* Button styling */ +.jw-btn {display:inline-block;vertical-align:middle;white-space:nowrap;color:#fdfdfd;font-size:13px;line-height:1;padding:10px 30px;border-radius:3px;border:1px solid #363a3d;font-weight:700;} +.jw-btn-save {border:1px solid #363a3d;background-color:#3fa700;box-shadow:0 1px 1px rgba(65,64,66,.14),inset 0 1px 0 #54db00;} +.jw-btn-save:hover {background:#358b01;} +.jw-btn-close {border-color:#a53222;background-color:#d7412d;box-shadow:0 1px 1px rgba(65,64,66,.14),inset 0 1px 0 #ff4d35;} +.jw-btn-close:hover {background:#a53222;} + +/* Information View */ +.k2ViewIsInfo .header, +.k2ViewIsInfo .subhead {position:relative;z-index:2;} + +#k2InfoPage {max-width:1300px;} +#k2InfoPage .k2ScrollingContent {margin-bottom:10px } + +#k2AdminContainer #k2InfoPage h1, +#k2AdminContainer #k2InfoPage h2 {margin-bottom:20px;padding:0;font-weight:400;font-size:26px;line-height:28px;} +#k2InfoPage a {color:#00afec;} +#k2InfoPage ul {margin-bottom:30px;} +#k2InfoPage table li {background:#fff;} + +.isJ15 #k2InfoPage ul.k2ScrollSpyMenu {top:175px;} +.isJ25 #k2InfoPage ul.k2ScrollSpyMenu {top:183px;} +.isJ30 #k2InfoPage ul.k2ScrollSpyMenu {top:0;padding-top:138px;border-left:1px solid #e3e4e4;} + +#k2InfoPage ul.k2ScrollSpyMenu {padding:0;height:100%;padding-top:31px;z-index:1;} +#k2InfoPage ul.k2ScrollSpyMenu li {border-bottom:1px solid #e3e4e4;border-right:1px solid #e3e4e4;} +#k2InfoPage ul.k2ScrollSpyMenu > li:first-child {border-top:1px solid #e3e4e4;} + +#k2InfoPage ul.k2ScrollSpyMenu li a {font-size:14px;padding:17px 28px;display:block;color:#636b6e;} +#k2InfoPage ul.k2ScrollSpyMenu li a.active {background:#f7f7f7;} +#k2InfoPage ul.k2ScrollSpyMenu li a:hover {background:#00afec;color:#fff;} +#k2InfoPage .fa {float:right;} + +#k2InfoPage table, +#k2InfoPage fieldset {width:100%;border:0;border-spacing:0;} +#k2InfoPage fieldset div {padding:10px 0 0;} +#k2InfoPage .k2InfoTable tr td:first-child {width:70%;} +#k2InfoPage .k2InfoTable tr td:last-child {width:30%;} + +#k2InfoPage fieldset {margin-bottom:40px;} + +#k2InfoPage legend {font-size:23px;font-weight:300;color:#4a4949;display:block;margin:0 0 10px;padding-bottom:10px;border-bottom:1px solid #c5c4c4;position:static;float:none;} +#k2InfoPage th {background:#fff;height:35px;line-height:35px;text-align:left;padding:0 15px;} +#k2InfoPage td {padding:12px 15px;border:0;} +#k2InfoPage tr td:first-child {border-radius:3px 0 0 3px;} +#k2InfoPage tr td:last-child {border-radius:0 3px 3px 0;} +#k2InfoPage table.stripped tr:nth-child(2n-1) td {background:#f7f7f7;} +#k2InfoPage .green {color:#3fa800;font-weight:600;} +#k2InfoPage .red {color:#bd362f;font-weight:600 } + +/* About Block */ +#k2InfoPage #k2AboutBlock {font-size:14px;line-height:1.65;} +#k2InfoPage #k2AboutBlock h2 {margin:30px 0 10px;border:none; +padding:0;color:#4a4949;} +#k2InfoPage #k2AboutBlock a {padding-bottom:2px;border-bottom:1px solid #dbdcdc;} + + + +/* ====================================================================================================== */ +/* ====================================================================================================== */ +/* ====================================== Joomla CSS Normalizations ===================================== */ +/* ====================================================================================================== */ +/* ====================================================================================================== */ + +/* Joomla 1.5 */ +html.isJ15 {overflow-y:scroll;} +html.isJ15 #system-message {margin:-26px 0 16px;} +html.isJ15 #system-message dd ul {padding:20px 10px;} +html.isJ15 div#element-box div.m {padding:0;border-bottom:1px solid #ccc;} +html.isJ15 div#element-box div.m div#k2AdminContainer #k2FormTopNav ul.k2NavTabs {border-top:1px solid #d4d7d9;} +html.isJ15 div#element-box div.m div#k2AdminContainer #k2FormTopNav ul.k2NavTabs li.ui-tabs-selected a:before {content:"\f0d8";font-family:"FontAwesome";font-style:normal;font-weight:normal;text-decoration:inherit;color:#fff;font-size:32px;position:absolute;bottom:-12px;left:50%;margin-left:-16px;width:32px;text-shadow:0px -1px 1px #ccc;} + +/* Joomla 1.5 & 2.5 */ +html.isJ25 {overflow-y:scroll;} +html.isJ25 div#element-box div.m {padding:10px 0;} +html.isJ25 div#element-box div.m div#k2AdminContainer {margin-top:-10px;background:#fff;} +html.isJ25 div#element-box div.m div#k2AdminContainer #k2FormTopNav {padding:0;margin-top:0;} +html.isJ25 div#element-box div.m div#k2AdminContainer #k2FormTopNav ul.k2NavTabs {border-top:1px solid #d4d7d9;} +html.isJ25 div#element-box div.m div#k2AdminContainer #k2FormTopNav ul.k2NavTabs li.ui-tabs-selected a:before {content:"\f0d8";font-family:"FontAwesome";font-style:normal;font-weight:normal;text-decoration:inherit;color:#fff;font-size:32px;position:absolute;bottom:-12px;left:50%;margin-left:-16px;width:32px;text-shadow:0px -1px 1px #ccc;} +html.isJ25 div.m {border:0;} +html.isJ25 div.m, +html.isJ25 #content-box {-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} +html.isJ25 .xmlParamsFields .paramValue label {padding:0 13px!important;} +html.isJ25 #element-box {margin-bottom:0;padding:0;} +html.isJ25 #toolbar-box {padding:0 0;} +html.isJ25 div#toolbar-box div.m {padding:10px 0;} +html.isJ25 .xmlParamsFields .paramValue input[type="text"], +html.isJ25 .xmlParamsFields .paramValue textarea, +html.isJ25 .xmlParamsFields .paramValue select {margin-left:0;} +html.oldJ #k2AdminContainer .k2AdminTableFilters, +html.oldJ #k2AdminContainer .adminlist {border-left:0;} +.oldJ .controls input[type="radio"], +.oldJ .k2Table .k2SubTableValue input[type="radio"] {top:0;left:0;} + +/* The submenu for Joomla 1.5 & 2.5 */ +html.isJ25 #toolbar-box {margin-bottom:0;} +html.isJ25 #submenu-box, +html.isJ15 #submenu-box {padding:0;margin:0;border-top:1px solid #d4d7d9;float:left;width:100%;} +html.isJ25 #submenu-box div.m, +html.isJ15 #submenu-box .m {border:0;padding:0;} + +html.isJ25 #submenu, +html.isJ15 #submenu {border-bottom:1px solid #d4d7d9;float:left;width:100%;background:#f0f2f2;} +html.isJ25 #submenu li a, +html.isJ15 #submenu li a {display:block;color:#777;font-size:14px;text-decoration:none;font-weight:normal;outline:0;padding:21px 24px;margin:0;border-right:1px solid #d4d7d9;position:relative;} +html.isJ25 #submenu li a.active, +html.isJ15 #submenu li a.active {color:#0091ff;background:#f0f2f2;} +html.isJ25 #submenu li a.active:before, +html.isJ15 #submenu li a.active:before {text-align:center;content:"\f0d8";font-family:"FontAwesome";color:#fff;position:absolute;font-size:32px;bottom:-2px;left:50%;margin-left:-16px;width:32px;text-shadow:0px -1px 1px #ccc;} + +/* The list */ +.oldJ table.adminlist {border-spacing:0;} +.oldJ table.adminlist tbody tr td {border:0;} +.oldJ table.adminlist thead th {padding:10px 0;border-left:0;border-right:0;} +#k2AdminContainer.oldJ .adminlist {border:0;} +#k2AdminContainer.oldJ .adminlist tfoot tr td {border-top:0;padding:15px 0;} +#k2AdminContainer.oldJ table.k2AdminTableFilters {border-left:0;} +#k2AdminContainer.oldJ .k2AdminTableFilters tr td {padding:10px;} +#k2AdminContainer.oldJ .adminlist tbody tr td {padding:10px;} + +html.isJ25 #k2AdminContainer .k2AdminTableFilters tr td {padding:10px;} + +.oldJ h1 {color:#00AFEB;} + +/* Item form */ +.oldJ fieldset {padding-left:0;border:0;} +.oldJ select, +.oldJ input[type="text"], +.oldJ input[type="email"] {height:30px;min-height:30px;width:auto;max-width:100%;} +.oldJ select {max-width:300px;} + +/* field normalisation */ +.k2ViewIsItem .oldJ input[type="file"], +.k2ViewIsCategory .oldJ input[type="file"] {margin-bottom:20px;} +input#k2ImageBrowseServer {width:auto;height:30px;line-height:8px;margin-left:10px;} +.k2ViewIsCategory .oldJ input, +.k2ViewIsCategory .oldJ select, +.k2ViewIsItem .oldJ select {height:40px;width:100%;} + +/* Proper widths */ +.k2ViewIsItem .oldJ input, +.k2ViewIsItem .oldJ input[type="text"] {width:auto;min-width:208px;} +.k2ViewIsItem .oldJ input.k2TitleBox {min-width:100%;} + +.oldJ input[type="text"] {width:100%;} +.oldJ .adminlist input[type="text"] {width:auto;min-width:0;} +.oldJ .k2TagsNotice {margin-bottom:30px;} +.oldJ #itemAttachments a.k2AttachmentBrowseServer {margin-left:20px;} + +/* Mimick Joomla 3.x's input styling for 1.5 & 2.5 */ +.oldJ label, +.oldJ .paramLabel {font-size:13px;font-weight:700;display:inline-block;vertical-align:middle;color:#777;} +.oldJ textarea, +.oldJ input[type="text"], +.oldJ input[type="password"], +.oldJ input[type="number"], +.oldJ input[type="email"], +.oldJ input[type="url"], +.oldJ .uneditable-input, +.oldJ .k2ViewIsItem select, +.oldJ .k2ViewIsCategory select, +.oldJ .k2GenericForm select {background-color:#fff;border:1px solid #ccc;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-transition:border linear .2s,box-shadow linear .2s;-moz-transition:border linear .2s,box-shadow linear .2s;transition:border linear .2s,box-shadow linear .2s;display:inline-block;height:30px;font-size:13px;padding:0 10px;min-width:80px;line-height:18px;color:#555;border-radius:3px;vertical-align:middle;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;} +.oldJ .k2GenericForm select {min-width:169px;} +.oldJ input.k2OrderBox {} /* don't hard code the width as we never know how large the number can be */ +.oldJ td.order span {display:none;} + +/* Forms */ +.k2GenericForm > h3:first-child {display:none;} + +/* Params */ +.oldJ .xmlParamsFields ul li {padding:10px 20px 10px 0;} + +/* Joomla 1.5 specific */ +#system-message dd.message {overflow:hidden;margin-top:0;} +.isJ15 div.header {padding:0;margin:12px;} +.isJ15 div.toolbar {margin-top:10px;} +.isJ15 #content-box .padding {padding:0;} +.isJ15 div#toolbar-box div.t, +.isJ15 div#element-box div.section-box div.t {padding:0;background:none;} +.isJ15 div.t, +.isJ15 div.b {display:none!important;} +.isJ15 div#toolbar-box {margin:0;} +.isJ15 div.m {border:0!important;} +.isJ15 #border-bottom {display:none;} +.isJ15 #submenu-box {margin:0;} +.isJ15 #k2AdminFooter {margin:10px auto 0;padding:0 0 20px;border-bottom:1px solid #ccc;} + +/* Joomla 3.x specific */ +html.isJ30 {} +body#com_k2 {} +.com_k2 .subhead-collapse {margin-bottom:1px;} +.com_k2 .subhead {border-bottom:1px solid #D4D7D7;margin-bottom:0;} + +/* Fix user group permissions category drop-down glitches under Joomla 3.0 */ +#paramscategories_chzn li {padding:3px 20px 3px 5px;} + +@media screen and (max-width:600px) { + .k2ItemFormEditor .editor .btn {display:block;margin:0 0 15px!important;text-align:left;} + .k2ItemFormEditor .editor .btn-group {display:block;} + .k2ItemFormEditor .editor .btn-toolbar {-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;} + .k2ItemFormEditor .editor .btn-toolbar.pull-right {float:none;width:100%;padding-top:0;margin-top:-10px;} + .k2ItemFormEditor .editor .btn-toolbar.pull-left {float:none;} +} + +/* -------------- View Styling -------------- */ + +/* Admin - Dashboard */ +#cpanel.k2AdminCpanel {float:left;width:52%;} +#k2AdminStats {float:right;width:47%;} +#k2AdminStats dl.tabs dt.closed {border:1px solid #ccc;} +#k2AdminStats dl.tabs dt.open {background:#fff;border:1px solid #ccc;border-bottom:1px solid #fff;} +div.isJ25 div.current {background:#fff;} +#k2AdminStats table.adminlist {width:100%;} + +/* Admin - Item - Autocomplete */ +.ui-autocomplete {position:absolute;margin:0;padding:0;list-style:none;border:1px solid #eee;background-color:white;border-right-color:#ddd;border-bottom-color:#ddd;text-align:left;z-index:50;} +* html .ui-autocomplete {width:1px;} /* without this, the menu expands to 100% in IE6 */ + +.ui-menu {list-style:none;padding:2px; margin:0; margin-top:-3px;display:block; float:left;} +.ui-menu .ui-menu-item {margin:0;padding:0;zoom:0;float:left;clear:left;width:99%;} +.ui-menu .ui-menu-item a {text-decoration:none; display:block; padding:.2em .4em; line-height:1.5;zoom:1;font-weight:bold;} +.ui-menu .ui-menu-item a.ui-state-hover, +.ui-menu .ui-menu-item a.ui-state-active {margin:-1px;background-color:#444;color:#fff;} + +/* Admin - Comments */ +td#k2Comment {} +div.commentText {} +div.commentToolbar {padding-top:4px;} +div.commentToolbar span.k2CommentsLog {display:block;float:right;font-weight:bold;} +div.commentToolbar span.k2CommentsLoader {background:url(../images/backend/loader.gif) no-repeat 0 50%;padding-left:24px;} + a.editComment {} + div.k2CommentControls {display:none;} + div.k2CommentControls span.k2OptionSep {margin:0 4px;} + a.saveComment {} + a.closeComment {} + +/* New views introduced in 2.7 - Batch & Move (using the -alt suffix) */ +.header-alt {padding:15px 8px;font-size:20px;font-weight:300;letter-spacing:-1px;background-color:#fff;box-shadow:0 1px 0 rgba(0,0,0,.18);} +.header-alt h3 {margin:0;padding:0;line-height:1;font-weight:300;} +.header-alt.margin {margin-bottom:48px;} + +.subheader-alt {overflow:hidden;padding-top:24px;padding-bottom:24px;border-top:1px solid #d0d0cf;border-bottom:1px solid #d0d0cf;margin-bottom:24px;} +.subheader-alt label {display:inline-block;vertical-align:middle;color:#000;font-weight:700;margin:0;line-height:1; } +.subheader-alt input[type="radio"] {display:inline-block;vertical-align:middle;margin-right:5px;margin-top:0;} + +.action-alt {margin-bottom:25px;min-height:66px;} +.action-alt ol {padding-left:15px;margin:10px 0 15px 0;font-size:13px;font-weight:500;} +.action-alt ol li {margin-bottom:8px;} + +.label-alt {font-weight:700;color:#636a6f;font-size:13px;line-height:1;display:block;} +.label-alt.margin {margin-bottom:10px;} +.label-alt .fa {font-size:18px;display:inline-block;vertical-align:middle;margin-right:5px;} +.oldJ .label-alt {display:block;} + + + +/* ====================================================================================== */ +/* ====================================================================================== */ +/* ====================================== Overrides ===================================== */ +/* ====================================================================================== */ +/* ====================================================================================== */ + +/* Joomla System Messages */ +#system-message-container {position:relative;z-index:11;width:60%;margin:0 auto !important;padding:0 !important;} +#system-message-container .alert {margin:8px 0;} + +/* Modal Selector */ +#k2AdminContainer.inModalSelector #adminForm {margin-top:56px;position:relative;z-index:9;} +#k2AdminContainer.inModalSelector .k2AdminTableFilters {border:0;border-bottom:1px solid #dbdcdc;} +#k2AdminContainer.inModalSelector .k2AdminTableFilters tr, +#k2AdminContainer.inModalSelector .k2AdminTableFilters td {border:0 !important;} +#k2AdminFooter.inModalSelector {margin:8px auto;} +#k2ModalSelectorHeader {background:#fff url(../images/backend/k2_logo_126x48.png) no-repeat 8px 50%;background-size:80px;padding:16px 0 16px 108px;margin:0;position:fixed;top:0;left:0;right:0;z-index:10;border-bottom:4px solid #eee;} + + + +/* === Frontend Editing === */ +#k2ModalContainer {padding:0;margin:0;} + #k2ModalHeader {background:#fff;text-align:right;position:fixed;top:0;left:0;right:0;z-index:10;padding:8px;margin:0;border-bottom:4px solid #eee;} + #k2ModalLogo {background:url(../images/backend/k2_logo_126x48.png) no-repeat 8px 50%;background-size:80px;padding:16px 0 16px 108px;margin:0;float:left;} + #k2ModalToolbar {display:inline-block;margin:12px 12px 0 0;border-collapse:separate;} + #k2ModalToolbar td {border:none;} + #k2ModalToolbar td.button a {display:block;padding:4px 8px;color:#fff;border:0;border-radius:4px;font-size:14px;font-weight:bold;text-decoration:none;background:#222;cursor:pointer;} + #k2ModalToolbar #toolbar-publish a, + #k2ModalToolbar #toolbar-save a {background:#18bc9c;} + #k2ModalToolbar #toolbar-publish a:hover, + #k2ModalToolbar #toolbar-save a:hover {background:#128f76;} + #k2ModalToolbar #toolbar-unpublish a, + #k2ModalToolbar #toolbar-close a, + #k2ModalToolbar #toolbar-cancel a {background:#e74c3c;} + #k2ModalToolbar #toolbar-unpublish a:hover, + #k2ModalToolbar #toolbar-close a:hover, + #k2ModalToolbar #toolbar-cancel a:hover {background:#d62c1a;} +#k2ModalContainer #adminForm {margin-top:86px;position:relative;z-index:9;} + #k2ModalContainer .k2AdminTableFilters {border:0;border-bottom:1px solid #dbdcdc;} + #k2ModalContainer .k2AdminTableFilters tr, + #k2ModalContainer .k2AdminTableFilters td {border:0 !important;} + #k2ModalContainer #adminForm table tfoot tr td {padding:8px !important;} + +/* Item */ +#k2ModalPermissionsNotice {text-align:center;} +#k2ModalPermissionsNotice p {display:inline-block;color:#fff;font-size:12px;background:#3498db;padding:8px;margin:8px auto;border-radius:4px;} +div#k2Modal div#k2ID {top:-2px;right:160px;} /* Overrides backend position */ +div#k2Modal div#editor-xtd-buttons .button2-left {display:inline;} /* Joomla 1.5 */ + +/* Comments */ +#k2ModalContainer .k2CommentsPagination {text-align:center;} +#k2ModalContainer .k2CommentsPagination .pagination {margin:0;padding:0;} +#k2ModalContainer .k2CommentsPagination .pagination span, +#k2ModalContainer .k2CommentsPagination .pagination a {} + +/* Joomla System Messages */ +#system-message-container {position:fixed;z-index:11;width:40%;margin:0 auto !important;padding:0 !important;top:20px;left:20%;right:20%;} +#system-message-container .alert {margin:8px 0;} + + + +/* End */ diff --git a/deployed/k2/media/k2/assets/css/k2.css b/deployed/k2/media/k2/assets/css/k2.css new file mode 100644 index 00000000..a23ffd43 --- /dev/null +++ b/deployed/k2/media/k2/assets/css/k2.css @@ -0,0 +1,927 @@ +/** + * @version 2.7.x + * @package K2 + * @author JoomlaWorks http://www.joomlaworks.net + * @copyright Copyright (c) 2006 - 2016 JoomlaWorks Ltd. All rights reserved. + * @license GNU/GPL license:http://www.gnu.org/copyleft/gpl.html + */ + +/* Import Open Sans */ +@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,800italic,800,700italic,700,600,600italic,400italic,300italic,300&subset=latin,greek,vietnamese,cyrillic-ext,cyrillic); + +/* Common */ +a:active,a:focus {outline:0;} +.clr {clear:both;height:0;line-height:0;border:none;float:none;background:none;padding:0;margin:0;} +hr.sep {line-height:0;height:0;border:none;border-bottom:1px dotted #ccc;padding:0;margin:4px 0;} + +.isJ30 body {padding-right:0;padding-left:0;} +.com_k2 select[multiple], +.com_k2 select[size], +.com_k2 select {min-height:40px;height:40px;max-width:100%;} + +/* Reset Bootstrap responsive stuff */ +.isJ30 .header, +.isJ30 .navbar-fixed-top, +.isJ30 .navbar-fixed-bottom, +.isJ30 .navbar-static-top, +.isJ30 .btn-subhead, +.isJ30 .subhead {margin-left:0;margin-right:0;} + + + +/* -------------- Admin Common -------------- */ + +.k2Center {text-align:center;} +.k2Left {text-align:left;} +.k2Right {text-align:right;} +.k2FLeft {float:left;} +.k2FRight {float:right;} +.k2ForceWrap {white-space:normal!important;max-width:120px;overflow:hidden;} +.k2Date {white-space:nowrap;text-align:center;} +.k2Order {white-space:nowrap!important;text-align:right;width:auto!important;min-width:80px;} +.k2Order span {} +.k2OrderBox {text-align:center;} +.k2NoWrap {white-space:nowrap;} +.k2IsIcon {font-family:Arial,Helvetica,sans-serif!important;font-size:16px!important;} +.k2IsIcon:hover {color:#BB3A00;text-decoration:none;} +/*.k2TitleBox {box-sizing:border-box;width:100%;font-size:20px!important;padding:14px 6px!important;}*/ +.k2TitleBox {font-size:20px!important;height:35px!important;padding:5px 6px!important;width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} +.k2TitleAliasBox {width:60%;font-size:12px;} +.k2TextBox {background:#fff;padding:4px;} +.k2ListItemDisabled {cursor:pointer;color:#0B55C4;} /* used in popup lists */ +.visually-hidden { position: absolute; overflow: hidden; clip: rect(0, 0, 0, 0); } + +/* Simple grid based on Foundation */ +#k2AdminContainer .row {margin-left:auto;margin-right:auto;width:100%;max-width:1200px;} +#k2AdminContainer .row .row {margin-left:-0.625em;margin-right:-0.625em;width:auto;} +#k2AdminContainer .row.row-nomax {max-width:100%;} +.column, +.columns {float:left;padding-left:0.625em;padding-right:0.625em;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} +.small-12 {width:100%;} +@media screen and (min-width:60em) { + .large-6 {width:50%;} + .large-8 {width:75%;} + .large-9 {width:66.67%;} + .large-10 {width:83%;} +} +.column.small-centered, +.columns.small-centered {float:none;margin-left:auto;margin-right:auto;} + +/* Sprite */ +.icon-48-k2, +body.com_k2 .page-title, +.k2Inactive, +span.k2GalleryNotice , +.k2Active {display:inline-block;background:url('../images/system/sprite-backend.png') no-repeat;overflow:hidden;text-align:left;} +#k2ExtraFieldsValidationResults:before {background:url('../images/system/sprite-backend.png') no-repeat;overflow:hidden;text-align:left;} +span.k2GalleryNotice {background-position:-79px -118px;width:16px;height:16px;} +#k2ExtraFieldsValidationResults:before {content: '';float:left;margin-right:10px;background-position:-10px -92px;width:59px;height:54px;} +.icon-48-k2{background-position:-10px -0px;width:95px;height:36px;} +body.com_k2 .page-title {background-position:-10px -46px;width:85px;height:36px;} +.k2Inactive {background-position:-79px -92px;width:16px;height:16px;} +.k2Active {background-position:-79px -144px;width:16px;height:16px;} +/* End of the sprite */ + +.k2Toggler {display:block;width:16px;height:16px;margin:0 auto;padding:0;background-repeat:no-repeat;background-position:0 0;text-indent:-500px;overflow:hidden;} +.k2Active {background-image:url(../images/system/tick.png);} +.k2Inactive{background-image:url(../images/system/cross.png);} + +.k2clr {clear:both;height:0;line-height:0;border:none;float:none;background:none;padding:0;margin:0;} + +div#k2AdminContainer {font-family:'Open Sans',sans-serif;} + +/* Common image styling */ +img.k2AdminImage {border:4px solid #ddd;margin:10px 0;padding:0;display:block;} +img.k2UserAvatar {margin:10px 20px;} + +.paramHeader {padding:6px 8px;} + +ul.k2GenericList {list-style:square;margin:0 8px 8px;padding:2px 8px;} +ul.k2GenericList li {list-style:square;padding:2px 0;} + +/* Generic button */ +.k2Selector {background:#f0f2f2;border:1px solid #d4d7d9;border-radius:3px;display:inline-block;margin:0;padding:4px 8px;color:#555;font-weight:bold;font-size:12px;cursor:pointer;text-decoration:none;box-shadow:0 0 1px 0 rgba(41,40,42,0.2);} +.k2Selector:hover {color:#222;text-decoration:none;border-color:rgba(82,168,236,0.8);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,0.6);-webkit-transition:box-shadow 300ms ease;transition:box-shadow 300ms ease;} + +/* Header */ +.subhead .btn-toolbar {padding-right:10px;} +.icon-48-k2 {color:#222!important;padding-left:120px!important;font-size:24px!important;} +.icon-48-k2 h2 {color:#222!important;font-size:24px!important;margin-left:10px!important;} + +/* Normalize all Joomla radio controls? +div.controls label.radio {} +div.controls label.radio input[type="radio"] {} +*/ + +div#k2AdminContainer h1 {padding:0 0 8px 0;margin:0;} +span.k2Notice {cursor:pointer;font-weight:bold;} +.k2LimitBox {float:left;margin:0 10px 0 0;} + +/* Fixes pagination issue for the limitbox */ +.k2LimitBox .chzn-drop { top: auto!important; bottom: 38px!important; } +.k2LimitBox .chzn-container-active.chzn-with-drop .chzn-single { border-radius: 0 0 5px 5px!important; } +.k2LimitBox .chzn-container .chzn-drop { padding-top: 10px; border-bottom: 0; border-top: 1px solid #aaa; border-radius: 4px 4px 0 0; } + +/* Common for Joomla 2.5 */ +div.isJ25 table.admintable {} +div.isJ25 table.admintable td.key {background:#f6f6f6;/*border-bottom:1px solid #e9e9e9;border-right:1px solid #e9e9e9;*/color:#666;font-weight:bold;text-align:right;font-size:11px;width:140px;} +div.isJ25 table.admintable td.key label {margin:0;padding:0;} + +/* Common for Joomla 3.x */ +body.com_k2 .container-fluid {padding:0!important;} +body.com_k2 .page-title {padding-left:100px;} +@media (max-width:767px) { + body.com_k2 .page-title {padding-left:0;text-indent:-800px} +} +div.controls label.radio {display:inline-block;} +.isJ30 table.adminlist tfoot tr td {text-align:center;} + +/* Footer */ +#k2AdminFooter {text-align:center;margin:20px auto 4px auto;width:100%;clear:both;float:left;} +@media screen and (min-width:767px) { + #k2AdminFooter {margin-bottom:45px;} +} + +/* div tables */ +div.k2Table {margin:0 0 20px 0;} +div.k2Table .k2TableLabel > label {font-weight:normal;color:#777;} +div.k2Table .k2TableValue {} +div.k2Table .k2TableValue input[type="text"]{min-height:40px;line-height:40px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} +div.k2Table .k2TableValue:after {content:" ";display:block;margin-bottom:8px;} +div.k2SubTable {margin-bottom:15px;} +div.k2SubTable .k2SubTableLabel {display:inline-block;text-align:right;vertical-align:top;} +div.k2SubTable .k2SubTableLabel > label {font-weight:normal;color:#777;} + +div.k2SubTable .k2SubTableValue label {padding-left:4px!important;} +div.k2SubTable .k2SubTableValue input[type="radio"] {margin:2px 8px 0 0!important;} + +.k2TableValue, +.k2SubTableValue {margin-bottom:15px;} + +@media screen and (max-width:1240px) { + .k2TableRightTop {margin-top:20px;} +} +@media screen and (min-width:1240px) { + div.k2TableInline {display:inline-block;} + div.k2TableLeft {float:left;} + div.k2TableRight {float:right;text-align:right;} + div.k2TableRight .chzn-container {text-align:left;} + .k2ViewIsItem div.k2SubTable .k2SubTableLabel:first-child {margin-left:0;width:auto;} + .k2ItemTableRightPad {padding-left:16px;} +} +@media screen and (min-width:1660px) { + div.k2CatTableLeft {float:left;} + div.k2CatTableRight {float:right;text-align:right;} + div.k2ItemTableLeft {float:left;} + div.k2ItemTableRight {float:right;text-align:right;} +} +@media screen and (min-width:1000px) { + div.k2Table .k2TableValue {margin-left:120px;vertical-align:top;} + div.k2Table .k2TableLabel {position:absolute;width:100px;vertical-align:top;text-align:right;} + div.k2SubTable .k2SubTableValue {display:inline-block;vertical-align:top;} + div.k2SubTable .k2SubTableLabel {margin:0 0 0 20px;padding:9px 8px 0;} + div.k2SubTable .k2SubTableValue {width:210px;} + .k2ViewIsCategory div.k2SubTable .k2SubTableLabel {width:150px;} + .k2ViewIsItem div.k2SubTable .k2SubTableLabel {width:90px;} +} +@media screen and (min-width:767px) { + div.k2Table .k2TableLabel {display:block;padding:10px 0;} + .k2ViewIsItem div.k2SubTable .k2SubTableLabel:first-child {margin-left:-107px;} + /* Category specific styling */ + .k2CategoryForm div.k2Table .k2TableLabel > label {width:125px;max-width:125px;} + .k2CategoryForm div.k2Table .k2TableValue {margin-left:145px;} + label[for="title"] {font-size:18px;} + label[for="tags"] {padding:20px 0 0 0;} +} + +/* Chozen plugin */ +.com_k2 .chzn-container, +.com_k2 .chzn-drop, +.com_k2 .chzn-container-active.chzn-with-drop .chzn-single, +.com_k2 .chzn-container-single .chzn-single, +.com_k2 .chzn-container-single .chzn-single span {min-height:35px;} +.com_k2 .chzn-container-single .chzn-single span {line-height:35px;} +.com_k2 .chzn-container-single .chzn-single div b {background-position:2px 8px;} +.com_k2 .chzn-container-active.chzn-with-drop .chzn-single div b {background-position:-14px 8px;} + +/* Generic Tabs Layout */ +.ui-tabs-hide {display:none;} +div.k2Tabs {clear:both;padding:10px 0;} +ul.k2TabsNavigation {margin:0;padding:0;text-align:left;list-style:none;} +ul.k2TabsNavigation li {display:inline-block;margin:0 -2px 0 0;padding:0;width:49%} +ul.k2TabsNavigation li a {display:block;padding:10px;margin:0;background:#f0f2f2;font-size:14px;text-decoration:none;font-weight:normal;outline:0;border-radius:3px 3px 0 0;color:#6d6f71;border-bottom:1px solid #d4d7d9;} +ul.k2TabsNavigation li a:hover {text-decoration:none;background-color:#f6f6f6;} +ul.k2TabsNavigation li a i {margin-right:8px;color:#6d6f71;display:none;} +ul.k2TabsNavigation li.ui-tabs-selected a {padding:10px 20px;background:#fff;color:#58595b;border:1px solid #d4d7d9;border-bottom:1px solid #fff;} +ul.k2TabsNavigation li.ui-tabs-selected a i {color:#0091ff;} +ul.k2TabsNavigation li.ui-tabs-selected a:hover {background-color:#fff;} +#k2MediaTabs ul.k2TabsNavigation li {width:100%;font-size:12px;} + +@media screen and (min-width:480px) { + ul.k2TabsNavigation li {width:32.3333%;} +} +@media screen and (min-width:600px) { + ul.k2TabsNavigation li {width:auto;} +} +@media screen and (min-width:800px) { + ul.k2TabsNavigation li a i {display:inline-block;} + ul.k2TabsNavigation li a {padding:10px 21px;} + #k2MediaTabs ul.k2TabsNavigation li {width:50%;} +} + +/* Media Tabs */ +@media screen and (min-width:1024px) { + #k2MediaTabs ul.k2TabsNavigation li {width:auto;font-size:16px;} +} +div.k2TabsContent {background:#fff;border:1px solid #d4d7d9;padding:10px;margin-top:-1px;margin-bottom:10px;} +.k2TabsContent.k2TabsContentLower {padding:25px 30px;} +div.isJ25 div.k2TabsContent {} +div.isJ30 div.k2TabsContent {} +div.k2TabsContent {width:100%;float:left;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;} + +/* Entity ID */ +div#k2ID {position:absolute;right:0;top:0;font-size:18px;font-weight:normal;padding:21px 24px;color:#0091ff;display:none;} +div#k2ID strong {color:#a8c5dd;} + +/* Top Nav Tabs */ +#k2FormTopNav {padding:0;} +#k2FormTopNav ul.k2NavTabs {margin:0;padding:0;text-align:left;white-space:nowrap;background:#f0f2f2;border-bottom:1px solid #d4d7d9;} +#k2FormTopNav ul.k2NavTabs li {list-style:none;display:inline-block;margin:0;padding:0;color:#414042;} +#k2FormTopNav ul.k2NavTabs li a {display:block;font-size:14px;text-decoration:none;font-weight:normal;outline:0;padding:21px 10px;margin:0;border-right:1px solid #d4d7d9;color:#414042;} +#k2FormTopNav ul.k2NavTabs li a:hover {text-decoration:none;color:#0091ff;} +#k2FormTopNav ul.k2NavTabs li:last-child a {border-right:0;} +#k2FormTopNav ul.k2NavTabs li a i {font-size:18px;margin-right:12px;color:#9cbcd3;display:none;} +#k2FormTopNav ul.k2NavTabs li a:hover i {color:#0091ff;} +#k2FormTopNav ul.k2NavTabs li.ui-tabs-selected a {position:relative;color:#122747;} +#k2FormTopNav ul.k2NavTabs li.ui-tabs-selected a:before {content:"\f0d8";font-family:"FontAwesome";font-style:normal;font-weight:normal;text-decoration:inherit;color:#fff;font-size:32px;position:absolute;bottom:-5px;left:50%;margin-left:-16px;width:32px;text-shadow:0px -1px 1px #ccc;} +#k2FormTopNav ul.k2NavTabs li.ui-tabs-selected a i {color:#0091ff;} + +@media screen and ( min-width:640px ) { + #k2FormTopNav ul.k2NavTabs li a {font-size:18px;padding:21px 24px;} + #k2FormTopNav ul.k2NavTabs li a i {display:inline-block;} +} +@media screen and ( min-width:500px ) { + div#k2ID {display:block;} + #k2FormTopNav ul.k2NavTabs li a {} +} +div.k2NavTabContent {padding:20px;} + +/* XML Parameter Rendering */ +form#adminForm {} +#k2TabDisplaySet, +#k2TabPubAndMeta {padding:0;} + +/* Metadata specific styling */ +#k2TabPubAndMeta .row {margin-left:0;max-width:100%;} + +ul.k2ScrollSpyMenu {position:fixed;list-style:none;padding:20px 0 0;margin:0;width:320px;display:none;} +ul.k2ScrollSpyMenu li a {display:block;-webkit-transition:.5s all ease-out;-moz-transition:.5s all ease-out;transition:.5s all ease-out;font-size:16px; +color:#00afec;padding:14px 28px;text-decoration:none;} +ul.k2ScrollSpyMenu li a:hover {color:#000;} +ul.k2ScrollSpyMenu li.active a {background:#f7f7f7;} +div.k2ScrollingContent {margin-left:0;padding:20px 20px 0;} +div.K2ScrollingContent h3 {margin-top:20px;} + +@media screen and (min-width:900px) { + ul.k2ScrollSpyMenu {display:block;} + div.k2ScrollingContent {margin-left:320px;padding-left:30px;padding-right:30px;padding-top:20px;border-left:1px solid #e3e4e4;} +} + +/* The fields */ +.xmlParamsFields {} +.xmlParamsFields.limitWidth {max-width:850px;padding:0 20px;} +.xmlParamsFields ul {list-style:none outside none;margin:0;padding:0;clear:both;} +.xmlParamsFields ul li {display:block;float:left;width:100%;clear:both;border-radius:3px;margin:0;padding:10px 20px 10px 0;} +.xmlParamsFields ul li:nth-child(2n-2) {background:#f7f7f7;} +.xmlParamsFields ul li.headerElement {padding:0;background:#fff;} + +.xmlParamsFields .paramValue label {min-width:85px;width:auto;text-align:center;border:1px solid #d4d6d8;line-height:33px;vertical-align:top;height:33px;font-size:12px;margin:0 -2px;padding:0 13px; +color:#8a8c8c;display:inline-block;vertical-align:middle;white-space:nowrap;background-color:#eff1f1; +box-shadow:0 1px 1px rgba(65,64,66,.14),inset 0 1px 0 #fff;} +.xmlParamsFields .paramValue label:hover {cursor:pointer;box-shadow:0 1px 1px rgba(65,64,66,.14),inset 0 0 10px rgba(0,0,0,.15);} +.xmlParamsFields .paramValue input[type="radio"] {opacity:0;position:absolute;clip:rect(0,0,0,0);} +.xmlParamsFields .paramValue input[type="text"], +.xmlParamsFields .paramValue textarea, +.xmlParamsFields .paramValue select {margin-left:20px;} + +/* Check boxes - generic */ +.xmlParamsFields .paramValue input:checked + label {background:#63696f;color:#fff;box-shadow:0 1px 1px rgba(65,64,66,.14);} +/* Check boxes - show */ +.xmlParamsFields .paramValue input[value="1"]:checked + label {background:#3fa800;color:#fff;box-shadow:0 1px 1px rgba(65,64,66,.14);} +/* Check boxes - hide */ +.xmlParamsFields .paramValue input[value="0"]:checked + label {background:#bd362f;color:#fff;box-shadow:0 1px 1px rgba(65,64,66,.14);} +/* Check boxes - inherit */ +.xmlParamsFields .paramValue input[value=""]:checked + label {background:#63696f;color:#fff;box-shadow:0 1px 1px rgba(65,64,66,.14);} +.xmlParamsFields .paramValue input[value=""] + label {border-radius:3px 0 0 3px;} +.xmlParamsFields .paramValue input[value="1"] + label {border-radius:0 3px 3px 0;} + +/* the labels */ +.xmlParamsFields .paramLabel label {font-size:13px;font-weight:700;color:#777778;padding:10px 10px 10px 20px;line-height:1;margin:0;display:inline-block;vertical-align:middle;} +.xmlParamsFields .paramValue, +.xmlParamsFields .paramLabel {display:inline-block;vertical-align:middle;} +.xmlParamsFields .paramLabel input[type="checkbox"] {margin-left:20px;display:inline-block;vertical-align:middle;position:relative;top:-2px;} +.xmlParamsFields .paramLabel input[type="checkbox"] + label {padding-left:5px;} +.xmlParamsFields .paramValue {width:100%;} + +.k2ScrollingContent > h3, +.k2NavTabContent h3 {font-size:16px;font-weight:300;padding-bottom:16px;margin-top:25px;margin-bottom:15px;border-bottom:2px solid #dddedf;color:#00afec;} +@media screen and (min-width:767px) { + .xmlParamsFields .paramValue {float:right;width:auto;} + .k2ScrollingContent > h3, + .k2NavTabContent h3 {font-size:24px;} + .xmlParamsFields .paramValue input[type="text"], + .xmlParamsFields .paramValue textarea {float:right;} +} + +div#k2AdminContainer.isJ25 form#adminForm div.xmlParamsFields fieldset input {float:none!important;} +div.paramValueSpacer {background:#f6f6f6;border-bottom:1px solid #e9e9e9;border-right:1px solid #e9e9e9;color:#666;font-weight:bold;text-align:right;font-size:11px;} + +/* Generic form additional styling - tags, users, usergroups etc. */ +.k2GenericForm {width:850px;max-width:100%;padding:0 20px;} +.k2GenericForm h3 {font-size:24px;font-weight:300;padding-bottom:16px;margin-top:25px;margin-bottom:15px;border-bottom:2px solid #dddedf;color:#00afec;} +.k2GenericForm .k2ItemFormEditor {padding:20px 0 20px 20px;} + +/* Additional parameters styling for the item form */ +.additionalParams {border-bottom:2px solid #f1f1f1;border-radius:3px;position:relative;overflow:hidden;margin:0;padding:0;} +.additionalParams > li {background:#ededed;padding-top:3px;padding-bottom:4px;display:block;overflow:hidden;padding:5px 12px 5px 25px;border-radius:3px;font-size:16px;} +.additionalParams > li:nth-child(2n-2) {background:#f7f7f7;} +.additionalParams label {font-size:13px;font-weight:700;color:#777778;padding:10px 0;line-height:1;margin:0;} + +/* Hits */ +.itemHits {text-align:center;color:#296d86;text-transform:uppercase;font-size:12px;font-weight:700;padding-top:20px;overflow:hidden;background:#2fbbec;border-radius:3px;} +.itemHits span {color:#fff;font-weight:300;font-size:70px;line-height:1;display:block;margin-bottom:15px;} +.itemHitsReset {background:#ededed;padding:8px;border-radius:0 0 3px 3px;} +#resetHitsButton {border-radius:3px;display:block;width:100%;font-weight:700;max-width:none;padding:5px 0;font-size:11px;color:#414042;border-color:#d4d7d9;background-color:#f0f2f2;box-shadow:0 1px 1px rgba(65,64,66,.14),inset 0 1px 0 #fff;} + +/* Rating */ +.itemRating {text-align:center;color:#8d6e3c;text-transform:uppercase;font-size:12px;font-weight:700;padding-top:20px;background:#f7be59;border-radius:3px;} +.itemRating span {color:#fff;font-weight:300;font-size:30px;line-height:1;display:block;margin:11px 0;} +.itemRatingReset {background:#ededed;padding:8px;border-radius:0 0 3px 3px;margin-top:15px;} +#resetRatingButton {border-radius:3px;display:block;width:100%;font-weight:700;max-width:none;padding:5px 0;font-size:11px;color:#414042;border-color:#d4d7d9;background-color:#f0f2f2;box-shadow:0 1px 1px rgba(65,64,66,.14),inset 0 1px 0 #fff;} + +/* Small - responsive blocks */ +@media screen and (min-width:767px) { + .row-resposive > .col:first-child {padding-left:0;} + .row-resposive > .col:last-child {padding-right:0;} + .row-resposive {overflow:hidden;width:100%;} + .col {float:left;padding:0 15px;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;} + .col6 {width:50%;} + .col3 {width:25%;} +} +.row-resposive {margin-bottom:45px;} + +/* Extrafields - newly generated elements */ +#exFieldsTypesDiv {padding-top:15px;} +#exFieldsTypesDiv input[type="text"] {margin-bottom:20px;min-height:30px;line-height:40px;} +#exFieldsTypesDiv input[type="button"], +#exFieldsTypesDiv button {margin-bottom:20px;display:inline-block;vertical-align:top;margin-right:10px;color:#414042;min-width:100px;padding:10px 15px;border-radius:3px;border:1px solid #dedede;border-bottom-color:#cacaca;background:#fdfdfd;white-space:normal;position:relative;font-weight:700;background:-moz-linear-gradient(top,#fdfdfd 0%,#f5f5f5 100%);background:-webkit-linear-gradient(top,#fdfdfd 0%,#f5f5f5 100%);background:linear-gradient(to bottom,#fdfdfd 0%,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdfdfd',endColorstr='#f5f5f5',GradientType=0);box-shadow:0 1px 1px rgba(65,64,66,.14),inset 0 1px 0 #fff;} +#exFieldsTypesDiv input[type="button"]:hover, +#exFieldsTypesDiv button:hover {background:#d4d7d9;} +#groupContainer {text-align:right;width:100%;clear:both;float:left;margin:20px 0 0;} +#groupContainer > span, +#groupContainer > label {font-weight:700;color:#777;padding-right:10px;} +.oldJ #groupContainer input[type="text"] {width:auto;} + + + +/* ====================================================================================================== */ +/* ====================================================================================================== */ +/* ====================================== Backend View Specific CSS ===================================== */ +/* ====================================================================================================== */ +/* ====================================================================================================== */ + +/* Settings - Joomla 3.x, 2.5 & 1.5 */ +.paramHeaderContent {background:#e5f7fd;border-radius:3px;line-height:1;padding:18px 25px;margin:25px 0 10px 0;color:#346b93;font-size:18px;} +.tab-pane > .control-group:first-child .paramHeaderContent {margin-top:0;} + +.form-horizontal .controls label, +.controls label, +.k2Table .k2SubTableValue label {min-width:85px;width:auto;text-align:center;border:1px solid #d4d6d8;line-height:33px;vertical-align:top;height:33px;font-size:12px;margin:0 -2px;padding:0 13px!important; +color:#8a8c8c;display:inline-block;vertical-align:middle;white-space:nowrap;background-color:#eff1f1; +box-shadow:0 1px 1px rgba(65,64,66,.14),inset 0 1px 0 #fff;} + +.controls label:hover, +.k2Table .k2SubTableValue label:hover {cursor:pointer;box-shadow:0 1px 1px rgba(65,64,66,.14),inset 0 0 10px rgba(0,0,0,.15);} +.controls input[type="radio"],.k2Table .k2SubTableValue input[type="radio"] {opacity:0;position:absolute;clip:rect(0,0,0,0);} + +.controls label:first-of-type, +.k2Table .k2SubTableValue label:first-of-type {border-radius:3px 0 0 3px;} +.controls label:last-of-type, +.k2Table .k2SubTableValue label:last-of-type {border-radius:0 3px 3px 0;} + +/* Check boxes - show/Yes */ +.controls input[value="1"]:checked + label, +.k2Table .k2SubTableValue input[value="1"]:checked + label, +label[id*="1-"].radio.isChecked {background:#3fa800;color:#fff;box-shadow:0 1px 1px rgba(65,64,66,.14);} + +/* Check boxes - hide/No */ +.controls input[value="0"]:checked + label, +.k2Table .k2SubTableValue input[value="0"]:checked + label, +label[id*="0-"].radio.isChecked {background:#bd362f;color:#fff;box-shadow:0 1px 1px rgba(65,64,66,.14);} + +/* Check boxes - Generic */ +.xmlParamsFields .paramValue label.isChecked, +.k2Table .k2SubTableValue label.isChecked, +.controls label.isChecked {background:#63696f;color:#fff;box-shadow:0 1px 1px rgba(65,64,66,.14);} + +/* Redefining the form */ +.form-horizontal .control-label:empty {display:none;} +.form-horizontal .controls {margin-left:0!important;} +.form-horizontal .control-label {min-width:350px;max-width:350px;} +.form-horizontal .control-label label {font-size:13px;font-weight:700;color:#777778;padding:15px 10px 10px;line-height:1;margin:0;} +.controls .radio, +.controls .checkbox {padding-left:0;} + +/* Bootstrap resets */ +.form-horizontal .control-group {margin-bottom:0!important;border-radius:3px;} +.form-horizontal .control-group:nth-child(2n-2) {background:#f7f7f7;} +.form-horizontal .controls > .radio:first-child, +.form-horizontal .controls > .checkbox:first-child {padding-top:10px;} +.k2Table .controls > .radio:first-child, +.k2Table .controls > .checkbox:first-child, +.k2GenericForm .controls > .radio:first-child, +.k2GenericForm .controls > .checkbox:first-child {padding-top:0px;} +.form-horizontal .controls fieldset {padding:10px 0;} +.form-horizontal .controls .chzn-container {margin:15px 0;} +.form-horizontal .controls input[type="text"], +.form-horizontal .controls textarea {margin:10px 0 15px 0;} + +.tab-pane {padding-top:25px;} + +/* Permissions */ +#permissions-sliders, +.rule-desc {padding:15px 15px 0;} +#permissions .alert {margin:5px 0 0;} +#permissions-sliders {border-radius:3px;} + +/* Item - Overrides */ +.K2AdminViewItem {} +#k2Author {font-weight:bold;color:#333;display:inline-block;margin-top:10px;margin-right:10px;} +div#k2TabContent {padding:0;} +span.k2ItemFormEditorTitle {display:block;color:#58595b;font-size:20px;font-weight:bold;padding:24px 0 12px 24px;} +.k2ItemFormEditor .editor {background:#f0f2f2;border-top:1px solid #d7d9d9;border-bottom:1px solid #e9ebec;} +.k2ItemFormEditor .editor .btn-toolbar {padding:4px 20px;} + +.view-item #system-message-container {padding:0;} +.view-item #system-message-container .alert {margin-bottom:0;border-radius:0;} + +/* Item - Free tagging */ +ul.tags {background:#fff;border:1px solid #ccc;cursor:default;min-height:48px;height:auto;display:inline-block;margin:0;padding:4px 6px;border-radius:3px;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-sizing:border-box;width:100%;} +ul.tags li {border-radius:3px;background:#d1e8fc;color:#0f4776;line-height:14px;list-style:none;float:left;clear:none;padding:10px;margin:2px 2px 2px 0;font-size:14px;font-weight:bold;font-family:"Lucida Grande";vertical-align:middle;} +ul.tags li span.tagRemove {font-size:12px;font-family:"Lucida Grande";color:#0b4373;cursor:pointer;} +ul.tags li span.tagRemove:hover {color:#505050;cursor:pointer;} +ul.tags li input {border:none;padding-top:2px;background:none;font-size:12px;font-weight:normal;font-family:"Lucida Grande";float:left;clear:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;} +ul.tags li input:focus {background:none;} +ul.tags li input.tagsLoading {background:url(../images/system/loader.gif) no-repeat 50% 50%;} +ul.tags li.clr {clear:both;height:0;line-height:0;border:none;float:none;background:none;padding:0;margin:0;} +ul.tags li.tagAdd {border:none;padding:0;background:none;height:35px;} +ul.tags li.tagAdd input#search-field {border:none;height:35px;min-height:0;line-height: 35px;}ul.tags li.tagAdd input {border:none;} +p.k2TagsNotice {display:block;font-size:11px;font-weight:bold;margin:0;padding:0;color:#999;} + +.ui-autocomplete {position:absolute;margin:0;padding:0;list-style:none;border:1px solid #eee;background-color:white;border-right-color:#ddd;border-bottom-color:#ddd;text-align:left;z-index:50;} +* html .ui-autocomplete {width:1px;} /* without this the menu expands to 100% in IE6 */ + +.ui-menu {list-style:none;padding:2px; margin:0; margin-top:-3px;display:block; float:left;} +.ui-menu .ui-menu-item {margin:0;padding:0;zoom:0;float:left;clear:left;width:99%;} +.ui-menu .ui-menu-item a {text-decoration:none; display:block; padding:.2em .4em; line-height:1.5;zoom:1;font-weight:bold;} +.ui-menu .ui-menu-item a.ui-state-hover, +.ui-menu .ui-menu-item a.ui-state-active {margin:-1px;background-color:#444;color:#fff;} + +/* Item - Selection based tagging */ +#tagsLog {float:left;padding-left:4px;font-weight:bold;line-height:16px;vertical-align:middle;} +#tagsLog.tagsLoading {background:url(../images/system/loader.gif) no-repeat 50% 50%;margin-left:4px;padding:0;width:16px;height:16px;display:block;float:left;} + +table#tagLists {width:100%;} +table#tagLists tr td span {display:block;font-weight:bold;} +table#tagLists tr td#tagListsLeft {width:40%;} +table#tagLists tr td#tagListsLeft select {width:99%;height:106px;} +table#tagLists tr td#tagListsButtons {vertical-align:middle;width:20%;} +table#tagLists tr td#tagListsButtons input {width:99%;} +table#tagLists tr td#tagListsRight {width:40%;} +table#tagLists tr td#tagListsRight select {width:99%;height:106px;} + +/* Item - Extra Fields Validation */ +#k2ExtraFieldsValidationResults {clear:both;font-weight:bold;font-size:12px;color:#369;margin:12px 0 4px;padding:16px;background-color:#d5e7fa;border-top:4px solid #96b0cb;display:none;} +#k2ExtraFieldsValidationResults h3 {padding:0;margin:0;font-size:20px;color:#369;border:0;} +ul#k2ExtraFieldsMissing {margin:8px;padding:0 18px; overflow: hidden;} +ul#k2ExtraFieldsMissing li {font-weight:normal;} +.k2Invalid {border-color:red;} + +/* Item - Attachments */ +#itemAttachments {margin-top:15px;padding-top:10px;} +#itemAttachments label {font-weight:bold;} +#itemAttachments input {margin-bottom:10px;} +#itemAttachments input.linkTitle {width:200px;} +#itemAttachments textarea {width:200px;} +#itemAttachments a.k2AttachmentBrowseServer {margin-right:8px;} +td.k2ItemFormDateField {white-space:nowrap;} +td.k2ItemFormDateField input {} +td.k2ItemFormDateField img.calendar {vertical-align:bottom;margin-left:2px;} + +@media screen and (min-width:767px) { + #itemAttachments label {margin-right:10px;width:170px;float:left;clear:left;text-align:right;} +} + +.itemAttachmentsTable {width:100%;margin:0 0 20px;} +.itemAttachmentsTable th {border-bottom:3px solid #d7d9d9;border-top:0;color:#6d6f71;font-size:14px;font-weight:700;text-align:left;line-height:1;padding:12px 14px 12px 0;} +.itemAttachmentsTable th.k2Center {text-align:center;} +.itemAttachmentsTable td {padding:12px 14px 12px 0;font-size:13px;} +.itemAttachmentsTable td input {padding:8px 10px 7px;border:1px solid #d7d9d9;border-radius:3px;height:auto;} +.deleteAttachmentButton {font-size:18px;color:#9e0b0f;} +.downloadAttachmentButton {padding-right:10px;font-size:18px;} + +/* New attachments form */ +.itemNewAttachment {border-top:3px solid #d7d9d9;padding:20px 0;} +.itemNewAttachment button {background:none;float:right;border:0;font-size:16px;color:#9e0b0f;font-size:18px;} +.itemNewAttachment .attachmentGap {margin-bottom:20px;} +.itemNewAttachment button + input[type="text"] {min-height:30px;line-height:40px;vertical-align:top;} + +/* Item - Extrafields & Image Fields */ +#extraFields {padding-top:20px;} +.itemAdditionalField {margin-bottom:25px;clear:both;width:100%;float:left;} +.itemAdditionalField .itemAdditionalValue {margin-right:15px;margin-bottom:10px;} +.itemAdditionalField label {font-size:13px;color:#68696b;font-weight:700;display:block;margin-top:0;margin-bottom:0;padding-top:5px;} +.itemAdditionalField .sep, +.itemAdditionalField label.sep {display:block;font-weight:700;margin:25px 0;font-size:15px;text-transform:uppercase;} +.itemAdditionalField .itemAdditionalData {} +.itemAdditionalField input[type="text"], +.itemAdditionalField input[type="email"] {width:100%;max-width:100%;min-height:40px;line-height:40px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} +.itemAdditionalField textarea {width:100%;max-width:100%;min-height:40px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} +.itemAdditionalField input[type="text"]#existingImageValue {width:100%;display:block;margin-bottom:15px;} +.nicEdit-main {outline:0;} +.k2ExtraFieldHeader {font-size:16px;color:#68696b;font-weight:300;display:block;margin-top:0;margin-bottom:0;padding-top:5px;} + +/* padding correction for the calendar */ +#extraFieldsContainer .k2Calendar + .btn {padding:10px 12px;} +#extraFieldsContainer .icon-calendar {margin-right:0;} + +@media screen and (min-width:767px) { + .itemAdditionalField .itemAdditionalValue {width:100px;margin-bottom:0 } + .itemAdditionalField label {display:inline-block;vertical-align:middle;} + .itemAdditionalField .itemAdditionalData {min-width:75%;float:left;} + .itemNewAttachment button + input[type="text"] {margin-left:-12px;} + .itemAdditionalField .sep, + .itemAdditionalField label.sep {display:inline-block;vertical-align:middle;margin:0 25px;} + .itemAdditionalField input[type="text"]#existingImageValue {width:auto;display:inline-block;vertical-align:middle;margin-right:-10px;margin-bottom:0;} + .k2ExtraFieldHeader {margin-left:120px;} +} + +/* Item Buttons */ +.itemAdditionalField .itemAdditionalData > button, +.itemAdditionalField .itemAdditionalData > input[type="button"], +.itemAdditionalField .itemAdditionalData > input[type="submit"], +.k2Button {color:#414042;min-width:150px;padding:10px 15px;border-radius:3px;;border:1px solid #dedede;border-bottom-color:#cacaca;background:#fdfdfd;white-space:normal;display:inline-block;vertical-align:middle;position:relative;font-weight:700;background:-moz-linear-gradient(top,#fdfdfd 0%,#f5f5f5 100%);background:-webkit-linear-gradient(top,#fdfdfd 0%,#f5f5f5 100%);background:linear-gradient(to bottom,#fdfdfd 0%,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdfdfd',endColorstr='#f5f5f5',GradientType=0);box-shadow:0 1px 1px rgba(65,64,66,.14),inset 0 1px 0 #fff;} +.itemAdditionalField .itemAdditionalData > button:hover, +.itemAdditionalField .itemAdditionalData > input[type="button"]:hover, +.itemAdditionalField .itemAdditionalData > input[type="submit"]:hover, +.itemAdditionalField .k2Button:hover {text-decoration:none;border-color:#dedede;border-bottom-color:#cacaca;background:#fdfdfd;background:-moz-linear-gradient(top,#fdfdfd 0%,#f5f5f5 100%);background:-webkit-linear-gradient(top,#fdfdfd 0%,#f5f5f5 100%);background:linear-gradient(to bottom,#fdfdfd 0%,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdfdfd',endColorstr='#f5f5f5',GradientType=0);} + +/* Additional item secondary fields */ +.itemAdditionalBlock {display:inline-block;vertical-align:middle;margin-right:15px;} +.itemAdditionalBlock.sep {margin:0 25px 0 0;color:#2f98f3;} +.itemAdditionalBlock label {font-weight:700;padding:0;} +.itemAdditionalBlock input[type="text"], +.itemAdditionalBlock input[type="email"], +.itemAdditionalBlock textarea {margin-bottom:0;} + +.k2DocLink {font-weight:700;margin-top:15px;} +.k2DocLink a {} +.k2DocLink span {} + +/* Item - Gallery */ +.itemGalleryBlock {margin-bottom:20px;} +.itemGalleryBlock label {display:block;margin-bottom:10px;} +#itemGallery label {display:inline;} +.itemGalleryBlock input[type="text"] {max-width:300px;} +.itemGalleryBlock.separator {text-transform:uppercase;font-weight:700;color:#46afff;} +span.k2GalleryNotice {cursor:pointer;text-indent:-99px;width:16px;height:16px;line-height:16px;padding:0;margin:0 0 -4px 0;display:inline-block;overflow-x:hidden;} + +/* Admin - Item */ +.itemPlugins {margin-top:20px;clear:both;} +.itemPlugins label {font-size:13px;color:#68696b;font-weight:700;display:block;margin-top:0;margin-bottom:0;padding-top:5px;padding-bottom:10px;} +.itemPluginsContent {padding:0 20px;} + +/* Admin - Media Manager */ +.isJ30 #elfinder input {width:auto;}/* Fix for Joomla 3.2 CSS... */ +.K2AdminViewMedia {border-left:1px solid #d3d3d3;border-bottom:1px solid #d3d3d3;} + +/* Lists - Generic styling */ +#k2AdminContainer {position:relative;width:100%;clear:both;margin-bottom:10px;} + +.com_k2.view-items, +.com_k2.view-categories, +.com_k2.view-tags, +.com_k2.view-comments, +.com_k2.view-usergroups, +.com_k2.view-users, +.com_k2.view-extrafields, +.com_k2.view-extrafieldsgroups {background:#f0f2f2;} + +.isJ30 .row-fluid .span10 {margin-left:0;min-width:85%;} +.isJ30 .row-fluid .span2 {min-width:15%;} + +/* Lists - filters */ +#k2AdminContainer .k2AdminTableFilters {margin-bottom:0;width:100%;border-left:1px solid #dbdcdc;} +#k2AdminContainer .k2AdminTableFilters .chzn-container {margin-bottom:5px;} +#k2AdminContainer .k2AdminTableFilters tr td {background:#fff; padding-top:15px;} + +/* Filters on smaller viewports */ +#k2AdminContainer .k2AdminTableFiltersSelects, +#k2AdminContainer .k2AdminTableFiltersSearch { display: block; width: 100%; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } +#k2AdminContainer .k2AdminTableFiltersSelects select { max-width: 48%; } + +@media screen and (min-width: 920px) { + #k2AdminContainer .k2AdminTableFiltersSelects, #k2AdminContainer .k2AdminTableFiltersSearch { display: table-cell; width: auto; } + #k2AdminContainer .k2AdminTableFilters tr td {border-bottom:1px solid #dbdcdc;} + table.k2AdminTableFilters tr td.k2AdminTableFiltersSelects {text-align:right;} + #k2AdminContainer .k2AdminTableFiltersSelects select { max-width: none; } +} + +/* Legacy styling */ +table.k2AdminTableFilters {width:100%;} +table.k2AdminTableFilters tr td.k2AdminTableFiltersSearch {white-space:nowrap;} +table.k2AdminTableFilters tr td.k2AdminTableFiltersSelects .chzn-container {text-align:left;} +table.k2AdminTableFilters tr td.k2AdminTableFiltersSelects select {margin: 1px 0 5px 0;} + +/* Edit Forms */ +table.adminFormK2 {width:100%;margin-bottom:16px;} + +/* Lists - items */ +#k2AdminContainer .adminlist {margin-bottom:0;border-left:1px solid #dbdcdc;} +#k2AdminContainer .adminlist input[type="checkbox"] {margin-top:0;} +#k2AdminContainer .adminlist thead tr th {background:#fff;border-bottom:1px solid #dbdcdc;} +#k2AdminContainer .adminlist tbody tr td {padding-top:15px;padding-bottom:15px;} +#k2AdminContainer .adminlist tfoot tr td {background:#fff;border-bottom:1px solid #dbdcdc;border-top:1px solid #dbdcdc;} +#k2AdminContainer .adminlist a {text-decoration:none;color:#636b6e;cursor:pointer;} +#k2AdminContainer .adminlist a.editComment {color:#46afff;} +#k2AdminContainer .adminlist a:hover {color:#46afff;} + +.isJ15 #k2AdminContainer .adminlist tr td, +.isJ25 #k2AdminContainer .adminlist tr td {background:#f0f2f2;border-bottom:1px solid #dbdcdc;} + +.table-responsive-wrap {position:relative;} +.table-responsive {width:100%;margin-bottom:15px;overflow-x:scroll;overflow-y:hidden;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar;} + +/* minimal modal */ +.jw-modal {display:none;position:fixed;z-index:9999;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.3);} +.jw-modal.jw-modal-open {display:block;} +.jw-modal-main {padding-top:40px;} +.jw-modal-header {color:#fff;padding:25px 20px;font-size:20px;font-weight:300;letter-spacing:-1px;background-color:#63696f;box-shadow:0 1px 0 rgba(0,0,0,.18);overflow:hidden;} +.jw-modal-header h3 {margin:0;font-size:20px;} +.jw-modal-content {position:absolute;left:50%;width:650px;border:1px solid rgba(0,0,0,.8);background-color:#fdfdfd;box-shadow:0 0 29px rgba(0,0,0,.16); +z-index:100;margin:25px auto 25px -325px;font-family:'Open Sans',sans-serif;-webkit-font-smoothing:antialiased;font-smoothing:antialiased;} +.jw-modal-footer {padding:16px 0;background-color:#eff1f1;box-shadow:0 1px 0 rgba(0,0,0,.18);clear:both;width:100%;overflow:hidden;} + +/* Button styling */ +.jw-btn {display:inline-block;vertical-align:middle;white-space:nowrap;color:#fdfdfd;font-size:13px;line-height:1;padding:10px 30px;border-radius:3px;border:1px solid #363a3d;font-weight:700;} +.jw-btn-save {border:1px solid #363a3d;background-color:#3fa700;box-shadow:0 1px 1px rgba(65,64,66,.14),inset 0 1px 0 #54db00;} +.jw-btn-save:hover {background:#358b01;} +.jw-btn-close {border-color:#a53222;background-color:#d7412d;box-shadow:0 1px 1px rgba(65,64,66,.14),inset 0 1px 0 #ff4d35;} +.jw-btn-close:hover {background:#a53222;} + +/* Information View */ +.k2ViewIsInfo .header, +.k2ViewIsInfo .subhead {position:relative;z-index:2;} + +#k2InfoPage {max-width:1300px;} +#k2InfoPage .k2ScrollingContent {margin-bottom:10px } + +#k2AdminContainer #k2InfoPage h1, +#k2AdminContainer #k2InfoPage h2 {margin-bottom:20px;padding:0;font-weight:400;font-size:26px;line-height:28px;} +#k2InfoPage a {color:#00afec;} +#k2InfoPage ul {margin-bottom:30px;} +#k2InfoPage table li {background:#fff;} + +.isJ15 #k2InfoPage ul.k2ScrollSpyMenu {top:175px;} +.isJ25 #k2InfoPage ul.k2ScrollSpyMenu {top:183px;} +.isJ30 #k2InfoPage ul.k2ScrollSpyMenu {padding-top:125px;top:0;border-left:1px solid #e3e4e4;} + +#k2InfoPage ul.k2ScrollSpyMenu {padding:0;height:100%;padding-top:31px;z-index:1;} +#k2InfoPage ul.k2ScrollSpyMenu li {border-bottom:1px solid #e3e4e4;border-right:1px solid #e3e4e4;} +#k2InfoPage ul.k2ScrollSpyMenu > li:first-child {border-top:1px solid #e3e4e4;} + +#k2InfoPage ul.k2ScrollSpyMenu li a {font-size:14px;padding:17px 28px;display:block;color:#636b6e;} +#k2InfoPage ul.k2ScrollSpyMenu li a.active {background:#f7f7f7;} +#k2InfoPage ul.k2ScrollSpyMenu li a:hover {background:#00afec;color:#fff;} +#k2InfoPage .fa {float:right;} + +#k2InfoPage table, +#k2InfoPage fieldset {width:100%;border:0;border-spacing:0;} +#k2InfoPage fieldset div {padding:10px 0 0;} +#k2InfoPage .k2InfoTable tr td:first-child {width:70%;} +#k2InfoPage .k2InfoTable tr td:last-child {width:30%;} + +#k2InfoPage fieldset {margin-bottom:40px;} + +#k2InfoPage legend {font-size:23px;font-weight:300;color:#4a4949;display:block;margin:0 0 10px;padding-bottom:10px;border-bottom:1px solid #c5c4c4;position:static;float:none;} +#k2InfoPage th {background:#fff;height:35px;line-height:35px;text-align:left;padding:0 15px;} +#k2InfoPage td {padding:12px 15px;border:0;} +#k2InfoPage tr td:first-child {border-radius:3px 0 0 3px;} +#k2InfoPage tr td:last-child {border-radius:0 3px 3px 0;} +#k2InfoPage table.stripped tr:nth-child(2n-1) td {background:#f7f7f7;} +#k2InfoPage .green {color:#3fa800;font-weight:600;} +#k2InfoPage .red {color:#bd362f;font-weight:600 } + +/* About Block */ +#k2InfoPage #k2AboutBlock {font-size:14px;line-height:1.65;} +#k2InfoPage #k2AboutBlock h2 {margin:30px 0 10px;border:none; +padding:0;color:#4a4949;} +#k2InfoPage #k2AboutBlock a {padding-bottom:2px;border-bottom:1px solid #dbdcdc;} + + + +/* ====================================================================================================== */ +/* ====================================================================================================== */ +/* ====================================== Joomla CSS Normalizations ===================================== */ +/* ====================================================================================================== */ +/* ====================================================================================================== */ + +/* Joomla 1.5 */ +html.isJ15 {overflow-y:scroll;} +html.isJ15 #system-message {margin:-26px 0 16px;} +html.isJ15 #system-message dd ul {padding:20px 10px;} +html.isJ15 div#element-box div.m {padding:0;border-bottom:1px solid #ccc;} +html.isJ15 div#element-box div.m div#k2AdminContainer #k2FormTopNav ul.k2NavTabs {border-top:1px solid #d4d7d9;} +html.isJ15 div#element-box div.m div#k2AdminContainer #k2FormTopNav ul.k2NavTabs li.ui-tabs-selected a:before {content:"\f0d8";font-family:"FontAwesome";font-style:normal;font-weight:normal;text-decoration:inherit;color:#fff;font-size:32px;position:absolute;bottom:-12px;left:50%;margin-left:-16px;width:32px;text-shadow:0px -1px 1px #ccc;} + +/* Joomla 1.5 & 2.5 */ +html.isJ25 {overflow-y:scroll;} +html.isJ25 div#element-box div.m {padding:10px 0;} +html.isJ25 div#element-box div.m div#k2AdminContainer {margin-top:-10px;background:#fff;} +html.isJ25 div#element-box div.m div#k2AdminContainer #k2FormTopNav {padding:0;margin-top:0;} +html.isJ25 div#element-box div.m div#k2AdminContainer #k2FormTopNav ul.k2NavTabs {border-top:1px solid #d4d7d9;} +html.isJ25 div#element-box div.m div#k2AdminContainer #k2FormTopNav ul.k2NavTabs li.ui-tabs-selected a:before {content:"\f0d8";font-family:"FontAwesome";font-style:normal;font-weight:normal;text-decoration:inherit;color:#fff;font-size:32px;position:absolute;bottom:-12px;left:50%;margin-left:-16px;width:32px;text-shadow:0px -1px 1px #ccc;} +html.isJ25 div.m {border:0;} +html.isJ25 div.m, +html.isJ25 #content-box {-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} +html.isJ25 .xmlParamsFields .paramValue label {padding:0 13px!important;} +html.isJ25 #element-box {margin-bottom:0;padding:0;} +html.isJ25 #toolbar-box {padding:0 0;} +html.isJ25 div#toolbar-box div.m {padding:10px 0;} +html.isJ25 .xmlParamsFields .paramValue input[type="text"], +html.isJ25 .xmlParamsFields .paramValue textarea, +html.isJ25 .xmlParamsFields .paramValue select {margin-left:0;} +html.oldJ #k2AdminContainer .k2AdminTableFilters, +html.oldJ #k2AdminContainer .adminlist {border-left:0;} +.oldJ .controls input[type="radio"], +.oldJ .k2Table .k2SubTableValue input[type="radio"] {top:0;left:0;} + +/* The submenu for Joomla 1.5 & 2.5 */ +html.isJ25 #toolbar-box {margin-bottom:0;} +html.isJ25 #submenu-box, +html.isJ15 #submenu-box {padding:0;margin:0;border-top:1px solid #d4d7d9;float:left;width:100%;} +html.isJ25 #submenu-box div.m, +html.isJ15 #submenu-box .m {border:0;padding:0;} + +html.isJ25 #submenu, +html.isJ15 #submenu {border-bottom:1px solid #d4d7d9;float:left;width:100%;background:#f0f2f2;} +html.isJ25 #submenu li a, +html.isJ15 #submenu li a {display:block;color:#777;font-size:14px;text-decoration:none;font-weight:normal;outline:0;padding:21px 24px;margin:0;border-right:1px solid #d4d7d9;position:relative;} +html.isJ25 #submenu li a.active, +html.isJ15 #submenu li a.active {color:#0091ff;background:#f0f2f2;} +html.isJ25 #submenu li a.active:before, +html.isJ15 #submenu li a.active:before {text-align:center;content:"\f0d8";font-family:"FontAwesome";color:#fff;position:absolute;font-size:32px;bottom:-2px;left:50%;margin-left:-16px;width:32px;text-shadow:0px -1px 1px #ccc;} + +/* The list */ +.oldJ table.adminlist {border-spacing:0;} +.oldJ table.adminlist tbody tr td {border:0;} +.oldJ table.adminlist thead th {padding:10px 0;border-left:0;border-right:0;} +#k2AdminContainer.oldJ .adminlist {border:0;} +#k2AdminContainer.oldJ .adminlist tfoot tr td {border-top:0;padding:15px 0;} +#k2AdminContainer.oldJ table.k2AdminTableFilters {border-left:0;} +#k2AdminContainer.oldJ .k2AdminTableFilters tr td {padding:10px;} +#k2AdminContainer.oldJ .adminlist tbody tr td {padding:10px;} + +html.isJ25 #k2AdminContainer .k2AdminTableFilters tr td {padding:10px;} + +.oldJ h1 {color:#00AFEB;} + +/* Item form */ +.oldJ fieldset {padding-left:0;border:0;} +.oldJ select, +.oldJ input[type="text"], +.oldJ input[type="email"] {height:30px;min-height:30px;width:auto;max-width:100%;} +.oldJ select {max-width:300px;} + +/* field normalisation */ +.k2ViewIsItem .oldJ input[type="file"], +.k2ViewIsCategory .oldJ input[type="file"] {margin-bottom:20px;} +input#k2ImageBrowseServer {width:auto;height:30px;line-height:8px;margin-left:10px;} +.k2ViewIsCategory .oldJ input, +.k2ViewIsCategory .oldJ select, +.k2ViewIsItem .oldJ select {height:40px;width:100%;} + +/* Proper widths */ +.k2ViewIsItem .oldJ input, +.k2ViewIsItem .oldJ input[type="text"] {width:auto;min-width:208px;} +.k2ViewIsItem .oldJ input.k2TitleBox {min-width:100%;} + +.oldJ input[type="text"] {width:100%;} +.oldJ .adminlist input[type="text"] {width:auto;min-width:0;} +.oldJ .k2TagsNotice {margin-bottom:30px;} +.oldJ #itemAttachments a.k2AttachmentBrowseServer {margin-left:20px;} + +/* Mimick Joomla 3.x's input styling for 1.5 & 2.5 */ +.oldJ label, +.oldJ .paramLabel {font-size:13px;font-weight:700;display:inline-block;vertical-align:middle;color:#777;} +.oldJ textarea, +.oldJ input[type="text"], +.oldJ input[type="password"], +.oldJ input[type="number"], +.oldJ input[type="email"], +.oldJ input[type="url"], +.oldJ .uneditable-input, +.oldJ .k2ViewIsItem select, +.oldJ .k2ViewIsCategory select, +.oldJ .k2GenericForm select {background-color:#fff;border:1px solid #ccc;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-transition:border linear .2s,box-shadow linear .2s;-moz-transition:border linear .2s,box-shadow linear .2s;transition:border linear .2s,box-shadow linear .2s;display:inline-block;height:30px;font-size:13px;padding:0 10px;min-width:80px;line-height:18px;color:#555;border-radius:3px;vertical-align:middle;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;} +.oldJ .k2GenericForm select {min-width:169px;} +.oldJ input.k2OrderBox {} /* don't hard code the width as we never know how large the number can be */ +.oldJ td.order span {display:none;} + +/* Forms */ +.k2GenericForm > h3:first-child {display:none;} + +/* Params */ +.oldJ .xmlParamsFields ul li {padding:10px 20px 10px 0;} + +/* Joomla 1.5! specific */ +#system-message dd.message {overflow:hidden;margin-top:0;} +.isJ15 div.header {padding:0;margin:12px;} +.isJ15 div.toolbar {margin-top:10px;} +.isJ15 #content-box .padding {padding:0;} +.isJ15 div#toolbar-box div.t, +.isJ15 div#element-box div.section-box div.t {padding:0;background:none;} +.isJ15 div.t, +.isJ15 div.b {display:none!important;} +.isJ15 div#toolbar-box {margin:0;} +.isJ15 div.m {border:0!important;} +.isJ15 #border-bottom {display:none;} +.isJ15 #submenu-box {margin:0;} +.isJ15 #k2AdminFooter {margin:10px auto 0;padding:0 0 20px;border-bottom:1px solid #ccc;} + +/* Joomla 3.x specific */ +html.isJ30 {} +body#com_k2 {} +.com_k2 .subhead-collapse {margin-bottom:1px;} +.com_k2 .subhead {border-bottom:1px solid #D4D7D7;margin-bottom:0;} + +/* Fix user group permissions category drop-down glitches under Joomla 3.0 */ +#paramscategories_chzn li {padding:3px 20px 3px 5px;} + +@media screen and (max-width:600px) { + .k2ItemFormEditor .editor .btn {display:block;margin:0 0 15px!important;text-align:left;} + .k2ItemFormEditor .editor .btn-group {display:block;} + .k2ItemFormEditor .editor .btn-toolbar {-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;} + .k2ItemFormEditor .editor .btn-toolbar.pull-right {float:none;width:100%;padding-top:0;margin-top:-10px;} + .k2ItemFormEditor .editor .btn-toolbar.pull-left {float:none;} +} + +/* -------------- View Styling -------------- */ + +/* Admin - Dashboard */ +#cpanel.k2AdminCpanel {float:left;width:52%;} +#k2AdminStats {float:right;width:47%;} +#k2AdminStats dl.tabs dt.closed {border:1px solid #ccc;} +#k2AdminStats dl.tabs dt.open {background:#fff;border:1px solid #ccc;border-bottom:1px solid #fff;} +div.isJ25 div.current {background:#fff;} +#k2AdminStats table.adminlist {width:100%;} + +/* Admin - Item - Autocomplete */ +.ui-autocomplete {position:absolute;margin:0;padding:0;list-style:none;border:1px solid #eee;background-color:white;border-right-color:#ddd;border-bottom-color:#ddd;text-align:left;z-index:50;} +* html .ui-autocomplete {width:1px;} /* without this, the menu expands to 100% in IE6 */ + +.ui-menu {list-style:none;padding:2px; margin:0; margin-top:-3px;display:block; float:left;} +.ui-menu .ui-menu-item {margin:0;padding:0;zoom:0;float:left;clear:left;width:99%;} +.ui-menu .ui-menu-item a {text-decoration:none; display:block; padding:.2em .4em; line-height:1.5;zoom:1;font-weight:bold;} +.ui-menu .ui-menu-item a.ui-state-hover, +.ui-menu .ui-menu-item a.ui-state-active {margin:-1px;background-color:#444;color:#fff;} + +/* Admin - Comments */ +td#k2Comment {} +div.commentText {} +div.commentToolbar {padding-top:4px;} +a.editComment {} +a.saveComment {display:none;} +a.closeComment {display:none;padding-left:4px;margin-left:4px;border-left:1px solid #aaa;} +div.commentToolbar span.k2CommentsLog {display:block;float:right;font-weight:bold;} +div.commentToolbar span.k2CommentsLoader {background:url(../images/system/loader.gif) no-repeat 0 50%;padding-left:24px;} + +/* New views introduced in 2.7 - Batch & Move (using the -alt suffix) */ +.header-alt {padding:15px 8px;font-size:20px;font-weight:300;letter-spacing:-1px;background-color:#fff;box-shadow:0 1px 0 rgba(0,0,0,.18);} +.header-alt h3 {margin:0;padding:0;line-height:1;font-weight:300;} +.header-alt.margin {margin-bottom:48px;} + +.subheader-alt {overflow:hidden;padding-top:24px;padding-bottom:24px;border-top:1px solid #d0d0cf;border-bottom:1px solid #d0d0cf;margin-bottom:24px;} +.subheader-alt label {display:inline-block;vertical-align:middle;color:#000;font-weight:700;margin:0;line-height:1; } +.subheader-alt input[type="radio"] {display:inline-block;vertical-align:middle;margin-right:5px;margin-top:0;} + +.action-alt {margin-bottom:25px;min-height:66px;} +.action-alt ol {padding-left:15px;margin:10px 0 15px 0;font-size:13px;font-weight:500;} +.action-alt ol li {margin-bottom:8px;} + +.label-alt {font-weight:700;color:#636a6f;font-size:13px;line-height:1;display:block;} +.label-alt.margin {margin-bottom:10px;} +.label-alt .fa {font-size:18px;display:inline-block;vertical-align:middle;margin-right:5px;} +.oldJ .label-alt {display:block;} + +/* End */ diff --git a/deployed/k2/media/k2/assets/css/k2.fonts.css b/deployed/k2/media/k2/assets/css/k2.fonts.css new file mode 100644 index 00000000..41c7e7b4 --- /dev/null +++ b/deployed/k2/media/k2/assets/css/k2.fonts.css @@ -0,0 +1,225 @@ +@font-face { + font-family: 'simple-line-icons'; + src: url('../fonts/Simple-Line-Icons.eot?v=2.2.2'); + src: url('../fonts/Simple-Line-Icons.eot?#iefix&v=2.2.2') format('embedded-opentype'), + url('../fonts/Simple-Line-Icons.ttf?v=2.2.2') format('truetype'), + url('../fonts/Simple-Line-Icons.woff2?v=2.2.2') format('woff2'), + url('../fonts/Simple-Line-Icons.woff?v=2.2.2') format('woff'), + url('../fonts/Simple-Line-Icons.svg?v=2.2.2#simple-line-icons') format('svg'); + font-weight: normal; + font-style: normal; +} +/* + Use the following CSS code if you want to have a class per icon. + Instead of a list of all class selectors, you can use the generic [class*="k2icon-"] selector, but it's slower: +*/ +.k2icon-user,.k2icon-people,.k2icon-user-female,.k2icon-user-follow,.k2icon-user-following,.k2icon-user-unfollow,.k2icon-login,.k2icon-logout,.k2icon-emotsmile,.k2icon-phone,.k2icon-call-end,.k2icon-call-in, +a#fontIncrease:before, a#fontDecrease:before,.k2icon-call-out,.k2icon-map,.k2icon-location-pin,.k2icon-direction,.k2icon-directions,.k2icon-compass,.k2icon-layers,.k2icon-menu,.k2icon-list,.k2icon-options-vertical,.k2icon-options,.k2icon-arrow-down,.k2icon-arrow-left,.k2icon-arrow-right,.k2icon-arrow-up,.k2icon-arrow-up-circle,.k2icon-arrow-left-circle,.k2icon-arrow-right-circle,.k2icon-arrow-down-circle,.k2icon-check,.k2icon-clock,.k2icon-plus,.k2icon-close,.k2icon-trophy,.k2icon-screen-smartphone,.k2icon-screen-desktop,.k2icon-plane,.k2icon-notebook,.k2icon-mustache,.k2icon-mouse,.k2icon-magnet,.k2icon-energy,.k2icon-disc,.k2icon-cursor,.k2icon-cursor-move,.k2icon-crop,.k2icon-chemistry,.k2icon-speedometer,.k2icon-shield,.k2icon-screen-tablet,.k2icon-magic-wand,.k2icon-hourglass,.k2icon-graduation,.k2icon-ghost,.k2icon-game-controller,.k2icon-fire,.k2icon-eyeglass,.k2icon-envelope-open,.k2icon-envelope-letter,.k2icon-bell,.k2icon-badge,.k2icon-anchor,.k2icon-wallet,.k2icon-vector,.k2icon-speech,.k2icon-puzzle,.k2icon-printer,.k2icon-present,.k2icon-playlist,.k2icon-pin,.k2icon-picture,.k2icon-handbag,.k2icon-globe-alt,.k2icon-globe,.k2icon-folder-alt,.k2icon-folder,.k2icon-film,.k2icon-feed,.k2icon-drop,.k2icon-drawer,.k2icon-docs,.k2icon-doc,.k2icon-diamond,.k2icon-cup,.k2icon-calculator,.k2icon-bubbles,.k2icon-briefcase,.k2icon-book-open,.k2icon-basket-loaded,.k2icon-basket,.k2icon-bag,.k2icon-action-undo,.k2icon-action-redo,.k2icon-wrench,.k2icon-umbrella,.k2icon-trash,.k2icon-tag,.k2icon-support,.k2icon-frame,.k2icon-size-fullscreen,.k2icon-size-actual,.k2icon-shuffle,.k2icon-share-alt,.k2icon-share,.k2icon-rocket,.k2icon-question,.k2icon-pie-chart,.k2icon-pencil,.k2icon-note,.k2icon-loop,.k2icon-home,.k2icon-grid,.k2icon-graph,.k2icon-microphone,.k2icon-music-tone-alt,.k2icon-music-tone,.k2icon-earphones-alt,.k2icon-earphones,.k2icon-equalizer,.k2icon-like,.k2icon-dislike,.k2icon-control-start,.k2icon-control-rewind,.k2icon-control-play,.k2icon-control-pause,.k2icon-control-forward,.k2icon-control-end,.k2icon-volume-1,.k2icon-volume-2,.k2icon-volume-off,.k2icon-calendar,.k2icon-bulb,.k2icon-chart,.k2icon-ban,.k2icon-bubble,.k2icon-camrecorder,.k2icon-camera,.k2icon-cloud-download,.k2icon-cloud-upload,.k2icon-envelope,.k2icon-eye,.k2icon-flag,.k2icon-heart,.k2icon-info,.k2icon-key,.k2icon-link,.k2icon-lock,.k2icon-lock-open,.k2icon-magnifier,.k2icon-magnifier-add,.k2icon-magnifier-remove,.k2icon-paper-clip,.k2icon-paper-plane,.k2icon-power,.k2icon-refresh,.k2icon-reload,.k2icon-settings,.k2icon-star,.k2icon-symbol-female,.k2icon-symbol-male,.k2icon-target,.k2icon-credit-card,.k2icon-paypal,.k2icon-social-tumblr,.k2icon-social-twitter,.k2icon-social-facebook,.k2icon-social-instagram,.k2icon-social-linkedin,.k2icon-social-pinterest,.k2icon-social-github,.k2icon-social-gplus,.k2icon-social-reddit,.k2icon-social-skype,.k2icon-social-dribbble,.k2icon-social-behance,.k2icon-social-foursqare,.k2icon-social-soundcloud,.k2icon-social-spotify,.k2icon-social-stumbleupon,.k2icon-social-youtube,.k2icon-social-dropbox{font-family:'simple-line-icons';speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale} +.k2icon-user:before{content:"\e005"} +.k2icon-people:before{content:"\e001"} +.k2icon-user-female:before{content:"\e000"} +.k2icon-user-follow:before{content:"\e002"} +.k2icon-user-following:before{content:"\e003"} +.k2icon-user-unfollow:before{content:"\e004"} +.k2icon-login:before{content:"\e066"} +.k2icon-logout:before{content:"\e065"} +.k2icon-emotsmile:before{content:"\e021"} +.k2icon-phone:before{content:"\e600"} +.k2icon-call-end:before{content:"\e048"} +.k2icon-call-in:before{content:"\e047"} +.k2icon-call-out:before{content:"\e046"} +.k2icon-map:before{content:"\e033"} +.k2icon-location-pin:before{content:"\e096"} +.k2icon-direction:before{content:"\e042"} +.k2icon-directions:before{content:"\e041"} +.k2icon-compass:before{content:"\e045"} +.k2icon-layers:before{content:"\e034"} +.k2icon-menu:before{content:"\e601"} +.k2icon-list:before{content:"\e067"} +.k2icon-options-vertical:before{content:"\e602"} +.k2icon-options:before{content:"\e603"} +.k2icon-arrow-down:before{content:"\e604"} +.k2icon-arrow-left:before{content:"\e605"} +.k2icon-arrow-right:before{content:"\e606"} +.k2icon-arrow-up:before{content:"\e607"} +.k2icon-arrow-up-circle:before{content:"\e078"} +.k2icon-arrow-left-circle:before{content:"\e07a"} +.k2icon-arrow-right-circle:before{content:"\e079"} +.k2icon-arrow-down-circle:before{content:"\e07b"} +.k2icon-check:before{content:"\e080"} +.k2icon-clock:before{content:"\e081"} +.k2icon-plus:before{content:"\e095"} +.k2icon-close:before{content:"\e082"} +.k2icon-trophy:before{content:"\e006"} +.k2icon-screen-smartphone:before{content:"\e010"} +.k2icon-screen-desktop:before{content:"\e011"} +.k2icon-plane:before{content:"\e012"} +.k2icon-notebook:before{content:"\e013"} +.k2icon-mustache:before{content:"\e014"} +.k2icon-mouse:before{content:"\e015"} +.k2icon-magnet:before{content:"\e016"} +.k2icon-energy:before{content:"\e020"} +.k2icon-disc:before{content:"\e022"} +.k2icon-cursor:before{content:"\e06e"} +.k2icon-cursor-move:before{content:"\e023"} +.k2icon-crop:before{content:"\e024"} +.k2icon-chemistry:before{content:"\e026"} +.k2icon-speedometer:before{content:"\e007"} +.k2icon-shield:before{content:"\e00e"} +.k2icon-screen-tablet:before{content:"\e00f"} +.k2icon-magic-wand:before{content:"\e017"} +.k2icon-hourglass:before{content:"\e018"} +.k2icon-graduation:before{content:"\e019"} +.k2icon-ghost:before{content:"\e01a"} +.k2icon-game-controller:before{content:"\e01b"} +.k2icon-fire:before{content:"\e01c"} +.k2icon-eyeglass:before{content:"\e01d"} +.k2icon-envelope-open:before{content:"\e01e"} +.k2icon-envelope-letter:before{content:"\e01f"} +.k2icon-bell:before{content:"\e027"} +.k2icon-badge:before{content:"\e028"} +.k2icon-anchor:before{content:"\e029"} +.k2icon-wallet:before{content:"\e02a"} +.k2icon-vector:before{content:"\e02b"} +.k2icon-speech:before{content:"\e02c"} +.k2icon-puzzle:before{content:"\e02d"} +.k2icon-printer:before{content:"\e02e"} +.k2icon-present:before{content:"\e02f"} +.k2icon-playlist:before{content:"\e030"} +.k2icon-pin:before{content:"\e031"} +.k2icon-picture:before{content:"\e032"} +.k2icon-handbag:before{content:"\e035"} +.k2icon-globe-alt:before {content:"\e036"} +.k2icon-globe:before {content:"\e037"} +.k2icon-folder-alt:before{content:"\e039"} +.k2icon-folder:before{content:"\e089"} +.k2icon-film:before{content:"\e03a"} +.k2icon-feed:before{content:"\e03b"} +.k2icon-drop:before{content:"\e03e"} +.k2icon-drawer:before{content:"\e03f"} +.k2icon-docs:before{content:"\e040"} +.k2icon-doc:before{content:"\e085"} +.k2icon-diamond:before{content:"\e043"} +.k2icon-cup:before{content:"\e044"} +.k2icon-calculator:before{content:"\e049"} +.k2icon-bubbles:before{content:"\e04a"} +.k2icon-briefcase:before{content:"\e04b"} +.k2icon-book-open:before{content:"\e04c"} +.k2icon-basket-loaded:before{content:"\e04d"} +.k2icon-basket:before{content:"\e04e"} +.k2icon-bag:before{content:"\e04f"} +.k2icon-action-undo:before{content:"\e050"} +.k2icon-action-redo:before{content:"\e051"} +.k2icon-wrench:before{content:"\e052"} +.k2icon-umbrella:before{content:"\e053"} +.k2icon-trash:before{content:"\e054"} +.k2icon-tag:before{content:"\e055"} +.k2icon-support:before{content:"\e056"} +.k2icon-frame:before{content:"\e038"} +.k2icon-size-fullscreen:before{content:"\e057"} +.k2icon-size-actual:before{content:"\e058"} +.k2icon-shuffle:before{content:"\e059"} +.k2icon-share-alt:before{content:"\e05a"} +.k2icon-share:before{content:"\e05b"} +.k2icon-rocket:before{content:"\e05c"} +.k2icon-question:before{content:"\e05d"} +.k2icon-pie-chart:before{content:"\e05e"} +.k2icon-pencil:before{content:"\e05f"} +.k2icon-note:before{content:"\e060"} +.k2icon-loop:before{content:"\e064"} +.k2icon-home:before{content:"\e069"} +.k2icon-grid:before{content:"\e06a"} +.k2icon-graph:before{content:"\e06b"} +.k2icon-microphone:before{content:"\e063"} +.k2icon-music-tone-alt:before{content:"\e061"} +.k2icon-music-tone:before{content:"\e062"} +.k2icon-earphones-alt:before{content:"\e03c"} +.k2icon-earphones:before{content:"\e03d"} +.k2icon-equalizer:before{content:"\e06c"} +.k2icon-like:before{content:"\e068"} +.k2icon-dislike:before{content:"\e06d"} +.k2icon-control-start:before{content:"\e06f"} +.k2icon-control-rewind:before{content:"\e070"} +.k2icon-control-play:before{content:"\e071"} +.k2icon-control-pause:before{content:"\e072"} +.k2icon-control-forward:before{content:"\e073"} +.k2icon-control-end:before{content:"\e074"} +.k2icon-volume-1:before{content:"\e09f"} +.k2icon-volume-2:before{content:"\e0a0"} +.k2icon-volume-off:before{content:"\e0a1"} +.k2icon-calendar:before{content:"\e075"} +.k2icon-bulb:before{content:"\e076"} +.k2icon-chart:before{content:"\e077"} +.k2icon-ban:before{content:"\e07c"} +.k2icon-bubble:before{content:"\e07d"} +.k2icon-camrecorder:before{content:"\e07e"} +.k2icon-camera:before{content:"\e07f"} +.k2icon-cloud-download:before{content:"\e083"} +.k2icon-cloud-upload:before{content:"\e084"} +.k2icon-envelope:before{content:"\e086"} +.k2icon-eye:before{content:"\e087"} +.k2icon-flag:before{content:"\e088"} +.k2icon-heart:before{content:"\e08a"} +.k2icon-info:before{content:"\e08b"} +.k2icon-key:before{content:"\e08c"} +.k2icon-link:before{content:"\e08d"} +.k2icon-lock:before{content:"\e08e"} +.k2icon-lock-open:before{content:"\e08f"} +.k2icon-magnifier:before{content:"\e090"} +.k2icon-magnifier-add:before, a#fontIncrease:before {content:"\e091"} +.k2icon-magnifier-remove:before, a#fontDecrease:before {content:"\e092"} +.k2icon-paper-clip:before{content:"\e093"} +.k2icon-paper-plane:before{content:"\e094"} +.k2icon-power:before{content:"\e097"} +.k2icon-refresh:before{content:"\e098"} +.k2icon-reload:before{content:"\e099"} +.k2icon-settings:before{content:"\e09a"} +.k2icon-star:before{content:"\e09b"} +.k2icon-symbol-female:before{content:"\e09c"} +.k2icon-symbol-male:before{content:"\e09d"} +.k2icon-target:before{content:"\e09e"} +.k2icon-credit-card:before{content:"\e025"} +.k2icon-paypal:before{content:"\e608"} +.k2icon-social-tumblr:before{content:"\e00a"} +.k2icon-social-twitter:before{content:"\e009"} +.k2icon-social-facebook:before{content:"\e00b"} +.k2icon-social-instagram:before{content:"\e609"} +.k2icon-social-linkedin:before{content:"\e60a"} +.k2icon-social-pinterest:before{content:"\e60b"} +.k2icon-social-github:before{content:"\e60c"} +.k2icon-social-gplus:before{content:"\e60d"} +.k2icon-social-reddit:before{content:"\e60e"} +.k2icon-social-skype:before{content:"\e60f"} +.k2icon-social-dribbble:before{content:"\e00d"} +.k2icon-social-behance:before{content:"\e610"} +.k2icon-social-foursqare:before{content:"\e611"} +.k2icon-social-soundcloud:before{content:"\e612"} +.k2icon-social-spotify:before{content:"\e613"} +.k2icon-social-stumbleupon:before{content:"\e614"} +.k2icon-social-youtube:before{content:"\e008"} +.k2icon-social-dropbox:before{content:"\e00c"} + +/* new helper classes */ +.k2-loader { -webkit-animation: fa-spin 2s infinite linear; animation: fa-spin 2s infinite linear; } + +/* simple animation for spining icons */ +@-webkit-keyframes fa-spin { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(359deg); + transform: rotate(359deg); + } +} +@keyframes fa-spin { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(359deg); + transform: rotate(359deg); + } +} diff --git a/deployed/k2/media/k2/assets/css/k2.frontend.css b/deployed/k2/media/k2/assets/css/k2.frontend.css new file mode 100644 index 00000000..78e859b5 --- /dev/null +++ b/deployed/k2/media/k2/assets/css/k2.frontend.css @@ -0,0 +1,73 @@ +/** + * @version 2.7.x + * @package K2 + * @author JoomlaWorks http://www.joomlaworks.net + * @copyright Copyright (c) 2006 - 2016 JoomlaWorks Ltd. All rights reserved. + * @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html + */ + +/* ============ Frontend Editing ============ */ + +/* --- component.php overrides --- */ +body.contentpane, +body.component-body {padding:0;margin:0;font-family:Arial, Helvetica, sans-serif;font-size:11px;color:#333;background:#fff;} +body.contentpane a, +body.component-body a {color:#333;font-weight:bold;text-decoration:none;} +body.contentpane a:hover, +body.component-body a:hover {color:#0B55C4;} +body.contentpane input, +body.component-body input, +body.contentpane select, +body.component-body select {border:1px solid #ccc;} + +body div.button2-left a {font-weight:normal;} + +table td.key {background:#f6f6f6;border-bottom:1px solid #e9e9e9;border-right:1px solid #e9e9e9;color:#666;font-weight:bold;text-align:right;font-size:11px;width:140px;} + +/* --- K2 --- */ +div#k2ToggleSidebarContainer {text-align:right;} + a#k2ToggleSidebar:before {content:"<>";font-family:monospace;} + a#k2ToggleSidebar {background:#95a5a6;display:inline-block;padding:2px 4px;color:#fff;border:0;border-radius:4px;font-size:11px;font-weight:bold;} + a#k2ToggleSidebar:hover {background:#798d8f;} + +div#k2FrontendContainer {padding:20px;margin:0;} + +div#k2Frontend {background:#fff;width:auto;padding:8px;margin:0;} +div#k2Frontend h3, +div#k2Frontend legend {font-size:11px;font-family:Arial, Helvetica, sans-serif;} +div#k2Frontend fieldset {border:1px solid #ccc;} + +div#k2Frontend div#editor-xtd-buttons .button2-left {display:inline;} + +div#k2Frontend table.k2FrontendToolbar {display:block;margin-top:12px;float:right;border-collapse:separate;} +div#k2Frontend table.k2FrontendToolbar td {border:none;} + +div#k2Frontend table.k2FrontendToolbar td.button a {display:block;padding:4px 8px;color:#fff;border:0;border-radius:4px;font-size:14px;font-weight:bold;} + #toolbar-save a {background:#18bc9c;} + #toolbar-save a:hover {background:#128f76;} + #toolbar-cancel a {background:#e74c3c;} + #toolbar-cancel a:hover {background:#d62c1a;} + +#k2FrontendEditToolbar {text-align:left;padding:8px;} +#k2FrontendEditToolbar h2 {width:auto;margin-top:0;line-height:40px; min-height: 48px;} + +#k2FrontendPermissionsNotice {text-align:center;} +#k2FrontendPermissionsNotice p {display:inline-block;color:#fff;font-size:12px;background:#3498db;padding:8px;margin:8px auto;border-radius:4px;} + +div#k2Frontend table.adminFormK2 {border-collapse:collapse;} +div#k2Frontend table.adminFormK2 tr td {border:none;} + +#adminFormK2tabs, +#adminFormK2Sidebar {border:none;} +#adminFormK2Sidebar table {width:100%;} +.isJ30 #adminFormK2Sidebar h3 {font-size:18px;} + +h3.ui-accordion-header span.ui-icon {margin:-2px 0 0 0;} + +div#k2Frontend .k2CommentsPagination {text-align:center;} +div#k2Frontend .k2CommentsPagination .pagination span, +div#k2Frontend .k2CommentsPagination .pagination a {padding:0 2px;} + +/* Tabs in the frontend */ +.isJ15 div#k2Frontend div.k2TabsContent, +.isJ25 div#k2Frontend div.k2TabsContent {margin-top:3px;} diff --git a/deployed/k2/media/k2/assets/css/k2.global.css b/deployed/k2/media/k2/assets/css/k2.global.css new file mode 100644 index 00000000..53c38003 --- /dev/null +++ b/deployed/k2/media/k2/assets/css/k2.global.css @@ -0,0 +1,146 @@ +/** + * @version 2.8.x + * @package K2 + * @author JoomlaWorks http://www.joomlaworks.net + * @copyright Copyright (c) 2006 - 2017 JoomlaWorks Ltd. All rights reserved. + * @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html + */ + +/* --- Common --- */ +.k2clr {clear:both;height:0;line-height:0;border:none;float:none;background:none;padding:0;margin:0;} +#k2AlertContainer {position:fixed;top:0;left:0;right:0;z-index:99999;} + #k2AlertMessage {width:40%;background:#42a640;color:#fff;font-size:18px;text-align:center;margin:0 auto;padding:20px;box-sizing:border-box;border-bottom:4px solid #358534;} + a#k2AlertClose {color:#358534;font-family:monospace;font-size:24px;font-weight:bold;display:block;width:16px;height:16px;margin:0 0 10px 10px;float:right;text-decoration:none;} + a#k2AlertClose:hover {color:#2b752a;} + #k2AlertMessage span {display:block;width:92%;margin:auto;} + + + +/* --- jQueryUI Sortables for K2 Fields/Elements --- */ +div.k2SelectorButton {display:block;border-bottom:1px dotted #ccc;padding:8px 0;margin:0 0 8px 0;} +div.k2SelectorButton a {} + div.k2SingleSelect {border:0;padding:0;margin:0;} + div.k2SingleSelect span.k2EntryText {display:inline-block;margin:2px 0;padding:4px 6px;border:1px solid #ccc;background:#eee;border-radius:2px;color:#555;} +ul.k2SortableListContainer {list-style:none;display:block;clear:both;margin:0;padding:0;width:80%;} +ul.k2SortableListContainer li {list-style:none;margin:2px 0;padding:8px;border:1px solid #ccc;background:#eee;border-radius:2px;cursor:move;} +ul.k2SortableListContainer li a.k2EntryRemove {cursor:pointer;margin:0 12px 0 0;font-size:14px;} +ul.k2SortableListContainer li span.k2EntryText {} + + + +/* --- Header Element --- */ +.jwHeaderContainer {background:#e5f7fd;color:#346b93;font-size:20px;padding:24px 16px;margin:0;border-radius:4px;} +.jwHeaderContainer15 {clear:both;font-weight:bold;font-size:12px;color:#369;margin:0;padding:0;background:#d5e7fa;border-bottom:2px solid #96b0cb;float:left;width:100%;} +.jwHeaderContent {} +.jwHeaderClr {clear:both;height:0;line-height:0;border:none;float:none;background:none;padding:0;margin:0;} + + + +/* --- Style parameters for modules --- */ +.com_modules .form-horizontal .span9 .control-group {border-radius:4px;padding:0;margin:0 0 4px 0 !important;} +.com_modules .form-horizontal .span9 .control-group:nth-child(2n-1) {background:#f7f7f7;} +.com_modules .form-horizontal .span9 .control-group:last-child {margin-bottom:100px !important;} +.com_modules .form-horizontal .span9 .control-group .control-label, +.com_modules .form-horizontal .span9 .control-group .controls {padding:16px;margin:0;} +.com_modules .form-horizontal .span9 .control-group .control-label label {padding:0;margin:0;} +.com_modules .form-horizontal .span9 .control-group .controls label {} +.com_modules .form-horizontal .span9 .control-group .control-label label {font-size:14px;margin-top:4px;} + +/* Resize parameter columns */ +@media all and (min-width:771px) { + .com_modules .form-horizontal .span9 .control-group .control-label {width:30% !important;} + .com_modules .form-horizontal .span9 .control-group .controls {margin-left:32% !important;} +} +@media all and (min-width:481px) and (max-width:770px){ + .com_modules .form-horizontal .span9 .control-group .control-label {width:45% !important;} + .com_modules .form-horizontal .span9 .control-group .controls {margin-left:47% !important;} +} +.com_modules .form-horizontal .span9 .control-group-header {background:#e5f7fd;margin-top:32px !important;} +.com_modules .form-horizontal .span9 .control-group-header .control-label, +.com_modules .form-horizontal .span9 .control-group-header .controls {padding:0 !important;margin:0 !important;} + +/* Textarea & Chosen (multi-container) blocks */ +.com_modules .form-horizontal .span9 .controls .chzn-container-multi {width:90% !important;} +.com_modules .form-horizontal .span9 .controls textarea {width:90%;} + + + +/* --- Style parameters for menus --- */ +.com_menus .form-horizontal #attrib-basic .control-group {border-radius:4px;padding:0;margin:0 0 4px 0 !important;} +.com_menus .form-horizontal #attrib-basic .control-group:nth-child(2n-1) {background:#f7f7f7;} +.com_menus .form-horizontal #attrib-basic .control-group:last-child {margin-bottom:100px !important;} +.com_menus .form-horizontal #attrib-basic .control-group .control-label, +.com_menus .form-horizontal #attrib-basic .control-group .controls {padding:16px;margin:0;} +.com_menus .form-horizontal #attrib-basic .control-group .control-label label {padding:0;margin:0;} +.com_menus .form-horizontal #attrib-basic .control-group .controls label {} +.com_menus .form-horizontal #attrib-basic .control-group .control-label label {font-size:14px;margin-top:4px;} + +/* Resize parameter columns */ +@media all and (min-width:771px) { + .com_menus .form-horizontal #attrib-basic .control-group .control-label {width:30% !important;} + .com_menus .form-horizontal #attrib-basic .control-group .controls {margin-left:32% !important;} +} +@media all and (min-width:481px) and (max-width:770px){ + .com_menus .form-horizontal #attrib-basic .control-group .control-label {width:45% !important;} + .com_menus .form-horizontal #attrib-basic .control-group .controls {margin-left:47% !important;} +} +.com_menus .form-horizontal #attrib-basic .control-group-header {background:#e5f7fd;margin-top:32px !important;} +.com_menus .form-horizontal #attrib-basic .control-group-header .control-label, +.com_menus .form-horizontal #attrib-basic .control-group-header .controls {padding:0 !important;margin:0 !important;} + +/* Textarea & Chosen (multi-container) blocks */ +.com_menus .form-horizontal #attrib-basic .controls .chzn-container-multi {width:90% !important;} +.com_menus .form-horizontal #attrib-basic .controls textarea {width:90%;} + +/* Radio/Checkbox Buttons */ +.com_menus .form-horizontal #attrib-basic .controls fieldset.radio:not(.btn-group) label {display:inline-block !important;margin:0 !important;padding:0 16px 0 2px !important;} +.com_menus .form-horizontal #attrib-basic .controls fieldset.radio:not(.btn-group), +.com_menus .form-horizontal #attrib-basic .controls fieldset.checkbox:not(.btn-group) {padding:0 !important;margin:4px 0 0 0 !important;} +.com_menus .form-horizontal #attrib-basic .controls fieldset.radio:not(.btn-group) input[type="radio"], +.com_menus .form-horizontal #attrib-basic .controls fieldset.radio:not(.btn-group) .checkbox input[type="checkbox"] {display:inline-block !important;float:none !important;margin:-2px 0 0 0 !important;} + + + +/* --- Style component parameters --- */ +.com_config .form-horizontal .span10 .control-group {border-radius:4px;padding:0;margin:0 0 4px 0 !important;} +.com_config .form-horizontal .span10 .control-group:nth-child(2n-1) {background:#f7f7f7;} +.com_config .form-horizontal .span10 .control-group:last-child {margin-bottom:100px !important;} +.com_config .form-horizontal .span10 .control-group .control-label, +.com_config .form-horizontal .span10 .control-group .controls {padding:16px;margin:0;} +.com_config .form-horizontal .span10 .control-group .control-label label {padding:0;margin:0;} +.com_config .form-horizontal .span10 .control-group .controls label {} +.com_config .form-horizontal .span10 .control-group .control-label label {font-size:14px;margin-top:4px;} + +/* Resize parameter columns */ +@media all and (min-width:771px) { + .com_config .form-horizontal .span10 .control-group .control-label {width:30% !important;} + .com_config .form-horizontal .span10 .control-group .controls {margin-left:32% !important;} +} +@media all and (min-width:481px) and (max-width:770px){ + .com_config .form-horizontal .span10 .control-group .control-label {width:45% !important;} + .com_config .form-horizontal .span10 .control-group .controls {margin-left:47% !important;} +} +.com_config .form-horizontal .span10 .control-group-header {background:#e5f7fd;margin-top:32px !important;} +.com_config .form-horizontal .span10 .control-group-header .control-label, +.com_config .form-horizontal .span10 .control-group-header .controls {padding:0 !important;margin:0 !important;} + +/* Textarea & Chosen (multi-container) blocks */ +.com_config .form-horizontal .span10 .controls .chzn-container-multi {width:90% !important;} +.com_config .form-horizontal .span10 .controls textarea {width:90%;} + +/* Radio/Checkbox Buttons */ +.com_config .form-horizontal .span10 .controls fieldset.radio label {display:inline-block !important;margin:0 !important;padding:0 16px 0 2px !important;} +.com_config .form-horizontal .span10 .controls fieldset.radio, +.com_config .form-horizontal .span10 .controls fieldset.checkbox {padding:0 !important;margin:4px 0 0 0 !important;} +.com_config .form-horizontal .span10 .controls fieldset.radio input[type="radio"], +.com_config .form-horizontal .span10 .controls fieldset.radio .checkbox input[type="checkbox"] {display:inline-block !important;float:none !important;margin:-2px 0 0 0 !important;} + + + +/* --- JoomFish Styling --- */ +#K2ExtraFields {color:#000;font-size:11px;padding:6px 2px 4px 4px;text-align:left;} +#K2ExtraFields h1 {font-size:16px;height:25px;} +#K2ExtraFields h2 {font-size:14px;} +#K2ExtraFields strong {font-style:italic;} + +/* END */ diff --git a/deployed/k2/media/k2/assets/css/k2.modules.css b/deployed/k2/media/k2/assets/css/k2.modules.css new file mode 100644 index 00000000..e0ff5425 --- /dev/null +++ b/deployed/k2/media/k2/assets/css/k2.modules.css @@ -0,0 +1,107 @@ +/** + * @version 2.7.x + * @package K2 + * @author JoomlaWorks http://www.joomlaworks.net + * @copyright Copyright (c) 2006 - 2016 JoomlaWorks Ltd. All rights reserved. + * @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html + */ + +/* categorieslatest.php, userslatest.php, users.php, items.php */ +.ui-sortable { padding:4px 0; position:relative; } +#categoriesList li,#usersList li,#itemsList li { list-style:none; margin:4px 0; line-height:16px; height:16px; } +.ui-sortable span { height:16px; line-height:16px; } +.ui-sortable span.handle { cursor:move; } +.ui-sortable img.remove { width:16px; height:16px; margin:0; margin-right:4px; cursor:pointer; float:left; } + +/* header.php */ +.k2clr { clear:both; height:0; line-height:0; border:none; float:none; background:none; padding:0; margin:0; } +.paramHeaderContainer15 { clear:both; font-weight:bold; font-size:12px; color:#369; margin:0; padding:0; float:left; width:100%; } +#minwidth-body .paramHeaderContent { font-size:12px; color:#369; border-radius: 0; float: none; width: auto; margin: 0 -4px 5px; } + +/* Normalize module param width in Joomla! 1.6+ */ +.pane-sliders ul.adminformlist { margin:0; padding:0; list-style:none; } +.pane-sliders ul.adminformlist li { margin:0; padding:0; list-style:none; clear:both; } +.pane-sliders ul.adminformlist li label { clear:left; background:#f6f6f6; border-bottom:1px solid #e9e9e9; border-right:1px solid #e9e9e9; margin:0 4px 1px 0; padding:4px; color:#666; font-weight:bold; text-align:right; font-size:11px; width:140px; } +.pane-sliders ul.adminformlist li fieldset {margin:0;} +.pane-sliders ul.adminformlist li fieldset label { clear:none; width:auto; background:none; font-weight:normal; border:none; padding:0; text-align:left; margin:5px 0; width:auto; } +.pane-sliders ul.adminformlist li select, +.pane-sliders ul.adminformlist li textarea, +.pane-sliders ul.adminformlist li input[type="text"] { margin:0; } + +/* Joomla! 1.6-1.7 configuration settings */ +body.contentpane ul.config-option-list li>label { background:#f6f6f6; border-bottom:1px solid #e9e9e9; border-right:1px solid #e9e9e9; color:#666; font-weight:bold; text-align:right; font-size:11px; width:150px; margin:0 0 1px; padding:4px; } +body.contentpane div.current select { margin-bottom:0!important; } +body.contentpane dl.tabs { padding-left:8px!important; } +body.contentpane dl.tabs dt.open { background:#fff!important; border-bottom:1px solid #fff!important; } + +/* Joomla! 2.5 only */ +#minwidth-body .pane-sliders ul.adminformlist li > label { padding: 10px; } +#minwidth-body .pane-sliders ul.adminformlist li fieldset { padding: 5px; } +#minwidth-body .pane-sliders ul.adminformlist li .select2-container { max-width: 200px; } + +/* Settings - Joomla! 3.x */ +.paramHeaderContent { background: #e5f7fd; border-radius: 3px; line-height: 1; padding: 18px 25px; color: #346b93; font-size: 18px; } + .tab-pane > .control-group:first-child .paramHeaderContent { margin-top: 0; } + +.com_modules .form-horizontal .controls:not(#jform_menuselect) label, +.com_modules .controls:not(#jform_menuselect) label, +.com_menus .controls label, .com_config .controls label { min-width:85px;width:auto; text-align:center; border:1px solid #d4d6d8;line-height:33px;vertical-align:top;height:33px;font-size:12px;margin:0 -2px;padding:0 13px; +color:#8a8c8c;display:inline-block;vertical-align:middle;white-space:nowrap;background-color:#eff1f1; +box-shadow:0 1px 1px rgba(65,64,66,.14), inset 0 1px 0 #fff; } + + .controls label:hover {cursor:pointer; box-shadow:0 1px 1px rgba(65,64,66,.14), inset 0 0 10px rgba(0,0,0,.15);} + .controls input[type="radio"] { opacity: 0; position: absolute; clip: rect(0,0,0,0); } + + .controls label:first-of-type { border-radius: 3px 0 0 3px; } + .controls label:last-of-type { border-radius: 0 3px 3px 0; } + + + /* Checked boxes - show/ Yes */ + .com_modules .form-horizontal .controls:not(#jform_menuselect) input[value="1"]:checked + label, + .com_modules .controls:not(#jform_menuselect) input[value="1"]:checked + label, + .com_menus .controls input[value="1"]:checked + label, + .com_config .controls input[value="1"]:checked + label, + .controls input[value="1"]:checked + label, + label[id*="1-"].radio.isChecked { background: #3fa800; color: #fff; box-shadow: 0 1px 1px rgba(65,64,66,.14); } + + /* Checked boxes - hide/ No */ + .com_modules .form-horizontal .controls:not(#jform_menuselect) input[value="0"]:checked + label, + .com_modules .controls:not(#jform_menuselect) input[value="0"]:checked + label, + .com_menus .controls input[value="0"]:checked + label, + .com_config .controls input[value="0"]:checked + label, + .controls input[value="0"]:checked + label, + label[id*="0-"].radio.isChecked { background: #bd362f; color: #fff; box-shadow: 0 1px 1px rgba(65,64,66,.14); } + + /* Checked boxes - Generic */ + label.isChecked { background: #63696f; color: #fff; box-shadow: 0 1px 1px rgba(65,64,66,.14); } + + +/* Redefining the form */ +.form-horizontal .control-label:empty { display: none; } +.form-horizontal .controls { margin-left: 0!important; } + +.form-horizontal .control-label { min-width: 200px; max-width: 200px; } +.form-horizontal .control-label label { font-size: 13px; font-weight: 700; color: #777778; padding: 15px 10px 10px; line-height: 1; margin: 0; } +.controls .radio, .controls .checkbox { padding-left: 0; } + +/* BS resets */ +.form-horizontal .control-group {margin-bottom: 15px; border-radius: 3px; } +.form-horizontal .control-group:nth-child(2n-2) { background: #f7f7f7; } + +.form-horizontal .controls > .radio:first-child, .form-horizontal .controls > .checkbox:first-child { padding-top: 10px; } +.k2Table .controls > .radio:first-child, .k2Table .controls > .checkbox:first-child, +.k2GenericForm .controls > .radio:first-child, .k2GenericForm .controls > .checkbox:first-child { padding-top: 0px; } + +.form-horizontal .controls fieldset { padding: 10px 0; } +.form-horizontal .controls .chzn-container { margin: 15px 0; } +.form-horizontal .controls input[type="text"], .form-horizontal .controls textarea, .form-horizontal .controls input[type="text"] + .btn { margin: 10px 0 15px 0; } + +/* Tabs */ +ul#configTabs {margin:0 0 18px;padding:0;text-align:left;white-space:nowrap;list-style:none;} + ul#configTabs li { display:inline-block; margin:0 1px -1px; padding:0; } + ul#configTabs li a {display:block;padding:10px 21px;margin:0;background:#f0f2f2;font-size:14px;text-decoration:none;font-weight:normal;outline:0;border-radius:3px 3px 0 0;color:#6d6f71;border-bottom:1px solid #d4d7d9;} + ul#configTabs li a:hover {text-decoration:none;background-color:#f6f6f6;} + ul#configTabs li a i {margin-right:8px;color:#6d6f71;} + ul#configTabs li.active a {padding:10px 20px;background:#fff;color:#58595b;border:1px solid #d4d7d9;border-bottom:1px solid #fff;} + ul#configTabs li.active a i {color:#0091ff;} + ul#configTabs li.active a:hover {background-color:#fff;} diff --git a/deployed/k2/media/k2/assets/css/magnific-popup.css b/deployed/k2/media/k2/assets/css/magnific-popup.css new file mode 100644 index 00000000..f4dd8937 --- /dev/null +++ b/deployed/k2/media/k2/assets/css/magnific-popup.css @@ -0,0 +1,88 @@ +/* Magnific Popup CSS */ +.mfp-bg {top:0;left:0;width:100%;height:100%;z-index:1042;overflow:hidden;position:fixed;background:#0b0b0b;opacity:0.8;} +.mfp-wrap {top:0;left:0;width:100%;height:100%;z-index:1043;position:fixed;outline:none !important;-webkit-backface-visibility:hidden;} +.mfp-container {text-align:center;position:absolute;width:100%;height:100%;left:0;top:0;padding:0 8px;box-sizing:border-box;} +.mfp-container:before {content:'';display:inline-block;height:100%;vertical-align:middle;} +.mfp-align-top .mfp-container:before {display:none;} +.mfp-content {position:relative;display:inline-block;vertical-align:middle;margin:0 auto;text-align:left;z-index:1045;} +.mfp-inline-holder .mfp-content, +.mfp-ajax-holder .mfp-content {width:100%;cursor:auto;} +.mfp-ajax-cur {cursor:progress;} +.mfp-zoom-out-cur, .mfp-zoom-out-cur .mfp-image-holder .mfp-close {cursor:-moz-zoom-out;cursor:-webkit-zoom-out;cursor:zoom-out;} +.mfp-zoom {cursor:pointer;cursor:-webkit-zoom-in;cursor:-moz-zoom-in;cursor:zoom-in;} +.mfp-auto-cursor .mfp-content {cursor:auto;} +.mfp-close, +.mfp-arrow, +.mfp-preloader, +.mfp-counter {-webkit-user-select:none;-moz-user-select:none;user-select:none;} +.mfp-loading.mfp-figure {display:none;} +.mfp-hide {display:none !important;} +.mfp-preloader {color:#CCC;position:absolute;top:50%;width:auto;text-align:center;margin-top:-0.8em;left:8px;right:8px;z-index:1044;} +.mfp-preloader a {color:#CCC;} +.mfp-preloader a:hover {color:#FFF;} +.mfp-s-ready .mfp-preloader {display:none;} +.mfp-s-error .mfp-content {display:none;} +button.mfp-close, +button.mfp-arrow {overflow:visible;cursor:pointer;background:transparent;border:0;-webkit-appearance:none;display:block;outline:none;padding:0;z-index:1046;box-shadow:none;touch-action:manipulation;} +button::-moz-focus-inner {padding:0;border:0;} +.mfp-close {width:44px;height:44px;line-height:44px;position:absolute;right:0;top:0;text-decoration:none;text-align:center;opacity:0.65;padding:0 0 18px 10px;color:#FFF;font-style:normal;font-size:28px;font-family:Arial, Baskerville, monospace;} +.mfp-close:hover, +.mfp-close:focus {opacity:1;} +.mfp-close:active {top:1px;} +.mfp-close-btn-in .mfp-close {color:#333;} +.mfp-image-holder .mfp-close, +.mfp-iframe-holder .mfp-close {color:#FFF;right:-6px;text-align:right;padding-right:6px;width:100%;} +.mfp-counter {position:absolute;top:0;right:0;color:#CCC;font-size:12px;line-height:18px;white-space:nowrap;} +.mfp-arrow {position:absolute;opacity:0.65;margin:0;top:50%;margin-top:-55px;padding:0;width:90px;height:110px;-webkit-tap-highlight-color:transparent;} +.mfp-arrow:active {margin-top:-54px;} +.mfp-arrow:hover, +.mfp-arrow:focus {opacity:1;} +.mfp-arrow:before, +.mfp-arrow:after {content:'';display:block;width:0;height:0;position:absolute;left:0;top:0;margin-top:35px;margin-left:35px;border:medium inset transparent;} +.mfp-arrow:after {border-top-width:13px;border-bottom-width:13px;top:8px;} +.mfp-arrow:before {border-top-width:21px;border-bottom-width:21px;opacity:0.7;} +.mfp-arrow-left {left:0;} +.mfp-arrow-left:after {border-right:17px solid #FFF;margin-left:31px;} +.mfp-arrow-left:before {margin-left:25px;border-right:27px solid #3F3F3F;} +.mfp-arrow-right {right:0;} +.mfp-arrow-right:after {border-left:17px solid #FFF;margin-left:39px;} +.mfp-arrow-right:before {border-left:27px solid #3F3F3F;} +.mfp-iframe-holder {padding-top:40px;padding-bottom:40px;} +.mfp-iframe-holder .mfp-content {line-height:0;width:100%;max-width:1240px;height:100%;} /* Updated iframe dimensions for better editing */ +.mfp-iframe-holder .mfp-close {top:-40px;} +.mfp-iframe-scaler {width:100%;height:0;overflow:hidden;padding-top:56.25%;} +.mfp-iframe-scaler iframe {position:absolute;display:block;top:0;left:0;width:100%;height:100%;box-shadow:0 0 8px rgba(0, 0, 0, 0.6);background:#000;} + +/* Main image in popup */ +img.mfp-img {width:auto;max-width:100%;height:auto;display:block;line-height:0;box-sizing:border-box;padding:40px 0 40px;margin:0 auto;} + +/* The shadow behind the image */ +.mfp-figure {line-height:0;} +.mfp-figure:after {content:'';position:absolute;left:0;top:40px;bottom:40px;display:block;right:0;width:auto;height:auto;z-index:-1;box-shadow:0 0 8px rgba(0, 0, 0, 0.6);background:#444;} +.mfp-figure small {color:#BDBDBD;display:block;font-size:12px;line-height:14px;} +.mfp-figure figure {margin:0;} +.mfp-bottom-bar {margin-top:-36px;position:absolute;top:100%;left:0;width:100%;cursor:auto;} +.mfp-title {text-align:left;line-height:18px;color:#F3F3F3;word-wrap:break-word;padding-right:36px;} +.mfp-image-holder .mfp-content {max-width:100%;} +.mfp-gallery .mfp-image-holder .mfp-figure {cursor:pointer;} + +@media screen and (max-width:800px) and (orientation:landscape), screen and (max-height:300px) { + /** + * Remove all paddings around the image on small screen + */ + .mfp-img-mobile .mfp-image-holder {padding-left:0;padding-right:0;} + .mfp-img-mobile img.mfp-img {padding:0;} + .mfp-img-mobile .mfp-figure:after {top:0;bottom:0;} + .mfp-img-mobile .mfp-figure small {display:inline;margin-left:5px;} + .mfp-img-mobile .mfp-bottom-bar {background:rgba(0, 0, 0, 0.6);bottom:0;margin:0;top:auto;padding:3px 5px;position:fixed;box-sizing:border-box;} + .mfp-img-mobile .mfp-bottom-bar:empty {padding:0;} + .mfp-img-mobile .mfp-counter {right:5px;top:3px;} + .mfp-img-mobile .mfp-close {top:0;right:0;width:35px;height:35px;line-height:35px;background:rgba(0, 0, 0, 0.6);position:fixed;text-align:center;padding:0;} +} + +@media all and (max-width:900px) { + .mfp-arrow {-webkit-transform:scale(0.75);transform:scale(0.75);} + .mfp-arrow-left {-webkit-transform-origin:0;transform-origin:0;} + .mfp-arrow-right {-webkit-transform-origin:100%;transform-origin:100%;} + .mfp-container {padding-left:6px;padding-right:6px;} +} diff --git a/deployed/k2/media/k2/assets/css/select2.min.css b/deployed/k2/media/k2/assets/css/select2.min.css new file mode 100644 index 00000000..c3a0fe95 --- /dev/null +++ b/deployed/k2/media/k2/assets/css/select2.min.css @@ -0,0 +1 @@ +.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle;}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none;}.select2-container .select2-selection--single .select2-selection__rendered{display:block;overflow:hidden;padding-left:8px;padding-right:20px;text-overflow:ellipsis;}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px;}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none;}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;}.select2-container .select2-search--inline{float:left;}.select2-container .select2-search--inline .select2-search__field{border:none;font-size:100%;margin-top:5px;}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051;}.select2-results{display:block;}.select2-results__options{list-style:none;margin:0;padding:0;}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none;}.select2-results__option[aria-selected]{cursor:pointer;}.select2-container--open .select2-dropdown{left:0;}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0;}.select2-search--dropdown{display:block;padding:4px;}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box;}.select2-search--dropdown.select2-search--hide{display:none;}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0);}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px;}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px;}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999;}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px;}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0;}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left;}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto;}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default;}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none;}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px;}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;}.select2-container--default .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px;width:100%;}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left;}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px;}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px;}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px;}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333;}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder{float:right;}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto;}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto;}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default;}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none;}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0;}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0;}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa;}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto;}.select2-container--default .select2-results__option[role=group]{padding:0;}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999;}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd;}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em;}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white;}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px;}.select2-container--classic .select2-selection--single{background-color:#f6f6f6;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #ffffff 50%, #eeeeee 100%);background-image:-o-linear-gradient(top, #ffffff 50%, #eeeeee 100%);background-image:linear-gradient(to bottom, #ffffff 50%, #eeeeee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0);}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb;}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px;}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px;}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999;}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%);background-image:-o-linear-gradient(top, #eeeeee 50%, #cccccc 100%);background-image:linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#cccccc', GradientType=0);}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0;}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left;}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto;}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb;}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none;}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px;}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #ffffff 0%, #eeeeee 50%);background-image:-o-linear-gradient(top, #ffffff 0%, #eeeeee 50%);background-image:linear-gradient(to bottom, #ffffff 0%, #eeeeee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0);}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eeeeee 50%, #ffffff 100%);background-image:-o-linear-gradient(top, #eeeeee 50%, #ffffff 100%);background-image:linear-gradient(to bottom, #eeeeee 50%, #ffffff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0);}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0;}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb;}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px;}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none;}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px;}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px;}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555;}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right;}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto;}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto;}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb;}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0;}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0;}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;}.select2-container--classic .select2-dropdown{background-color:white;border:1px solid transparent;}.select2-container--classic .select2-dropdown--above{border-bottom:none;}.select2-container--classic .select2-dropdown--below{border-top:none;}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto;}.select2-container--classic .select2-results__option[role=group]{padding:0;}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey;}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:white;}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px;}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb;} \ No newline at end of file diff --git a/deployed/k2/media/k2/assets/css/theme.css b/deployed/k2/media/k2/assets/css/theme.css new file mode 100644 index 00000000..8d599fd7 --- /dev/null +++ b/deployed/k2/media/k2/assets/css/theme.css @@ -0,0 +1,63 @@ +.std42-dialog, .std42-dialog .ui-widget-content { background-color:#ededed; background-image:none; background-clip: content-box; } + +/* navbar */ +.elfinder-navbar .ui-state-hover { background:transparent; border-color:transparent; } +.elfinder-navbar .ui-state-active { border-color:#00afec; color:#fff; } +/* disabled elfinder */ +.elfinder-disabled .elfinder-navbar .ui-state-active { background: #dadada; border-color:#aaa; color:#fff; } + +/* current directory */ +/* selected file in "icons" view */ +.elfinder-cwd-view-icons .elfinder-cwd-file .ui-state-hover { background:#fff; } +/* list view*/ +.elfinder-cwd table tr:nth-child(odd), +.elfinder-cwd table tr:nth-child(2n+1) { background-color:#ededed; } +.elfinder-cwd table tr { border-top:1px solid #fff; } + +/* common selected background/color */ +.elfinder-cwd-view-icons .elfinder-cwd-file .elfinder-cwd-filename.ui-state-hover, +.elfinder-cwd table td.ui-state-hover, +.elfinder-button-menu .ui-state-hover { background: #3875d7; color:#fff;} +/* disabled elfinder */ +.elfinder-disabled .elfinder-cwd-view-icons .elfinder-cwd-file .elfinder-cwd-filename.ui-state-hover, +.elfinder-disabled .elfinder-cwd table td.ui-state-hover { background:#dadada;} + +/* statusbar */ +.elfinder .elfinder-statusbar { color:#555; } +.elfinder .elfinder-statusbar a { text-decoration:none; color:#555;} +.std42-dialog .elfinder-help, .std42-dialog .elfinder-help .ui-widget-content { background:#fff;} + +/* contextmenu */ +.elfinder-contextmenu .ui-state-hover { background: #00afec; color:#fff; } +.elfinder-contextmenu .ui-state-hover .elfinder-contextmenu-arrow { background-image:url('../images/elfinder/arrows-active.png'); } + +/* Overriding the jquery ui */ +.ui-widget-header { background:#fff; border-radius: 0; border-color: #dbdcdc; } +.ui-widget-content { border: 0; } + .ui-widget-content .elfinder-button-search .ui-icon { margin-top: -13px; } +.elfinder-cwd-view-icons .elfinder-cwd-file .elfinder-cwd-filename.ui-state-hover, .elfinder-cwd table td.ui-state-hover, +.elfinder-button-menu .ui-state-hover, .elfinder-navbar .ui-state-active { background: #00afec; } +.elfinder-contextmenu, .elfinder-contextmenu-sub { z-index: 9999; } +.elfinder-toolbar { padding: 10px; } + +/* reseting the backgrounds */ +.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { background: #fff; } +.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { background-image: none!important; } +.elfinder-cwd-file.ui-state-hover { background-color: #fff!important; } + +#sigPro .elfinder-cwd-filename input[type="text"] { max-width: 100%; height: 18px; line-height: 15px; } +#sigPro .elfinder-button-search input{border:1px solid #AAAAAA;border-radius:12px 12px 12px 12px;font-size:0.8em;height:22px;line-height:22px;outline:0 solid;padding:0 20px;width:160px;} +#sigPro .elfinder-button:hover { background-color: #00afec; } +#sigPro .elfinder-button.ui-state-disabled:hover { background-color: none; } +#sigPro .elfinder .elfinder-navbar { background:#e3e3e3; } +.isJVersion30 .elfinder-button-search .ui-icon { top: 39%; } +.ui-icon:hover, +.elfinder-button.elfinder-button-search:hover { background-color: transparent!important; cursor: pointer; } +/* dialog boxes */ +.ui-dialog {position: absolute; z-index: 10005; margin-top: 190px; } +.ui-dialog { margin-top: 110px; } +.elfinder-quicklook { margin-top: 75px; } + +.elfinder-statusbar { padding-top: 15px; padding-bottom: 15px; } +.ui-resizable-se { right: -3px; bottom: 1px; } +.elfinder-resize-control input[type=text] { width: auto; } diff --git a/deployed/k2/media/k2/assets/fonts/Simple-Line-Icons.eot b/deployed/k2/media/k2/assets/fonts/Simple-Line-Icons.eot new file mode 100644 index 00000000..533fd7f4 Binary files /dev/null and b/deployed/k2/media/k2/assets/fonts/Simple-Line-Icons.eot differ diff --git a/deployed/k2/media/k2/assets/fonts/Simple-Line-Icons.svg b/deployed/k2/media/k2/assets/fonts/Simple-Line-Icons.svg new file mode 100644 index 00000000..bed0f148 --- /dev/null +++ b/deployed/k2/media/k2/assets/fonts/Simple-Line-Icons.svg @@ -0,0 +1,211 @@ + + + + + + +{ + "fontFamily": "simple-line-icons", + "majorVersion": 2, + "minorVersion": 0, + "license": "MIT", + "designer": "Jamal Jama, Ahmad Firoz", + "version": "Version 2.0", + "fontId": "simple-line-icons", + "psName": "simple-line-icons", + "subFamily": "Regular", + "fullName": "simple-line-icons", + "description": "Font generated by IcoMoon." +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/deployed/k2/media/k2/assets/fonts/Simple-Line-Icons.ttf b/deployed/k2/media/k2/assets/fonts/Simple-Line-Icons.ttf new file mode 100644 index 00000000..ecf85a42 Binary files /dev/null and b/deployed/k2/media/k2/assets/fonts/Simple-Line-Icons.ttf differ diff --git a/deployed/k2/media/k2/assets/fonts/Simple-Line-Icons.woff b/deployed/k2/media/k2/assets/fonts/Simple-Line-Icons.woff new file mode 100644 index 00000000..b38250d4 Binary files /dev/null and b/deployed/k2/media/k2/assets/fonts/Simple-Line-Icons.woff differ diff --git a/deployed/k2/media/k2/assets/fonts/Simple-Line-Icons.woff2 b/deployed/k2/media/k2/assets/fonts/Simple-Line-Icons.woff2 new file mode 100644 index 00000000..ec9373a5 Binary files /dev/null and b/deployed/k2/media/k2/assets/fonts/Simple-Line-Icons.woff2 differ diff --git a/deployed/k2/media/k2/assets/images/backend/cross.png b/deployed/k2/media/k2/assets/images/backend/cross.png new file mode 100644 index 00000000..6b9fa6dd Binary files /dev/null and b/deployed/k2/media/k2/assets/images/backend/cross.png differ diff --git a/deployed/k2/media/k2/assets/images/backend/dashboard.png b/deployed/k2/media/k2/assets/images/backend/dashboard.png new file mode 100644 index 00000000..a43fd265 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/backend/dashboard.png differ diff --git a/deployed/k2/media/k2/assets/images/backend/k2_logo_126x48.png b/deployed/k2/media/k2/assets/images/backend/k2_logo_126x48.png new file mode 100644 index 00000000..647f4441 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/backend/k2_logo_126x48.png differ diff --git a/deployed/k2/media/k2/assets/images/backend/k2_logo_16x16.png b/deployed/k2/media/k2/assets/images/backend/k2_logo_16x16.png new file mode 100644 index 00000000..b010babc Binary files /dev/null and b/deployed/k2/media/k2/assets/images/backend/k2_logo_16x16.png differ diff --git a/deployed/k2/media/k2/assets/images/backend/loader.gif b/deployed/k2/media/k2/assets/images/backend/loader.gif new file mode 100644 index 00000000..1560b646 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/backend/loader.gif differ diff --git a/deployed/k2/media/k2/assets/images/backend/sprite.png b/deployed/k2/media/k2/assets/images/backend/sprite.png new file mode 100644 index 00000000..62345738 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/backend/sprite.png differ diff --git a/deployed/k2/media/k2/assets/images/backend/tick.png b/deployed/k2/media/k2/assets/images/backend/tick.png new file mode 100644 index 00000000..2414885b Binary files /dev/null and b/deployed/k2/media/k2/assets/images/backend/tick.png differ diff --git a/deployed/k2/media/k2/assets/images/dashboard/categories-trashed.png b/deployed/k2/media/k2/assets/images/dashboard/categories-trashed.png new file mode 100644 index 00000000..09f4168c Binary files /dev/null and b/deployed/k2/media/k2/assets/images/dashboard/categories-trashed.png differ diff --git a/deployed/k2/media/k2/assets/images/dashboard/categories.png b/deployed/k2/media/k2/assets/images/dashboard/categories.png new file mode 100644 index 00000000..b3505ee6 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/dashboard/categories.png differ diff --git a/deployed/k2/media/k2/assets/images/dashboard/comments.png b/deployed/k2/media/k2/assets/images/dashboard/comments.png new file mode 100644 index 00000000..9bd8818c Binary files /dev/null and b/deployed/k2/media/k2/assets/images/dashboard/comments.png differ diff --git a/deployed/k2/media/k2/assets/images/dashboard/documentation.png b/deployed/k2/media/k2/assets/images/dashboard/documentation.png new file mode 100644 index 00000000..98457915 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/dashboard/documentation.png differ diff --git a/deployed/k2/media/k2/assets/images/dashboard/extend.png b/deployed/k2/media/k2/assets/images/dashboard/extend.png new file mode 100644 index 00000000..d9e50ba1 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/dashboard/extend.png differ diff --git a/deployed/k2/media/k2/assets/images/dashboard/extra-field-groups.png b/deployed/k2/media/k2/assets/images/dashboard/extra-field-groups.png new file mode 100644 index 00000000..88b80f41 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/dashboard/extra-field-groups.png differ diff --git a/deployed/k2/media/k2/assets/images/dashboard/extra-fields.png b/deployed/k2/media/k2/assets/images/dashboard/extra-fields.png new file mode 100644 index 00000000..823eaeca Binary files /dev/null and b/deployed/k2/media/k2/assets/images/dashboard/extra-fields.png differ diff --git a/deployed/k2/media/k2/assets/images/dashboard/help.png b/deployed/k2/media/k2/assets/images/dashboard/help.png new file mode 100644 index 00000000..c2184aeb Binary files /dev/null and b/deployed/k2/media/k2/assets/images/dashboard/help.png differ diff --git a/deployed/k2/media/k2/assets/images/dashboard/image-editing.png b/deployed/k2/media/k2/assets/images/dashboard/image-editing.png new file mode 100644 index 00000000..90a0bd30 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/dashboard/image-editing.png differ diff --git a/deployed/k2/media/k2/assets/images/dashboard/item-new.png b/deployed/k2/media/k2/assets/images/dashboard/item-new.png new file mode 100644 index 00000000..09a9b42f Binary files /dev/null and b/deployed/k2/media/k2/assets/images/dashboard/item-new.png differ diff --git a/deployed/k2/media/k2/assets/images/dashboard/items-featured.png b/deployed/k2/media/k2/assets/images/dashboard/items-featured.png new file mode 100644 index 00000000..3cbfeb54 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/dashboard/items-featured.png differ diff --git a/deployed/k2/media/k2/assets/images/dashboard/items-trashed.png b/deployed/k2/media/k2/assets/images/dashboard/items-trashed.png new file mode 100644 index 00000000..3f3b6d81 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/dashboard/items-trashed.png differ diff --git a/deployed/k2/media/k2/assets/images/dashboard/items.png b/deployed/k2/media/k2/assets/images/dashboard/items.png new file mode 100644 index 00000000..3db75383 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/dashboard/items.png differ diff --git a/deployed/k2/media/k2/assets/images/dashboard/joomlareader.png b/deployed/k2/media/k2/assets/images/dashboard/joomlareader.png new file mode 100644 index 00000000..3a9a1c3e Binary files /dev/null and b/deployed/k2/media/k2/assets/images/dashboard/joomlareader.png differ diff --git a/deployed/k2/media/k2/assets/images/dashboard/mediamanager.png b/deployed/k2/media/k2/assets/images/dashboard/mediamanager.png new file mode 100644 index 00000000..fa1e3110 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/dashboard/mediamanager.png differ diff --git a/deployed/k2/media/k2/assets/images/dashboard/sprite-dashboard.png b/deployed/k2/media/k2/assets/images/dashboard/sprite-dashboard.png new file mode 100644 index 00000000..a43fd265 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/dashboard/sprite-dashboard.png differ diff --git a/deployed/k2/media/k2/assets/images/dashboard/tags.png b/deployed/k2/media/k2/assets/images/dashboard/tags.png new file mode 100644 index 00000000..ddb667aa Binary files /dev/null and b/deployed/k2/media/k2/assets/images/dashboard/tags.png differ diff --git a/deployed/k2/media/k2/assets/images/editforms/Attach.png b/deployed/k2/media/k2/assets/images/editforms/Attach.png new file mode 100644 index 00000000..1733420e Binary files /dev/null and b/deployed/k2/media/k2/assets/images/editforms/Attach.png differ diff --git a/deployed/k2/media/k2/assets/images/editforms/Database.png b/deployed/k2/media/k2/assets/images/editforms/Database.png new file mode 100644 index 00000000..82be893c Binary files /dev/null and b/deployed/k2/media/k2/assets/images/editforms/Database.png differ diff --git a/deployed/k2/media/k2/assets/images/editforms/Document.png b/deployed/k2/media/k2/assets/images/editforms/Document.png new file mode 100644 index 00000000..228f5f11 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/editforms/Document.png differ diff --git a/deployed/k2/media/k2/assets/images/editforms/Document2.png b/deployed/k2/media/k2/assets/images/editforms/Document2.png new file mode 100644 index 00000000..851e0ec7 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/editforms/Document2.png differ diff --git a/deployed/k2/media/k2/assets/images/editforms/Gear.png b/deployed/k2/media/k2/assets/images/editforms/Gear.png new file mode 100644 index 00000000..5da1b1ab Binary files /dev/null and b/deployed/k2/media/k2/assets/images/editforms/Gear.png differ diff --git a/deployed/k2/media/k2/assets/images/editforms/Info2.png b/deployed/k2/media/k2/assets/images/editforms/Info2.png new file mode 100644 index 00000000..041378ed Binary files /dev/null and b/deployed/k2/media/k2/assets/images/editforms/Info2.png differ diff --git a/deployed/k2/media/k2/assets/images/editforms/Movie.png b/deployed/k2/media/k2/assets/images/editforms/Movie.png new file mode 100644 index 00000000..207dafe0 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/editforms/Movie.png differ diff --git a/deployed/k2/media/k2/assets/images/editforms/Photo.png b/deployed/k2/media/k2/assets/images/editforms/Photo.png new file mode 100644 index 00000000..0b2c5043 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/editforms/Photo.png differ diff --git a/deployed/k2/media/k2/assets/images/editforms/Picture.png b/deployed/k2/media/k2/assets/images/editforms/Picture.png new file mode 100644 index 00000000..20c63cb9 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/editforms/Picture.png differ diff --git a/deployed/k2/media/k2/assets/images/editforms/Puzzle.png b/deployed/k2/media/k2/assets/images/editforms/Puzzle.png new file mode 100644 index 00000000..7b048b8d Binary files /dev/null and b/deployed/k2/media/k2/assets/images/editforms/Puzzle.png differ diff --git a/deployed/k2/media/k2/assets/images/editforms/Size-Horz.png b/deployed/k2/media/k2/assets/images/editforms/Size-Horz.png new file mode 100644 index 00000000..8626d475 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/editforms/Size-Horz.png differ diff --git a/deployed/k2/media/k2/assets/images/editforms/Tool.png b/deployed/k2/media/k2/assets/images/editforms/Tool.png new file mode 100644 index 00000000..b026f015 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/editforms/Tool.png differ diff --git a/deployed/k2/media/k2/assets/images/editforms/Tv.png b/deployed/k2/media/k2/assets/images/editforms/Tv.png new file mode 100644 index 00000000..b0ad1921 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/editforms/Tv.png differ diff --git a/deployed/k2/media/k2/assets/images/editforms/Video.png b/deployed/k2/media/k2/assets/images/editforms/Video.png new file mode 100644 index 00000000..b51de6a8 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/editforms/Video.png differ diff --git a/deployed/k2/media/k2/assets/images/editforms/Write.png b/deployed/k2/media/k2/assets/images/editforms/Write.png new file mode 100644 index 00000000..19317807 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/editforms/Write.png differ diff --git a/deployed/k2/media/k2/assets/images/editforms/Write2.png b/deployed/k2/media/k2/assets/images/editforms/Write2.png new file mode 100644 index 00000000..b2df41f5 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/editforms/Write2.png differ diff --git a/deployed/k2/media/k2/assets/images/editforms/Write3.png b/deployed/k2/media/k2/assets/images/editforms/Write3.png new file mode 100644 index 00000000..4277ba44 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/editforms/Write3.png differ diff --git a/deployed/k2/media/k2/assets/images/elfinder/arrows-active.png b/deployed/k2/media/k2/assets/images/elfinder/arrows-active.png new file mode 100644 index 00000000..2ad71094 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/elfinder/arrows-active.png differ diff --git a/deployed/k2/media/k2/assets/images/elfinder/arrows-normal.png b/deployed/k2/media/k2/assets/images/elfinder/arrows-normal.png new file mode 100644 index 00000000..9d8b4d2a Binary files /dev/null and b/deployed/k2/media/k2/assets/images/elfinder/arrows-normal.png differ diff --git a/deployed/k2/media/k2/assets/images/elfinder/crop.gif b/deployed/k2/media/k2/assets/images/elfinder/crop.gif new file mode 100644 index 00000000..72ea7ccb Binary files /dev/null and b/deployed/k2/media/k2/assets/images/elfinder/crop.gif differ diff --git a/deployed/k2/media/k2/assets/images/elfinder/dialogs.png b/deployed/k2/media/k2/assets/images/elfinder/dialogs.png new file mode 100644 index 00000000..20de3574 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/elfinder/dialogs.png differ diff --git a/deployed/k2/media/k2/assets/images/elfinder/icons-big.png b/deployed/k2/media/k2/assets/images/elfinder/icons-big.png new file mode 100644 index 00000000..d4950a53 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/elfinder/icons-big.png differ diff --git a/deployed/k2/media/k2/assets/images/elfinder/icons-small.png b/deployed/k2/media/k2/assets/images/elfinder/icons-small.png new file mode 100644 index 00000000..95849dce Binary files /dev/null and b/deployed/k2/media/k2/assets/images/elfinder/icons-small.png differ diff --git a/deployed/k2/media/k2/assets/images/elfinder/logo.png b/deployed/k2/media/k2/assets/images/elfinder/logo.png new file mode 100644 index 00000000..c1036de6 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/elfinder/logo.png differ diff --git a/deployed/k2/media/k2/assets/images/elfinder/progress.gif b/deployed/k2/media/k2/assets/images/elfinder/progress.gif new file mode 100644 index 00000000..8bab11e3 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/elfinder/progress.gif differ diff --git a/deployed/k2/media/k2/assets/images/elfinder/quicklook-bg.png b/deployed/k2/media/k2/assets/images/elfinder/quicklook-bg.png new file mode 100644 index 00000000..aedeadd6 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/elfinder/quicklook-bg.png differ diff --git a/deployed/k2/media/k2/assets/images/elfinder/quicklook-icons.png b/deployed/k2/media/k2/assets/images/elfinder/quicklook-icons.png new file mode 100644 index 00000000..76df30c9 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/elfinder/quicklook-icons.png differ diff --git a/deployed/k2/media/k2/assets/images/elfinder/resize.png b/deployed/k2/media/k2/assets/images/elfinder/resize.png new file mode 100644 index 00000000..6ec17cd3 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/elfinder/resize.png differ diff --git a/deployed/k2/media/k2/assets/images/elfinder/spinner-mini.gif b/deployed/k2/media/k2/assets/images/elfinder/spinner-mini.gif new file mode 100644 index 00000000..5b33f7e5 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/elfinder/spinner-mini.gif differ diff --git a/deployed/k2/media/k2/assets/images/elfinder/toolbar.png b/deployed/k2/media/k2/assets/images/elfinder/toolbar.png new file mode 100644 index 00000000..3a09bd3c Binary files /dev/null and b/deployed/k2/media/k2/assets/images/elfinder/toolbar.png differ diff --git a/deployed/k2/media/k2/assets/images/ie6nomore/ie6nomore-chrome.jpg b/deployed/k2/media/k2/assets/images/ie6nomore/ie6nomore-chrome.jpg new file mode 100644 index 00000000..ca537000 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/ie6nomore/ie6nomore-chrome.jpg differ diff --git a/deployed/k2/media/k2/assets/images/ie6nomore/ie6nomore-cornerx.jpg b/deployed/k2/media/k2/assets/images/ie6nomore/ie6nomore-cornerx.jpg new file mode 100644 index 00000000..7d5f3803 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/ie6nomore/ie6nomore-cornerx.jpg differ diff --git a/deployed/k2/media/k2/assets/images/ie6nomore/ie6nomore-firefox.jpg b/deployed/k2/media/k2/assets/images/ie6nomore/ie6nomore-firefox.jpg new file mode 100644 index 00000000..4a969f82 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/ie6nomore/ie6nomore-firefox.jpg differ diff --git a/deployed/k2/media/k2/assets/images/ie6nomore/ie6nomore-ie8.jpg b/deployed/k2/media/k2/assets/images/ie6nomore/ie6nomore-ie8.jpg new file mode 100644 index 00000000..d165765c Binary files /dev/null and b/deployed/k2/media/k2/assets/images/ie6nomore/ie6nomore-ie8.jpg differ diff --git a/deployed/k2/media/k2/assets/images/ie6nomore/ie6nomore-safari.jpg b/deployed/k2/media/k2/assets/images/ie6nomore/ie6nomore-safari.jpg new file mode 100644 index 00000000..a70e0fd5 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/ie6nomore/ie6nomore-safari.jpg differ diff --git a/deployed/k2/media/k2/assets/images/ie6nomore/ie6nomore-warning.jpg b/deployed/k2/media/k2/assets/images/ie6nomore/ie6nomore-warning.jpg new file mode 100644 index 00000000..695b23cd Binary files /dev/null and b/deployed/k2/media/k2/assets/images/ie6nomore/ie6nomore-warning.jpg differ diff --git a/deployed/k2/media/k2/assets/images/system/K2_Logo_105x40_24.png b/deployed/k2/media/k2/assets/images/system/K2_Logo_105x40_24.png new file mode 100644 index 00000000..eda5689f Binary files /dev/null and b/deployed/k2/media/k2/assets/images/system/K2_Logo_105x40_24.png differ diff --git a/deployed/k2/media/k2/assets/images/system/K2_Logo_126x48_24.png b/deployed/k2/media/k2/assets/images/system/K2_Logo_126x48_24.png new file mode 100644 index 00000000..647f4441 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/system/K2_Logo_126x48_24.png differ diff --git a/deployed/k2/media/k2/assets/images/system/K2_Logo_85x36_24.png b/deployed/k2/media/k2/assets/images/system/K2_Logo_85x36_24.png new file mode 100644 index 00000000..68eb43f6 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/system/K2_Logo_85x36_24.png differ diff --git a/deployed/k2/media/k2/assets/images/system/boxTopBackground.jpg b/deployed/k2/media/k2/assets/images/system/boxTopBackground.jpg new file mode 100644 index 00000000..954d79a6 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/system/boxTopBackground.jpg differ diff --git a/deployed/k2/media/k2/assets/images/system/boxTopBackground.png b/deployed/k2/media/k2/assets/images/system/boxTopBackground.png new file mode 100644 index 00000000..99c45cef Binary files /dev/null and b/deployed/k2/media/k2/assets/images/system/boxTopBackground.png differ diff --git a/deployed/k2/media/k2/assets/images/system/cross.png b/deployed/k2/media/k2/assets/images/system/cross.png new file mode 100644 index 00000000..6b9fa6dd Binary files /dev/null and b/deployed/k2/media/k2/assets/images/system/cross.png differ diff --git a/deployed/k2/media/k2/assets/images/system/folder.png b/deployed/k2/media/k2/assets/images/system/folder.png new file mode 100644 index 00000000..942e9b61 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/system/folder.png differ diff --git a/deployed/k2/media/k2/assets/images/system/go-up.png b/deployed/k2/media/k2/assets/images/system/go-up.png new file mode 100644 index 00000000..61dff461 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/system/go-up.png differ diff --git a/deployed/k2/media/k2/assets/images/system/k2.gif b/deployed/k2/media/k2/assets/images/system/k2.gif new file mode 100644 index 00000000..d1202cd2 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/system/k2.gif differ diff --git a/deployed/k2/media/k2/assets/images/system/k2_16x16.png b/deployed/k2/media/k2/assets/images/system/k2_16x16.png new file mode 100644 index 00000000..b010babc Binary files /dev/null and b/deployed/k2/media/k2/assets/images/system/k2_16x16.png differ diff --git a/deployed/k2/media/k2/assets/images/system/loader.gif b/deployed/k2/media/k2/assets/images/system/loader.gif new file mode 100644 index 00000000..1560b646 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/system/loader.gif differ diff --git a/deployed/k2/media/k2/assets/images/system/nicEditorIcons.gif b/deployed/k2/media/k2/assets/images/system/nicEditorIcons.gif new file mode 100644 index 00000000..5cf1ebed Binary files /dev/null and b/deployed/k2/media/k2/assets/images/system/nicEditorIcons.gif differ diff --git a/deployed/k2/media/k2/assets/images/system/question-frame.png b/deployed/k2/media/k2/assets/images/system/question-frame.png new file mode 100644 index 00000000..be528147 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/system/question-frame.png differ diff --git a/deployed/k2/media/k2/assets/images/system/remove.png b/deployed/k2/media/k2/assets/images/system/remove.png new file mode 100644 index 00000000..29c3a04e Binary files /dev/null and b/deployed/k2/media/k2/assets/images/system/remove.png differ diff --git a/deployed/k2/media/k2/assets/images/system/sprite-backend.png b/deployed/k2/media/k2/assets/images/system/sprite-backend.png new file mode 100644 index 00000000..62345738 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/system/sprite-backend.png differ diff --git a/deployed/k2/media/k2/assets/images/system/sprite-dashboard.png b/deployed/k2/media/k2/assets/images/system/sprite-dashboard.png new file mode 100644 index 00000000..db05d132 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/system/sprite-dashboard.png differ diff --git a/deployed/k2/media/k2/assets/images/system/tick.png b/deployed/k2/media/k2/assets/images/system/tick.png new file mode 100644 index 00000000..2414885b Binary files /dev/null and b/deployed/k2/media/k2/assets/images/system/tick.png differ diff --git a/deployed/k2/media/k2/assets/images/system/ui-icons_222222_256x240.png b/deployed/k2/media/k2/assets/images/system/ui-icons_222222_256x240.png new file mode 100644 index 00000000..b273ff11 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/system/ui-icons_222222_256x240.png differ diff --git a/deployed/k2/media/k2/assets/images/system/ui-icons_228ef1_256x240.png b/deployed/k2/media/k2/assets/images/system/ui-icons_228ef1_256x240.png new file mode 100644 index 00000000..c357355a Binary files /dev/null and b/deployed/k2/media/k2/assets/images/system/ui-icons_228ef1_256x240.png differ diff --git a/deployed/k2/media/k2/assets/images/system/video.png b/deployed/k2/media/k2/assets/images/system/video.png new file mode 100644 index 00000000..528ae28b Binary files /dev/null and b/deployed/k2/media/k2/assets/images/system/video.png differ diff --git a/deployed/k2/media/k2/assets/images/system/warning.png b/deployed/k2/media/k2/assets/images/system/warning.png new file mode 100644 index 00000000..2ed9a048 Binary files /dev/null and b/deployed/k2/media/k2/assets/images/system/warning.png differ diff --git a/deployed/k2/media/k2/assets/js/elfinder.min.js b/deployed/k2/media/k2/assets/js/elfinder.min.js new file mode 100644 index 00000000..73400326 --- /dev/null +++ b/deployed/k2/media/k2/assets/js/elfinder.min.js @@ -0,0 +1,25 @@ +/*! + * elFinder - file manager for web + * Version 2.0 rc1 (2012-04-10) + * http://elfinder.org + * + * Copyright 2009-2012, Studio 42 + * Licensed under a 3 clauses BSD license + */ +(function(a){window.elFinder=function(b,c){this.time("load");var d=this,b=a(b),e=a("
        ").append(b.contents()),f=b.attr("style"),g=b.attr("id")||"",h="elfinder-"+(g||Math.random().toString().substr(2,7)),i="mousedown."+h,j="keydown."+h,k="keypress."+h,l=!0,m=!0,n=["enable","disable","load","open","reload","select","add","remove","change","dblclick","getfile","lockfiles","unlockfiles","dragstart","dragstop"],o={},p="",q={path:"",url:"",tmbUrl:"",disabled:[],separator:"/",archives:[],extract:[],copyOverwrite:!0,tmb:!1},r={},s=[],t={},u={},v=[],w=[],x=[],y=new d.command(d),z="auto",A=400,B=a(document.createElement("audio")).hide().appendTo("body")[0],C,D=function(b){if(b.init)r={};else for(var c in r)r.hasOwnProperty(c)&&r[c].mime!="directory"&&r[c].phash==p&&a.inArray(c,w)===-1&&delete r[c];p=b.cwd.hash,E(b.files),r[p]||E([b.cwd]),d.lastDir(p)},E=function(a){var b=a.length,c;while(b--)c=a[b],c.name&&c.hash&&c.mime&&(r[c.hash]=c)},F=function(b){var c=b.keyCode,e=!!b.ctrlKey||!!b.metaKey;l&&(a.each(u,function(a,f){f.type==b.type&&f.keyCode==c&&f.shiftKey==b.shiftKey&&f.ctrlKey==e&&f.altKey==b.altKey&&(b.preventDefault(),b.stopPropagation(),f.callback(b,d),d.debug("shortcut-exec",a+" : "+f.description))}),c==9&&b.preventDefault())},G=new Date,H,I;this.api=null,this.newAPI=!1,this.oldAPI=!1,this.OS=navigator.userAgent.indexOf("Mac")!==-1?"mac":navigator.userAgent.indexOf("Win")!==-1?"win":"other",this.options=a.extend(!0,{},this._options,c||{}),c.ui&&(this.options.ui=c.ui),c.commands&&(this.options.commands=c.commands),c.uiOptions&&c.uiOptions.toolbar&&(this.options.uiOptions.toolbar=c.uiOptions.toolbar),a.extend(this.options.contextmenu,c.contextmenu),this.requestType=/^(get|post)$/i.test(this.options.requestType)?this.options.requestType.toLowerCase():"get",this.customData=a.isPlainObject(this.options.customData)?this.options.customData:{},this.id=g,this.uploadURL=c.urlUpload||c.url,this.namespace=h,this.lang=this.i18[this.options.lang]&&this.i18[this.options.lang].messages?this.options.lang:"en",I=this.lang=="en"?this.i18.en:a.extend(!0,{},this.i18.en,this.i18[this.lang]),this.direction=I.direction,this.messages=I.messages,this.dateFormat=this.options.dateFormat||I.dateFormat,this.fancyFormat=this.options.fancyDateFormat||I.fancyDateFormat,this.today=(new Date(G.getFullYear(),G.getMonth(),G.getDate())).getTime()/1e3,this.yesterday=this.today-86400,H=this.options.UTCDate?"UTC":"",this.getHours="get"+H+"Hours",this.getMinutes="get"+H+"Minutes",this.getSeconds="get"+H+"Seconds",this.getDate="get"+H+"Date",this.getDay="get"+H+"Day",this.getMonth="get"+H+"Month",this.getFullYear="get"+H+"FullYear",this.cssClass="ui-helper-reset ui-helper-clearfix ui-widget ui-widget-content ui-corner-all elfinder elfinder-"+(this.direction=="rtl"?"rtl":"ltr")+" "+this.options.cssClass,this.storage=function(){try{return"localStorage"in window&&window.localStorage!==null?d.localStorage:d.cookie}catch(a){return d.cookie}}(),this.notifyDelay=this.options.notifyDelay>0?parseInt(this.options.notifyDelay):500,this.draggable={appendTo:"body",addClasses:!0,delay:30,revert:!0,refreshPositions:!0,cursor:"move",cursorAt:{left:50,top:47},drag:function(a,b){b.helper.toggleClass("elfinder-drag-helper-plus",a.shiftKey||a.ctrlKey||a.metaKey)},stop:function(){d.trigger("focus").trigger("dragstop")},helper:function(b,c){var e=this.id?a(this):a(this).parents("[id]:first"),f=a('
        '),g=function(a){return'
        '},h,i;return d.trigger("dragstart",{target:e[0],originalEvent:b}),h=e.is("."+d.res("class","cwdfile"))?d.selected():[d.navId2Hash(e.attr("id"))],f.append(g(r[h[0]].mime)).data("files",h),(i=h.length)>1&&f.append(g(r[h[i-1]].mime)+''+i+""),f}},this.droppable={tolerance:"pointer",accept:".elfinder-cwd-file-wrapper,.elfinder-navbar-dir,.elfinder-cwd-file",hoverClass:this.res("class","adroppable"),drop:function(b,c){var e=a(this),f=a.map(c.helper.data("files")||[],function(a){return a||null}),g=[],h="class",i,j,k,l;e.is("."+d.res(h,"cwd"))?j=p:e.is("."+d.res(h,"cwdfile"))?j=e.attr("id"):e.is("."+d.res(h,"navdir"))&&(j=d.navId2Hash(e.attr("id"))),i=f.length;while(i--)l=f[i],l!=j&&r[l].phash!=j&&g.push(l);g.length&&(c.helper.hide(),d.clipboard(g,!(b.ctrlKey||b.shiftKey||b.metaKey)),d.exec("paste",j).always(function(){d.clipboard([])}),d.trigger("drop",{files:f}))}},this.enabled=function(){return b.is(":visible")&&l},this.visible=function(){return b.is(":visible")},this.root=function(a){var b=r[a||p],c;while(b&&b.phash)b=r[b.phash];if(b)return b.hash;while(c in r&&r.hasOwnProperty(c)){b=r[c];if(!b.phash&&!b.mime=="directory"&&b.read)return b.hash}return""},this.cwd=function(){return r[p]||{}},this.option=function(a){return q[a]||""},this.file=function(a){return r[a]},this.files=function(){return a.extend(!0,{},r)},this.parents=function(a){var b=[],c;while(c=this.file(a))b.unshift(c.hash),a=c.phash;return b},this.path2array=function(a){var b,c=[];while(a&&(b=r[a])&&b.hash)c.unshift(b.name),a=b.phash;return c},this.path=function(a){return r[a]&&r[a].path?r[a].path:this.path2array(a).join(q.separator)},this.url=function(b){var c=r[b];if(!c||!c.read)return"";if(c.url)return c.url;if(q.url)return q.url+a.map(this.path2array(b),function(a){return encodeURIComponent(a)}).slice(1).join("/");var d=a.extend({},this.customData,{cmd:"file",target:c.hash});return this.oldAPI&&(d.cmd="open",d.current=c.phash),this.options.url+(this.options.url.indexOf("?")===-1?"?":"&")+a.param(d,!0)},this.tmb=function(b){var c=r[b],d=c&&c.tmb&&c.tmb!=1?q.tmbUrl+c.tmb:"";return d&&(a.browser.opera||a.browser.msie)&&(d+="?_="+(new Date).getTime()),d},this.selected=function(){return s.slice(0)},this.selectedFiles=function(){return a.map(s,function(a){return r[a]||null})},this.fileByName=function(a,b){var c;for(c in r)if(r.hasOwnProperty(c)&&r[c].phash==b&&r[c].name==a)return r[c]},this.validResponse=function(a,b){return b.error||this.rules[this.rules[a]?a:"defaults"](b)},this.request=function(b){var c=this,d=this.options,e=a.Deferred(),f=a.extend({},d.customData,{mimes:d.onlyMimes},b.data||b),g=f.cmd,h=!b.preventDefault&&!b.preventFail,i=!b.preventDefault&&!b.preventDone,j=a.extend({},b.notify),k=!!b.raw,l=b.syncOnFail,m,b=a.extend({url:d.url,async:!0,type:this.requestType,dataType:"json",cache:!1,data:f},b.options||{}),n=function(b){b.warning&&c.error(b.warning),g=="open"&&D(a.extend(!0,{},b)),b.removed&&b.removed.length&&c.remove(b),b.added&&b.added.length&&c.add(b),b.changed&&b.changed.length&&c.change(b),c.trigger(g,b),b.sync&&c.sync()},o=function(a,b){var c;switch(b){case"abort":c=a.quiet?"":["errConnect","errAbort"];break;case"timeout":c=["errConnect","errTimeout"];break;case"parsererror":c=["errResponse","errDataNotJSON"];break;default:a.status==403?c=["errConnect","errAccess"]:a.status==404?c=["errConnect","errNotFound"]:c="errConnect"}e.reject(c,a,b)},p=function(b){if(k)return e.resolve(b);if(!b)return e.reject(["errResponse","errDataEmpty"],r);if(!a.isPlainObject(b))return e.reject(["errResponse","errDataNotJSON"],r);if(b.error)return e.reject(b.error,r);if(!c.validResponse(g,b))return e.reject("errResponse",r);b=c.normalize(b),c.api||(c.api=b.api||1,c.newAPI=c.api>=2,c.oldAPI=!c.newAPI),b.options&&(q=a.extend({},q,b.options)),e.resolve(b),b.debug&&c.debug("backend-debug",b.debug)},r,s;i&&e.done(n),e.fail(function(a){a&&(h?c.error(a):c.debug("error",c.i18n(a)))});if(!g)return e.reject("errCmdReq");l&&e.fail(function(a){a&&c.sync()}),j.type&&j.cnt&&(m=setTimeout(function(){c.notify(j),e.always(function(){j.cnt=-(parseInt(j.cnt)||0),c.notify(j)})},c.notifyDelay),e.always(function(){clearTimeout(m)}));if(g=="open")while(s=x.pop())!s.state() == 'rejected'&&!s.isResolved()&&(s.quiet=!0,s.abort());return delete b.preventFail,r=this.transport.send(b).fail(o).done(p),g=="open"&&(x.unshift(r),e.always(function(){var b=a.inArray(r,x);b!==-1&&x.splice(b,1)})),e},this.diff=function(b){var c={},d=[],e=[],f=[],g=function(a){var b=f.length;while(b--)if(f[b].hash==a)return!0};return a.each(b,function(a,b){c[b.hash]=b}),a.each(r,function(a,b){!c[a]&& +e.push(a)}),a.each(c,function(b,c){var e=r[b];e?a.each(c,function(a){if(c[a]!=e[a])return f.push(c),!1}):d.push(c)}),a.each(e,function(b,d){var h=r[d],i=h.phash;i&&h.mime=="directory"&&a.inArray(i,e)===-1&&c[i]&&!g(i)&&f.push(c[i])}),{added:d,removed:e,changed:f}},this.sync=function(){var b=this,c=a.Deferred().done(function(){b.trigger("sync")}),d={data:{cmd:"open",init:1,target:p,tree:this.ui.tree?1:0},preventDefault:!0},e={data:{cmd:"parents",target:p},preventDefault:!0};return a.when(this.request(d),this.request(e)).fail(function(a){c.reject(a),a&&b.request({data:{cmd:"open",target:b.lastDir(""),tree:1,init:1},notify:{type:"open",cnt:1,hideCnt:!0}})}).done(function(a,d){var e=b.diff(a.files.concat(d&&d.tree?d.tree:[]));return e.removed.length&&b.remove(e),e.added.length&&b.add(e),e.changed.length&&b.change(e),c.resolve(e)}),c},this.upload=function(a){return this.transport.upload(a,this)},this.bind=function(a,b){var c;if(typeof b=="function"){a=(""+a).toLowerCase().split(/\s+/);for(c=0;c-1&&c.splice(d,1),b=null,this},this.trigger=function(b,c){var b=b.toLowerCase(),d=t[b]||[],e,f;this.debug("event-"+b,c);if(d.length){b=a.Event(b);for(e=0;e0?e:e.charCodeAt(0):a.ui.keyCode[e],e&&!u[d]&&(u[d]={keyCode:e,altKey:a.inArray("ALT",g)!=-1,ctrlKey:a.inArray("CTRL",g)!=-1,shiftKey:a.inArray("SHIFT",g)!=-1,type:b.type||"keydown",callback:b.callback,description:b.description,pattern:d})}return this},this.shortcuts=function(){var b=[];return a.each(u,function(a,c){b.push([c.pattern,d.i18n(c.description)])}),b},this.clipboard=function(b,c){var d=function(){return a.map(v,function(a){return a.hash})};return b!==void 0&&(v.length&&this.trigger("unlockfiles",{files:d()}),w=[],v=a.map(b||[],function(a){var b=r[a];return b?(w.push(a),{hash:a,phash:b.phash,name:b.name,mime:b.mime,read:b.read,locked:b.locked,cut:!!c}):null}),this.trigger("changeclipboard",{clipboard:v.slice(0,v.length)}),c&&this.trigger("lockfiles",{files:d()})),v.slice(0,v.length)},this.isCommandEnabled=function(b){return this._commands[b]?a.inArray(b,q.disabled)===-1:!1},this.exec=function(b,c,d){return this._commands[b]&&this.isCommandEnabled(b)?this._commands[b].exec(c,d):a.Deferred().reject("No such command")},this.dialog=function(c,d){return a("
        ").append(c).appendTo(b).elfinderdialog(d)},this.getUI=function(a){return this.ui[a]||b},this.command=function(a){return a===void 0?this._commands:this._commands[a]},this.resize=function(a,c){b.css("width",a).height(c).trigger("resize"),this.trigger("resize",{width:b.width(),height:b.height()})},this.restoreSize=function(){this.resize(z,A)},this.show=function(){b.show(),this.enable().trigger("show")},this.hide=function(){this.disable().trigger("hide"),b.hide()},this.destroy=function(){b&&b[0].elfinder&&(this.trigger("destroy").disable(),t={},u={},a(document).add(b).unbind("."+this.namespace),d.trigger=function(){},b.children().remove(),b.append(e.contents()).removeClass(this.cssClass).attr("style",f),b[0].elfinder=null,C&&clearInterval(C))},this.setSort(this.options.sort,this.options.sortDirect);if(!(a.fn.selectable&&a.fn.draggable&&a.fn.droppable))return alert(this.i18n("errJqui"));if(!b.length)return alert(this.i18n("errNode"));if(!this.options.url)return alert(this.i18n("errURL"));a.extend(a.ui.keyCode,{F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120}),this.dragUpload=!1,this.xhrUpload=typeof XMLHttpRequestUpload!="undefined"&&typeof File!="undefined"&&typeof FormData!="undefined",this.transport={},typeof this.options.transport=="object"&&(this.transport=this.options.transport,typeof this.transport.init=="function"&&this.transport.init(this)),typeof this.transport.send!="function"&&(this.transport.send=function(b){return a.ajax(b)}),this.transport.upload=="iframe"?this.transport.upload=a.proxy(this.uploads.iframe,this):typeof this.transport.upload=="function"?this.dragUpload=!!this.options.dragUploadAllow:this.xhrUpload?(this.transport.upload=a.proxy(this.uploads.xhr,this),this.dragUpload=!0):this.transport.upload=a.proxy(this.uploads.iframe,this),this.error=function(){var a=arguments[0];return arguments.length==1&&typeof a=="function"?d.bind("error",a):d.trigger("error",{error:a})},a.each(["enable","disable","load","open","reload","select","add","remove","change","dblclick","getfile","lockfiles","unlockfiles","dragstart","dragstop","search","searchend","viewchange"],function(b,c){d[c]=function(){var b=arguments[0];return arguments.length==1&&typeof b=="function"?d.bind(c,b):d.trigger(c,a.isPlainObject(b)?b:{})}}),this.enable(function(){!l&&d.visible()&&d.ui.overlay.is(":hidden")&&(l=!0,a("texarea:focus,input:focus,button").blur(),b.removeClass("elfinder-disabled"))}).disable(function(){m=l,l=!1,b.addClass("elfinder-disabled")}).open(function(){s=[]}).select(function(b){s=a.map(b.data.selected||b.data.value||[],function(a){return r[a]?a:null})}).error(function(b){var c={cssClass:"elfinder-dialog-error",title:d.i18n(d.i18n("error")),resizable:!1,destroyOnClose:!0,buttons:{}};c.buttons[d.i18n(d.i18n("btnClose"))]=function(){a(this).elfinderdialog("close")},d.dialog(''+d.i18n(b.data.error),c)}).bind("tree parents",function(a){E(a.data.tree||[])}).bind("tmb",function(b){a.each(b.data.images||[],function(a,b){r[a]&&(r[a].tmb=b)})}).add(function(a){E(a.data.added||[])}).change(function(b){a.each(b.data.changed||[],function(b,c){var d=c.hash;r[d]=r[d]?a.extend(r[d],c):c})}).remove(function(b){var c=b.data.removed||[],d=c.length,e=function(b){var c=r[b];c&&(c.mime=="directory"&&c.dirs&&a.each(r,function(a,c){c.phash==b&&e(a)}),delete r[b])};while(d--)e(c[d])}).bind("search",function(a){E(a.data.files)}).bind("rm",function(b){var c=B.canPlayType&&B.canPlayType('audio/wav; codecs="1"');c&&c!=""&&c!="no"&&a(B).html('')[0].play()}),a.each(this.options.handlers,function(a,b){d.bind(a,b)}),this.history=new this.history(this),typeof this.options.getFileCallback=="function"&&this.commands.getfile&&(this.bind("dblclick",function(a){a.preventDefault(),d.exec("getfile").fail(function(){d.exec("open")})}),this.shortcut({pattern:"enter",description:this.i18n("cmdgetfile"),callback:function(){d.exec("getfile").fail(function(){d.exec(d.OS=="mac"?"rename":"open")})}}).shortcut({pattern:"ctrl+enter",description:this.i18n(this.OS=="mac"?"cmdrename":"cmdopen"),callback:function(){d.exec(d.OS=="mac"?"rename":"open")}})),this._commands={},a.isArray(this.options.commands)||(this.options.commands=[]),a.each(["open","reload","back","forward","up","home","info","quicklook","getfile","help"],function(b,c){a.inArray(c,d.options.commands)===-1&&d.options.commands.push(c)}),a.each(this.options.commands,function(b,c){var e=d.commands[c];a.isFunction(e)&&!d._commands[c]&&(e.prototype=y,d._commands[c]=new e,d._commands[c].setup(c,d.options.commandsOptions[c]||{}))}),b.addClass(this.cssClass).bind(i,function(){!l&&d.enable()}),this.ui={workzone:a("
        ").appendTo(b).elfinderworkzone(this),navbar:a("
        ").appendTo(b).elfindernavbar(this,this.options.uiOptions.navbar||{}),contextmenu:a("
        ").appendTo(b).elfindercontextmenu(this),overlay:a("
        ").appendTo(b).elfinderoverlay({show:function(){d.disable()},hide:function(){m&&d.enable()}}),cwd:a("
        ").appendTo(b).elfindercwd(this),notify:this.dialog("",{cssClass:"elfinder-dialog-notify",position:{top:"12px",right:"12px"},resizable:!1,autoOpen:!1,title:" ",width:280}),statusbar:a('
        ').hide().appendTo(b)},a.each(this.options.ui|| +[],function(c,e){var f="elfinder"+e,g=d.options.uiOptions[e]||{};!d.ui[e]&&a.fn[f]&&(d.ui[e]=a("<"+(g.tag||"div")+"/>").appendTo(b)[f](d,g))}),b[0].elfinder=this,this.options.resizable&&a.fn.resizable&&b.resizable({handles:"se",minWidth:300,minHeight:200}),this.options.width&&(z=this.options.width),this.options.height&&(A=parseInt(this.options.height)),d.resize(z,A),a(document).bind("click."+this.namespace,function(c){l&&!a(c.target).closest(b).length&&d.disable()}).bind(j+" "+k,F),this.trigger("init").request({data:{cmd:"open",target:d.lastDir(),init:1,tree:this.ui.tree?1:0},preventDone:!0,notify:{type:"open",cnt:1,hideCnt:!0},freeze:!0}).fail(function(){d.trigger("fail").disable().lastDir(""),t={},u={},a(document).add(b).unbind("."+this.namespace),d.trigger=function(){}}).done(function(b){d.load().debug("api",d.api),b=a.extend(!0,{},b),D(b),d.trigger("open",b)}),this.one("load",function(){b.trigger("resize"),d.options.sync>1e3&&(C=setInterval(function(){d.sync()},d.options.sync))})},elFinder.prototype={res:function(a,b){return this.resources[a]&&this.resources[a][b]},i18:{en:{translator:"",language:"English",direction:"ltr",dateFormat:"d.m.Y H:i",fancyDateFormat:"$1 H:i",messages:{}},months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},kinds:{unknown:"Unknown",directory:"Folder",symlink:"Alias","symlink-broken":"AliasBroken","application/x-empty":"TextPlain","application/postscript":"Postscript","application/vnd.ms-office":"MsOffice","application/vnd.ms-word":"MsWord","application/vnd.ms-excel":"MsExcel","application/vnd.ms-powerpoint":"MsPP","application/pdf":"PDF","application/xml":"XML","application/vnd.oasis.opendocument.text":"OO","application/x-shockwave-flash":"AppFlash","application/flash-video":"Flash video","application/x-bittorrent":"Torrent","application/javascript":"JS","application/rtf":"RTF","application/rtfd":"RTF","application/x-font-ttf":"TTF","application/x-font-otf":"OTF","application/x-rpm":"RPM","application/x-web-config":"TextPlain","application/xhtml+xml":"HTML","application/docbook+xml":"DOCBOOK","application/x-awk":"AWK","application/x-gzip":"GZIP","application/x-bzip2":"BZIP","application/zip":"ZIP","application/x-zip":"ZIP","application/x-rar":"RAR","application/x-tar":"TAR","application/x-7z-compressed":"7z","application/x-jar":"JAR","text/plain":"TextPlain","text/x-php":"PHP","text/html":"HTML","text/javascript":"JS","text/css":"CSS","text/rtf":"RTF","text/rtfd":"RTF","text/x-c":"C","text/x-csrc":"C","text/x-chdr":"CHeader","text/x-c++":"CPP","text/x-c++src":"CPP","text/x-c++hdr":"CPPHeader","text/x-shellscript":"Shell","application/x-csh":"Shell","text/x-python":"Python","text/x-java":"Java","text/x-java-source":"Java","text/x-ruby":"Ruby","text/x-perl":"Perl","text/x-sql":"SQL","text/xml":"XML","text/x-comma-separated-values":"CSV","image/x-ms-bmp":"BMP","image/jpeg":"JPEG","image/gif":"GIF","image/png":"PNG","image/tiff":"TIFF","image/x-targa":"TGA","image/vnd.adobe.photoshop":"PSD","image/xbm":"XBITMAP","image/pxm":"PXM","audio/mpeg":"AudioMPEG","audio/midi":"AudioMIDI","audio/ogg":"AudioOGG","audio/mp4":"AudioMPEG4","audio/x-m4a":"AudioMPEG4","audio/wav":"AudioWAV","audio/x-mp3-playlist":"AudioPlaylist","video/x-dv":"VideoDV","video/mp4":"VideoMPEG4","video/mpeg":"VideoMPEG","video/x-msvideo":"VideoAVI","video/quicktime":"VideoMOV","video/x-ms-wmv":"VideoWM","video/x-flv":"VideoFlash","video/x-matroska":"VideoMKV","video/ogg":"VideoOGG"},rules:{defaults:function(b){return!b||b.added&&!a.isArray(b.added)||b.removed&&!a.isArray(b.removed)||b.changed&&!a.isArray(b.changed)?!1:!0},open:function(b){return b&&b.cwd&&b.files&&a.isPlainObject(b.cwd)&&a.isArray(b.files)},tree:function(b){return b&&b.tree&&a.isArray(b.tree)},parents:function(b){return b&&b.tree&&a.isArray(b.tree)},tmb:function(b){return b&&b.images&&(a.isPlainObject(b.images)||a.isArray(b.images))},upload:function(b){return b&&(a.isPlainObject(b.added)||a.isArray(b.added))},search:function(b){return b&&b.files&&a.isArray(b.files)}},sorts:{nameDirsFirst:1,kindDirsFirst:2,sizeDirsFirst:3,dateDirsFirst:4,name:5,kind:6,size:7,date:8},setSort:function(a,b){this.sort=this.sorts[a]||1,this.sortDirect=b=="asc"||b=="desc"?b:"asc",this.trigger("sortchange")},commands:{},parseUploadData:function(b){var c;if(!a.trim(b))return{error:["errResponse","errDataEmpty"]};try{c=a.parseJSON(b)}catch(d){return{error:["errResponse","errDataNotJSON"]}}return this.validResponse("upload",c)?(c=this.normalize(c),c.removed=a.map(c.added||[],function(a){return a.hash}),c):{error:["errResponse"]}},iframeCnt:0,uploads:{iframe:function(b,c){var d=c?c:this,e=b.input,f=a.Deferred().fail(function(a){a&&d.error(a)}).done(function(a){a.warning&&d.error(a.warning),a.removed&&d.remove(a),a.added&&d.add(a),a.changed&&d.change(a),d.trigger("upload",a),a.sync&&d.sync()}),g="iframe-"+d.namespace+ ++d.iframeCnt,h=a('
        '),i=a.browser.msie,j=function(){o&&clearTimeout(o),n&&clearTimeout(n),m&&d.notify({type:"upload",cnt:-l}),setTimeout(function(){i&&a('':""),a._keyEvent=!1,K},_generateMonthYearHeader:function(a,b,c,d,e,f,g,h){var i=this._get(a,"changeMonth"),j=this._get(a,"changeYear"),k=this._get(a,"showMonthAfterYear"),l='
        ',m="";if(f||!i)m+=''+g[b]+"";else{var n=d&&d.getFullYear()==c,o=e&&e.getFullYear()==c;m+='"}k||(l+=m+(f||!i||!j?" ":""));if(!a.yearshtml){a.yearshtml="";if(f||!j)l+=''+c+"";else{var q=this._get(a,"yearRange").split(":"),r=(new Date).getFullYear(),s=function(a){var b=a.match(/c[+-].*/)?c+parseInt(a.substring(1),10):a.match(/[+-].*/)?r+parseInt(a,10):parseInt(a,10);return isNaN(b)?r:b},t=s(q[0]),u=Math.max(t,s(q[1]||""));t=d?Math.max(t,d.getFullYear()):t,u=e?Math.min(u,e.getFullYear()):u,a.yearshtml+='",l+=a.yearshtml,a.yearshtml=null}}return l+=this._get(a,"yearSuffix"),k&&(l+=(f||!i||!j?" ":"")+m),l+="
        ",l},_adjustInstDate:function(a,b,c){var d=a.drawYear+(c=="Y"?b:0),e=a.drawMonth+(c=="M"?b:0),f=Math.min(a.selectedDay,this._getDaysInMonth(d,e))+(c=="D"?b:0),g=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(d,e,f)));a.selectedDay=g.getDate(),a.drawMonth=a.selectedMonth=g.getMonth(),a.drawYear=a.selectedYear=g.getFullYear(),(c=="M"||c=="Y")&&this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max"),e=c&&bd?d:e,e},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");b&&b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){var b=this._get(a,"numberOfMonths");return b==null?[1,1]:typeof b=="number"?[1,b]:b},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,d){var e=this._getNumberOfMonths(a),f=this._daylightSavingAdjust(new Date(c,d+(b<0?b:e[0]*e[1]),1));return b<0&&f.setDate(this._getDaysInMonth(f.getFullYear(),f.getMonth())),this._isInRange(a,f)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!d||b.getTime()<=d.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");return b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10),{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,d){b||(a.currentDay=a.selectedDay,a.currentMonth=a.selectedMonth,a.currentYear=a.selectedYear);var e=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(d,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),e,this._getFormatConfig(a))}}),$.fn.datepicker=function(a){if(!this.length)return this;$.datepicker.initialized||($(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv),$.datepicker.initialized=!0);var b=Array.prototype.slice.call(arguments,1);return typeof a!="string"||a!="isDisabled"&&a!="getDate"&&a!="widget"?a=="option"&&arguments.length==2&&typeof arguments[1]=="string"?$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b)):this.each(function(){typeof a=="string"?$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this].concat(b)):$.datepicker._attachDatepicker(this,a)}):$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b))},$.datepicker=new Datepicker,$.datepicker.initialized=!1,$.datepicker.uuid=(new Date).getTime(),$.datepicker.version="1.8.24",window["DP_jQuery_"+dpuuid]=$})(jQuery);;/*! jQuery UI - v1.8.24 - 2012-09-28 +* https://github.com/jquery/jquery-ui +* Includes: jquery.ui.progressbar.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +(function(a,b){a.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()}),this.valueDiv=a("
        ").appendTo(this.element),this.oldValue=this._value(),this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove(),a.Widget.prototype.destroy.apply(this,arguments)},value:function(a){return a===b?this._value():(this._setOption("value",a),this)},_setOption:function(b,c){b==="value"&&(this.options.value=c,this._refreshValue(),this._value()===this.options.max&&this._trigger("complete")),a.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;return typeof a!="number"&&(a=0),Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100*this._value()/this.options.max},_refreshValue:function(){var a=this.value(),b=this._percentage();this.oldValue!==a&&(this.oldValue=a,this._trigger("change")),this.valueDiv.toggle(a>this.min).toggleClass("ui-corner-right",a===this.options.max).width(b.toFixed(0)+"%"),this.element.attr("aria-valuenow",a)}}),a.extend(a.ui.progressbar,{version:"1.8.24"})})(jQuery);;/*! jQuery UI - v1.8.24 - 2012-09-28 +* https://github.com/jquery/jquery-ui +* Includes: jquery.effects.core.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +jQuery.effects||function(a,b){function c(b){var c;return b&&b.constructor==Array&&b.length==3?b:(c=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(b))?[parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10)]:(c=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(b))?[parseFloat(c[1])*2.55,parseFloat(c[2])*2.55,parseFloat(c[3])*2.55]:(c=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(b))?[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)]:(c=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(b))?[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)]:(c=/rgba\(0, 0, 0, 0\)/.exec(b))?e.transparent:e[a.trim(b).toLowerCase()]}function d(b,d){var e;do{e=(a.curCSS||a.css)(b,d);if(e!=""&&e!="transparent"||a.nodeName(b,"body"))break;d="backgroundColor"}while(b=b.parentNode);return c(e)}function h(){var a=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,b={},c,d;if(a&&a.length&&a[0]&&a[a[0]]){var e=a.length;while(e--)c=a[e],typeof a[c]=="string"&&(d=c.replace(/\-(\w)/g,function(a,b){return b.toUpperCase()}),b[d]=a[c])}else for(c in a)typeof a[c]=="string"&&(b[c]=a[c]);return b}function i(b){var c,d;for(c in b)d=b[c],(d==null||a.isFunction(d)||c in g||/scrollbar/.test(c)||!/color/i.test(c)&&isNaN(parseFloat(d)))&&delete b[c];return b}function j(a,b){var c={_:0},d;for(d in b)a[d]!=b[d]&&(c[d]=b[d]);return c}function k(b,c,d,e){typeof b=="object"&&(e=c,d=null,c=b,b=c.effect),a.isFunction(c)&&(e=c,d=null,c={});if(typeof c=="number"||a.fx.speeds[c])e=d,d=c,c={};return a.isFunction(d)&&(e=d,d=null),c=c||{},d=d||c.duration,d=a.fx.off?0:typeof d=="number"?d:d in a.fx.speeds?a.fx.speeds[d]:a.fx.speeds._default,e=e||c.complete,[b,c,d,e]}function l(b){return!b||typeof b=="number"||a.fx.speeds[b]?!0:typeof b=="string"&&!a.effects[b]?!0:!1}a.effects={},a.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","borderColor","color","outlineColor"],function(b,e){a.fx.step[e]=function(a){a.colorInit||(a.start=d(a.elem,e),a.end=c(a.end),a.colorInit=!0),a.elem.style[e]="rgb("+Math.max(Math.min(parseInt(a.pos*(a.end[0]-a.start[0])+a.start[0],10),255),0)+","+Math.max(Math.min(parseInt(a.pos*(a.end[1]-a.start[1])+a.start[1],10),255),0)+","+Math.max(Math.min(parseInt(a.pos*(a.end[2]-a.start[2])+a.start[2],10),255),0)+")"}});var e={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},f=["add","remove","toggle"],g={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};a.effects.animateClass=function(b,c,d,e){return a.isFunction(d)&&(e=d,d=null),this.queue(function(){var g=a(this),k=g.attr("style")||" ",l=i(h.call(this)),m,n=g.attr("class")||"";a.each(f,function(a,c){b[c]&&g[c+"Class"](b[c])}),m=i(h.call(this)),g.attr("class",n),g.animate(j(l,m),{queue:!1,duration:c,easing:d,complete:function(){a.each(f,function(a,c){b[c]&&g[c+"Class"](b[c])}),typeof g.attr("style")=="object"?(g.attr("style").cssText="",g.attr("style").cssText=k):g.attr("style",k),e&&e.apply(this,arguments),a.dequeue(this)}})})},a.fn.extend({_addClass:a.fn.addClass,addClass:function(b,c,d,e){return c?a.effects.animateClass.apply(this,[{add:b},c,d,e]):this._addClass(b)},_removeClass:a.fn.removeClass,removeClass:function(b,c,d,e){return c?a.effects.animateClass.apply(this,[{remove:b},c,d,e]):this._removeClass(b)},_toggleClass:a.fn.toggleClass,toggleClass:function(c,d,e,f,g){return typeof d=="boolean"||d===b?e?a.effects.animateClass.apply(this,[d?{add:c}:{remove:c},e,f,g]):this._toggleClass(c,d):a.effects.animateClass.apply(this,[{toggle:c},d,e,f])},switchClass:function(b,c,d,e,f){return a.effects.animateClass.apply(this,[{add:c,remove:b},d,e,f])}}),a.extend(a.effects,{version:"1.8.24",save:function(a,b){for(var c=0;c
        ").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),e=document.activeElement;try{e.id}catch(f){e=document.body}return b.wrap(d),(b[0]===e||a.contains(b[0],e))&&a(e).focus(),d=b.parent(),b.css("position")=="static"?(d.css({position:"relative"}),b.css({position:"relative"})):(a.extend(c,{position:b.css("position"),zIndex:b.css("z-index")}),a.each(["top","left","bottom","right"],function(a,d){c[d]=b.css(d),isNaN(parseInt(c[d],10))&&(c[d]="auto")}),b.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),d.css(c).show()},removeWrapper:function(b){var c,d=document.activeElement;return b.parent().is(".ui-effects-wrapper")?(c=b.parent().replaceWith(b),(b[0]===d||a.contains(b[0],d))&&a(d).focus(),c):b},setTransition:function(b,c,d,e){return e=e||{},a.each(c,function(a,c){var f=b.cssUnit(c);f[0]>0&&(e[c]=f[0]*d+f[1])}),e}}),a.fn.extend({effect:function(b,c,d,e){var f=k.apply(this,arguments),g={options:f[1],duration:f[2],callback:f[3]},h=g.options.mode,i=a.effects[b];return a.fx.off||!i?h?this[h](g.duration,g.callback):this.each(function(){g.callback&&g.callback.call(this)}):i.call(this,g)},_show:a.fn.show,show:function(a){if(l(a))return this._show.apply(this,arguments);var b=k.apply(this,arguments);return b[1].mode="show",this.effect.apply(this,b)},_hide:a.fn.hide,hide:function(a){if(l(a))return this._hide.apply(this,arguments);var b=k.apply(this,arguments);return b[1].mode="hide",this.effect.apply(this,b)},__toggle:a.fn.toggle,toggle:function(b){if(l(b)||typeof b=="boolean"||a.isFunction(b))return this.__toggle.apply(this,arguments);var c=k.apply(this,arguments);return c[1].mode="toggle",this.effect.apply(this,c)},cssUnit:function(b){var c=this.css(b),d=[];return a.each(["em","px","%","pt"],function(a,b){c.indexOf(b)>0&&(d=[parseFloat(c),b])}),d}});var m={};a.each(["Quad","Cubic","Quart","Quint","Expo"],function(a,b){m[b]=function(b){return Math.pow(b,a+2)}}),a.extend(m,{Sine:function(a){return 1-Math.cos(a*Math.PI/2)},Circ:function(a){return 1-Math.sqrt(1-a*a)},Elastic:function(a){return a===0||a===1?a:-Math.pow(2,8*(a-1))*Math.sin(((a-1)*80-7.5)*Math.PI/15)},Back:function(a){return a*a*(3*a-2)},Bounce:function(a){var b,c=4;while(a<((b=Math.pow(2,--c))-1)/11);return 1/Math.pow(4,3-c)-7.5625*Math.pow((b*3-2)/22-a,2)}}),a.each(m,function(b,c){a.easing["easeIn"+b]=c,a.easing["easeOut"+b]=function(a){return 1-c(1-a)},a.easing["easeInOut"+b]=function(a){return a<.5?c(a*2)/2:c(a*-2+2)/-2+1}})}(jQuery);;/*! jQuery UI - v1.8.24 - 2012-09-28 +* https://github.com/jquery/jquery-ui +* Includes: jquery.effects.blind.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +(function(a,b){a.effects.blind=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"hide"),f=b.options.direction||"vertical";a.effects.save(c,d),c.show();var g=a.effects.createWrapper(c).css({overflow:"hidden"}),h=f=="vertical"?"height":"width",i=f=="vertical"?g.height():g.width();e=="show"&&g.css(h,0);var j={};j[h]=e=="show"?i:0,g.animate(j,b.duration,b.options.easing,function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()})})}})(jQuery);;/*! jQuery UI - v1.8.24 - 2012-09-28 +* https://github.com/jquery/jquery-ui +* Includes: jquery.effects.bounce.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +(function(a,b){a.effects.bounce=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"effect"),f=b.options.direction||"up",g=b.options.distance||20,h=b.options.times||5,i=b.duration||250;/show|hide/.test(e)&&d.push("opacity"),a.effects.save(c,d),c.show(),a.effects.createWrapper(c);var j=f=="up"||f=="down"?"top":"left",k=f=="up"||f=="left"?"pos":"neg",g=b.options.distance||(j=="top"?c.outerHeight(!0)/3:c.outerWidth(!0)/3);e=="show"&&c.css("opacity",0).css(j,k=="pos"?-g:g),e=="hide"&&(g=g/(h*2)),e!="hide"&&h--;if(e=="show"){var l={opacity:1};l[j]=(k=="pos"?"+=":"-=")+g,c.animate(l,i/2,b.options.easing),g=g/2,h--}for(var m=0;m
        ").css({position:"absolute",visibility:"visible",left:-j*(g/d),top:-i*(h/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:g/d,height:h/c,left:f.left+j*(g/d)+(b.options.mode=="show"?(j-Math.floor(d/2))*(g/d):0),top:f.top+i*(h/c)+(b.options.mode=="show"?(i-Math.floor(c/2))*(h/c):0),opacity:b.options.mode=="show"?0:1}).animate({left:f.left+j*(g/d)+(b.options.mode=="show"?0:(j-Math.floor(d/2))*(g/d)),top:f.top+i*(h/c)+(b.options.mode=="show"?0:(i-Math.floor(c/2))*(h/c)),opacity:b.options.mode=="show"?1:0},b.duration||500);setTimeout(function(){b.options.mode=="show"?e.css({visibility:"visible"}):e.css({visibility:"visible"}).hide(),b.callback&&b.callback.apply(e[0]),e.dequeue(),a("div.ui-effects-explode").remove()},b.duration||500)})}})(jQuery);;/*! jQuery UI - v1.8.24 - 2012-09-28 +* https://github.com/jquery/jquery-ui +* Includes: jquery.effects.fade.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +(function(a,b){a.effects.fade=function(b){return this.queue(function(){var c=a(this),d=a.effects.setMode(c,b.options.mode||"hide");c.animate({opacity:d},{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}})(jQuery);;/*! jQuery UI - v1.8.24 - 2012-09-28 +* https://github.com/jquery/jquery-ui +* Includes: jquery.effects.fold.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +(function(a,b){a.effects.fold=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"hide"),f=b.options.size||15,g=!!b.options.horizFirst,h=b.duration?b.duration/2:a.fx.speeds._default/2;a.effects.save(c,d),c.show();var i=a.effects.createWrapper(c).css({overflow:"hidden"}),j=e=="show"!=g,k=j?["width","height"]:["height","width"],l=j?[i.width(),i.height()]:[i.height(),i.width()],m=/([0-9]+)%/.exec(f);m&&(f=parseInt(m[1],10)/100*l[e=="hide"?0:1]),e=="show"&&i.css(g?{height:0,width:f}:{height:f,width:0});var n={},p={};n[k[0]]=e=="show"?l[0]:f,p[k[1]]=e=="show"?l[1]:0,i.animate(n,h,b.options.easing).animate(p,h,b.options.easing,function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()})})}})(jQuery);;/*! jQuery UI - v1.8.24 - 2012-09-28 +* https://github.com/jquery/jquery-ui +* Includes: jquery.effects.highlight.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +(function(a,b){a.effects.highlight=function(b){return this.queue(function(){var c=a(this),d=["backgroundImage","backgroundColor","opacity"],e=a.effects.setMode(c,b.options.mode||"show"),f={backgroundColor:c.css("backgroundColor")};e=="hide"&&(f.opacity=0),a.effects.save(c,d),c.show().css({backgroundImage:"none",backgroundColor:b.options.color||"#ffff99"}).animate(f,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){e=="hide"&&c.hide(),a.effects.restore(c,d),e=="show"&&!a.support.opacity&&this.style.removeAttribute("filter"),b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}})(jQuery);;/*! jQuery UI - v1.8.24 - 2012-09-28 +* https://github.com/jquery/jquery-ui +* Includes: jquery.effects.pulsate.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +(function(a,b){a.effects.pulsate=function(b){return this.queue(function(){var c=a(this),d=a.effects.setMode(c,b.options.mode||"show"),e=(b.options.times||5)*2-1,f=b.duration?b.duration/2:a.fx.speeds._default/2,g=c.is(":visible"),h=0;g||(c.css("opacity",0).show(),h=1),(d=="hide"&&g||d=="show"&&!g)&&e--;for(var i=0;i
        ').appendTo(document.body).addClass(b.options.className).css({top:g.top,left:g.left,height:c.innerHeight(),width:c.innerWidth(),position:"absolute"}).animate(f,b.duration,b.options.easing,function(){h.remove(),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()})})}})(jQuery);; diff --git a/deployed/k2/media/k2/assets/js/jquery.magnific-popup.min.js b/deployed/k2/media/k2/assets/js/jquery.magnific-popup.min.js new file mode 100644 index 00000000..6ee3a3bd --- /dev/null +++ b/deployed/k2/media/k2/assets/js/jquery.magnific-popup.min.js @@ -0,0 +1,4 @@ +/*! Magnific Popup - v1.1.0 - 2016-02-20 +* http://dimsemenov.com/plugins/magnific-popup/ +* Copyright (c) 2016 Dmitry Semenov; */ +!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):window.jQuery||window.Zepto)}(function(a){var b,c,d,e,f,g,h="Close",i="BeforeClose",j="AfterClose",k="BeforeAppend",l="MarkupParse",m="Open",n="Change",o="mfp",p="."+o,q="mfp-ready",r="mfp-removing",s="mfp-prevent-close",t=function(){},u=!!window.jQuery,v=a(window),w=function(a,c){b.ev.on(o+a+p,c)},x=function(b,c,d,e){var f=document.createElement("div");return f.className="mfp-"+b,d&&(f.innerHTML=d),e?c&&c.appendChild(f):(f=a(f),c&&f.appendTo(c)),f},y=function(c,d){b.ev.triggerHandler(o+c,d),b.st.callbacks&&(c=c.charAt(0).toLowerCase()+c.slice(1),b.st.callbacks[c]&&b.st.callbacks[c].apply(b,a.isArray(d)?d:[d]))},z=function(c){return c===g&&b.currTemplate.closeBtn||(b.currTemplate.closeBtn=a(b.st.closeMarkup.replace("%title%",b.st.tClose)),g=c),b.currTemplate.closeBtn},A=function(){a.magnificPopup.instance||(b=new t,b.init(),a.magnificPopup.instance=b)},B=function(){var a=document.createElement("p").style,b=["ms","O","Moz","Webkit"];if(void 0!==a.transition)return!0;for(;b.length;)if(b.pop()+"Transition"in a)return!0;return!1};t.prototype={constructor:t,init:function(){var c=navigator.appVersion;b.isLowIE=b.isIE8=document.all&&!document.addEventListener,b.isAndroid=/android/gi.test(c),b.isIOS=/iphone|ipad|ipod/gi.test(c),b.supportsTransition=B(),b.probablyMobile=b.isAndroid||b.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),d=a(document),b.popupsCache={}},open:function(c){var e;if(c.isObj===!1){b.items=c.items.toArray(),b.index=0;var g,h=c.items;for(e=0;e(a||v.height())},_setFocus:function(){(b.st.focus?b.content.find(b.st.focus).eq(0):b.wrap).focus()},_onFocusIn:function(c){return c.target===b.wrap[0]||a.contains(b.wrap[0],c.target)?void 0:(b._setFocus(),!1)},_parseMarkup:function(b,c,d){var e;d.data&&(c=a.extend(d.data,c)),y(l,[b,c,d]),a.each(c,function(c,d){if(void 0===d||d===!1)return!0;if(e=c.split("_"),e.length>1){var f=b.find(p+"-"+e[0]);if(f.length>0){var g=e[1];"replaceWith"===g?f[0]!==d[0]&&f.replaceWith(d):"img"===g?f.is("img")?f.attr("src",d):f.replaceWith(a("").attr("src",d).attr("class",f.attr("class"))):f.attr(e[1],d)}}else b.find(p+"-"+c).html(d)})},_getScrollbarSize:function(){if(void 0===b.scrollbarSize){var a=document.createElement("div");a.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(a),b.scrollbarSize=a.offsetWidth-a.clientWidth,document.body.removeChild(a)}return b.scrollbarSize}},a.magnificPopup={instance:null,proto:t.prototype,modules:[],open:function(b,c){return A(),b=b?a.extend(!0,{},b):{},b.isObj=!0,b.index=c||0,this.instance.open(b)},close:function(){return a.magnificPopup.instance&&a.magnificPopup.instance.close()},registerModule:function(b,c){c.options&&(a.magnificPopup.defaults[b]=c.options),a.extend(this.proto,c.proto),this.modules.push(b)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,prependTo:null,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'',tClose:"Close (Esc)",tLoading:"Loading...",autoFocusLast:!0}},a.fn.magnificPopup=function(c){A();var d=a(this);if("string"==typeof c)if("open"===c){var e,f=u?d.data("magnificPopup"):d[0].magnificPopup,g=parseInt(arguments[1],10)||0;f.items?e=f.items[g]:(e=d,f.delegate&&(e=e.find(f.delegate)),e=e.eq(g)),b._openClick({mfpEl:e},d,f)}else b.isOpen&&b[c].apply(b,Array.prototype.slice.call(arguments,1));else c=a.extend(!0,{},c),u?d.data("magnificPopup",c):d[0].magnificPopup=c,b.addGroup(d,c);return d};var C,D,E,F="inline",G=function(){E&&(D.after(E.addClass(C)).detach(),E=null)};a.magnificPopup.registerModule(F,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){b.types.push(F),w(h+"."+F,function(){G()})},getInline:function(c,d){if(G(),c.src){var e=b.st.inline,f=a(c.src);if(f.length){var g=f[0].parentNode;g&&g.tagName&&(D||(C=e.hiddenClass,D=x(C),C="mfp-"+C),E=f.after(D).detach().removeClass(C)),b.updateStatus("ready")}else b.updateStatus("error",e.tNotFound),f=a("
        ");return c.inlineElement=f,f}return b.updateStatus("ready"),b._parseMarkup(d,{},c),d}}});var H,I="ajax",J=function(){H&&a(document.body).removeClass(H)},K=function(){J(),b.req&&b.req.abort()};a.magnificPopup.registerModule(I,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'The content could not be loaded.'},proto:{initAjax:function(){b.types.push(I),H=b.st.ajax.cursor,w(h+"."+I,K),w("BeforeChange."+I,K)},getAjax:function(c){H&&a(document.body).addClass(H),b.updateStatus("loading");var d=a.extend({url:c.src,success:function(d,e,f){var g={data:d,xhr:f};y("ParseAjax",g),b.appendContent(a(g.data),I),c.finished=!0,J(),b._setFocus(),setTimeout(function(){b.wrap.addClass(q)},16),b.updateStatus("ready"),y("AjaxContentAdded")},error:function(){J(),c.finished=c.loadError=!0,b.updateStatus("error",b.st.ajax.tError.replace("%url%",c.src))}},b.st.ajax.settings);return b.req=a.ajax(d),""}}});var L,M=function(c){if(c.data&&void 0!==c.data.title)return c.data.title;var d=b.st.image.titleSrc;if(d){if(a.isFunction(d))return d.call(b,c);if(c.el)return c.el.attr(d)||""}return""};a.magnificPopup.registerModule("image",{options:{markup:'
        ',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'The image could not be loaded.'},proto:{initImage:function(){var c=b.st.image,d=".image";b.types.push("image"),w(m+d,function(){"image"===b.currItem.type&&c.cursor&&a(document.body).addClass(c.cursor)}),w(h+d,function(){c.cursor&&a(document.body).removeClass(c.cursor),v.off("resize"+p)}),w("Resize"+d,b.resizeImage),b.isLowIE&&w("AfterChange",b.resizeImage)},resizeImage:function(){var a=b.currItem;if(a&&a.img&&b.st.image.verticalFit){var c=0;b.isLowIE&&(c=parseInt(a.img.css("padding-top"),10)+parseInt(a.img.css("padding-bottom"),10)),a.img.css("max-height",b.wH-c)}},_onImageHasSize:function(a){a.img&&(a.hasSize=!0,L&&clearInterval(L),a.isCheckingImgSize=!1,y("ImageHasSize",a),a.imgHidden&&(b.content&&b.content.removeClass("mfp-loading"),a.imgHidden=!1))},findImageSize:function(a){var c=0,d=a.img[0],e=function(f){L&&clearInterval(L),L=setInterval(function(){return d.naturalWidth>0?void b._onImageHasSize(a):(c>200&&clearInterval(L),c++,void(3===c?e(10):40===c?e(50):100===c&&e(500)))},f)};e(1)},getImage:function(c,d){var e=0,f=function(){c&&(c.img[0].complete?(c.img.off(".mfploader"),c===b.currItem&&(b._onImageHasSize(c),b.updateStatus("ready")),c.hasSize=!0,c.loaded=!0,y("ImageLoadComplete")):(e++,200>e?setTimeout(f,100):g()))},g=function(){c&&(c.img.off(".mfploader"),c===b.currItem&&(b._onImageHasSize(c),b.updateStatus("error",h.tError.replace("%url%",c.src))),c.hasSize=!0,c.loaded=!0,c.loadError=!0)},h=b.st.image,i=d.find(".mfp-img");if(i.length){var j=document.createElement("img");j.className="mfp-img",c.el&&c.el.find("img").length&&(j.alt=c.el.find("img").attr("alt")),c.img=a(j).on("load.mfploader",f).on("error.mfploader",g),j.src=c.src,i.is("img")&&(c.img=c.img.clone()),j=c.img[0],j.naturalWidth>0?c.hasSize=!0:j.width||(c.hasSize=!1)}return b._parseMarkup(d,{title:M(c),img_replaceWith:c.img},c),b.resizeImage(),c.hasSize?(L&&clearInterval(L),c.loadError?(d.addClass("mfp-loading"),b.updateStatus("error",h.tError.replace("%url%",c.src))):(d.removeClass("mfp-loading"),b.updateStatus("ready")),d):(b.updateStatus("loading"),c.loading=!0,c.hasSize||(c.imgHidden=!0,d.addClass("mfp-loading"),b.findImageSize(c)),d)}}});var N,O=function(){return void 0===N&&(N=void 0!==document.createElement("p").style.MozTransform),N};a.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(a){return a.is("img")?a:a.find("img")}},proto:{initZoom:function(){var a,c=b.st.zoom,d=".zoom";if(c.enabled&&b.supportsTransition){var e,f,g=c.duration,j=function(a){var b=a.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),d="all "+c.duration/1e3+"s "+c.easing,e={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},f="transition";return e["-webkit-"+f]=e["-moz-"+f]=e["-o-"+f]=e[f]=d,b.css(e),b},k=function(){b.content.css("visibility","visible")};w("BuildControls"+d,function(){if(b._allowZoom()){if(clearTimeout(e),b.content.css("visibility","hidden"),a=b._getItemToZoom(),!a)return void k();f=j(a),f.css(b._getOffset()),b.wrap.append(f),e=setTimeout(function(){f.css(b._getOffset(!0)),e=setTimeout(function(){k(),setTimeout(function(){f.remove(),a=f=null,y("ZoomAnimationEnded")},16)},g)},16)}}),w(i+d,function(){if(b._allowZoom()){if(clearTimeout(e),b.st.removalDelay=g,!a){if(a=b._getItemToZoom(),!a)return;f=j(a)}f.css(b._getOffset(!0)),b.wrap.append(f),b.content.css("visibility","hidden"),setTimeout(function(){f.css(b._getOffset())},16)}}),w(h+d,function(){b._allowZoom()&&(k(),f&&f.remove(),a=null)})}},_allowZoom:function(){return"image"===b.currItem.type},_getItemToZoom:function(){return b.currItem.hasSize?b.currItem.img:!1},_getOffset:function(c){var d;d=c?b.currItem.img:b.st.zoom.opener(b.currItem.el||b.currItem);var e=d.offset(),f=parseInt(d.css("padding-top"),10),g=parseInt(d.css("padding-bottom"),10);e.top-=a(window).scrollTop()-f;var h={width:d.width(),height:(u?d.innerHeight():d[0].offsetHeight)-g-f};return O()?h["-moz-transform"]=h.transform="translate("+e.left+"px,"+e.top+"px)":(h.left=e.left,h.top=e.top),h}}});var P="iframe",Q="//about:blank",R=function(a){if(b.currTemplate[P]){var c=b.currTemplate[P].find("iframe");c.length&&(a||(c[0].src=Q),b.isIE8&&c.css("display",a?"block":"none"))}};a.magnificPopup.registerModule(P,{options:{markup:'
        ',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){b.types.push(P),w("BeforeChange",function(a,b,c){b!==c&&(b===P?R():c===P&&R(!0))}),w(h+"."+P,function(){R()})},getIframe:function(c,d){var e=c.src,f=b.st.iframe;a.each(f.patterns,function(){return e.indexOf(this.index)>-1?(this.id&&(e="string"==typeof this.id?e.substr(e.lastIndexOf(this.id)+this.id.length,e.length):this.id.call(this,e)),e=this.src.replace("%id%",e),!1):void 0});var g={};return f.srcAction&&(g[f.srcAction]=e),b._parseMarkup(d,g,c),b.updateStatus("ready"),d}}});var S=function(a){var c=b.items.length;return a>c-1?a-c:0>a?c+a:a},T=function(a,b,c){return a.replace(/%curr%/gi,b+1).replace(/%total%/gi,c)};a.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var c=b.st.gallery,e=".mfp-gallery";return b.direction=!0,c&&c.enabled?(f+=" mfp-gallery",w(m+e,function(){c.navigateByImgClick&&b.wrap.on("click"+e,".mfp-img",function(){return b.items.length>1?(b.next(),!1):void 0}),d.on("keydown"+e,function(a){37===a.keyCode?b.prev():39===a.keyCode&&b.next()})}),w("UpdateStatus"+e,function(a,c){c.text&&(c.text=T(c.text,b.currItem.index,b.items.length))}),w(l+e,function(a,d,e,f){var g=b.items.length;e.counter=g>1?T(c.tCounter,f.index,g):""}),w("BuildControls"+e,function(){if(b.items.length>1&&c.arrows&&!b.arrowLeft){var d=c.arrowMarkup,e=b.arrowLeft=a(d.replace(/%title%/gi,c.tPrev).replace(/%dir%/gi,"left")).addClass(s),f=b.arrowRight=a(d.replace(/%title%/gi,c.tNext).replace(/%dir%/gi,"right")).addClass(s);e.click(function(){b.prev()}),f.click(function(){b.next()}),b.container.append(e.add(f))}}),w(n+e,function(){b._preloadTimeout&&clearTimeout(b._preloadTimeout),b._preloadTimeout=setTimeout(function(){b.preloadNearbyImages(),b._preloadTimeout=null},16)}),void w(h+e,function(){d.off(e),b.wrap.off("click"+e),b.arrowRight=b.arrowLeft=null})):!1},next:function(){b.direction=!0,b.index=S(b.index+1),b.updateItemHTML()},prev:function(){b.direction=!1,b.index=S(b.index-1),b.updateItemHTML()},goTo:function(a){b.direction=a>=b.index,b.index=a,b.updateItemHTML()},preloadNearbyImages:function(){var a,c=b.st.gallery.preload,d=Math.min(c[0],b.items.length),e=Math.min(c[1],b.items.length);for(a=1;a<=(b.direction?e:d);a++)b._preloadItem(b.index+a);for(a=1;a<=(b.direction?d:e);a++)b._preloadItem(b.index-a)},_preloadItem:function(c){if(c=S(c),!b.items[c].preloaded){var d=b.items[c];d.parsed||(d=b.parseEl(c)),y("LazyLoad",d),"image"===d.type&&(d.img=a('').on("load.mfploader",function(){d.hasSize=!0}).on("error.mfploader",function(){d.hasSize=!0,d.loadError=!0,y("LazyLoadError",d)}).attr("src",d.src)),d.preloaded=!0}}}});var U="retina";a.magnificPopup.registerModule(U,{options:{replaceSrc:function(a){return a.src.replace(/\.\w+$/,function(a){return"@2x"+a})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var a=b.st.retina,c=a.ratio;c=isNaN(c)?c():c,c>1&&(w("ImageHasSize."+U,function(a,b){b.img.css({"max-width":b.img[0].naturalWidth/c,width:"100%"})}),w("ElementParse."+U,function(b,d){d.src=a.replaceSrc(d,c)}))}}}}),A()}); \ No newline at end of file diff --git a/deployed/k2/media/k2/assets/js/k2.backend.js b/deployed/k2/media/k2/assets/js/k2.backend.js new file mode 100644 index 00000000..e7dce5a3 --- /dev/null +++ b/deployed/k2/media/k2/assets/js/k2.backend.js @@ -0,0 +1,1240 @@ +/** + * @version 2.8.x + * @package K2 + * @author JoomlaWorks http://www.joomlaworks.net + * @copyright Copyright (c) 2006 - 2017 JoomlaWorks Ltd. All rights reserved. + * @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html + */ + +var $K2 = jQuery.noConflict(); + +var K2JVersion; +var K2SitePath; +var selectsInstance; + +$K2(document).ready(function() { + + // Set the selects instance to allow inheritance of jQuery chosen bindings + if ( typeof (K2JVersion) !== 'undefined' && K2JVersion === '30') { + selectsInstance = jQuery; + } else { + selectsInstance = $K2; + } + + // Generic function to get URL params passed in .js script include + function getUrlParams(targetScript, varName) { + var scripts = document.getElementsByTagName('script'); + var scriptCount = scripts.length; + for (var a = 0; a < scriptCount; a++) { + var scriptSrc = scripts[a].src; + if (scriptSrc.indexOf(targetScript) >= 0) { + varName = varName.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); + var re = new RegExp("[\\?&]" + varName + "=([^&#]*)"); + var parsedVariables = re.exec(scriptSrc); + if (parsedVariables !== null) { + return parsedVariables[1]; + } + } + } + } + + // Set the site root path + K2SitePath = getUrlParams('k2.backend.js', 'sitepath'); + + // --- Common functions --- + + // Minimal Scrollspy + $K2(".k2ScrollSpyMenu").each(function( index ) { + // Cache selectors + var lastId, + menuItems = $K2(this).find("a"), + firstMenuItem = menuItems[0], + // Anchors corresponding to menu items + scrollItems = menuItems.map(function(){ + var item = $K2($K2(this).attr("href")); + if (item.length) return item; + }); + + // Bind click handler to menu items so we can get a fancy scroll animation + menuItems.click(function(e){ + var href = $K2(this).attr("href"), + offsetTop = (href === "#") ? 0 : $K2(href).offset().top-60; + $K2('html, body').stop().animate({ + scrollTop: offsetTop + }, 300); + e.preventDefault(); + }); + + // Bind to scroll + $K2(window).scroll(function(){ + // Get container scroll position + var fromTop = $K2(this).scrollTop() + 100; + + // Get id of current scroll item + var cur = scrollItems.map(function(){ + if ($K2(this).offset().top < fromTop) return this; + }); + // Get the id of the current element + cur = cur[cur.length-1]; + var id = cur && cur.length ? cur[0].id : ""; + + if (lastId !== id) { + lastId = id; + // Set/remove active class + menuItems + .parent().removeClass("active") + .end().filter('a[href="#'+id+'"]').parent().addClass("active"); + } + }); + }); + + // Toggler + $K2('#jToggler').click(function() { + if ($K2(this).attr('checked')) { + $K2('input[id^=cb]').attr('checked', true); + $K2('input[name=boxchecked]').val($K2('input[id^=cb]:checked').length); + } else { + $K2('input[id^=cb]').attr('checked', false); + $K2('input[name=boxchecked]').val('0'); + } + }); + + // Submit form + $K2('#k2SubmitButton').click(function() { + this.form.submit(); + }); + + // Form filters reset + $K2('#k2ResetButton').click(function(event) { + event.preventDefault(); + $K2('.k2AdminTableFilters input').val(''); + $K2('.k2AdminTableFilters option').removeAttr('selected'); + this.form.submit(); + }); + selectsInstance('.k2AdminTableFilters select').change(function() { + this.form.submit(); + }); + + // View specific functions + if ($K2('#k2AdminContainer').length > 0) { + var K2IsAdmin = true; + var view = $K2('#k2AdminContainer input[name=view]').val(); + } else { + var K2IsAdmin = false; + var view = $K2('#k2ModalContainer input[name=view]').val(); + } + + // Report user + $K2('.k2ReportUserButton').click(function(event) { + event.preventDefault(); + if (view == 'comments') { + var alert = K2Language[2]; + } else { + var alert = K2Language[0]; + } + if (confirm(alert)) { + window.location.href = $K2(this).attr('href'); + } + }); + + switch(view) { + + case 'comments': + var flag = false; + $K2('.editComment').click(function(event) { + event.preventDefault(); + if (flag) { + alert(K2Language[0]); + return; + } + flag = true; + var commentID = $K2(this).attr('rel'); + var target = $K2('#k2Comment' + commentID + ' .commentText'); + var value = target.text(); + $K2('#k2Comment' + commentID + ' input').val(value); + target.empty(); + var textarea = $K2(' + + + '; +} + + + + +/** + * A ReCaptchaResponse is returned from recaptcha_check_answer() + */ +class ReCaptchaResponse { + var $is_valid; + var $error; +} + + +/** + * Calls an HTTP POST function to verify if the user's guess was correct + * @param string $privkey + * @param string $remoteip + * @param string $challenge + * @param string $response + * @param array $extra_params an array of extra variables to post to the server + * @return ReCaptchaResponse + */ +function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array()) +{ + if ($privkey == null || $privkey == '') { + die ("To use reCAPTCHA you must get an API key from https://www.google.com/recaptcha/admin/create"); + } + + if ($remoteip == null || $remoteip == '') { + die ("For security reasons, you must pass the remote ip to reCAPTCHA"); + } + + + + //discard spam submissions + if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) { + $recaptcha_response = new ReCaptchaResponse(); + $recaptcha_response->is_valid = false; + $recaptcha_response->error = 'incorrect-captcha-sol'; + return $recaptcha_response; + } + + $response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify", + array ( + 'privatekey' => $privkey, + 'remoteip' => $remoteip, + 'challenge' => $challenge, + 'response' => $response + ) + $extra_params + ); + + $answers = explode ("\n", $response [1]); + $recaptcha_response = new ReCaptchaResponse(); + + if (trim ($answers [0]) == 'true') { + $recaptcha_response->is_valid = true; + } + else { + $recaptcha_response->is_valid = false; + $recaptcha_response->error = $answers [1]; + } + return $recaptcha_response; + +} + +/** + * gets a URL where the user can sign up for reCAPTCHA. If your application + * has a configuration page where you enter a key, you should provide a link + * using this function. + * @param string $domain The domain where the page is hosted + * @param string $appname The name of your application + */ +function recaptcha_get_signup_url ($domain = null, $appname = null) { + return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname)); +} + +function _recaptcha_aes_pad($val) { + $block_size = 16; + $numpad = $block_size - (strlen ($val) % $block_size); + return str_pad($val, strlen ($val) + $numpad, chr($numpad)); +} + +/* Mailhide related code */ + +function _recaptcha_aes_encrypt($val,$ky) { + if (! function_exists ("mcrypt_encrypt")) { + die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed."); + } + $mode=MCRYPT_MODE_CBC; + $enc=MCRYPT_RIJNDAEL_128; + $val=_recaptcha_aes_pad($val); + return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"); +} + + +function _recaptcha_mailhide_urlbase64 ($x) { + return strtr(base64_encode ($x), '+/', '-_'); +} + +/* gets the reCAPTCHA Mailhide url for a given email, public key and private key */ +function recaptcha_mailhide_url($pubkey, $privkey, $email) { + if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) { + die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " . + "you can do so at http://www.google.com/recaptcha/mailhide/apikey"); + } + + + $ky = pack('H*', $privkey); + $cryptmail = _recaptcha_aes_encrypt ($email, $ky); + + return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail); +} + +/** + * gets the parts of the email to expose to the user. + * eg, given johndoe@example,com return ["john", "example.com"]. + * the email is then displayed as john...@example.com + */ +function _recaptcha_mailhide_email_parts ($email) { + $arr = preg_split("/@/", $email ); + + if (strlen ($arr[0]) <= 4) { + $arr[0] = substr ($arr[0], 0, 1); + } else if (strlen ($arr[0]) <= 6) { + $arr[0] = substr ($arr[0], 0, 3); + } else { + $arr[0] = substr ($arr[0], 0, 4); + } + return $arr; +} + +/** + * Gets html to display an email address given a public an private key. + * to get a key, go to: + * + * http://www.google.com/recaptcha/mailhide/apikey + */ +function recaptcha_mailhide_html($pubkey, $privkey, $email) { + $emailparts = _recaptcha_mailhide_email_parts ($email); + $url = recaptcha_mailhide_url ($pubkey, $privkey, $email); + + return htmlentities($emailparts[0]) . "...@" . htmlentities ($emailparts [1]); + +} + + +?> \ No newline at end of file diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/Changelog b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/Changelog new file mode 100644 index 00000000..67d17c34 --- /dev/null +++ b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/Changelog @@ -0,0 +1,655 @@ +2017-08-16 Naoki Sawada + + * elFinder (2.1.28): + - [ui:cwd] Fixed #2140 sync problem of col-width of table header when item add/remove + - [cmd] Fixed #2144 add cmds `select(all|none|invert)` + - [php:core] Fixed #2143 locale dependent version number problem + - And some minor bug fixes + + +2017-08-10 Naoki Sawada + + * elFinder (2.1.27): + - [php:core] Fixed #2104 notice error in `getIniBytes()` with php 7.1 + - [cmd:download] Fixed #2106 add an option `commandOptions.download.minFilesZipdl` + - [VD:abstract] enable to specify the path of server commands as constant + - [cmd:quicklook] Fixed #2108 support HLS, DASH video preview + - [cmd:open,quicklook] MIME type determination to case incentive + - [cmd:undo,redo] Fixed #2115 implement the Undo/Redo command + - [VD] Fixed #2120 item copy between volumes is incomplete + - [VD:Box,OneDrive] Fixed #2122 to be able to know the access token in debug mode + - [VD:abstract] Fixed #2107 do clearstatcache() in abstract class + - [cmd:help] Fixed #2118 controling to show/hide toolbar icons in preference tab + - [ui:dialog] Fixed #2123 problem in maximaize on fullscreen mode + - [ui:toolbar] add an option `showPreferenceButton` + - [cmd:rm] Fixed #2087 rm command not disable on unselect items + - [ui:dialog] Fixed #2124 missing dialog on fullscreen mode + - [cmd:resize] Fixed #2127 don't show "SaveAs" if new image saving is not allowed + - [VD:OneDrive] Fixed #2131 causes an infinite loop at the copy command + - And some minor bug fixes + + +2017-07-17 Naoki Sawada + + * elFinder (2.1.26): + - [php:core] Fixed #2069 add static method `elFinder::getApiFullVersion()` + - [js:core] Fixed #2073 auto loading of language files implemented in core + - [cmd:help] Fixed #2074 add the Preference tab + - [js:core] Fixed #2079 lost binded user functions with node.elfinder('reload') + - [cmd:help] Fixed #2076 problem of content area height synchronization + - [js:core] Fixed #2081 problem that updating of `uiCmdMap` + - [cmd:resize] Fixed #2085 "Save As" dose not work in 2.1.25 + - [cmd:rm] Fixed #2086 problem of cmd mode sync on the item selected + - [js:core] Fixed #2076 cancel full screen mode on `destroy` + - [cmd:rm] Fixed #2087 JavaScript error when hide `rm` icon in toolbar + - [cmd:netmount] Fixed #2088 problem of shows error dialog behind this dialog + - [cmd:rm] Fixed #2087 button icon label is wrong until boot up + - [php:connector] Supports X-Sendfile and similar file-download accelerators + - And some minor bug fixes + + +2017-06-23 Naoki Sawada + + * elFinder (2.1.25): + - [php] Fixed #2014 "Parse error" on PHP < 5.3 + - [core,API] Fixed #1431 cmd `edit` supports Data Uri Scheme + - [cmd:edit] Added Pixlr Editor, Pixlr Express, Cleative Cloud Image editor, Ace Editor, CodeMirror, SimpleMDE, CKEditor and TinyMCE as default editors + - [cmd:edit] Fixed #2020 add "Save As" button + - [cmd:resize] Fixed #2016 add Preset size buttons + - [cmd:resize] Fixed #2019 conflict with the bootstrap.js + - [CD:abstract] Fixed #2025 cannot edit any files with `memory_limit` = -1 + - [cmd:edit] Fixed #2027 make it selectable from multiple editors + - [VD:abstract,LocalFileSystem] Fixed #2035 support multipart rar extraction + - [VD:abstract] Fixed #2040 Fatal error on create the item with PHP>=7.1 + - [cmd:rm] Fixed #2042 add command options `infoCheckWait`, `toTrashMaxItems` + - [cmd:resize] Fixed #2043 add "Save As" button into the resize dialog + - [js:core] Fixed #2050 handling server errors during upload + - [VD:abstract] Fixed #2054 to use the same hash value as Linux on Windows server + - [js:restore] Fixed #2057 problem of empty folder handling + - [cmd:empty] Fixed #2061 add a new command `empty` - "Empty the folder" + - And some minor bug fixes + + +2017-05-19 Naoki Sawada + + * elFinder (2.1.24): + - [js:options] Fixed #1947 add client option `dispInlineRegex` for legacy connectors + - [js:options] Fixed #1948 separate uiOptions.toolbar extra options to uiOptions.toolbarExtra + - [js:core,php:core] Fixed #1951 set name to uploaded items from clipboard data + - [js:core,php:core] Fixed #1951 to IE and correction to Firefox + - [js:core] Fixed #1953 to selectable "Rename" when item name exists on upload + - [VD:abstract] Fixed #1952 urlencode of results file.url on upload + - [VD:abstract] Fixed #1959 add connector roots option `acceptedDirname` + - [js:core] Fixed #1965 add an option `heightBase` to client configuration + - [VD:abstract] Fixed #1974 add an option `driverId` (prefix of volumeid) + - [php:connector] Fixed #1975 possible XSS issue on debug mode of connector + - [VD:FTP] Fixed #1982 problem with connect to Pure-FTPd + - [php:plugin:Normalizer,Sanitizer] Fixed #1983 upload fails due to unnecessary conversion + - [cmd:quicklook] Fixed #1985 seek and volume change disabled in Firefox + - [js:core,cmd:rm,VD:trash] Fixed #1065 add "Trash" feature + - [php:core] Fixed #1990 sometimes in initial request, pass to bind callback `$volume` is empty + - [cmd:rm,trash,restore] Fixed #1991 implementation of restore function + - [js:core] Fixed #1996 pass an event object as `this` into binded callback + - [ui:tree] Fixed #1999 split display of many directories + - [js:core] Fixed #2005 prevent folder switching heavy as folders increase + - [VD:abstract] Fixed #2000 `elFinderVolumeDriver::imageUtil()` is not working properly + - [plugin:normalizer] Fixed #2004 add an option `umlauts + - [VD:LocalFileSystem] Fixed #2009 corrention of an option `keepTimestamp`(upload)` + - [ui:cwd,stat] Fixed #2010 sync problem when deleted any items in search results view + - And some minor bug fixes + + +2017-03-31 Naoki Sawada + + * elFinder (2.1.23): + - [VD:Dropbox2] Fixed #1598 add a driver of Dropbox APIv2 + - [js:core] change option `abortCmdsOnOpen` default value to `['tmb', 'parents'] + - [php:core,VD:abstract] add a command `subdirs` + - [js:core] add new method `asyncJob` + - [quicklook] optimize of HTML5 audio/video player + - [php:core,VD:abstract] Fixed problem of caching of subdirs + - [ui:tree] trigger `check subdirs()` if necessary of change targets + - [cmd:netmount] Fixed #1925 allow selection of multi-level hierarchy + - [ui,cmd] Fixed #1931 cmd.disabled is not working in multi-volume search + - [VD:GoogleDrive] Fixed #1932 support to auth type "JSON service account credentials" + - [VD:GoogleDrive] Fixed #1933 sometimes infinite loop if root path is other than root on GoogleDrive + - [js:core,ui:cwd,tree] add core method fm.getIconStyle() and use + - [cmd:quicklook,info] Fixed #1926 support i18 name, file.icon + - [Vd:abstract] allow -1 as value of option `checkSubfolders` for check asynchronously + - [ui:cwd] Fixed #1923 first letter search & navigation in cwd + - [VD:LocalFileSystem,FTP] Make success `extract()` by excluding unallowed items + - [ui:cwd] Fixed #1941 performance deterioration of the thumbnail attach process + - [js:core] Supports tag + - And some minor bug fixes + + +2017-02-25 Naoki Sawada + + * elFinder (2.1.22): + - [VD:LocalFileSystem] Fixed #1882 option `copyJoin` does not work on extract + - [cmd:help] Fixed #1898 error ".tabs is not a function" without JqUI tabs widget + - [VD:abstract] Fixed #1899 rotating image breaks itself without exiftran and jpegtran + - [VD:LocalFileSystem] Fixed #1910 `startPath` dose not work currently + - [VD:abstract] Fixed #1911 unable to rename folder + - And some minor bug fixes + + +2017-02-25 Naoki Sawada + + * elFinder (2.0.9): + - [VD:abstract] Fixed #1911 unable to rename folder + + +2017-02-09 Naoki Sawada + + * elFinder (2.0.8): + - [VD:security] Fixed #1891 MIME-type check of unknown item is not execute + + +2017-02-07 Naoki Sawada + + * elFinder (2.1.21): + - [cmd:open] Fixed #1844 make configurable to open into tab(s) + - [php:core] Fixed #1846 target folder may be stay locked by adding items + - [cmd:download] Fixed #1868 fixed up timeouts for bad connection download + - [proxy:v1] Fixed #1880 error on command `paste` + - [v1 support] Fixed #1884 error on command `reload` + - [cmd:upload] Fixed #1885 Error on upload.ui = 'uploadbutton' + - [VD:security] Fixed #1891 MIME-type check of unknown item is not execute + - And some minor bug fixes + + +2017-01-11 Naoki Sawada + + * elFinder (2.1.20): + - [php:core] Fixed #1800 session write before umount of the volume + - [cmd:upload] Fixed #1804 add folder upload button into upload dialog + - [php:plugin] Fixed #1807 enable/disable plugin by pressing meta key on DnD upload + - [cmd:rename] Fixed #1814 trigger event blur of input on item unselect + - [js:core] Fixed #1817 add "execpre.[cmd]" event and make cmd exec cancelable + - [js:core] Fixed #1818 mtime not defined for chunk upload + - [js:core] Fixed #1826 allow command invalidation by each item(folder/file) + - [ui:dialog] Fixed #1824 empty dialog on elfinder load + - [cmd:resize] Fixed #1834 configurable default state of `8px Grid` + - [VD] Fixed #1841 published files security issues + - [js:core] Fixed #1832 allow to set error message on HTTP status code 4/5xx + - [js:cmd] Fixed #1842 disable shortcut that specified to `disabled` + - [php:core] Fixed #1843 security vulnerability fix + + +2016-12-10 Naoki Sawada + + * elFinder (2.1.19): + - [js] Fixed #1000 Wrap compiled code in UMD (for commonJs and AMD support) + - [VD:OneDrive,Box] Fixed #1774 dose not work when PHP has `open_basedir` + - [cmd:edit,php:core] Fixed #1779 save contents with original character encoding + - [ui:toolbar] Fixed #1778 displayTextLabel option not works + - [cmd:edit] add encoding select box rel. #1779 + - [cmd:search] Fixed #1782 search by mimetype dose not work (>=2.1.16) + - [ui:dialog] Fixed #1785 trigger resize event with `maximize:on` in minimize element + - [VD:abstract] Fixed #1783 Illegal duplicate data as bind in duplicate command + - [cmd:edit] include elFinder instance as `fm` into `ta.editor` property + - [js:core] Fixed #1791 implement JS, CSS loader and auto load of elFinder CSS + - [cmd:resize] Fixed #1789 bug that crop image size is change while dragging + - [js:core] Fixed #1788 bug that chunked upload timeout processing is invalid + - [VD:abstract] Fixed #1799 uses `link()` in exec `zipdl` to more faster + - And some minor bug fixes + + +2016-11-21 Naoki Sawada + + * elFinder (2.1.18): + + - [VD:FTP] Fixed #1757 cause infinite loop with getting stat of second level items from system root + - [js:core] Fixed #1761 problem of chunk merge request on 2.1.17 + - [php:core] Fixed #1762 broken backward compatibility of PHP < 5.4 on 2.1.17 + - And some minor bug fixes + + +2016-11-19 Naoki Sawada + + * elFinder (2.1.17): + + - [cmd:upload] Fixed #1695 disabled check doesn't work in other than CWD volume + - [js:core] Fixed #1698 abort the file upload at network error occurs + - [ui:toolbar] Fixed #1699 add an option `displayTextLabel` (default: `false`) + - [css:toolbar] Fixed #1700 correction of button label for touch devices + - [ui:toolbar] add contextmenu to show/hide the text label + - [ui:workzone] Fixed #1702 cwd size fits to the workzone at resize + - [VD:abstract] Fixed #1703 problem of make the video thumbnail + - [core] Fixed #1706 configurable to limit max number of selectable items + - Added an option `maxTargets` of connector main option. + - [ui:cwd] Fixed #1701 No thumbnails after added the item (v 2.1.16) + - [cmd:download] Fixed #1707 allow zip download in multi volume searching + - Added native driver for GoogleDrive, OneDrive and Box (Special thanks to Raja Sharma) + - [cmd:netmount] Fixed #1713 OAuth of procedure is not completed on MS Edge + - [css:quicklook] Fixed #1717 preview html file won't scroll on IOS + - [cmd:upload] Fixed #1718 File upload on paste does not work + - [js:core] Fixed #1724 add client option `enableByMouseOver` + - [js:core] Fixed #1724 disable event `disable` with option `enableAlways=true` + - [js:core] Fixed #1724 optimize switching enable/disable for elf in iframe + - [cmd:getfile] Fixed #1727 wrong path when the tree is not loaded + - [cmd:quicklook] Fixed #1737 select next item after an item deleted + - [cmd:mkdir] Fixed #1739 Add 'new folder' action to tree context menu + - [VD:abstract,LocalFileSystem] Fixed #1744 results `url` must be urlencoded + - [js:core] Fixed #1738 retry uploading only on connection aborted + - [cmd:search] Fixed #1745 "onlyMimes" option invalid in search results + - [js:core] Fixed #1738 bug in the retry function on chunked uploading + - [php:plugin:AutoResize] Fixed #1746 add an option `forceEffect` (default:false) + - [js:core,cmd:quicklook] Fixed #1748 add client option `rawStringDecoder` + - And some minor bug fixes + + +2016-10-11 Naoki Sawada + + * elFinder (2.1.16): + - [cmd:info] Fixed #1652 add CSS class name `file.csscls` to icon + - [ui:cwd] Fixed #1653 JQUI.selectable does not work on items that has been added + - [js:core,cmd:info] Fixed #1652 add the item type `Volume Root` + - [js:core] Fixed #1656 wrong result `fm.convAbsUrl()` with location basename + - [php:core] Fixed #1658 to allow cancel cmd exec by [cmd].pre callback + - [js:code] Fixed #1659 not work in Mac/iOS safari private browsing mode + - [js:core] Fixed #1662 `[cmd]fail` event is fired at fail cmd execution + - [php:core] Fixed #1669 Fatal error in `detectFileExtension()` when URL upload + - [ui:dialog] Fixed #1670 add the minimize button into the editing dialog + - [ui:navbar] Fixed #1684 rtl right-panel resize bug + - [cmd:resize] Fixed #1685 to enable specify bgcolor in the image rotation + - [cmd:resize] Fixed #1686 add "Aspect ratio" button into crop panel + - [cmd:resize] add button "8px Grid" Enabled/Disabled for JPEG image + - [js:core] Fixed #1689 initialized to an undefined property + - [js:core] Fixed #1692 optimize function of swipe to close navbar + - [cmd:quicklook] Fixed #1693 `dispInlineRegex` doesn't reflect in multi volume searching + - And some minor bug fixes + + +2016-09-12 Naoki Sawada + + * elFinder (2.1.15): + - [js:command] inheritable elFinder.command object rel. #1545 + - [VD:abstract] Fixed #1550 option `uiCmdMap` dose not work on 2.1.14 + - [VD:abstract] Fixed #1553 root stat not refresh when do chmod of root + - [php:core] fix make netkey problem - support multiple array options + - [js:core] Fixed #1554 can not unmount netvolume when done auto sync + - [js:core] Fixed #1555 can not upload to unreadable folder + - [php:core] parent dir sets to changed when upload, paste, rm, mkfile, mkdir etc + - [js:core] Fixed #1560 to possible to apply sort mode in tree in navbar + - [js:ui,cmd:fullscreen] Fixed #1563 add ui command "fullscrren" + - [cmd:edit] Fixed #1561 add to fullscreen button + - [js:core] Fixed #1562 sort with i18 name if exist + - [js:options] ui option `commands` accepts "*" as all of commands + - [VD:LocalFileSystem] Fixed #1565 dose not support volume option `searchTimeout` + - [VD:FTP] Fixed #1571 cause infinite loop during auto-sync of the volume root + - [php:core] Fixed #1572 unable to DnD upload the folder named "0" + - [VD:abstract] Fixed #1575 can not rename "0" to "00", "000"... + - [cmd:rename] Fixed #1573 input text stay in there at rename error in tree view + - [ui:cwd] Fixed #1576 reset the column width may not applied to the header + - [ui:conttextmenu] Fixed #1578 to the contextmenu draggable + - [php,cmd:open] Fixed #1586 RFC7233 violation, add `commandsOptions.open.method` + - [ui:navbar,cwd] Fixed #1590 auto scroll on HTML5 native dragging + - [VD:Dropbox] Fixed #1596 correction of `basename`, `dirname` on the windows server + - [cmd:upload] Fixed #1600 add target folder selector into upload dialog + - [ui] Fixed #1609 toast notification on complete of upload/paste into any folder + - [cmd:getfile] Fixed #1610 getFileCallback to supports the jQuery.Deferred + - [cmd:rename] Fixed #1613 correction of error handling + - [js:core] Fixed #1614 correction of upload mixed chunks and normal file + - [ui:cwd] Fixed #1615 break the lazy rendering when it delete items + - [ui:tree] Fixed #1617 other volumes cmds doesn't work when it disabled in cwd + - [core] Fixed #1622 added an option `phash` to the volume roots for implement feature of volume group + - [ui:toolbar] Fixed #1619 use fm.trigger('toolbarload') instead toolbar.tigger('load') + - [js:options] Fixed #1624 add a new option `overwriteUploadConfirm` + - [cmd:search] Fixed #1635 support parallel requests for multi volumes + - [contextmenu] Fixed #1645 to enable the operation of the keyboard + - [ui:cwd] Fixed #1646 selected targets by ctrl+shift are wrong + - [ui:dialog] Fixed #1647 controlling tabstop by `elfinder-tabstop` css class name + - And some minor bug fixes + +2016-07-25 Naoki Sawada + + * elFinder (2.1.14): + - [js:core,VD:abstract] Fixed #1525 do MIME check before file upload + - [API] Accept the root options data as an attribute `options` of the root stat + - [ui:cwd] Fixed #1532 can not use the `_` in custom column name + - [js:command] Fixed #1533 update the cmd status at `sync` + - [core] Fixed #1012 support i18n folder name + - [ui:cwd] Fixed #1544 jQuery backward compatibility (fix DnD problem) + - [proxy:APIv1] Fixed #178 correction of command `paste` + - And some minor bug fixes + + +2016-07-11 Naoki Sawada + + * elFinder (2.1.13): + - [ui:cwd] Fixed #1433 create a thumbnail of the video file with ffmpeg + - [js:core] Fixed #1435 bug of getFileCallback on multi instances + - [ui:cwd] Fixed #1440 bug that not become disabled on multi instance + - [cmd:quicklook] Fixed #1441 hide the prev/next button on first/last item + - [js:core] Fixed #1439 show window close confirm dialog while editing file + - [ui:cwd] Fixed #1450 missing contextmenu on touch up on iOS devices + - [js] Fixed #1455 duplicate registration of command change event + - [ui:cwd] Fixed #1461 resizable table column width + - [cmd:sort] Fixed #1464 to enable more sort options + - [cmd:chmod] Fixed #1465 remove unnecessary `this` reference + - [ui:toolbar,navbar] Fixed #1473 memorize state of open/close by swipe + - [ui:cwd] Fixed #1475 make custom column sortable on list view + - [cmd:quicklook] Fixed #1478 preview broken with old jQuery + - [js:core] Fixed #1480 broken compatibility with protocol API v1 + - [cmd:opendir] Fixed #1481 broken in elFinder 2.1.12 + - [ui:cwd] Fixed #1479 can't be moved to the right edge at column sort + - [ui:cwd] Fixed #1485 add an option of template placeholders replacement rules + - [php:core] Fixed #1490 configurable root options of the network mounting volume + - [js] Fixed #1491 jQuery 3.0 supports + - [cmd:search] Fixed #1499 incremental search from current view items + - [cmd;resize] Fixed #1498 img-edit dialog layout disordered when resizing window + - [VD:abstract] Fixed #1505 configurable duplicate's suffix, unique numbe format + - [VD:abstract] Fixed #1507 add a volume option `dirUrlOwn` + - [VD:abstract] Fixed #1514 security vulnerability in the archive command + - And some minor bug fixes + + +2016-07-11 Naoki Sawada + + * elFinder (2.0.7): + - [VD:abstract] Fixed #1514 security vulnerability in the archive command + + +2016-05-30 Naoki Sawada + + * elFinder (2.1.12): + - Fixed #1321 Not trim white spaces on editing the text file + - Fixed #1320 Supported operation in the modal dialog + - Correction of the context menu (Mobile devices, Right-to-Left Language etc.) + - Correction of Quicklook (Supported 'video/quicktime', improvement of IFRAME, For Mobile devices etc) + - Fixed #1272 Correct detection of timestamp on FTP volume + - Fixed #1315 Implement function for `copyJoin` of the volume root option + - Fixed #1344 Use self image as thumbnail when without `imgLib` + - Fixed #1342 Bugfix of method `getFullPath` that was problems relative path can not be resolved + - Added a volume root option `uploadMaxConn` + - Maximum number of chunked upload connection. `-1` to disable chunked upload. + - Changed default value of volume root option `tmbBgColor` to 'transparent' + - Added a volume root option `bgColorFb` + - Image rotate fallback background color (defalt: #ffffff). Uses this color if it can not specify to transparent. + - Fixed #935 Supports `'convert'`(imagemagick) as `imgLib` + - Fixed #1363 Bugfix of FTP connect from windows localhost to remote server + - Fixed #1367 Bugfix of backward compatible to jQuery UI < 1.11 + - Mobile devices friendly + - Swipe to navbar/toolbar show/hide on touch devices + - Hide toolbar on mobile devices at initial view + - A little bigger icons + - Added item select checkboxes + - Path breadcrumbs move to top of workzone when hide navbar + - To enable resizing/cropping by touch events + - UX enhancements + - Fixed #1311 CWD list table with fixed fixed header + - UI path apply text-ellipsis in each holder name + - Fixed #1370 implemented function keep timestamp into LocalFileSystem volume driver + - Added PHP error handler and removed all `@` error-control operator + - Fixed #1391 take care 32bit system of chunked file uploading arg `cid` + - Fixed #1393 Added PHP class auto loader + - Fixed #1412 Enable auto scroll when navbar/cwd drag over + - And some minor bug fixes + + +2016-04-11 Naoki Sawada + + * elFinder (2.1.11): + - Added Archive(zip|gzip|tar) quicklook preview plugin + - DnD upload supports Microsoft Edge + - Fixed problem which directory is not detected in the LocalFileSystem driver (Bug of 2.1.10) + - And some minor bug fixes + + +2016-04-02 Naoki Sawada + + * elFinder (2.1.10): + - Fixed #1061, #1231 Supported controllable folder icons + - Fixed #1240 LocalFileSystem search files it was still follow symlinks + - Added new volume root option `searchExDirReg` for exclusion serach + - Return file.url in result on file upload for 3rd party uploader + - Supported elFinder API version 1 + - Added a new volume driver FlysystemGoogleDriveNetmount that based on flysystem-google-drive + - Added a new connector plugin "AutoRotate" + - And some minor bug fixes + + +2016-03-11 Naoki Sawada + + * elFinder (2.1.9): + - Fixed enbug of 2.1.6-2.1.7 PHP error undefind valiable/array to string conversion + - The function to make thumbnail supports more image types when Imagick enabled + - Correction of the problem that Archive / Extract function don't work well under some environment + - Added a quicklook plugin that is the Google docs online viewer + - Default is disabled. Set `commandsOptions.quicklook.googleDocsMimes` to enable this plugin. + ```javascript + commandsOptions : { + // "quicklook" command options. + quicklook : { + autoplay : true, + jplayer : 'extensions/jplayer', + // MIME types to use Google Docs online viewer + // Example array value + // ['application/pdf', 'image/tiff', 'application/msword', 'application/vnd.ms-excel', 'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'] + googleDocsMimes : [] + } + } + ``` + - And some minor bug fixes + + +2016-03-07 Naoki Sawada + + * elFinder (2.1.8): + - Added a new volume driver `MsSQL` + - Fixed #1226 problem of sort by clicking on cloumn headers + - Fixed #1229 bug of selection after sorting in list view + - Replaceable session handling wrapper (elFinderSessionInterface) + - Added Connector main config `defaultMimefile` () + - update mime.types + - Added LocalFileSystem volume root config `followSymLinks` (defailt true) + - And some minor bug fixes + + +2016-02-21 Naoki Sawada + + * elFinder (2.1.7): + - Added connector main options `commonTempPath` and `maxArcFilesSize` + - Fixed #353 It can download files/folders as an archve file + - Fixed #1195 Supported BMP in GD image resize + - Became possible to cancellation while searching + - Supported API protocol version 2.0 for the legacy connector + - Fixed #1206 Configurable places(favorites) (https://github.com/Studio-42/elFinder/issues/1206) + - Fixed #1211 Remove deprecated method jQueryUI.zIndex() + - Supported jQueryUI 1.12.0 + - Fixed #1213 infinite loop in PHP connector + - Cmd:mkdir to callable "New Folder with Selected items" as "Into New Folder" + - Supported nao-pon/flysystem-google-drive with barryvdh/elfinder-flysystem-driver + - barryvdh/elfinder-flysystem-driver (https://github.com/barryvdh/elfinder-flysystem-driver) + - nao-pon/flysystem-google-drive (https://github.com/nao-pon/flysystem-google-drive) + - UX improvement of in Touch devices + - And some minor bug fixes + + +2015-02-21 Naoki Sawada + + * elFinder (2.0.6): + - Fixed #1213 infinite loop in PHP connector + + +2016-01-19 Naoki Sawada + + * elFinder (2.1.6): + - Fixed #1074 startPath for multi volumes + - Fixed #1172 enbug-fix of rename command + - Fixed #1174 support for multi-instance on the same connector + - Plugin: AutoResize New option `preserveExif` + - Fixed #179 JPEG quality specifiable + - Fixed #1176 auto-sync check with HTTP long polling/inotifywait + - Fixed #1181 case insensitive search problem of LocalFileSystem driver + - Added an autosync button into contextmenu `Reload` + - Added new client configuration `syncStart` + - Search result view optimization + - Adddd new volume root option `searchTimeout` (default 30s) + - Added new crient command `opendir` - opens selected item's parent folder at search result + - Sortable "Places" (your favorites) + - Fixed #1193 open the file at direct URL if possible + - And some minor bug fixes + + +2015-12-26 Naoki Sawada + + * elFinder (2.1.5): + - Fixed bug that can't in writable with `chmod` + - Show remove item info in confirm dialog on `rm` action + - Fixed #1165, MIME types maintenance (doc, dot, xlt, xla) + - Fixed problem if filename included character that can't be json encode + - Added option `convmap` to Normalizer plugin + - And some minor bug fixes + + +2015-12-26 Naoki Sawada + + * elFinder (2.0.5): + - Fixed problem if filename included character that can't be json encode + + +2015-12-16 Naoki Sawada + + * elFinder (2.1.4): + - Fixed #1163 Dropbox driver supported windows server + - Fixed search problem on Windows server + + +2015-12-13 Naoki Sawada + + * elFinder (2.1.3): + - Auto configure `customHeaders`, `xhrFields` for CORS + - Allow set elFinder::$volumesCnt by HTTP header "X-elFinder-VolumesCntStart" + - Resolved #1145, Configurable keyboard shortcuts of any command + - Force non-overwrite on URL uploading + - Supported Drag out function with [Shift] + Drag of file item (with out IE) + - Drag and Drop copy from elFinder(A) to elFinder(B) + - Make list of download url to Text editor + - Drag and Drop download with Chrome (Single file only) + - etc. + - Choosable "backup" at pasting of same name files + - Show confirm at uploading of same name file exists + - Show URL link icon on Download menu in contextmenu + - This icon is clickable as normal link, shows context menu and drag out + - Added more feedback sign of jQuery DnD drag icon + - Others, some minor bug fixes + + +2015-11-23 Naoki Sawada + + * elFinder (2.1.2): + - [security-fix] vulnerability of the MIME type quarantine + - Multi-line filename editing on icon view + - Auto expands filename editing on list view + - Fixed #1124, Uploading problem exactly 20MiB/30MiB/40MiB... + - Marged #1125, Fix file permissions for MySQL LOAD_FILE command + - Fixed #1127, Supported full path including the drive letter of the Windows server + - Marged #1131, #1132, Complete Romanian(ro) translation + - Fixed symbolic link file stats `mtime`, `size` + - Marged #1133, Complete German(de) translation + - Marged #1139, Complete Türkçe(tr) translation + - Marged #1141, Plugin Normalizer function: make filename lowercase + - Others, some minor bug fixes + + +2015-11-23 Naoki Sawada + + * elFinder (2.0.4): + - [security-fix] vulnerability of the MIME type quarantine + + +2015-11-10 Naoki Sawada + + * elFinder (2.1.1): + - More High performance server backend and light client UI + - Connector plugin + - AutoResize : Auto resize on file upload. + - Normalizer : UTF-8 Normalizer of file-name and file-path etc. + - Sanitizer : Sanitizer of file-name and file-path etc. + - Watermark : Print watermark on file upload. + - Folder upload with Chrome + - Chunked file upload + - Upload directly to the folder + - Creating the archive by specifying the file name + - Direct extraction to the current working directory (you do not want to create a folder) + - Support Dropbox.com© (Configurable & As network volume) + - Supports custom information in info dialog + - Configuable columns of list view + - Supports custom CSS class function of tree view + + +2015-11-10 Naoki Sawada + + * elFinder (2.0.3): + - jQuery 1.9+ support + - 350+ bugs fixed since rc1 version + - Modify translations and some new translations + - Netmount volume function + + +2012-04-10 Troex Nevelin + + * elFinder (2.0 rc1): + - Major code refactor + - 200+ bugs fixed since beta version + - 14 new translations + - FTP volume driver + - Advanced image editing dialog + + +2011-07-10 Troex Nevelin + + * elFinder (2.0 beta): + - New branch 2.x, total rewrite from scratch + - MySQL volume driver support (as file storage) + - Full drag & drop support with HTML5 upload + + +2011-06-20 Troex Nevelin + + * elFinder (1.2): + - jQuery and UI updated + - Python connector improvements + - QuickLook fixed + - CSS fixes + - New icons from http://pixel-mixer.com/ + - New languages: Czech, Dutch, German, Greek, French, Hungarian, + Italian, Japanese, Latvian, Polish, Brazilian Portuguese, + Slovak, Thai, Turkish, Vietnamese, Simplified Chinese, + Traditional Chinese + + +2010-03-11 Troex Nevelin + + * elFinder (1.1): + - Total rewrite from scratch. + - New PHP connector. + - Python connector. + - Create/Extract archives. + - QuickLook. + - "Places" for favorites. + - Background thumbnails creation. + - Exteneded configuration options of connector and client. + - Spanish localization. + - JSON API description. + - Full documentation in English, Russian and Spanish. + - No more use of jquery plugins. + - Website update. + - [bugfix] All known bugs fixed. + + +2009-11-09 Dmitry Levashov + + * elFinder (1.0.1): + - In directory tree panel added arrows to open/close directories + without entering in. + - Added shortcut support for copy/cut/paste/delete files and + folders. For Mac users added Command+Backspace support. + - Added context menu to current directory. + - Added help. + - [bugfix] invalid determing files/folders permissions using + "perms" options in php connector + diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/LICENSE.md b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/LICENSE.md new file mode 100644 index 00000000..cb4ff9ed --- /dev/null +++ b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/LICENSE.md @@ -0,0 +1,15 @@ +elFinder is issued under a 3-clauses BSD license. + +Copyright (c) 2009-2016, Studio 42 +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the Studio 42 Ltd. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL "STUDIO 42" OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/README.md b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/README.md new file mode 100644 index 00000000..65bcc89e --- /dev/null +++ b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/README.md @@ -0,0 +1,206 @@ +elFinder +======== + +**WARNING: IF YOU HAVE OLDER VERSIONS OF ELFINDER ON PUBLIC SERVERS, IT MAY CAUSE SERIOUS DAMAGE TO YOUR SERVER AND VISITED USER. YOU SHOULD UPDATE TO THE LATEST VERSION OR REMOVE IT FROM THE SERVER.** + +
        +      _ ______ _           _           
        +     | |  ____(_)         | |          
        +  ___| | |__   _ _ __   __| | ___ _ __ 
        + / _ \ |  __| | | '_ \ / _` |/ _ \ '__|
        +|  __/ | |    | | | | | (_| |  __/ |   
        + \___|_|_|    |_|_| |_|\__,_|\___|_|   
        +
        + +elFinder is an open-source file manager for web, written in JavaScript using +jQuery UI. Creation is inspired by simplicity and convenience of Finder program +used in Mac OS X operating system. + +[![Download now!](http://studio-42.github.io/elFinder/images/download-icon.png)](https://github.com/Studio-42/elFinder/releases/latest) +[![Packagist License](https://poser.pugx.org/studio-42/elfinder/license.png)](http://choosealicense.com/licenses/bsd-3-clause/) +[![Latest Stable Version](https://poser.pugx.org/studio-42/elfinder/version.png)](https://packagist.org/packages/studio-42/elfinder) +[![Total Downloads](https://poser.pugx.org/studio-42/elfinder/d/total.png)](https://packagist.org/packages/studio-42/elfinder) +[![CDNJS version](https://img.shields.io/cdnjs/v/elfinder.svg)](https://cdnjs.com/libraries/elfinder) + +Contents +-------- +* [Branches](#branches) +* [Features](#features) +* [Requirements](#requirements) +* [Installation](#installation) +* [Downloads](#downloads) +* [Demo Sites](#demo-sites) +* [FAQs](#faqs) +* [3rd Party Connectors](#3rd-party-connectors) +* [3rd Party Volume Drivers](#3rd-party-volume-drivers) +* [3rd Party Themes](#3rd-party-themes) +* [Support](#support) +* [Authors](#authors) +* [License](#license) + +Branches +-------- +- [master](https://github.com/Studio-42/elFinder/tree/master) - Main development branch +- [2.1-src](https://github.com/Studio-42/elFinder/tree/2.1-src) - 2.1 development branch, auto build to 2.1 on commit +- [2.1](https://github.com/Studio-42/elFinder/tree/2.1) - 2.1 nightly build branch + +Features +-------- + * Usability like the MacOS Finder or Windows Explorer + * Mobile friendly view for touch devices + * All operations with files and folders on a remote server (copy, move, + upload, create folder/file, rename, etc.) + * High performance server backend and light client UI + * Multi-root support + * Local file system, MySQL, FTP volume storage drivers + * Cloud strage (Box, Dropbox, GoogleDrive and OneDrive) drivers + * Background file/folder upload with Drag & Drop HTML5 support + * Chunked file upload for large file + * Upload directly to the folder + * Upload form URL (or list) + * List and Icons view + * Keyboard shortcuts + * Standard methods of file/group selection using mouse or keyboard + * Move/Copy files with Drag & Drop + * Drag & Drop to outside by starting drag with alt/option key press + * Archives create/extract (zip, rar, 7z, tar, gzip, bzip2) + * Rich context menu and toolbar + * Quicklook, preview for common file types + * Edit text files and images + * "Places" for your favorites + * Calculate directory sizes + * Thumbnails for image, movie files + * Easy to integrate with web editors (elRTE, CKEditor, TinyMCE) + * Flexible configuration of access rights, upload file types, user interface + and other + * Extensibility by event handling of backend and client side + * Simple client-server API based on JSON + * Supports custom information in info dialog + * Configuable columns of list view + * Supports custom CSS class function for the custom folder icon + * Connector plugin + * [AutoRotate](https://github.com/Studio-42/elFinder/blob/2.1-src/php/plugins/AutoRotate/plugin.php) : Auto rotation on file upload of JPEG file by EXIF Orientation. + * [AutoResize](https://github.com/Studio-42/elFinder/blob/2.1-src/php/plugins/AutoResize/plugin.php) : Auto resize on file upload. + * [Normalizer](https://github.com/Studio-42/elFinder/blob/2.1-src/php/plugins/Normalizer/plugin.php) : UTF-8 Normalizer of file-name and file-path etc. + * [Sanitizer](https://github.com/Studio-42/elFinder/blob/2.1-src/php/plugins/Sanitizer/plugin.php) : Sanitizer of file-name and file-path etc. + * [Watermark](https://github.com/Studio-42/elFinder/blob/2.1-src/php/plugins/Watermark/plugin.php) : Print watermark on file upload. + * For more details, see the [Changelog](https://github.com/Studio-42/elFinder/blob/master/Changelog) + +Requirements +------------ +### jQuery / jQuery UI + * jQuery 1.8.0+ + * jQuery UI 1.9.0+ + +**However, we recommend newest version.** + +### Client + * Modern browser. elFinder was tested in Internet Explorer 8 + and newest Firefox, Chrome, IE, Edge and Opera + +### Server + * Any web server + * PHP 5.2+ (Recommend PHP 5.4 or higher) And for thumbnails - GD / Imagick module / convert(imagemagick) require + +Installation +------------ +### Builds (compressed) + 1. Download and unzip one of the [builds](#downloads) below to your PHP server + 2. Rename `/php/connector.minimal.php-dist` to `/php/connector.minimal.php` + 3. Load `/elfinder.html` in your browser to run elFinder + +### Source (uncompressed) + 1. Clone this repository to your PHP server + + ``` + $ git clone https://github.com/Studio-42/elFinder.git + ``` + + 2. Rename `/php/connector.minimal.php-dist` to `/php/connector.minimal.php` + 3. Load `/elfinder.src.html` in your browser to run elFinder + +### Installer + - [Setup elFinder 2.1.x nightly with Composer](https://github.com/Studio-42/elFinder/tree/gh-pages/tools/installer/setup_with_composer) + +Downloads +------------ +**Stable releases** ([Changelog](https://github.com/Studio-42/elFinder/blob/master/Changelog)) + + [elFinder 2.1.28](https://github.com/Studio-42/elFinder/archive/2.1.28.zip) + + [elFinder 2.0.9](https://github.com/Studio-42/elFinder/archive/2.0.9.zip) (deprecated) + +**Nightly builds** + + [elFinder 2.1.x (Nightly)](https://github.com/Studio-42/elFinder/archive/2.1.zip) + +Demo sites +------------ +**2.1.x Nightly** + + https://studio-42.github.io/elFinder/ (with CORS) + + https://hypweb.net/elFinder-nightly/demo/2.1/ + +FAQs +------------ + +### Should I use elFinder builds (compressed) or source (uncompressed)? + +For debugging and development, use the [source](#source-uncompressed). For production, use [builds](#builds-compressed). + +### How do I integrate elFinder with CKEditor/TinyMCE/elRTE/etc...? +Check out the [wiki](https://github.com/studio-42/elFinder/wiki#howtos) for individual instructions. + +### The procedure of language files created or modified? + +You can create or modify the language file to use translation tool. Please refer to the pull request the results to the respective branch. + * [2.1 branch translation tool](http://studio-42.github.io/elFinder/tools/langman/#2.1) + + +3rd party connectors +-------------------- + * [ASP.NET](https://github.com/leniel/elFinder.Net) + * [ASP.NET Core](https://github.com/gordon-matt/elFinder.NetCore) + * [Java Servlet](https://github.com/trustsystems/elfinder-java-connector) + * [Python](https://github.com/Studio-42/elfinder-python) + * [Ruby/Rails](https://github.com/phallstrom/el_finder) + * [Django](https://github.com/mikery/django-elfinder) + * [Laravel](https://github.com/barryvdh/laravel-elfinder) + * [JavaScript/Efw](https://github.com/efwGrp/efw3.X/blob/master/help/api_efw_tag.md#elfinder-tag) + * [Symfony](https://github.com/helios-ag/FMElfinderBundle) + +3rd party Volume Drivers +-------------------- + * [League\Flysystem (PHP)](https://github.com/barryvdh/elfinder-flysystem-driver) (for elFinder 2.1+) + +3rd party Themes +-------------------- +Hint: [How to load CSS with RequireJS?](https://github.com/Studio-42/elFinder/wiki/How-to-load-CSS-with-RequireJS%3F) + + * [lokothodida/elfinder-theme-moono](https://github.com/lokothodida/elfinder-theme-moono) + * [lokothodida/elfinder-theme-windows-10](https://github.com/lokothodida/elfinder-theme-windows-10) + * [StudioJunkyard/elfinder-boostrap-theme](https://github.com/StudioJunkyard/LibreICONS/tree/master/themes/elFinder) + * [RobiNN1/elFinder-Material-Theme](https://github.com/RobiNN1/elFinder-Material-Theme) + +Support +------- + + * [Homepage](http://elfinder.org) + * [Wiki](https://github.com/Studio-42/elFinder/wiki) + * [Issues](https://github.com/Studio-42/elFinder/issues) + * + + +Authors +------- + + * Chief developer: Dmitry "dio" Levashov + * Maintainer: Troex Nevelin + * Developers: Alexey Sukhotin , Naoki Sawada + * Icons: [PixelMixer](http://pixelmixer.ru), [Yusuke Kamiyamane](http://p.yusukekamiyamane.com) + +We hope our tools will be helpful for you. + + +License +------- + +elFinder is issued under a 3-clauses BSD license. + + * [License terms](https://github.com/Studio-42/elFinder/blob/master/LICENSE.md) diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/css/elfinder.full.css b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/css/elfinder.full.css new file mode 100644 index 00000000..2b25a48b --- /dev/null +++ b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/css/elfinder.full.css @@ -0,0 +1,3124 @@ +/*! + * elFinder - file manager for web + * Version 2.1.28 (2017-08-17) + * http://elfinder.org + * + * Copyright 2009-2017, Studio 42 + * Licensed under a 3-clauses BSD license + */ + +/* File: /css/commands.css */ +/******************************************************************/ +/* COMMANDS STYLES */ +/******************************************************************/ + +/********************** COMMAND "RESIZE" ****************************/ +.elfinder-dialog-resize { margin-top:.3em; } +.elfinder-resize-type { float:left; margin-bottom: .4em; } +.elfinder-resize-control { float: left; } +.elfinder-resize-control input[type=text] { + border:1px solid #aaa; + text-align: right; + width: 4em; +} +.elfinder-resize-control input.elfinder-resize-bg { + text-align: center; + width: 5em; + direction: ltr; +} +.elfinder-dialog-resize .elfinder-resize-imgrotate, +.elfinder-dialog-resize .elfinder-resize-pallet { + cursor: pointer; +} +.elfinder-dialog-resize .elfinder-resize-picking { + cursor: crosshair; +} +.elfinder-dialog-resize .elfinder-resize-grid8 + button { + padding-top: 2px; + padding-bottom: 2px; +} +.elfinder-resize-preview { + width:400px; + height:400px; + padding:10px; + background:#fff; + border:1px solid #aaa; + float:right; + position:relative; + overflow:hidden; + text-align: left; + direction: ltr; +} + +.elfinder-resize-handle { position:relative;} + +.elfinder-resize-handle-hline, +.elfinder-resize-handle-vline { + position:absolute; + background-image:url("../img/crop.gif"); +} + +.elfinder-resize-handle-hline { + width:100%; + height:1px !important; + background-repeat:repeat-x; +} +.elfinder-resize-handle-vline { + width:1px !important; + height:100%; + background-repeat:repeat-y; +} + +.elfinder-resize-handle-hline-top { top:0; left:0; } +.elfinder-resize-handle-hline-bottom { bottom:0; left:0; } +.elfinder-resize-handle-vline-left { top:0; left:0; } +.elfinder-resize-handle-vline-right { top:0; right:0; } + +.elfinder-resize-handle-point { + position:absolute; + width:8px; + height:8px; + border:1px solid #777; + background:transparent; +} + +.elfinder-resize-handle-point-n { + top:0; + left:50%; + margin-top:-5px; + margin-left:-5px; +} +.elfinder-resize-handle-point-ne { + top:0; + right:0; + margin-top:-5px; + margin-right:-5px; +} +.elfinder-resize-handle-point-e { + top:50%; + right:0; + margin-top:-5px; + margin-right:-5px; +} +.elfinder-resize-handle-point-se { + bottom:0; + right:0; + margin-bottom:-5px; + margin-right:-5px; +} +.elfinder-resize-handle-point-s { + bottom:0; + left:50%; + margin-bottom:-5px; + margin-left:-5px; +} +.elfinder-resize-handle-point-sw { + bottom:0; + left:0; + margin-bottom:-5px; + margin-left:-5px; +} +.elfinder-resize-handle-point-w { + top:50%; + left:0; + margin-top:-5px; + margin-left:-5px; +} +.elfinder-resize-handle-point-nw { + top:0; + left:0; + margin-top:-5px; + margin-left:-5px; +} + +.elfinder-resize-spinner { + position:absolute; + width:200px; + height:30px; + top:50%; + margin-top:-25px; + left:50%; + margin-left:-100px; + text-align:center; + background:url(../img/progress.gif) center bottom repeat-x; +} + +.elfinder-resize-row { margin-bottom:9px; position:relative;} + +.elfinder-resize-label { float:left; width:80px; padding-top: 3px; } + +.elfinder-resize-checkbox-label { border: 1px solid transparent; } + +.elfinder-dialog .elfinder-dialog-resize .elfinder-resize-whctrls { + margin: -20px 5px 0 5px; +} +.elfinder-ltr .elfinder-dialog .elfinder-dialog-resize .elfinder-resize-whctrls { + float: right; +} +.elfinder-rtl .elfinder-dialog .elfinder-dialog-resize .elfinder-resize-whctrls { + float: left; +} + +.elfinder-dialog .elfinder-dialog-resize .ui-resizable-e, +.elfinder-dialog .elfinder-dialog-resize .ui-resizable-w { + height:100%; + width:10px; +} +.elfinder-dialog .elfinder-dialog-resize .ui-resizable-s, +.elfinder-dialog .elfinder-dialog-resize .ui-resizable-n { + width:100%; + height:10px; +} +.elfinder-dialog .elfinder-dialog-resize .ui-resizable-e { margin-right: -7px; } +.elfinder-dialog .elfinder-dialog-resize .ui-resizable-w { margin-left: -7px; } +.elfinder-dialog .elfinder-dialog-resize .ui-resizable-s { margin-bottom: -7px; } +.elfinder-dialog .elfinder-dialog-resize .ui-resizable-n { margin-top: -7px; } + +.elfinder-dialog .elfinder-dialog-resize .ui-resizable-se, +.elfinder-dialog .elfinder-dialog-resize .ui-resizable-sw, +.elfinder-dialog .elfinder-dialog-resize .ui-resizable-ne, +.elfinder-dialog .elfinder-dialog-resize .ui-resizable-nw { + width: 10px; + height: 10px; +} +.elfinder-dialog .elfinder-dialog-resize .ui-resizable-se { + background:transparent; + bottom:0; + right:0; + margin-right:-7px; + margin-bottom:-7px; +} +.elfinder-dialog .elfinder-dialog-resize .ui-resizable-sw { + margin-left: -7px; + margin-bottom: -7px; +} +.elfinder-dialog .elfinder-dialog-resize .ui-resizable-ne { + margin-right:-7px; + margin-top:-7px; +} +.elfinder-dialog .elfinder-dialog-resize .ui-resizable-nw { + margin-left: -7px; + margin-top: -7px; +} + +.elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-s, +.elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-n { + height: 20px; +} +.elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-e, +.elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-w { + width: 20px; +} +.elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-se, +.elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-sw, +.elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-ne, +.elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-nw { + width: 30px; + height: 30px; +} +.elfinder-touch .elfinder-dialog .elfinder-dialog-resize .elfinder-resize-preview .ui-resizable-se { + width: 30px; + height: 30px; + zoom: 1; + margin: 0; +} +.elfinder-dialog-resize .ui-icon-grip-solid-vertical { + position:absolute; + top:50%; + right:0; + margin-top:-8px; + margin-right:-11px; +} +.elfinder-dialog-resize .ui-icon-grip-solid-horizontal { + position:absolute; + left:50%; + bottom:0; + margin-left:-8px; + margin-bottom:-11px;; +} + +.elfinder-dialog-resize .elfinder-resize-row .ui-buttonset { + float:right; +} + +.elfinder-dialog-resize .elfinder-resize-degree input, +.elfinder-dialog-resize .elfinder-resize-quality input { + width: 2.5em; +} +.elfinder-dialog-resize .elfinder-resize-degree button.ui-button { + padding: 6px 8px; +} +.elfinder-dialog-resize button.ui-button span { + padding: 0; +} + +.ui-widget-content .elfinder-dialog-resize .elfinder-resize-rotate-slider { + width: 195px; + margin: 10px 7px; + background-color: #fafafa; +} + +.elfinder-dialog-resize .elfinder-resize-type span.ui-checkboxradio-icon { + display: none; +} + +.elfinder-resize-preset-container { + box-sizing: border-box; + border-radius: 5px; +} + +/********************** COMMAND "EDIT" ****************************/ +/* edit text file textarea */ +.elfinder-file-edit { + width:100%; + height:99%; + margin:0; + padding:2px; + border:1px solid #ccc; + box-sizing: border-box; + resize: none; +} +.elfinder-touch .elfinder-file-edit { + font-size: 16px; +} +/* bottom margen for softkeyboard on fullscreen mode */ +.elfinder-touch.elfinder-fullscreen-native textarea.elfinder-file-edit { + padding-bottom: 20em; + margin-bottom: -20em; +} +.std42-dialog .ui-dialog-titlebar select { font-size: 12px; } +.std42-dialog .ui-dialog-buttonpane .elfinder-dialog-confirm-encoding { font-size: 12px; } + + +/********************** COMMAND "SORT" ****************************/ +/* for list table header sort triangle icon */ +div.elfinder-cwd-wrapper-list tr.ui-state-default td { + position: relative; +} +div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon { + position: absolute; + top: 4px; + left: 0; + right: 0; + margin: auto 0px auto auto; +} +.elfinder-touch div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon { + top: 7px; +} +.elfinder-rtl div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon { + margin: auto auto auto 0px; +} +/********************** COMMAND "HELP" ****************************/ +/* help dialog */ +.elfinder-help { margin-bottom:.5em; } + +/* fix tabs */ +.elfinder-help .ui-tabs-panel { + padding:.5em; + overflow: auto; + padding: 10px; +} +.elfinder-dialog .ui-tabs .ui-tabs-nav li a { padding:.2em 1em;} + +.elfinder-help-shortcuts { + height: auto; + padding: 10px; + margin: 0; + box-sizing: border-box; +} +.elfinder-help-shortcut { white-space:nowrap; clear:both;} + +.elfinder-help-shortcut-pattern { float:left; width:160px;} + +.elfinder-help-logo { + width:100px; + height:96px; + float:left; + margin-right:1em; + background:url('../img/logo.png') center center no-repeat; +} + +.elfinder-help h3 { font-size:1.5em; margin:.2em 0 .3em 0; } + +.elfinder-help-separator { clear:both; padding:.5em; } + +.elfinder-help-link { padding:2px; } + +.elfinder-help .ui-priority-secondary { font-size:.9em;} + +.elfinder-help .ui-priority-primary { margin-bottom:7px;} + +.elfinder-help-team { + clear: both; + text-align:right; + border-bottom:1px solid #ccc; + margin:.5em 0; + font-size:.9em; +} + +.elfinder-help-team div { float:left; } +.elfinder-help-license { font-size:.9em;} + +.elfinder-help-disabled { + font-weight:bold; + text-align:center; + margin:90px 0; +} + +.elfinder-help .elfinder-dont-panic { + display:block; + border:1px solid transparent; + width:200px; + height:200px; + margin:30px auto; + text-decoration:none; + text-align:center; + position:relative; + background:#d90004; + -moz-box-shadow: 5px 5px 9px #111; + -webkit-box-shadow: 5px 5px 9px #111; + box-shadow: 5px 5px 9px #111; + background: -moz-radial-gradient(80px 80px, circle farthest-corner, #d90004 35%, #960004 100%); + background: -webkit-gradient(radial, 80 80, 60, 80 80, 120, from(#d90004), to(#960004)); + -moz-border-radius: 100px; + -webkit-border-radius: 100px; + border-radius: 100px; + outline:none; +} + +.elfinder-help .elfinder-dont-panic span { + font-size:3em; + font-weight:bold; + text-align:center; + color:#fff; + position:absolute; + left:0; + top:45px; +} + +.elfinder-help-debug { + height:100%; + padding:0; + margin:0; + overflow:none; + border: none; +} + +.elfinder-help-debug .ui-tabs-panel { + padding: 0; + margin: 0; + overflow:auto; +} + +.elfinder-help-debug fieldset { + margin-bottom: 10px; + border-color: #778899; + border-radius: 10px; +} + +.elfinder-help-debug legend { + font-size: 1.2em; + font-weight: bold; + color: #2e8b57; +} + +.elfinder-help-debug dl { + margin: 0; +} + +.elfinder-help-debug dt { + color: #778899; +} + +.elfinder-help-debug dt:before { + content: "["; +} +.elfinder-help-debug dt:after { + content: "]"; +} + +.elfinder-help-debug dd { + margin-left: 1em; +} + +.elfinder-help-debug dd span { + /*font-size: 1.2em;*/ +} + +.elfinder-help-preference { + padding: 10px; + height: auto; + min-height: 100%; + box-sizing: border-box; +} + +.elfinder-help-preference dl { + width: 100%; +} +.elfinder-help-preference dt { + display: block; + width: 200px; + clear: left; + float: left; + max-width: 50%; +} +.elfinder-rtl .elfinder-help-preference dt { + clear: right; + float: right; +} +.elfinder-help-preference dd { + margin-bottom: 1em; +} +.elfinder-help-preference dd label, +.elfinder-help-preference dd input[type=checkbox] { + white-space: nowrap; + display: inline-block; + cursor: pointer; +} + +/********************** COMMAND "INFO" ****************************/ +.elfinder-info-title .elfinder-cwd-bgurl:after { + left: -28px; +} +.elfinder-info-title .elfinder-cwd-icon-video:after { + left: -7px; +} + +/********************** COMMAND "UPLOAD" ****************************/ +.elfinder-upload-dialog-wrapper .elfinder-upload-dirselect { + position: absolute; + bottom: 2px; + width: 16px; + height: 16px; + padding: 10px; + border: none; + overflow: hidden; + cursor: pointer; +} +.elfinder-ltr .elfinder-upload-dialog-wrapper .elfinder-upload-dirselect { + left: 2px; +} +.elfinder-rtl .elfinder-upload-dialog-wrapper .elfinder-upload-dirselect { + right: 2px; +} + +/* File: /css/common.css */ +/*********************************************/ +/* COMMON ELFINDER STUFFS */ +/*********************************************/ + +/* for old jQuery UI */ +.ui-front { + z-index: 100; +} + +/* common container */ +.elfinder { + padding: 0; + position:relative; + display:block; + visibility: visible; + font-size: 18px; + font-family: Verdana,Arial,Helvetica,sans-serif; +} + +/* in lazy execution status */ +.elfinder.elfinder-processing * { + cursor: progress !important +} +.elfinder.elfinder-processing.elfinder-touch .elfinder-workzone:after { + position: absolute; + top: 0; + width: 100%; + height: 3px; + content: ''; + left: 0; + background-image: url(../img/progress.gif); + opacity: .6; + pointer-events: none; +} + +/* for disable select of Touch devices */ +.elfinder *:not(input):not(textarea):not(select):not([contenteditable=true]), +.elfinder-contextmenu *:not(input):not(textarea):not(select):not([contenteditable=true]) { + -webkit-tap-highlight-color: rgba(0,0,0,0); + /*-webkit-touch-callout:none;*/ + -webkit-user-select: none; + -moz-user-select: none; + -khtml-user-select: none; + user-select: none; +} + +.elfinder .overflow-scrolling-touch { + -webkit-overflow-scrolling: touch; +} + +/* right to left enviroment */ +.elfinder-rtl { text-align:right; direction:rtl; } + +/* nav and cwd container */ +.elfinder-workzone { + padding: 0; + position:relative; + overflow:hidden; +} + +/* dir/file permissions and symlink markers */ +.elfinder-lock, +.elfinder-perms, +.elfinder-symlink { + position:absolute; + width:16px; + height:16px; + background-image:url(../img/toolbar.png); + background-repeat:no-repeat; + background-position:0 -528px; +} + +.elfinder-symlink { } + +/* noaccess */ +.elfinder-na .elfinder-perms { background-position:0 -96px; } + +/* read only */ +.elfinder-ro .elfinder-perms { background-position:0 -64px;} + +/* write only */ +.elfinder-wo .elfinder-perms { background-position:0 -80px;} + +/* volume type group */ +.elfinder-group .elfinder-perms { background-position:0 0px;} + +/* locked */ +.elfinder-lock { + background-position:0 -656px; +} + +/* drag helper */ +.elfinder-drag-helper { + top: 0px; + left: 0px; + width:70px; + height:60px; + padding:0 0 0 25px; + z-index:100000; + will-change: left, top; +} +.elfinder-drag-helper.html5-native { + position: absolute; + top: -1000px; + left: -1000px; +} + +/* drag helper status icon (default no-drop) */ +.elfinder-drag-helper-icon-status { + position:absolute; + width:16px; + height:16px; + left:42px; + top:60px; + background:url('../img/toolbar.png') 0 -96px no-repeat; + display: block; +} + +/* show "up-arrow" icon for move item */ +.elfinder-drag-helper-move .elfinder-drag-helper-icon-status { + background-position:0 -720px; +} +/* show "plus" icon when ctrl/shift pressed */ +.elfinder-drag-helper-plus .elfinder-drag-helper-icon-status { + background-position:0 -544px; +} + +/* files num in drag helper */ +.elfinder-drag-num { + position:absolute; + top:0; + left:0; + width:16px; + height:14px; + text-align:center; + padding-top:2px; + + font-weight:bold; + color:#fff; + background-color:red; + -moz-border-radius: 8px; + -webkit-border-radius: 8px; + border-radius: 8px; +} + +/* icon in drag helper */ +.elfinder-drag-helper .elfinder-cwd-icon { margin:0 0 0 -24px; float:left; } + +/* transparent overlay */ +.elfinder-overlay { + position: absolute; + opacity: .2; + filter: Alpha(Opacity=20); +} + +/* panels under/below cwd (for search field etc) */ +.elfinder .elfinder-panel { + position:relative; + background-image:none; + padding:7px 12px; +} + +/* for html5 drag and drop */ +[draggable=true] { + -khtml-user-drag: element; +} + +/* for place holder to content editable elements */ +.elfinder [contentEditable=true]:empty:not(:focus):before { + content:attr(data-ph); +} + +/* bottom tray */ +.elfinder div.elfinder-bottomtray { + position: fixed; + bottom: 0; + max-width:100%; + opacity: .8; +} +.elfinder.elfinder-ltr div.elfinder-bottomtray { + left: 0; +} +.elfinder.elfinder-rtl div.elfinder-bottomtray { + right: 0; +} + +/* File: /css/contextmenu.css */ +/* menu and submenu */ +.elfinder .elfinder-contextmenu, +.elfinder .elfinder-contextmenu-sub { + position:absolute; + border:1px solid #aaa; + background:#fff; + color:#555; + padding:4px 0; + top: 0; + left: 0; +} + +/* submenu */ +.elfinder .elfinder-contextmenu-sub { top:5px; } +/* submenu in rtl/ltr enviroment */ +.elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-sub { margin-left:-5px; } +.elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-sub { margin-right:-5px; } + +/* menu item */ +.elfinder .elfinder-contextmenu-header { + margin-top: -4px; + padding: 0 .5em .2ex; + border: none; + text-align: center; +} +.elfinder .elfinder-contextmenu-header span { + font-weight: normal; + font-size: 0.8em; + font-weight: bolder; +} +.elfinder .elfinder-contextmenu-item { + position:relative; + display:block; + padding:4px 30px; + text-decoration:none; + white-space:nowrap; + cursor:default; +} +.elfinder .elfinder-contextmenu-item.ui-state-active { + border: none; +} +.elfinder .elfinder-contextmenu-item .ui-icon { + width:16px; + height:16px; + position:absolute; + left:auto; + right:auto; + top:50%; + margin-top:-8px; +} +.elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-item .ui-icon { + left: 2px; +} +.elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-item .ui-icon { + right: 2px; +} +.elfinder-touch .elfinder-contextmenu-item { + padding:12px 38px; +} + +/* root icon of each volume */ +.elfinder-navbar-root-local.elfinder-contextmenu-icon { background-image:url("../img/volume_icon_local.png"); } +.elfinder-navbar-root-ftp.elfinder-contextmenu-icon { background-image:url("../img/volume_icon_ftp.png"); } +.elfinder-navbar-root-sql.elfinder-contextmenu-icon { background-image:url("../img/volume_icon_sql.png"); } +.elfinder-navbar-root-dropbox.elfinder-contextmenu-icon { background-image:url("../img/volume_icon_dropbox.png"); } +.elfinder-navbar-root-googledrive.elfinder-contextmenu-icon { background-image:url("../img/volume_icon_googledrive.png"); } +.elfinder-navbar-root-onedrive.elfinder-contextmenu-icon { background-image:url("../img/volume_icon_onedrive.png"); } +.elfinder-navbar-root-box.elfinder-contextmenu-icon { background-image:url("../img/volume_icon_box.png"); } + +/* text in item */ +.elfinder .elfinder-contextmenu .elfinder-contextmenu-item span { display:block; } + +/* submenu item in rtl/ltr enviroment */ +.elfinder .elfinder-contextmenu-sub .elfinder-contextmenu-item { padding-left:12px; padding-right:12px; } +.elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-item { text-align:left; } +.elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-item { text-align:right; } +.elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-sub .elfinder-contextsubmenu-item-icon { padding-left:28px; } +.elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-sub .elfinder-contextsubmenu-item-icon { padding-right:28px; } +.elfinder-touch .elfinder-contextmenu-ltr .elfinder-contextmenu-sub .elfinder-contextsubmenu-item-icon { padding-left:36px; } +.elfinder-touch .elfinder-contextmenu-rtl .elfinder-contextmenu-sub .elfinder-contextsubmenu-item-icon { padding-right:36px; } + +/* command/submenu icon */ +.elfinder .elfinder-contextmenu-extra-icon, +.elfinder .elfinder-contextmenu-arrow, +.elfinder .elfinder-contextmenu-icon { + position:absolute; + top:50%; + margin-top:-8px; + overflow: hidden; +} + +/* command icon in rtl/ltr enviroment */ +.elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-icon { left:8px; } +.elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-icon { right:8px; } +.elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-extra-icon { right:8px; } +.elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-extra-icon { left:8px; } + +/* arrow icon */ +.elfinder .elfinder-contextmenu-arrow { + width:16px; + height:16px; + background:url('../img/arrows-normal.png') 5px 4px no-repeat; +} + +/* arrow icon in rtl/ltr enviroment */ +.elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-arrow { right:5px; } +.elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-arrow { left:5px; background-position: 0 -10px; } + +/* command extra icon's , tag */ +.elfinder .elfinder-contextmenu-extra-icon a, +.elfinder .elfinder-contextmenu-extra-icon span { + display: inline-block; + width: 100%; + height: 100%; + padding: 20px; + margin: 0; + color: transparent !important; + text-decoration: none; + cursor: pointer; +} + +/* disable ui border/bg image on hover */ +.elfinder .elfinder-contextmenu .ui-state-hover { border:0 solid; background-image:none;} + +/* separator */ +.elfinder .elfinder-contextmenu-separator { + height:0px; + border-top:1px solid #ccc; + margin:0 1px; +} + +/* for CSS style priority to ui-state-disabled - "background-image: none" */ +.elfinder .elfinder-button-icon.ui-state-disabled { + background-image: url('../img/toolbar.png') !important; +} +/* File: /css/cwd.css */ +/******************************************************************/ +/* CURRENT DIRECTORY STYLES */ +/******************************************************************/ +/* cwd container to avoid selectable on scrollbar */ +.elfinder-cwd-wrapper { + overflow: auto; + position:relative; + padding:2px; + margin:0; +} + +.elfinder-cwd-wrapper-list { padding:0; } + +/* container */ +.elfinder-cwd { + position:relative; + cursor:default; + padding:0; + margin:0; + -ms-touch-action: auto; + touch-action: auto; +} + +/* container active on dropenter */ +.elfinder .elfinder-cwd-wrapper.elfinder-droppable-active { + outline: 2px solid #8cafed; + outline-offset: -2px; +} + +.elfinder-cwd-wrapper-empty .elfinder-cwd:after { + display: block; + position: absolute; + top: 40%; + left: 0; + right: 0; + margin-top: -2em; + line-height: 1.5em; + text-align: center; + white-space: pre-wrap; + opacity: 0.6; + filter: Alpha(Opacity=60); + font-weight: bold; +} + +.elfinder-cwd-file .elfinder-cwd-select { + position: absolute; + top: 0px; + left: 0px; + width: 30px; + height: 30px; + background-color: transparent; + opacity: .4; + filter:Alpha(Opacity=40); +} + +.elfinder-cwd-file.ui-selected .elfinder-cwd-select { + opacity: .8; + filter:Alpha(Opacity=80); +} +.elfinder-rtl .elfinder-cwd-file .elfinder-cwd-select { + left: auto; + right: 0px; +} + +.elfinder .elfinder-cwd-selectall { + position: absolute; + width: 30px; + height: 30px; + top: 0px; + opacity: .8; + filter:Alpha(Opacity=80); +} + +.elfinder .elfinder-workzone.elfinder-cwd-wrapper-empty .elfinder-cwd-selectall { + display: none; +} + +/************************** ICONS VIEW ********************************/ + +.elfinder-ltr .elfinder-workzone .elfinder-cwd-selectall { + text-align: right; + right: 18px; + left: auto; +} + +.elfinder-rtl .elfinder-workzone .elfinder-cwd-selectall { + text-align: left; + right: auto; + left: 18px; +} + +.elfinder-ltr.elfinder-mobile .elfinder-workzone .elfinder-cwd-selectall { + right: 0px; +} + +.elfinder-rtl.elfinder-mobile .elfinder-workzone .elfinder-cwd-selectall { + left: 0px; +} + +.elfinder-cwd-view-icons .elfinder-cwd-file .elfinder-cwd-select.ui-state-hover { + background-color: transparent; +} + +/* file container */ +.elfinder-cwd-view-icons .elfinder-cwd-file { + width:120px; + height:90px; + padding-bottom:2px; + cursor:default; + border:none; +/* overflow:hidden;*/ + position:relative; +} + +/*.elfinder-cwd-view-icons .elfinder-cwd-file .elfinder-cwd-select { + top: 0px; + left: 0px; +}*/ + +/*.elfinder-rtl .elfinder-cwd-view-icons .elfinder-cwd-file .elfinder-cwd-select { + left: auto; + right: 7px; +}*/ + +/* ltr/rtl enviroment */ +.elfinder-ltr .elfinder-cwd-view-icons .elfinder-cwd-file { float:left; margin:0 3px 2px 0; } +.elfinder-rtl .elfinder-cwd-view-icons .elfinder-cwd-file { float:right; margin:0 0 5px 3px; } + +/* remove ui hover class border */ +.elfinder-cwd-view-icons .elfinder-cwd-file .ui-state-hover { border:0 solid; } + +/* icon wrapper to create selected highlight around icon */ +.elfinder-cwd-view-icons .elfinder-cwd-file-wrapper { + width:52px; + height:52px; + margin:1px auto 1px auto; + padding:2px; + position:relative; +} + +/* file name place */ +.elfinder-cwd-view-icons .elfinder-cwd-filename { + text-align: center; + max-height: 2.4em; + line-height: 1.2em; + white-space: pre-line; + overflow: hidden; + text-overflow: ellipsis; + -o-text-overflow: ellipsis; + margin: 3px 1px 0 1px; + padding: 1px; + -moz-border-radius: 8px; + -webkit-border-radius: 8px; + border-radius: 8px; + /* for webkit CSS3 */ + word-break: break-word; + overflow-wrap: break-word; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; +} + +/* permissions/symlink markers */ +.elfinder-cwd-view-icons .elfinder-perms { bottom:4px; right:2px; } +.elfinder-cwd-view-icons .elfinder-lock { top:-3px; right:-2px; } +.elfinder-cwd-view-icons .elfinder-symlink { bottom:6px; left:0px; } + +/* icon/thumbnail */ +.elfinder-cwd-icon { + display:block; + width:48px; + height:48px; + margin:0 auto; + background: url('../img/icons-big.png') 0 0 no-repeat; + -moz-background-clip: padding; + -webkit-background-clip: padding-box; + background-clip: padding-box; +} + +/* volume icon of root in folder */ +.elfinder-navbar-root-local .elfinder-cwd-icon, +.elfinder-cwd .elfinder-navbar-root-local.elfinder-droppable-active .elfinder-cwd-icon, +.elfinder-cwd-view-list .elfinder-navbar-root-local td .elfinder-cwd-icon { + background-image:url("../img/volume_icon_local.png"); + background-position:0 0; + background-size: contain; +} +.elfinder-cwd .elfinder-navbar-root-local.elfinder-droppable-active .elfinder-cwd-icon { + background-position:1px -1px; +} +.elfinder-navbar-root-trash .elfinder-cwd-icon, +.elfinder-cwd .elfinder-navbar-root-trash.elfinder-droppable-active .elfinder-cwd-icon, +.elfinder-cwd-view-list .elfinder-navbar-root-trash td .elfinder-cwd-icon { + background-image:url("../img/volume_icon_trash.png"); + background-position:0 0; + background-size: contain; +} +.elfinder-cwd .elfinder-navbar-root-trash.elfinder-droppable-active .elfinder-cwd-icon { + background-position:1px -1px; +} +.elfinder-navbar-root-ftp .elfinder-cwd-icon, +.elfinder-cwd .elfinder-navbar-root-ftp.elfinder-droppable-active .elfinder-cwd-icon, +.elfinder-cwd-view-list .elfinder-navbar-root-ftp td .elfinder-cwd-icon { + background-image:url("../img/volume_icon_ftp.png"); + background-position:0 0; + background-size: contain; +} +.elfinder-cwd .elfinder-navbar-root-ftp.elfinder-droppable-active .elfinder-cwd-icon { + background-position:1px -1px; +} +.elfinder-navbar-root-sql .elfinder-cwd-icon, +.elfinder-cwd .elfinder-navbar-root-sql.elfinder-droppable-active .elfinder-cwd-icon, +.elfinder-cwd-view-list .elfinder-navbar-root-sql td .elfinder-cwd-icon { + background-image:url("../img/volume_icon_sql.png"); + background-position:0 0; + background-size: contain; +} +.elfinder-cwd .elfinder-navbar-root-sql.elfinder-droppable-active .elfinder-cwd-icon { + background-position:1px -1px; +} +.elfinder-navbar-root-dropbox .elfinder-cwd-icon, +.elfinder-cwd .elfinder-navbar-root-dropbox.elfinder-droppable-active .elfinder-cwd-icon, +.elfinder-cwd-view-list .elfinder-navbar-root-dropbox td .elfinder-cwd-icon { + background-image:url("../img/volume_icon_dropbox.png"); + background-position:0 0; + background-size: contain; +} +.elfinder-cwd .elfinder-navbar-root-dropbox.elfinder-droppable-active .elfinder-cwd-icon { + background-position:1px -1px; +} +.elfinder-navbar-root-googledrive .elfinder-cwd-icon, +.elfinder-cwd .elfinder-navbar-root-googledrive.elfinder-droppable-active .elfinder-cwd-icon, +.elfinder-cwd-view-list .elfinder-navbar-root-googledrive td .elfinder-cwd-icon { + background-image:url("../img/volume_icon_googledrive.png"); + background-position:0 0; + background-size: contain; +} +.elfinder-navbar-root-onedrive .elfinder-cwd-icon, +.elfinder-cwd .elfinder-navbar-root-onedrive.elfinder-droppable-active .elfinder-cwd-icon, +.elfinder-cwd-view-list .elfinder-navbar-root-onedrive td .elfinder-cwd-icon { + background-image:url("../img/volume_icon_onedrive.png"); + background-position:0 0; + background-size: contain; +} +.elfinder-navbar-root-box .elfinder-cwd-icon, +.elfinder-cwd .elfinder-navbar-root-box.elfinder-droppable-active .elfinder-cwd-icon, +.elfinder-cwd-view-list .elfinder-navbar-root-box td .elfinder-cwd-icon { + background-image:url("../img/volume_icon_box.png"); + background-position:0 0; + background-size: contain; +} +.elfinder-cwd .elfinder-navbar-root-googledrive.elfinder-droppable-active .elfinder-cwd-icon, +.elfinder-cwd .elfinder-navbar-root-onedrive.elfinder-droppable-active .elfinder-cwd-icon, +.elfinder-cwd .elfinder-navbar-root-box.elfinder-droppable-active .elfinder-cwd-icon { + background-position:1px -1px; +} +.elfinder-navbar-root-network .elfinder-cwd-icon, +.elfinder-cwd .elfinder-navbar-root-network.elfinder-droppable-active .elfinder-cwd-icon, +.elfinder-cwd-view-list .elfinder-navbar-root-network td .elfinder-cwd-icon { + background-image:url("../img/toolbar.png"); + background-position: 0 71.65%; /* Don't forget change % when toolbar.png edited */ + background-size: cover; +} +.elfinder-cwd .elfinder-navbar-root-network.elfinder-droppable-active .elfinder-cwd-icon { + background-position:1px -1px; +} + +/* thumbnail image */ +.elfinder-cwd-icon.elfinder-cwd-bgurl { + background-position: center center; + background-repeat: no-repeat; + -moz-background-size: contain; + background-size: contain; +} +/* thumbnail self */ +.elfinder-cwd-icon.elfinder-cwd-bgurl.elfinder-cwd-bgself { + -moz-background-size: cover; + background-size: cover; +} +/* thumbnail crop*/ +.elfinder-cwd-icon.elfinder-cwd-bgurl { + -moz-background-size: cover; + background-size: cover; +} +.elfinder-cwd-bgurl:after { + content: ' '; + position: relative; + display: inline-block; + top: 36px; + left: -38px; + width: 48px; + height: 48px; + background: url('../img/icons-big.png') 0 0 no-repeat; + background-size: auto !important; + opacity: .8; + filter: Alpha(Opacity=60); + -webkit-transform-origin: 54px -24px; + -webkit-transform: scale(.6); + -moz-transform-origin: 54px -24px; + -moz-transform: scale(.6); + -ms-transform-origin: 54px -24px; + -ms-transform: scale(.6); + -o-transform-origin: 54px -24px; + -o-transform: scale(.6); + transform-origin: 54px -24px; + transform: scale(.6); +} +/* thumbnail image overlay none */ +.elfinder-cwd-icon-image:after { + content: none; +} +/* thumbnail image video overlay */ +.elfinder-cwd-icon-video:after { + top: 32px; + left: -26px; + height: 25px; + width: 22px; + background-position: 0px -373px; + -webkit-transform: scale(1); + -moz-transform: scale(1); + -ms-transform: scale(1); + -o-transform: scale(1); + transform: scale(1); +} + +/* "opened folder" icon on dragover */ +.elfinder-cwd .elfinder-droppable-active .elfinder-cwd-icon { background-position: 0 -100px; } +.elfinder-cwd .elfinder-droppable-active { + outline: 2px solid #8cafed; + outline-offset: -2px; +} + +/* mimetypes icons */ +.elfinder-cwd-icon-directory { background-position:0 -50px; } + +.elfinder-cwd-icon-application:after, +.elfinder-cwd-icon-application { background-position:0 -150px; } + +.elfinder-cwd-icon-x-empty:after, +.elfinder-cwd-icon-text:after, +.elfinder-cwd-icon-x-empty, +.elfinder-cwd-icon-text { background-position:0 -200px; } + +.elfinder-cwd-icon-image:after, +.elfinder-cwd-icon-vnd-adobe-photoshop:after, +.elfinder-cwd-icon-postscript:after, +.elfinder-cwd-icon-image, +.elfinder-cwd-icon-vnd-adobe-photoshop, +.elfinder-cwd-icon-postscript { background-position:0 -250px; } + +.elfinder-cwd-icon-audio:after, +.elfinder-cwd-icon-audio { background-position:0 -300px; } + +.elfinder-cwd-icon-video, +.elfinder-cwd-icon-flash-video, +.elfinder-cwd-icon-dash-xml, +.elfinder-cwd-icon-vnd-apple-mpegURL, +.elfinder-cwd-icon-x-mpegURL { background-position:0 -350px; } + +.elfinder-cwd-icon-rtf:after, +.elfinder-cwd-icon-rtfd:after, +.elfinder-cwd-icon-rtf, +.elfinder-cwd-icon-rtfd { background-position: 0 -401px; } + +.elfinder-cwd-icon-pdf:after, +.elfinder-cwd-icon-pdf { background-position: 0 -450px; } + +.elfinder-cwd-icon-ms-excel:after, +.elfinder-cwd-icon-msword:after, +.elfinder-cwd-icon-vnd-ms-excel:after, +.elfinder-cwd-icon-vnd-ms-excel-addin-macroEnabled-12:after, +.elfinder-cwd-icon-vnd-ms-excel-sheet-binary-macroEnabled-12:after, +.elfinder-cwd-icon-vnd-ms-excel-sheet-macroEnabled-12:after, +.elfinder-cwd-icon-vnd-ms-excel-template-macroEnabled-12:after, +.elfinder-cwd-icon-vnd-ms-office:after, +.elfinder-cwd-icon-vnd-ms-powerpoint:after, +.elfinder-cwd-icon-vnd-ms-powerpoint-addin-macroEnabled-12:after, +.elfinder-cwd-icon-vnd-ms-powerpoint-presentation-macroEnabled-12:after, +.elfinder-cwd-icon-vnd-ms-powerpoint-slide-macroEnabled-12:after, +.elfinder-cwd-icon-vnd-ms-powerpoint-slideshow-macroEnabled-12:after, +.elfinder-cwd-icon-vnd-ms-powerpoint-template-macroEnabled-12:after, +.elfinder-cwd-icon-vnd-ms-word:after, +.elfinder-cwd-icon-vnd-ms-word-document-macroEnabled-12:after, +.elfinder-cwd-icon-vnd-ms-word-template-macroEnabled-12:after, +.elfinder-cwd-icon-vnd-oasis-opendocument-chart:after, +.elfinder-cwd-icon-vnd-oasis-opendocument-database:after, +.elfinder-cwd-icon-vnd-oasis-opendocument-formula:after, +.elfinder-cwd-icon-vnd-oasis-opendocument-graphics:after, +.elfinder-cwd-icon-vnd-oasis-opendocument-graphics-template:after, +.elfinder-cwd-icon-vnd-oasis-opendocument-image:after, +.elfinder-cwd-icon-vnd-oasis-opendocument-presentation:after, +.elfinder-cwd-icon-vnd-oasis-opendocument-presentation-template:after, +.elfinder-cwd-icon-vnd-oasis-opendocument-spreadsheet:after, +.elfinder-cwd-icon-vnd-oasis-opendocument-spreadsheet-template:after, +.elfinder-cwd-icon-vnd-oasis-opendocument-text:after, +.elfinder-cwd-icon-vnd-oasis-opendocument-text-master:after, +.elfinder-cwd-icon-vnd-oasis-opendocument-text-template:after, +.elfinder-cwd-icon-vnd-oasis-opendocument-text-web:after, +.elfinder-cwd-icon-vnd-openofficeorg-extension:after, +.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-presentation:after, +.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-slide:after, +.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-slideshow:after, +.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-template:after, +.elfinder-cwd-icon-vnd-openxmlformats-officedocument-spreadsheetml-sheet:after, +.elfinder-cwd-icon-vnd-openxmlformats-officedocument-spreadsheetml-template:after, +.elfinder-cwd-icon-vnd-openxmlformats-officedocument-wordprocessingml-document:after, +.elfinder-cwd-icon-vnd-openxmlformats-officedocument-wordprocessingml-template:after, +.elfinder-cwd-icon-ms-excel, +.elfinder-cwd-icon-msword, +.elfinder-cwd-icon-vnd-ms-excel, +.elfinder-cwd-icon-vnd-ms-excel-addin-macroEnabled-12, +.elfinder-cwd-icon-vnd-ms-excel-sheet-binary-macroEnabled-12, +.elfinder-cwd-icon-vnd-ms-excel-sheet-macroEnabled-12, +.elfinder-cwd-icon-vnd-ms-excel-template-macroEnabled-12, +.elfinder-cwd-icon-vnd-ms-office, +.elfinder-cwd-icon-vnd-ms-powerpoint, +.elfinder-cwd-icon-vnd-ms-powerpoint-addin-macroEnabled-12, +.elfinder-cwd-icon-vnd-ms-powerpoint-presentation-macroEnabled-12, +.elfinder-cwd-icon-vnd-ms-powerpoint-slide-macroEnabled-12, +.elfinder-cwd-icon-vnd-ms-powerpoint-slideshow-macroEnabled-12, +.elfinder-cwd-icon-vnd-ms-powerpoint-template-macroEnabled-12, +.elfinder-cwd-icon-vnd-ms-word, +.elfinder-cwd-icon-vnd-ms-word-document-macroEnabled-12, +.elfinder-cwd-icon-vnd-ms-word-template-macroEnabled-12, +.elfinder-cwd-icon-vnd-oasis-opendocument-chart, +.elfinder-cwd-icon-vnd-oasis-opendocument-database, +.elfinder-cwd-icon-vnd-oasis-opendocument-formula, +.elfinder-cwd-icon-vnd-oasis-opendocument-graphics, +.elfinder-cwd-icon-vnd-oasis-opendocument-graphics-template, +.elfinder-cwd-icon-vnd-oasis-opendocument-image, +.elfinder-cwd-icon-vnd-oasis-opendocument-presentation, +.elfinder-cwd-icon-vnd-oasis-opendocument-presentation-template, +.elfinder-cwd-icon-vnd-oasis-opendocument-spreadsheet, +.elfinder-cwd-icon-vnd-oasis-opendocument-spreadsheet-template, +.elfinder-cwd-icon-vnd-oasis-opendocument-text, +.elfinder-cwd-icon-vnd-oasis-opendocument-text-master, +.elfinder-cwd-icon-vnd-oasis-opendocument-text-template, +.elfinder-cwd-icon-vnd-oasis-opendocument-text-web, +.elfinder-cwd-icon-vnd-openofficeorg-extension, +.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-presentation, +.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-slide, +.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-slideshow, +.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-template, +.elfinder-cwd-icon-vnd-openxmlformats-officedocument-spreadsheetml-sheet, +.elfinder-cwd-icon-vnd-openxmlformats-officedocument-spreadsheetml-template, +.elfinder-cwd-icon-vnd-openxmlformats-officedocument-wordprocessingml-document, +.elfinder-cwd-icon-vnd-openxmlformats-officedocument-wordprocessingml-template { background-position: 0 -500px; } + +.elfinder-cwd-icon-html:after, +.elfinder-cwd-icon-html { background-position: 0 -550px; } + +.elfinder-cwd-icon-css:after, +.elfinder-cwd-icon-css { background-position: 0 -600px; } + +.elfinder-cwd-icon-javascript:after, +.elfinder-cwd-icon-x-javascript:after, +.elfinder-cwd-icon-javascript, +.elfinder-cwd-icon-x-javascript { background-position: 0 -650px; } + +.elfinder-cwd-icon-x-perl:after, +.elfinder-cwd-icon-x-perl { background-position: 0 -700px; } + +.elfinder-cwd-icon-x-python:after, +.elfinder-cwd-icon-x-python { background-position: 0 -750px; } + +.elfinder-cwd-icon-x-ruby:after, +.elfinder-cwd-icon-x-ruby { background-position: 0 -800px; } + + +.elfinder-cwd-icon-x-sh:after, +.elfinder-cwd-icon-x-shellscript:after, +.elfinder-cwd-icon-x-sh, +.elfinder-cwd-icon-x-shellscript { background-position: 0 -850px; } + +.elfinder-cwd-icon-x-c:after, +.elfinder-cwd-icon-x-csrc:after, +.elfinder-cwd-icon-x-chdr:after, +.elfinder-cwd-icon-x-c--:after, +.elfinder-cwd-icon-x-c--src:after, +.elfinder-cwd-icon-x-c--hdr:after, +.elfinder-cwd-icon-x-java:after, +.elfinder-cwd-icon-x-java-source:after, +.elfinder-cwd-icon-x-c, +.elfinder-cwd-icon-x-csrc, +.elfinder-cwd-icon-x-chdr, +.elfinder-cwd-icon-x-c--, +.elfinder-cwd-icon-x-c--src, +.elfinder-cwd-icon-x-c--hdr, +.elfinder-cwd-icon-x-java, +.elfinder-cwd-icon-x-java-source { background-position: 0 -900px; } + +.elfinder-cwd-icon-x-php:after, +.elfinder-cwd-icon-x-php { background-position: 0 -950px; } + +.elfinder-cwd-icon-xml:after, +.elfinder-cwd-icon-xml { background-position: 0 -1000px; } + +.elfinder-cwd-icon-zip:after, +.elfinder-cwd-icon-x-zip:after, +.elfinder-cwd-icon-x-xz:after, +.elfinder-cwd-icon-x-7z-compressed:after, +.elfinder-cwd-icon-zip, +.elfinder-cwd-icon-x-zip, +.elfinder-cwd-icon-x-xz, +.elfinder-cwd-icon-x-7z-compressed { background-position: 0 -1050px; } + +.elfinder-cwd-icon-x-gzip:after, +.elfinder-cwd-icon-x-tar:after, +.elfinder-cwd-icon-x-gzip, +.elfinder-cwd-icon-x-tar { background-position: 0 -1100px; } + +.elfinder-cwd-icon-x-bzip:after, +.elfinder-cwd-icon-x-bzip2:after, +.elfinder-cwd-icon-x-bzip, +.elfinder-cwd-icon-x-bzip2 { background-position: 0 -1150px; } + +.elfinder-cwd-icon-x-rar:after, +.elfinder-cwd-icon-x-rar-compressed:after, +.elfinder-cwd-icon-x-rar, +.elfinder-cwd-icon-x-rar-compressed { background-position: 0 -1200px; } + +.elfinder-cwd-icon-x-shockwave-flash:after, +.elfinder-cwd-icon-x-shockwave-flash { background-position: 0 -1250px; } + +.elfinder-cwd-icon-group { background-position:0 -1300px;} + +/* textfield inside icon */ +.elfinder-cwd-filename input { width:100%; border:none; margin:0; padding:0; } +.elfinder-cwd-view-icons input {text-align:center; } +.elfinder-cwd-view-icons textarea { + width: 100%; + border: 0px solid; + margin: 0; + padding: 0; + text-align: center; + overflow: hidden; + resize: none; +} + +.elfinder-cwd-view-icons { text-align:center; } + + +/************************************ LIST VIEW ************************************/ + +/*.elfinder-cwd-view-list { padding:0 0 4px 0; }*/ + +.elfinder-cwd-wrapper.elfinder-cwd-fixheader .elfinder-cwd::after { + display: none; +} + +.elfinder-cwd table { + width: 100%; + border-collapse: separate; + border: 0 solid; + margin: 0 0 10px 0; + border-spacing: 0; + box-sizing: padding-box; + padding: 2px; + position: relative; +} + +.elfinder-cwd-wrapper-list.elfinder-cwd-fixheader { + position: absolute; + overflow: hidden; +} + +.elfinder-cwd-wrapper-list.elfinder-cwd-fixheader:before { + content: ''; + position: absolute; + width: 100%; + top: 0; + height: 3px; + background-color: white; +} +.elfinder-droppable-active + .elfinder-cwd-wrapper-list.elfinder-cwd-fixheader:before { + background-color: #8cafed; +} + +.elfinder .elfinder-workzone div.elfinder-cwd-fixheader table { + table-layout: fixed; +} + +.elfinder .elfinder-cwd table tbody.elfinder-cwd-fixheader { + position: relative; +} + +.elfinder-ltr .elfinder-cwd thead .elfinder-cwd-selectall { + text-align: left; + right: auto; + left: 0px; + padding-top: 3px; +} + +.elfinder-rtl .elfinder-cwd thead .elfinder-cwd-selectall { + text-align: right; + right: 0px; + left: auto; + padding-top: 3px; +} + +.elfinder-touch .elfinder-cwd thead .elfinder-cwd-selectall { + padding-top: 5px; +} + +.elfinder .elfinder-cwd table thead tr { border-left:0 solid; border-top:0 solid; border-right:0 solid; } + +.elfinder .elfinder-cwd table thead td { + padding: 4px 14px; +} +.elfinder-ltr .elfinder-cwd.elfinder-has-checkbox table thead td:first-child { + padding: 4px 14px 4px 22px; +} +.elfinder-rtl .elfinder-cwd.elfinder-has-checkbox table thead td:first-child { + padding: 4px 22px 4px 14px; +} + +.elfinder .elfinder-cwd table thead td.ui-state-active { + background: #ebf1f6; + background: -moz-linear-gradient(top, #ebf1f6 0%, #abd3ee 50%, #89c3eb 51%, #d5ebfb 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ebf1f6), color-stop(50%,#abd3ee), color-stop(51%,#89c3eb), color-stop(100%,#d5ebfb)); + background: -webkit-linear-gradient(top, #ebf1f6 0%,#abd3ee 50%,#89c3eb 51%,#d5ebfb 100%); + background: -o-linear-gradient(top, #ebf1f6 0%,#abd3ee 50%,#89c3eb 51%,#d5ebfb 100%); + background: -ms-linear-gradient(top, #ebf1f6 0%,#abd3ee 50%,#89c3eb 51%,#d5ebfb 100%); + background: linear-gradient(to bottom, #ebf1f6 0%,#abd3ee 50%,#89c3eb 51%,#d5ebfb 100%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ebf1f6', endColorstr='#d5ebfb',GradientType=0 ); +} + +.elfinder .elfinder-cwd table td { + padding:4px 12px; + white-space:pre; + overflow:hidden; + text-align:right; + cursor:default; + border:0 solid; +} + +.elfinder .elfinder-cwd table tbody td:first-child { + position: relative +} + +.elfinder .elfinder-cwd table td div { + box-sizing: content-box; +} + +tr.elfinder-cwd-file td .elfinder-cwd-select { + width: 40px; + padding-top: 3px; +} + +.elfinder-touch tr.elfinder-cwd-file td .elfinder-cwd-select { + padding-top: 10px; +} + +.elfinder-touch .elfinder-cwd tr td { + padding: 10px 12px; +} + +.elfinder-touch .elfinder-cwd table thead td { + padding: 8px 14px; +} + +.elfinder-touch .elfinder-cwd tr.elfinder-cwd-file td { + padding: 13px 12px; +} + +.elfinder-ltr .elfinder-cwd table td { text-align:right; } +.elfinder-ltr .elfinder-cwd table td:first-child { text-align:left; } +.elfinder-rtl .elfinder-cwd table td { text-align:left; } +.elfinder-rtl .elfinder-cwd table td:first-child { text-align:right; } + +.elfinder-odd-row { background:#eee; } + +/* filename container */ +.elfinder-cwd-view-list .elfinder-cwd-file-wrapper { width:97%; position:relative; } +/* filename container in ltr/rtl enviroment */ +.elfinder-ltr .elfinder-cwd-view-list.elfinder-has-checkbox .elfinder-cwd-file-wrapper { margin-left: 8px; } +.elfinder-rtl .elfinder-cwd-view-list.elfinder-has-checkbox .elfinder-cwd-file-wrapper { margin-right: 8px; } +.elfinder-ltr .elfinder-cwd-view-list .elfinder-cwd-filename { padding-left:23px; } +.elfinder-rtl .elfinder-cwd-view-list .elfinder-cwd-filename { padding-right:23px; } + +/* premissions/symlink marker */ +.elfinder-cwd-view-list .elfinder-perms, +.elfinder-cwd-view-list .elfinder-lock, +.elfinder-cwd-view-list .elfinder-symlink { + margin-top:-6px; + opacity: .6; + filter:Alpha(Opacity=60); +} +/* markers in ltr/rtl enviroment */ +.elfinder-ltr .elfinder-cwd-view-list .elfinder-perms { left:8px; bottom:-4px; } +.elfinder-ltr .elfinder-cwd-view-list .elfinder-lock { left:10px; top:0px; } +.elfinder-ltr .elfinder-cwd-view-list .elfinder-symlink { left:-7px; bottom:-4px; } + +/* file icon */ +.elfinder-cwd-view-list td .elfinder-cwd-icon { + width:16px; + height:16px; + position:absolute; + top:50%; + margin-top:-8px; + background-image:url(../img/icons-small.png); +} +/* icon in ltr/rtl enviroment */ +.elfinder-ltr .elfinder-cwd-view-list .elfinder-cwd-icon { left:0; } +.elfinder-rtl .elfinder-cwd-view-list .elfinder-cwd-icon { right:0; } + +/* thumbnail image video overlay */ +.elfinder-cwd-view-list .elfinder-cwd-icon.elfinder-cwd-icon-video.elfinder-cwd-bgurl:after { + content: none; +} + +/* table header resize handle */ +.elfinder-cwd-view-list thead td .ui-resizable-handle { + height: 100%; + top: 3px; +} +.elfinder-touch .elfinder-cwd-view-list thead td .ui-resizable-handle { + top: -5px; + margin: 10px; +} +.elfinder-cwd-view-list thead td .ui-resizable-e { + right: -7px; +} +.elfinder-cwd-view-list thead td .ui-resizable-w { + left: -7px; +} +.elfinder-touch .elfinder-cwd-view-list thead td .ui-resizable-e { + right: -16px; +} +.elfinder-touch .elfinder-cwd-view-list thead td .ui-resizable-w { + left: -16px; +} + +/* empty message */ +.elfinder-cwd-wrapper-empty .elfinder-cwd-view-list.elfinder-cwd:after { + margin-top: 0; +} + +/* File: /css/dialog.css */ +/*********************************************/ +/* DIALOGS STYLES */ +/*********************************************/ + +/* common dialogs class */ +.std42-dialog { + padding:0; + position:absolute; + left:auto; + right:auto; +} +.std42-dialog.elfinder-dialog-minimized { + overFlow: hidden; + position: relative; + float: left; + width: auto; +} +.elfinder-rtl .std42-dialog.elfinder-dialog-minimized { + float: right; +} + +/* titlebar */ +.std42-dialog .ui-dialog-titlebar { + border-left:0 solid transparent; + border-top:0 solid transparent; + border-right:0 solid transparent; + -moz-border-radius-bottomleft: 0; + -webkit-border-bottom-left-radius: 0; + border-bottom-left-radius: 0; + -moz-border-radius-bottomright: 0; + -webkit-border-bottom-right-radius: 0; + border-bottom-right-radius: 0; + font-weight:normal; + padding:.2em 1em; +} +.std42-dialog.elfinder-dialog-minimized .ui-dialog-titlebar { + padding: 0 .5em; + height: 20px; +} +.elfinder-touch .std42-dialog.elfinder-dialog-minimized .ui-dialog-titlebar { + padding:.3em .5em; +} +.std42-dialog.ui-draggable-disabled .ui-dialog-titlebar { + cursor: default; +} + +.std42-dialog .ui-dialog-titlebar .ui-widget-header { + border : none; + cursor: pointer; +} + +.std42-dialog .ui-dialog-titlebar span.elfinder-dialog-title { + display: inherit; + word-break: break-all; +} +.std42-dialog.elfinder-dialog-minimized .ui-dialog-titlebar span.elfinder-dialog-title { + display: list-item; + display: -moz-inline-box; + white-space: nowrap; + word-break: normal; + overflow: hidden; + word-wrap: normal; + overflow-wrap: normal; + max-width: -webkit-calc(100% - 24px); + max-width: -moz-calc(100% - 24px); + max-width: calc(100% - 24px); +} +.elfinder-touch .std42-dialog .ui-dialog-titlebar span.elfinder-dialog-title { + padding-top: .15em; +} +.elfinder-touch .std42-dialog.elfinder-dialog-minimized .ui-dialog-titlebar span.elfinder-dialog-title { + max-width: -webkit-calc(100% - 36px); + max-width: -moz-calc(100% - 36px); + max-width: calc(100% - 36px); +} + +.std42-dialog .ui-dialog-titlebar .elfinder-titlebar-button { + position: relative; + float: left; + top: 10px; + left: -10px; + right: 10px; + width: 20px; + height: 20px; + padding:1px; + margin: -10px 1px 0 1px; + background-color: transparent; + background-image: none; +} +.elfinder-touch .std42-dialog/*:not(.elfinder-dialog-minimized)*/ .ui-dialog-titlebar .elfinder-titlebar-button { + transform: scale(1.1); + zoom: 1.1; + margin-left: 5px; + margin-right: 5px; +} +.std42-dialog .ui-dialog-titlebar .elfinder-titlebar-button-right { + float: right; +} +.std42-dialog .ui-dialog-titlebar .elfinder-titlebar-button.elfinder-titlebar-button-right { + left: 10px; + right: -10px; +} +.std42-dialog .ui-dialog-titlebar .elfinder-titlebar-button .ui-icon { + width: 17px; + height: 17px; + border-width: 1px; + border-color: transparent; + opacity: .7; + filter:Alpha(Opacity=70); + -moz-border-radius: 8px; + -webkit-border-radius: 8px; + border-radius: 8px; +} +.std42-dialog.elfinder-dialog-minimized .ui-dialog-titlebar .elfinder-titlebar-button .ui-icon { + opacity: 1; + filter:Alpha(Opacity=100); +} +.std42-dialog.elfinder-dialog-minimized .ui-dialog-titlebar select { + display: none; +} +.std42-dialog .ui-dialog-titlebar .ui-dialog-titlebar-close:hover .ui-icon, +.elfinder-mobile .std42-dialog .ui-dialog-titlebar .ui-dialog-titlebar-close .ui-icon { + background-color: #ff6252; + border-color: #e5695d; +} +.std42-dialog .ui-dialog-titlebar .elfinder-titlebar-minimize:hover .ui-icon, +.elfinder-mobile .std42-dialog .ui-dialog-titlebar .elfinder-titlebar-minimize .ui-icon { + background-color: #ffbc00; + border-color: #e3a40b; +} +.std42-dialog .ui-dialog-titlebar .elfinder-titlebar-full:hover .ui-icon, +.elfinder-mobile .std42-dialog .ui-dialog-titlebar .elfinder-titlebar-full .ui-icon { + background-color: #26c82f; + border-color: #13ae10; +} + +/* resize handle for touch devices */ +.elfinder-touch .std42-dialog.ui-dialog:not(ui-resizable-disabled) .ui-resizable-se { + width: 12px; + height: 12px; + zoom: 1.5; + right: -7px; + bottom: -7px; + margin: 3px 7px 7px 3px; + background-position: -64px -224px; +} + +.elfinder-rtl .elfinder-dialog .ui-dialog-titlebar { text-align:right; } + +/* content */ +.std42-dialog .ui-dialog-content { + padding:.3em .5em; + box-sizing: border-box; +} +.elfinder .std42-dialog .ui-dialog-content, +.elfinder .std42-dialog .ui-dialog-content * { + -webkit-user-select: auto; + -moz-user-select: text; + -khtml-user-select: text; + user-select: text; +} + +.elfinder .std42-dialog .ui-dialog-content form label { + border: none; +} + +/* buttons */ +.std42-dialog .ui-dialog-buttonpane { + border: 0 solid; + margin: 0; + padding: .5em; + text-align: right; +} +.elfinder-rtl .std42-dialog .ui-dialog-buttonpane { text-align: left; } + +.std42-dialog .ui-dialog-buttonpane button { margin:.2em 0 0 .4em; padding: .2em; outline:0px solid; } +.std42-dialog .ui-dialog-buttonpane button span { padding:2px 9px; } +.std42-dialog .ui-dialog-buttonpane button span.ui-icon { padding: 2px; } + +.elfinder-dialog .ui-resizable-e, +.elfinder-dialog .ui-resizable-s { width:0; height:0;} + +.std42-dialog .ui-button input { cursor: pointer;} + +.std42-dialog select { border: 1px solid #ccc; } + +/* error/notify/confirm dialogs icon */ +.elfinder-dialog-icon { + position:absolute; + width:32px; + height:32px; + left:10px; + top:50%; + margin-top:-15px; + background:url("../img/dialogs.png") 0 0 no-repeat; +} + +.elfinder-rtl .elfinder-dialog-icon { left:auto; right:10px;} + + + +/*********************** ERROR DIALOG **************************/ + +.elfinder-dialog-error .ui-dialog-content, +.elfinder-dialog-confirm .ui-dialog-content { padding-left: 56px; min-height:35px; } + +.elfinder-rtl .elfinder-dialog-error .ui-dialog-content, +.elfinder-rtl .elfinder-dialog-confirm .ui-dialog-content { padding-left:0; padding-right: 56px; } + +/*********************** NOTIFY DIALOG **************************/ + +.elfinder-dialog-notify .ui-dialog-titlebar-close { display:none; } +.elfinder-dialog-notify .ui-dialog-content { padding:0; } + +/* one notification container */ +.elfinder-notify { + border-bottom:1px solid #ccc; + position:relative; + padding:.5em; + + text-align:center; + overflow:hidden; +} + +.elfinder-ltr .elfinder-notify { padding-left:36px; } +.elfinder-rtl .elfinder-notify { padding-right:36px; } + +.elfinder-notify:last-child { border:0 solid; } + +/* progressbar */ +.elfinder-notify-progressbar { + width:180px; + height:8px; + border:1px solid #aaa; + background:#f5f5f5; + margin:5px auto; + overflow:hidden; +} + +.elfinder-notify-progress { + width:100%; + height:8px; + background:url(../img/progress.gif) center center repeat-x; +} + +.elfinder-notify-progressbar, .elfinder-notify-progress { + -moz-border-radius: 2px; + -webkit-border-radius: 2px; + border-radius: 2px; +} + +/* icons */ +.elfinder-dialog-icon-open, +.elfinder-dialog-icon-readdir, +.elfinder-dialog-icon-file { background-position: 0 -225px; } +.elfinder-dialog-icon-reload { background-position: 0 -225px; } +.elfinder-dialog-icon-mkdir { background-position: 0 -64px; } +.elfinder-dialog-icon-mkfile { background-position: 0 -96px; } +.elfinder-dialog-icon-copy, +.elfinder-dialog-icon-prepare, +.elfinder-dialog-icon-move { background-position: 0 -128px;} +.elfinder-dialog-icon-upload { background-position: 0 -160px; } +.elfinder-dialog-icon-chunkmerge { background-position: 0 -160px; } +.elfinder-dialog-icon-rm { background-position: 0 -192px; } +.elfinder-dialog-icon-download { background-position: 0 -260px; } +.elfinder-dialog-icon-save { background-position: 0 -295px; } +.elfinder-dialog-icon-rename { background-position: 0 -330px; } +.elfinder-dialog-icon-zipdl, +.elfinder-dialog-icon-archive, +.elfinder-dialog-icon-extract { background-position: 0 -365px; } +.elfinder-dialog-icon-search { background-position: 0 -402px; } +.elfinder-dialog-icon-resize, +.elfinder-dialog-icon-loadimg, +.elfinder-dialog-icon-netmount, +.elfinder-dialog-icon-netunmount, +.elfinder-dialog-icon-chmod, +.elfinder-dialog-icon-preupload, +.elfinder-dialog-icon-url, +.elfinder-dialog-icon-dim { background-position: 0 -434px; } + +/*********************** CONFIRM DIALOG **************************/ + +.elfinder-dialog-confirm-applyall, +.elfinder-dialog-confirm-encoding { + padding: 0 1em; + margin: 0; +} +.elfinder-ltr .elfinder-dialog-confirm-applyall, +.elfinder-ltr .elfinder-dialog-confirm-encoding { text-align: left; } +.elfinder-rtl .elfinder-dialog-confirm-applyall, +.elfinder-rtl .elfinder-dialog-confirm-encoding { text-align: right; } + +.elfinder-dialog-confirm .elfinder-dialog-icon { background-position:0 -32px; } + +.elfinder-dialog-confirm .ui-dialog-buttonset { width: auto; } + +/*********************** FILE INFO DIALOG **************************/ + + +.elfinder-info-title .elfinder-cwd-icon { + float:left; + width:48px; + height:48px; + margin-right:1em; +} + +.elfinder-rtl .elfinder-info-title .elfinder-cwd-icon { + float: right; + margin-right: 0; + margin-left: 1em; +} + +.elfinder-info-title strong { display:block; padding:.3em 0 .5em 0; } + +.elfinder-info-tb { + min-width:200px; + border:0 solid; + margin:1em .2em 1em .2em; +} + +.elfinder-info-tb td { white-space:nowrap; padding:2px; } + +.elfinder-info-tb tr td:first-child { text-align:right; } + +.elfinder-info-tb span { float:left;} +.elfinder-info-tb a { outline: none; text-decoration:underline; } +.elfinder-info-tb a:hover { text-decoration:none; } +.elfinder-info-spinner { + width:14px; + height:14px; + float:left; + background: url("../img/spinner-mini.gif") center center no-repeat; + margin:0 5px; +} + +.elfinder-netmount-tb { margin:0 auto; } +.elfinder-netmount-tb select, +.elfinder-netmount-tb input { border:1px solid #ccc; } +.elfinder-netmount-tb .elfinder-button-icon { cursor: pointer; } + +button.elfinder-info-button { + margin: -3.5px 0; + cursor: pointer; +} + +/*********************** UPLOAD DIALOG **************************/ + +.elfinder-upload-dropbox { + display: table-cell; + text-align:center; + vertical-align: middle; + padding:0.5em; + border:3px dashed #aaa; + width: 9999px; + height: 80px; + overflow: hidden; + word-break: keep-all; +} + +.elfinder-upload-dropbox.ui-state-hover { + background:#dfdfdf; + border:3px dashed #555; +} + +.elfinder-upload-dialog-or { + margin:.3em 0; + text-align:center; +} + +.elfinder-upload-dialog-wrapper { text-align:center; } + +.elfinder-upload-dialog-wrapper .ui-button { position:relative; overflow:hidden; } + +.elfinder-upload-dialog-wrapper .ui-button form { + position:absolute; + right:0; + top:0; + opacity: 0; filter:Alpha(Opacity=0); +} + +.elfinder-upload-dialog-wrapper .ui-button form input { + padding:0 20px; + font-size:3em; + +} + + +/* dialog for elFinder itself */ +.dialogelfinder .dialogelfinder-drag { + border-left:0 solid; + border-top:0 solid; + border-right:0 solid; + font-weight:normal; + padding:2px 12px; + cursor:move; + position:relative; + text-align:left; +} + +.elfinder-rtl .dialogelfinder-drag { text-align:right;} + +.dialogelfinder-drag-close { + position: absolute; + top:50%; + margin-top:-8px; +} + +.elfinder-ltr .dialogelfinder-drag-close { right:12px; } +.elfinder-rtl .dialogelfinder-drag-close { left:12px; } + + +/*********************** RM CONFIRM **************************/ +.elfinder-rm-title { + margin-bottom: .5ex; +} + +.elfinder-rm-title .elfinder-cwd-icon { + float:left; + width:48px; + height:48px; + margin-right:1em; +} + +.elfinder-rtl .elfinder-rm-title .elfinder-cwd-icon { + float: right; + margin-right: 0; + margin-left: 1em; +} + +.elfinder-rm-title strong { + display: block; + /*word-wrap: break-word;*/ + white-space: pre-wrap; + word-break: normal; + overflow: hidden; + text-overflow: ellipsis; +} + +.elfinder-rm-title+br { + display: none; +} + +/*********************** EDIT DIALOG **************************/ + +.ui-dialog-titlebar select.elfinder-edit-changed { + border-bottom: 1px solid #13ae10; +} + +/* File: /css/fonts.css */ +.elfinder-contextmenu .elfinder-contextmenu-item span { font-size:.72em; } + +.elfinder-cwd-view-icons .elfinder-cwd-filename { font-size:.7em; } +.elfinder-cwd-view-list td { font-size:.7em; } + +.std42-dialog .ui-dialog-titlebar { font-size:.82em; } +.std42-dialog .ui-dialog-content { font-size:.72em; } +.std42-dialog .ui-dialog-buttonpane { font-size:.76em; } +.elfinder-info-tb { font-size:.9em; } +.elfinder-upload-dropbox { font-size:1.2em; } +.elfinder-upload-dialog-or { font-size:1.2em; } +.dialogelfinder .dialogelfinder-drag { font-size:.9em; } +.elfinder .elfinder-navbar { font-size:.72em; } +.elfinder-place-drag .elfinder-navbar-dir { font-size:.9em;} +.elfinder-quicklook-title { font-size:.7em; } +.elfinder-quicklook-info-data { font-size:.72em; } +.elfinder-quicklook-preview-text-wrapper { font-size:.9em; } +.elfinder-button-menu-item { font-size:.72em; } +.elfinder-button-search input { font-size:.8em; } +.elfinder-statusbar div { font-size:.7em; } +.elfinder-drag-num { font-size:12px; } +.elfinder-toast { font-size:.76em; } + + +/* File: /css/navbar.css */ +/*********************************************/ +/* NAVIGATION PANEL */ +/*********************************************/ + +/* container */ +.elfinder .elfinder-navbar { + width:230px; + padding:3px 5px; + background-image:none; + border-top:0 solid; + border-bottom:0 solid; + overflow:auto; + position:relative; +} + + +/* ltr/rtl enviroment */ +.elfinder-ltr .elfinder-navbar { float:left; border-left:0 solid; } +.elfinder-rtl .elfinder-navbar { float:right; border-right:0 solid; } +.elfinder-ltr .ui-resizable-e { margin-left:10px; } + +/* folders tree container */ +.elfinder-tree { + display:table; width:100%; margin: 0 0 .5em 0; + -webkit-tap-highlight-color:rgba(0,0,0,0); +} + +/* one folder wrapper */ +.elfinder-navbar-wrapper, .elfinder-place-wrapper { } + +/* folder */ +.elfinder-navbar-dir { + position:relative; + display:block; + white-space:nowrap; + padding:3px 12px; + margin: 0; + outline:0px solid; + border:1px solid transparent; + cursor:default; +} +.elfinder-touch .elfinder-navbar-dir { + padding: 12px 12px; +} + +/* ltr/rtl enviroment */ +.elfinder-ltr .elfinder-navbar-dir { padding-left:35px; } +.elfinder-rtl .elfinder-navbar-dir { padding-right:35px; } + +/* arrow before icon */ +.elfinder-navbar-arrow { + width:12px; + height:14px; + position:absolute; + display:none; + top:50%; + margin-top:-8px; + background-image:url("../img/arrows-normal.png"); + background-repeat:no-repeat; +/* border:1px solid #111;*/ +} +.elfinder-ltr .elfinder-navbar-arrow { + left: 0; +} +.elfinder-rtl .elfinder-navbar-arrow { + right:0; +} +.elfinder-touch .elfinder-navbar-arrow { + zoom: 1.4; + -moz-transform-origin: top left; + -moz-transform: scale(1.4); + margin-bottom: 7px; +} +.elfinder-ltr.elfinder-touch .elfinder-navbar-arrow { + left: -3px; + margin-right: 20px; +} +.elfinder-rtl.elfinder-touch .elfinder-navbar-arrow { + right: -3px; + margin-left: 20px; +} + +.ui-state-active .elfinder-navbar-arrow { background-image:url("../img/arrows-active.png"); } + +/* collapsed/expanded arrow view */ +.elfinder-navbar-collapsed .elfinder-navbar-arrow { display:block; } + +.elfinder-subtree-chksubdir .elfinder-navbar-arrow { opacity: .25; filter:Alpha(Opacity=25); } + +/* arrow ltr/rtl enviroment */ +.elfinder-ltr .elfinder-navbar-collapsed .elfinder-navbar-arrow { background-position: 0 4px;} +.elfinder-rtl .elfinder-navbar-collapsed .elfinder-navbar-arrow { background-position: 0 -10px; } +.elfinder-ltr .elfinder-navbar-expanded .elfinder-navbar-arrow, +.elfinder-rtl .elfinder-navbar-expanded .elfinder-navbar-arrow { background-position:0 -21px; } + + +/* folder icon */ +.elfinder-navbar-icon { + width:16px; + height:16px; + position:absolute; + top:50%; + margin-top:-8px; + background-image:url("../img/toolbar.png"); + background-repeat:no-repeat; + background-position:0 -16px; +} + +/* ltr/rtl enviroment */ +.elfinder-ltr .elfinder-navbar-icon { left:14px; } +.elfinder-rtl .elfinder-navbar-icon { right:14px; } + +/* root folder */ +.elfinder-tree .elfinder-navbar-root .elfinder-navbar-icon { background-position:0 0; } +.elfinder-places .elfinder-navbar-root .elfinder-navbar-icon { background-position:0 -704px; } + +/* root icon of each volume */ +.elfinder-tree .elfinder-navbar-root-local .elfinder-navbar-icon { background-image:url("../img/volume_icon_local.png"); background-position:0 0; } +.elfinder-tree .elfinder-navbar-root-trash .elfinder-navbar-icon { background-image:url("../img/volume_icon_trash.png"); background-position:0 0; } +.elfinder-tree .elfinder-navbar-root-ftp .elfinder-navbar-icon { background-image:url("../img/volume_icon_ftp.png"); background-position:0 0; } +.elfinder-tree .elfinder-navbar-root-sql .elfinder-navbar-icon { background-image:url("../img/volume_icon_sql.png"); background-position:0 0; } +.elfinder-tree .elfinder-navbar-root-dropbox .elfinder-navbar-icon { background-image:url("../img/volume_icon_dropbox.png"); background-position:0 0; } +.elfinder-tree .elfinder-navbar-root-googledrive .elfinder-navbar-icon { background-image:url("../img/volume_icon_googledrive.png"); background-position:0 0; } +.elfinder-tree .elfinder-navbar-root-onedrive .elfinder-navbar-icon { background-image:url("../img/volume_icon_onedrive.png"); background-position:0 0; } +.elfinder-tree .elfinder-navbar-root-box .elfinder-navbar-icon { background-image:url("../img/volume_icon_box.png"); background-position:0 0; } +.elfinder-tree .elfinder-navbar-root-network .elfinder-navbar-icon { background-image:url("../img/toolbar.png"); background-position: 0 -688px; } + +/* icon in active/hove/dropactive state */ +.ui-state-active .elfinder-navbar-icon, +.elfinder-droppable-active .elfinder-navbar-icon, +.ui-state-hover .elfinder-navbar-icon { background-position:0 -32px; } + +/* ltr/rtl enviroment */ +.elfinder-ltr .elfinder-navbar-subtree { margin-left:12px; } +.elfinder-rtl .elfinder-navbar-subtree { margin-right:12px; } + + +/* spinner */ +.elfinder-navbar-spinner { + width:14px; + height:14px; + position:absolute; + display:block; + top:50%; + margin-top:-7px; + background: url("../img/spinner-mini.gif") center center no-repeat; +} +/* spinner ltr/rtl enviroment */ +.elfinder-ltr .elfinder-navbar-spinner { left:0; margin-left:-2px; } +.elfinder-rtl .elfinder-navbar-spinner { right:0; margin-right:-2px; } + +/* marker */ +.elfinder-navbar .elfinder-perms, +.elfinder-navbar .elfinder-lock, +.elfinder-navbar .elfinder-symlink { opacity: .6; filter:Alpha(Opacity=60); } + +/* permissions marker */ +.elfinder-navbar .elfinder-perms { bottom:-1px; margin-top:-8px; } + +/* locked marker */ +.elfinder-navbar .elfinder-lock { top:-2px; } + +/* permissions/symlink markers ltr/rtl enviroment */ +.elfinder-ltr .elfinder-navbar .elfinder-perms { left: 20px; } +.elfinder-rtl .elfinder-navbar .elfinder-perms { right: 20px; } +.elfinder-ltr .elfinder-navbar .elfinder-lock { left: 20px; } +.elfinder-rtl .elfinder-navbar .elfinder-lock { right: 20px; } +.elfinder-ltr .elfinder-navbar .elfinder-symlink { left: 8px; } +.elfinder-rtl .elfinder-navbar .elfinder-symlink { right: 8px; } + +/* navbar input */ +.elfinder-navbar input { width:100%; border:0px solid; margin:0; padding:0; } + +/* resizable */ +.elfinder-navbar .ui-resizable-handle { width:12px; background:transparent url('../img/resize.png') center center no-repeat; } +.elfinder-nav-handle-icon { + position:absolute; + top:50%; + margin:-8px 2px 0 2px; + opacity: .5; filter:Alpha(Opacity=50); +} + +/* pager button */ +.elfinder-navbar-pager { + width: 100%; + box-sizing: border-box; + padding-top: 3px; + padding-bottom: 3px; +} +.elfinder-touch .elfinder-navbar-pager { + padding-top: 10px; + padding-bottom: 10px; +} + +.elfinder-places { + border: none; + margin: 0; + padding: 0; +} +.elfinder-places.elfinder-droppable-active { + /*border:1px solid #8cafed;*/ +} + +/* navbar swipe handle */ +.elfinder-navbar-swipe-handle { + position: absolute; + top: 0px; + height: 100%; + width: 50px; + pointer-events: none; +} +.elfinder-ltr .elfinder-navbar-swipe-handle { + left: 0px; + background: linear-gradient(to right, + rgba(221,228,235,1) 0, + rgba(221,228,235,0.8) 5px, + rgba(216,223,230,0.3) 8px, + rgba(0,0,0,0.1) 95%, + rgba(0,0,0,0) 100%); +} +.elfinder-rtl .elfinder-navbar-swipe-handle { + right: 0px; + background: linear-gradient(to left, + rgba(221,228,235,1) 0, + rgba(221,228,235,0.8) 5px, + rgba(216,223,230,0.3) 8px, + rgba(0,0,0,0.1) 95%, + rgba(0,0,0,0) 100%); +} +/* File: /css/places.css */ +/*********************************************/ +/* PLACES STYLES */ +/*********************************************/ +/* root extra icon */ +.elfinder-navbar-root .elfinder-places-root-icon { + position: absolute; + top: 50%; + margin-top: -9px; + cursor: pointer; +} +.elfinder-ltr .elfinder-places-root-icon { + right: 10px; +} +.elfinder-rtl .elfinder-places-root-icon { + left: 10px; +} +.elfinder-navbar-expanded .elfinder-places-root-icon { + display: block; +} + +/* dragging helper base */ +.elfinder-place-drag { + font-size: 0.8em; +} + +/* File: /css/quicklook.css */ +/* quicklook window */ +.elfinder-quicklook { + position:absolute; + background:url("../img/quicklook-bg.png"); + overflow:hidden; + border-radius:7px; + -moz-border-radius:7px; + -webkit-border-radius:7px; + padding:20px 0 40px 0; +} + +.elfinder-quicklook.elfinder-touch { + padding:30px 0 40px 0; +} + +.elfinder-quicklook .ui-resizable-se { + width:14px; + height:14px; + right:5px; + bottom:3px; + background:url("../img/toolbar.png") 0 -496px no-repeat; +} +.elfinder-quicklook.elfinder-touch .ui-resizable-se { + zoom: 1.5; +} + +/* quicklook fullscreen window */ +.elfinder-quicklook.elfinder-quicklook-fullscreen { + position:fixed; + top:0; + right:0; + bottom:0; + left:0; + margin:0; + box-sizing:border-box; + width:100%; + height:100%; + object-fit:contain; + border-radius:0; + -moz-border-radius:0; + -webkit-border-radius:0; + -webkit-background-clip: padding-box; + padding:0; + background:#000; + display:block; +} +/* hide titlebar in fullscreen mode */ +.elfinder-quicklook-fullscreen .elfinder-quicklook-titlebar, +.elfinder-quicklook-fullscreen.elfinder-quicklook .ui-resizable-handle { display:none; } + +/* hide preview border in fullscreen mode */ +.elfinder-quicklook-fullscreen .elfinder-quicklook-preview { border:0 solid ;} + +/*.elfinder-quicklook-fullscreen iframe { + height: 100%; +}*/ + +.elfinder-quicklook-cover { + width: 100%; + height: 100%; + top: 0; + left: 0; + position: absolute; +} + +/* quicklook titlebar */ +.elfinder-quicklook-titlebar { + text-align:center; + background:#777; + position:absolute; + left:0; + top:0; + width:100%; + height:20px; + -moz-border-radius-topleft: 7px; + -webkit-border-top-left-radius: 7px; + border-top-left-radius: 7px; + -moz-border-radius-topright: 7px; + -webkit-border-top-right-radius: 7px; + border-top-right-radius: 7px; + cursor:move; +} + +.elfinder-touch .elfinder-quicklook-titlebar { + height: 30px; +} + +/* window title */ +.elfinder-quicklook-title { + color:#fff; + white-space:nowrap; + overflow:hidden; + padding:2px 0; +} + +.elfinder-touch .elfinder-quicklook-title { + padding: 8px 0; +} + +/* icon "close" in titlebar */ +.elfinder-quicklook-titlebar .ui-icon { + position:absolute; + left : 4px; + top:50%; + margin-top:-8px; + width:16px; + height:16px; + cursor:pointer; +} +.elfinder-quicklook-titlebar .ui-icon.elfinder-platformWin { + left : auto; + right : 4px; +} + +.elfinder-touch .elfinder-quicklook-titlebar .ui-icon { + zoom: 1.5; +} + +/* main part of quicklook window */ +.elfinder-quicklook-preview { + overflow: hidden; + position:relative; + border:0 solid; + border-left:1px solid transparent; + border-right:1px solid transparent; + height:100%; +} +.elfinder-quicklook-preview.elfinder-overflow-auto { + overflow: auto; + -webkit-overflow-scrolling: touch; +} + +/* wrapper for file info/icon */ +.elfinder-quicklook-info-wrapper { + position:absolute; + width:100%; + left:0; + top:50%; + margin-top:-50px; +} + +/* file info */ +.elfinder-quicklook-info { + padding: 0 12px 0 112px; +} + +/* file name in info */ +.elfinder-quicklook-info .elfinder-quicklook-info-data:first-child { + color:#fff; + font-weight:bold; + padding-bottom:.5em; +} + +/* other data in info */ +.elfinder-quicklook-info-data { + padding-bottom:.2em; + color:#fff; +} + + +/* file icon */ +.elfinder-quicklook .elfinder-cwd-icon { + position:absolute; + left:32px; + top:50%; + margin-top:-20px; +} + +/* image in preview */ +.elfinder-quicklook-preview img { + display:block; + margin:0 auto; +} + +/* navigation bar on quicklook window bottom */ +.elfinder-quicklook-navbar { + position:absolute; + left:50%; + bottom:4px; + width:140px; + height:32px; + padding:0px; + margin-left:-70px; + border:1px solid transparent; + border-radius:19px; + -moz-border-radius:19px; + -webkit-border-radius:19px; +} + +/* navigation bar in fullscreen mode */ +.elfinder-quicklook-fullscreen .elfinder-quicklook-navbar { + width:188px; + margin-left:-94px; + padding:5px; + border:1px solid #eee; + background:#000; + opacity: 0.4; + filter: Alpha(Opacity=40); +} + +/* show close icon in fullscreen mode */ +.elfinder-quicklook-fullscreen .elfinder-quicklook-navbar-icon-close, +.elfinder-quicklook-fullscreen .elfinder-quicklook-navbar-separator { + display:inline; +} + +/* icons in navbar */ +.elfinder-quicklook-navbar-icon { + width:32px; + height:32px; + margin:0 7px; + float:left; + background:url("../img/quicklook-icons.png") 0 0 no-repeat; + +} + +/* fullscreen icon */ +.elfinder-quicklook-navbar-icon-fullscreen { + background-position:0 -64px; +} + +/* exit fullscreen icon */ +.elfinder-quicklook-navbar-icon-fullscreen-off { + background-position:0 -96px; +} + +/* prev file icon */ +.elfinder-quicklook-navbar-icon-prev { + background-position:0 0; +} + +/* next file icon */ +.elfinder-quicklook-navbar-icon-next { + background-position:0 -32px; +} + +/* close icon */ +.elfinder-quicklook-navbar-icon-close { + background-position:0 -128px; + display:none; +} + +/* icons separator */ +.elfinder-quicklook-navbar-separator { + width:1px; + height:32px; + float:left; + border-left:1px solid #fff; + display:none; +} + +/* text files preview wrapper */ +.elfinder-quicklook-preview-text-wrapper { + width: 100%; + height:100%; + background:#fff; + color:#222; + overflow:auto; + -webkit-overflow-scrolling: touch; +} + +/* archive files preview wrapper */ +.elfinder-quicklook-preview-archive-wrapper { + width: 100%; + height:100%; + background:#fff; + color:#222; + font-size: 1.5ex; + overflow:auto; + -webkit-overflow-scrolling: touch +} + +/* archive files preview header */ +.elfinder-quicklook-preview-archive-wrapper strong { + padding: 0 5px; +} + +/* text preview */ +pre.elfinder-quicklook-preview-text { + width: auto; + height: auto; + margin:0; + padding:3px 9px; + border: none; +} + +/* html/pdf preview */ +.elfinder-quicklook-preview-html, +.elfinder-quicklook-preview-pdf, +.elfinder-quicklook-preview-iframe { + width:100%; + height:100%; + background:#fff; + margin:0; + border: none; + display: block; +} + +/* swf preview container */ +.elfinder-quicklook-preview-flash { + width:100%; + height:100%; +} + +/* audio preview container */ +.elfinder-quicklook-preview-audio { + width:100%; + position:absolute; + bottom:0; + left:0; +} + +/* audio preview using embed */ +embed.elfinder-quicklook-preview-audio { + height:30px; + background:transparent; +} + +/* video preview container */ +.elfinder-quicklook-preview-video { + width:100%; + height:100%; +} + +/* allow user select */ +.elfinder .elfinder-quicklook .elfinder-quicklook-info *, +.elfinder .elfinder-quicklook .elfinder-quicklook-preview * { + -webkit-user-select: auto; + -moz-user-select: text; + -khtml-user-select: text; + user-select: text; +} + +/* File: /css/statusbar.css */ +/******************************************************************/ +/* STATUSBAR STYLES */ +/******************************************************************/ + + +/* statusbar container */ +.elfinder-statusbar { + text-align:center; + font-weight:normal; + padding:.2em .5em; + + border-right:0 solid transparent; + border-bottom:0 solid transparent; + border-left:0 solid transparent; +} + +.elfinder-statusbar span { + cursor: pointer; + /*display: inline-block;*/ + vertical-align: bottom; + overflow: hidden; + text-overflow: ellipsis; + -o-text-overflow: ellipsis; + text-overflow: ".."; + -o-text-overflow: ".."; +} +.elfinder-statusbar span.ui-state-hover, +.elfinder-statusbar span.ui-state-active { border: none; } +.elfinder-statusbar span.elfinder-path-cwd { cursor: default; } + + + +/* path in statusbar */ +.elfinder-path { + max-width:30%; + white-space:nowrap; + overflow:hidden; + text-overflow:ellipsis; + -o-text-overflow:ellipsis; +} +.elfinder-ltr .elfinder-path { float:left; } +.elfinder-rtl .elfinder-path { float:right; } + +/* path in workzone (case of swipe to navbar close) */ +.elfinder-workzone-path { + position: relative; +} +.elfinder-workzone-path .elfinder-path { + position: relative; + font-size: .75em; + font-weight: normal; + float: none; + max-width: none; + overflow-x: scroll; + text-overflow: initial; + -o-text-overflow: initial; +} +.elfinder-ltr .elfinder-workzone-path .elfinder-path { + margin-left: 24px; +} +.elfinder-rtl .elfinder-workzone-path .elfinder-path { + margin-right: 24px; +} +.elfinder-workzone-path .elfinder-path span { + display: inline-block; + padding: 5px 3px; +} +.elfinder-workzone-path .elfinder-path span.elfinder-path-cwd { + font-weight: bold; +} +.elfinder-workzone-path .elfinder-path span.ui-state-hover, +.elfinder-workzone-path .elfinder-path span.ui-state-active { border: none; } + +.elfinder-workzone-path .elfinder-path-roots { + position: absolute; + top: 0; + width: 24px; + height: 20px; + padding: 2px; + border: none; + overflow: hidden; +} +.elfinder-ltr .elfinder-workzone-path .elfinder-path-roots { + left: 0; +} +.elfinder-rtl .elfinder-workzone-path .elfinder-path-roots { + right: 0; +} +/* total/selected size in statusbar */ +.elfinder-stat-size { white-space:nowrap; } +.elfinder-ltr .elfinder-stat-size { float:right; } +.elfinder-rtl .elfinder-stat-size { float:left; } + +.elfinder-stat-selected { white-space:nowrap; overflow:hidden; } + +/* File: /css/toast.css */ +/* + * CSS for Toastr + * Copyright 2012-2015 + * Authors: John Papa, Hans Fjällemark, and Tim Ferrell. + * All Rights Reserved. + * Use, reproduction, distribution, and modification of this code is subject to the terms and + * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php + * + * ARIA Support: Greta Krafsig + * + * Project: https://github.com/CodeSeven/toastr + */ + +.elfinder .elfinder-toast { + position: absolute; + top: 12px; + right: 12px; + max-width: 90%; + cursor: default; +} + +.elfinder .elfinder-toast > div { + position: relative; + pointer-events: auto; + overflow: hidden; + margin: 0 0 6px; + padding: 8px 16px 8px 50px; + -moz-border-radius: 3px 3px 3px 3px; + -webkit-border-radius: 3px 3px 3px 3px; + border-radius: 3px 3px 3px 3px; + background-position: 15px center; + background-repeat: no-repeat; + -moz-box-shadow: 0 0 12px #999999; + -webkit-box-shadow: 0 0 12px #999999; + box-shadow: 0 0 12px #999999; + color: #FFFFFF; + opacity: 0.9; + filter: alpha(opacity=90); + background-color: #030303; + text-align: center; +} + +.elfinder .elfinder-toast > .toast-info { + background-color: #2F96B4; + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGwSURBVEhLtZa9SgNBEMc9sUxxRcoUKSzSWIhXpFMhhYWFhaBg4yPYiWCXZxBLERsLRS3EQkEfwCKdjWJAwSKCgoKCcudv4O5YLrt7EzgXhiU3/4+b2ckmwVjJSpKkQ6wAi4gwhT+z3wRBcEz0yjSseUTrcRyfsHsXmD0AmbHOC9Ii8VImnuXBPglHpQ5wwSVM7sNnTG7Za4JwDdCjxyAiH3nyA2mtaTJufiDZ5dCaqlItILh1NHatfN5skvjx9Z38m69CgzuXmZgVrPIGE763Jx9qKsRozWYw6xOHdER+nn2KkO+Bb+UV5CBN6WC6QtBgbRVozrahAbmm6HtUsgtPC19tFdxXZYBOfkbmFJ1VaHA1VAHjd0pp70oTZzvR+EVrx2Ygfdsq6eu55BHYR8hlcki+n+kERUFG8BrA0BwjeAv2M8WLQBtcy+SD6fNsmnB3AlBLrgTtVW1c2QN4bVWLATaIS60J2Du5y1TiJgjSBvFVZgTmwCU+dAZFoPxGEEs8nyHC9Bwe2GvEJv2WXZb0vjdyFT4Cxk3e/kIqlOGoVLwwPevpYHT+00T+hWwXDf4AJAOUqWcDhbwAAAAASUVORK5CYII=") !important; +} +.elfinder .elfinder-toast > .toast-error { + background-color: #BD362F; + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHOSURBVEhLrZa/SgNBEMZzh0WKCClSCKaIYOED+AAKeQQLG8HWztLCImBrYadgIdY+gIKNYkBFSwu7CAoqCgkkoGBI/E28PdbLZmeDLgzZzcx83/zZ2SSXC1j9fr+I1Hq93g2yxH4iwM1vkoBWAdxCmpzTxfkN2RcyZNaHFIkSo10+8kgxkXIURV5HGxTmFuc75B2RfQkpxHG8aAgaAFa0tAHqYFfQ7Iwe2yhODk8+J4C7yAoRTWI3w/4klGRgR4lO7Rpn9+gvMyWp+uxFh8+H+ARlgN1nJuJuQAYvNkEnwGFck18Er4q3egEc/oO+mhLdKgRyhdNFiacC0rlOCbhNVz4H9FnAYgDBvU3QIioZlJFLJtsoHYRDfiZoUyIxqCtRpVlANq0EU4dApjrtgezPFad5S19Wgjkc0hNVnuF4HjVA6C7QrSIbylB+oZe3aHgBsqlNqKYH48jXyJKMuAbiyVJ8KzaB3eRc0pg9VwQ4niFryI68qiOi3AbjwdsfnAtk0bCjTLJKr6mrD9g8iq/S/B81hguOMlQTnVyG40wAcjnmgsCNESDrjme7wfftP4P7SP4N3CJZdvzoNyGq2c/HWOXJGsvVg+RA/k2MC/wN6I2YA2Pt8GkAAAAASUVORK5CYII=") !important; +} +.elfinder .elfinder-toast > .toast-success { + background-color: #51A351; + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADsSURBVEhLY2AYBfQMgf///3P8+/evAIgvA/FsIF+BavYDDWMBGroaSMMBiE8VC7AZDrIFaMFnii3AZTjUgsUUWUDA8OdAH6iQbQEhw4HyGsPEcKBXBIC4ARhex4G4BsjmweU1soIFaGg/WtoFZRIZdEvIMhxkCCjXIVsATV6gFGACs4Rsw0EGgIIH3QJYJgHSARQZDrWAB+jawzgs+Q2UO49D7jnRSRGoEFRILcdmEMWGI0cm0JJ2QpYA1RDvcmzJEWhABhD/pqrL0S0CWuABKgnRki9lLseS7g2AlqwHWQSKH4oKLrILpRGhEQCw2LiRUIa4lwAAAABJRU5ErkJggg==") !important; +} +.elfinder .elfinder-toast > .toast-warning { + background-color: #F89406; + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGYSURBVEhL5ZSvTsNQFMbXZGICMYGYmJhAQIJAICYQPAACiSDB8AiICQQJT4CqQEwgJvYASAQCiZiYmJhAIBATCARJy+9rTsldd8sKu1M0+dLb057v6/lbq/2rK0mS/TRNj9cWNAKPYIJII7gIxCcQ51cvqID+GIEX8ASG4B1bK5gIZFeQfoJdEXOfgX4QAQg7kH2A65yQ87lyxb27sggkAzAuFhbbg1K2kgCkB1bVwyIR9m2L7PRPIhDUIXgGtyKw575yz3lTNs6X4JXnjV+LKM/m3MydnTbtOKIjtz6VhCBq4vSm3ncdrD2lk0VgUXSVKjVDJXJzijW1RQdsU7F77He8u68koNZTz8Oz5yGa6J3H3lZ0xYgXBK2QymlWWA+RWnYhskLBv2vmE+hBMCtbA7KX5drWyRT/2JsqZ2IvfB9Y4bWDNMFbJRFmC9E74SoS0CqulwjkC0+5bpcV1CZ8NMej4pjy0U+doDQsGyo1hzVJttIjhQ7GnBtRFN1UarUlH8F3xict+HY07rEzoUGPlWcjRFRr4/gChZgc3ZL2d8oAAAAASUVORK5CYII=") !important; +} + + +.elfinder .elfinder-toast > div button.ui-button { + background-image: none; + margin-top: 8px; + padding: .5em .8em; +} + +.elfinder .elfinder-toast > .toast-success button.ui-button { + background-color: green; + color: #FFF; +} + +.elfinder .elfinder-toast > .toast-success button.ui-button.ui-state-hover { + background-color: #add6ad; + color: #254b25; +} + +/* File: /css/toolbar.css */ +/*********************************************/ +/* TOOLBAR STYLES */ +/*********************************************/ +/* toolbar container */ +.elfinder-toolbar { + padding:4px 0 3px 0; + border-left:0 solid transparent; + border-top:0 solid transparent; + border-right:0 solid transparent; +} + +/* container for button's group */ +.elfinder-buttonset { + margin: 1px 4px; + float:left; + background:transparent; + padding:0; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; +} + +/*.elfinder-buttonset:first-child { margin:0; }*/ + +/* button */ +.elfinder .elfinder-button { + /*width:16px;*/ + height:16px; + margin:0; + padding:4px; + float:left; + overflow:hidden; + position:relative; + border:0 solid; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + line-height: 1; + cursor: default; +} +.elfinder-touch .elfinder-button { + /*width:20px;*/ + height:20px; +} + +.elfinder .ui-icon-search { cursor:pointer;} + +.elfinder-button:first-child { + -moz-border-radius-topleft: 4px; + -webkit-border-top-left-radius: 4px; + border-top-left-radius: 4px; + -moz-border-radius-bottomleft: 4px; + -webkit-border-bottom-left-radius: 4px; + border-bottom-left-radius: 4px; +} + +.elfinder-button:last-child { + -moz-border-radius-topright: 4px; + -webkit-border-top-right-radius: 4px; + border-top-right-radius: 4px; + -moz-border-radius-bottomright: 4px; + -webkit-border-bottom-right-radius: 4px; + border-bottom-right-radius: 4px; +} + +/* separator between buttons, required for berder between button with ui color */ +.elfinder-toolbar-button-separator { + float:left; + padding:0; + height:24px; + border-top:0 solid; + border-right:0 solid; + border-bottom:0 solid; + width:0; +} + +.elfinder-touch .elfinder-toolbar-button-separator { + height:20px; +} + +/* change icon opacity^ not button */ +.elfinder .elfinder-button.ui-state-disabled { opacity:1; filter:Alpha(Opacity=100);} +.elfinder .elfinder-button.ui-state-disabled .elfinder-button-icon, +.elfinder .elfinder-button.ui-state-disabled .elfinder-button-text { opacity:.4; filter:Alpha(Opacity=40);} + +/* rtl enviroment */ +.elfinder-rtl .elfinder-buttonset { float:right; } + +/* icon inside button */ +.elfinder-button-icon { + width:16px; + height:16px; + /*display:block;*/ + display:inline-block; + background:url('../img/toolbar.png') no-repeat; +} +.elfinder-button-text { + position: relative; + display: inline-block; + top: -4px; + margin: 0 2px; + font-size: 12px; +} + +.elfinder-touch .elfinder-button-icon { + zoom: 1.25; + -moz-transform-origin: top left; + -moz-transform: scale(1.25); +} +.elfinder-touch .elfinder-button-text { + top: -5px; +} + +/* buttons icons */ +.elfinder-button-icon-home { background-position: 0 0; } +.elfinder-button-icon-back { background-position: 0 -112px; } +.elfinder-button-icon-forward { background-position: 0 -128px; } +.elfinder-button-icon-up { background-position: 0 -144px; } +.elfinder-button-icon-dir { background-position: 0 -16px; } +.elfinder-button-icon-opendir { background-position: 0 -32px; } +.elfinder-button-icon-reload { background-position: 0 -160px; } +.elfinder-button-icon-open { background-position: 0 -176px; } +.elfinder-button-icon-mkdir { background-position: 0 -192px; } +.elfinder-button-icon-mkfile { background-position: 0 -208px; } +.elfinder-button-icon-rm { background-position: 0 -832px; } +.elfinder-button-icon-trash { background-position: 0 -224px; } +.elfinder-button-icon-restore { background-position: 0 -816px; } +.elfinder-button-icon-copy { background-position: 0 -240px; } +.elfinder-button-icon-cut { background-position: 0 -256px; } +.elfinder-button-icon-paste { background-position: 0 -272px; } +.elfinder-button-icon-getfile { background-position: 0 -288px; } +.elfinder-button-icon-duplicate { background-position: 0 -304px; } +.elfinder-button-icon-rename { background-position: 0 -320px; } +.elfinder-button-icon-edit { background-position: 0 -336px; } +.elfinder-button-icon-quicklook { background-position: 0 -352px; } +.elfinder-button-icon-upload { background-position: 0 -368px; } +.elfinder-button-icon-download { background-position: 0 -384px; } +.elfinder-button-icon-info { background-position: 0 -400px; } +.elfinder-button-icon-extract { background-position: 0 -416px; } +.elfinder-button-icon-archive { background-position: 0 -432px; } +.elfinder-button-icon-view { background-position: 0 -448px; } +.elfinder-button-icon-view-list { background-position: 0 -464px; } +.elfinder-button-icon-help { background-position: 0 -480px; } +.elfinder-button-icon-resize { background-position: 0 -512px; } +.elfinder-button-icon-link { background-position: 0 -528px; } +.elfinder-button-icon-search { background-position: 0 -561px; } +.elfinder-button-icon-sort { background-position: 0 -577px; } +.elfinder-button-icon-rotate-r { background-position: 0 -625px; } +.elfinder-button-icon-rotate-l { background-position: 0 -641px; } +.elfinder-button-icon-netmount { background-position: 0 -688px; } +.elfinder-button-icon-netunmount { background-position: 0 -96px; } +.elfinder-button-icon-places { background-position: 0 -704px; } +.elfinder-button-icon-chmod { background-position: 0 -48px; } +.elfinder-button-icon-accept { background-position: 0 -736px; } +.elfinder-button-icon-opendir { background-position: 0 -32px; } +.elfinder-button-icon-menu { background-position: 0 -752px; } +.elfinder-button-icon-colwidth { background-position: 0 -768px; } +.elfinder-button-icon-fullscreen { background-position: 0 -784px; } +.elfinder-button-icon-unfullscreen { background-position: 0 -800px; } +.elfinder-button-icon-empty { background-position: 0 -848px; } +.elfinder-button-icon-undo { background-position: 0 -864px; } +.elfinder-button-icon-redo { background-position: 0 -880px; } +.elfinder-button-icon-preference { background-position: 0 -896px; } +.elfinder-button-icon-mkdirin { background-position: 0 -912px; } +.elfinder-button-icon-selectall { background-position: 0 -928px; } +.elfinder-button-icon-selectnone { background-position: 0 -944px; } +.elfinder-button-icon-selectinvert { background-position: 0 -960px; } + +/* button with dropdown menu*/ +.elfinder .elfinder-menubutton { overflow:visible; } + +/* button with spinner icon */ +.elfinder-button-icon-spinner { background: url("../img/spinner-mini.gif") center center no-repeat; } + +/* menu */ +.elfinder-button-menu { + position:absolute; + left:0; + top:25px; + padding:3px 0; +} + +.elfinder-touch .elfinder-button-menu { + top:35px; +} + +/* menu item */ +.elfinder-button-menu-item { + white-space:nowrap; + cursor:default; + padding:5px 19px; + position:relative; +} +.elfinder-touch .elfinder-button-menu-item { + padding: 12px 19px +} + +/* fix hover ui class */ +.elfinder-button-menu .ui-state-hover { border:0 solid; } + +.elfinder-button-menu-item-separated { border-top:1px solid #ccc; } + +.elfinder-button-menu-item .ui-icon { + width:16px; + height:16px; + position:absolute; + left:2px; + top:50%; + margin-top:-8px; + display:none; +} + +.elfinder-button-menu-item-selected .ui-icon { display:block; } +.elfinder-button-menu-item-selected-asc .ui-icon-arrowthick-1-s { display:none; } +.elfinder-button-menu-item-selected-desc .ui-icon-arrowthick-1-n { display:none; } + +/* hack for upload button */ +.elfinder-button form { + position:absolute; + top:0; + right:0; + opacity: 0; filter:Alpha(Opacity=0); + cursor: pointer; +} + +.elfinder .elfinder-button form input { background:transparent; cursor: default;} + +/* search "button" */ +.elfinder .elfinder-button-search { + border:0 solid; + background:transparent; + padding:0; + margin: 1px 4px; + height: auto; + min-height: 26px; + float:right; + width:202px; + overflow: visible; +} + +.elfinder .elfinder-button-search .elfinder-button-menu { + font-size: 8pt; + text-align: center; + width: 100%; + overflow: hidden; +} + +.elfinder .elfinder-button-search .elfinder-button-menu div { + margin-left: auto; + margin-right: auto; + margin-bottom: 5px; +} + +.elfinder .elfinder-button-search .elfinder-button-menu div .ui-state-hover { + border: 1px solid; +} + +/* ltr/rte enviroment */ +.elfinder-ltr .elfinder-button-search { float:right; margin-right:10px; } +.elfinder-rtl .elfinder-button-search { float:left; margin-left:10px; } + +/* search text field */ +.elfinder-button-search input { + width:160px; + height:22px; + padding:0 20px; + line-height: 22px; + border:0 solid; + border:1px solid #aaa; + -moz-border-radius: 12px; + -webkit-border-radius: 12px; + border-radius: 12px; + outline:0px solid; +} + +.elfinder-button-search input::-ms-clear { + display: none; +} +.elfinder-touch .elfinder-button-search input { + height:28px; + line-height: 28px; +} +.elfinder-rtl .elfinder-button-search input { direction:rtl; } + + +/* icons */ +.elfinder-button-search .ui-icon { + position:absolute; + height:18px; + top: 50%; + margin:-8px 4px 0 4px; + opacity: .6; + filter:Alpha(Opacity=60); +} +.elfinder-button-search .ui-checkboxradio-icon { + display: none; +} + +/* search/close icons */ +.elfinder-ltr .elfinder-button-search .ui-icon-search { left:0;} +.elfinder-rtl .elfinder-button-search .ui-icon-search { right:0;} +.elfinder-ltr .elfinder-button-search .ui-icon-close { right:0;} +.elfinder-rtl .elfinder-button-search .ui-icon-close { left:0;} + +/* toolbar swipe handle */ +.elfinder-toolbar-swipe-handle { + position: absolute; + top: 0px; + left: 0px; + height: 50px; + width: 100%; + pointer-events: none; + background: linear-gradient(to bottom, + rgba(221,228,235,1) 0, + rgba(221,228,235,0.8) 2px, + rgba(216,223,230,0.3) 5px, + rgba(0,0,0,0.1) 95%, + rgba(0,0,0,0) 100%); +} + diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/css/elfinder.min.css b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/css/elfinder.min.css new file mode 100644 index 00000000..982bdb8c --- /dev/null +++ b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/css/elfinder.min.css @@ -0,0 +1,9 @@ +/*! + * elFinder - file manager for web + * Version 2.1.28 (2017-08-17) + * http://elfinder.org + * + * Copyright 2009-2017, Studio 42 + * Licensed under a 3-clauses BSD license + */ +.elfinder-dialog-resize{margin-top:.3em}.elfinder-resize-type{float:left;margin-bottom:.4em}.elfinder-resize-control{float:left}.elfinder-resize-control input[type=text]{border:1px solid #aaa;text-align:right;width:4em}.elfinder-resize-control input.elfinder-resize-bg{text-align:center;width:5em;direction:ltr}.elfinder-dialog-resize .elfinder-resize-imgrotate,.elfinder-dialog-resize .elfinder-resize-pallet{cursor:pointer}.elfinder-dialog-resize .elfinder-resize-picking{cursor:crosshair}.elfinder-dialog-resize .elfinder-resize-grid8+button{padding-top:2px;padding-bottom:2px}.elfinder-resize-preview{width:400px;height:400px;padding:10px;background:#fff;border:1px solid #aaa;float:right;position:relative;overflow:hidden;text-align:left;direction:ltr}.elfinder .elfinder-cwd table tbody.elfinder-cwd-fixheader,.elfinder-resize-handle,div.elfinder-cwd-wrapper-list tr.ui-state-default td{position:relative}.elfinder-resize-handle-hline,.elfinder-resize-handle-vline{position:absolute;background-image:url(../img/crop.gif)}.elfinder-resize-handle-hline{width:100%;height:1px!important;background-repeat:repeat-x}.elfinder-resize-handle-vline{width:1px!important;height:100%;background-repeat:repeat-y}.elfinder-resize-handle-hline-top{top:0;left:0}.elfinder-resize-handle-hline-bottom{bottom:0;left:0}.elfinder-resize-handle-vline-left{top:0;left:0}.elfinder-resize-handle-vline-right{top:0;right:0}.elfinder-resize-handle-point{position:absolute;width:8px;height:8px;border:1px solid #777;background:0 0}.elfinder-resize-handle-point-n{top:0;left:50%;margin-top:-5px;margin-left:-5px}.elfinder-resize-handle-point-e,.elfinder-resize-handle-point-ne{top:0;right:0;margin-top:-5px;margin-right:-5px}.elfinder-resize-handle-point-e{top:50%}.elfinder-resize-handle-point-se{bottom:0;right:0;margin-bottom:-5px;margin-right:-5px}.elfinder-resize-handle-point-s,.elfinder-resize-handle-point-sw{bottom:0;left:50%;margin-bottom:-5px;margin-left:-5px}.elfinder-resize-handle-point-sw{left:0}.elfinder-resize-handle-point-nw,.elfinder-resize-handle-point-w{top:50%;left:0;margin-top:-5px;margin-left:-5px}.elfinder-resize-handle-point-nw{top:0}.elfinder-resize-spinner{position:absolute;width:200px;height:30px;top:50%;margin-top:-25px;left:50%;margin-left:-100px;text-align:center;background:url(../img/progress.gif) center bottom repeat-x}.elfinder-resize-row{margin-bottom:9px;position:relative}.elfinder-resize-label{float:left;width:80px;padding-top:3px}.elfinder-resize-checkbox-label{border:1px solid transparent}.elfinder-dialog .elfinder-dialog-resize .elfinder-resize-whctrls{margin:-20px 5px 0}.elfinder-ltr .elfinder-dialog .elfinder-dialog-resize .elfinder-resize-whctrls{float:right}.elfinder-help-team div,.elfinder-info-tb span,.elfinder-rtl .elfinder-dialog .elfinder-dialog-resize .elfinder-resize-whctrls{float:left}.elfinder-dialog .elfinder-dialog-resize .ui-resizable-e,.elfinder-dialog .elfinder-dialog-resize .ui-resizable-w{height:100%;width:10px}.elfinder-dialog .elfinder-dialog-resize .ui-resizable-n,.elfinder-dialog .elfinder-dialog-resize .ui-resizable-s{width:100%;height:10px}.elfinder-dialog .elfinder-dialog-resize .ui-resizable-e{margin-right:-7px}.elfinder-dialog .elfinder-dialog-resize .ui-resizable-w{margin-left:-7px}.elfinder-dialog .elfinder-dialog-resize .ui-resizable-s{margin-bottom:-7px}.elfinder-dialog .elfinder-dialog-resize .ui-resizable-n{margin-top:-7px}.elfinder-dialog .elfinder-dialog-resize .ui-resizable-ne,.elfinder-dialog .elfinder-dialog-resize .ui-resizable-nw,.elfinder-dialog .elfinder-dialog-resize .ui-resizable-se,.elfinder-dialog .elfinder-dialog-resize .ui-resizable-sw{width:10px;height:10px}.elfinder-dialog .elfinder-dialog-resize .ui-resizable-se{background:0 0;bottom:0;right:0;margin-right:-7px;margin-bottom:-7px}.elfinder-dialog .elfinder-dialog-resize .ui-resizable-sw{margin-left:-7px;margin-bottom:-7px}.elfinder-dialog .elfinder-dialog-resize .ui-resizable-ne{margin-right:-7px;margin-top:-7px}.elfinder-dialog .elfinder-dialog-resize .ui-resizable-nw{margin-left:-7px;margin-top:-7px}.elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-n,.elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-s{height:20px}.elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-e,.elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-w{width:20px}.elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-ne,.elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-nw,.elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-se,.elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-sw{width:30px;height:30px}.elfinder-touch .elfinder-dialog .elfinder-dialog-resize .elfinder-resize-preview .ui-resizable-se{width:30px;height:30px;zoom:1;margin:0}.elfinder-dialog-resize .ui-icon-grip-solid-vertical{position:absolute;top:50%;right:0;margin-top:-8px;margin-right:-11px}.elfinder-dialog-resize .ui-icon-grip-solid-horizontal{position:absolute;left:50%;bottom:0;margin-left:-8px;margin-bottom:-11px}.elfinder-dialog-resize .elfinder-resize-row .ui-buttonset{float:right}.elfinder-dialog-resize .elfinder-resize-degree input,.elfinder-dialog-resize .elfinder-resize-quality input{width:2.5em}.elfinder-dialog-resize .elfinder-resize-degree button.ui-button{padding:6px 8px}.elfinder-dialog-resize button.ui-button span{padding:0}.ui-widget-content .elfinder-dialog-resize .elfinder-resize-rotate-slider{width:195px;margin:10px 7px;background-color:#fafafa}.elfinder-dialog-resize .elfinder-resize-type span.ui-checkboxradio-icon{display:none}.elfinder-resize-preset-container{box-sizing:border-box;border-radius:5px}.elfinder-file-edit{width:100%;height:99%;margin:0;padding:2px;border:1px solid #ccc;box-sizing:border-box;resize:none}.elfinder-touch .elfinder-file-edit{font-size:16px}.elfinder-touch.elfinder-fullscreen-native textarea.elfinder-file-edit{padding-bottom:20em;margin-bottom:-20em}.std42-dialog .ui-dialog-buttonpane .elfinder-dialog-confirm-encoding,.std42-dialog .ui-dialog-titlebar select{font-size:12px}div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon{position:absolute;top:4px;left:0;right:0;margin:auto 0 auto auto}.elfinder-touch div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon{top:7px}.elfinder-rtl div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon{margin:auto auto auto 0}.elfinder-help{margin-bottom:.5em}.elfinder-help .ui-tabs-panel{overflow:auto;padding:10px}.elfinder-dialog .ui-tabs .ui-tabs-nav li a{padding:.2em 1em}.elfinder-help-shortcuts{height:auto;padding:10px;margin:0;box-sizing:border-box}.elfinder-help-shortcut{white-space:nowrap;clear:both}.elfinder-help-shortcut-pattern{float:left;width:160px}.elfinder-help-logo{width:100px;height:96px;float:left;margin-right:1em;background:url(../img/logo.png) center center no-repeat}.elfinder-help h3{font-size:1.5em;margin:.2em 0 .3em}.elfinder-help-separator{clear:both;padding:.5em}.elfinder-help-link,.std42-dialog .ui-dialog-buttonpane button span.ui-icon{padding:2px}.elfinder-help .ui-priority-secondary{font-size:.9em}.elfinder-help .ui-priority-primary{margin-bottom:7px}.elfinder-help-team{clear:both;text-align:right;border-bottom:1px solid #ccc;margin:.5em 0;font-size:.9em}.elfinder-help-license{font-size:.9em}.elfinder-help-disabled{font-weight:700;text-align:center;margin:90px 0}.elfinder-help .elfinder-dont-panic{display:block;border:1px solid transparent;width:200px;height:200px;margin:30px auto;text-decoration:none;text-align:center;position:relative;background:#d90004;-moz-box-shadow:5px 5px 9px #111;-webkit-box-shadow:5px 5px 9px #111;box-shadow:5px 5px 9px #111;background:-moz-radial-gradient(80px 80px,circle farthest-corner,#d90004 35%,#960004 100%);background:-webkit-gradient(radial,80 80,60,80 80,120,from(#d90004),to(#960004));-moz-border-radius:100px;-webkit-border-radius:100px;border-radius:100px;outline:none}.elfinder-help .elfinder-dont-panic span{font-size:3em;font-weight:700;text-align:center;color:#fff;position:absolute;left:0;top:45px}.elfinder-help-debug{height:100%;padding:0;margin:0;overflow:none;border:none}.elfinder-help-debug .ui-tabs-panel{padding:0;margin:0;overflow:auto}.elfinder-help-debug fieldset{margin-bottom:10px;border-color:#789;border-radius:10px}.elfinder-help-debug legend{font-size:1.2em;font-weight:700;color:#2e8b57}.elfinder-help-debug dl{margin:0}.elfinder-help-debug dt{color:#789}.elfinder-help-debug dt:before{content:"["}.elfinder-help-debug dt:after{content:"]"}.elfinder-help-debug dd{margin-left:1em}.elfinder-help-preference{padding:10px;height:auto;min-height:100%;box-sizing:border-box}.elfinder-help-preference dl{width:100%}.elfinder-help-preference dt{display:block;width:200px;clear:left;float:left;max-width:50%}.elfinder-rtl .elfinder-help-preference dt{clear:right;float:right}.elfinder-help-preference dd{margin-bottom:1em}.elfinder-help-preference dd input[type=checkbox],.elfinder-help-preference dd label{white-space:nowrap;display:inline-block;cursor:pointer}.elfinder-info-title .elfinder-cwd-bgurl:after{left:-28px}.elfinder-info-title .elfinder-cwd-icon-video:after{left:-7px}.elfinder-upload-dialog-wrapper .elfinder-upload-dirselect{position:absolute;bottom:2px;width:16px;height:16px;padding:10px;border:none;overflow:hidden;cursor:pointer}.elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-item .ui-icon,.elfinder-ltr .elfinder-upload-dialog-wrapper .elfinder-upload-dirselect{left:2px}.elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-item .ui-icon,.elfinder-rtl .elfinder-upload-dialog-wrapper .elfinder-upload-dirselect{right:2px}.ui-front{z-index:100}.elfinder{padding:0;position:relative;display:block;visibility:visible;font-size:18px;font-family:Verdana,Arial,Helvetica,sans-serif}.elfinder.elfinder-processing *{cursor:progress!important}.elfinder.elfinder-processing.elfinder-touch .elfinder-workzone:after{position:absolute;top:0;width:100%;height:3px;content:'';left:0;background-image:url(../img/progress.gif);opacity:.6;pointer-events:none}.elfinder :not(input):not(textarea):not(select):not([contenteditable=true]),.elfinder-contextmenu :not(input):not(textarea):not(select):not([contenteditable=true]){-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-user-select:none;-moz-user-select:none;-khtml-user-select:none;user-select:none}.elfinder .overflow-scrolling-touch{-webkit-overflow-scrolling:touch}.elfinder-rtl{text-align:right;direction:rtl}.elfinder-workzone{padding:0;position:relative;overflow:hidden}.elfinder-lock,.elfinder-perms,.elfinder-symlink{position:absolute;width:16px;height:16px;background-image:url(../img/toolbar.png);background-repeat:no-repeat}.elfinder-perms,.elfinder-symlink{background-position:0 -528px}.elfinder-na .elfinder-perms{background-position:0 -96px}.elfinder-ro .elfinder-perms{background-position:0 -64px}.elfinder-wo .elfinder-perms{background-position:0 -80px}.elfinder-group .elfinder-perms{background-position:0 0}.elfinder-lock{background-position:0 -656px}.elfinder-drag-helper{top:0;left:0;width:70px;height:60px;padding:0 0 0 25px;z-index:100000;will-change:left,top}.elfinder-drag-helper.html5-native{position:absolute;top:-1000px;left:-1000px}.elfinder-drag-helper-icon-status{position:absolute;width:16px;height:16px;left:42px;top:60px;background:url(../img/toolbar.png) 0 -96px no-repeat;display:block}.elfinder-drag-helper-move .elfinder-drag-helper-icon-status{background-position:0 -720px}.elfinder-drag-helper-plus .elfinder-drag-helper-icon-status{background-position:0 -544px}.elfinder-drag-num{position:absolute;top:0;left:0;width:16px;height:14px;text-align:center;padding-top:2px;font-weight:700;color:#fff;background-color:red;-moz-border-radius:8px;-webkit-border-radius:8px;border-radius:8px}.elfinder-drag-helper .elfinder-cwd-icon{margin:0 0 0 -24px;float:left}.elfinder-overlay{position:absolute;opacity:.2;filter:Alpha(Opacity=20)}.elfinder .elfinder-panel{position:relative;background-image:none;padding:7px 12px}[draggable=true]{-khtml-user-drag:element}.elfinder [contentEditable=true]:empty:not(:focus):before{content:attr(data-ph)}.elfinder div.elfinder-bottomtray{position:fixed;bottom:0;max-width:100%;opacity:.8}.elfinder.elfinder-ltr div.elfinder-bottomtray{left:0}.elfinder.elfinder-rtl div.elfinder-bottomtray{right:0}.elfinder .elfinder-contextmenu,.elfinder .elfinder-contextmenu-sub{position:absolute;border:1px solid #aaa;background:#fff;color:#555;padding:4px 0;top:0;left:0}.elfinder .elfinder-contextmenu-sub{top:5px}.elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-sub{margin-left:-5px}.elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-sub{margin-right:-5px}.elfinder .elfinder-contextmenu-header{margin-top:-4px;padding:0 .5em .2ex;border:none;text-align:center}.elfinder .elfinder-contextmenu-header span{font-size:.8em;font-weight:bolder}.elfinder .elfinder-contextmenu-item{position:relative;display:block;padding:4px 30px;text-decoration:none;white-space:nowrap;cursor:default}.elfinder .elfinder-contextmenu-item.ui-state-active,.elfinder .std42-dialog .ui-dialog-content form label{border:none}.elfinder .elfinder-contextmenu-item .ui-icon{width:16px;height:16px;position:absolute;left:auto;right:auto;top:50%;margin-top:-8px}.elfinder-touch .elfinder-contextmenu-item{padding:12px 38px}.elfinder-navbar-root-local.elfinder-contextmenu-icon{background-image:url(../img/volume_icon_local.png)}.elfinder-navbar-root-ftp.elfinder-contextmenu-icon{background-image:url(../img/volume_icon_ftp.png)}.elfinder-navbar-root-sql.elfinder-contextmenu-icon{background-image:url(../img/volume_icon_sql.png)}.elfinder-navbar-root-dropbox.elfinder-contextmenu-icon{background-image:url(../img/volume_icon_dropbox.png)}.elfinder-navbar-root-googledrive.elfinder-contextmenu-icon{background-image:url(../img/volume_icon_googledrive.png)}.elfinder-navbar-root-onedrive.elfinder-contextmenu-icon{background-image:url(../img/volume_icon_onedrive.png)}.elfinder-navbar-root-box.elfinder-contextmenu-icon{background-image:url(../img/volume_icon_box.png)}.elfinder .elfinder-contextmenu .elfinder-contextmenu-item span{display:block}.elfinder .elfinder-contextmenu-sub .elfinder-contextmenu-item{padding-left:12px;padding-right:12px}.elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-item{text-align:left}.elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-item{text-align:right}.elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-sub .elfinder-contextsubmenu-item-icon{padding-left:28px}.elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-sub .elfinder-contextsubmenu-item-icon{padding-right:28px}.elfinder-touch .elfinder-contextmenu-ltr .elfinder-contextmenu-sub .elfinder-contextsubmenu-item-icon{padding-left:36px}.elfinder-touch .elfinder-contextmenu-rtl .elfinder-contextmenu-sub .elfinder-contextsubmenu-item-icon{padding-right:36px}.elfinder .elfinder-contextmenu-arrow,.elfinder .elfinder-contextmenu-extra-icon,.elfinder .elfinder-contextmenu-icon{position:absolute;top:50%;margin-top:-8px;overflow:hidden}.elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-icon{left:8px}.elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-extra-icon,.elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-icon{right:8px}.elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-extra-icon{left:8px}.elfinder .elfinder-contextmenu-arrow{width:16px;height:16px;background:url(../img/arrows-normal.png) 5px 4px no-repeat}.elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-arrow{right:5px}.elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-arrow{left:5px;background-position:0 -10px}.elfinder .elfinder-contextmenu-extra-icon a,.elfinder .elfinder-contextmenu-extra-icon span{display:inline-block;width:100%;height:100%;padding:20px;margin:0;color:transparent!important;text-decoration:none;cursor:pointer}.elfinder .elfinder-contextmenu .ui-state-hover{border:0 solid;background-image:none}.elfinder .elfinder-contextmenu-separator{height:0;border-top:1px solid #ccc;margin:0 1px}.elfinder .elfinder-button-icon.ui-state-disabled{background-image:url(../img/toolbar.png)!important}.elfinder-cwd-wrapper{overflow:auto;position:relative;padding:2px;margin:0}.elfinder-cwd-wrapper-list{padding:0}.elfinder-cwd{position:relative;cursor:default;padding:0;margin:0;-ms-touch-action:auto;touch-action:auto}.elfinder .elfinder-cwd-wrapper.elfinder-droppable-active{outline:2px solid #8cafed;outline-offset:-2px}.elfinder-cwd-wrapper-empty .elfinder-cwd:after{display:block;position:absolute;top:40%;left:0;right:0;margin-top:-2em;line-height:1.5em;text-align:center;white-space:pre-wrap;opacity:.6;filter:Alpha(Opacity=60);font-weight:700}.elfinder-cwd-file .elfinder-cwd-select{position:absolute;top:0;left:0;width:30px;height:30px;background-color:transparent;opacity:.4;filter:Alpha(Opacity=40)}.elfinder .elfinder-cwd-selectall,.elfinder-cwd-file.ui-selected .elfinder-cwd-select{opacity:.8;filter:Alpha(Opacity=80)}.elfinder-rtl .elfinder-cwd-file .elfinder-cwd-select{left:auto;right:0}.elfinder .elfinder-cwd-selectall{position:absolute;width:30px;height:30px;top:0}.elfinder .elfinder-workzone.elfinder-cwd-wrapper-empty .elfinder-cwd-selectall{display:none}.elfinder-ltr .elfinder-workzone .elfinder-cwd-selectall{text-align:right;right:18px;left:auto}.elfinder-rtl .elfinder-workzone .elfinder-cwd-selectall{text-align:left;right:auto;left:18px}.elfinder-ltr.elfinder-mobile .elfinder-workzone .elfinder-cwd-selectall{right:0}.elfinder-rtl.elfinder-mobile .elfinder-workzone .elfinder-cwd-selectall{left:0}.elfinder-cwd-view-icons .elfinder-cwd-file .elfinder-cwd-select.ui-state-hover{background-color:transparent}.elfinder-cwd-view-icons .elfinder-cwd-file{width:120px;height:90px;padding-bottom:2px;cursor:default;border:none;position:relative}.elfinder-ltr .elfinder-cwd-view-icons .elfinder-cwd-file{float:left;margin:0 3px 2px 0}.elfinder-rtl .elfinder-cwd-view-icons .elfinder-cwd-file{float:right;margin:0 0 5px 3px}.elfinder-cwd-view-icons .elfinder-cwd-file .ui-state-hover{border:0 solid}.elfinder-cwd-view-icons .elfinder-cwd-file-wrapper{width:52px;height:52px;margin:1px auto;padding:2px;position:relative}.elfinder-cwd-view-icons .elfinder-cwd-filename{text-align:center;max-height:2.4em;line-height:1.2em;white-space:pre-line;overflow:hidden;text-overflow:ellipsis;-o-text-overflow:ellipsis;margin:3px 1px 0;padding:1px;-moz-border-radius:8px;-webkit-border-radius:8px;border-radius:8px;word-break:break-word;overflow-wrap:break-word;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.elfinder-cwd-view-icons .elfinder-perms{bottom:4px;right:2px}.elfinder-cwd-view-icons .elfinder-lock{top:-3px;right:-2px}.elfinder-cwd-view-icons .elfinder-symlink{bottom:6px;left:0}.elfinder-cwd-bgurl:after,.elfinder-cwd-icon{width:48px;height:48px;background:url(../img/icons-big.png) 0 0 no-repeat}.elfinder-cwd-icon{margin:0 auto;-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box;display:block}.elfinder-cwd-view-list .elfinder-navbar-root-local td .elfinder-cwd-icon,.elfinder-navbar-root-local .elfinder-cwd-icon{background-image:url(../img/volume_icon_local.png);background-position:0 0;background-size:contain}.elfinder-cwd .elfinder-navbar-root-local.elfinder-droppable-active .elfinder-cwd-icon{background-image:url(../img/volume_icon_local.png);background-size:contain;background-position:1px -1px}.elfinder-cwd-view-list .elfinder-navbar-root-trash td .elfinder-cwd-icon,.elfinder-navbar-root-trash .elfinder-cwd-icon{background-image:url(../img/volume_icon_trash.png);background-position:0 0;background-size:contain}.elfinder-cwd .elfinder-navbar-root-trash.elfinder-droppable-active .elfinder-cwd-icon{background-image:url(../img/volume_icon_trash.png);background-size:contain;background-position:1px -1px}.elfinder-cwd-view-list .elfinder-navbar-root-ftp td .elfinder-cwd-icon,.elfinder-navbar-root-ftp .elfinder-cwd-icon{background-image:url(../img/volume_icon_ftp.png);background-position:0 0;background-size:contain}.elfinder-cwd .elfinder-navbar-root-ftp.elfinder-droppable-active .elfinder-cwd-icon{background-image:url(../img/volume_icon_ftp.png);background-size:contain;background-position:1px -1px}.elfinder-cwd-view-list .elfinder-navbar-root-sql td .elfinder-cwd-icon,.elfinder-navbar-root-sql .elfinder-cwd-icon{background-image:url(../img/volume_icon_sql.png);background-position:0 0;background-size:contain}.elfinder-cwd .elfinder-navbar-root-sql.elfinder-droppable-active .elfinder-cwd-icon{background-image:url(../img/volume_icon_sql.png);background-size:contain;background-position:1px -1px}.elfinder-cwd-view-list .elfinder-navbar-root-dropbox td .elfinder-cwd-icon,.elfinder-navbar-root-dropbox .elfinder-cwd-icon{background-image:url(../img/volume_icon_dropbox.png);background-position:0 0;background-size:contain}.elfinder-cwd .elfinder-navbar-root-dropbox.elfinder-droppable-active .elfinder-cwd-icon{background-image:url(../img/volume_icon_dropbox.png);background-size:contain;background-position:1px -1px}.elfinder-cwd-view-list .elfinder-navbar-root-googledrive td .elfinder-cwd-icon,.elfinder-navbar-root-googledrive .elfinder-cwd-icon{background-image:url(../img/volume_icon_googledrive.png);background-position:0 0;background-size:contain}.elfinder-cwd .elfinder-navbar-root-googledrive.elfinder-droppable-active .elfinder-cwd-icon{background-image:url(../img/volume_icon_googledrive.png);background-size:contain}.elfinder-cwd-view-list .elfinder-navbar-root-onedrive td .elfinder-cwd-icon,.elfinder-navbar-root-onedrive .elfinder-cwd-icon{background-image:url(../img/volume_icon_onedrive.png);background-position:0 0;background-size:contain}.elfinder-cwd .elfinder-navbar-root-onedrive.elfinder-droppable-active .elfinder-cwd-icon{background-image:url(../img/volume_icon_onedrive.png);background-size:contain}.elfinder-cwd-view-list .elfinder-navbar-root-box td .elfinder-cwd-icon,.elfinder-navbar-root-box .elfinder-cwd-icon{background-image:url(../img/volume_icon_box.png);background-position:0 0;background-size:contain}.elfinder-cwd .elfinder-navbar-root-box.elfinder-droppable-active .elfinder-cwd-icon{background-image:url(../img/volume_icon_box.png);background-size:contain}.elfinder-cwd .elfinder-navbar-root-box.elfinder-droppable-active .elfinder-cwd-icon,.elfinder-cwd .elfinder-navbar-root-googledrive.elfinder-droppable-active .elfinder-cwd-icon,.elfinder-cwd .elfinder-navbar-root-onedrive.elfinder-droppable-active .elfinder-cwd-icon{background-position:1px -1px}.elfinder-cwd-view-list .elfinder-navbar-root-network td .elfinder-cwd-icon,.elfinder-navbar-root-network .elfinder-cwd-icon{background-image:url(../img/toolbar.png);background-position:0 71.65%;background-size:cover}.elfinder-cwd .elfinder-navbar-root-network.elfinder-droppable-active .elfinder-cwd-icon{background-image:url(../img/toolbar.png);background-size:cover;background-position:1px -1px}.elfinder-cwd-icon.elfinder-cwd-bgurl{background-position:center center;background-repeat:no-repeat}.elfinder-cwd-icon.elfinder-cwd-bgurl,.elfinder-cwd-icon.elfinder-cwd-bgurl.elfinder-cwd-bgself{-moz-background-size:cover;background-size:cover}.elfinder-cwd-bgurl:after{content:' ';position:relative;display:inline-block;top:36px;left:-38px;background-size:auto!important;opacity:.8;filter:Alpha(Opacity=60);-webkit-transform-origin:54px -24px;-webkit-transform:scale(.6);-moz-transform-origin:54px -24px;-moz-transform:scale(.6);-ms-transform-origin:54px -24px;-ms-transform:scale(.6);-o-transform-origin:54px -24px;-o-transform:scale(.6);transform-origin:54px -24px;transform:scale(.6)}.elfinder-cwd-icon-image:after,.elfinder-cwd-view-list .elfinder-cwd-icon.elfinder-cwd-icon-video.elfinder-cwd-bgurl:after{content:none}.elfinder-cwd-icon-video:after{top:32px;left:-26px;height:25px;width:22px;background-position:0 -373px;-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)}.elfinder-cwd .elfinder-droppable-active .elfinder-cwd-icon{background-position:0 -100px}.elfinder-cwd .elfinder-droppable-active{outline:2px solid #8cafed;outline-offset:-2px}.elfinder-cwd-icon-directory{background-position:0 -50px}.elfinder-cwd-icon-application,.elfinder-cwd-icon-application:after{background-position:0 -150px}.elfinder-cwd-icon-text,.elfinder-cwd-icon-text:after,.elfinder-cwd-icon-x-empty,.elfinder-cwd-icon-x-empty:after{background-position:0 -200px}.elfinder-cwd-icon-image,.elfinder-cwd-icon-image:after,.elfinder-cwd-icon-postscript,.elfinder-cwd-icon-postscript:after,.elfinder-cwd-icon-vnd-adobe-photoshop,.elfinder-cwd-icon-vnd-adobe-photoshop:after{background-position:0 -250px}.elfinder-cwd-icon-audio,.elfinder-cwd-icon-audio:after{background-position:0 -300px}.elfinder-cwd-icon-dash-xml,.elfinder-cwd-icon-flash-video,.elfinder-cwd-icon-video,.elfinder-cwd-icon-vnd-apple-mpegURL,.elfinder-cwd-icon-x-mpegURL{background-position:0 -350px}.elfinder-cwd-icon-rtf,.elfinder-cwd-icon-rtf:after,.elfinder-cwd-icon-rtfd,.elfinder-cwd-icon-rtfd:after{background-position:0 -401px}.elfinder-cwd-icon-pdf,.elfinder-cwd-icon-pdf:after{background-position:0 -450px}.elfinder-cwd-icon-ms-excel,.elfinder-cwd-icon-ms-excel:after,.elfinder-cwd-icon-msword,.elfinder-cwd-icon-msword:after,.elfinder-cwd-icon-vnd-ms-excel,.elfinder-cwd-icon-vnd-ms-excel-addin-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-excel-addin-macroEnabled-12:after,.elfinder-cwd-icon-vnd-ms-excel-sheet-binary-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-excel-sheet-binary-macroEnabled-12:after,.elfinder-cwd-icon-vnd-ms-excel-sheet-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-excel-sheet-macroEnabled-12:after,.elfinder-cwd-icon-vnd-ms-excel-template-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-excel-template-macroEnabled-12:after,.elfinder-cwd-icon-vnd-ms-excel:after,.elfinder-cwd-icon-vnd-ms-office,.elfinder-cwd-icon-vnd-ms-office:after,.elfinder-cwd-icon-vnd-ms-powerpoint,.elfinder-cwd-icon-vnd-ms-powerpoint-addin-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-powerpoint-addin-macroEnabled-12:after,.elfinder-cwd-icon-vnd-ms-powerpoint-presentation-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-powerpoint-presentation-macroEnabled-12:after,.elfinder-cwd-icon-vnd-ms-powerpoint-slide-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-powerpoint-slide-macroEnabled-12:after,.elfinder-cwd-icon-vnd-ms-powerpoint-slideshow-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-powerpoint-slideshow-macroEnabled-12:after,.elfinder-cwd-icon-vnd-ms-powerpoint-template-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-powerpoint-template-macroEnabled-12:after,.elfinder-cwd-icon-vnd-ms-powerpoint:after,.elfinder-cwd-icon-vnd-ms-word,.elfinder-cwd-icon-vnd-ms-word-document-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-word-document-macroEnabled-12:after,.elfinder-cwd-icon-vnd-ms-word-template-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-word-template-macroEnabled-12:after,.elfinder-cwd-icon-vnd-ms-word:after,.elfinder-cwd-icon-vnd-oasis-opendocument-chart,.elfinder-cwd-icon-vnd-oasis-opendocument-chart:after,.elfinder-cwd-icon-vnd-oasis-opendocument-database,.elfinder-cwd-icon-vnd-oasis-opendocument-database:after,.elfinder-cwd-icon-vnd-oasis-opendocument-formula,.elfinder-cwd-icon-vnd-oasis-opendocument-formula:after,.elfinder-cwd-icon-vnd-oasis-opendocument-graphics,.elfinder-cwd-icon-vnd-oasis-opendocument-graphics-template,.elfinder-cwd-icon-vnd-oasis-opendocument-graphics-template:after,.elfinder-cwd-icon-vnd-oasis-opendocument-graphics:after,.elfinder-cwd-icon-vnd-oasis-opendocument-image,.elfinder-cwd-icon-vnd-oasis-opendocument-image:after,.elfinder-cwd-icon-vnd-oasis-opendocument-presentation,.elfinder-cwd-icon-vnd-oasis-opendocument-presentation-template,.elfinder-cwd-icon-vnd-oasis-opendocument-presentation-template:after,.elfinder-cwd-icon-vnd-oasis-opendocument-presentation:after,.elfinder-cwd-icon-vnd-oasis-opendocument-spreadsheet,.elfinder-cwd-icon-vnd-oasis-opendocument-spreadsheet-template,.elfinder-cwd-icon-vnd-oasis-opendocument-spreadsheet-template:after,.elfinder-cwd-icon-vnd-oasis-opendocument-spreadsheet:after,.elfinder-cwd-icon-vnd-oasis-opendocument-text,.elfinder-cwd-icon-vnd-oasis-opendocument-text-master,.elfinder-cwd-icon-vnd-oasis-opendocument-text-master:after,.elfinder-cwd-icon-vnd-oasis-opendocument-text-template,.elfinder-cwd-icon-vnd-oasis-opendocument-text-template:after,.elfinder-cwd-icon-vnd-oasis-opendocument-text-web,.elfinder-cwd-icon-vnd-oasis-opendocument-text-web:after,.elfinder-cwd-icon-vnd-oasis-opendocument-text:after,.elfinder-cwd-icon-vnd-openofficeorg-extension,.elfinder-cwd-icon-vnd-openofficeorg-extension:after,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-presentation,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-presentation:after,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-slide,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-slide:after,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-slideshow,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-slideshow:after,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-template,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-template:after,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-spreadsheetml-sheet,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-spreadsheetml-sheet:after,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-spreadsheetml-template,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-spreadsheetml-template:after,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-wordprocessingml-document,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-wordprocessingml-document:after,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-wordprocessingml-template,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-wordprocessingml-template:after{background-position:0 -500px}.elfinder-cwd-icon-html,.elfinder-cwd-icon-html:after{background-position:0 -550px}.elfinder-cwd-icon-css,.elfinder-cwd-icon-css:after{background-position:0 -600px}.elfinder-cwd-icon-javascript,.elfinder-cwd-icon-javascript:after,.elfinder-cwd-icon-x-javascript,.elfinder-cwd-icon-x-javascript:after{background-position:0 -650px}.elfinder-cwd-icon-x-perl,.elfinder-cwd-icon-x-perl:after{background-position:0 -700px}.elfinder-cwd-icon-x-python,.elfinder-cwd-icon-x-python:after{background-position:0 -750px}.elfinder-cwd-icon-x-ruby,.elfinder-cwd-icon-x-ruby:after{background-position:0 -800px}.elfinder-cwd-icon-x-sh,.elfinder-cwd-icon-x-sh:after,.elfinder-cwd-icon-x-shellscript,.elfinder-cwd-icon-x-shellscript:after{background-position:0 -850px}.elfinder-cwd-icon-x-c,.elfinder-cwd-icon-x-c--,.elfinder-cwd-icon-x-c--:after,.elfinder-cwd-icon-x-c--hdr,.elfinder-cwd-icon-x-c--hdr:after,.elfinder-cwd-icon-x-c--src,.elfinder-cwd-icon-x-c--src:after,.elfinder-cwd-icon-x-c:after,.elfinder-cwd-icon-x-chdr,.elfinder-cwd-icon-x-chdr:after,.elfinder-cwd-icon-x-csrc,.elfinder-cwd-icon-x-csrc:after,.elfinder-cwd-icon-x-java,.elfinder-cwd-icon-x-java-source,.elfinder-cwd-icon-x-java-source:after,.elfinder-cwd-icon-x-java:after{background-position:0 -900px}.elfinder-cwd-icon-x-php,.elfinder-cwd-icon-x-php:after{background-position:0 -950px}.elfinder-cwd-icon-xml,.elfinder-cwd-icon-xml:after{background-position:0 -1000px}.elfinder-cwd-icon-x-7z-compressed,.elfinder-cwd-icon-x-7z-compressed:after,.elfinder-cwd-icon-x-xz,.elfinder-cwd-icon-x-xz:after,.elfinder-cwd-icon-x-zip,.elfinder-cwd-icon-x-zip:after,.elfinder-cwd-icon-zip,.elfinder-cwd-icon-zip:after{background-position:0 -1050px}.elfinder-cwd-icon-x-gzip,.elfinder-cwd-icon-x-gzip:after,.elfinder-cwd-icon-x-tar,.elfinder-cwd-icon-x-tar:after{background-position:0 -1100px}.elfinder-cwd-icon-x-bzip,.elfinder-cwd-icon-x-bzip2,.elfinder-cwd-icon-x-bzip2:after,.elfinder-cwd-icon-x-bzip:after{background-position:0 -1150px}.elfinder-cwd-icon-x-rar,.elfinder-cwd-icon-x-rar-compressed,.elfinder-cwd-icon-x-rar-compressed:after,.elfinder-cwd-icon-x-rar:after{background-position:0 -1200px}.elfinder-cwd-icon-x-shockwave-flash,.elfinder-cwd-icon-x-shockwave-flash:after{background-position:0 -1250px}.elfinder-cwd-icon-group{background-position:0 -1300px}.elfinder-cwd-filename input{width:100%;border:none;margin:0;padding:0}.elfinder-cwd-view-icons,.elfinder-cwd-view-icons input{text-align:center}.elfinder-cwd-view-icons textarea{width:100%;border:0 solid;margin:0;padding:0;text-align:center;overflow:hidden;resize:none}.elfinder-cwd-wrapper.elfinder-cwd-fixheader .elfinder-cwd::after,.std42-dialog.elfinder-dialog-minimized .ui-dialog-titlebar select{display:none}.elfinder-cwd table{width:100%;border-collapse:separate;border:0 solid;margin:0 0 10px;border-spacing:0;box-sizing:padding-box;padding:2px;position:relative}.elfinder-cwd-wrapper-list.elfinder-cwd-fixheader{position:absolute;overflow:hidden}.elfinder-cwd-wrapper-list.elfinder-cwd-fixheader:before{content:'';position:absolute;width:100%;top:0;height:3px;background-color:#fff}.elfinder-droppable-active+.elfinder-cwd-wrapper-list.elfinder-cwd-fixheader:before{background-color:#8cafed}.elfinder .elfinder-workzone div.elfinder-cwd-fixheader table{table-layout:fixed}.elfinder-ltr .elfinder-cwd thead .elfinder-cwd-selectall{text-align:left;right:auto;left:0;padding-top:3px}.elfinder-rtl .elfinder-cwd thead .elfinder-cwd-selectall{text-align:right;right:0;left:auto;padding-top:3px}.elfinder-touch .elfinder-cwd thead .elfinder-cwd-selectall{padding-top:5px}.elfinder .elfinder-cwd table thead tr{border-left:0 solid;border-top:0 solid;border-right:0 solid}.elfinder .elfinder-cwd table thead td{padding:4px 14px}.elfinder-ltr .elfinder-cwd.elfinder-has-checkbox table thead td:first-child{padding:4px 14px 4px 22px}.elfinder-rtl .elfinder-cwd.elfinder-has-checkbox table thead td:first-child{padding:4px 22px 4px 14px}.elfinder .elfinder-cwd table thead td.ui-state-active{background:#ebf1f6;background:-moz-linear-gradient(top,#ebf1f6 0%,#abd3ee 50%,#89c3eb 51%,#d5ebfb 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#ebf1f6),color-stop(50%,#abd3ee),color-stop(51%,#89c3eb),color-stop(100%,#d5ebfb));background:-webkit-linear-gradient(top,#ebf1f6 0%,#abd3ee 50%,#89c3eb 51%,#d5ebfb 100%);background:-o-linear-gradient(top,#ebf1f6 0%,#abd3ee 50%,#89c3eb 51%,#d5ebfb 100%);background:-ms-linear-gradient(top,#ebf1f6 0%,#abd3ee 50%,#89c3eb 51%,#d5ebfb 100%);background:linear-gradient(to bottom,#ebf1f6 0%,#abd3ee 50%,#89c3eb 51%,#d5ebfb 100%);filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#ebf1f6', endColorstr='#d5ebfb',GradientType=0 )}.elfinder .elfinder-cwd table td{padding:4px 12px;white-space:pre;overflow:hidden;text-align:right;cursor:default;border:0 solid}.elfinder .elfinder-cwd table tbody td:first-child{position:relative}.elfinder .elfinder-cwd table td div{box-sizing:content-box}tr.elfinder-cwd-file td .elfinder-cwd-select{width:40px;padding-top:3px}.elfinder-touch tr.elfinder-cwd-file td .elfinder-cwd-select{padding-top:10px}.elfinder-touch .elfinder-cwd tr td{padding:10px 12px}.elfinder-touch .elfinder-cwd table thead td{padding:8px 14px}.elfinder-touch .elfinder-cwd tr.elfinder-cwd-file td{padding:13px 12px}.elfinder-ltr .elfinder-cwd table td{text-align:right}.elfinder-ltr .elfinder-cwd table td:first-child{text-align:left}.elfinder-rtl .elfinder-cwd table td{text-align:left}.elfinder-info-tb tr td:first-child,.elfinder-rtl .elfinder-cwd table td:first-child{text-align:right}.elfinder-odd-row{background:#eee}.elfinder-cwd-view-list .elfinder-cwd-file-wrapper{width:97%;position:relative}.elfinder-ltr .elfinder-cwd-view-list.elfinder-has-checkbox .elfinder-cwd-file-wrapper{margin-left:8px}.elfinder-rtl .elfinder-cwd-view-list.elfinder-has-checkbox .elfinder-cwd-file-wrapper{margin-right:8px}.elfinder-ltr .elfinder-cwd-view-list .elfinder-cwd-filename{padding-left:23px}.elfinder-rtl .elfinder-cwd-view-list .elfinder-cwd-filename{padding-right:23px}.elfinder-cwd-view-list .elfinder-lock,.elfinder-cwd-view-list .elfinder-perms,.elfinder-cwd-view-list .elfinder-symlink{margin-top:-6px;opacity:.6;filter:Alpha(Opacity=60)}.elfinder-ltr .elfinder-cwd-view-list .elfinder-perms{left:8px;bottom:-4px}.elfinder-ltr .elfinder-cwd-view-list .elfinder-lock{left:10px;top:0}.elfinder-ltr .elfinder-cwd-view-list .elfinder-symlink{left:-7px;bottom:-4px}.elfinder-cwd-view-list td .elfinder-cwd-icon{width:16px;height:16px;position:absolute;top:50%;margin-top:-8px;background-image:url(../img/icons-small.png)}.elfinder-ltr .elfinder-cwd-view-list .elfinder-cwd-icon{left:0}.elfinder-rtl .elfinder-cwd-view-list .elfinder-cwd-icon{right:0}.elfinder-cwd-view-list thead td .ui-resizable-handle{height:100%;top:3px}.elfinder-touch .elfinder-cwd-view-list thead td .ui-resizable-handle{top:-5px;margin:10px}.elfinder-cwd-view-list thead td .ui-resizable-e{right:-7px}.elfinder-cwd-view-list thead td .ui-resizable-w{left:-7px}.elfinder-touch .elfinder-cwd-view-list thead td .ui-resizable-e{right:-16px}.elfinder-touch .elfinder-cwd-view-list thead td .ui-resizable-w{left:-16px}.elfinder-cwd-wrapper-empty .elfinder-cwd-view-list.elfinder-cwd:after{margin-top:0}.std42-dialog{padding:0;position:absolute;left:auto;right:auto}.std42-dialog.elfinder-dialog-minimized{overFlow:hidden;position:relative;float:left;width:auto}.elfinder-rtl .std42-dialog.elfinder-dialog-minimized{float:right}.std42-dialog .ui-dialog-titlebar{border-left:0 solid transparent;border-top:0 solid transparent;border-right:0 solid transparent;-moz-border-radius-bottomleft:0;-webkit-border-bottom-left-radius:0;border-bottom-left-radius:0;-moz-border-radius-bottomright:0;-webkit-border-bottom-right-radius:0;border-bottom-right-radius:0;font-weight:400;padding:.2em 1em}.std42-dialog.elfinder-dialog-minimized .ui-dialog-titlebar{padding:0 .5em;height:20px}.elfinder-touch .std42-dialog.elfinder-dialog-minimized .ui-dialog-titlebar{padding:.3em .5em}.std42-dialog.ui-draggable-disabled .ui-dialog-titlebar{cursor:default}.std42-dialog .ui-dialog-titlebar .ui-widget-header{border:none;cursor:pointer}.std42-dialog .ui-dialog-titlebar span.elfinder-dialog-title{display:inherit;word-break:break-all}.std42-dialog.elfinder-dialog-minimized .ui-dialog-titlebar span.elfinder-dialog-title{display:list-item;display:-moz-inline-box;white-space:nowrap;word-break:normal;overflow:hidden;word-wrap:normal;overflow-wrap:normal;max-width:-webkit-calc(100% - 24px);max-width:-moz-calc(100% - 24px);max-width:calc(100% - 24px)}.elfinder-touch .std42-dialog .ui-dialog-titlebar span.elfinder-dialog-title{padding-top:.15em}.elfinder-touch .std42-dialog.elfinder-dialog-minimized .ui-dialog-titlebar span.elfinder-dialog-title{max-width:-webkit-calc(100% - 36px);max-width:-moz-calc(100% - 36px);max-width:calc(100% - 36px)}.std42-dialog .ui-dialog-titlebar .elfinder-titlebar-button{position:relative;float:left;top:10px;left:-10px;right:10px;width:20px;height:20px;padding:1px;margin:-10px 1px 0;background-color:transparent;background-image:none}.elfinder-touch .std42-dialog .ui-dialog-titlebar .elfinder-titlebar-button{transform:scale(1.1);zoom:1.1;margin-left:5px;margin-right:5px}.std42-dialog .ui-dialog-titlebar .elfinder-titlebar-button-right{float:right}.std42-dialog .ui-dialog-titlebar .elfinder-titlebar-button.elfinder-titlebar-button-right{left:10px;right:-10px}.std42-dialog .ui-dialog-titlebar .elfinder-titlebar-button .ui-icon{width:17px;height:17px;border-width:1px;border-color:transparent;opacity:.7;filter:Alpha(Opacity=70);-moz-border-radius:8px;-webkit-border-radius:8px;border-radius:8px}.std42-dialog.elfinder-dialog-minimized .ui-dialog-titlebar .elfinder-titlebar-button .ui-icon{opacity:1;filter:Alpha(Opacity=100)}.elfinder-mobile .std42-dialog .ui-dialog-titlebar .ui-dialog-titlebar-close .ui-icon,.std42-dialog .ui-dialog-titlebar .ui-dialog-titlebar-close:hover .ui-icon{background-color:#ff6252;border-color:#e5695d}.elfinder-mobile .std42-dialog .ui-dialog-titlebar .elfinder-titlebar-minimize .ui-icon,.std42-dialog .ui-dialog-titlebar .elfinder-titlebar-minimize:hover .ui-icon{background-color:#ffbc00;border-color:#e3a40b}.elfinder-mobile .std42-dialog .ui-dialog-titlebar .elfinder-titlebar-full .ui-icon,.std42-dialog .ui-dialog-titlebar .elfinder-titlebar-full:hover .ui-icon{background-color:#26c82f;border-color:#13ae10}.elfinder-touch .std42-dialog.ui-dialog:not(ui-resizable-disabled) .ui-resizable-se{width:12px;height:12px;zoom:1.5;right:-7px;bottom:-7px;margin:3px 7px 7px 3px;background-position:-64px -224px}.elfinder-rtl .elfinder-dialog .ui-dialog-titlebar{text-align:right}.std42-dialog .ui-dialog-content{padding:.3em .5em;box-sizing:border-box}.elfinder .std42-dialog .ui-dialog-content,.elfinder .std42-dialog .ui-dialog-content *{-webkit-user-select:auto;-moz-user-select:text;-khtml-user-select:text;user-select:text}.std42-dialog .ui-dialog-buttonpane{border:0 solid;margin:0;padding:.5em;text-align:right}.elfinder-rtl .std42-dialog .ui-dialog-buttonpane{text-align:left}.std42-dialog .ui-dialog-buttonpane button{margin:.2em 0 0 .4em;padding:.2em;outline:0 solid}.std42-dialog .ui-dialog-buttonpane button span{padding:2px 9px}.elfinder-dialog .ui-resizable-e,.elfinder-dialog .ui-resizable-s{width:0;height:0}.std42-dialog .ui-button input{cursor:pointer}.elfinder-netmount-tb input,.elfinder-netmount-tb select,.std42-dialog select{border:1px solid #ccc}.elfinder-dialog-icon{position:absolute;width:32px;height:32px;left:10px;top:50%;margin-top:-15px;background:url(../img/dialogs.png) 0 0 no-repeat}.elfinder-rtl .elfinder-dialog-icon{left:auto;right:10px}.elfinder-dialog-confirm .ui-dialog-content,.elfinder-dialog-error .ui-dialog-content{padding-left:56px;min-height:35px}.elfinder-rtl .elfinder-dialog-confirm .ui-dialog-content,.elfinder-rtl .elfinder-dialog-error .ui-dialog-content{padding-left:0;padding-right:56px}.elfinder-dialog-notify .ui-dialog-titlebar-close,.elfinder-rm-title+br{display:none}.elfinder-dialog-notify .ui-dialog-content{padding:0}.elfinder-notify{border-bottom:1px solid #ccc;position:relative;padding:.5em;text-align:center;overflow:hidden}.elfinder-ltr .elfinder-notify{padding-left:36px}.elfinder-rtl .elfinder-notify{padding-right:36px}.elfinder-notify:last-child{border:0 solid}.elfinder-notify-progressbar{width:180px;height:8px;border:1px solid #aaa;background:#f5f5f5;margin:5px auto;overflow:hidden}.elfinder-notify-progress{width:100%;height:8px;background:url(../img/progress.gif) center center repeat-x}.elfinder-notify-progress,.elfinder-notify-progressbar{-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px}.elfinder-dialog-icon-file,.elfinder-dialog-icon-open,.elfinder-dialog-icon-readdir,.elfinder-dialog-icon-reload{background-position:0 -225px}.elfinder-dialog-icon-mkdir{background-position:0 -64px}.elfinder-dialog-icon-mkfile{background-position:0 -96px}.elfinder-dialog-icon-copy,.elfinder-dialog-icon-move,.elfinder-dialog-icon-prepare{background-position:0 -128px}.elfinder-dialog-icon-chunkmerge,.elfinder-dialog-icon-upload{background-position:0 -160px}.elfinder-dialog-icon-rm{background-position:0 -192px}.elfinder-dialog-icon-download{background-position:0 -260px}.elfinder-dialog-icon-save{background-position:0 -295px}.elfinder-dialog-icon-rename{background-position:0 -330px}.elfinder-dialog-icon-archive,.elfinder-dialog-icon-extract,.elfinder-dialog-icon-zipdl{background-position:0 -365px}.elfinder-dialog-icon-search{background-position:0 -402px}.elfinder-dialog-icon-chmod,.elfinder-dialog-icon-dim,.elfinder-dialog-icon-loadimg,.elfinder-dialog-icon-netmount,.elfinder-dialog-icon-netunmount,.elfinder-dialog-icon-preupload,.elfinder-dialog-icon-resize,.elfinder-dialog-icon-url{background-position:0 -434px}.elfinder-dialog-confirm-applyall,.elfinder-dialog-confirm-encoding{padding:0 1em;margin:0}.elfinder-ltr .elfinder-dialog-confirm-applyall,.elfinder-ltr .elfinder-dialog-confirm-encoding{text-align:left}.elfinder-rtl .elfinder-dialog-confirm-applyall,.elfinder-rtl .elfinder-dialog-confirm-encoding{text-align:right}.elfinder-dialog-confirm .elfinder-dialog-icon{background-position:0 -32px}.elfinder-dialog-confirm .ui-dialog-buttonset{width:auto}.elfinder-info-title .elfinder-cwd-icon{float:left;width:48px;height:48px;margin-right:1em}.elfinder-rtl .elfinder-info-title .elfinder-cwd-icon,.elfinder-rtl .elfinder-rm-title .elfinder-cwd-icon{float:right;margin-right:0;margin-left:1em}.elfinder-info-title strong{display:block;padding:.3em 0 .5em}.elfinder-info-tb{min-width:200px;border:0 solid;margin:1em .2em}.elfinder-info-tb td{white-space:nowrap;padding:2px}.elfinder-info-tb a{outline:none;text-decoration:underline}.elfinder-info-tb a:hover{text-decoration:none}.elfinder-info-spinner{width:14px;height:14px;float:left;background:url(../img/spinner-mini.gif) center center no-repeat;margin:0 5px}.elfinder-netmount-tb{margin:0 auto}.elfinder-netmount-tb .elfinder-button-icon{cursor:pointer}button.elfinder-info-button{margin:-3.5px 0;cursor:pointer}.elfinder-upload-dropbox{display:table-cell;text-align:center;vertical-align:middle;padding:.5em;border:3px dashed #aaa;width:9999px;height:80px;overflow:hidden;word-break:keep-all}.elfinder-upload-dropbox.ui-state-hover{background:#dfdfdf;border:3px dashed #555}.elfinder-upload-dialog-or{margin:.3em 0;text-align:center}.elfinder-upload-dialog-wrapper{text-align:center}.elfinder-upload-dialog-wrapper .ui-button{position:relative;overflow:hidden}.elfinder-upload-dialog-wrapper .ui-button form{position:absolute;right:0;top:0;opacity:0;filter:Alpha(Opacity=0)}.elfinder-upload-dialog-wrapper .ui-button form input{padding:0 20px;font-size:3em}.dialogelfinder .dialogelfinder-drag{border-left:0 solid;border-top:0 solid;border-right:0 solid;font-weight:400;padding:2px 12px;cursor:move;position:relative;text-align:left}.elfinder-rtl .dialogelfinder-drag{text-align:right}.dialogelfinder-drag-close{position:absolute;top:50%;margin-top:-8px}.elfinder-ltr .dialogelfinder-drag-close{right:12px}.elfinder-rtl .dialogelfinder-drag-close{left:12px}.elfinder-rm-title{margin-bottom:.5ex}.elfinder-rm-title .elfinder-cwd-icon{float:left;width:48px;height:48px;margin-right:1em}.elfinder-rm-title strong{display:block;white-space:pre-wrap;word-break:normal;overflow:hidden;text-overflow:ellipsis}.ui-dialog-titlebar select.elfinder-edit-changed{border-bottom:1px solid #13ae10}.elfinder-contextmenu .elfinder-contextmenu-item span{font-size:.72em}.elfinder-cwd-view-icons .elfinder-cwd-filename,.elfinder-cwd-view-list td{font-size:.7em}.std42-dialog .ui-dialog-titlebar{font-size:.82em}.std42-dialog .ui-dialog-content{font-size:.72em}.std42-dialog .ui-dialog-buttonpane{font-size:.76em}.dialogelfinder .dialogelfinder-drag,.elfinder-info-tb{font-size:.9em}.elfinder-upload-dialog-or,.elfinder-upload-dropbox{font-size:1.2em}.elfinder .elfinder-navbar{font-size:.72em}.elfinder-place-drag .elfinder-navbar-dir{font-size:.9em}.elfinder-quicklook-title,.elfinder-statusbar div{font-size:.7em}.elfinder-quicklook-info-data{font-size:.72em}.elfinder-quicklook-preview-text-wrapper{font-size:.9em}.elfinder-button-menu-item{font-size:.72em}.elfinder-button-search input{font-size:.8em}.elfinder-drag-num{font-size:12px}.elfinder-toast{font-size:.76em}.elfinder .elfinder-navbar{width:230px;padding:3px 5px;background-image:none;border-top:0 solid;border-bottom:0 solid;overflow:auto;position:relative}.elfinder-ltr .elfinder-navbar{float:left;border-left:0 solid}.elfinder-rtl .elfinder-navbar{float:right;border-right:0 solid}.elfinder-ltr .ui-resizable-e{margin-left:10px}.elfinder-tree{display:table;width:100%;margin:0 0 .5em;-webkit-tap-highlight-color:rgba(0,0,0,0)}.elfinder-navbar-dir{position:relative;display:block;white-space:nowrap;padding:3px 12px;margin:0;outline:0 solid;border:1px solid transparent;cursor:default}.elfinder-touch .elfinder-navbar-dir{padding:12px}.elfinder-ltr .elfinder-navbar-dir{padding-left:35px}.elfinder-rtl .elfinder-navbar-dir{padding-right:35px}.elfinder-navbar-arrow,.elfinder-navbar-icon{position:absolute;top:50%;margin-top:-8px;background-repeat:no-repeat}.elfinder-navbar-arrow{display:none;width:12px;height:14px;background-image:url(../img/arrows-normal.png)}.elfinder-ltr .elfinder-navbar-arrow{left:0}.elfinder-rtl .elfinder-navbar-arrow{right:0}.elfinder-touch .elfinder-navbar-arrow{zoom:1.4;-moz-transform-origin:top left;-moz-transform:scale(1.4);margin-bottom:7px}.elfinder-ltr.elfinder-touch .elfinder-navbar-arrow{left:-3px;margin-right:20px}.elfinder-rtl.elfinder-touch .elfinder-navbar-arrow{right:-3px;margin-left:20px}.ui-state-active .elfinder-navbar-arrow{background-image:url(../img/arrows-active.png)}.elfinder-navbar-collapsed .elfinder-navbar-arrow{display:block}.elfinder-subtree-chksubdir .elfinder-navbar-arrow{opacity:.25;filter:Alpha(Opacity=25)}.elfinder-ltr .elfinder-navbar-collapsed .elfinder-navbar-arrow{background-position:0 4px}.elfinder-rtl .elfinder-navbar-collapsed .elfinder-navbar-arrow{background-position:0 -10px}.elfinder-ltr .elfinder-navbar-expanded .elfinder-navbar-arrow,.elfinder-rtl .elfinder-navbar-expanded .elfinder-navbar-arrow{background-position:0 -21px}.elfinder-navbar-icon{width:16px;height:16px;background-image:url(../img/toolbar.png);background-position:0 -16px}.elfinder-ltr .elfinder-navbar-icon{left:14px}.elfinder-rtl .elfinder-navbar-icon{right:14px}.elfinder-tree .elfinder-navbar-root .elfinder-navbar-icon{background-position:0 0}.elfinder-places .elfinder-navbar-root .elfinder-navbar-icon{background-position:0 -704px}.elfinder-tree .elfinder-navbar-root-local .elfinder-navbar-icon{background-image:url(../img/volume_icon_local.png);background-position:0 0}.elfinder-tree .elfinder-navbar-root-trash .elfinder-navbar-icon{background-image:url(../img/volume_icon_trash.png);background-position:0 0}.elfinder-tree .elfinder-navbar-root-ftp .elfinder-navbar-icon{background-image:url(../img/volume_icon_ftp.png);background-position:0 0}.elfinder-tree .elfinder-navbar-root-sql .elfinder-navbar-icon{background-image:url(../img/volume_icon_sql.png);background-position:0 0}.elfinder-tree .elfinder-navbar-root-dropbox .elfinder-navbar-icon{background-image:url(../img/volume_icon_dropbox.png);background-position:0 0}.elfinder-tree .elfinder-navbar-root-googledrive .elfinder-navbar-icon{background-image:url(../img/volume_icon_googledrive.png);background-position:0 0}.elfinder-tree .elfinder-navbar-root-onedrive .elfinder-navbar-icon{background-image:url(../img/volume_icon_onedrive.png);background-position:0 0}.elfinder-tree .elfinder-navbar-root-box .elfinder-navbar-icon{background-image:url(../img/volume_icon_box.png);background-position:0 0}.elfinder-tree .elfinder-navbar-root-network .elfinder-navbar-icon{background-image:url(../img/toolbar.png);background-position:0 -688px}.elfinder-droppable-active .elfinder-navbar-icon,.ui-state-active .elfinder-navbar-icon,.ui-state-hover .elfinder-navbar-icon{background-position:0 -32px}.elfinder-ltr .elfinder-navbar-subtree{margin-left:12px}.elfinder-rtl .elfinder-navbar-subtree{margin-right:12px}.elfinder-navbar-spinner{width:14px;height:14px;position:absolute;display:block;top:50%;margin-top:-7px;background:url(../img/spinner-mini.gif) center center no-repeat}.elfinder-ltr .elfinder-navbar-spinner{left:0;margin-left:-2px}.elfinder-rtl .elfinder-navbar-spinner{right:0;margin-right:-2px}.elfinder-navbar .elfinder-lock,.elfinder-navbar .elfinder-perms,.elfinder-navbar .elfinder-symlink{opacity:.6;filter:Alpha(Opacity=60)}.elfinder-navbar .elfinder-perms{bottom:-1px;margin-top:-8px}.elfinder-navbar .elfinder-lock{top:-2px}.elfinder-ltr .elfinder-navbar .elfinder-perms{left:20px}.elfinder-rtl .elfinder-navbar .elfinder-perms{right:20px}.elfinder-ltr .elfinder-navbar .elfinder-lock{left:20px}.elfinder-rtl .elfinder-navbar .elfinder-lock{right:20px}.elfinder-ltr .elfinder-navbar .elfinder-symlink{left:8px}.elfinder-rtl .elfinder-navbar .elfinder-symlink{right:8px}.elfinder-navbar input{width:100%;border:0 solid;margin:0;padding:0}.elfinder-navbar .ui-resizable-handle{width:12px;background:url(../img/resize.png) center center no-repeat}.elfinder-nav-handle-icon{position:absolute;top:50%;margin:-8px 2px 0;opacity:.5;filter:Alpha(Opacity=50)}.elfinder-navbar-pager{width:100%;box-sizing:border-box;padding-top:3px;padding-bottom:3px}.elfinder-touch .elfinder-navbar-pager{padding-top:10px;padding-bottom:10px}.elfinder-places{border:none;margin:0;padding:0}.elfinder-navbar-swipe-handle{position:absolute;top:0;height:100%;width:50px;pointer-events:none}.elfinder-ltr .elfinder-navbar-swipe-handle{left:0;background:linear-gradient(to right,#dde4eb 0,rgba(221,228,235,.8) 5px,rgba(216,223,230,.3) 8px,rgba(0,0,0,.1) 95%,rgba(0,0,0,0) 100%)}.elfinder-rtl .elfinder-navbar-swipe-handle{right:0;background:linear-gradient(to left,#dde4eb 0,rgba(221,228,235,.8) 5px,rgba(216,223,230,.3) 8px,rgba(0,0,0,.1) 95%,rgba(0,0,0,0) 100%)}.elfinder-navbar-root .elfinder-places-root-icon{position:absolute;top:50%;margin-top:-9px;cursor:pointer}.elfinder-ltr .elfinder-places-root-icon{right:10px}.elfinder-rtl .elfinder-places-root-icon{left:10px}.elfinder-navbar-expanded .elfinder-places-root-icon{display:block}.elfinder-place-drag{font-size:.8em}.elfinder-quicklook{position:absolute;background:url(../img/quicklook-bg.png);overflow:hidden;border-radius:7px;-moz-border-radius:7px;-webkit-border-radius:7px;padding:20px 0 40px}.elfinder-quicklook.elfinder-touch{padding:30px 0 40px}.elfinder-quicklook .ui-resizable-se{width:14px;height:14px;right:5px;bottom:3px;background:url(../img/toolbar.png) 0 -496px no-repeat}.elfinder-quicklook.elfinder-touch .ui-resizable-se{zoom:1.5}.elfinder-quicklook.elfinder-quicklook-fullscreen{position:fixed;top:0;right:0;bottom:0;left:0;margin:0;box-sizing:border-box;width:100%;height:100%;object-fit:contain;border-radius:0;-moz-border-radius:0;-webkit-border-radius:0;-webkit-background-clip:padding-box;padding:0;background:#000;display:block}.elfinder-quicklook-fullscreen .elfinder-quicklook-titlebar,.elfinder-quicklook-fullscreen.elfinder-quicklook .ui-resizable-handle{display:none}.elfinder-quicklook-fullscreen .elfinder-quicklook-preview{border:0 solid}.elfinder-quicklook-cover,.elfinder-quicklook-titlebar{width:100%;height:100%;top:0;left:0;position:absolute}.elfinder-quicklook-titlebar{text-align:center;background:#777;height:20px;-moz-border-radius-topleft:7px;-webkit-border-top-left-radius:7px;border-top-left-radius:7px;-moz-border-radius-topright:7px;-webkit-border-top-right-radius:7px;border-top-right-radius:7px;cursor:move}.elfinder-touch .elfinder-quicklook-titlebar{height:30px}.elfinder-quicklook-title{color:#fff;white-space:nowrap;overflow:hidden;padding:2px 0}.elfinder-touch .elfinder-quicklook-title{padding:8px 0}.elfinder-quicklook-titlebar .ui-icon{position:absolute;left:4px;top:50%;margin-top:-8px;width:16px;height:16px;cursor:pointer}.elfinder-quicklook-titlebar .ui-icon.elfinder-platformWin{left:auto;right:4px}.elfinder-touch .elfinder-quicklook-titlebar .ui-icon{zoom:1.5}.elfinder-quicklook-preview{overflow:hidden;position:relative;border:0 solid;border-left:1px solid transparent;border-right:1px solid transparent;height:100%}.elfinder-quicklook-preview.elfinder-overflow-auto{overflow:auto;-webkit-overflow-scrolling:touch}.elfinder-quicklook-info-wrapper{position:absolute;width:100%;left:0;top:50%;margin-top:-50px}.elfinder-quicklook-info{padding:0 12px 0 112px}.elfinder-quicklook-info .elfinder-quicklook-info-data:first-child{color:#fff;font-weight:700;padding-bottom:.5em}.elfinder-quicklook-info-data{padding-bottom:.2em;color:#fff}.elfinder-quicklook .elfinder-cwd-icon{position:absolute;left:32px;top:50%;margin-top:-20px}.elfinder-quicklook-preview img{display:block;margin:0 auto}.elfinder-quicklook-navbar{position:absolute;left:50%;bottom:4px;width:140px;height:32px;padding:0;margin-left:-70px;border:1px solid transparent;border-radius:19px;-moz-border-radius:19px;-webkit-border-radius:19px}.elfinder-quicklook-fullscreen .elfinder-quicklook-navbar{width:188px;margin-left:-94px;padding:5px;border:1px solid #eee;background:#000;opacity:.4;filter:Alpha(Opacity=40)}.elfinder-quicklook-fullscreen .elfinder-quicklook-navbar-icon-close,.elfinder-quicklook-fullscreen .elfinder-quicklook-navbar-separator{display:inline}.elfinder-quicklook-navbar-icon{width:32px;height:32px;margin:0 7px;float:left;background:url(../img/quicklook-icons.png) 0 0 no-repeat}.elfinder-quicklook-navbar-icon-fullscreen{background-position:0 -64px}.elfinder-quicklook-navbar-icon-fullscreen-off{background-position:0 -96px}.elfinder-quicklook-navbar-icon-prev{background-position:0 0}.elfinder-quicklook-navbar-icon-next{background-position:0 -32px}.elfinder-quicklook-navbar-icon-close{background-position:0 -128px;display:none}.elfinder-quicklook-navbar-separator{width:1px;height:32px;float:left;border-left:1px solid #fff;display:none}.elfinder-quicklook-preview-archive-wrapper,.elfinder-quicklook-preview-text-wrapper{width:100%;height:100%;background:#fff;color:#222;overflow:auto;-webkit-overflow-scrolling:touch}.elfinder-quicklook-preview-archive-wrapper{font-size:1.5ex}.elfinder-quicklook-preview-archive-wrapper strong{padding:0 5px}pre.elfinder-quicklook-preview-text{width:auto;height:auto;margin:0;padding:3px 9px;border:none}.elfinder-quicklook-preview-html,.elfinder-quicklook-preview-iframe,.elfinder-quicklook-preview-pdf{width:100%;height:100%;background:#fff;margin:0;border:none;display:block}.elfinder-quicklook-preview-flash{width:100%;height:100%}.elfinder-quicklook-preview-audio{width:100%;position:absolute;bottom:0;left:0}embed.elfinder-quicklook-preview-audio{height:30px;background:0 0}.elfinder-quicklook-preview-video{width:100%;height:100%}.elfinder .elfinder-quicklook .elfinder-quicklook-info *,.elfinder .elfinder-quicklook .elfinder-quicklook-preview *{-webkit-user-select:auto;-moz-user-select:text;-khtml-user-select:text;user-select:text}.elfinder-statusbar{text-align:center;font-weight:400;padding:.2em .5em;border-right:0 solid transparent;border-bottom:0 solid transparent;border-left:0 solid transparent}.elfinder-statusbar span{cursor:pointer;vertical-align:bottom;overflow:hidden;text-overflow:"..";-o-text-overflow:".."}.elfinder-statusbar span.ui-state-active,.elfinder-statusbar span.ui-state-hover{border:none}.elfinder-statusbar span.elfinder-path-cwd{cursor:default}.elfinder-path{max-width:30%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;-o-text-overflow:ellipsis}.elfinder-ltr .elfinder-path{float:left}.elfinder-rtl .elfinder-path{float:right}.elfinder-workzone-path{position:relative}.elfinder-workzone-path .elfinder-path{position:relative;font-size:.75em;font-weight:400;float:none;max-width:none;overflow-x:scroll;text-overflow:initial;-o-text-overflow:initial}.elfinder-ltr .elfinder-workzone-path .elfinder-path{margin-left:24px}.elfinder-rtl .elfinder-workzone-path .elfinder-path{margin-right:24px}.elfinder-workzone-path .elfinder-path span{display:inline-block;padding:5px 3px}.elfinder-workzone-path .elfinder-path span.elfinder-path-cwd{font-weight:700}.elfinder-workzone-path .elfinder-path span.ui-state-active,.elfinder-workzone-path .elfinder-path span.ui-state-hover{border:none}.elfinder-workzone-path .elfinder-path-roots{position:absolute;top:0;width:24px;height:20px;padding:2px;border:none;overflow:hidden}.elfinder-ltr .elfinder-workzone-path .elfinder-path-roots{left:0}.elfinder-rtl .elfinder-workzone-path .elfinder-path-roots{right:0}.elfinder-stat-size{white-space:nowrap}.elfinder-ltr .elfinder-stat-size{float:right}.elfinder-rtl .elfinder-stat-size{float:left}.elfinder-stat-selected{white-space:nowrap;overflow:hidden}.elfinder .elfinder-toast{position:absolute;top:12px;right:12px;max-width:90%;cursor:default}.elfinder .elfinder-toast>div{position:relative;pointer-events:auto;overflow:hidden;margin:0 0 6px;padding:8px 16px 8px 50px;-moz-border-radius:3px 3px 3px 3px;-webkit-border-radius:3px 3px 3px 3px;border-radius:3px 3px 3px 3px;background-position:15px center;background-repeat:no-repeat;-moz-box-shadow:0 0 12px #999;-webkit-box-shadow:0 0 12px #999;box-shadow:0 0 12px #999;color:#fff;opacity:.9;filter:alpha(opacity=90);background-color:#030303;text-align:center}.elfinder .elfinder-toast>.toast-info{background-color:#2f96b4;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGwSURBVEhLtZa9SgNBEMc9sUxxRcoUKSzSWIhXpFMhhYWFhaBg4yPYiWCXZxBLERsLRS3EQkEfwCKdjWJAwSKCgoKCcudv4O5YLrt7EzgXhiU3/4+b2ckmwVjJSpKkQ6wAi4gwhT+z3wRBcEz0yjSseUTrcRyfsHsXmD0AmbHOC9Ii8VImnuXBPglHpQ5wwSVM7sNnTG7Za4JwDdCjxyAiH3nyA2mtaTJufiDZ5dCaqlItILh1NHatfN5skvjx9Z38m69CgzuXmZgVrPIGE763Jx9qKsRozWYw6xOHdER+nn2KkO+Bb+UV5CBN6WC6QtBgbRVozrahAbmm6HtUsgtPC19tFdxXZYBOfkbmFJ1VaHA1VAHjd0pp70oTZzvR+EVrx2Ygfdsq6eu55BHYR8hlcki+n+kERUFG8BrA0BwjeAv2M8WLQBtcy+SD6fNsmnB3AlBLrgTtVW1c2QN4bVWLATaIS60J2Du5y1TiJgjSBvFVZgTmwCU+dAZFoPxGEEs8nyHC9Bwe2GvEJv2WXZb0vjdyFT4Cxk3e/kIqlOGoVLwwPevpYHT+00T+hWwXDf4AJAOUqWcDhbwAAAAASUVORK5CYII=)!important}.elfinder .elfinder-toast>.toast-error{background-color:#bd362f;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHOSURBVEhLrZa/SgNBEMZzh0WKCClSCKaIYOED+AAKeQQLG8HWztLCImBrYadgIdY+gIKNYkBFSwu7CAoqCgkkoGBI/E28PdbLZmeDLgzZzcx83/zZ2SSXC1j9fr+I1Hq93g2yxH4iwM1vkoBWAdxCmpzTxfkN2RcyZNaHFIkSo10+8kgxkXIURV5HGxTmFuc75B2RfQkpxHG8aAgaAFa0tAHqYFfQ7Iwe2yhODk8+J4C7yAoRTWI3w/4klGRgR4lO7Rpn9+gvMyWp+uxFh8+H+ARlgN1nJuJuQAYvNkEnwGFck18Er4q3egEc/oO+mhLdKgRyhdNFiacC0rlOCbhNVz4H9FnAYgDBvU3QIioZlJFLJtsoHYRDfiZoUyIxqCtRpVlANq0EU4dApjrtgezPFad5S19Wgjkc0hNVnuF4HjVA6C7QrSIbylB+oZe3aHgBsqlNqKYH48jXyJKMuAbiyVJ8KzaB3eRc0pg9VwQ4niFryI68qiOi3AbjwdsfnAtk0bCjTLJKr6mrD9g8iq/S/B81hguOMlQTnVyG40wAcjnmgsCNESDrjme7wfftP4P7SP4N3CJZdvzoNyGq2c/HWOXJGsvVg+RA/k2MC/wN6I2YA2Pt8GkAAAAASUVORK5CYII=)!important}.elfinder .elfinder-toast>.toast-success{background-color:#51a351;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADsSURBVEhLY2AYBfQMgf///3P8+/evAIgvA/FsIF+BavYDDWMBGroaSMMBiE8VC7AZDrIFaMFnii3AZTjUgsUUWUDA8OdAH6iQbQEhw4HyGsPEcKBXBIC4ARhex4G4BsjmweU1soIFaGg/WtoFZRIZdEvIMhxkCCjXIVsATV6gFGACs4Rsw0EGgIIH3QJYJgHSARQZDrWAB+jawzgs+Q2UO49D7jnRSRGoEFRILcdmEMWGI0cm0JJ2QpYA1RDvcmzJEWhABhD/pqrL0S0CWuABKgnRki9lLseS7g2AlqwHWQSKH4oKLrILpRGhEQCw2LiRUIa4lwAAAABJRU5ErkJggg==)!important}.elfinder .elfinder-toast>.toast-warning{background-color:#f89406;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGYSURBVEhL5ZSvTsNQFMbXZGICMYGYmJhAQIJAICYQPAACiSDB8AiICQQJT4CqQEwgJvYASAQCiZiYmJhAIBATCARJy+9rTsldd8sKu1M0+dLb057v6/lbq/2rK0mS/TRNj9cWNAKPYIJII7gIxCcQ51cvqID+GIEX8ASG4B1bK5gIZFeQfoJdEXOfgX4QAQg7kH2A65yQ87lyxb27sggkAzAuFhbbg1K2kgCkB1bVwyIR9m2L7PRPIhDUIXgGtyKw575yz3lTNs6X4JXnjV+LKM/m3MydnTbtOKIjtz6VhCBq4vSm3ncdrD2lk0VgUXSVKjVDJXJzijW1RQdsU7F77He8u68koNZTz8Oz5yGa6J3H3lZ0xYgXBK2QymlWWA+RWnYhskLBv2vmE+hBMCtbA7KX5drWyRT/2JsqZ2IvfB9Y4bWDNMFbJRFmC9E74SoS0CqulwjkC0+5bpcV1CZ8NMej4pjy0U+doDQsGyo1hzVJttIjhQ7GnBtRFN1UarUlH8F3xict+HY07rEzoUGPlWcjRFRr4/gChZgc3ZL2d8oAAAAASUVORK5CYII=)!important}.elfinder .elfinder-toast>div button.ui-button{background-image:none;margin-top:8px;padding:.5em .8em}.elfinder .elfinder-toast>.toast-success button.ui-button{background-color:green;color:#fff}.elfinder .elfinder-toast>.toast-success button.ui-button.ui-state-hover{background-color:#add6ad;color:#254b25}.elfinder-toolbar{padding:4px 0 3px;border-left:0 solid transparent;border-top:0 solid transparent;border-right:0 solid transparent}.elfinder-buttonset{margin:1px 4px;float:left;background:0 0;padding:0;-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px}.elfinder .elfinder-button{height:16px;margin:0;padding:4px;float:left;overflow:hidden;position:relative;border:0 solid;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;line-height:1;cursor:default}.elfinder-touch .elfinder-button{height:20px}.elfinder .ui-icon-search{cursor:pointer}.elfinder-button:first-child{-moz-border-radius-topleft:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-bottomleft:4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px}.elfinder-button:last-child{-moz-border-radius-topright:4px;-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-moz-border-radius-bottomright:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px}.elfinder-toolbar-button-separator{float:left;padding:0;height:24px;border-top:0 solid;border-right:0 solid;border-bottom:0 solid;width:0}.elfinder-touch .elfinder-toolbar-button-separator{height:20px}.elfinder .elfinder-button.ui-state-disabled{opacity:1;filter:Alpha(Opacity=100)}.elfinder .elfinder-button.ui-state-disabled .elfinder-button-icon,.elfinder .elfinder-button.ui-state-disabled .elfinder-button-text{opacity:.4;filter:Alpha(Opacity=40)}.elfinder-rtl .elfinder-buttonset{float:right}.elfinder-button-icon{width:16px;height:16px;display:inline-block;background:url(../img/toolbar.png) no-repeat}.elfinder-button-text{position:relative;display:inline-block;top:-4px;margin:0 2px;font-size:12px}.elfinder-touch .elfinder-button-icon{zoom:1.25;-moz-transform-origin:top left;-moz-transform:scale(1.25)}.elfinder-touch .elfinder-button-text{top:-5px}.elfinder-button-icon-home{background-position:0 0}.elfinder-button-icon-back{background-position:0 -112px}.elfinder-button-icon-forward{background-position:0 -128px}.elfinder-button-icon-up{background-position:0 -144px}.elfinder-button-icon-dir{background-position:0 -16px}.elfinder-button-icon-reload{background-position:0 -160px}.elfinder-button-icon-open{background-position:0 -176px}.elfinder-button-icon-mkdir{background-position:0 -192px}.elfinder-button-icon-mkfile{background-position:0 -208px}.elfinder-button-icon-rm{background-position:0 -832px}.elfinder-button-icon-trash{background-position:0 -224px}.elfinder-button-icon-restore{background-position:0 -816px}.elfinder-button-icon-copy{background-position:0 -240px}.elfinder-button-icon-cut{background-position:0 -256px}.elfinder-button-icon-paste{background-position:0 -272px}.elfinder-button-icon-getfile{background-position:0 -288px}.elfinder-button-icon-duplicate{background-position:0 -304px}.elfinder-button-icon-rename{background-position:0 -320px}.elfinder-button-icon-edit{background-position:0 -336px}.elfinder-button-icon-quicklook{background-position:0 -352px}.elfinder-button-icon-upload{background-position:0 -368px}.elfinder-button-icon-download{background-position:0 -384px}.elfinder-button-icon-info{background-position:0 -400px}.elfinder-button-icon-extract{background-position:0 -416px}.elfinder-button-icon-archive{background-position:0 -432px}.elfinder-button-icon-view{background-position:0 -448px}.elfinder-button-icon-view-list{background-position:0 -464px}.elfinder-button-icon-help{background-position:0 -480px}.elfinder-button-icon-resize{background-position:0 -512px}.elfinder-button-icon-link{background-position:0 -528px}.elfinder-button-icon-search{background-position:0 -561px}.elfinder-button-icon-sort{background-position:0 -577px}.elfinder-button-icon-rotate-r{background-position:0 -625px}.elfinder-button-icon-rotate-l{background-position:0 -641px}.elfinder-button-icon-netmount{background-position:0 -688px}.elfinder-button-icon-netunmount{background-position:0 -96px}.elfinder-button-icon-places{background-position:0 -704px}.elfinder-button-icon-chmod{background-position:0 -48px}.elfinder-button-icon-accept{background-position:0 -736px}.elfinder-button-icon-opendir{background-position:0 -32px}.elfinder-button-icon-menu{background-position:0 -752px}.elfinder-button-icon-colwidth{background-position:0 -768px}.elfinder-button-icon-fullscreen{background-position:0 -784px}.elfinder-button-icon-unfullscreen{background-position:0 -800px}.elfinder-button-icon-empty{background-position:0 -848px}.elfinder-button-icon-undo{background-position:0 -864px}.elfinder-button-icon-redo{background-position:0 -880px}.elfinder-button-icon-preference{background-position:0 -896px}.elfinder-button-icon-mkdirin{background-position:0 -912px}.elfinder-button-icon-selectall{background-position:0 -928px}.elfinder-button-icon-selectnone{background-position:0 -944px}.elfinder-button-icon-selectinvert{background-position:0 -960px}.elfinder .elfinder-menubutton{overflow:visible}.elfinder-button-icon-spinner{background:url(../img/spinner-mini.gif) center center no-repeat}.elfinder-button-menu{position:absolute;left:0;top:25px;padding:3px 0}.elfinder-touch .elfinder-button-menu{top:35px}.elfinder-button-menu-item{white-space:nowrap;cursor:default;padding:5px 19px;position:relative}.elfinder-touch .elfinder-button-menu-item{padding:12px 19px}.elfinder-button-menu .ui-state-hover{border:0 solid}.elfinder-button-menu-item-separated{border-top:1px solid #ccc}.elfinder-button-menu-item .ui-icon{width:16px;height:16px;position:absolute;left:2px;top:50%;margin-top:-8px;display:none}.elfinder-button-menu-item-selected .ui-icon{display:block}.elfinder-button-menu-item-selected-asc .ui-icon-arrowthick-1-s,.elfinder-button-menu-item-selected-desc .ui-icon-arrowthick-1-n{display:none}.elfinder-button form{position:absolute;top:0;right:0;opacity:0;filter:Alpha(Opacity=0);cursor:pointer}.elfinder .elfinder-button form input{background:0 0;cursor:default}.elfinder .elfinder-button-search{border:0 solid;background:0 0;padding:0;margin:1px 4px;height:auto;min-height:26px;float:right;width:202px;overflow:visible}.elfinder .elfinder-button-search .elfinder-button-menu{font-size:8pt;text-align:center;width:100%;overflow:hidden}.elfinder .elfinder-button-search .elfinder-button-menu div{margin-left:auto;margin-right:auto;margin-bottom:5px}.elfinder .elfinder-button-search .elfinder-button-menu div .ui-state-hover{border:1px solid}.elfinder-ltr .elfinder-button-search{float:right;margin-right:10px}.elfinder-rtl .elfinder-button-search{float:left;margin-left:10px}.elfinder-button-search input{width:160px;height:22px;padding:0 20px;line-height:22px;border:1px solid #aaa;-moz-border-radius:12px;-webkit-border-radius:12px;border-radius:12px;outline:0 solid}.elfinder-button-search input::-ms-clear{display:none}.elfinder-touch .elfinder-button-search input{height:28px;line-height:28px}.elfinder-rtl .elfinder-button-search input{direction:rtl}.elfinder-button-search .ui-icon{position:absolute;height:18px;top:50%;margin:-8px 4px 0;opacity:.6;filter:Alpha(Opacity=60)}.elfinder-button-search .ui-checkboxradio-icon{display:none}.elfinder-ltr .elfinder-button-search .ui-icon-search{left:0}.elfinder-ltr .elfinder-button-search .ui-icon-close,.elfinder-rtl .elfinder-button-search .ui-icon-search{right:0}.elfinder-rtl .elfinder-button-search .ui-icon-close{left:0}.elfinder-toolbar-swipe-handle{position:absolute;top:0;left:0;height:50px;width:100%;pointer-events:none;background:linear-gradient(to bottom,#dde4eb 0,rgba(221,228,235,.8) 2px,rgba(216,223,230,.3) 5px,rgba(0,0,0,.1) 95%,rgba(0,0,0,0) 100%)} \ No newline at end of file diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/css/theme.css b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/css/theme.css new file mode 100644 index 00000000..0fc05fa4 --- /dev/null +++ b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/css/theme.css @@ -0,0 +1,72 @@ +/** + * MacOS X like theme for elFinder. + * Required jquery ui "smoothness" theme. + * + * @author Dmitry (dio) Levashov + **/ + +/* input textarea */ +.elfinder input, +.elfinder textarea { + color: #000; + background-color: #FFF; +} + +/* dialogs */ +.std42-dialog, .std42-dialog .ui-widget-content { background-color:#ededed; background-image:none; background-clip: content-box; } + +/* navbar */ +.elfinder .elfinder-navbar { background:#dde4eb; } +.elfinder-navbar .ui-state-hover { color:#000; background-color:#edf1f4; border-color:#bdcbd8; } +.elfinder-navbar .ui-state-active { background: #3875d7; border-color:#3875d7; color:#fff; } +.elfinder-navbar .elfinder-droppable-active {background:#A7C6E5 !important;} +/* disabled elfinder */ +.elfinder-disabled .elfinder-navbar .ui-state-active { background: #dadada; border-color:#aaa; color:#fff; } + +/* workzone */ +.elfinder-workzone { background:#fff; } + +/* current directory */ +/* Is in trash */ +.elfinder-cwd-wrapper.elfinder-cwd-wrapper-trash { + background-color: #f0efef; +} +/* selected file in "icons" view */ +.elfinder-cwd-view-icons .elfinder-cwd-file .ui-state-hover { background:#ccc; } + +/* list view*/ +.elfinder-cwd table thead td.ui-state-hover { background:#ddd; } +.elfinder-cwd table tr:nth-child(odd) { background-color:#edf3fe; } +.elfinder-cwd table tr { + border: 1px solid transparent; + border-top:1px solid #fff; +} +.elfinder-cwd .elfinder-droppable-active td { background:#A7C6E5 !important; } + + +/* common selected background/color */ +.elfinder-cwd-view-icons .elfinder-cwd-file .elfinder-cwd-filename.ui-state-hover, +.elfinder-cwd table td.ui-state-hover, +.elfinder-button-menu .ui-state-hover { background: #3875d7; color:#fff;} +/* disabled elfinder */ +.elfinder-disabled .elfinder-cwd-view-icons .elfinder-cwd-file .elfinder-cwd-filename.ui-state-hover, +.elfinder-disabled .elfinder-cwd table td.ui-state-hover { background:#dadada;} + +/* statusbar */ +.elfinder .elfinder-statusbar { color:#555; } +.elfinder .elfinder-statusbar a { text-decoration:none; color:#555;} + + +.std42-dialog .elfinder-help, .std42-dialog .elfinder-help .ui-widget-content { background:#fff;} + +/* contextmenu */ +.elfinder-contextmenu .ui-state-active { background: #6293df; color:#fff; } +.elfinder-contextmenu .ui-state-hover { background: #3875d7; color:#fff; } +.elfinder-contextmenu .ui-state-hover .elfinder-contextmenu-arrow { background-image:url('../img/arrows-active.png'); } + +/* dialog */ +.elfinder .ui-dialog input:text.ui-state-hover, +.elfinder .ui-dialog textarea.ui-state-hover { + background-image: none; + background-color: inherit; +} diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/files/.gitkeep b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/files/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/files/.trash/.gitkeep b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/files/.trash/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/arrows-active.png b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/arrows-active.png new file mode 100644 index 00000000..4d6de0e5 Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/arrows-active.png differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/arrows-normal.png b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/arrows-normal.png new file mode 100644 index 00000000..73f944bc Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/arrows-normal.png differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/crop.gif b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/crop.gif new file mode 100644 index 00000000..72ea7ccb Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/crop.gif differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/dialogs.png b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/dialogs.png new file mode 100644 index 00000000..be339b7f Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/dialogs.png differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/edit_aceeditor.png b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/edit_aceeditor.png new file mode 100644 index 00000000..b5bc45e7 Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/edit_aceeditor.png differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/edit_ckeditor.png b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/edit_ckeditor.png new file mode 100644 index 00000000..232069c1 Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/edit_ckeditor.png differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/edit_codemirror.png b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/edit_codemirror.png new file mode 100644 index 00000000..2eed4d55 Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/edit_codemirror.png differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/edit_creativecloud.png b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/edit_creativecloud.png new file mode 100644 index 00000000..a022dda3 Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/edit_creativecloud.png differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/edit_pixlreditor.png b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/edit_pixlreditor.png new file mode 100644 index 00000000..78179306 Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/edit_pixlreditor.png differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/edit_pixlrexpress.png b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/edit_pixlrexpress.png new file mode 100644 index 00000000..4d8e88a9 Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/edit_pixlrexpress.png differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/edit_simplemde.png b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/edit_simplemde.png new file mode 100644 index 00000000..2b88095a Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/edit_simplemde.png differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/edit_tinymce.png b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/edit_tinymce.png new file mode 100644 index 00000000..cc654a1a Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/edit_tinymce.png differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/icons-big.png b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/icons-big.png new file mode 100644 index 00000000..6b2af0c7 Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/icons-big.png differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/icons-small.png b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/icons-small.png new file mode 100644 index 00000000..0a397c1d Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/icons-small.png differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/logo.png b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/logo.png new file mode 100644 index 00000000..aa5a6bc5 Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/logo.png differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/progress.gif b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/progress.gif new file mode 100644 index 00000000..8bab11e3 Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/progress.gif differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/quicklook-bg.png b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/quicklook-bg.png new file mode 100644 index 00000000..6c4010bf Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/quicklook-bg.png differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/quicklook-icons.png b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/quicklook-icons.png new file mode 100644 index 00000000..cb47d31b Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/quicklook-icons.png differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/resize.png b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/resize.png new file mode 100644 index 00000000..25b1fea5 Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/resize.png differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/spinner-mini.gif b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/spinner-mini.gif new file mode 100644 index 00000000..5b33f7e5 Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/spinner-mini.gif differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/toolbar.png b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/toolbar.png new file mode 100644 index 00000000..9f585da9 Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/toolbar.png differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/volume_icon_box.png b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/volume_icon_box.png new file mode 100644 index 00000000..52eaec2b Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/volume_icon_box.png differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/volume_icon_dropbox.png b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/volume_icon_dropbox.png new file mode 100644 index 00000000..2454e3f4 Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/volume_icon_dropbox.png differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/volume_icon_ftp.png b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/volume_icon_ftp.png new file mode 100644 index 00000000..d0881398 Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/volume_icon_ftp.png differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/volume_icon_googledrive.png b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/volume_icon_googledrive.png new file mode 100644 index 00000000..22ae2a9f Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/volume_icon_googledrive.png differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/volume_icon_local.png b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/volume_icon_local.png new file mode 100644 index 00000000..3c3635dc Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/volume_icon_local.png differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/volume_icon_onedrive.png b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/volume_icon_onedrive.png new file mode 100644 index 00000000..7ac5f89b Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/volume_icon_onedrive.png differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/volume_icon_sql.png b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/volume_icon_sql.png new file mode 100644 index 00000000..304d87e6 Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/volume_icon_sql.png differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/volume_icon_trash.png b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/volume_icon_trash.png new file mode 100644 index 00000000..cc68fa65 Binary files /dev/null and b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/img/volume_icon_trash.png differ diff --git a/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/js/elfinder.full.js b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/js/elfinder.full.js new file mode 100644 index 00000000..983f4dda --- /dev/null +++ b/deployed/k2/media/k2/assets/vendors/studio-42/elfinder/js/elfinder.full.js @@ -0,0 +1,27377 @@ +/*! + * elFinder - file manager for web + * Version 2.1.28 (2017-08-17) + * http://elfinder.org + * + * Copyright 2009-2017, Studio 42 + * Licensed under a 3-clauses BSD license + */ +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD + define(['jquery','jquery-ui'], factory); + } else if (typeof exports !== 'undefined') { + // CommonJS + var $, ui; + try { + $ = require('jquery'); + ui = require('jquery-ui'); + } catch (e) {} + module.exports = factory($, ui); + } else { + // Browser globals (Note: root is window) + factory(root.jQuery, root.jQuery.ui, true); + } +}(this, function($, _ui, toGlobal) { +toGlobal = toGlobal || false; + + +/* + * File: /js/elFinder.js + */ + +/** + * @class elFinder - file manager for web + * + * @author Dmitry (dio) Levashov + **/ +var elFinder = function(node, opts, bootCallback) { + //this.time('load'); + + var self = this, + + /** + * Objects array of jQuery.Deferred that calls before elFinder boot up + * + * @type Array + */ + dfrdsBeforeBootup = [], + + /** + * Plugin name to check for conflicts with bootstrap etc + * + * @type Array + **/ + conflictChecks = ['button'], + + /** + * Node on which elfinder creating + * + * @type jQuery + **/ + node = $(node), + + /** + * Object of events originally registered in this node + * + * @type Object + */ + prevEvents = $.extend(true, {}, $._data(node.get(0), 'events')), + + /** + * Store node contents. + * + * @see this.destroy + * @type jQuery + **/ + prevContent = $('
        ').append(node.contents()).attr('class', node.attr('class') || '').attr('style', node.attr('style') || ''), + + /** + * Instance ID. Required to get/set cookie + * + * @type String + **/ + id = node.attr('id') || '', + + /** + * Events namespace + * + * @type String + **/ + namespace = 'elfinder-' + (id ? id : Math.random().toString().substr(2, 7)), + + /** + * Mousedown event + * + * @type String + **/ + mousedown = 'mousedown.'+namespace, + + /** + * Keydown event + * + * @type String + **/ + keydown = 'keydown.'+namespace, + + /** + * Keypress event + * + * @type String + **/ + keypress = 'keypress.'+namespace, + + /** + * Is shortcuts/commands enabled + * + * @type Boolean + **/ + enabled = true, + + /** + * Store enabled value before ajax requiest + * + * @type Boolean + **/ + prevEnabled = true, + + /** + * List of build-in events which mapped into methods with same names + * + * @type Array + **/ + events = ['enable', 'disable', 'load', 'open', 'reload', 'select', 'add', 'remove', 'change', 'dblclick', 'getfile', 'lockfiles', 'unlockfiles', 'selectfiles', 'unselectfiles', 'dragstart', 'dragstop', 'search', 'searchend', 'viewchange'], + + /** + * Rules to validate data from backend + * + * @type Object + **/ + rules = {}, + + /** + * Current working directory hash + * + * @type String + **/ + cwd = '', + + /** + * Current working directory options default + * + * @type Object + **/ + cwdOptionsDefault = { + path : '', + url : '', + tmbUrl : '', + disabled : [], + separator : '/', + archives : [], + extract : [], + copyOverwrite : true, + uploadOverwrite : true, + uploadMaxSize : 0, + jpgQuality : 100, + tmbCrop : false, + tmb : false // old API + }, + + /** + * Current working directory options + * + * @type Object + **/ + cwdOptions = {}, + + /** + * Files/dirs cache + * + * @type Object + **/ + files = {}, + + /** + * Files/dirs hash cache of each dirs + * + * @type Object + **/ + ownFiles = {}, + + /** + * Selected files hashes + * + * @type Array + **/ + selected = [], + + /** + * Events listeners + * + * @type Object + **/ + listeners = {}, + + /** + * Shortcuts + * + * @type Object + **/ + shortcuts = {}, + + /** + * Buffer for copied files + * + * @type Array + **/ + clipboard = [], + + /** + * Copied/cuted files hashes + * Prevent from remove its from cache. + * Required for dispaly correct files names in error messages + * + * @type Object + **/ + remember = {}, + + /** + * Queue for 'open' requests + * + * @type Array + **/ + queue = [], + + /** + * Queue for only cwd requests e.g. `tmb` + * + * @type Array + **/ + cwdQueue = [], + + /** + * Commands prototype + * + * @type Object + **/ + base = new self.command(self), + + /** + * elFinder node width + * + * @type String + * @default "auto" + **/ + width = 'auto', + + /** + * elFinder node height + * Number: pixcel or String: Number + "%" + * + * @type Number | String + * @default 400 + **/ + height = 400, + + /** + * Base node object or selector + * Element which is the reference of the height percentage + * + * @type Object|String + * @default null | $(window) (if height is percentage) + **/ + heightBase = null, + + /** + * elfinder path for sound played on remove + * @type String + * @default ./sounds/ + **/ + soundPath = './sounds/', + + beeper = $(document.createElement('audio')).hide().appendTo('body')[0], + + syncInterval, + autoSyncStop = 0, + + uiCmdMapPrev = '', + + gcJobRes = null, + + open = function(data) { + // NOTES: Do not touch data object + + var volumeid, contextmenu, emptyDirs = {}, stayDirs = {}, + rmClass, hashes, calc, gc, collapsed, prevcwd; + + if (self.api >= 2.1) { + // support volume driver option `uiCmdMap` + self.commandMap = (data.options.uiCmdMap && Object.keys(data.options.uiCmdMap).length)? data.options.uiCmdMap : {}; + if (uiCmdMapPrev !== JSON.stringify(self.commandMap)) { + uiCmdMapPrev = JSON.stringify(self.commandMap); + } + } else { + self.options.sync = 0; + } + + if (data.init) { + // init - reset cache + files = {}; + ownFiles = {}; + } else { + // remove only files from prev cwd + // and collapsed directory (included 100+ directories) to empty for perfomance tune in DnD + prevcwd = cwd; + rmClass = 'elfinder-subtree-loaded ' + self.res('class', 'navexpand'); + collapsed = self.res('class', 'navcollapse'); + hashes = Object.keys(files); + calc = function(i) { + if (!files[i]) { + return true; + } + + var isDir = (files[i].mime === 'directory'), + phash = files[i].phash, + pnav; + + if ( + (!isDir + || emptyDirs[phash] + || (!stayDirs[phash] + && $('#'+self.navHash2Id(files[i].hash)).is(':hidden') + && $('#'+self.navHash2Id(phash)).next('.elfinder-navbar-subtree').children().length > 100 + ) + ) + && (isDir || phash !== cwd) + && ! remember[i] + ) { + if (isDir && !emptyDirs[phash]) { + emptyDirs[phash] = true; + $('#'+self.navHash2Id(phash)) + .removeClass(rmClass) + .next('.elfinder-navbar-subtree').empty(); + } + deleteCache(files[i]); + } else if (isDir) { + stayDirs[phash] = true; + } + }; + gc = function() { + if (hashes.length) { + gcJobRes && gcJobRes._abort(); + gcJobRes = self.asyncJob(calc, hashes, { + interval : 20, + numPerOnce : 100 + }); + } + }; + + self.trigger('filesgc').one('filesgc', function() { + hashes = []; + }); + + self.one('opendone', function() { + if (prevcwd !== cwd) { + if (! node.data('lazycnt')) { + gc(); + } else { + self.one('lazydone', gc); + } + } + }); + } + + self.sorters = []; + cwd = data.cwd.hash; + cache(data.files); + if (!files[cwd]) { + cache([data.cwd]); + } + self.lastDir(cwd); + + self.autoSync(); + }, + + /** + * Store info about files/dirs in "files" object. + * + * @param Array files + * @return void + **/ + cache = function(data) { + var defsorter = { name: true, perm: true, date: true, size: true, kind: true }, + sorterChk = (self.sorters.length === 0), + l = data.length, + setSorter = function(f) { + var f = f || {}; + self.sorters = []; + $.each(self.sortRules, function(key) { + if (defsorter[key] || typeof f[key] !== 'undefined' || (key === 'mode' && typeof f.perm !== 'undefined')) { + self.sorters.push(key); + } + }); + }, + f, i; + + for (i = 0; i < l; i++) { + f = Object.assign({}, data[i]); + if (f.name && f.hash && f.mime) { + if (sorterChk && f.phash === cwd) { + setSorter(f); + sorterChk = false; + } + + // make or update of leaf roots cache + if (f.isroot && f.phash) { + if (! self.leafRoots[f.phash]) { + self.leafRoots[f.phash] = [ f.hash ]; + } else { + if ($.inArray(f.hash, self.leafRoots[f.phash]) === -1) { + self.leafRoots[f.phash].push(f.hash); + } + } + if (files[f.phash]) { + if (! files[f.phash].dirs) { + files[f.phash].dirs = 1; + } + if (f.ts && (files[f.phash].ts || 0) < f.ts) { + files[f.phash].ts = f.ts; + } + } + } + + files[f.hash] && deleteCache(files[f.hash], true); + files[f.hash] = f; + if (f.mime === 'directory' && !ownFiles[f.hash]) { + ownFiles[f.hash] = {}; + } + if (f.phash) { + if (!ownFiles[f.phash]) { + ownFiles[f.phash] = {}; + } + ownFiles[f.phash][f.hash] = true; + } + } + } + + // for empty folder + sorterChk && setSorter(); + }, + + /** + * Delete file object from files caches + * + * @param Array removed hashes + * @return void + */ + remove = function(removed) { + var l = removed.length, + roots = {}, + rm = function(hash) { + var file = files[hash], i; + if (file) { + if (file.mime === 'directory') { + if (roots[hash]) { + delete self.roots[roots[hash]]; + } + if (self.searchStatus.state < 2) { + $.each(files, function(h, f) { + f.phash == hash && rm(h); + }); + } + } + deleteCache(files[hash]); + } + }; + + $.each(self.roots, function(k, v) { + roots[v] = k; + }); + while (l--) { + rm(removed[l]); + } + }, + + /** + * Update file object in files caches + * + * @param Array changed file objects + * @return void + */ + change = function(changed) { + $.each(changed, function(i, file) { + var hash = file.hash; + if (files[hash]) { + $.each(['locked', 'hidden', 'width', 'height'], function(i, v){ + if (files[hash][v] && !file[v]) { + delete files[hash][v]; + } + }); + } + files[hash] = files[hash] ? Object.assign(files[hash], file) : file; + }); + }, + + /** + * Delete cache data of files, ownFiles and self.optionsByHashes + * + * @param Object file + * @param Boolean update + * @return void + */ + deleteCache = function(file, update) { + var hash = file.hash, + phash = file.phash; + + if (phash && ownFiles[phash]) { + delete ownFiles[phash][hash]; + } + if (!update) { + ownFiles[hash] && delete ownFiles[hash]; + self.optionsByHashes[hash] && delete self.optionsByHashes[hash]; + } + delete files[hash]; + }, + + /** + * Maximum number of concurrent connections on request + * + * @type Number + */ + requestMaxConn, + + /** + * Current number of connections + * + * @type Number + */ + requestCnt = 0, + + /** + * Queue waiting for connection + * + * @type Array + */ + requestQueue = [], + + /** + * Flag to cancel the `open` command waiting for connection + * + * @type Boolean + */ + requestQueueSkipOpen = false, + + /** + * Exec shortcut + * + * @param jQuery.Event keydown/keypress event + * @return void + */ + execShortcut = function(e) { + var code = e.keyCode, + ctrlKey = !!(e.ctrlKey || e.metaKey), + ddm; + + if (enabled) { + + $.each(shortcuts, function(i, shortcut) { + if (shortcut.type == e.type + && shortcut.keyCode == code + && shortcut.shiftKey == e.shiftKey + && shortcut.ctrlKey == ctrlKey + && shortcut.altKey == e.altKey) { + e.preventDefault(); + e.stopPropagation(); + shortcut.callback(e, self); + self.debug('shortcut-exec', i+' : '+shortcut.description); + } + }); + + // prevent tab out of elfinder + if (code == $.ui.keyCode.TAB && !$(e.target).is(':input')) { + e.preventDefault(); + } + + // cancel any actions by [Esc] key + if (e.type === 'keydown' && code == $.ui.keyCode.ESCAPE) { + // copy or cut + if (! node.find('.ui-widget:visible').length) { + self.clipboard().length && self.clipboard([]); + } + // dragging + if ($.ui.ddmanager) { + ddm = $.ui.ddmanager.current; + ddm && ddm.helper && ddm.cancel(); + } + // button menus + node.find('.ui-widget.elfinder-button-menu').hide(); + // trigger keydownEsc + self.trigger('keydownEsc', e); + } + + } + }, + date = new Date(), + utc, + i18n, + inFrame = (window.parent !== window), + parentIframe = (function() { + var pifm, ifms; + if (inFrame) { + try { + ifms = $('iframe', window.parent.document); + if (ifms.length) { + $.each(ifms, function(i, ifm) { + if (ifm.contentWindow === window) { + pifm = $(ifm); + return false; + } + }); + } + } catch(e) {} + } + return pifm; + })(), + bootUp; + + // check opt.bootCallback + if (opts.bootCallback && typeof opts.bootCallback === 'function') { + (function() { + var func = bootCallback, + opFunc = opts.bootCallback; + bootCallback = function(fm, extraObj) { + func && typeof func === 'function' && func.call(this, fm, extraObj); + opFunc.call(this, fm, extraObj); + } + })(); + } + delete opts.bootCallback; + + /** + * Protocol version + * + * @type String + **/ + this.api = null; + + /** + * elFinder use new api + * + * @type Boolean + **/ + this.newAPI = false; + + /** + * elFinder use old api + * + * @type Boolean + **/ + this.oldAPI = false; + + /** + * Net drivers names + * + * @type Array + **/ + this.netDrivers = []; + + /** + * Base URL of elfFinder library starting from Manager HTML + * + * @type String + */ + this.baseUrl = ''; + + /** + * Is elFinder CSS loaded + * + * @type Boolean + */ + this.cssloaded = false; + + /** + * Callback function at boot up that option specified at elFinder starting + * + * @type Function + */ + this.bootCallback; + + /** + * Configuration options + * + * @type Object + **/ + this.options = $.extend(true, {}, this._options, opts||{}); + + // set fm.baseUrl + this.baseUrl = (function() { + var myTag, myCss, base, baseUrl; + + if (self.options.baseUrl) { + return self.options.baseUrl; + } else { + baseUrl = ''; + myTag = $('head > script[src$="js/elfinder.min.js"],script[src$="js/elfinder.full.js"]:first'); + if (myTag.length) { + myCss = $('head > link[href$="css/elfinder.min.css"],link[href$="css/elfinder.full.css"]:first').length; + if (! myCss) { + // to request CSS auto loading + self.cssloaded = null; + } + baseUrl = myTag.attr('src').replace(/js\/[^\/]+$/, ''); + if (! baseUrl.match(/^(https?\/\/|\/)/)) { + // check tag + if (base = $('head > base[href]').attr('href')) { + baseUrl = base.replace(/\/$/, '') + '/' + baseUrl; + } + } + } + if (baseUrl !== '') { + self.options.baseUrl = baseUrl; + } else { + if (! self.options.baseUrl) { + self.options.baseUrl = './'; + } + baseUrl = self.options.baseUrl; + } + return baseUrl; + } + })(); + + // set dispInlineRegex + cwdOptionsDefault['dispInlineRegex'] = this.options.dispInlineRegex; + + // auto load required CSS + if (this.options.cssAutoLoad) { + (function(fm) { + var baseUrl = self.baseUrl, + hide, fi, cnt; + + if (self.cssloaded === null) { + // hide elFinder node while css loading + hide = $(''); + + $('head').append(hide); + self.loadCss([baseUrl+'css/elfinder.min.css', baseUrl+'css/theme.css']); + + // additional CSS files + if (Array.isArray(self.options.cssAutoLoad)) { + self.loadCss(self.options.cssAutoLoad); + } + + // check css loaded and remove hide + cnt = 1000; // timeout 10 secs + fi = setInterval(function() { + if (--cnt < 0 || node.css('visibility') !== 'hidden') { + clearInterval(fi); + hide.remove(); + self.cssloaded = true; + self.trigger('cssloaded'); + } + }, 10); + } + self.options.cssAutoLoad = false; + })(); + } + + /** + * Volume option to set the properties of the root Stat + * + * @type Object + */ + this.optionProperties = { + icon: void(0), + csscls: void(0), + tmbUrl: void(0), + uiCmdMap: {}, + netkey: void(0), + disabled: [] + }; + + if (opts.ui) { + this.options.ui = opts.ui; + } + + if (opts.commands) { + this.options.commands = opts.commands; + } + + if (opts.uiOptions) { + if (opts.uiOptions.toolbar && Array.isArray(opts.uiOptions.toolbar)) { + if ($.isPlainObject(opts.uiOptions.toolbar[opts.uiOptions.toolbar.length - 1])) { + Object.assign(this.options.uiOptions.toolbarExtra, opts.uiOptions.toolbar.pop()); + } + this.options.uiOptions.toolbar = opts.uiOptions.toolbar; + } + if (opts.uiOptions.toolbarExtra && $.isPlainObject(opts.uiOptions.toolbarExtra)) { + Object.assign(this.options.uiOptions.toolbarExtra, opts.uiOptions.toolbarExtra); + } + + if (opts.uiOptions.cwd && opts.uiOptions.cwd.listView) { + if (opts.uiOptions.cwd.listView.columns) { + this.options.uiOptions.cwd.listView.columns = opts.uiOptions.cwd.listView.columns; + } + if (opts.uiOptions.cwd.listView.columnsCustomName) { + this.options.uiOptions.cwd.listView.columnsCustomName = opts.uiOptions.cwd.listView.columnsCustomName; + } + } + } + // join toolbarExtra to toolbar + this.options.uiOptions.toolbar.push(this.options.uiOptions.toolbarExtra); + delete this.options.uiOptions.toolbarExtra; + + if (opts.contextmenu) { + Object.assign(this.options.contextmenu, opts.contextmenu); + } + + if (! inFrame && ! this.options.enableAlways && $('body').children().length === 2) { // only node and beeper + this.options.enableAlways = true; + } + + if (this.baseUrl === '') { + this.baseUrl = this.options.baseUrl? this.options.baseUrl : ''; + } + + // make options.debug + if (this.options.debug === true) { + this.options.debug = 'all'; + } else if (Array.isArray(this.options.debug)) { + (function() { + var d = {}; + $.each(self.options.debug, function() { + d[this] = true; + }); + self.options.debug = d; + })(); + } else { + this.options.debug = false; + } + + /** + * Original functions evacuated by conflict check + * + * @type Object + */ + this.noConflicts = {}; + + /** + * Check and save conflicts with bootstrap etc + * + * @type Function + */ + this.noConflict = function() { + $.each(conflictChecks, function(i, p) { + if ($.fn[p] && typeof $.fn[p].noConflict === 'function') { + self.noConflicts[p] = $.fn[p].noConflict(); + } + }); + } + // do check conflict + this.noConflict(); + + /** + * Is elFinder over CORS + * + * @type Boolean + **/ + this.isCORS = false; + + // configure for CORS + (function(){ + var parseUrl = document.createElement('a'), + parseUploadUrl; + parseUrl.href = opts.url; + if (opts.urlUpload && (opts.urlUpload !== opts.url)) { + parseUploadUrl = document.createElement('a'); + parseUploadUrl.href = opts.urlUpload; + } + if (window.location.host !== parseUrl.host || (parseUploadUrl && (window.location.host !== parseUploadUrl.host))) { + self.isCORS = true; + if (!$.isPlainObject(self.options.customHeaders)) { + self.options.customHeaders = {}; + } + if (!$.isPlainObject(self.options.xhrFields)) { + self.options.xhrFields = {}; + } + self.options.requestType = 'post'; + self.options.customHeaders['X-Requested-With'] = 'XMLHttpRequest'; + self.options.xhrFields['withCredentials'] = true; + } + })(); + + /** + * Ajax request type + * + * @type String + * @default "get" + **/ + this.requestType = /^(get|post)$/i.test(this.options.requestType) ? this.options.requestType.toLowerCase() : 'get'; + + // set `requestMaxConn` by option + requestMaxConn = Math.max(parseInt(this.options.requestMaxConn), 1); + + /** + * Any data to send across every ajax request + * + * @type Object + * @default {} + **/ + this.customData = $.isPlainObject(this.options.customData) ? this.options.customData : {}; + + /** + * Any custom headers to send across every ajax request + * + * @type Object + * @default {} + */ + this.customHeaders = $.isPlainObject(this.options.customHeaders) ? this.options.customHeaders : {}; + + /** + * Any custom xhrFields to send across every ajax request + * + * @type Object + * @default {} + */ + this.xhrFields = $.isPlainObject(this.options.xhrFields) ? this.options.xhrFields : {}; + + /** + * command names for into queue for only cwd requests + * these commands aborts before `open` request + * + * @type Array + * @default ['tmb', 'parents'] + */ + this.abortCmdsOnOpen = this.options.abortCmdsOnOpen || ['tmb', 'parents']; + + /** + * ID. Required to create unique cookie name + * + * @type String + **/ + this.id = id; + + /** + * ui.nav id prefix + * + * @type String + */ + this.navPrefix = 'nav' + (elFinder.prototype.uniqueid? elFinder.prototype.uniqueid : '') + '-'; + + /** + * ui.cwd id prefix + * + * @type String + */ + this.cwdPrefix = elFinder.prototype.uniqueid? ('cwd' + elFinder.prototype.uniqueid + '-') : ''; + + // Increment elFinder.prototype.uniqueid + ++elFinder.prototype.uniqueid; + + /** + * URL to upload files + * + * @type String + **/ + this.uploadURL = opts.urlUpload || opts.url; + + /** + * Events namespace + * + * @type String + **/ + this.namespace = namespace; + + /** + * Today timestamp + * + * @type Number + **/ + this.today = (new Date(date.getFullYear(), date.getMonth(), date.getDate())).getTime()/1000; + + /** + * Yesterday timestamp + * + * @type Number + **/ + this.yesterday = this.today - 86400; + + utc = this.options.UTCDate ? 'UTC' : ''; + + this.getHours = 'get'+utc+'Hours'; + this.getMinutes = 'get'+utc+'Minutes'; + this.getSeconds = 'get'+utc+'Seconds'; + this.getDate = 'get'+utc+'Date'; + this.getDay = 'get'+utc+'Day'; + this.getMonth = 'get'+utc+'Month'; + this.getFullYear = 'get'+utc+'FullYear'; + + /** + * elFinder node z-index (auto detect on elFinder load) + * + * @type null | Number + **/ + this.zIndex; + + /** + * Current search status + * + * @type Object + */ + this.searchStatus = { + state : 0, // 0: search ended, 1: search started, 2: in search result + query : '', + target : '', + mime : '', + mixed : false, // in multi volumes search: false or Array that target volume ids + ininc : false // in incremental search + }; + + /** + * Method to store/fetch data + * + * @type Function + **/ + this.storage = (function() { + try { + if ('localStorage' in window && window['localStorage'] !== null) { + if (self.UA.Safari) { + // check for Mac/iOS safari private browsing mode + window.localStorage.setItem('elfstoragecheck', 1); + window.localStorage.removeItem('elfstoragecheck'); + } + return self.localStorage; + } else { + return self.cookie; + } + } catch (e) { + return self.cookie; + } + })(); + + /** + * Interface language + * + * @type String + * @default "en" + **/ + this.lang = this.storage('lang') || this.options.lang; + + this.viewType = this.storage('view') || this.options.defaultView || 'icons'; + + this.sortType = this.storage('sortType') || this.options.sortType || 'name'; + + this.sortOrder = this.storage('sortOrder') || this.options.sortOrder || 'asc'; + + this.sortStickFolders = this.storage('sortStickFolders'); + if (this.sortStickFolders === null) { + this.sortStickFolders = !!this.options.sortStickFolders; + } else { + this.sortStickFolders = !!this.sortStickFolders + } + + this.sortAlsoTreeview = this.storage('sortAlsoTreeview'); + if (this.sortAlsoTreeview === null) { + this.sortAlsoTreeview = !!this.options.sortAlsoTreeview; + } else { + this.sortAlsoTreeview = !!this.sortAlsoTreeview + } + + this.sortRules = $.extend(true, {}, this._sortRules, this.options.sortRules); + + $.each(this.sortRules, function(name, method) { + if (typeof method != 'function') { + delete self.sortRules[name]; + } + }); + + this.compare = $.proxy(this.compare, this); + + /** + * Delay in ms before open notification dialog + * + * @type Number + * @default 500 + **/ + this.notifyDelay = this.options.notifyDelay > 0 ? parseInt(this.options.notifyDelay) : 500; + + /** + * Dragging UI Helper object + * + * @type jQuery | null + **/ + this.draggingUiHelper = null; + + /** + * Base droppable options + * + * @type Object + **/ + this.droppable = { + greedy : true, + tolerance : 'pointer', + accept : '.elfinder-cwd-file-wrapper,.elfinder-navbar-dir,.elfinder-cwd-file,.elfinder-cwd-filename', + hoverClass : this.res('class', 'adroppable'), + classes : { // Deprecated hoverClass jQueryUI>=1.12.0 + 'ui-droppable-hover': this.res('class', 'adroppable') + }, + autoDisable: true, // elFinder original, see jquery.elfinder.js + drop : function(e, ui) { + var dst = $(this), + targets = $.map(ui.helper.data('files')||[], function(h) { return h || null }), + result = [], + dups = [], + faults = [], + isCopy = ui.helper.hasClass('elfinder-drag-helper-plus'), + c = 'class', + cnt, hash, i, h; + + if (typeof e.button === 'undefined' || ui.helper.data('namespace') !== namespace || ! self.insideWorkzone(e.pageX, e.pageY)) { + return false; + } + if (dst.hasClass(self.res(c, 'cwdfile'))) { + hash = self.cwdId2Hash(dst.attr('id')); + } else if (dst.hasClass(self.res(c, 'navdir'))) { + hash = self.navId2Hash(dst.attr('id')); + } else { + hash = cwd; + } + + cnt = targets.length; + + while (cnt--) { + h = targets[cnt]; + // ignore drop into itself or in own location + if (h != hash && files[h].phash != hash) { + result.push(h); + } else { + ((isCopy && h !== hash && files[hash].write)? dups : faults).push(h); + } + } + + if (faults.length) { + return false; + } + + ui.helper.data('droped', true); + + if (dups.length) { + ui.helper.hide(); + self.exec('duplicate', dups, {_userAction: true}); + } + + if (result.length) { + ui.helper.hide(); + self.clipboard(result, !isCopy); + self.exec('paste', hash, {_userAction: true}, hash).always(function(){ + self.clipboard([]); + self.trigger('unlockfiles', {files : targets}); + }); + self.trigger('drop', {files : targets}); + } + } + }; + + /** + * Return true if filemanager is active + * + * @return Boolean + **/ + this.enabled = function() { + return enabled && this.visible(); + }; + + /** + * Return true if filemanager is visible + * + * @return Boolean + **/ + this.visible = function() { + return node[0].elfinder && node.is(':visible'); + }; + + /** + * Return file is root? + * + * @param Object target file object + * @return Boolean + */ + this.isRoot = function(file) { + return (file.isroot || ! file.phash)? true : false; + } + + /** + * Return root dir hash for current working directory + * + * @param String target hash + * @param Boolean include fake parent (optional) + * @return String + */ + this.root = function(hash, fake) { + hash = hash || cwd; + var dir, i; + + if (! fake) { + $.each(self.roots, function(id, rhash) { + if (hash.indexOf(id) === 0) { + dir = rhash; + return false; + } + }); + if (dir) { + return dir; + } + } + + dir = files[hash]; + while (dir && dir.phash && (fake || ! dir.isroot)) { + dir = files[dir.phash] + } + if (dir) { + return dir.hash; + } + + while (i in files && files.hasOwnProperty(i)) { + dir = files[i] + if (!dir.phash && !dir.mime == 'directory' && dir.read) { + return dir.hash; + } + } + + return ''; + }; + + /** + * Return current working directory info + * + * @return Object + */ + this.cwd = function() { + return files[cwd] || {}; + }; + + /** + * Return required cwd option + * + * @param String option name + * @param String target hash (optional) + * @return mixed + */ + this.option = function(name, target) { + var res; + target = target || cwd; + if (self.optionsByHashes[target] && typeof self.optionsByHashes[target][name] !== 'undefined') { + return self.optionsByHashes[target][name]; + } + if (cwd !== target) { + res = ''; + $.each(self.volOptions, function(id, opt) { + if (target.indexOf(id) === 0) { + res = opt[name] || ''; + return false; + } + }); + return res; + } else { + return cwdOptions[name] || ''; + } + }; + + /** + * Return disabled commands by each folder + * + * @param Array target hashes + * @return Array + */ + this.getDisabledCmds = function(targets) { + var disabled = ['hidden']; + if (! Array.isArray(targets)) { + targets = [ targets ]; + } + $.each(targets, function(i, h) { + var disCmds = self.option('disabled', h); + if (disCmds) { + $.each(disCmds, function(i, cmd) { + if ($.inArray(cmd, disabled) === -1) { + disabled.push(cmd); + } + }); + } + }); + return disabled; + } + + /** + * Return file data from current dir or tree by it's hash + * + * @param String file hash + * @return Object + */ + this.file = function(hash) { + return hash? files[hash] : void(0); + }; + + /** + * Return all cached files + * + * @param String parent hash + * @return Object + */ + this.files = function(phash) { + var items = {}; + if (phash) { + if (!ownFiles[phash]) { + return {}; + } + $.each(ownFiles[phash], function(h) { + if (files[h]) { + items[h] = files[h]; + } else { + delete ownFiles[phash][h]; + } + }); + return Object.assign({}, items); + } + return Object.assign({}, files); + }; + + /** + * Return list of file parents hashes include file hash + * + * @param String file hash + * @return Array + */ + this.parents = function(hash) { + var parents = [], + dir; + + while ((dir = this.file(hash))) { + parents.unshift(dir.hash); + hash = dir.phash; + } + return parents; + }; + + this.path2array = function(hash, i18) { + var file, + path = []; + + while (hash) { + if ((file = files[hash]) && file.hash) { + path.unshift(i18 && file.i18 ? file.i18 : file.name); + hash = file.isroot? null : file.phash; + } else { + path = []; + break; + } + } + + return path; + }; + + /** + * Return file path or Get path async with jQuery.Deferred + * + * @param Object file + * @param Boolean i18 + * @param Object asyncOpt + * @return String|jQuery.Deferred + */ + this.path = function(hash, i18, asyncOpt) { + var path = files[hash] && files[hash].path + ? files[hash].path + : this.path2array(hash, i18).join(cwdOptions.separator); + if (! asyncOpt || ! files[hash]) { + return path; + } else { + asyncOpt = Object.assign({notify: {type : 'parents', cnt : 1, hideCnt : true}}, asyncOpt); + + var dfd = $.Deferred(), + notify = asyncOpt.notify, + noreq = false, + req = function() { + self.request({ + data : {cmd : 'parents', target : files[hash].phash}, + notify : notify, + preventFail : true + }) + .done(done) + .fail(function() { + dfd.reject(); + }); + }, + done = function() { + self.one('parentsdone', function() { + path = self.path(hash, i18); + if (path === '' && noreq) { + //retry with request + noreq = false; + req(); + } else { + if (notify) { + clearTimeout(ntftm); + notify.cnt = -(parseInt(notify.cnt || 0)); + self.notify(notify); + } + dfd.resolve(path); + } + }); + }, + ntftm; + + if (path) { + return dfd.resolve(path); + } else { + if (self.ui['tree']) { + // try as no request + if (notify) { + ntftm = setTimeout(function() { + self.notify(notify); + }, self.notifyDelay); + } + noreq = true; + done(true); + } else { + req(); + } + return dfd; + } + } + }; + + /** + * Return file url if set + * + * @param String file hash + * @param Object Options + * @return String + */ + this.url = function(hash, opts) { + var file = files[hash], + opts = opts || {}, + async = opts.async || false, + temp = opts.temporary || false, + dfrd = async? $.Deferred() : null, + getUrl = function(url) { + if (url) { + return url; + } + if (file.url) { + return file.url; + } + + baseUrl = (file.hash.indexOf(self.cwd().volumeid) === 0)? cwdOptions.url : self.option('url', file.hash); + + if (baseUrl) { + return baseUrl + $.map(self.path2array(hash), function(n) { return encodeURIComponent(n); }).slice(1).join('/') + } + + var params = Object.assign({}, self.customData, { + cmd: 'file', + target: file.hash + }); + if (self.oldAPI) { + params.cmd = 'open'; + params.current = file.phash; + } + return self.options.url + (self.options.url.indexOf('?') === -1 ? '?' : '&') + $.param(params, true); + }, + baseUrl, res; + + if (!file || !file.read) { + return async? dfrd.resolve('') : ''; + } + + if (file.url == '1') { + this.request({ + data : { cmd : 'url', target : hash, options : { temporary: temp? 1 : 0 } }, + preventDefault : true, + options: {async: async}, + notify: async? {type : temp? 'file' : 'url', cnt : 1, hideCnt : true} : {} + }) + .done(function(data) { + file.url = data.url || ''; + }) + .fail(function() { + file.url = ''; + }) + .always(function() { + var url; + if (file.url && temp) { + url = file.url; + file.url = '1'; // restore + } + if (async) { + dfrd.resolve(getUrl(url)); + } else { + return getUrl(url); + } + }); + } else { + if (async) { + dfrd.resolve(getUrl()); + } else { + return getUrl(); + } + } + + if (async) { + return dfrd; + } + }; + + /** + * Return file url for open in elFinder + * + * @param String file hash + * @param Boolean for download link + * @return String + */ + this.openUrl = function(hash, download) { + var file = files[hash], + url = ''; + + if (!file || !file.read) { + return ''; + } + + if (!download) { + if (file.url) { + if (file.url != 1) { + return file.url; + } + } else if (cwdOptions.url && file.hash.indexOf(self.cwd().volumeid) === 0) { + return cwdOptions.url + $.map(this.path2array(hash), function(n) { return encodeURIComponent(n); }).slice(1).join('/'); + } + } + + url = this.options.url; + url = url + (url.indexOf('?') === -1 ? '?' : '&') + + (this.oldAPI ? 'cmd=open¤t='+file.phash : 'cmd=file') + + '&target=' + file.hash; + + if (download) { + url += '&download=1'; + } + + $.each(this.options.customData, function(key, val) { + url += '&' + encodeURIComponent(key) + '=' + encodeURIComponent(val); + }); + + return url; + }; + + /** + * Return thumbnail url + * + * @param Object file object + * @return String + */ + this.tmb = function(file) { + var tmbUrl, tmbCrop, + cls = 'elfinder-cwd-bgurl', + url = ''; + + if ($.isPlainObject(file)) { + if (self.searchStatus.state && file.hash.indexOf(self.cwd().volumeid) !== 0) { + tmbUrl = self.option('tmbUrl', file.hash); + tmbCrop = self.option('tmbCrop', file.hash); + } else { + tmbUrl = cwdOptions['tmbUrl']; + tmbCrop = cwdOptions['tmbCrop']; + } + if (tmbCrop) { + cls += ' elfinder-cwd-bgurl-crop'; + } + if (tmbUrl === 'self' && file.mime.indexOf('image/') === 0) { + url = self.openUrl(file.hash); + cls += ' elfinder-cwd-bgself'; + } else if ((self.oldAPI || tmbUrl) && file && file.tmb && file.tmb != 1) { + url = tmbUrl + file.tmb; + } + if (url) { + return { url: url, className: cls }; + } + } + + return false; + }; + + /** + * Return selected files hashes + * + * @return Array + **/ + this.selected = function() { + return selected.slice(0); + }; + + /** + * Return selected files info + * + * @return Array + */ + this.selectedFiles = function() { + return $.map(selected, function(hash) { return files[hash] ? Object.assign({}, files[hash]) : null }); + }; + + /** + * Return true if file with required name existsin required folder + * + * @param String file name + * @param String parent folder hash + * @return Boolean + */ + this.fileByName = function(name, phash) { + var hash; + + for (hash in files) { + if (files.hasOwnProperty(hash) && files[hash].phash == phash && files[hash].name == name) { + return files[hash]; + } + } + }; + + /** + * Valid data for required command based on rules + * + * @param String command name + * @param Object cammand's data + * @return Boolean + */ + this.validResponse = function(cmd, data) { + return data.error || this.rules[this.rules[cmd] ? cmd : 'defaults'](data); + }; + + /** + * Return bytes from ini formated size + * + * @param String ini formated size + * @return Integer + */ + this.returnBytes = function(val) { + var last; + if (isNaN(val)) { + if (! val) { + val = ''; + } + // for ex. 1mb, 1KB + val = val.replace(/b$/i, ''); + last = val.charAt(val.length - 1).toLowerCase(); + val = val.replace(/[tgmk]$/i, ''); + if (last == 't') { + val = val * 1024 * 1024 * 1024 * 1024; + } else if (last == 'g') { + val = val * 1024 * 1024 * 1024; + } else if (last == 'm') { + val = val * 1024 * 1024; + } else if (last == 'k') { + val = val * 1024; + } + val = isNaN(val)? 0 : parseInt(val); + } else { + val = parseInt(val); + if (val < 1) val = 0; + } + return val; + }; + + /** + * Proccess ajax request. + * Fired events : + * @todo + * @example + * @todo + * @return $.Deferred + */ + this.request = function(opts) { + var self = this, + o = this.options, + dfrd = $.Deferred(), + // request data + data = Object.assign({}, o.customData, {mimes : o.onlyMimes}, opts.data || opts), + // command name + cmd = data.cmd, + isOpen = (!opts.asNotOpen && cmd === 'open'), + // call default fail callback (display error dialog) ? + deffail = !(opts.preventDefault || opts.preventFail), + // call default success callback ? + defdone = !(opts.preventDefault || opts.preventDone), + // options for notify dialog + notify = Object.assign({}, opts.notify), + // make cancel button + cancel = !!opts.cancel, + // do not normalize data - return as is + raw = !!opts.raw, + // sync files on request fail + syncOnFail = opts.syncOnFail, + // use lazy() + lazy = !!opts.lazy, + // prepare function before done() + prepare = opts.prepare, + // navigate option object when cmd done + navigate = opts.navigate, + // open notify dialog timeout + timeout, + // request options + options = Object.assign({ + url : o.url, + async : true, + type : this.requestType, + dataType : 'json', + cache : false, + // timeout : 100, + data : data, + headers : this.customHeaders, + xhrFields: this.xhrFields + }, opts.options || {}), + /** + * Default success handler. + * Call default data handlers and fire event with command name. + * + * @param Object normalized response data + * @return void + **/ + done = function(data) { + data.warning && self.error(data.warning); + + if (isOpen) { + open(data); + } else { + self.updateCache(data); + } + + data.changed && data.changed.length && change(data.changed); + + self.lazy(function() { + // fire some event to update cache/ui + data.removed && data.removed.length && self.remove(data); + data.added && data.added.length && self.add(data); + data.changed && data.changed.length && self.change(data); + }).then(function() { + // fire event with command name + return self.lazy(function() { + self.trigger(cmd, data); + }); + }).then(function() { + // fire event with command name + 'done' + return self.lazy(function() { + self.trigger(cmd + 'done'); + }); + }).then(function() { + // force update content + data.sync && self.sync(); + }); + }, + /** + * Request error handler. Reject dfrd with correct error message. + * + * @param jqxhr request object + * @param String request status + * @return void + **/ + error = function(xhr, status) { + var error, data, + d = self.options.debug; + + switch (status) { + case 'abort': + error = xhr.quiet ? '' : ['errConnect', 'errAbort']; + break; + case 'timeout': + error = ['errConnect', 'errTimeout']; + break; + case 'parsererror': + error = ['errResponse', 'errDataNotJSON']; + if (xhr.responseText) { + if (! cwd || (d && (d === 'all' || d['backend-error']))) { + error.push(xhr.responseText); + } + } + break; + default: + if (xhr.responseText) { + // check responseText, Is that JSON? + try { + data = JSON.parse(xhr.responseText); + if (data && data.error) { + error = data.error; + } + } catch(e) {} + } + if (! error) { + if (xhr.status == 403) { + error = ['errConnect', 'errAccess', 'HTTP error ' + xhr.status]; + } else if (xhr.status == 404) { + error = ['errConnect', 'errNotFound', 'HTTP error ' + xhr.status]; + } else if (xhr.status >= 500) { + error = ['errResponse', 'errServerError', 'HTTP error ' + xhr.status]; + } else { + if (xhr.status == 414 && options.type === 'get') { + // retry by POST method + options.type = 'post'; + dfrd.xhr = xhr = self.transport.send(options).fail(error).done(success); + return; + } + error = xhr.quiet ? '' : ['errConnect', 'HTTP error ' + xhr.status]; + } + } + } + + self.trigger(cmd + 'done'); + dfrd.reject(error, xhr, status); + }, + /** + * Request success handler. Valid response data and reject/resolve dfrd. + * + * @param Object response data + * @param String request status + * @return void + **/ + success = function(response) { + var d = self.options.debug; + + // Set currrent request command name + self.currentReqCmd = cmd; + + if (response.debug && (!d || (d !== 'all' && !d['backend-error']))) { + if (!d) { + self.options.debug = {}; + } + self.options.debug['backend-error'] = true + } + + if (raw) { + response && response.debug && self.debug('backend-debug', response); + return dfrd.resolve(response); + } + + if (!response) { + return dfrd.reject(['errResponse', 'errDataEmpty'], xhr, response); + } else if (!$.isPlainObject(response)) { + return dfrd.reject(['errResponse', 'errDataNotJSON'], xhr, response); + } else if (response.error) { + return dfrd.reject(response.error, xhr, response); + }/* else if (!self.validResponse(cmd, response)) { + return dfrd.reject('errResponse', xhr, response); + }*/ + + var resolve = function() { + var pushLeafRoots = function(name) { + if (self.leafRoots[data.target] && response[name]) { + $.each(self.leafRoots[data.target], function(i, h) { + var root; + if (root = self.file(h)) { + response[name].push(root); + } + }); + } + }, + actionTarget; + + if (isOpen) { + pushLeafRoots('files'); + } else if (cmd === 'tree') { + pushLeafRoots('tree'); + } + + response = self.normalize(response); + + if (!self.validResponse(cmd, response)) { + return dfrd.reject((response.norError || 'errResponse'), xhr, response); + } + + if (!self.api) { + self.api = response.api || 1; + if (self.api == '2.0' && typeof response.options.uploadMaxSize !== 'undefined') { + self.api = '2.1'; + } + self.newAPI = self.api >= 2; + self.oldAPI = !self.newAPI; + } + + if (response.options) { + cwdOptions = Object.assign({}, cwdOptionsDefault, response.options); + } + + if (response.netDrivers) { + self.netDrivers = response.netDrivers; + } + + if (response.maxTargets) { + self.maxTargets = response.maxTargets; + } + + if (isOpen && !!data.init) { + self.uplMaxSize = self.returnBytes(response.uplMaxSize); + self.uplMaxFile = !!response.uplMaxFile? parseInt(response.uplMaxFile) : 20; + } + + if (typeof prepare === 'function') { + prepare(response); + } + + if (navigate) { + actionTarget = navigate.target || 'added'; + if (response[actionTarget] && response[actionTarget].length) { + self.one(cmd + 'done', function() { + var targets = response[actionTarget], + newItems = self.findCwdNodes(targets), + inCwdHashes = function() { + var cwdHash = self.cwd().hash; + return $.map(targets, function(f) { return (f.phash && cwdHash === f.phash)? f.hash : null; }); + }, + hashes = inCwdHashes(), + makeToast = function(t) { + var node = void(0), + data = t.action? t.action.data : void(0), + cmd, msg, done; + if ((data || hashes.length) && t.action && (msg = t.action.msg) && (cmd = t.action.cmd) && (!t.action.cwdNot || t.action.cwdNot !== self.cwd().hash)) { + done = t.action.done; + data = t.action.data; + node = $('
        ') + .append( + $('') + .on('mouseenter mouseleave', function(e) { + $(this).toggleClass('ui-state-hover', e.type == 'mouseenter'); + }) + .on('click', function() { + self.exec(cmd, data || hashes, {_userAction: true, _currentType: 'toast', _currentNode: $(this) }); + if (done) { + self.one(cmd+'done', function() { + if (typeof done === 'function') { + done(); + } else if (done === 'select') { + self.trigger('selectfiles', {files : inCwdHashes()}); + } + }); + } + }) + ); + } + delete t.action; + t.extNode = node; + return t; + }; + + if (! navigate.toast) { + navigate.toast = {}; + } + + !navigate.noselect && self.trigger('selectfiles', {files : self.searchStatus.state > 1 ? $.map(targets, function(f) { return f.hash; }) : hashes}); + + if (newItems.length) { + if (!navigate.noscroll) { + newItems.first().trigger('scrolltoview', {blink : false}); + self.resources.blink(newItems, 'lookme'); + } + if ($.isPlainObject(navigate.toast.incwd)) { + self.toast(makeToast(navigate.toast.incwd)); + } + } else { + if ($.isPlainObject(navigate.toast.inbuffer)) { + self.toast(makeToast(navigate.toast.inbuffer)); + } + } + }); + } + } + + dfrd.resolve(response); + + response.debug && self.debug('backend-debug', response); + }; + + lazy? self.lazy(resolve) : resolve(); + }, + xhr, _xhr, + xhrAbort = function(e) { + if (xhr && xhr.state() === 'pending') { + xhr.quiet = true; + xhr.abort(); + if (e && e.type != 'unload' && e.type != 'destroy') { + self.autoSync(); + } + } + }, + abort = function(e){ + self.trigger(cmd + 'done'); + if (e.type == 'autosync') { + if (e.data.action != 'stop') return; + } else if (e.type != 'unload' && e.type != 'destroy' && e.type != 'openxhrabort') { + if (!e.data.added || !e.data.added.length) { + return; + } + } + xhrAbort(e); + }, + request = function() { + if (isOpen) { + if (requestQueueSkipOpen) { + return dfrd.reject(); + } + requestQueueSkipOpen = true; + } + + requestCnt++; + + dfrd.fail(function(error, xhr, response) { + xhrAbort(); + self.trigger(cmd + 'fail', response); + if (error) { + deffail ? self.error(error) : self.debug('error', self.i18n(error)); + } + syncOnFail && self.sync(); + }) + + if (!cmd) { + syncOnFail = false; + return dfrd.reject('errCmdReq'); + } + + if (self.maxTargets && data.targets && data.targets.length > self.maxTargets) { + syncOnFail = false; + return dfrd.reject(['errMaxTargets', self.maxTargets]); + } + + defdone && dfrd.done(done); + + if (notify.type && notify.cnt) { + if (cancel) { + notify.cancel = dfrd; + } + timeout = setTimeout(function() { + self.notify(notify); + dfrd.always(function() { + notify.cnt = -(parseInt(notify.cnt)||0); + self.notify(notify); + }) + }, self.notifyDelay) + + dfrd.always(function() { + clearTimeout(timeout); + }); + } + + // quiet abort not completed "open" requests + if (isOpen) { + while ((_xhr = queue.pop())) { + if (_xhr.state() == 'pending') { + _xhr.quiet = true; + _xhr.abort(); + } + } + if (cwd !== data.target) { + while ((_xhr = cwdQueue.pop())) { + if (_xhr.state() == 'pending') { + _xhr.quiet = true; + _xhr.abort(); + } + } + } + } + + // trigger abort autoSync for commands to add the item + if ($.inArray(cmd, (self.cmdsToAdd + ' autosync').split(' ')) !== -1) { + if (cmd !== 'autosync') { + self.autoSync('stop'); + dfrd.always(function() { + self.autoSync(); + }); + } + self.trigger('openxhrabort'); + } + + delete options.preventFail + + dfrd.xhr = xhr = self.transport.send(options).always(function() { + --requestCnt; + if (requestQueue.length) { + requestQueue.shift()(); + } else { + requestQueueSkipOpen = false; + } + }).fail(error).done(success); + + if (isOpen || (data.compare && cmd === 'info')) { + // add autoSync xhr into queue + queue.unshift(xhr); + // bind abort() + data.compare && self.bind(self.cmdsToAdd + ' autosync openxhrabort', abort); + dfrd.always(function() { + var ndx = $.inArray(xhr, queue); + data.compare && self.unbind(self.cmdsToAdd + ' autosync openxhrabort', abort); + ndx !== -1 && queue.splice(ndx, 1); + }); + } else if ($.inArray(cmd, self.abortCmdsOnOpen) !== -1) { + // add "open" xhr, only cwd xhr into queue + cwdQueue.unshift(xhr); + dfrd.always(function() { + var ndx = $.inArray(xhr, cwdQueue); + ndx !== -1 && cwdQueue.splice(ndx, 1); + }); + } + + // abort pending xhr on window unload or elFinder destroy + self.bind('unload destroy', abort); + dfrd.always(function() { + self.unbind('unload destroy', abort); + }); + + return dfrd; + }, + queueingRequest = function() { + if (isOpen) { + requestQueueSkipOpen = false; + } + if (requestCnt < requestMaxConn) { + // do request + return request(); + } else { + if (isOpen) { + requestQueue.unshift(request); + } else { + requestQueue.push(request); + } + return dfrd; + } + }, + bindData = {opts: opts, result: true}; + + // trigger "request.cmd" that callback be able to cancel request by substituting "false" for "event.data.result" + self.trigger('request.' + cmd, bindData, true); + + if (! bindData.result) { + self.trigger(cmd + 'done'); + return dfrd.reject(); + } else if (typeof bindData.result === 'object' && bindData.result.promise) { + bindData.result + .done(queueingRequest) + .fail(function() { + self.trigger(cmd + 'done'); + dfrd.reject(); + }); + return dfrd; + } + + return queueingRequest(); + }; + + /** + * Call cache() + * Store info about files/dirs in "files" object. + * + * @param Array files + * @return void + */ + this.cache = function(dataArray) { + if (! Array.isArray(dataArray)) { + dataArray = [ dataArray ]; + } + cache(dataArray); + }; + + /** + * Update file object caches by respose data object + * + * @param Object respose data object + * @return void + */ + this.updateCache = function(data) { + if ($.isPlainObject(data)) { + data.files && data.files.length && cache(data.files); + data.tree && data.tree.length && cache(data.tree); + data.removed && data.removed.length && remove(data.removed); + data.added && data.added.length && cache(data.added); + data.changed && data.changed.length && change(data.changed); + } + }; + + /** + * Compare current files cache with new files and return diff + * + * @param Array new files + * @param String target folder hash + * @param Array exclude properties to compare + * @return Object + */ + this.diff = function(incoming, onlydir, excludeProps) { + var raw = {}, + added = [], + removed = [], + changed = [], + isChanged = function(hash) { + var l = changed.length; + + while (l--) { + if (changed[l].hash == hash) { + return true; + } + } + }; + + $.each(incoming, function(i, f) { + raw[f.hash] = f; + }); + + // find removed + $.each(files, function(hash, f) { + if (! raw[hash] && (! onlydir || f.phash === onlydir)) { + removed.push(hash); + } + }); + + // compare files + $.each(raw, function(hash, file) { + var origin = files[hash]; + + if (!origin) { + added.push(file); + } else { + $.each(file, function(prop) { + if (! excludeProps || $.inArray(prop, excludeProps) === -1) { + if (file[prop] !== origin[prop]) { + changed.push(file) + return false; + } + } + }); + } + }); + + // parents of removed dirs mark as changed (required for tree correct work) + $.each(removed, function(i, hash) { + var file = files[hash], + phash = file.phash; + + if (phash + && file.mime == 'directory' + && $.inArray(phash, removed) === -1 + && raw[phash] + && !isChanged(phash)) { + changed.push(raw[phash]); + } + }); + + return { + added : added, + removed : removed, + changed : changed + }; + }; + + /** + * Sync content + * + * @return jQuery.Deferred + */ + this.sync = function(onlydir, polling) { + this.autoSync('stop'); + var self = this, + compare = function(){ + var c = '', cnt = 0, mtime = 0; + if (onlydir && polling) { + $.each(files, function(h, f) { + if (f.phash && f.phash === onlydir) { + ++cnt; + mtime = Math.max(mtime, f.ts); + } + c = cnt+':'+mtime; + }); + } + return c; + }, + comp = compare(), + dfrd = $.Deferred().done(function() { self.trigger('sync'); }), + opts = [this.request({ + data : {cmd : 'open', reload : 1, target : cwd, tree : (! onlydir && this.ui.tree) ? 1 : 0, compare : comp}, + preventDefault : true + })], + exParents = function() { + var parents = [], + curRoot = self.file(self.root(cwd)), + curId = curRoot? curRoot.volumeid : null, + phash = self.cwd().phash, + isroot,pdir; + + while(phash) { + if (pdir = self.file(phash)) { + if (phash.indexOf(curId) !== 0) { + parents.push( {target: phash, cmd: 'tree'} ); + if (! self.isRoot(pdir)) { + parents.push( {target: phash, cmd: 'parents'} ); + } + curRoot = self.file(self.root(phash)); + curId = curRoot? curRoot.volumeid : null; + } + phash = pdir.phash; + } else { + phash = null; + } + } + return parents; + }; + + if (! onlydir && self.api >= 2) { + (cwd !== this.root()) && opts.push(this.request({ + data : {cmd : 'parents', target : cwd}, + preventDefault : true + })); + $.each(exParents(), function(i, data) { + opts.push(self.request({ + data : {cmd : data.cmd, target : data.target}, + preventDefault : true + })); + }); + } + $.when.apply($, opts) + .fail(function(error, xhr) { + if (! polling || $.inArray('errOpen', error) !== -1) { + dfrd.reject(error); + error && self.request({ + data : {cmd : 'open', target : (self.lastDir('') || self.root()), tree : 1, init : 1}, + notify : {type : 'open', cnt : 1, hideCnt : true} + }); + } else { + dfrd.reject((error && xhr.status != 0)? error : void 0); + } + }) + .done(function(odata) { + var pdata, argLen, i; + + if (odata.cwd.compare) { + if (comp === odata.cwd.compare) { + return dfrd.reject(); + } + } + + // for 2nd and more requests + pdata = {tree : []}; + + // results marge of 2nd and more requests + argLen = arguments.length; + if (argLen > 1) { + for(i = 1; i < argLen; i++) { + if (arguments[i].tree && arguments[i].tree.length) { + pdata.tree.push.apply(pdata.tree, arguments[i].tree); + } + } + } + + if (self.api < 2.1) { + if (! pdata.tree) { + pdata.tree = []; + } + pdata.tree.push(odata.cwd); + } + + // data normalize + odata = self.normalize(odata); + if (!self.validResponse('open', odata)) { + return dfrd.reject((odata.norError || 'errResponse')); + } + pdata = self.normalize(pdata); + if (!self.validResponse('tree', pdata)) { + return dfrd.reject((pdata.norError || 'errResponse')); + } + + var diff = self.diff(odata.files.concat(pdata && pdata.tree ? pdata.tree : []), onlydir); + + diff.added.push(odata.cwd); + + self.updateCache(diff); + + // trigger events + diff.removed.length && self.remove(diff); + diff.added.length && self.add(diff); + diff.changed.length && self.change(diff); + return dfrd.resolve(diff); + }) + .always(function() { + self.autoSync(); + }); + + return dfrd; + }; + + this.upload = function(files) { + return this.transport.upload(files, this); + }; + + /** + * Arrays that has to unbind events + * + * @type Object + */ + this.toUnbindEvents = {}; + + /** + * Attach listener to events + * To bind to multiply events at once, separate events names by space + * + * @param String event(s) name(s) + * @param Object event handler + * @return elFinder + */ + this.bind = function(event, callback) { + var i, len; + + if (typeof(callback) == 'function') { + event = ('' + event).toLowerCase().replace(/^\s+|\s+$/g, '').split(/\s+/); + + len = event.length; + for (i = 0; i < len; i++) { + if (listeners[event[i]] === void(0)) { + listeners[event[i]] = []; + } + listeners[event[i]].push(callback); + } + } + return this; + }; + + /** + * Remove event listener if exists + * To un-bind to multiply events at once, separate events names by space + * + * @param String event(s) name(s) + * @param Function callback + * @return elFinder + */ + this.unbind = function(event, callback) { + var i, len, l, ci; + + event = ('' + event).toLowerCase().split(/\s+/); + + len = event.length; + for (i = 0; i < len; i++) { + if (l = listeners[event[i]]) { + ci = $.inArray(callback, l); + ci > -1 && l.splice(ci, 1); + } + } + + callback = null; + return this; + }; + + /** + * Fire event - send notification to all event listeners + * In the callback `this` becames an event object + * + * @param String event type + * @param Object data to send across event + * @param Boolean allow modify data (call by reference of data) + * @return elFinder + */ + this.trigger = function(type, data, allowModify) { + var type = type.toLowerCase(), + isopen = (type === 'open'), + dataIsObj = (typeof data === 'object'), + handlers = listeners[type] || [], i, l, jst, event; + + this.debug('event-'+type, data); + + allowModify = true; + if (l = handlers.length) { + event = $.Event(type); + if (allowModify) { + event.data = data; + } + + for (i = 0; i < l; i++) { + if (! handlers[i]) { + // probably un-binded this handler + continue; + } + // set `event.data` only callback has argument + if (handlers[i].length) { + if (!allowModify) { + // to avoid data modifications. remember about "sharing" passing arguments in js :) + if (dataIsObj && !jst) { + jst = JSON.stringify(data); + } + event.data = jst? JSON.parse(jst) : data; + } + } + + try { + if (handlers[i].call(event, event, this) === false + || event.isDefaultPrevented()) { + this.debug('event-stoped', event.type); + break; + } + } catch (ex) { + window.console && window.console.log && window.console.log(ex); + } + + } + + if (this.toUnbindEvents[type] && this.toUnbindEvents[type].length) { + $.each(this.toUnbindEvents[type], function(i, v) { + self.unbind(v.type, v.callback); + }); + delete this.toUnbindEvents[type]; + } + } + return this; + }; + + /** + * Get event listeners + * + * @param String event type + * @return Array listed event functions + */ + this.getListeners = function(event) { + return event? listeners[event.toLowerCase()] : listeners; + }; + + /** + * Bind keybord shortcut to keydown event + * + * @example + * elfinder.shortcut({ + * pattern : 'ctrl+a', + * description : 'Select all files', + * callback : function(e) { ... }, + * keypress : true|false (bind to keypress instead of keydown) + * }) + * + * @param Object shortcut config + * @return elFinder + */ + this.shortcut = function(s) { + var patterns, pattern, code, i, parts; + + if (this.options.allowShortcuts && s.pattern && $.isFunction(s.callback)) { + patterns = s.pattern.toUpperCase().split(/\s+/); + + for (i= 0; i < patterns.length; i++) { + pattern = patterns[i] + parts = pattern.split('+'); + code = (code = parts.pop()).length == 1 + ? code > 0 ? code : code.charCodeAt(0) + : (code > 0 ? code : $.ui.keyCode[code]); + + if (code && !shortcuts[pattern]) { + shortcuts[pattern] = { + keyCode : code, + altKey : $.inArray('ALT', parts) != -1, + ctrlKey : $.inArray('CTRL', parts) != -1, + shiftKey : $.inArray('SHIFT', parts) != -1, + type : s.type || 'keydown', + callback : s.callback, + description : s.description, + pattern : pattern + }; + } + } + } + return this; + }; + + /** + * Registered shortcuts + * + * @type Object + **/ + this.shortcuts = function() { + var ret = []; + + $.each(shortcuts, function(i, s) { + ret.push([s.pattern, self.i18n(s.description)]); + }); + return ret; + }; + + /** + * Get/set clipboard content. + * Return new clipboard content. + * + * @example + * this.clipboard([]) - clean clipboard + * this.clipboard([{...}, {...}], true) - put 2 files in clipboard and mark it as cutted + * + * @param Array new files hashes + * @param Boolean cut files? + * @return Array + */ + this.clipboard = function(hashes, cut) { + var map = function() { return $.map(clipboard, function(f) { return f.hash }); }; + + if (hashes !== void(0)) { + clipboard.length && this.trigger('unlockfiles', {files : map()}); + remember = {}; + + clipboard = $.map(hashes||[], function(hash) { + var file = files[hash]; + if (file) { + + remember[hash] = true; + + return { + hash : hash, + phash : file.phash, + name : file.name, + mime : file.mime, + read : file.read, + locked : file.locked, + cut : !!cut + } + } + return null; + }); + this.trigger('changeclipboard', {clipboard : clipboard.slice(0, clipboard.length)}); + cut && this.trigger('lockfiles', {files : map()}); + } + + // return copy of clipboard instead of refrence + return clipboard.slice(0, clipboard.length); + }; + + /** + * Return true if command enabled + * + * @param String command name + * @param String|void hash for check of own volume's disabled cmds + * @return Boolean + */ + this.isCommandEnabled = function(name, dstHash) { + var disabled, + cvid = self.cwd().volumeid || ''; + + // In serach results use selected item hash to check + if (!dstHash && self.searchStatus.state > 1 && self.selected().length) { + dstHash = self.selected()[0]; + } + if (dstHash && (! cvid || dstHash.indexOf(cvid) !== 0)) { + disabled = self.option('disabled', dstHash); + if (! disabled) { + disabled = []; + } + } else { + disabled = cwdOptions.disabled; + } + return this._commands[name] ? $.inArray(name, disabled) === -1 : false; + }; + + /** + * Exec command and return result; + * + * @param String command name + * @param String|Array usualy files hashes + * @param String|Array command options + * @param String|void hash for enabled check of own volume's disabled cmds + * @return $.Deferred + */ + this.exec = function(cmd, files, opts, dstHash) { + var dfrd; + + if (cmd === 'open') { + if (this.searchStatus.state || this.searchStatus.ininc) { + this.trigger('searchend', { noupdate: true }); + } + this.autoSync('stop'); + } + if (!dstHash && files) { + if ($.isArray(files)) { + if (files.length) { + dstHash = files[0]; + } + } else { + dstHash = files; + } + } + dfrd = this._commands[cmd] && this.isCommandEnabled(cmd, dstHash) + ? this._commands[cmd].exec(files, opts) + : $.Deferred().reject('No such command'); + + this.trigger('exec', { dfrd : dfrd, cmd : cmd, files : files, opts : opts, dstHash : dstHash }); + return dfrd; + }; + + /** + * Create and return dialog. + * + * @param String|DOMElement dialog content + * @param Object dialog options + * @return jQuery + */ + this.dialog = function(content, options) { + var dialog = $('
        ').append(content).appendTo(node).elfinderdialog(options, this), + dnode = dialog.closest('.ui-dialog'), + resize = function(){ + ! dialog.data('draged') && dialog.is(':visible') && dialog.elfinderdialog('posInit'); + }; + if (dnode.length) { + self.bind('resize', resize); + dnode.on('remove', function() { + self.unbind('resize', resize); + }); + } + return dialog; + }; + + /** + * Create and return toast. + * + * @param Object toast options - see ui/toast.js + * @return jQuery + */ + this.toast = function(options) { + return $('
        ').appendTo(this.ui.toast).elfindertoast(options || {}, this); + }; + + /** + * Return UI widget or node + * + * @param String ui name + * @return jQuery + */ + this.getUI = function(ui) { + return this.ui[ui] || node; + }; + + /** + * Return elFinder.command instance or instances array + * + * @param String command name + * @return Object | Array + */ + this.getCommand = function(name) { + return name === void(0) ? this._commands : this._commands[name]; + }; + + /** + * Resize elfinder node + * + * @param String|Number width + * @param String|Number height + * @return void + */ + this.resize = function(w, h) { + var getMargin = function() { + var m = node.outerHeight(true) - node.innerHeight(), + p = node; + + while(p.get(0) !== heightBase.get(0)) { + p = p.parent(); + m += p.outerHeight(true) - p.innerHeight(); + if (! p.parent().length) { + // reached the document + break; + } + } + return m; + }, + fit = ! node.hasClass('ui-resizable'), + prv = node.data('resizeSize') || {w: 0, h: 0}, + mt, size = {}; + + if (heightBase && heightBase.data('resizeTm')) { + clearTimeout(heightBase.data('resizeTm')); + // heightBase.off('resize.' + self.namespace, fitToBase); + } + + if (typeof h === 'string') { + if (mt = h.match(/^([0-9.]+)%$/)) { + // setup heightBase + if (! heightBase || ! heightBase.length) { + heightBase = $(window); + } + if (! heightBase.data('marginToMyNode')) { + heightBase.data('marginToMyNode', getMargin()); + } + if (! heightBase.data('fitToBaseFunc')) { + heightBase.data('fitToBaseFunc', function(e) { + var tm = heightBase.data('resizeTm'); + e.preventDefault(); + e.stopPropagation(); + tm && clearTimeout(tm); + if (! node.hasClass('elfinder-fullscreen')) { + heightBase.data('resizeTm', setTimeout(function() { + self.restoreSize(); + }, 50)); + } + }); + } + h = heightBase.height() * (mt[1] / 100) - heightBase.data('marginToMyNode'); + + heightBase.off('resize.' + self.namespace, heightBase.data('fitToBaseFunc')); + fit && heightBase.on('resize.' + self.namespace, heightBase.data('fitToBaseFunc')); + } + } + + node.css({ width : w, height : parseInt(h) }); + size.w = node.width(); + size.h = node.height(); + node.data('resizeSize', size); + if (size.w !== prv.w || size.h !== prv.h) { + node.trigger('resize'); + this.trigger('resize', {width : size.w, height : size.h}); + } + }; + + /** + * Restore elfinder node size + * + * @return elFinder + */ + this.restoreSize = function() { + this.resize(width, height); + }; + + this.show = function() { + node.show(); + this.enable().trigger('show'); + }; + + this.hide = function() { + if (this.options.enableAlways) { + prevEnabled = enabled; + enabled = false; + } + this.disable().trigger('hide'); + node.hide(); + }; + + /** + * Lazy execution function + * + * @param Object function + * @param Number delay + * @param Object options + * @return Object jQuery.Deferred + */ + this.lazy = function(func, delay, opts) { + var busy = function(state) { + var cnt = node.data('lazycnt'), + repaint; + + if (state) { + repaint = node.data('lazyrepaint')? false : opts.repaint; + if (! cnt) { + node.data('lazycnt', 1) + .addClass('elfinder-processing'); + } else { + node.data('lazycnt', ++cnt); + } + if (repaint) { + node.data('lazyrepaint', true).css('display'); // force repaint + } + } else { + if (cnt && cnt > 1) { + node.data('lazycnt', --cnt); + } else { + repaint = node.data('lazyrepaint'); + node.data('lazycnt', 0) + .removeData('lazyrepaint') + .removeClass('elfinder-processing'); + repaint && node.css('display'); // force repaint; + self.trigger('lazydone'); + } + } + }, + dfd = $.Deferred(); + + delay = delay || 0; + opts = opts || {}; + busy(true); + + setTimeout(function() { + dfd.resolve(func.call(dfd)); + busy(false); + }, delay); + + return dfd; + } + + /** + * Destroy this elFinder instance + * + * @return void + **/ + this.destroy = function() { + if (node && node[0].elfinder) { + node.hasClass('elfinder-fullscreen') && self.toggleFullscreen(node); + this.options.syncStart = false; + this.autoSync('forcestop'); + this.trigger('destroy').disable(); + clipboard = []; + selected = []; + listeners = {}; + shortcuts = {}; + $(window).off('.' + namespace); + $(document).off('.' + namespace); + self.trigger = function(){} + $(beeper).remove(); + node.off() + .removeData() + .empty() + .append(prevContent.contents()) + .attr('class', prevContent.attr('class')) + .attr('style', prevContent.attr('style')); + delete node[0].elfinder; + // restore kept events + $.each(prevEvents, function(n, arr) { + $.each(arr, function(i, o) { + node.on(o.type + (o.namespace? '.'+o.namespace : ''), o.selector, o.handler); + }); + }); + } + }; + + /** + * Start or stop auto sync + * + * @param String|Bool stop + * @return void + */ + this.autoSync = function(mode) { + var sync; + if (self.options.sync >= 1000) { + if (syncInterval) { + clearTimeout(syncInterval); + syncInterval = null; + self.trigger('autosync', {action : 'stop'}); + } + + if (mode === 'stop') { + ++autoSyncStop; + } else { + autoSyncStop = Math.max(0, --autoSyncStop); + } + + if (autoSyncStop || mode === 'forcestop' || ! self.options.syncStart) { + return; + } + + // run interval sync + sync = function(start){ + var timeout; + if (cwdOptions.syncMinMs && (start || syncInterval)) { + start && self.trigger('autosync', {action : 'start'}); + timeout = Math.max(self.options.sync, cwdOptions.syncMinMs); + syncInterval && clearTimeout(syncInterval); + syncInterval = setTimeout(function() { + var dosync = true, hash = cwd, cts; + if (cwdOptions.syncChkAsTs && files[hash] && (cts = files[hash].ts)) { + self.request({ + data : {cmd : 'info', targets : [hash], compare : cts, reload : 1}, + preventDefault : true + }) + .done(function(data){ + var ts; + dosync = true; + if (data.compare) { + ts = data.compare; + if (ts == cts) { + dosync = false; + } + } + if (dosync) { + self.sync(hash).always(function(){ + if (ts) { + // update ts for cache clear etc. + files[hash].ts = ts; + } + sync(); + }); + } else { + sync(); + } + }) + .fail(function(error, xhr){ + if (error && xhr.status != 0) { + self.error(error); + if ($.inArray('errOpen', error) !== -1) { + self.request({ + data : {cmd : 'open', target : (self.lastDir('') || self.root()), tree : 1, init : 1}, + notify : {type : 'open', cnt : 1, hideCnt : true} + }); + } + } else { + syncInterval = setTimeout(function() { + sync(); + }, timeout); + } + }); + } else { + self.sync(cwd, true).always(function(){ + sync(); + }); + } + }, timeout); + } + }; + sync(true); + } + }; + + /** + * Return bool is inside work zone of specific point + * + * @param Number event.pageX + * @param Number event.pageY + * @return Bool + */ + this.insideWorkzone = function(x, y, margin) { + var rectangle = this.getUI('workzone').data('rectangle'); + + margin = margin || 1; + if (x < rectangle.left + margin + || x > rectangle.left + rectangle.width + margin + || y < rectangle.top + margin + || y > rectangle.top + rectangle.height + margin) { + return false; + } + return true; + }; + + /** + * Target ui node move to last of children of elFinder node fot to show front + * + * @param Object target Target jQuery node object + */ + this.toFront = function(target) { + var lastnode = node.children(':last'); + target = $(target); + if (lastnode.get(0) !== target.get(0)) { + target.trigger('beforedommove') + .insertAfter(lastnode) + .trigger('dommove'); + } + }; + + /** + * Return css object for maximize + * + * @return Object + */ + this.getMaximizeCss = function() { + return { + width : '100%', + height : '100%', + margin : 0, + padding : 0, + top : 0, + left : 0, + display : 'block', + position: 'fixed', + zIndex : Math.max(self.zIndex? (self.zIndex + 1) : 0 , 1000), + maxWidth : '', + maxHeight: '' + }; + }; + + // Closure for togglefullscreen + (function() { + // check is in iframe + if (inFrame && self.UA.Fullscreen) { + self.UA.Fullscreen = false; + if (parentIframe && typeof parentIframe.attr('allowfullscreen') !== 'undefined') { + self.UA.Fullscreen = true; + } + } + + var orgStyle, bodyOvf, resizeTm, fullElm, exitFull, toFull, + cls = 'elfinder-fullscreen', + clsN = 'elfinder-fullscreen-native', + checkDialog = function() { + var t = 0, + l = 0; + $.each(node.children('.ui-dialog,.ui-draggable'), function(i, d) { + var $d = $(d), + pos = $d.position(); + + if (pos.top < 0) { + $d.css('top', t); + t += 20; + } + if (pos.left < 0) { + $d.css('left', l); + l += 20; + } + }); + }, + funcObj = self.UA.Fullscreen? { + // native full screen mode + + fullElm: function() { + return document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement || null; + }, + + exitFull: function() { + if (document.exitFullscreen) { + return document.exitFullscreen(); + } else if (document.webkitExitFullscreen) { + return document.webkitExitFullscreen(); + } else if (document.mozCancelFullScreen) { + return document.mozCancelFullScreen(); + } else if (document.msExitFullscreen) { + return document.msExitFullscreen(); + } + }, + + toFull: function(elem) { + if (elem.requestFullscreen) { + return elem.requestFullscreen(); + } else if (elem.webkitRequestFullscreen) { + return elem.webkitRequestFullscreen(); + } else if (elem.mozRequestFullScreen) { + return elem.mozRequestFullScreen(); + } else if (elem.msRequestFullscreen) { + return elem.msRequestFullscreen(); + } + return false; + } + } : { + // node element maximize mode + + fullElm: function() { + var full; + if (node.hasClass(cls)) { + return node.get(0); + } else { + full = node.find('.' + cls); + if (full.length) { + return full.get(0); + } + } + return null; + }, + + exitFull: function() { + var elm; + + $(window).off('resize.' + namespace, resize); + if (bodyOvf !== void(0)) { + $('body').css('overflow', bodyOvf); + } + bodyOvf = void(0); + + if (orgStyle) { + elm = orgStyle.elm; + restoreStyle(elm); + $(elm).trigger('resize', {fullscreen: 'off'}); + } + + $(window).trigger('resize'); + }, + + toFull: function(elem) { + bodyOvf = $('body').css('overflow') || ''; + $('body').css('overflow', 'hidden'); + + $(elem).css(self.getMaximizeCss()) + .addClass(cls) + .trigger('resize', {fullscreen: 'on'}); + + checkDialog(); + + $(window).on('resize.' + namespace, resize).trigger('resize'); + + return true; + } + }, + restoreStyle = function(elem) { + if (orgStyle && orgStyle.elm == elem) { + $(elem).removeClass(cls + ' ' + clsN).attr('style', orgStyle.style); + orgStyle = null; + } + }, + resize = function(e) { + var elm; + if (e.target === window) { + resizeTm && clearTimeout(resizeTm); + resizeTm = setTimeout(function() { + if (elm = funcObj.fullElm()) { + $(elm).trigger('resize', {fullscreen: 'on'}); + } + }, 100); + } + }; + + $(document).on('fullscreenchange.' + namespace + ' webkitfullscreenchange.' + namespace + ' mozfullscreenchange.' + namespace + ' MSFullscreenChange.' + namespace, function(e){ + if (self.UA.Fullscreen) { + var elm = funcObj.fullElm(), + win = $(window); + + resizeTm && clearTimeout(resizeTm); + if (elm === null) { + win.off('resize.' + namespace, resize); + if (orgStyle) { + elm = orgStyle.elm; + restoreStyle(elm); + $(elm).trigger('resize', {fullscreen: 'off'}); + } + } else { + $(elm).addClass(cls + ' ' + clsN) + .attr('style', 'width:100%; height:100%; margin:0; padding:0;') + .trigger('resize', {fullscreen: 'on'}); + win.on('resize.' + namespace, resize); + checkDialog(); + } + win.trigger('resize'); + } + }); + + /** + * Toggle Full Scrren Mode + * + * @param Object target + * @param Bool full + * @return Object | Null DOM node object of current full scrren + */ + self.toggleFullscreen = function(target, full) { + var elm = $(target).get(0), + curElm = null; + + curElm = funcObj.fullElm(); + if (curElm) { + if (curElm == elm) { + if (full === true) { + return curElm; + } + } else { + if (full === false) { + return curElm; + } + } + funcObj.exitFull(); + return null; + } else { + if (full === false) { + return null; + } + } + + orgStyle = {elm: elm, style: $(elm).attr('style')}; + if (funcObj.toFull(elm) !== false) { + return elm; + } else { + orgStyle = null; + return null; + } + }; + })(); + + // Closure for toggleMaximize + (function(){ + var cls = 'elfinder-maximized', + resizeTm, + resize = function(e) { + if (e.target === window && e.data && e.data.elm) { + var elm = e.data.elm; + resizeTm && clearTimeout(resizeTm); + resizeTm = setTimeout(function() { + elm.trigger('resize', {maximize: 'on'}); + }, 100); + } + }, + exitMax = function(elm) { + $(window).off('resize.' + namespace, resize); + $('body').css('overflow', elm.data('bodyOvf')); + elm.removeClass(cls) + .attr('style', elm.data('orgStyle')) + .removeData('bodyOvf') + .removeData('orgStyle'); + elm.trigger('resize', {maximize: 'off'}); + }, + toMax = function(elm) { + elm.data('bodyOvf', $('body').css('overflow') || '') + .data('orgStyle', elm.attr('style')) + .addClass(cls) + .css(self.getMaximizeCss()); + $('body').css('overflow', 'hidden'); + $(window).on('resize.' + namespace, {elm: elm}, resize); + elm.trigger('resize', {maximize: 'on'}); + }; + + /** + * Toggle Maximize target node + * + * @param Object target + * @param Bool max + * @return void + */ + self.toggleMaximize = function(target, max) { + var elm = $(target), + maximized = elm.hasClass(cls); + + if (maximized) { + if (max === true) { + return; + } + exitMax(elm); + } else { + if (max === false) { + return; + } + toMax(elm); + } + }; + })(); + + /************* init stuffs ****************/ + + // check jquery ui + if (!($.fn.selectable && $.fn.draggable && $.fn.droppable)) { + return alert(this.i18n('errJqui')); + } + + // check node + if (!node.length) { + return alert(this.i18n('errNode')); + } + // check connector url + if (!this.options.url) { + return alert(this.i18n('errURL')); + } + + Object.assign($.ui.keyCode, { + 'F1' : 112, + 'F2' : 113, + 'F3' : 114, + 'F4' : 115, + 'F5' : 116, + 'F6' : 117, + 'F7' : 118, + 'F8' : 119, + 'F9' : 120, + 'F10' : 121, + 'F11' : 122, + 'F12' : 123, + 'DIG0' : 48, + 'DIG1' : 49, + 'DIG2' : 50, + 'DIG3' : 51, + 'DIG4' : 52, + 'DIG5' : 53, + 'DIG6' : 54, + 'DIG7' : 55, + 'DIG8' : 56, + 'DIG9' : 57, + 'NUM0' : 96, + 'NUM1' : 97, + 'NUM2' : 98, + 'NUM3' : 99, + 'NUM4' : 100, + 'NUM5' : 101, + 'NUM6' : 102, + 'NUM7' : 103, + 'NUM8' : 104, + 'NUM9' : 105, + 'CONTEXTMENU' : 93 + }); + + this.dragUpload = false; + this.xhrUpload = (typeof XMLHttpRequestUpload != 'undefined' || typeof XMLHttpRequestEventTarget != 'undefined') && typeof File != 'undefined' && typeof FormData != 'undefined'; + + // configure transport object + this.transport = {}; + + if (typeof(this.options.transport) == 'object') { + this.transport = this.options.transport; + if (typeof(this.transport.init) == 'function') { + this.transport.init(this) + } + } + + if (typeof(this.transport.send) != 'function') { + this.transport.send = function(opts) { return $.ajax(opts); } + } + + if (this.transport.upload == 'iframe') { + this.transport.upload = $.proxy(this.uploads.iframe, this); + } else if (typeof(this.transport.upload) == 'function') { + this.dragUpload = !!this.options.dragUploadAllow; + } else if (this.xhrUpload && !!this.options.dragUploadAllow) { + this.transport.upload = $.proxy(this.uploads.xhr, this); + this.dragUpload = true; + } else { + this.transport.upload = $.proxy(this.uploads.iframe, this); + } + + /** + * Decoding 'raw' string converted to unicode + * + * @param String str + * @return String + */ + this.decodeRawString = $.isFunction(this.options.rawStringDecoder)? this.options.rawStringDecoder : function(str) { + var charCodes = function(str) { + var i, len, arr; + for (i=0,len=str.length,arr=[]; i= 0xd800 && c <= 0xdbff) { + scalars.push((c & 1023) + 64 << 10 | arr[++i] & 1023); + } else { + scalars.push(c); + } + } + return scalars; + }, + decodeUTF8 = function(arr) { + var i, len, c, str, char = String.fromCharCode; + for (i=0,len=arr.length,str=""; c=arr[i],i= 0xc2) { + str += char((c&31)<<6 | arr[++i]&63); + } else if (c <= 0xef && c >= 0xe0) { + str += char((c&15)<<12 | (arr[++i]&63)<<6 | arr[++i]&63); + } else if (c <= 0xf7 && c >= 0xf0) { + str += char( + 0xd800 | ((c&7)<<8 | (arr[++i]&63)<<2 | arr[++i]>>>4&3) - 64, + 0xdc00 | (arr[i++]&15)<<6 | arr[i]&63 + ); + } else { + str += char(0xfffd); + } + } + return str; + }; + + return decodeUTF8(scalarValues(str)); + }; + + /** + * Alias for this.trigger('error', {error : 'message'}) + * + * @param String error message + * @return elFinder + **/ + this.error = function() { + var arg = arguments[0], + opts = arguments[1] || null; + return arguments.length == 1 && typeof(arg) == 'function' + ? self.bind('error', arg) + : (arg === true? this : self.trigger('error', {error : arg, opts : opts})); + }; + + // create bind/trigger aliases for build-in events + $.each(events, function(i, name) { + self[name] = function() { + var arg = arguments[0]; + return arguments.length == 1 && typeof(arg) == 'function' + ? self.bind(name, arg) + : self.trigger(name, $.isPlainObject(arg) ? arg : {}); + } + }); + + // bind core event handlers + this + .enable(function() { + if (!enabled && self.visible() && self.ui.overlay.is(':hidden') && ! node.children('.elfinder-dialog').find('.'+self.res('class', 'editing')).length) { + enabled = true; + document.activeElement && document.activeElement.blur(); + node.removeClass('elfinder-disabled'); + } + }) + .disable(function() { + prevEnabled = enabled; + enabled = false; + node.addClass('elfinder-disabled'); + }) + .open(function() { + selected = []; + }) + .select(function(e) { + var cnt = 0, + unselects = []; + selected = $.map(e.data.selected || e.data.value|| [], function(hash) { + if (unselects.length || (self.maxTargets && ++cnt > self.maxTargets)) { + unselects.push(hash); + return null; + } else { + return files[hash] ? hash : null; + } + }); + if (unselects.length) { + self.trigger('unselectfiles', {files: unselects, inselect: true}); + self.toast({mode: 'warning', msg: self.i18n(['errMaxTargets', self.maxTargets])}); + } + }) + .error(function(e) { + var opts = { + cssClass : 'elfinder-dialog-error', + title : self.i18n(self.i18n('error')), + resizable : false, + destroyOnClose : true, + buttons : {} + }; + + opts.buttons[self.i18n(self.i18n('btnClose'))] = function() { $(this).elfinderdialog('close'); }; + + if (e.data.opts && $.isPlainObject(e.data.opts)) { + Object.assign(opts, e.data.opts); + } + + self.dialog(''+self.i18n(e.data.error), opts); + }) + .bind('tmb', function(e) { + $.each(e.data.images||[], function(hash, tmb) { + if (files[hash]) { + files[hash].tmb = tmb; + } + }) + }) + .bind('searchstart', function(e) { + Object.assign(self.searchStatus, e.data); + self.searchStatus.state = 1; + }) + .bind('search', function(e) { + self.searchStatus.state = 2; + }) + .bind('searchend', function() { + self.searchStatus.state = 0; + self.searchStatus.ininc = false; + self.searchStatus.mixed = false; + }) + + ; + + // We listen and emit a sound on delete according to option + if (true === this.options.sound) { + this.bind('playsound', function(e) { + var play = beeper.canPlayType && beeper.canPlayType('audio/wav; codecs="1"'), + file = e.data && e.data.soundFile; + + play && file && play != '' && play != 'no' && $(beeper).html('')[0].play(); + }); + } + + // bind external event handlers + $.each(this.options.handlers, function(event, callback) { + self.bind(event, callback); + }); + + /** + * History object. Store visited folders + * + * @type Object + **/ + this.history = new this.history(this); + + /** + * Root hashed + * + * @type Object + */ + this.roots = {}; + + /** + * leaf roots + * + * @type Object + */ + this.leafRoots = {}; + + /** + * Loaded commands + * + * @type Object + **/ + this._commands = {}; + + if (!Array.isArray(this.options.commands)) { + this.options.commands = []; + } + + if ($.inArray('*', this.options.commands) !== -1) { + this.options.commands = Object.keys(this.commands); + } + + /** + * UI command map of cwd volume ( That volume driver option `uiCmdMap` ) + * + * @type Object + **/ + this.commandMap = {}; + + /** + * cwd options of each volume + * key: volumeid + * val: options object + * + * @type Object + */ + this.volOptions = {}; + + /** + * Hash of trash holders + * key: trash folder hash + * val: source volume hash + * + * @type Object + */ + this.trashes = {}; + + /** + * cwd options of each folder/file + * key: hash + * val: options object + * + * @type Object + */ + this.optionsByHashes = {}; + + /** + * UI Auto Hide Functions + * Each auto hide function mast be call to `fm.trigger('uiautohide')` at end of process + * + * @type Array + **/ + this.uiAutoHide = []; + + // trigger `uiautohide` + this.one('open', function() { + if (self.uiAutoHide.length) { + setTimeout(function() { + self.trigger('uiautohide'); + }, 500); + } + }); + + // Auto Hide Functions sequential processing start + this.bind('uiautohide', function() { + if (self.uiAutoHide.length) { + self.uiAutoHide.shift()(); + } + }); + + // make node resizable + this.options.resizable + && $.fn.resizable + && node.resizable({ + resize : function(e, ui) { + self.resize(ui.size.width, ui.size.height); + }, + handles : 'se', + minWidth : 300, + minHeight : 200 + }); + + if (this.options.width) { + width = this.options.width; + } + + if (this.options.height) { + height = this.options.height; + } + + if (this.options.heightBase) { + heightBase = $(this.options.heightBase); + } + + if (this.options.soundPath) { + soundPath = this.options.soundPath.replace(/\/+$/, '') + '/'; + } + + // attach events to document + $(document) + // disable elfinder on click outside elfinder + .on('click.'+namespace, function(e) { enabled && ! self.options.enableAlways && !$(e.target).closest(node).length && self.disable(); }) + // exec shortcuts + .on(keydown+' '+keypress, execShortcut); + + // attach events to window + self.options.useBrowserHistory && $(window) + .on('popstate.' + namespace, function(ev) { + var target = ev.originalEvent.state && ev.originalEvent.state.thash; + target && !$.isEmptyObject(self.files()) && self.request({ + data : {cmd : 'open', target : target, onhistory : 1}, + notify : {type : 'open', cnt : 1, hideCnt : true}, + syncOnFail : true + }); + }); + + (function(){ + var tm; + $(window).on('resize.' + namespace, function(e){ + if (e.target === this) { + tm && clearTimeout(tm); + tm = setTimeout(function() { + self.trigger('resize', {width : node.width(), height : node.height()}); + }, 100); + } + }) + .on('beforeunload.' + namespace,function(e){ + var msg, cnt; + if (node.is(':visible')) { + if (self.ui.notify.children().length && $.inArray('hasNotifyDialog', self.options.windowCloseConfirm) !== -1) { + msg = self.i18n('ntfsmth'); + } else if (node.find('.'+self.res('class', 'editing')).length && $.inArray('editingFile', self.options.windowCloseConfirm) !== -1) { + msg = self.i18n('editingFile'); + } else if ((cnt = Object.keys(self.selected()).length) && $.inArray('hasSelectedItem', self.options.windowCloseConfirm) !== -1) { + msg = self.i18n('hasSelected', ''+cnt); + } else if ((cnt = Object.keys(self.clipboard()).length) && $.inArray('hasClipboardData', self.options.windowCloseConfirm) !== -1) { + msg = self.i18n('hasClipboard', ''+cnt); + } + if (msg) { + e.returnValue = msg; + return msg; + } + } + self.trigger('unload'); + }); + })(); + + // bind window onmessage for CORS + $(window).on('message.' + namespace, function(e){ + var res = e.originalEvent || null, + obj, data; + if (res && self.uploadURL.indexOf(res.origin) === 0) { + try { + obj = JSON.parse(res.data); + data = obj.data || null; + if (data) { + if (data.error) { + if (obj.bind) { + self.trigger(obj.bind+'fail', data); + } + self.error(data.error); + } else { + data.warning && self.error(data.warning); + self.updateCache(data); + data.removed && data.removed.length && self.remove(data); + data.added && data.added.length && self.add(data); + data.changed && data.changed.length && self.change(data); + if (obj.bind) { + self.trigger(obj.bind, data); + self.trigger(obj.bind+'done'); + } + data.sync && self.sync(); + } + } + } catch (e) { + self.sync(); + } + } + }); + + // elFinder enable always + if (self.options.enableAlways) { + $(window).on('focus.' + namespace, function(e){ + (e.target === this) && self.enable(); + }); + if (inFrame) { + $(window.top).on('focus.' + namespace, function() { + if (self.enable() && (! parentIframe || parentIframe.is(':visible'))) { + setTimeout(function() { + $(window).focus(); + }, 10); + } + }); + } + } else if (inFrame) { + $(window).on('blur.' + namespace, function(e){ + enabled && e.target === this && self.disable(); + }); + } + + // return focus to the window on click (elFInder in the frame) + if (inFrame) { + node.on('click', function(e) { + $(window).focus(); + }); + } + + // elFinder to enable by mouse over + if (this.options.enableByMouseOver) { + node.on('mouseenter', function(e) { + (inFrame) && $(window).focus(); + ! self.enabled() && self.enable(); + }); + } + + // store instance in node + node[0].elfinder = this; + + // auto load language file + dfrdsBeforeBootup.push((function() { + var lang = self.lang, + langJs = self.baseUrl + 'js/i18n/elfinder.' + lang + '.js', + dfd = $.Deferred().done(function() { + if (self.i18[lang]) { + self.lang = lang; + } + i18n = self.lang === 'en' + ? self.i18['en'] + : $.extend(true, {}, self.i18['en'], self.i18[self.lang]); + self.storage('lang', self.lang); + }); + + if (!self.i18[lang]) { + self.lang = 'en'; + if (typeof define === 'function' && define.amd) { + require([langJs], function() { + dfd.resolve(); + }, function() { + dfd.resolve(); + }); + } else { + self.loadScript([langJs], function() { + dfd.resolve(); + }, { + loadType: 'tag', + error : function() { + dfd.resolve(); + } + }); + } + } else { + dfd.resolve(); + } + return dfd; + })()); + + // elFinder boot up function + bootUp = function() { + /** + * Interface direction + * + * @type String + * @default "ltr" + **/ + self.direction = i18n.direction; + + /** + * i18 messages + * + * @type Object + **/ + self.messages = i18n.messages; + + /** + * Date/time format + * + * @type String + * @default "m.d.Y" + **/ + self.dateFormat = self.options.dateFormat || i18n.dateFormat; + + /** + * Date format like "Yesterday 10:20:12" + * + * @type String + * @default "{day} {time}" + **/ + self.fancyFormat = self.options.fancyDateFormat || i18n.fancyDateFormat; + + /** + * Date format for if upload file has not original unique name + * e.g. Clipboard image data, Image data taken with iOS + * + * @type String + * @default "ymd-His" + **/ + self.nonameDateFormat = (self.options.nonameDateFormat || i18n.nonameDateFormat).replace(/[\/\\]/g, '_'); + + /** + * Css classes + * + * @type String + **/ + self.cssClass = 'ui-helper-reset ui-helper-clearfix ui-widget ui-widget-content ui-corner-all elfinder elfinder-' + +(self.direction == 'rtl' ? 'rtl' : 'ltr') + +(self.UA.Touch? (' elfinder-touch' + (self.options.resizable ? ' touch-punch' : '')) : '') + +(self.UA.Mobile? ' elfinder-mobile' : '') + +' '+self.options.cssClass; + + // prepare node + node.addClass(self.cssClass) + .on(mousedown, function() { + !enabled && self.enable(); + }); + + // draggable closure + (function() { + var ltr, wzRect, wzBottom, nodeStyle, + keyEvt = keydown + 'draggable' + ' keyup.' + namespace + 'draggable'; + + /** + * Base draggable options + * + * @type Object + **/ + self.draggable = { + appendTo : node, + addClasses : false, + distance : 4, + revert : true, + refreshPositions : false, + cursor : 'crosshair', + cursorAt : {left : 50, top : 47}, + scroll : false, + start : function(e, ui) { + var helper = ui.helper, + targets = $.map(helper.data('files')||[], function(h) { + if (h) { + remember[h] = true; + return h; + } + return null; + }), + locked = false, + cnt, h; + + // fix node size + nodeStyle = node.attr('style'); + node.width(node.width()).height(node.height()); + + // set var for drag() + ltr = (self.direction === 'ltr'); + wzRect = self.getUI('workzone').data('rectangle'); + wzBottom = wzRect.top + wzRect.height; + + self.draggingUiHelper = helper; + cnt = targets.length; + while (cnt--) { + h = targets[cnt]; + if (files[h].locked) { + locked = true; + helper.data('locked', true); + break; + } + } + !locked && self.trigger('lockfiles', {files : targets}); + + helper.data('autoScrTm', setInterval(function() { + if (helper.data('autoScr')) { + self.autoScroll[helper.data('autoScr')](helper.data('autoScrVal')); + } + }, 50)); + }, + drag : function(e, ui) { + var helper = ui.helper, + autoUp; + + if ((autoUp = wzRect.top > e.pageY) || wzBottom < e.pageY) { + if (wzRect.cwdEdge > e.pageX) { + helper.data('autoScr', (ltr? 'navbar' : 'cwd') + (autoUp? 'Up' : 'Down')); + } else { + helper.data('autoScr', (ltr? 'cwd' : 'navbar') + (autoUp? 'Up' : 'Down')); + } + helper.data('autoScrVal', Math.pow((autoUp? wzRect.top - e.pageY : e.pageY - wzBottom), 1.3)); + } else { + if (helper.data('autoScr')) { + helper.data('refreshPositions', 1).data('autoScr', null); + } + } + if (helper.data('refreshPositions') && $(this).elfUiWidgetInstance('draggable')) { + if (helper.data('refreshPositions') > 0) { + $(this).draggable('option', { refreshPositions : true, elfRefresh : true }); + helper.data('refreshPositions', -1); + } else { + $(this).draggable('option', { refreshPositions : false, elfRefresh : false }); + helper.data('refreshPositions', null); + } + } + }, + stop : function(e, ui) { + var helper = ui.helper, + files; + + $(document).off(keyEvt); + $(this).elfUiWidgetInstance('draggable') && $(this).draggable('option', { refreshPositions : false }); + self.draggingUiHelper = null; + self.trigger('focus').trigger('dragstop'); + if (! helper.data('droped')) { + files = $.map(helper.data('files')||[], function(h) { return h || null ;}); + self.trigger('unlockfiles', {files : files}); + self.trigger('selectfiles', {files : files}); + } + self.enable(); + + // restore node style + node.attr('style', nodeStyle); + + helper.data('autoScrTm') && clearInterval(helper.data('autoScrTm')); + }, + helper : function(e, ui) { + var element = this.id ? $(this) : $(this).parents('[id]:first'), + helper = $('
        '), + icon = function(f) { + var mime = f.mime, i, tmb = self.tmb(f); + i = '
        '; + if (tmb) { + i = $(i).addClass(tmb.className).css('background-image', "url('"+tmb.url+"')").get(0).outerHTML; + } + return i; + }, + hashes, l, ctr; + + self.draggingUiHelper && self.draggingUiHelper.stop(true, true); + + self.trigger('dragstart', {target : element[0], originalEvent : e}); + + hashes = element.hasClass(self.res('class', 'cwdfile')) + ? self.selected() + : [self.navId2Hash(element.attr('id'))]; + + helper.append(icon(files[hashes[0]])).data('files', hashes).data('locked', false).data('droped', false).data('namespace', namespace).data('dropover', 0); + + if ((l = hashes.length) > 1) { + helper.append(icon(files[hashes[l-1]]) + ''+l+''); + } + + $(document).on(keyEvt, function(e){ + var chk = (e.shiftKey||e.ctrlKey||e.metaKey); + if (ctr !== chk) { + ctr = chk; + if (helper.is(':visible') && helper.data('dropover') && ! helper.data('droped')) { + helper.toggleClass('elfinder-drag-helper-plus', helper.data('locked')? true : ctr); + self.trigger(ctr? 'unlockfiles' : 'lockfiles', {files : hashes, helper: helper}); + } + } + }); + + return helper; + } + }; + })(); + + // in getFileCallback set - change default actions on double click/enter/ctrl+enter + if (self.commands.getfile) { + if (typeof(self.options.getFileCallback) == 'function') { + self.bind('dblclick', function(e) { + e.preventDefault(); + self.exec('getfile').fail(function() { + self.exec('open', e.data && e.data.file? [ e.data.file ]: void(0)); + }); + }); + self.shortcut({ + pattern : 'enter', + description : self.i18n('cmdgetfile'), + callback : function() { self.exec('getfile').fail(function() { self.exec(self.OS == 'mac' ? 'rename' : 'open') }) } + }) + .shortcut({ + pattern : 'ctrl+enter', + description : self.i18n(self.OS == 'mac' ? 'cmdrename' : 'cmdopen'), + callback : function() { self.exec(self.OS == 'mac' ? 'rename' : 'open') } + }); + } else { + self.options.getFileCallback = null; + } + } + + // load commands + $.each(self.commands, function(name, cmd) { + var proto = Object.assign({}, cmd.prototype), + extendsCmd, opts; + if ($.isFunction(cmd) && !self._commands[name] && (cmd.prototype.forceLoad || $.inArray(name, self.options.commands) !== -1)) { + extendsCmd = cmd.prototype.extendsCmd || ''; + if (extendsCmd) { + if ($.isFunction(self.commands[extendsCmd])) { + cmd.prototype = Object.assign({}, base, new self.commands[extendsCmd](), cmd.prototype); + } else { + return true; + } + } else { + cmd.prototype = Object.assign({}, base, cmd.prototype); + } + self._commands[name] = new cmd(); + cmd.prototype = proto; + opts = self.options.commandsOptions[name] || {}; + if (extendsCmd && self.options.commandsOptions[extendsCmd]) { + opts = $.extend(true, {}, self.options.commandsOptions[extendsCmd], opts); + } + self._commands[name].setup(name, opts); + // setup linked commands + if (self._commands[name].linkedCmds.length) { + $.each(self._commands[name].linkedCmds, function(i, n) { + var lcmd = self.commands[n]; + if ($.isFunction(lcmd) && !self._commands[n]) { + lcmd.prototype = base; + self._commands[n] = new lcmd(); + self._commands[n].setup(n, self.options.commandsOptions[n]||{}); + } + }); + } + } + }); + + /** + * UI nodes + * + * @type Object + **/ + self.ui = { + // container for nav panel and current folder container + workzone : $('
        ').appendTo(node).elfinderworkzone(self), + // container for folders tree / places + navbar : $('
        ').appendTo(node).elfindernavbar(self, self.options.uiOptions.navbar || {}), + // contextmenu + contextmenu : $('
        ').appendTo(node).elfindercontextmenu(self), + // overlay + overlay : $('
        ').appendTo(node).elfinderoverlay({ + show : function() { self.disable(); }, + hide : function() { prevEnabled && self.enable(); } + }), + // current folder container + cwd : $('
        ').appendTo(node).elfindercwd(self, self.options.uiOptions.cwd || {}), + // notification dialog window + notify : self.dialog('', { + cssClass : 'elfinder-dialog-notify', + position : self.options.notifyDialog.position, + absolute : true, + resizable : false, + autoOpen : false, + closeOnEscape : false, + title : ' ', + width : parseInt(self.options.notifyDialog.width) + }), + statusbar : $('
        ').hide().appendTo(node), + toast : $('
        ').appendTo(node), + bottomtray : $('
        ').appendTo(node) + }; + + // load required ui + $.each(self.options.ui || [], function(i, ui) { + var name = 'elfinder'+ui, + opts = self.options.uiOptions[ui] || {}; + + if (!self.ui[ui] && $.fn[name]) { + // regist to self.ui before make instance + self.ui[ui] = $('<'+(opts.tag || 'div')+'/>').appendTo(node); + self.ui[ui][name](self, opts); + } + }); + + // update size + self.resize(width, height); + + (function() { + var navbar = self.getUI('navbar'), + cwd = self.getUI('cwd').parent(); + + self.autoScroll = { + navbarUp : function(v) { + navbar.scrollTop(Math.max(0, navbar.scrollTop() - v)); + }, + navbarDown : function(v) { + navbar.scrollTop(navbar.scrollTop() + v); + }, + cwdUp : function(v) { + cwd.scrollTop(Math.max(0, cwd.scrollTop() - v)); + }, + cwdDown : function(v) { + cwd.scrollTop(cwd.scrollTop() + v); + } + }; + })(); + + // Swipe on the touch devices to show/hide of toolbar or navbar + if (self.UA.Touch) { + (function() { + var lastX, lastY, nodeOffset, nodeWidth, nodeTop, navbarW, toolbarH, + navbar = self.getUI('navbar'), + toolbar = self.getUI('toolbar'), + moveEv = 'touchmove.stopscroll', + moveTm, + moveOn = function(e) { + e.preventDefault(); + moveTm && clearTimeout(moveTm); + }, + moveOff = function() { + moveTm = setTimeout(function() { + node.off(moveEv); + }, 100); + }, + handleW, handleH = 50; + + node.on('touchstart touchmove touchend', function(e) { + if (e.type === 'touchend') { + lastX = false; + lastY = false; + moveOff(); + return; + } + + var touches = e.originalEvent.touches || [{}], + x = touches[0].pageX || null, + y = touches[0].pageY || null, + ltr = (self.direction === 'ltr'), + navbarMode, treeWidth, swipeX, moveX, toolbarT, mode; + + if (x === null || y === null || (e.type === 'touchstart' && touches.length > 1)) { + return; + } + + if (e.type === 'touchstart') { + nodeOffset = node.offset(); + nodeWidth = node.width(); + if (navbar) { + lastX = false; + if (navbar.is(':hidden')) { + if (! handleW) { + handleW = Math.max(50, nodeWidth / 10) + } + if ((ltr? (x - nodeOffset.left) : (nodeWidth + nodeOffset.left - x)) < handleW) { + lastX = x; + } + } else { + navbarW = navbar.width(); + treeWidth = Math.max.apply(Math, $.map(navbar.children('.elfinder-tree'), function(c){return $(c).width();})); + if (ltr) { + swipeX = (x < nodeOffset.left + navbarW && treeWidth - navbar.scrollLeft() - 5 <= navbarW); + } else { + swipeX = (x > nodeOffset.left + nodeWidth - navbarW && treeWidth + navbar.scrollLeft() - 5 <= navbarW); + } + if (swipeX) { + handleW = Math.max(50, nodeWidth / 10); + lastX = x; + } else { + lastX = false; + } + } + } + if (toolbar) { + toolbarH = toolbar.height(); + nodeTop = nodeOffset.top; + if (y - nodeTop < (toolbar.is(':hidden')? handleH : (toolbarH + 30))) { + lastY = y; + node.on(moveEv, moveOn); + moveOff(); + } else { + lastY = false; + } + } + } else { + if (navbar && lastX !== false) { + navbarMode = (ltr? (lastX > x) : (lastX < x))? 'navhide' : 'navshow'; + moveX = Math.abs(lastX - x); + if (navbarMode === 'navhide' && moveX > navbarW * .6 + || (moveX > (navbarMode === 'navhide'? navbarW / 3 : 45) + && (navbarMode === 'navshow' + || (ltr? x < nodeOffset.left + 20 : x > nodeOffset.left + nodeWidth - 20) + )) + ) { + self.getUI('navbar').trigger(navbarMode, {handleW: handleW}); + lastX = false; + } + } + if (toolbar && lastY !== false ) { + toolbarT = toolbar.offset().top; + if (Math.abs(lastY - y) > Math.min(45, toolbarH / 3)) { + mode = (lastY > y)? 'slideUp' : 'slideDown'; + if (mode === 'slideDown' || toolbarT + 20 > y) { + if (toolbar.is(mode === 'slideDown' ? ':hidden' : ':visible')) { + toolbar.stop(true, true).trigger('toggle', {duration: 100, handleH: handleH}); + moveOff(); + } + lastY = false; + } + } + } + } + }); + })(); + } + + if (self.dragUpload) { + // add event listener for HTML5 DnD upload + (function() { + var isin = function(e) { + return (e.target.nodeName !== 'TEXTAREA' && e.target.nodeName !== 'INPUT' && $(e.target).closest('div.ui-dialog-content').length === 0); + }, + ent = 'native-drag-enter', + disable = 'native-drag-disable', + c = 'class', + navdir = self.res(c, 'navdir'), + droppable = self.res(c, 'droppable'), + dropover = self.res(c, 'adroppable'), + arrow = self.res(c, 'navarrow'), + clDropActive = self.res(c, 'adroppable'), + wz = self.getUI('workzone'), + ltr = (self.direction === 'ltr'), + clearTm = function() { + autoScrTm && clearTimeout(autoScrTm); + autoScrTm = null; + }, + wzRect, autoScrFn, autoScrTm; + + node.on('dragenter', function(e) { + clearTm(); + if (isin(e)) { + e.preventDefault(); + e.stopPropagation(); + wzRect = wz.data('rectangle'); + } + }) + .on('dragleave', function(e) { + clearTm(); + if (isin(e)) { + e.preventDefault(); + e.stopPropagation(); + } + }) + .on('dragover', function(e) { + var autoUp; + if (isin(e)) { + e.preventDefault(); + e.stopPropagation(); + e.originalEvent.dataTransfer.dropEffect = 'none'; + if (! autoScrTm) { + autoScrTm = setTimeout(function() { + var wzBottom = wzRect.top + wzRect.height, + fn; + if ((autoUp = e.pageY < wzRect.top) || e.pageY > wzBottom ) { + if (wzRect.cwdEdge > e.pageX) { + fn = (ltr? 'navbar' : 'cwd') + (autoUp? 'Up' : 'Down'); + } else { + fn = (ltr? 'cwd' : 'navbar') + (autoUp? 'Up' : 'Down'); + } + self.autoScroll[fn](Math.pow((autoUp? wzRect.top - e.pageY : e.pageY - wzBottom), 1.3)); + } + autoScrTm = null; + }, 20); + } + } else { + clearTm(); + } + }) + .on('drop', function(e) { + clearTm(); + if (isin(e)) { + e.stopPropagation(); + e.preventDefault(); + } + }); + + node.on('dragenter', '.native-droppable', function(e){ + if (e.originalEvent.dataTransfer) { + var $elm = $(e.currentTarget), + id = e.currentTarget.id || null, + cwd = null, + elfFrom; + if (!id) { // target is cwd + cwd = self.cwd(); + $elm.data(disable, false); + try { + $.each(e.originalEvent.dataTransfer.types, function(i, v){ + if (v.substr(0, 13) === 'elfinderfrom:') { + elfFrom = v.substr(13).toLowerCase(); + } + }); + } catch(e) {} + } + if (!cwd || (cwd.write && (!elfFrom || elfFrom !== (window.location.href + cwd.hash).toLowerCase()))) { + e.preventDefault(); + e.stopPropagation(); + $elm.data(ent, true); + $elm.addClass(clDropActive); + } else { + $elm.data(disable, true); + } + } + }) + .on('dragleave', '.native-droppable', function(e){ + if (e.originalEvent.dataTransfer) { + var $elm = $(e.currentTarget); + e.preventDefault(); + e.stopPropagation(); + if ($elm.data(ent)) { + $elm.data(ent, false); + } else { + $elm.removeClass(clDropActive); + } + } + }) + .on('dragover', '.native-droppable', function(e){ + if (e.originalEvent.dataTransfer) { + var $elm = $(e.currentTarget); + e.preventDefault(); + e.stopPropagation(); + e.originalEvent.dataTransfer.dropEffect = $elm.data(disable)? 'none' : 'copy'; + $elm.data(ent, false); + } + }) + .on('drop', '.native-droppable', function(e){ + if (e.originalEvent && e.originalEvent.dataTransfer) { + var $elm = $(e.currentTarget) + id; + e.preventDefault(); + e.stopPropagation(); + $elm.removeClass(clDropActive); + if (e.currentTarget.id) { + id = $elm.hasClass(navdir)? self.navId2Hash(e.currentTarget.id) : self.cwdId2Hash(e.currentTarget.id); + } else { + id = self.cwd().hash; + } + e.originalEvent._target = id; + self.exec('upload', {dropEvt: e.originalEvent, target: id}, void 0, id); + } + }); + })(); + } + + // trigger event cssloaded if cddAutoLoad disabled + if (self.cssloaded === false) { + self.cssloaded = true; + self.trigger('cssloaded'); + } + + // calculate elFinder node z-index + self.zIndexCalc(); + + // send initial request and start to pray >_< + self.trigger('init') + .request({ + data : {cmd : 'open', target : self.startDir(), init : 1, tree : self.ui.tree ? 1 : 0}, + preventDone : true, + notify : {type : 'open', cnt : 1, hideCnt : true}, + freeze : true + }) + .fail(function() { + self.trigger('fail').disable().lastDir(''); + listeners = {}; + shortcuts = {}; + $(document).add(node).off('.'+namespace); + self.trigger = function() { }; + }) + .done(function(data) { + var trashDisable = function(th) { + var src = self.file(self.trashes[th]), + d = self.options.debug, + error; + + if (src && src.volumeid) { + delete self.volOptions[src.volumeid].trashHash; + } + self.trashes[th] = false; + self.debug('backend-error', 'Trash hash "'+th+'" was not found or not writable.'); + }, + toChkTh = {}; + + // re-calculate elFinder node z-index + self.zIndexCalc(); + + self.load().debug('api', self.api); + // update ui's size after init + node.trigger('resize'); + // initial open + open(data); + self.trigger('open', data); + self.trigger('opendone'); + + if (inFrame && self.options.enableAlways) { + $(window).focus(); + } + + // check self.trashes + $.each(self.trashes, function(th) { + var dir = self.file(th), + src; + if (! dir) { + toChkTh[th] = true; + } else if (dir.mime !== 'directory' || ! dir.write) { + trashDisable(th); + } + }); + if (Object.keys(toChkTh).length) { + self.request({ + data : {cmd : 'info', targets : Object.keys(toChkTh)}, + preventDefault : true + }).done(function(data) { + if (data && data.files) { + $.each(data.files, function(i, dir) { + if (dir.mime === 'directory' && dir.write) { + delete toChkTh[dir.hash]; + } + }); + } + }).always(function() { + $.each(toChkTh, trashDisable); + }) + } + + }); + // self.timeEnd('load'); + // End of bootUp() + }; + + // call bootCallback function with elFinder instance, extraObject - { dfrdsBeforeBootup: dfrdsBeforeBootup } + if (bootCallback && typeof bootCallback === 'function') { + self.bootCallback = bootCallback; + bootCallback.call(node.get(0), self, { dfrdsBeforeBootup: dfrdsBeforeBootup }); + } + + // call dfrdsBeforeBootup functions then boot up elFinder + $.when.apply(null, dfrdsBeforeBootup).done(function() { + bootUp(); + }).fail(function(error) { + self.error(error); + }); +}; + +//register elFinder to global scope +if (typeof toGlobal === 'undefined' || toGlobal) { + window.elFinder = elFinder; +} + +/** + * Prototype + * + * @type Object + */ +elFinder.prototype = { + + uniqueid : 0, + + res : function(type, id) { + return this.resources[type] && this.resources[type][id]; + }, + + /** + * User os. Required to bind native shortcuts for open/rename + * + * @type String + **/ + OS : navigator.userAgent.indexOf('Mac') !== -1 ? 'mac' : navigator.userAgent.indexOf('Win') !== -1 ? 'win' : 'other', + + /** + * User browser UA. + * jQuery.browser: version deprecated: 1.3, removed: 1.9 + * + * @type Object + **/ + UA : (function(){ + var webkit = !document.uniqueID && !window.opera && !window.sidebar && window.localStorage && 'WebkitAppearance' in document.documentElement.style; + return { + // Browser IE <= IE 6 + ltIE6 : typeof window.addEventListener == "undefined" && typeof document.documentElement.style.maxHeight == "undefined", + // Browser IE <= IE 7 + ltIE7 : typeof window.addEventListener == "undefined" && typeof document.querySelectorAll == "undefined", + // Browser IE <= IE 8 + ltIE8 : typeof window.addEventListener == "undefined" && typeof document.getElementsByClassName == "undefined", + IE : document.uniqueID, + Firefox : window.sidebar, + Opera : window.opera, + Webkit : webkit, + Chrome : webkit && window.chrome, + Safari : webkit && !window.chrome, + Mobile : typeof window.orientation != "undefined", + Touch : typeof window.ontouchstart != "undefined", + iOS : navigator.platform.match(/^iP(?:[ao]d|hone)/), + Fullscreen : (typeof (document.exitFullscreen || document.webkitExitFullscreen || document.mozCancelFullScreen || document.msExitFullscreen) !== 'undefined') + }; + })(), + + /** + * Current request command + * + * @type String + */ + currentReqCmd : '', + + /** + * Internationalization object + * + * @type Object + */ + i18 : { + en : { + translator : '', + language : 'English', + direction : 'ltr', + dateFormat : 'd.m.Y H:i', + fancyDateFormat : '$1 H:i', + nonameDateFormat : 'ymd-His', + messages : {} + }, + months : ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], + monthsShort : ['msJan', 'msFeb', 'msMar', 'msApr', 'msMay', 'msJun', 'msJul', 'msAug', 'msSep', 'msOct', 'msNov', 'msDec'], + + days : ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], + daysShort : ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] + }, + + /** + * File mimetype to kind mapping + * + * @type Object + */ + kinds : { + 'unknown' : 'Unknown', + 'directory' : 'Folder', + 'symlink' : 'Alias', + 'symlink-broken' : 'AliasBroken', + 'application/x-empty' : 'TextPlain', + 'application/postscript' : 'Postscript', + 'application/vnd.ms-office' : 'MsOffice', + 'application/msword' : 'MsWord', + 'application/vnd.ms-word' : 'MsWord', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' : 'MsWord', + 'application/vnd.ms-word.document.macroEnabled.12' : 'MsWord', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.template' : 'MsWord', + 'application/vnd.ms-word.template.macroEnabled.12' : 'MsWord', + 'application/vnd.ms-excel' : 'MsExcel', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' : 'MsExcel', + 'application/vnd.ms-excel.sheet.macroEnabled.12' : 'MsExcel', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.template' : 'MsExcel', + 'application/vnd.ms-excel.template.macroEnabled.12' : 'MsExcel', + 'application/vnd.ms-excel.sheet.binary.macroEnabled.12' : 'MsExcel', + 'application/vnd.ms-excel.addin.macroEnabled.12' : 'MsExcel', + 'application/vnd.ms-powerpoint' : 'MsPP', + 'application/vnd.openxmlformats-officedocument.presentationml.presentation' : 'MsPP', + 'application/vnd.ms-powerpoint.presentation.macroEnabled.12' : 'MsPP', + 'application/vnd.openxmlformats-officedocument.presentationml.slideshow' : 'MsPP', + 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12' : 'MsPP', + 'application/vnd.openxmlformats-officedocument.presentationml.template' : 'MsPP', + 'application/vnd.ms-powerpoint.template.macroEnabled.12' : 'MsPP', + 'application/vnd.ms-powerpoint.addin.macroEnabled.12' : 'MsPP', + 'application/vnd.openxmlformats-officedocument.presentationml.slide' : 'MsPP', + 'application/vnd.ms-powerpoint.slide.macroEnabled.12' : 'MsPP', + 'application/pdf' : 'PDF', + 'application/xml' : 'XML', + 'application/vnd.oasis.opendocument.text' : 'OO', + 'application/vnd.oasis.opendocument.text-template' : 'OO', + 'application/vnd.oasis.opendocument.text-web' : 'OO', + 'application/vnd.oasis.opendocument.text-master' : 'OO', + 'application/vnd.oasis.opendocument.graphics' : 'OO', + 'application/vnd.oasis.opendocument.graphics-template' : 'OO', + 'application/vnd.oasis.opendocument.presentation' : 'OO', + 'application/vnd.oasis.opendocument.presentation-template' : 'OO', + 'application/vnd.oasis.opendocument.spreadsheet' : 'OO', + 'application/vnd.oasis.opendocument.spreadsheet-template' : 'OO', + 'application/vnd.oasis.opendocument.chart' : 'OO', + 'application/vnd.oasis.opendocument.formula' : 'OO', + 'application/vnd.oasis.opendocument.database' : 'OO', + 'application/vnd.oasis.opendocument.image' : 'OO', + 'application/vnd.openofficeorg.extension' : 'OO', + 'application/x-shockwave-flash' : 'AppFlash', + 'application/flash-video' : 'Flash video', + 'application/x-bittorrent' : 'Torrent', + 'application/javascript' : 'JS', + 'application/rtf' : 'RTF', + 'application/rtfd' : 'RTF', + 'application/x-font-ttf' : 'TTF', + 'application/x-font-otf' : 'OTF', + 'application/x-rpm' : 'RPM', + 'application/x-web-config' : 'TextPlain', + 'application/xhtml+xml' : 'HTML', + 'application/docbook+xml' : 'DOCBOOK', + 'application/x-awk' : 'AWK', + 'application/x-gzip' : 'GZIP', + 'application/x-bzip2' : 'BZIP', + 'application/x-xz' : 'XZ', + 'application/zip' : 'ZIP', + 'application/x-zip' : 'ZIP', + 'application/x-rar' : 'RAR', + 'application/x-tar' : 'TAR', + 'application/x-7z-compressed' : '7z', + 'application/x-jar' : 'JAR', + 'text/plain' : 'TextPlain', + 'text/x-php' : 'PHP', + 'text/html' : 'HTML', + 'text/javascript' : 'JS', + 'text/css' : 'CSS', + 'text/rtf' : 'RTF', + 'text/rtfd' : 'RTF', + 'text/x-c' : 'C', + 'text/x-csrc' : 'C', + 'text/x-chdr' : 'CHeader', + 'text/x-c++' : 'CPP', + 'text/x-c++src' : 'CPP', + 'text/x-c++hdr' : 'CPPHeader', + 'text/x-shellscript' : 'Shell', + 'application/x-csh' : 'Shell', + 'text/x-python' : 'Python', + 'text/x-java' : 'Java', + 'text/x-java-source' : 'Java', + 'text/x-ruby' : 'Ruby', + 'text/x-perl' : 'Perl', + 'text/x-sql' : 'SQL', + 'text/xml' : 'XML', + 'text/x-comma-separated-values' : 'CSV', + 'text/x-markdown' : 'Markdown', + 'image/x-ms-bmp' : 'BMP', + 'image/jpeg' : 'JPEG', + 'image/gif' : 'GIF', + 'image/png' : 'PNG', + 'image/tiff' : 'TIFF', + 'image/x-targa' : 'TGA', + 'image/vnd.adobe.photoshop' : 'PSD', + 'image/xbm' : 'XBITMAP', + 'image/pxm' : 'PXM', + 'audio/mpeg' : 'AudioMPEG', + 'audio/midi' : 'AudioMIDI', + 'audio/ogg' : 'AudioOGG', + 'audio/mp4' : 'AudioMPEG4', + 'audio/x-m4a' : 'AudioMPEG4', + 'audio/wav' : 'AudioWAV', + 'audio/x-mp3-playlist' : 'AudioPlaylist', + 'video/x-dv' : 'VideoDV', + 'video/mp4' : 'VideoMPEG4', + 'video/mpeg' : 'VideoMPEG', + 'video/x-msvideo' : 'VideoAVI', + 'video/quicktime' : 'VideoMOV', + 'video/x-ms-wmv' : 'VideoWM', + 'video/x-flv' : 'VideoFlash', + 'video/x-matroska' : 'VideoMKV', + 'video/ogg' : 'VideoOGG' + }, + + /** + * Ajax request data validation rules + * + * @type Object + */ + rules : { + defaults : function(data) { + if (!data + || (data.added && !Array.isArray(data.added)) + || (data.removed && !Array.isArray(data.removed)) + || (data.changed && !Array.isArray(data.changed))) { + return false; + } + return true; + }, + open : function(data) { return data && data.cwd && data.files && $.isPlainObject(data.cwd) && Array.isArray(data.files); }, + tree : function(data) { return data && data.tree && Array.isArray(data.tree); }, + parents : function(data) { return data && data.tree && Array.isArray(data.tree); }, + tmb : function(data) { return data && data.images && ($.isPlainObject(data.images) || Array.isArray(data.images)); }, + upload : function(data) { return data && ($.isPlainObject(data.added) || Array.isArray(data.added));}, + search : function(data) { return data && data.files && Array.isArray(data.files)} + }, + + /** + * Commands costructors + * + * @type Object + */ + commands : {}, + + /** + * Commands to add the item (space delimited) + * + * @type String + */ + cmdsToAdd : 'archive duplicate extract mkdir mkfile paste rm upload', + + parseUploadData : function(text) { + var data; + + if (!$.trim(text)) { + return {error : ['errResponse', 'errDataEmpty']}; + } + + try { + data = JSON.parse(text); + } catch (e) { + return {error : ['errResponse', 'errDataNotJSON']}; + } + + data = this.normalize(data); + if (!this.validResponse('upload', data)) { + return {error : (response.norError || ['errResponse'])}; + } + data.removed = $.merge((data.removed || []), $.map(data.added||[], function(f) { return f.hash; })); + return data; + + }, + + iframeCnt : 0, + + uploads : { + // xhr muiti uploading flag + xhrUploading: false, + + // check file/dir exists + checkExists: function(files, target, fm, isDir) { + var dfrd = $.Deferred(), + names, renames = [], hashes = {}, chkFiles = [], + cancel = function() { + var i = files.length; + while (--i > -1) { + files[i]._remove = true; + } + }, + resolve = function() { + dfrd.resolve(renames, hashes); + }, + check = function() { + var existed = [], exists = [], i, c, + confirm = function(ndx) { + var last = ndx == exists.length-1, + opts = { + title : fm.i18n('cmdupload'), + text : ['errExists', exists[ndx].name, 'confirmRepl'], + all : !last, + accept : { + label : 'btnYes', + callback : function(all) { + !last && !all + ? confirm(++ndx) + : resolve(); + } + }, + reject : { + label : 'btnNo', + callback : function(all) { + var i; + + if (all) { + i = exists.length; + while (ndx < i--) { + files[exists[i].i]._remove = true; + } + } else { + files[exists[ndx].i]._remove = true; + } + + !last && !all + ? confirm(++ndx) + : resolve(); + } + }, + cancel : { + label : 'btnCancel', + callback : function() { + cancel(); + resolve(); + } + }, + buttons : [ + { + label : 'btnBackup', + callback : function(all) { + var i; + if (all) { + i = exists.length; + while (ndx < i--) { + renames.push(exists[i].name); + } + } else { + renames.push(exists[ndx].name); + } + !last && !all + ? confirm(++ndx) + : resolve(); + } + } + ] + }; + + if (!isDir) { + opts.buttons.push({ + label : 'btnRename' + (last? '' : 'All'), + callback : function() { + renames = null; + resolve(); + } + }); + } + if (fm.iframeCnt > 0) { + delete opts.reject; + } + fm.confirm(opts); + }; + + if (! fm.file(target).read) { + // for dropbox type + resolve(); + return; + } + + names = $.map(files, function(file, i) { return file.name && (!fm.UA.iOS || file.name !== 'image.jpg')? {i: i, name: file.name} : null ;}); + + fm.request({ + data : {cmd : 'ls', target : target, intersect : $.map(names, function(item) { return item.name;})}, + notify : {type : 'preupload', cnt : 1, hideCnt : true}, + preventFail : true + }) + .done(function(data) { + var existedArr, cwdItems; + if (data) { + if (data.error) { + cancel(); + } else { + if (fm.options.overwriteUploadConfirm && fm.option('uploadOverwrite', target)) { + if (data.list) { + if (Array.isArray(data.list)) { + existed = data.list || []; + } else { + existedArr = []; + existed = $.map(data.list, function(n) { + if (typeof n === 'string') { + return n; + } else { + // support to >=2.1.11 plugin Normalizer, Sanitizer + existedArr = existedArr.concat(n); + return null; + } + }); + if (existedArr.length) { + existed = existed.concat(existedArr); + } + hashes = data.list; + } + exists = $.map(names, function(name){ + return $.inArray(name.name, existed) !== -1 ? name : null ; + }); + if (exists.length && existed.length && target == fm.cwd().hash) { + cwdItems = $.map(fm.files(target), function(file) { return file.name; } ); + if ($.map(existed, function(n) { + return $.inArray(n, cwdItems) === -1? true : null; + }).length){ + fm.sync(); + } + } + } + } + } + } + if (exists.length > 0) { + confirm(0); + } else { + resolve(); + } + }) + .fail(function(error) { + cancel(); + resolve(); + error && fm.error(error); + }); + }; + if (fm.api >= 2.1 && typeof files[0] == 'object') { + check(); + } else { + resolve(); + } + return dfrd; + }, + + // check droped contents + checkFile : function(data, fm, target) { + if (!!data.checked || data.type == 'files') { + return data.files; + } else if (data.type == 'data') { + var dfrd = $.Deferred(), + files = [], + paths = [], + dirctorys = [], + entries = [], + processing = 0, + items, + mkdirs = [], + + readEntries = function(dirReader) { + var toArray = function(list) { + return Array.prototype.slice.call(list || []); + }; + }, + + doScan = function(items) { + var dirReader, entry, length, + entries = [], + toArray = function(list) { + return Array.prototype.slice.call(list || [], 0); + }, + excludes = fm.options.folderUploadExclude[fm.OS] || null; + length = items.length; + for (var i = 0; i < length; i++) { + entry = items[i]; + if (entry) { + if (entry.isFile) { + processing++; + entry.file(function (file) { + if (! excludes || ! file.name.match(excludes)) { + paths.push(entry.fullPath || ''); + files.push(file); + } + processing--; + }); + } else if (entry.isDirectory) { + if (fm.api >= 2.1) { + processing++; + mkdirs.push(entry.fullPath); + dirReader = entry.createReader(); + var entries = []; + // Call the reader.readEntries() until no more results are returned. + var readEntries = function() { + dirReader.readEntries (function(results) { + if (!results.length) { + for (var i = 0; i < entries.length; i++) { + doScan([entries[i]]); + } + processing--; + } else { + entries = entries.concat(toArray(results)); + readEntries(); + } + }, function(){ + processing--; + }); + }; + readEntries(); // Start reading dirs. + } + } + } + } + }, hasDirs; + + items = $.map(data.files.items, function(item){ + return item.getAsEntry? item.getAsEntry() : item.webkitGetAsEntry(); + }); + $.each(items, function(i, item) { + if (item.isDirectory) { + hasDirs = true; + return false; + } + }); + if (items.length > 0) { + fm.uploads.checkExists(items, target, fm, hasDirs).done(function(renames, hashes){ + var notifyto, dfds = []; + if (fm.options.overwriteUploadConfirm && fm.option('uploadOverwrite', target)) { + if (renames === null) { + data.overwrite = 0; + renames = []; + } + items = $.map(items, function(item){ + var i, bak, hash, dfd, hi; + if (item.isDirectory && renames.length) { + i = $.inArray(item.name, renames); + if (i !== -1) { + renames.splice(i, 1); + bak = fm.uniqueName(item.name + fm.options.backupSuffix , null, ''); + $.each(hashes, function(h, name) { + if (item.name == name) { + hash = h; + return false; + } + }); + if (! hash) { + hash = fm.fileByName(item.name, target).hash; + } + fm.lockfiles({files : [hash]}); + dfd = fm.request({ + data : {cmd : 'rename', target : hash, name : bak}, + notify : {type : 'rename', cnt : 1} + }) + .fail(function(error) { + item._remove = true; + fm.sync(); + }) + .always(function() { + fm.unlockfiles({files : [hash]}) + }); + dfds.push(dfd); + } + } + return !item._remove? item : null; + }); + } + $.when.apply($, dfds).done(function(){ + if (items.length > 0) { + notifyto = setTimeout(function() { + fm.notify({type : 'readdir', cnt : 1, hideCnt: true}); + }, fm.options.notifyDelay); + doScan(items); + setTimeout(function wait() { + if (processing > 0) { + setTimeout(wait, 10); + } else { + notifyto && clearTimeout(notifyto); + fm.notify({type : 'readdir', cnt : -1}); + dfrd.resolve([files, paths, renames, hashes, mkdirs]); + } + }, 10); + } else { + dfrd.reject(); + } + }); + }); + return dfrd.promise(); + } else { + return dfrd.reject(); + } + } else { + var ret = []; + var check = []; + var str = data.files[0]; + if (data.type == 'html') { + var tmp = $("").append($.parseHTML(str.replace(/ src=/ig, ' _elfsrc='))), + atag; + $('img[_elfsrc]', tmp).each(function(){ + var url, purl, + self = $(this), + pa = self.closest('a'); + if (pa && pa.attr('href') && pa.attr('href').match(/\.(?:jpe?g|gif|bmp|png)/i)) { + purl = pa.attr('href'); + } + url = self.attr('_elfsrc'); + if (url) { + if (purl) { + $.inArray(purl, ret) == -1 && ret.push(purl); + $.inArray(url, check) == -1 && check.push(url); + } else { + $.inArray(url, ret) == -1 && ret.push(url); + } + } + // Probably it's clipboard data + if (ret.length === 1 && ret[0].match(/^data:image\/png/)) { + data.clipdata = true; + } + }); + atag = $('a[href]', tmp); + atag.each(function(){ + var loc, + parseUrl = function(url) { + var a = document.createElement('a'); + a.href = url; + return a; + }; + if ($(this).text()) { + loc = parseUrl($(this).attr('href')); + if (loc.href && (atag.length === 1 || ! loc.pathname.match(/(?:\.html?|\/[^\/.]*)$/i))) { + if ($.inArray(loc.href, ret) == -1 && $.inArray(loc.href, check) == -1) ret.push(loc.href); + } + } + }); + } else { + var regex, m, url; + regex = /(http[^<>"{}|\\^\[\]`\s]+)/ig; + while (m = regex.exec(str)) { + url = m[1].replace(/&/g, '&'); + if ($.inArray(url, ret) == -1) ret.push(url); + } + } + return ret; + } + }, + + // upload transport using XMLHttpRequest + xhr : function(data, fm) { + var self = fm ? fm : this, + node = self.getUI(), + xhr = new XMLHttpRequest(), + notifyto = null, notifyto2 = null, + dataChecked = data.checked, + isDataType = (data.isDataType || data.type == 'data'), + target = (data.target || self.cwd().hash), + dropEvt = (data.dropEvt || null), + chunkEnable = (self.option('uploadMaxConn', target) != -1), + multiMax = Math.min(5, Math.max(1, self.option('uploadMaxConn', target))), + retryWait = 10000, // 10 sec + retryMax = 30, // 10 sec * 30 = 300 secs (Max 5 mins) + retry = 0, + getFile = function(files) { + var dfd = $.Deferred(), + file; + if (files.promise) { + files.always(function(f) { + dfd.resolve(Array.isArray(f) && f.length? (isDataType? f[0][0] : f[0]) : {}); + }); + } else { + dfd.resolve(files.length? (isDataType? files[0][0] : files[0]) : {}); + } + return dfd; + }, + dfrd = $.Deferred() + .fail(function(error) { + if (self.uploads.xhrUploading) { + getFile(files).done(function(file) { + if (file._cid) { + setTimeout(function() { self.sync(); }, 5000); + formData = new FormData(); + files = [{_chunkfail: true}]; + formData.append('chunk', file._chunk); + formData.append('cid' , file._cid); + isDataType = false; + send(files); + } + }); + } + self.sync(); + self.uploads.xhrUploading = false; + files = null; + error && self.error(error); + }) + .done(function(data) { + xhr = null; + self.uploads.xhrUploading = false; + files = null; + if (data) { + self.currentReqCmd = 'upload'; + data.warning && self.error(data.warning); + self.updateCache(data); + data.removed && self.remove(data); + data.added && self.add(data); + data.changed && self.change(data); + self.trigger('upload', data); + self.trigger('uploaddone'); + data.sync && self.sync(); + data.debug && fm.debug('backend-debug', data); + } + }) + .always(function() { + // unregist fnAbort function + node.off('uploadabort', fnAbort); + $(window).off('unload', fnAbort); + notifyto && clearTimeout(notifyto); + notifyto2 && clearTimeout(notifyto2); + dataChecked && !data.multiupload && checkNotify() && self.notify({type : 'upload', cnt : -cnt, progress : 0, size : 0}); + chunkMerge && notifyElm.children('.elfinder-notify-chunkmerge').length && self.notify({type : 'chunkmerge', cnt : -1}); + }), + formData = new FormData(), + files = data.input ? data.input.files : self.uploads.checkFile(data, self, target), + cnt = data.checked? (isDataType? files[0].length : files.length) : files.length, + loaded = 0, + prev = 0, + filesize = 0, + notify = false, + notifyElm = self.ui.notify, + cancelBtn = true, + abort = false, + checkNotify = function() { + return notify = (notify || notifyElm.children('.elfinder-notify-upload').length); + }, + fnAbort = function() { + abort = true; + if (xhr) { + xhr.quiet = true; + xhr.abort(); + } + if (checkNotify()) { + self.notify({type : 'upload', cnt : notifyElm.children('.elfinder-notify-upload').data('cnt') * -1, progress : 0, size : 0}); + } + }, + cancelToggle = function(show) { + notifyElm.children('.elfinder-notify-upload').children('.elfinder-notify-cancel')[show? 'show':'hide'](); + }, + startNotify = function(size) { + if (!size) size = filesize; + return setTimeout(function() { + notify = true; + self.notify({type : 'upload', cnt : cnt, progress : loaded - prev, size : size, + cancel: function() { + node.trigger('uploadabort'); + dfrd.resolve(); + } + }); + prev = loaded; + if (data.multiupload) { + cancelBtn && cancelToggle(true); + } else { + cancelToggle(cancelBtn && loaded < size); + } + }, self.options.notifyDelay); + }, + doRetry = function() { + if (retry++ <= retryMax) { + if (checkNotify() && prev) { + self.notify({type : 'upload', cnt : 0, progress : 0, size : prev}); + } + xhr.quiet = true; + xhr.abort(); + prev = loaded = 0; + setTimeout(function() { + if (! abort) { + xhr.open('POST', self.uploadURL, true); + xhr.send(formData); + } + }, retryWait); + } else { + node.trigger('uploadabort'); + dfrd.reject(['errAbort', 'errTimeout']); + } + }, + renames = (data.renames || null), + hashes = (data.hashes || null), + chunkMerge = false; + + // regist fnAbort function + node.one('uploadabort', fnAbort); + $(window).one('unload.' + fm.namespace, fnAbort); + + !chunkMerge && (prev = loaded); + + if (!isDataType && !cnt) { + return dfrd.reject(['errUploadNoFiles']); + } + + xhr.addEventListener('error', function() { + if (xhr.status == 0) { + if (abort) { + dfrd.reject(); + } else { + // ff bug while send zero sized file + // for safari - send directory + if (!isDataType && data.files && $.map(data.files, function(f){return ! f.type && f.size === (self.UA.Safari? 1802 : 0)? f : null;}).length) { + errors.push('errFolderUpload'); + dfrd.reject(['errAbort', 'errFolderUpload']); + } else if (data.input && $.map(data.input.files, function(f){return ! f.type && f.size === (self.UA.Safari? 1802 : 0)? f : null;}).length) { + dfrd.reject(['errUploadNoFiles']); + } else { + doRetry(); + } + } + } else { + node.trigger('uploadabort'); + dfrd.reject('errConnect'); + } + }, false); + + xhr.addEventListener('load', function(e) { + var status = xhr.status, res, curr = 0, error = ''; + + if (status >= 400) { + if (status > 500) { + error = 'errResponse'; + } else { + error = ['errResponse', 'errServerError']; + } + } else { + if (!xhr.responseText) { + error = ['errResponse', 'errDataEmpty']; + } + } + + if (error) { + node.trigger('uploadabort'); + getFile(files).done(function(file) { + return dfrd.reject(file._cid? null : error); + }); + } + + loaded = filesize; + + if (checkNotify() && (curr = loaded - prev)) { + self.notify({type : 'upload', cnt : 0, progress : curr, size : 0}); + } + + res = self.parseUploadData(xhr.responseText); + + // chunked upload commit + if (res._chunkmerged) { + formData = new FormData(); + var _file = [{_chunkmerged: res._chunkmerged, _name: res._name, _mtime: res._mtime}]; + chunkMerge = true; + node.off('uploadabort', fnAbort); + notifyto2 = setTimeout(function() { + self.notify({type : 'chunkmerge', cnt : 1}); + }, self.options.notifyDelay); + isDataType? send(_file, files[1]) : send(_file); + return; + } + + res._multiupload = data.multiupload? true : false; + if (res.error) { + self.trigger('uploadfail', res); + if (res._chunkfailure || res._multiupload) { + abort = true; + self.uploads.xhrUploading = false; + notifyto && clearTimeout(notifyto); + if (notifyElm.children('.elfinder-notify-upload').length) { + self.notify({type : 'upload', cnt : -cnt, progress : 0, size : 0}); + dfrd.reject(res.error); + } else { + // for multi connection + dfrd.reject(); + } + } else { + dfrd.reject(res.error); + } + } else { + dfrd.resolve(res); + } + }, false); + + xhr.upload.addEventListener('loadstart', function(e) { + if (!chunkMerge && e.lengthComputable) { + loaded = e.loaded; + retry && (loaded = 0); + filesize = e.total; + if (!loaded) { + loaded = parseInt(filesize * 0.05); + } + if (checkNotify()) { + self.notify({type : 'upload', cnt : 0, progress : loaded - prev, size : data.multiupload? 0 : filesize}); + prev = loaded; + } + } + }, false); + + xhr.upload.addEventListener('progress', function(e) { + var curr; + + if (e.lengthComputable && !chunkMerge && xhr.readyState < 2) { + + loaded = e.loaded; + + // to avoid strange bug in safari (not in chrome) with drag&drop. + // bug: macos finder opened in any folder, + // reset safari cache (option+command+e), reload elfinder page, + // drop file from finder + // on first attempt request starts (progress callback called ones) but never ends. + // any next drop - successfull. + if (!data.checked && loaded > 0 && !notifyto) { + notifyto = startNotify(xhr._totalSize - loaded); + } + + if (!filesize) { + filesize = e.total; + if (!loaded) { + loaded = parseInt(filesize * 0.05); + } + } + + curr = loaded - prev; + if (checkNotify() && (curr/e.total) >= 0.05) { + self.notify({type : 'upload', cnt : 0, progress : curr, size : 0}); + prev = loaded; + } + + if (! data.multiupload && loaded >= filesize) { + cancelBtn = false; + cancelToggle(false); + } + } + }, false); + + var send = function(files, paths){ + var size = 0, + fcnt = 1, + sfiles = [], + c = 0, + total = cnt, + maxFileSize, + totalSize = 0, + chunked = [], + chunkID = new Date().getTime().toString().substr(-9), // for take care of the 32bit backend system + BYTES_PER_CHUNK = Math.min((fm.uplMaxSize? fm.uplMaxSize : 2097152) - 8190, fm.options.uploadMaxChunkSize), // uplMaxSize margin 8kb or options.uploadMaxChunkSize + blobSlice = chunkEnable? false : '', + blobSize, blobMtime, i, start, end, chunks, blob, chunk, added, done, last, failChunk, + multi = function(files, num){ + var sfiles = [], cid, sfilesLen = 0, cancelChk; + if (!abort) { + while(files.length && sfiles.length < num) { + sfiles.push(files.shift()); + } + sfilesLen = sfiles.length; + if (sfilesLen) { + cancelChk = sfilesLen; + for (var i=0; i < sfilesLen; i++) { + if (abort) { + break; + } + cid = isDataType? (sfiles[i][0][0]._cid || null) : (sfiles[i][0]._cid || null); + if (!!failChunk[cid]) { + last--; + continue; + } + fm.exec('upload', { + type: data.type, + isDataType: isDataType, + files: sfiles[i], + checked: true, + target: target, + dropEvt: dropEvt, + renames: renames, + hashes: hashes, + multiupload: true, + overwrite: data.overwrite === 0? 0 : void 0 + }, void 0, target) + .fail(function(error) { + if (error && error === 'No such command') { + abort = true; + fm.error(['errUpload', 'errPerm']); + } + if (cid) { + failChunk[cid] = true; + } + }) + .always(function(e) { + if (e && e.added) added = $.merge(added, e.added); + if (last <= ++done) { + fm.trigger('multiupload', {added: added}); + notifyto && clearTimeout(notifyto); + if (checkNotify()) { + self.notify({type : 'upload', cnt : -cnt, progress : 0, size : 0}); + } + } + if (files.length) { + multi(files, 1); // Next one + } else { + if (--cancelChk <= 1) { + cancelBtn = false; + cancelToggle(false); + } + } + }); + } + } + } + if (sfiles.length < 1 || abort) { + if (abort) { + notifyto && clearTimeout(notifyto); + if (cid) { + failChunk[cid] = true; + } + dfrd.reject(); + } else { + dfrd.resolve(); + self.uploads.xhrUploading = false; + } + } + }, + check = function(){ + if (!self.uploads.xhrUploading) { + self.uploads.xhrUploading = true; + multi(sfiles, multiMax); // Max connection: 3 + } else { + setTimeout(function(){ check(); }, 100); + } + }; + + if (! dataChecked && (isDataType || data.type == 'files')) { + if (! (maxFileSize = fm.option('uploadMaxSize', target))) { + maxFileSize = 0; + } + for (i=0; i < files.length; i++) { + try { + blob = files[i]; + blobSize = blob.size; + if (blobSlice === false) { + blobSlice = ''; + if (self.api >= 2.1) { + if ('slice' in blob) { + blobSlice = 'slice'; + } else if ('mozSlice' in blob) { + blobSlice = 'mozSlice'; + } else if ('webkitSlice' in blob) { + blobSlice = 'webkitSlice'; + } + } + } + } catch(e) { + cnt--; + total--; + continue; + } + + // file size check + if ((maxFileSize && blobSize > maxFileSize) || (!blobSlice && fm.uplMaxSize && blobSize > fm.uplMaxSize)) { + self.error(self.i18n('errUploadFile', blob.name) + ' ' + self.i18n('errUploadFileSize')); + cnt--; + total--; + continue; + } + + // file mime check + if (blob.type && ! self.uploadMimeCheck(blob.type, target)) { + self.error(self.i18n('errUploadFile', blob.name) + ' ' + self.i18n('errUploadMime') + ' (' + self.escape(blob.type) + ')'); + cnt--; + total--; + continue; + } + + if (blobSlice && blobSize > BYTES_PER_CHUNK) { + start = 0; + end = BYTES_PER_CHUNK; + chunks = -1; + total = Math.floor(blobSize / BYTES_PER_CHUNK); + blobMtime = blob.lastModified? Math.round(blob.lastModified/1000) : 0; + + totalSize += blobSize; + chunked[chunkID] = 0; + while(start <= blobSize) { + chunk = blob[blobSlice](start, end); + chunk._chunk = blob.name + '.' + (++chunks) + '_' + total + '.part'; + chunk._cid = chunkID; + chunk._range = start + ',' + chunk.size + ',' + blobSize; + chunk._mtime = blobMtime; + chunked[chunkID]++; + + if (size) { + c++; + } + if (typeof sfiles[c] == 'undefined') { + sfiles[c] = []; + if (isDataType) { + sfiles[c][0] = []; + sfiles[c][1] = []; + } + } + size = BYTES_PER_CHUNK; + fcnt = 1; + if (isDataType) { + sfiles[c][0].push(chunk); + sfiles[c][1].push(paths[i]); + } else { + sfiles[c].push(chunk); + } + + start = end; + end = start + BYTES_PER_CHUNK; + } + if (chunk == null) { + self.error(self.i18n('errUploadFile', blob.name) + ' ' + self.i18n('errUploadFileSize')); + cnt--; + total--; + } else { + total += chunks; + size = 0; + fcnt = 1; + c++; + } + continue; + } + if ((fm.uplMaxSize && size + blobSize >= fm.uplMaxSize) || fcnt > fm.uplMaxFile) { + size = 0; + fcnt = 1; + c++; + } + if (typeof sfiles[c] == 'undefined') { + sfiles[c] = []; + if (isDataType) { + sfiles[c][0] = []; + sfiles[c][1] = []; + } + } + if (isDataType) { + sfiles[c][0].push(blob); + sfiles[c][1].push(paths[i]); + } else { + sfiles[c].push(blob); + } + size += blobSize; + totalSize += blobSize; + fcnt++; + } + + if (sfiles.length == 0) { + // no data + data.checked = true; + return false; + } + + if (sfiles.length > 1) { + // multi upload + notifyto = startNotify(totalSize); + added = []; + done = 0; + last = sfiles.length; + failChunk = []; + check(); + return true; + } + + // single upload + if (isDataType) { + files = sfiles[0][0]; + paths = sfiles[0][1]; + } else { + files = sfiles[0]; + } + } + + if (!dataChecked) { + if (!fm.UA.Safari || !data.files) { + notifyto = startNotify(totalSize); + } else { + xhr._totalSize = totalSize; + } + } + + dataChecked = true; + + if (! files.length) { + dfrd.reject(['errUploadNoFiles']); + } + + xhr.open('POST', self.uploadURL, true); + + // set request headers + if (fm.customHeaders) { + $.each(fm.customHeaders, function(key) { + xhr.setRequestHeader(key, this); + }); + } + + // set xhrFields + if (fm.xhrFields) { + $.each(fm.xhrFields, function(key) { + if (key in xhr) { + xhr[key] = this; + } + }); + } + + formData.append('cmd', 'upload'); + formData.append(self.newAPI ? 'target' : 'current', target); + if (renames && renames.length) { + $.each(renames, function(i, v) { + formData.append('renames[]', v); + }); + formData.append('suffix', fm.options.backupSuffix); + } + if (hashes) { + $.each(hashes, function(i, v) { + formData.append('hashes['+ i +']', v); + }); + } + $.each(self.options.customData, function(key, val) { + formData.append(key, val); + }); + $.each(self.options.onlyMimes, function(i, mime) { + formData.append('mimes['+i+']', mime); + }); + + $.each(files, function(i, file) { + if (file._chunkmerged) { + formData.append('chunk', file._chunkmerged); + formData.append('upload[]', file._name); + formData.append('mtime[]', file._mtime); + } else { + if (file._chunkfail) { + formData.append('upload[]', 'chunkfail'); + formData.append('mimes', 'chunkfail'); + } else { + formData.append('upload[]', file); + if (data.clipdata) { + data.overwrite = 0; + formData.append('name[]', fm.date(fm.nonameDateFormat) + '.png'); + } + if (fm.UA.iOS && file.name === 'image.jpg') { + data.overwrite = 0; + formData.append('name[]', fm.date(fm.nonameDateFormat) + '.jpg'); + } + } + if (file._chunk) { + formData.append('chunk', file._chunk); + formData.append('cid' , file._cid); + formData.append('range', file._range); + formData.append('mtime[]', file._mtime); + } else { + formData.append('mtime[]', file.lastModified? Math.round(file.lastModified/1000) : 0); + } + } + }); + + if (isDataType) { + $.each(paths, function(i, path) { + formData.append('upload_path[]', path); + }); + } + + if (data.overwrite === 0) { + formData.append('overwrite', 0); + } + + // send int value that which meta key was pressed when dropped as `dropWith` + if (dropEvt) { + formData.append('dropWith', parseInt( + (dropEvt.altKey ? '1' : '0')+ + (dropEvt.ctrlKey ? '1' : '0')+ + (dropEvt.metaKey ? '1' : '0')+ + (dropEvt.shiftKey? '1' : '0'), 2)); + } + + xhr.send(formData); + + return true; + }; + + if (! isDataType) { + if (files.length > 0) { + if (! data.clipdata && renames == null) { + var mkdirs = [], + paths = [], + excludes = fm.options.folderUploadExclude[fm.OS] || null; + $.each(files, function(i, file) { + var relPath = file.webkitRelativePath || file.relativePath || ''; + if (! relPath) { + return false; + } + if (excludes && file.name.match(excludes)) { + file._remove = true; + relPath = void(0); + } else { + relPath = relPath.replace(/\/[^\/]*$/, ''); + if (relPath && $.inArray(relPath, mkdirs) === -1) { + mkdirs.push(relPath); + } + } + paths.push(relPath); + }); + renames = []; + hashes = {}; + if (mkdirs.length) { + (function() { + var checkDirs = $.map(mkdirs, function(name) { return name.indexOf('/') === -1 ? {name: name} : null;}), + cancelDirs = []; + fm.uploads.checkExists(checkDirs, target, fm, true).done( + function(res, res2) { + var dfds = [], dfd, bak, hash; + if (fm.options.overwriteUploadConfirm && fm.option('uploadOverwrite', target)) { + cancelDirs = $.map(checkDirs, function(dir) { return dir._remove? dir.name : null ;} ); + checkDirs = $.map(checkDirs, function(dir) { return !dir._remove? dir : null ;} ); + } + if (cancelDirs.length) { + $.each(paths.concat(), function(i, path) { + if ($.inArray(path, cancelDirs) === 0) { + files[i]._remove = true; + delete paths[i]; + } + }); + } + files = $.map(files, function(file) { return file._remove? null : file; }); + paths = $.map(paths, function(path) { return path === void 0 ? null : path; }); + if (checkDirs.length) { + dfd = $.Deferred(); + if (res.length) { + $.each(res, function(i, existName) { + // backup + bak = fm.uniqueName(existName + fm.options.backupSuffix , null, ''); + $.each(res2, function(h, name) { + if (res[0] == name) { + hash = h; + return false; + } + }); + if (! hash) { + hash = fm.fileByName(res[0], target).hash; + } + fm.lockfiles({files : [hash]}); + dfds.push( + fm.request({ + data : {cmd : 'rename', target : hash, name : bak}, + notify : {type : 'rename', cnt : 1} + }) + .fail(function(error) { + dfrd.reject(error); + fm.sync(); + }) + .always(function() { + fm.unlockfiles({files : [hash]}) + }) + ); + }); + } else { + dfds.push(null); + } + + $.when.apply($, dfds).done(function() { + // ensure directories + fm.request({ + data : {cmd : 'mkdir', target : target, dirs : mkdirs}, + notify : {type : 'mkdir', cnt : mkdirs.length}, + preventFail: true + }) + .fail(function(error) { + error = error || ['errUnknown']; + if (error[0] === 'errCmdParams') { + multiMax = 1; + } else { + multiMax = 0; + dfrd.reject(error); + } + }) + .done(function(data) { + if (data.hashes) { + paths = $.map(paths.concat(), function(p) { + if (p === '') { + return target; + } else { + return data.hashes['/' + p]; + } + }); + } + }) + .always(function(data) { + if (multiMax) { + isDataType = true; + if (! send(files, paths)) { + dfrd.reject(); + } + } + }); + }); + } else { + dfrd.reject(); + } + } + ); + })(); + } else { + fm.uploads.checkExists(files, target, fm).done( + function(res, res2){ + if (fm.options.overwriteUploadConfirm && fm.option('uploadOverwrite', target)) { + if (res === null) { + data.overwrite = 0; + } else { + renames = res; + hashes = res2; + } + files = $.map(files, function(file){return !file._remove? file : null ;}); + } + cnt = files.length; + if (cnt > 0) { + if (! send(files)) { + dfrd.reject(); + } + } else { + dfrd.reject(); + } + } + ); + } + } else { + if (! send(files)) { + dfrd.reject(); + } + } + } else { + dfrd.reject(); + } + } else { + if (dataChecked) { + send(files[0], files[1]); + } else { + files.done(function(result) { // result: [files, paths, renames, hashes, mkdirs] + renames = []; + cnt = result[0].length; + if (cnt) { + if (result[4] && result[4].length) { + // ensure directories + fm.request({ + data : {cmd : 'mkdir', target : target, dirs : result[4]}, + notify : {type : 'mkdir', cnt : result[4].length}, + preventFail: true + }) + .fail(function(error) { + error = error || ['errUnknown']; + if (error[0] === 'errCmdParams') { + multiMax = 1; + } else { + multiMax = 0; + dfrd.reject(error); + } + }) + .done(function(data) { + if (data.hashes) { + result[1] = $.map(result[1], function(p) { + p = p.replace(/\/[^\/]*$/, ''); + if (p === '') { + return target; + } else { + return data.hashes[p]; + } + }); + } + }) + .always(function(data) { + if (multiMax) { + renames = result[2]; + hashes = result[3]; + send(result[0], result[1]); + } + }); + return; + } else { + result[1] = $.map(result[1], function() { return target; }); + } + renames = result[2]; + hashes = result[3]; + send(result[0], result[1]); + } else { + dfrd.reject(['errUploadNoFiles']); + } + }).fail(function(){ + dfrd.reject(); + }); + } + } + + return dfrd; + }, + + // upload transport using iframe + iframe : function(data, fm) { + var self = fm ? fm : this, + input = data.input? data.input : false, + files = !input ? self.uploads.checkFile(data, self) : false, + dfrd = $.Deferred() + .fail(function(error) { + error && self.error(error); + }), + name = 'iframe-'+fm.namespace+(++self.iframeCnt), + form = $('
        '), + msie = this.UA.IE, + // clear timeouts, close notification dialog, remove form/iframe + onload = function() { + abortto && clearTimeout(abortto); + notifyto && clearTimeout(notifyto); + notify && self.notify({type : 'upload', cnt : -cnt}); + + setTimeout(function() { + msie && $('