/** * Устанавливает или проверяет статус дня рождения. * * @param integer $status статус * * @return integer 1 в случае успеха, 0 в случае ошибки */ public function setStatus($status) { if (pg_affected_rows(settings::SetVariable('birthday' . $this->year, 'status', $status))) { return 1; } $sql = "INSERT INTO settings (id, module, variable, value) SELECT COALESCE(MAX(id),0)+1, 'birthday{$this->year}', 'status', '{$status}' FROM settings"; if (pg_query(DBConnect(), $sql)) { return 1; } return 0; }
exit; } if (!hasPermissions('birthday')) { exit; } $action = trim($_GET['action']); $msettings = new settings(); switch ($action) { case 'delete': $id = trim($_GET['id']); if ($id) { $error = birthday08::Delete($id); } break; case 'status': $msettings->SetVariable('birthday08', 'status', $_GET['value']); } $users = birthday08::GetAll(); ?> <script src="/scripts/warning.js" type="text/javascript"></script> <?php if ($msettings->GetVariable('birthday08', 'status') == 'open') { ?> <B>Статус регистрации: Открыта</B> » <A href="./?action=status&value=close" class="blue">Закрыть</A> <?php } else { ?> <B>Статус регистрации: Закрыта</B> » <A href="./?action=status&value=open" class="blue">Открыть</A>
define('MAX_SIZE', 5 * 1024 * 1024); //5Mb $action = __paramInit('string', 'action', 'action'); $type = __paramInit('bool', 'type', 'type'); $type_prefix = $type == 1 ? 'emp_' : ''; $settings = new settings(); switch ($action) { case 'save': $uploaded_file = new CFile($_FILES['file']); $uploaded_file->server_root = 1; $uploaded_file->max_size = MAX_SIZE; $uploaded_file->allowed_ext = array('jpg', 'jpeg', 'gif', 'png'); $filename = $uploaded_file->MoveUploadedFile(BANNER_PATH); if (!count($uploaded_file->error) && $filename) { $settings->AddVariable('newsletter', $type_prefix . 'banner_file', WDCPREFIX . '/' . $uploaded_file->path . $uploaded_file->name); $settings->AddVariable('newsletter', $type_prefix . 'banner_link', __paramInit('string', null, 'link')); } header_location_exit('./#' . ($type == 1 ? 'emp' : 'frl')); break; case 'delete': $settings->SetVariable('newsletter', $type_prefix . 'banner_file', null); $settings->SetVariable('newsletter', $type_prefix . 'banner_link', null); break; } $newsletter_banner_file = $settings->GetVariable('newsletter', 'banner_file'); $newsletter_banner_link = $settings->GetVariable('newsletter', 'banner_link'); $newsletter_emp_banner_file = $settings->GetVariable('newsletter', 'emp_banner_file'); $newsletter_emp_banner_link = $settings->GetVariable('newsletter', 'emp_banner_link'); $content = '../content.php'; $inner_page = 'inner_index.php'; include $rpath . 'template2.php';
exit; } if (!hasPermissions('birthday')) { exit; } $action = trim($_GET['action']); $msettings = new settings(); switch ($action) { case "delete": $id = trim($_GET['id']); if ($id) { $error = birthday08::Delete($id); } break; case "status": $msettings->SetVariable("birthday08", "status", $_GET['value']); } $users = birthday08::GetAll(); ?> <script src="/scripts/warning.js" type="text/javascript"></script> <?php if ($msettings->GetVariable("birthday08", "status") == "open") { ?> <B>Статус регистрации: Открыта</B> » <A href="./?action=status&value=close" class="blue">Закрыть</A> <?php } else { ?> <B>Статус регистрации: Закрыта</B> » <A href="./?action=status&value=open" class="blue">Открыть</A>