feat(deployed): add JSN / JoomlaShine 2.5.6 (no-source, vetted live)
JSN / JoomlaShine (JSN Project) component + framework + modules + plugins; vendor closed in 2021 -> deployed files. Signed-off-by: LÁZÁR Imre <imre@illusion.hu> Assisted-by: claude-code@claude-opus-4-8
This commit is contained in:
parent
b0ebd8bce3
commit
fc3244f2da
12
deployed/jsn/administrator/components/com_jsn/access.xml
Normal file
12
deployed/jsn/administrator/components/com_jsn/access.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<access component="com_jsn">
|
||||||
|
<section name="component">
|
||||||
|
<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
|
||||||
|
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" />
|
||||||
|
<action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_COMPONENT_DESC" />
|
||||||
|
<action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_COMPONENT_DESC" />
|
||||||
|
<action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_COMPONENT_DESC" />
|
||||||
|
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_EDITSTATE_COMPONENT_DESC" />
|
||||||
|
<action name="core.admin.import" title="COM_JSN_IMPORTACCESS" description="COM_JSN_IMPORTACCESS_DESC" />
|
||||||
|
</section>
|
||||||
|
</access>
|
||||||
@ -0,0 +1,906 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
class ImgPicker
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $options;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $errorMessages = array(
|
||||||
|
// File upload errors codes
|
||||||
|
// http://www.php.net/manual/en/features.file-upload.errors.php
|
||||||
|
1 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini',
|
||||||
|
2 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form',
|
||||||
|
3 => 'The uploaded file was only partially uploaded',
|
||||||
|
4 => 'No file was uploaded',
|
||||||
|
6 => 'Missing a temporary folder',
|
||||||
|
7 => 'Failed to write file to disk',
|
||||||
|
8 => 'A PHP extension stopped the file upload',
|
||||||
|
'gd' => 'PHP GD library is NOT installed on your web server',
|
||||||
|
'post_max_size' => 'The uploaded file exceeds the post_max_size directive in php.ini',
|
||||||
|
'max_file_size' => 'File is too big',
|
||||||
|
'min_file_size' => 'File is too small',
|
||||||
|
'accept_file_types' => 'Filetype not allowed',
|
||||||
|
'max_width' => 'Image exceeds maximum width of ',
|
||||||
|
'min_width' => 'Image requires a minimum width of ',
|
||||||
|
'max_height' => 'Image exceeds maximum height of ',
|
||||||
|
'min_height' => 'Image requires a minimum height of ',
|
||||||
|
'upload_failed' => 'Failed to upload the file',
|
||||||
|
'move_failed' => 'Failed to upload the file',
|
||||||
|
'invalid_image' => 'Invalid image',
|
||||||
|
'image_resize' => 'Failed to resize image',
|
||||||
|
'not_exists' => 'Failed to load the image'
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new instance.
|
||||||
|
*
|
||||||
|
* @param array $options
|
||||||
|
* @param array $errorMessages
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct($options = array(), $errorMessages = array())
|
||||||
|
{
|
||||||
|
$this->options = array(
|
||||||
|
// Upload directory path:
|
||||||
|
'upload_dir' => __DIR__ . '/files/',
|
||||||
|
|
||||||
|
// Upload directory url:
|
||||||
|
'upload_url' => $this->getFullUrl() . '/files/',
|
||||||
|
|
||||||
|
// Accepted file types:
|
||||||
|
'accept_file_types' => 'png|jpg|jpeg|gif',
|
||||||
|
|
||||||
|
// Directory mode:
|
||||||
|
'mkdir_mode' => 0755,
|
||||||
|
|
||||||
|
// File size restrictions (in bytes):
|
||||||
|
'max_file_size' => null,
|
||||||
|
'min_file_size' => 1,
|
||||||
|
|
||||||
|
// Image resolution restrictions (in px):
|
||||||
|
'max_width' => null,
|
||||||
|
'max_height' => null,
|
||||||
|
'min_width' => 1,
|
||||||
|
'min_height' => 1,
|
||||||
|
|
||||||
|
// Auto orient image based on EXIF data:
|
||||||
|
'auto_orient' => true,
|
||||||
|
|
||||||
|
// Image versions
|
||||||
|
'versions' => array(
|
||||||
|
//'' => array(
|
||||||
|
//'upload_dir' => '',
|
||||||
|
//'upload_url' => '',
|
||||||
|
// Create square images
|
||||||
|
// 'crop' => true,
|
||||||
|
// 'max_width' => 200,
|
||||||
|
// 'max_height' => 200,
|
||||||
|
//),
|
||||||
|
|
||||||
|
// 'avatar' => array(
|
||||||
|
// 'crop' => true,
|
||||||
|
// 'max_width' => 200,
|
||||||
|
// 'max_height' => 200
|
||||||
|
// ),
|
||||||
|
|
||||||
|
// 'small' => array(
|
||||||
|
// 'crop' => true,
|
||||||
|
// 'max_width' => 100
|
||||||
|
// )
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->options = $options + $this->options;
|
||||||
|
|
||||||
|
$this->errorMessages = $errorMessages + $this->errorMessages;
|
||||||
|
|
||||||
|
$this->initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize upload and crop actions.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function initialize()
|
||||||
|
{
|
||||||
|
if (!extension_loaded('gd') || !function_exists('gd_info')) {
|
||||||
|
$this->error = $this->getErrorMessage('gd');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
|
||||||
|
|
||||||
|
if (method_exists($this, $action.'Action')) {
|
||||||
|
return $this->{$action.'Action'}();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load action.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function loadAction()
|
||||||
|
{
|
||||||
|
if (!isset($this->options['load'])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$files = call_user_func($this->options['load'], $this);
|
||||||
|
|
||||||
|
if (!$files) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_array($files)) {
|
||||||
|
$files = array($files);
|
||||||
|
$single = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$images = array();
|
||||||
|
|
||||||
|
foreach ($files as $file) {
|
||||||
|
$image = new stdClass();
|
||||||
|
$image->path = $this->getUploadPath($file);
|
||||||
|
|
||||||
|
if (!file_exists($image->path)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$image->name = $file;
|
||||||
|
$image->type = $this->getFileExtension($image->name);
|
||||||
|
$image->url = $this->getUploadUrl($image->name);
|
||||||
|
|
||||||
|
list($image->width, $image->height) = @getimagesize($image->path);
|
||||||
|
|
||||||
|
foreach ($this->options['versions'] as $version => $options) {
|
||||||
|
$filename = $this->getVersionFilename($image->name, $version);
|
||||||
|
$filepath = $this->getUploadPath($filename, $version);
|
||||||
|
|
||||||
|
list($width, $height) = @getimagesize($filepath);
|
||||||
|
|
||||||
|
$image->versions[$version] = array(
|
||||||
|
'url' => $this->getUploadUrl($filename, $version),
|
||||||
|
'width' => $width,
|
||||||
|
'height' => $height
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($image->path);
|
||||||
|
|
||||||
|
if (isset($single)) {
|
||||||
|
$images = $image;
|
||||||
|
} else {
|
||||||
|
$images[] = $image;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->generateResponse($images);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Preview action.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function previewAction()
|
||||||
|
{
|
||||||
|
$get=JFactory::getApplication()->input->get->getArray();
|
||||||
|
$filename = basename(@$get['file']);
|
||||||
|
$width = @$get['width'];
|
||||||
|
$rotate = @$get['rotate'];
|
||||||
|
|
||||||
|
$filepath = $this->getUploadPath($filename);
|
||||||
|
$filetype = $this->getFileExtension($filename);
|
||||||
|
|
||||||
|
if (file_exists($filepath)) {
|
||||||
|
list($src_w, $src_h) = @getimagesize($filepath);
|
||||||
|
|
||||||
|
$dst_w = $src_w;
|
||||||
|
$dst_h = $src_h;
|
||||||
|
|
||||||
|
if (is_numeric($width) && $width > 0) {
|
||||||
|
$dst_w = $width;
|
||||||
|
$dst_h = $src_h / $src_w * $width;
|
||||||
|
}
|
||||||
|
|
||||||
|
$dst_path = $this->getUploadPath(md5($filename).'.'.$filetype);
|
||||||
|
|
||||||
|
$this->resizeImage($filepath, $dst_path, 0, 0, $dst_w, $dst_h, $src_w, $src_h);
|
||||||
|
|
||||||
|
if (in_array(abs($rotate), array(90, 180, 270))) {
|
||||||
|
$angle = ($rotate < 0) ? abs($rotate) : 360 - $rotate;
|
||||||
|
$this->rotateImage($dst_path, $angle);
|
||||||
|
}
|
||||||
|
$ext = pathinfo($dst_path, PATHINFO_EXTENSION);
|
||||||
|
|
||||||
|
switch( $ext ) {
|
||||||
|
case "gif": $ctype="image/gif"; break;
|
||||||
|
case "png": $ctype="image/png"; break;
|
||||||
|
case "jpeg":
|
||||||
|
case "jpg": $ctype="image/jpeg"; break;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
|
||||||
|
header('Content-type: ' . $ctype);
|
||||||
|
|
||||||
|
header('Content-Length: ' . filesize($dst_path));
|
||||||
|
readfile($dst_path);
|
||||||
|
@unlink($dst_path);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete action
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function deleteAction()
|
||||||
|
{
|
||||||
|
if (!isset($this->options['delete'])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$post=JFactory::getApplication()->input->post->getArray();
|
||||||
|
$filename = basename(@$post['file']);
|
||||||
|
$filepath = $this->getUploadPath($filename);
|
||||||
|
|
||||||
|
if (file_exists($filepath) && call_user_func($this->options['delete'], $filename, $this)) {
|
||||||
|
foreach ($this->options['versions'] as $version => $options) {
|
||||||
|
$name = $this->getVersionFilename($filename, $version);
|
||||||
|
$path = $this->getUploadPath($name, $version);
|
||||||
|
@unlink($path);
|
||||||
|
}
|
||||||
|
|
||||||
|
@unlink($filepath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Upload action.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function uploadAction()
|
||||||
|
{
|
||||||
|
$jform=JFactory::getApplication()->input->files->getArray();
|
||||||
|
$upload = isset($jform['file']) ? $jform['file'] : null;
|
||||||
|
|
||||||
|
$file = $this->handleFileUpload(
|
||||||
|
@$upload['tmp_name'],
|
||||||
|
@$upload['name'] == 'blob' ? md5(mt_rand()).'.jpg' : @$upload['name'],
|
||||||
|
@$upload['size'],
|
||||||
|
@$upload['error']
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->generateResponse($file);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle file upload.
|
||||||
|
*
|
||||||
|
* @param string $uploaded_file
|
||||||
|
* @param string $name
|
||||||
|
* @param integer $size
|
||||||
|
* @param integer $error
|
||||||
|
* @return stdClass
|
||||||
|
*/
|
||||||
|
protected function handleFileUpload($uploaded_file, $name, $size, $error)
|
||||||
|
{
|
||||||
|
$image = new stdClass();
|
||||||
|
$image->name = $this->getFilename($name);
|
||||||
|
$image->type = $this->getFileExtension($name);
|
||||||
|
$image->size = $this->fixIntOverflow(intval($size));
|
||||||
|
$image->path = $this->getUploadPath($image->name);
|
||||||
|
$image->url = $this->getUploadUrl($image->name);
|
||||||
|
list($image->width, $image->height) = @getimagesize($uploaded_file);
|
||||||
|
|
||||||
|
if (!$this->validate($uploaded_file, $image, $error)) {
|
||||||
|
return $image;
|
||||||
|
}
|
||||||
|
|
||||||
|
$upload_dir = $this->getUploadPath();
|
||||||
|
if (!is_dir($upload_dir)) {
|
||||||
|
mkdir($upload_dir, $this->options['mkdir_mode'], true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Upload start callback
|
||||||
|
if (isset($this->options['upload_start'])) {
|
||||||
|
call_user_func($this->options['upload_start'], $image, $this);
|
||||||
|
}
|
||||||
|
|
||||||
|
$image->path = $this->getUploadPath($image->name);
|
||||||
|
$image->url = $this->getUploadUrl($image->name);
|
||||||
|
|
||||||
|
if (!move_uploaded_file($uploaded_file, $image->path)) {
|
||||||
|
$image->error = $this->getErrorMessage('move_failed');
|
||||||
|
return $image;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Orient the image
|
||||||
|
if (!empty($this->options['auto_orient'])) {
|
||||||
|
$this->orientImage($image->path);
|
||||||
|
}
|
||||||
|
|
||||||
|
list($image->width, $image->height) = @getimagesize($image->path);
|
||||||
|
|
||||||
|
// Generate image versions
|
||||||
|
$image->versions = $this->generateVersions($image, true);
|
||||||
|
|
||||||
|
// Upload complete callback
|
||||||
|
if (isset($this->options['upload_complete'])) {
|
||||||
|
call_user_func($this->options['upload_complete'], $image, $this);
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($image->path);
|
||||||
|
|
||||||
|
return $image;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Crop action.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function cropAction()
|
||||||
|
{
|
||||||
|
$post=JFactory::getApplication()->input->post->getArray();
|
||||||
|
$filename = basename(@$post['image']);
|
||||||
|
$rotate = @$post['rotate'];
|
||||||
|
|
||||||
|
$image = new stdClass();
|
||||||
|
$image->name = $filename;
|
||||||
|
$image->type = $this->getFileExtension($image->name);
|
||||||
|
$image->path = $this->getUploadPath($image->name);
|
||||||
|
$image->url = $this->getUploadUrl($image->name);
|
||||||
|
|
||||||
|
if (!file_exists($image->path)) {
|
||||||
|
return $this->generateResponse(array('error'=>$this->getErrorMessage('not_exists')));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!preg_match('/.('.$this->options['accept_file_types'].')+$/i', $image->name)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
list($image->width, $image->height) = @getimagesize($image->path);
|
||||||
|
|
||||||
|
@list($src_x, $src_y, $x2, $y2, $src_w, $src_h) = @array_values(@$post['coords']);
|
||||||
|
|
||||||
|
if (isset($this->options['crop_start'])) {
|
||||||
|
call_user_func($this->options['crop_start'], $image, $this);
|
||||||
|
}
|
||||||
|
|
||||||
|
$image->url = $this->getUploadUrl($image->name);
|
||||||
|
|
||||||
|
if (empty($src_w) || empty($src_h)) {
|
||||||
|
$src_w = $image->width;
|
||||||
|
$src_h = $image->height;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($src_x) && empty($src_y)) {
|
||||||
|
$src_x = $src_y = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$dst_w = $src_w;
|
||||||
|
$dst_h = $src_h;
|
||||||
|
|
||||||
|
$tmp = clone $image;
|
||||||
|
$tmp->path = $this->getUploadPath(md5($tmp->name).'.'.$tmp->type);
|
||||||
|
|
||||||
|
@copy($image->path, $tmp->path);
|
||||||
|
|
||||||
|
if (in_array(abs($rotate), array(90, 180, 270))) {
|
||||||
|
$angle = ($rotate < 0) ? abs($rotate) : 360 - $rotate;
|
||||||
|
$this->rotateImage($tmp->path, $angle);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->resizeImage($tmp->path, null, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
|
||||||
|
|
||||||
|
list($tmp->width, $tmp->height) = @getimagesize($tmp->path);
|
||||||
|
|
||||||
|
$image->versions = $this->generateVersions($tmp);
|
||||||
|
|
||||||
|
@unlink($tmp->path);
|
||||||
|
|
||||||
|
if (!isset($this->options['versions'][''])) {
|
||||||
|
@rename($image->path, $this->getUploadPath($image->name));
|
||||||
|
}
|
||||||
|
|
||||||
|
list($image->width, $image->height) = @getimagesize($this->getUploadPath($image->name));
|
||||||
|
|
||||||
|
if ($image->path != $this->getUploadPath($image->name)) {
|
||||||
|
foreach ($this->options['versions'] as $version => $options) {
|
||||||
|
$filename = $this->getVersionFilename(basename($image->path), $version);
|
||||||
|
@unlink($this->getUploadPath($filename, $version));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Crop complete callback
|
||||||
|
if (isset($this->options['crop_complete'])) {
|
||||||
|
call_user_func($this->options['crop_complete'], $image, $this);
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($image->path);
|
||||||
|
|
||||||
|
// Generate json response
|
||||||
|
$this->generateResponse($image);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate image versions.
|
||||||
|
*
|
||||||
|
* @param stdClass $image
|
||||||
|
* @param bool $is_upload
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function generateVersions($image, $is_upload = false)
|
||||||
|
{
|
||||||
|
$versions = array();
|
||||||
|
foreach ($this->options['versions'] as $version => $options) {
|
||||||
|
$dst_w = $src_w = $image->width;
|
||||||
|
$dst_h = $src_h = $image->height;
|
||||||
|
$src_x = $src_y = 0;
|
||||||
|
|
||||||
|
$max_width = @$options['max_width'];
|
||||||
|
$max_height = @$options['max_height'];
|
||||||
|
$crop = isset($options['crop']) && $options['crop'] === true;
|
||||||
|
|
||||||
|
if ($crop) {
|
||||||
|
$min = min($src_w, $src_h);
|
||||||
|
$src_x = ($src_w - $min)/2;
|
||||||
|
$src_y = ($src_h - $min)/2;
|
||||||
|
$dst_w = $dst_h = $src_w = $src_h = $min;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($max_width) && $src_w > $max_width || ($src_w < $max_width && $crop)) {
|
||||||
|
$dst_w = $max_width;
|
||||||
|
$dst_h = $src_h / $src_w * $max_width;
|
||||||
|
} else if (!empty($max_height) && $src_h > $max_height || ($src_h < $max_height && $crop)) {
|
||||||
|
$dst_h = $max_height;
|
||||||
|
$dst_w = $src_w / $src_h * $max_height;
|
||||||
|
}
|
||||||
|
|
||||||
|
$filename = $this->getVersionFilename($image->name, $version);
|
||||||
|
$filepath = $this->getUploadPath($filename, $version);
|
||||||
|
$upload_dir = $this->getUploadPath('', $version);
|
||||||
|
|
||||||
|
if (!is_dir($upload_dir)) {
|
||||||
|
mkdir($upload_dir, $this->options['mkdir_mode'], true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$is_upload || ($is_upload && $version != '')) {
|
||||||
|
$success = $this->resizeImage($image->path, $filepath, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($success)) {
|
||||||
|
$versions[$version] = array(
|
||||||
|
'url' => $this->getUploadUrl($filename, $version),
|
||||||
|
'width' => $dst_w,
|
||||||
|
'height' => $dst_h
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $versions;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate uploaded file.
|
||||||
|
*
|
||||||
|
* @param string $uploaded_file
|
||||||
|
* @param stdClass $name
|
||||||
|
* @param string $error
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
protected function validate($uploaded_file, $file, $error)
|
||||||
|
{
|
||||||
|
if (!$uploaded_file) {
|
||||||
|
$file->error = $this->getErrorMessage(4);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($error) {
|
||||||
|
$file->error = $this->getErrorMessage($error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$content_length = $this->fixIntOverflow(intval($_SERVER['CONTENT_LENGTH']));
|
||||||
|
$post_max_size = $this->getConfigBytes(ini_get('post_max_size'));
|
||||||
|
|
||||||
|
if ($post_max_size && $content_length > $post_max_size) {
|
||||||
|
$file->error = $this->getErrorMessage('post_max_size');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->options['max_file_size'] && $file->size > $this->options['max_file_size']) {
|
||||||
|
$file->error = $this->getErrorMessage('max_file_size');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->options['min_file_size'] && $file->size < $this->options['min_file_size']) {
|
||||||
|
$file->error = $this->getErrorMessage('min_file_size');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!preg_match('/.('.$this->options['accept_file_types'].')+$/i', $file->name)) {
|
||||||
|
$file->error = $this->getErrorMessage('accept_file_types');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($file->width) || empty($file->height)) {
|
||||||
|
$file->error = $this->getErrorMessage('invalid_image');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$max_width = @$this->options['max_width'];
|
||||||
|
$max_height = @$this->options['max_height'];
|
||||||
|
$min_width = @$this->options['min_width'];
|
||||||
|
$min_height = @$this->options['min_height'];
|
||||||
|
|
||||||
|
if ($max_width || $max_height || $min_width || $min_height) {
|
||||||
|
if ($max_width && $file->width > $max_width) {
|
||||||
|
$file->error = $this->getErrorMessage('max_width').$max_width.'px';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($max_height && $file->height > $max_height) {
|
||||||
|
$file->error = $this->getErrorMessage('max_height').$max_height.'px';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($min_width && $file->width < $min_width) {
|
||||||
|
$file->error = $this->getErrorMessage('min_width').$min_width.'px';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($min_height && $file->height < $min_height) {
|
||||||
|
$file->error = $this->getErrorMessage('min_height').$min_height.'px';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get upload directory path.
|
||||||
|
*
|
||||||
|
* @param string $filename
|
||||||
|
* @param string $version
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getUploadPath($filename = '', $version = '')
|
||||||
|
{
|
||||||
|
$upload_dir = $this->options['upload_dir'];
|
||||||
|
|
||||||
|
if ($version != '') {
|
||||||
|
$dir = @$this->options['versions'][$version]['upload_dir'];
|
||||||
|
|
||||||
|
if (!empty($dir)) {
|
||||||
|
$upload_dir = $dir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $upload_dir . $filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get upload directory url.
|
||||||
|
*
|
||||||
|
* @param string $filename
|
||||||
|
* @param string $version
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getUploadUrl($filename = '', $version = '')
|
||||||
|
{
|
||||||
|
$upload_url = $this->options['upload_url'];
|
||||||
|
|
||||||
|
if ($version != '') {
|
||||||
|
$url = @$this->options['versions'][$version]['upload_url'];
|
||||||
|
|
||||||
|
if (!empty($url)) {
|
||||||
|
$upload_url = $url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $upload_url . $filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get full url.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function getFullUrl() {
|
||||||
|
$https = !empty($_SERVER['HTTPS']) && strcasecmp($_SERVER['HTTPS'], 'on') === 0;
|
||||||
|
|
||||||
|
return
|
||||||
|
($https ? 'https://' : 'http://').
|
||||||
|
(!empty($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'].'@' : '').
|
||||||
|
(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ($_SERVER['SERVER_NAME'].
|
||||||
|
($https && $_SERVER['SERVER_PORT'] === 443 ||
|
||||||
|
$_SERVER['SERVER_PORT'] === 80 ? '' : ':'.$_SERVER['SERVER_PORT']))).
|
||||||
|
substr($_SERVER['SCRIPT_NAME'],0, strrpos($_SERVER['SCRIPT_NAME'], '/'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get file name.
|
||||||
|
*
|
||||||
|
* @param string
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getFilename($name)
|
||||||
|
{
|
||||||
|
return $this->getUniqueFilename($name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get version name.
|
||||||
|
*
|
||||||
|
* @param string
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getVersionFilename($filename, $version)
|
||||||
|
{
|
||||||
|
$ext = $this->getFileExtension($filename);
|
||||||
|
|
||||||
|
if ($version == '') {
|
||||||
|
return $filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_replace('.'.$ext, "-$version.$ext", $filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get unique file name.
|
||||||
|
*
|
||||||
|
* @param string
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getUniqueFilename($name)
|
||||||
|
{
|
||||||
|
while (is_dir($this->getUploadPath($name))) {
|
||||||
|
$name = $this->upcountName($name);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (is_file($this->getUploadPath($name))) {
|
||||||
|
$name = $this->upcountName($name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get file extension.
|
||||||
|
*
|
||||||
|
* @param string $filename
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getFileExtension($filename)
|
||||||
|
{
|
||||||
|
return pathinfo(strtolower($filename), PATHINFO_EXTENSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate json response.
|
||||||
|
*
|
||||||
|
* @param mixed $response
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function generateResponse($response)
|
||||||
|
{
|
||||||
|
echo json_encode($response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get error message.
|
||||||
|
*
|
||||||
|
* @param string $error
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getErrorMessage($error)
|
||||||
|
{
|
||||||
|
return isset($this->errorMessages[$error]) ? $this->errorMessages[$error] : $error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resize image.
|
||||||
|
*
|
||||||
|
* @param string $src_path Source image path
|
||||||
|
* @param string|null $dst_path Destination image path
|
||||||
|
* @param integer $src_x x-coordinate of source point
|
||||||
|
* @param integer $src_y y-coordinate of source point
|
||||||
|
* @param integer $dst_w Destination width
|
||||||
|
* @param integer $dst_h Destination height
|
||||||
|
* @param integer $src_w Source width
|
||||||
|
* @param integer $src_h Source height
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function resizeImage($src_path, $dst_path = null, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h)
|
||||||
|
{
|
||||||
|
$src_x = ceil($src_x);
|
||||||
|
$src_y = ceil($src_y);
|
||||||
|
$dst_w = ceil($dst_w);
|
||||||
|
$dst_h = ceil($dst_h);
|
||||||
|
$src_w = ceil($src_w);
|
||||||
|
$src_h = ceil($src_h);
|
||||||
|
|
||||||
|
$dst_path = ($dst_path) ? $dst_path : $src_path;
|
||||||
|
$dst_image = imagecreatetruecolor($dst_w, $dst_h);
|
||||||
|
$extension = $this->getFileExtension($src_path);
|
||||||
|
|
||||||
|
if (!$dst_image) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($extension) {
|
||||||
|
case 'gif':
|
||||||
|
$src_image = imagecreatefromgif($src_path);
|
||||||
|
break;
|
||||||
|
case 'jpeg':
|
||||||
|
case 'jpg':
|
||||||
|
$src_image = imagecreatefromjpeg($src_path);
|
||||||
|
break;
|
||||||
|
case 'png':
|
||||||
|
imagealphablending($dst_image, false);
|
||||||
|
imagesavealpha($dst_image, true);
|
||||||
|
$src_image = imagecreatefrompng($src_path);
|
||||||
|
@imagealphablending($src_image, true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($src_image) && !$src_image) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!imagecopyresampled($dst_image, $src_image, 0, 0, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($extension) {
|
||||||
|
case 'gif':
|
||||||
|
return imagegif($dst_image, $dst_path);
|
||||||
|
break;
|
||||||
|
case 'jpeg':
|
||||||
|
case 'jpg':
|
||||||
|
return imagejpeg($dst_image, $dst_path);
|
||||||
|
break;
|
||||||
|
case 'png':
|
||||||
|
return imagepng($dst_image, $dst_path);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotate image.
|
||||||
|
*
|
||||||
|
* @param string $src_path
|
||||||
|
* @param integer $angle
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function rotateImage($src_path, $angle)
|
||||||
|
{
|
||||||
|
$type = $this->getFileExtension($src_path);
|
||||||
|
|
||||||
|
switch ($type) {
|
||||||
|
case 'gif':
|
||||||
|
$source = imagecreatefromgif($src_path);
|
||||||
|
break;
|
||||||
|
case 'jpeg':
|
||||||
|
case 'jpg':
|
||||||
|
$source = imagecreatefromjpeg($src_path);
|
||||||
|
break;
|
||||||
|
case 'png':
|
||||||
|
$source = imagecreatefrompng($src_path);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$image = imagerotate($source, $angle, 0);
|
||||||
|
|
||||||
|
switch ($type) {
|
||||||
|
case 'gif':
|
||||||
|
imagegif($image, $src_path);
|
||||||
|
break;
|
||||||
|
case 'jpeg':
|
||||||
|
case 'jpg':
|
||||||
|
imagejpeg($image, $src_path);
|
||||||
|
break;
|
||||||
|
case 'png':
|
||||||
|
imagepng($image, $src_path);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
imagedestroy($source);
|
||||||
|
imagedestroy($image);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Orient image based on EXIF orientation data.
|
||||||
|
*
|
||||||
|
* @param string $filepath
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function orientImage($filepath)
|
||||||
|
{
|
||||||
|
if (!preg_match('/\.(jpe?g)$/i', $filepath)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('exif_read_data')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$exif = @exif_read_data($filepath);
|
||||||
|
|
||||||
|
if (!empty($exif['Orientation'])) {
|
||||||
|
switch($exif['Orientation']) {
|
||||||
|
case 3: $angle = 180; break;
|
||||||
|
case 6: $angle = -90; break;
|
||||||
|
case 8: $angle = 90; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($angle)) {
|
||||||
|
$this->rotateImage($filepath, $angle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function upcountName($name)
|
||||||
|
{
|
||||||
|
return preg_replace_callback(
|
||||||
|
'/(?:(?: \(([\d]+)\))?(\.[^.]+))?$/',
|
||||||
|
array($this, 'upcountNameCallback'),
|
||||||
|
$name,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function upcountNameCallback($matches)
|
||||||
|
{
|
||||||
|
$index = isset($matches[1]) ? intval($matches[1]) + 1 : 1;
|
||||||
|
$ext = isset($matches[2]) ? $matches[2] : '';
|
||||||
|
|
||||||
|
return ' ('.$index.')'.$ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getConfigBytes($val)
|
||||||
|
{
|
||||||
|
$val = trim($val);
|
||||||
|
$last = strtolower($val[strlen($val)-1]);
|
||||||
|
|
||||||
|
switch ($last) {
|
||||||
|
case 'g':
|
||||||
|
$val *= 1024;
|
||||||
|
case 'm':
|
||||||
|
$val *= 1024;
|
||||||
|
case 'k':
|
||||||
|
$val *= 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->fixIntOverflow($val);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function fixIntOverflow($size)
|
||||||
|
{
|
||||||
|
if ($size < 0) {
|
||||||
|
$size += 2.0 * (PHP_INT_MAX + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $size;
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
692
deployed/jsn/administrator/components/com_jsn/config.xml
Normal file
692
deployed/jsn/administrator/components/com_jsn/config.xml
Normal file
@ -0,0 +1,692 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<config>
|
||||||
|
<fieldset
|
||||||
|
name="fieldlist"
|
||||||
|
label="COM_JSN_CONFIG_FIELD_SETTINGS_LABEL" addfieldpath="/administrator/components/com_jsn/models/fields">
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="download_id"
|
||||||
|
type="text"
|
||||||
|
label="COM_JSN_CONFIG_DOWNLOADID"
|
||||||
|
description="COM_JSN_CONFIG_DOWNLOADID_DESC"
|
||||||
|
default=""
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="logintype"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_LOGINTYPE"
|
||||||
|
description="COM_JSN_CONFIG_LOGINTYPE_DESC"
|
||||||
|
default="USERNAME"
|
||||||
|
>
|
||||||
|
<option value="USERNAME">COM_JSN_CONFIG_LOGINTYPE_USERNAME</option>
|
||||||
|
<option value="USERNAMEMAIL">COM_JSN_CONFIG_LOGINTYPE_USERNAMEMAIL</option>
|
||||||
|
<option value="MAIL">COM_JSN_CONFIG_LOGINTYPE_MAIL</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="status"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_STATUS"
|
||||||
|
description="COM_JSN_CONFIG_STATUS_DESC"
|
||||||
|
default="1"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="forcerequired"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_FORCEREQUIRED"
|
||||||
|
description="COM_JSN_CONFIG_FORCEREQUIRED_DESC"
|
||||||
|
default="0"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="admin_frontend"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_ADMINFRONTEND"
|
||||||
|
description="COM_JSN_CONFIG_ADMINFRONTEND_DESC"
|
||||||
|
default="0"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="admin_loginas"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_LOGINAS"
|
||||||
|
description="COM_JSN_CONFIG_LOGINAS_DESC"
|
||||||
|
default="1"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="firstLoginUrl"
|
||||||
|
type="menuitem"
|
||||||
|
disable="separator"
|
||||||
|
label="COM_JSN_CONFIG_FIRSTLOGINURL"
|
||||||
|
description="COM_JSN_CONFIG_FIRSTLOGINURL_DESC"
|
||||||
|
>
|
||||||
|
<option value="">JDEFAULT</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="loginUrl"
|
||||||
|
type="menuitem"
|
||||||
|
disable="separator"
|
||||||
|
label="COM_JSN_CONFIG_LOGINURL"
|
||||||
|
description="COM_JSN_CONFIG_LOGINURL_DESC"
|
||||||
|
>
|
||||||
|
<option value="">JDEFAULT</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="profileACL"
|
||||||
|
type="list"
|
||||||
|
label="COM_JSN_CONFIG_PROFILEACL"
|
||||||
|
description="COM_JSN_CONFIG_PROFILEACL_DESC"
|
||||||
|
default="2"
|
||||||
|
>
|
||||||
|
<option value="0">COM_JSN_PRIVATE</option>
|
||||||
|
<option value="1">COM_JSN_REGISTERED</option>
|
||||||
|
<option value="2">COM_JSN_PUBLIC</option>
|
||||||
|
<option value="3">COM_JSN_CUSTOMACCESS</option>
|
||||||
|
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="profileACLcustom"
|
||||||
|
type="accesslevel"
|
||||||
|
showon="profileACL:3"
|
||||||
|
label="COM_JSN_CONFIG_PROFILEACLCUSTOM"
|
||||||
|
description="COM_JSN_CONFIG_PROFILEACLCUSTOM_DESC"
|
||||||
|
>
|
||||||
|
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="sef_with"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_SEFWITH"
|
||||||
|
description="COM_JSN_CONFIG_SEFWITH_DESC"
|
||||||
|
default="username"
|
||||||
|
>
|
||||||
|
<option value="id">COM_JSN_CONFIG_SEFWITH_ID</option>
|
||||||
|
<option value="username">COM_JSN_CONFIG_SEFWITH_USERNAME</option>
|
||||||
|
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="googlemaps_apikey"
|
||||||
|
type="text"
|
||||||
|
label="COM_JSN_CONFIG_GOOGLEMAPSAPIKEY"
|
||||||
|
description="COM_JSN_CONFIG_GOOGLEMAPSAPIKEY_DESC"
|
||||||
|
default=""
|
||||||
|
/>
|
||||||
|
<field name="spmain2" label="COM_JSN_CONFIG_BACKENDEXPORT" type="spacer" />
|
||||||
|
<field name="export_all_fields"
|
||||||
|
description="COM_JSN_EXPORT_ALL_FIELDS_BACKEND_DESC"
|
||||||
|
label="COM_JSN_EXPORT_ALL_FIELDS_BACKEND"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
default="1"
|
||||||
|
>
|
||||||
|
<option value="1">JALL</option>
|
||||||
|
<option value="0">COM_JSN_SELECTEDFIELDS</option>
|
||||||
|
</field>
|
||||||
|
<field name="export_list_fields"
|
||||||
|
description="COM_JSN_EXPORT_LIST_FIELDS_BACKEND_DESC"
|
||||||
|
label="COM_JSN_EXPORT_LIST_FIELDS_BACKEND"
|
||||||
|
default=""
|
||||||
|
type="parent"
|
||||||
|
level="2"
|
||||||
|
table="jsn_fields"
|
||||||
|
multiple="true"
|
||||||
|
where="a.type NOT LIKE 'delimeter'"
|
||||||
|
field_id="alias"
|
||||||
|
showon="export_all_fields:0"
|
||||||
|
>
|
||||||
|
<option value="name">COM_JSN_FORMATNAME</option>
|
||||||
|
<option value="_system">COM_JSN_SYSTEMFIELDS</option>
|
||||||
|
<option value="groups">JLIB_RULES_GROUPS</option>
|
||||||
|
</field>
|
||||||
|
<field name="export_separator" type="text"
|
||||||
|
description="COM_JSN_EXPORT_SEPARATOR_DESC"
|
||||||
|
label="COM_JSN_EXPORT_SEPARATOR"
|
||||||
|
filter="raw"
|
||||||
|
default=";"
|
||||||
|
/>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset
|
||||||
|
name="corefield"
|
||||||
|
label="COM_JSN_CONFIG_CORE_FIELDS_LABEL">
|
||||||
|
|
||||||
|
<field name="spcorefields1" label="COM_JSN_CONFIG_AVATAR_TITLE" type="spacer" />
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="avatar"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_AVATAR"
|
||||||
|
description="COM_JSN_CONFIG_AVATAR_DESC"
|
||||||
|
default="1"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
<option value="2">Gravatar</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="avatarletters"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_AVATARLETTERS"
|
||||||
|
description="COM_JSN_CONFIG_AVATARLETTERS_DESC"
|
||||||
|
default="0"
|
||||||
|
showon="avatar:1"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="spcorefields0" label="COM_JSN_CONFIG_JOOMLA_NAME_TITLE" type="spacer" />
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="namestyle"
|
||||||
|
type="list"
|
||||||
|
label="COM_JSN_CONFIG_NAMESTYLE"
|
||||||
|
description="COM_JSN_CONFIG_NAMESTYLE_DESC"
|
||||||
|
default="FIRSTNAME_LASTNAME"
|
||||||
|
>
|
||||||
|
<option value="FIRSTNAME_LASTNAME">COM_JSN_CONFIG_NAMESTYLE_FIRSTNAME_LASTNAME</option>
|
||||||
|
<option value="FIRSTNAME_SECONDNAME_LASTNAME">COM_JSN_CONFIG_NAMESTYLE_FIRSTNAME_SECONDNAME_LASTNAME</option>
|
||||||
|
<option value="FIRSTNAME">COM_JSN_CONFIG_NAMESTYLE_FIRSTNAME</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="formatname"
|
||||||
|
type="list"
|
||||||
|
label="COM_JSN_CONFIG_FORMATNAME"
|
||||||
|
description="COM_JSN_CONFIG_FORMATNAME_DESC"
|
||||||
|
default="NAME"
|
||||||
|
>
|
||||||
|
<option value="NAME">COM_JSN_CONFIG_FORMATNAME_NAME</option>
|
||||||
|
<option value="USERNAME">COM_JSN_CONFIG_FORMATNAME_USERNAME</option>
|
||||||
|
<option value="NAMEUSERNAME">COM_JSN_CONFIG_FORMATNAME_NAMEUSERNAME</option>
|
||||||
|
<option value="USERNAMENAME">COM_JSN_CONFIG_FORMATNAME_USERNAMENAME</option>
|
||||||
|
<option value="CUSTOM">COM_JSN_CONFIG_FORMATNAME_CUSTOM</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="formatnamecustom"
|
||||||
|
type="text"
|
||||||
|
label="COM_JSN_CONFIG_FORMATNAMECUSTOM"
|
||||||
|
description="COM_JSN_CONFIG_FORMATNAMECUSTOM_DESC"
|
||||||
|
default="{firstname} {lastname}"
|
||||||
|
hint="{firstname} {lastname}"
|
||||||
|
showon="formatname:CUSTOM"
|
||||||
|
>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="spcorefields2" label="COM_JSN_CONFIG_JOOMLA_EMAIL_TITLE" type="spacer" />
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="confirmusermail"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_CONFIRMUSERMAIL"
|
||||||
|
description="COM_JSN_CONFIG_CONFIRMUSERMAIL_DESC"
|
||||||
|
default="0"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="activatenewmail"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_ACTIVATE_EMAIL_ONCHANGE"
|
||||||
|
description="COM_JSN_CONFIG_ACTIVATE_EMAIL_ONCHANGE_DESC"
|
||||||
|
default="0"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="spcorefields3" label="COM_JSN_CONFIG_JOOMLA_PASSWORD_TITLE" type="spacer" />
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="confirmuserpassword"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_CONFIRMUSERPASSWORD"
|
||||||
|
description="COM_JSN_CONFIG_CONFIRMUSERPASSWORD_DESC"
|
||||||
|
default="1"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="passwordstrengthmeter"
|
||||||
|
label="COM_JSN_CONFIG_PASSWORDSTRENGTHMETER"
|
||||||
|
description ="COM_JSN_CONFIG_PASSWORDSTRENGTHMETER_DESC"
|
||||||
|
class="btn-group"
|
||||||
|
type="radio"
|
||||||
|
default="0"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset
|
||||||
|
name="layout"
|
||||||
|
label="COM_JSM_CONFIG_LAYOUTOPTIONS"
|
||||||
|
>
|
||||||
|
<field name="splayout0" label="COM_JSM_CONFIG_LAYOUT_PROFILE" type="spacer" />
|
||||||
|
<field
|
||||||
|
name="hideempty"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_HIDEEMPTY"
|
||||||
|
description="COM_JSN_CONFIG_HIDEEMPTY_DESC"
|
||||||
|
default="0"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
</field>
|
||||||
|
<field
|
||||||
|
name="profile_fg_tabs"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_PROFILE_FG_TABS"
|
||||||
|
description="COM_JSN_CONFIG_PROFILE_FG_TABS_DESC"
|
||||||
|
default="1"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
</field>
|
||||||
|
<field
|
||||||
|
name="profile_contact_btn"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_PROFILE_CONTACT_BTN"
|
||||||
|
description="COM_JSN_CONFIG_PROFILE_CONTACT_BTN_DESC"
|
||||||
|
default="1"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
</field>
|
||||||
|
<field name="splayout1" label="COM_JSM_CONFIG_LAYOUT_FORMS" type="spacer" />
|
||||||
|
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="tabs"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_TABS"
|
||||||
|
description="COM_JSN_CONFIG_TABS_DESC"
|
||||||
|
default="2"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
<option value="2">COM_JSN_STEPBYSTEP</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="layout"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_LAYOUT"
|
||||||
|
description="COM_JSN_CONFIG_LAYOUT_DESC"
|
||||||
|
default="1"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="layout_width"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_LAYOUT_WIDTH"
|
||||||
|
description="COM_JSN_CONFIG_LAYOUT_WIDTH_DESC"
|
||||||
|
default="full"
|
||||||
|
>
|
||||||
|
<option value="full">COM_JSN_CONFIG_LAYOUT_WIDTH_FULL</option>
|
||||||
|
<option value="center">COM_JSN_CONFIG_LAYOUT_WIDTH_CENTER</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="layout_maxwidth"
|
||||||
|
type="text"
|
||||||
|
label="COM_JSN_CONFIG_LAYOUT_MAXWIDTH"
|
||||||
|
description="COM_JSN_CONFIG_LAYOUT_MAXWIDTH_DESC"
|
||||||
|
default="500"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="layout_form"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_LAYOUT_FORM"
|
||||||
|
description="COM_JSN_CONFIG_LAYOUT_FORM"
|
||||||
|
default="horizontal"
|
||||||
|
>
|
||||||
|
<option value="vertical">COM_JSN_CONFIG_LAYOUT_FORM_VERTICAL</option>
|
||||||
|
<option value="horizontal">COM_JSN_CONFIG_LAYOUT_FORM_HORIZONTAL</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
|
||||||
|
<field name="splayout2" label="COM_JSM_CONFIG_LAYOUT_GENERAL" type="spacer" />
|
||||||
|
<field
|
||||||
|
name="bootstrap"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_INCLUDE_BOOTSTRAP"
|
||||||
|
description="COM_JSN_INCLUDE_BOOTSTRAP_DESC"
|
||||||
|
default="0"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
</field>
|
||||||
|
<field
|
||||||
|
name="bootstrap_icons"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_INCLUDE_ICOMOON"
|
||||||
|
description="COM_JSN_INCLUDE_ICOMOON_DESC"
|
||||||
|
default="0"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset
|
||||||
|
name="socialconnect"
|
||||||
|
label="COM_JSM_CONFIG_SOCIALCONNECT"
|
||||||
|
>
|
||||||
|
<field name="sp0" label="COM_JSM_CONFIG_SOCIALCONNECT_GENERAL" type="spacer" />
|
||||||
|
<field
|
||||||
|
name="socialconnect_type"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_SOCIALCONNECTLOGINTYPE"
|
||||||
|
description="COM_JSN_CONFIG_SOCIALCONNECTLOGINTYPE_DESC"
|
||||||
|
default="popup"
|
||||||
|
>
|
||||||
|
<option value="popup">COM_JSN_CONFIG_SOCIALCONNECTLOGINTYPE_POPUP</option>
|
||||||
|
<option value="redirect">COM_JSN_CONFIG_SOCIALCONNECTLOGINTYPE_REDIRECT</option>
|
||||||
|
</field>
|
||||||
|
<field
|
||||||
|
name="socialconnect_profilelink"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_SOCIALCONNECTPROFILELINK"
|
||||||
|
description="COM_JSN_CONFIG_SOCIALCONNECTPROFILELINK_DESC"
|
||||||
|
default="1"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
</field>
|
||||||
|
<field
|
||||||
|
name="socialconnect_profilelink_btnicon"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_SOCIALCONNECTPROFILELINKICON"
|
||||||
|
description="COM_JSN_CONFIG_SOCIALCONNECTPROFILELINKICON_DESC"
|
||||||
|
default="0"
|
||||||
|
showon="socialconnect_profilelink:1"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="socialconnect_loginlink"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_SOCIALCONNECTLOGINLINK"
|
||||||
|
description="COM_JSN_CONFIG_SOCIALCONNECTLOGINLINK_DESC"
|
||||||
|
default="1"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="socialconnect_loginlink_btnicon"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_SOCIALCONNECTLOGINLINKICON"
|
||||||
|
description="COM_JSN_CONFIG_SOCIALCONNECTLOGINLINKICON_DESC"
|
||||||
|
default="0"
|
||||||
|
showon="socialconnect_loginlink:1"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
</field>
|
||||||
|
<field
|
||||||
|
name="socialconnect_confirmemail"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_SOCIALCONNECTEMAILACTIVATION"
|
||||||
|
description="COM_JSN_CONFIG_SOCIALCONNECTEMAILACTIVATION_DESC"
|
||||||
|
default="0"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
<option value="2">COM_JSN_CONFIG_SOCIALCONNECT_EMAILMANUALLY</option>
|
||||||
|
</field>
|
||||||
|
<field name="sp_everywhere" label="COM_JSM_CONFIG_SOCIALCONNECT_EVERYWHERE" type="spacer" />
|
||||||
|
<field
|
||||||
|
name="buttons_everywhere_tag"
|
||||||
|
type="text"
|
||||||
|
hint="COM_JSM_CONFIG_SOCIALCONNECT_EVERYWHERE_TAG_HINT"
|
||||||
|
label="COM_JSM_CONFIG_SOCIALCONNECT_EVERYWHERE_TAG"
|
||||||
|
description="COM_JSM_CONFIG_SOCIALCONNECT_EVERYWHERE_TAG_DESC"
|
||||||
|
default=""
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field name="sp1" label="COM_JSN_CONFIG_FACEBOOK" type="spacer" />
|
||||||
|
<field
|
||||||
|
name="facebook_enabled"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_FACEBOOKENABLE"
|
||||||
|
description="COM_JSN_CONFIG_FACEBOOKENABLE_DESC"
|
||||||
|
default="0"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
</field>
|
||||||
|
<field
|
||||||
|
name="facebook_application_id"
|
||||||
|
type="text"
|
||||||
|
label="COM_JSN_CONFIG_FACEBOOKAPPID"
|
||||||
|
description="COM_JSN_CONFIG_FACEBOOKAPPID_DESC"
|
||||||
|
default=""
|
||||||
|
showon="facebook_enabled:1"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
name="facebook_application_secret"
|
||||||
|
type="text"
|
||||||
|
label="COM_JSN_CONFIG_FACEBOOKAPPSECRET"
|
||||||
|
description="COM_JSN_CONFIG_FACEBOOKAPPSECRET_DESC"
|
||||||
|
default=""
|
||||||
|
showon="facebook_enabled:1"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
name="facebook_usergroups"
|
||||||
|
multiple="true"
|
||||||
|
type="usergroup"
|
||||||
|
label="COM_JSN_CONFIG_SC_USERGROUP"
|
||||||
|
description="COM_JSN_CONFIG_SC_USERGROUP_DESC"
|
||||||
|
default=""
|
||||||
|
showon="facebook_enabled:1"
|
||||||
|
/>
|
||||||
|
<field name="sp2" label="COM_JSN_CONFIG_TWITTER" type="spacer" />
|
||||||
|
<field
|
||||||
|
name="twitter_enabled"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_TWITTERENABLE"
|
||||||
|
description="COM_JSN_CONFIG_TWITTERENABLE_DESC"
|
||||||
|
default="0"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
</field>
|
||||||
|
<field
|
||||||
|
name="twitter_consumer_key"
|
||||||
|
type="text"
|
||||||
|
label="COM_JSN_CONFIG_TWITTERCONSUMERKEY"
|
||||||
|
description="COM_JSN_CONFIG_TWITTERCONSUMERKEY_DESC"
|
||||||
|
default=""
|
||||||
|
showon="twitter_enabled:1"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
name="twitter_consumer_secret"
|
||||||
|
type="text"
|
||||||
|
label="COM_JSN_CONFIG_TWITTERCONSUMERSECRET"
|
||||||
|
description="COM_JSN_CONFIG_TWITTERCONSUMERSECRET_DESC"
|
||||||
|
default=""
|
||||||
|
showon="twitter_enabled:1"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
name="twitter_usergroups"
|
||||||
|
multiple="true"
|
||||||
|
type="usergroup"
|
||||||
|
label="COM_JSN_CONFIG_SC_USERGROUP"
|
||||||
|
description="COM_JSN_CONFIG_SC_USERGROUP_DESC"
|
||||||
|
default=""
|
||||||
|
showon="twitter_enabled:1"
|
||||||
|
/>
|
||||||
|
<field name="sp3" label="COM_JSN_CONFIG_GOOGLE" type="spacer" />
|
||||||
|
<field
|
||||||
|
name="google_enabled"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_GOOGLEENABLE"
|
||||||
|
description="COM_JSN_CONFIG_GOOGLEENABLE_DESC"
|
||||||
|
default="0"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
</field>
|
||||||
|
<field
|
||||||
|
name="google_client_id"
|
||||||
|
type="text"
|
||||||
|
label="COM_JSN_CONFIG_GOOGLECLIENTID"
|
||||||
|
description="COM_JSN_CONFIG_GOOGLECLIENTID_DESC"
|
||||||
|
default=""
|
||||||
|
showon="google_enabled:1"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
name="google_client_secret"
|
||||||
|
type="text"
|
||||||
|
label="COM_JSN_CONFIG_GOOGLECLIENTSECRET"
|
||||||
|
description="COM_JSN_CONFIG_GOOGLECLIENTSECRET_DESC"
|
||||||
|
default=""
|
||||||
|
showon="google_enabled:1"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
name="google_api_key"
|
||||||
|
type="text"
|
||||||
|
label="COM_JSN_CONFIG_GOOGLEAPIKEY"
|
||||||
|
description="COM_JSN_CONFIG_GOOGLEAPIKEY_DESC"
|
||||||
|
default=""
|
||||||
|
showon="google_enabled:1"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
name="google_usergroups"
|
||||||
|
multiple="true"
|
||||||
|
type="usergroup"
|
||||||
|
label="COM_JSN_CONFIG_SC_USERGROUP"
|
||||||
|
description="COM_JSN_CONFIG_SC_USERGROUP_DESC"
|
||||||
|
default=""
|
||||||
|
showon="google_enabled:1"
|
||||||
|
/>
|
||||||
|
<field name="sp4" label="COM_JSN_CONFIG_LINKEDIN" type="spacer" />
|
||||||
|
<field
|
||||||
|
name="linkedin_enabled"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_LINKEDINENABLE"
|
||||||
|
description="COM_JSN_CONFIG_LINKEDINENABLE_DESC"
|
||||||
|
default="0"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
</field>
|
||||||
|
<field
|
||||||
|
name="linkedin_api_key"
|
||||||
|
type="text"
|
||||||
|
label="COM_JSN_CONFIG_LINKEDINAPIKEY"
|
||||||
|
description="COM_JSN_CONFIG_LINKEDINAPIKEY_DESC"
|
||||||
|
default=""
|
||||||
|
showon="linkedin_enabled:1"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
name="linkedin_secret_key"
|
||||||
|
type="text"
|
||||||
|
label="COM_JSN_CONFIG_LINKEDINSECRETKEY"
|
||||||
|
description="COM_JSN_CONFIG_LINKEDINSECRETKEY_DESC"
|
||||||
|
default=""
|
||||||
|
showon="linkedin_enabled:1"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
name="linkedin_usergroups"
|
||||||
|
multiple="true"
|
||||||
|
type="usergroup"
|
||||||
|
label="COM_JSN_CONFIG_SC_USERGROUP"
|
||||||
|
description="COM_JSN_CONFIG_SC_USERGROUP_DESC"
|
||||||
|
default=""
|
||||||
|
showon="linkedin_enabled:1"
|
||||||
|
/>
|
||||||
|
<field name="sp5" label="COM_JSN_CONFIG_INSTAGRAM" type="spacer" />
|
||||||
|
<field
|
||||||
|
name="instagram_enabled"
|
||||||
|
type="radio" class="btn-group"
|
||||||
|
label="COM_JSN_CONFIG_INSTAGRAMENABLE"
|
||||||
|
description="COM_JSN_CONFIG_INSTAGRAMENABLE_DESC"
|
||||||
|
default="0"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
</field>
|
||||||
|
<field
|
||||||
|
name="instagram_application_id"
|
||||||
|
type="text"
|
||||||
|
label="COM_JSN_CONFIG_INSTAGRAMCLIENTID"
|
||||||
|
description="COM_JSN_CONFIG_INSTAGRAMCLIENTID_DESC"
|
||||||
|
default=""
|
||||||
|
showon="instagram_enabled:1"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
name="instagram_application_secret"
|
||||||
|
type="text"
|
||||||
|
label="COM_JSN_CONFIG_INSTAGRAMCLIENTSECRET"
|
||||||
|
description="COM_JSN_CONFIG_INSTAGRAMCLIENTSECRET_DESC"
|
||||||
|
default=""
|
||||||
|
showon="instagram_enabled:1"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
name="instagram_usergroups"
|
||||||
|
multiple="true"
|
||||||
|
type="usergroup"
|
||||||
|
label="COM_JSN_CONFIG_SC_USERGROUP"
|
||||||
|
description="COM_JSN_CONFIG_SC_USERGROUP_DESC"
|
||||||
|
default=""
|
||||||
|
showon="instagram_enabled:1"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset
|
||||||
|
name="permissions"
|
||||||
|
label="JCONFIG_PERMISSIONS_LABEL"
|
||||||
|
description="JCONFIG_PERMISSIONS_DESC"
|
||||||
|
>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="rules"
|
||||||
|
type="rules"
|
||||||
|
label="JCONFIG_PERMISSIONS_LABEL"
|
||||||
|
filter="rules"
|
||||||
|
validate="rules"
|
||||||
|
component="com_jsn"
|
||||||
|
section="component" />
|
||||||
|
</fieldset>
|
||||||
|
</config>
|
||||||
152
deployed/jsn/administrator/components/com_jsn/controller.php
Normal file
152
deployed/jsn/administrator/components/com_jsn/controller.php
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
class JsnController extends JControllerLegacy
|
||||||
|
{
|
||||||
|
protected $default_view = 'fields';
|
||||||
|
/**
|
||||||
|
* Method to display a view.
|
||||||
|
*
|
||||||
|
* @param boolean $cachable If true, the view output will be cached
|
||||||
|
* @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
|
||||||
|
*
|
||||||
|
* @return JControllerLegacy This object to support chaining.
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
public function display($cachable = false, $urlparams = false)
|
||||||
|
{
|
||||||
|
require_once JPATH_COMPONENT.'/helpers/jsn.php';
|
||||||
|
|
||||||
|
$view = $this->input->get('view', 'fields');
|
||||||
|
$layout = $this->input->get('layout', 'default');
|
||||||
|
$id = $this->input->getInt('id');
|
||||||
|
|
||||||
|
// Check for edit form.
|
||||||
|
if ($view == 'field' && $layout == 'edit' && !$this->checkEditId('com_jsn.edit.field', $id))
|
||||||
|
{
|
||||||
|
// Somehow the person just went to the form - we don't allow that.
|
||||||
|
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
|
||||||
|
$this->setMessage($this->getError(), 'error');
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_jsn&view=fields', false));
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if($view == 'opField'){
|
||||||
|
foreach (glob(JPATH_ADMINISTRATOR . '/components/com_jsn/helpers/fields/*.php') as $filename) {
|
||||||
|
require_once $filename;
|
||||||
|
}
|
||||||
|
//$user=JsnHelper::getUser();
|
||||||
|
if(/*!$user->guest && */JFactory::getApplication()->input->get('type','')!=''){
|
||||||
|
$class='Jsn'.ucfirst(JFactory::getApplication()->input->get('type','')).'FieldHelper';
|
||||||
|
if(class_exists($class))
|
||||||
|
{
|
||||||
|
$class::operations();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
parent::display();
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function install()
|
||||||
|
{
|
||||||
|
$db=JFactory::getDbo();
|
||||||
|
$query=$db->getQuery(true);
|
||||||
|
$query->update('#__extensions')->set($db->quoteName('enabled').'=1')
|
||||||
|
->where($db->quoteName('element').' IN ('.
|
||||||
|
$db->quote('jsn_author').','.
|
||||||
|
$db->quote('jsn_auth').','.
|
||||||
|
$db->quote('jsn_system').','.
|
||||||
|
$db->quote('jsn_content').','.
|
||||||
|
$db->quote('jsn_users').','.
|
||||||
|
$db->quote('usergroups').','.
|
||||||
|
$db->quote('socialconnect').')');
|
||||||
|
$db->setQuery($query);
|
||||||
|
|
||||||
|
$result = $db->query();
|
||||||
|
$this->setMessage(JText::_('COM_JSN_INSTALL'));
|
||||||
|
$this->syncuserRun();
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_jsn&view=fields', false));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update()
|
||||||
|
{
|
||||||
|
$db=JFactory::getDbo();
|
||||||
|
$query=$db->getQuery(true);
|
||||||
|
$query->update('#__extensions')->set($db->quoteName('enabled').'=1')
|
||||||
|
->where($db->quoteName('element').' IN ('.
|
||||||
|
$db->quote('jsn_auth').','.
|
||||||
|
$db->quote('jsn_system').','.
|
||||||
|
$db->quote('jsn_content').','.
|
||||||
|
$db->quote('jsn_users').','.
|
||||||
|
$db->quote('usergroups').','.
|
||||||
|
$db->quote('socialconnect').')');
|
||||||
|
$db->setQuery($query);
|
||||||
|
|
||||||
|
$result = $db->query();
|
||||||
|
$this->setMessage(JText::_('COM_JSN_UPDATE'));
|
||||||
|
$this->syncuserRun();
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_jsn&view=fields', false));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function syncuser()
|
||||||
|
{
|
||||||
|
$this->syncuserRun();
|
||||||
|
$this->setMessage(JText::_('COM_JSN_SYNCUSER'));
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_jsn&view=fields', false));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function syncuserRun()
|
||||||
|
{
|
||||||
|
$config = JComponentHelper::getParams('com_jsn');
|
||||||
|
$namestyle=$config->get('namestyle','FIRSTNAME_LASTNAME');
|
||||||
|
|
||||||
|
$db=JFactory::getDbo();
|
||||||
|
$query=$db->getQuery(true);
|
||||||
|
$query->select('a.id,a.name,b.id as bid')->from('#__users as a')->join('left','#__jsn_users as b ON a.id=b.id');
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
$users=$db->loadObjectList();
|
||||||
|
|
||||||
|
|
||||||
|
foreach($users as $user){
|
||||||
|
if($user->bid==null || $user->bid==''){
|
||||||
|
$query=$db->getQuery(true);
|
||||||
|
$fields=array();
|
||||||
|
$values=array();
|
||||||
|
switch($namestyle){
|
||||||
|
case 'FIRSTNAME':
|
||||||
|
$fields[]=$db->quoteName('firstname');
|
||||||
|
$values[]=$db->quote($user->name);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$fields[]=$db->quoteName('firstname');
|
||||||
|
$fields[]=$db->quoteName('lastname');
|
||||||
|
$name=explode(' ',$user->name,2);
|
||||||
|
$values[]=$db->quote((isset($name[0]) ? $name[0] : ''));
|
||||||
|
$values[]=$db->quote((isset($name[1]) ? $name[1] : ''));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$query="INSERT INTO #__jsn_users(id,".implode(', ',$fields).") VALUES(".$user->id.", ".implode(', ',$values).")";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,82 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
class JsnControllerField extends JControllerForm
|
||||||
|
{
|
||||||
|
public function addgroup()
|
||||||
|
{
|
||||||
|
parent::add();
|
||||||
|
$this->setRedirect('index.php?option=com_jsn&view=field&layout=editgroup');
|
||||||
|
}
|
||||||
|
public function editgroup()
|
||||||
|
{
|
||||||
|
parent::edit();
|
||||||
|
$id=$this->input->get('id');
|
||||||
|
$this->setRedirect('index.php?option=com_jsn&view=field&layout=editgroup&id='.$id);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to check if you can add a new record.
|
||||||
|
*
|
||||||
|
* @param array $data An array of input data.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
protected function allowAdd($data = array())
|
||||||
|
{
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
return ($user->authorise('core.create', 'com_jsn'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to check if you can edit a record.
|
||||||
|
*
|
||||||
|
* @param array $data An array of input data.
|
||||||
|
* @param string $key The name of the key for the primary key.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
protected function allowEdit($data = array(), $key = 'id')
|
||||||
|
{
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
|
||||||
|
|
||||||
|
// Since there is no asset tracking and no categories, revert to the component permissions.
|
||||||
|
return parent::allowEdit($data, $key);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to run batch operations.
|
||||||
|
*
|
||||||
|
* @param object $model The model.
|
||||||
|
*
|
||||||
|
* @return boolean True if successful, false otherwise and internal error is set.
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
public function batch($model = null)
|
||||||
|
{
|
||||||
|
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||||
|
|
||||||
|
// Set the model
|
||||||
|
$model = $this->getModel('Field');
|
||||||
|
|
||||||
|
// Preset the redirect
|
||||||
|
$this->setRedirect('index.php?option=com_jsn&view=fields');
|
||||||
|
|
||||||
|
return parent::batch($model);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,290 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
class JsnControllerFields extends JControllerAdmin
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param array An optional associative array of configuration settings.
|
||||||
|
* @see JController
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
public function __construct($config = array())
|
||||||
|
{
|
||||||
|
parent::__construct($config);
|
||||||
|
|
||||||
|
$this->registerTask('unpublish', 'publish');
|
||||||
|
$this->registerTask('required_unpublish', 'required_publish');
|
||||||
|
$this->registerTask('profile_unpublish', 'profile_publish');
|
||||||
|
$this->registerTask('register_unpublish', 'register_publish');
|
||||||
|
$this->registerTask('search_unpublish', 'search_publish');
|
||||||
|
$this->registerTask('edit_unpublish', 'edit_publish');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function required_publish()
|
||||||
|
{
|
||||||
|
// Check for request forgeries.
|
||||||
|
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||||
|
|
||||||
|
$ids = $this->input->get('cid', array(), 'array');
|
||||||
|
$values = array('required_publish' => 1, 'required_unpublish' => 0);
|
||||||
|
$task = $this->getTask();
|
||||||
|
$value = JArrayHelper::getValue($values, $task, 0, 'int');
|
||||||
|
|
||||||
|
if (empty($ids))
|
||||||
|
{
|
||||||
|
JFactory::getApplication()->enqueueMessage(JText::_('COM_JSN_NO_FIELDS_SELECTED'));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Get the model.
|
||||||
|
$model = $this->getModel();
|
||||||
|
|
||||||
|
// Change the state of the records.
|
||||||
|
if (!$model->toggle($ids, $value, 'required'))
|
||||||
|
{
|
||||||
|
JFactory::getApplication()->enqueueMessage($model->getError());
|
||||||
|
} else {
|
||||||
|
if ($value == 1)
|
||||||
|
{
|
||||||
|
$ntext = 'COM_JSN_N_FIELDS_REQUIRED';
|
||||||
|
} else {
|
||||||
|
$ntext = 'COM_JSN_N_FIELDS_UNREQUIRED';
|
||||||
|
}
|
||||||
|
$this->setMessage(JText::plural($ntext, count($ids)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setRedirect('index.php?option=com_jsn&view=fields');
|
||||||
|
}
|
||||||
|
public function profile_publish()
|
||||||
|
{
|
||||||
|
// Check for request forgeries.
|
||||||
|
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||||
|
|
||||||
|
$ids = $this->input->get('cid', array(), 'array');
|
||||||
|
$values = array('profile_publish' => 1, 'profile_unpublish' => 0);
|
||||||
|
$task = $this->getTask();
|
||||||
|
$value = JArrayHelper::getValue($values, $task, 0, 'int');
|
||||||
|
|
||||||
|
if (empty($ids))
|
||||||
|
{
|
||||||
|
JFactory::getApplication()->enqueueMessage(JText::_('COM_JSN_NO_FIELDS_SELECTED'));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Get the model.
|
||||||
|
$model = $this->getModel();
|
||||||
|
|
||||||
|
// Change the state of the records.
|
||||||
|
if (!$model->toggle($ids, $value, 'profile'))
|
||||||
|
{
|
||||||
|
JFactory::getApplication()->enqueueMessage($model->getError());
|
||||||
|
} else {
|
||||||
|
if ($value == 1)
|
||||||
|
{
|
||||||
|
$ntext = 'COM_JSN_N_FIELDS_PROFILE';
|
||||||
|
} else {
|
||||||
|
$ntext = 'COM_JSN_N_FIELDS_UNPROFILE';
|
||||||
|
}
|
||||||
|
$this->setMessage(JText::plural($ntext, count($ids)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setRedirect('index.php?option=com_jsn&view=fields');
|
||||||
|
}
|
||||||
|
public function register_publish()
|
||||||
|
{
|
||||||
|
// Check for request forgeries.
|
||||||
|
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||||
|
|
||||||
|
$ids = $this->input->get('cid', array(), 'array');
|
||||||
|
$values = array('register_publish' => 1, 'register_unpublish' => 0);
|
||||||
|
$task = $this->getTask();
|
||||||
|
$value = JArrayHelper::getValue($values, $task, 0, 'int');
|
||||||
|
|
||||||
|
if (empty($ids))
|
||||||
|
{
|
||||||
|
JFactory::getApplication()->enqueueMessage(JText::_('COM_JSN_NO_FIELDS_SELECTED'));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Get the model.
|
||||||
|
$model = $this->getModel();
|
||||||
|
|
||||||
|
// Change the state of the records.
|
||||||
|
if (!$model->toggle($ids, $value, 'register'))
|
||||||
|
{
|
||||||
|
JFactory::getApplication()->enqueueMessage($model->getError());
|
||||||
|
} else {
|
||||||
|
if ($value == 1)
|
||||||
|
{
|
||||||
|
$ntext = 'COM_JSN_N_FIELDS_REGISTER';
|
||||||
|
} else {
|
||||||
|
$ntext = 'COM_JSN_N_FIELDS_UNREGISTER';
|
||||||
|
}
|
||||||
|
$this->setMessage(JText::plural($ntext, count($ids)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setRedirect('index.php?option=com_jsn&view=fields');
|
||||||
|
}
|
||||||
|
public function edit_publish()
|
||||||
|
{
|
||||||
|
// Check for request forgeries.
|
||||||
|
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||||
|
|
||||||
|
$ids = $this->input->get('cid', array(), 'array');
|
||||||
|
$values = array('edit_publish' => 1, 'edit_unpublish' => 0);
|
||||||
|
$task = $this->getTask();
|
||||||
|
$value = JArrayHelper::getValue($values, $task, 0, 'int');
|
||||||
|
|
||||||
|
if (empty($ids))
|
||||||
|
{
|
||||||
|
JFactory::getApplication()->enqueueMessage(JText::_('COM_JSN_NO_FIELDS_SELECTED'));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Get the model.
|
||||||
|
$model = $this->getModel();
|
||||||
|
|
||||||
|
// Change the state of the records.
|
||||||
|
if (!$model->toggle($ids, $value, 'edit'))
|
||||||
|
{
|
||||||
|
JFactory::getApplication()->enqueueMessage($model->getError());
|
||||||
|
} else {
|
||||||
|
if ($value == 1)
|
||||||
|
{
|
||||||
|
$ntext = 'COM_JSN_N_FIELDS_EDIT';
|
||||||
|
} else {
|
||||||
|
$ntext = 'COM_JSN_N_FIELDS_UNEDIT';
|
||||||
|
}
|
||||||
|
$this->setMessage(JText::plural($ntext, count($ids)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setRedirect('index.php?option=com_jsn&view=fields');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function search_publish()
|
||||||
|
{
|
||||||
|
// Check for request forgeries.
|
||||||
|
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||||
|
|
||||||
|
$ids = $this->input->get('cid', array(), 'array');
|
||||||
|
$values = array('search_publish' => 1, 'search_unpublish' => 0);
|
||||||
|
$task = $this->getTask();
|
||||||
|
$value = JArrayHelper::getValue($values, $task, 0, 'int');
|
||||||
|
|
||||||
|
if (empty($ids))
|
||||||
|
{
|
||||||
|
JFactory::getApplication()->enqueueMessage(JText::_('COM_JSN_NO_FIELDS_SELECTED'));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Get the model.
|
||||||
|
$model = $this->getModel();
|
||||||
|
|
||||||
|
// Change the state of the records.
|
||||||
|
if (!$model->toggle($ids, $value, 'search'))
|
||||||
|
{
|
||||||
|
JFactory::getApplication()->enqueueMessage($model->getError());
|
||||||
|
} else {
|
||||||
|
if ($value == 1)
|
||||||
|
{
|
||||||
|
$ntext = 'COM_JSN_N_FIELDS_SERCHABLE';
|
||||||
|
} else {
|
||||||
|
$ntext = 'COM_JSN_N_FIELDS_UNSERCHABLE';
|
||||||
|
}
|
||||||
|
$this->setMessage(JText::plural($ntext, count($ids)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setRedirect('index.php?option=com_jsn&view=fields');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Proxy for getModel
|
||||||
|
*
|
||||||
|
* @param string $name The model name. Optional.
|
||||||
|
* @param string $prefix The class prefix. Optional.
|
||||||
|
*
|
||||||
|
* @return JModelLegacy The model.
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
public function getModel($name = 'Field', $prefix = 'JsnModel', $config = array('ignore_request' => true))
|
||||||
|
{
|
||||||
|
$model = parent::getModel($name, $prefix, $config);
|
||||||
|
return $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rebuild the nested set tree.
|
||||||
|
*
|
||||||
|
* @return boolean False on failure or error, true on success.
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
public function rebuild()
|
||||||
|
{
|
||||||
|
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||||
|
|
||||||
|
$extension = $this->input->get('extension');
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_jsn&view=fields', false));
|
||||||
|
|
||||||
|
$model = $this->getModel();
|
||||||
|
|
||||||
|
if ($model->rebuild()) {
|
||||||
|
// Rebuild succeeded.
|
||||||
|
$this->setMessage(JText::_('COM_JSN_REBUILD_SUCCESS'));
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
// Rebuild failed.
|
||||||
|
$this->setMessage(JText::_('COM_JSN_REBUILD_FAILURE'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to save the submitted ordering values for records via AJAX.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 3.0
|
||||||
|
*/
|
||||||
|
public function saveOrderAjax()
|
||||||
|
{
|
||||||
|
// Get the input
|
||||||
|
$input = JFactory::getApplication()->input;
|
||||||
|
$pks = $input->post->get('cid', array(), 'array');
|
||||||
|
$order = $input->post->get('order', array(), 'array');
|
||||||
|
|
||||||
|
// Sanitize the input
|
||||||
|
JArrayHelper::toInteger($pks);
|
||||||
|
JArrayHelper::toInteger($order);
|
||||||
|
|
||||||
|
// Get the model
|
||||||
|
$model = $this->getModel();
|
||||||
|
|
||||||
|
// Save the ordering
|
||||||
|
$return = $model->saveorder($pks, $order);
|
||||||
|
|
||||||
|
if ($return)
|
||||||
|
{
|
||||||
|
echo "1";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close the application
|
||||||
|
JFactory::getApplication()->close();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
require_once(JPATH_COMPONENT . '/../com_users/controllers/user.php');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View class for a list of users.
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
class JsnControllerUser extends UsersControllerUser
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
require_once(JPATH_COMPONENT . '/../com_users/controllers/users.php');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View class for a list of users.
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
class JsnControllerUsers extends UsersControllerUsers
|
||||||
|
{
|
||||||
|
public function getModel($name = 'User', $prefix = 'JsnModel', $config = array('ignore_request' => true))
|
||||||
|
{
|
||||||
|
return parent::getModel($name, $prefix, $config);
|
||||||
|
}
|
||||||
|
}
|
||||||
14
deployed/jsn/administrator/components/com_jsn/defines.php
Normal file
14
deployed/jsn/administrator/components/com_jsn/defines.php
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
define('JSN_TYPE', 'basic');
|
||||||
|
|
||||||
|
define('JSN_ENV', true);
|
||||||
@ -0,0 +1,156 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
global $_FIELDTYPES;
|
||||||
|
$_FIELDTYPES['checkboxlist']='COM_JSN_FIELDTYPE_CHECKBOX';
|
||||||
|
|
||||||
|
class JsnCheckboxlistFieldHelper
|
||||||
|
{
|
||||||
|
public static function create($alias)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = "ALTER TABLE #__jsn_users ADD ".$db->quoteName($alias)." VARCHAR(255)";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function delete($alias)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = "ALTER TABLE #__jsn_users DROP COLUMN ".$db->quoteName($alias);
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getXml($item)
|
||||||
|
{
|
||||||
|
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
|
||||||
|
$hideTitle= ($item->params->get('hidetitle',0) && JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn') || ($item->params->get('hidetitleedit',0) && (JFactory::getApplication()->input->get('layout','')=='edit' || JFactory::getApplication()->input->get('view','')=='registration'));
|
||||||
|
if(JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn' && $item->params->get('titleprofile','')!='') $item->title=$item->params->get('titleprofile','');
|
||||||
|
$defaultvalue=($item->params->get('checkbox_defaultvalue','')!='' ? 'default="'.JsnHelper::xmlentities($item->params->get('checkbox_defaultvalue','')).'"' : '');//(isset($item->params['text_defaultvalue']) && $item->params['text_defaultvalue']!='' ? 'default="'.$item->params['text_defaultvalue'].'"' : '');
|
||||||
|
$inline=($item->params->get('checkbox_inline',0) ? 'optioninline="'.$item->params->get('checkbox_inline','').'"' : '');
|
||||||
|
|
||||||
|
if($item->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
elseif($item->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('view')!='registration' && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
else $readonly='';
|
||||||
|
|
||||||
|
$options=array();
|
||||||
|
$optTxt=explode("\n",$item->params->get('checkbox_options',''));
|
||||||
|
foreach($optTxt as $opt)
|
||||||
|
{
|
||||||
|
$opt=explode('|',$opt);
|
||||||
|
if(count($opt)==1) $options[]='<option value="'.trim(JsnHelper::xmlentities($opt[0])).'">'.trim(JsnHelper::xmlentities($opt[0])).'</option>';
|
||||||
|
if(count($opt)==2) $options[]='<option value="'.trim(JsnHelper::xmlentities($opt[0])).'">'.trim(JsnHelper::xmlentities($opt[1])).'</option>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$xml='';
|
||||||
|
|
||||||
|
$xml.='
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="'.$item->alias.'"
|
||||||
|
type="checkboxlist"
|
||||||
|
id="'.$item->alias.'"
|
||||||
|
inline="inline"
|
||||||
|
description="'.JsnHelper::xmlentities(($item->description)).'"
|
||||||
|
label="'.($hideTitle ? JsnHelper::xmlentities('<span class="no-title">'.JText::_($item->title).'</span>') : JsnHelper::xmlentities($item->title)).'"
|
||||||
|
'.$defaultvalue.'
|
||||||
|
'.$inline.'
|
||||||
|
'.$readonly.'
|
||||||
|
class="'.$item->params->get('field_cssclass','').'"
|
||||||
|
required="'.($item->required ? ($item->required==2 ? 'admin' : 'frontend' ) : 'false' ).'"
|
||||||
|
>
|
||||||
|
'.implode(' ',$options).'
|
||||||
|
</field>
|
||||||
|
';
|
||||||
|
return $xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function loadData($field, $user, &$data)
|
||||||
|
{
|
||||||
|
$alias=$field->alias;
|
||||||
|
if(isset($user->$alias)) $data->$alias=json_decode($user->$alias);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function storeData($field, $data, &$storeData)
|
||||||
|
{
|
||||||
|
//if($field->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) return;
|
||||||
|
//if($field->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('task')=='profile.save' && JFactory::getApplication()->isSite()) return;
|
||||||
|
$alias=$field->alias;
|
||||||
|
if(isset($data[$alias])) $storeData[$alias]=json_encode($data[$alias]);
|
||||||
|
else $storeData[$alias]='';
|
||||||
|
if($field->params->get('field_readonly','')=="1" && JFactory::getApplication()->isSite() && isset($storeData[$alias])) {unset($storeData[$alias]);}
|
||||||
|
if($field->params->get('field_readonly','')=="2" && JFactory::getApplication()->input->get->get('task','')=='profile.save' && JFactory::getApplication()->isSite() && isset($storeData[$alias])) {unset($storeData[$alias]);}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function checkboxlist($field)
|
||||||
|
{
|
||||||
|
$value=$field->__get('value');
|
||||||
|
if (empty($value) && (string) $value != '0')
|
||||||
|
{
|
||||||
|
return JHtml::_('users.value', $value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$options=$field->getOptions();
|
||||||
|
$result=array();
|
||||||
|
foreach($options as $option)
|
||||||
|
{
|
||||||
|
if(in_array($option->value,$value)) $result[]=JText::_($option->text);
|
||||||
|
}
|
||||||
|
return implode(', ',$result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchInput($field)
|
||||||
|
{
|
||||||
|
$selectedOptions=JFactory::getApplication()->input->get($field->alias,null,'raw');
|
||||||
|
$options=array();
|
||||||
|
$optTxt=explode("\n",$field->params->get('checkbox_options',''));
|
||||||
|
foreach($optTxt as $opt)
|
||||||
|
{
|
||||||
|
$opt=explode('|',$opt);
|
||||||
|
if(count($opt)==1) $options[]=JHtml::_('select.option', trim($opt[0]), JText::_(trim(htmlspecialchars($opt[0]))));
|
||||||
|
if(count($opt)==2) $options[]=JHtml::_('select.option', trim($opt[0]), JText::_(trim(htmlspecialchars($opt[1]))));
|
||||||
|
}
|
||||||
|
|
||||||
|
$return=JHtml::_('select.radiolist', $options, $field->alias.'[]', null, 'value', 'text', null, $field->alias);
|
||||||
|
$from=array('<div','</div>','type="radio"','class="radio"','class="controls"');
|
||||||
|
if($field->params->get('checkbox_inline',0)==0) $to=array('<fieldset class="checkboxes"','</fieldset>','type="checkbox"','class="checkbox"','id="jform_'.str_replace('-','_',$field->alias).'"');
|
||||||
|
else $to=array('<fieldset class="checkboxes"','</fieldset>','type="checkbox"','class="checkbox inline"','id="jform_'.str_replace('-','_',$field->alias).'"');
|
||||||
|
if($selectedOptions!=null)
|
||||||
|
{
|
||||||
|
foreach($selectedOptions as $selectedOption)
|
||||||
|
{
|
||||||
|
$from[]='value="'.$selectedOption.'"';
|
||||||
|
$to[]='value="'.$selectedOption.'" checked="checked"';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return str_replace($from,$to,$return);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchQuery($field, &$query)
|
||||||
|
{
|
||||||
|
$options=JFactory::getApplication()->input->get($field->alias,null,'raw');
|
||||||
|
$db=JFactory::getDbo();
|
||||||
|
|
||||||
|
$where='';
|
||||||
|
foreach($options as $option)
|
||||||
|
{
|
||||||
|
$where.='b.'.$db->quoteName($field->alias).' LIKE '.$db->quote('%"'.$option.'"%').' OR ';
|
||||||
|
}
|
||||||
|
$where=substr($where, 0,-4);
|
||||||
|
$query->where('('.$where.')');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<form>
|
||||||
|
<fields name="params">
|
||||||
|
<fieldset
|
||||||
|
name="checkboxlist"
|
||||||
|
label="COM_JSN_CHECKBOX_FIELDSET_LABEL"
|
||||||
|
>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="checkbox_defaultvalue"
|
||||||
|
label="COM_JSN_GENERAL_DEFAULTVALUE"
|
||||||
|
description ="COM_JSN_GENERAL_DEFAULTVALUE"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="checkbox_options"
|
||||||
|
label="COM_JSN_CHECKBOX_OPTIONS"
|
||||||
|
description ="COM_JSN_CHECKBOX_OPTIONS_DESC"
|
||||||
|
rows="10"
|
||||||
|
class="span6"
|
||||||
|
type="textarea"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="checkbox_inline"
|
||||||
|
label="COM_JSN_OPTIONS_INLINE"
|
||||||
|
description ="COM_JSN_OPTIONS_INLINE_DESC"
|
||||||
|
class="btn-group"
|
||||||
|
type="radio"
|
||||||
|
default="0"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
</form>
|
||||||
@ -0,0 +1,89 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
class JsnCoreFieldHelper
|
||||||
|
{
|
||||||
|
public static function create($alias)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function delete($alias)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getXml($item = null)
|
||||||
|
{
|
||||||
|
$config = JComponentHelper::getParams('com_jsn');
|
||||||
|
$xml='';
|
||||||
|
if(JFactory::getApplication()->isAdmin())
|
||||||
|
{
|
||||||
|
$xml='
|
||||||
|
<field name="name" type="hidden"
|
||||||
|
class="inputbox"
|
||||||
|
default="formatName"
|
||||||
|
/>';
|
||||||
|
if($config->get('facebook_enabled',0) || $config->get('twitter_enabled',0) || $config->get('google_enabled',0) || $config->get('linkedin_enabled',0) || $config->get('instagram_enabled',0)) {
|
||||||
|
$xml.='<field name="spconnect" label="<h4>SocialConnect</h4>" type="spacer" />';
|
||||||
|
if($config->get('facebook_enabled',0)) $xml.='<field name="facebook_id" type="text"
|
||||||
|
class="inputbox"
|
||||||
|
default=""
|
||||||
|
label="Facebook ID"
|
||||||
|
/>';
|
||||||
|
if($config->get('twitter_enabled',0)) $xml.='<field name="twitter_id" type="text"
|
||||||
|
class="inputbox"
|
||||||
|
default=""
|
||||||
|
label="Twitter ID"
|
||||||
|
/>';
|
||||||
|
if($config->get('google_enabled',0)) $xml.='<field name="google_id" type="text"
|
||||||
|
class="inputbox"
|
||||||
|
default=""
|
||||||
|
label="Google Plus ID"
|
||||||
|
/>';
|
||||||
|
if($config->get('linkedin_enabled',0)) $xml.='<field name="linkedin_id" type="text"
|
||||||
|
class="inputbox"
|
||||||
|
default=""
|
||||||
|
label="LinkedIn ID"
|
||||||
|
/>';
|
||||||
|
if($config->get('instagram_enabled',0)) $xml.='<field name="instagram_id" type="text"
|
||||||
|
class="inputbox"
|
||||||
|
default=""
|
||||||
|
label="Instagram ID"
|
||||||
|
/>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif(JFactory::getApplication()->input->get('view')=='registration')
|
||||||
|
{
|
||||||
|
$xml='
|
||||||
|
<field name="name" type="hidden"
|
||||||
|
class="inputbox"
|
||||||
|
default="formatName"
|
||||||
|
/>
|
||||||
|
';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$xml='
|
||||||
|
<field name="name" type="hidden"
|
||||||
|
class="inputbox"
|
||||||
|
/>
|
||||||
|
<field name="id" type="hidden"
|
||||||
|
filter="integer"
|
||||||
|
/>
|
||||||
|
';
|
||||||
|
}
|
||||||
|
return $xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,214 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
global $_FIELDTYPES;
|
||||||
|
$_FIELDTYPES['date']='COM_JSN_FIELDTYPE_DATE';
|
||||||
|
|
||||||
|
class JsnDateFieldHelper
|
||||||
|
{
|
||||||
|
public static function create($alias)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = "ALTER TABLE #__jsn_users ADD ".$db->quoteName($alias)." DATETIME DEFAULT NULL";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function delete($alias)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = "ALTER TABLE #__jsn_users DROP COLUMN ".$db->quoteName($alias);
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getXml($item)
|
||||||
|
{
|
||||||
|
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
|
||||||
|
$xml='';
|
||||||
|
$hideTitle= ($item->params->get('hidetitle',0) && JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn') || ($item->params->get('hidetitleedit',0) && (JFactory::getApplication()->input->get('layout','')=='edit' || JFactory::getApplication()->input->get('view','')=='registration'));
|
||||||
|
if(JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn' && $item->params->get('titleprofile','')!='') $item->title=$item->params->get('titleprofile','');
|
||||||
|
if($item->params->get('date_default','')!="") $default=date('Y-m-d',strtotime($item->params->get('date_default','')));
|
||||||
|
else $default="";
|
||||||
|
$placeholder=($item->params->get('date_placeholder','')!='' ? 'hint="'.JsnHelper::xmlentities($item->params->get('date_placeholder','')).'"' : 'hint="COM_JSN_CLICKONCALENDAR"');
|
||||||
|
$formformat=($item->params->get('date_formformat','')!='' ? 'formformat="'.JsnHelper::xmlentities($item->params->get('date_formformat','')).'"' : 'formformat="d MM yyyy"');
|
||||||
|
|
||||||
|
if($item->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) $readonly='readonlydate="true"';
|
||||||
|
elseif($item->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('view')!='registration' && JFactory::getApplication()->isSite()) $readonly='readonlydate="true"';
|
||||||
|
else $readonly='';
|
||||||
|
|
||||||
|
$xml='
|
||||||
|
<field
|
||||||
|
name="'.$item->alias.'"
|
||||||
|
type="date"
|
||||||
|
id="'.$item->alias.'"
|
||||||
|
label="'.($hideTitle ? JsnHelper::xmlentities('<span class="no-title">'.JText::_($item->title).'</span>') : JsnHelper::xmlentities($item->title)).'"
|
||||||
|
description="'.JsnHelper::xmlentities(($item->description)).'"
|
||||||
|
dateformat="'.$item->params->get('date_format','j F Y').'"
|
||||||
|
size="22"
|
||||||
|
datetype="'.$item->params->get('date_type',0).'"
|
||||||
|
default="'.$default.'"
|
||||||
|
required="'.($item->required ? ($item->required==2 ? 'admin' : 'frontend' ) : 'false' ).'"
|
||||||
|
readonly="true"
|
||||||
|
viewmode="'.$item->params->get('date_viewmode','days').'"
|
||||||
|
span="'.$item->params->get('date_span',0).'"
|
||||||
|
spanyear="'.$item->params->get('date_span_year',0).'"
|
||||||
|
spanmonth="'.$item->params->get('date_span_month',0).'"
|
||||||
|
spanday="'.$item->params->get('date_span_day',0).'"
|
||||||
|
'.$placeholder.'
|
||||||
|
'.$formformat.'
|
||||||
|
'.$readonly.'
|
||||||
|
class="'.$item->params->get('field_cssclass','').'"
|
||||||
|
/>
|
||||||
|
';
|
||||||
|
return $xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function loadData($field, $user, &$data)
|
||||||
|
{
|
||||||
|
$alias=$field->alias;
|
||||||
|
if(isset($user->$alias) && $user->$alias!='0000-00-00 00:00:00' && $user->$alias!='0000-00-00')
|
||||||
|
{
|
||||||
|
$date=new JDate($user->$alias);
|
||||||
|
$data->$alias=$date->toSql();
|
||||||
|
}
|
||||||
|
else $data->$alias='';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function storeData($field, $data, &$storeData)
|
||||||
|
{
|
||||||
|
//if($field->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) return;
|
||||||
|
//if($field->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('task')=='profile.save' && JFactory::getApplication()->isSite()) return;
|
||||||
|
$alias=$field->alias;
|
||||||
|
if(isset($data[$alias]) && $data[$alias]!='0000-00-00 00:00:00' && $data[$alias]!='0000-00-00')
|
||||||
|
{
|
||||||
|
if($data[$alias]=='')
|
||||||
|
$storeData[$alias]='';//'0000-00-00 00:00:00';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$p1 = strpos($data[$alias],'-');
|
||||||
|
$p2 = strrpos($data[$alias],'-');
|
||||||
|
if( $p1 == 4 && $p2 == 7 ) $storeData[$alias] = $data[$alias];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function date($field)
|
||||||
|
{
|
||||||
|
$value=$field->__get('value');
|
||||||
|
if (empty($value))
|
||||||
|
{
|
||||||
|
return JHtml::_('users.value', $value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($value != '0000-00-00 00:00:00' && $value != '0000-00-00')
|
||||||
|
return $field->getDate();
|
||||||
|
else
|
||||||
|
return JHtml::_('users.value', null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchInput($field)
|
||||||
|
{
|
||||||
|
if($field->params->get('date_type',0)!=1)
|
||||||
|
{
|
||||||
|
if(JText::_('COM_JSN_STARTMONDAY')=='1') $date_weekstart=' data-date-weekstart="1"';
|
||||||
|
else $date_weekstart='';
|
||||||
|
|
||||||
|
$doc=JFactory::getDocument();
|
||||||
|
JHtml::_('bootstrap.framework');
|
||||||
|
$doc->addScript(JURI::root().'components/com_jsn/assets/js/bootstrap-datepicker.min.js');
|
||||||
|
$doc->addStylesheet(JURI::root().'components/com_jsn/assets/css/datepicker.min.css');
|
||||||
|
$return=array();
|
||||||
|
$return[]='<input id="jform_'.str_replace('-','_',$field->alias).'" type="hidden" name="'.$field->alias.'" value="1" /><div class=""><div class="bsdatesearch">';
|
||||||
|
$return[]='<div'.$date_weekstart.' data-date-viewmode="'.$field->params->get('date_viewmode','days').'" data-date-format="'.JText::_('COM_JSN_DATE_INPUT_FORMAT').'" data-date="'.JFactory::getApplication()->input->get($field->alias.'_from','','raw').'" id="'.$field->alias.'_from" class="input-prepend date bsdate"><span class="btn btn-success"><i class="jsn-icon jsn-icon-calendar"></i></span><span class="btn btn-danger"><i class="jsn-icon jsn-icon-remove jsndateremove"></i></span><input placeholder="'.JText::_('COM_JSN_STARTDATE').'" type="text" readonly="readonly" value="'.JFactory::getApplication()->input->get($field->alias.'_from','','raw').'" name="'.$field->alias.'_from" /></div>';
|
||||||
|
$return[]='</div> <div class="bsdatesearch">';
|
||||||
|
$return[]='<div'.$date_weekstart.' data-date-viewmode="'.$field->params->get('date_viewmode','days').'" data-date-format="'.JText::_('COM_JSN_DATE_INPUT_FORMAT').'" data-date="'.JFactory::getApplication()->input->get($field->alias.'_to','','raw').'" id="'.$field->alias.'_to" class="input-prepend date bsdate"><span class="btn btn-success"><i class="jsn-icon jsn-icon-calendar"></i></span><span class="btn btn-danger"><i class="jsn-icon jsn-icon-remove jsndateremove"></i></span><input placeholder="'.JText::_('COM_JSN_ENDDATE').'" type="text" readonly="readonly" value="'.JFactory::getApplication()->input->get($field->alias.'_to','','raw').'" name="'.$field->alias.'_to" /></div>';
|
||||||
|
$return[]='</div><div class="bsdatesearchtip"><span class="label label-default">'.JText::_('COM_JSN_CHOOSEDATEINTERVAL').'</span></div></div>';
|
||||||
|
static $init=0;
|
||||||
|
if($init==0){
|
||||||
|
$script='
|
||||||
|
var DPGlobalDates = {
|
||||||
|
days: ["'.JText::_("SUNDAY").'", "'.JText::_("MONDAY").'", "'.JText::_("TUESDAY").'", "'.JText::_("WEDNESDAY").'", "'.JText::_("THURSDAY").'", "'.JText::_("FRIDAY").'", "'.JText::_("SATURDAY").'", "'.JText::_("SUNDAY").'"],
|
||||||
|
daysShort: ["'.JText::_("SUN").'", "'.JText::_("MON").'", "'.JText::_("TUE").'", "'.JText::_("WED").'", "'.JText::_("THU").'", "'.JText::_("FRI").'", "'.JText::_("SAT").'", "'.JText::_("SUN").'"],
|
||||||
|
daysMin: ["'.JText::_("SUN").'", "'.JText::_("MON").'", "'.JText::_("TUE").'", "'.JText::_("WED").'", "'.JText::_("THU").'", "'.JText::_("FRI").'", "'.JText::_("SAT").'", "'.JText::_("SUN").'"],
|
||||||
|
months: ["'.JText::_("JANUARY").'", "'.JText::_("FEBRUARY").'", "'.JText::_("MARCH").'", "'.JText::_("APRIL").'", "'.JText::_("MAY").'", "'.JText::_("JUNE").'", "'.JText::_("JULY").'", "'.JText::_("AUGUST").'", "'.JText::_("SEPTEMBER").'", "'.JText::_("OCTOBER").'", "'.JText::_("NOVEMBER").'", "'.JText::_("DECEMBER").'"],
|
||||||
|
monthsShort: ["'.JText::_("JANUARY_SHORT").'", "'.JText::_("FEBRUARY_SHORT").'", "'.JText::_("MARCH_SHORT").'", "'.JText::_("APRIL_SHORT").'", "'.JText::_("MAY_SHORT").'", "'.JText::_("JUNE_SHORT").'", "'.JText::_("JULY_SHORT").'", "'.JText::_("AUGUST_SHORT").'", "'.JText::_("SEPTEMBER_SHORT").'", "'.JText::_("OCTOBER_SHORT").'", "'.JText::_("NOVEMBER_SHORT").'", "'.JText::_("DECEMBER_SHORT").'"]
|
||||||
|
};
|
||||||
|
';
|
||||||
|
}
|
||||||
|
else $script='';
|
||||||
|
$init=1;
|
||||||
|
$script.='
|
||||||
|
jQuery(document).ready(function($){
|
||||||
|
var nowTemp = new Date();
|
||||||
|
var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0);
|
||||||
|
$("#'.$field->alias.'_from").jsndatepicker();
|
||||||
|
$("#'.$field->alias.'_to").jsndatepicker();
|
||||||
|
|
||||||
|
|
||||||
|
$("#'.$field->alias.'_from .jsndateremove").click(function(){
|
||||||
|
//'.$field->alias.'_from.setValue(newDate);
|
||||||
|
$("#'.$field->alias.'_from input").val("");
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
$("#'.$field->alias.'_to .jsndateremove").click(function(){
|
||||||
|
//'.$field->alias.'_to.setValue(newDate);
|
||||||
|
//$("#'.$field->alias.'_to").attr("data-date","");
|
||||||
|
$("#'.$field->alias.'_to input").val("");
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
';
|
||||||
|
$doc->addScriptDeclaration( $script );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$return=array();
|
||||||
|
$return[]='<input id="jform_'.str_replace('-','_',$field->alias).'" type="hidden" name="'.$field->alias.'" value="1" /><div class=""><div class="numericsearch">';
|
||||||
|
$return[]='<input min="0" type="number" placeholder="'.JText::_('COM_JSN_STARTAGE').'" name="'.$field->alias.'_from" value="'.JFactory::getApplication()->input->get($field->alias.'_from','','raw').'"/>';
|
||||||
|
$return[]='</div> <div class="numericsearch">';
|
||||||
|
$return[]='<input min="0" type="number" placeholder="'.JText::_('COM_JSN_ENDAGE').'" name="'.$field->alias.'_to" value="'.JFactory::getApplication()->input->get($field->alias.'_to','','raw').'"/>';
|
||||||
|
$return[]='</div><div class="numericsearchtip"><span class="label label-default">'.JText::_('COM_JSN_CHOOSEAGEINTERVAL').'</span></div></div>';
|
||||||
|
}
|
||||||
|
return implode('',$return);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchQuery($field, &$query)
|
||||||
|
{ if($field->params->get('date_type',0)!=1)
|
||||||
|
{
|
||||||
|
$date_from=new JDate(str_replace('/','-',JFactory::getApplication()->input->get($field->alias.'_from','','raw')));
|
||||||
|
$date_to=new JDate(str_replace('/','-',JFactory::getApplication()->input->get($field->alias.'_to','','raw')));
|
||||||
|
$db=JFactory::getDbo();
|
||||||
|
if(JFactory::getApplication()->input->get($field->alias.'_from','','raw')!='') $query->where('b.'.$db->quoteName($field->alias).' >= '.$db->quote($date_from->toSql()));
|
||||||
|
if(JFactory::getApplication()->input->get($field->alias.'_to','','raw')!='') $query->where('b.'.$db->quoteName($field->alias).' <= '.$db->quote($date_to->toSql()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(is_numeric(JFactory::getApplication()->input->get($field->alias.'_from','','raw')) && JFactory::getApplication()->input->get($field->alias.'_from','','raw')>0){
|
||||||
|
$date_from=date('Y-m-d',strtotime('-'.JFactory::getApplication()->input->get($field->alias.'_from','','raw').' years'));
|
||||||
|
$db=JFactory::getDbo();
|
||||||
|
$query->where('b.'.$db->quoteName($field->alias).' <= '.$db->quote($date_from));
|
||||||
|
}
|
||||||
|
else JFactory::getApplication()->input->set($field->alias.'_from','');
|
||||||
|
if(is_numeric(JFactory::getApplication()->input->get($field->alias.'_to','','raw')) && JFactory::getApplication()->input->get($field->alias.'_to','','raw')>0){
|
||||||
|
$date_to=date('Y-m-d',strtotime('-'.(JFactory::getApplication()->input->get($field->alias.'_to','','raw')+1).' years'));
|
||||||
|
$db=JFactory::getDbo();
|
||||||
|
$query->where('b.'.$db->quoteName($field->alias).' >= '.$db->quote($date_to));
|
||||||
|
}
|
||||||
|
else JFactory::getApplication()->input->set($field->alias.'_to','');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,131 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<form>
|
||||||
|
<fields name="params">
|
||||||
|
<fieldset
|
||||||
|
name="date"
|
||||||
|
label="COM_JSN_DATE_FIELDSET_LABEL"
|
||||||
|
>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="date_default"
|
||||||
|
label="COM_JSN_GENERAL_DEFAULTVALUE"
|
||||||
|
description ="COM_JSN_GENERAL_DEFAULTVALUE_DESC"
|
||||||
|
type="calendar"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="date_placeholder"
|
||||||
|
label="COM_JSN_GENERAL_PLACEHOLDER"
|
||||||
|
description ="COM_JSN_GENERAL_PLACEHOLDER_DESC"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="date_format"
|
||||||
|
label="COM_JSN_DATE_FORMAT"
|
||||||
|
description ="COM_JSN_DATE_FORMAT_DESC"
|
||||||
|
type="text"
|
||||||
|
default="j F Y"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="date_formformat"
|
||||||
|
label="COM_JSN_DATE_FORMFORMAT"
|
||||||
|
description ="COM_JSN_DATE_FORMFORMAT_DESC"
|
||||||
|
type="list"
|
||||||
|
default="d MM yyyy"
|
||||||
|
>
|
||||||
|
<option value="d MM yyyy">31 December 2010 (d mmmm yyyy)</option>
|
||||||
|
<option value="dd/mm/yyyy">31/12/2010 (dd/mm/yyyy)</option>
|
||||||
|
<option value="mm/dd/yyyy">12/31/2010 (mm/dd/yyyy)</option>
|
||||||
|
<option value="yyyy/mm/dd">2010/12/31 (yyyy/mm/dd)</option>
|
||||||
|
<option value="dd-mm-yyyy">31-12-2010 (dd-mm-yyyy)</option>
|
||||||
|
<option value="mm-dd-yyyy">12-31-2010 (mm-dd-yyyy)</option>
|
||||||
|
<option value="yyyy-mm-dd">2010-12-31 (yyyy-mm-dd)</option>
|
||||||
|
<option value="dd.mm.yyyy">31.12.2010 (dd.mm.yyyy)</option>
|
||||||
|
<option value="mm.dd.yyyy">12.31.2010 (mm.dd.yyyy)</option>
|
||||||
|
<option value="yyyy.mm.dd">2010.12.31 (yyyy.mm.dd)</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="date_type"
|
||||||
|
label="COM_JSN_DATE_TYPE"
|
||||||
|
description ="COM_JSN_DATE_TYPE_DESC"
|
||||||
|
type="list"
|
||||||
|
filter="int"
|
||||||
|
default="0"
|
||||||
|
>
|
||||||
|
<option value="0">COM_JSN_DATE_DATE</option>
|
||||||
|
<option value="1">COM_JSN_DATE_AGE</option>
|
||||||
|
<option value="2">COM_JSN_DATE_YEARSAGO</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="date_viewmode"
|
||||||
|
label="COM_JSN_DATE_VIEWMODE"
|
||||||
|
description ="COM_JSN_DATE_VIEWMODE_DESC"
|
||||||
|
type="list"
|
||||||
|
filter="string"
|
||||||
|
default="days"
|
||||||
|
>
|
||||||
|
<option value="days">COM_JSN_DATE_VIEWMODE_DAY</option>
|
||||||
|
<option value="months">COM_JSN_DATE_VIEWMODE_MONTH</option>
|
||||||
|
<option value="years">COM_JSN_DATE_VIEWMODE_YEAR</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="date_span"
|
||||||
|
label="COM_JSN_DATE_SPAN"
|
||||||
|
description ="COM_JSN_DATE_SPAN_DESC"
|
||||||
|
type="list"
|
||||||
|
filter="int"
|
||||||
|
default="0"
|
||||||
|
>
|
||||||
|
<option value="0">COM_JSN_DATE_ALLDATE</option>
|
||||||
|
<option value="1">COM_JSN_DATE_PAST</option>
|
||||||
|
<option value="2">COM_JSN_DATE_FUTURE</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="date_span_year"
|
||||||
|
label="COM_JSN_DATE_SPAN_YEAR"
|
||||||
|
description ="COM_JSN_DATE_SPAN_YEAR_DESC"
|
||||||
|
type="text"
|
||||||
|
filter="int"
|
||||||
|
default="0"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="date_span_month"
|
||||||
|
label="COM_JSN_DATE_SPAN_MONTH"
|
||||||
|
description ="COM_JSN_DATE_SPAN_MONTH_DESC"
|
||||||
|
type="text"
|
||||||
|
filter="int"
|
||||||
|
default="0"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="date_span_day"
|
||||||
|
label="COM_JSN_DATE_SPAN_DAY"
|
||||||
|
description ="COM_JSN_DATE_SPAN_DAY_DESC"
|
||||||
|
type="text"
|
||||||
|
filter="int"
|
||||||
|
default="0"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- <field
|
||||||
|
name="text_filter"
|
||||||
|
label="COM_JSN_TEXT_FILTER"
|
||||||
|
description ="COM_JSN_TEXT_FILTER_DESC"
|
||||||
|
type="list"
|
||||||
|
default="text"
|
||||||
|
>
|
||||||
|
<option value="string">COM_JSN_TEXT_FILTER_TEXT</option>
|
||||||
|
<option value="email">COM_JSN_TEXT_FILTER_EMAIL</option>
|
||||||
|
<option value="tel">COM_JSN_TEXT_FILTER_PHONE</option>
|
||||||
|
<option value="int">COM_JSN_TEXT_FILTER_INT</option>
|
||||||
|
</field> -->
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
</form>
|
||||||
@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
global $_FIELDTYPES;
|
||||||
|
$_FIELDTYPES['delimeter']='COM_JSN_FIELDTYPE_DELIMETER';
|
||||||
|
|
||||||
|
class JsnDelimeterFieldHelper
|
||||||
|
{
|
||||||
|
public static function create($alias)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function delete($alias)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getXml($item)
|
||||||
|
{
|
||||||
|
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
|
||||||
|
$hideTitle= ($item->params->get('hidetitle',0) && JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn') || ($item->params->get('hidetitleedit',0) && (JFactory::getApplication()->input->get('layout','')=='edit' || JFactory::getApplication()->input->get('view','')=='registration'));
|
||||||
|
if(JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn' && $item->params->get('titleprofile','')!='') $item->title=$item->params->get('titleprofile','');
|
||||||
|
$xml='
|
||||||
|
<field
|
||||||
|
name="'.$item->alias.'"
|
||||||
|
type="delimeter"
|
||||||
|
id="'.$item->alias.'"
|
||||||
|
text="'.JsnHelper::xmlentities($item->description).'"
|
||||||
|
label="'.($hideTitle ? JsnHelper::xmlentities('<span class="no-title">'.JText::_($item->title).'</span>') : JsnHelper::xmlentities($item->title)).'"
|
||||||
|
class="'.$item->params->get('field_cssclass','').'"
|
||||||
|
/>
|
||||||
|
';
|
||||||
|
return $xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function loadData($field, $user, &$data)
|
||||||
|
{
|
||||||
|
$alias=$field->alias;
|
||||||
|
$data->$alias=$field->description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function storeData($field, $data, &$storeData)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function delimeter($field)
|
||||||
|
{
|
||||||
|
$value=$field->__get('value');
|
||||||
|
if (empty($value))
|
||||||
|
{
|
||||||
|
return JHtml::_('users.value', $value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//if(JText::_(strip_tags($value)) != strip_tags($value)) $value=JText::_(strip_tags($value));
|
||||||
|
if(substr_count($value,'<p>')==1 && substr_count($value,' ')==0) $value=JText::_(strip_tags($value));
|
||||||
|
JPluginHelper::importPlugin('content');
|
||||||
|
return JHtml::_('content.prepare', $value, '', 'jsn_content.content');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,116 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
global $_FIELDTYPES;
|
||||||
|
$_FIELDTYPES['email']='COM_JSN_FIELDTYPE_EMAIL';
|
||||||
|
|
||||||
|
class JsnEmailFieldHelper
|
||||||
|
{
|
||||||
|
public static function create($alias)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = "ALTER TABLE #__jsn_users ADD ".$db->quoteName($alias)." VARCHAR(255)";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function delete($alias)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = "ALTER TABLE #__jsn_users DROP COLUMN ".$db->quoteName($alias);
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getXml($item)
|
||||||
|
{
|
||||||
|
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
|
||||||
|
$hideTitle= ($item->params->get('hidetitle',0) && JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn') || ($item->params->get('hidetitleedit',0) && (JFactory::getApplication()->input->get('layout','')=='edit' || JFactory::getApplication()->input->get('view','')=='registration'));
|
||||||
|
if(JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn' && $item->params->get('titleprofile','')!='') $item->title=$item->params->get('titleprofile','');
|
||||||
|
$defaultvalue=($item->params->get('email_defaultvalue','')!='' ? 'default="'.JsnHelper::xmlentities($item->params->get('email_defaultvalue','')).'"' : '');
|
||||||
|
$maxlength=($item->params->get('text_maxlength','')!='' ? 'maxlength="'.$item->params->get('text_maxlength','').'"' : '');
|
||||||
|
$placeholder=($item->params->get('email_placeholder','')!='' ? 'hint="'.JsnHelper::xmlentities($item->params->get('email_placeholder','')).'"' : '');
|
||||||
|
|
||||||
|
if($item->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
elseif($item->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('view')!='registration' && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
else $readonly='';
|
||||||
|
|
||||||
|
$filter='string';
|
||||||
|
$type='emailfull';
|
||||||
|
|
||||||
|
$xml='';
|
||||||
|
|
||||||
|
$xml.='
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="'.$item->alias.'"
|
||||||
|
type="'.$type.'"
|
||||||
|
validate="email"
|
||||||
|
|
||||||
|
id="'.$item->alias.'"
|
||||||
|
description="'.JsnHelper::xmlentities(($item->description)).'"
|
||||||
|
filter="'.$filter.'"
|
||||||
|
label="'.($hideTitle ? JsnHelper::xmlentities('<span class="no-title">'.JText::_($item->title).'</span>') : JsnHelper::xmlentities($item->title)).'"
|
||||||
|
size="30"
|
||||||
|
'.$defaultvalue.'
|
||||||
|
'.$maxlength.'
|
||||||
|
'.$placeholder.'
|
||||||
|
'.$readonly.'
|
||||||
|
class="'.$item->params->get('field_cssclass','').'"
|
||||||
|
required="'.($item->required ? ($item->required==2 ? 'admin' : 'frontend' ) : 'false' ).'"
|
||||||
|
/>
|
||||||
|
';
|
||||||
|
return $xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function loadData($field, $user, &$data)
|
||||||
|
{
|
||||||
|
$alias=$field->alias;
|
||||||
|
if(isset($user->$alias)) $data->$alias=$user->$alias;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function storeData($field, $data, &$storeData)
|
||||||
|
{
|
||||||
|
//if($field->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) return;
|
||||||
|
//if($field->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('task')=='profile.save' && JFactory::getApplication()->isSite()) return;
|
||||||
|
$alias=$field->alias;
|
||||||
|
if(isset($data[$alias])) $storeData[$alias]=$data[$alias];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function email($field)
|
||||||
|
{
|
||||||
|
$value=$field->__get('value');
|
||||||
|
if (empty($value))
|
||||||
|
{
|
||||||
|
return JHtml::_('users.value', $value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
JPluginHelper::importPlugin('content');
|
||||||
|
return JHtml::_('content.prepare', '<a href="mailto:'.$value.'">'.$value.'</a>', '', 'jsn_content.content');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchInput($field)
|
||||||
|
{
|
||||||
|
$return='<input id="jform_'.str_replace('-','_',$field->alias).'" type="text" placeholder="'.JText::_('COM_JSN_SEARCHFOR').' '.JText::_($field->title).'..." name="'.$field->alias.'" value="'.JFactory::getApplication()->input->get($field->alias,'','raw').'"/>';
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchQuery($field, &$query)
|
||||||
|
{
|
||||||
|
$db=JFactory::getDbo();
|
||||||
|
$query->where('b.'.$db->quoteName($field->alias).' LIKE '.$db->quote('%'.JFactory::getApplication()->input->get($field->alias,null,'raw').'%'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<form>
|
||||||
|
<fields name="params">
|
||||||
|
<fieldset
|
||||||
|
name="email"
|
||||||
|
label="COM_JSN_EMAIL_FIELDSET_LABEL"
|
||||||
|
>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="email_defaultvalue"
|
||||||
|
label="COM_JSN_GENERAL_DEFAULTVALUE"
|
||||||
|
description ="COM_JSN_GENERAL_DEFAULTVALUE_DESC"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="email_placeholder"
|
||||||
|
label="COM_JSN_GENERAL_PLACEHOLDER"
|
||||||
|
description ="COM_JSN_GENERAL_PLACEHOLDER_DESC"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
</form>
|
||||||
@ -0,0 +1,139 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
global $_FIELDTYPES;
|
||||||
|
$_FIELDTYPES['filetype']='COM_JSN_FIELDTYPE_FILETYPE';
|
||||||
|
|
||||||
|
class JsnFiletypeFieldHelper
|
||||||
|
{
|
||||||
|
public static function create($alias)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = "ALTER TABLE #__jsn_users ADD ".$db->quoteName($alias)." VARCHAR(255)";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function delete($alias)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = "ALTER TABLE #__jsn_users DROP COLUMN ".$db->quoteName($alias);
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getXml($item)
|
||||||
|
{
|
||||||
|
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
|
||||||
|
$hideTitle= ($item->params->get('hidetitle',0) && JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn') || ($item->params->get('hidetitleedit',0) && (JFactory::getApplication()->input->get('layout','')=='edit' || JFactory::getApplication()->input->get('view','')=='registration'));
|
||||||
|
if(JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn' && $item->params->get('titleprofile','')!='') $item->title=$item->params->get('titleprofile','');
|
||||||
|
$defaultvalue='';//($item->params->get('image_defaultvalue','')!='' ? 'default="'.JsnHelper::xmlentities($item->params->get('image_defaultvalue','')).'"' : '');//(isset($item->params['image_defaultvalue']) && $item->params['image_defaultvalue']!='' ? 'default="'.$item->params['image_defaultvalue'].'"' : '');
|
||||||
|
|
||||||
|
if($item->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
elseif($item->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('view')!='registration' && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
else $readonly='';
|
||||||
|
|
||||||
|
$xml='
|
||||||
|
<field
|
||||||
|
name="'.$item->alias.'"
|
||||||
|
type="filetype"
|
||||||
|
downloadtext="'.($item->params->get('filetype_label','')=='' ? 'Download' : JsnHelper::xmlentities($item->params->get('filetype_label','')) ).'"
|
||||||
|
id="'.$item->alias.'"
|
||||||
|
class="'.$item->alias.' '.$item->params->get('field_cssclass','').'"
|
||||||
|
description="'.JsnHelper::xmlentities(($item->description)).'"
|
||||||
|
label="'.($hideTitle ? JsnHelper::xmlentities('<span class="no-title">'.JText::_($item->title).'</span>') : JsnHelper::xmlentities($item->title)).'"
|
||||||
|
required="'.($item->required && JFactory::getApplication()->input->get('jform',null,'array')==null ? ($item->required==2 ? 'admin' : 'frontend' ) : 'false' ).'"
|
||||||
|
requiredfile="'.($item->required ? ($item->required==2 ? 'admin' : 'frontend' ) : 'false' ).'"
|
||||||
|
validate="filetype"
|
||||||
|
'.$readonly.'
|
||||||
|
mime="'.$item->params->get('filetype_ext','pdf|zip|doc|docx').'"
|
||||||
|
/>
|
||||||
|
';
|
||||||
|
return $xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function loadData($field, $user, &$data)
|
||||||
|
{
|
||||||
|
$alias=$field->alias;
|
||||||
|
if(isset($user->$alias) && $user->$alias!='' && file_exists(JPATH_SITE.'/'.$user->$alias))
|
||||||
|
{
|
||||||
|
$data->$alias=$user->$alias;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function storeData($field, $data, &$storeData)
|
||||||
|
{
|
||||||
|
//if($field->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) return;
|
||||||
|
//if($field->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('task')=='profile.save' && JFactory::getApplication()->isSite()) return;
|
||||||
|
$upload_path=$field->params->get('filetype_path','images/profiler/');
|
||||||
|
|
||||||
|
// Set Upload Dir
|
||||||
|
$upload_dir=JPATH_SITE.'/'.$upload_path;
|
||||||
|
if(!file_exists($upload_dir))
|
||||||
|
{
|
||||||
|
mkdir($upload_dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get Alias
|
||||||
|
$alias=$field->alias;
|
||||||
|
if(isset($data[$alias])) $storeData[$alias]=$data[$alias];
|
||||||
|
|
||||||
|
// Delete Image
|
||||||
|
$jform=JFactory::getApplication()->input->post->getArray();
|
||||||
|
if(isset($jform['jform'][$field->alias.'_delete']))
|
||||||
|
{
|
||||||
|
// Delete old file
|
||||||
|
foreach (glob($upload_dir.$alias.$data['id'].'*') as $deletefile)
|
||||||
|
{
|
||||||
|
unlink($deletefile);
|
||||||
|
}
|
||||||
|
|
||||||
|
$storeData[$alias]='';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$jform=JFactory::getApplication()->input->files->get('jform',null,'raw');
|
||||||
|
if(isset($jform['upload_'.$alias])) $jform_file=$jform['upload_'.$alias];
|
||||||
|
if(isset($jform_file['name']) && strlen($jform_file['name'])>4)
|
||||||
|
{
|
||||||
|
foreach (glob($upload_dir.$alias.$data['id'].'*') as $deletefile)
|
||||||
|
{
|
||||||
|
unlink($deletefile);
|
||||||
|
}
|
||||||
|
$md5=md5(time().rand());
|
||||||
|
$filename=$alias.$data['id'].'_'.$md5;
|
||||||
|
$name=$jform_file['name'];
|
||||||
|
$ext = strtolower($name[strlen($name)-4].$name[strlen($name)-3].$name[strlen($name)-2].$name[strlen($name)-1]);
|
||||||
|
if ($ext[0] == '.') $ext = substr($ext, 1, 3);
|
||||||
|
move_uploaded_file($jform_file['tmp_name'], $upload_dir.'/'.$filename.'.'.$ext);
|
||||||
|
$storeData[$alias]=$upload_path.$filename.'.'.$ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function filetype($field)
|
||||||
|
{
|
||||||
|
$value=$field->__get('value');
|
||||||
|
if (empty($value))
|
||||||
|
{
|
||||||
|
return JHtml::_('users.value', $value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return $field->getFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<form>
|
||||||
|
<fields name="params">
|
||||||
|
<fieldset
|
||||||
|
name="filetype"
|
||||||
|
label="COM_JSN_FILETYPE_FIELDSET_LABEL"
|
||||||
|
>
|
||||||
|
|
||||||
|
<field
|
||||||
|
label="COM_JSN_FILETYPE_EXT"
|
||||||
|
description="COM_JSN_FILETYPE_EXT_DESC"
|
||||||
|
name="filetype_ext"
|
||||||
|
type="text"
|
||||||
|
filter="string"
|
||||||
|
default="pdf|zip|doc|docx"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
label="COM_JSN_FILETYPE_LABEL"
|
||||||
|
description="COM_JSN_FILETYPE_LABEL_DESC"
|
||||||
|
name="filetype_label"
|
||||||
|
type="text"
|
||||||
|
filter="string"
|
||||||
|
default=""
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
label="COM_JSN_UPLOADPATH"
|
||||||
|
description="COM_JSN_UPLOADPATH_DESC"
|
||||||
|
name="filetype_path"
|
||||||
|
type="text"
|
||||||
|
filter="string"
|
||||||
|
default="images/profiler/"
|
||||||
|
hint="images/profiler/"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
</form>
|
||||||
@ -0,0 +1,92 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
global $_FIELDTYPES;
|
||||||
|
$_FIELDTYPES['hide']='COM_JSN_FIELDTYPE_HIDDEN';
|
||||||
|
|
||||||
|
class JsnHideFieldHelper
|
||||||
|
{
|
||||||
|
public static function create($alias)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = "ALTER TABLE #__jsn_users ADD ".$db->quoteName($alias)." VARCHAR(255)";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function delete($alias)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = "ALTER TABLE #__jsn_users DROP COLUMN ".$db->quoteName($alias);
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getXml($item)
|
||||||
|
{
|
||||||
|
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
|
||||||
|
$hideTitle= ($item->params->get('hidetitle',0) && JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn') || ($item->params->get('hidetitleedit',0) && (JFactory::getApplication()->input->get('layout','')=='edit' || JFactory::getApplication()->input->get('view','')=='registration'));
|
||||||
|
if(JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn' && $item->params->get('titleprofile','')!='') $item->title=$item->params->get('titleprofile','');
|
||||||
|
$defaultvalue=($item->params->get('hide_defaultvalue','')!='' ? 'default="'.JsnHelper::xmlentities($item->params->get('hide_defaultvalue','')).'"' : '');
|
||||||
|
$xml='';
|
||||||
|
|
||||||
|
if($item->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
elseif($item->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('view')!='registration' && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
else $readonly='';
|
||||||
|
|
||||||
|
$xml.='
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="'.$item->alias.'"
|
||||||
|
type="hidden"
|
||||||
|
id="'.$item->alias.'"
|
||||||
|
description="'.JsnHelper::xmlentities(($item->description)).'"
|
||||||
|
filter="string"
|
||||||
|
label="'.($hideTitle ? JsnHelper::xmlentities('<span class="no-title">'.JText::_($item->title).'</span>') : JsnHelper::xmlentities($item->title)).'"
|
||||||
|
size="30"
|
||||||
|
'.$defaultvalue.'
|
||||||
|
'.$readonly.'
|
||||||
|
class="'.$item->params->get('field_cssclass','').'"
|
||||||
|
required="'.($item->required ? ($item->required==2 ? 'admin' : 'frontend' ) : 'false' ).'"
|
||||||
|
/>
|
||||||
|
';
|
||||||
|
return $xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function loadData($field, $user, &$data)
|
||||||
|
{
|
||||||
|
$alias=$field->alias;
|
||||||
|
if(isset($user->$alias)) $data->$alias=$user->$alias;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function storeData($field, $data, &$storeData)
|
||||||
|
{
|
||||||
|
//if($field->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) return;
|
||||||
|
//if($field->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('task')=='profile.save' && JFactory::getApplication()->isSite()) return;
|
||||||
|
$alias=$field->alias;
|
||||||
|
if(isset($data[$alias])) $storeData[$alias]=$data[$alias];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchInput($field)
|
||||||
|
{
|
||||||
|
$return='<input type="text" placeholder="'.JText::_('COM_JSN_SEARCHFOR').' '.JText::_($field->title).'..." name="'.$field->alias.'" value="'.JFactory::getApplication()->input->get($field->alias,'','raw').'"/>';
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchQuery($field, &$query)
|
||||||
|
{
|
||||||
|
$db=JFactory::getDbo();
|
||||||
|
$query->where('b.'.$db->quoteName($field->alias).' LIKE '.$db->quote('%'.JFactory::getApplication()->input->get($field->alias,null,'raw').'%'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<form>
|
||||||
|
<fields name="params">
|
||||||
|
<fieldset
|
||||||
|
name="hide"
|
||||||
|
label="COM_JSN_HIDE_FIELDSET_LABEL"
|
||||||
|
>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="hide_defaultvalue"
|
||||||
|
label="COM_JSN_GENERAL_DEFAULTVALUE"
|
||||||
|
description ="COM_JSN_GENERAL_DEFAULTVALUE"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
</form>
|
||||||
@ -0,0 +1,632 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
global $_FIELDTYPES;
|
||||||
|
$_FIELDTYPES['image']='COM_JSN_FIELDTYPE_IMAGE';
|
||||||
|
|
||||||
|
class JsnImageFieldHelper
|
||||||
|
{
|
||||||
|
public static function create($alias)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = "ALTER TABLE #__jsn_users ADD ".$db->quoteName($alias)." VARCHAR(255)";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function delete($alias)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = "ALTER TABLE #__jsn_users DROP COLUMN ".$db->quoteName($alias);
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getXml($item)
|
||||||
|
{
|
||||||
|
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
|
||||||
|
$hideTitle= ($item->params->get('hidetitle',0) && JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn') || ($item->params->get('hidetitleedit',0) && (JFactory::getApplication()->input->get('layout','')=='edit' || JFactory::getApplication()->input->get('view','')=='registration'));
|
||||||
|
if(JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn' && $item->params->get('titleprofile','')!='') $item->title=$item->params->get('titleprofile','');
|
||||||
|
$defaultvalue=($item->params->get('image_defaultvalue','')!='' ? 'default="'.JsnHelper::xmlentities($item->params->get('image_defaultvalue','')).'"' : '');//(isset($item->params['image_defaultvalue']) && $item->params['image_defaultvalue']!='' ? 'default="'.$item->params['image_defaultvalue'].'"' : '');
|
||||||
|
|
||||||
|
if($item->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
elseif($item->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('view')!='registration' && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
else $readonly='';
|
||||||
|
|
||||||
|
$xml='
|
||||||
|
<field
|
||||||
|
name="'.$item->alias.'"
|
||||||
|
type="imagefull"
|
||||||
|
id="'.$item->alias.'"
|
||||||
|
imageclass="'.$item->alias.' '.$item->params->get('image_class','').'"
|
||||||
|
class="'.$item->params->get('field_cssclass','').'"
|
||||||
|
description="'.JsnHelper::xmlentities(($item->description)).'"
|
||||||
|
accept="image/*"
|
||||||
|
label="'.($hideTitle ? JsnHelper::xmlentities('<span class="no-title">'.JText::_($item->title).'</span>') : JsnHelper::xmlentities($item->title)).'"
|
||||||
|
alt="'.$item->params->get('image_alt','').'"
|
||||||
|
'.$defaultvalue.'
|
||||||
|
'.$readonly.'
|
||||||
|
width="'.$item->params->get('image_width','500').'"
|
||||||
|
height="'.$item->params->get('image_height','500').'"
|
||||||
|
width_thumb="'.$item->params->get('image_thumbwidth','100').'"
|
||||||
|
height_thumb="'.$item->params->get('image_thumbheight','100').'"
|
||||||
|
cropwebcam="'.$item->params->get('image_cropwebcam','0').'"
|
||||||
|
required="'.($item->required && JFactory::getApplication()->input->get('jform',null,'array')==null ? ($item->required==2 ? 'admin' : 'frontend' ) : 'false' ).'"
|
||||||
|
requiredfile="'.($item->required ? ($item->required==2 ? 'admin' : 'frontend' ) : 'false' ).'"
|
||||||
|
validate="image"
|
||||||
|
/>
|
||||||
|
';
|
||||||
|
return $xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function loadData($field, $user, &$data)
|
||||||
|
{
|
||||||
|
$alias=$field->alias;
|
||||||
|
$alias_clean=$field->alias.'_clean';
|
||||||
|
$alias_mini=$field->alias.'_mini';
|
||||||
|
|
||||||
|
$jsn_config = JComponentHelper::getParams('com_jsn');
|
||||||
|
if($jsn_config->get('avatar',1) == 2 && isset($data->email)) // Gravatar
|
||||||
|
{
|
||||||
|
$email = $data->email;
|
||||||
|
if($field->params->get('image_defaultvalue','')!='')
|
||||||
|
$default = '&d='.urlencode(JURI::root().$field->params->get('image_defaultvalue',''));
|
||||||
|
else
|
||||||
|
$default = '';
|
||||||
|
$size = $field->params->get('image_height',500);
|
||||||
|
$size_mini = $field->params->get('image_thumbwidth',100);
|
||||||
|
|
||||||
|
$data->$alias = "https://www.gravatar.com/avatar/" . md5( strtolower( trim( $email ) ) ) . "?s=" . $size . $default;
|
||||||
|
$data->$alias_mini = "https://www.gravatar.com/avatar/" . md5( strtolower( trim( $email ) ) ) . "?s=" . $size_mini . $default;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($user->$alias) && $user->$alias!='' && file_exists(JPATH_SITE.'/'.$user->$alias))
|
||||||
|
{
|
||||||
|
$data->$alias=$user->$alias;
|
||||||
|
$data->$alias_clean=$data->$alias;
|
||||||
|
$data->$alias_mini=preg_replace('~_(?!.*_)~', 'mini_', $data->$alias);
|
||||||
|
if(!file_exists(JPATH_SITE.'/'.$data->$alias_mini)) $data->$alias_mini=$user->$alias;
|
||||||
|
}
|
||||||
|
elseif($field->params->get('image_defaultvalue','')!='')
|
||||||
|
{
|
||||||
|
$data->$alias=$field->params->get('image_defaultvalue','');
|
||||||
|
$data->$alias_mini=$data->$alias;
|
||||||
|
$data->$alias_clean='';
|
||||||
|
}
|
||||||
|
elseif($alias == 'avatar')
|
||||||
|
{
|
||||||
|
$data->$alias='components/com_jsn/assets/img/default.jpg';
|
||||||
|
$data->$alias_mini='components/com_jsn/assets/img/default.jpg';
|
||||||
|
$data->$alias_clean='';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function storeData($field, $data, &$storeData)
|
||||||
|
{
|
||||||
|
$jsn_config = JComponentHelper::getParams('com_jsn');
|
||||||
|
if($jsn_config->get('avatar',1) == 2) // Gravatar
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//if($field->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) return;
|
||||||
|
//if($field->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('task')=='profile.save' && JFactory::getApplication()->isSite()) return;
|
||||||
|
$upload_path=$field->params->get('image_path','images/profiler/');
|
||||||
|
|
||||||
|
// Set Upload Dir
|
||||||
|
$upload_dir=JPATH_SITE.'/'.$upload_path;
|
||||||
|
if(!file_exists($upload_dir))
|
||||||
|
{
|
||||||
|
mkdir($upload_dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get Alias
|
||||||
|
$alias=$field->alias;
|
||||||
|
if(isset($data[$alias])) $storeData[$alias]=$data[$alias];
|
||||||
|
|
||||||
|
// Delete Image
|
||||||
|
$jform=JFactory::getApplication()->input->post->getArray();
|
||||||
|
if(isset($storeData[$alias]) && $storeData[$alias]=='')
|
||||||
|
{
|
||||||
|
// Delete old file
|
||||||
|
foreach (glob($upload_dir.$alias.$data['id'].'*') as $deletefile)
|
||||||
|
{
|
||||||
|
unlink($deletefile);
|
||||||
|
}
|
||||||
|
|
||||||
|
$storeData[$alias]='';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ------ METHOD INPUT ------ */
|
||||||
|
$jform=JFactory::getApplication()->input->files->get('jform',null,'raw');
|
||||||
|
if(isset($jform['upload_'.$alias])) $jform_file=$jform['upload_'.$alias];
|
||||||
|
if(isset($jform_file['name']) && strlen($jform_file['name'])>4)
|
||||||
|
$fileArray=array(
|
||||||
|
'name' => $jform_file['name'],
|
||||||
|
'type' => $jform_file['type'],
|
||||||
|
'tmp_name' => $jform_file['tmp_name'],
|
||||||
|
'error' => $jform_file['error'],
|
||||||
|
'size' => $jform_file['size'],
|
||||||
|
);
|
||||||
|
else
|
||||||
|
$fileArray=array();
|
||||||
|
|
||||||
|
if(file_exists(JPATH_ADMINISTRATOR.'/components/com_k2/lib/class.upload.php')) require_once(JPATH_ADMINISTRATOR.'/components/com_k2/lib/class.upload.php');
|
||||||
|
else require_once(JPATH_ADMINISTRATOR.'/components/com_jsn/assets/class.upload.php');
|
||||||
|
$foo = new Upload($fileArray);
|
||||||
|
$session = JFactory::getSession();
|
||||||
|
if ($foo->uploaded)
|
||||||
|
{
|
||||||
|
// Delete old file
|
||||||
|
foreach (glob($upload_dir.$alias.$data['id'].'*') as $deletefile)
|
||||||
|
{
|
||||||
|
unlink($deletefile);
|
||||||
|
}
|
||||||
|
|
||||||
|
$md5=md5(time().rand());
|
||||||
|
// Store & Resize Image Thumbs
|
||||||
|
$filename=$alias.$data['id'].'mini_'.$md5;
|
||||||
|
$foo->file_new_name_body = $filename;
|
||||||
|
$foo->image_resize = true;
|
||||||
|
$foo->image_ratio_crop = true;
|
||||||
|
$foo->image_convert = 'png';
|
||||||
|
if($field->params->get('image_thumbwidth',100)>0) $foo->image_x = $field->params->get('image_thumbwidth',100);//$field->params['image_thumbwidth'];
|
||||||
|
if($field->params->get('image_thumbheight',100)>0) $foo->image_y = $field->params->get('image_thumbheight',100);//$field->params['image_thumbheight'];
|
||||||
|
//die($foo->image_x);
|
||||||
|
$foo->Process($upload_dir);
|
||||||
|
// Store & Resize Image
|
||||||
|
$filename=$alias.$data['id'].'_'.$md5;
|
||||||
|
$foo->file_new_name_body = $filename;
|
||||||
|
$foo->image_resize = true;
|
||||||
|
$foo->image_ratio_crop = true;
|
||||||
|
$foo->image_convert = 'png';
|
||||||
|
if($field->params->get('image_width',500)>0) $foo->image_x = $field->params->get('image_width',500);//$field->params['image_width'];
|
||||||
|
if($field->params->get('image_height',500)>0) $foo->image_y = $field->params->get('image_height',500);//$field->params['image_height'];
|
||||||
|
$foo->Process($upload_dir);
|
||||||
|
if ($foo->processed)
|
||||||
|
{
|
||||||
|
$storeData[$alias]=$upload_path.$foo->file_dst_name;
|
||||||
|
$foo->Clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* ------ METHOD CROP & WEBCAM ------ */
|
||||||
|
if($session->get('_tmp_img_'.$alias,'')!=''){
|
||||||
|
$md5=md5(time().rand());
|
||||||
|
$file = $session->get('_tmp_img_'.$alias,'');
|
||||||
|
$ext = pathinfo($file, PATHINFO_EXTENSION);
|
||||||
|
$filename=$alias.$data['id'].'_'.$md5.'.'.$ext;
|
||||||
|
$filename_mini=$alias.$data['id'].'mini_'.$md5.'.'.$ext;
|
||||||
|
$path = JPATH_SITE.'/images/_tmp/';
|
||||||
|
if(file_exists($path . str_replace('.','-big.',$file)) && file_exists($path . str_replace('.','-big.',$file))){
|
||||||
|
foreach (glob($upload_dir.$alias.$data['id'].'*') as $deletefile)
|
||||||
|
{
|
||||||
|
unlink($deletefile);
|
||||||
|
}
|
||||||
|
rename($path . str_replace('.','-big.',$file),$upload_dir.$filename);
|
||||||
|
rename($path . str_replace('.','-mini.',$file),$upload_dir.$filename_mini);
|
||||||
|
unlink($path . $file);
|
||||||
|
$storeData[$alias]=$upload_path.$filename;
|
||||||
|
}
|
||||||
|
/* Clean Session Var */
|
||||||
|
$session->set('_tmp_img_'.$alias,'');
|
||||||
|
}
|
||||||
|
/* ------ METHOD CROP ------ */
|
||||||
|
$images = Slim::getImages('imgupload_'.$alias);
|
||||||
|
if(count($images)){
|
||||||
|
|
||||||
|
foreach ($images as $image) {
|
||||||
|
switch ($image['input']['type']) {
|
||||||
|
case 'image/gif':
|
||||||
|
$extension = '.gif';
|
||||||
|
break;
|
||||||
|
case 'image/jpeg':
|
||||||
|
$extension = '.jpg';
|
||||||
|
break;
|
||||||
|
case 'image/png':
|
||||||
|
$extension = '.png';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$extension = '.jpg';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// Clean Old Images
|
||||||
|
foreach (glob($upload_dir.$alias.$data['id'].'*') as $deletefile)
|
||||||
|
{
|
||||||
|
unlink($deletefile);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy uploaded images
|
||||||
|
$md5=md5(time().rand());
|
||||||
|
$filename=$alias.$data['id'].'_'.$md5.$extension;
|
||||||
|
$filename_mini=$alias.$data['id'].'mini_'.$md5;
|
||||||
|
$file = Slim::saveFile($image['output']['data'], $filename, $upload_dir,false);
|
||||||
|
$file = Slim::saveFile($image['output']['data'], $filename_mini, $upload_dir,false);
|
||||||
|
$storeData[$alias]=$upload_path.$filename;
|
||||||
|
|
||||||
|
// Resize Thumbs
|
||||||
|
$handle = new upload($upload_dir.$filename_mini);
|
||||||
|
$handle->file_new_name_body=$filename_mini;
|
||||||
|
if($field->params->get('image_thumbwidth',100)>0) $handle->image_x = $field->params->get('image_thumbwidth',100);
|
||||||
|
if($field->params->get('image_thumbheight',100)>0) $handle->image_y = $field->params->get('image_thumbheight',100);
|
||||||
|
$handle->image_resize = true;
|
||||||
|
$handle->image_ratio_crop = true;
|
||||||
|
$handle->process($upload_dir);
|
||||||
|
$handle->clean();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Temp folder path to clean */
|
||||||
|
$path = JPATH_SITE.'/images/_tmp/';
|
||||||
|
|
||||||
|
/* Clean Tmp folder from not saved images */
|
||||||
|
if($session->get('_tmp_rand_'.$alias,'')!='')
|
||||||
|
{
|
||||||
|
|
||||||
|
$rand=$session->get('_tmp_rand_'.$alias,'')!='';
|
||||||
|
|
||||||
|
$filename_prefix=substr(md5($_SERVER['REMOTE_ADDR'].$alias.$rand),0,10);
|
||||||
|
|
||||||
|
if (file_exists($path))
|
||||||
|
{
|
||||||
|
foreach (glob($path.$filename_prefix.'*') as $deletefile)
|
||||||
|
{
|
||||||
|
unlink($deletefile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function image($field,$user)
|
||||||
|
{
|
||||||
|
$value=$field->__get('value');
|
||||||
|
if (empty($value))
|
||||||
|
{
|
||||||
|
return JHtml::_('users.value', $value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return $field->getImage($user);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function operations()
|
||||||
|
{
|
||||||
|
JFactory::getConfig()->set('gzip',false);
|
||||||
|
$db=JFactory::getDbo();
|
||||||
|
$query=$db->getQuery(true);
|
||||||
|
$query->select('params')->from('#__jsn_fields')->where('alias='.$db->quote(JFactory::getApplication()->input->get('field')));
|
||||||
|
$params = new JRegistry;
|
||||||
|
$db->setQuery($query);
|
||||||
|
$params->loadString($db->loadResult());
|
||||||
|
$name=JFactory::getApplication()->input->get('field');
|
||||||
|
|
||||||
|
$session = JFactory::getSession();
|
||||||
|
|
||||||
|
|
||||||
|
require_once(JPATH_ADMINISTRATOR.'/components/com_jsn/assets/ImgPicker.php');
|
||||||
|
|
||||||
|
if($session->get('_tmp_rand_'.$name,'')=='') $session->set('_tmp_rand_'.$name,md5(time().rand()));
|
||||||
|
|
||||||
|
$rand=$session->get('_tmp_rand_'.$name,'');
|
||||||
|
|
||||||
|
$filename=substr(md5($_SERVER['REMOTE_ADDR'].$name.$rand),0,10);
|
||||||
|
|
||||||
|
$upload_tmp = JPATH_SITE.'/images/_tmp/';
|
||||||
|
if (!file_exists($upload_tmp)) {
|
||||||
|
mkdir($upload_tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
$options = array(
|
||||||
|
|
||||||
|
// Upload directory path
|
||||||
|
'upload_dir' => $upload_tmp,
|
||||||
|
|
||||||
|
// Upload directory url:
|
||||||
|
//'upload_url' => 'http://localhost/imgPicker/files/',
|
||||||
|
'upload_url' => JURI::root(true) . '/images/_tmp/',
|
||||||
|
|
||||||
|
// Accepted file types:
|
||||||
|
'accept_file_types' => 'png|jpg|jpeg|gif',
|
||||||
|
|
||||||
|
// Directory mode:
|
||||||
|
'mkdir_mode' => 0777,
|
||||||
|
|
||||||
|
// File size restrictions (in bytes):
|
||||||
|
'max_file_size' => null,
|
||||||
|
'min_file_size' => 1,
|
||||||
|
|
||||||
|
// Image resolution restrictions (in px):
|
||||||
|
'max_width' => null,
|
||||||
|
'max_height' => null,
|
||||||
|
'min_width' => 1,
|
||||||
|
'min_height' => 1,
|
||||||
|
|
||||||
|
// Image versions:
|
||||||
|
'versions' => array(
|
||||||
|
// This will create 2 image versions: the original one and a 200x200 one
|
||||||
|
'mini' => array(
|
||||||
|
//'upload_dir' => '',
|
||||||
|
//'upload_url' => '',
|
||||||
|
// Create square image
|
||||||
|
//'crop' => true,
|
||||||
|
'max_width' => $params->get('image_thumbwidth',100),
|
||||||
|
'max_height' => $params->get('image_thumbheight',100)
|
||||||
|
),
|
||||||
|
'big' => array(
|
||||||
|
//'upload_dir' => '',
|
||||||
|
//'upload_url' => '',
|
||||||
|
// Create square imag
|
||||||
|
//'crop' => true,
|
||||||
|
'max_width' => $params->get('image_width',500),
|
||||||
|
'max_height' => $params->get('image_height',500)
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load callback
|
||||||
|
*
|
||||||
|
* @param ImgPicker $instance
|
||||||
|
* @return string|array
|
||||||
|
*/
|
||||||
|
'load' => function($instance) {
|
||||||
|
//return 'avatar.jpg';
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete callback
|
||||||
|
*
|
||||||
|
* @param string $filename
|
||||||
|
* @param ImgPicker $instance
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
'delete' => function($filename, $instance) {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Upload start callback
|
||||||
|
*
|
||||||
|
* @param stdClass $image
|
||||||
|
* @param ImgPicker $instance
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
'upload_start' => function($image, $instance) {
|
||||||
|
$session = JFactory::getSession();
|
||||||
|
$rand=$session->get('_tmp_rand_'.JFactory::getApplication()->input->get('field'));
|
||||||
|
$filename=substr(md5($_SERVER['REMOTE_ADDR'].JFactory::getApplication()->input->get('field').$rand),0,10);
|
||||||
|
$image->name = $filename . '.' . $image->type;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Upload complete callback
|
||||||
|
*
|
||||||
|
* @param stdClass $image
|
||||||
|
* @param ImgPicker $instance
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
'upload_complete' => function($image, $instance) {
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Crop start callback
|
||||||
|
*
|
||||||
|
* @param stdClass $image
|
||||||
|
* @param ImgPicker $instance
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
'crop_start' => function($image, $instance) {
|
||||||
|
$session = JFactory::getSession();
|
||||||
|
$rand=$session->get('_tmp_rand_'.JFactory::getApplication()->input->get('field'));
|
||||||
|
$filename=substr(md5($_SERVER['REMOTE_ADDR'].JFactory::getApplication()->input->get('field').$rand),0,10);
|
||||||
|
$image->name = $filename . '.' . $image->type;
|
||||||
|
$session->set('_tmp_img_'.JFactory::getApplication()->input->get('field'),$filename . '.' . $image->type);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Crop complete callback
|
||||||
|
*
|
||||||
|
* @param stdClass $image
|
||||||
|
* @param ImgPicker $instance
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
'crop_complete' => function($image, $instance) {
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// Create new ImgPicker instance
|
||||||
|
new ImgPicker($options);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
abstract class SlimStatus {
|
||||||
|
const FAILURE = 'failure';
|
||||||
|
const SUCCESS = 'success';
|
||||||
|
}
|
||||||
|
|
||||||
|
class Slim {
|
||||||
|
|
||||||
|
public static function getImages($inputName = 'slim') {
|
||||||
|
|
||||||
|
$values = Slim::getPostData($inputName);
|
||||||
|
|
||||||
|
// test for errors
|
||||||
|
if ($values === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// determine if contains multiple input values, if is singular, put in array
|
||||||
|
$data = array();
|
||||||
|
if (!is_array($values)) {
|
||||||
|
$values = array($values);
|
||||||
|
}
|
||||||
|
|
||||||
|
// handle all posted fields
|
||||||
|
foreach ($values as $value) {
|
||||||
|
$inputValue = Slim::parseInput($value);
|
||||||
|
if ($inputValue) {
|
||||||
|
array_push($data, $inputValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// return the data collected from the fields
|
||||||
|
return $data;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// $value should be in JSON format
|
||||||
|
private static function parseInput($value) {
|
||||||
|
|
||||||
|
// if no json received, exit, don't handle empty input values.
|
||||||
|
if (empty($value)) {return null;}
|
||||||
|
|
||||||
|
// The data is posted as a JSON String so to be used it needs to be deserialized first
|
||||||
|
$data = json_decode($value);
|
||||||
|
|
||||||
|
// shortcut
|
||||||
|
$input = null;
|
||||||
|
$actions = null;
|
||||||
|
$output = null;
|
||||||
|
$meta = null;
|
||||||
|
|
||||||
|
if (isset ($data->input)) {
|
||||||
|
$inputData = isset($data->input->image) ? Slim::getBase64Data($data->input->image) : null;
|
||||||
|
$input = array(
|
||||||
|
'data' => $inputData,
|
||||||
|
'name' => $data->input->name,
|
||||||
|
'type' => $data->input->type,
|
||||||
|
'size' => $data->input->size,
|
||||||
|
'width' => $data->input->width,
|
||||||
|
'height' => $data->input->height,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($data->output)) {
|
||||||
|
$outputData = isset($data->output->image) ? Slim::getBase64Data($data->output->image) : null;
|
||||||
|
$output = array(
|
||||||
|
'data' => $outputData,
|
||||||
|
'width' => $data->output->width,
|
||||||
|
'height' => $data->output->height
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($data->actions)) {
|
||||||
|
$actions = array(
|
||||||
|
'crop' => $data->actions->crop ? array(
|
||||||
|
'x' => $data->actions->crop->x,
|
||||||
|
'y' => $data->actions->crop->y,
|
||||||
|
'width' => $data->actions->crop->width,
|
||||||
|
'height' => $data->actions->crop->height,
|
||||||
|
'type' => $data->actions->crop->type
|
||||||
|
) : null,
|
||||||
|
'size' => $data->actions->size ? array(
|
||||||
|
'width' => $data->actions->size->width,
|
||||||
|
'height' => $data->actions->size->height
|
||||||
|
) : null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($data->meta)) {
|
||||||
|
$meta = $data->meta;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We've sanitized the base64data and will now return the clean file object
|
||||||
|
return array(
|
||||||
|
'input' => $input,
|
||||||
|
'output' => $output,
|
||||||
|
'actions' => $actions,
|
||||||
|
'meta' => $meta
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// $path should have trailing slash
|
||||||
|
public static function saveFile($data, $name, $path = 'tmp/', $uid = true) {
|
||||||
|
|
||||||
|
// Add trailing slash if omitted
|
||||||
|
if (substr($path, -1) !== '/') {
|
||||||
|
$path .= '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test if directory already exists
|
||||||
|
if(!is_dir($path)){
|
||||||
|
mkdir($path, 0755, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Let's put a unique id in front of the filename so we don't accidentally overwrite older files
|
||||||
|
if ($uid) {
|
||||||
|
$name = uniqid() . '_' . $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add name to path, we need the full path including the name to save the file
|
||||||
|
$path = $path . $name;
|
||||||
|
|
||||||
|
// store the file
|
||||||
|
Slim::save($data, $path);
|
||||||
|
|
||||||
|
// return the files new name and location
|
||||||
|
return array(
|
||||||
|
'name' => $name,
|
||||||
|
'path' => $path
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function outputJSON($data) {
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo json_encode($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the posted data from the POST or FILES object. If was using Slim to upload it will be in POST (as posted with hidden field) if not enhanced with Slim it'll be in FILES.
|
||||||
|
* @param $inputName
|
||||||
|
* @return array|bool
|
||||||
|
*/
|
||||||
|
private static function getPostData($inputName) {
|
||||||
|
|
||||||
|
$values = array();
|
||||||
|
|
||||||
|
if (isset($_POST[$inputName])) {
|
||||||
|
$values = $_POST[$inputName];
|
||||||
|
}
|
||||||
|
else if (isset($_FILES[$inputName])) {
|
||||||
|
// Slim was not used to upload this file
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $values;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saves the data to a given location
|
||||||
|
* @param $data
|
||||||
|
* @param $path
|
||||||
|
*/
|
||||||
|
private static function save($data, $path) {
|
||||||
|
file_put_contents($path, $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Strips the "data:image..." part of the base64 data string so PHP can save the string as a file
|
||||||
|
* @param $data
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private static function getBase64Data($data) {
|
||||||
|
return base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $data));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,93 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<form>
|
||||||
|
<fields name="params">
|
||||||
|
<fieldset
|
||||||
|
name="image"
|
||||||
|
label="COM_JSN_IMAGE_FIELDSET_LABEL"
|
||||||
|
>
|
||||||
|
|
||||||
|
<field
|
||||||
|
label="COM_JSN_IMAGE_PARAM_WIDTH"
|
||||||
|
name="image_width"
|
||||||
|
type="text"
|
||||||
|
filter="int"
|
||||||
|
default="200"
|
||||||
|
size="4"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
label="COM_JSN_IMAGE_PARAM_HEIGHT"
|
||||||
|
name="image_height"
|
||||||
|
type="text"
|
||||||
|
filter="int"
|
||||||
|
default="200"
|
||||||
|
size="4"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
label="COM_JSN_IMAGE_PARAM_THUMBWIDTH"
|
||||||
|
name="image_thumbwidth"
|
||||||
|
type="text"
|
||||||
|
filter="int"
|
||||||
|
default="75"
|
||||||
|
size="4"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
label="COM_JSN_IMAGE_PARAM_THUMBHEIGHT"
|
||||||
|
name="image_thumbheight"
|
||||||
|
type="text"
|
||||||
|
filter="int"
|
||||||
|
default="75"
|
||||||
|
size="4"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="image_defaultvalue"
|
||||||
|
label="COM_JSN_GENERAL_DEFAULTVALUE"
|
||||||
|
description ="COM_JSN_GENERAL_DEFAULTVALUE_DESC"
|
||||||
|
type="media"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
label="COM_JSN_IMAGE_PARAM_ALT"
|
||||||
|
name="image_alt"
|
||||||
|
type="text"
|
||||||
|
filter="string"
|
||||||
|
default=""
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
label="COM_JSN_IMAGE_CLASS"
|
||||||
|
name="image_class"
|
||||||
|
type="text"
|
||||||
|
filter="string"
|
||||||
|
default=""
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="image_cropwebcam"
|
||||||
|
label="COM_JSN_IMAGE_CROPWEBCAM"
|
||||||
|
description ="COM_JSN_IMAGE_CROPWEBCAM_DESC"
|
||||||
|
class="btn-group"
|
||||||
|
type="radio"
|
||||||
|
default="0"
|
||||||
|
>
|
||||||
|
<option value="0">COM_JSN_IMAGE_METHOD_INPUT</option>
|
||||||
|
<option value="1">COM_JSN_IMAGE_METHOD_CROPWEBCAM</option>
|
||||||
|
<option value="2">COM_JSN_IMAGE_METHOD_CROP</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
label="COM_JSN_UPLOADPATH"
|
||||||
|
description="COM_JSN_UPLOADPATH_DESC"
|
||||||
|
name="image_path"
|
||||||
|
type="text"
|
||||||
|
filter="string"
|
||||||
|
default="images/profiler/"
|
||||||
|
hint="images/profiler/"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
</form>
|
||||||
@ -0,0 +1,137 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
class JsnLastvisitdateFieldHelper
|
||||||
|
{
|
||||||
|
public static function create($alias)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function delete($alias)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getXml($item)
|
||||||
|
{
|
||||||
|
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
|
||||||
|
$xml='';
|
||||||
|
$hideTitle= ($item->params->get('hidetitle',0) && JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn') || ($item->params->get('hidetitleedit',0) && (JFactory::getApplication()->input->get('layout','')=='edit' || JFactory::getApplication()->input->get('view','')=='registration'));
|
||||||
|
if(JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn' && $item->params->get('titleprofile','')!='') $item->title=$item->params->get('titleprofile','');
|
||||||
|
if(JFactory::getApplication()->isSite())
|
||||||
|
$xml='
|
||||||
|
<field
|
||||||
|
name="lastvisitdate"
|
||||||
|
type="lastvisitdate"
|
||||||
|
class="readonly '.$item->params->get('field_cssclass','').'"
|
||||||
|
label="'.($hideTitle ? JsnHelper::xmlentities('<span class="no-title">'.JText::_($item->title).'</span>') : JsnHelper::xmlentities($item->title)).'"
|
||||||
|
description=""
|
||||||
|
readonly="true"
|
||||||
|
format="%Y-%m-%d %H:%M:%S"
|
||||||
|
size="22"
|
||||||
|
filter="user_utc"
|
||||||
|
/>
|
||||||
|
';
|
||||||
|
return $xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function loadData($field, $user, &$data)
|
||||||
|
{
|
||||||
|
if(isset($data->lastvisitDate)) $data->lastvisitdate=$data->lastvisitDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function storeData($field, $data, &$storeData)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function lastvisitdate($field)
|
||||||
|
{
|
||||||
|
$value=$field->__get('value');
|
||||||
|
if (empty($value))
|
||||||
|
{
|
||||||
|
return JHtml::_('users.value', $value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($value != '0000-00-00 00:00:00')
|
||||||
|
return JHtml::_('date', $value);
|
||||||
|
else
|
||||||
|
return JText::_('COM_JSN_NEVER');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchInput($field)
|
||||||
|
{
|
||||||
|
if(JText::_('COM_JSN_STARTMONDAY')=='1') $date_weekstart=' data-date-weekstart="1"';
|
||||||
|
else $date_weekstart='';
|
||||||
|
|
||||||
|
$doc=JFactory::getDocument();
|
||||||
|
JHtml::_('bootstrap.framework');
|
||||||
|
$doc->addScript(JURI::root().'components/com_jsn/assets/js/bootstrap-datepicker.js');
|
||||||
|
$doc->addStylesheet(JURI::root().'components/com_jsn/assets/css/datepicker.css');
|
||||||
|
$return=array();
|
||||||
|
$return[]='<input id="jform_'.str_replace('-','_',$field->alias).'" type="hidden" name="'.$field->alias.'" value="1" /><div class=""><div class="bsdatesearch">';
|
||||||
|
$return[]='<div'.$date_weekstart.' data-date-viewmode="'.$field->params->get('date_viewmode','days').'" data-date-format="'.JText::_('COM_JSN_DATE_INPUT_FORMAT').'" data-date="'.JFactory::getApplication()->input->get($field->alias.'_from','','raw').'" id="'.$field->alias.'_from" class="input-prepend date bsdate"><span class="btn btn-success"><i class="icon icon-calendar"></i></span><span class="btn btn-danger"><i class="icon icon-remove jsndateremove"></i></span><input placeholder="'.JText::_('COM_JSN_STARTDATE').'" type="text" readonly="readonly" value="'.JFactory::getApplication()->input->get($field->alias.'_from','','raw').'" name="'.$field->alias.'_from" /></div>';
|
||||||
|
$return[]='</div><div class="bsdatesearch">';
|
||||||
|
$return[]='<div'.$date_weekstart.' data-date-viewmode="'.$field->params->get('date_viewmode','days').'" data-date-format="'.JText::_('COM_JSN_DATE_INPUT_FORMAT').'" data-date="'.JFactory::getApplication()->input->get($field->alias.'_to','','raw').'" id="'.$field->alias.'_to" class="input-prepend date bsdate"><span class="btn btn-success"><i class="icon icon-calendar"></i></span><span class="btn btn-danger"><i class="icon icon-remove jsndateremove"></i></span><input placeholder="'.JText::_('COM_JSN_ENDDATE').'" type="text" readonly="readonly" value="'.JFactory::getApplication()->input->get($field->alias.'_to','','raw').'" name="'.$field->alias.'_to" /></div>';
|
||||||
|
$return[]='</div><div class="bsdatesearchtip"><span class="label label-default">'.JText::_('COM_JSN_CHOOSEDATEINTERVAL').'</span></div></div>';
|
||||||
|
static $init=0;
|
||||||
|
if($init==0){
|
||||||
|
$script='
|
||||||
|
var DPGlobalDates = {
|
||||||
|
days: ["'.JText::_("SUNDAY").'", "'.JText::_("MONDAY").'", "'.JText::_("TUESDAY").'", "'.JText::_("WEDNESDAY").'", "'.JText::_("THURSDAY").'", "'.JText::_("FRIDAY").'", "'.JText::_("SATURDAY").'", "'.JText::_("SUNDAY").'"],
|
||||||
|
daysShort: ["'.JText::_("SUN").'", "'.JText::_("MON").'", "'.JText::_("TUE").'", "'.JText::_("WED").'", "'.JText::_("THU").'", "'.JText::_("FRI").'", "'.JText::_("SAT").'", "'.JText::_("SUN").'"],
|
||||||
|
daysMin: ["'.JText::_("SUN").'", "'.JText::_("MON").'", "'.JText::_("TUE").'", "'.JText::_("WED").'", "'.JText::_("THU").'", "'.JText::_("FRI").'", "'.JText::_("SAT").'", "'.JText::_("SUN").'"],
|
||||||
|
months: ["'.JText::_("JANUARY").'", "'.JText::_("FEBRUARY").'", "'.JText::_("MARCH").'", "'.JText::_("APRIL").'", "'.JText::_("MAY").'", "'.JText::_("JUNE").'", "'.JText::_("JULY").'", "'.JText::_("AUGUST").'", "'.JText::_("SEPTEMBER").'", "'.JText::_("OCTOBER").'", "'.JText::_("NOVEMBER").'", "'.JText::_("DECEMBER").'"],
|
||||||
|
monthsShort: ["'.JText::_("JANUARY_SHORT").'", "'.JText::_("FEBRUARY_SHORT").'", "'.JText::_("MARCH_SHORT").'", "'.JText::_("APRIL_SHORT").'", "'.JText::_("MAY_SHORT").'", "'.JText::_("JUNE_SHORT").'", "'.JText::_("JULY_SHORT").'", "'.JText::_("AUGUST_SHORT").'", "'.JText::_("SEPTEMBER_SHORT").'", "'.JText::_("OCTOBER_SHORT").'", "'.JText::_("NOVEMBER_SHORT").'", "'.JText::_("DECEMBER_SHORT").'"]
|
||||||
|
};
|
||||||
|
';
|
||||||
|
}
|
||||||
|
else $script='';
|
||||||
|
$init=1;
|
||||||
|
$script.='
|
||||||
|
jQuery(document).ready(function($){
|
||||||
|
var nowTemp = new Date();
|
||||||
|
var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0);
|
||||||
|
$("#'.$field->alias.'_from").jsndatepicker();
|
||||||
|
$("#'.$field->alias.'_to").jsndatepicker();
|
||||||
|
|
||||||
|
|
||||||
|
$("#'.$field->alias.'_from .jsndateremove").click(function(){
|
||||||
|
//'.$field->alias.'_from.setValue(newDate);
|
||||||
|
$("#'.$field->alias.'_from input").val("");
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
$("#'.$field->alias.'_to .jsndateremove").click(function(){
|
||||||
|
//'.$field->alias.'_to.setValue(newDate);
|
||||||
|
//$("#'.$field->alias.'_to").attr("data-date","");
|
||||||
|
$("#'.$field->alias.'_to input").val("");
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
';
|
||||||
|
$doc->addScriptDeclaration( $script );
|
||||||
|
return implode('',$return);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchQuery($field, &$query)
|
||||||
|
{
|
||||||
|
$date_from=new JDate(str_replace('/','-',JFactory::getApplication()->input->get($field->alias.'_from','','raw')));
|
||||||
|
$date_to=new JDate(str_replace('/','-',JFactory::getApplication()->input->get($field->alias.'_to','','raw')));
|
||||||
|
$db=JFactory::getDbo();
|
||||||
|
if(JFactory::getApplication()->input->get($field->alias.'_from','','raw')!='') $query->where('a.'.$db->quoteName('lastvisitDate').' > '.$db->quote($date_from->toSql()));
|
||||||
|
if(JFactory::getApplication()->input->get($field->alias.'_to','','raw')!='') $query->where('a.'.$db->quoteName('lastvisitDate').' < '.$db->quote($date_to->toSql()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,119 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
global $_FIELDTYPES;
|
||||||
|
$_FIELDTYPES['link']='COM_JSN_FIELDTYPE_LINK';
|
||||||
|
|
||||||
|
class JsnLinkFieldHelper
|
||||||
|
{
|
||||||
|
public static function create($alias)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = "ALTER TABLE #__jsn_users ADD ".$db->quoteName($alias)." VARCHAR(255)";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function delete($alias)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = "ALTER TABLE #__jsn_users DROP COLUMN ".$db->quoteName($alias);
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getXml($item)
|
||||||
|
{
|
||||||
|
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
|
||||||
|
$hideTitle= ($item->params->get('hidetitle',0) && JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn') || ($item->params->get('hidetitleedit',0) && (JFactory::getApplication()->input->get('layout','')=='edit' || JFactory::getApplication()->input->get('view','')=='registration'));
|
||||||
|
if(JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn' && $item->params->get('titleprofile','')!='') $item->title=$item->params->get('titleprofile','');
|
||||||
|
$defaultvalue=($item->params->get('link_defaultvalue','')!='' ? 'default="'.JsnHelper::xmlentities($item->params->get('link_defaultvalue','')).'"' : '');
|
||||||
|
$maxlength=($item->params->get('link_maxlength','')!='' ? 'maxlength="'.$item->params->get('link_maxlength','').'"' : '');
|
||||||
|
$placeholder=($item->params->get('link_placeholder','')!='' ? 'hint="'.JsnHelper::xmlentities($item->params->get('link_placeholder','')).'"' : '');
|
||||||
|
$robots=$item->params->get('link_robots','');
|
||||||
|
|
||||||
|
if($item->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
elseif($item->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('view')!='registration' && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
else $readonly='';
|
||||||
|
|
||||||
|
$type='link';
|
||||||
|
|
||||||
|
$xml='';
|
||||||
|
|
||||||
|
$xml.='
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="'.$item->alias.'"
|
||||||
|
type="'.$type.'"
|
||||||
|
id="'.$item->alias.'"
|
||||||
|
description="'.JsnHelper::xmlentities(($item->description)).'"
|
||||||
|
validate="link"
|
||||||
|
label="'.($hideTitle ? JsnHelper::xmlentities('<span class="no-title">'.JText::_($item->title).'</span>') : JsnHelper::xmlentities($item->title)).'"
|
||||||
|
size="30"
|
||||||
|
'.$defaultvalue.'
|
||||||
|
'.$maxlength.'
|
||||||
|
'.$placeholder.'
|
||||||
|
'.$readonly.'
|
||||||
|
class="'.$item->params->get('field_cssclass','').'"
|
||||||
|
rel="'.$robots.'"
|
||||||
|
required="'.($item->required ? ($item->required==2 ? 'admin' : 'frontend' ) : 'false' ).'"
|
||||||
|
/>
|
||||||
|
';
|
||||||
|
return $xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function loadData($field, $user, &$data)
|
||||||
|
{
|
||||||
|
$alias=$field->alias;
|
||||||
|
if(isset($user->$alias)) $data->$alias=$user->$alias;
|
||||||
|
if(isset($user->$alias) && $data->$alias=='http://') $data->$alias='';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function storeData($field, $data, &$storeData)
|
||||||
|
{
|
||||||
|
//if($field->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) return;
|
||||||
|
//if($field->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('task')=='profile.save' && JFactory::getApplication()->isSite()) return;
|
||||||
|
$alias=$field->alias;
|
||||||
|
if(isset($data[$alias])){
|
||||||
|
if(substr(trim($data[$alias]), 0, 4)=='http') $storeData[$alias]=$data[$alias];
|
||||||
|
else $storeData[$alias]='http://'.$data[$alias];
|
||||||
|
}
|
||||||
|
if($storeData[$alias]=='http://') $storeData[$alias]='';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function link($field)
|
||||||
|
{
|
||||||
|
$value=$field->__get('value');
|
||||||
|
if (empty($value))
|
||||||
|
{
|
||||||
|
return JHtml::_('users.value', $value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return $field->getLink();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchInput($field)
|
||||||
|
{
|
||||||
|
$return='<input id="jform_'.str_replace('-','_',$field->alias).'" type="text" placeholder="'.JText::_('COM_JSN_SEARCHFOR').' '.JText::_($field->title).'..." name="'.$field->alias.'" value="'.JFactory::getApplication()->input->get($field->alias,'','raw').'"/>';
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchQuery($field, &$query)
|
||||||
|
{
|
||||||
|
$db=JFactory::getDbo();
|
||||||
|
$query->where('b.'.$db->quoteName($field->alias).' LIKE '.$db->quote('%'.JFactory::getApplication()->input->get($field->alias,null,'raw').'%'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<form>
|
||||||
|
<fields name="params">
|
||||||
|
<fieldset
|
||||||
|
name="link"
|
||||||
|
label="COM_JSN_LINK_FIELDSET_LABEL"
|
||||||
|
>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="link_defaultvalue"
|
||||||
|
label="COM_JSN_GENERAL_DEFAULTVALUE"
|
||||||
|
description ="COM_JSN_GENERAL_DEFAULTVALUE_DESC"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="link_placeholder"
|
||||||
|
label="COM_JSN_GENERAL_PLACEHOLDER"
|
||||||
|
description ="COM_JSN_GENERAL_PLACEHOLDER_DESC"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="link_maxlength"
|
||||||
|
label="COM_JSN_TEXT_MAXLENGTH"
|
||||||
|
description ="COM_JSN_TEXT_MAXLENGTH_DESC"
|
||||||
|
type="text"
|
||||||
|
filter="int"
|
||||||
|
default="255"
|
||||||
|
/>
|
||||||
|
<field name="link_robots"
|
||||||
|
type="list"
|
||||||
|
label="JFIELD_METADATA_ROBOTS_LABEL"
|
||||||
|
description="JFIELD_METADATA_ROBOTS_DESC"
|
||||||
|
>
|
||||||
|
<option value="">JNONE</option>
|
||||||
|
<option value="index, follow">JGLOBAL_INDEX_FOLLOW</option>
|
||||||
|
<option value="noindex, follow">JGLOBAL_NOINDEX_FOLLOW</option>
|
||||||
|
<option value="index, nofollow">JGLOBAL_INDEX_NOFOLLOW</option>
|
||||||
|
<option value="noindex, nofollow">JGLOBAL_NOINDEX_NOFOLLOW</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
</form>
|
||||||
@ -0,0 +1,115 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
global $_FIELDTYPES;
|
||||||
|
$_FIELDTYPES['numeric']='COM_JSN_FIELDTYPE_NUMERIC';
|
||||||
|
|
||||||
|
class JsnNumericFieldHelper
|
||||||
|
{
|
||||||
|
public static function create($alias)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = "ALTER TABLE #__jsn_users ADD ".$db->quoteName($alias)." INTEGER";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function delete($alias)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = "ALTER TABLE #__jsn_users DROP COLUMN ".$db->quoteName($alias);
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getXml($item)
|
||||||
|
{
|
||||||
|
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
|
||||||
|
$hideTitle= ($item->params->get('hidetitle',0) && JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn') || ($item->params->get('hidetitleedit',0) && (JFactory::getApplication()->input->get('layout','')=='edit' || JFactory::getApplication()->input->get('view','')=='registration'));
|
||||||
|
if(JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn' && $item->params->get('titleprofile','')!='') $item->title=$item->params->get('titleprofile','');
|
||||||
|
$defaultvalue=($item->params->get('numeric_defaultvalue','')!='' ? 'default="'.$item->params->get('numeric_defaultvalue','').'"' : '');
|
||||||
|
|
||||||
|
if($item->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
elseif($item->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('view')!='registration' && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
else $readonly='';
|
||||||
|
|
||||||
|
$max='max="'.$item->params->get('numeric_max',999999).'"';
|
||||||
|
$min='min="'.$item->params->get('numeric_min',0).'"';
|
||||||
|
$step='step="'.$item->params->get('numeric_step',1).'"';
|
||||||
|
|
||||||
|
if(isset($_SERVER['HTTP_USER_AGENT'])) $agent = $_SERVER['HTTP_USER_AGENT']; else $agent='';
|
||||||
|
if(strlen(strstr($agent,"Firefox")) > 0 ) $type='text';
|
||||||
|
else $type='numeric';
|
||||||
|
|
||||||
|
$xml='';
|
||||||
|
|
||||||
|
$xml.='
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="'.$item->alias.'"
|
||||||
|
type="'.$type.'"
|
||||||
|
id="'.$item->alias.'"
|
||||||
|
description="'.JsnHelper::xmlentities(($item->description)).'"
|
||||||
|
label="'.($hideTitle ? JsnHelper::xmlentities('<span class="no-title">'.JText::_($item->title).'</span>') : JsnHelper::xmlentities($item->title)).'"
|
||||||
|
size="30"
|
||||||
|
'.$defaultvalue.'
|
||||||
|
'.$max.'
|
||||||
|
'.$min.'
|
||||||
|
'.$step.'
|
||||||
|
'.$readonly.'
|
||||||
|
class="'.$item->params->get('field_cssclass','').'"
|
||||||
|
required="'.($item->required ? ($item->required==2 ? 'admin' : 'frontend' ) : 'false' ).'"
|
||||||
|
validate="numeric"
|
||||||
|
/>
|
||||||
|
';
|
||||||
|
return $xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function loadData($field, $user, &$data)
|
||||||
|
{
|
||||||
|
$alias=$field->alias;
|
||||||
|
if(isset($user->$alias)) $data->$alias=$user->$alias;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function storeData($field, $data, &$storeData)
|
||||||
|
{
|
||||||
|
//if($field->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) return;
|
||||||
|
//if($field->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('task')=='profile.save' && JFactory::getApplication()->isSite()) return;
|
||||||
|
$alias=$field->alias;
|
||||||
|
if(isset($data[$alias])) $storeData[$alias]=$data[$alias];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchInput($field)
|
||||||
|
{
|
||||||
|
$max='max="'.$field->params->get('numeric_max',999999).'"';
|
||||||
|
$min='min="'.$field->params->get('numeric_min',0).'"';
|
||||||
|
$step='step="'.$field->params->get('numeric_step',1).'"';
|
||||||
|
|
||||||
|
$return=array();
|
||||||
|
$return[]='<input id="jform_'.str_replace('-','_',$field->alias).'" type="hidden" name="'.$field->alias.'" value="1" /><div class=""><div class="numericsearch">';
|
||||||
|
$return[]='<input type="number" placeholder="'.JText::_('COM_JSN_STARTNUMERIC').'" '.$min.$max.$step.'name="'.$field->alias.'_from" value="'.JFactory::getApplication()->input->get($field->alias.'_from','','raw').'"/>';
|
||||||
|
$return[]='</div> <div class="numericsearch">';
|
||||||
|
$return[]='<input type="number" placeholder="'.JText::_('COM_JSN_ENDNUMERIC').'" '.$min.$max.$step.'name="'.$field->alias.'_to" value="'.JFactory::getApplication()->input->get($field->alias.'_to','','raw').'"/>';
|
||||||
|
$return[]='</div><div class="numericsearchtip"><span class="label label-default">'.JText::_('COM_JSN_CHOOSENUMERICINTERVAL').'</span></div></div>';
|
||||||
|
|
||||||
|
return implode('',$return);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchQuery($field, &$query)
|
||||||
|
{
|
||||||
|
$db=JFactory::getDbo();
|
||||||
|
if(JFactory::getApplication()->input->get($field->alias.'_from','','raw')!='') $query->where('b.'.$db->quoteName($field->alias).' >= '.$db->quote(JFactory::getApplication()->input->get($field->alias.'_from','','raw')));
|
||||||
|
if(JFactory::getApplication()->input->get($field->alias.'_to','','raw')!='') $query->where('b.'.$db->quoteName($field->alias).' <= '.$db->quote(JFactory::getApplication()->input->get($field->alias.'_to','','raw')));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<form>
|
||||||
|
<fields name="params">
|
||||||
|
<fieldset
|
||||||
|
name="numeric"
|
||||||
|
label="COM_JSN_NUMERIC_FIELDSET_LABEL"
|
||||||
|
>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="numeric_defaultvalue"
|
||||||
|
label="COM_JSN_GENERAL_DEFAULTVALUE"
|
||||||
|
description ="COM_JSN_GENERAL_DEFAULTVALUE_DESC"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="numeric_max"
|
||||||
|
label="COM_JSN_NUMERIC_MAX"
|
||||||
|
description ="COM_JSN_NUMERIC_MAX_DESC"
|
||||||
|
type="text"
|
||||||
|
filter="int"
|
||||||
|
default="999999"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="numeric_min"
|
||||||
|
label="COM_JSN_NUMERIC_MIN"
|
||||||
|
description ="COM_JSN_NUMERIC_MIN_DESC"
|
||||||
|
type="text"
|
||||||
|
filter="int"
|
||||||
|
default="0"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="numeric_step"
|
||||||
|
label="COM_JSN_NUMERIC_STEP"
|
||||||
|
description ="COM_JSN_NUMERIC_STEP_DESC"
|
||||||
|
type="text"
|
||||||
|
filter="int"
|
||||||
|
default="1"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
</form>
|
||||||
@ -0,0 +1,136 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
class JsnPasswordFieldHelper
|
||||||
|
{
|
||||||
|
public static function create($alias)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function delete($alias)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getXml($item)
|
||||||
|
{
|
||||||
|
$version=new JVersion();
|
||||||
|
$xml='';
|
||||||
|
if(JFactory::getApplication()->isSite())
|
||||||
|
{
|
||||||
|
$configUsers=JComponentHelper::getParams('com_users');
|
||||||
|
$configJsn=JComponentHelper::getParams('com_jsn');
|
||||||
|
if(JFactory::getApplication()->input->get('view')=='registration') $required='required="true"';
|
||||||
|
else $required='';
|
||||||
|
if($configJsn->get('passwordstrengthmeter',0)) $strengthmeter='strengthmeter="true"';
|
||||||
|
else $strengthmeter='';
|
||||||
|
$hideTitle= ($item->params->get('hidetitle',0) && JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn') || ($item->params->get('hidetitleedit',0) && (JFactory::getApplication()->input->get('layout','')=='edit' || JFactory::getApplication()->input->get('view','')=='registration'));
|
||||||
|
if(JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn' && $item->params->get('titleprofile','')!='') $item->title=$item->params->get('titleprofile','');
|
||||||
|
$placeholder=($item->params->get('password_placeholder','')!='' ? 'hint="'.JsnHelper::xmlentities($item->params->get('password_placeholder','')).'"' : '');
|
||||||
|
$placeholder2=($item->params->get('password_placeholder2','')!='' ? 'hint="'.JsnHelper::xmlentities($item->params->get('password_placeholder2','')).'"' : '');
|
||||||
|
$xml.='
|
||||||
|
<field name="password1" type="passwordfull"
|
||||||
|
autocomplete="off"
|
||||||
|
class="validate-password '.$item->params->get('field_cssclass','').'"
|
||||||
|
description="COM_USERS_DESIRED_PASSWORD"
|
||||||
|
filter="raw"
|
||||||
|
label="'.($hideTitle ? JsnHelper::xmlentities('<span class="no-title">'.JText::_($item->title).'</span>') : JsnHelper::xmlentities($item->title)).'"
|
||||||
|
size="30"
|
||||||
|
minimum_length="'.$configUsers->get('minimum_length',4).'"
|
||||||
|
minimum_integers="'.$configUsers->get('minimum_integers',0).'"
|
||||||
|
minimum_symbols="'.$configUsers->get('minimum_symbols',0).'"
|
||||||
|
minimum_uppercase="'.$configUsers->get('minimum_uppercase',0).'"
|
||||||
|
'.(($version->RELEASE=='3.0' || $version->getShortVersion()=='3.1.1' || $version->getShortVersion()=='3.1.0') ? 'field="password2" validate="equals" message="COM_USERS_PROFILE_PASSWORD1_MESSAGE"' : 'validate="password"').'
|
||||||
|
'.$required.'
|
||||||
|
'.$placeholder.'
|
||||||
|
'.$strengthmeter.'
|
||||||
|
/>
|
||||||
|
';
|
||||||
|
$config = JComponentHelper::getParams('com_jsn');
|
||||||
|
if($config->get('confirmuserpassword',1) || JFactory::getApplication()->input->get('layout','')=='edit')
|
||||||
|
{
|
||||||
|
$xml.='
|
||||||
|
<field name="password2" type="confirmpassword"
|
||||||
|
autocomplete="off"
|
||||||
|
'.(($version->RELEASE=='3.0' || $version->getShortVersion()=='3.1.1' || $version->getShortVersion()=='3.1.0') ? '' : 'field="password1" validate="equals" message="COM_USERS_PROFILE_PASSWORD1_MESSAGE"').'
|
||||||
|
class="validate-confirmpassword"
|
||||||
|
description="COM_USERS_PROFILE_PASSWORD2_DESC"
|
||||||
|
filter="raw"
|
||||||
|
label="'.($hideTitle ? JsnHelper::xmlentities('<span class="no-title">'.JText::_('COM_JSN_PROFILE_PASSWORD2_LABEL').'</span>') : 'COM_JSN_PROFILE_PASSWORD2_LABEL').'"
|
||||||
|
size="30"
|
||||||
|
'.$required.'
|
||||||
|
'.$placeholder2.'
|
||||||
|
/>
|
||||||
|
';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$configJsn=JComponentHelper::getParams('com_jsn');
|
||||||
|
if($configJsn->get('passwordstrengthmeter',0)) $strengthmeter='strengthmeter="true"';
|
||||||
|
|
||||||
|
$hideTitle= ($item->params->get('hidetitle',0) && JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn') || ($item->params->get('hidetitleedit',0) && (JFactory::getApplication()->input->get('layout','')=='edit' || JFactory::getApplication()->input->get('view','')=='registration'));
|
||||||
|
if(JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn' && $item->params->get('titleprofile','')!='') $item->title=$item->params->get('titleprofile','');
|
||||||
|
$placeholder=($item->params->get('password_placeholder','')!='' ? 'hint="'.JsnHelper::xmlentities($item->params->get('password_placeholder','')).'"' : '');
|
||||||
|
$placeholder2=($item->params->get('password_placeholder2','')!='' ? 'hint="'.JsnHelper::xmlentities($item->params->get('password_placeholder2','')).'"' : '');
|
||||||
|
if(JFactory::getApplication()->input->get('option','')=='com_admin')
|
||||||
|
{
|
||||||
|
$password1_desc='COM_ADMIN_USER_FIELD_PASSWORD_DESC';
|
||||||
|
$password2_label='COM_ADMIN_USER_FIELD_PASSWORD2_LABEL';
|
||||||
|
$password2_desc='COM_ADMIN_USER_FIELD_PASSWORD2_DESC';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$password1_desc='COM_USERS_USER_FIELD_PASSWORD_DESC';
|
||||||
|
$password2_label='COM_USERS_USER_FIELD_PASSWORD2_LABEL';
|
||||||
|
$password2_desc='COM_USERS_USER_FIELD_PASSWORD2_DESC';
|
||||||
|
}
|
||||||
|
|
||||||
|
$xml.='
|
||||||
|
<field name="password" type="passwordfull"
|
||||||
|
autocomplete="off"
|
||||||
|
class="validate-password"
|
||||||
|
description="'.$password1_desc.'"
|
||||||
|
filter="raw"
|
||||||
|
validate="password"
|
||||||
|
label="'.($hideTitle ? JsnHelper::xmlentities('<span class="no-title">'.JText::_($item->title).'</span>') : JsnHelper::xmlentities($item->title)).'"
|
||||||
|
size="30"
|
||||||
|
'.$placeholder.'
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field name="password2" type="confirmpassword"
|
||||||
|
autocomplete="off"
|
||||||
|
class="validate-confirmpassword"
|
||||||
|
description="'.$password2_desc.'"
|
||||||
|
filter="raw"
|
||||||
|
label="'.($hideTitle ? JsnHelper::xmlentities('<span class="no-title">'.JText::_($password2_label).'</span>') : $password2_label).'"
|
||||||
|
size="30"
|
||||||
|
validate="equals"
|
||||||
|
field="password"
|
||||||
|
'.$placeholder2.'
|
||||||
|
/>
|
||||||
|
';
|
||||||
|
|
||||||
|
}
|
||||||
|
return $xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function loadData($field, $user, &$data)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function storeData($field, $data, &$storeData)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<form>
|
||||||
|
<fields name="params">
|
||||||
|
<fieldset
|
||||||
|
name="password"
|
||||||
|
label="COM_JSN_PASSWORD_FIELDSET_LABEL"
|
||||||
|
>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="password_placeholder"
|
||||||
|
label="COM_JSN_GENERAL_PLACEHOLDER"
|
||||||
|
description ="COM_JSN_GENERAL_PLACEHOLDER_DESC"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="password_placeholder2"
|
||||||
|
label="COM_JSN_GENERAL_PLACEHOLDER2"
|
||||||
|
description ="COM_JSN_GENERAL_PLACEHOLDER_DESC2"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
</form>
|
||||||
@ -0,0 +1,109 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
global $_FIELDTYPES;
|
||||||
|
$_FIELDTYPES['phone']='COM_JSN_FIELDTYPE_PHONE';
|
||||||
|
|
||||||
|
class JsnPhoneFieldHelper
|
||||||
|
{
|
||||||
|
public static function create($alias)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = "ALTER TABLE #__jsn_users ADD ".$db->quoteName($alias)." VARCHAR(100)";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function delete($alias)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = "ALTER TABLE #__jsn_users DROP COLUMN ".$db->quoteName($alias);
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getXml($item)
|
||||||
|
{
|
||||||
|
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
|
||||||
|
$hideTitle= ($item->params->get('hidetitle',0) && JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn') || ($item->params->get('hidetitleedit',0) && (JFactory::getApplication()->input->get('layout','')=='edit' || JFactory::getApplication()->input->get('view','')=='registration'));
|
||||||
|
if(JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn' && $item->params->get('titleprofile','')!='') $item->title=$item->params->get('titleprofile','');
|
||||||
|
$defaultvalue=($item->params->get('phone_defaultvalue','')!='' ? 'default="'.JsnHelper::xmlentities($item->params->get('phone_defaultvalue','')).'"' : '');
|
||||||
|
$placeholder=($item->params->get('phone_placeholder','')!='' ? 'hint="'.JsnHelper::xmlentities($item->params->get('phone_placeholder','')).'"' : '');
|
||||||
|
|
||||||
|
if($item->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
elseif($item->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('view')!='registration' && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
else $readonly='';
|
||||||
|
|
||||||
|
$type='phone';
|
||||||
|
|
||||||
|
$xml='';
|
||||||
|
|
||||||
|
$xml.='
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="'.$item->alias.'"
|
||||||
|
type="'.$type.'"
|
||||||
|
id="'.$item->alias.'"
|
||||||
|
description="'.JsnHelper::xmlentities(($item->description)).'"
|
||||||
|
validate="phone"
|
||||||
|
class="validate-phone '.$item->params->get('field_cssclass','').'"
|
||||||
|
label="'.($hideTitle ? JsnHelper::xmlentities('<span class="no-title">'.JText::_($item->title).'</span>') : JsnHelper::xmlentities($item->title)).'"
|
||||||
|
size="30"
|
||||||
|
'.$defaultvalue.'
|
||||||
|
'.$placeholder.'
|
||||||
|
'.$readonly.'
|
||||||
|
required="'.($item->required ? ($item->required==2 ? 'admin' : 'frontend' ) : 'false' ).'"
|
||||||
|
/>
|
||||||
|
';
|
||||||
|
return $xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function loadData($field, $user, &$data)
|
||||||
|
{
|
||||||
|
$alias=$field->alias;
|
||||||
|
if(isset($user->$alias)) $data->$alias=$user->$alias;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function storeData($field, $data, &$storeData)
|
||||||
|
{
|
||||||
|
//if($field->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) return;
|
||||||
|
//if($field->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('task')=='profile.save' && JFactory::getApplication()->isSite()) return;
|
||||||
|
$alias=$field->alias;
|
||||||
|
if(isset($data[$alias])) $storeData[$alias]=$data[$alias];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchInput($field)
|
||||||
|
{
|
||||||
|
$return='<input id="jform_'.str_replace('-','_',$field->alias).'" type="text" placeholder="'.JText::_('COM_JSN_SEARCHFOR').' '.JText::_($field->title).'..." name="'.$field->alias.'" value="'.JFactory::getApplication()->input->get($field->alias,'','raw').'"/>';
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchQuery($field, &$query)
|
||||||
|
{
|
||||||
|
$db=JFactory::getDbo();
|
||||||
|
$query->where('b.'.$db->quoteName($field->alias).' LIKE '.$db->quote('%'.JFactory::getApplication()->input->get($field->alias,null,'raw').'%'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function phone($field)
|
||||||
|
{
|
||||||
|
$value=$field->__get('value');
|
||||||
|
if (empty($value))
|
||||||
|
{
|
||||||
|
return JHtml::_('users.value', $value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return '<a href="tel:'.$value.'">'.$value.'</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<form>
|
||||||
|
<fields name="params">
|
||||||
|
<fieldset
|
||||||
|
name="phone"
|
||||||
|
label="COM_JSN_PHONE_FIELDSET_LABEL"
|
||||||
|
>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="phone_defaultvalue"
|
||||||
|
label="COM_JSN_GENERAL_DEFAULTVALUE"
|
||||||
|
description ="COM_JSN_GENERAL_DEFAULTVALUE_DESC"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="phone_placeholder"
|
||||||
|
label="COM_JSN_GENERAL_PLACEHOLDER"
|
||||||
|
description ="COM_JSN_GENERAL_PLACEHOLDER_DESC"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
</form>
|
||||||
@ -0,0 +1,153 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
global $_FIELDTYPES;
|
||||||
|
$_FIELDTYPES['radiolist']='COM_JSN_FIELDTYPE_RADIO';
|
||||||
|
|
||||||
|
class JsnRadiolistFieldHelper
|
||||||
|
{
|
||||||
|
public static function create($alias)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = "ALTER TABLE #__jsn_users ADD ".$db->quoteName($alias)." VARCHAR(255)";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function delete($alias)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = "ALTER TABLE #__jsn_users DROP COLUMN ".$db->quoteName($alias);
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getXml($item)
|
||||||
|
{
|
||||||
|
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
|
||||||
|
$hideTitle= ($item->params->get('hidetitle',0) && JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn') || ($item->params->get('hidetitleedit',0) && (JFactory::getApplication()->input->get('layout','')=='edit' || JFactory::getApplication()->input->get('view','')=='registration'));
|
||||||
|
if(JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn' && $item->params->get('titleprofile','')!='') $item->title=$item->params->get('titleprofile','');
|
||||||
|
$defaultvalue=($item->params->get('radio_defaultvalue','')!='' ? 'default="'.JsnHelper::xmlentities($item->params->get('radio_defaultvalue','')).'"' : '');
|
||||||
|
$inline=($item->params->get('radio_inline',0) ? 'optioninline="'.$item->params->get('radio_inline','').'"' : '');
|
||||||
|
|
||||||
|
if($item->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
elseif($item->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('view')!='registration' && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
else $readonly='';
|
||||||
|
|
||||||
|
$options=array();
|
||||||
|
$optTxt=explode("\n",$item->params->get('radio_options',''));
|
||||||
|
foreach($optTxt as $opt)
|
||||||
|
{
|
||||||
|
$opt=explode('|',$opt);
|
||||||
|
if(count($opt)==1) $options[]='<option value="'.trim(JsnHelper::xmlentities($opt[0])).'">'.trim(JsnHelper::xmlentities($opt[0])).'</option>';
|
||||||
|
if(count($opt)==2) $options[]='<option value="'.trim(JsnHelper::xmlentities($opt[0])).'">'.trim(JsnHelper::xmlentities($opt[1])).'</option>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$xml='';
|
||||||
|
|
||||||
|
$xml.='
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="'.$item->alias.'"
|
||||||
|
type="radiolist"
|
||||||
|
id="'.$item->alias.'"
|
||||||
|
description="'.JsnHelper::xmlentities(($item->description)).'"
|
||||||
|
label="'.($hideTitle ? JsnHelper::xmlentities('<span class="no-title">'.JText::_($item->title).'</span>') : JsnHelper::xmlentities($item->title)).'"
|
||||||
|
'.$defaultvalue.'
|
||||||
|
'.$inline.'
|
||||||
|
'.$readonly.'
|
||||||
|
class="'.$item->params->get('field_cssclass','').'"
|
||||||
|
required="'.($item->required ? ($item->required==2 ? 'admin' : 'frontend' ) : 'false' ).'"
|
||||||
|
>
|
||||||
|
'.implode(' ',$options).'
|
||||||
|
</field>
|
||||||
|
';
|
||||||
|
return $xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function loadData($field, $user, &$data)
|
||||||
|
{
|
||||||
|
$alias=$field->alias;
|
||||||
|
if(isset($user->$alias)) $data->$alias=$user->$alias;
|
||||||
|
//elseif($field->params->get('radio_defaultvalue','')!=''/*isset($field->params['text_defaultvalue']) && $field->params['text_defaultvalue']!=''*/) $data->$alias=$field->params->get('radio_defaultvalue','');//$field->params['text_defaultvalue'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function storeData($field, $data, &$storeData)
|
||||||
|
{
|
||||||
|
//if($field->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) return;
|
||||||
|
//if($field->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('task')=='profile.save' && JFactory::getApplication()->isSite()) return;
|
||||||
|
$alias=$field->alias;
|
||||||
|
if(isset($data[$alias])) $storeData[$alias]=$data[$alias];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function radiolist($field)
|
||||||
|
{
|
||||||
|
$value=$field->__get('value');
|
||||||
|
if (empty($value) && (string) $value != '0')
|
||||||
|
{
|
||||||
|
return JHtml::_('users.value', $value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$options=$field->getOptions();
|
||||||
|
$result='';
|
||||||
|
foreach($options as $option)
|
||||||
|
{
|
||||||
|
if($option->value==$value) $result=JText::_($option->text);
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchInput($field)
|
||||||
|
{
|
||||||
|
$selectedOptions=JFactory::getApplication()->input->get($field->alias,null,'raw');
|
||||||
|
$options=array();
|
||||||
|
$optTxt=explode("\n",$field->params->get('radio_options',''));
|
||||||
|
foreach($optTxt as $opt)
|
||||||
|
{
|
||||||
|
$opt=explode('|',$opt);
|
||||||
|
if(count($opt)==1) $options[]=JHtml::_('select.option', trim($opt[0]), JText::_(trim(htmlspecialchars($opt[0]))));
|
||||||
|
if(count($opt)==2) $options[]=JHtml::_('select.option', trim($opt[0]), JText::_(trim(htmlspecialchars($opt[1]))));
|
||||||
|
}
|
||||||
|
|
||||||
|
$return=JHtml::_('select.radiolist', $options, $field->alias.'[]', null, 'value', 'text', null, $field->alias);
|
||||||
|
$from=array('<div','</div>','type="radio"','class="radio"','class="controls"');
|
||||||
|
if($field->params->get('radio_inline',0)==0) $to=array('<fieldset class="checkboxes"','</fieldset>','type="checkbox"','class="checkbox"','id="jform_'.str_replace('-','_',$field->alias).'"');
|
||||||
|
else $to=array('<fieldset class="checkboxes"','</fieldset>','type="checkbox"','class="checkbox inline"','id="jform_'.str_replace('-','_',$field->alias).'"');
|
||||||
|
if($selectedOptions!=null)
|
||||||
|
{
|
||||||
|
foreach($selectedOptions as $selectedOption)
|
||||||
|
{
|
||||||
|
$from[]='value="'.$selectedOption.'"';
|
||||||
|
$to[]='value="'.$selectedOption.'" checked="checked"';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return str_replace($from,$to,$return);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchQuery($field, &$query)
|
||||||
|
{
|
||||||
|
$options=JFactory::getApplication()->input->get($field->alias,null,'raw');
|
||||||
|
$db=JFactory::getDbo();
|
||||||
|
|
||||||
|
$where='';
|
||||||
|
foreach($options as $option)
|
||||||
|
{
|
||||||
|
$where.='b.'.$db->quoteName($field->alias).' = '.$db->quote($option).' OR ';
|
||||||
|
}
|
||||||
|
$where=substr($where, 0,-4);
|
||||||
|
$query->where('('.$where.')');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<form>
|
||||||
|
<fields name="params">
|
||||||
|
<fieldset
|
||||||
|
name="radiolist"
|
||||||
|
label="COM_JSN_RADIO_FIELDSET_LABEL"
|
||||||
|
>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="radio_defaultvalue"
|
||||||
|
label="COM_JSN_GENERAL_DEFAULTVALUE"
|
||||||
|
description ="COM_JSN_GENERAL_DEFAULTVALUE"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="radio_options"
|
||||||
|
label="COM_JSN_RADIO_OPTIONS"
|
||||||
|
description ="COM_JSN_RADIO_OPTIONS_DESC"
|
||||||
|
rows="10"
|
||||||
|
class="span6"
|
||||||
|
type="textarea"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="radio_inline"
|
||||||
|
label="COM_JSN_OPTIONS_INLINE"
|
||||||
|
description ="COM_JSN_OPTIONS_INLINE_DESC"
|
||||||
|
class="btn-group"
|
||||||
|
type="radio"
|
||||||
|
default="0"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
</form>
|
||||||
@ -0,0 +1,137 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
class JsnRegisterdateFieldHelper
|
||||||
|
{
|
||||||
|
public static function create($alias)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function delete($alias)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getXml($item)
|
||||||
|
{
|
||||||
|
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
|
||||||
|
$xml='';
|
||||||
|
$hideTitle= ($item->params->get('hidetitle',0) && JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn') || ($item->params->get('hidetitleedit',0) && (JFactory::getApplication()->input->get('layout','')=='edit' || JFactory::getApplication()->input->get('view','')=='registration'));
|
||||||
|
if(JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn' && $item->params->get('titleprofile','')!='') $item->title=$item->params->get('titleprofile','');
|
||||||
|
if(JFactory::getApplication()->isSite())
|
||||||
|
$xml='
|
||||||
|
<field
|
||||||
|
name="registerdate"
|
||||||
|
type="registerdate"
|
||||||
|
class="readonly '.$item->params->get('field_cssclass','').'"
|
||||||
|
label="'.($hideTitle ? JsnHelper::xmlentities('<span class="no-title">'.JText::_($item->title).'</span>') : JsnHelper::xmlentities($item->title)).'"
|
||||||
|
description=""
|
||||||
|
readonly="true"
|
||||||
|
format="%Y-%m-%d %H:%M:%S"
|
||||||
|
size="22"
|
||||||
|
filter="user_utc"
|
||||||
|
/>
|
||||||
|
';
|
||||||
|
return $xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function loadData($field, $user, &$data)
|
||||||
|
{
|
||||||
|
if(isset($data->registerDate)) $data->registerdate=$data->registerDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function storeData($field, $data, &$storeData)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function registerdate($field)
|
||||||
|
{
|
||||||
|
$value=$field->__get('value');
|
||||||
|
if (empty($value))
|
||||||
|
{
|
||||||
|
return JHtml::_('users.value', $value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return JHtml::_('date', $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchInput($field)
|
||||||
|
{
|
||||||
|
if(JText::_('COM_JSN_STARTMONDAY')=='1') $date_weekstart=' data-date-weekstart="1"';
|
||||||
|
else $date_weekstart='';
|
||||||
|
|
||||||
|
$doc=JFactory::getDocument();
|
||||||
|
JHtml::_('bootstrap.framework');
|
||||||
|
$doc->addScript(JURI::root().'components/com_jsn/assets/js/bootstrap-datepicker.js');
|
||||||
|
$doc->addStylesheet(JURI::root().'components/com_jsn/assets/css/datepicker.css');
|
||||||
|
$return=array();
|
||||||
|
$return[]='<input id="jform_'.str_replace('-','_',$field->alias).'" type="hidden" name="'.$field->alias.'" value="1" /><div class=""><div class="bsdatesearch">';
|
||||||
|
$return[]='<div'.$date_weekstart.' data-date-viewmode="'.$field->params->get('date_viewmode','days').'" data-date-format="'.JText::_('COM_JSN_DATE_INPUT_FORMAT').'" data-date="'.JFactory::getApplication()->input->get($field->alias.'_from','','raw').'" id="'.$field->alias.'_from" class="input-prepend date bsdate"><span class="btn btn-success"><i class="icon icon-calendar"></i></span><span class="btn btn-danger"><i class="icon icon-remove jsndateremove"></i></span><input placeholder="'.JText::_('COM_JSN_STARTDATE').'" type="text" readonly="readonly" value="'.JFactory::getApplication()->input->get($field->alias.'_from','','raw').'" name="'.$field->alias.'_from" /></div>';
|
||||||
|
$return[]='</div><div class="bsdatesearch">';
|
||||||
|
$return[]='<div'.$date_weekstart.' data-date-viewmode="'.$field->params->get('date_viewmode','days').'" data-date-format="'.JText::_('COM_JSN_DATE_INPUT_FORMAT').'" data-date="'.JFactory::getApplication()->input->get($field->alias.'_to','','raw').'" id="'.$field->alias.'_to" class="input-prepend date bsdate"><span class="btn btn-success"><i class="icon icon-calendar"></i></span><span class="btn btn-danger"><i class="icon icon-remove jsndateremove"></i></span><input placeholder="'.JText::_('COM_JSN_ENDDATE').'" type="text" readonly="readonly" value="'.JFactory::getApplication()->input->get($field->alias.'_to','','raw').'" name="'.$field->alias.'_to" /></div>';
|
||||||
|
$return[]='</div><div class="bsdatesearchtip"><span class="label label-default">'.JText::_('COM_JSN_CHOOSEDATEINTERVAL').'</span></div></div>';
|
||||||
|
static $init=0;
|
||||||
|
if($init==0){
|
||||||
|
$script='
|
||||||
|
var DPGlobalDates = {
|
||||||
|
days: ["'.JText::_("SUNDAY").'", "'.JText::_("MONDAY").'", "'.JText::_("TUESDAY").'", "'.JText::_("WEDNESDAY").'", "'.JText::_("THURSDAY").'", "'.JText::_("FRIDAY").'", "'.JText::_("SATURDAY").'", "'.JText::_("SUNDAY").'"],
|
||||||
|
daysShort: ["'.JText::_("SUN").'", "'.JText::_("MON").'", "'.JText::_("TUE").'", "'.JText::_("WED").'", "'.JText::_("THU").'", "'.JText::_("FRI").'", "'.JText::_("SAT").'", "'.JText::_("SUN").'"],
|
||||||
|
daysMin: ["'.JText::_("SUN").'", "'.JText::_("MON").'", "'.JText::_("TUE").'", "'.JText::_("WED").'", "'.JText::_("THU").'", "'.JText::_("FRI").'", "'.JText::_("SAT").'", "'.JText::_("SUN").'"],
|
||||||
|
months: ["'.JText::_("JANUARY").'", "'.JText::_("FEBRUARY").'", "'.JText::_("MARCH").'", "'.JText::_("APRIL").'", "'.JText::_("MAY").'", "'.JText::_("JUNE").'", "'.JText::_("JULY").'", "'.JText::_("AUGUST").'", "'.JText::_("SEPTEMBER").'", "'.JText::_("OCTOBER").'", "'.JText::_("NOVEMBER").'", "'.JText::_("DECEMBER").'"],
|
||||||
|
monthsShort: ["'.JText::_("JANUARY_SHORT").'", "'.JText::_("FEBRUARY_SHORT").'", "'.JText::_("MARCH_SHORT").'", "'.JText::_("APRIL_SHORT").'", "'.JText::_("MAY_SHORT").'", "'.JText::_("JUNE_SHORT").'", "'.JText::_("JULY_SHORT").'", "'.JText::_("AUGUST_SHORT").'", "'.JText::_("SEPTEMBER_SHORT").'", "'.JText::_("OCTOBER_SHORT").'", "'.JText::_("NOVEMBER_SHORT").'", "'.JText::_("DECEMBER_SHORT").'"]
|
||||||
|
};
|
||||||
|
';
|
||||||
|
}
|
||||||
|
else $script='';
|
||||||
|
$init=1;
|
||||||
|
$script.='
|
||||||
|
jQuery(document).ready(function($){
|
||||||
|
var nowTemp = new Date();
|
||||||
|
var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0);
|
||||||
|
$("#'.$field->alias.'_from").jsndatepicker();
|
||||||
|
$("#'.$field->alias.'_to").jsndatepicker();
|
||||||
|
|
||||||
|
|
||||||
|
$("#'.$field->alias.'_from .jsndateremove").click(function(){
|
||||||
|
//'.$field->alias.'_from.setValue(newDate);
|
||||||
|
$("#'.$field->alias.'_from input").val("");
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
$("#'.$field->alias.'_to .jsndateremove").click(function(){
|
||||||
|
//'.$field->alias.'_to.setValue(newDate);
|
||||||
|
//$("#'.$field->alias.'_to").attr("data-date","");
|
||||||
|
$("#'.$field->alias.'_to input").val("");
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
';
|
||||||
|
$doc->addScriptDeclaration( $script );
|
||||||
|
return implode('',$return);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchQuery($field, &$query)
|
||||||
|
{
|
||||||
|
$date_from=new JDate(str_replace('/','-',JFactory::getApplication()->input->get($field->alias.'_from','','raw')));
|
||||||
|
$date_to=new JDate(str_replace('/','-',JFactory::getApplication()->input->get($field->alias.'_to','','raw')));
|
||||||
|
$db=JFactory::getDbo();
|
||||||
|
//$from=JDate::getInstance((JFactory::getApplication()->input->get($field->alias.'_from','')=='' ? '0000-00-00' : $date_from->toSql()));
|
||||||
|
//$to=JDate::getInstance((JFactory::getApplication()->input->get($field->alias.'_to','')=='' ? '9999-00-00' : $date_to->toSql()));
|
||||||
|
if(JFactory::getApplication()->input->get($field->alias.'_from','','raw')!='') $query->where('a.'.$db->quoteName('registerDate').' > '.$db->quote($date_from->toSql()));
|
||||||
|
if(JFactory::getApplication()->input->get($field->alias.'_to','','raw')!='') $query->where('a.'.$db->quoteName('registerDate').' < '.$db->quote($date_to->toSql()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,405 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
global $_FIELDTYPES;
|
||||||
|
$_FIELDTYPES['selectlist']='COM_JSN_FIELDTYPE_SELECT';
|
||||||
|
|
||||||
|
class JsnSelectlistFieldHelper
|
||||||
|
{
|
||||||
|
public static function create($alias)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = "ALTER TABLE #__jsn_users ADD ".$db->quoteName($alias)." VARCHAR(255)";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function delete($alias)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = "ALTER TABLE #__jsn_users DROP COLUMN ".$db->quoteName($alias);
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getXml($item)
|
||||||
|
{
|
||||||
|
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
|
||||||
|
$hideTitle= ($item->params->get('hidetitle',0) && JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn') || ($item->params->get('hidetitleedit',0) && (JFactory::getApplication()->input->get('layout','')=='edit' || JFactory::getApplication()->input->get('view','')=='registration'));
|
||||||
|
if(JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn' && $item->params->get('titleprofile','')!='') $item->title=$item->params->get('titleprofile','');
|
||||||
|
$defaultvalue=($item->params->get('select_defaultvalue','')!='' ? 'default="'.JsnHelper::xmlentities($item->params->get('select_defaultvalue','')).'"' : '');//(isset($item->params['text_defaultvalue']) && $item->params['text_defaultvalue']!='' ? 'default="'.$item->params['text_defaultvalue'].'"' : '');
|
||||||
|
$multiple=($item->params->get('select_multiple',0) ? 'multiple="true"' : '');
|
||||||
|
$dbtable=($item->params->get('select_dbopttable','')=='' ? '' : 'dbopttable="'.$item->params->get('select_dbopttable','').'"');
|
||||||
|
$dbvalue=($item->params->get('select_dboptvalue','')=='' ? '' : 'dboptvalue="'.$item->params->get('select_dboptvalue','').'"');
|
||||||
|
$dbtext=($item->params->get('select_dbopttext','')=='' ? '' : 'dbopttext="'.$item->params->get('select_dbopttext','').'"');
|
||||||
|
$dbwhere=($item->params->get('select_dboptwhere','')=='' ? '' : 'dboptwhere="'.JsnHelper::xmlentities($item->params->get('select_dboptwhere','')).'"');
|
||||||
|
$dbfiltervalue=($item->params->get('select_dboptfiltervalue','')=='' ? '' : 'dboptfiltervalue="'.JsnHelper::xmlentities($item->params->get('select_dboptfiltervalue','')).'"');
|
||||||
|
$dbfiltercolumn=($item->params->get('select_dboptfiltercolumn','')=='' ? '' : 'dboptfiltercolumn="'.JsnHelper::xmlentities($item->params->get('select_dboptfiltercolumn','')).'"');
|
||||||
|
$placeholder=($item->params->get('select_placeholder','')!='' ? 'hint="'.JsnHelper::xmlentities($item->params->get('select_placeholder','')).'"' : '');
|
||||||
|
|
||||||
|
if($item->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
elseif($item->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('view')!='registration' && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
else $readonly='';
|
||||||
|
|
||||||
|
$options=array();
|
||||||
|
$optTxt=explode("\n",$item->params->get('select_options',''));
|
||||||
|
foreach($optTxt as $opt)
|
||||||
|
{
|
||||||
|
$opt=trim($opt);
|
||||||
|
if($opt!=''){
|
||||||
|
$opt=explode('|',$opt);
|
||||||
|
if(count($opt)==1) $options[]='<option value="'.trim(JsnHelper::xmlentities($opt[0])).'">'.trim(JsnHelper::xmlentities($opt[0])).'</option>';
|
||||||
|
if(count($opt)==2) $options[]='<option value="'.trim(JsnHelper::xmlentities($opt[0])).'">'.trim(JsnHelper::xmlentities($opt[1])).'</option>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$xml='';
|
||||||
|
|
||||||
|
if(!$item->params->get('select_multiple',0)) {
|
||||||
|
if($item->params->get('select_placeholder','')=='') $noval='<option value="">COM_JSN_NOSELECTION</option>';
|
||||||
|
else $noval='<option value="">'.JsnHelper::xmlentities($item->params->get('select_placeholder','')).'</option>';
|
||||||
|
}
|
||||||
|
else $noval='';
|
||||||
|
|
||||||
|
$xml.='
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="'.$item->alias.'"
|
||||||
|
type="selectlist"
|
||||||
|
id="'.$item->alias.'"
|
||||||
|
description="'.htmlspecialchars(($item->description)).'"
|
||||||
|
label="'.($hideTitle ? JsnHelper::xmlentities('<span class="no-title">'.JText::_($item->title).'</span>') : htmlspecialchars($item->title)).'"
|
||||||
|
'.$defaultvalue.'
|
||||||
|
'.$multiple.'
|
||||||
|
'.$dbtable.'
|
||||||
|
'.$dbvalue.'
|
||||||
|
'.$dbtext.'
|
||||||
|
'.$dbwhere.'
|
||||||
|
'.$placeholder.'
|
||||||
|
'.$dbfiltervalue.'
|
||||||
|
'.$dbfiltercolumn.'
|
||||||
|
'.$readonly.'
|
||||||
|
class="'.$item->params->get('field_cssclass','').'"
|
||||||
|
required="'.($item->required ? ($item->required==2 ? 'admin' : 'frontend' ) : 'false' ).'"
|
||||||
|
>
|
||||||
|
'.$noval.'
|
||||||
|
'.implode(' ',$options).'
|
||||||
|
</field>
|
||||||
|
';
|
||||||
|
return $xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function loadData($field, $user, &$data)
|
||||||
|
{
|
||||||
|
//if($field->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) return;
|
||||||
|
//if($field->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('task')=='profile.save' && JFactory::getApplication()->isSite()) return;
|
||||||
|
$alias=$field->alias;
|
||||||
|
if(isset($user->$alias)) $data->$alias=($field->params->get('select_multiple',0) ? json_decode($user->$alias) : $user->$alias);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function storeData($field, $data, &$storeData)
|
||||||
|
{
|
||||||
|
$alias=$field->alias;
|
||||||
|
if(isset($data[$alias])) $storeData[$alias]=($field->params->get('select_multiple',0) ? json_encode($data[$alias]) : $data[$alias]);
|
||||||
|
elseif(JFactory::getApplication()->input->get('jform_'.$alias,null,'raw')) $storeData[$alias]='';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function selectlist($field)
|
||||||
|
{
|
||||||
|
$value=$field->__get('value');
|
||||||
|
if (empty($value) && (string) $value != '0')
|
||||||
|
{
|
||||||
|
return JHtml::_('users.value', $value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$options=$field->getOptions();
|
||||||
|
if(is_array($value))
|
||||||
|
{
|
||||||
|
$result=array();
|
||||||
|
foreach($options as $option)
|
||||||
|
{
|
||||||
|
if(in_array($option->value,$value)) $result[]=JText::_($option->text);
|
||||||
|
}
|
||||||
|
return implode(', ',$result);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$result='';
|
||||||
|
foreach($options as $option)
|
||||||
|
{
|
||||||
|
if($option->value==$value) $result=JText::_($option->text);
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchInput($field)
|
||||||
|
{
|
||||||
|
JHtml::_('formbehavior.chosen', 'select');
|
||||||
|
$script = '';
|
||||||
|
$selectedOptions=JFactory::getApplication()->input->get($field->alias,null,'raw');
|
||||||
|
$options=array();
|
||||||
|
$optTxt=explode("\n",$field->params->get('select_options',''));
|
||||||
|
//if(!$field->params->get('select_multiple',0)) $options[]=JHtml::_('select.option', '', JText::_('COM_JSN_NOSELECTION'));
|
||||||
|
foreach($optTxt as $opt)
|
||||||
|
{
|
||||||
|
$opt=trim($opt);
|
||||||
|
if($opt!=''){
|
||||||
|
$opt=explode('|',$opt);
|
||||||
|
if(count($opt)==1) $options[]=JHtml::_('select.option', trim($opt[0]), JText::_(trim(htmlspecialchars($opt[0]))));
|
||||||
|
if(count($opt)==2) $options[]=JHtml::_('select.option', trim($opt[0]), JText::_(trim(htmlspecialchars($opt[1]))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$dbOptTable=$field->params->get('select_dbopttable','');
|
||||||
|
$dbOptValue=$field->params->get('select_dboptvalue','');
|
||||||
|
$dbOptText=$field->params->get('select_dbopttext','');
|
||||||
|
$dbOptWhere=$field->params->get('select_dboptwhere','');
|
||||||
|
$dbOptFilterColumn=$field->params->get('select_dboptfiltercolumn','');
|
||||||
|
$dbOptFilterValue=$field->params->get('select_dboptfiltervalue','');
|
||||||
|
if(!empty($dbOptTable) && !empty($dbOptValue) && !empty($dbOptText)) // set the alias of your field (width this conditions the select type work normally for all field except for this field)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
$query->select($dbOptValue.' AS value, '.$dbOptText.' AS text')->from($dbOptTable);
|
||||||
|
|
||||||
|
if(!empty($dbOptWhere)) $query->where($dbOptWhere);
|
||||||
|
|
||||||
|
|
||||||
|
if(!empty($dbOptFilterColumn) && !empty($dbOptFilterValue))
|
||||||
|
{
|
||||||
|
$script = JsnSelectlistFieldHelper::getAjaxScript($dbOptFilterValue,$field->alias,'jform_',true);
|
||||||
|
$optionParent=JFactory::getApplication()->input->get($dbOptFilterValue,'','raw');
|
||||||
|
if(empty($optionParent))
|
||||||
|
{
|
||||||
|
$query->where('FALSE');
|
||||||
|
}
|
||||||
|
elseif(is_array($optionParent))
|
||||||
|
{
|
||||||
|
$value=$optionParent;
|
||||||
|
foreach($value as &$val)
|
||||||
|
$val=$db->quote($val);
|
||||||
|
$value=implode(',',$value);
|
||||||
|
$query->where($dbOptFilterColumn.' IN ('.$value.')');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$query->where($dbOptFilterColumn.' = '.$db->quote($optionParent));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$query->order('text');
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$dbOptions = $db->loadObjectList();
|
||||||
|
foreach($dbOptions as $option)
|
||||||
|
{
|
||||||
|
$options[]=JHtml::_('select.option', trim($option->value), JText::_(trim(htmlspecialchars($option->text))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (RuntimeException $e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$from=array();
|
||||||
|
$to=array();
|
||||||
|
//if($field->params->get('select_multiple',0))
|
||||||
|
//{
|
||||||
|
$return=JHtml::_('select.genericlist', $options, $field->alias.'[]', 'multiple="multiple"', 'value', 'text', null, 'jform_'.str_replace('-','_',$field->alias));
|
||||||
|
|
||||||
|
if($selectedOptions!=null)
|
||||||
|
{
|
||||||
|
foreach($selectedOptions as $selectedOption)
|
||||||
|
{
|
||||||
|
$from[]='value="'.$selectedOption.'"';
|
||||||
|
$to[]='value="'.$selectedOption.'" selected="selected"';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$return=JHtml::_('select.genericlist', $options, $field->alias, null, 'value', 'text', null, 'jform_'.str_replace('-','_',$field->alias));
|
||||||
|
$from[]='value="'.$selectedOptions.'"';
|
||||||
|
$to[]='value="'.$selectedOptions.'" selected="selected"';
|
||||||
|
}*/
|
||||||
|
|
||||||
|
return str_replace($from,$to,$return).$script;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchQuery($field, &$query)
|
||||||
|
{
|
||||||
|
$option=JFactory::getApplication()->input->get($field->alias,null,'raw');
|
||||||
|
$db=JFactory::getDbo();
|
||||||
|
//if($field->params->get('select_multiple',0))
|
||||||
|
//{
|
||||||
|
$where='';
|
||||||
|
foreach($option as $opt)
|
||||||
|
{
|
||||||
|
$where.='b.'.$db->quoteName($field->alias).' LIKE '.$db->quote('%"'.$opt.'"%').' OR '.'b.'.$db->quoteName($field->alias).' = '.$db->quote($opt).' OR ';
|
||||||
|
}
|
||||||
|
$where=substr($where, 0,-4);
|
||||||
|
$query->where('('.$where.')');
|
||||||
|
/*}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$query->where('b.'.$db->quoteName($field->alias).' = '.$db->quote($option));
|
||||||
|
}*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function operations()
|
||||||
|
{
|
||||||
|
JFactory::getConfig()->set('gzip',false);
|
||||||
|
$db=JFactory::getDbo();
|
||||||
|
$query=$db->getQuery(true);
|
||||||
|
$field=JFactory::getApplication()->input->get('field','','raw');
|
||||||
|
$value=JFactory::getApplication()->input->get('value','','raw');
|
||||||
|
$multi=(int) JFactory::getApplication()->input->get('multi',0,'raw');
|
||||||
|
$query->select('params')->from('#__jsn_fields')->where('alias='.$db->quote($field));
|
||||||
|
$params = new JRegistry;
|
||||||
|
$db->setQuery($query);
|
||||||
|
$params->loadString($db->loadResult());
|
||||||
|
|
||||||
|
JHtml::_('formbehavior.chosen', 'select');
|
||||||
|
$options=array();
|
||||||
|
$optTxt=explode("\n",$params->get('select_options',''));
|
||||||
|
if(!$params->get('select_multiple',0) && !$multi) $options[]=JHtml::_('select.option', '', JText::_('COM_JSN_NOSELECTION'));
|
||||||
|
foreach($optTxt as $opt)
|
||||||
|
{
|
||||||
|
$opt=trim($opt);
|
||||||
|
if($opt!=''){
|
||||||
|
$opt=explode('|',$opt);
|
||||||
|
if(count($opt)==1) $options[]=JHtml::_('select.option', trim($opt[0]), JText::_(trim(htmlspecialchars($opt[0]))));
|
||||||
|
if(count($opt)==2) $options[]=JHtml::_('select.option', trim($opt[0]), JText::_(trim(htmlspecialchars($opt[1]))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$dbOptTable=$params->get('select_dbopttable','');
|
||||||
|
$dbOptValue=$params->get('select_dboptvalue','');
|
||||||
|
$dbOptText=$params->get('select_dbopttext','');
|
||||||
|
$dbOptWhere=$params->get('select_dboptwhere','');
|
||||||
|
if(!empty($value) && !empty($dbOptTable) && !empty($dbOptValue) && !empty($dbOptText)) // set the alias of your field (width this conditions the select type work normally for all field except for this field)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
$query->select($dbOptValue.' AS value, '.$dbOptText.' AS text')->from($dbOptTable);
|
||||||
|
|
||||||
|
if(!empty($dbOptWhere)) $query->where($dbOptWhere);
|
||||||
|
|
||||||
|
$select_dboptfiltercolumn=$params->get('select_dboptfiltercolumn','');
|
||||||
|
if(!empty($select_dboptfiltercolumn) && !empty($value))
|
||||||
|
{
|
||||||
|
$value = explode(',', $value);
|
||||||
|
|
||||||
|
$filter_value = array();
|
||||||
|
foreach($value as $v)
|
||||||
|
$filter_value[] = $db->quote($v);
|
||||||
|
|
||||||
|
$where=$db->quoteName($params->get('select_dboptfiltercolumn','')).' IN ('.implode(',',$filter_value).')';
|
||||||
|
|
||||||
|
$query->where($where);
|
||||||
|
}
|
||||||
|
|
||||||
|
$query->order('text');
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$dbOptions = $db->loadObjectList();
|
||||||
|
foreach($dbOptions as $option)
|
||||||
|
{
|
||||||
|
$options[]=JHtml::_('select.option', trim($option->value), JText::_(trim(htmlspecialchars($option->text))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (RuntimeException $e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($options);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getAjaxScript($parentField,$thisField,$prefix='jform_',$force_multiple = false)
|
||||||
|
{ $rand=rand(0,10000);
|
||||||
|
if($force_multiple) $multi = '&multi=1';
|
||||||
|
else $multi = '&multi=0';
|
||||||
|
$script='<script>
|
||||||
|
jQuery(window).load(function(){
|
||||||
|
form'.$rand.'=jQuery("#'.$prefix.$parentField.'").closest("form");
|
||||||
|
field'.$rand.'=form'.$rand.'.find("#'.$prefix.$thisField.'").get(0);
|
||||||
|
value'.$rand.'=jQuery(field'.$rand.').val();
|
||||||
|
if(jQuery("#'.$prefix.$parentField.'").val()!="")
|
||||||
|
{
|
||||||
|
jQuery(field'.$rand.').attr("disabled","disabled");
|
||||||
|
jQuery(field'.$rand.').trigger("liszt:updated.chosen");
|
||||||
|
jQuery.ajax({
|
||||||
|
url:"'.JURI::base().'index.php?option=com_jsn&view=opField'.$multi.'&type=selectlist&field='.$thisField.'&value="+jQuery("#'.$prefix.$parentField.'").val()+"&format=raw",
|
||||||
|
type:"GET",
|
||||||
|
data: "",
|
||||||
|
dataType: "json",
|
||||||
|
success: function( json ) {
|
||||||
|
jQuery(field'.$rand.').find("option").remove();
|
||||||
|
jQuery.each(json, function(i, k) {
|
||||||
|
jQuery(field'.$rand.').append(jQuery("<option>").text(k.text).attr("value", k.value));
|
||||||
|
});
|
||||||
|
jQuery(field'.$rand.').val(value'.$rand.');
|
||||||
|
jQuery(field'.$rand.').removeAttr("disabled");
|
||||||
|
jQuery(field'.$rand.').trigger("liszt:updated.chosen");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
jQuery("#'.$prefix.$parentField.'").change(function(){
|
||||||
|
form=jQuery(this).closest("form");
|
||||||
|
field=form.find("#'.$prefix.$thisField.'").get(0);
|
||||||
|
value=jQuery(field).val();
|
||||||
|
jQuery(field).attr("disabled","disabled");
|
||||||
|
jQuery(field).trigger("liszt:updated.chosen");
|
||||||
|
jQuery.ajax({
|
||||||
|
url:"'.JURI::base().'index.php?option=com_jsn&view=opField'.$multi.'&type=selectlist&field='.$thisField.'&value="+jQuery(this).val()+"&format=raw",
|
||||||
|
type:"GET",
|
||||||
|
data: "",
|
||||||
|
dataType: "json",
|
||||||
|
success: function( json ) {
|
||||||
|
jQuery(field).find("option").remove();
|
||||||
|
jQuery.each(json, function(i, k) {
|
||||||
|
jQuery(field).append(jQuery("<option>").text(k.text).attr("value", k.value));
|
||||||
|
});
|
||||||
|
jQuery(field).val("");
|
||||||
|
jQuery(field).removeAttr("disabled");
|
||||||
|
jQuery(field).trigger("liszt:updated.chosen");
|
||||||
|
jQuery(field).change();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
';
|
||||||
|
return $script;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,104 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<form>
|
||||||
|
<fields name="params">
|
||||||
|
<fieldset
|
||||||
|
name="selectlist"
|
||||||
|
label="COM_JSN_SELECT_FIELDSET_LABEL"
|
||||||
|
>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="select_defaultvalue"
|
||||||
|
label="COM_JSN_GENERAL_DEFAULTVALUE"
|
||||||
|
description ="COM_JSN_GENERAL_DEFAULTVALUE"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="select_placeholder"
|
||||||
|
label="COM_JSN_GENERAL_PLACEHOLDER"
|
||||||
|
description ="COM_JSN_GENERAL_PLACEHOLDER_DESC"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="select_options"
|
||||||
|
label="COM_JSN_CHECKBOX_OPTIONS"
|
||||||
|
description ="COM_JSN_CHECKBOX_OPTIONS_DESC"
|
||||||
|
rows="10"
|
||||||
|
class="span6"
|
||||||
|
type="textarea"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="select_multiple"
|
||||||
|
label="COM_JSN_OPTIONS_MULTIPLE"
|
||||||
|
description ="COM_JSN_OPTIONS_MULTIPLE_DESC"
|
||||||
|
class="btn-group"
|
||||||
|
type="radio"
|
||||||
|
default="0"
|
||||||
|
>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="spacer_select1" label="COM_JSN_SELECT_DBDESC" type="spacer" />
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="select_dbopttable"
|
||||||
|
label="COM_JSN_SELECT_DBTABLE"
|
||||||
|
description ="COM_JSN_SELECT_DBTABLE_DESC"
|
||||||
|
type="text"
|
||||||
|
hint="#__content"
|
||||||
|
filter="raw"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
name="select_dboptvalue"
|
||||||
|
label="COM_JSN_SELECT_DBVALUE"
|
||||||
|
description ="COM_JSN_SELECT_DBVALUE_DESC"
|
||||||
|
type="text"
|
||||||
|
hint="id"
|
||||||
|
filter="raw"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
name="select_dbopttext"
|
||||||
|
label="COM_JSN_SELECT_DBTEXT"
|
||||||
|
description ="COM_JSN_SELECT_DBTEXT_DESC"
|
||||||
|
type="text"
|
||||||
|
hint="title"
|
||||||
|
filter="raw"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
name="select_dboptwhere"
|
||||||
|
label="COM_JSN_SELECT_DBWHERE"
|
||||||
|
description ="COM_JSN_SELECT_DBWHERE_DESC"
|
||||||
|
type="text"
|
||||||
|
hint="state=1"
|
||||||
|
filter="raw"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
name="select_dboptfiltervalue"
|
||||||
|
label="COM_JSN_SELECT_DBFILTERVALUE"
|
||||||
|
description ="COM_JSN_SELECT_DBFILTERVALUE_DESC"
|
||||||
|
type="parent"
|
||||||
|
table="jsn_fields"
|
||||||
|
level="2"
|
||||||
|
field_id="alias"
|
||||||
|
multiple="false"
|
||||||
|
default="0"
|
||||||
|
>
|
||||||
|
<option value="0">COM_JSN_CONDITION_DISABLED</option>
|
||||||
|
</field>
|
||||||
|
<field
|
||||||
|
name="select_dboptfiltercolumn"
|
||||||
|
label="COM_JSN_SELECT_DBFILTERCOLUMN"
|
||||||
|
description ="COM_JSN_SELECT_DBFILTERCOLUMN_DESC"
|
||||||
|
type="text"
|
||||||
|
hint="catid"
|
||||||
|
filter="raw"
|
||||||
|
default=""
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
</form>
|
||||||
@ -0,0 +1,118 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
global $_FIELDTYPES;
|
||||||
|
$_FIELDTYPES['text']='COM_JSN_FIELDTYPE_TEXT';
|
||||||
|
|
||||||
|
class JsnTextFieldHelper
|
||||||
|
{
|
||||||
|
public static function create($alias)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = "ALTER TABLE #__jsn_users ADD ".$db->quoteName($alias)." VARCHAR(255)";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function delete($alias)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = "ALTER TABLE #__jsn_users DROP COLUMN ".$db->quoteName($alias);
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getXml($item)
|
||||||
|
{
|
||||||
|
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
|
||||||
|
$hideTitle= ($item->params->get('hidetitle',0) && JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn') || ($item->params->get('hidetitleedit',0) && (JFactory::getApplication()->input->get('layout','')=='edit' || JFactory::getApplication()->input->get('view','')=='registration'));
|
||||||
|
if(JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn' && $item->params->get('titleprofile','')!='') $item->title=$item->params->get('titleprofile','');
|
||||||
|
$defaultvalue=($item->params->get('text_defaultvalue','')!='' ? 'default="'.JsnHelper::xmlentities($item->params->get('text_defaultvalue','')).'"' : '');
|
||||||
|
$maxlength=($item->params->get('text_maxlength','')!='' ? 'maxlength="'.$item->params->get('text_maxlength','').'"' : '');
|
||||||
|
$placeholder=($item->params->get('text_placeholder','')!='' ? 'hint="'.JsnHelper::xmlentities($item->params->get('text_placeholder','')).'"' : '');
|
||||||
|
if($item->params->get('text_regex','')!='custom') $regex=($item->params->get('text_regex','')!='' ? 'class="validate-pattern '.$item->params->get('field_cssclass','').'" validate="regex" pattern="'.$item->params->get('text_regex','').'"' : 'class="'.$item->params->get('field_cssclass','').'"');
|
||||||
|
else $regex='class="validate-pattern '.$item->params->get('field_cssclass','').'" validate="regex" pattern="'.$item->params->get('text_customregex','').'"';
|
||||||
|
|
||||||
|
if($item->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
elseif($item->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('view')!='registration' && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
else $readonly='';
|
||||||
|
|
||||||
|
|
||||||
|
$type='textfull';
|
||||||
|
|
||||||
|
$xml='';
|
||||||
|
|
||||||
|
$xml.='
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="'.$item->alias.'"
|
||||||
|
type="'.$type.'"
|
||||||
|
id="'.$item->alias.'"
|
||||||
|
label="'.($hideTitle ? JsnHelper::xmlentities('<span class="no-title">'.JText::_($item->title).'</span>') : JsnHelper::xmlentities($item->title)).'"
|
||||||
|
description="'.JsnHelper::xmlentities(($item->description)).'"
|
||||||
|
size="30"
|
||||||
|
'.$defaultvalue.'
|
||||||
|
'.$maxlength.'
|
||||||
|
'.$placeholder.'
|
||||||
|
'.$regex.'
|
||||||
|
'.$readonly.'
|
||||||
|
required="'.($item->required ? ($item->required==2 ? 'admin' : 'frontend' ) : 'false' ).'"
|
||||||
|
message-regex="'.JsnHelper::xmlentities($item->params->get('text_messageregex','')).'"
|
||||||
|
/>
|
||||||
|
';
|
||||||
|
return $xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function loadData($field, $user, &$data)
|
||||||
|
{
|
||||||
|
$alias=$field->alias;
|
||||||
|
if(isset($user->$alias)) $data->$alias=$user->$alias;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function storeData($field, $data, &$storeData)
|
||||||
|
{
|
||||||
|
//if($field->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) return;
|
||||||
|
//if($field->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('task')=='profile.save' && JFactory::getApplication()->isSite()) return;
|
||||||
|
$alias=$field->alias;
|
||||||
|
if(isset($data[$alias])) $storeData[$alias]=$data[$alias];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchInput($field)
|
||||||
|
{
|
||||||
|
$return='<input id="jform_'.str_replace('-','_',$field->alias).'" type="text" placeholder="'.JText::_('COM_JSN_SEARCHFOR').' '.JText::_($field->title).'..." name="'.$field->alias.'" value="'.JFactory::getApplication()->input->get($field->alias,'','raw').'"/>';
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchQuery($field, &$query)
|
||||||
|
{
|
||||||
|
$db=JFactory::getDbo();
|
||||||
|
if($field->params->get('text_searchmode','like')=='like') $query->where('b.'.$db->quoteName($field->alias).' LIKE '.$db->quote('%'.JFactory::getApplication()->input->get($field->alias,null,'raw').'%'));
|
||||||
|
else $query->where('LOWER(b.'.$db->quoteName($field->alias).') = LOWER('.$db->quote(JFactory::getApplication()->input->get($field->alias,null,'raw')).')');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function editScript()
|
||||||
|
{
|
||||||
|
return '<script>jQuery(document).ready(function(){
|
||||||
|
function text_show(){
|
||||||
|
var val = jQuery("#jform_params_text_regex").val();
|
||||||
|
if(val == "custom") jQuery("#jform_params_text_customregex").closest(".control-group").show();
|
||||||
|
else jQuery("#jform_params_text_customregex").closest(".control-group").hide();
|
||||||
|
if(val.length) jQuery("#jform_params_text_messageregex").closest(".control-group").show();
|
||||||
|
else jQuery("#jform_params_text_messageregex").closest(".control-group").hide();
|
||||||
|
}
|
||||||
|
jQuery("#jform_params_text_regex").change(text_show);
|
||||||
|
text_show();
|
||||||
|
});</script>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,76 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<form>
|
||||||
|
<fields name="params">
|
||||||
|
<fieldset
|
||||||
|
name="text"
|
||||||
|
label="COM_JSN_TEXT_FIELDSET_LABEL"
|
||||||
|
>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="text_defaultvalue"
|
||||||
|
label="COM_JSN_GENERAL_DEFAULTVALUE"
|
||||||
|
description ="COM_JSN_GENERAL_DEFAULTVALUE_DESC"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="text_placeholder"
|
||||||
|
label="COM_JSN_GENERAL_PLACEHOLDER"
|
||||||
|
description ="COM_JSN_GENERAL_PLACEHOLDER_DESC"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="text_maxlength"
|
||||||
|
label="COM_JSN_TEXT_MAXLENGTH"
|
||||||
|
description ="COM_JSN_TEXT_MAXLENGTH_DESC"
|
||||||
|
type="text"
|
||||||
|
filter="int"
|
||||||
|
default="255"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="text_regex"
|
||||||
|
label="COM_JSN_TEXT_REGEX"
|
||||||
|
description ="COM_JSN_TEXT_REGEX_DESC"
|
||||||
|
type="list"
|
||||||
|
>
|
||||||
|
<option value="">JNO</option>
|
||||||
|
<option value="[0-9]+">COM_JSN_TEXT_REGEX_INTEGER</option>
|
||||||
|
<option value="[0-9]{5}">COM_JSN_TEXT_REGEX_ZIPCODE</option>
|
||||||
|
<option value="[0-9]+[,]*[0-9]*">COM_JSN_TEXT_REGEX_DECIMAL</option>
|
||||||
|
<option value="custom">COM_JSN_TEXT_REGEX_CUSTOM</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="text_customregex"
|
||||||
|
label="COM_JSN_TEXT_CUSTOMREGEX"
|
||||||
|
description ="COM_JSN_TEXT_CUSTOMREGEX_DESC"
|
||||||
|
type="text"
|
||||||
|
filter="raw"
|
||||||
|
default=""
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="text_messageregex"
|
||||||
|
label="COM_JSN_TEXT_MESSAGEREGEX"
|
||||||
|
description ="COM_JSN_TEXT_MESSAGEREGEX_DESC"
|
||||||
|
type="text"
|
||||||
|
filter="raw"
|
||||||
|
default="Error"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="text_searchmode"
|
||||||
|
label="COM_JSN_TEXT_SEARCHMODE"
|
||||||
|
description ="COM_JSN_TEXT_SEARCHMODE_DESC"
|
||||||
|
type="list"
|
||||||
|
default="like"
|
||||||
|
>
|
||||||
|
<option value="like">COM_JSN_TEXT_SEARCHMODE_LIKE</option>
|
||||||
|
<option value="equal">COM_JSN_TEXT_SEARCHMODE_EQUAL</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
</form>
|
||||||
@ -0,0 +1,118 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
global $_FIELDTYPES;
|
||||||
|
$_FIELDTYPES['textarea']='COM_JSN_FIELDTYPE_TEXTAREA';
|
||||||
|
|
||||||
|
class JsnTextareaFieldHelper
|
||||||
|
{
|
||||||
|
public static function create($alias)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = "ALTER TABLE #__jsn_users ADD ".$db->quoteName($alias)." TEXT";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function delete($alias)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = "ALTER TABLE #__jsn_users DROP COLUMN ".$db->quoteName($alias);
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getXml($item)
|
||||||
|
{
|
||||||
|
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
|
||||||
|
$hideTitle= ($item->params->get('hidetitle',0) && JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn') || ($item->params->get('hidetitleedit',0) && (JFactory::getApplication()->input->get('layout','')=='edit' || JFactory::getApplication()->input->get('view','')=='registration'));
|
||||||
|
if(JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn' && $item->params->get('titleprofile','')!='') $item->title=$item->params->get('titleprofile','');
|
||||||
|
$defaultvalue=($item->params->get('textarea_defaultvalue','')!='' ? 'default="'.JsnHelper::xmlentities($item->params->get('textarea_defaultvalue','')).'"' : '');
|
||||||
|
$maxlength=($item->params->get('textarea_maxlength','')!='' ? 'maxlength="'.$item->params->get('textarea_maxlength','').'"' : '');
|
||||||
|
$type=$item->params->get('textarea_type','textarea');
|
||||||
|
$placeholder=($item->params->get('textarea_placeholder','')!='' ? 'hint="'.JsnHelper::xmlentities($item->params->get('textarea_placeholder','')).'"' : '');
|
||||||
|
if($type=='textarea') $filter='filter="raw"';
|
||||||
|
else $filter='filter="raw"';
|
||||||
|
|
||||||
|
if($item->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
elseif($item->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('view')!='registration' && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
else $readonly='';
|
||||||
|
|
||||||
|
if(JFactory::getApplication()->input->get('option')=='com_jsn') $type='textarea';
|
||||||
|
|
||||||
|
$xml='';
|
||||||
|
|
||||||
|
$xml.='
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="'.$item->alias.'"
|
||||||
|
type="'.$type.'"
|
||||||
|
id="'.$item->alias.'"
|
||||||
|
origintype="'.$item->params->get('textarea_type','textarea').'"
|
||||||
|
description="'.JsnHelper::xmlentities(($item->description)).'"
|
||||||
|
label="'.($hideTitle ? JsnHelper::xmlentities('<span class="no-title">'.JText::_($item->title).'</span>') : JsnHelper::xmlentities($item->title)).'"
|
||||||
|
'.$filter.'
|
||||||
|
'.$defaultvalue.'
|
||||||
|
'.$maxlength.'
|
||||||
|
'.$placeholder.'
|
||||||
|
'.$readonly.'
|
||||||
|
class="'.$item->params->get('field_cssclass','').'"
|
||||||
|
required="'.($item->required ? ($item->required==2 ? 'admin' : 'frontend' ) : 'false' ).'"
|
||||||
|
/>
|
||||||
|
';
|
||||||
|
return $xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function loadData($field, $user, &$data)
|
||||||
|
{
|
||||||
|
$alias=$field->alias;
|
||||||
|
if(isset($user->$alias)) $data->$alias=$user->$alias;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function storeData($field, $data, &$storeData)
|
||||||
|
{
|
||||||
|
//if($field->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) return;
|
||||||
|
//if($field->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('task')=='profile.save' && JFactory::getApplication()->isSite()) return;
|
||||||
|
$alias=$field->alias;
|
||||||
|
if(isset($data[$alias])) $storeData[$alias]=$data[$alias];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchInput($field)
|
||||||
|
{
|
||||||
|
$return='<input id="jform_'.str_replace('-','_',$field->alias).'" type="text" placeholder="'.JText::_('COM_JSN_SEARCHFOR').' '.JText::_($field->title).'..." name="'.$field->alias.'" value="'.JFactory::getApplication()->input->get($field->alias,'','raw').'"/>';
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchQuery($field, &$query)
|
||||||
|
{
|
||||||
|
$db=JFactory::getDbo();
|
||||||
|
$query->where('b.'.$db->quoteName($field->alias).' LIKE '.$db->quote('%'.JFactory::getApplication()->input->get($field->alias,null,'raw').'%'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function textarea($field)
|
||||||
|
{
|
||||||
|
$value=$field->__get('value');
|
||||||
|
if (empty($value))
|
||||||
|
{
|
||||||
|
return JHtml::_('users.value', $value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//if(JText::_(strip_tags($value)) != strip_tags($value)) $value=JText::_(strip_tags($value));
|
||||||
|
if(substr_count($value,'<p>')==1 && substr_count($value,' ')==0) $text=JText::_(strip_tags($value));
|
||||||
|
if(method_exists($field,'getAttribute') && $field->getAttribute('origintype')=='textarea') return str_replace("\n","<br />",htmlspecialchars($value));
|
||||||
|
else return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<form>
|
||||||
|
<fields name="params">
|
||||||
|
<fieldset
|
||||||
|
name="textarea"
|
||||||
|
label="COM_JSN_TEXTAREA_FIELDSET_LABEL"
|
||||||
|
>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="textarea_defaultvalue"
|
||||||
|
label="COM_JSN_GENERAL_DEFAULTVALUE"
|
||||||
|
description ="COM_JSN_GENERAL_DEFAULTVALUE_DESC"
|
||||||
|
type="textarea"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="textarea_placeholder"
|
||||||
|
label="COM_JSN_GENERAL_PLACEHOLDER"
|
||||||
|
description ="COM_JSN_GENERAL_PLACEHOLDER_DESC"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="textarea_maxlength"
|
||||||
|
label="COM_JSN_TEXT_MAXLENGTH"
|
||||||
|
description ="COM_JSN_TEXT_MAXLENGTH_DESC"
|
||||||
|
type="text"
|
||||||
|
default=""
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="textarea_type"
|
||||||
|
label="COM_JSN_TEXTAREA_TYPE"
|
||||||
|
description ="COM_JSN_TEXTAREA_TYPE_DESC"
|
||||||
|
type="list"
|
||||||
|
default="textarea"
|
||||||
|
>
|
||||||
|
<option value="textarea">COM_JSN_TEXTAREA_TYPE_TEXTAREA</option>
|
||||||
|
<option value="editor">COM_JSN_TEXTAREA_TYPE_EDITOR</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
</form>
|
||||||
@ -0,0 +1,131 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
class JsnUsermailFieldHelper
|
||||||
|
{
|
||||||
|
public static function create($alias)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function delete($alias)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getXml($item)
|
||||||
|
{
|
||||||
|
$xml='';
|
||||||
|
if(JFactory::getApplication()->isSite())
|
||||||
|
{
|
||||||
|
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
|
||||||
|
$hideTitle= ($item->params->get('hidetitle',0) && JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn') || ($item->params->get('hidetitleedit',0) && (JFactory::getApplication()->input->get('layout','')=='edit' || JFactory::getApplication()->input->get('view','')=='registration'));
|
||||||
|
if(JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn' && $item->params->get('titleprofile','')!='') $item->title=$item->params->get('titleprofile','');
|
||||||
|
$placeholder=($item->params->get('usermail_placeholder','')!='' ? 'hint="'.JsnHelper::xmlentities($item->params->get('usermail_placeholder','')).'"' : '');
|
||||||
|
$placeholder2=($item->params->get('usermail_placeholder2','')!='' ? 'hint="'.JsnHelper::xmlentities($item->params->get('usermail_placeholder2','')).'"' : '');
|
||||||
|
|
||||||
|
if($item->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
elseif($item->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('view')!='registration' && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
else $readonly='';
|
||||||
|
|
||||||
|
$xml.='
|
||||||
|
<field name="email1" type="emailfull"
|
||||||
|
description="COM_USERS_PROFILE_EMAIL1_DESC"
|
||||||
|
filter="string"
|
||||||
|
label="'.($hideTitle ? JsnHelper::xmlentities('<span class="no-title">'.JText::_($item->title).'</span>') : JsnHelper::xmlentities($item->title)).'"
|
||||||
|
message="COM_USERS_PROFILE_EMAIL1_MESSAGE"
|
||||||
|
required="true"
|
||||||
|
size="30"
|
||||||
|
unique="true"
|
||||||
|
validate="email"
|
||||||
|
'.$placeholder.'
|
||||||
|
'.$readonly.'
|
||||||
|
class="'.$item->params->get('field_cssclass','').'"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
';
|
||||||
|
$config = JComponentHelper::getParams('com_jsn');
|
||||||
|
if($config->get('confirmusermail',0))
|
||||||
|
{
|
||||||
|
$xml.='
|
||||||
|
<field name="email2" type="confirmemail"
|
||||||
|
description="COM_USERS_PROFILE_EMAIL2_DESC"
|
||||||
|
field="email1"
|
||||||
|
class="validate-confirmemail '.$item->params->get('field_cssclass','').'"
|
||||||
|
filter="string"
|
||||||
|
label="'.($hideTitle ? JsnHelper::xmlentities('<span class="no-title">'.JText::_('COM_USERS_PROFILE_EMAIL2_LABEL').'</span>') : 'COM_USERS_PROFILE_EMAIL2_LABEL').'"
|
||||||
|
message="COM_USERS_PROFILE_EMAIL2_MESSAGE"
|
||||||
|
required="true"
|
||||||
|
size="30"
|
||||||
|
validate="equals"
|
||||||
|
'.$placeholder2.'
|
||||||
|
'.$readonly.'
|
||||||
|
/>
|
||||||
|
';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$hideTitle= ($item->params->get('hidetitle',0) && JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn') || ($item->params->get('hidetitleedit',0) && (JFactory::getApplication()->input->get('layout','')=='edit' || JFactory::getApplication()->input->get('view','')=='registration'));
|
||||||
|
$placeholder=($item->params->get('usermail_placeholder','')!='' ? 'hint="'.JsnHelper::xmlentities($item->params->get('usermail_placeholder','')).'"' : '');
|
||||||
|
$xml.='
|
||||||
|
<field name="email" type="emailfull"
|
||||||
|
class="inputbox '.$item->params->get('field_cssclass','').'"
|
||||||
|
description="COM_USERS_USER_FIELD_EMAIL_DESC"
|
||||||
|
label="'.($hideTitle ? JsnHelper::xmlentities('<span class="no-title">'.JText::_($item->title).'</span>') : JsnHelper::xmlentities($item->title)).'"
|
||||||
|
required="true"
|
||||||
|
size="30"
|
||||||
|
validate="email"
|
||||||
|
'.$placeholder.'
|
||||||
|
/>
|
||||||
|
';
|
||||||
|
}
|
||||||
|
return $xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function loadData($field, $user, &$data)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function storeData($field, $data, &$storeData)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchInput($field)
|
||||||
|
{
|
||||||
|
$return='<input id="jform_'.str_replace('-','_',$field->alias).'" type="text" placeholder="'.JText::_('COM_JSN_SEARCHFOR').' '.JText::_($field->title).'..." name="'.$field->alias.'" value="'.JFactory::getApplication()->input->get($field->alias,'','raw').'"/>';
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchQuery($field, &$query)
|
||||||
|
{
|
||||||
|
$db=JFactory::getDbo();
|
||||||
|
$query->where('a.'.$db->quoteName('email').' LIKE '.$db->quote('%'.JFactory::getApplication()->input->get('email',null,'raw').'%'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function usermail($field)
|
||||||
|
{
|
||||||
|
$value=$field->__get('value');
|
||||||
|
if (empty($value))
|
||||||
|
{
|
||||||
|
return JHtml::_('users.value', $value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
JPluginHelper::importPlugin('content');
|
||||||
|
return JHtml::_('content.prepare', '<a href="mailto:'.$value.'">'.$value.'</a>', '', 'jsn_content.content');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<form>
|
||||||
|
<fields name="params">
|
||||||
|
<fieldset
|
||||||
|
name="usermail"
|
||||||
|
label="COM_JSN_USERMAIL_FIELDSET_LABEL"
|
||||||
|
>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="usermail_placeholder"
|
||||||
|
label="COM_JSN_GENERAL_PLACEHOLDER"
|
||||||
|
description ="COM_JSN_GENERAL_PLACEHOLDER_DESC"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="usermail_placeholder2"
|
||||||
|
label="COM_JSN_GENERAL_PLACEHOLDER2"
|
||||||
|
description ="COM_JSN_GENERAL_PLACEHOLDER_DESC2"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
</form>
|
||||||
@ -0,0 +1,97 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
class JsnUsernameFieldHelper
|
||||||
|
{
|
||||||
|
public static function create($alias)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function delete($alias)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getXml($item)
|
||||||
|
{
|
||||||
|
$xml='';
|
||||||
|
if(JFactory::getApplication()->isSite())
|
||||||
|
{
|
||||||
|
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
|
||||||
|
$hideTitle= ($item->params->get('hidetitle',0) && JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn') || ($item->params->get('hidetitleedit',0) && (JFactory::getApplication()->input->get('layout','')=='edit' || JFactory::getApplication()->input->get('view','')=='registration'));
|
||||||
|
if(JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn' && $item->params->get('titleprofile','')!='') $item->title=$item->params->get('titleprofile','');
|
||||||
|
$placeholder=($item->params->get('username_placeholder','')!='' ? 'hint="'.JsnHelper::xmlentities($item->params->get('username_placeholder','')).'"' : '');
|
||||||
|
|
||||||
|
if($item->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
elseif($item->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('view')!='registration' && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
else $readonly='';
|
||||||
|
if($item->params->get('username_regex','')!='custom') $regex=($item->params->get('username_regex','')!='' ? 'class="validate-pattern '.$item->params->get('field_cssclass','').'" pattern="'.$item->params->get('username_regex','').'"' : 'class="validate-username '.$item->params->get('field_cssclass','').'"');
|
||||||
|
else $regex='class="validate-pattern '.$item->params->get('field_cssclass','').'" pattern="'.$item->params->get('username_customregex','').'"';
|
||||||
|
|
||||||
|
$xml='
|
||||||
|
<field name="username" type="textfull"
|
||||||
|
'.$regex.'
|
||||||
|
description="COM_USERS_DESIRED_USERNAME"
|
||||||
|
filter="username"
|
||||||
|
label="'.($hideTitle ? JsnHelper::xmlentities('<span class="no-title">'.JText::_($item->title).'</span>') : JsnHelper::xmlentities($item->title)).'"
|
||||||
|
message="COM_USERS_PROFILE_USERNAME_MESSAGE"
|
||||||
|
required="true"
|
||||||
|
'.$placeholder.'
|
||||||
|
'.$readonly.'
|
||||||
|
size="30"
|
||||||
|
validate="username"
|
||||||
|
message-regex="'.JsnHelper::xmlentities($item->params->get('username_messageregex','')).'"
|
||||||
|
/>
|
||||||
|
';
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$hideTitle= ($item->params->get('hidetitle',0) && JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn') || ($item->params->get('hidetitleedit',0) && (JFactory::getApplication()->input->get('layout','')=='edit' || JFactory::getApplication()->input->get('view','')=='registration'));
|
||||||
|
$placeholder=($item->params->get('username_placeholder','')!='' ? 'hint="'.JsnHelper::xmlentities($item->params->get('username_placeholder','')).'"' : '');
|
||||||
|
$xml='
|
||||||
|
<field name="username" type="text"
|
||||||
|
description="COM_USERS_USER_FIELD_USERNAME_DESC"
|
||||||
|
label="'.($hideTitle ? JsnHelper::xmlentities('<span class="no-title">'.JText::_($item->title).'</span>') : JsnHelper::xmlentities($item->title)).'"
|
||||||
|
required="true"
|
||||||
|
size="30"
|
||||||
|
'.$placeholder.'
|
||||||
|
class="'.$item->params->get('field_cssclass','').'"
|
||||||
|
/>
|
||||||
|
';
|
||||||
|
}
|
||||||
|
return $xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function loadData($field, $user, &$data)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function storeData($field, $data, &$storeData)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchInput($field)
|
||||||
|
{
|
||||||
|
$return='<input id="jform_'.str_replace('-','_',$field->alias).'" type="text" placeholder="'.JText::_('COM_JSN_SEARCHFOR').' '.JText::_($field->title).'..." name="'.$field->alias.'" value="'.JFactory::getApplication()->input->get($field->alias,'','raw').'"/>';
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchQuery($field, &$query)
|
||||||
|
{
|
||||||
|
$db=JFactory::getDbo();
|
||||||
|
if($field->params->get('username_searchmode','like')=='like') $query->where('a.'.$db->quoteName('username').' LIKE '.$db->quote('%'.JFactory::getApplication()->input->get('username',null,'raw').'%'));
|
||||||
|
else $query->where('LOWER(a.'.$db->quoteName('username').') = LOWER('.$db->quote(JFactory::getApplication()->input->get('username',null,'raw')).')');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,62 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<form>
|
||||||
|
<fields name="params">
|
||||||
|
<fieldset
|
||||||
|
name="username"
|
||||||
|
label="COM_JSN_USERNAME_FIELDSET_LABEL"
|
||||||
|
>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="username_placeholder"
|
||||||
|
label="COM_JSN_GENERAL_PLACEHOLDER"
|
||||||
|
description ="COM_JSN_GENERAL_PLACEHOLDER_DESC"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="username_searchmode"
|
||||||
|
label="COM_JSN_TEXT_SEARCHMODE"
|
||||||
|
description ="COM_JSN_TEXT_SEARCHMODE_DESC"
|
||||||
|
type="list"
|
||||||
|
default="like"
|
||||||
|
>
|
||||||
|
<option value="like">COM_JSN_TEXT_SEARCHMODE_LIKE</option>
|
||||||
|
<option value="equal">COM_JSN_TEXT_SEARCHMODE_EQUAL</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="username_regex"
|
||||||
|
label="COM_JSN_TEXT_REGEX"
|
||||||
|
description ="COM_JSN_TEXT_REGEX_DESC"
|
||||||
|
type="list"
|
||||||
|
>
|
||||||
|
<option value="">JNO</option>
|
||||||
|
<option value="[a-z0-9]+">Lowercase with numbers</option>
|
||||||
|
<option value="[a-z]+">Lowercase without numbers</option>
|
||||||
|
<option value="[A-Z0-9]+">Uppercase with numbers</option>
|
||||||
|
<option value="[A-Z]+">Uppercase without numbers</option>
|
||||||
|
<option value="custom">COM_JSN_TEXT_REGEX_CUSTOM</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="username_customregex"
|
||||||
|
label="COM_JSN_TEXT_CUSTOMREGEX"
|
||||||
|
description ="COM_JSN_TEXT_CUSTOMREGEX_DESC"
|
||||||
|
type="text"
|
||||||
|
filter="raw"
|
||||||
|
default=""
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="username_messageregex"
|
||||||
|
label="COM_JSN_TEXT_MESSAGEREGEX"
|
||||||
|
description ="COM_JSN_TEXT_MESSAGEREGEX_DESC"
|
||||||
|
type="text"
|
||||||
|
filter="raw"
|
||||||
|
default="Error"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
</form>
|
||||||
@ -0,0 +1,124 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
global $_FIELDTYPES;
|
||||||
|
$_FIELDTYPES['video']='COM_JSN_FIELDTYPE_VIDEO';
|
||||||
|
|
||||||
|
class JsnVideoFieldHelper
|
||||||
|
{
|
||||||
|
public static function create($alias)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = "ALTER TABLE #__jsn_users ADD ".$db->quoteName($alias)." VARCHAR(255)";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function delete($alias)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = "ALTER TABLE #__jsn_users DROP COLUMN ".$db->quoteName($alias);
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getXml($item)
|
||||||
|
{
|
||||||
|
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
|
||||||
|
$hideTitle= ($item->params->get('hidetitle',0) && JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn') || ($item->params->get('hidetitleedit',0) && (JFactory::getApplication()->input->get('layout','')=='edit' || JFactory::getApplication()->input->get('view','')=='registration'));
|
||||||
|
if(JFactory::getApplication()->input->get('view','profile')=='profile' && JFactory::getApplication()->input->get('option','')=='com_jsn' && $item->params->get('titleprofile','')!='') $item->title=$item->params->get('titleprofile','');
|
||||||
|
$defaultvalue=($item->params->get('video_defaultvalue','')!='' ? 'default="'.JsnHelper::xmlentities($item->params->get('video_defaultvalue','')).'"' : '');
|
||||||
|
$maxlength=($item->params->get('video_maxlength','')!='' ? 'maxlength="'.$item->params->get('video_maxlength','').'"' : '');
|
||||||
|
$placeholder=($item->params->get('video_placeholder','')!='' ? 'hint="'.JsnHelper::xmlentities($item->params->get('video_placeholder','')).'"' : '');
|
||||||
|
|
||||||
|
if($item->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
elseif($item->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('view')!='registration' && JFactory::getApplication()->isSite()) $readonly='readonly="true"';
|
||||||
|
else $readonly='';
|
||||||
|
|
||||||
|
$type='video';
|
||||||
|
|
||||||
|
$xml='';
|
||||||
|
|
||||||
|
$xml.='
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="'.$item->alias.'"
|
||||||
|
type="'.$type.'"
|
||||||
|
id="'.$item->alias.'"
|
||||||
|
description="'.JsnHelper::xmlentities(($item->description)).'"
|
||||||
|
validate="video"
|
||||||
|
label="'.($hideTitle ? JsnHelper::xmlentities('<span class="no-title">'.JText::_($item->title).'</span>') : JsnHelper::xmlentities($item->title)).'"
|
||||||
|
size="30"
|
||||||
|
'.$defaultvalue.'
|
||||||
|
'.$maxlength.'
|
||||||
|
'.$placeholder.'
|
||||||
|
'.$readonly.'
|
||||||
|
class="'.$item->params->get('field_cssclass','').'"
|
||||||
|
required="'.($item->required ? ($item->required==2 ? 'admin' : 'frontend' ) : 'false' ).'"
|
||||||
|
/>
|
||||||
|
';
|
||||||
|
return $xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function loadData($field, $user, &$data)
|
||||||
|
{
|
||||||
|
$alias=$field->alias;
|
||||||
|
if(isset($user->$alias)) $data->$alias=$user->$alias;
|
||||||
|
if(isset($user->$alias) && $data->$alias=='http://') $data->$alias='';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function storeData($field, $data, &$storeData)
|
||||||
|
{
|
||||||
|
//if($field->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) return;
|
||||||
|
//if($field->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('task')=='profile.save' && JFactory::getApplication()->isSite()) return;
|
||||||
|
$alias=$field->alias;
|
||||||
|
if(isset($data[$alias])){
|
||||||
|
if(substr(trim($data[$alias]), 0, 4)=='http') $storeData[$alias]=$data[$alias];
|
||||||
|
else $storeData[$alias]='http://'.$data[$alias];
|
||||||
|
}
|
||||||
|
if(isset($data[$alias]) && $storeData[$alias]=='http://') $storeData[$alias]='';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function video($field)
|
||||||
|
{
|
||||||
|
$value=$field->__get('value');
|
||||||
|
if (empty($value))
|
||||||
|
{
|
||||||
|
return JHtml::_('users.value', $value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(strpos(' '.$value,'vimeo')>1)
|
||||||
|
{
|
||||||
|
$value=substr($value,strrpos($value,'/')+1);
|
||||||
|
return '<iframe src="//player.vimeo.com/video/'.$value.'?portrait=0&badge=0" style="width:100%;height:300px;" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
|
||||||
|
}
|
||||||
|
$value=substr($value,strrpos($value,'/')+1);
|
||||||
|
if(strrpos($value,'?v=')) $value=substr($value,strrpos($value,'?v=')+3);
|
||||||
|
return '<iframe style="width:100%;height:300px;" src="//www.youtube.com/embed/'.$value.'" frameborder="0" allowfullscreen></iframe>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchInput($field)
|
||||||
|
{
|
||||||
|
$return='<input id="jform_'.str_replace('-','_',$field->alias).'" type="text" placeholder="'.JText::_('COM_JSN_SEARCHFOR').' '.JText::_($field->title).'..." name="'.$field->alias.'" value="'.JFactory::getApplication()->input->get($field->alias,'','raw').'"/>';
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSearchQuery($field, &$query)
|
||||||
|
{
|
||||||
|
$db=JFactory::getDbo();
|
||||||
|
$query->where('b.'.$db->quoteName($field->alias).' LIKE '.$db->quote('%'.JFactory::getApplication()->input->get($field->alias,null,'raw').'%'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<form>
|
||||||
|
<fields name="params">
|
||||||
|
<fieldset
|
||||||
|
name="video"
|
||||||
|
label="COM_JSN_VIDEO_FIELDSET_LABEL"
|
||||||
|
>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="video_defaultvalue"
|
||||||
|
label="COM_JSN_GENERAL_DEFAULTVALUE"
|
||||||
|
description ="COM_JSN_GENERAL_DEFAULTVALUE_DESC"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="video_placeholder"
|
||||||
|
label="COM_JSN_GENERAL_PLACEHOLDER"
|
||||||
|
description ="COM_JSN_GENERAL_PLACEHOLDER_DESC"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="video_maxlength"
|
||||||
|
label="COM_JSN_TEXT_MAXLENGTH"
|
||||||
|
description ="COM_JSN_TEXT_MAXLENGTH_DESC"
|
||||||
|
type="text"
|
||||||
|
filter="int"
|
||||||
|
default="255"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
</form>
|
||||||
@ -0,0 +1,181 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
abstract class JHtmlField
|
||||||
|
{
|
||||||
|
|
||||||
|
public static function required($value, $i, $enabled = true, $checkbox = 'cb')
|
||||||
|
{
|
||||||
|
$states = array(
|
||||||
|
2 => array(
|
||||||
|
'required_unpublish',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'publish',
|
||||||
|
'publish'
|
||||||
|
),
|
||||||
|
1 => array(
|
||||||
|
'required_unpublish',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'publish icon-star',
|
||||||
|
'publish'
|
||||||
|
),
|
||||||
|
0 => array(
|
||||||
|
'required_publish',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'unpublish',
|
||||||
|
'unpublish'
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
return JHtml::_('jgrid.state', $states, $value, $i, 'fields.', $enabled, true, $checkbox);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function core($value, $i, $enabled = false, $checkbox = 'cb')
|
||||||
|
{
|
||||||
|
$states = array(
|
||||||
|
1 => array(
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'publish',
|
||||||
|
'publish'
|
||||||
|
),
|
||||||
|
0 => array(
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'unpublish',
|
||||||
|
'unpublish'
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
return JHtml::_('jgrid.state', $states, $value, $i, 'fields.', $enabled, true, $checkbox);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function profile($value, $i, $enabled = true, $checkbox = 'cb')
|
||||||
|
{
|
||||||
|
$states = array(
|
||||||
|
1 => array(
|
||||||
|
'profile_unpublish',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'publish',
|
||||||
|
'publish'
|
||||||
|
),
|
||||||
|
0 => array(
|
||||||
|
'profile_publish',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'unpublish',
|
||||||
|
'unpublish'
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
return JHtml::_('jgrid.state', $states, $value, $i, 'fields.', $enabled, true, $checkbox);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function edit($value, $i, $enabled = true, $checkbox = 'cb')
|
||||||
|
{
|
||||||
|
$states = array(
|
||||||
|
1 => array(
|
||||||
|
'edit_unpublish',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'publish',
|
||||||
|
'publish'
|
||||||
|
),
|
||||||
|
0 => array(
|
||||||
|
'edit_publish',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'unpublish',
|
||||||
|
'unpublish'
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
return JHtml::_('jgrid.state', $states, $value, $i, 'fields.', $enabled, true, $checkbox);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function register($value, $i, $enabled = true, $checkbox = 'cb')
|
||||||
|
{
|
||||||
|
$states = array(
|
||||||
|
1 => array(
|
||||||
|
'register_unpublish',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'publish',
|
||||||
|
'publish'
|
||||||
|
),
|
||||||
|
0 => array(
|
||||||
|
'register_publish',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'unpublish',
|
||||||
|
'unpublish'
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
return JHtml::_('jgrid.state', $states, $value, $i, 'fields.', $enabled, true, $checkbox);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function search($value, $i, $enabled = true, $checkbox = 'cb')
|
||||||
|
{
|
||||||
|
$states = array(
|
||||||
|
1 => array(
|
||||||
|
'search_unpublish',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'publish',
|
||||||
|
'publish'
|
||||||
|
),
|
||||||
|
0 => array(
|
||||||
|
'search_publish',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'unpublish',
|
||||||
|
'unpublish'
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
return JHtml::_('jgrid.state', $states, $value, $i, 'fields.', $enabled, true, $checkbox);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,100 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Libraries
|
||||||
|
* @subpackage HTML
|
||||||
|
*
|
||||||
|
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('JPATH_PLATFORM') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extended Utility class for batch processing widgets.
|
||||||
|
*
|
||||||
|
* @package Joomla.Libraries
|
||||||
|
* @subpackage HTML
|
||||||
|
* @since 1.7
|
||||||
|
*/
|
||||||
|
abstract class JHtmlJsnbatch
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a batch widget for the access level selector.
|
||||||
|
*
|
||||||
|
* @return string The necessary HTML for the widget.
|
||||||
|
*
|
||||||
|
* @since 1.7
|
||||||
|
*/
|
||||||
|
public static function access()
|
||||||
|
{
|
||||||
|
JHtml::_('bootstrap.tooltip', '.modalTooltip', array('container' => '.modal-body'));
|
||||||
|
|
||||||
|
// Create the batch selector to change an access level on a selection list.
|
||||||
|
return
|
||||||
|
'<label id="batch-access-lbl" for="batch-access" class="modalTooltip" '
|
||||||
|
. 'title="' . JHtml::tooltipText('COM_JSN_BATCH_ACCESS', 'COM_JSN_BATCH_ACCESS_DESC') . '">'
|
||||||
|
. JText::_('COM_JSN_BATCH_ACCESS')
|
||||||
|
. '</label>'
|
||||||
|
. JHtml::_(
|
||||||
|
'access.assetgrouplist',
|
||||||
|
'batch[assetgroup_id]', '',
|
||||||
|
'class="inputbox"',
|
||||||
|
array(
|
||||||
|
'title' => JText::_('JNONE'),
|
||||||
|
'id' => 'batch-access'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function accessview()
|
||||||
|
{
|
||||||
|
JHtml::_('bootstrap.tooltip', '.modalTooltip', array('container' => '.modal-body'));
|
||||||
|
|
||||||
|
// Create the batch selector to change an access level on a selection list.
|
||||||
|
return
|
||||||
|
'<label id="batch-access-lbl" for="batch-access" class="modalTooltip" '
|
||||||
|
. 'title="' . JHtml::tooltipText('COM_JSN_BATCH_ACCESSVIEW', 'COM_JSN_BATCH_ACCESSVIEW_DESC') . '">'
|
||||||
|
. JText::_('COM_JSN_BATCH_ACCESSVIEW')
|
||||||
|
. '</label>'
|
||||||
|
. JHtml::_(
|
||||||
|
'access.assetgrouplist',
|
||||||
|
'batch[assetgroupview_id]', '',
|
||||||
|
'class="inputbox"',
|
||||||
|
array(
|
||||||
|
'title' => JText::_('JNONE'),
|
||||||
|
'id' => 'batch-accessview'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fieldgroup()
|
||||||
|
{
|
||||||
|
JHtml::_('bootstrap.tooltip', '.modalTooltip', array('container' => '.modal-body'));
|
||||||
|
|
||||||
|
// Create the batch selector to change an access level on a selection list.
|
||||||
|
$dataArray=array('0'=>JText::_('JNONE'));
|
||||||
|
$db=JFactory::getDbo();
|
||||||
|
$query=$db->getQuery(true);
|
||||||
|
$query->select('id, title')->from('#__jsn_fields')->where('level=1 AND published=1');
|
||||||
|
$db->setQuery($query);
|
||||||
|
$results=$db->loadAssocList('id', 'title');
|
||||||
|
foreach($results as $k => $v)
|
||||||
|
{
|
||||||
|
$dataArray[$k]=JText::_($v);
|
||||||
|
}
|
||||||
|
return
|
||||||
|
'<label id="batch-access-lbl" for="batch-access" class="modalTooltip" '
|
||||||
|
. 'title="' . JHtml::tooltipText('COM_JSN_BATCH_FIELDGROUP', 'COM_JSN_BATCH_FIELDGROUP_DESC') . '">'
|
||||||
|
. JText::_('COM_JSN_BATCH_FIELDGROUP')
|
||||||
|
. '</label>'
|
||||||
|
. JHtml::_(
|
||||||
|
'select.genericlist',$dataArray,
|
||||||
|
'batch[fieldgroup_id]',
|
||||||
|
array(
|
||||||
|
'id' => 'batch-fieldgroup'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
include(JPATH_COMPONENT . '/../com_users/helpers/html/users.php');
|
||||||
@ -0,0 +1,99 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('JPATH_PLATFORM') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility class for Bootstrap elements.
|
||||||
|
*
|
||||||
|
* @package Joomla.Libraries
|
||||||
|
* @subpackage HTML
|
||||||
|
* @since 3.0
|
||||||
|
*/
|
||||||
|
abstract class JHtmlBootstrapJ30 extends JHtmlBootstrap
|
||||||
|
{
|
||||||
|
protected static $loaded = array();
|
||||||
|
|
||||||
|
public static function startTabSet($selector = 'myTab', $params = array())
|
||||||
|
{
|
||||||
|
$sig = md5(serialize(array($selector, $params)));
|
||||||
|
|
||||||
|
if (!isset(self::$loaded[__METHOD__][$sig]))
|
||||||
|
{
|
||||||
|
// Include Bootstrap framework
|
||||||
|
self::framework();
|
||||||
|
|
||||||
|
// Setup options object
|
||||||
|
$opt['active'] = (isset($params['active']) && ($params['active'])) ? (string) $params['active'] : '';
|
||||||
|
|
||||||
|
$options = JHtml::getJSObject($opt);
|
||||||
|
|
||||||
|
// Attach tabs to document
|
||||||
|
JFactory::getDocument()
|
||||||
|
->addScriptDeclaration("(function($){
|
||||||
|
$('#$selector a').click(function (e)
|
||||||
|
{
|
||||||
|
e.preventDefault();
|
||||||
|
$(this).tab('show');
|
||||||
|
});
|
||||||
|
})(jQuery);");
|
||||||
|
|
||||||
|
// Set static array
|
||||||
|
self::$loaded[__METHOD__][$sig] = true;
|
||||||
|
self::$loaded[__METHOD__][$selector]['active'] = $opt['active'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$html = '<ul class="nav nav-tabs" id="'.$selector.'Tabs"></ul>
|
||||||
|
<div class="tab-content" id="'.$selector.'Content">';
|
||||||
|
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function endTabSet()
|
||||||
|
{
|
||||||
|
$html = '</div>';
|
||||||
|
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function addTab($selector, $id, $title)
|
||||||
|
{
|
||||||
|
static $tabScriptLayout = null;
|
||||||
|
static $tabLayout = null;
|
||||||
|
|
||||||
|
$tabScriptLayout = is_null($tabScriptLayout) ? new JLayoutFile('addtabscript') : $tabScriptLayout;
|
||||||
|
$tabLayout = is_null($tabLayout) ? new JLayoutFile('addtab') : $tabLayout;
|
||||||
|
|
||||||
|
$active = (self::$loaded['JHtmlBootstrapJ30::startTabSet'][$selector]['active'] == $id) ? ' active' : '';
|
||||||
|
|
||||||
|
// Inject tab into UL
|
||||||
|
JFactory::getDocument()
|
||||||
|
->addScriptDeclaration("(function($){
|
||||||
|
$(document).ready(function() {
|
||||||
|
// Handler for .ready() called.
|
||||||
|
var tab = $('<li class=\"$active\"><a href=\"#$id\" data-toggle=\"tab\">$title</a></li>');
|
||||||
|
$('#" . $selector . "Tabs').append(tab);
|
||||||
|
});
|
||||||
|
})(jQuery);");
|
||||||
|
|
||||||
|
$html = '<div id="'.$id.'" class="tab-pane'.$active.'">';
|
||||||
|
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function endTab()
|
||||||
|
{
|
||||||
|
$html = '</div>';
|
||||||
|
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('JPATH_PLATFORM') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Rule class for the Joomla Platform.
|
||||||
|
*
|
||||||
|
* @package Joomla.Platform
|
||||||
|
* @subpackage Form
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
class JFormRuleNotequals extends JFormRule
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Method to test if two values are not equal. To use this rule, the form
|
||||||
|
* XML needs a validate attribute of equals and a field attribute
|
||||||
|
* that is equal to the field to test against.
|
||||||
|
*
|
||||||
|
* @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object.
|
||||||
|
* @param mixed $value The form field value to validate.
|
||||||
|
* @param string $group The field name group control value. This acts as as an array container for the field.
|
||||||
|
* For example if the field has name="foo" and the group value is set to "bar" then the
|
||||||
|
* full field name would end up being "bar[foo]".
|
||||||
|
* @param JRegistry $input An optional JRegistry object with the entire data set to validate against the entire form.
|
||||||
|
* @param JForm $form The form object for which the field is being tested.
|
||||||
|
*
|
||||||
|
* @return boolean True if the value is valid, false otherwise.
|
||||||
|
*
|
||||||
|
* @since 11.1
|
||||||
|
* @throws InvalidArgumentException
|
||||||
|
* @throws UnexpectedValueException
|
||||||
|
*/
|
||||||
|
public function test(SimpleXMLElement $element, $value, $group = null, JRegistry $input = null, JForm $form = null)
|
||||||
|
{
|
||||||
|
$field = (string) $element['field'];
|
||||||
|
|
||||||
|
// Check that a validation field is set.
|
||||||
|
if (!$field)
|
||||||
|
{
|
||||||
|
throw new UnexpectedValueException(sprintf('$field empty in %s::test', get_class($this)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_null($form))
|
||||||
|
{
|
||||||
|
throw new InvalidArgumentException(sprintf('The value for $form must not be null in %s', get_class($this)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_null($input))
|
||||||
|
{
|
||||||
|
throw new InvalidArgumentException(sprintf('The value for $input must not be null in %s', get_class($this)));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test the two values against each other.
|
||||||
|
if ($value != $input->get($field))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
252
deployed/jsn/administrator/components/com_jsn/helpers/jsn.php
Normal file
252
deployed/jsn/administrator/components/com_jsn/helpers/jsn.php
Normal file
@ -0,0 +1,252 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
class JsnHelperAdmin
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Configure the Submenu links.
|
||||||
|
*
|
||||||
|
* @param string The extension.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
public static function addSubmenu($extension)
|
||||||
|
{
|
||||||
|
JHtmlSidebar::addEntry(
|
||||||
|
JText::_('COM_JSN_SUBMENU_FIELDS'),
|
||||||
|
'index.php?option=com_jsn&view=fields'
|
||||||
|
);
|
||||||
|
/*JHtmlSidebar::addEntry(
|
||||||
|
JText::_('COM_JSN_SUBMENU_USERTYPE'),
|
||||||
|
'index.php?option=com_jsn&view=usertypes'
|
||||||
|
);*/
|
||||||
|
JHtmlSidebar::addEntry(
|
||||||
|
JText::_('COM_JSN_SUBMENU_USERS'),
|
||||||
|
'index.php?option=com_users&view=users'
|
||||||
|
);
|
||||||
|
require_once(JPATH_ADMINISTRATOR.'/components/com_jsn/defines.php');
|
||||||
|
if(JSN_TYPE == 'free'){
|
||||||
|
JHtmlSidebar::addEntry(
|
||||||
|
JText::_('COM_JSN_IMPORT_USERS').' (not available in free version)',
|
||||||
|
'#'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
elseif(JFactory::getUser()->authorise('core.admin.import', 'com_jsn')){
|
||||||
|
JHtmlSidebar::addEntry(
|
||||||
|
JText::_('COM_JSN_IMPORT_USERS'),
|
||||||
|
'index.php?option=com_jsn&view=import'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$parts = explode('.', $extension);
|
||||||
|
$component = $parts[0];
|
||||||
|
|
||||||
|
if (count($parts) > 1)
|
||||||
|
{
|
||||||
|
$section = $parts[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to find the component helper.
|
||||||
|
$file = JPath::clean(JPATH_ADMINISTRATOR . '/components/com_jsn/helpers/jsn.php');
|
||||||
|
|
||||||
|
if (file_exists($file))
|
||||||
|
{
|
||||||
|
require_once $file;
|
||||||
|
|
||||||
|
$cName = 'JsnHelperAdmin';
|
||||||
|
|
||||||
|
if (class_exists($cName))
|
||||||
|
{
|
||||||
|
if (is_callable(array($cName, 'addSubmenu')))
|
||||||
|
{
|
||||||
|
$lang = JFactory::getLanguage();
|
||||||
|
// loading language file from the administrator/language directory then
|
||||||
|
// loading language file from the administrator/components/*extension*/language directory
|
||||||
|
$lang->load($component, JPATH_BASE, null, false, false)
|
||||||
|
|| $lang->load($component, JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $component), null, false, false)
|
||||||
|
|| $lang->load($component, JPATH_BASE, $lang->getDefault(), false, false)
|
||||||
|
|| $lang->load($component, JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $component), $lang->getDefault(), false, false);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a list of the actions that can be performed.
|
||||||
|
*
|
||||||
|
* @return JObject
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
public static function getActions()
|
||||||
|
{
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$result = new JObject;
|
||||||
|
|
||||||
|
$assetName = 'com_jsn';
|
||||||
|
$level = 'component';
|
||||||
|
$actions = JAccess::getActions('com_jsn', $level);
|
||||||
|
|
||||||
|
foreach ($actions as $action)
|
||||||
|
{
|
||||||
|
$result->set($action->name, $user->authorise($action->name, $assetName));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*public static function excludeFromProfile($data){
|
||||||
|
$db=JFactory::getDbo();
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
$query->select('a.*')->from('#__jsn_fields AS a')->where('a.level = 2')->where('a.published = 1')->order($db->escape('a.lft') . ' ASC');
|
||||||
|
$db->setQuery( $query );
|
||||||
|
$fields = $db->loadObjectList('alias');
|
||||||
|
$userData=$data;
|
||||||
|
$excludeFromProfile=array();
|
||||||
|
foreach($fields as $field)
|
||||||
|
{
|
||||||
|
// Load Options
|
||||||
|
$registry = new JRegistry;
|
||||||
|
$registry->loadString($field->params);
|
||||||
|
$field->params = $registry->toArray();
|
||||||
|
|
||||||
|
$condition_suffix=array('','1','2','3','4');
|
||||||
|
foreach($condition_suffix as $suffix)
|
||||||
|
{
|
||||||
|
if(isset($field->params['condition_operator'.$suffix]) && $field->params['condition_operator'.$suffix]!=0 && count($field->params['condition_hide'.$suffix])>0){
|
||||||
|
if($field->params['condition_field'.$suffix]=='_custom') $value=$field->params['condition_custom'.$suffix];
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$alias=$field->params['condition_field'.$suffix];
|
||||||
|
if(isset($userData->$alias)) $value=$userData->$alias;
|
||||||
|
else $value='';
|
||||||
|
if(is_array($value)) $value=implode(',',$value);
|
||||||
|
}
|
||||||
|
$alias=$field->alias;
|
||||||
|
if(!isset($userData->$alias)) $userData->$alias='';
|
||||||
|
|
||||||
|
if(is_array($userData->$alias))
|
||||||
|
{
|
||||||
|
foreach($userData->$alias as $userValue)
|
||||||
|
{
|
||||||
|
switch($field->params['condition_operator'.$suffix])
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
if($userValue==$value)
|
||||||
|
{
|
||||||
|
foreach($field->params['condition_hide'.$suffix] as $fieldToHide)
|
||||||
|
{
|
||||||
|
$excludeFromProfile[]='jform['.$fieldToHide.']';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if($userValue>$value)
|
||||||
|
{
|
||||||
|
foreach($field->params['condition_hide'.$suffix] as $fieldToHide)
|
||||||
|
{
|
||||||
|
$excludeFromProfile[]='jform['.$fieldToHide.']';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if($userValue<$value)
|
||||||
|
{
|
||||||
|
foreach($field->params['condition_hide'.$suffix] as $fieldToHide)
|
||||||
|
{
|
||||||
|
$excludeFromProfile[]='jform['.$fieldToHide.']';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
if(strpos(' '.$userValue,$value)>0)
|
||||||
|
{
|
||||||
|
foreach($field->params['condition_hide'.$suffix] as $fieldToHide)
|
||||||
|
{
|
||||||
|
$excludeFromProfile[]='jform['.$fieldToHide.']';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
if($userValue!=$value)
|
||||||
|
{
|
||||||
|
foreach($field->params['condition_hide'.$suffix] as $fieldToHide)
|
||||||
|
{
|
||||||
|
$excludeFromProfile[]='jform['.$fieldToHide.']';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch($field->params['condition_operator'.$suffix])
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
if($userData->$alias==$value)
|
||||||
|
{
|
||||||
|
foreach($field->params['condition_hide'.$suffix] as $fieldToHide)
|
||||||
|
{
|
||||||
|
$excludeFromProfile[]='jform['.$fieldToHide.']';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if($userData->$alias>$value)
|
||||||
|
{
|
||||||
|
foreach($field->params['condition_hide'.$suffix] as $fieldToHide)
|
||||||
|
{
|
||||||
|
$excludeFromProfile[]='jform['.$fieldToHide.']';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if($userData->$alias<$value)
|
||||||
|
{
|
||||||
|
foreach($field->params['condition_hide'.$suffix] as $fieldToHide)
|
||||||
|
{
|
||||||
|
$excludeFromProfile[]='jform['.$fieldToHide.']';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
if(strpos(' '.$userData->$alias,$value)>0)
|
||||||
|
{
|
||||||
|
foreach($field->params['condition_hide'.$suffix] as $fieldToHide)
|
||||||
|
{
|
||||||
|
$excludeFromProfile[]='jform['.$fieldToHide.']';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
if($userData->$alias!=$value)
|
||||||
|
{
|
||||||
|
foreach($field->params['condition_hide'.$suffix] as $fieldToHide)
|
||||||
|
{
|
||||||
|
$excludeFromProfile[]='jform['.$fieldToHide.']';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $excludeFromProfile;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
function onConfigurationBeforeSave(){
|
||||||
|
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$config = JComponentHelper::getParams('com_jsn');
|
||||||
|
|
||||||
|
switch($config->get('namestyle', 'FIRSTNAME_LASTNAME')){
|
||||||
|
case 'FIRSTNAME_LASTNAME':
|
||||||
|
$unpublish=array($db->quote('secondname'));
|
||||||
|
$publish=array($db->quote('firstname'),$db->quote('lastname'));
|
||||||
|
break;
|
||||||
|
case 'FIRSTNAME_SECONDNAME_LASTNAME':
|
||||||
|
$unpublish=array();
|
||||||
|
$publish=array($db->quote('firstname'),$db->quote('lastname'),$db->quote('secondname'));
|
||||||
|
break;
|
||||||
|
case 'FIRSTNAME':
|
||||||
|
$unpublish=array($db->quote('secondname'),$db->quote('lastname'));
|
||||||
|
$publish=array($db->quote('firstname'));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(count($unpublish)>0)
|
||||||
|
{
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
$query->update("#__jsn_fields");
|
||||||
|
$query->set($db->quoteName('published').' = 0');
|
||||||
|
$query->where('alias IN ('. implode(', ',$unpublish) .')');
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
}
|
||||||
|
if(count($publish)>0)
|
||||||
|
{
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
$query->update("#__jsn_fields");
|
||||||
|
$query->set($db->quoteName('published').' = 1');
|
||||||
|
$query->where('alias IN ('. implode(', ',$publish) .')');
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
$query->update("#__jsn_fields");
|
||||||
|
$query->set($db->quoteName('published').' = '. ($config->get('avatar', 1) ? 1 : 0) );
|
||||||
|
$query->where('alias = '.$db->quote('avatar'));
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
onConfigurationBeforeSave();
|
||||||
|
?>
|
||||||
864
deployed/jsn/administrator/components/com_jsn/install.jsn.php
Normal file
864
deployed/jsn/administrator/components/com_jsn/install.jsn.php
Normal file
@ -0,0 +1,864 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
class com_JsnInstallerScript {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to install the extension
|
||||||
|
* $parent is the class calling this method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function install($parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to uninstall the extension
|
||||||
|
* $parent is the class calling this method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function uninstall($parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to update the extension
|
||||||
|
* $parent is the class calling this method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function update($parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to run before an install/update/uninstall method
|
||||||
|
* $parent is the class calling this method
|
||||||
|
* $type is the type of change (install, update or discover_install)
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function preflight($type, $parent)
|
||||||
|
{
|
||||||
|
$files = JPATH_SITE.'/administrator/components/com_jsn/helpers/fields/*';
|
||||||
|
foreach (glob($files) as $deletefile)
|
||||||
|
{
|
||||||
|
unlink($deletefile);
|
||||||
|
}
|
||||||
|
$files = JPATH_SITE.'/administrator/components/com_jsn/models/fields/*';
|
||||||
|
foreach (glob($files) as $deletefile)
|
||||||
|
{
|
||||||
|
unlink($deletefile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to run after an install/update/uninstall method
|
||||||
|
* $parent is the class calling this method
|
||||||
|
* $type is the type of change (install, update or discover_install)
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function postflight($type, $parent)
|
||||||
|
{
|
||||||
|
//$app = JFactory::getApplication();
|
||||||
|
$db=JFactory::getDbo();
|
||||||
|
|
||||||
|
// Add Column for versions 1.1.x to 1.2.x
|
||||||
|
try {
|
||||||
|
$query ="ALTER TABLE `#__jsn_fields` ADD `edit` tinyint(1) NOT NULL DEFAULT '0'";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
$query ="UPDATE `#__jsn_fields` SET `edit`=1 WHERE `level`=2 AND `params` NOT LIKE '%\"hideonedit\":\"1\"%'";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
$query ="UPDATE `#__jsn_fields` SET `alias`='registerdate',`path`='default/registerdate',`edit`='0' WHERE `id`=10";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
$query ="UPDATE `#__jsn_fields` SET `edit`='0' WHERE `id`=11";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
}
|
||||||
|
catch (Exception $e) { }
|
||||||
|
|
||||||
|
// Add Column for versions 1.2.x to 1.3.x
|
||||||
|
try {
|
||||||
|
$query ="ALTER TABLE `#__jsn_fields` ADD `accessview` int(10) unsigned NOT NULL DEFAULT '0'";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
$query ="UPDATE `#__jsn_fields` SET `accessview`=1;";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
}
|
||||||
|
catch (Exception $e) { }
|
||||||
|
|
||||||
|
// Remove Old Broken Package reference
|
||||||
|
try {
|
||||||
|
$query ="DELETE FROM `#__extensions` WHERE `element` = 'pkg_pkg_jsn'";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
}
|
||||||
|
catch (Exception $e) { }
|
||||||
|
|
||||||
|
// Add Column Instagram_id for versions 2.0.x to 2.1.x
|
||||||
|
try {
|
||||||
|
$query ="ALTER TABLE `#__jsn_users` MODIFY COLUMN `facebook_id` varchar(200) NOT NULL";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
$query ="ALTER TABLE `#__jsn_users` ADD `instagram_id` varchar(50) NOT NULL";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
}
|
||||||
|
catch (Exception $e) { }
|
||||||
|
|
||||||
|
// Fix root record in #__jsn_fields table
|
||||||
|
try {
|
||||||
|
$query ="UPDATE `#__jsn_fields` SET `published` = 1 WHERE `id` = 1";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
}
|
||||||
|
catch (Exception $e) { }
|
||||||
|
|
||||||
|
// Firstname and Lastname need to be required also in backend
|
||||||
|
try {
|
||||||
|
$query ="UPDATE `#__jsn_fields` SET `required` = 2 WHERE `id` IN (4,6)";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
}
|
||||||
|
catch (Exception $e) { }
|
||||||
|
|
||||||
|
// Add Column Conditions for versions 2.3+
|
||||||
|
try {
|
||||||
|
|
||||||
|
$query ="ALTER TABLE `#__jsn_fields` ADD `conditions` text NOT NULL";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
|
||||||
|
// Convert old conditions to new system
|
||||||
|
$query = 'SELECT * FROM #__jsn_fields';
|
||||||
|
$db->setQuery($query);
|
||||||
|
$fields = $db->loadObjectList('alias');
|
||||||
|
foreach($fields as $field)
|
||||||
|
{
|
||||||
|
if(empty($field->params)) continue;
|
||||||
|
|
||||||
|
$params=json_decode($field->params);
|
||||||
|
if(!isset($params->condition_operator)) continue;
|
||||||
|
|
||||||
|
$conditions=array();
|
||||||
|
// Condition 0
|
||||||
|
if($params->condition_operator > 0){
|
||||||
|
if(!empty($params->condition_hide)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator;
|
||||||
|
$c->to = $params->condition_field;
|
||||||
|
$c->custom_value = $params->condition_custom;
|
||||||
|
$c->action = ($params->condition_action=='hide' ? 'fields_hide' : 'fields_show');
|
||||||
|
$c->fields_target = $params->condition_hide;
|
||||||
|
$c->two_ways = $params->condition_twoways;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
if(!empty($params->condition_usergroups)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator;
|
||||||
|
$c->to = $params->condition_field;
|
||||||
|
$c->custom_value = $params->condition_custom;
|
||||||
|
$c->action = ($params->condition_ugaction=='add' ? 'usergroups_add' : 'usergroups_remove');
|
||||||
|
$c->usergroups_target = $params->condition_usergroups;
|
||||||
|
$c->two_ways = $params->condition_twoways;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Condition 1
|
||||||
|
if($params->condition_operator1 > 0){
|
||||||
|
if(!empty($params->condition_hide1)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator1;
|
||||||
|
$c->to = $params->condition_field1;
|
||||||
|
$c->custom_value = $params->condition_custom1;
|
||||||
|
$c->action = ($params->condition_action1=='hide' ? 'fields_hide' : 'fields_show');
|
||||||
|
$c->fields_target = $params->condition_hide1;
|
||||||
|
$c->two_ways = $params->condition_twoways1;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
if(!empty($params->condition_usergroups1)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator1;
|
||||||
|
$c->to = $params->condition_field1;
|
||||||
|
$c->custom_value = $params->condition_custom1;
|
||||||
|
$c->action = ($params->condition_ugaction1=='add' ? 'usergroups_add' : 'usergroups_remove');
|
||||||
|
$c->usergroups_target = $params->condition_usergroups1;
|
||||||
|
$c->two_ways = $params->condition_twoways1;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Condition 2
|
||||||
|
if($params->condition_operator2 > 0){
|
||||||
|
if(!empty($params->condition_hide2)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator2;
|
||||||
|
$c->to = $params->condition_field2;
|
||||||
|
$c->custom_value = $params->condition_custom2;
|
||||||
|
$c->action = ($params->condition_action2=='hide' ? 'fields_hide' : 'fields_show');
|
||||||
|
$c->fields_target = $params->condition_hide2;
|
||||||
|
$c->two_ways = $params->condition_twoways2;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
if(!empty($params->condition_usergroups2)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator2;
|
||||||
|
$c->to = $params->condition_field2;
|
||||||
|
$c->custom_value = $params->condition_custom2;
|
||||||
|
$c->action = ($params->condition_ugaction2=='add' ? 'usergroups_add' : 'usergroups_remove');
|
||||||
|
$c->usergroups_target = $params->condition_usergroups2;
|
||||||
|
$c->two_ways = $params->condition_twoways2;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Condition 3
|
||||||
|
if($params->condition_operator3 > 0){
|
||||||
|
if(!empty($params->condition_hide3)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator3;
|
||||||
|
$c->to = $params->condition_field3;
|
||||||
|
$c->custom_value = $params->condition_custom3;
|
||||||
|
$c->action = ($params->condition_action3=='hide' ? 'fields_hide' : 'fields_show');
|
||||||
|
$c->fields_target = $params->condition_hide3;
|
||||||
|
$c->two_ways = $params->condition_twoways3;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
if(!empty($params->condition_usergroups3)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator3;
|
||||||
|
$c->to = $params->condition_field3;
|
||||||
|
$c->custom_value = $params->condition_custom3;
|
||||||
|
$c->action = ($params->condition_ugaction3=='add' ? 'usergroups_add' : 'usergroups_remove');
|
||||||
|
$c->usergroups_target = $params->condition_usergroups3;
|
||||||
|
$c->two_ways = $params->condition_twoways3;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Condition 4
|
||||||
|
if($params->condition_operator4 > 0){
|
||||||
|
if(!empty($params->condition_hide4)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator4;
|
||||||
|
$c->to = $params->condition_field4;
|
||||||
|
$c->custom_value = $params->condition_custom4;
|
||||||
|
$c->action = ($params->condition_action4=='hide' ? 'fields_hide' : 'fields_show');
|
||||||
|
$c->fields_target = $params->condition_hide4;
|
||||||
|
$c->two_ways = $params->condition_twoways4;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
if(!empty($params->condition_usergroups4)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator4;
|
||||||
|
$c->to = $params->condition_field4;
|
||||||
|
$c->custom_value = $params->condition_custom4;
|
||||||
|
$c->action = ($params->condition_ugaction4=='add' ? 'usergroups_add' : 'usergroups_remove');
|
||||||
|
$c->usergroups_target = $params->condition_usergroups4;
|
||||||
|
$c->two_ways = $params->condition_twoways4;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Condition 5
|
||||||
|
if($params->condition_operator5 > 0){
|
||||||
|
if(!empty($params->condition_hide5)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator5;
|
||||||
|
$c->to = $params->condition_field5;
|
||||||
|
$c->custom_value = $params->condition_custom5;
|
||||||
|
$c->action = ($params->condition_action5=='hide' ? 'fields_hide' : 'fields_show');
|
||||||
|
$c->fields_target = $params->condition_hide5;
|
||||||
|
$c->two_ways = $params->condition_twoways5;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
if(!empty($params->condition_usergroups5)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator5;
|
||||||
|
$c->to = $params->condition_field5;
|
||||||
|
$c->custom_value = $params->condition_custom5;
|
||||||
|
$c->action = ($params->condition_ugaction5=='add' ? 'usergroups_add' : 'usergroups_remove');
|
||||||
|
$c->usergroups_target = $params->condition_usergroups5;
|
||||||
|
$c->two_ways = $params->condition_twoways5;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Condition 6
|
||||||
|
if($params->condition_operator6 > 0){
|
||||||
|
if(!empty($params->condition_hide6)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator6;
|
||||||
|
$c->to = $params->condition_field6;
|
||||||
|
$c->custom_value = $params->condition_custom6;
|
||||||
|
$c->action = ($params->condition_action6=='hide' ? 'fields_hide' : 'fields_show');
|
||||||
|
$c->fields_target = $params->condition_hide6;
|
||||||
|
$c->two_ways = $params->condition_twoways6;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
if(!empty($params->condition_usergroups6)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator6;
|
||||||
|
$c->to = $params->condition_field6;
|
||||||
|
$c->custom_value = $params->condition_custom6;
|
||||||
|
$c->action = ($params->condition_ugaction6=='add' ? 'usergroups_add' : 'usergroups_remove');
|
||||||
|
$c->usergroups_target = $params->condition_usergroups6;
|
||||||
|
$c->two_ways = $params->condition_twoways6;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Condition 7
|
||||||
|
if($params->condition_operator7 > 0){
|
||||||
|
if(!empty($params->condition_hide7)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator7;
|
||||||
|
$c->to = $params->condition_field7;
|
||||||
|
$c->custom_value = $params->condition_custom7;
|
||||||
|
$c->action = ($params->condition_action7=='hide' ? 'fields_hide' : 'fields_show');
|
||||||
|
$c->fields_target = $params->condition_hide7;
|
||||||
|
$c->two_ways = $params->condition_twoways7;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
if(!empty($params->condition_usergroups7)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator7;
|
||||||
|
$c->to = $params->condition_field7;
|
||||||
|
$c->custom_value = $params->condition_custom7;
|
||||||
|
$c->action = ($params->condition_ugaction7=='add' ? 'usergroups_add' : 'usergroups_remove');
|
||||||
|
$c->usergroups_target = $params->condition_usergroups7;
|
||||||
|
$c->two_ways = $params->condition_twoways7;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Condition 8
|
||||||
|
if($params->condition_operator8 > 0){
|
||||||
|
if(!empty($params->condition_hide8)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator8;
|
||||||
|
$c->to = $params->condition_field8;
|
||||||
|
$c->custom_value = $params->condition_custom8;
|
||||||
|
$c->action = ($params->condition_action8=='hide' ? 'fields_hide' : 'fields_show');
|
||||||
|
$c->fields_target = $params->condition_hide8;
|
||||||
|
$c->two_ways = $params->condition_twoways8;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
if(!empty($params->condition_usergroups8)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator8;
|
||||||
|
$c->to = $params->condition_field8;
|
||||||
|
$c->custom_value = $params->condition_custom8;
|
||||||
|
$c->action = ($params->condition_ugaction8=='add' ? 'usergroups_add' : 'usergroups_remove');
|
||||||
|
$c->usergroups_target = $params->condition_usergroups8;
|
||||||
|
$c->two_ways = $params->condition_twoways8;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Condition 9
|
||||||
|
if($params->condition_operator9 > 0){
|
||||||
|
if(!empty($params->condition_hide9)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator9;
|
||||||
|
$c->to = $params->condition_field9;
|
||||||
|
$c->custom_value = $params->condition_custom9;
|
||||||
|
$c->action = ($params->condition_action9=='hide' ? 'fields_hide' : 'fields_show');
|
||||||
|
$c->fields_target = $params->condition_hide9;
|
||||||
|
$c->two_ways = $params->condition_twoways9;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
if(!empty($params->condition_usergroups9)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator9;
|
||||||
|
$c->to = $params->condition_field9;
|
||||||
|
$c->custom_value = $params->condition_custom9;
|
||||||
|
$c->action = ($params->condition_ugaction9=='add' ? 'usergroups_add' : 'usergroups_remove');
|
||||||
|
$c->usergroups_target = $params->condition_usergroups9;
|
||||||
|
$c->two_ways = $params->condition_twoways9;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Condition 10
|
||||||
|
if($params->condition_operator10 > 0){
|
||||||
|
if(!empty($params->condition_hide10)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator10;
|
||||||
|
$c->to = $params->condition_field10;
|
||||||
|
$c->custom_value = $params->condition_custom10;
|
||||||
|
$c->action = ($params->condition_action10=='hide' ? 'fields_hide' : 'fields_show');
|
||||||
|
$c->fields_target = $params->condition_hide10;
|
||||||
|
$c->two_ways = $params->condition_twoways10;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
if(!empty($params->condition_usergroups10)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator10;
|
||||||
|
$c->to = $params->condition_field10;
|
||||||
|
$c->custom_value = $params->condition_custom10;
|
||||||
|
$c->action = ($params->condition_ugaction10=='add' ? 'usergroups_add' : 'usergroups_remove');
|
||||||
|
$c->usergroups_target = $params->condition_usergroups10;
|
||||||
|
$c->two_ways = $params->condition_twoways10;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Condition 11
|
||||||
|
if($params->condition_operator11 > 0){
|
||||||
|
if(!empty($params->condition_hide11)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator11;
|
||||||
|
$c->to = $params->condition_field11;
|
||||||
|
$c->custom_value = $params->condition_custom11;
|
||||||
|
$c->action = ($params->condition_action11=='hide' ? 'fields_hide' : 'fields_show');
|
||||||
|
$c->fields_target = $params->condition_hide11;
|
||||||
|
$c->two_ways = $params->condition_twoways11;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
if(!empty($params->condition_usergroups11)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator11;
|
||||||
|
$c->to = $params->condition_field11;
|
||||||
|
$c->custom_value = $params->condition_custom11;
|
||||||
|
$c->action = ($params->condition_ugaction11=='add' ? 'usergroups_add' : 'usergroups_remove');
|
||||||
|
$c->usergroups_target = $params->condition_usergroups11;
|
||||||
|
$c->two_ways = $params->condition_twoways11;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Condition 12
|
||||||
|
if($params->condition_operator12 > 0){
|
||||||
|
if(!empty($params->condition_hide12)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator12;
|
||||||
|
$c->to = $params->condition_field12;
|
||||||
|
$c->custom_value = $params->condition_custom12;
|
||||||
|
$c->action = ($params->condition_action12=='hide' ? 'fields_hide' : 'fields_show');
|
||||||
|
$c->fields_target = $params->condition_hide12;
|
||||||
|
$c->two_ways = $params->condition_twoways12;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
if(!empty($params->condition_usergroups12)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator12;
|
||||||
|
$c->to = $params->condition_field12;
|
||||||
|
$c->custom_value = $params->condition_custom12;
|
||||||
|
$c->action = ($params->condition_ugaction12=='add' ? 'usergroups_add' : 'usergroups_remove');
|
||||||
|
$c->usergroups_target = $params->condition_usergroups12;
|
||||||
|
$c->two_ways = $params->condition_twoways12;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Condition 13
|
||||||
|
if($params->condition_operator13 > 0){
|
||||||
|
if(!empty($params->condition_hide13)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator13;
|
||||||
|
$c->to = $params->condition_field13;
|
||||||
|
$c->custom_value = $params->condition_custom13;
|
||||||
|
$c->action = ($params->condition_action13=='hide' ? 'fields_hide' : 'fields_show');
|
||||||
|
$c->fields_target = $params->condition_hide13;
|
||||||
|
$c->two_ways = $params->condition_twoways13;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
if(!empty($params->condition_usergroups13)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator13;
|
||||||
|
$c->to = $params->condition_field13;
|
||||||
|
$c->custom_value = $params->condition_custom13;
|
||||||
|
$c->action = ($params->condition_ugaction13=='add' ? 'usergroups_add' : 'usergroups_remove');
|
||||||
|
$c->usergroups_target = $params->condition_usergroups13;
|
||||||
|
$c->two_ways = $params->condition_twoways13;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Condition 14
|
||||||
|
if($params->condition_operator14 > 0){
|
||||||
|
if(!empty($params->condition_hide14)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator14;
|
||||||
|
$c->to = $params->condition_field14;
|
||||||
|
$c->custom_value = $params->condition_custom14;
|
||||||
|
$c->action = ($params->condition_action14=='hide' ? 'fields_hide' : 'fields_show');
|
||||||
|
$c->fields_target = $params->condition_hide14;
|
||||||
|
$c->two_ways = $params->condition_twoways14;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
if(!empty($params->condition_usergroups14)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator14;
|
||||||
|
$c->to = $params->condition_field14;
|
||||||
|
$c->custom_value = $params->condition_custom14;
|
||||||
|
$c->action = ($params->condition_ugaction14=='add' ? 'usergroups_add' : 'usergroups_remove');
|
||||||
|
$c->usergroups_target = $params->condition_usergroups14;
|
||||||
|
$c->two_ways = $params->condition_twoways14;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Condition 15
|
||||||
|
if($params->condition_operator15 > 0){
|
||||||
|
if(!empty($params->condition_hide15)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator15;
|
||||||
|
$c->to = $params->condition_field15;
|
||||||
|
$c->custom_value = $params->condition_custom15;
|
||||||
|
$c->action = ($params->condition_action15=='hide' ? 'fields_hide' : 'fields_show');
|
||||||
|
$c->fields_target = $params->condition_hide15;
|
||||||
|
$c->two_ways = $params->condition_twoways15;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
if(!empty($params->condition_usergroups15)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator15;
|
||||||
|
$c->to = $params->condition_field15;
|
||||||
|
$c->custom_value = $params->condition_custom15;
|
||||||
|
$c->action = ($params->condition_ugaction15=='add' ? 'usergroups_add' : 'usergroups_remove');
|
||||||
|
$c->usergroups_target = $params->condition_usergroups15;
|
||||||
|
$c->two_ways = $params->condition_twoways15;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Condition 16
|
||||||
|
if($params->condition_operator16 > 0){
|
||||||
|
if(!empty($params->condition_hide16)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator16;
|
||||||
|
$c->to = $params->condition_field16;
|
||||||
|
$c->custom_value = $params->condition_custom16;
|
||||||
|
$c->action = ($params->condition_action16=='hide' ? 'fields_hide' : 'fields_show');
|
||||||
|
$c->fields_target = $params->condition_hide16;
|
||||||
|
$c->two_ways = $params->condition_twoways16;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
if(!empty($params->condition_usergroups16)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator16;
|
||||||
|
$c->to = $params->condition_field16;
|
||||||
|
$c->custom_value = $params->condition_custom16;
|
||||||
|
$c->action = ($params->condition_ugaction16=='add' ? 'usergroups_add' : 'usergroups_remove');
|
||||||
|
$c->usergroups_target = $params->condition_usergroups16;
|
||||||
|
$c->two_ways = $params->condition_twoways16;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Condition 17
|
||||||
|
if($params->condition_operator17 > 0){
|
||||||
|
if(!empty($params->condition_hide17)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator17;
|
||||||
|
$c->to = $params->condition_field17;
|
||||||
|
$c->custom_value = $params->condition_custom17;
|
||||||
|
$c->action = ($params->condition_action17=='hide' ? 'fields_hide' : 'fields_show');
|
||||||
|
$c->fields_target = $params->condition_hide17;
|
||||||
|
$c->two_ways = $params->condition_twoways17;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
if(!empty($params->condition_usergroups17)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator17;
|
||||||
|
$c->to = $params->condition_field17;
|
||||||
|
$c->custom_value = $params->condition_custom17;
|
||||||
|
$c->action = ($params->condition_ugaction17=='add' ? 'usergroups_add' : 'usergroups_remove');
|
||||||
|
$c->usergroups_target = $params->condition_usergroups17;
|
||||||
|
$c->two_ways = $params->condition_twoways17;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Condition 18
|
||||||
|
if($params->condition_operator18 > 0){
|
||||||
|
if(!empty($params->condition_hide18)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator18;
|
||||||
|
$c->to = $params->condition_field18;
|
||||||
|
$c->custom_value = $params->condition_custom18;
|
||||||
|
$c->action = ($params->condition_action18=='hide' ? 'fields_hide' : 'fields_show');
|
||||||
|
$c->fields_target = $params->condition_hide18;
|
||||||
|
$c->two_ways = $params->condition_twoways18;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
if(!empty($params->condition_usergroups18)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator18;
|
||||||
|
$c->to = $params->condition_field18;
|
||||||
|
$c->custom_value = $params->condition_custom18;
|
||||||
|
$c->action = ($params->condition_ugaction18=='add' ? 'usergroups_add' : 'usergroups_remove');
|
||||||
|
$c->usergroups_target = $params->condition_usergroups18;
|
||||||
|
$c->two_ways = $params->condition_twoways18;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Condition 19
|
||||||
|
if($params->condition_operator19 > 0){
|
||||||
|
if(!empty($params->condition_hide19)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator19;
|
||||||
|
$c->to = $params->condition_field19;
|
||||||
|
$c->custom_value = $params->condition_custom19;
|
||||||
|
$c->action = ($params->condition_action19=='hide' ? 'fields_hide' : 'fields_show');
|
||||||
|
$c->fields_target = $params->condition_hide19;
|
||||||
|
$c->two_ways = $params->condition_twoways19;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
if(!empty($params->condition_usergroups19)){
|
||||||
|
$c = new stdClass();
|
||||||
|
$c->operator = $params->condition_operator19;
|
||||||
|
$c->to = $params->condition_field19;
|
||||||
|
$c->custom_value = $params->condition_custom19;
|
||||||
|
$c->action = ($params->condition_ugaction19=='add' ? 'usergroups_add' : 'usergroups_remove');
|
||||||
|
$c->usergroups_target = $params->condition_usergroups19;
|
||||||
|
$c->two_ways = $params->condition_twoways19;
|
||||||
|
if(empty($c->to)) $c->to = '';
|
||||||
|
if(empty($c->custom_value)) $c->custom_value = '';
|
||||||
|
if(empty($c->fields_target)) $c->fields_target = '';
|
||||||
|
if(empty($c->two_ways)) $c->two_ways = 1;
|
||||||
|
$conditions[]=$c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(count($conditions)){
|
||||||
|
$conditions = json_encode($conditions);
|
||||||
|
$query ="UPDATE `#__jsn_fields` SET `conditions` = ".$db->quote($conditions)." WHERE id=".$field->id;
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception $e) { }
|
||||||
|
|
||||||
|
// Change Collation
|
||||||
|
try {
|
||||||
|
$query ="ALTER TABLE #__jsn_users CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
$query ="ALTER TABLE #__jsn_fields CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
}
|
||||||
|
catch (Exception $e) { }
|
||||||
|
|
||||||
|
// Joomla updater
|
||||||
|
/*$query=$db->getQuery(true);
|
||||||
|
$query->select('location')->from('#__update_sites')->where('`name`="Easy Profile"');
|
||||||
|
$db->setQuery($query);
|
||||||
|
$updaterSiteId=$db->loadResult();
|
||||||
|
|
||||||
|
if($updaterSiteId==false)
|
||||||
|
{
|
||||||
|
$query='INSERT INTO #__update_sites(`name`,`type`,`location`,`enabled`) VALUES ("Easy Profile","extension","https://www.easy-profile.com/extension.xml",1)';
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
$updaterSiteId = $db->insertid();
|
||||||
|
}
|
||||||
|
|
||||||
|
$query=$db->getQuery(true);
|
||||||
|
$query->select('extension_id')->from('#__extensions')->where('`name`="com_jsn"');
|
||||||
|
$db->setQuery($query);
|
||||||
|
$updaterExtensionId= $db->loadResult();
|
||||||
|
|
||||||
|
try {
|
||||||
|
$query='INSERT INTO #__update_sites_extensions(`update_site_id`,`extension_id`) VALUES ('.$updaterSiteId.','.$updaterExtensionId.')';
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
}
|
||||||
|
catch (Exception $e) { }*/
|
||||||
|
|
||||||
|
// Plugin enable
|
||||||
|
$query=$db->getQuery(true);
|
||||||
|
$query->update('#__extensions')->set($db->quoteName('enabled').'=1')
|
||||||
|
->where($db->quoteName('element').' IN ('.
|
||||||
|
$db->quote('jsn_author').','.
|
||||||
|
$db->quote('jsn_auth').','.
|
||||||
|
$db->quote('jsn_system').','.
|
||||||
|
$db->quote('jsn_content').','.
|
||||||
|
$db->quote('jsn_users').','.
|
||||||
|
$db->quote('usergroups').','.
|
||||||
|
$db->quote('ajaxuserlist').','.
|
||||||
|
$db->quote('socialconnect').')');
|
||||||
|
$db->setQuery($query);
|
||||||
|
|
||||||
|
$result = $db->query();
|
||||||
|
|
||||||
|
$lang = JFactory::getLanguage();
|
||||||
|
$lang->load('com_jsn');
|
||||||
|
|
||||||
|
$message='<div style="text-align:center"><style>.alert{display:none;}.alert.alert-success,.alert.alert-error,.alert.alert-danger{display:block;}</style><img style="width:200px;" src="http://www.easy-profile.com/easyprofile.png" /><br /><br /><b>';
|
||||||
|
|
||||||
|
if($type=='install') $message.='Successfully installed';
|
||||||
|
else $message.='Successfully updated';
|
||||||
|
|
||||||
|
$message.='</b><br /><br /><a class="btn btn-warning" target="_blank" href="https://www.easy-profile.com/support"><i class="icon icon-question-sign"></i> <b>Support</b></a> <a class="btn btn-info" target="_blank" href="http://docs.easy-profile.com/"><i class="icon icon-book"></i> <b>Docs</b></a><br /><br /></div>';
|
||||||
|
|
||||||
|
JFactory::getApplication()->enqueueMessage($message);
|
||||||
|
|
||||||
|
//$app->redirect('index.php?option=com_jsn&task='.$type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
47
deployed/jsn/administrator/components/com_jsn/jsn.php
Normal file
47
deployed/jsn/administrator/components/com_jsn/jsn.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
require_once(JPATH_COMPONENT.'/helpers/trigger_com_config.php');
|
||||||
|
|
||||||
|
require_once(JPATH_COMPONENT.'/defines.php');
|
||||||
|
|
||||||
|
ini_set('display_errors', false);
|
||||||
|
error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE);
|
||||||
|
|
||||||
|
$version=new JVersion();
|
||||||
|
if($version->RELEASE=='3.0'){
|
||||||
|
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/j30/html');
|
||||||
|
JFormHelper::addRulePath(JPATH_COMPONENT.'/helpers/j30/rule');
|
||||||
|
define('JSNPREFIX','j30');
|
||||||
|
}
|
||||||
|
else define('JSNPREFIX','');
|
||||||
|
|
||||||
|
$input = JFactory::getApplication()->input;
|
||||||
|
|
||||||
|
if (!JFactory::getUser()->authorise('core.manage', 'com_jsn') && $input->get('view','fields')!='opField' && $input->get('view','fields')!='users')
|
||||||
|
{
|
||||||
|
return JFactory::getApplication()->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'));
|
||||||
|
}
|
||||||
|
if (!JFactory::getUser()->authorise('core.manage', 'com_users') && $input->get('view','fields')=='users')
|
||||||
|
{
|
||||||
|
return JFactory::getApplication()->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$lang = JFactory::getLanguage();
|
||||||
|
$lang->load('com_users');
|
||||||
|
$lang->load('com_jsn',JPATH_SITE);
|
||||||
|
JLoader::register('UsersHelper', __DIR__ . '/../com_users/helpers/users.php');
|
||||||
|
|
||||||
|
$task = $input->get('task');
|
||||||
|
|
||||||
|
$controller = JControllerLegacy::getInstance('Jsn');
|
||||||
|
$controller->execute($input->get('task'));
|
||||||
|
$controller->redirect();
|
||||||
83
deployed/jsn/administrator/components/com_jsn/jsn.xml
Normal file
83
deployed/jsn/administrator/components/com_jsn/jsn.xml
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<extension type="component" version="3.0" method="upgrade">
|
||||||
|
<name>com_jsn</name>
|
||||||
|
<author>JSN Project</author>
|
||||||
|
<creationDate>December 2013</creationDate>
|
||||||
|
<copyright>(C) 2005 - 2013 Open Source Matters. All rights reserved.</copyright>
|
||||||
|
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
|
||||||
|
<authorEmail>fiorino.desanto@gmail.com</authorEmail>
|
||||||
|
<authorUrl>www.joomla.org</authorUrl>
|
||||||
|
<version>2.5.6</version>
|
||||||
|
<description>COM_JSN_XML_DESCRIPTION</description>
|
||||||
|
|
||||||
|
<scriptfile>install.jsn.php</scriptfile>
|
||||||
|
|
||||||
|
<install> <!-- Runs on install -->
|
||||||
|
<sql>
|
||||||
|
<file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file>
|
||||||
|
</sql>
|
||||||
|
</install>
|
||||||
|
<uninstall> <!-- Runs on uninstall -->
|
||||||
|
<sql>
|
||||||
|
<file driver="mysql" charset="utf8">sql/uninstall.mysql.utf8.sql</file>
|
||||||
|
</sql>
|
||||||
|
</uninstall>
|
||||||
|
<update>
|
||||||
|
<schemas>
|
||||||
|
<schemapath type="mysql">sql/updates</schemapath>
|
||||||
|
</schemas>
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<files folder="site">
|
||||||
|
<filename>jsn.php</filename>
|
||||||
|
<filename>router.php</filename>
|
||||||
|
<filename>controller.php</filename>
|
||||||
|
<folder>helpers</folder>
|
||||||
|
<folder>models</folder>
|
||||||
|
<folder>views</folder>
|
||||||
|
<folder>assets</folder>
|
||||||
|
</files>
|
||||||
|
<languages>
|
||||||
|
<language tag="it-IT">languages/site/it-IT/it-IT.com_jsn.ini</language>
|
||||||
|
<language tag="en-GB">languages/site/en-GB/en-GB.com_jsn.ini</language>
|
||||||
|
<language tag="de-DE">languages/site/de-DE/de-DE.com_jsn.ini</language>
|
||||||
|
<language tag="es-ES">languages/site/es-ES/es-ES.com_jsn.ini</language>
|
||||||
|
</languages>
|
||||||
|
|
||||||
|
<administration>
|
||||||
|
<files folder="admin">
|
||||||
|
<filename>jsn.php</filename>
|
||||||
|
<filename>access.xml</filename>
|
||||||
|
<filename>config.xml</filename>
|
||||||
|
<!-- <filename>jsn.xml</filename> -->
|
||||||
|
<filename>controller.php</filename>
|
||||||
|
<filename>defines.php</filename>
|
||||||
|
<folder>controllers</folder>
|
||||||
|
<folder>helpers</folder>
|
||||||
|
<folder>models</folder>
|
||||||
|
<folder>views</folder>
|
||||||
|
<folder>sql</folder>
|
||||||
|
<folder>tables</folder>
|
||||||
|
<folder>assets</folder>
|
||||||
|
</files>
|
||||||
|
<languages>
|
||||||
|
<language tag="it-IT">languages/admin/it-IT/it-IT.com_jsn.ini</language>
|
||||||
|
<language tag="it-IT">languages/admin/it-IT/it-IT.com_jsn.sys.ini</language>
|
||||||
|
<language tag="en-GB">languages/admin/en-GB/en-GB.com_jsn.ini</language>
|
||||||
|
<language tag="en-GB">languages/admin/en-GB/en-GB.com_jsn.sys.ini</language>
|
||||||
|
<language tag="de-DE">languages/admin/de-DE/de-DE.com_jsn.ini</language>
|
||||||
|
<language tag="de-DE">languages/admin/de-DE/de-DE.com_jsn.sys.ini</language>
|
||||||
|
<language tag="es-ES">languages/admin/es-ES/es-ES.com_jsn.ini</language>
|
||||||
|
<language tag="es-ES">languages/admin/es-ES/es-ES.com_jsn.sys.ini</language>
|
||||||
|
</languages>
|
||||||
|
<menu link="option=com_jsn" img="class:fields">com_jsn</menu>
|
||||||
|
|
||||||
|
</administration>
|
||||||
|
|
||||||
|
<updateservers>
|
||||||
|
<server type="extension" priority="1" name="Easy Profile">https://www.easy-profile.com/update.php?p=easy-profile&file=extension.xml</server>
|
||||||
|
</updateservers>
|
||||||
|
|
||||||
|
</extension>
|
||||||
|
|
||||||
|
|
||||||
696
deployed/jsn/administrator/components/com_jsn/models/field.php
Normal file
696
deployed/jsn/administrator/components/com_jsn/models/field.php
Normal file
@ -0,0 +1,696 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
class JsnModelField extends JModelAdmin
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string The prefix to use with controller messages.
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
protected $text_prefix = 'COM_JSN';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param array An optional associative array of configuration settings.
|
||||||
|
* @see JController
|
||||||
|
* @since 3.0.3
|
||||||
|
*/
|
||||||
|
public function __construct($config = array())
|
||||||
|
{
|
||||||
|
parent::__construct($config);
|
||||||
|
// Include Field Class
|
||||||
|
foreach (glob(JPATH_ADMINISTRATOR . '/components/com_jsn/helpers/fields/*.php') as $filename) {
|
||||||
|
require_once $filename;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to test whether a record can be deleted.
|
||||||
|
*
|
||||||
|
* @param object $record A record object.
|
||||||
|
*
|
||||||
|
* @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
protected function canDelete($record)
|
||||||
|
{
|
||||||
|
if (!empty($record->id))
|
||||||
|
{
|
||||||
|
if ($record->published != -2)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
|
||||||
|
return parent::canDelete($record);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to test whether a record can have its state changed.
|
||||||
|
*
|
||||||
|
* @param object $record A record object.
|
||||||
|
*
|
||||||
|
* @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
protected function canEditState($record,$nameField = null)
|
||||||
|
{
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
|
||||||
|
// Prevent Delete and Unpublish Core Fields
|
||||||
|
if(($record->core && $nameField!='profile' && $nameField!='search') && !($record->alias=='avatar' && ($nameField=='edit' || $nameField=='required' || $nameField=='register')) && !($record->alias=='secondname' && $nameField=='required'))
|
||||||
|
{
|
||||||
|
JFactory::getApplication()->enqueueMessage(JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED').' - '.JText::_('COM_JSN_VIEWCONFIG'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::canEditState($record);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get a table object, load it if necessary.
|
||||||
|
*
|
||||||
|
* @param string $type The table name. Optional.
|
||||||
|
* @param string $prefix The class prefix. Optional.
|
||||||
|
* @param array $config Configuration array for model. Optional.
|
||||||
|
*
|
||||||
|
* @return JTable A JTable object
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
public function getTable($type = 'Field', $prefix = 'JsnTable', $config = array())
|
||||||
|
{
|
||||||
|
return JTable::getInstance($type, $prefix, $config);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-populate the model state.
|
||||||
|
*
|
||||||
|
* Note. Calling getState in this method will result in recursion.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
protected function populateState()
|
||||||
|
{
|
||||||
|
$app = JFactory::getApplication('administrator');
|
||||||
|
|
||||||
|
$parentId = $app->input->getInt('parent_id');
|
||||||
|
$this->setState('field.parent_id', $parentId);
|
||||||
|
|
||||||
|
// Load the User state.
|
||||||
|
$pk = $app->input->getInt('id');
|
||||||
|
$this->setState($this->getName() . '.id', $pk);
|
||||||
|
|
||||||
|
// Load the parameters.
|
||||||
|
$params = JComponentHelper::getParams('com_jsn');
|
||||||
|
$this->setState('params', $params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get a field.
|
||||||
|
*
|
||||||
|
* @param integer $pk An optional id of the object to get, otherwise the id from the model state is used.
|
||||||
|
*
|
||||||
|
* @return mixed Field data object on success, false on failure.
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
public function getItem($pk = null)
|
||||||
|
{
|
||||||
|
if ($result = parent::getItem($pk))
|
||||||
|
{
|
||||||
|
|
||||||
|
// Prime required properties.
|
||||||
|
if (empty($result->id))
|
||||||
|
{
|
||||||
|
$result->parent_id = $this->getState('field.parent_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert the metadata field to an array.
|
||||||
|
$registry = new JRegistry;
|
||||||
|
$registry->loadString($result->metadata);
|
||||||
|
$result->metadata = $registry->toArray();
|
||||||
|
|
||||||
|
// Convert the images field to an array.
|
||||||
|
$registry = new JRegistry;
|
||||||
|
$registry->loadString($result->images);
|
||||||
|
$result->images = $registry->toArray();
|
||||||
|
|
||||||
|
// Convert the created and modified dates to local user time for display in the form.
|
||||||
|
$tz = new DateTimeZone(JFactory::getApplication()->getCfg('offset'));
|
||||||
|
|
||||||
|
if ((int) $result->created_time)
|
||||||
|
{
|
||||||
|
$date = new JDate($result->created_time);
|
||||||
|
$date->setTimezone($tz);
|
||||||
|
$result->created_time = $date->toSql(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$result->created_time = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((int) $result->modified_time)
|
||||||
|
{
|
||||||
|
$date = new JDate($result->modified_time);
|
||||||
|
$date->setTimezone($tz);
|
||||||
|
$result->modified_time = $date->toSql(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$result->modified_time = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get the row form.
|
||||||
|
*
|
||||||
|
* @param array $data Data for the form.
|
||||||
|
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
|
||||||
|
*
|
||||||
|
* @return mixed A JForm object on success, false on failure
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
public function getForm($data = array(), $loadData = true)
|
||||||
|
{
|
||||||
|
$extension = $this->getState('field');
|
||||||
|
$jinput = JFactory::getApplication()->input;
|
||||||
|
|
||||||
|
// Get the form.
|
||||||
|
$form = $this->loadForm('com_jsn.field', 'field', array('control' => 'jform', 'load_data' => $loadData));
|
||||||
|
|
||||||
|
if (empty($form))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
if (!$user->authorise('core.edit.state', 'com_jsn' . $jinput->get('id')))
|
||||||
|
{
|
||||||
|
// Disable fields for display.
|
||||||
|
$form->setFieldAttribute('ordering', 'disabled', 'true');
|
||||||
|
$form->setFieldAttribute('published', 'disabled', 'true');
|
||||||
|
|
||||||
|
// Disable fields while saving.
|
||||||
|
// The controller has already verified this is a record you can edit.
|
||||||
|
$form->setFieldAttribute('ordering', 'filter', 'unset');
|
||||||
|
$form->setFieldAttribute('published', 'filter', 'unset');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load Fields Params
|
||||||
|
foreach (glob(JPATH_ADMINISTRATOR . '/components/com_jsn/helpers/fields/*.xml') as $filename)
|
||||||
|
{
|
||||||
|
$form->loadFile($filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get the data that should be injected in the form.
|
||||||
|
*
|
||||||
|
* @return mixed The data for the form.
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
protected function loadFormData()
|
||||||
|
{
|
||||||
|
// Check the session for previously entered form data.
|
||||||
|
$data = JFactory::getApplication()->getUserState('com_jsn.edit.field.data', array());
|
||||||
|
|
||||||
|
if (empty($data))
|
||||||
|
{
|
||||||
|
$data = $this->getItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
$version=new JVersion();
|
||||||
|
if($version->RELEASE=='3.0') $this->preprocessDataJ30('com_jsn.field', $data);
|
||||||
|
else $this->preprocessData('com_jsn.field', $data);
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to preprocess the form.
|
||||||
|
*
|
||||||
|
* @param JForm $form A JForm object.
|
||||||
|
* @param mixed $data The data expected for the form.
|
||||||
|
* @param string $group The name of the plugin group to import.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @see JFormField
|
||||||
|
* @since 3.1
|
||||||
|
* @throws Exception if there is an error in the form event.
|
||||||
|
*/
|
||||||
|
protected function preprocessForm(JForm $form, $data, $group = 'content')
|
||||||
|
{
|
||||||
|
// Trigger the default form events.
|
||||||
|
parent::preprocessForm($form, $data, $group);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to save the form data.
|
||||||
|
*
|
||||||
|
* @param array $data The form data.
|
||||||
|
*
|
||||||
|
* @return boolean True on success.
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
public function save($data)
|
||||||
|
{
|
||||||
|
$dispatcher = JEventDispatcher::getInstance();
|
||||||
|
$table = $this->getTable();
|
||||||
|
$input = JFactory::getApplication()->input;
|
||||||
|
$pk = (!empty($data['id'])) ? $data['id'] : (int) $this->getState($this->getName() . '.id');
|
||||||
|
$isNew = true;
|
||||||
|
|
||||||
|
// Include the content plugins for the on save events.
|
||||||
|
JPluginHelper::importPlugin('content');
|
||||||
|
|
||||||
|
// Load the row if saving an existing field.
|
||||||
|
if ($pk > 0)
|
||||||
|
{
|
||||||
|
$table->load($pk);
|
||||||
|
$isNew = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the new parent id if parent id not matched OR while New/Save as Copy .
|
||||||
|
if ($table->parent_id != $data['parent_id'] || $data['id'] == 0)
|
||||||
|
{
|
||||||
|
$table->setLocation($data['parent_id'], 'last-child');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($data['images']) && is_array($data['images']))
|
||||||
|
{
|
||||||
|
$registry = new JRegistry;
|
||||||
|
$registry->loadArray($data['images']);
|
||||||
|
$data['images'] = (string) $registry;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alter the title for save as copy
|
||||||
|
if ($input->get('task') == 'save2copy')
|
||||||
|
{
|
||||||
|
list($title, $alias) = $this->generateNewTitle($data['parent_id'], $data['alias'], $data['title']);
|
||||||
|
$data['title'] = $title;
|
||||||
|
$data['alias'] = $alias;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove Search flag for some field type
|
||||||
|
$removeSearch = array('filetype','image','delimeter');
|
||||||
|
if($isNew && in_array($data['type'],$removeSearch))
|
||||||
|
{
|
||||||
|
$data['search'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Block Modify of Alias, Type and Core / Block Modify of core parameter
|
||||||
|
if(!$isNew)
|
||||||
|
{
|
||||||
|
unset($data['type']);
|
||||||
|
unset($data['alias']);
|
||||||
|
unset($data['core']);
|
||||||
|
if($table->core && $table->alias != 'avatar' && $table->alias != 'secondname'){
|
||||||
|
unset($data['required']);
|
||||||
|
//unset($data['profile']);
|
||||||
|
unset($data['register']);
|
||||||
|
unset($data['edit']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set Tos
|
||||||
|
/*if($data['type']=='tos')
|
||||||
|
{
|
||||||
|
$data['required']=1;
|
||||||
|
$data['register']=1;
|
||||||
|
$data['profile']=0;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
// Block Reserved Alias
|
||||||
|
$reserved=array('id','name','email1','email2','password1','password2','params','privacy','facebook_id','google_id','twitter_id','linkedin_id','instagram_id','search');
|
||||||
|
if($isNew && in_array( strtolower($data['alias']) , $reserved ))
|
||||||
|
{
|
||||||
|
$data['alias']='jsn_'.$data['alias'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind the data.
|
||||||
|
if (!$table->bind($data))
|
||||||
|
{
|
||||||
|
$this->setError($table->getError());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind the rules.
|
||||||
|
if (isset($data['rules']))
|
||||||
|
{
|
||||||
|
$rules = new JAccessRules($data['rules']);
|
||||||
|
$table->setRules($rules);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check the data.
|
||||||
|
if (!$table->check())
|
||||||
|
{
|
||||||
|
$this->setError($table->getError());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Trigger the onContentBeforeSave event.
|
||||||
|
$result = $dispatcher->trigger($this->event_before_save, array($this->option . '.' . $this->name, &$table, $isNew));
|
||||||
|
if (in_array(false, $result, true))
|
||||||
|
{
|
||||||
|
$this->setError($table->getError());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store the data.
|
||||||
|
if (!$table->store())
|
||||||
|
{
|
||||||
|
$this->setError($table->getError());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Trigger the onContentAfterSave event.
|
||||||
|
$dispatcher->trigger($this->event_after_save, array($this->option . '.' . $this->name, &$table, $isNew));
|
||||||
|
|
||||||
|
// Create function for field
|
||||||
|
if($isNew && $table->level==2){
|
||||||
|
$class='Jsn'.ucfirst($table->type).'FieldHelper';
|
||||||
|
if(class_exists($class)) $class::create($table->alias);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rebuild the path for the field:
|
||||||
|
if (!$table->rebuildPath($table->id))
|
||||||
|
{
|
||||||
|
$this->setError($table->getError());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rebuild the paths of the field's children:
|
||||||
|
if (!$table->rebuild($table->id, $table->lft, $table->level, $table->path))
|
||||||
|
{
|
||||||
|
$this->setError($table->getError());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setState($this->getName() . '.id', $table->id);
|
||||||
|
|
||||||
|
// Clear the cache
|
||||||
|
$this->cleanCache();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete(&$pks){
|
||||||
|
foreach($pks as $pk){
|
||||||
|
$item=$this->getItem($pk);
|
||||||
|
if($item->level==2){
|
||||||
|
try{
|
||||||
|
$class='Jsn'.ucfirst($item->type).'FieldHelper';
|
||||||
|
if(class_exists($class)) $class::delete($item->alias);
|
||||||
|
}
|
||||||
|
catch (Exception $e) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return parent::delete($pks);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method rebuild the entire nested set tree.
|
||||||
|
*
|
||||||
|
* @return boolean False on failure or error, true otherwise.
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
public function rebuild()
|
||||||
|
{
|
||||||
|
// Get an instance of the table object.
|
||||||
|
$table = $this->getTable();
|
||||||
|
|
||||||
|
if (!$table->rebuild())
|
||||||
|
{
|
||||||
|
$this->setError($table->getError());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear the cache
|
||||||
|
$this->cleanCache();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to save the reordered nested set tree.
|
||||||
|
* First we save the new order values in the lft values of the changed ids.
|
||||||
|
* Then we invoke the table rebuild to implement the new ordering.
|
||||||
|
*
|
||||||
|
* @param array $idArray An array of primary key ids.
|
||||||
|
* @param integer $lft_array The lft value
|
||||||
|
*
|
||||||
|
* @return boolean False on failure or error, True otherwise
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
public function saveorder($idArray = null, $lft_array = null)
|
||||||
|
{
|
||||||
|
// Get an instance of the table object.
|
||||||
|
$table = $this->getTable();
|
||||||
|
|
||||||
|
if (!$table->saveorder($idArray, $lft_array))
|
||||||
|
{
|
||||||
|
$this->setError($table->getError());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear the cache
|
||||||
|
$this->cleanCache();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to change the title & alias.
|
||||||
|
*
|
||||||
|
* @param integer $parent_id The id of the parent.
|
||||||
|
* @param string $alias The alias.
|
||||||
|
* @param string $title The title.
|
||||||
|
*
|
||||||
|
* @return array Contains the modified title and alias.
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
protected function generateNewTitle($parent_id, $alias, $title)
|
||||||
|
{
|
||||||
|
// Alter the title & alias
|
||||||
|
$table = $this->getTable();
|
||||||
|
while ($table->load(array('alias' => $alias, 'parent_id' => $parent_id)))
|
||||||
|
{
|
||||||
|
$title = ($table->title != $title) ? $title : JString::increment($title);
|
||||||
|
$alias = JString::increment($alias, 'dash');
|
||||||
|
}
|
||||||
|
|
||||||
|
return array($title, $alias);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function toggle(&$pks, $value = 1, $nameField)
|
||||||
|
{
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$table = $this->getTable();
|
||||||
|
$pks = (array) $pks;
|
||||||
|
|
||||||
|
// Access checks.
|
||||||
|
foreach ($pks as $i => $pk)
|
||||||
|
{
|
||||||
|
if ($table->load($pk))
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!$this->canEditState($table,$nameField))
|
||||||
|
{
|
||||||
|
// Prune items that you can't change.
|
||||||
|
unset($pks[$i]);
|
||||||
|
JFactory::getApplication()->enqueueMessage(JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED').' - '.JText::_('COM_JSN_VIEWCONFIG'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attempt to change the state of the records.
|
||||||
|
if (!$table->toggle($pks, $value, $user->get('id'),$nameField))
|
||||||
|
{
|
||||||
|
$this->setError($table->getError());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function preprocessDataJ30($context, &$data)
|
||||||
|
{
|
||||||
|
// Get the dispatcher and load the users plugins.
|
||||||
|
$dispatcher = JEventDispatcher::getInstance();
|
||||||
|
JPluginHelper::importPlugin('content');
|
||||||
|
|
||||||
|
// Trigger the data preparation event.
|
||||||
|
$results = $dispatcher->trigger('onContentPrepareData', array($context, $data));
|
||||||
|
|
||||||
|
// Check for errors encountered while preparing the data.
|
||||||
|
if (count($results) > 0 && in_array(false, $results, true))
|
||||||
|
{
|
||||||
|
$this->setError($dispatcher->getError());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function batchAccess($value, $pks, $contexts)
|
||||||
|
{
|
||||||
|
$new_pk=array();
|
||||||
|
foreach($pks as $key => $pk)
|
||||||
|
{
|
||||||
|
// Remove Core Fields
|
||||||
|
if($pk>11) $new_pk[]=$pk;
|
||||||
|
}
|
||||||
|
parent::batchAccess($value, $new_pk, $contexts);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function batch($commands, $pks, $contexts)
|
||||||
|
{
|
||||||
|
parent::batch($commands, $pks, $contexts);
|
||||||
|
if (!empty($commands['assetgroupview_id']))
|
||||||
|
{
|
||||||
|
if (!$this->batchAccessView($commands['assetgroupview_id'], $pks, $contexts))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$done = true;
|
||||||
|
}
|
||||||
|
if (!empty($commands['fieldgroup_id']))
|
||||||
|
{
|
||||||
|
if (!$this->batchFieldGroup($commands['fieldgroup_id'], $pks, $contexts))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$done = true;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function batchAccessView($value, $pks, $contexts)
|
||||||
|
{
|
||||||
|
if (empty($this->batchSet))
|
||||||
|
{
|
||||||
|
// Set some needed variables.
|
||||||
|
$this->user = JFactory::getUser();
|
||||||
|
$this->table = $this->getTable();
|
||||||
|
$this->tableClassName = get_class($this->table);
|
||||||
|
$this->contentType = new JUcmType;
|
||||||
|
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($pks as $pk)
|
||||||
|
{
|
||||||
|
if ($this->user->authorise('core.edit', $contexts[$pk]))
|
||||||
|
{
|
||||||
|
$this->table->reset();
|
||||||
|
$this->table->load($pk);
|
||||||
|
$this->table->accessview = (int) $value;
|
||||||
|
|
||||||
|
if (!empty($this->type))
|
||||||
|
{
|
||||||
|
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->table->store())
|
||||||
|
{
|
||||||
|
$this->setError($this->table->getError());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clean the cache
|
||||||
|
$this->cleanCache();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function batchFieldGroup($value, $pks, $contexts)
|
||||||
|
{
|
||||||
|
if (empty($this->batchSet))
|
||||||
|
{
|
||||||
|
// Set some needed variables.
|
||||||
|
$this->user = JFactory::getUser();
|
||||||
|
$this->table = $this->getTable();
|
||||||
|
$this->tableClassName = get_class($this->table);
|
||||||
|
$this->contentType = new JUcmType;
|
||||||
|
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($pks as $pk)
|
||||||
|
{
|
||||||
|
if ($this->user->authorise('core.edit', $contexts[$pk]))
|
||||||
|
{
|
||||||
|
$this->table->reset();
|
||||||
|
$this->table->load($pk);
|
||||||
|
$this->table->parent_id = (int) $value;
|
||||||
|
$this->table->lft = 1000;
|
||||||
|
$this->table->rgt = 1000;
|
||||||
|
|
||||||
|
if (!empty($this->type))
|
||||||
|
{
|
||||||
|
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->table->store())
|
||||||
|
{
|
||||||
|
$this->setError($this->table->getError());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->rebuild();
|
||||||
|
|
||||||
|
// Clean the cache
|
||||||
|
$this->cleanCache();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
311
deployed/jsn/administrator/components/com_jsn/models/fields.php
Normal file
311
deployed/jsn/administrator/components/com_jsn/models/fields.php
Normal file
@ -0,0 +1,311 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
class JsnModelFields extends JModelList
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param array An optional associative array of configuration settings.
|
||||||
|
* @see JController
|
||||||
|
* @since 3.0.3
|
||||||
|
*/
|
||||||
|
public function __construct($config = array())
|
||||||
|
{
|
||||||
|
if (empty($config['filter_fields']))
|
||||||
|
{
|
||||||
|
$config['filter_fields'] = array(
|
||||||
|
'id', 'a.id',
|
||||||
|
'title', 'a.title',
|
||||||
|
'alias', 'a.alias',
|
||||||
|
'published', 'a.published',
|
||||||
|
'access', 'a.access', 'access_level',
|
||||||
|
'language', 'a.language',
|
||||||
|
'checked_out', 'a.checked_out',
|
||||||
|
'checked_out_time', 'a.checked_out_time',
|
||||||
|
'created_time', 'a.created_time',
|
||||||
|
'created_user_id', 'a.created_user_id',
|
||||||
|
'lft', 'a.lft',
|
||||||
|
'rgt', 'a.rgt',
|
||||||
|
'level', 'a.level',
|
||||||
|
'path', 'a.path',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
parent::__construct($config);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to auto-populate the model state.
|
||||||
|
*
|
||||||
|
* Note. Calling getState in this method will result in recursion.
|
||||||
|
*
|
||||||
|
* @param string $ordering An optional ordering field.
|
||||||
|
* @param string $direction An optional direction (asc|desc).
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
protected function populateState($ordering = null, $direction = null)
|
||||||
|
{
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$context = $this->context;
|
||||||
|
|
||||||
|
$search = $this->getUserStateFromRequest($context . '.search', 'filter_search');
|
||||||
|
$this->setState('filter.search', $search);
|
||||||
|
|
||||||
|
$level = $this->getUserStateFromRequest($context . '.filter.level', 'filter_level', 0, 'int');
|
||||||
|
$this->setState('filter.level', $level);
|
||||||
|
|
||||||
|
$access = $this->getUserStateFromRequest($context . '.filter.access', 'filter_access', 0, 'int');
|
||||||
|
$this->setState('filter.access', $access);
|
||||||
|
|
||||||
|
$published = $this->getUserStateFromRequest($context . '.filter.published', 'filter_published', '');
|
||||||
|
$this->setState('filter.published', $published);
|
||||||
|
|
||||||
|
$language = $this->getUserStateFromRequest($context . '.filter.language', 'filter_language', '');
|
||||||
|
$this->setState('filter.language', $language);
|
||||||
|
|
||||||
|
// Load the parameters.
|
||||||
|
$params = JComponentHelper::getParams('com_jsn');
|
||||||
|
$this->setState('params', $params);
|
||||||
|
|
||||||
|
// List state information.
|
||||||
|
parent::populateState('a.lft', 'asc');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get a store id based on model configuration state.
|
||||||
|
*
|
||||||
|
* This is necessary because the model is used by the component and
|
||||||
|
* different modules that might need different sets of data or different
|
||||||
|
* ordering requirements.
|
||||||
|
*
|
||||||
|
* @param string $id A prefix for the store id.
|
||||||
|
*
|
||||||
|
* @return string A store id.
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
protected function getStoreId($id = '')
|
||||||
|
{
|
||||||
|
// Compile the store id.
|
||||||
|
$id .= ':' . $this->getState('filter.search');
|
||||||
|
$id .= ':' . $this->getState('filter.published');
|
||||||
|
$id .= ':' . $this->getState('filter.language');
|
||||||
|
|
||||||
|
return parent::getStoreId($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to create a query for a list of items.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
protected function getListQuery()
|
||||||
|
{
|
||||||
|
// Create a new query object.
|
||||||
|
$db = $this->getDbo();
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
|
||||||
|
// Select the required fields from the table.
|
||||||
|
$query->select(
|
||||||
|
$this->getState(
|
||||||
|
'list.select',
|
||||||
|
'a.id, a.title, a.alias, a.note, a.published, a.access, a.accessview,a.params' .
|
||||||
|
', a.checked_out, a.checked_out_time, a.created_user_id' .
|
||||||
|
', a.path, a.parent_id, a.level, a.conditions, a.lft, a.rgt, a.type, a.core, a.required, a.edit, a.profile, a.register, a.search' .
|
||||||
|
', a.language'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$query->from('#__jsn_fields AS a')
|
||||||
|
->where('a.alias <> ' . $db->quote('root'));
|
||||||
|
|
||||||
|
// Join over the language
|
||||||
|
//$query->select('l.title AS language_title')
|
||||||
|
// ->join('LEFT', $db->quoteName('#__languages') . ' AS l ON l.lang_code = a.language');
|
||||||
|
|
||||||
|
// Join over the users for the checked out user.
|
||||||
|
$query->select('uc.name AS editor')
|
||||||
|
->join('LEFT', '#__users AS uc ON uc.id=a.checked_out');
|
||||||
|
|
||||||
|
// Join over the users for the author.
|
||||||
|
$query->select('ua.name AS author_name')
|
||||||
|
->join('LEFT', '#__users AS ua ON ua.id = a.created_user_id');
|
||||||
|
|
||||||
|
$query->select('ug.title AS access_title')
|
||||||
|
->join('LEFT', '#__viewlevels AS ug on ug.id = a.access');
|
||||||
|
|
||||||
|
$query->select('ugv.title AS accessview_title')
|
||||||
|
->join('LEFT', '#__viewlevels AS ugv on ugv.id = a.accessview');
|
||||||
|
|
||||||
|
// Filter on the level.
|
||||||
|
if ($level = $this->getState('filter.level'))
|
||||||
|
{
|
||||||
|
$query->where('a.level <= ' . (int) $level);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter by access level.
|
||||||
|
if ($access = $this->getState('filter.access'))
|
||||||
|
{
|
||||||
|
$query->where('a.access = ' . (int) $access);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Implement View Level Access
|
||||||
|
if (!$user->authorise('core.admin'))
|
||||||
|
{
|
||||||
|
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||||
|
//$query->where('a.access IN (' . $groups . ')');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter by published state
|
||||||
|
$published = $this->getState('filter.published');
|
||||||
|
if (is_numeric($published))
|
||||||
|
{
|
||||||
|
$query->where('a.published = ' . (int) $published);
|
||||||
|
}
|
||||||
|
elseif ($published === '')
|
||||||
|
{
|
||||||
|
$query->where('(a.published IN (0, 1))');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter by search in title
|
||||||
|
$search = $this->getState('filter.search');
|
||||||
|
if (!empty($search))
|
||||||
|
{
|
||||||
|
if (stripos($search, 'id:') === 0)
|
||||||
|
{
|
||||||
|
$query->where('a.id = ' . (int) substr($search, 3));
|
||||||
|
}
|
||||||
|
elseif (stripos($search, 'author:') === 0)
|
||||||
|
{
|
||||||
|
$search = $db->quote('%' . $db->escape(substr($search, 7), true) . '%');
|
||||||
|
$query->where('(ua.name LIKE ' . $search . ' OR ua.username LIKE ' . $search . ')');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$search = $db->quote('%' . $db->escape($search, true) . '%');
|
||||||
|
$query->where('(a.title LIKE ' . $search . ' OR a.alias LIKE ' . $search . ' OR a.note LIKE ' . $search . ')');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter on the language.
|
||||||
|
if ($language = $this->getState('filter.language'))
|
||||||
|
{
|
||||||
|
$query->where('a.language = ' . $db->quote($language));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the list ordering clause
|
||||||
|
$listOrdering = $this->getState('list.ordering', 'a.lft');
|
||||||
|
$listDirn = $db->escape($this->getState('list.direction', 'ASC'));
|
||||||
|
if ($listOrdering == 'a.access')
|
||||||
|
{
|
||||||
|
$query->order('a.access ' . $listDirn . ', a.lft ' . $listDirn);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$query->order($db->escape($listOrdering) . ' ' . $listDirn);
|
||||||
|
}
|
||||||
|
|
||||||
|
//echo nl2br(str_replace('#__','jos_',$query));
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method override to check-in a record or an array of record
|
||||||
|
*
|
||||||
|
* @param mixed $pks The ID of the primary key or an array of IDs
|
||||||
|
*
|
||||||
|
* @return mixed Boolean false if there is an error, otherwise the count of records checked in.
|
||||||
|
*
|
||||||
|
* @since 12.2
|
||||||
|
*/
|
||||||
|
public function checkin($pks = array())
|
||||||
|
{
|
||||||
|
$pks = (array) $pks;
|
||||||
|
$table = $this->getTable();
|
||||||
|
$count = 0;
|
||||||
|
|
||||||
|
if (empty($pks))
|
||||||
|
{
|
||||||
|
$pks = array((int) $this->getState($this->getName() . '.id'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check in all items.
|
||||||
|
foreach ($pks as $pk)
|
||||||
|
{
|
||||||
|
if ($table->load($pk))
|
||||||
|
{
|
||||||
|
|
||||||
|
if ($table->checked_out > 0)
|
||||||
|
{
|
||||||
|
// Only attempt to check the row in if it exists.
|
||||||
|
if ($pk)
|
||||||
|
{
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
|
||||||
|
// Get an instance of the row to checkin.
|
||||||
|
$table = $this->getTable();
|
||||||
|
if (!$table->load($pk))
|
||||||
|
{
|
||||||
|
$this->setError($table->getError());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if this is the user having previously checked out the row.
|
||||||
|
if ($table->checked_out > 0 && $table->checked_out != $user->get('id') && !$user->authorise('core.admin', 'com_checkin'))
|
||||||
|
{
|
||||||
|
$this->setError(JText::_('JLIB_APPLICATION_ERROR_CHECKIN_USER_MISMATCH'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attempt to check the row in.
|
||||||
|
if (!$table->checkin($pk))
|
||||||
|
{
|
||||||
|
$this->setError($table->getError());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->setError($table->getError());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get a table object, load it if necessary.
|
||||||
|
*
|
||||||
|
* @param string $type The table name. Optional.
|
||||||
|
* @param string $prefix The class prefix. Optional.
|
||||||
|
* @param array $config Configuration array for model. Optional.
|
||||||
|
*
|
||||||
|
* @return JTable A JTable object
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
public function getTable($type = 'Field', $prefix = 'JsnTable', $config = array())
|
||||||
|
{
|
||||||
|
return JTable::getInstance($type, $prefix, $config);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
JFormHelper::loadFieldClass('checkboxes');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Field class for the Joomla Framework.
|
||||||
|
*
|
||||||
|
* @package Joomla.Libraries
|
||||||
|
* @subpackage Form
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
class JFormFieldCheckboxlist extends JFormFieldCheckboxes
|
||||||
|
{
|
||||||
|
public $type = 'Checkboxlist';
|
||||||
|
|
||||||
|
public $isNested = null;
|
||||||
|
|
||||||
|
public $table = null;
|
||||||
|
|
||||||
|
protected $comParams = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
|
// Load com_jsn config
|
||||||
|
$this->comParams = JComponentHelper::getParams('com_jsn');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function getInput()
|
||||||
|
{
|
||||||
|
if($this->element['optioninline']==1) $inline='inline';
|
||||||
|
else $inline='';
|
||||||
|
$html=array();
|
||||||
|
$version=new JVersion();
|
||||||
|
if($version->RELEASE<'3.5'){
|
||||||
|
$from=array('<label','</label>','<ul>','</ul>','<li','</li>');
|
||||||
|
$to=array('<span','</span>','','','<label class="checkbox '.$inline.'"','</label>');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$from=array('class="checkbox"');
|
||||||
|
$to=array('class="checkbox '.$inline.'"');
|
||||||
|
}
|
||||||
|
$html[]=str_replace($from,$to,parent::getInput());
|
||||||
|
if(isset($this->element['readonly']) && $this->element['readonly']=='true') $html[]='<input type="hidden" value="1" name="'.$this->name.'"/>' ;
|
||||||
|
return implode('', $html);
|
||||||
|
}
|
||||||
|
public function getOptions()
|
||||||
|
{
|
||||||
|
return parent::getOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getLayoutData()
|
||||||
|
{
|
||||||
|
$hasValue = (isset($this->value) && !empty($this->value));
|
||||||
|
if($hasValue && is_object($this->value)) $this->value = (array)$this->value;
|
||||||
|
$data = parent::getLayoutData();
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,156 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
JFormHelper::loadFieldClass('textarea');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Field class for the Joomla Framework.
|
||||||
|
*
|
||||||
|
* @package Joomla.Libraries
|
||||||
|
* @subpackage Form
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
class JFormFieldConditions extends JFormFieldTextarea
|
||||||
|
{
|
||||||
|
public $type = 'Conditions';
|
||||||
|
|
||||||
|
//public $isNested = null;
|
||||||
|
|
||||||
|
//public $table = null;
|
||||||
|
|
||||||
|
protected $comParams = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
|
// Load com_jsn config
|
||||||
|
$this->comParams = JComponentHelper::getParams('com_jsn');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getInput()
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = $db->getQuery(true)
|
||||||
|
->select('a.alias AS value, a.path, a.title AS text, a.alias, a.type, a.level, a.published')
|
||||||
|
->from('#__jsn_fields AS a')
|
||||||
|
->join('LEFT', '#__jsn_fields AS b ON a.lft > b.lft AND a.rgt < b.rgt');
|
||||||
|
$query->where('a.level = 2');
|
||||||
|
$query->where('a.published IN (0,1)');
|
||||||
|
$query->group('a.id, a.title, a.level, a.lft, a.rgt, a.parent_id, a.published, a.path')
|
||||||
|
->order('a.lft ASC');
|
||||||
|
$db->setQuery($query);
|
||||||
|
$fields = $db->loadObjectList();
|
||||||
|
$fields_opt = '';
|
||||||
|
foreach($fields as &$value){
|
||||||
|
$fields_opt.='<option value="'. $value->alias .'">'.JText::_($value->text) . " (" . $value->alias . ")</option>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$html='
|
||||||
|
<div class="dd" id="sortable'.$this->id.'" style="width:100%;">
|
||||||
|
<a id="sortable-add-item-btn" class="dd-new-item">+</a>
|
||||||
|
<li class="dd-item-blueprint">
|
||||||
|
<button class="collapse" data-action="collapse" type="button" style="display: none;">–</button>
|
||||||
|
<button class="expand" data-action="expand" type="button" style="display: none;">+</button>
|
||||||
|
<div class="dd-handle dd3-handle">Drag</div>
|
||||||
|
<div class="dd3-content">
|
||||||
|
<span class="item-name">[item_name]</span>
|
||||||
|
<div class="dd-button-container">
|
||||||
|
<button class="custom-button-example">✎</button>
|
||||||
|
<button class="item-remove">×</button>
|
||||||
|
</div>
|
||||||
|
<div class="dd-edit-box" style="display: none;">
|
||||||
|
<button class="btn btn-primary btn-small pull-right end-edit"><b>'.JText::_('COM_JSN_CONDITION_SAVE').'</b></button>
|
||||||
|
<input type="text" name="title" autocomplete="off" placeholder="Item"
|
||||||
|
data-placeholder="'.JText::_('COM_JSN_CONDITION_TITLE').'"
|
||||||
|
data-default-value="Condition Description"/>
|
||||||
|
<hr />
|
||||||
|
'.JText::_('COM_JSN_CONDITION_IF').'
|
||||||
|
<span><select name="operator">
|
||||||
|
<option value="1">'.JText::_('COM_JSN_CONDITION_EQUAL').'</option>
|
||||||
|
<option value="2">'.JText::_('COM_JSN_CONDITION_GREATER').'</option>
|
||||||
|
<option value="3">'.JText::_('COM_JSN_CONDITION_LESS').'</option>
|
||||||
|
<option value="4">'.JText::_('COM_JSN_CONDITION_CONTAINS').'</option>
|
||||||
|
<option value="5">'.JText::_('COM_JSN_CONDITION_NOTEQUAL').'</option>
|
||||||
|
<option value="6">'.JText::_('COM_JSN_CONDITION_NOTCONTAINS').'</option>
|
||||||
|
</select></span>
|
||||||
|
<span><select name="to" class="select_to" onchange="if(jQuery(this).val()==\'_custom\') jQuery(this).parent().next().show(); else jQuery(this).parent().next().hide();">
|
||||||
|
<option value="_custom">'.JText::_('COM_JSN_CONDITION_CUSTOMVALUE').'</option>
|
||||||
|
'.$fields_opt.'
|
||||||
|
</select></span>
|
||||||
|
<span><input type="text" class="custom_value" name="custom_value" autocomplete="off" placeholder="Item"
|
||||||
|
data-placeholder="Custom Value"
|
||||||
|
data-default-value=""/></span>
|
||||||
|
<hr />
|
||||||
|
'.JText::_('COM_JSN_CONDITION_THEN').'
|
||||||
|
<span><select class="select_action" name="action" onchange="if(jQuery(this).val()==\'fields_show\' || jQuery(this).val()==\'fields_hide\' ) jQuery(this).parent().next().show().next().hide(); else jQuery(this).parent().next().hide().next().show();">
|
||||||
|
<option value="fields_show">'.JText::_('COM_JSN_CONDITION_SHOWFIELDS').'</option>
|
||||||
|
<option value="fields_hide">'.JText::_('COM_JSN_CONDITION_HIDEFIELDS').'</option>
|
||||||
|
<option value="usergroups_add" '.(JSN_TYPE=='free' ? 'disabled="disabled"' : '').'>'.JText::_('COM_JSN_CONDITION_ADDUSERGROUP').'</option>
|
||||||
|
<option value="usergroups_remove" '.(JSN_TYPE=='free' ? 'disabled="disabled"' : '').'>'.JText::_('COM_JSN_CONDITION_REMOVEUSERGROUP').'</option>
|
||||||
|
</select></span>
|
||||||
|
<span><select name="fields_target" multiple="multiple">
|
||||||
|
'.$fields_opt.'
|
||||||
|
</select></span>
|
||||||
|
<span>'.JHtml::_('access.usergroup', 'usergroups_target', null, 'multiple', null, null).'</span>
|
||||||
|
<hr />
|
||||||
|
'.JText::_('COM_JSN_CONDITION_INVERSE').' <select name="two_ways"/><option selected="selected" value="1">'.JText::_('JYES').'</option><option value="0">'.JText::_('JNO').'</option></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<ol class="dd-list"></ol>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
jQuery(document).ready(function($) {
|
||||||
|
jQuery(\'#sortable'.$this->id.' select\').chosen("destroy");
|
||||||
|
|
||||||
|
var $sortable = $(\'#sortable'.$this->id.'\'),
|
||||||
|
sortable = $(\'#sortable'.$this->id.'\').sortable(),
|
||||||
|
$jsonOutput = $(\'#'.$this->id.'\');
|
||||||
|
|
||||||
|
$sortable.sortable({
|
||||||
|
slideAnimationDuration: 0,
|
||||||
|
maxDepth: 0,
|
||||||
|
data: $(\'#'.$this->id.'\').val() || \'[]\'
|
||||||
|
})
|
||||||
|
.onCreateItem(function(blueprint) {
|
||||||
|
var customButton = $(blueprint).find(\'.custom-button-example\');
|
||||||
|
customButton.click(function() {
|
||||||
|
blueprint.find(\'.dd3-content span\').first().click();
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.parseJson()
|
||||||
|
.on([\'onItemCollapsed\', \'onItemExpanded\', \'onItemAdded\', \'onSaveEditBoxInput\', \'onItemDrop\', \'onItemDrag\', \'onItemRemoved\', \'onItemEndEdit\'], function(a, b, c) {
|
||||||
|
$jsonOutput.val(sortable.toJson());
|
||||||
|
});
|
||||||
|
|
||||||
|
sortable.on(\'*\', function(a, b, c) {
|
||||||
|
jQuery(\'#sortable'.$this->id.' button\').click(function(){return false;});
|
||||||
|
})
|
||||||
|
.onItemStartEdit(function() {
|
||||||
|
jQuery(\'#sortable'.$this->id.' .dd-list select\').chosen();
|
||||||
|
jQuery(\'.select_to,.select_action\').change();
|
||||||
|
});
|
||||||
|
jQuery(\'#sortable'.$this->id.' button\').click(function(){return false;});
|
||||||
|
$jsonOutput.hide();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
';
|
||||||
|
return $html . parent::getInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
JFormHelper::loadFieldClass('email');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Field class for the Joomla Platform.
|
||||||
|
* Provides spacer markup to be used in form layouts.
|
||||||
|
*
|
||||||
|
* @package Joomla.Platform
|
||||||
|
* @subpackage Form
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
class JFormFieldConfirmemail extends JFormFieldEmail
|
||||||
|
{
|
||||||
|
|
||||||
|
public $type = 'Confirmemail';
|
||||||
|
|
||||||
|
protected function getInput()
|
||||||
|
{
|
||||||
|
$html = parent::getInput();
|
||||||
|
$html.= '<div class="message-regex">'.JText::_('COM_JSN_NOT_EQUAL_EMAIL').'</div>';
|
||||||
|
return str_replace('validate-email','',$html);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
JFormHelper::loadFieldClass('password');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Field class for the Joomla Platform.
|
||||||
|
* Provides spacer markup to be used in form layouts.
|
||||||
|
*
|
||||||
|
* @package Joomla.Platform
|
||||||
|
* @subpackage Form
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
class JFormFieldConfirmpassword extends JFormFieldPassword
|
||||||
|
{
|
||||||
|
|
||||||
|
public $type = 'Confirmpassword';
|
||||||
|
|
||||||
|
protected function getInput()
|
||||||
|
{
|
||||||
|
$html = parent::getInput();
|
||||||
|
$html.= '<div class="message-regex">'.JText::_('COM_JSN_NOT_EQUAL_PASSWORD').'</div>';
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,109 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
JFormHelper::loadFieldClass('hidden');
|
||||||
|
|
||||||
|
class JFormFieldDate extends JFormFieldHidden
|
||||||
|
{
|
||||||
|
public $type = 'Date';
|
||||||
|
|
||||||
|
public function getDate(){
|
||||||
|
if($this->element['datetype']==0)
|
||||||
|
return JHtml::_('date', $this->value, $this->element['dateformat'],'UTC');
|
||||||
|
|
||||||
|
if($this->element['datetype']==1)
|
||||||
|
{
|
||||||
|
$birthDate=JHtml::_('date', $this->value, 'm/d/Y','UTC');
|
||||||
|
$birthDate = explode("/", $birthDate);
|
||||||
|
$age = (date("md", date("U", mktime(0, 0, 0, $birthDate[0], $birthDate[1], $birthDate[2]))) > date("md") ? ((date("Y")-$birthDate[2])-1):(date("Y")-$birthDate[2]));
|
||||||
|
|
||||||
|
if( $age == 1 ) return $age.' '.JText::_('COM_JSN_YEAR');
|
||||||
|
else return $age.' '.JText::_('COM_JSN_YEARS');
|
||||||
|
}
|
||||||
|
|
||||||
|
if($this->element['datetype']==2)
|
||||||
|
{
|
||||||
|
$years=date('Y')-JHtml::_('date', $this->value, 'Y','UTC');
|
||||||
|
if( $years == 0 ) return JText::_('COM_JSN_THISYEAR');
|
||||||
|
if( $years == 1 ) return JText::_('COM_JSN_YEARAGO');
|
||||||
|
else return $years.' '.JText::_('COM_JSN_YEARSAGO');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getInput()
|
||||||
|
{
|
||||||
|
$doc=JFactory::getDocument();
|
||||||
|
JHtml::_('bootstrap.framework');
|
||||||
|
$doc->addScript(JURI::root().'components/com_jsn/assets/js/bootstrap-datepicker.min.js');
|
||||||
|
$doc->addStylesheet(JURI::root().'components/com_jsn/assets/css/datepicker.min.css');
|
||||||
|
$span='';
|
||||||
|
if((int)$this->element['span'])
|
||||||
|
{
|
||||||
|
$span='
|
||||||
|
{
|
||||||
|
onRender: function(date) {
|
||||||
|
return date.valueOf() '.((int)$this->element['span']==1 ? '>' : '<').' now.valueOf() ? "disabled" : "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
';
|
||||||
|
}
|
||||||
|
static $init=0;
|
||||||
|
if($init==0){
|
||||||
|
$script='
|
||||||
|
var DPGlobalDates = {
|
||||||
|
days: ["'.JText::_("SUNDAY").'", "'.JText::_("MONDAY").'", "'.JText::_("TUESDAY").'", "'.JText::_("WEDNESDAY").'", "'.JText::_("THURSDAY").'", "'.JText::_("FRIDAY").'", "'.JText::_("SATURDAY").'", "'.JText::_("SUNDAY").'"],
|
||||||
|
daysShort: ["'.JText::_("SUN").'", "'.JText::_("MON").'", "'.JText::_("TUE").'", "'.JText::_("WED").'", "'.JText::_("THU").'", "'.JText::_("FRI").'", "'.JText::_("SAT").'", "'.JText::_("SUN").'"],
|
||||||
|
daysMin: ["'.JText::_("SUN").'", "'.JText::_("MON").'", "'.JText::_("TUE").'", "'.JText::_("WED").'", "'.JText::_("THU").'", "'.JText::_("FRI").'", "'.JText::_("SAT").'", "'.JText::_("SUN").'"],
|
||||||
|
months: ["'.JText::_("JANUARY").'", "'.JText::_("FEBRUARY").'", "'.JText::_("MARCH").'", "'.JText::_("APRIL").'", "'.JText::_("MAY").'", "'.JText::_("JUNE").'", "'.JText::_("JULY").'", "'.JText::_("AUGUST").'", "'.JText::_("SEPTEMBER").'", "'.JText::_("OCTOBER").'", "'.JText::_("NOVEMBER").'", "'.JText::_("DECEMBER").'"],
|
||||||
|
monthsShort: ["'.JText::_("JANUARY_SHORT").'", "'.JText::_("FEBRUARY_SHORT").'", "'.JText::_("MARCH_SHORT").'", "'.JText::_("APRIL_SHORT").'", "'.JText::_("MAY_SHORT").'", "'.JText::_("JUNE_SHORT").'", "'.JText::_("JULY_SHORT").'", "'.JText::_("AUGUST_SHORT").'", "'.JText::_("SEPTEMBER_SHORT").'", "'.JText::_("OCTOBER_SHORT").'", "'.JText::_("NOVEMBER_SHORT").'", "'.JText::_("DECEMBER_SHORT").'"]
|
||||||
|
};
|
||||||
|
';
|
||||||
|
}
|
||||||
|
else $script='';
|
||||||
|
$init=1;
|
||||||
|
if(isset($this->element['readonlydate']) && $this->element['readonlydate']) $script.='';
|
||||||
|
else $script.='
|
||||||
|
jQuery(document).ready(function($){
|
||||||
|
var nowTemp = new Date();
|
||||||
|
var now = new Date(nowTemp.getFullYear()'.((int)$this->element['spanyear']>=0 ? '+'.$this->element['spanyear'] : $this->element['spanyear']).', nowTemp.getMonth()'.((int)$this->element['spanmonth']>=0 ? '+'.$this->element['spanmonth'] : $this->element['spanmonth']).', nowTemp.getDate()'.((int)$this->element['spanday']>=0 ? '+'.$this->element['spanday'] : $this->element['spanday']).', 0, 0, 0, 0);
|
||||||
|
$("#wrapper'.$this->id.'").jsndatepicker('.$span.');
|
||||||
|
$("#wrapper'.$this->id.' .jsndateremove").click(function(){
|
||||||
|
$("#wrapper'.$this->id.' input").val("").change();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
';
|
||||||
|
$format=$this->element['formformat'];
|
||||||
|
|
||||||
|
$value='';
|
||||||
|
if($this->value!='') {
|
||||||
|
$format_date=str_replace('dd','z',$format);
|
||||||
|
$format_date=str_replace('d','j',$format_date);
|
||||||
|
$format_date=str_replace('z','d',$format_date);
|
||||||
|
$format_date=str_replace('mm','m',$format_date);
|
||||||
|
$format_date=str_replace('MM','F',$format_date);
|
||||||
|
$format_date=str_replace('yyyy','Y',$format_date);
|
||||||
|
$date=new JDate($this->value);
|
||||||
|
$value=$date->format($format_date);//date($format_date,strtotime($this->value));
|
||||||
|
}
|
||||||
|
if(JText::_('COM_JSN_STARTMONDAY')=='1') $date_weekstart=' data-date-weekstart="1"';
|
||||||
|
else $date_weekstart='';
|
||||||
|
|
||||||
|
if(isset($this->element['readonlydate']) && $this->element['readonlydate']) $readonly = true;
|
||||||
|
else $readonly = false;
|
||||||
|
|
||||||
|
$doc->addScriptDeclaration( $script );
|
||||||
|
return '<div'.$date_weekstart.' data-date-viewmode="'.$this->element['viewmode'].'" data-date-format="'.$format.'" data-date="'.$value.'" id="wrapper'.$this->id.'" class="input-prepend date bsdate">'.($readonly ? '' : '<span class="btn btn-success"><i class="jsn-icon jsn-icon-calendar"></i></span><span class="btn btn-danger"><i class="jsn-icon jsn-icon-remove jsndateremove"></i></span>').'<input type="text" readonly="readonly" value="'.$value.'" placeholder="'.($readonly ? JText::_('COM_USERS_PROFILE_VALUE_NOT_FOUND') : JText::_($this->element['hint'])).'"/>'.parent::getInput().'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Field class for the Joomla Platform.
|
||||||
|
* Provides spacer markup to be used in form layouts.
|
||||||
|
*
|
||||||
|
* @package Joomla.Platform
|
||||||
|
* @subpackage Form
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
class JFormFieldDelimeter extends JFormField
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The form field type.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
protected $type = 'Delimeter';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get the field input markup for a spacer.
|
||||||
|
* The spacer does not have accept input.
|
||||||
|
*
|
||||||
|
* @return string The field input markup.
|
||||||
|
*
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
protected function getInput()
|
||||||
|
{
|
||||||
|
$html = array();
|
||||||
|
$class = $this->element['class'] ? (string) $this->element['class'] : '';
|
||||||
|
$text = $this->element['text'] ? (string) $this->element['text'] : (string) $this->element['label'];
|
||||||
|
//if(JText::_(strip_tags($text)) != strip_tags($text)) $text=JText::_(strip_tags($text));
|
||||||
|
if(substr_count($text,' ')==0) $text=JText::_(strip_tags($text));
|
||||||
|
|
||||||
|
$html[] = '<div id="'.$this->id.'" >';
|
||||||
|
$html[] = JHtml::_('content.prepare', $text, '', 'jsn_content.content');
|
||||||
|
$html[] = '</div>';
|
||||||
|
|
||||||
|
return implode('', $html);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*protected function getLabel()
|
||||||
|
{
|
||||||
|
return '<style>.'.$this->element['name'].'+.optional{display:none;}</style><div class="'.$this->element['name'].'"></div>';
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get the field title.
|
||||||
|
*
|
||||||
|
* @return string The field title.
|
||||||
|
*
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
/*protected function getTitle()
|
||||||
|
{
|
||||||
|
return ' ';
|
||||||
|
}*/
|
||||||
|
}
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
JFormHelper::loadFieldClass('email');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Field class for the Joomla Platform.
|
||||||
|
* Provides spacer markup to be used in form layouts.
|
||||||
|
*
|
||||||
|
* @package Joomla.Platform
|
||||||
|
* @subpackage Form
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
class JFormFieldEmailfull extends JFormFieldEmail
|
||||||
|
{
|
||||||
|
|
||||||
|
public $type = 'Email';
|
||||||
|
|
||||||
|
protected function getInput()
|
||||||
|
{
|
||||||
|
$html = parent::getInput();
|
||||||
|
$html.= '<div class="message-regex">'.JText::_('COM_JSN_EMAILINVALID').'</div>';
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,135 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
JFormHelper::loadFieldClass('hidden');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Field class for the Joomla Framework.
|
||||||
|
*
|
||||||
|
* @package Joomla.Libraries
|
||||||
|
* @subpackage Form
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
class JFormFieldFiletype extends JFormFieldHidden
|
||||||
|
{
|
||||||
|
public $type = 'Filetype';
|
||||||
|
|
||||||
|
protected function getInput()
|
||||||
|
{
|
||||||
|
|
||||||
|
$html=array();
|
||||||
|
|
||||||
|
// Add Bootstrap JS
|
||||||
|
$doc = JFactory::getDocument();
|
||||||
|
JHtml::_('bootstrap.framework');
|
||||||
|
|
||||||
|
$max_post = ini_get('post_max_size');
|
||||||
|
$max_upload = ini_get('upload_max_filesize');
|
||||||
|
$memory_limit = ini_get('memory_limit');
|
||||||
|
$upload_limit = min(JFormFieldFiletype::convertPHPSizeToBytes($max_upload), JFormFieldFiletype::convertPHPSizeToBytes($max_post), JFormFieldFiletype::convertPHPSizeToBytes($memory_limit));
|
||||||
|
|
||||||
|
$script='
|
||||||
|
jQuery(function($) {
|
||||||
|
$(\'input[name="'.str_replace(']', '_delete]', $this->name).'"]\').change(function(){
|
||||||
|
if($(this).is(":checked")){
|
||||||
|
$(\'#jform_'.$this->element['name'].'\').attr(\'oldvalue\',$(\'#jform_'.$this->element['name'].'\').val());
|
||||||
|
$(\'#jform_'.$this->element['name'].'\').val(\'\');
|
||||||
|
$(\'#jform_'.$this->element['name'].'\').change();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$(\'#jform_'.$this->element['name'].'\').val($(\'#jform_'.$this->element['name'].'\').attr(\'oldvalue\'));
|
||||||
|
$(\'#jform_'.$this->element['name'].'\').change();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$(\'#jform_upload_'.$this->element['name'].'\').change(function(){
|
||||||
|
$(\'#jform_'.$this->element['name'].'\').val(\'true\');
|
||||||
|
$(\'#jform_'.$this->element['name'].'\').change();
|
||||||
|
});
|
||||||
|
});';
|
||||||
|
$doc->addScriptDeclaration( $script );
|
||||||
|
|
||||||
|
if(isset($this->element['readonly']) && $this->element['readonly']) $readonly = 'readonly="readonly" disabled="disabled"';
|
||||||
|
else $readonly = '';
|
||||||
|
|
||||||
|
$html[]='<input '.$readonly.' jsn-extensions="'.$this->element['mime'].'" type="file" name="jform[upload_'.$this->element['name'].']" id="jform_upload_'.$this->element['name'].'" class="validate-fileext">';
|
||||||
|
$html[]='<div style="margin-bottom:5px;">'.JText::_('COM_JSN_ALLOWED_EXTENSIONS').' <b>'.str_replace('|',', ',$this->element['mime']).'</b>. '.JText::_('COM_JSN_ALLOWED_SIZE').' <b>'.JFormFieldFiletype::formatBytes($upload_limit).'</b>.</div>';
|
||||||
|
|
||||||
|
$html[]=parent::getInput();
|
||||||
|
|
||||||
|
if($this->element['required']!='true' && $this->value) $html[]='<fieldset class="checkboxes" style="clear:both;"><label class="checkbox"><input type="checkbox" name="'.str_replace(']', '_delete]', $this->name).'"/><span>'.JText::_('JACTION_DELETE').': <a href="'.JURI::root(true).'/'.$this->value.'" target="_blank">'.substr($this->value, strrpos($this->value, '/')+1).'</a></span></label></fieldset>';
|
||||||
|
if($this->element['required']=='true' && $this->value) $html[]='<a href="'.JURI::root(true).'/'.$this->value.'" target="_blank">'.substr($this->value, strrpos($this->value, '/')+1).'</a>';
|
||||||
|
|
||||||
|
return implode('', $html);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFile()
|
||||||
|
{
|
||||||
|
$attribs=array(
|
||||||
|
'class' => 'file '.$this->element['class']
|
||||||
|
);
|
||||||
|
$html=array();
|
||||||
|
|
||||||
|
if($this->value) $html[]='<div><a target="_blank" class="btn btn-mini btn-sm btn-default" href="'.$this->value.'"><i class="icon-download"></i> '.JText::_($this->element['downloadtext']).'</a></div>';
|
||||||
|
return implode('', $html);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getValue()
|
||||||
|
{
|
||||||
|
return $this->value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*public function getLabel()
|
||||||
|
{
|
||||||
|
return str_replace('jform_','jform_upload_',parent::getLabel());
|
||||||
|
}*/
|
||||||
|
|
||||||
|
static function convertPHPSizeToBytes($sSize)
|
||||||
|
{
|
||||||
|
if ( is_numeric( $sSize) ) {
|
||||||
|
return $sSize;
|
||||||
|
}
|
||||||
|
$sSuffix = substr($sSize, -1);
|
||||||
|
$iValue = substr($sSize, 0, -1);
|
||||||
|
switch(strtoupper($sSuffix)){
|
||||||
|
case 'P':
|
||||||
|
$iValue *= 1024;
|
||||||
|
case 'T':
|
||||||
|
$iValue *= 1024;
|
||||||
|
case 'G':
|
||||||
|
$iValue *= 1024;
|
||||||
|
case 'M':
|
||||||
|
$iValue *= 1024;
|
||||||
|
case 'K':
|
||||||
|
$iValue *= 1024;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $iValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
static function formatBytes($bytes, $precision = 2) {
|
||||||
|
$units = array('B', 'KB', 'MB', 'GB', 'TB');
|
||||||
|
|
||||||
|
$bytes = max($bytes, 0);
|
||||||
|
$pow = floor(($bytes ? log($bytes) : 0) / log(1024));
|
||||||
|
$pow = min($pow, count($units) - 1);
|
||||||
|
|
||||||
|
$bytes /= pow(1024, $pow);
|
||||||
|
|
||||||
|
return round($bytes, $precision) . ' ' . $units[$pow];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,375 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
JFormHelper::loadFieldClass('hidden');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Field class for the Joomla Framework.
|
||||||
|
*
|
||||||
|
* @package Joomla.Libraries
|
||||||
|
* @subpackage format
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
class JFormFieldImagefull extends JFormFieldHidden
|
||||||
|
{
|
||||||
|
public $type = 'Image';
|
||||||
|
|
||||||
|
protected function getInput()
|
||||||
|
{
|
||||||
|
$doc = JFactory::getDocument();
|
||||||
|
$dir = $doc->direction;
|
||||||
|
|
||||||
|
$jsn_config = JComponentHelper::getParams('com_jsn');
|
||||||
|
if($jsn_config->get('avatar',1) == 2) // Gravatar
|
||||||
|
{
|
||||||
|
return JText::_('COM_JSN_AVATAR_WITH_GRAVATAR');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->element['class']='';
|
||||||
|
$attribs=array(
|
||||||
|
'style' => 'float:left;width:50px;margin-right:10px;border-radius:2px;margin-bottom:5px;',
|
||||||
|
'class' => 'img_'.$this->element['name']
|
||||||
|
);
|
||||||
|
if($dir=='rtl')
|
||||||
|
{
|
||||||
|
$attribs=array(
|
||||||
|
'style' => 'float:right;width:50px;margin-left:10px;border-radius:2px;margin-bottom:5px;',
|
||||||
|
'class' => 'img_'.$this->element['name']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$html=array();
|
||||||
|
|
||||||
|
// Check Mobile
|
||||||
|
$iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone");
|
||||||
|
$android = strpos($_SERVER['HTTP_USER_AGENT'],"Android");
|
||||||
|
$palmpre = strpos($_SERVER['HTTP_USER_AGENT'],"webOS");
|
||||||
|
$berry = strpos($_SERVER['HTTP_USER_AGENT'],"BlackBerry");
|
||||||
|
$ipod = strpos($_SERVER['HTTP_USER_AGENT'],"iPod");
|
||||||
|
$windowsphone = strpos($_SERVER['HTTP_USER_AGENT'],"Windows Phone");
|
||||||
|
if($windowsphone || $iphone || $android || $palmpre || $ipod || $berry == true) $mobile=true;
|
||||||
|
else $mobile=false;
|
||||||
|
|
||||||
|
// Add Bootstrap JS
|
||||||
|
JHtml::_('bootstrap.framework');
|
||||||
|
|
||||||
|
if(isset($this->element['readonly']) && $this->element['readonly']) {$readonly = 'readonly="readonly" disabled="disabled"';$this->element['cropwebcam']=0;}
|
||||||
|
else $readonly = '';
|
||||||
|
|
||||||
|
switch($this->element['cropwebcam']){
|
||||||
|
default:
|
||||||
|
case '0': /* INPUT */
|
||||||
|
|
||||||
|
// Set Default
|
||||||
|
if($this->element['name']=='avatar') $default_image='components/com_jsn/assets/img/default.jpg';
|
||||||
|
else $default_image='components/com_jsn/assets/img/no_image.gif';
|
||||||
|
|
||||||
|
if(isset($this->element['default'])) $default_image=$this->element['default'];
|
||||||
|
if(isset($this->element['removed_default'])) $default_image=$this->element['removed_default'];
|
||||||
|
|
||||||
|
// Clear value inherit by default value
|
||||||
|
if($this->value==$default_image) $this->value='';
|
||||||
|
|
||||||
|
// Image Preview
|
||||||
|
if(empty($this->value) || $this->value=='true')
|
||||||
|
{
|
||||||
|
$this->value='';
|
||||||
|
$session = JFactory::getSession();
|
||||||
|
$session->set('_tmp_img_'.$this->element['name'],'');
|
||||||
|
$img_src=$default_image;
|
||||||
|
$html[]=JHtml::_('image', $default_image ,$this->element['alt'],$attribs);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$session = JFactory::getSession();
|
||||||
|
$session->set('_tmp_img_'.$this->element['name'],'');
|
||||||
|
$img_src=$this->value;
|
||||||
|
$html[]=JHtml::_('image', preg_replace('~_(?!.*_)~', 'mini_', $this->value) ,$this->element['alt'],$attribs);
|
||||||
|
}
|
||||||
|
$script='
|
||||||
|
jQuery(function($) {
|
||||||
|
$(\'input[name="'.str_replace(']', '_delete]', $this->name).'"]\').change(function(){
|
||||||
|
if($(this).is(":checked")){
|
||||||
|
$(\'#'.$this->id.'\').attr(\'oldvalue\',$(\'#'.$this->id.'\').val());
|
||||||
|
$(\'#'.$this->id.'\').val(\'\');
|
||||||
|
$(\'#'.$this->id.'\').change();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$(\'#'.$this->id.'\').val($(\'#'.$this->id.'\').attr(\'oldvalue\'));
|
||||||
|
$(\'#'.$this->id.'\').change();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$(\'#jform_upload_'.$this->element['name'].'\').change(function(){
|
||||||
|
$(\'#'.$this->id.'\').val(\'true\');
|
||||||
|
$(\'#'.$this->id.'\').change();
|
||||||
|
});
|
||||||
|
});';
|
||||||
|
$doc->addScriptDeclaration( $script );
|
||||||
|
|
||||||
|
$html[]='<input '.$readonly.' type="file" name="jform[upload_'.$this->element['name'].']" id="jform_upload_'.$this->element['name'].'" accept="image/*">';
|
||||||
|
$html[]=parent::getInput();
|
||||||
|
if($this->element['required']!='true' && $this->value) $html[]='<fieldset class="checkboxes" style="clear:both;"><label class="checkbox"><input type="checkbox" name="'.str_replace(']', '_delete]', $this->name).'"/><span>'.JText::_('COM_JSN_DELETE_IMAGE').'</span></label></fieldset>';
|
||||||
|
$html[]='<div style="clear:both"></div>';
|
||||||
|
|
||||||
|
break;
|
||||||
|
case '1': /* CROP & WEBCAM */
|
||||||
|
|
||||||
|
// Set Default
|
||||||
|
if($this->element['name']=='avatar') $default_image='components/com_jsn/assets/img/default.jpg';
|
||||||
|
else $default_image='components/com_jsn/assets/img/no_image.gif';
|
||||||
|
|
||||||
|
if(isset($this->element['default'])) $default_image=$this->element['default'];
|
||||||
|
if(isset($this->element['removed_default'])) $default_image=$this->element['removed_default'];
|
||||||
|
|
||||||
|
// Clear value inherit by default value
|
||||||
|
if($this->value==$default_image) $this->value='';
|
||||||
|
|
||||||
|
// Image Preview
|
||||||
|
$isTmp=strpos($this->value, '_tmp');
|
||||||
|
if(empty($this->value) || $this->value=='true')
|
||||||
|
{
|
||||||
|
$this->value='';
|
||||||
|
$session = JFactory::getSession();
|
||||||
|
$session->set('_tmp_img_'.$this->element['name'],'');
|
||||||
|
$img_src=$default_image;
|
||||||
|
$html[]=JHtml::_('image', $default_image ,$this->element['alt'],$attribs);
|
||||||
|
}
|
||||||
|
elseif($isTmp)
|
||||||
|
{
|
||||||
|
$img_src=$this->value;
|
||||||
|
$img_src=substr($img_src,strpos($img_src,'images/_tmp/'));
|
||||||
|
$img_src=substr($img_src,0,strrpos($img_src,'?'));
|
||||||
|
$html[]=JHtml::_('image',$img_src ,$this->element['alt'],$attribs);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$session = JFactory::getSession();
|
||||||
|
$session->set('_tmp_img_'.$this->element['name'],'');
|
||||||
|
$img_src=$this->value;
|
||||||
|
$html[]=JHtml::_('image', preg_replace('~_(?!.*_)~', 'mini_', $this->value) ,$this->element['alt'],$attribs);
|
||||||
|
}
|
||||||
|
|
||||||
|
$doc->addScript(JURI::root().'components/com_jsn/assets/js/jquery.Jcrop.min.js');
|
||||||
|
$doc->addScript(JURI::root().'components/com_jsn/assets/js/jquery.imgpicker.min.js');
|
||||||
|
$doc->addStylesheet(JURI::root().'components/com_jsn/assets/css/imgpicker.min.css');
|
||||||
|
|
||||||
|
if(JFactory::getApplication()->isAdmin()) $admin_path='administrator/';
|
||||||
|
else $admin_path='';
|
||||||
|
|
||||||
|
$width=$this->element['width'];
|
||||||
|
$height=$this->element['height'];
|
||||||
|
|
||||||
|
$html[]='
|
||||||
|
<div class="jsn_'.$this->element['name'].'-container">
|
||||||
|
<button type="button" class="btn btn-danger" data-ip-modal="#jsn_'.$this->element['name'].'Modal"><i class="jsn-icon jsn-icon-pencil"></i> '.JText::_('COM_JSN_IMAGE_CHANGE').'</button>
|
||||||
|
</div>';
|
||||||
|
$modal='
|
||||||
|
<div class="ip-modal" id="jsn_'.$this->element['name'].'Modal">
|
||||||
|
<div class="ip-modal-dialog">
|
||||||
|
<div class="ip-modal-content">
|
||||||
|
<div class="ip-modal-header">
|
||||||
|
<a class="ip-close" title="Close">×</a>
|
||||||
|
<h4 class="ip-modal-title">'.JText::sprintf('COM_JSN_IMAGE_MODALTITLE',JText::_($this->element['label'])).'</h4>
|
||||||
|
</div>
|
||||||
|
<div class="ip-modal-body">
|
||||||
|
<div class="btn btn-primary ip-upload">'.JText::_('COM_JSN_IMAGE_UPLOAD').' <input type="file" name="file" class="ip-file"></div>
|
||||||
|
'.($mobile || $this->element['cropwebcam']=='2' ? '' : '<button type="button" class="btn btn-primary ip-webcam">'.JText::_('COM_JSN_IMAGE_WEBCAM').'</button>').'
|
||||||
|
<button type="button" class="btn btn-info ip-edit">'.JText::_('JACTION_EDIT').'</button>
|
||||||
|
<button type="button" class="btn btn-danger ip-delete">'.JText::_('JACTION_DELETE').'</button>
|
||||||
|
|
||||||
|
<div class="alert ip-alert"></div>
|
||||||
|
<div class="ip-info">'.JText::_('COM_JSN_CROPWEBCAM_TIP').'</div>
|
||||||
|
<div class="ip-preview"></div>
|
||||||
|
<div class="ip-rotate">
|
||||||
|
<button type="button" class="btn btn-default ip-rotate-ccw" title="Rotate counter-clockwise"><i class="icon-ccw"></i></button>
|
||||||
|
<button type="button" class="btn btn-default ip-rotate-cw" title="Rotate clockwise"><i class="icon-cw"></i></button>
|
||||||
|
</div>
|
||||||
|
<div class="ip-progress">
|
||||||
|
<!-- <div class="text">Uploading</div> -->
|
||||||
|
<div class="progress progress-striped active"><div class="progress-bar bar"></div></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="ip-modal-footer">
|
||||||
|
<div class="ip-actions">
|
||||||
|
<button type="button" class="btn btn-success ip-save">'.JText::_('COM_JSN_IMAGE_SAVEIMAGE').'</button>
|
||||||
|
<button type="button" class="btn btn-primary ip-capture">'.JText::_('COM_JSN_IMAGE_CAPTURE').'</button>
|
||||||
|
<button type="button" class="btn btn-default ip-cancel">'.JText::_('COM_JSN_IMAGE_CANCEL').'</button>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="btn btn-default ip-close">Close</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>';
|
||||||
|
$script='
|
||||||
|
jQuery(function($) {
|
||||||
|
$(\'body\').append(\''.str_replace(array("\n","\r","'"),array("","","\'"),$modal).'\');
|
||||||
|
$(\'input[name="'.str_replace(']', '_delete]', $this->name).'"]\').change(function(){
|
||||||
|
if($(this).is(":checked")){
|
||||||
|
$(\'#'.$this->id.'\').attr(\'oldvalue\',$(\'#'.$this->id.'\').val());
|
||||||
|
$(\'#'.$this->id.'\').val(\'\');
|
||||||
|
$(\'#'.$this->id.'\').change();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$(\'#'.$this->id.'\').val($(\'#'.$this->id.'\').attr(\'oldvalue\'));
|
||||||
|
$(\'#'.$this->id.'\').change();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$(\'#jsn_'.$this->element['name'].'Modal\').imgPicker({
|
||||||
|
url: \''.JURI::root(true).'/'.$admin_path.'index.php?option=com_jsn&view=opField&type=image&format=raw&field='.$this->element['name'].'\',
|
||||||
|
aspectRatio: '.$width.'/'.$height.', /* Crop aspect ratio */
|
||||||
|
setSelect: [0,0,1000,1000],
|
||||||
|
swf: \''.JURI::root().'components/com_jsn/assets/webcam.swf\',
|
||||||
|
/* Delete callback */
|
||||||
|
deleteComplete: function() {
|
||||||
|
$(\'.img_'.$this->element['name'].'\').attr(\'src\', \''.JURI::root(true).'/'.$img_src.'\');
|
||||||
|
$(\'#'.$this->id.'\').val(\''.$this->value.'\');
|
||||||
|
$(\'#'.$this->id.'\').change();
|
||||||
|
$(\'input[name="'.str_replace(']', '_delete]', $this->name).'"]\').prop(\'checked\', false);
|
||||||
|
this.modal(\'hide\');
|
||||||
|
},
|
||||||
|
/* Crop success callback */
|
||||||
|
cropSuccess: function(image) {
|
||||||
|
$(\'.img_'.$this->element['name'].'\').attr(\'src\', image.versions.mini.url + time());
|
||||||
|
$(\'#'.$this->id.'\').val(image.versions.mini.url + time());
|
||||||
|
$(\'#'.$this->id.'\').change();
|
||||||
|
$(\'input[name="'.str_replace(']', '_delete]', $this->name).'"]\').prop(\'checked\', false);
|
||||||
|
this.modal(\'hide\');
|
||||||
|
},
|
||||||
|
/* Send some custom data to server */
|
||||||
|
data: {
|
||||||
|
key: \'value\',
|
||||||
|
},
|
||||||
|
/* Translated Messages */
|
||||||
|
messages: {
|
||||||
|
selectimg: \''.JText::_('COM_JSN_IMAGE_ALERT_SELECTIMG').'\',
|
||||||
|
uploading: \''.JText::_('COM_JSN_IMAGE_ALERT_UPLOADING').'\',
|
||||||
|
loading: \''.JText::_('COM_JSN_IMAGE_ALERT_LOADING').'\',
|
||||||
|
saving: \''.JText::_('COM_JSN_IMAGE_ALERT_SAVING').'\',
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});';
|
||||||
|
$doc->addScriptDeclaration( $script );
|
||||||
|
$html[]=parent::getInput();
|
||||||
|
|
||||||
|
if($this->element['required']!='true' && $this->value) $html[]='<fieldset class="checkboxes" style="clear:both;"><label class="checkbox"><input type="checkbox" name="'.str_replace(']', '_delete]', $this->name).'"/><span>'.JText::_('COM_JSN_DELETE_IMAGE').'</span></label></fieldset>';
|
||||||
|
$html[]='<div style="clear:both"></div>';
|
||||||
|
|
||||||
|
break;
|
||||||
|
case '2': /* CROP & DD */
|
||||||
|
|
||||||
|
// Reset Value
|
||||||
|
if($this->value=='true')
|
||||||
|
{
|
||||||
|
$this->value='';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set Default
|
||||||
|
if($this->element['name']=='avatar') $default_image='components/com_jsn/assets/img/default.jpg';
|
||||||
|
else $default_image='components/com_jsn/assets/img/no_image.gif';
|
||||||
|
|
||||||
|
if(isset($this->element['default'])) $default_image=$this->element['default'];
|
||||||
|
if(isset($this->element['removed_default'])) $default_image=$this->element['removed_default'];
|
||||||
|
|
||||||
|
// Clear value inherit by default value
|
||||||
|
if($this->value==$default_image) $this->value='';
|
||||||
|
|
||||||
|
// Clear Session
|
||||||
|
$session = JFactory::getSession();
|
||||||
|
$session->set('_tmp_img_'.$this->element['name'],'');
|
||||||
|
|
||||||
|
$doc->addScript(JURI::root().'components/com_jsn/assets/js/jquery.slim.min.js');
|
||||||
|
$doc->addStylesheet(JURI::root().'components/com_jsn/assets/css/slim.min.css');
|
||||||
|
|
||||||
|
$width=$this->element['width'];
|
||||||
|
$height=$this->element['height'];
|
||||||
|
|
||||||
|
$json=json_decode($this->value);
|
||||||
|
$isJSON=(json_last_error() == JSON_ERROR_NONE);
|
||||||
|
|
||||||
|
$html[]='<div id="imgupload_'.$this->element['name'].'" class="slim" style="width:120px;border-radius:5px;overflow:hidden;background-image:url('.JURI::root(true).'/'.$default_image.');background-repeat:no-repeat;background-size:cover;">';
|
||||||
|
$html[]='<input type="file" name="imgupload_'.$this->element['name'].'"/>';
|
||||||
|
if(!empty($this->value)) $html[] = '<img id="imgpreview_'.$this->element['name'].'" src="" />';
|
||||||
|
$html[]='</div>';
|
||||||
|
$html[]=parent::getInput();
|
||||||
|
|
||||||
|
$script='jQuery(document).ready(function($){
|
||||||
|
var init_'.$this->id.'='.(empty($this->value) ? 'false' : 'true').';
|
||||||
|
'.(!empty($this->value) && $isJSON ? '$("#imgpreview_'.$this->element['name'].'").attr("src",$.parseJSON($("#'.$this->id.'").val()).output.image);' : '').'
|
||||||
|
'.(!empty($this->value) && !$isJSON ? '$("#imgpreview_'.$this->element['name'].'").attr("src","'.JURI::root(true).'/"+$("#'.$this->id.'").val());' : '').'
|
||||||
|
$("#imgupload_'.$this->element['name'].'").slim({
|
||||||
|
label: "<p>'.str_replace("'","\'",JText::_('COM_JSN_IMAGE_HERE')).'</p>",
|
||||||
|
buttonConfirmLabel: "'.str_replace("'","\'",JText::_('JSUBMIT')).'",
|
||||||
|
buttonCancelLabel: "'.str_replace("'","\'",JText::_('JCANCEL')).'",
|
||||||
|
ratio: "'.$width.':'.$height.'",
|
||||||
|
size: {width: '.$width.',height: '.$height.'},
|
||||||
|
didRemove: function(){$("#'.$this->id.'").val(\'\').change();},
|
||||||
|
didTransform: function(){
|
||||||
|
if(init_'.$this->id.') {
|
||||||
|
$("#imgupload_'.$this->element['name'].' .slim-btn.slim-btn-edit").hide();
|
||||||
|
'.(!empty($this->value) && $isJSON ? '$(\'input[name="imgupload_'.$this->element['name'].'"]\').val($("#'.$this->id.'").val());' : '').'
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$(\'input[name="imgupload_'.$this->element['name'].'"]\').val(JSON.stringify(this.dataBase64));
|
||||||
|
$("#'.$this->id.'").val(JSON.stringify(this.dataBase64)).change();
|
||||||
|
$("#imgupload_'.$this->element['name'].' .slim-btn.slim-btn-edit").show();
|
||||||
|
}
|
||||||
|
init_'.$this->id.'=false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});';
|
||||||
|
|
||||||
|
$doc->addScriptDeclaration( $script );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode('', $html);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getImage($user)
|
||||||
|
{
|
||||||
|
$attribs=array(
|
||||||
|
'class' => $this->element['imageclass']
|
||||||
|
);
|
||||||
|
|
||||||
|
if($this->name == 'avatar' && empty($user->avatar_clean))
|
||||||
|
{
|
||||||
|
$attribs['avatar'] = JsnHelper::getFormatName($user);
|
||||||
|
}
|
||||||
|
|
||||||
|
$html=array();
|
||||||
|
|
||||||
|
if($this->value) $html[]=JHtml::_('image', $this->value,$this->element['alt'],$attribs);
|
||||||
|
return implode('', $html);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getValue()
|
||||||
|
{
|
||||||
|
return $this->value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getElement()
|
||||||
|
{
|
||||||
|
return $this->element;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setElement($element)
|
||||||
|
{
|
||||||
|
$this->element = $element;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
JFormHelper::loadFieldClass('calendar');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Field class for the Joomla Platform.
|
||||||
|
* Provides spacer markup to be used in form layouts.
|
||||||
|
*
|
||||||
|
* @package Joomla.Platform
|
||||||
|
* @subpackage Form
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
class JFormFieldLastvisitdate extends JFormFieldCalendar
|
||||||
|
{
|
||||||
|
|
||||||
|
public $type = 'Lastvisitdate';
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
JFormHelper::loadFieldClass('url');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Field class for the Joomla Platform.
|
||||||
|
* Provides spacer markup to be used in form layouts.
|
||||||
|
*
|
||||||
|
* @package Joomla.Platform
|
||||||
|
* @subpackage Form
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
class JFormFieldLink extends JFormFieldUrl
|
||||||
|
{
|
||||||
|
|
||||||
|
public $type = 'Link';
|
||||||
|
|
||||||
|
public function getLink()
|
||||||
|
{
|
||||||
|
$html=array();
|
||||||
|
|
||||||
|
if($this->value) $html[]='<a rel="noopener noreferrer" target="_blank" rel="'.$this->element['rel'].'" href="'.$this->value.'">'.$this->value.'</a>';
|
||||||
|
return implode('', $html);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,172 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Platform
|
||||||
|
* @subpackage Form
|
||||||
|
*
|
||||||
|
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('JPATH_PLATFORM') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Field class for the Joomla Platform.
|
||||||
|
* Provides a one line text box with up-down handles to set a number in the field.
|
||||||
|
*
|
||||||
|
* @package Joomla.Platform
|
||||||
|
* @subpackage Form
|
||||||
|
* @link http://www.w3.org/TR/html-markup/input.text.html#input.text
|
||||||
|
* @since 3.2
|
||||||
|
*/
|
||||||
|
class JFormFieldNumeric extends JFormField
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The form field type.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 3.2
|
||||||
|
*/
|
||||||
|
protected $type = 'Numeric';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The allowable maximum value of the field.
|
||||||
|
*
|
||||||
|
* @var float
|
||||||
|
* @since 3.2
|
||||||
|
*/
|
||||||
|
protected $max = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The allowable minimum value of the field.
|
||||||
|
*
|
||||||
|
* @var float
|
||||||
|
* @since 3.2
|
||||||
|
*/
|
||||||
|
protected $min = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The step by which value of the field increased or decreased.
|
||||||
|
*
|
||||||
|
* @var float
|
||||||
|
* @since 3.2
|
||||||
|
*/
|
||||||
|
protected $step = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get certain otherwise inaccessible properties from the form field object.
|
||||||
|
*
|
||||||
|
* @param string $name The property name for which to the the value.
|
||||||
|
*
|
||||||
|
* @return mixed The property value or null.
|
||||||
|
*
|
||||||
|
* @since 3.2
|
||||||
|
*/
|
||||||
|
public function __get($name)
|
||||||
|
{
|
||||||
|
switch ($name)
|
||||||
|
{
|
||||||
|
case 'max':
|
||||||
|
case 'min':
|
||||||
|
case 'step':
|
||||||
|
return $this->$name;
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::__get($name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to set certain otherwise inaccessible properties of the form field object.
|
||||||
|
*
|
||||||
|
* @param string $name The property name for which to the the value.
|
||||||
|
* @param mixed $value The value of the property.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 3.2
|
||||||
|
*/
|
||||||
|
public function __set($name, $value)
|
||||||
|
{
|
||||||
|
switch ($name)
|
||||||
|
{
|
||||||
|
case 'step':
|
||||||
|
case 'min':
|
||||||
|
case 'max':
|
||||||
|
$this->$name = (float) $value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
parent::__set($name, $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to attach a JForm object to the field.
|
||||||
|
*
|
||||||
|
* @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object.
|
||||||
|
* @param mixed $value The form field value to validate.
|
||||||
|
* @param string $group The field name group control value. This acts as as an array container for the field.
|
||||||
|
* For example if the field has name="foo" and the group value is set to "bar" then the
|
||||||
|
* full field name would end up being "bar[foo]".
|
||||||
|
*
|
||||||
|
* @return boolean True on success.
|
||||||
|
*
|
||||||
|
* @see JFormField::setup()
|
||||||
|
* @since 3.2
|
||||||
|
*/
|
||||||
|
public function setup(SimpleXMLElement $element, $value, $group = null)
|
||||||
|
{
|
||||||
|
$return = parent::setup($element, $value, $group);
|
||||||
|
|
||||||
|
if ($return)
|
||||||
|
{
|
||||||
|
$this->max = isset($this->element['max']) ? (float) $this->element['max'] : 100;
|
||||||
|
$this->min = isset($this->element['min']) ? (float) $this->element['min'] : 0;
|
||||||
|
$this->step = isset($this->element['step']) ? (float) $this->element['step'] : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get the field input markup.
|
||||||
|
*
|
||||||
|
* @return string The field input markup.
|
||||||
|
*
|
||||||
|
* @since 3.2
|
||||||
|
*/
|
||||||
|
protected function getInput()
|
||||||
|
{
|
||||||
|
// Translate placeholder text
|
||||||
|
$hint = $this->translateHint ? JText::_($this->hint) : $this->hint;
|
||||||
|
|
||||||
|
// Initialize some field attributes.
|
||||||
|
$size = !empty($this->size) ? ' size="' . $this->size . '"' : '';
|
||||||
|
$max = !empty($this->max) ? ' max="' . $this->max . '"' : '';
|
||||||
|
$min = !empty($this->min) ? ' min="' . $this->min . '"' : '';
|
||||||
|
$step = !empty($this->step) ? ' step="' . $this->step . '"' : '';
|
||||||
|
$class = !empty($this->class) ? ' class="' . $this->class . '"' : '';
|
||||||
|
$readonly = $this->readonly ? ' readonly' : '';
|
||||||
|
$disabled = $this->disabled ? ' disabled' : '';
|
||||||
|
$required = $this->required ? ' required aria-required="true"' : '';
|
||||||
|
$hint = $hint ? ' placeholder="' . $hint . '"' : '';
|
||||||
|
|
||||||
|
$autocomplete = !$this->autocomplete ? ' autocomplete="off"' : ' autocomplete="' . $this->autocomplete . '"';
|
||||||
|
$autocomplete = $autocomplete == ' autocomplete="on"' ? '' : $autocomplete;
|
||||||
|
|
||||||
|
$autofocus = $this->autofocus ? ' autofocus' : '';
|
||||||
|
|
||||||
|
$value = (float) $this->value;
|
||||||
|
$value = empty($value) ? $this->min : $value;
|
||||||
|
|
||||||
|
// Initialize JavaScript field attributes.
|
||||||
|
$onchange = !empty($this->onchange) ? ' onchange="' . $this->onchange . '"' : '';
|
||||||
|
|
||||||
|
// Including fallback code for HTML5 non supported browsers.
|
||||||
|
JHtml::_('jquery.framework');
|
||||||
|
JHtml::_('script', 'system/html5fallback.js', false, true);
|
||||||
|
|
||||||
|
return '<input type="number" name="' . $this->name . '" id="' . $this->id . '"' . ' value="'
|
||||||
|
. htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '"' . $class . $size . $disabled . $readonly
|
||||||
|
. $hint . $onchange . $max . $step . $min . $required . $autocomplete . $autofocus . ' />';
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,157 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
JFormHelper::loadFieldClass('list');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Field class for the Joomla Framework.
|
||||||
|
*
|
||||||
|
* @package Joomla.Libraries
|
||||||
|
* @subpackage Form
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
class JFormFieldParent extends JFormFieldList
|
||||||
|
{
|
||||||
|
public $type = 'Parent';
|
||||||
|
|
||||||
|
public $isNested = null;
|
||||||
|
|
||||||
|
public $table = null;
|
||||||
|
|
||||||
|
protected $comParams = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
|
// Load com_jsn config
|
||||||
|
$this->comParams = JComponentHelper::getParams('com_jsn');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function getOptions()
|
||||||
|
{
|
||||||
|
$this->table=$this->element['table'];
|
||||||
|
//die($this->table);
|
||||||
|
$options = array();
|
||||||
|
|
||||||
|
$published = $this->element['published']? $this->element['published'] : array(0,1);
|
||||||
|
$name = (string) $this->element['name'];
|
||||||
|
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = $db->getQuery(true)
|
||||||
|
->select('a.'.(isset($this->element['field_id']) ? $this->element['field_id'] : 'id').' AS value, a.path, a.'.(isset($this->element['field_title']) ? $this->element['field_title'] : 'title').' AS text, a.alias, a.type, a.level, a.published')
|
||||||
|
->from('#__'.$this->table.' AS a')
|
||||||
|
->join('LEFT', $db->quoteName('#__'.$this->table) . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt');
|
||||||
|
|
||||||
|
if (isset($this->element['level'])) $query->where('a.level = ' . (int) $this->element['level']);
|
||||||
|
|
||||||
|
if (isset($this->element['where'])) $query->where($this->element['where']);
|
||||||
|
|
||||||
|
// Filter language
|
||||||
|
if (!empty($this->element['language']))
|
||||||
|
{
|
||||||
|
$query->where('a.language = ' . $db->quote($this->element['language']));
|
||||||
|
}
|
||||||
|
|
||||||
|
$query->where($db->quoteName('a.alias') . ' <> ' . $db->quote('root'));
|
||||||
|
|
||||||
|
// Filter to only load active items
|
||||||
|
|
||||||
|
// Filter on the published state
|
||||||
|
if (is_numeric($published))
|
||||||
|
{
|
||||||
|
$query->where('a.published = ' . (int) $published);
|
||||||
|
}
|
||||||
|
elseif (is_array($published))
|
||||||
|
{
|
||||||
|
JArrayHelper::toInteger($published);
|
||||||
|
$query->where('a.published IN (' . implode(',', $published) . ')');
|
||||||
|
}
|
||||||
|
|
||||||
|
$query->group('a.id, a.title, a.level, a.lft, a.rgt, a.parent_id, a.published, a.path')
|
||||||
|
->order('a.lft ASC');
|
||||||
|
|
||||||
|
// Get the options.
|
||||||
|
$db->setQuery($query);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$options = $db->loadObjectList();
|
||||||
|
}
|
||||||
|
catch (RuntimeException $e)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Translate Options Text
|
||||||
|
foreach($options as &$value){
|
||||||
|
$value->text=JText::_($value->text) . " (" . $value->alias . ")";
|
||||||
|
if(isset($this->element['mini_img']) && $this->element['mini_img'] && $value->type=='image') $value->value= $value->value.'_mini';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Merge any additional options in the XML definition.
|
||||||
|
if (isset($this->element['level']) || isset($this->element['enableoptions'])) $options = array_merge(parent::getOptions(), $options);
|
||||||
|
|
||||||
|
// Prepare nested data
|
||||||
|
if ($this->isNested())
|
||||||
|
{
|
||||||
|
$this->prepareOptionsNested($options);
|
||||||
|
}
|
||||||
|
//print_r($options);
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add "-" before nested fields, depending on level
|
||||||
|
*
|
||||||
|
* @param array &$options Array of fields
|
||||||
|
*
|
||||||
|
* @return array The field option objects.
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
protected function prepareOptionsNested(&$options)
|
||||||
|
{
|
||||||
|
if ($options)
|
||||||
|
{
|
||||||
|
foreach ($options as &$option)
|
||||||
|
{
|
||||||
|
$repeat = (isset($option->level) && $option->level - 1 >= 0) ? $option->level - 1 : 0;
|
||||||
|
$option->text = str_repeat('- ', $repeat) . $option->text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isNested()
|
||||||
|
{
|
||||||
|
if (is_null($this->isNested))
|
||||||
|
{
|
||||||
|
// If mode="nested" || ( mode not set & config = nested )
|
||||||
|
if ((isset($this->element['mode']) && $this->element['mode'] == 'nested') && !isset($this->element['level'])
|
||||||
|
/*|| (!isset($this->element['mode']) && $this->comParams->get('jsn_field_nested', 1) == 0)*/)
|
||||||
|
{
|
||||||
|
$this->isNested = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->isNested;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
JFormHelper::loadFieldClass('password');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Field class for the Joomla Platform.
|
||||||
|
* Provides spacer markup to be used in form layouts.
|
||||||
|
*
|
||||||
|
* @package Joomla.Platform
|
||||||
|
* @subpackage Form
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
class JFormFieldPasswordfull extends JFormFieldPassword
|
||||||
|
{
|
||||||
|
|
||||||
|
public $type = 'Passwordfull';
|
||||||
|
|
||||||
|
protected function getInput()
|
||||||
|
{
|
||||||
|
$version = new JVersion();
|
||||||
|
if($version->getShortVersion() >= '3.7' || true)
|
||||||
|
{
|
||||||
|
$configJsn=JComponentHelper::getParams('com_jsn');
|
||||||
|
if($configJsn->get('passwordstrengthmeter',0)){
|
||||||
|
JHtml::_('behavior.framework');
|
||||||
|
$doc = JFactory::getDocument();
|
||||||
|
$doc->addScript(JURI::root().'media/system/js/passwordstrength.js');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$html = parent::getInput();
|
||||||
|
$html.= '<div class="message-regex">'.JText::_('COM_JSN_NOT_VALID_PASSWORD').'</div>';
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
JFormHelper::loadFieldClass('tel');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Field class for the Joomla Platform.
|
||||||
|
* Provides spacer markup to be used in form layouts.
|
||||||
|
*
|
||||||
|
* @package Joomla.Platform
|
||||||
|
* @subpackage Form
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
class JFormFieldPhone extends JFormFieldTel
|
||||||
|
{
|
||||||
|
|
||||||
|
public $type = 'Phone';
|
||||||
|
|
||||||
|
protected function getInput()
|
||||||
|
{
|
||||||
|
$html = parent::getInput();
|
||||||
|
$html.= '<div class="message-regex">'.JText::_('COM_JSN_PHONEINVALID').'</div>';
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
JFormHelper::loadFieldClass('hidden');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Field class for the Joomla Platform.
|
||||||
|
* Provides spacer markup to be used in form layouts.
|
||||||
|
*
|
||||||
|
* @package Joomla.Platform
|
||||||
|
* @subpackage Form
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
class JFormFieldPrivacy extends JFormFieldHidden
|
||||||
|
{
|
||||||
|
|
||||||
|
public $type = 'Privacy';
|
||||||
|
|
||||||
|
protected function getInput()
|
||||||
|
{
|
||||||
|
$doc = JFactory::getDocument();
|
||||||
|
$dir = $doc->direction;
|
||||||
|
|
||||||
|
$config = JComponentHelper::getParams('com_jsn');
|
||||||
|
$html=array();
|
||||||
|
$jsnsocial_enabled = JPluginHelper::isEnabled('jsn', 'socialnetwork');
|
||||||
|
if($jsnsocial_enabled)
|
||||||
|
{
|
||||||
|
$html[]='
|
||||||
|
<a id="btn_'.$this->id.'" class="privacy_btn" data-toggle="dropdown" href="#">
|
||||||
|
<i></i>
|
||||||
|
<span class="caret"></span>
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu pull-'.($dir=='rtl' ? 'left' : 'right').'" id="opt_'.$this->id.'">
|
||||||
|
<li><a href="#" rel="0"><i class="jsn-icon jsn-icon-users green"></i> '.JText::_('COM_JSN_PUBLIC').'</a></li>
|
||||||
|
<li><a href="#" rel="1"><i class="jsn-icon jsn-icon-user orange"></i> '.JText::_('COM_JSN_FRIENDSONLY').'</a></li>
|
||||||
|
<li><a href="#" rel="99"><i class="jsn-icon jsn-icon-user-secret red"></i> '.JText::_('COM_JSN_PRIVATE').'</a></li>
|
||||||
|
</ul>
|
||||||
|
';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$html[]='
|
||||||
|
<a id="btn_'.$this->id.'" class="privacy_btn" data-toggle="dropdown" href="#">
|
||||||
|
<i></i>
|
||||||
|
<span class="caret"></span>
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu pull-'.($dir=='rtl' ? 'left' : 'right').'" id="opt_'.$this->id.'">
|
||||||
|
'.($config->get('profileACL',2)==2 ? '<li><a href="#" rel="0"><i class="jsn-icon jsn-icon-users green"></i> '.JText::_('COM_JSN_PUBLIC').'</a></li>': '').'
|
||||||
|
<li><a href="#" rel="1"><i class="jsn-icon jsn-icon-user orange"></i> '.JText::_('COM_JSN_REGISTERED').'</a></li>
|
||||||
|
<li><a href="#" rel="99"><i class="jsn-icon jsn-icon-user-secret red"></i> '.JText::_('COM_JSN_PRIVATE').'</a></li>
|
||||||
|
</ul>
|
||||||
|
';
|
||||||
|
}
|
||||||
|
//'<a href="#'.$this->id.'" class="privacy_btn btn"><i class="icon-locked"></i></a>';
|
||||||
|
$html[]=parent::getInput();
|
||||||
|
return implode('', $html);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
JFormHelper::loadFieldClass('radio');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Field class for the Joomla Framework.
|
||||||
|
*
|
||||||
|
* @package Joomla.Libraries
|
||||||
|
* @subpackage Form
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
class JFormFieldRadiolist extends JFormFieldRadio
|
||||||
|
{
|
||||||
|
public $type = 'Radiolist';
|
||||||
|
|
||||||
|
public $isNested = null;
|
||||||
|
|
||||||
|
public $table = null;
|
||||||
|
|
||||||
|
protected $comParams = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
|
// Load com_jsn config
|
||||||
|
$this->comParams = JComponentHelper::getParams('com_jsn');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function getInput()
|
||||||
|
{
|
||||||
|
if($this->element['optioninline']==1) $inline='inline';
|
||||||
|
else $inline='';
|
||||||
|
$html=array();
|
||||||
|
$from=array('<label','<input','</label>');
|
||||||
|
$to=array('<span','<label class="radio '.$inline.'"><input ','</span></label>');
|
||||||
|
$html[]=str_replace($from,$to,parent::getInput());
|
||||||
|
return implode('', $html);
|
||||||
|
}
|
||||||
|
public function getOptions()
|
||||||
|
{
|
||||||
|
return parent::getOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
JFormHelper::loadFieldClass('calendar');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Field class for the Joomla Platform.
|
||||||
|
* Provides spacer markup to be used in form layouts.
|
||||||
|
*
|
||||||
|
* @package Joomla.Platform
|
||||||
|
* @subpackage Form
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
class JFormFieldRegisterdate extends JFormFieldCalendar
|
||||||
|
{
|
||||||
|
|
||||||
|
public $type = 'Registerdate';
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,148 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
JFormHelper::loadFieldClass('list');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Field class for the Joomla Framework.
|
||||||
|
*
|
||||||
|
* @package Joomla.Libraries
|
||||||
|
* @subpackage Form
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
class JFormFieldSelectlist extends JFormFieldList
|
||||||
|
{
|
||||||
|
public $type = 'Selectlist';
|
||||||
|
|
||||||
|
public $isNested = null;
|
||||||
|
|
||||||
|
public $table = null;
|
||||||
|
|
||||||
|
protected $comParams = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
|
// Load com_jsn config
|
||||||
|
$this->comParams = JComponentHelper::getParams('com_jsn');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function getInput()
|
||||||
|
{
|
||||||
|
JHtml::_('formbehavior.chosen', 'select');
|
||||||
|
/* Placeholder for multiple with Javascript */
|
||||||
|
if(isset($this->element['hint']) && isset($this->element['multiple']) && $this->element['multiple']=='true') {
|
||||||
|
$script="jQuery(document).ready(function(){jQuery('#".$this->id."_chzn input').attr('value','".str_replace("'","\\'",$this->element['hint'])."')});";
|
||||||
|
$doc=JFactory::getDocument();
|
||||||
|
$doc->addScriptDeclaration( $script );
|
||||||
|
}
|
||||||
|
if(is_object($this->value)) $this->value = (array) $this->value;
|
||||||
|
if(is_array($this->value)) $value=implode(',',$this->value);
|
||||||
|
else $value=$this->value;
|
||||||
|
/* Multiple empty fix */
|
||||||
|
if(isset($this->element['multiple']) && $this->element['multiple']=='true')
|
||||||
|
$multiple_fix='<input name="'.$this->id.'" type="hidden" value="1" />';
|
||||||
|
else
|
||||||
|
$multiple_fix='';
|
||||||
|
/* --- */
|
||||||
|
$script = '';
|
||||||
|
if(isset($this->element['dboptfiltercolumn']) && !empty($this->element['dboptfiltercolumn']) && isset($this->element['dboptfiltervalue']) && !empty($this->element['dboptfiltervalue']))
|
||||||
|
{
|
||||||
|
$script = JsnSelectlistFieldHelper::getAjaxScript($this->element['dboptfiltervalue'],$this->element['name']);
|
||||||
|
}
|
||||||
|
return str_replace('<select','<select data-val="'.$value.'"',parent::getInput()).$multiple_fix.$script;
|
||||||
|
}
|
||||||
|
public function getOptions()
|
||||||
|
{
|
||||||
|
if(isset($this->element['dbopttable']) && !empty($this->element['dbopttable']) && isset($this->element['dboptvalue']) && !empty($this->element['dboptvalue']) && isset($this->element['dbopttext']) && !empty($this->element['dbopttext'])) // set the alias of your field (width this conditions the select type work normally for all field except for this field)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
$query->select($this->element['dboptvalue'].' AS value, '.$this->element['dbopttext'].' AS text')->from($this->element['dbopttable']);
|
||||||
|
|
||||||
|
if(isset($this->element['dboptfiltercolumn']) && !empty($this->element['dboptfiltercolumn']) && isset($this->element['dboptfiltervalue']) && !empty($this->element['dboptfiltervalue']))
|
||||||
|
{
|
||||||
|
if(empty($this->value))
|
||||||
|
{
|
||||||
|
return parent::getOptions();
|
||||||
|
}
|
||||||
|
elseif(is_array($this->value))
|
||||||
|
{
|
||||||
|
$value=$this->value;
|
||||||
|
foreach($value as &$val)
|
||||||
|
$val=$db->quote($val);
|
||||||
|
$value=implode(',',$value);
|
||||||
|
$query->where($this->element['dboptvalue'].' IN ('.$value.')');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$query->where($this->element['dboptvalue'].' = '.$db->quote($this->value));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
elseif(isset($this->element['dboptwhere']) && !empty($this->element['dboptwhere']))
|
||||||
|
{
|
||||||
|
JPluginHelper::importPlugin('content');
|
||||||
|
$where= JHtml::_('content.prepare', $this->element['dboptwhere'], 'customwhere', 'com_finder.indexer');
|
||||||
|
if(empty($this->value))
|
||||||
|
{
|
||||||
|
$query->where($where);
|
||||||
|
}
|
||||||
|
elseif(is_array($this->value))
|
||||||
|
{
|
||||||
|
$value=$this->value;
|
||||||
|
foreach($value as &$val)
|
||||||
|
$val=$db->quote($val);
|
||||||
|
$value=implode(',',$value);
|
||||||
|
$query->where($where.' OR '.$this->element['dboptvalue'].' IN ('.$value.')');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$query->where($where.' OR '.$this->element['dboptvalue'].' = '.$db->quote($this->value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$query->order('text');
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$options = $db->loadObjectList();
|
||||||
|
}
|
||||||
|
catch (RuntimeException $e)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($options as &$option)
|
||||||
|
{
|
||||||
|
$option->text=JText::_($option->text);
|
||||||
|
}
|
||||||
|
|
||||||
|
$options = array_merge(parent::getOptions(), $options); // Merge any additional options in the fields params (you can remove this).
|
||||||
|
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return parent::getOptions();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
JFormHelper::loadFieldClass('text');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Field class for the Joomla Platform.
|
||||||
|
* Provides spacer markup to be used in form layouts.
|
||||||
|
*
|
||||||
|
* @package Joomla.Platform
|
||||||
|
* @subpackage Form
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
class JFormFieldTextfull extends JFormFieldText
|
||||||
|
{
|
||||||
|
|
||||||
|
public $type = 'Text';
|
||||||
|
|
||||||
|
protected function getInput()
|
||||||
|
{
|
||||||
|
$html = parent::getInput();
|
||||||
|
if(!empty($this->element['pattern'])) {
|
||||||
|
$html = preg_replace('/pattern=/', 'jsn-pattern=', $html, 1);
|
||||||
|
if(isset($this->element['message-regex'])) $html.= '<div class="message-regex">'.$this->element['message-regex'].'</div>';
|
||||||
|
}
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
JFormHelper::loadFieldClass('list');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Field class for the Joomla Framework.
|
||||||
|
*
|
||||||
|
* @package Joomla.Libraries
|
||||||
|
* @subpackage Form
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
class JFormFieldTypes extends JFormFieldList
|
||||||
|
{
|
||||||
|
public $type = 'Types';
|
||||||
|
|
||||||
|
protected $comParams = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
|
// Load com_jsn config
|
||||||
|
$this->comParams = JComponentHelper::getParams('com_jsn');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function getOptions()
|
||||||
|
{
|
||||||
|
// Include Field Class
|
||||||
|
foreach (glob(JPATH_ADMINISTRATOR . '/components/com_jsn/helpers/fields/*.php') as $filename) {
|
||||||
|
require_once $filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
global $_FIELDTYPES;
|
||||||
|
$options = $_FIELDTYPES;
|
||||||
|
|
||||||
|
// Translate Options Text
|
||||||
|
foreach($options as &$value){
|
||||||
|
$value=JText::_($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Merge any additional options in the XML definition.
|
||||||
|
if (!isset($this->element['level'])) $options = array_merge(parent::getOptions(), $options);
|
||||||
|
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
JFormHelper::loadFieldClass('url');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Field class for the Joomla Platform.
|
||||||
|
* Provides spacer markup to be used in form layouts.
|
||||||
|
*
|
||||||
|
* @package Joomla.Platform
|
||||||
|
* @subpackage Form
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
class JFormFieldVideo extends JFormFieldUrl
|
||||||
|
{
|
||||||
|
|
||||||
|
public $type = 'Video';
|
||||||
|
|
||||||
|
}
|
||||||
2274
deployed/jsn/administrator/components/com_jsn/models/forms/field.xml
Normal file
2274
deployed/jsn/administrator/components/com_jsn/models/forms/field.xml
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,94 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<form>
|
||||||
|
<fields name="filter">
|
||||||
|
<field
|
||||||
|
name="search"
|
||||||
|
type="text"
|
||||||
|
label="COM_USERS_SEARCH_USERS"
|
||||||
|
description="COM_USERS_SEARCH_IN_NAME"
|
||||||
|
hint="JSEARCH_FILTER"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
name="state"
|
||||||
|
type="userstate"
|
||||||
|
label="COM_USERS_FILTER_STATE"
|
||||||
|
description="COM_USERS_FILTER_STATE_DESC"
|
||||||
|
onchange="this.form.submit();"
|
||||||
|
>
|
||||||
|
<option value="">COM_USERS_FILTER_STATE</option>
|
||||||
|
</field>
|
||||||
|
<field
|
||||||
|
name="active"
|
||||||
|
type="useractive"
|
||||||
|
label="COM_USERS_FILTER_ACTIVE"
|
||||||
|
description="COM_USERS_FILTER_ACTIVE_DESC"
|
||||||
|
onchange="this.form.submit();"
|
||||||
|
>
|
||||||
|
<option value="">COM_USERS_FILTER_ACTIVE</option>
|
||||||
|
</field>
|
||||||
|
<field
|
||||||
|
name="group_id"
|
||||||
|
type="usergrouplist"
|
||||||
|
label="COM_USERS_FILTER_GROUP"
|
||||||
|
description="COM_USERS_FILTER_GROUP_DESC"
|
||||||
|
onchange="this.form.submit();"
|
||||||
|
>
|
||||||
|
<option value="">COM_USERS_FILTER_USERGROUP</option>
|
||||||
|
</field>
|
||||||
|
<field
|
||||||
|
name="lastvisitrange"
|
||||||
|
type="lastvisitdaterange"
|
||||||
|
label="COM_USERS_OPTION_FILTER_LAST_VISIT_DATE"
|
||||||
|
description="COM_USERS_OPTION_FILTER_LAST_VISIT_DATE"
|
||||||
|
onchange="this.form.submit();"
|
||||||
|
>
|
||||||
|
<option value="">COM_USERS_OPTION_FILTER_LAST_VISIT_DATE</option>
|
||||||
|
</field>
|
||||||
|
<field
|
||||||
|
name="range"
|
||||||
|
type="registrationdaterange"
|
||||||
|
label="COM_USERS_OPTION_FILTER_DATE"
|
||||||
|
description="COM_USERS_OPTION_FILTER_DATE"
|
||||||
|
onchange="this.form.submit();"
|
||||||
|
>
|
||||||
|
<option value="">COM_USERS_OPTION_FILTER_DATE</option>
|
||||||
|
</field>
|
||||||
|
</fields>
|
||||||
|
<fields name="list">
|
||||||
|
<field
|
||||||
|
name="fullordering"
|
||||||
|
type="list"
|
||||||
|
label="COM_CONTENT_LIST_FULL_ORDERING"
|
||||||
|
description="COM_CONTENT_LIST_FULL_ORDERING_DESC"
|
||||||
|
onchange="this.form.submit();"
|
||||||
|
default="a.name ASC"
|
||||||
|
>
|
||||||
|
<option value="">JGLOBAL_SORT_BY</option>
|
||||||
|
<option value="a.name ASC">COM_USERS_HEADING_NAME_ASC</option>
|
||||||
|
<option value="a.name DESC">COM_USERS_HEADING_NAME_DESC</option>
|
||||||
|
<option value="a.username ASC">COM_USERS_HEADING_USERNAME_ASC</option>
|
||||||
|
<option value="a.username DESC">COM_USERS_HEADING_USERNAME_DESC</option>
|
||||||
|
<option value="a.block ASC">COM_USERS_HEADING_ENABLED_ASC</option>
|
||||||
|
<option value="a.block DESC">COM_USERS_HEADING_ENABLED_DESC</option>
|
||||||
|
<option value="a.activation ASC">COM_USERS_HEADING_ACTIVATED_ASC</option>
|
||||||
|
<option value="a.activation DESC">COM_USERS_HEADING_ACTIVATED_DESC</option>
|
||||||
|
<option value="a.email ASC">COM_USERS_HEADING_EMAIL_ASC</option>
|
||||||
|
<option value="a.email DESC">COM_USERS_HEADING_EMAIL_DESC</option>
|
||||||
|
<option value="a.lastvisitDate ASC">COM_USERS_HEADING_LAST_VISIT_DATE_ASC</option>
|
||||||
|
<option value="a.lastvisitDate DESC">COM_USERS_HEADING_LAST_VISIT_DATE_DESC</option>
|
||||||
|
<option value="a.registerDate ASC">COM_USERS_HEADING_REGISTRATION_DATE_ASC</option>
|
||||||
|
<option value="a.registerDate DESC">COM_USERS_HEADING_REGISTRATION_DATE_DESC</option>
|
||||||
|
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
|
||||||
|
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
|
||||||
|
</field>
|
||||||
|
<field
|
||||||
|
name="limit"
|
||||||
|
type="limitbox"
|
||||||
|
class="input-mini"
|
||||||
|
default="25"
|
||||||
|
label="COM_CONTENT_LIST_LIMIT"
|
||||||
|
description="COM_CONTENT_LIST_LIMIT_DESC"
|
||||||
|
onchange="this.form.submit();"
|
||||||
|
/>
|
||||||
|
</fields>
|
||||||
|
</form>
|
||||||
@ -0,0 +1,72 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('JPATH_PLATFORM') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Rule class for the Joomla Platform.
|
||||||
|
*
|
||||||
|
* @package Joomla.Platform
|
||||||
|
* @subpackage Form
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
class JFormRuleFiletype extends JFormRule
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Method to test an external url for a valid parts.
|
||||||
|
*
|
||||||
|
* @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object.
|
||||||
|
* @param mixed $value The form field value to validate.
|
||||||
|
* @param string $group The field name group control value. This acts as as an array container for the field.
|
||||||
|
* For example if the field has name="foo" and the group value is set to "bar" then the
|
||||||
|
* full field name would end up being "bar[foo]".
|
||||||
|
* @param JRegistry $input An optional JRegistry object with the entire data set to validate against the entire form.
|
||||||
|
* @param JForm $form The form object for which the field is being tested.
|
||||||
|
*
|
||||||
|
* @return boolean True if the value is valid, false otherwise.
|
||||||
|
*
|
||||||
|
* @since 11.1
|
||||||
|
* @link http://www.w3.org/Addressing/URL/url-spec.txt
|
||||||
|
* @see JString
|
||||||
|
*/
|
||||||
|
public function test(SimpleXMLElement $element, $value, $group = null, JRegistry $input = null, JForm $form = null)
|
||||||
|
{
|
||||||
|
// If the field is empty and not required, the field is valid.
|
||||||
|
$required = ((string) $element['requiredfile'] == 'true' || (string) $element['requiredfile'] == 'required');
|
||||||
|
|
||||||
|
$validate=false;
|
||||||
|
|
||||||
|
$jform=JFactory::getApplication()->input->files->get('jform',null,'array');
|
||||||
|
if(isset($jform['upload_'. (string) $element['name']]))$jform_file=$jform['upload_'. (string) $element['name']];
|
||||||
|
if(isset($jform_file['name']) && strlen($jform_file['name'])>4)
|
||||||
|
{
|
||||||
|
$filename=$jform_file['name'];
|
||||||
|
$ext = strtolower($filename[strlen($filename)-4].$filename[strlen($filename)-3].$filename[strlen($filename)-2].$filename[strlen($filename)-1]);
|
||||||
|
if ($ext[0] == '.') $ext = substr($ext, 1, 3);
|
||||||
|
if (!in_array($ext, explode('|', (string) $element['mime']) )) return false;
|
||||||
|
$validate=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$required) return true;
|
||||||
|
|
||||||
|
$form=JFactory::getApplication()->input->get('jform',false,'array');
|
||||||
|
if($form && isset($form['id']))
|
||||||
|
{
|
||||||
|
$db=JFactory::getDbo();
|
||||||
|
$query=$db->getQuery(true);
|
||||||
|
$query->select($db->quoteName((string) $element['id']))->from('#__jsn_users')->where('id = '. (int) $form['id']);
|
||||||
|
$db->setQuery($query);
|
||||||
|
$checkValue=$db->loadResult();
|
||||||
|
if(!empty($checkValue)) $validate=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($validate) return true;
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('JPATH_PLATFORM') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Rule class for the Joomla Platform.
|
||||||
|
*
|
||||||
|
* @package Joomla.Platform
|
||||||
|
* @subpackage Form
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
class JFormRuleImage extends JFormRule
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Method to test an external url for a valid parts.
|
||||||
|
*
|
||||||
|
* @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object.
|
||||||
|
* @param mixed $value The form field value to validate.
|
||||||
|
* @param string $group The field name group control value. This acts as as an array container for the field.
|
||||||
|
* For example if the field has name="foo" and the group value is set to "bar" then the
|
||||||
|
* full field name would end up being "bar[foo]".
|
||||||
|
* @param JRegistry $input An optional JRegistry object with the entire data set to validate against the entire form.
|
||||||
|
* @param JForm $form The form object for which the field is being tested.
|
||||||
|
*
|
||||||
|
* @return boolean True if the value is valid, false otherwise.
|
||||||
|
*
|
||||||
|
* @since 11.1
|
||||||
|
* @link http://www.w3.org/Addressing/URL/url-spec.txt
|
||||||
|
* @see JString
|
||||||
|
*/
|
||||||
|
public function test(SimpleXMLElement $element, $value, $group = null, JRegistry $input = null, JForm $form = null)
|
||||||
|
{
|
||||||
|
// If the field is empty and not required, the field is valid.
|
||||||
|
$required = ((string) $element['requiredfile'] == 'true' || (string) $element['requiredfile'] == 'required');
|
||||||
|
|
||||||
|
$validate=false;
|
||||||
|
|
||||||
|
$jform=JFactory::getApplication()->input->files->get('jform',null,'raw');
|
||||||
|
if(isset($jform['upload_'. (string) $element['name']]))$jform_file=$jform['upload_'. (string) $element['name']];
|
||||||
|
if(isset($jform_file['name']) && strlen($jform_file['name'])>4)
|
||||||
|
{
|
||||||
|
$filename=$jform_file['name'];
|
||||||
|
$ext = strtolower($filename[strlen($filename)-4].$filename[strlen($filename)-3].$filename[strlen($filename)-2].$filename[strlen($filename)-1]);
|
||||||
|
if ($ext[0] == '.') $ext = substr($ext, 1, 3);
|
||||||
|
if (!in_array($ext, explode('|', 'jpg|png|jpeg|gif|bmp') )) return false;
|
||||||
|
$validate=true;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$form=JFactory::getApplication()->input->get('jform',null,'raw');
|
||||||
|
$value=$form[(string) $element['name']];
|
||||||
|
if(!empty($value)) $validate=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$required) return true;
|
||||||
|
|
||||||
|
if($validate) return true;
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,98 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('JPATH_PLATFORM') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Rule class for the Joomla Platform.
|
||||||
|
*
|
||||||
|
* @package Joomla.Platform
|
||||||
|
* @subpackage Form
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
class JFormRuleLink extends JFormRule
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Method to test an external url for a valid parts.
|
||||||
|
*
|
||||||
|
* @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object.
|
||||||
|
* @param mixed $value The form field value to validate.
|
||||||
|
* @param string $group The field name group control value. This acts as as an array container for the field.
|
||||||
|
* For example if the field has name="foo" and the group value is set to "bar" then the
|
||||||
|
* full field name would end up being "bar[foo]".
|
||||||
|
* @param JRegistry $input An optional JRegistry object with the entire data set to validate against the entire form.
|
||||||
|
* @param JForm $form The form object for which the field is being tested.
|
||||||
|
*
|
||||||
|
* @return boolean True if the value is valid, false otherwise.
|
||||||
|
*
|
||||||
|
* @since 11.1
|
||||||
|
* @link http://www.w3.org/Addressing/URL/url-spec.txt
|
||||||
|
* @see JString
|
||||||
|
*/
|
||||||
|
public function test(SimpleXMLElement $element, $value, $group = null, JRegistry $input = null, JForm $form = null)
|
||||||
|
{
|
||||||
|
// If the field is empty and not required, the field is valid.
|
||||||
|
$required = ((string) $element['required'] == 'true' || (string) $element['required'] == 'required');
|
||||||
|
if (!$required && empty($value))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
$urlParts = JString::parse_url($value);
|
||||||
|
|
||||||
|
// See http://www.w3.org/Addressing/URL/url-spec.txt
|
||||||
|
// Use the full list or optionally specify a list of permitted schemes.
|
||||||
|
if ($element['schemes'] == '')
|
||||||
|
{
|
||||||
|
$scheme = array('http', 'https', 'ftp', 'ftps', 'gopher', 'mailto', 'news', 'prospero', 'telnet', 'rlogin', 'tn3270', 'wais', 'url',
|
||||||
|
'mid', 'cid', 'nntp', 'tel', 'urn', 'ldap', 'file', 'fax', 'modem', 'git');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$scheme = explode(',', $element['schemes']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This rule is only for full URLs with schemes because parse_url does not parse
|
||||||
|
* accurately without a scheme.
|
||||||
|
* @see http://php.net/manual/en/function.parse-url.php
|
||||||
|
*/
|
||||||
|
if ($urlParts && !array_key_exists('scheme', $urlParts))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$urlScheme = (string) $urlParts['scheme'];
|
||||||
|
$urlScheme = strtolower($urlScheme);
|
||||||
|
if (in_array($urlScheme, $scheme) == false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// For some schemes here must be two slashes.
|
||||||
|
if (($urlScheme == 'http' || $urlScheme == 'https' || $urlScheme == 'ftp' || $urlScheme == 'sftp' || $urlScheme == 'gopher'
|
||||||
|
|| $urlScheme == 'wais' || $urlScheme == 'gopher' || $urlScheme == 'prospero' || $urlScheme == 'telnet' || $urlScheme == 'git')
|
||||||
|
&& ((substr($value, strlen($urlScheme), 3)) !== '://'))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// The best we can do for the rest is make sure that the strings are valid UTF-8
|
||||||
|
// and the port is an integer.
|
||||||
|
if (array_key_exists('host', $urlParts) && !JString::valid((string) $urlParts['host']))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (array_key_exists('port', $urlParts) && !is_int((int) $urlParts['port']))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (array_key_exists('path', $urlParts) && !JString::valid((string) $urlParts['path']))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('JPATH_PLATFORM') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Rule class for the Joomla Platform
|
||||||
|
*
|
||||||
|
* @package Joomla.Platform
|
||||||
|
* @subpackage Form
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
class JFormRuleNumeric extends JFormRule
|
||||||
|
{
|
||||||
|
|
||||||
|
public function test(SimpleXMLElement $element, $value, $group = null, JRegistry $input = null, JForm $form = null)
|
||||||
|
{
|
||||||
|
// If the field is empty and not required, the field is valid.
|
||||||
|
$required = ((string) $element['required'] == 'true' || (string) $element['required'] == 'required');
|
||||||
|
if (!$required && empty($value))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_numeric($value)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ($value>$element['max'])
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ($value<$element['min'])
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,105 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('JPATH_PLATFORM') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Rule class for the Joomla Platform
|
||||||
|
*
|
||||||
|
* @package Joomla.Platform
|
||||||
|
* @subpackage Form
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
class JFormRulePhone extends JFormRule
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Method to test the url for a valid parts.
|
||||||
|
*
|
||||||
|
* @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object.
|
||||||
|
* @param mixed $value The form field value to validate.
|
||||||
|
* @param string $group The field name group control value. This acts as as an array container for the field.
|
||||||
|
* For example if the field has name="foo" and the group value is set to "bar" then the
|
||||||
|
* full field name would end up being "bar[foo]".
|
||||||
|
* @param JRegistry $input An optional JRegistry object with the entire data set to validate against the entire form.
|
||||||
|
* @param JForm $form The form object for which the field is being tested.
|
||||||
|
*
|
||||||
|
* @return boolean True if the value is valid, false otherwise.
|
||||||
|
*
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
public function test(SimpleXMLElement $element, $value, $group = null, JRegistry $input = null, JForm $form = null)
|
||||||
|
{
|
||||||
|
// If the field is empty and not required, the field is valid.
|
||||||
|
$required = ((string) $element['required'] == 'true' || (string) $element['required'] == 'required');
|
||||||
|
if (!$required && empty($value))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @see http://www.nanpa.com/
|
||||||
|
* @see http://tools.ietf.org/html/rfc4933
|
||||||
|
* @see http://www.itu.int/rec/T-REC-E.164/en
|
||||||
|
*
|
||||||
|
* Regex by Steve Levithan
|
||||||
|
* @see http://blog.stevenlevithan.com/archives/validate-phone-number
|
||||||
|
* @note that valid ITU-T and EPP must begin with +.
|
||||||
|
*/
|
||||||
|
$regexarray = array('NANP' => '/^(?:\+?1[-. ]?)?\(?([2-9][0-8][0-9])\)?[-. ]?([2-9][0-9]{2})[-. ]?([0-9]{4})$/',
|
||||||
|
'ITU-T' => '/^\+(?:[0-9] ?){6,14}[0-9]$/', 'EPP' => '/^\+[0-9]{1,3}\.[0-9]{4,14}(?:x.+)?$/');
|
||||||
|
if (isset($element['plan']))
|
||||||
|
{
|
||||||
|
|
||||||
|
$plan = (string) $element['plan'];
|
||||||
|
if ($plan == 'northamerica' || $plan == 'us')
|
||||||
|
{
|
||||||
|
$plan = 'NANP';
|
||||||
|
}
|
||||||
|
elseif ($plan == 'International' || $plan == 'int' || $plan == 'missdn' || !$plan)
|
||||||
|
{
|
||||||
|
$plan = 'ITU-T';
|
||||||
|
}
|
||||||
|
elseif ($plan == 'IETF')
|
||||||
|
{
|
||||||
|
$plan = 'EPP';
|
||||||
|
}
|
||||||
|
|
||||||
|
$regex = $regexarray[$plan];
|
||||||
|
|
||||||
|
// Test the value against the regular expression.
|
||||||
|
if (preg_match($regex, $value) == false)
|
||||||
|
{
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* If the rule is set but no plan is selected just check that there are between
|
||||||
|
* 7 and 15 digits inclusive and no illegal characters (but common number separators
|
||||||
|
* are allowed).
|
||||||
|
*/
|
||||||
|
$cleanvalue = preg_replace('/[+. \-(\)]/', '', $value);
|
||||||
|
$regex = '/^[0-9]{7,15}?$/';
|
||||||
|
if (preg_match($regex, $cleanvalue) == true)
|
||||||
|
{
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('JPATH_PLATFORM') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Rule class for the Joomla Platform
|
||||||
|
*
|
||||||
|
* @package Joomla.Platform
|
||||||
|
* @subpackage Form
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
class JFormRuleRegex extends JFormRule
|
||||||
|
{
|
||||||
|
|
||||||
|
public function test(SimpleXMLElement $element, $value, $group = null, JRegistry $input = null, JForm $form = null)
|
||||||
|
{
|
||||||
|
// If the field is empty and not required, the field is valid.
|
||||||
|
$required = ((string) $element['required'] == 'true' || (string) $element['required'] == 'required');
|
||||||
|
if (!$required && empty($value))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($element['pattern']))
|
||||||
|
{
|
||||||
|
|
||||||
|
$regex = '/^'.(string) $element['pattern'].'$/';
|
||||||
|
|
||||||
|
|
||||||
|
// Test the value against the regular expression.
|
||||||
|
if (preg_match($regex, $value) == false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,100 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('JPATH_PLATFORM') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form Rule class for the Joomla Platform.
|
||||||
|
*
|
||||||
|
* @package Joomla.Platform
|
||||||
|
* @subpackage Form
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
class JFormRuleVideo extends JFormRule
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Method to test an external url for a valid parts.
|
||||||
|
*
|
||||||
|
* @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object.
|
||||||
|
* @param mixed $value The form field value to validate.
|
||||||
|
* @param string $group The field name group control value. This acts as as an array container for the field.
|
||||||
|
* For example if the field has name="foo" and the group value is set to "bar" then the
|
||||||
|
* full field name would end up being "bar[foo]".
|
||||||
|
* @param JRegistry $input An optional JRegistry object with the entire data set to validate against the entire form.
|
||||||
|
* @param JForm $form The form object for which the field is being tested.
|
||||||
|
*
|
||||||
|
* @return boolean True if the value is valid, false otherwise.
|
||||||
|
*
|
||||||
|
* @since 11.1
|
||||||
|
* @link http://www.w3.org/Addressing/URL/url-spec.txt
|
||||||
|
* @see JString
|
||||||
|
*/
|
||||||
|
public function test(SimpleXMLElement $element, $value, $group = null, JRegistry $input = null, JForm $form = null)
|
||||||
|
{
|
||||||
|
// If the field is empty and not required, the field is valid.
|
||||||
|
$required = ((string) $element['required'] == 'true' || (string) $element['required'] == 'required');
|
||||||
|
if (!$required && empty($value))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
$urlParts = JString::parse_url($value);
|
||||||
|
|
||||||
|
// See http://www.w3.org/Addressing/URL/url-spec.txt
|
||||||
|
// Use the full list or optionally specify a list of permitted schemes.
|
||||||
|
if ($element['schemes'] == '')
|
||||||
|
{
|
||||||
|
$scheme = array('http', 'https', 'ftp', 'ftps', 'gopher', 'mailto', 'news', 'prospero', 'telnet', 'rlogin', 'tn3270', 'wais', 'url',
|
||||||
|
'mid', 'cid', 'nntp', 'tel', 'urn', 'ldap', 'file', 'fax', 'modem', 'git');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$scheme = explode(',', $element['schemes']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This rule is only for full URLs with schemes because parse_url does not parse
|
||||||
|
* accurately without a scheme.
|
||||||
|
* @see http://php.net/manual/en/function.parse-url.php
|
||||||
|
*/
|
||||||
|
if ($urlParts && !array_key_exists('scheme', $urlParts))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$urlScheme = (string) $urlParts['scheme'];
|
||||||
|
$urlScheme = strtolower($urlScheme);
|
||||||
|
if (in_array($urlScheme, $scheme) == false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// For some schemes here must be two slashes.
|
||||||
|
if (($urlScheme == 'http' || $urlScheme == 'https' || $urlScheme == 'ftp' || $urlScheme == 'sftp' || $urlScheme == 'gopher'
|
||||||
|
|| $urlScheme == 'wais' || $urlScheme == 'gopher' || $urlScheme == 'prospero' || $urlScheme == 'telnet' || $urlScheme == 'git')
|
||||||
|
&& ((substr($value, strlen($urlScheme), 3)) !== '://'))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// The best we can do for the rest is make sure that the strings are valid UTF-8
|
||||||
|
// and the port is an integer.
|
||||||
|
if (array_key_exists('host', $urlParts) && !JString::valid((string) $urlParts['host']))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (array_key_exists('port', $urlParts) && !is_int((int) $urlParts['port']))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (array_key_exists('path', $urlParts) && !JString::valid((string) $urlParts['path']))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Video
|
||||||
|
if(!(strpos(' '.$value,'https://www.youtube.com/watch?v=')==1 || strpos(' '.$value,'http://www.youtube.com/watch?v=')==1 || strpos(' '.$value,'https://m.youtube.com/watch?v=')==1 || strpos(' '.$value,'http://www.youtube.com/watch?v=')==1 || strpos(' '.$value,'http://youtu.be/')==1 || strpos(' '.$value,'http://vimeo.com/')==1 || strpos(' '.$value,'https://vimeo.com/')==1)) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
require_once(JPATH_COMPONENT . '/../com_users/models/user.php');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Methods supporting a list of user records.
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
class JsnModelUser extends UsersModelUser
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
289
deployed/jsn/administrator/components/com_jsn/models/users.php
Normal file
289
deployed/jsn/administrator/components/com_jsn/models/users.php
Normal file
@ -0,0 +1,289 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
require_once(JPATH_COMPONENT . '/../com_users/models/users.php');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Methods supporting a list of user records.
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
class JsnModelUsers extends UsersModelUsers
|
||||||
|
{
|
||||||
|
|
||||||
|
protected function getListQuery()
|
||||||
|
{
|
||||||
|
// Create a new query object.
|
||||||
|
$db = $this->getDbo();
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
|
||||||
|
// Select the required fields from the table.
|
||||||
|
$query->select(
|
||||||
|
$this->getState(
|
||||||
|
'list.select',
|
||||||
|
'a.*'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$query->from($db->quoteName('#__users') . ' AS a');
|
||||||
|
|
||||||
|
// If the model is set to check item state, add to the query.
|
||||||
|
$state = $this->getState('filter.state');
|
||||||
|
|
||||||
|
if (is_numeric($state))
|
||||||
|
{
|
||||||
|
$query->where('a.block = ' . (int) $state);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the model is set to check the activated state, add to the query.
|
||||||
|
$active = $this->getState('filter.active');
|
||||||
|
|
||||||
|
if (is_numeric($active))
|
||||||
|
{
|
||||||
|
if ($active == '0')
|
||||||
|
{
|
||||||
|
$query->where('a.activation IN (' . $db->quote('') . ', ' . $db->quote('0') . ')');
|
||||||
|
}
|
||||||
|
elseif ($active == '1')
|
||||||
|
{
|
||||||
|
$query->where($query->length('a.activation') . ' > 1');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter the items over the group id if set.
|
||||||
|
$groupId = $this->getState('filter.group_id');
|
||||||
|
$groups = $this->getState('filter.groups');
|
||||||
|
|
||||||
|
if ($groupId || isset($groups))
|
||||||
|
{
|
||||||
|
$query->join('LEFT', '#__user_usergroup_map AS map2 ON map2.user_id = a.id')
|
||||||
|
->group(
|
||||||
|
$db->quoteName(
|
||||||
|
array(
|
||||||
|
'a.id',
|
||||||
|
'a.name',
|
||||||
|
'a.username',
|
||||||
|
'a.password',
|
||||||
|
'a.block',
|
||||||
|
'a.sendEmail',
|
||||||
|
'a.registerDate',
|
||||||
|
'a.lastvisitDate',
|
||||||
|
'a.activation',
|
||||||
|
'a.params',
|
||||||
|
'a.email'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($groupId)
|
||||||
|
{
|
||||||
|
$query->where('map2.group_id = ' . (int) $groupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($groups))
|
||||||
|
{
|
||||||
|
$query->where('map2.group_id IN (' . implode(',', $groups) . ')');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter the items over the search string if set.
|
||||||
|
$search = $this->getState('filter.search');
|
||||||
|
|
||||||
|
if (!empty($search))
|
||||||
|
{
|
||||||
|
if (stripos($search, 'id:') === 0)
|
||||||
|
{
|
||||||
|
$query->where('a.id = ' . (int) substr($search, 3));
|
||||||
|
}
|
||||||
|
elseif (stripos($search, 'username:') === 0)
|
||||||
|
{
|
||||||
|
$search = $db->quote('%' . $db->escape(substr($search, 9), true) . '%');
|
||||||
|
$query->where('a.username LIKE ' . $search);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Escape the search token.
|
||||||
|
$search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%'));
|
||||||
|
|
||||||
|
// Compile the different search clauses.
|
||||||
|
$searches = array();
|
||||||
|
$searches[] = 'a.name LIKE ' . $search;
|
||||||
|
$searches[] = 'a.username LIKE ' . $search;
|
||||||
|
$searches[] = 'a.email LIKE ' . $search;
|
||||||
|
|
||||||
|
// Add the clauses to the query.
|
||||||
|
$query->where('(' . implode(' OR ', $searches) . ')');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add filter for registration ranges select list
|
||||||
|
$range = $this->getState('filter.range');
|
||||||
|
|
||||||
|
// Apply the range filter.
|
||||||
|
if ($range)
|
||||||
|
{
|
||||||
|
$dates = $this->buildDateRange($range);
|
||||||
|
|
||||||
|
if ($dates['dNow'] === false)
|
||||||
|
{
|
||||||
|
$query->where(
|
||||||
|
$db->qn('a.registerDate') . ' < ' . $db->quote($dates['dStart']->format('Y-m-d H:i:s'))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$query->where(
|
||||||
|
$db->qn('a.registerDate') . ' >= ' . $db->quote($dates['dStart']->format('Y-m-d H:i:s')) .
|
||||||
|
' AND ' . $db->qn('a.registerDate') . ' <= ' . $db->quote($dates['dNow']->format('Y-m-d H:i:s'))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add filter for registration ranges select list
|
||||||
|
$lastvisitrange = $this->getState('filter.lastvisitrange');
|
||||||
|
|
||||||
|
// Apply the range filter.
|
||||||
|
if ($lastvisitrange)
|
||||||
|
{
|
||||||
|
$dates = $this->buildDateRange($lastvisitrange);
|
||||||
|
|
||||||
|
if (is_string($dates['dStart']))
|
||||||
|
{
|
||||||
|
$query->where(
|
||||||
|
$db->qn('a.lastvisitDate') . ' = ' . $db->quote($dates['dStart'])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
elseif ($dates['dNow'] === false)
|
||||||
|
{
|
||||||
|
$query->where(
|
||||||
|
$db->qn('a.lastvisitDate') . ' < ' . $db->quote($dates['dStart']->format('Y-m-d H:i:s'))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$query->where(
|
||||||
|
$db->qn('a.lastvisitDate') . ' >= ' . $db->quote($dates['dStart']->format('Y-m-d H:i:s')) .
|
||||||
|
' AND ' . $db->qn('a.lastvisitDate') . ' <= ' . $db->quote($dates['dNow']->format('Y-m-d H:i:s'))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter by excluded users
|
||||||
|
$excluded = $this->getState('filter.excluded');
|
||||||
|
//$excluded= array('0) AND id IN (113,112');
|
||||||
|
|
||||||
|
if (!empty($excluded))
|
||||||
|
{
|
||||||
|
$query->where('id NOT IN (' . implode(',', $excluded) . ')');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the list ordering clause.
|
||||||
|
$query->order($db->qn($db->escape($this->getState('list.ordering', 'a.name'))) . ' ' . $db->escape($this->getState('list.direction', 'ASC')));
|
||||||
|
|
||||||
|
if($this->filter)
|
||||||
|
{
|
||||||
|
$session = JFactory::getSession();
|
||||||
|
$itemid=JFactory::getApplication()->input->get('Itemid','admin');
|
||||||
|
if(count(JFactory::getApplication()->input->post->getArray()))
|
||||||
|
$session->set('jsn_search_'.$itemid,JFactory::getApplication()->input->post->getArray());
|
||||||
|
elseif($session->get('jsn_search_'.$itemid,null)){
|
||||||
|
foreach($session->get('jsn_search_'.$itemid) as $key=>$value){
|
||||||
|
JFactory::getApplication()->input->set($key,$value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$query->join('left','#__jsn_users as b ON a.id=b.id');
|
||||||
|
|
||||||
|
if($this->filter) {
|
||||||
|
// Load Fields
|
||||||
|
$queryField = $db->getQuery(true);
|
||||||
|
$queryField->select('a.*')->from('#__jsn_fields AS a')->where('a.level = 2')->where('a.search = 1')->where('a.published = 1');
|
||||||
|
$db->setQuery( $queryField );
|
||||||
|
$fields = $db->loadObjectList();
|
||||||
|
|
||||||
|
foreach (glob(JPATH_ADMINISTRATOR . '/components/com_jsn/helpers/fields/*.php') as $filename) {
|
||||||
|
require_once $filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($fields as $field)
|
||||||
|
{
|
||||||
|
if(JFactory::getApplication()->input->get($field->alias,'','raw')!=''){
|
||||||
|
|
||||||
|
// Load Field Registry
|
||||||
|
$registry = new JRegistry;
|
||||||
|
$registry->loadString($field->params);
|
||||||
|
$field->params = $registry;
|
||||||
|
|
||||||
|
$class='Jsn'.ucfirst($field->type).'FieldHelper';
|
||||||
|
|
||||||
|
if(class_exists($class)) $class::getSearchQuery($field,$query);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
public $filter=true;
|
||||||
|
|
||||||
|
private function buildDateRange($range)
|
||||||
|
{
|
||||||
|
// Get UTC for now.
|
||||||
|
$dNow = new JDate;
|
||||||
|
$dStart = clone $dNow;
|
||||||
|
|
||||||
|
switch ($range)
|
||||||
|
{
|
||||||
|
case 'past_week':
|
||||||
|
$dStart->modify('-7 day');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'past_1month':
|
||||||
|
$dStart->modify('-1 month');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'past_3month':
|
||||||
|
$dStart->modify('-3 month');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'past_6month':
|
||||||
|
$dStart->modify('-6 month');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'post_year':
|
||||||
|
$dNow = false;
|
||||||
|
case 'past_year':
|
||||||
|
$dStart->modify('-1 year');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'today':
|
||||||
|
// Ranges that need to align with local 'days' need special treatment.
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$offset = $app->get('offset');
|
||||||
|
|
||||||
|
// Reset the start time to be the beginning of today, local time.
|
||||||
|
$dStart = new JDate('now', $offset);
|
||||||
|
$dStart->setTime(0, 0, 0);
|
||||||
|
|
||||||
|
// Now change the timezone back to UTC.
|
||||||
|
$tz = new DateTimeZone('GMT');
|
||||||
|
$dStart->setTimezone($tz);
|
||||||
|
break;
|
||||||
|
case 'never':
|
||||||
|
$dNow = false;
|
||||||
|
$dStart = $this->_db->getNullDate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return array('dNow' => $dNow, 'dStart' => $dStart);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,77 @@
|
|||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `#__jsn_fields` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`parent_id` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`lft` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`rgt` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`level` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`path` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`title` varchar(255) NOT NULL,
|
||||||
|
`alias` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||||
|
`note` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`description` mediumtext NOT NULL,
|
||||||
|
`published` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
|
||||||
|
`type` varchar(255) NOT NULL,
|
||||||
|
`core` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`required` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`profile` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`edit` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`register` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`search` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
|
||||||
|
`checked_out` int(11) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`access` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`accessview` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`params` text NOT NULL,
|
||||||
|
`conditions` text NOT NULL,
|
||||||
|
`metadesc` varchar(1024) NOT NULL COMMENT 'The meta description for the page.',
|
||||||
|
`metakey` varchar(1024) NOT NULL COMMENT 'The meta keywords for the page.',
|
||||||
|
`metadata` varchar(2048) NOT NULL COMMENT 'JSON encoded metadata properties.',
|
||||||
|
`created_user_id` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`created_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`created_by_alias` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`modified_user_id` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`modified_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`images` text NOT NULL,
|
||||||
|
`urls` text NOT NULL,
|
||||||
|
`hits` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`language` char(7) NOT NULL,
|
||||||
|
`version` int(10) unsigned NOT NULL DEFAULT '1',
|
||||||
|
`publish_up` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`publish_down` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `#__jsn_users` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`privacy` TEXT NOT NULL,
|
||||||
|
`firstname` varchar(255) NOT NULL,
|
||||||
|
`secondname` varchar(255) NOT NULL,
|
||||||
|
`lastname` varchar(255) NOT NULL,
|
||||||
|
`avatar` varchar(255) NOT NULL,
|
||||||
|
`params` TEXT NOT NULL,
|
||||||
|
`facebook_id` varchar(255) NOT NULL,
|
||||||
|
`twitter_id` varchar(255) NOT NULL,
|
||||||
|
`google_id` varchar(255) NOT NULL,
|
||||||
|
`linkedin_id` varchar(255) NOT NULL,
|
||||||
|
`instagram_id` varchar(255) NOT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
|
||||||
|
|
||||||
|
INSERT IGNORE INTO #__jsn_fields(`id`,`parent_id`,`level`,`title`,`alias`,`path`,`type`,`published`,`core`,`required`,`profile`,`register`,`lft`,`rgt`,`access`,`params`,`edit`,`accessview`) VALUES
|
||||||
|
(1,0,0,'ROOT','root','','',1,0,0,0,0, 0,21,1, '', 0,1),
|
||||||
|
(2,1,1,'DETAILS','default','default','',1,1,0,0,0, 1,20,1, '', 0,1),
|
||||||
|
(3,2,2,'USERNAME','username','default/username','username',1,1,1,1,1, 2,3,1, '', 1,1),
|
||||||
|
(4,2,2,'NAME','firstname','default/firstname','text',1,1,2,1,1, 4,5,1, '', 1,1),
|
||||||
|
(5,2,2,'SECONDNAME','secondname','default/secondname','text',0,1,0,1,1, 6,7,1, '', 1,1),
|
||||||
|
(6,2,2,'LASTNAME','lastname','default/lastname','text',1,1,2,1,1, 8,9,1, '', 1,1),
|
||||||
|
(7,2,2,'EMAIL','email','default/email','usermail',1,1,1,1,1, 10,11,1, '', 1,1),
|
||||||
|
(8,2,2,'PASSWORD','password','default/password','password',1,1,1,1,1, 12,13,1, '', 1,1),
|
||||||
|
(9,2,2,'AVATAR','avatar','default/avatar','image',1,1,0,1,1, 14,15,1,'{"image_width":500,"image_height":500,"image_thumbwidth":100,"image_thumbheight":100,"image_alt":"Avatar","image_class":""}', 1,1),
|
||||||
|
(10,2,2,'REGISTEREDDATE','registerdate','default/registerdate','registerdate',1,1,0,1,0, 16,17,1, '', 0,1),
|
||||||
|
(11,2,2,'LASTVISITDATE','lastvisitdate','default/lastvisitdate','lastvisitdate',1,1,0,1,0, 18,19,1, '', 0,1);
|
||||||
|
|
||||||
|
UPDATE #__extensions SET ordering=1 WHERE name LIKE 'plg_authentication_joomla' OR name LIKE 'plg_user_profile';
|
||||||
@ -0,0 +1,122 @@
|
|||||||
|
-- DROP TABLE IF EXISTS `#__jsn_fields`;
|
||||||
|
DROP TABLE IF EXISTS `#__jsn_usertypes`;
|
||||||
|
-- DROP TABLE IF EXISTS `#__jsn_users`;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `#__jsn_fields` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`parent_id` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`lft` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`rgt` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`level` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`path` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`title` varchar(255) NOT NULL,
|
||||||
|
`alias` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||||
|
`note` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`description` mediumtext NOT NULL,
|
||||||
|
`published` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
|
||||||
|
`type` varchar(255) NOT NULL,
|
||||||
|
`core` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`required` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`profile` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`register` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
|
||||||
|
`checked_out` int(11) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`access` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`params` text NOT NULL,
|
||||||
|
`metadesc` varchar(1024) NOT NULL COMMENT 'The meta description for the page.',
|
||||||
|
`metakey` varchar(1024) NOT NULL COMMENT 'The meta keywords for the page.',
|
||||||
|
`metadata` varchar(2048) NOT NULL COMMENT 'JSON encoded metadata properties.',
|
||||||
|
`created_user_id` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`created_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`created_by_alias` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`modified_user_id` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`modified_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`images` text NOT NULL,
|
||||||
|
`urls` text NOT NULL,
|
||||||
|
`hits` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`language` char(7) NOT NULL,
|
||||||
|
`version` int(10) unsigned NOT NULL DEFAULT '1',
|
||||||
|
`publish_up` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`publish_down` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `field_idx` (`published`,`access`),
|
||||||
|
KEY `idx_access` (`access`),
|
||||||
|
KEY `idx_checkout` (`checked_out`),
|
||||||
|
KEY `idx_path` (`path`),
|
||||||
|
KEY `idx_left_right` (`lft`,`rgt`),
|
||||||
|
KEY `idx_alias` (`alias`),
|
||||||
|
KEY `idx_language` (`language`)
|
||||||
|
) DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
/*CREATE TABLE IF NOT EXISTS `#__jsn_usertypes` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`parent_id` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`lft` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`rgt` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`level` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`path` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`title` varchar(255) NOT NULL,
|
||||||
|
`alias` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||||
|
`note` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`description` mediumtext NOT NULL,
|
||||||
|
`published` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`checked_out` int(11) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`access` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`params` text NOT NULL,
|
||||||
|
`metadesc` varchar(1024) NOT NULL COMMENT 'The meta description for the page.',
|
||||||
|
`metakey` varchar(1024) NOT NULL COMMENT 'The meta keywords for the page.',
|
||||||
|
`metadata` varchar(2048) NOT NULL COMMENT 'JSON encoded metadata properties.',
|
||||||
|
`created_user_id` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`created_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`created_by_alias` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`modified_user_id` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`modified_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`images` text NOT NULL,
|
||||||
|
`urls` text NOT NULL,
|
||||||
|
`hits` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`language` char(7) NOT NULL,
|
||||||
|
`version` int(10) unsigned NOT NULL DEFAULT '1',
|
||||||
|
`publish_up` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`publish_down` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `usertype_idx` (`published`,`access`),
|
||||||
|
KEY `idx_access` (`access`),
|
||||||
|
KEY `idx_checkout` (`checked_out`),
|
||||||
|
KEY `idx_path` (`path`),
|
||||||
|
KEY `idx_left_right` (`lft`,`rgt`),
|
||||||
|
KEY `idx_alias` (`alias`),
|
||||||
|
KEY `idx_language` (`language`)
|
||||||
|
) DEFAULT CHARSET=utf8;*/
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `#__jsn_users` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`privacy` TEXT NOT NULL DEFAULT '',
|
||||||
|
`firstname` varchar(255) NOT NULL,
|
||||||
|
`secondname` varchar(255) NOT NULL,
|
||||||
|
`lastname` varchar(255) NOT NULL,
|
||||||
|
`avatar` varchar(255) NOT NULL,
|
||||||
|
`params` TEXT NOT NULL DEFAULT '',
|
||||||
|
`facebook_id` varchar(255) NOT NULL,
|
||||||
|
`twitter_id` varchar(255) NOT NULL,
|
||||||
|
`google_id` varchar(255) NOT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
INSERT IGNORE INTO #__jsn_fields(`id`,`parent_id`,`level`,`title`,`alias`,`path`,`type`,`published`,`core`,`required`,`profile`,`register`,`lft`,`rgt`,`access`,`params`) VALUES
|
||||||
|
(1,0,0,'ROOT','root','','',0,0,0,0,0, 0,21,1, ''),
|
||||||
|
(2,1,1,'DETAILS','default','default','',1,1,0,0,0, 1,20,1, ''),
|
||||||
|
(3,2,2,'USERNAME','username','default/username','username',1,1,1,1,1, 2,3,1, ''),
|
||||||
|
(4,2,2,'NAME','firstname','default/firstname','text',1,1,1,1,1, 4,5,1, ''),
|
||||||
|
(5,2,2,'SECONDNAME','secondname','default/secondname','text',0,1,0,1,1, 6,7,1, ''),
|
||||||
|
(6,2,2,'LASTNAME','lastname','default/lastname','text',1,1,1,1,1, 8,9,1, ''),
|
||||||
|
(7,2,2,'EMAIL','email','default/email','usermail',1,1,1,1,1, 10,11,1, ''),
|
||||||
|
(8,2,2,'PASSWORD','password','default/password','password',1,1,1,1,1, 12,13,1, ''),
|
||||||
|
(9,2,2,'AVATAR','avatar','default/avatar','image',1,1,0,1,1, 14,15,1,'{"image_width":200,"image_height":200,"image_thumbwidth":50,"image_thumbheight":50,"image_alt":"Avatar","image_class":"img-circle"}'),
|
||||||
|
(10,2,2,'REGISTEREDDATE','registereddate','default/registereddate','registerdate',1,1,0,1,0, 16,17,1, ''),
|
||||||
|
(11,2,2,'LASTVISITDATE','lastvisitdate','default/lastvisitdate','lastvisitdate',1,1,0,1,0, 18,19,1, '');
|
||||||
|
|
||||||
|
/*INSERT IGNORE INTO #__jsn_usertypes(`id`,`parent_id`,`level`,`title`,`alias`,`path`,`published`,`lft`,`rgt`,`access`) VALUES
|
||||||
|
(1,0,0,'ROOT','root','',0, 0,21,1);*/
|
||||||
253
deployed/jsn/administrator/components/com_jsn/tables/field.php
Normal file
253
deployed/jsn/administrator/components/com_jsn/tables/field.php
Normal file
@ -0,0 +1,253 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2013 Jsn Project company. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||||
|
* @package Easy Profile
|
||||||
|
* website www.easy-profile.com
|
||||||
|
* Technical Support : Forum - http://www.easy-profile.com/support.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
|
||||||
|
class JsnTableField extends JTableNested
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param JDatabaseDriver A database connector object
|
||||||
|
*/
|
||||||
|
public function __construct($db)
|
||||||
|
{
|
||||||
|
parent::__construct('#__jsn_fields', 'id', $db);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overloaded bind function
|
||||||
|
*
|
||||||
|
* @param array $array Named array
|
||||||
|
* @param mixed $ignore An optional array or space separated list of properties
|
||||||
|
* to ignore while binding.
|
||||||
|
*
|
||||||
|
* @return mixed Null if operation was satisfactory, otherwise returns an error string
|
||||||
|
*
|
||||||
|
* @see JTable::bind
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
public function bind($array, $ignore = '')
|
||||||
|
{
|
||||||
|
if (isset($array['params']) && is_array($array['params']))
|
||||||
|
{
|
||||||
|
$registry = new JRegistry;
|
||||||
|
$registry->loadArray($array['params']);
|
||||||
|
$array['params'] = (string) $registry;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($array['metadata']) && is_array($array['metadata']))
|
||||||
|
{
|
||||||
|
$registry = new JRegistry;
|
||||||
|
$registry->loadArray($array['metadata']);
|
||||||
|
$array['metadata'] = (string) $registry;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($array['images']) && is_array($array['images']))
|
||||||
|
{
|
||||||
|
$registry = new JRegistry;
|
||||||
|
$registry->loadArray($array['images']);
|
||||||
|
$array['images'] = (string) $registry;
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::bind($array, $ignore);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overloaded check method to ensure data integrity.
|
||||||
|
*
|
||||||
|
* @return boolean True on success.
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
* @throws UnexpectedValueException
|
||||||
|
*/
|
||||||
|
public function check()
|
||||||
|
{
|
||||||
|
// Check for valid name.
|
||||||
|
if (trim($this->title) == '')
|
||||||
|
{
|
||||||
|
throw new UnexpectedValueException(sprintf('The title is empty'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($this->alias))
|
||||||
|
{
|
||||||
|
$this->alias = $this->title;
|
||||||
|
}
|
||||||
|
if($this->id==0)
|
||||||
|
{
|
||||||
|
if(strlen($this->alias)>40) $this->alias=substr($this->alias,0,40);
|
||||||
|
|
||||||
|
$this->alias = str_replace('-','_',JApplication::stringURLSafe($this->alias));
|
||||||
|
if (trim(str_replace('-', '', $this->alias)) == '' || preg_match('/^[a-zA-Z0-9_]*$/', $this->alias) == false || is_numeric($this->alias))
|
||||||
|
{
|
||||||
|
$this->alias = 'field_'.JDate::getInstance()->format("YmdHis");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Check the publish down date is not earlier than publish up.
|
||||||
|
if ((int) $this->publish_down > 0 && $this->publish_down < $this->publish_up)
|
||||||
|
{
|
||||||
|
throw new UnexpectedValueException(sprintf('End publish date is before start publish date.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clean up keywords -- eliminate extra spaces between phrases
|
||||||
|
// and cr (\r) and lf (\n) characters from string
|
||||||
|
if (!empty($this->metakey))
|
||||||
|
{
|
||||||
|
// Only process if not empty
|
||||||
|
// Define array of characters to remove
|
||||||
|
$bad_characters = array("\n", "\r", "\"", "<", ">");
|
||||||
|
// Remove bad characters
|
||||||
|
$after_clean = JString::str_ireplace($bad_characters, "", $this->metakey);
|
||||||
|
|
||||||
|
// Create array using commas as delimiter
|
||||||
|
$keys = explode(',', $after_clean);
|
||||||
|
$clean_keys = array();
|
||||||
|
foreach($keys as $key)
|
||||||
|
{
|
||||||
|
if (trim($key))
|
||||||
|
{
|
||||||
|
// Ignore blank keywords
|
||||||
|
$clean_keys[] = trim($key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Put array back together delimited by ", "
|
||||||
|
$this->metakey = implode(", ", $clean_keys);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clean up description -- eliminate quotes and <> brackets
|
||||||
|
if (!empty($this->metadesc)) {
|
||||||
|
// Only process if not empty
|
||||||
|
$bad_characters = array("\"", "<", ">");
|
||||||
|
$this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overriden JTable::store to set modified data and user id.
|
||||||
|
*
|
||||||
|
* @param boolean $updateNulls True to update fields even if they are null.
|
||||||
|
*
|
||||||
|
* @return boolean True on success.
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
public function store($updateNulls = false)
|
||||||
|
{
|
||||||
|
$date = JDate::getInstance();
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
if ($this->id) {
|
||||||
|
// Existing item
|
||||||
|
$this->modified_time = $date->toSql();
|
||||||
|
$this->modified_user_id = $user->get('id');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// New field. A field created and created_by field can be set by the user,
|
||||||
|
// so we don't touch either of these if they are set.
|
||||||
|
if (!(int) $this->created_time) {
|
||||||
|
$this->created_time = $date->toSql();
|
||||||
|
}
|
||||||
|
if (empty($this->created_user_id)) {
|
||||||
|
$this->created_user_id = $user->get('id');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify that the alias is unique
|
||||||
|
$table = JTable::getInstance('Field', 'JsnTable');
|
||||||
|
if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
|
||||||
|
{
|
||||||
|
$this->setError(JText::_('COM_JSN_ERROR_UNIQUE_ALIAS'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return parent::store($updateNulls);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to delete a node and, optionally, its child nodes from the table.
|
||||||
|
*
|
||||||
|
* @param integer $pk The primary key of the node to delete.
|
||||||
|
* @param boolean $children True to delete child nodes, false to move them up a level.
|
||||||
|
*
|
||||||
|
* @return boolean True on success.
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
* @see http://docs.joomla.org/JTableNested/delete
|
||||||
|
*/
|
||||||
|
public function delete($pk = null, $children = false)
|
||||||
|
{
|
||||||
|
return parent::delete($pk, $children);
|
||||||
|
$helper = new JHelperFields;
|
||||||
|
$helper->fieldDeleteInstances($pk);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function toggle($pks = null, $state = 1, $userId = 0, $nameField)
|
||||||
|
{
|
||||||
|
$k = $this->_tbl_key;
|
||||||
|
|
||||||
|
// Sanitize input.
|
||||||
|
JArrayHelper::toInteger($pks);
|
||||||
|
$userId = (int) $userId;
|
||||||
|
$state = (int) $state;
|
||||||
|
|
||||||
|
// If there are no primary keys set check to see if the instance key is set.
|
||||||
|
if (empty($pks))
|
||||||
|
{
|
||||||
|
if ($this->$k)
|
||||||
|
{
|
||||||
|
$pks = array($this->$k);
|
||||||
|
}
|
||||||
|
// Nothing to set publishing state on, return false.
|
||||||
|
else {
|
||||||
|
$this->setError(JText::_('JLIB_DATABASE_ERROR_NO_ROWS_SELECTED'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get an instance of the table
|
||||||
|
$table = JTable::getInstance('Field', 'JsnTable');
|
||||||
|
|
||||||
|
// For all keys
|
||||||
|
foreach ($pks as $pk)
|
||||||
|
{
|
||||||
|
// Load the banner
|
||||||
|
if (!$table->load($pk))
|
||||||
|
{
|
||||||
|
$this->setError($table->getError());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify checkout
|
||||||
|
if ($table->checked_out == 0 || $table->checked_out == $userId)
|
||||||
|
{
|
||||||
|
// Change the state
|
||||||
|
$table->$nameField = $state;
|
||||||
|
$table->checked_out = 0;
|
||||||
|
$table->checked_out_time = $this->_db->getNullDate();
|
||||||
|
|
||||||
|
// Check the row
|
||||||
|
$table->check();
|
||||||
|
|
||||||
|
// Store the row
|
||||||
|
if (!$table->store())
|
||||||
|
{
|
||||||
|
$this->setError($table->getError());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count($this->getErrors()) == 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user