105 lines
2.3 KiB
PHP
105 lines
2.3 KiB
PHP
<?php
|
|
|
|
if(!defined('BASE_DIR')) exit;
|
|
|
|
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';
|
|
|
|
// получение PID для публичной части
|
|
$pid = (int)($_REQUEST['pid'] ?? 0);
|
|
|
|
switch ($_REQUEST['action'])
|
|
{
|
|
case 'result':
|
|
$poll->pollResultShow($tpl_dir, $lang_file, $pid);
|
|
break;
|
|
|
|
case 'vote':
|
|
$poll->pollVote($pid);
|
|
break;
|
|
|
|
case 'archive':
|
|
$poll->pollArchiveShow($tpl_dir, $lang_file);
|
|
break;
|
|
|
|
case 'form':
|
|
$poll->pollCommentShow($tpl_dir, $lang_file, $pid, THEME_FOLDER);
|
|
break;
|
|
|
|
case 'comment':
|
|
$poll->pollCommentNew($tpl_dir, $lang_file, $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';
|
|
|
|
// получение ID для админки
|
|
$id = (int)($_REQUEST['id'] ?? 0);
|
|
|
|
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($id);
|
|
break;
|
|
|
|
case 'edit':
|
|
$poll->pollEdit($adm_dir, $lang_file, $id);
|
|
break;
|
|
|
|
case 'save':
|
|
$poll->pollSave($id);
|
|
break;
|
|
|
|
case 'delete':
|
|
$poll->pollDelete($id);
|
|
break;
|
|
|
|
case 'comments':
|
|
$poll->pollCommentEdit($adm_dir, $lang_file, $id);
|
|
break;
|
|
|
|
case 'sort':
|
|
$poll->pollSort((array)($_REQUEST['sort'] ?? []));
|
|
exit;
|
|
}
|
|
}
|
|
?>
|