AnonSec Shell
Server IP : 54.36.91.62  /  Your IP : 216.73.217.117
Web Server : Apache
System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User : coopiak ( 151928)
PHP Version : 8.3.23
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/coopiak/amisdesseniors-fr/media/jlexreview/assets/profile/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/amisdesseniors-fr/media/jlexreview/assets/profile/script.js
function JReviewProfile($, config, request)
{
	var _this = this;
		this.state = {
			uid 	: config.uid,
			sort 	: 'desc',
			filter 	: 'all'
		};

	this.helper = {
		url : function(params)
		{
			return request
					+ (request.indexOf('?')==-1?'?':'&')
					+ $.param (params);
		}
	};

	this.dialog = function (options)
	{
		var _dialog = this,
			settings = 
			{
				caption 	: 'Dialog',
				submitLabel : 'Submit',
				cancelLabel : 'Cancel',
				content 	: '',
				loadfn 		: null,
				submitfn 	: null,
				cancelfn 	: null
			};

		if (typeof options=='object') $.extend (settings, options);

		_dialog.init = function ()
		{
			var html = '<div class="jreview-overlay">';
					html+= '<div class="jreview-dialog">';
						html+= '<div class="jreview-dg-caption">'+settings.caption+'</div>';
						html+= '<div class="jreview-dg-error"></div>';
						html+= '<div class="jreview-dg-content">'+settings.content+'</div>';
						html+= '<div class="jreview-dg-footer">';
							if (settings.submitLabel!==false)
							{
								html+= '<button class="jreview-dg-submit">'+settings.submitLabel+'</button>';
							}
							html+= '<button class="jreview-dg-cancel">'+settings.cancelLabel+'</button>';
						html+= '</div>';
					html+= '</div>';
				html+= '</div>';
			_dialog.el = $(html);
			_dialog.el.appendTo ('body');

			// events
			if (typeof settings.loadfn=='function')
				settings.loadfn (_dialog);

			_dialog.el.on ('click', '.jreview-dg-submit', function() {
				if (typeof settings.submitfn=='function')
					settings.submitfn (_dialog);
			});

			_dialog.el.on ('click', '.jreview-dg-cancel', function() {
				if (typeof settings.cancelfn=='function')
				{
					var rn = settings.cancelfn (_dialog);
					if (rn!==false)
					{
						_dialog.off ();
					}
				} else {
					_dialog.off ();
				}
			});

			var resizeEvent = function ()
			{
				if (! $('.jreview-dialog').length)
				{
					return false;
				}

				var widthOfScreen = $(window).width (),
					heightOfScreen = $(window).width ();

				if (widthOfScreen <= 450)
				{
					_dialog.el.find ('.jreview-dialog')
								.removeClass ('wide touch')
								.removeAttr ('style')
								.addClass ('touch');

					$('html,body').addClass ('disableScroll');
				} else {
					_dialog.el.find ('.jreview-dialog')
								.removeClass ('wide touch')
								.removeAttr ('style')
								.addClass ('wide');

					var widthOfdialog = widthOfScreen > 650 ? 600 : (widthOfScreen-40),
						left = (widthOfScreen - widthOfdialog) / 2,
						maxHeight = heightOfScreen - 50 - 30; // 30 is top possition.

					_dialog.el.find ('.jreview-dialog').css ({
						width: widthOfdialog + 'px',
						left : left + 'px',
						'max-height' : maxHeight + 'px'
					});

					$('html,body').removeClass ('disableScroll');
				}
			}

			resizeEvent ();
			$(window).resize (function(){
				resizeEvent ();
			});
		};

		_dialog.off = function ()
		{
			_dialog.el.off ();
			_dialog.el.fadeOut ('fast', function (){
				$(this).remove ();
				$('html,body').removeClass ('disableScroll');
			});
		};

		_dialog.setError = function (msg)
		{
			_dialog.el.find ('.jreview-dg-error')
				.addClass('active').html (msg);
		};

		_dialog.clearError = function ()
		{
			_dialog.el.find ('.jreview-dg-error')
				.removeClass('active').html ('');
		};

		_dialog.overlay = function ()
		{
			if (!_dialog.el.find('.jreview-dg-overlay').length)
			{
				_dialog.el.find('.jreview-dg-content').append ('<div class="jreview-dg-overlay"></div>');
				_dialog.el.find('button').attr ('disabled', 'disabled');
			}
		};

		_dialog.unOverlay = function ()
		{
			_dialog.el.find('.jreview-dg-overlay').remove ();
			_dialog.el.find('button').removeAttr ('disabled');
		};

		_dialog.init ();
	};

	this.events = function()
	{
		// change avatar
		if ($('#reviewer-detail button._change_avatar').length)
		{
			var _btn = $('#reviewer-detail button._change_avatar'),
				_btnText = _btn.text();
			_btn.click(function(e){
				e.preventDefault();

				if (_btn.hasClass('disabled'))
				{
					return;
				}

				var _el = $('<input type="file" name="file" />');
				_el.change(function(evt){
					if (evt.target.files.length!=1) return false;

					if ( typeof FormData=='undefined')
					{
						// not support HTML 5
						alert ("This feature couldn't run in your browser. Please update your browser to latest version.");
						return;
					}

					var data = new FormData();
					data.append('file', evt.target.files[0]);

					_btn.addClass('disabled');
					_btn.text('Please wait...');

					var xhr = $.ajax({
								url: _this.helper.url ({view:'profile', task:'thumb'}),
								data: data,
								processData: false,
								contentType: false,
								dataType: 'json',
								xhr: function() {
									var xhrobj = $.ajaxSettings.xhr();
									if (xhrobj.upload) {
								        xhrobj.upload.addEventListener('progress', function(event) {
								            	var percent = 0;
								            	var position = event.loaded || event.position;
								            	var total = event.total;
									            if (event.lengthComputable) {
									                percent = Math.ceil(position / total * 100);
									            }
								        }, false);
								    }
									return xhrobj;
								},
								type: 'POST',
								success: function(d){
									_btn.removeClass('disabled');
									if (d.status==200)
									{
										location.reload();
									} else {
										_btn.text(_btnText);
										alert(d.error);
									}
								},
								error: function(xhr, ajaxOptions, thrownError){
									_btn.removeClass('disabled');
									_btn.text(_btnText);
									alert("JSON couldn't load.");
								}
							});
				});

				_el.trigger("click");
			});
		}

		// filter/sorting tools
		$('#reviewer-detail ._tool_item span').click(function(){
			var _el 	= $(this),
				_action = _el.attr('data-action'),
				_value 	= _el.attr('data-value');

			if (_el.hasClass('active'))
			{
				return;
			}

			_el.addClass('active');
			$('#reviewer-detail ._tool_item span[data-action='+_action+']').not(_el).removeClass('active');

			_this.state[_action] = _value;
			_this.getComments(0);
		});

		// following
		$('#reviewer-detail ._follow_btn').click(function(){
			var _el = $(this);

			if (_el.hasClass('disabled'))
			{
				return;
			}

			if (_el.hasClass('active'))
			{
				// unfollow
				_el.addClass('disabled');
				$.post(_this.helper.url({view:'profile', task:'unsubscribe'}), {type:0, id:config.uid}, function(d){
					_el.removeClass('disabled');
					if (d.status==200)
					{
						_el.removeClass('active');
						_el.text('Follow');
					} else {
						alert(d.error);
					}
				}, 'json');

				return;
			}

			if (config.member==0)
			{
				if (config.allow==1)
				{
					// for guest
					var html = '<div class="input-group">';
							html+= '<label>Name</label>';
							html+= '<input type="text" name="guest_name" />';
						html+= '</div>';
						html+= '<div class="input-group">';
							html+= '<label>Email</label>';
							html+= '<input type="email" name="guest_email" />';
						html+= '</div>';

					var followDialog = new _this.dialog({
							caption : 'One step to follow',
							content : html,
							loadfn: function(dialog)
							{
								dialog.el.find('input[type=text]:eq(0)').focus();
							},
							submitfn : function(dialog)
							{
								var _name  = dialog.el.find('input[name=guest_name]'),
									_email = dialog.el.find('input[name=guest_email]');

								if (/^\s*$/.test(_name.val()))
								{
									_name.focus();
									return;
								}

								if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(_email.val()))
								{
									_email.focus();
									return;
								}

								$.post(_this.helper.url({view:'profile', task:'subscribe'}), {name:_name.val(), email:_email.val(), id:config.uid, type:0}, function(d){
									if (d.status==200)
									{
										_el.addClass('active');
										_el.text('Following');
										dialog.off();
									} else {
										dialog.setError(d.error);
									}
								}, 'json');
							}
						});

				} else {
					// show login form
					var html = '<div class="input-group">';
							html+= '<label>Username</label>';
							html+= '<input type="text" name="username" />';
						html+= '</div>';
						html+= '<div class="input-group">';
							html+= '<label>Password</label>';
							html+= '<input type="password" name="password" />';
						html+= '</div>';

					var loginDialog = new _this.dialog({
							caption : 'Login',
							content : html,
							submitLabel : 'Login',
							loadfn: function(dialog)
							{
								dialog.setError('You must login first.');
								dialog.el.find('input[type=text]:eq(0)').focus();
							},
							submitfn : function(dialog)
							{

							}
						});
				}
			} else {
				if (config.allow==0)
				{
					_el.addClass('disabled');
				} else {
					_el.addClass('disabled');
					$.post(_this.helper.url({view:'profile', task:'subscribe'}), {id:config.uid, type:0}, function(d){
						_el.removeClass('disabled');
						if (d.status==200)
						{
							_el.addClass('active');
							_el.text('Following');
						} else {
							alert(d.error);
						}
					}, 'json');
				}
			}
		});
	};

	this.getComments = function(offset, callback)
	{
		$.get(_this.helper.url({view:'profile',task:'activity',offset:offset}), _this.state, function(d){
			if (d.status==400)
			{
				console.log(d.error);
			} else {
				var html = '';
				$.each(d.data.activities, function(k,v){
					html+= '<div class="jreview-act-item">';
						html+= '<span class="_date" data-time="'+v.created+'">'+v.date_format+'</span>';
						html+= '<span class="_author">'+config.name+'</span>';
						html+= '<span class="_action">'+(v.rtype==1?config.lang.rating_act_text:config.lang.comment_act_text)+'</span>';
						html+= 'in <a href="'+v.url+'">'+v.object_name+'</a>';
						if (v.caption!=null && !/^\s*$/.test(v.caption))
						{
							html+= '<div class="_quote">'+v.caption+'</div>';
						}
					html+= '</div>';
				});

				if (offset==0)
				{
					$('#reviewer-posts').empty();
				}

				$('#reviewer-posts').append(html);

				// create pagination
				$('#reviewer-posts ._pagination').remove();
				if (d.data.offset*1+d.data.limit*1<d.data.total*1)
				{
					$('#reviewer-posts').append('<a class="_pagination">Load more</a>');
					$('#reviewer-posts ._pagination').click(function(){
						var _el = $(this);

						if (_el.hasClass('disabled'))
						{
							return;
						}

						_el.addClass('disabled');
						_el.text('Please wait...');
						_this.getComments(d.data.offset*1+d.data.limit*1);
					});
				}
			}

			if (typeof callback=='function')
			{
				callback();
			}
		}, "json");
	};

	this.init = function()
	{
		_this.events();
		_this.getComments(0);
	};
}

Anon7 - 2022
AnonSec Team