Ejemplo n.º 1
0
Archivo: wt.php Proyecto: Nazg-Gul/gate
 function OptGet($opt, $cfg)
 {
     $val = opt_get($opt);
     if ($val == '') {
         $val = config_get($cfg);
     }
     return $val;
 }
Ejemplo n.º 2
0
 *
 * Copyright (c) 2008-2009 Sergey I. Sharybin <*****@*****.**>
 *
 * This program can be distributed under the terms of the GNU GPL.
 * See the file COPYING.
 */
if ($PHP_SELF != '') {
    print 'HACKERS?';
    die;
}
global $id, $page;
formo('title=Редактирование пользователя;');
$glist = security_groups();
$max_login_len = opt_get('max_user_login_len');
$max_name_len = opt_get('max_user_name_len');
$max_passwd_len = opt_get('max_user_passwd_len');
$user = user_get_by_id($id);
?>
<script language="JavaScript" type="text/javascript">
  var gDesc = new Array ();
<?php 
foreach ($glist as $k => $g) {
    ?>
  gDesc[<?php 
    echo $g['access'];
    ?>
]='<?php 
    echo addslashes($g['desc']);
    ?>
';
<?php 
Ejemplo n.º 3
0
 function user_check_fields($login, $name, $passwd, $email, $check_login = true, $skipId = -1)
 {
     // Get settings
     $max_login_len = opt_get('max_user_login_len');
     $max_name_len = opt_get('max_user_name_len');
     $max_passwd_len = opt_get('max_user_passwd_len');
     if ($check_login && !isalphanum($login)) {
         add_info('Логин пользователя может состоять лишь из латинских букв и цифр.');
         return false;
     }
     if (mb_strlen($login) > $max_login_len) {
         add_info('Логин пользователя может содержать не более ' . $max_login_len . ' символов.');
         return false;
     }
     if (mb_strlen($name) > $max_name_len) {
         add_info('Имя пользователя может содержать не более ' . $max_name_len . ' символов.');
         return false;
     }
     if (mb_strlen($passwd) > $max_passwd_len) {
         add_info('Пароль пользователя может содержать не более ' . $max_passwd_len . ' символов.');
         return false;
     }
     if (!check_email($email)) {
         add_info('Адрес электронной почты не выглядит корректным.');
         return false;
     }
     if (user_registered_with_email($email, $skipId)) {
         add_info('Этот адрес электронной почты уже используется. ' . 'Пожалуйста, укажите другой.');
         return false;
     }
     if ($check_login && user_registered_with_login($login, $skipId)) {
         add_info('Этот логин уже используется. Пожалуйста, укажите другой.');
         return false;
     }
     return true;
 }
Ejemplo n.º 4
0
 function Problem_DrawProblems()
 {
     $manage = $this->IsContestJudge();
     if (!$manage) {
         return;
     }
     $delete = $this->GetAllowed('PROBLEMS.DELETE');
     $edit = $this->GetAllowed('PROBLEMS.EDIT');
     $rejudge = $this->GetAllowed('PROBLEMS.REJUDGE');
     $list = $this->problemsContainer->GetList(stripslashes($_GET['filter']));
     $n = count($list);
     if ($n == 0) {
         $this->CPrintLn('<span class="contentSub2">' . 'Нет задач для редактирования или просмотра.</span>');
         $this->CPrintLn($this->Template('problems.filter.form'));
         return;
     }
     $problemsPerPage = opt_get('WT_problems_per_page');
     if (!$problemsPerPage) {
         $problemsPerPage = 15;
     }
     $page = $i = 0;
     $pages = new CVCPagintation();
     content_url_var_push_global('filter');
     $pages->Init('PAGES', 'pageid=pageid;bottomPages=false;skiponcepage=true;');
     $last = ceil($n / $problemsPerPage);
     if ($_GET['pageid'] < 0) {
         $pageid = 0;
     } else {
         if ($_GET['pageid'] >= $last) {
             $_GET['pageid'] = $last - 1;
         }
     }
     while ($i < $n) {
         $c = 0;
         $arr = array();
         $first = $list[$i];
         while ($c < $problemsPerPage && $i < $n) {
             $arr[] = $list[$i];
             $c++;
             $i++;
         }
         $last = $list[$i - 1];
         if ($page == $_GET['pageid'] || $page == 0 && $_GET['pageid'] == '') {
             $src = $this->Template('problems.list.page', array('lib' => $this, 'data' => $arr, 'page' => $page, 'perpage' => $problemsPerPage, 'acc.manage' => $manage, 'acc.delete' => $delete, 'acc.edit' => $edit, 'acc.rejudge' => $rejudge));
         } else {
             $src = '';
         }
         $pages->AppendPage($src, htmlspecialchars($first['name']) . ($last['name'] ? ' .. ' . htmlspecialchars($last['name']) : ''));
         $page++;
     }
     $this->CPrintLn($pages->OuterHTML());
     $this->CPrintLn($this->Template('problems.filter.form'));
 }
Ejemplo n.º 5
0
 function check_locked()
 {
     global $login, $passwd;
     if (!opt_get('site_lock')) {
         return false;
     }
     if ($login != '') {
         user_authorize($login, $passwd);
     }
     if (user_access_root()) {
         return false;
     }
     tplp('common/site_lock');
     return true;
 }
Ejemplo n.º 6
0
 function GetPagintation($page = 0, $pageid = 'page')
 {
     $list = $this->GetList();
     $n = count($list);
     $s = 'content_' . $this->content_id . '_count';
     $perPage = opt_get($s);
     if ($perPage <= 0) {
         return '';
     }
     $pageCount = ceil($n / $perPage);
     if ($pageCount <= 1) {
         return '';
     }
     return stencil_pagintation($pageCount, $page, content_url_get_full(), $pageid);
 }
Ejemplo n.º 7
0
<?php

/**
 * Gate - Wiki engine and web-interface for WebTester Server
 *
 * Page generation script
 *
 * Copyright (c) 2008-2009 Sergey I. Sharybin <*****@*****.**>
 *
 * This program can be distributed under the terms of the GNU GPL.
 * See the file COPYING.
 */
if ($PHP_SELF != '') {
    print 'HACKERS?';
    die;
}
/* Redirect to needed page if needed */
$start_root = opt_get('start_root');
if ($start_root != '' && $start_root != '/') {
    redirect(config_get('document-root') . $start_root);
}
/* Draw page content */
$tpl = manage_template_by_name('Статьи / Заглавная страница');
print $tpl->GetText();
Ejemplo n.º 8
0
 function GetRSSData()
 {
     $res = '';
     $percontent = opt_get('rss_items_per_content');
     $prefix = config_get('http-document-root');
     if (is_array($this->settings['contents'])) {
         foreach ($this->settings['contents'] as $cid => $dummy) {
             $c = wiki_spawn_content($cid);
             if ($c->GetID() <= 0) {
                 unset($this->settings['contents'][$cid]);
                 continue;
             }
             $arr = $c->GetRSSData($percontent);
             $n = min(count($arr), $percontent);
             for ($i = 0; $i < $n; $i++) {
                 $linkPrefix = $prefix . $c->GetFullHTTPPath();
                 $row = $arr[$i];
                 $row['timestamp'] = $timestamp;
                 $res .= "  <item>\n";
                 $res .= '    <title>' . htmlspecialchars($row['title']) . '</title>' . "\n";
                 if ($row['link'] != '') {
                     $res .= '    <link>' . $linkPrefix . '/' . $row['link'] . '</link>' . "\n";
                 }
                 $res .= '    <description>' . htmlspecialchars($row['description']) . '</description>' . "\n";
                 if ($row['comments'] != '') {
                     $res .= '    <comments>' . $row['comments'] . '</comments>' . "\n";
                 }
                 $res .= '    <pubDate>' . FullLocalTime($row['pubdate']) . '</pubDate>' . "\n";
                 if ($row['dccreator'] != '') {
                     $res .= '    <dc:creator>' . htmlspecialchars($row['dccreator']) . '</dc:creator>' . "\n";
                 }
                 $res .= "  </item>\n";
             }
         }
     }
     return setvars($res);
 }
Ejemplo n.º 9
0
  if (http_request.readyState == 4) {
    if (http_request.responseText == '+OK')
      show_msg ('email_check_res', 'ok', 'Данный адрес электронной почты пользователя является корректным и Вы можете его использовать.'); else
      show_msg ('email_check_res', 'err', 'Вы не можете использовать этот адрес электронной почты, так как он уже используется.');
  }
}

function check_login () {
  var login = getElementById ('login').value;
  if (!isalphanum (login) || qtrim (login) == '') {
    show_msg ('login_check_res', 'err', 'Логин создаваемого пользователя может состоять лишь из букв латинского алфавита и цифр и не может быть пустым.');
    return false;
  }

  if (qtrim (login).length > <?php 
echo opt_get('max_user_login_len');
?>
) {
    show_msg ('login_check_res', 'err', 'Логин пользователя может содержать не более 14 символов.');
    return false;
  }

  ipc_send_request ('/', 'ipc=check_login&login='******'email').value;

  if (!check_email (email)) {
    show_msg ('email_check_res', 'err', 'Указанный почтовый ящик не выглядит корректным. Его использование невозможно.');
    return false;
Ejemplo n.º 10
0
function check () {
  var passwd = getElementById ('passwd').value;
  var passwd_confirm = getElementById ('passwd_confirm').value;

  if (passwd != passwd_confirm) {
    alert ('Ошибка подтверждения пароля.');
    return false;
  }

  if (passwd.length > <?php 
            echo opt_get('max_user_passwd_len');
            ?>
) {
    alert ('Пароль создаваемого пользователя может содержать не более <?php 
            echo opt_get('max_user_passwd_len');
            ?>
 символов.');
    return false;
  }

  return true;
}
</script>
<?php 
            global $action;
            $f = new CVCForm();
            $f->Init('', 'action=.?id\\=' . $id . '&hash\\=' . $hash . '&action\\=save;method=POST;add_check_func=check;caption=Сменить пароль;');
            $f->AppendCustomField(array('src' => '<table class="clear" width="100%"><tr><td width="30%">Пароль</td><td style="padding: 2px;"><input type="password" class="txt block" id="passwd" name="passwd" onkeyup="check_passwd ();" onchange="check_passwd ();"></td></tr>' . '<tr><td>Подтверждение</td><td style="padding: 2px;"><input type="password" class="txt block" id="passwd_confirm" name="passwd_confirm"  onkeyup="check_passwd ();" onchange="check_passwd ();"><div id="passwd_msg"></div></td></tr>' . '</table>'));
            $draw = true;
            if ($action == 'save') {
Ejemplo n.º 11
0
    print 'HACKERS?';
    die;
}
formo('title=Список существующих пользователей;');
$groups = group_list();
?>
  <script language="JavaScript" type="text/javascript">
    function update () {
      var group=getElementById ('showGroup').value;
      nav ('.?group='+group);
    }
  </script>
<?php 
if (count($list) > 0) {
    global $page, $group;
    $perPage = opt_get('user_count');
    if ($perPage <= 0) {
        $perpage = 10;
    }
    $pages = new CVCPagintation();
    $pages->Init('', ($group != '' ? 'urlprefix=?group\\=' . $group . ';' : '') . 'bottomPages=false;skiponcepage=true;');
    $i = 0;
    $n = count($list);
    if ($page != '') {
        $pageid = '&page=' . $page;
    }
    while ($i < $n) {
        $c = 0;
        $pageSrc = '<table class="list">' . "\n";
        $pageSrc .= '<tr class="h"><th class="n first">№</th><th width="20%">Логин</th><th width="20%">Имя</th><th width="20%">E-Mail</th><th>Уровень доступа</th><th width="48" class="last">&nbsp;</th></tr>' . "\n";
        while ($c < $perPage && $i < $n) {