Модуль Опросы | Голосование v1.26.1a
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
3.2 KiB

<?php
if(!defined('BASE_DIR')) exit;
if (defined('ACP'))
{
$modul['ModuleName'] = 'Опросы';
$modul['ModuleSysName'] = 'poll';
$modul['ModuleVersion'] = '1.1a';
$modul['ModuleDescription'] = 'Данный модуль предназачен для организации системы опросов на сайте. Возможности модуля позволяют создавать неограниченное количество опросных листов, а также неограниченное количество вопросов.';
$modul['ModuleAutor'] = 'AVE.CMS Team';
$modul['ModuleCopyright'] = '&copy; 2007-2013 AVE.CMS';
$modul['ModuleIsFunction'] = 1;
$modul['ModuleTemplate'] = 1;
$modul['ModuleAdminEdit'] = 1;
$modul['ModuleFunction'] = 'mod_poll';
$modul['ModuleTag'] = '[mod_poll:XXX]';
$modul['ModuleTagLink'] = null;
$modul['ModuleAveTag'] = '#\\\[mod_poll:(\\\d+)]#';
$modul['ModulePHPTag'] = "<?php mod_poll(''$1''); ?>";
}
function mod_poll($poll_id)
{
require_once(BASE_DIR . '/modules/poll/class.poll.php');
require_once(BASE_DIR . '/modules/poll/funcs/func.rewrite.php');
$poll = new Poll;
$tpl_dir = BASE_DIR . '/modules/poll/templates/';
$lang_file = BASE_DIR . '/modules/poll/lang/' . $_SESSION['user_language'] . '.txt';
$poll->pollShow($tpl_dir, $lang_file, stripslashes($poll_id));
}
if (!defined('ACP')
&& isset($_REQUEST['module']) && $_REQUEST['module'] == 'poll'
&& isset($_REQUEST['action']))
{
require_once(BASE_DIR . '/modules/poll/class.poll.php');
require_once(BASE_DIR . '/modules/poll/funcs/func.rewrite.php');
$poll = new Poll;
$tpl_dir = BASE_DIR . '/modules/poll/templates/';
$lang_file = BASE_DIR . '/modules/poll/lang/' . $_SESSION['user_language'] . '.txt';
switch ($_REQUEST['action'])
{
case 'result':
$poll->pollResultShow($tpl_dir, $lang_file, (int)$_REQUEST['pid']);
break;
case 'vote':
$poll->pollVote((int)$_REQUEST['pid']);
break;
case 'archive':
$poll->pollArchiveShow($tpl_dir, $lang_file);
break;
case 'form':
$poll->pollCommentShow($tpl_dir, $lang_file, (int)$_REQUEST['pid'], THEME_FOLDER);
break;
case 'comment':
$poll->pollCommentNew($tpl_dir, $lang_file, (int)$_REQUEST['pid']);
break;
}
}
if (defined('ACP') && !empty($_REQUEST['moduleaction']))
{
require_once(BASE_DIR . '/modules/poll/class.poll.php');
require_once(BASE_DIR . '/modules/poll/funcs/func.rewrite.php');
$poll = new Poll;
$adm_dir = BASE_DIR . '/modules/poll/admin/';
$lang_file = BASE_DIR . '/modules/poll/lang/' . $_SESSION['user_language'] . '.txt';
switch ($_REQUEST['moduleaction'])
{
case '1':
$poll->pollList($adm_dir, $lang_file);
break;
case 'new':
$poll->pollNew($adm_dir, $lang_file);
break;
case 'save_new':
$poll->pollNewItemSave((int)$_REQUEST['id']);
break;
case 'edit':
$poll->pollEdit($adm_dir, $lang_file, (int)$_REQUEST['id']);
break;
case 'save':
$poll->pollSave((int)$_REQUEST['id']);
break;
case 'delete':
$poll->pollDelete((int)$_REQUEST['id']);
break;
case 'comments':
$poll->pollCommentEdit($adm_dir, $lang_file, (int)$_REQUEST['id']);
break;
case 'sort':
$poll->pollSort((array)$_REQUEST['sort']);
exit;
}
}
?>