Пример #1
0
 /**
  * 过滤数据,包括tag和special chars
  *
  * @param $value
  * @return array|string
  */
 public static function clean_data($value)
 {
     if (is_array($value)) {
         foreach ($value as $k => $v) {
             $value[$k] = OJ::clean_data($v);
         }
     } else {
         $value = strip_tags($value);
         $value = HTML::chars($value, TRUE);
     }
     return $value;
 }
Пример #2
0
"></script>
<script type="text/javascript" src="<?php 
    e::url('js/tinymce/tinymce.min.js');
    ?>
"></script>
<script type="text/javascript" src="<?php 
    e::url('uploadify/jquery.uploadify.min.js');
    ?>
"></script>
<link rel="stylesheet" href="<?php 
    e::url('uploadify/uploadify.css');
    ?>
">
<?php 
}
if (!OJ::is_backend()) {
    ?>
<script type="text/javascript"> var base_url = '<?php 
    echo Kohana::$base_url;
    ?>
';</script>
<link rel="stylesheet" href="<?php 
    e::url('js/code/prettify.css');
    ?>
">
<link rel="stylesheet" href="<?php 
    e::url('css/nprogress.css');
    ?>
">
<script type="text/javascript" src="<?php 
    e::url('js/page.js');
Пример #3
0
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-5 control-label" for="email"><?php 
echo __('user.register.email');
?>
</label>
        <div class="col-sm-7">
            <input class="form-control" name="email" id="email" type="text" placeholder="<?php 
echo __('user.register.1_to_30');
?>
"/>
        </div>
    </div>
    <?php 
if ($mode = OJ::is_captcha_enabled()) {
    ?>
    <div class="form-group">
        <label class="col-sm-5 control-label"><?php 
    echo __('user.register.captcha');
    ?>
</label>
        <div class="col-sm-7">
        <?php 
    echo View::factory('captcha/' . $mode);
    ?>
        </div>
    </div>
    <?php 
}
?>
Пример #4
0
        </div>
    </div>
    <div class="form-group">
        <label for="password" class="control-label col-sm-4"><?php 
echo __('user.login.password');
?>
</label>
        <div class="col-sm-8">
            <input type="password" name="pwd" class="form-control" id="password" placeholder="<?php 
echo __('user.login.password');
?>
"/>
        </div>
    </div>
    <?php 
if ($mode = OJ::is_captcha_enabled() and Session::instance()->get('login_times') > 0) {
    ?>
    <div class="form-group">
        <label class="col-sm-4 control-label" ><?php 
    echo __('user.login.captcha');
    ?>
</label>
        <div class="col-sm-8">
            <?php 
    echo View::factory('captcha/' . $mode);
    ?>
        </div>
    </div>
    <?php 
}
?>
Пример #5
0
<?php 
if (OJ::is_backend()) {
    echo View::factory('block/backend_nav');
} else {
    echo View::factory('block/frontend_nav');
}
?>
        <?php 
echo View::factory('block/user_control');
?>
        </div><!--/.nav-collapse -->
    </div>
</div>
<div class="container">
<?php 
if (OJ::is_backend()) {
    ?>
    <div class="row">
        <div class="col-md-1 sidebar">
            <?php 
    echo View::factory('admin/' . strtolower(Request::current()->controller()) . '/sidebar');
    ?>
        </div>
        <div class="col-md-11">
            <h3><?php 
    echo $title;
    ?>
</h3>
            <?php 
    echo View::factory('block/message');
    ?>
Пример #6
0
    ?>
</td>
        <td><?php 
    echo HTML::anchor("/problem/show/{$i->problem_id}", $i->problem_id);
    ?>
</td>
        <td><?php 
    echo HTML::anchor("/u/{$i->user_id}", $i->user_id);
    ?>
</td>
        <td>
            <?php 
    echo __(e::jresult($i->result));
    ?>
            <?php 
    if (OJ::is_oi_mode()) {
        echo $i->display_pass_rate();
    }
    ?>
        </td>
        <td><?php 
    if ($i->result == 4) {
        echo $i->time, 'ms';
    } else {
        echo '----';
    }
    ?>
</td>
        <td><?php 
    if ($i->result == 4) {
        echo $i->memory, 'kb';
Пример #7
0
                <li><a href="<?php 
    e::url('user/edit');
    ?>
"><?php 
    echo __("top_frontend.useredit");
    ?>
</a></li>
                <li><a href="<?php 
    e::url('mail');
    ?>
"><?php 
    echo __("top_frontend.mail");
    ?>
</a></li>
                <?php 
    if (OJ::is_admin()) {
        ?>
                    <li><a href="<?php 
        e::url('admin');
        ?>
" data-no-turbolink><?php 
        echo __("top_frontend.adminctl");
        ?>
</a></li>
                <?php 
    }
    ?>
                <?php 
    if ($cu) {
        ?>
                    <li class="divider"></li>
Пример #8
0
 public function action_submit()
 {
     $current_user = $this->check_login();
     if ($this->request->is_post()) {
         $pid = $this->get_post('pid');
         $cid = $this->get_post('cid', null);
         $cpid = $this->get_post('cpid', -1);
         // if no pid, then it should be contest
         // if contest id set, then this submit a contest problem
         if ($cid and $cpid !== -1) {
             $contest = Model_Contest::find_by_id($cid);
             if ($contest and $contest->can_user_access($current_user)) {
                 $problem = $contest->problem($cpid);
                 if (!$problem) {
                     throw new Exception_Page(__('common.problem_not_found'));
                 }
             } else {
                 throw new Exception_Page(__('common.contest_not_found'));
             }
         } else {
             // so is normal submit
             $problem = Model_Problem::find_by_id($pid);
             if (!$problem or !$problem->can_user_access($current_user)) {
                 throw new Exception_Page(__('common.problem_not_found'));
             }
         }
         $last_submission = $current_user->get_last_submission();
         if ($last_submission) {
             $d_start = strtotime($last_submission);
             $d_end = time();
             $limitation = OJ::get_submit_time();
             if ($d_end - $d_start < $limitation) {
                 throw new Exception_Page(__('common.too_quick_:sec', array(':sec' => $limitation)));
             }
         }
         $source_code = $this->get_raw_post('source');
         $lang = $this->get_post('language');
         $solution = Model_Solution::create($current_user, $problem, $lang, $source_code);
         if ($cid) {
             // set contest info
             $solution->contest_id = $cid;
             $solution->num = $cpid;
         }
         $solution->save();
         // set user favorite language
         $current_user->language = $lang;
         $current_user->save();
         $this->redirect('/status');
         return;
     } else {
         $pid = $this->request->param('id', null);
         $this->template_data['pid'] = OJ::clean_data($pid);
     }
     $this->template_data['cid'] = $this->get_query('cid', null);
     $this->template_data['cpid'] = $this->get_query('pid', null);
     $this->template_data['default_lang'] = $current_user->language;
     $this->template_data['title'] = __('problem.submit.submit_code');
 }
Пример #9
0
 /**
  * all post data
  *
  * @return array
  */
 protected function cleaned_post()
 {
     return OJ::clean_data($this->request->post());
 }
Пример #10
0
    ?>
selected="selected"<?php 
}
?>
>
                                <?php 
echo __('admin.user.edit.disabled');
?>
                            </option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <?php 
foreach (OJ::permission_list() as $permission) {
    ?>
                        <div class="checkbox">
                            <label>
                                <input type="checkbox" name="permission[]" value="<?php 
    echo $permission;
    ?>
" <?php 
    if ($user->has_permission($permission)) {
        ?>
checked="checked" <?php 
    }
    ?>
/> <?php 
    echo __($permission);
    ?>