Тема: Вопрос Вопросы по vBulletin
Показать сообщение отдельно
Старый 15.06.2010, 21:05 Вверх   #1481
Пользователь
 
Аватар для paul
paul вне форума
Доп. информация
По умолчанию

Вообщем, может, кто поможет. У меня стоит чат vBShout 2.1.
Дело в том, что пользователи в архиве могут удалять и править свои сообщения. Надо бы оставить такую возможность только для администраторов.
Вот вырвал код из .xml файла:
_ShoutControl.prototype.Delete = function (shoutid)
{
if (!this.active)
{
if (confirm('Are you sure to want to delete this shout message?'))
{
return this.DoDelete(shoutid)
}
}

return false
}

_ShoutControl.prototype.DoDelete = function (shoutid)
{
this.active = true
this.shoutid = shoutid

doDel = new vB_AJAX_Handler(true)
doDel.onreadystatechange(DeleteDone)
doDel.send('vbshout.php', 'do=deleteshout&id=' + this.shoutid)

return false
}

_ShoutControl.prototype.Edit = function (shoutid)
{
if (shoutid != this.shoutid)
{
if (this.active)
{
this.cancelActive(this.shoutid)
}

this.active = true
this.shoutid = shoutid

// Activate Editor
fetch_object('shout_message_edit_' + this.shoutid).style.display = ''
fetch_object('shout_message_' + this.shoutid).style.display = 'none'
}

return false
}

_ShoutControl.prototype.cancelActive = function (shoutid)
{
// Deactivate Editor
fetch_object('shout_message_edit_' + this.shoutid).style.display = 'none'
fetch_object('shout_message_' + this.shoutid).style.display = ''
return false
}

_ShoutControl.prototype.Save = function ()
{
if (this.active)
{
doShout = new vB_AJAX_Handler(true)
doShout.onreadystatechange(SaveDone)

if (postingShout)
{
alert('Posting in progress..')
return false
}

ShoutMsg = fetch_object('shout_message_editor_' + this.shoutid).value

if (ShoutMsg.replace(/ /g, '') == '')
{
alert('You must enter a shout!')
return false
}

doShout.send('vbshout.php', 'do=editshout&id=' + this.shoutid + '&shout=' + PHP.urlencode(ShoutMsg))
postingShout = true
}

return false
}

Shout = new _ShoutControl

function SaveDone()
{
if (doShout.handler.readyState == 4 && doShout.handler.status == 200)
{
postingShout = false
Shout.active = false
Shout.cancelActive(Shout.shoutid)
fetch_object('shout_message_' + Shout.shoutid).innerHTML = doShout.handler.responseText
Shout.shoutid = -1
}
}

function DeleteDone()
{
  Ответить с цитированием
 
Время генерации страницы 0.14999 секунды с 9 запросами