code stringlengths 1 2.01M | repo_name stringlengths 3 62 | path stringlengths 1 267 | language stringclasses 231
values | license stringclasses 13
values | size int64 1 2.01M |
|---|---|---|---|---|---|
<?php
class filemanage extends BACKEND_Controller {
/*
Project : 48c6c450f1a4a0cc53d9585dc0fee742
Created on : Mar 16, 2013, 11:29:15 PM
Author : Truong Khuong - khuongxuantruong@gmail.com
Description :
Purpose of the stylesheet follows.
*/
function __construct() {
parent::__construct();
$this->smarty = new CI_Smarty3();
$this->smarty->error_reporting = E_ALL & ~E_NOTICE;
}
function index($type='0x1A') {
$assigns['menuactive']='menu-filemanage';
$assigns['type']=$type;
$this->smarty
->assign($assigns)
->display("backend/02_filemanage/filemanage");
}
}
?> | 0x6a | trunk/application/controllers/backend/filemanage.php | PHP | asf20 | 739 |
<?php
define("CCTRL", "category");
define("CCTRLNAME", "category");
define("TOKEN", "bb6222905ef8419183b5437779497596");
class category extends BACKEND_Controller {
/*
Project : 48c6c450f1a4a0cc53d9585dc0fee742
Created on : Mar 16, 2013, 11:29:15 PM
Author : Truong Khuong - khuongxuantruong@gmail.com
Description :
Purpose of the stylesheet follows.
*/
private $assigns=null;
function __construct() {
parent::__construct();
$this->load->model('backend/category_model');
$type=isset($_GET['type'])?$_GET['type']:null;
//$this->category_model = new category_basemodel($type);
$this->types = $this->category_model->get_by_type('system');
$this->smarty = new CI_Smarty3();
$this->smarty->error_reporting = E_ALL & ~E_NOTICE;
if (!isset($_SESSION["ADP"][CCTRL]["display"]))
$_SESSION["ADP"][CCTRL]["display"] = 0;
$this->assigns['CategoryType']=array('news'=>'News','project'=>'Project','system'=>'System','about'=>'About','product'=>'Product');
}
function viewport(){
//print_r($_SESSION);die;
echo $c=$this->load->view('views_backend/tree_maps/01_treemap',$this->assigns,true);
}
function index($type=null) {
if(isset($_GET['view'])){$this->tree();return;}
$assigns['categories'] = $this->category_model->catetory_list;
$assigns['types']=$this->types;
$assigns['menuactive']='menu-category';
$colModel = $this->category_model->colmod();
foreach ($colModel as $col) {
$datafields[] = array(
'name' => $col['datafield'],
'type' => isset($col['type']) ? $col['type'] : 'string'
);
$column = $col;
$column['editable'] = isset($col['editable']) ? $col['editable'] : false;
$column['filterable'] = isset($col['filterable']) ? $col['filterable'] : true;
$column['sortable'] = isset($col['sortable']) ? $col['sortable'] : true;
$column['minwidth'] = isset($col['minwidth']) ? $col['minwidth'] : (isset($col['width']) ? $col['width'] : 100);
$columns[$col['datafield']] = $column;
$list[] = array(
'label' => $col['text'],
'value' => $col['datafield'],
'checked' => isset($col["hidden"]) ? !$col["hidden"] : true
);
}
$assigns['datafields']= $datafields;
$assigns['columns']= $columns;
$assigns['list']= $list;
$assigns['type']=$type;
$type=isset($_GET['type'])?$_GET['type']:$type;
$assigns['bindingsource']="/admincp/backend/category/binding/$type";
$assigns['treebindingsource']='/admincp/backend/category/treebinding/'.$type;
$this->smarty
->assign($assigns)
->display("backend/03_category/03_grid");
}
function treebinding($type=null) {
$result = $this->category_model->treebinding($type);
$data=$result;
$this->output->set_header('Content-type: application/json');
$this->output->set_output(json_encode($data));
}
function binding($type=null) {
$result = $this->category_model->binding();
$data=$result['rows'];//$this->category_model->get_by_type($type);
$result['rows']=$this->category_model->buildTreeArray($data);
$result['totalrecords']= count($result['rows']);
$this->output->set_header('Content-type: application/json');
$this->output->set_output(json_encode($result));
}
function editor($id = "") {
$assigns = null;
if ($id !== "")
$assigns['item'] = $this->category_model->_get($id);
$assigns['categories'] = $this->category_model->catetory_list;
$assigns['types'] = $this->category_model->get_by_type('system');
//$assigns['types']=$this->types;
$this->smarty
->assign($assigns)
->display("backend/03_category/02_editor");
}
function getDataRow($Id=0){
if($Id==0)$Id=(int)$this->input->post('Id');
$R["result"] = -1;
$R["message"] = "Bad request !.";
if($Id>0){
$R["result"] = 0;
$R["message"] = "Get data Success !";
$R["item"] = $this->category_model->_get($Id);
}
echo json_encode($R);
}
function loadEditPanel($type='',$Id=0){
if($Id==0)$Id=(int)$this->input->post('Id');
if($type=='')$type=$this->input->post('Type');
if($Id>0)
$this->assigns['item']=$this->category_model->_get($Id);
$data=$this->category_model->get_by_type($type);
$this->assigns['category_list']=$this->category_model->buildTreeArray($data);
echo $c=$this->load->view('views_backend/10_categories/01_category_edit_panel',$this->assigns,true);
}
function save() {
$R["result"] = -1;
$R["message"] = ("This function to requires an administrative account.<br/>Please check your authority, and try again.");
if($this->privilege->aupr_permission!=777)goto result;
$params=$this->input->post();
$params["cate_parent"] = (int) $params["cate_parent"];
$params["cate_position"] = (int) $params["cate_position"];
$cate_id = (int)$params["cate_id"];unset($params["cate_id"]);
if ($params["cate_parent"] != 0 && $cate_id !=0) {
if (in_array($cate_id, $this->category_model->catetory_list[$params["cate_parent"]]->parents)){
$R["message"] = 'Lỗi cấu trúc.';
goto result;
}
}
if ($cate_id != 0) {
$rs = $this->category_model->_update($cate_id, $params);
} else {
$rs = $this->category_model->_insert($params);
}
if ($rs === true) {
$R["result"] = 1;
$R["message"] = ascii_to_entities("Dữ liệu đã được hệ thống ghi nhận.");
} else {
$R["result"] = -1;
$R["error_number"] = $this->db->_error_number();
$R["error_message"] = $this->db->_error_message();
$R["message"] = ascii_to_entities("
Dữ liệu chưa được hệ thống ghi nhận.<br/>
Vui lòng kiểm tra dữ liệu và thử lại.<br/>
");
if ($R["error_number"] != 0)
$R["message"].=ascii_to_entities("<span class='erc'>[" . $R["error_number"] . "] " . $R["error_message"] . ".</span>");
}
result:
echo json_encode($R);
}
function store(){
$dt=$this->category_model->binding();
$result=$dt;
$result['success']= true;
header('Content-type: application/json');
echo json_encode($result);
return;
$this->output->set_header('Content-type: application/json');
$this->output->set_output(json_encode($result));
}
function demo(){
$data=$this->category_model->get_by_type('News');
$arr=$this->buildTreeArray($data);
}
}
?> | 0x6a | trunk/application/controllers/backend/category.php | PHP | asf20 | 7,302 |
<?php
class wallpaper extends BACKEND_Controller {
/*
Project : 48c6c450f1a4a0cc53d9585dc0fee742
Created on : Mar 16, 2013, 11:29:15 PM
Author : Truong Khuong - khuongxuantruong@gmail.com
Description :
Purpose of the stylesheet follows.
*/
function __construct() {
parent::__construct();
}
function index() {
}
}
?>
| 0x6a | trunk/application/controllers/backend/wallpaper.php | PHP | asf20 | 429 |
<?php
define("CCTRL", "users");
define("CCTRLNAME", "users");
define("TOKEN", "bb6222905ef8419183b5437779497596");
class user extends BACKEND_Controller {
/*
Project : 48c6c450f1a4a0cc53d9585dc0fee742
Created on : Mar 16, 2013, 11:29:15 PM
Author : Truong Khuong - khuongxuantruong@gmail.com
Description :
Purpose of the stylesheet follows.
*/
private $assets=null;
function __construct() {
parent::__construct();
$this->load->model('backend/user_model');
$this->smarty = new CI_Smarty3();
$this->smarty->error_reporting = E_ALL & ~E_NOTICE;
if (!isset($_SESSION["ADP"][CCTRL]["display"]))
$_SESSION["ADP"][CCTRL]["display"] = 0;
}
function index() {
$assigns['menuactive']='menu-user';
$colModel = $this->user_model->colmod();
foreach ($colModel as $col) {
$datafields[] = array(
'name' => $col['datafield'],
'type' => isset($col['type']) ? $col['type'] : 'string'
);
$column = $col;
$column['editable'] = isset($col['editable']) ? $col['editable'] : false;
$column['filterable'] = isset($col['filterable']) ? $col['filterable'] : true;
$column['sortable'] = isset($col['sortable']) ? $col['sortable'] : true;
$column['minwidth'] = isset($col['minwidth']) ? $col['minwidth'] : (isset($col['width']) ? $col['width'] : 100);
$columns[$col['datafield']] = $column;
$list[] = array(
'label' => $col['text'],
'value' => $col['datafield'],
'checked' => isset($col["hidden"]) ? !$col["hidden"] : true
);
}
$assigns['datafields']= $datafields;
$assigns['columns']= $columns;
$assigns['list']= $list;
$type=isset($_GET['type'])?$_GET['type']:null;
$assigns['bindingsource']=base_url()."/backend/user/binding";
$assigns['users'] = $this->user_model->gets();
$this->smarty
->assign($assigns)
//->display("admin/01_auth_user");
->display("backend/02_user/01_grid");
}
function editor($id = "") {
if ($id !== "")
$this->assets['user'] = $this->user_model->get($id);
$this->load->view('views_backend/user/02_user_edit_panel',$this->assets);
// $this->smarty
// ->assign($assigns)
// ->display("backend/02_user/editor");
}
function binding() {
$result = $this->user_model->binding();
$this->output->set_header('Content-type: application/json');
$this->output->set_output(json_encode($result));
}
function randomstring(){
echo random_string('alnum', rand(4, 8)*2);
}
function save() {
$R["result"] = -1;
$R["message"] = ascii_to_entities("This function to requires an administrative account.<br/>Please check your authority, and try again.");
if($this->privilege->aupr_permission!=777)goto result;
$params["ause_name"] = $this->input->post("ause_name");
$params["ause_username"] = $this->input->post("ause_username");
$params["ause_position"] = (int) $this->input->post("ause_position");
$params["ause_status"] = $this->input->post("ause_status");
$params["ause_email"] = $this->input->post("ause_email");
$apri_id = $this->input->post("ause_id");
if ($apri_id != false) {
$user = $this->user_model->get($apri_id);
if($user==null){
$R["result"] = -904;
$R["message"] = ascii_to_entities("User not exist.");
goto result;
}
if($this->input->post("ause_password")!=false){
$params["ause_password"]=md5($params["ause_username"].$this->input->post("ause_password").$user->ause_secretkey);
}
$params["ause_update"] = date('Y-m-d H:i:s');
$rok = @$this->user_model->update($apri_id, $params);
} else {
$params["ause_key"] = random_string('alnum', 8);
$params["ause_salt"] = random_string('alnum', 8);
$params["ause_secretkey"] = random_string('alnum', 32);
$params["ause_password"]=md5($params["ause_username"].$this->input->post("ause_password").$params["ause_secretkey"]);
$rok = @$this->user_model->insert($params);
}
if ($rok === true) {
$R["result"] = 1;
$R["message"] = ascii_to_entities("Dữ liệu đã được hệ thống ghi nhận.");
} else {
$R["result"] = -1;
$R["error_number"] = $this->db->_error_number();
$R["error_message"] = $this->db->_error_message();
$R["message"] = ascii_to_entities("
Dữ liệu chưa được hệ thống ghi nhận.<br/>
Vui lòng kiểm tra dữ liệu và thử lại.<br/>
");
if ($R["error_number"] != 0)
$R["message"].=ascii_to_entities("<span class='erc'>[" . $R["error_number"] . "] " . $R["error_message"] . ".</span>");
}
result:
echo json_encode($R);
}
function detail($id = "") {
//$id=$this->input->get('id');
$user = $this->user_model->get($id);
if ($user === null)
show_404();
$privileges = $this->user_model->getprivileges($id);
//echo $this->db->last_query();
$time = time();
$salt = $_SESSION['auth']['user']->ause_salt;
// $this->smarty
// ->assign(array(
// 'user' => $user,
// 'privileges' => $privileges,
// 'time' => $time,
// 'salt' => $salt
// ))
// ->display("backend/02_user/01_detail");
$this->assets=array(
'user' => $user,
'privileges' => $privileges,
'time' => $time,
'salt' => $salt
);
$this->load->view('views_backend/user/01_user_privilege',$this->assets);
}
function setprivilege() {
$R["result"] = -1;
$R["message"] = ascii_to_entities("This function to requires an administrative account.<br/>Please check your authority, and try again.");
if($this->privilege->aupr_permission!=777)goto result;
$R["result"] = -998;
$rOk = 0;
$R["message"] = ascii_to_entities("Access is denied - Request invalid.");
$salt = $_SESSION['auth']['user']->ause_salt;
$aupr_user = $this->input->post('user_id');
$aupr_privilege = $this->input->post('privilege_id');
$aupr_permission = $this->input->post('permission');
$secretkey = $this->input->post('secretkey');
$signature = $this->input->post('signature');
if ($this->privilege->aupr_permission !== '777') {
$R["result"] = -997;
$R["message"] = ascii_to_entities("Permission denied to access the function.");
goto result;
}
//if( $signature!==md5("$aupr_privilege$secretkey$salt") ){
// $R["result"]=-991;
// $R["message"]=ascii_to_entities("Signature invalid.");
// goto result;
//}
$aParamsi = array(
'aupr_user' => $aupr_user,
'aupr_privilege' => $aupr_privilege,
'aupr_permission' => $aupr_permission,
'aupr_insert' => date('Y-m-d H:i:s'),
'aupr_status' => 'true',
);
$aUpdate = array('aupr_permission', 'aupr_insert');
$rOk = $this->user_model->insert_onduplicate_update_aupr($aParamsi, $aUpdate);
if ($rOk > 0) {
$R["result"] = 1;
$R["message"] = ascii_to_entities("Set permission success.");
} else {
$R["result"] = -1;
$R["message"] = ascii_to_entities("Set permission fail.");
}
result:
$this->output->set_header('Content-type: application/json');
$this->output->set_output(json_encode($R));
}
}
?> | 0x6a | trunk/application/controllers/backend/user.php | PHP | asf20 | 8,428 |
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html> | 0x6a | trunk/application/controllers/index.html | HTML | asf20 | 114 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| Foreign Characters
| -------------------------------------------------------------------
| This file contains an array of foreign characters for transliteration
| conversion used by the Text helper
|
*/
$foreign_characters = array(
'/ä|æ|ǽ/' => 'ae',
'/ö|œ/' => 'oe',
'/ü/' => 'ue',
'/Ä/' => 'Ae',
'/Ü/' => 'Ue',
'/Ö/' => 'Oe',
'/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ/' => 'A',
'/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª/' => 'a',
'/Ç|Ć|Ĉ|Ċ|Č/' => 'C',
'/ç|ć|ĉ|ċ|č/' => 'c',
'/Ð|Ď|Đ/' => 'D',
'/ð|ď|đ/' => 'd',
'/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě/' => 'E',
'/è|é|ê|ë|ē|ĕ|ė|ę|ě/' => 'e',
'/Ĝ|Ğ|Ġ|Ģ/' => 'G',
'/ĝ|ğ|ġ|ģ/' => 'g',
'/Ĥ|Ħ/' => 'H',
'/ĥ|ħ/' => 'h',
'/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ/' => 'I',
'/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı/' => 'i',
'/Ĵ/' => 'J',
'/ĵ/' => 'j',
'/Ķ/' => 'K',
'/ķ/' => 'k',
'/Ĺ|Ļ|Ľ|Ŀ|Ł/' => 'L',
'/ĺ|ļ|ľ|ŀ|ł/' => 'l',
'/Ñ|Ń|Ņ|Ň/' => 'N',
'/ñ|ń|ņ|ň|ʼn/' => 'n',
'/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ/' => 'O',
'/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º/' => 'o',
'/Ŕ|Ŗ|Ř/' => 'R',
'/ŕ|ŗ|ř/' => 'r',
'/Ś|Ŝ|Ş|Š/' => 'S',
'/ś|ŝ|ş|š|ſ/' => 's',
'/Ţ|Ť|Ŧ/' => 'T',
'/ţ|ť|ŧ/' => 't',
'/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ/' => 'U',
'/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ/' => 'u',
'/Ý|Ÿ|Ŷ/' => 'Y',
'/ý|ÿ|ŷ/' => 'y',
'/Ŵ/' => 'W',
'/ŵ/' => 'w',
'/Ź|Ż|Ž/' => 'Z',
'/ź|ż|ž/' => 'z',
'/Æ|Ǽ/' => 'AE',
'/ß/'=> 'ss',
'/IJ/' => 'IJ',
'/ij/' => 'ij',
'/Œ/' => 'OE',
'/ƒ/' => 'f'
);
/* End of file foreign_chars.php */
/* Location: ./application/config/foreign_chars.php */ | 0x6a | trunk/application/config/foreign_chars.php | PHP | asf20 | 1,781 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| URI ROUTING
| -------------------------------------------------------------------------
| This file lets you re-map URI requests to specific controller functions.
|
| Typically there is a one-to-one relationship between a URL string
| and its corresponding controller class/method. The segments in a
| URL normally follow this pattern:
|
| example.com/class/method/id/
|
| In some instances, however, you may want to remap this relationship
| so that a different class/function is called than the one
| corresponding to the URL.
|
| Please see the user guide for complete details:
|
| http://codeigniter.com/user_guide/general/routing.html
|
| -------------------------------------------------------------------------
| RESERVED ROUTES
| -------------------------------------------------------------------------
|
| There area two reserved routes:
|
| $route['default_controller'] = 'welcome';
|
| This route indicates which controller class should be loaded if the
| URI contains no data. In the above example, the "welcome" class
| would be loaded.
|
| $route['404_override'] = 'errors/page_missing';
|
| This route will tell the Router what URI segments to use if those provided
| in the URL cannot be matched to a valid route.
|
*/
$route['default_controller'] = "home";
$route['(gioi-thieu|about)'] = "home/about";
$route['(lien-he|contact)'] = "home/contact";
$route['(tin-tuc|news)/(:any)'] = "news/detail/$2";
$route['(gioi-thieu|about)/(:any)'] = "home/about/$2";
$route['(dich-vu|service)'] = "home/service";
$route['(dich-vu|service)/(:any)'] = "home/service/$2";
$route['(dich-vu|service)/(:any)/(:any)'] = "home/service/$2/$3";
$route['(du-an|project)'] = "home/project";
$route['(du-an|project)/(:any)'] = "home/project/$2";
$route['(du-an|project)/(:any)/(:any)'] = "home/project/$2/$3";
$route['404_override'] = '';
/* End of file routes.php */
| 0x6a | trunk/application/config/routes.php | PHP | asf20 | 2,076 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| USER AGENT TYPES
| -------------------------------------------------------------------
| This file contains four arrays of user agent data. It is used by the
| User Agent Class to help identify browser, platform, robot, and
| mobile device data. The array keys are used to identify the device
| and the array values are used to set the actual name of the item.
|
*/
$platforms = array (
'windows nt 6.0' => 'Windows Longhorn',
'windows nt 5.2' => 'Windows 2003',
'windows nt 5.0' => 'Windows 2000',
'windows nt 5.1' => 'Windows XP',
'windows nt 4.0' => 'Windows NT 4.0',
'winnt4.0' => 'Windows NT 4.0',
'winnt 4.0' => 'Windows NT',
'winnt' => 'Windows NT',
'windows 98' => 'Windows 98',
'win98' => 'Windows 98',
'windows 95' => 'Windows 95',
'win95' => 'Windows 95',
'windows' => 'Unknown Windows OS',
'os x' => 'Mac OS X',
'ppc mac' => 'Power PC Mac',
'freebsd' => 'FreeBSD',
'ppc' => 'Macintosh',
'linux' => 'Linux',
'debian' => 'Debian',
'sunos' => 'Sun Solaris',
'beos' => 'BeOS',
'apachebench' => 'ApacheBench',
'aix' => 'AIX',
'irix' => 'Irix',
'osf' => 'DEC OSF',
'hp-ux' => 'HP-UX',
'netbsd' => 'NetBSD',
'bsdi' => 'BSDi',
'openbsd' => 'OpenBSD',
'gnu' => 'GNU/Linux',
'unix' => 'Unknown Unix OS'
);
// The order of this array should NOT be changed. Many browsers return
// multiple browser types so we want to identify the sub-type first.
$browsers = array(
'Flock' => 'Flock',
'Chrome' => 'Chrome',
'Opera' => 'Opera',
'MSIE' => 'Internet Explorer',
'Internet Explorer' => 'Internet Explorer',
'Shiira' => 'Shiira',
'Firefox' => 'Firefox',
'Chimera' => 'Chimera',
'Phoenix' => 'Phoenix',
'Firebird' => 'Firebird',
'Camino' => 'Camino',
'Netscape' => 'Netscape',
'OmniWeb' => 'OmniWeb',
'Safari' => 'Safari',
'Mozilla' => 'Mozilla',
'Konqueror' => 'Konqueror',
'icab' => 'iCab',
'Lynx' => 'Lynx',
'Links' => 'Links',
'hotjava' => 'HotJava',
'amaya' => 'Amaya',
'IBrowse' => 'IBrowse'
);
$mobiles = array(
// legacy array, old values commented out
'mobileexplorer' => 'Mobile Explorer',
// 'openwave' => 'Open Wave',
// 'opera mini' => 'Opera Mini',
// 'operamini' => 'Opera Mini',
// 'elaine' => 'Palm',
'palmsource' => 'Palm',
// 'digital paths' => 'Palm',
// 'avantgo' => 'Avantgo',
// 'xiino' => 'Xiino',
'palmscape' => 'Palmscape',
// 'nokia' => 'Nokia',
// 'ericsson' => 'Ericsson',
// 'blackberry' => 'BlackBerry',
// 'motorola' => 'Motorola'
// Phones and Manufacturers
'motorola' => "Motorola",
'nokia' => "Nokia",
'palm' => "Palm",
'iphone' => "Apple iPhone",
'ipad' => "iPad",
'ipod' => "Apple iPod Touch",
'sony' => "Sony Ericsson",
'ericsson' => "Sony Ericsson",
'blackberry' => "BlackBerry",
'cocoon' => "O2 Cocoon",
'blazer' => "Treo",
'lg' => "LG",
'amoi' => "Amoi",
'xda' => "XDA",
'mda' => "MDA",
'vario' => "Vario",
'htc' => "HTC",
'samsung' => "Samsung",
'sharp' => "Sharp",
'sie-' => "Siemens",
'alcatel' => "Alcatel",
'benq' => "BenQ",
'ipaq' => "HP iPaq",
'mot-' => "Motorola",
'playstation portable' => "PlayStation Portable",
'hiptop' => "Danger Hiptop",
'nec-' => "NEC",
'panasonic' => "Panasonic",
'philips' => "Philips",
'sagem' => "Sagem",
'sanyo' => "Sanyo",
'spv' => "SPV",
'zte' => "ZTE",
'sendo' => "Sendo",
// Operating Systems
'symbian' => "Symbian",
'SymbianOS' => "SymbianOS",
'elaine' => "Palm",
'palm' => "Palm",
'series60' => "Symbian S60",
'windows ce' => "Windows CE",
// Browsers
'obigo' => "Obigo",
'netfront' => "Netfront Browser",
'openwave' => "Openwave Browser",
'mobilexplorer' => "Mobile Explorer",
'operamini' => "Opera Mini",
'opera mini' => "Opera Mini",
// Other
'digital paths' => "Digital Paths",
'avantgo' => "AvantGo",
'xiino' => "Xiino",
'novarra' => "Novarra Transcoder",
'vodafone' => "Vodafone",
'docomo' => "NTT DoCoMo",
'o2' => "O2",
// Fallback
'mobile' => "Generic Mobile",
'wireless' => "Generic Mobile",
'j2me' => "Generic Mobile",
'midp' => "Generic Mobile",
'cldc' => "Generic Mobile",
'up.link' => "Generic Mobile",
'up.browser' => "Generic Mobile",
'smartphone' => "Generic Mobile",
'cellphone' => "Generic Mobile"
);
// There are hundreds of bots but these are the most common.
$robots = array(
'googlebot' => 'Googlebot',
'msnbot' => 'MSNBot',
'slurp' => 'Inktomi Slurp',
'yahoo' => 'Yahoo',
'askjeeves' => 'AskJeeves',
'fastcrawler' => 'FastCrawler',
'infoseek' => 'InfoSeek Robot 1.0',
'lycos' => 'Lycos'
);
/* End of file user_agents.php */
/* Location: ./application/config/user_agents.php */ | 0x6a | trunk/application/config/user_agents.php | PHP | asf20 | 5,589 |
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Enable/Disable Migrations
|--------------------------------------------------------------------------
|
| Migrations are disabled by default but should be enabled
| whenever you intend to do a schema migration.
|
*/
$config['migration_enabled'] = FALSE;
/*
|--------------------------------------------------------------------------
| Migrations version
|--------------------------------------------------------------------------
|
| This is used to set migration version that the file system should be on.
| If you run $this->migration->latest() this is the version that schema will
| be upgraded / downgraded to.
|
*/
$config['migration_version'] = 0;
/*
|--------------------------------------------------------------------------
| Migrations Path
|--------------------------------------------------------------------------
|
| Path to your migrations folder.
| Typically, it will be within your application path.
| Also, writing permission is required within the migrations path.
|
*/
$config['migration_path'] = APPPATH . 'migrations/';
/* End of file migration.php */
/* Location: ./application/config/migration.php */ | 0x6a | trunk/application/config/migration.php | PHP | asf20 | 1,322 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Hooks
| -------------------------------------------------------------------------
| This file lets you define "hooks" to extend CI without hacking the core
| files. Please see the user guide for info:
|
| http://codeigniter.com/user_guide/general/hooks.html
|
*/
/* End of file hooks.php */
/* Location: ./application/config/hooks.php */ | 0x6a | trunk/application/config/hooks.php | PHP | asf20 | 498 |
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Website details
|
| These details are used in emails sent by authentication library.
|--------------------------------------------------------------------------
*/
$config['website_name'] = 'http://localhost/48c6c450f1a4a0cc53d9585dc0fee742/';
$config['webmaster_email'] = 'webmaster@your-site.com';
/*
|--------------------------------------------------------------------------
| Security settings
|
| The library uses PasswordHash library for operating with hashed passwords.
| 'phpass_hash_portable' = Can passwords be dumped and exported to another server. If set to FALSE then you won't be able to use this database on another server.
| 'phpass_hash_strength' = Password hash strength.
|--------------------------------------------------------------------------
*/
$config['phpass_hash_portable'] = FALSE;
$config['phpass_hash_strength'] = 8;
/*
|--------------------------------------------------------------------------
| Registration settings
|
| 'allow_registration' = Registration is enabled or not
| 'captcha_registration' = Registration uses CAPTCHA
| 'email_activation' = Requires user to activate their account using email after registration.
| 'email_activation_expire' = Time before users who don't activate their account getting deleted from database. Default is 48 hours (60*60*24*2).
| 'email_account_details' = Email with account details is sent after registration (only when 'email_activation' is FALSE).
| 'use_username' = Username is required or not.
|
| 'username_min_length' = Min length of user's username.
| 'username_max_length' = Max length of user's username.
| 'password_min_length' = Min length of user's password.
| 'password_max_length' = Max length of user's password.
|--------------------------------------------------------------------------
*/
$config['allow_registration'] = TRUE;
$config['captcha_registration'] = TRUE;
$config['email_activation'] = TRUE;
$config['email_activation_expire'] = 60*60*24*2;
$config['email_account_details'] = TRUE;
$config['use_username'] = TRUE;
$config['username_min_length'] = 4;
$config['username_max_length'] = 20;
$config['password_min_length'] = 4;
$config['password_max_length'] = 20;
/*
|--------------------------------------------------------------------------
| Login settings
|
| 'login_by_username' = Username can be used to login.
| 'login_by_email' = Email can be used to login.
| You have to set at least one of 2 settings above to TRUE.
| 'login_by_username' makes sense only when 'use_username' is TRUE.
|
| 'login_record_ip' = Save in database user IP address on user login.
| 'login_record_time' = Save in database current time on user login.
|
| 'login_count_attempts' = Count failed login attempts.
| 'login_max_attempts' = Number of failed login attempts before CAPTCHA will be shown.
| 'login_attempt_expire' = Time to live for every attempt to login. Default is 24 hours (60*60*24).
|--------------------------------------------------------------------------
*/
$config['login_by_username'] = TRUE;
$config['login_by_email'] = TRUE;
$config['login_record_ip'] = TRUE;
$config['login_record_time'] = TRUE;
$config['login_count_attempts'] = TRUE;
$config['login_max_attempts'] = 5;
$config['login_attempt_expire'] = 60*60*24;
/*
|--------------------------------------------------------------------------
| Auto login settings
|
| 'autologin_cookie_name' = Auto login cookie name.
| 'autologin_cookie_life' = Auto login cookie life before expired. Default is 2 months (60*60*24*31*2).
|--------------------------------------------------------------------------
*/
$config['autologin_cookie_name'] = 'autologin';
$config['autologin_cookie_life'] = 60*60*24*31*2;
/*
|--------------------------------------------------------------------------
| Forgot password settings
|
| 'forgot_password_expire' = Time before forgot password key become invalid. Default is 15 minutes (60*15).
|--------------------------------------------------------------------------
*/
$config['forgot_password_expire'] = 60*15;
/*
|--------------------------------------------------------------------------
| Captcha
|
| You can set captcha that created by Auth library in here.
| 'captcha_path' = Directory where the catpcha will be created.
| 'captcha_fonts_path' = Font in this directory will be used when creating captcha.
| 'captcha_font_size' = Font size when writing text to captcha. Leave blank for random font size.
| 'captcha_grid' = Show grid in created captcha.
| 'captcha_expire' = Life time of created captcha before expired, default is 3 minutes (180 seconds).
| 'captcha_case_sensitive' = Captcha case sensitive or not.
|--------------------------------------------------------------------------
*/
$config['captcha_path'] = 'captcha/';
$config['captcha_fonts_path'] = 'captcha/fonts/5.ttf';
$config['captcha_width'] = 200;
$config['captcha_height'] = 50;
$config['captcha_font_size'] = 14;
$config['captcha_grid'] = FALSE;
$config['captcha_expire'] = 180;
$config['captcha_case_sensitive'] = TRUE;
/*
|--------------------------------------------------------------------------
| reCAPTCHA
|
| 'use_recaptcha' = Use reCAPTCHA instead of common captcha
| You can get reCAPTCHA keys by registering at http://recaptcha.net
|--------------------------------------------------------------------------
*/
$config['use_recaptcha'] = TRUE;
$config['recaptcha_public_key'] = '6LfADt4SAAAAAEN0Nw8Q2pVU-Iuwh-DQyaISySxS';
$config['recaptcha_private_key'] = '6LfADt4SAAAAAA7IzFtqBxW__Vz7DFtl9TukSUBt';
/*
|--------------------------------------------------------------------------
| Database settings
|
| 'db_table_prefix' = Table prefix that will be prepended to every table name used by the library
| (except 'ci_sessions' table).
|--------------------------------------------------------------------------
*/
$config['db_table_prefix'] = '';
/* End of file tank_auth.php */
/* Location: ./application/config/tank_auth.php */ | 0x6a | trunk/application/config/tank_auth.php | PHP | asf20 | 6,064 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
* Name: flexi auth Config
*
* Author:
* Rob Hussey
* flexiauth@haseydesign.com
* haseydesign.com/flexi-auth
*
* Copyright 2012 Rob Hussey
*
* Previous Authors / Contributors:
* Ben Edmunds, benedmunds.com
* Phil Sturgeon, philsturgeon.co.uk
* Mathew Davies
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Description: A full login authorisation and user management library for CodeIgniter based on Ion Auth (By Ben Edmunds) which itself was based on Redux Auth 2 (Mathew Davies)
* Released: 13/09/2012
* Requirements: PHP5 or above and Codeigniter 2.0+
*/
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
// DATABASE NAMES / ALIASES
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
/**
* If required, it is possible to set your own name for each database table and column.
* Note: Only change the name in the apostrophes (after the '=' sign), and not the $config array names.
* Example: Change $config['database']['user_acc']['columns']['id'] = 'uacc_id' to $config['database']['user_acc']['columns']['id'] = 'new_column_name'
*
* Quick Reference Guide on array structuring
* ['table'] = table name, ['primary_key'] = primary key of table used in joins, ['join'] = column used to join table, ['columns']['xxx'] = specific column name
*/
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
/**
* Primary User Account Table
* The primary user account table contains all of the columns required for different functions within the flexi auth library.
*
* All columns are required.
*/
$config['database']['user_acc']['table'] = 'user_accounts';
$config['database']['user_acc']['join'] = 'user_accounts.uacc_id';
$config['database']['user_acc']['columns']['id'] = 'uacc_id';
$config['database']['user_acc']['columns']['group_id'] = 'uacc_group_fk';
$config['database']['user_acc']['columns']['email'] = 'uacc_email';
$config['database']['user_acc']['columns']['username'] = 'uacc_username';
$config['database']['user_acc']['columns']['password'] = 'uacc_password';
$config['database']['user_acc']['columns']['ip_address'] = 'uacc_ip_address';
$config['database']['user_acc']['columns']['salt'] = 'uacc_salt';
$config['database']['user_acc']['columns']['activation_token'] = 'uacc_activation_token';
$config['database']['user_acc']['columns']['forgot_password_token'] = 'uacc_forgotten_password_token';
$config['database']['user_acc']['columns']['forgot_password_expire'] = 'uacc_forgotten_password_expire';
$config['database']['user_acc']['columns']['update_email_token'] = 'uacc_update_email_token';
$config['database']['user_acc']['columns']['update_email'] = 'uacc_update_email';
$config['database']['user_acc']['columns']['active'] = 'uacc_active';
$config['database']['user_acc']['columns']['suspend'] = 'uacc_suspend';
$config['database']['user_acc']['columns']['failed_logins'] = 'uacc_fail_login_attempts';
$config['database']['user_acc']['columns']['failed_login_ip'] = 'uacc_fail_login_ip_address';
$config['database']['user_acc']['columns']['failed_login_ban_date'] = 'uacc_date_fail_login_ban';
$config['database']['user_acc']['columns']['last_login_date'] = 'uacc_date_last_login';
$config['database']['user_acc']['columns']['date_added'] = 'uacc_date_added';
// Custom columns can be added to the main user account table to enable library functions to handle additional custom data stored within the table.
$config['database']['user_acc']['custom_columns'] = array(
### Example : 'date_modified', 'modified_user_id' etc.
);
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
/**
* User Group Table
* The user group table is used to allocate a group classification to users, typically this is used to group users as either admins or public users.
* The grouped users can then be delivered content specific to their group, or restricted access to set areas - i.e. an admin only area.
*
* All columns are required.
*/
$config['database']['user_group']['table'] = 'user_groups';
$config['database']['user_group']['join'] = 'user_groups.ugrp_id';
$config['database']['user_group']['columns']['id'] = 'ugrp_id';
$config['database']['user_group']['columns']['name'] = 'ugrp_name';
$config['database']['user_group']['columns']['description'] = 'ugrp_desc';
$config['database']['user_group']['columns']['admin'] = 'ugrp_admin';
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
/**
* User Privilege Table
* The user privilege table is used to allocate role privileges to users.
* Whilst very similar to user groups, multiple privileges can be assigned to a user, the users privilege (and group if desired) can then be
* looked up to verify if a user has permission to perform an action or access specific data.
* For example, 2 users could be in an 'Moderator' group, 1 of the users could be allowed to update data, whilst the other could only view the data.
*
* All columns are required.
*/
$config['database']['user_privileges']['table'] = 'user_privileges';
$config['database']['user_privileges']['columns']['id'] = 'upriv_id';
$config['database']['user_privileges']['columns']['name'] = 'upriv_name';
$config['database']['user_privileges']['columns']['description'] = 'upriv_desc';
/**
* User Privilege Users Table
* The user privilege user table is used to assign privileges to users. Multiple privileges can be assigned to a user.
*
* All columns are required.
*/
$config['database']['user_privilege_users']['table'] = 'user_privilege_users';
$config['database']['user_privilege_users']['columns']['id'] = 'upriv_users_id';
$config['database']['user_privilege_users']['columns']['user_id'] = 'upriv_users_uacc_fk';
$config['database']['user_privilege_users']['columns']['privilege_id'] = 'upriv_users_upriv_fk';
/**
* User Privilege Groups Table
* The user privilege group table is used to assign privileges to user groups. Multiple privileges can be assigned to a user group.
*
* All columns are required.
*/
$config['database']['user_privilege_groups']['table'] = 'user_privilege_groups';
$config['database']['user_privilege_groups']['columns']['id'] = 'upriv_groups_id';
$config['database']['user_privilege_groups']['columns']['group_id'] = 'upriv_groups_ugrp_fk';
$config['database']['user_privilege_groups']['columns']['privilege_id'] = 'upriv_groups_upriv_fk';
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
/**
* User Login Session Table
* The user login session table is used to validate user login credentials. For security purposes, if a users credentitals do not match those
* stored within the table, the user is automatically logged out.
*
* All columns are required.
*/
$config['database']['user_sess']['table'] = 'user_login_sessions';
$config['database']['user_sess']['join'] = 'user_login_sessions.usess_uacc_fk';
$config['database']['user_sess']['columns']['user_id'] = 'usess_uacc_fk';
$config['database']['user_sess']['columns']['series'] = 'usess_series';
$config['database']['user_sess']['columns']['token'] = 'usess_token';
$config['database']['user_sess']['columns']['date'] = 'usess_login_date';
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
// Custom User Related Tables
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
/**
* Additional custom tables that are directly related to the user account table can be included in flexi auth CRUD functions by
* setting their database structure via the the $config['database'] array.
*
* Typically, such examples of a custom table you may wish to link to the user account table would be a user profile table listing the
* users name and contact details etc.
*
* You are not limited to the number of different custom tables you can define.
*
* ### Example Custom Table Template ###
* $config['database']['custom']['#Array Alias#']['table'] = '#Actual table name#';
* $config['database']['custom']['#Array Alias#']['primary_key'] = '#Table primary key#';
* $config['database']['custom']['#Array Alias#']['foreign_key'] = '#Table foreign key (Usually the table join column)#';
* $config['database']['custom']['#Array Alias#']['join'] = '#Actual table name#.#Foreign key column to main user table "user_acc"#';
* $config['database']['custom']['#Array Alias#']['custom_columns'] = array('#Column1#','#Column2#');
*
* Note: No custom tables are required to use flexi auth and the custom 'User Profile' and 'User Address' tables below are set only as examples.
*/
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
/**
* Custom User Profile Table
* Example table used to hold profile data on each user.
*
* Note: This table and all included fields can be expanded upon or removed completely.
*/
$config['database']['custom']['user_profile']['table'] = 'demo_user_profiles';
$config['database']['custom']['user_profile']['primary_key'] = 'upro_id';
$config['database']['custom']['user_profile']['foreign_key'] = 'upro_uacc_fk';
$config['database']['custom']['user_profile']['join'] = 'demo_user_profiles.upro_uacc_fk';
$config['database']['custom']['user_profile']['custom_columns'] = array(
'upro_first_name','upro_last_name','upro_phone','upro_newsletter'
);
###+++++++++++++++++++++++++++###
/**
* Custom User Address Table
* Example table used to hold address data on each user.
* By holding this data in a separate table from the profile data table above, a user can save multiple addresses.
*
* Note: This table and all included fields can be expanded upon or removed completely.
*/
$config['database']['custom']['user_address']['table'] = 'demo_user_address';
$config['database']['custom']['user_address']['primary_key'] = 'uadd_id';
$config['database']['custom']['user_address']['foreign_key'] = 'uadd_uacc_fk';
$config['database']['custom']['user_address']['join'] = 'demo_user_address.uadd_uacc_fk';
$config['database']['custom']['user_address']['custom_columns'] = array(
'uadd_alias','uadd_recipient','uadd_phone','uadd_company','uadd_address_01','uadd_address_02','uadd_city','uadd_county',
'uadd_post_code','uadd_country'
);
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
// DATABASE SETTINGS
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
/**
* flexi auth Database Settings
* If required, it is possible to set your own column names and data types for some database settings.
*
* Note: Only change the value after the '=' sign, and not the $config array names.
* Example: Change $config['database']['settings']['example'] = 'example_value_1' to $config['database']['settings']['example'] = 'example_value_2'
*/
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
/**
* Primary User Identity Column
* Set the column to be used to primarily identify users.
*
* Note: The column MUST be either the ['email'] or ['username'] columns from the main user account table, and must contain a unique column name.
*/
$config['database']['settings']['primary_identity_col'] = 'uacc_email';
/**
* User Identity Columns
* Set whether the users email address, username or both are to be used to identify users from data submitted via a login form.
* This MUST include the ['primary_identity_col'] column set above (Default 'uacc_email').
* If both the email address and username are used, then users will be able to login by submitting either value.
*
* Note: The only valid columns are the users email address (Default column name 'uacc_email') or username (Default column name'uacc_username').
*/
$config['database']['settings']['identity_cols'] = array('uacc_email', 'uacc_username');
/**
* User Search Query Columns
* Set the table columns that are looked-up by the libraries search_users() function to match users against submitted search query terms.
*
* Note: Any column within the user main account, custom or group tables can be added to array
*/
$config['database']['settings']['search_user_cols'] = array('uacc_email', 'upro_first_name', 'upro_last_name');
/**
* Database Date / Time Format
* Set a native PHP function to format the date and time correctly to be stored within the user tables.
* Typically this will either be either DATETIME or TIMESTAMP.
*
* MySQL DATETIME = date('Y-m-d H:i:s');
* Unix TIMESTAMP = time();
*
* Note: Ensure you consistently use the same data type in all defined flexi auth tables for date and time data.
*/
$config['database']['settings']['date_time'] = date('Y-m-d H:i:s');
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
// SESSION NAMES / ALIASES
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
/**
* flexi auth Session
* flexi auth uses CI sessions to store and serve authentication data between pages loads.
* All flexi auth session data is stored together within one session array, this helps maintain a tidy session structure.
*
* If required, it is possible to set your own name for each session variable.
* Note: Only change the name in the apostrophes (after the '=' sign), and not the $config array names.
* Example: Change $config['sessions']['user_id'] = 'user_id' to $config['sessions']['user_id'] = 'new_session_name'
*/
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
/**
* Auth Session Name
* Set the root auth session name saved as an array in the CI session, all other flexi auth session data is then stored within this array.
*/
$config['sessions']['name'] = 'flexi_auth';
/**
* Primary User Indentifier Session
* Contains the $config['database']['settings']['primary_identity_col'] column value (Defined above).
* This value is then used to internally identify the user when performing CRUD functions.
*/
$config['sessions']['user_identifier'] = 'user_identifier';
/**
* User Account Data Sessions
* Used for performing various CRUD functions.
*/
$config['sessions']['user_id'] = 'user_id';
$config['sessions']['is_admin'] = 'admin';
$config['sessions']['group'] = 'group';
$config['sessions']['privileges'] = 'privileges';
/**
* Login Via Password
* Indicate whether the user logged in via entering a password or was logged in automatically via the 'Remember me' function.
*/
$config['sessions']['logged_in_via_password'] = 'logged_in_via_password';
/**
* Login Session Token
* The login session token is used to help validate a users login credentials against a stored database token.
*
* Note: Only used when $config['security']['validate_login_onload'] = TRUE (Defined Below)
*/
$config['sessions']['login_session_token'] = 'login_session_token';
/**
* Math Captcha Flash Session
* Used to store the answer of a math captcha question, this data is stored only in a CI flash session and so will only be available on the next page and is then deleted.
*/
$config['sessions']['math_captcha'] = 'math_captcha';
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
// COOKIE NAMES / ALIASES
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
/**
* flexi auth Cookies
* flexi auth uses cookies to store and serve authentication data for the next time a user visits the website.
*
* If required, it is possible to set your own name for each cookie variable.
* Note: Only change the name in the apostrophes (after the '=' sign), and not the $config array names.
* Example: Change $config['cookies']['user_id'] = 'user_id' to $config['cookies']['user_id'] = 'new_session_name'
*/
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
/**
* 'Remember me' Cookies
* Used to store 'Remember me' data to automatically log a user in next time they visit the website.
*/
$config['cookies']['user_id'] = 'user_id';
$config['cookies']['remember_series'] = 'remember_series';
$config['cookies']['remember_token'] = 'remember_token';
/**
* Login Session Cookie
* The cookie login session token is used to invalidate a users login session when they close their browser by deleting itself.
*
* Note: Only used when $config['security']['validate_login_onload'] = TRUE and $config['security']['logout_user_onclose'] = TRUE (Defined Below)
*/
$config['cookies']['login_session_token'] = 'login_session_token';
/**
* Login Via Password Cookie
* The login via password cookie token is used to invalidate a users 'logged in via password' status when they close their browser by deleting itself.
*
* Note: Only used when $config['security']['logout_user_onclose'] = FALSE (Defined Below)
*/
$config['cookies']['login_via_password_token'] = 'login_via_password_token';
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
// SECURITY CONFIGURATIONS
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
/**
* flexi auth Security Configurations
* Many of flexi auths security features are customisable and can even be turned on and off to suit different websites.
*
* Note: Only change the value after the '=' sign, and not the $config array names.
* Example: Change $config['security']['example'] = TRUE to $config['security']['example'] = FALSE
*/
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
// LOGIN COOKIE AND SESSION SETTINGS
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
/**
* Set whether login details are validated on every page load.
* @param bool
*
* TRUE = Login credentials are validated against the database everytime a page is loaded, invalid users are logged out automatically.
* FALSE = Login credentials are validated only once at time of login and will not expire until CI sessions expire (Defined via CI config file).
*/
$config['security']['validate_login_onload'] = TRUE;
/**
* Set the lifetime of a user login session in seconds.
* @param int
*
* Example: 60*30 = 30 minutes, 60*60*24 = 1 day, 86400 = 1 day, 0 = Unlimited
* Setting the value as '0' would mean the session would not expire until CIs own session value (config['sess_expiration'] in CI config file) expired.
*
* Note: Only used when $config['security']['validate_login_onload'] = TRUE
* !IMPORTANT:
* If the CI config setting '$config['sess_expiration']' is lower, it will cause the session to expire prior to the 'login_session_expire' value.
* If 'Remember me' cookies are used, and a users login session expires, they will remain logged in via the 'Remember me' cookie.
* There are then functions within the library to check whether a user is logged in via entering a password, or via a cookie - typically sensitive data should
* only be available to users logged in via a password, and less sensitive data to users logged in via 'Remember me' cookies.
*/
$config['security']['login_session_expire'] = 60*60*3;
/**
* Set whether a users login time is extended when their session token is validated (On every page load).
* @param bool
*
* Note: Only used when $config['security']['validate_login_onload'] = TRUE
*/
$config['security']['extend_login_session'] = TRUE;
/**
* Set whether a user is logged out as soon as the browser is closed.
* Creates a cookie with a 0 lifetime that is deleted when the browser is closed.
* This invalidates the users session the next time they visit the website as there is no longer a matching cookie.
* @param bool
*
* Note: Only used when $config['security']['validate_login_onload'] = TRUE
* !IMPORTANT: 'logout_user_onclose' will also void any 'Remember me' cookies and so both features should not be used together.
*/
$config['security']['logout_user_onclose'] = TRUE;
/**
* Set whether a user has their 'logged in via password' status removed as soon as the browser is closed.
* If the user enabled the 'Remember me' feature on login, and their session is still valid, they will have a 'logged in via "Remember me"' status on their next visit.
* If the user did not enable the 'Remember me' feature on login, they will be logged out on their next visit.
*
* If this setting is not enabled, a user who has logged in via password will have the same login status if they close the browser and revisit the
* site before the login session expires ('login_session_expire').
*
* The feature works by creating a cookie with a 0 lifetime that is deleted when the browser is closed.
* This invalidates the users session the next time they visit the website as there is no longer a matching cookie.
* @param bool
*
* Note: Only used when $config['security']['logout_user_onclose'] = FALSE
*/
$config['security']['unset_password_status_onclose'] = TRUE;
/**
* Set the lifetime of a users login cookies in seconds, this includes the 'Remember me' cookies.
* @param int
*
* Example: 60*60*24 = 24 hours, 60*60*24*14 = 14 days, 86400 = 1 day
*/
$config['security']['user_cookie_expire'] = 60*60*24*14;
/**
* Set whether a users 'Remember me' login cookies have their lifetime extended when their session token is validated.
* @param bool
*/
$config['security']['extend_cookies_on_login'] = TRUE;
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
// PASSWORD SETTINGS
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
/**
* Set the minimum required characters for the users password.
* @param int
*/
$config['security']['min_password_length'] = 8;
/**
* Set which characters are valid for user passwords.
* Default allows alpha-numeric, dashes, underscores, periods and commas ('\.\,\-_ a-z0-9').
* Note this is a regular expression.
*/
$config['security']['valid_password_chars'] = '\.\,\-_ a-z0-9';
/**
* Set the static (non-database stored) salt used for password and hash token generation.
* @param string
*
* !IMPORTANT:
* Do NOT change this salt once users have started registering accounts as their passwords will not work without the original salt.
* CHANGE THE DEFAULT STATIC SALT SET BELOW TO YOUR OWN RANDOM SET OF CHARACTERS.
*/
$config['security']['static_salt'] = 'change-me!';
/**
* Set whether a salt is stored in the database and then used for password and hash token generation.
* @param bool
*/
$config['security']['store_database_salt'] = TRUE;
/**
* Set the length of a stored database salt (See above).
* @param int
*
* Note: Only used if $config['security']['store_database_salt'] = TRUE
*/
$config['security']['database_salt_length'] = 10;
/**
* Set the expiry time of unused 'Forgotten Password' tokens.
* Users will be required to request a new 'Forgotten Password' token once expired.
* @param int
*
* Example: Time set in minutes, 0 = unlimited, 60*24 = 24 hours, 1440 = 24 hours.
*/
$config['security']['expire_forgotten_password'] = 15;
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
// FAILED LOGIN ATTEMPT SETTINGS
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
/**
* Set a limit to the number of failed login attempts.
* Once limit is passed, user is blocked from another attempt until time ban passes (Defined by $config['security']['login_attempt_time_ban'] below).
* Additionally/alternatively, a captcha can be set to show once this limit is reached by using the 'ip_login_attempts_exceeded()' library function.
* @param int
*
* Note: If a user exceeds 3 times the limit set, the resulting time ban is doubled to further slow down attempts.
* Example: 0 = unlimited attempts, 3 = 3 attempts.
*/
$config['security']['login_attempt_limit'] = 3;
/**
* If a user has exceeded the failed login attempt limit, set the length of time they must wait before they can attempt to login again.
* @param int
*
* Note: The time ban is doubled if the failed attempts are 3 times higher than the limit defined via $config['security']['login_attempt_limit'].
* Example: If 'login_attempt_limit' = 3 and 'login_attempt_time_ban' = 10, after 3 failed attempts, the user must wait 10 seconds between each next attempt,
* after 9 consecutive failed attempts, the user must wait 20 seconds between each next attempt. Attempts within the time ban are ignored and not even checked as being valid.
* !IMPORTANT: It is NOT recommended that this time ban is set for a long period of time (> 5 mins).
* Long time bans could be abused by attackers to deny legitimate users access, it is designed to SLOW DOWN brute force attackers, not outright ban them.
*
* Example: Time in seconds, 0 = no time ban, 10 = 10 seconds, 60*3 = 3 minutes.
*/
$config['security']['login_attempt_time_ban'] = 10;
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
// Google reCAPTCHA SETTINGS
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
/**
* flexi auth Google reCAPTCHA Settings.
* Google reCAPTCHA can be used to help slow down brute force login attempts, requiring the user to complete the CAPTCHA before their login details will be submitted.
*
* Note: Only change the value after the '=' sign, and not the $config array names.
* Example: Change $config['security']['example'] = 'example_value_1' to $config['security']['example'] = 'example_value_2'
*/
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
/**
* reCAPTCHA Keys
* Set your unique reCAPTCHA api keys.
* !IMPORTANT: Obtain YOUR OWN reCAPTCHA keys from http://www.google.com/recaptcha.
*/
$config['security']['recaptcha_public_key'] = 'ENTER_RECAPTCHA_PUBLIC_KEY_HERE';
$config['security']['recaptcha_private_key'] = 'ENTER_RECAPTCHA_PRIVATE_KEY_HERE';
/**
* Set the theme of the reCAPTCHA. For custom theming, see https://developers.google.com/recaptcha/docs/customization
* Predefined themes: 'red', 'white', 'blackglass', 'clean'. Set 'custom' for custom themes.
*/
$config['security']['recaptcha_theme'] = 'white';
/**
* Set the language of the reCAPTCHA.
* Supported languages: English 'en', Dutch 'nl', French 'fr', German 'de', Portuguese 'pt', Russian 'ru', Spanish 'es', Turkish 'tr'.
*/
$config['security']['recaptcha_language'] = 'en';
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
// GENERAL CONFIGURATION SETTINGS
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
/**
* General flexi auth Settings
* Many of flexi auths automatic functions are customisable and can even be turned on and off to suit different websites.
*
* Note: Only change the value after the '=' sign, and not the $config array names.
* Example: Change $config['settings']['example'] = TRUE to $config['settings']['example'] = FALSE
*/
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
/**
* Set whether an incremented number is added to the end of an unavailable username.
* Example: If username 'flexi' is already in use, the next user to use 'flexi' as their username will be automatically updated to 'flexi1'.
* @param: bool
*
* Note: This only applies if the username is not set as the primary identity column ($config['database']['settings']['primary_identity_col'])
*/
$config['settings']['auto_increment_username'] = FALSE;
/**
* Set whether accounts are suspended by default on registration / inserting user.
* This option allows admins to verify account details before enabling users.
* @param: bool
*/
$config['settings']['suspend_new_accounts'] = FALSE;
/**
* Set a time limit to grant users instant login access, once expired, they are locked out until they activate their account via an activation email sent to them.
* @param: int
*
* Example: Time in minutes, 0 = unlimited, 60*24 = 24 hours, 1440 = 24 hours
*/
$config['settings']['account_activation_time_limit'] = 0;
/**
* Set the id of the default group that new users will be added to unless otherwise specified.
* @param: int
*/
$config['settings']['default_group_id'] = 1;
/**
* Set whether user privileges should be determined by individual privileges assigned per user, or via privileges assigned to a users user group.
* @param array
*
* Options: array('user','group'), array('user'), array('group')
*/
$config['settings']['privilege_sources'] = array('user','group');
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
// EMAIL CONFIGURATION SETTINGS
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
/**
* flexi auth Email Settings
* Some of the functions in flexi auth need to send emails to the user (i.e. 'Account Activation', 'Forgot Password' etc).
* If required, the title, reply address, email type and the content of these emails can be configured to suit different website needs.
*
* Note: Only change the value after the '=' sign, and not the $config array names.
* Example: Change $config['email']['example'] = 'example_value_1' to $config['email']['example'] = 'example_value_2'
*/
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
// Site title shown as 'from' header on emails.
$config['email']['site_title'] = "flexi auth";
// Reply email shown as 'from' header on emails.
$config['email']['reply_email'] = "info@website.com";
/**
* Type of email to send, options: 'html', 'text'.
* Note: If using 'text', the default code within the flexi auth templates use HTML which will be emailed as plain text.
*/
$config['email']['email_type'] = 'html';
/**
* Directory where email templates are stored.
* Default: 'includes/email/'
*/
$config['email']['email_template_directory'] = 'includes/email/';
/**
* 'Activate Account' email template.
* Default: 'activate_account.tpl.php'
*/
$config['email']['email_template_activate'] = 'activate_account.tpl.php';
/**
* 'Forgot Password' email template.
* Default: 'forgot_password.tpl.php'
*/
$config['email']['email_template_forgot_password'] = 'forgot_password.tpl.php';
/**
* 'Forgot Password Complete' email template.
* Default: 'new_password.tpl.php'
*/
$config['email']['email_template_forgot_password_complete'] = 'new_password.tpl.php';
/**
* 'Update Email' email template.
* Default: 'update_email_address.tpl.php'
*/
$config['email']['email_template_update_email'] = 'update_email_address.tpl.php';
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
// MESSAGE SETTINGS
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
/**
* Message Delimiter Settings
* Define status and error message delimiters to style auth messages.
* @param: string
*
* Example: ['status_prefix'] = '<p class="status_msg">', ['status_suffix'] = '</p>'
*/
// Message Start Delimiter
$config['messages']['delimiters']['status_prefix'] = '<p class="status_msg">';
// Message End Delimiter
$config['messages']['delimiters']['status_suffix'] = '</p>';
// Error Start Delimiter
$config['messages']['delimiters']['error_prefix'] = '<p class="error_msg">';
// Error End Delimiter
$config['messages']['delimiters']['error_suffix'] = '</p>';
###++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++###
/**
* Message Visibility
* Define which status and error messages are returned as public or admin messages, or which messages are not returned at all.
* Public messages are intended to be displayed to public and admin users, whilst admin messages are intended for admin users only.
*
* Example:
* Public and Admin message = $config['messages']['target_user']['account_creation_successful'] = 'public';
* Admin Only message = $config['messages']['target_user']['account_creation_successful'] = 'admin';
* Do NOT set public or admin message = $config['messages']['target_user']['account_creation_successful'] = FALSE;
*/
// Account Creation
$config['messages']['target_user']['account_creation_successful'] = 'public';
$config['messages']['target_user']['account_creation_unsuccessful'] = 'public';
$config['messages']['target_user']['account_creation_duplicate_email'] = 'public';
$config['messages']['target_user']['account_creation_duplicate_username'] = 'public';
$config['messages']['target_user']['account_creation_duplicate_identity'] = 'public';
$config['messages']['target_user']['account_creation_insufficient_data'] = 'public';
// Password
$config['messages']['target_user']['password_invalid'] = 'public';
$config['messages']['target_user']['password_change_successful'] = 'public';
$config['messages']['target_user']['password_change_unsuccessful'] = 'public';
$config['messages']['target_user']['password_token_invalid'] = 'public';
$config['messages']['target_user']['email_new_password_successful'] = 'public';
$config['messages']['target_user']['email_forgot_password_successful'] = 'public';
$config['messages']['target_user']['email_forgot_password_unsuccessful'] = 'public';
// Activation
$config['messages']['target_user']['activate_successful'] = 'public';
$config['messages']['target_user']['activate_unsuccessful'] = 'public';
$config['messages']['target_user']['deactivate_successful'] = 'public';
$config['messages']['target_user']['deactivate_unsuccessful'] = 'public';
$config['messages']['target_user']['activation_email_successful'] = 'public';
$config['messages']['target_user']['activation_email_unsuccessful'] = 'public';
$config['messages']['target_user']['account_requires_activation'] = 'public';
$config['messages']['target_user']['account_already_activated'] = 'public';
$config['messages']['target_user']['email_activation_email_successful'] = 'public';
$config['messages']['target_user']['email_activation_email_unsuccessful'] = 'public';
// Login / Logout
$config['messages']['target_user']['login_successful'] = 'public';
$config['messages']['target_user']['login_unsuccessful'] = 'public';
$config['messages']['target_user']['logout_successful'] = 'public';
$config['messages']['target_user']['login_details_invalid'] = 'public';
$config['messages']['target_user']['captcha_answer_invalid'] = 'public';
$config['messages']['target_user']['login_attempts_exceeded'] = 'public';
$config['messages']['target_user']['login_session_expired'] = 'public';
$config['messages']['target_user']['account_suspended'] = 'public';
// Account Changes
$config['messages']['target_user']['update_successful'] = 'public';
$config['messages']['target_user']['update_unsuccessful'] = 'public';
$config['messages']['target_user']['delete_successful'] = 'public';
$config['messages']['target_user']['delete_unsuccessful'] = 'public';
// Form Validation
$config['messages']['target_user']['form_validation_duplicate_identity'] = 'public';
$config['messages']['target_user']['form_validation_duplicate_email'] = 'public';
$config['messages']['target_user']['form_validation_duplicate_username'] = 'public';
/* End of file flexi_auth.php */
/* Location: ./system/application/config/flexi_auth.php */ | 0x6a | trunk/application/config/flexi_auth.php | PHP | asf20 | 37,310 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$_doctypes = array(
'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
'xhtml1-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
'xhtml1-trans' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
'xhtml1-frame' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
'html5' => '<!DOCTYPE html>',
'html4-strict' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
'html4-trans' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
'html4-frame' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">'
);
/* End of file doctypes.php */
/* Location: ./application/config/doctypes.php */ | 0x6a | trunk/application/config/doctypes.php | PHP | asf20 | 1,138 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| SMILEYS
| -------------------------------------------------------------------
| This file contains an array of smileys for use with the emoticon helper.
| Individual images can be used to replace multiple simileys. For example:
| :-) and :) use the same image replacement.
|
| Please see user guide for more info:
| http://codeigniter.com/user_guide/helpers/smiley_helper.html
|
*/
$smileys = array(
// smiley image name width height alt
':-)' => array('grin.gif', '19', '19', 'grin'),
':lol:' => array('lol.gif', '19', '19', 'LOL'),
':cheese:' => array('cheese.gif', '19', '19', 'cheese'),
':)' => array('smile.gif', '19', '19', 'smile'),
';-)' => array('wink.gif', '19', '19', 'wink'),
';)' => array('wink.gif', '19', '19', 'wink'),
':smirk:' => array('smirk.gif', '19', '19', 'smirk'),
':roll:' => array('rolleyes.gif', '19', '19', 'rolleyes'),
':-S' => array('confused.gif', '19', '19', 'confused'),
':wow:' => array('surprise.gif', '19', '19', 'surprised'),
':bug:' => array('bigsurprise.gif', '19', '19', 'big surprise'),
':-P' => array('tongue_laugh.gif', '19', '19', 'tongue laugh'),
'%-P' => array('tongue_rolleye.gif', '19', '19', 'tongue rolleye'),
';-P' => array('tongue_wink.gif', '19', '19', 'tongue wink'),
':P' => array('raspberry.gif', '19', '19', 'raspberry'),
':blank:' => array('blank.gif', '19', '19', 'blank stare'),
':long:' => array('longface.gif', '19', '19', 'long face'),
':ohh:' => array('ohh.gif', '19', '19', 'ohh'),
':grrr:' => array('grrr.gif', '19', '19', 'grrr'),
':gulp:' => array('gulp.gif', '19', '19', 'gulp'),
'8-/' => array('ohoh.gif', '19', '19', 'oh oh'),
':down:' => array('downer.gif', '19', '19', 'downer'),
':red:' => array('embarrassed.gif', '19', '19', 'red face'),
':sick:' => array('sick.gif', '19', '19', 'sick'),
':shut:' => array('shuteye.gif', '19', '19', 'shut eye'),
':-/' => array('hmm.gif', '19', '19', 'hmmm'),
'>:(' => array('mad.gif', '19', '19', 'mad'),
':mad:' => array('mad.gif', '19', '19', 'mad'),
'>:-(' => array('angry.gif', '19', '19', 'angry'),
':angry:' => array('angry.gif', '19', '19', 'angry'),
':zip:' => array('zip.gif', '19', '19', 'zipper'),
':kiss:' => array('kiss.gif', '19', '19', 'kiss'),
':ahhh:' => array('shock.gif', '19', '19', 'shock'),
':coolsmile:' => array('shade_smile.gif', '19', '19', 'cool smile'),
':coolsmirk:' => array('shade_smirk.gif', '19', '19', 'cool smirk'),
':coolgrin:' => array('shade_grin.gif', '19', '19', 'cool grin'),
':coolhmm:' => array('shade_hmm.gif', '19', '19', 'cool hmm'),
':coolmad:' => array('shade_mad.gif', '19', '19', 'cool mad'),
':coolcheese:' => array('shade_cheese.gif', '19', '19', 'cool cheese'),
':vampire:' => array('vampire.gif', '19', '19', 'vampire'),
':snake:' => array('snake.gif', '19', '19', 'snake'),
':exclaim:' => array('exclaim.gif', '19', '19', 'excaim'),
':question:' => array('question.gif', '19', '19', 'question') // no comma after last item
);
/* End of file smileys.php */
/* Location: ./application/config/smileys.php */ | 0x6a | trunk/application/config/smileys.php | PHP | asf20 | 3,295 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| MIME TYPES
| -------------------------------------------------------------------
| This file contains an array of mime types. It is used by the
| Upload class to help identify allowed file types.
|
*/
$mimes = array( 'hqx' => 'application/mac-binhex40',
'cpt' => 'application/mac-compactpro',
'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel'),
'bin' => 'application/macbinary',
'dms' => 'application/octet-stream',
'lha' => 'application/octet-stream',
'lzh' => 'application/octet-stream',
'exe' => array('application/octet-stream', 'application/x-msdownload'),
'class' => 'application/octet-stream',
'psd' => 'application/x-photoshop',
'so' => 'application/octet-stream',
'sea' => 'application/octet-stream',
'dll' => 'application/octet-stream',
'oda' => 'application/oda',
'pdf' => array('application/pdf', 'application/x-download'),
'ai' => 'application/postscript',
'eps' => 'application/postscript',
'ps' => 'application/postscript',
'smi' => 'application/smil',
'smil' => 'application/smil',
'mif' => 'application/vnd.mif',
'xls' => array('application/excel', 'application/vnd.ms-excel', 'application/msexcel'),
'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint'),
'wbxml' => 'application/wbxml',
'wmlc' => 'application/wmlc',
'dcr' => 'application/x-director',
'dir' => 'application/x-director',
'dxr' => 'application/x-director',
'dvi' => 'application/x-dvi',
'gtar' => 'application/x-gtar',
'gz' => 'application/x-gzip',
'php' => 'application/x-httpd-php',
'php4' => 'application/x-httpd-php',
'php3' => 'application/x-httpd-php',
'phtml' => 'application/x-httpd-php',
'phps' => 'application/x-httpd-php-source',
'js' => 'application/x-javascript',
'swf' => 'application/x-shockwave-flash',
'sit' => 'application/x-stuffit',
'tar' => 'application/x-tar',
'tgz' => array('application/x-tar', 'application/x-gzip-compressed'),
'xhtml' => 'application/xhtml+xml',
'xht' => 'application/xhtml+xml',
'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed'),
'mid' => 'audio/midi',
'midi' => 'audio/midi',
'mpga' => 'audio/mpeg',
'mp2' => 'audio/mpeg',
'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),
'aif' => 'audio/x-aiff',
'aiff' => 'audio/x-aiff',
'aifc' => 'audio/x-aiff',
'ram' => 'audio/x-pn-realaudio',
'rm' => 'audio/x-pn-realaudio',
'rpm' => 'audio/x-pn-realaudio-plugin',
'ra' => 'audio/x-realaudio',
'rv' => 'video/vnd.rn-realvideo',
'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'),
'bmp' => array('image/bmp', 'image/x-windows-bmp'),
'gif' => 'image/gif',
'jpeg' => array('image/jpeg', 'image/pjpeg'),
'jpg' => array('image/jpeg', 'image/pjpeg'),
'jpe' => array('image/jpeg', 'image/pjpeg'),
'png' => array('image/png', 'image/x-png'),
'tiff' => 'image/tiff',
'tif' => 'image/tiff',
'css' => 'text/css',
'html' => 'text/html',
'htm' => 'text/html',
'shtml' => 'text/html',
'txt' => 'text/plain',
'text' => 'text/plain',
'log' => array('text/plain', 'text/x-log'),
'rtx' => 'text/richtext',
'rtf' => 'text/rtf',
'xml' => 'text/xml',
'xsl' => 'text/xml',
'mpeg' => 'video/mpeg',
'mpg' => 'video/mpeg',
'mpe' => 'video/mpeg',
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',
'avi' => 'video/x-msvideo',
'movie' => 'video/x-sgi-movie',
'doc' => 'application/msword',
'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip'),
'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip'),
'word' => array('application/msword', 'application/octet-stream'),
'xl' => 'application/excel',
'eml' => 'message/rfc822',
'json' => array('application/json', 'text/json')
);
/* End of file mimes.php */
/* Location: ./application/config/mimes.php */
| 0x6a | trunk/application/config/mimes.php | PHP | asf20 | 4,453 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| File and Directory Modes
|--------------------------------------------------------------------------
|
| These prefs are used when checking and setting modes when working
| with the file system. The defaults are fine on servers with proper
| security, but you may wish (or even need) to change the values in
| certain environments (Apache running a separate process for each
| user, PHP under CGI with Apache suEXEC, etc.). Octal values should
| always be used to set the mode correctly.
|
*/
define('FILE_READ_MODE', 0644);
define('FILE_WRITE_MODE', 0666);
define('DIR_READ_MODE', 0755);
define('DIR_WRITE_MODE', 0777);
/*
|--------------------------------------------------------------------------
| File Stream Modes
|--------------------------------------------------------------------------
|
| These modes are used when working with fopen()/popen()
|
*/
define('FOPEN_READ', 'rb');
define('FOPEN_READ_WRITE', 'r+b');
define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
define('FOPEN_WRITE_CREATE', 'ab');
define('FOPEN_READ_WRITE_CREATE', 'a+b');
define('FOPEN_WRITE_CREATE_STRICT', 'xb');
define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
/* End of file constants.php */
/* Location: ./application/config/constants.php */ | 0x6a | trunk/application/config/constants.php | PHP | asf20 | 1,558 |
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Email
| -------------------------------------------------------------------------
| This file lets you define parameters for sending emails.
| Please see the user guide for info:
|
| http://codeigniter.com/user_guide/libraries/email.html
|
*/
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
/* End of file email.php */
/* Location: ./application/config/email.php */ | 0x6a | trunk/application/config/email.php | PHP | asf20 | 563 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| DATABASE CONNECTIVITY SETTINGS
| -------------------------------------------------------------------
| This file will contain the settings needed to access your database.
|
| For complete instructions please consult the 'Database Connection'
| page of the User Guide.
|
| -------------------------------------------------------------------
| EXPLANATION OF VARIABLES
| -------------------------------------------------------------------
|
| ['hostname'] The hostname of your database server.
| ['username'] The username used to connect to the database
| ['password'] The password used to connect to the database
| ['database'] The name of the database you want to connect to
| ['dbdriver'] The database type. ie: mysql. Currently supported:
mysql, mysqli, postgre, odbc, mssql, sqlite, oci8
| ['dbprefix'] You can add an optional prefix, which will be added
| to the table name when using the Active Record class
| ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
| ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
| ['cache_on'] TRUE/FALSE - Enables/disables query caching
| ['cachedir'] The path to the folder where cache files should be stored
| ['char_set'] The character set used in communicating with the database
| ['dbcollat'] The character collation used in communicating with the database
| NOTE: For MySQL and MySQLi databases, this setting is only used
| as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
| (and in table creation queries made with DB Forge).
| There is an incompatibility in PHP with mysql_real_escape_string() which
| can make your site vulnerable to SQL injection if you are using a
| multi-byte character set and are running versions lower than these.
| Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
| ['swap_pre'] A default table prefix that should be swapped with the dbprefix
| ['autoinit'] Whether or not to automatically initialize the database.
| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
| - good for ensuring strict SQL while developing
|
| The $active_group variable lets you choose which connection group to
| make active. By default there is only one group (the 'default' group).
|
| The $active_record variables lets you determine whether or not to load
| the active record class
*/
$active_group = 'default';
$active_record = TRUE;
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = '';
$db['default']['database'] = '0x6a';
$db['default']['dbdriver'] = 'mysqli';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = FALSE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
/* End of file database.php */
/* Location: ./application/config/database.php */ | 0x6a | trunk/application/config/database.php | PHP | asf20 | 3,285 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| AUTO-LOADER
| -------------------------------------------------------------------
| This file specifies which systems should be loaded by default.
|
| In order to keep the framework as light-weight as possible only the
| absolute minimal resources are loaded by default. For example,
| the database is not connected to automatically since no assumption
| is made regarding whether you intend to use it. This file lets
| you globally define which systems you would like loaded with every
| request.
|
| -------------------------------------------------------------------
| Instructions
| -------------------------------------------------------------------
|
| These are the things you can load automatically:
|
| 1. Packages
| 2. Libraries
| 3. Helper files
| 4. Custom config files
| 5. Language files
| 6. Models
|
*/
/*
| -------------------------------------------------------------------
| Auto-load Packges
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared');
|
*/
$autoload['packages'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Libraries
| -------------------------------------------------------------------
| These are the classes located in the system/libraries folder
| or in your application/libraries folder.
|
| Prototype:
|
| $autoload['libraries'] = array('database', 'session', 'xmlrpc');
*/
$autoload['libraries'] =array( 'database','smarty3','lang','xmlrpc','parser');
/*
| -------------------------------------------------------------------
| Auto-load Helper Files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array('url','string');
/*
| -------------------------------------------------------------------
| Auto-load Config files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['config'] = array('config1', 'config2');
|
| NOTE: This item is intended for use ONLY if you have created custom
| config files. Otherwise, leave it blank.
|
*/
$autoload['config'] = array('frontend');
/*
| -------------------------------------------------------------------
| Auto-load Language files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['language'] = array('lang1', 'lang2');
|
| NOTE: Do not include the "_lang" part of your file. For example
| "codeigniter_lang.php" would be referenced as array('codeigniter');
|
*/
$autoload['language'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Models
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['model'] = array('model1', 'model2');
|
*/
$autoload['model'] = array();
/* End of file autoload.php */
/* Location: ./application/config/autoload.php */ | 0x6a | trunk/application/config/autoload.php | PHP | asf20 | 3,158 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Profiler Sections
| -------------------------------------------------------------------------
| This file lets you determine whether or not various sections of Profiler
| data are displayed when the Profiler is enabled.
| Please see the user guide for info:
|
| http://codeigniter.com/user_guide/general/profiling.html
|
*/
/* End of file profiler.php */
/* Location: ./application/config/profiler.php */ | 0x6a | trunk/application/config/profiler.php | PHP | asf20 | 564 |
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html> | 0x6a | trunk/application/config/index.html | HTML | asf20 | 114 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
| http://example.com/
|
| If this is not set then CodeIgniter will guess the protocol, domain and
| path to your installation.
|
*/
$config['base_url'] = '';
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = '';
/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string. The default setting of 'AUTO' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'AUTO' Default - auto detects
| 'PATH_INFO' Uses the PATH_INFO
| 'QUERY_STRING' Uses the QUERY_STRING
| 'REQUEST_URI' Uses the REQUEST_URI
| 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO
|
*/
$config['uri_protocol'] = 'request_uri';
/*
|--------------------------------------------------------------------------
| URL suffix
|--------------------------------------------------------------------------
|
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
| For more information please see the user guide:
|
| http://codeigniter.com/user_guide/general/urls.html
*/
$config['url_suffix'] = '.html';
/*
|--------------------------------------------------------------------------
| Default Language
|--------------------------------------------------------------------------
|
| This determines which set of language files should be used. Make sure
| there is an available translation if you intend to use something other
| than english.
|
*/
$config['language'] = 'english';
/*
|--------------------------------------------------------------------------
| Default Character Set
|--------------------------------------------------------------------------
|
| This determines which character set is used by default in various methods
| that require a character set to be provided.
|
*/
$config['charset'] = 'UTF-8';
/*
|--------------------------------------------------------------------------
| Enable/Disable System Hooks
|--------------------------------------------------------------------------
|
| If you would like to use the 'hooks' feature you must enable it by
| setting this variable to TRUE (boolean). See the user guide for details.
|
*/
$config['enable_hooks'] = FALSE;
/*
|--------------------------------------------------------------------------
| Class Extension Prefix
|--------------------------------------------------------------------------
|
| This item allows you to set the filename/classname prefix when extending
| native libraries. For more information please see the user guide:
|
| http://codeigniter.com/user_guide/general/core_classes.html
| http://codeigniter.com/user_guide/general/creating_libraries.html
|
*/
$config['subclass_prefix'] = 'Backend_';
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify with a regular expression which characters are permitted
| within your URLs. When someone tries to submit a URL with disallowed
| characters they will get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible. By default only these are allowed: a-z 0-9~%.:_-
|
| Leave blank to allow all characters -- but only if you are insane.
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
/*
|--------------------------------------------------------------------------
| Enable Query Strings
|--------------------------------------------------------------------------
|
| By default CodeIgniter uses search-engine friendly segment based URLs:
| example.com/who/what/where/
|
| By default CodeIgniter enables access to the $_GET array. If for some
| reason you would like to disable it, set 'allow_get_array' to FALSE.
|
| You can optionally enable standard query string based URLs:
| example.com?who=me&what=something&where=here
|
| Options are: TRUE or FALSE (boolean)
|
| The other items let you set the query string 'words' that will
| invoke your controllers and its functions:
| example.com/index.php?c=controller&m=function
|
| Please note that some of the helpers won't work as expected when
| this feature is enabled, since CodeIgniter is designed primarily to
| use segment based URLs.
|
*/
$config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd'; // experimental not currently in use
/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| If you have enabled error logging, you can set an error threshold to
| determine what gets logged. Threshold options are:
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
| 0 = Disables logging, Error logging TURNED OFF
| 1 = Error Messages (including PHP errors)
| 2 = Debug Messages
| 3 = Informational Messages
| 4 = All Messages
|
| For a live site you'll usually only enable Errors (1) to be logged otherwise
| your log files will fill up very fast.
|
*/
$config['log_threshold'] = 0;
/*
|--------------------------------------------------------------------------
| Error Logging Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/logs/ folder. Use a full server path with trailing slash.
|
*/
$config['log_path'] = '';
/*
|--------------------------------------------------------------------------
| Date Format for Logs
|--------------------------------------------------------------------------
|
| Each item that is logged has an associated date. You can use PHP date
| codes to set your own date formatting
|
*/
$config['log_date_format'] = 'Y-m-d H:i:s';
/*
|--------------------------------------------------------------------------
| Cache Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| system/cache/ folder. Use a full server path with trailing slash.
|
*/
$config['cache_path'] = 'cache/';
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| If you use the Encryption class or the Session class you
| MUST set an encryption key. See the user guide for info.
|
*/
$config['encryption_key'] = '48c6c450f1a4a0cc53d9585dc0fee742';
/*
|--------------------------------------------------------------------------
| Session Variables
|--------------------------------------------------------------------------
|
| 'sess_cookie_name' = the name you want for the cookie
| 'sess_expiration' = the number of SECONDS you want the session to last.
| by default sessions last 7200 seconds (two hours). Set to zero for no expiration.
| 'sess_expire_on_close' = Whether to cause the session to expire automatically
| when the browser window is closed
| 'sess_encrypt_cookie' = Whether to encrypt the cookie
| 'sess_use_database' = Whether to save the session data to a database
| 'sess_table_name' = The name of the session database table
| 'sess_match_ip' = Whether to match the user's IP address when reading the session data
| 'sess_match_useragent' = Whether to match the User Agent when reading the session data
| 'sess_time_to_update' = how many seconds between CI refreshing Session Information
|
*/
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;
/*
|--------------------------------------------------------------------------
| Cookie Related Variables
|--------------------------------------------------------------------------
|
| 'cookie_prefix' = Set a prefix if you need to avoid collisions
| 'cookie_domain' = Set to .your-domain.com for site-wide cookies
| 'cookie_path' = Typically will be a forward slash
| 'cookie_secure' = Cookies will only be set if a secure HTTPS connection exists.
|
*/
$config['cookie_prefix'] = "";
$config['cookie_domain'] = "";
$config['cookie_path'] = "/";
$config['cookie_secure'] = FALSE;
/*
|--------------------------------------------------------------------------
| Global XSS Filtering
|--------------------------------------------------------------------------
|
| Determines whether the XSS filter is always active when GET, POST or
| COOKIE data is encountered
|
*/
$config['global_xss_filtering'] = TRUE;
/*
|--------------------------------------------------------------------------
| Cross Site Request Forgery
|--------------------------------------------------------------------------
| Enables a CSRF cookie token to be set. When set to TRUE, token will be
| checked on a submitted form. If you are accepting user data, it is strongly
| recommended CSRF protection be enabled.
|
| 'csrf_token_name' = The token name
| 'csrf_cookie_name' = The cookie name
| 'csrf_expire' = The number in seconds the token should expire.
*/
$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
/*
|--------------------------------------------------------------------------
| Output Compression
|--------------------------------------------------------------------------
|
| Enables Gzip output compression for faster page loads. When enabled,
| the output class will test whether your server supports Gzip.
| Even if it does, however, not all browsers support compression
| so enable only if you are reasonably sure your visitors can handle it.
|
| VERY IMPORTANT: If you are getting a blank page when compression is enabled it
| means you are prematurely outputting something to your browser. It could
| even be a line of whitespace at the end of one of your scripts. For
| compression to work, nothing can be sent before the output buffer is called
| by the output class. Do not 'echo' any values with compression enabled.
|
*/
$config['compress_output'] = FALSE;
/*
|--------------------------------------------------------------------------
| Master Time Reference
|--------------------------------------------------------------------------
|
| Options are 'local' or 'gmt'. This pref tells the system whether to use
| your server's local time as the master 'now' reference, or convert it to
| GMT. See the 'date helper' page of the user guide for information
| regarding date handling.
|
*/
$config['time_reference'] = 'local';
/*
|--------------------------------------------------------------------------
| Rewrite PHP Short Tags
|--------------------------------------------------------------------------
|
| If your PHP installation does not have short tag support enabled CI
| can rewrite the tags on-the-fly, enabling you to utilize that syntax
| in your view files. Options are TRUE or FALSE (boolean)
|
*/
$config['rewrite_short_tags'] = FALSE;
/*
|--------------------------------------------------------------------------
| Reverse Proxy IPs
|--------------------------------------------------------------------------
|
| If your server is behind a reverse proxy, you must whitelist the proxy IP
| addresses from which CodeIgniter should trust the HTTP_X_FORWARDED_FOR
| header in order to properly identify the visitor's IP address.
| Comma-delimited, e.g. '10.0.1.200,10.0.1.201'
|
*/
$config['proxy_ips'] = '';
/* End of file config.php */
/* Location: ./application/config/config.php */
| 0x6a | trunk/application/config/config.php | PHP | asf20 | 13,216 |
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
$config['enable_cache']=false;
?>
| 0x6a | trunk/application/config/frontend.php | PHP | asf20 | 149 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Data Mapper Configuration
*
* Global configuration settings that apply to all DataMapped models.
*/
$config['prefix'] = '';
$config['join_prefix'] = 'join_';
$config['error_prefix'] = '';
$config['error_suffix'] = '';
$config['created_field'] = 'created';
$config['updated_field'] = 'updated';
$config['local_time'] = FALSE;
$config['unix_timestamp'] = FALSE;
$config['timestamp_format'] = 'Y-m-d H:i:s';
$config['lang_file_format'] = 'model_${model}';
$config['field_label_lang_format'] = '${model}_${field}';
$config['auto_transaction'] = FALSE;
$config['auto_populate_has_many'] = FALSE;
$config['auto_populate_has_one'] = FALSE;
$config['all_array_uses_ids'] = FALSE;
// set to FALSE to use the same DB instance across the board (breaks subqueries)
// Set to any acceptable parameters to $CI->database() to override the default.
$config['db_params'] = '';
// Uncomment to enable the production cache
// $config['production_cache'] = 'datamapper/cache';
$config['extensions_path'] = 'datamapper';
$config['extensions'] = array();
/* End of file datamapper.php */
/* Location: ./application/config/datamapper.php */
| 0x6a | trunk/application/config/datamapper.php | PHP | asf20 | 1,239 |
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html> | 0x6a | trunk/application/index.html | HTML | asf20 | 114 |
<?php
//session_save_path($_SERVER['DOCUMENT_ROOT'] . '/sessions');
//ini_set('session.gc_probability', 1);
session_start();
include 'libraries/function.php';
/*
*---------------------------------------------------------------
* APPLICATION ENVIRONMENT
*---------------------------------------------------------------
*
* You can load different configurations depending on your
* current environment. Setting the environment also influences
* things like logging and error reporting.
*
* This can be set to anything, but default usage is:
*
* development
* testing
* production
*
* NOTE: If you change these, also change the error_reporting() code below
*
*/
define('ENVIRONMENT', 'development');
/*
*---------------------------------------------------------------
* ERROR REPORTING
*---------------------------------------------------------------
*
* Different environments will require different levels of error reporting.
* By default development will show errors but testing and live will hide them.
*/
if (defined('ENVIRONMENT'))
{
switch (ENVIRONMENT)
{
case 'development':
error_reporting(E_ALL);
break;
case 'testing':
case 'production':
error_reporting(0);
break;
default:
exit('The application environment is not set correctly.');
}
}
/*
*---------------------------------------------------------------
* SYSTEM FOLDER NAME
*---------------------------------------------------------------
*
* This variable must contain the name of your "system" folder.
* Include the path if the folder is not in the same directory
* as this file.
*
*/
$system_path = 'system';
/*
*---------------------------------------------------------------
* APPLICATION FOLDER NAME
*---------------------------------------------------------------
*
* If you want this front controller to use a different "application"
* folder then the default one you can set its name here. The folder
* can also be renamed or relocated anywhere on your server. If
* you do, use a full server path. For more info please see the user guide:
* http://codeigniter.com/user_guide/general/managing_apps.html
*
* NO TRAILING SLASH!
*
*/
$application_folder = 'application';
/*
* --------------------------------------------------------------------
* DEFAULT CONTROLLER
* --------------------------------------------------------------------
*
* Normally you will set your default controller in the routes.php file.
* You can, however, force a custom routing by hard-coding a
* specific controller class/function here. For most applications, you
* WILL NOT set your routing here, but it's an option for those
* special instances where you might want to override the standard
* routing in a specific front controller that shares a common CI installation.
*
* IMPORTANT: If you set the routing here, NO OTHER controller will be
* callable. In essence, this preference limits your application to ONE
* specific controller. Leave the function name blank if you need
* to call functions dynamically via the URI.
*
* Un-comment the $routing array below to use this feature
*
*/
// The directory name, relative to the "controllers" folder. Leave blank
// if your controller is not in a sub-folder within the "controllers" folder
// $routing['directory'] = '';
// The controller class file name. Example: Mycontroller
// $routing['controller'] = '';
// The controller function you wish to be called.
// $routing['function'] = '';
/*
* -------------------------------------------------------------------
* CUSTOM CONFIG VALUES
* -------------------------------------------------------------------
*
* The $assign_to_config array below will be passed dynamically to the
* config class when initialized. This allows you to set custom config
* items or override any default config values found in the config.php file.
* This can be handy as it permits you to share one application between
* multiple front controller files, with each file containing different
* config values.
*
* Un-comment the $assign_to_config array below to use this feature
*
*/
// $assign_to_config['name_of_config_item'] = 'value of config item';
// --------------------------------------------------------------------
// END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
// --------------------------------------------------------------------
/*
* ---------------------------------------------------------------
* Resolve the system path for increased reliability
* ---------------------------------------------------------------
*/
// Set the current directory correctly for CLI requests
if (defined('STDIN'))
{
chdir(dirname(__FILE__));
}
if (realpath($system_path) !== FALSE)
{
$system_path = realpath($system_path).'/';
}
// ensure there's a trailing slash
$system_path = rtrim($system_path, '/').'/';
// Is the system path correct?
if ( ! is_dir($system_path))
{
exit("Your system folder path does not appear to be set correctly. Please open the following file and correct this: ".pathinfo(__FILE__, PATHINFO_BASENAME));
}
/*
* -------------------------------------------------------------------
* Now that we know the path, set the main path constants
* -------------------------------------------------------------------
*/
// The name of THIS file
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
// The PHP file extension
// this global constant is deprecated.
define('EXT', '.php');
// Path to the system folder
define('BASEPATH', str_replace("\\", "/", $system_path));
// Path to the front controller (this file)
define('FCPATH', str_replace(SELF, '', __FILE__));
// Name of the "system folder"
define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/'));
// The path to the "application" folder
if (is_dir($application_folder))
{
define('APPPATH', $application_folder.'/');
}
else
{
if ( ! is_dir(BASEPATH.$application_folder.'/'))
{
exit("Your application folder path does not appear to be set correctly. Please open the following file and correct this: ".SELF);
}
define('APPPATH', BASEPATH.$application_folder.'/');
}
/*
* --------------------------------------------------------------------
* LOAD THE BOOTSTRAP FILE
* --------------------------------------------------------------------
*
* And away we go...
*
*/
//require_once APPPATH.'third_party/datamapper/bootstrap.php';
require_once BASEPATH.'core/CodeIgniter.php';
/* End of file index.php */
/* Location: ./index.php */ | 0x6a | trunk/index.php | PHP | asf20 | 6,781 |
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Nivel1 here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Nivel1 extends World
{
/**
* Constructor for objects of class Nivel1.
*
*/
public Nivel1()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(700, 300, 1);
prepare();
}
/**
* Prepare the world for the start of the program. That is: create the initial
* objects and add them to the world.
*/
private void prepare()
{
Daga daga = new Daga();
addObject(daga, 0, 150);
Ninja ninja = new Ninja();
addObject(ninja, 56, 259);
}
}
| 131402-stick-ninja | trunk/Nivel1.java | Java | gpl3 | 841 |
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Nivel3 here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Nivel3 extends World
{
/**
* Constructor for objects of class Nivel3.
*
*/
public Nivel3()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(600, 400, 1);
}
}
| 131402-stick-ninja | trunk/Nivel3.java | Java | gpl3 | 481 |
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Elixir here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Elixir extends Bonos
{
/**
* Act - do whatever the Elixir wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
if(isTouching(Roca.class)){
this.setLocation(getX(), 250);
}
if(isTouching(Agujero.class)){
this.setLocation(getX()-20, getY());
}
}
}
| 131402-stick-ninja | trunk/Elixir.java | Java | gpl3 | 673 |
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Bonos here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Bonos extends Actor
{
/**
* Act - do whatever the Bonos wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
// Add your action code here.
}
}
| 131402-stick-ninja | trunk/Bonos.java | Java | gpl3 | 496 |
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Cuervo here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Cuervo extends Enemigos
{
private boolean facingLeft;
private int Speed;
private int animationCounter;
private final GreenfootImage cuervoL = new GreenfootImage("Cuervo.png");
private final GreenfootImage cuervoL0 = new GreenfootImage("Cuervo0.png");
private final GreenfootImage cuervoR = new GreenfootImage(cuervoL);
private final GreenfootImage cuervoR0 = new GreenfootImage(cuervoL0);
private Ninja ninja;
private GreenfootSound DagaEncajada;
public Cuervo(){
Speed = 3;
animationCounter = 0;
facingLeft = true;
cuervoR.mirrorHorizontally();
cuervoR0.mirrorHorizontally();
DagaEncajada = new GreenfootSound("DagaEncajada.wav");
}
/**
* Act - do whatever the Cuervo wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
mueve();
checaLimite();
checaColision();
}
/**
* Mueve Cuervo hacia la Izquierda
*/
public void mueve(){
setLocation (this.getX() - Speed, this.getY());
animationCounter ++;
if(animationCounter < 8){
if(facingLeft)
setImage(cuervoL0);
else
setImage(cuervoR0);
}else if(animationCounter < 16){
if(facingLeft)
setImage(cuervoL);
else
setImage(cuervoR);
}else if(animationCounter == 16)
animationCounter = 0;
}
public void checaLimite(){
if(getX()< 5 ){
Speed = -Speed;
facingLeft = false;
} else if(getX() > getWorld().getWidth()-5){
Speed = -Speed;
facingLeft = true;
}
}
public void checaColision(){
Niveles mundo = (Niveles)this.getWorld();
ninja = mundo.ninja;
if(isTouching(Daga.class)){
ninja.aumentaPuntos(10);
DagaEncajada.play();
removeTouching(Daga.class);
getWorld().removeObject(this);
}
}
public boolean regresaFacingLeft(){
return facingLeft;
}
}
| 131402-stick-ninja | trunk/Cuervo.java | Java | gpl3 | 2,842 |
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Cerca here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Cerca extends Obstaculos
{
private int Speed = 2;
/**
* Act - do whatever the Cerca wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
mueve();
checaMovimiento();
}
public void mueve(){
setLocation (this.getX(), this.getY() - Speed);
}
public void checaMovimiento(){
if(getY() > getWorld().getHeight()-20 || getY() < 10){
Speed += 4;
Speed = -Speed;
}
}
} | 131402-stick-ninja | trunk/Cerca.java | Java | gpl3 | 833 |
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Menu here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Menu extends World
{
/**
* Constructor for objects of class Menu.
*
*/
public Menu()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(600, 400, 1);
}
}
| 131402-stick-ninja | trunk/Menu.java | Java | gpl3 | 473 |
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Sumo here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Sumo extends Enemigos
{
private int Speed;
private int Salud ;
private int animationCounter;
private boolean moveLeft;
private boolean isDead = false;
private Cuchillo cuchillo;
private Elixir elixir;
private Ninja ninja;
private GreenfootSound DagaEncajada;
private final GreenfootImage WalkRight0 = new GreenfootImage("sumoC0.png");
private final GreenfootImage WalkRight1 = new GreenfootImage("sumoC1.png");
private final GreenfootImage WalkLeft0 = new GreenfootImage(WalkRight0);
private final GreenfootImage WalkLeft1 = new GreenfootImage(WalkRight1);
public Sumo(){
Salud = 300;
Speed = 1;
animationCounter = 0;
isDead = false;
WalkLeft0.mirrorHorizontally();
WalkLeft1.mirrorHorizontally();
moveLeft = true;
DagaEncajada = new GreenfootSound("DagaEncajada.wav");
}
/**
* Act - do whatever the Sumo wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
checaColision();
if(isDead == false){
if(ninjaCerca()){
if(moveLeft)
mueveLeft();
else
mueveRight();
}
}
}
public void mueveLeft()
{
setLocation (this.getX() - Speed, this.getY());
animationCounter ++;
if(animationCounter < 6)
setImage(WalkLeft0);
else if(animationCounter < 12)
setImage(WalkLeft1);
else if(animationCounter == 12)
animationCounter = 0;
}
public void mueveRight()
{
setLocation (this.getX() + Speed, this.getY());
animationCounter ++;
if(animationCounter < 6)
setImage(WalkLeft0);
else if(animationCounter < 12)
setImage(WalkLeft1);
else if(animationCounter == 12)
animationCounter = 0;
}
public boolean ninjaCerca(){
Niveles mundo = (Niveles)this.getWorld();
ninja = mundo.ninja();
if( ninja.ninjaX() < this.getX())
moveLeft = true;
else
moveLeft = false;
if(this.getX() - 300 >= ninja.ninjaX() || this.getX() + 300 <= ninja.ninjaX())
return false;
else
return true;
}
public void checaColision(){
Niveles mundo = (Niveles)this.getWorld();
ninja = mundo.ninja;
if(isTouching(Daga.class)){
DagaEncajada.play();
removeTouching(Daga.class);
setLocation (this.getX()+10, this.getY());
Salud -= 50;
}
if(isTouching(Onda.class)){
DagaEncajada.play();
removeTouching(Onda.class);
setLocation (this.getX()+10, this.getY());
Salud -= 50;
}
if(Salud <= 0){
ninja.aumentaPuntos(10);
cuchillo = new Cuchillo();
mundo.addObject(cuchillo, this.getX(), this.getY()+10);
elixir = new Elixir();
mundo.addObject(elixir, this.getX(), this.getY()+10);
getWorld().removeObject(this);
isDead = true;
}
}
}
| 131402-stick-ninja | trunk/Sumo.java | Java | gpl3 | 3,842 |
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.Color;
/**
* Write a description of class Letrero here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Letrero extends Actor
{
private static final Color transparent = new Color(0,0,0,0);
int Var = 0;
public Letrero(String mensaje, int letrero){
this.despliega(mensaje, letrero);
}
public void despliega(String mensaje, int letrero){
if(letrero == 1)
super.setImage(
new GreenfootImage(mensaje, 20, java.awt.Color.BLACK,transparent));
else if(letrero == 2)
super.setImage(
new GreenfootImage(mensaje, 20, java.awt.Color.BLACK,transparent ));
else if(letrero == 3)
super.setImage(
new GreenfootImage(mensaje, 20, java.awt.Color.BLACK,transparent ));
}
/**
* Act - do whatever the Letrero wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
if(Var == 0){
removeTouching(Letrero.class);
Var += 1;
}
}
}
| 131402-stick-ninja | trunk/Letrero.java | Java | gpl3 | 1,268 |
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Obstaculos here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Obstaculos extends Actor
{
/**
* Act - do whatever the Obstaculos wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
// Add your action code here.
}
}
| 131402-stick-ninja | trunk/Obstaculos.java | Java | gpl3 | 511 |
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Nivel2 here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Nivel2 extends World
{
/**
* Constructor for objects of class Nivel2.
*
*/
public Nivel2()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(600, 400, 1);
}
}
| 131402-stick-ninja | trunk/Nivel2.java | Java | gpl3 | 481 |
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class NinjaM here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class NinjaM extends Enemigos
{
private int Salud ;
private int Speed;
private int Tiempo;
private int animationCounter;
private boolean moveLeft;
private final int NUM_IMAG = 4;
private Elixir elixir;
private Ninja ninja;
private DagaNM dagaNM;
private GreenfootSound DagaEncajada;
private boolean isDead = false;
private final GreenfootImage atacaLeft = new GreenfootImage("ninjaMLC.png");
private final GreenfootImage atacaRight = new GreenfootImage(atacaLeft);
private final GreenfootImage ninjaMLeft = new GreenfootImage("ninjamalo.png");
private final GreenfootImage ninjaMRight = new GreenfootImage(ninjaMLeft);
private final GreenfootImage[] RunLeft = new GreenfootImage[NUM_IMAG];//Arreglo de imagenes correr hacia la derecha
private final GreenfootImage[] RunRight = new GreenfootImage[NUM_IMAG];
public NinjaM(){
Salud = 200;
Speed = 3;
Tiempo = 0;
animationCounter = 0;
isDead = false;
for(int i = 0; i<NUM_IMAG; i++){
RunLeft[i] = new GreenfootImage("ninjamaloC"+i+".png");
}
for(int i = 0; i<NUM_IMAG; i++){
RunRight[i] = new GreenfootImage(RunLeft[i]);
RunRight[i].mirrorHorizontally();
}
DagaEncajada = new GreenfootSound("DagaEncajada.wav");
atacaRight.mirrorHorizontally();
ninjaMRight.mirrorHorizontally();
}
/**
* Act - do whatever the NinjaM wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
if(ninjaCerca()){
if(moveLeft)
setImage(atacaLeft);
else
setImage(atacaRight);
if( Tiempo > 30){
lanceKnife();
Tiempo = 0;
}
Tiempo ++;
if(Tiempo > 50)
Tiempo = 0;
}
if(moveLeft)
setImage(ninjaMLeft);
else
setImage(ninjaMRight);
checaColision();
}
public boolean ninjaCerca(){
Niveles mundo = (Niveles)this.getWorld();
Ninja ninja = mundo.ninja();
if( ninja.ninjaX() < this.getX())
moveLeft = true;
else
moveLeft = false;
if(this.getX() - 300 >= ninja.ninjaX() || this.getX() + 300 <= ninja.ninjaX())
return false;
else
return true;
}
public void checaColision(){
Niveles mundo = (Niveles)this.getWorld();
ninja = mundo.ninja;
if(isTouching(Daga.class)){
DagaEncajada.play();
removeTouching(Daga.class);
Salud -= 50;
}
if(isTouching(Onda.class)){
DagaEncajada.play();
removeTouching(Onda.class);
Salud -= 50;
}
if(Salud <= 0){
ninja.aumentaPuntos(10);
elixir = new Elixir();
mundo.addObject(elixir, this.getX(), this.getY()+10);
getWorld().removeObject(this);
isDead = true;
}
}
public void lanceKnife(){
World world = this.getWorld();
Greenfoot.playSound("Cuchillo.wav");
dagaNM = new DagaNM(moveLeft);
world.addObject(dagaNM, this.getX(), this.getY()-50);
}
}
| 131402-stick-ninja | trunk/NinjaM.java | Java | gpl3 | 3,932 |
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Daga here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Daga extends Ninja
{
private boolean Dir;
public Daga(boolean dir){
Dir = dir;
}
/**
* Act - do whatever the Daga wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
move();
}
private void move(){
if(Dir)
super.move(10);
else {
super.setRotation(180);
super.move(10);
}
}
}
| 131402-stick-ninja | trunk/Daga.java | Java | gpl3 | 807 |
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Roca here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Roca extends Obstaculos
{
/**
* Act - do whatever the Roca wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
// Add your action code here.
}
}
| 131402-stick-ninja | trunk/Roca.java | Java | gpl3 | 498 |
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Nivel1 here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Niveles extends World
{
//Variables de instancia
private int Nivel; // variable para poder cambiar de nivel
private int Scroll;//Variable que controla el scroll de los niveles
private int ninjaPosX;// variable X para la posiscion de el ninja
private int ninjaPosY;//variable para la posicion de el ninja en Y
private int posMoneda;
private int soundCounter;//variable para el sonido de fondo el del juego
private int ayudaSig =0; //variable para pasar de siguiente pagina en la ayuda
public GreenfootSound soundNivel1;
public GreenfootSound soundNivel2;
Ninja ninja = new Ninja();
SaludL salud = new SaludL();
/**
* Constructor de el Niveles
*
*/
public Niveles()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(800, 320, 1, false);
Greenfoot.setSpeed(47); //Asigna la velocidad de el juego
//Greenfoot.start();//inicia el juego
soundNivel1 = new GreenfootSound("fondo1.wav");
soundNivel1.setVolume(70);
soundNivel2 = new GreenfootSound("fondo2.wav");
soundNivel2.setVolume(70);
posMoneda = 50;
soundCounter = 0;
iniciaNivel( 0 );
setPaintOrder(Cuchillo.class,Vida.class,Letrero.class,SaludL.class,Cerca.class,Ninja.class, Moneda.class, Roca.class,Sumo.class, NinjaM.class,Ladron.class, Cuervo.class);
}
/*
* Medtodo actuda de el mundo
*
*/
public void act(){
soundCounter ++;
if(Nivel == 1){
soundNivel1.play();
}else if(Nivel == 2){
soundNivel2.play();
}else if(Nivel == 3){
// MusicaN3.play();
}
}
/*
* Inicia el Nivel correspondiente dependiendo de el avance de el jugador
*/
public void iniciaNivel(int nivel)
{
Nivel = nivel;
if(Nivel == 0)//****************MENU****************
preparaMenu();
else if(Nivel == 1)//****************************** NIVEL 1 **************************
preparaNivel1(1);
else if(Nivel == 2)//****************************** NIVEL 2 **************************
preparaNivel2(1);
else if(Nivel == 3)//****************************** NIVEL 3 **************************
preparaNivel3(2);
else if(Nivel == 4)
ganaste();
else if (Nivel == -1)//****************************** GAME OVER **************************
gameOver();
}
/*
* Metodo para preparar el nivel 1
*/
public void preparaNivel1(int scroll){
Scroll = scroll;
setBackground("Nivel1.png");
removeObjects(getObjects(null));
if(Scroll == 1){ //************************Escenario 1 Nivel 1***************************
ninjaPosX = 40;
ninjaPosY = 280;
//posicion inicial de el ninja
addObject(ninja, ninjaPosX ,ninjaPosY);
addObject(new SaludL(),150,10);
addObject(new Letrero("Puntos = 0", 1),400,20);
addObject(new Letrero(" = 3", 2),500,20);
addObject(new Vida(),470,20);
addObject(new Letrero(" = 5", 3),600,20);
addObject(new Cuchillo(),570,20);
addObject(new Cuervo(),512,60);
addObject(new Cuervo(),448,181);
addObject(new Cuervo(),225,91);
addObject(new Roca(), 350, 290);
addObject(new Roca(), 748, 290);
addObject(new Cerca(), 200, 230);//primera cerca
addObject(new Cerca(), 527, 282);//Segunda Cerca
for(int i=0; i < 4; i++)
addObject(new Moneda(),100 +(i*posMoneda) ,300);
for(int i=0; i< 4; i++)
addObject(new Moneda(),350,250 - (i*posMoneda));
for(int i=0; i < 5; i++)
addObject(new Moneda(),450 +(i*posMoneda) ,300);
for(int i=0; i< 3; i++)
addObject(new Moneda(),670,200 - (i*posMoneda));
for(int i=0; i< 4; i++)
addObject(new Moneda(),750,250 - (i*posMoneda));
addObject(new Ladron(), 835, 280);
}else if(Scroll == 2){
removeObjects(getObjects(null));
ninjaPosX = 40;
ninjaPosY = 280;
//posicion inicial de el ninja
addObject(new SaludL(),150,10);
addObject(ninja, ninjaPosX ,ninjaPosY);
ninja.CambiaLetros(1);
ninja.CambiaLetros(2);
addObject(new Vida(),470,20);
ninja.CambiaLetros(3);
addObject(new Cuchillo(),570,20);
addObject(ninja, ninjaPosX ,ninjaPosY);
addObject(new Cuervo(),448,142);
addObject(new Cuervo(),225,49);
addObject(new Cuervo(),512,90);
addObject(new Roca(), 500, 290);
addObject(new Roca(), 700, 290);
addObject(new Cerca(), 200, 280);//primera cerca
addObject(new Cerca(), 270, 250);//Segunda Cerca
addObject(new Cerca(), 600, 150);//cuarta cerca
addObject(new Ladron(), 835, 280);
for(int i=0; i < 7; i++)
addObject(new Moneda(),100 +(i*posMoneda) ,300);
for(int i=0; i< 4; i++)
addObject(new Moneda(),350,250 - (i*posMoneda));
for(int i=0; i< 5; i++)
addObject(new Moneda(),500,250 - (i*posMoneda));
for(int i=0; i< 2; i++)
addObject(new Moneda(),580 + (i*posMoneda),150);
addObject(new Moneda(),600,300);
for(int i=0; i< 4; i++)
addObject(new Moneda(),700+(i*posMoneda),250 - (i*posMoneda));
}
}
/*
* Metodo para preparar objetos de el nivel 2
*/
public void preparaNivel2(int scroll){
Scroll = scroll;
removeObjects(getObjects(null));
setBackground("Nivel2.png");
if(Scroll == 1){
ninjaPosX = 40;
ninjaPosY = 280;
addObject(new SaludL(),150,10);
addObject(ninja, ninjaPosX ,ninjaPosY);
ninja.CambiaLetros(1);
ninja.CambiaLetros(2);
addObject(new Vida(),470,20);
ninja.CambiaLetros(3);
addObject(new Cuchillo(),570,20);
addObject(ninja, ninjaPosX ,ninjaPosY);
addObject(new Cuervo(),700,142);
addObject(new Cuervo(),512,60);
addObject(new Roca(), 748, 290);
addObject(new Cerca(), 170, 200);
addObject(new Cerca(), 450, 150);
addObject(new Agujero(), 650, 310);
for(int i=0; i < 5; i++)
addObject(new Moneda(),250 +(i*posMoneda) ,300);
for(int i=0; i< 3; i++)
addObject(new Moneda(),250+(i*posMoneda),250 - (i*posMoneda));
for(int i=0; i< 4; i++)
addObject(new Moneda(),750,250 - (i*posMoneda));
for(int i=0; i< 3; i++)
addObject(new Moneda(),600+(i*posMoneda),100 + (i*posMoneda));
addObject(new NinjaM(), 550, 280);
addObject(new Ladron(), 835, 280);
}else if(Scroll == 2){
removeObjects(getObjects(null));
ninjaPosX = 40;
ninjaPosY = 280;
addObject(ninja, ninjaPosX ,ninjaPosY);
addObject(new SaludL(),150,10);
ninja.CambiaLetros(1);
ninja.CambiaLetros(2);
addObject(new Vida(),470,20);
ninja.CambiaLetros(3);
addObject(new Cuchillo(),570,20);
addObject(new Cuervo(),448,142);
addObject(new Cuervo(),225,49);
addObject(new Roca(), 200, 290);
addObject(new Cerca(), 370, 150);
addObject(new Cerca(), 550, 200);
addObject(new Agujero(), 770, 310);
for(int i=0; i< 4; i++)
addObject(new Moneda(),200,250 - (i*posMoneda));
for(int i=0; i< 4; i++)
addObject(new Moneda(),750 + (i*posMoneda),250) ;
for(int i=0; i< 3; i++)
addObject(new Moneda(),600,300 - (i*posMoneda));
addObject(new NinjaM(), 570, 280);
addObject(new NinjaM(), 420, 280);
addObject(new Ladron(), 835, 280);
}
}
/*
* Metodo para preparar los objetos de el nivel3
*/
public void preparaNivel3(int scroll){
Scroll = scroll;
removeObjects(getObjects(null));
setBackground("Nivel3.png");
if(Scroll == 1){
removeObjects(getObjects(null));
ninjaPosX = 40;
ninjaPosY = 280;
addObject(ninja, ninjaPosX ,ninjaPosY);
addObject(new SaludL(),150,10);
ninja.CambiaLetros(1);
ninja.CambiaLetros(2);
addObject(new Vida(),470,20);
ninja.CambiaLetros(3);
addObject(new Cuchillo(),570,20);
addObject(new Cuervo(),448,142);
addObject(new Cuervo(),225,49);
addObject(new Cuervo(),725,181);
addObject(new Roca(), 270, 290);
addObject(new Cerca(), 370, 150);
addObject(new Cerca(), 670, 280);
addObject(new Agujero(), 170, 310);
for(int i=0; i< 3; i++)
addObject(new Moneda(),100+(i*posMoneda),250 - (i*posMoneda));
for(int i=0; i< 4; i++)
addObject(new Moneda(),270,250 - (i*posMoneda));
for(int i=0; i< 3; i++)
addObject(new Moneda(),500+(i*posMoneda),250 - (i*posMoneda));
addObject(new Sumo(), 700, 280);
addObject(new NinjaM(), 570, 280);
addObject(new NinjaM(), 500, 280);
addObject(new Ladron(), 835, 280);
}else if(Scroll == 2){
ninjaPosX = 40;
ninjaPosY = 280;
addObject(ninja, ninjaPosX ,ninjaPosY);
addObject(new SaludL(),150,10);
ninja.CambiaLetros(1);
ninja.CambiaLetros(2);
addObject(new Vida(),470,20);
ninja.CambiaLetros(3);
addObject(new Cuchillo(),570,20);
addObject(new Cuervo(),725,142);
addObject(new Cuervo(),512,60);
addObject(new Roca(), 748, 290);
addObject(new Cerca(), 170, 200);
addObject(new Cerca(), 450, 150);
addObject(new Agujero(), 650, 310);
for(int i=0; i < 5; i++)
addObject(new Moneda(),250 +(i*posMoneda) ,300);
for(int i=0; i< 3; i++)
addObject(new Moneda(),250+(i*posMoneda),250 - (i*posMoneda));
for(int i=0; i< 4; i++)
addObject(new Moneda(),750,250 - (i*posMoneda));
for(int i=0; i< 3; i++)
addObject(new Moneda(),600+(i*posMoneda),100 + (i*posMoneda));
addObject(new NinjaM(), 550, 280);
addObject(new Ladron(), 835, 280);
addObject(new Sumo(), 700, 280);
}
}
/*
* Metodo para cuando el jugador pierde el juego se muestra en pantalla un mensaje de Gameover
*/
public void gameOver(){
removeObjects(getObjects(null));
setBackground("gameOver.jpg");
Greenfoot.delay(200);
preparaMenu();
}
/*
* Metodo para cuando el jugador gana el juego se muestra un mensaje de Ganaste
*/
public void ganaste(){
removeObjects(getObjects(null));
setBackground("ganaste.png");
ninjaPosX = 40;
ninjaPosY = 280;
addObject(ninja, ninjaPosX ,ninjaPosY);
ninja.guardaPuntos();
Greenfoot.delay(200);
preparaMenu();
}
/*
* Regresa el ninja(jugador principal
*/
public Ninja ninja(){
return ninja;
}
/*
* prepara el menu incial de el juego
*/
public void preparaMenu(){
removeObjects(getObjects(null));
setBackground("Menu.png");
addObject(new Jugar(getWidth()/2,180), getWidth()/2, 180);
addObject(new Ayuda( getWidth()/2,280), getWidth()/2, 280);
addObject(new Records(getWidth()/4,280),getWidth()/4, 280);
addObject(new Creditos(getWidth()/2 + getWidth()/4,280),getWidth()/2 + getWidth()/4, 280);
}
/*
* Muestra la ayuda de el juego
*/
public void preparaAyuda(){
removeObjects(getObjects(null));
ayudaSig = 0;
setBackground("AyudaM0.png");
addObject(new Atras(20,20),20,20);
addObject(new Adelante(getWidth()-20,getHeight()-20),getWidth()-20,getHeight()-20);
Greenfoot.delay(20);
}
/*
* Muestra los creditos del el juego
*/
public void muestraCreditos(){
removeObjects(getObjects(null));
setBackground("CreditosM.png");
addObject(new Atras(20,20),20,20);
Greenfoot.delay(20);
}
/*
* Muestra los records de el juego
*/
public void muestraRecords(){
removeObjects(getObjects(null));
setBackground("RecordsM.png");
addObject(new Atras(20,20),20,20);
addObject(new ScoreBoard(720,300),getWidth()/2,(getHeight()/2));
}
/*
* Metodo para recorrer las paginas de la ayuda
*/
public void siguientePagina(){
ayudaSig++;
if(ayudaSig>=3)
{
preparaMenu();
return;
}
setBackground(new GreenfootImage("AyudaM"+ayudaSig+".png"));
}
}
| 131402-stick-ninja | trunk/Niveles.java | Java | gpl3 | 14,619 |
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Cuchillo here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Cuchillo extends Bonos
{
/**
* Act - do whatever the Cuchillo wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
if(isTouching(Roca.class)){
this.setLocation(getX(), 250);
}
}
}
| 131402-stick-ninja | trunk/Cuchillo.java | Java | gpl3 | 562 |
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Ladrones here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Ladrones extends Enemigos
{
/**
* Act - do whatever the Ladrones wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
// Add your action code here.
}
}
| 131402-stick-ninja | trunk/Ladrones.java | Java | gpl3 | 508 |
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Ladron here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Ladron extends Enemigos
{
private int Salud ;
private int Speed;
private int animationCounter;
private final int NUM_IMAG = 4;
private Ninja ninja;
private boolean isDead;
private GreenfootSound DagaEncajada;
private final GreenfootImage[] RunLeft = new GreenfootImage[NUM_IMAG];//Arreglo de imagenes correr hacia la derecha
private Cuchillo cuchillo;
public Ladron (){
Salud = 100;
Speed = 3;
animationCounter = 0;
isDead = false;
for(int i = 0; i<NUM_IMAG; i++){
RunLeft[i] = new GreenfootImage("ladronC"+i+".png");
}
DagaEncajada = new GreenfootSound("DagaEncajada.wav");
}
/**
* Act - do whatever the Ladron wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
/*Niveles mundo = (Niveles)this.getWorld();
ninja = mundo.ninja;
Object obj = getObjectsInRange( 20 ,null);
if(obj == ninja)
*/
if(!isDead){
mueveLeft();
checaLimite();
}
checaColision();
}
/**
* Mueve Ladron hacia la Izquierda
*/
public void mueveLeft(){
setLocation (this.getX() - Speed, this.getY());
animationCounter ++;
if(animationCounter < 4)
setImage(RunLeft[0]);
else if(animationCounter < 8)
setImage(RunLeft[1]);
else if(animationCounter < 12)
setImage(RunLeft[2]);
else if(animationCounter < 16)
setImage(RunLeft[3]);
else if(animationCounter == 16 )
animationCounter = 0;
}
public void checaLimite(){
if(getX() < -200)
setLocation (getWorld().getWidth(), this.getY());
}
public void checaColision(){
Niveles mundo = (Niveles)this.getWorld();
ninja = mundo.ninja;
if(isTouching(Daga.class)){
DagaEncajada.play();
removeTouching(Daga.class);
setLocation (this.getX() + 20, this.getY());
Salud -= 50;
}
if(isTouching(Onda.class)){
DagaEncajada.play();
removeTouching(Onda.class);
setLocation (this.getX() + 20, this.getY());
Salud -= 50;
}
if(Salud <= 0){
ninja.aumentaPuntos(10);
cuchillo = new Cuchillo();
mundo.addObject(cuchillo, this.getX(), this.getY()+10);
getWorld().removeObject(this);
isDead = true;
}
}
}
| 131402-stick-ninja | trunk/Ladron.java | Java | gpl3 | 3,142 |
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class DagaNM here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class DagaNM extends NinjaM
{
private boolean Dir;
public DagaNM(boolean dir){
Dir = dir;
}
/**
* Act - do whatever the Daga wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
move();
}
private void move(){
if(!Dir)
super.move(10);
else {
super.setRotation(180);
super.move(10);
}
}
}
| 131402-stick-ninja | trunk/DagaNM.java | Java | gpl3 | 806 |
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Moneda here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Moneda extends Bonos
{
private int valor;
private int animationCounter;
private final GreenfootImage coinL = new GreenfootImage("coin.png");
private final GreenfootImage coinR = new GreenfootImage(coinL);
public Moneda(){
animationCounter = 0;
coinR.mirrorHorizontally();
}
/**
* Act - do whatever the Moneda wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
animacion();
//checaColision();
}
public void animacion(){
animationCounter ++;
if(animationCounter < 20)
setImage(coinR);
else if(animationCounter < 40)
setImage(coinL);
else if(animationCounter == 40)
animationCounter = 0;
}
}
| 131402-stick-ninja | trunk/Moneda.java | Java | gpl3 | 1,129 |
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Salud here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class SaludL extends Actor
{
private int NUM = 11;
private final GreenfootImage[] Barra = new GreenfootImage[NUM];
private Ninja ninja;
public SaludL(){
for(int i = 0; i<NUM; i++)
Barra[i] = new GreenfootImage("BarraSalud"+i+".png");
}
/**
* Act - do whatever the Salud wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
Niveles mundo = (Niveles)this.getWorld();
ninja = mundo.ninja;
int salud = ninja.rsalud();
switch(salud){
case 100: setImage(Barra[10]);
break;
case 90: setImage(Barra[9]);
break;
case 80: setImage(Barra[8]);
break;
case 70: setImage(Barra[7]);
break;
case 60: setImage(Barra[6]);
break;
case 50: setImage(Barra[5]);
break;
case 40: setImage(Barra[4]);
break;
case 30: setImage(Barra[3]);
break;
case 20: setImage(Barra[2]);
break;
case 10: setImage(Barra[1]);
break;
case 0: setImage(Barra[0]);
break;
}
}
}
| 131402-stick-ninja | trunk/SaludL.java | Java | gpl3 | 1,688 |
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Agujero here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Agujero extends Obstaculos
{
/**
* Act - do whatever the Agujero wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
// Add your action code here.
}
}
| 131402-stick-ninja | trunk/Agujero.java | Java | gpl3 | 507 |
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Vida here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Vida extends Ninja
{
/**
* Act - do whatever the Vida wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
// Add your action code here.
}
}
| 131402-stick-ninja | trunk/Vida.java | Java | gpl3 | 493 |
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Zumo here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Zumo extends Enemigos
{
/**
* Act - do whatever the Zumo wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
// Add your action code here.
}
}
| 131402-stick-ninja | trunk/Zumo.java | Java | gpl3 | 496 |
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Enemigos here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Enemigos extends Actor
{
/**
* Act - do whatever the Enemigos wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
// Add your action code here.
}
}
| 131402-stick-ninja | trunk/Enemigos.java | Java | gpl3 | 505 |
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Onda here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Onda extends Ninja
{
private boolean Dir;
private int cont;
public Onda(boolean dir){
Dir = dir;
cont = 0;
}
public void act()
{
if(cont <15)
move();
else
getWorld().removeObject(this);
}
private void move(){
if(Dir)
super.move(10);
else {
super.setRotation(180);
super.move(10);
}
cont ++;
}
}
| 131402-stick-ninja | trunk/Onda.java | Java | gpl3 | 714 |
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Ninja here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Ninja extends Actor
{
private boolean isKeyPressed;
private boolean facingRight;
private boolean isJumping;
private boolean isLanceKnife;
private boolean isDown;
private boolean isAtack;
private boolean isDead;
private int iL = 0;
private int TimeK = 0;
protected int Salud;
protected int Vidas;
protected int Cuchillos;
protected int Puntos;
private int Speed;
private int Scroll;
private int Nivel;
private int NivelAux;
private int verticalSpeed = 0;
private int acceleration = 1;
private int animationCounter;
private int animationDead;
private int animationKnife;
private int jumpDistance = 15;
private int ninjaCentro;
private int ninjaA;
private Daga daga;
private Onda onda;
private final int NUM_IMAG = 4;
private GreenfootSound golpeCerca;
private GreenfootSound golpeadoCuervo;
private final GreenfootImage muertoCerca = new GreenfootImage("ninjaMC.png");
private final GreenfootImage AtackRight = new GreenfootImage("ninjaE.png");
private final GreenfootImage AtackLeft = new GreenfootImage(AtackRight);
private final GreenfootImage DuckingR = new GreenfootImage("ninjaA.png");
private final GreenfootImage DuckingL = new GreenfootImage(DuckingR);
private final GreenfootImage LanceKR = new GreenfootImage("ninjaLC.png");
private final GreenfootImage LanceKL = new GreenfootImage(LanceKR);
private final GreenfootImage ImagenNR = new GreenfootImage("ninja.PNG");
private final GreenfootImage ImagenNL = new GreenfootImage(ImagenNR);
private final GreenfootImage JumpRight = new GreenfootImage("ninjaB0.png");
private final GreenfootImage JumpLeft = new GreenfootImage(JumpRight);
private final GreenfootImage DownRight = new GreenfootImage("ninjaB1.png");
private final GreenfootImage DownLeft = new GreenfootImage(DownRight);
private final GreenfootImage[] ImagensWR = new GreenfootImage[NUM_IMAG];//Arreglo de la imagenes de caminar Derecha de el jugador
private final GreenfootImage[] ImagensWL = new GreenfootImage[NUM_IMAG];//Arreglo para las imagenes de caminar Izquierda de el jugador
public Ninja(){
Salud = 100;
Vidas = 3;
Puntos = 0;
Cuchillos = 5;
Speed = 6;
Scroll = 1;
Nivel = 1;
NivelAux = 1;
animationCounter = 0;
animationDead = 0;
animationKnife = 0;
facingRight = true;
isJumping = false;
isLanceKnife = false;
isAtack = false;
isDown = false;
isDead = false;
ImagenNL.mirrorHorizontally();//voltea imagen para ir hacia la izquierda
JumpLeft.mirrorHorizontally();//voltea imagen para brincar hacia la Izquierda
DownLeft.mirrorHorizontally();//Volte la imagen caer hacia la Izquierda
LanceKL.mirrorHorizontally();//Voltea imagen hacia la izquierda lanza cuchillo
DuckingL.mirrorHorizontally();//Voltea la imagen agachado hacia la Izquierda
AtackLeft.mirrorHorizontally(); //voltea ninja cuando esta atacando hacia la Izquierda
for(int i = 0; i<NUM_IMAG; i++)
ImagensWR[i] = new GreenfootImage("ninjaC"+i+".png");
for(int i = 0; i<NUM_IMAG; i++){
ImagensWL[i] = new GreenfootImage(ImagensWR[i]);
ImagensWL[i].mirrorHorizontally();
}
golpeCerca = new GreenfootSound("golpeCerca.wav");
golpeadoCuervo = new GreenfootSound("puñetaso.wav");
ninjaCentro = getImage().getHeight() /2;
ninjaA = DownRight.getHeight() / 2;
}
/**
* Act - do whatever the Ninja wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
if(!isDead){
checaTeclas();
checaColiciones();
Limtes();
if(!checaSuelo())
fall();
else
isJumping = false;
}else
IsDead();
}
/**
* Checa teclas y hace las acciones
*/
public void checaTeclas()
{
isKeyPressed = false;
isDown = false;
if((Greenfoot.isKeyDown("right") || Greenfoot.isKeyDown("d")) && (Greenfoot.isKeyDown("left") || Greenfoot.isKeyDown("a")))
{
detenCaminado();
}
else if(Greenfoot.isKeyDown("right") || Greenfoot.isKeyDown("d"))
{
animationCounter ++;
walkHR();
isKeyPressed = true;
facingRight = true;
}
else if(Greenfoot.isKeyDown("left") || Greenfoot.isKeyDown("a")){
animationCounter ++;
walkHL();
isKeyPressed = true;
facingRight = false;
}
if((Greenfoot.isKeyDown("up") || Greenfoot.isKeyDown("w")) && isJumping == false)//Brincar
{
isKeyPressed = true;
jump();
}
if((Greenfoot.isKeyDown("down") || Greenfoot.isKeyDown("s")) && isJumping == false)
{
isKeyPressed = true;
isDown = true;
down();
}
if(Greenfoot.isKeyDown("r") && TimeK > 20 ) //Lanzar cuchillo
{
isKeyPressed = true;
isLanceKnife = true;
lanceKnife();
TimeK = 0;
}
if(Greenfoot.isKeyDown("e") && TimeK > 20 && !isJumping){// Atacar
isKeyPressed = true;
isAtack = true;
TimeK = 0;
}
if(isAtack && !isLanceKnife){
atack();
}else
if(isLanceKnife){
lancingKnife();
}
else if(!isKeyPressed)
{
detenCaminado();
}
if(TimeK <25)//Este if es para que la variable Time no tome valores muy altos
TimeK ++;//Sirve para el retraso de el ataca y de el cuchillo
}
public void lancingKnife(){
animationKnife ++;
if(animationKnife > 10){
isLanceKnife = false;
animationKnife = 0;
}
if(facingRight)
setImage(LanceKR);
else
setImage(LanceKL);
}
public void detenCaminado()
{
if(facingRight)
setImage(ImagenNR);
else
setImage(ImagenNL);
}
/**
* Mueve el ninja a la Izquierda y cambia la imagen
*/
public void walkHL(){
setLocation (this.getX() - Speed, this.getY());
if(isTouching(Roca.class) && getY() > 250 ){
setLocation (this.getX() + Speed, this.getY());
}
if(animationCounter < 5)
setImage(ImagensWL[0]);
else if(animationCounter < 10)
setImage(ImagensWL[1]);
else if(animationCounter < 15)
setImage(ImagensWL[2]);
else if(animationCounter < 20)
setImage(ImagensWL[3]);
else if(animationCounter == 20 )
animationCounter = 0;
}
/**
* Mueve el ninja a la Derecha y cambia sus imagenes
*/
public void walkHR(){
setLocation (this.getX() + Speed, this.getY());
if(isTouching(Roca.class) && getY() > 250 ){
setLocation (this.getX() - Speed, this.getY());
}
if(animationCounter < 5)
setImage(ImagensWR[0]);
else if(animationCounter < 10)
setImage(ImagensWR[1]);
else if(animationCounter < 15)
setImage(ImagensWR[2]);
else if(animationCounter < 20)
setImage(ImagensWR[3]);
else if(animationCounter == 20 )
animationCounter = 0;
}
public void jump(){
verticalSpeed = verticalSpeed - jumpDistance;
fall();
}
public void fall(){
setLocation ( getX(), getY() + verticalSpeed);
verticalSpeed = verticalSpeed + acceleration;
isJumping = true;
checaSuelo();
if (facingRight){
if(verticalSpeed > 0)
setImage(DownRight);
else
setImage(JumpRight);
}
else{
if(verticalSpeed > 0)
setImage(DownLeft);
else
setImage(JumpLeft);
}
}
private boolean checaSuelo()
{
World mundo = getWorld();
if (getY() < mundo.getHeight()-40 && getOneObjectAtOffset (-17, ninjaCentro-5, Roca.class) == null
&& getOneObjectAtOffset (17, ninjaCentro-5, Roca.class) == null)
{
return false; // no esta tocando el suelo.
}
if ( getY() > mundo.getHeight() -40 /*|| getY() > 220 && getOneObjectAtOffset (-17, ninjaCentro-5, Roca.class) != null
&& getOneObjectAtOffset (17, ninjaCentro-5, Roca.class) != null*/)
{
setLocation( getX(), getY()-1);
}
verticalSpeed = 0;
return true;
}
public void atack(){
animationCounter ++;
if(animationCounter > 10){
Greenfoot.playSound("Espada.wav");
isAtack = false;
animationCounter = 0;
World world = this.getWorld();
onda = new Onda(facingRight);
world.addObject(onda, this.getX(), this.getY()-5);
}
if(facingRight)
setImage(AtackRight);
else
setImage(AtackLeft);
}
public void down(){
if(facingRight)
setImage(DuckingR);
else
setImage(DuckingL);
if(!isTouching(Roca.class)){
setLocation(getX(),296);
}
else
setLocation(getX(),245);
}
public void lanceKnife(){
if(Cuchillos > 0){
World world = this.getWorld();
Greenfoot.playSound("Cuchillo.wav");
daga = new Daga(facingRight);
world.addObject(daga, this.getX(), this.getY()-5);
disminuyeCuchillos();
}else
Greenfoot.playSound("NoCuchillos.wav");
}
public void disminuyeVida(){
Vidas--;
isDead = true;
CambiaLetros(2);
}
public void aumentaVida(){
Greenfoot.playSound("vida.wav");
Vidas ++;
CambiaLetros(2);
}
public void disminuyeSalud(int less){
Salud -= less;
if(Salud < 0)
disminuyeVida();
}
public void disminuyeCuchillos(){
Cuchillos --;
CambiaLetros(3);
}
public void disminuyePuntos(int puntos){
if(Puntos > 0 ){
Puntos -= puntos;
CambiaLetros(1);
}
}
public void aumentaPuntos(int puntos){
Puntos += puntos;
CambiaLetros(1);
}
public void aumentaSalud(){
if(Salud <= 100)
Salud += 20;
else
aumentaVida();
}
public void aumentaCuchillos(int cuchillos){
Cuchillos += cuchillos;
CambiaLetros(3);
}
public int rsalud(){
return Salud;
}
public void checaColiciones(){
Actor cuervo = getOneIntersectingObject(Cuervo.class);
Actor cerca = getOneIntersectingObject(Cerca.class);
Actor ninjaM = getOneIntersectingObject(NinjaM.class);
Actor sumo = getOneIntersectingObject(Sumo.class);
Actor agujero = getOneIntersectingObject(Agujero.class);
if(cuervo != null){
golpeadoCuervo.play();
disminuyeSalud(10);
if(cuervo.getX() > this.getX())
this.setLocation(getX()- 20,getY());
else
this.setLocation(getX() + 20,getY());
}
if(isTouching(Moneda.class) && iL > 10){
Greenfoot.playSound("coin.wav");
removeTouching(Moneda.class);
aumentaPuntos(5);
iL = 0;
}
if(isTouching(Cuchillo.class)){
Greenfoot.playSound("bonus.wav");
removeTouching(Cuchillo.class);
aumentaCuchillos(5);
}
if(isTouching(Elixir.class))
{
Greenfoot.playSound("bonus.wav");
removeTouching(Elixir.class);
aumentaSalud();
}
if(isTouching(Ladron.class)&& iL > 40){
disminuyePuntos(10);
iL = 0;
}
if(iL < 50)
iL ++;
if(ninjaM != null){
Greenfoot.playSound("puñetasoM.wav");
if(ninjaM.getX() > this.getX())
this.setLocation(getX()- 100,getY());
else
this.setLocation(getX() + 100,getY());
this.disminuyeSalud(20);
}
if(sumo != null){
Greenfoot.playSound("golpeSumo.wav");
if(sumo.getX() > this.getX())
this.setLocation(getX()- 100,getY());
else
this.setLocation(getX() + 100,getY());
this.disminuyeSalud(30);
}
if(agujero != null){
Greenfoot.playSound("caer.WAV");
this.setLocation(getX() ,getY()+ 200);
this.disminuyeVida();
}
if(cerca != null){
golpeCerca.play();
this.setLocation(getX(),300);
this.setImage(muertoCerca);
disminuyeVida();
}
}
public void Limtes(){
Niveles mundo = (Niveles)this.getWorld();
if(NivelAux == 1){
if(this.getX()>mundo.getWidth()+20 && Scroll == 1){
Scroll = 2;
mundo.preparaNivel1(Scroll);
}else if (this.getX()>mundo.getWidth()+20 && Scroll == 2){
Scroll = 1;
NivelAux = 2;
}
}else if (NivelAux == 2 ){
if( Nivel == 1 ){
Nivel = 2;
mundo.iniciaNivel(Nivel);
Scroll = 2;
}
if (this.getX()>mundo.getWidth()+20 && Scroll == 2){{
mundo.preparaNivel2(Scroll);
Scroll = 1;
}
}else if(this.getX()>mundo.getWidth()+20 && Scroll == 1)
NivelAux =3;
}else if(NivelAux == 3 ){
if(Nivel == 2 ){
Nivel = 3;
mundo.iniciaNivel(Nivel);
Scroll = 2;
}
if (this.getX()>mundo.getWidth()+20 && Scroll == 2){{
mundo.preparaNivel3(Scroll);
Scroll = 1;
}
}else if(this.getX()>mundo.getWidth()+20 && Scroll == 1)
NivelAux =4;
}else if(NivelAux == 4){
mundo.iniciaNivel(NivelAux);
}
}
public void IsDead(){
Niveles mundo = (Niveles)this.getWorld();
if(Vidas > 0){
Salud = 0;
if(animationDead > 30){
this.setLocation(40,280);
isDead = false;
Salud = 100;
animationDead = 0;
}
animationDead ++;
}else if(Vidas <= 0)
mundo.iniciaNivel(-1);
}
public int ninjaX(){
return getX();
}
public int ninjaY(){
return getY();
}
public void CambiaLetros(int jug){
if(jug == 1 ){
Letrero nuevo = new Letrero("Puntos = " + Puntos, 1);
getWorld().addObject(nuevo,400,20);
}else if(jug == 2 ){
Letrero nuevo = new Letrero(" = " + Vidas, 2);
getWorld().addObject(nuevo,500,20);
}else if(jug == 3){
Letrero nuevo = new Letrero(" = " + Cuchillos, 3);
getWorld().addObject(nuevo,600,20);
}
}
public void guardaPuntos()
{
if (UserInfo.isStorageAvailable())
{
UserInfo myInfo = UserInfo.getMyInfo();
if (Puntos > myInfo.getScore() || myInfo.getScore()==0)
{
myInfo.setScore(Puntos);
myInfo.store(); // write back to server
}
}
}
}
| 131402-stick-ninja | trunk/Ninja.java | Java | gpl3 | 18,640 |
//<![CDATA[
// Recent Post widget for Blogger with Preloader
// Author: Taufik Nurrohman
// https://plus.google.com/108949996304093815163/about
// Licence: Free for change, keep the original attribution, non commercial
function showRecentPosts(json) {
for (var i = 0; i < rp_numPosts; i++) {
if (i == json.feed.entry.length) break;
var entry = json.feed.entry[i],
postTitle = entry.title.$t,
postAuthor = entry.author[0].name.$t,
postDate = entry.published.$t.substring(0, 10),
postUrl,
linkTarget,
postContent,
postImage,
skeleton = "";
var dy = postDate.substring(0, 4),
dm = postDate.substring(5, 7),
dd = postDate.substring(8, 10);
for (var j = 0; j < entry.link.length; j++) {
if (entry.link[j].rel == 'alternate') {
postUrl = entry.link[j].href;
break;
}
}
for (var k = 0; k < entry.link.length; k++) {
if (entry.link[k].rel == 'replies' && entry.link[k].type == 'text/html') {
commentNum = entry.link[k].title.split(" ")[0];
commentLabel = entry.link[k].title.split(" ")[1];
break;
}
}
if ("content" in entry) {
postContent = entry.content.$t;
} else if ("summary" in entry) {
postContent = entry.summary.$t;
} else {
postContent = '';
}
if (rp_thumbWidth !== 0) {
if ("media$thumbnail" in entry) {
postImage = '<img style="width:' + rp_thumbWidth + 'px;height:' + rp_thumbWidth + 'px;" src="' + entry.media$thumbnail.url.replace(/\/s[0-9]+\-c/g, "\/s" + rp_thumbWidth + "-c") + '" alt="Loading..." />';
} else {
postImage = '<img style="width:' + rp_thumbWidth + 'px;height:' + rp_thumbWidth + 'px;" src="' + rp_noImage + '" alt="Loading..."/>';
}
} else {
postImage = "";
}
postContent = postContent.replace(/<br ?\/?>/ig, " ");
postContent = postContent.replace(/<\S[^>]*>/g, "");
if (postContent.length > rp_numChars) {
if (rp_numChars !== 0) {
postContent = postContent.substring(0, rp_numChars) + '…';
} else {
postContent = '';
}
}
linkTarget = (rp_newTabLink) ? ' target="_blank"' : '';
skeleton = '<li>';
skeleton += '<a href="' + postUrl + '"' + linkTarget + '>' + postImage + '</a>';
skeleton += '<div class="recent-right">';
skeleton += '<a class="title" href="' + postUrl + '"' + linkTarget + '>' + postTitle + '</a>';
skeleton += postContent;
skeleton += '</div>';
skeleton += '<br style="clear:both;"/><span class="foot"><span class="recent-date">' + dd + ' ' + rp_monthNames[parseInt(dm, 10) - 1] + ' ' + dy + '</span></span>';
skeleton += '</li>';
document.getElementById('recent-post').innerHTML += skeleton;
}
}
var labelName = (rp_sortByLabel !== false) ? '-/' + rp_sortByLabel : "";
var rp_script = document.createElement('script');
rp_script.src = rp_homePage + '/feeds/posts/default/' + labelName + '?alt=json-in-script&callback=showRecentPosts';
// Preloading...
if (rp_loadTimer === "onload") {
window.onload = function() {
document.getElementsByTagName('head')[0].appendChild(rp_script);
};
} else {
setTimeout(function() {
document.getElementsByTagName('head')[0].appendChild(rp_script);
}, rp_loadTimer);
}
//]]> | 123cuss | trunk/js-file/recent-post-preloader-by-taufik-nurrohman.js | JavaScript | asf20 | 3,625 |
//<![CDATA[
var thumbnail_mode = "float" ;
summary_noimg = 250;
summary_img = 210;
img_thumb_size = 95;
var numm_rand_post=3;
function removeHtmlTag(strx,chop){
if(strx.indexOf("<")!=-1){
var s = strx.split("<");
for(var i=0;i<s.length;i++){
if(s[i].indexOf(">")!=-1){
s[i] = s[i].substring(s[i].indexOf(">")+1,s[i].length);
}
}
strx = s.join("");
}
chop = (chop < strx.length-1) ? chop : strx.length-2;
while(strx.charAt(chop-1)!=' ' && strx.indexOf(' ',chop)!=-1) chop++;
strx = strx.substring(0,chop-1);
return strx+'...';
}
function createTumbnail(thumbUrl,img_size) {
var thumbnail = thumbUrl ;
var patt0 = /s72-c/g;
var patt1 = /s200/g;
var patt2 = /s320/g;
var patt3 = /s400/g;
var patt4 = /s640/g;
var patt5 = /s1600/g;
if ( patt1.test(thumbnail) == true) {
thumbnail = thumbnail.replace("s200","s"+img_size+"-c");
return thumbnail;
} else if (patt2.test(thumbnail) == true) {
thumbnail = thumbnail.replace("s320","s"+img_size+"-c");
return thumbnail;
} else if (patt3.test(thumbnail) == true) {
thumbnail = thumbnail.replace("s400","s"+img_size+"-c");
return thumbnail;
} else if (patt4.test(thumbnail) == true) {
thumbnail = thumbnail.replace("s640","s"+img_size+"-c");
return thumbnail;
} else if (patt5.test(thumbnail) == true) {
thumbnail = thumbnail.replace("s1600","s"+img_size+"-c");
return thumbnail;
} else if (patt0.test(thumbnail) == true) {
thumbnail = thumbnail.replace("s72-c","s"+img_size+"-c");
return thumbnail;
}
}
function popTumbnail(Turl,Tsize) {
return ('<img src="'+createTumbnail(Turl,Tsize)+'" />');
}
function createSummaryAndThumb(ID,pURL,pTitle){
var pID = 'summary' + ID;
var pThumb = 'thumbnail-' + ID;
var div = document.getElementById(pID);
var thumb = document.getElementById(pThumb);
var imgtag = "";
var img = div.getElementsByTagName("img");
var summ = summary_noimg;
if(img.length>=1) {
imgtag = '<span style="padding:0px;"><a href="'+ pURL +'" alt="tumbnail" title="'+ pTitle +'"><img src="' + img[0].src + '" alt="thumbnails"/></a></span>';
summ = summary_img;
} else {
imgtag = '';
summ = summary_img;
}
thumb.innerHTML = imgtag ;
div.innerHTML = '<div>' + removeHtmlTag(div.innerHTML,summ) + '</div>';
}
//]]> | 123cuss | trunk/js-file/thumbnailsummary-isotope.js | JavaScript | asf20 | 2,559 |
var JudNav = {};
//Pengambilan judul artikel melalui feed
function ambilJudNav(json) {
for (var i = 0; i < json.feed.entry.length; i++) {
var judul = json.feed.entry[i];
var data = "";
for (var k = 0; k < judul.link.length; k++) {
if (judul.link[k].rel == 'alternate') { data = judul.link[k].href; break } }
if (data != "") JudNav[data] = judul.title.$t } }
//Penulisan sekumpulan judul feed dengan mengambilnya dari fungsi sebelumnya 'ambilJudNav'
document.write('<script type="text/javascript" src="http://' + window.location.hostname + '/feeds/posts/summary?redirect=false&max-results=500&alt=json-in-script&callback=ambilJudNav"></' + 'script>');
//Pengambilan Anchor, Pengecekan URL dan Penggantian beberapa simbol
function JudulURL(anchor) {
var linkurl = anchor.match(/\/([^\/_]+)(_.*)?\.html/);
if (linkurl) {
linkurl = linkurl[1].replace(/-/g, " ");
linkurl = linkurl[0].toUpperCase() + linkurl.slice(1);
if (linkurl.length > 28) linkurl = linkurl.replace(/ [^ ]+$/, "...")
} return linkurl }
//Mengganti 'Posting Lama' dan 'Posting Lebih Baru'
$(window).load(function () {
window.setTimeout(function () {
var anchor = $("a.blog-pager-newer-link").attr("href");
if (anchor) { var judul = JudNav[anchor];
if (!judul) judul = JudulURL(anchor);
if (judul) $("a.blog-pager-newer-link").html(judul) }
anchor = $("a.blog-pager-older-link").attr("href");
if (anchor) { var judul = JudNav[anchor];
if (!judul) judul = JudulURL(anchor);
if (judul) $("a.blog-pager-older-link").html(judul)
} }, 500) }); | 123cuss | trunk/js-file/blogpager-judul.js | JavaScript | asf20 | 1,532 |
$(document).ready(function() {
function filterPath(string) {
return string
.replace(/^\//,'')
.replace(/(index|default).[a-zA-Z]{3,4}$/,'')
.replace(/\/$/,'');
}
var locationPath = filterPath(location.pathname);
var scrollElem = scrollableElement('html', 'body');
$('a[href*=#]').each(function() {
var thisPath = filterPath(this.pathname) || locationPath;
if ( locationPath == thisPath
&& (location.hostname == this.hostname || !this.hostname)
&& this.hash.replace(/#/,'') ) {
var $target = $(this.hash), target = this.hash;
if (target) {
var targetOffset = $target.offset().top;
$(this).click(function(event) {
event.preventDefault();
$(scrollElem).animate({scrollTop: targetOffset}, 400, function() {
location.hash = target;
});
});
}
}
});
// use the first element that is "scrollable"
function scrollableElement(els) {
for (var i = 0, argLength = arguments.length; i <argLength; i++) {
var el = arguments[i],
$scrollElement = $(el);
if ($scrollElement.scrollTop()> 0) {
return el;
} else {
$scrollElement.scrollTop(1);
var isScrollable = $scrollElement.scrollTop()> 0;
$scrollElement.scrollTop(0);
if (isScrollable) {
return el;
}
}
}
return [];
}
}); | 123cuss | trunk/js-file/smooth-page-scroll-1.js | JavaScript | asf20 | 1,449 |
//<![CDATA[
$(document).ready(function() {
function getTargetTop(elem){
var id = elem.attr("href");
var offset = 60;
return $(id).offset().top - offset;
}
$('a[href^="#"]').click(function(event) {
var target = getTargetTop($(this));
$('html, body').animate({scrollTop:target}, 1200);
event.preventDefault();
});
var sections = $('a[href^="#"]');
function checkSectionSelected(scrolledTo){
var threshold = 200;
var i;
for (i = 0; i < sections.length; i++) {
var section = $(sections[i]);
var target = getTargetTop(section);
if (scrolledTo > target - threshold && scrolledTo < target + threshold) {
sections.removeClass("active");
section.addClass("active");
} } ;}
checkSectionSelected($(window).scrollTop());
$(window).scroll(function(e){
checkSectionSelected($(window).scrollTop())
}); });
//]]> | 123cuss | trunk/js-file/smooth-page-scroll-2.js | JavaScript | asf20 | 823 |
void RCC_Init(void);
| 02-usart-gps-dma | stm32f4xx_rcc.h | C | gpl3 | 21 |
#include "stm32f4xx.h"
#include "nmea.h"
#include <string.h>
#include <stdlib.h>
struct gpsdata_t gpsdata;
static uint16_t chk_ok;
char *pch;
char *p;
uint32_t tmp = 0;
void TextOut(char str) //ITM Stimulus port 0 -> 1-be
{
do {
if(str=='\n') ITM_SendChar('\r');
ITM_SendChar(str); //ITM Send char printf helyett
} while (str++);
}
static uint32_t NMEA_atoi(char *p)
{
uint32_t out = 0;
while ((*p >= '0' && *p <= '9') || *p == '.')
{
if (*p == '.') {
p++;
continue;
}
out *= 10;
out += *p - '0';
p++;
}
return out;
}
void NMEA_Parse(char *buf, uint16_t len)
{
p = pch;
if (!strncmp(pch, "$GP",3 ))
{
chk_ok = 1;
}
if(!strncmp(p, "$GPGGA", 6))
{
p += 7;
// perse time
gpsdata.hour = (p[0] - '0') * 10 + p[1] - '0';
gpsdata.min = (p[2] - '0') * 10 + p[3] - '0';
gpsdata.sec = (p[4] - '0') * 10 + p[5] - '0';
// parse time
p = strstr(p, ",") + 1;
// parse lat
tmp = NMEA_atoi(p);
p = strstr(p, ",") + 1;
if (p[0] == 'S')
tmp = -tmp;
gpsdata.lat = tmp;
p = strstr(p, ",")+1;
// parse lon
tmp = NMEA_atoi(p);
p=strstr(p, ",") + 1;
if (p[0] == 'W')
tmp = -tmp;
gpsdata.lon = tmp;
p = strstr(p, ",") + 1;
gpsdata.valid = (p[0] - '0')?1:0;
// ez nem tudom mi
p = strstr(p, ",") + 1;
//gpsdata.alt = NMEA_atoi(p);
//gpsdata.sats = (p[0] - '0') * 10 + p[1] - '0';
p = strstr(p, ",") + 1;
// HDOP
gpsdata.hdop = NMEA_atoi(p);
p = strstr(p, ",") + 1;
// alt
gpsdata.alt = NMEA_atoi(p);
GPIOD->ODR ^= GPIO_ODR_ODR_13;
}
if(!strncmp(p, "$GPRMC", 6))
{
p += 7;
gpsdata.hour = (p[0] - '0') * 10 + p[1] - '0';
gpsdata.min = (p[2] - '0') * 10 + p[3] - '0';
gpsdata.sec = (p[4] - '0') * 10 + p[5] - '0';
p = strstr(p, ",") + 1;
gpsdata.rmc_valid = (p[0] == 'A')?1:0;
p = strstr(p, ",") + 1;
// parse lat
tmp = NMEA_atoi(p);
p = strstr(p, ",") + 1;
if (p[0] == 'S')
tmp = -tmp;
gpsdata.lat = tmp;
p = strstr(p, ",")+1;
// parse lon
tmp = NMEA_atoi(p);
p=strstr(p, ",") + 1;
if (p[0] == 'W')
tmp = -tmp;
gpsdata.lon = tmp;
p = strstr(p, ",") + 1;
// speed
gpsdata.speed = NMEA_atoi(p);
p = strstr(p, ",") + 1;
// heading
gpsdata.heading = NMEA_atoi(p);
p = strstr(p, ",") + 1;
// date
gpsdata.day = (p[0] - '0') * 10 + p[1] - '0';
gpsdata.month = (p[2] - '0') * 10 + p[3] - '0';
gpsdata.year = (p[4] - '0') * 10 + p[5] - '0';
GPIOD->ODR ^= GPIO_ODR_ODR_14;
}
if(!strncmp(p+3, "GSV", 3)) {
p += 11;
gpsdata.sats = (p[0] - '0') * 10 + p[1] - '0';
GPIOD->ODR ^= GPIO_ODR_ODR_15;
}
if (gpsdata.rmc_valid && gpsdata.valid == 1)
{
//GPIOD->ODR |= GPIO_ODR_ODR_15;
}
else
{
//GPIOD->ODR &= ~GPIO_ODR_ODR_15;
}
}
| 02-usart-gps-dma | Nmea.c | C | gpl3 | 2,735 |
/**
******************************************************************************
* @file system_stm32f4xx.c
* @author MCD Application Team
* @version V1.3.0 modified by Keil for MDK-ARM V5.0
* @date 08-November-2013
* @brief CMSIS Cortex-M4 Device Peripheral Access Layer System Source File.
* This file contains the system clock configuration for STM32F4xx devices.
*
* 1. This file provides two functions and one global variable to be called from
* user application:
* - SystemInit(): Setups the system clock (System clock source, PLL Multiplier
* and Divider factors, AHB/APBx prescalers and Flash settings),
* depending on the configuration made in the clock xls tool.
* This function is called at startup just after reset and
* before branch to main program. This call is made inside
* the "startup_stm32f4xx.s" file.
*
* - SystemCoreClock variable: Contains the core clock (HCLK), it can be used
* by the user application to setup the SysTick
* timer or configure other parameters.
*
* - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must
* be called whenever the core clock is changed
* during program execution.
*
* 2. After each device reset the HSI (16 MHz) is used as system clock source.
* Then SystemInit() function is called, in "startup_stm32f4xx.s" file, to
* configure the system clock before to branch to main program.
*
* 3. If the system clock source selected by user fails to startup, the SystemInit()
* function will do nothing and HSI still used as system clock source. User can
* add some code to deal with this issue inside the SetSysClock() function.
*
* 4. The default value of HSE crystal is set to 25MHz, refer to "HSE_VALUE" define
* in "stm32f4xx.h" file. When HSE is used as system clock source, directly or
* through PLL, and you are using different crystal you have to adapt the HSE
* value to your own configuration.
*
* 5. This file configures the system clock as follows:
*=============================================================================
*=============================================================================
* Supported STM32F40xxx/41xxx devices
*-----------------------------------------------------------------------------
* System Clock source | PLL (HSE)
*-----------------------------------------------------------------------------
* SYSCLK(Hz) | 168000000
*-----------------------------------------------------------------------------
* HCLK(Hz) | 168000000
*-----------------------------------------------------------------------------
* AHB Prescaler | 1
*-----------------------------------------------------------------------------
* APB1 Prescaler | 4
*-----------------------------------------------------------------------------
* APB2 Prescaler | 2
*-----------------------------------------------------------------------------
* HSE Frequency(Hz) | 25000000
*-----------------------------------------------------------------------------
* PLL_M | 25
*-----------------------------------------------------------------------------
* PLL_N | 336
*-----------------------------------------------------------------------------
* PLL_P | 2
*-----------------------------------------------------------------------------
* PLL_Q | 7
*-----------------------------------------------------------------------------
* PLLI2S_N | NA
*-----------------------------------------------------------------------------
* PLLI2S_R | NA
*-----------------------------------------------------------------------------
* I2S input clock | NA
*-----------------------------------------------------------------------------
* VDD(V) | 3.3
*-----------------------------------------------------------------------------
* Main regulator output voltage | Scale1 mode
*-----------------------------------------------------------------------------
* Flash Latency(WS) | 5
*-----------------------------------------------------------------------------
* Prefetch Buffer | ON
*-----------------------------------------------------------------------------
* Instruction cache | ON
*-----------------------------------------------------------------------------
* Data cache | ON
*-----------------------------------------------------------------------------
* Require 48MHz for USB OTG FS, | Disabled
* SDIO and RNG clock |
*-----------------------------------------------------------------------------
*=============================================================================
*=============================================================================
* Supported STM32F42xxx/43xxx devices
*-----------------------------------------------------------------------------
* System Clock source | PLL (HSE)
*-----------------------------------------------------------------------------
* SYSCLK(Hz) | 180000000
*-----------------------------------------------------------------------------
* HCLK(Hz) | 180000000
*-----------------------------------------------------------------------------
* AHB Prescaler | 1
*-----------------------------------------------------------------------------
* APB1 Prescaler | 4
*-----------------------------------------------------------------------------
* APB2 Prescaler | 2
*-----------------------------------------------------------------------------
* HSE Frequency(Hz) | 25000000
*-----------------------------------------------------------------------------
* PLL_M | 25
*-----------------------------------------------------------------------------
* PLL_N | 360
*-----------------------------------------------------------------------------
* PLL_P | 2
*-----------------------------------------------------------------------------
* PLL_Q | 7
*-----------------------------------------------------------------------------
* PLLI2S_N | NA
*-----------------------------------------------------------------------------
* PLLI2S_R | NA
*-----------------------------------------------------------------------------
* I2S input clock | NA
*-----------------------------------------------------------------------------
* VDD(V) | 3.3
*-----------------------------------------------------------------------------
* Main regulator output voltage | Scale1 mode
*-----------------------------------------------------------------------------
* Flash Latency(WS) | 5
*-----------------------------------------------------------------------------
* Prefetch Buffer | ON
*-----------------------------------------------------------------------------
* Instruction cache | ON
*-----------------------------------------------------------------------------
* Data cache | ON
*-----------------------------------------------------------------------------
* Require 48MHz for USB OTG FS, | Disabled
* SDIO and RNG clock |
*-----------------------------------------------------------------------------
*=============================================================================
*=============================================================================
* Supported STM32F401xx devices
*-----------------------------------------------------------------------------
* System Clock source | PLL (HSE)
*-----------------------------------------------------------------------------
* SYSCLK(Hz) | 84000000
*-----------------------------------------------------------------------------
* HCLK(Hz) | 84000000
*-----------------------------------------------------------------------------
* AHB Prescaler | 1
*-----------------------------------------------------------------------------
* APB1 Prescaler | 2
*-----------------------------------------------------------------------------
* APB2 Prescaler | 1
*-----------------------------------------------------------------------------
* HSE Frequency(Hz) | 25000000
*-----------------------------------------------------------------------------
* PLL_M | 25
*-----------------------------------------------------------------------------
* PLL_N | 336
*-----------------------------------------------------------------------------
* PLL_P | 4
*-----------------------------------------------------------------------------
* PLL_Q | 7
*-----------------------------------------------------------------------------
* PLLI2S_N | NA
*-----------------------------------------------------------------------------
* PLLI2S_R | NA
*-----------------------------------------------------------------------------
* I2S input clock | NA
*-----------------------------------------------------------------------------
* VDD(V) | 3.3
*-----------------------------------------------------------------------------
* Main regulator output voltage | Scale1 mode
*-----------------------------------------------------------------------------
* Flash Latency(WS) | 2
*-----------------------------------------------------------------------------
* Prefetch Buffer | ON
*-----------------------------------------------------------------------------
* Instruction cache | ON
*-----------------------------------------------------------------------------
* Data cache | ON
*-----------------------------------------------------------------------------
* Require 48MHz for USB OTG FS, | Disabled
* SDIO and RNG clock |
*-----------------------------------------------------------------------------
*=============================================================================
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
*/
/** @addtogroup CMSIS
* @{
*/
/** @addtogroup stm32f4xx_system
* @{
*/
/** @addtogroup STM32F4xx_System_Private_Includes
* @{
*/
#include "stm32f4xx.h"
/**
* @}
*/
/** @addtogroup STM32F4xx_System_Private_TypesDefinitions
* @{
*/
/**
* @}
*/
/** @addtogroup STM32F4xx_System_Private_Defines
* @{
*/
/************************* Miscellaneous Configuration ************************/
/*!< Uncomment the following line if you need to use external SRAM or SDRAM mounted
on STM324xG_EVAL/STM324x7I_EVAL/STM324x9I_EVAL boards as data memory */
#if defined (STM32F40_41xxx) || defined (STM32F427_437xx) || defined (STM32F429_439xx)
/* #define DATA_IN_ExtSRAM */
#endif /* STM32F40_41xxx || STM32F427_437x || STM32F429_439xx */
#if defined (STM32F427_437xx) || defined (STM32F429_439xx)
/* #define DATA_IN_ExtSDRAM */
#endif /* STM32F427_437x || STM32F429_439xx */
/*!< Uncomment the following line if you need to relocate your vector Table in
Internal SRAM. */
/* #define VECT_TAB_SRAM */
#define VECT_TAB_OFFSET 0x00 /*!< Vector Table base offset field.
This value must be a multiple of 0x200. */
/******************************************************************************/
/************************* PLL Parameters *************************************/
/* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N */
#define PLL_M 8
/* USB OTG FS, SDIO and RNG Clock = PLL_VCO / PLLQ */
#define PLL_Q 7
#if defined (STM32F40_41xxx)
#define PLL_N 336
/* SYSCLK = PLL_VCO / PLL_P */
#define PLL_P 2
#endif /* STM32F40_41xxx */
#if defined (STM32F427_437xx) || defined (STM32F429_439xx)
#define PLL_N 360
/* SYSCLK = PLL_VCO / PLL_P */
#define PLL_P 2
#endif /* STM32F427_437x || STM32F429_439xx */
#if defined (STM32F401xx)
#define PLL_N 336
/* SYSCLK = PLL_VCO / PLL_P */
#define PLL_P 4
#endif /* STM32F401xx */
/******************************************************************************/
/**
* @}
*/
/** @addtogroup STM32F4xx_System_Private_Macros
* @{
*/
/**
* @}
*/
/** @addtogroup STM32F4xx_System_Private_Variables
* @{
*/
#if defined (STM32F40_41xxx)
uint32_t SystemCoreClock = 168000000;
#endif /* STM32F40_41xxx */
#if defined (STM32F427_437xx) || defined (STM32F429_439xx)
uint32_t SystemCoreClock = 180000000;
#endif /* STM32F427_437x || STM32F429_439xx */
#if defined (STM32F401xx)
uint32_t SystemCoreClock = 84000000;
#endif /* STM32F401xx */
__I uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
/**
* @}
*/
/** @addtogroup STM32F4xx_System_Private_FunctionPrototypes
* @{
*/
static void SetSysClock(void);
#if defined (DATA_IN_ExtSRAM) || defined (DATA_IN_ExtSDRAM) || defined (PREMAIN_FSMC_SETUP) /* Keil */
static void SystemInit_ExtMemCtl(void);
#endif /* DATA_IN_ExtSRAM || DATA_IN_ExtSDRAM || defined (PREMAIN_FSMC_SETUP) */ /* Keil */
/**
* @}
*/
/** @addtogroup STM32F4xx_System_Private_Functions
* @{
*/
/**
* @brief Setup the microcontroller system
* Initialize the Embedded Flash Interface, the PLL and update the
* SystemFrequency variable.
* @param None
* @retval None
*/
void SystemInit(void)
{
/* FPU settings ------------------------------------------------------------*/
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2)); /* set CP10 and CP11 Full Access */
#endif
/* Reset the RCC clock configuration to the default reset state ------------*/
/* Set HSION bit */
RCC->CR |= (uint32_t)0x00000001;
/* Reset CFGR register */
RCC->CFGR = 0x00000000;
/* Reset HSEON, CSSON and PLLON bits */
RCC->CR &= (uint32_t)0xFEF6FFFF;
/* Reset PLLCFGR register */
RCC->PLLCFGR = 0x24003010;
/* Reset HSEBYP bit */
RCC->CR &= (uint32_t)0xFFFBFFFF;
/* Disable all interrupts */
RCC->CIR = 0x00000000;
#if defined (DATA_IN_ExtSRAM) || defined (DATA_IN_ExtSDRAM) || defined (PREMAIN_FSMC_SETUP) /* Keil */
SystemInit_ExtMemCtl();
#endif /* DATA_IN_ExtSRAM || DATA_IN_ExtSDRAM || defined (PREMAIN_FSMC_SETUP) */ /* Keil */
/* Configure the System clock source, PLL Multiplier and Divider factors,
AHB/APBx prescalers and Flash settings ----------------------------------*/
SetSysClock();
/* Configure the Vector Table location add offset address ------------------*/
#ifdef VECT_TAB_SRAM
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
#else
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
#endif
}
/**
* @brief Update SystemCoreClock variable according to Clock Register Values.
* The SystemCoreClock variable contains the core clock (HCLK), it can
* be used by the user application to setup the SysTick timer or configure
* other parameters.
*
* @note Each time the core clock (HCLK) changes, this function must be called
* to update SystemCoreClock variable value. Otherwise, any configuration
* based on this variable will be incorrect.
*
* @note - The system frequency computed by this function is not the real
* frequency in the chip. It is calculated based on the predefined
* constant and the selected clock source:
*
* - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*)
*
* - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(**)
*
* - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(**)
* or HSI_VALUE(*) multiplied/divided by the PLL factors.
*
* (*) HSI_VALUE is a constant defined in stm32f4xx.h file (default value
* 16 MHz) but the real value may vary depending on the variations
* in voltage and temperature.
*
* (**) HSE_VALUE is a constant defined in stm32f4xx.h file (default value
* 25 MHz), user has to ensure that HSE_VALUE is same as the real
* frequency of the crystal used. Otherwise, this function may
* have wrong result.
*
* - The result of this function could be not correct when using fractional
* value for HSE crystal.
*
* @param None
* @retval None
*/
void SystemCoreClockUpdate(void)
{
uint32_t tmp = 0, pllvco = 0, pllp = 2, pllsource = 0, pllm = 2;
/* Get SYSCLK source -------------------------------------------------------*/
tmp = RCC->CFGR & RCC_CFGR_SWS;
switch (tmp)
{
case 0x00: /* HSI used as system clock source */
SystemCoreClock = HSI_VALUE;
break;
case 0x04: /* HSE used as system clock source */
SystemCoreClock = HSE_VALUE;
break;
case 0x08: /* PLL used as system clock source */
/* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N
SYSCLK = PLL_VCO / PLL_P
*/
pllsource = (RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) >> 22;
pllm = RCC->PLLCFGR & RCC_PLLCFGR_PLLM;
if (pllsource != 0)
{
/* HSE used as PLL clock source */
pllvco = (HSE_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6);
}
else
{
/* HSI used as PLL clock source */
pllvco = (HSI_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6);
}
pllp = (((RCC->PLLCFGR & RCC_PLLCFGR_PLLP) >>16) + 1 ) *2;
SystemCoreClock = pllvco/pllp;
break;
default:
SystemCoreClock = HSI_VALUE;
break;
}
/* Compute HCLK frequency --------------------------------------------------*/
/* Get HCLK prescaler */
tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4)];
/* HCLK frequency */
SystemCoreClock >>= tmp;
}
/**
* @brief Configures the System clock source, PLL Multiplier and Divider factors,
* AHB/APBx prescalers and Flash settings
* @Note This function should be called only once the RCC clock configuration
* is reset to the default reset state (done in SystemInit() function).
* @param None
* @retval None
*/
static void SetSysClock(void)
{
/******************************************************************************/
/* PLL (clocked by HSE) used as System clock source */
/******************************************************************************/
__IO uint32_t StartUpCounter = 0, HSEStatus = 0;
/* Enable HSE */
RCC->CR |= ((uint32_t)RCC_CR_HSEON);
/* Wait till HSE is ready and if Time out is reached exit */
do
{
HSEStatus = RCC->CR & RCC_CR_HSERDY;
StartUpCounter++;
} while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
if ((RCC->CR & RCC_CR_HSERDY) != RESET)
{
HSEStatus = (uint32_t)0x01;
}
else
{
HSEStatus = (uint32_t)0x00;
}
if (HSEStatus == (uint32_t)0x01)
{
/* Select regulator voltage output Scale 1 mode */
RCC->APB1ENR |= RCC_APB1ENR_PWREN;
PWR->CR |= PWR_CR_VOS;
/* HCLK = SYSCLK / 1*/
RCC->CFGR |= RCC_CFGR_HPRE_DIV1;
#if defined (STM32F40_41xxx) || defined (STM32F427_437xx) || defined (STM32F429_439xx)
/* PCLK2 = HCLK / 2*/
RCC->CFGR |= RCC_CFGR_PPRE2_DIV2;
/* PCLK1 = HCLK / 4*/
RCC->CFGR |= RCC_CFGR_PPRE1_DIV4;
#endif /* STM32F40_41xxx || STM32F427_437x || STM32F429_439xx */
#if defined (STM32F401xx)
/* PCLK2 = HCLK / 2*/
RCC->CFGR |= RCC_CFGR_PPRE2_DIV1;
/* PCLK1 = HCLK / 4*/
RCC->CFGR |= RCC_CFGR_PPRE1_DIV2;
#endif /* STM32F401xx */
/* Configure the main PLL */
RCC->PLLCFGR = PLL_M | (PLL_N << 6) | (((PLL_P >> 1) -1) << 16) |
(RCC_PLLCFGR_PLLSRC_HSE) | (PLL_Q << 24);
/* Enable the main PLL */
RCC->CR |= RCC_CR_PLLON;
/* Wait till the main PLL is ready */
while((RCC->CR & RCC_CR_PLLRDY) == 0)
{
}
#if defined (STM32F427_437xx) || defined (STM32F429_439xx)
/* Enable the Over-drive to extend the clock frequency to 180 Mhz */
PWR->CR |= PWR_CR_ODEN;
while((PWR->CSR & PWR_CSR_ODRDY) == 0)
{
}
PWR->CR |= PWR_CR_ODSWEN;
while((PWR->CSR & PWR_CSR_ODSWRDY) == 0)
{
}
/* Configure Flash prefetch, Instruction cache, Data cache and wait state */
FLASH->ACR = FLASH_ACR_PRFTEN | FLASH_ACR_ICEN |FLASH_ACR_DCEN |FLASH_ACR_LATENCY_5WS;
#endif /* STM32F427_437x || STM32F429_439xx */
#if defined (STM32F40_41xxx)
/* Configure Flash prefetch, Instruction cache, Data cache and wait state */
FLASH->ACR = FLASH_ACR_PRFTEN | FLASH_ACR_ICEN |FLASH_ACR_DCEN |FLASH_ACR_LATENCY_5WS;
#endif /* STM32F40_41xxx */
#if defined (STM32F401xx)
/* Configure Flash prefetch, Instruction cache, Data cache and wait state */
FLASH->ACR = FLASH_ACR_PRFTEN | FLASH_ACR_ICEN |FLASH_ACR_DCEN |FLASH_ACR_LATENCY_2WS;
#endif /* STM32F401xx */
/* Select the main PLL as system clock source */
RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW));
RCC->CFGR |= RCC_CFGR_SW_PLL;
/* Wait till the main PLL is used as system clock source */
while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS ) != RCC_CFGR_SWS_PLL);
{
}
}
else
{ /* If HSE fails to start-up, the application will have wrong clock
configuration. User can add here some code to deal with this error */
}
}
/**
* @brief Setup the external memory controller. Called in startup_stm32f4xx.s
* before jump to __main
* @param None
* @retval None
*/
#ifdef PREMAIN_FSMC_SETUP /* Keil */
extern void FSMC_Setup (void);
void SystemInit_ExtMemCtl(void) {
FSMC_Setup();
}
#endif /* PREMAIN_FSMC_SETUP */ /* Keil */
#ifdef DATA_IN_ExtSRAM
/**
* @brief Setup the external memory controller.
* Called in startup_stm32f4xx.s before jump to main.
* This function configures the external SRAM mounted on STM324xG_EVAL/STM324x7I boards
* This SRAM will be used as program data memory (including heap and stack).
* @param None
* @retval None
*/
void SystemInit_ExtMemCtl(void)
{
/*-- GPIOs Configuration -----------------------------------------------------*/
/*
+-------------------+--------------------+------------------+--------------+
+ SRAM pins assignment +
+-------------------+--------------------+------------------+--------------+
| PD0 <-> FMC_D2 | PE0 <-> FMC_NBL0 | PF0 <-> FMC_A0 | PG0 <-> FMC_A10 |
| PD1 <-> FMC_D3 | PE1 <-> FMC_NBL1 | PF1 <-> FMC_A1 | PG1 <-> FMC_A11 |
| PD4 <-> FMC_NOE | PE3 <-> FMC_A19 | PF2 <-> FMC_A2 | PG2 <-> FMC_A12 |
| PD5 <-> FMC_NWE | PE4 <-> FMC_A20 | PF3 <-> FMC_A3 | PG3 <-> FMC_A13 |
| PD8 <-> FMC_D13 | PE7 <-> FMC_D4 | PF4 <-> FMC_A4 | PG4 <-> FMC_A14 |
| PD9 <-> FMC_D14 | PE8 <-> FMC_D5 | PF5 <-> FMC_A5 | PG5 <-> FMC_A15 |
| PD10 <-> FMC_D15 | PE9 <-> FMC_D6 | PF12 <-> FMC_A6 | PG9 <-> FMC_NE2 |
| PD11 <-> FMC_A16 | PE10 <-> FMC_D7 | PF13 <-> FMC_A7 |-----------------+
| PD12 <-> FMC_A17 | PE11 <-> FMC_D8 | PF14 <-> FMC_A8 |
| PD13 <-> FMC_A18 | PE12 <-> FMC_D9 | PF15 <-> FMC_A9 |
| PD14 <-> FMC_D0 | PE13 <-> FMC_D10 |-----------------+
| PD15 <-> FMC_D1 | PE14 <-> FMC_D11 |
| | PE15 <-> FMC_D12 |
+------------------+------------------+
*/
/* Enable GPIOD, GPIOE, GPIOF and GPIOG interface clock */
RCC->AHB1ENR |= 0x00000078;
/* Connect PDx pins to FMC Alternate function */
GPIOD->AFR[0] = 0x00cc00cc;
GPIOD->AFR[1] = 0xcccccccc;
/* Configure PDx pins in Alternate function mode */
GPIOD->MODER = 0xaaaa0a0a;
/* Configure PDx pins speed to 100 MHz */
GPIOD->OSPEEDR = 0xffff0f0f;
/* Configure PDx pins Output type to push-pull */
GPIOD->OTYPER = 0x00000000;
/* No pull-up, pull-down for PDx pins */
GPIOD->PUPDR = 0x00000000;
/* Connect PEx pins to FMC Alternate function */
GPIOE->AFR[0] = 0xcccccccc;
GPIOE->AFR[1] = 0xcccccccc;
/* Configure PEx pins in Alternate function mode */
GPIOE->MODER = 0xaaaaaaaa;
/* Configure PEx pins speed to 100 MHz */
GPIOE->OSPEEDR = 0xffffffff;
/* Configure PEx pins Output type to push-pull */
GPIOE->OTYPER = 0x00000000;
/* No pull-up, pull-down for PEx pins */
GPIOE->PUPDR = 0x00000000;
/* Connect PFx pins to FMC Alternate function */
GPIOF->AFR[0] = 0x00cccccc;
GPIOF->AFR[1] = 0xcccc0000;
/* Configure PFx pins in Alternate function mode */
GPIOF->MODER = 0xaa000aaa;
/* Configure PFx pins speed to 100 MHz */
GPIOF->OSPEEDR = 0xff000fff;
/* Configure PFx pins Output type to push-pull */
GPIOF->OTYPER = 0x00000000;
/* No pull-up, pull-down for PFx pins */
GPIOF->PUPDR = 0x00000000;
/* Connect PGx pins to FMC Alternate function */
GPIOG->AFR[0] = 0x00cccccc;
GPIOG->AFR[1] = 0x000000c0;
/* Configure PGx pins in Alternate function mode */
GPIOG->MODER = 0x00080aaa;
/* Configure PGx pins speed to 100 MHz */
GPIOG->OSPEEDR = 0x000c0fff;
/* Configure PGx pins Output type to push-pull */
GPIOG->OTYPER = 0x00000000;
/* No pull-up, pull-down for PGx pins */
GPIOG->PUPDR = 0x00000000;
/*-- FMC Configuration ------------------------------------------------------*/
/* Enable the FMC/FSMC interface clock */
RCC->AHB3ENR |= 0x00000001;
#if defined (STM32F427_437xx) || defined (STM32F429_439xx)
/* Configure and enable Bank1_SRAM2 */
FMC_Bank1->BTCR[2] = 0x00001011;
FMC_Bank1->BTCR[3] = 0x00000201;
FMC_Bank1E->BWTR[2] = 0x0fffffff;
#endif /* STM32F427_437xx || STM32F429_439xx */
#if defined (STM32F40_41xxx)
/* Configure and enable Bank1_SRAM2 */
FSMC_Bank1->BTCR[2] = 0x00001011;
FSMC_Bank1->BTCR[3] = 0x00000201;
FSMC_Bank1E->BWTR[2] = 0x0fffffff;
#endif /* STM32F40_41xxx */
/*
Bank1_SRAM2 is configured as follow:
In case of FSMC configuration
NORSRAMTimingStructure.FSMC_AddressSetupTime = 1;
NORSRAMTimingStructure.FSMC_AddressHoldTime = 0;
NORSRAMTimingStructure.FSMC_DataSetupTime = 2;
NORSRAMTimingStructure.FSMC_BusTurnAroundDuration = 0;
NORSRAMTimingStructure.FSMC_CLKDivision = 0;
NORSRAMTimingStructure.FSMC_DataLatency = 0;
NORSRAMTimingStructure.FSMC_AccessMode = FMC_AccessMode_A;
FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM2;
FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable;
FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM;
FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;
FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable;
FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable;
FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;
FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable;
FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState;
FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable;
FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable;
FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable;
FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;
FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &NORSRAMTimingStructure;
FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &NORSRAMTimingStructure;
In case of FMC configuration
NORSRAMTimingStructure.FMC_AddressSetupTime = 1;
NORSRAMTimingStructure.FMC_AddressHoldTime = 0;
NORSRAMTimingStructure.FMC_DataSetupTime = 2;
NORSRAMTimingStructure.FMC_BusTurnAroundDuration = 0;
NORSRAMTimingStructure.FMC_CLKDivision = 0;
NORSRAMTimingStructure.FMC_DataLatency = 0;
NORSRAMTimingStructure.FMC_AccessMode = FMC_AccessMode_A;
FMC_NORSRAMInitStructure.FMC_Bank = FMC_Bank1_NORSRAM2;
FMC_NORSRAMInitStructure.FMC_DataAddressMux = FMC_DataAddressMux_Disable;
FMC_NORSRAMInitStructure.FMC_MemoryType = FMC_MemoryType_SRAM;
FMC_NORSRAMInitStructure.FMC_MemoryDataWidth = FMC_MemoryDataWidth_16b;
FMC_NORSRAMInitStructure.FMC_BurstAccessMode = FMC_BurstAccessMode_Disable;
FMC_NORSRAMInitStructure.FMC_AsynchronousWait = FMC_AsynchronousWait_Disable;
FMC_NORSRAMInitStructure.FMC_WaitSignalPolarity = FMC_WaitSignalPolarity_Low;
FMC_NORSRAMInitStructure.FMC_WrapMode = FMC_WrapMode_Disable;
FMC_NORSRAMInitStructure.FMC_WaitSignalActive = FMC_WaitSignalActive_BeforeWaitState;
FMC_NORSRAMInitStructure.FMC_WriteOperation = FMC_WriteOperation_Enable;
FMC_NORSRAMInitStructure.FMC_WaitSignal = FMC_WaitSignal_Disable;
FMC_NORSRAMInitStructure.FMC_ExtendedMode = FMC_ExtendedMode_Disable;
FMC_NORSRAMInitStructure.FMC_WriteBurst = FMC_WriteBurst_Disable;
FMC_NORSRAMInitStructure.FMC_ContinousClock = FMC_CClock_SyncOnly;
FMC_NORSRAMInitStructure.FMC_ReadWriteTimingStruct = &NORSRAMTimingStructure;
FMC_NORSRAMInitStructure.FMC_WriteTimingStruct = &NORSRAMTimingStructure;
*/
}
#endif /* DATA_IN_ExtSRAM */
#ifdef DATA_IN_ExtSDRAM
/**
* @brief Setup the external memory controller.
* Called in startup_stm32f4xx.s before jump to main.
* This function configures the external SDRAM mounted on STM324x9I_EVAL board
* This SDRAM will be used as program data memory (including heap and stack).
* @param None
* @retval None
*/
void SystemInit_ExtMemCtl(void)
{
register uint32_t tmpreg = 0, timeout = 0xFFFF;
register uint32_t index;
/* Enable GPIOC, GPIOD, GPIOE, GPIOF, GPIOG, GPIOH and GPIOI interface
clock */
RCC->AHB1ENR |= 0x000001FC;
/* Connect PCx pins to FMC Alternate function */
GPIOC->AFR[0] = 0x0000000c;
GPIOC->AFR[1] = 0x00007700;
/* Configure PCx pins in Alternate function mode */
GPIOC->MODER = 0x00a00002;
/* Configure PCx pins speed to 50 MHz */
GPIOC->OSPEEDR = 0x00a00002;
/* Configure PCx pins Output type to push-pull */
GPIOC->OTYPER = 0x00000000;
/* No pull-up, pull-down for PCx pins */
GPIOC->PUPDR = 0x00500000;
/* Connect PDx pins to FMC Alternate function */
GPIOD->AFR[0] = 0x000000CC;
GPIOD->AFR[1] = 0xCC000CCC;
/* Configure PDx pins in Alternate function mode */
GPIOD->MODER = 0xA02A000A;
/* Configure PDx pins speed to 50 MHz */
GPIOD->OSPEEDR = 0xA02A000A;
/* Configure PDx pins Output type to push-pull */
GPIOD->OTYPER = 0x00000000;
/* No pull-up, pull-down for PDx pins */
GPIOD->PUPDR = 0x00000000;
/* Connect PEx pins to FMC Alternate function */
GPIOE->AFR[0] = 0xC00000CC;
GPIOE->AFR[1] = 0xCCCCCCCC;
/* Configure PEx pins in Alternate function mode */
GPIOE->MODER = 0xAAAA800A;
/* Configure PEx pins speed to 50 MHz */
GPIOE->OSPEEDR = 0xAAAA800A;
/* Configure PEx pins Output type to push-pull */
GPIOE->OTYPER = 0x00000000;
/* No pull-up, pull-down for PEx pins */
GPIOE->PUPDR = 0x00000000;
/* Connect PFx pins to FMC Alternate function */
GPIOF->AFR[0] = 0xcccccccc;
GPIOF->AFR[1] = 0xcccccccc;
/* Configure PFx pins in Alternate function mode */
GPIOF->MODER = 0xAA800AAA;
/* Configure PFx pins speed to 50 MHz */
GPIOF->OSPEEDR = 0xAA800AAA;
/* Configure PFx pins Output type to push-pull */
GPIOF->OTYPER = 0x00000000;
/* No pull-up, pull-down for PFx pins */
GPIOF->PUPDR = 0x00000000;
/* Connect PGx pins to FMC Alternate function */
GPIOG->AFR[0] = 0xcccccccc;
GPIOG->AFR[1] = 0xcccccccc;
/* Configure PGx pins in Alternate function mode */
GPIOG->MODER = 0xaaaaaaaa;
/* Configure PGx pins speed to 50 MHz */
GPIOG->OSPEEDR = 0xaaaaaaaa;
/* Configure PGx pins Output type to push-pull */
GPIOG->OTYPER = 0x00000000;
/* No pull-up, pull-down for PGx pins */
GPIOG->PUPDR = 0x00000000;
/* Connect PHx pins to FMC Alternate function */
GPIOH->AFR[0] = 0x00C0CC00;
GPIOH->AFR[1] = 0xCCCCCCCC;
/* Configure PHx pins in Alternate function mode */
GPIOH->MODER = 0xAAAA08A0;
/* Configure PHx pins speed to 50 MHz */
GPIOH->OSPEEDR = 0xAAAA08A0;
/* Configure PHx pins Output type to push-pull */
GPIOH->OTYPER = 0x00000000;
/* No pull-up, pull-down for PHx pins */
GPIOH->PUPDR = 0x00000000;
/* Connect PIx pins to FMC Alternate function */
GPIOI->AFR[0] = 0xCCCCCCCC;
GPIOI->AFR[1] = 0x00000CC0;
/* Configure PIx pins in Alternate function mode */
GPIOI->MODER = 0x0028AAAA;
/* Configure PIx pins speed to 50 MHz */
GPIOI->OSPEEDR = 0x0028AAAA;
/* Configure PIx pins Output type to push-pull */
GPIOI->OTYPER = 0x00000000;
/* No pull-up, pull-down for PIx pins */
GPIOI->PUPDR = 0x00000000;
/*-- FMC Configuration ------------------------------------------------------*/
/* Enable the FMC interface clock */
RCC->AHB3ENR |= 0x00000001;
/* Configure and enable SDRAM bank1 */
FMC_Bank5_6->SDCR[0] = 0x000039D0;
FMC_Bank5_6->SDTR[0] = 0x01115351;
/* SDRAM initialization sequence */
/* Clock enable command */
FMC_Bank5_6->SDCMR = 0x00000011;
tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
while((tmpreg != 0) & (timeout-- > 0))
{
tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
}
/* Delay */
for (index = 0; index<1000; index++);
/* PALL command */
FMC_Bank5_6->SDCMR = 0x00000012;
timeout = 0xFFFF;
while((tmpreg != 0) & (timeout-- > 0))
{
tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
}
/* Auto refresh command */
FMC_Bank5_6->SDCMR = 0x00000073;
timeout = 0xFFFF;
while((tmpreg != 0) & (timeout-- > 0))
{
tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
}
/* MRD register program */
FMC_Bank5_6->SDCMR = 0x00046014;
timeout = 0xFFFF;
while((tmpreg != 0) & (timeout-- > 0))
{
tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
}
/* Set refresh count */
tmpreg = FMC_Bank5_6->SDRTR;
FMC_Bank5_6->SDRTR = (tmpreg | (0x0000027C<<1));
/* Disable write protection */
tmpreg = FMC_Bank5_6->SDCR[0];
FMC_Bank5_6->SDCR[0] = (tmpreg & 0xFFFFFDFF);
/*
Bank1_SDRAM is configured as follow:
FMC_SDRAMTimingInitStructure.FMC_LoadToActiveDelay = 2;
FMC_SDRAMTimingInitStructure.FMC_ExitSelfRefreshDelay = 6;
FMC_SDRAMTimingInitStructure.FMC_SelfRefreshTime = 4;
FMC_SDRAMTimingInitStructure.FMC_RowCycleDelay = 6;
FMC_SDRAMTimingInitStructure.FMC_WriteRecoveryTime = 2;
FMC_SDRAMTimingInitStructure.FMC_RPDelay = 2;
FMC_SDRAMTimingInitStructure.FMC_RCDDelay = 2;
FMC_SDRAMInitStructure.FMC_Bank = SDRAM_BANK;
FMC_SDRAMInitStructure.FMC_ColumnBitsNumber = FMC_ColumnBits_Number_8b;
FMC_SDRAMInitStructure.FMC_RowBitsNumber = FMC_RowBits_Number_11b;
FMC_SDRAMInitStructure.FMC_SDMemoryDataWidth = FMC_SDMemory_Width_16b;
FMC_SDRAMInitStructure.FMC_InternalBankNumber = FMC_InternalBank_Number_4;
FMC_SDRAMInitStructure.FMC_CASLatency = FMC_CAS_Latency_3;
FMC_SDRAMInitStructure.FMC_WriteProtection = FMC_Write_Protection_Disable;
FMC_SDRAMInitStructure.FMC_SDClockPeriod = FMC_SDClock_Period_2;
FMC_SDRAMInitStructure.FMC_ReadBurst = FMC_Read_Burst_disable;
FMC_SDRAMInitStructure.FMC_ReadPipeDelay = FMC_ReadPipe_Delay_1;
FMC_SDRAMInitStructure.FMC_SDRAMTimingStruct = &FMC_SDRAMTimingInitStructure;
*/
}
#endif /* DATA_IN_ExtSDRAM */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
| 02-usart-gps-dma | system_stm32f4xx.c | C | gpl3 | 38,702 |
/* stm32f4xx_periph.c */
#include "stm32f4xx.h"
#include "stm32f4xx_periph.h"
#define MAX_STRLEN 256
char usart_buffer[MAX_STRLEN];
void USART2_INIT(void);
void TIM2_Init(void);
void DMA1_Init(void);
void TIM2_Init(void)
{
//LED init PD12
GPIOD -> MODER |= (1<<24); //PD12 = output
GPIOD -> OTYPER &= (1<<12); //Output Push/pull
GPIOD -> OSPEEDR &= ~(3<<24); //50Mhz fast speed
GPIOD -> OSPEEDR |= (2<<24);
GPIOD -> PUPDR &= ~(3<<24); //PD12 pull up
GPIOD -> PUPDR |= (1<<24);
//LED init PD12
//LED init PD13
GPIOD -> MODER |= (1<<26); //PD13 = output
GPIOD -> OTYPER &= (1<<13); //Output Push/pull
GPIOD -> OSPEEDR &= ~(3<<26); //50Mhz fast speed
GPIOD -> OSPEEDR |= (2<<26);
GPIOD -> PUPDR &= ~(3<<26); //PD13 pull up
GPIOD -> PUPDR |= (1<<26);
//LED init PD13
//LED init PD14
GPIOD -> MODER |= (1<<28); //PD14 = output
GPIOD -> OTYPER &= (1<<14); //Output Push/pull
GPIOD -> OSPEEDR &= ~(3<<28); //50Mhz fast speed
GPIOD -> OSPEEDR |= (2<<28);
GPIOD -> PUPDR &= ~(3<<28); //PD14 pull up
GPIOD -> PUPDR |= (1<<28);
//LED init PD14
//LED init PD14
GPIOD -> MODER |= (1<<30); //PD14 = output
GPIOD -> OTYPER &= (1<<15); //Output Push/pull
GPIOD -> OSPEEDR |= (2<<30); //50Mhz fast speed
GPIOD -> PUPDR |= (1<<30); //PD14 pull up
//LED init PD14
TIM2->CR1 &= ~TIM_CR1_CEN;
prescaler = SystemCoreClock/2;
prescaler /=Timer_Frequency;
prescaler -=1;
TIM2 -> PSC = Timer_Frequency-1;
TIM2 -> ARR = prescaler;
NVIC_EnableIRQ(TIM2_IRQn);
TIM2->DIER |= TIM_DIER_UIE;
TIM2->CR1 |= TIM_CR1_CEN;
}
void USART2_INIT(void)
{
BaudRate = 38400;
GPIOA -> MODER |= GPIO_MODER_MODER3_1; // RX PD6 to alternate function output push-pull at 50 MHz 0x10
GPIOA -> MODER |= GPIO_MODER_MODER2_1; // TX PD5 to alternate function output push-pull at 50 MHz 0x10
GPIOA -> OSPEEDR |= GPIO_OSPEEDER_OSPEEDR3_0 | GPIO_OSPEEDER_OSPEEDR3_1; //50Mhz fast speed
GPIOA -> OSPEEDR |= GPIO_OSPEEDER_OSPEEDR2_0 | GPIO_OSPEEDER_OSPEEDR2_1;
GPIOA -> PUPDR |= GPIO_PUPDR_PUPDR2_0;
GPIOA -> AFR[0] |= (7<<8);
GPIOA -> AFR[0] |= (7<<12);
BRR = (SystemCoreClock/4) / (BaudRate*16);
USART2 -> BRR = (68 << 4 ) + 0x06; //38400br
USART2 -> CR1 |= USART_CR1_UE | USART_CR1_RE | USART_CR1_TE;
USART2 -> CR3 |= USART_CR3_DMAR;
}
void DMA1_Init(void)
{
RCC -> AHB1ENR |= RCC_AHB1ENR_DMA1EN; // Enable DMA1 clcok
DMA1_Stream5 -> CR &= ~DMA_SxCR_EN; // disable Stream6
DMA1_Stream5 -> PAR = (uint32_t)&USART2->DR; // from periph port register
DMA1_Stream5 -> M0AR = (uint32_t) &usart_buffer; // write to memory
DMA1_Stream5 -> NDTR = 256; // number of data items
DMA1_Stream5 -> CR |= DMA_SxCR_MINC; // memory increment
DMA1_Stream5 -> CR |= DMA_SxCR_CHSEL_2; // select chanel0
DMA1_Stream5 -> CR &= ~DMA_SxCR_MSIZE_0; // half-word (16bit) memory data size
DMA1_Stream5 -> CR &= ~DMA_SxCR_PSIZE_0; // half-word (16bit) peripherial data size
DMA1_Stream5 -> CR |= DMA_SxCR_TCIE; // transaction complete interrupt
DMA1_Stream5 -> CR |= DMA_SxCR_CIRC; // non enable continous mode
DMA1_Stream5 -> CR |= DMA_SxCR_EN; // enable Stream6
NVIC_EnableIRQ(DMA1_Stream5_IRQn); // enable IRQ
}
| 02-usart-gps-dma | stm32f4xx_periph.c | C | gpl3 | 3,345 |
struct gpsdata_t {
// time
uint8_t hour;
uint8_t min;
uint8_t sec;
uint16_t hsec;
// date
uint8_t day;
uint8_t month;
uint8_t year;
// position
uint8_t valid;
uint8_t rmc_valid;
int32_t lat;
int32_t lon;
uint16_t alt;
uint16_t heading;
uint16_t speed;
uint8_t sats;
uint16_t hdop;
};
extern struct gpsdata_t gpsdata;
void NMEA_Parse(char *buf, uint16_t len);
| 02-usart-gps-dma | nmea.h | C | gpl3 | 385 |
/* stm32f4xx_it.c */
#include "stm32f4xx.h"
#include "stm32f4xx_it.h"
#include "nmea.h"
#include "main.h"
#include <stdio.h>
#include <string.h>
void USART2_IRQHandler(void);
void TIM2_IRQHandler(void);
void DMA1_Stream5_IRQHandler(void);
extern void delay_ms(uint32_t ms);
uint16_t temp;
extern char usart_buffer[MAX_STRLEN];
static __IO uint32_t TimingDelay;
void SysTick_Handler(void)
{
//SysTick->CTRL = 0x07;
TimingDelay--;
//TimingDelay_Decrement();
}
void USART2_IRQHandler(void)
{
temp = USART2->SR;
temp = USART2->DR;
if ((USART2 -> SR & USART_SR_RXNE) == 0)
{
char t = USART2->DR; // the character from the USART1 data register is saved in t
}
}
void TIM2_IRQHandler(void)
{
if ( TIM2->SR & TIM_SR_UIF )
{
GPIOD->ODR |= GPIO_ODR_ODR_12;
delay_ms(50);
GPIOD->ODR &= ~GPIO_ODR_ODR_12;
Read_USART();
TIM2->SR &= ~TIM_SR_UIF;
}
}
void DMA1_Stream5_IRQHandler(void)
{
if (DMA1 -> HISR & DMA_HISR_HTIF5)
{
DMA1 -> HIFCR |= DMA_HIFCR_CHTIF5;
}
if (DMA1 -> HISR & DMA_HISR_TCIF5)
{
// clear DMA1 interrupt pending bit
DMA1 -> HIFCR |= DMA_HIFCR_CTCIF5 | DMA_HIFCR_CHTIF5;
}
NVIC->ICPR[0] |=(1<<7);
}
| 02-usart-gps-dma | stm32f4xx_it.c | C | gpl3 | 1,158 |
/* stm32f4xx_periph.c */
#include "stm32f4xx.h"
static unsigned int BaudRate;
static unsigned int BRR;
static uint32_t Timer_Frequency = 42000;
static uint32_t prescaler;
void USART1_INIT(void);
void USART2_INIT(void);
void TIM2_Init(void);
| 02-usart-gps-dma | stm32f4xx_periph.h | C | gpl3 | 243 |
/* stm32f4xx_it.h */
#include "stm32f4xx.h"
#define MAX_STRLEN 256
extern char received_string[MAX_STRLEN+1];
extern char received_buff[MAX_STRLEN+1];
void USART1_IRQHandler(void);
void USART2_IRQHandler(void);
| 02-usart-gps-dma | stm32f4xx_it.h | C | gpl3 | 214 |
#include "stm32f4xx.h"
void RCC_Init(void);
void RCC_Init(void)
{
RCC -> APB1ENR = RCC_APB1ENR_USART2EN | RCC_APB1ENR_TIM2EN;
RCC -> AHB1ENR |= RCC_AHB1ENR_GPIOAEN | RCC_AHB1ENR_GPIODEN; // Enable PORTD
}
| 02-usart-gps-dma | stm32f4xx_rcc.c | C | gpl3 | 214 |
/* main.h */
#include "stm32f4xx.h"
extern void USERT1_INIT(void);
void Read_USART(void);
//uint8_t string_ready;
| 02-usart-gps-dma | main.h | C | gpl3 | 116 |
/** Automatically generated file. DO NOT MODIFY */
package android.support.v7.appcompat;
public final class BuildConfig {
public final static boolean DEBUG = true;
} | 1000m | trunk/appcompat_v7/gen/android/support/v7/appcompat/BuildConfig.java | Java | epl | 170 |
/*
* Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android;
// Stub java file to make inclusion into some IDE's work.
public final class UnusedStub {
private UnusedStub() { }
}
| 1000m | trunk/google-play-services_lib/src/android/UnusedStub.java | Java | epl | 759 |
/** Automatically generated file. DO NOT MODIFY */
package com.google.android.gms;
public final class BuildConfig {
public final static boolean DEBUG = true;
} | 1000m | trunk/google-play-services_lib/gen/com/google/android/gms/BuildConfig.java | Java | epl | 164 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class KhuyenMaiDTO
{
private int _id;
public int Id
{
get { return _id; }
set { _id = value; }
}
private int _phantram;
public int Phantram
{
get { return _phantram; }
set { _phantram = value; }
}
private DateTime _batdau;
public DateTime Batdau
{
get { return _batdau; }
set { _batdau = value; }
}
private DateTime _ketthuc;
public DateTime Ketthuc
{
get { return _ketthuc; }
set { _ketthuc = value; }
}
}
}
| 1142008-1142076-1142085-ptexpress | trunk/PTExpress/DTO/KhuyenMaiDTO.cs | C# | asf20 | 807 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
namespace DTO
{
public class XeDTO
{
private int _id;
public int Id
{
get { return _id; }
set { _id = value; }
}
private string _tenXe;
public string TenXe
{
get { return _tenXe; }
set { _tenXe = value; }
}
private string _bienSo;
public string BienSo
{
get { return _bienSo; }
set { _bienSo = value; }
}
private int _loai;
public int Loai
{
get { return _loai; }
set { _loai = value; }
}
private string _hangSanXuat;
public string HangSanXuat
{
get { return _hangSanXuat; }
set { _hangSanXuat = value; }
}
private int _soGhe;
public int SoGhe
{
get { return _soGhe; }
set { _soGhe = value; }
}
private int _tinhTrang;
public int TinhTrang
{
get { return _tinhTrang; }
set { _tinhTrang = value; }
}
private bool _daXoa;
public bool DaXoa
{
get { return _daXoa; }
set { _daXoa = value; }
}
public static IEnumerable<SelectListItem> GetListTinhTrang()
{
List<SelectListItem> lsTinhTrang = new List<SelectListItem>();
SelectListItem item1 = new SelectListItem();
item1.Value = "1";
item1.Text = "Đang chạy";
lsTinhTrang.Add(item1);
SelectListItem item2 = new SelectListItem();
item2.Value = "2";
item2.Text = "Đang bảo trì";
lsTinhTrang.Add(item2);
IEnumerable<SelectListItem> IEnumerableTinhTrang = lsTinhTrang;
return IEnumerableTinhTrang;
}
public static IEnumerable<SelectListItem> GetListLoaiXe()
{
List<SelectListItem> lsLoaiGhe = new List<SelectListItem>();
SelectListItem item1 = new SelectListItem();
item1.Value = "1";
item1.Text = "Ghế ngồi";
lsLoaiGhe.Add(item1);
SelectListItem item2 = new SelectListItem();
item2.Value = "2";
item2.Text = "Giường nằm";
lsLoaiGhe.Add(item2);
SelectListItem item3 = new SelectListItem();
item3.Value = "3";
item3.Text = "Trung chuyển";
lsLoaiGhe.Add(item3);
IEnumerable<SelectListItem> IEnumerableTinhTrang = lsLoaiGhe;
return IEnumerableTinhTrang;
}
}
}
| 1142008-1142076-1142085-ptexpress | trunk/PTExpress/DTO/XeDTO.cs | C# | asf20 | 2,870 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class DatVeDTO
{
private int _id;
private string _hoTen;
public string HoTen
{
get { return _hoTen; }
set { _hoTen = value; }
}
private string _khachHang;
public string KhachHang
{
get { return _khachHang; }
set { _khachHang = value; }
}
private string _chuyen;
public string Chuyen
{
get { return _chuyen; }
set { _chuyen = value; }
}
public int Id
{
get { return _id; }
set { _id = value; }
}
private int _khachHangId;
public int KhachHangId
{
get { return _khachHangId; }
set { _khachHangId = value; }
}
private int _chuyenXeId;
public int ChuyenXeId
{
get { return _chuyenXeId; }
set { _chuyenXeId = value; }
}
private string _nhanVien;
public string NhanVien
{
get { return _nhanVien; }
set { _nhanVien = value; }
}
private int _nhanVienId;
public int NhanVienId
{
get { return _nhanVienId; }
set { _nhanVienId = value; }
}
private int _ghe;
public int Ghe
{
get { return _ghe; }
set { _ghe = value; }
}
private DateTime _ngayDatVe;
public DateTime NgayDatVe
{
get { return _ngayDatVe; }
set { _ngayDatVe = value; }
}
private bool _daThanhToan;
public bool DaThanhToan
{
get { return _daThanhToan; }
set { _daThanhToan = value; }
}
private DateTime _ngayThanhToan;
public DateTime NgayThanhToan
{
get { return _ngayThanhToan; }
set { _ngayThanhToan = value; }
}
private bool _huyDatVe;
public bool HuyDatVe
{
get { return _huyDatVe; }
set { _huyDatVe = value; }
}
private DateTime _ngayHuy;
public DateTime NgayHuy
{
get { return _ngayHuy; }
set { _ngayHuy = value; }
}
}
}
| 1142008-1142076-1142085-ptexpress | trunk/PTExpress/DTO/DatVeDTO.cs | C# | asf20 | 2,517 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class ChuyenXeDTO
{
private int _id;
public int Id
{
get { return _id; }
set { _id = value; }
}
private int _XeId;
public int XeId
{
get { return _XeId; }
set { _XeId = value; }
}
private string _tenXe;
public string TenXe
{
get { return _tenXe; }
set { _tenXe = value; }
}
private int _tuyenDuongId;
public int TuyenDuongId
{
get { return _tuyenDuongId; }
set { _tuyenDuongId = value; }
}
private string _tenTuyenDuong;
public string TenTuyenDuong
{
get { return _tenTuyenDuong; }
set { _tenTuyenDuong = value; }
}
private DateTime _xuatPhat;
public DateTime XuatPhat
{
get { return _xuatPhat; }
set { _xuatPhat = value; }
}
private DateTime _denNoi;
public DateTime DenNoi
{
get { return _denNoi; }
set { _denNoi = value; }
}
private int _soGheTrong;
public int SoGheTrong
{
get { return _soGheTrong; }
set { _soGheTrong = value; }
}
private double _giaVe;
public double GiaVe
{
get { return _giaVe; }
set { _giaVe = value; }
}
private DateTime _ngayLenLich;
public DateTime NgayLenLich
{
get { return _ngayLenLich; }
set { _ngayLenLich = value; }
}
}
}
| 1142008-1142076-1142085-ptexpress | trunk/PTExpress/DTO/ChuyenXeDTO.cs | C# | asf20 | 1,838 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
namespace DTO
{
public class NhanVienDTO
{
public static IEnumerable<SelectListItem> GetListLoai()
{
List<SelectListItem> lsLoai = new List<SelectListItem>();
SelectListItem item1 = new SelectListItem();
item1.Value = "1";
item1.Text = "Nhân viên bán vé";
lsLoai.Add(item1);
SelectListItem item2 = new SelectListItem();
item2.Value = "2";
item2.Text = "Nhân viên quản lý";
lsLoai.Add(item2);
SelectListItem item3 = new SelectListItem();
item3.Value = "3";
item3.Text = "Nhân viên tin học";
lsLoai.Add(item3);
IEnumerable<SelectListItem> IEnumerableLoai = lsLoai;
return IEnumerableLoai;
}
public enum LoaiNV
{
NhanVienBanVe = 1,
NhanVienQuanLy = 2,
NhanVienTinHoc = 3
}
public const string SSNHANVIEN = "NhanVien";
private int _id;
public int Id
{
get { return _id; }
set { _id = value; }
}
private string _tenDangNhap;
public string TenDangNhap
{
get { return _tenDangNhap; }
set { _tenDangNhap = value; }
}
private string _matKhau;
public string MatKhau
{
get { return _matKhau; }
set { _matKhau = value; }
}
private string _email;
public string Email
{
get { return _email; }
set { _email = value; }
}
private int _loai;
public int Loai
{
get { return _loai; }
set { _loai = value; }
}
}
}
| 1142008-1142076-1142085-ptexpress | trunk/PTExpress/DTO/NhanVienDTO.cs | C# | asf20 | 1,969 |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DTO")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DTO")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("b5c7001b-58da-4465-9429-1470bf692e0c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 1142008-1142076-1142085-ptexpress | trunk/PTExpress/DTO/Properties/AssemblyInfo.cs | C# | asf20 | 1,418 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class GheDTO
{
int _chuyenXeId;
public int ChuyenXeId
{
get { return _chuyenXeId; }
set { _chuyenXeId = value; }
}
int _khachHangId;
public int KhachHangId
{
get { return _khachHangId; }
set { _khachHangId = value; }
}
int _maSoGhe;
public int MaSoGhe
{
get { return _maSoGhe; }
set { _maSoGhe = value; }
}
}
}
| 1142008-1142076-1142085-ptexpress | trunk/PTExpress/DTO/GheDTO.cs | C# | asf20 | 639 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
namespace DTO
{
public class KhachHangDTO
{
private int _id;
private bool _laKHTT;
public bool LaKHTT
{
get { return _laKHTT; }
set { _laKHTT = value; }
}
public int Id
{
get { return _id; }
set { _id = value; }
}
private String _tendangnhap;
public String Tendangnhap
{
get { return _tendangnhap; }
set { _tendangnhap = value; }
}
private String _matkhau;
public String Matkhau
{
get { return _matkhau; }
set { _matkhau = value; }
}
private String _email;
public String Email
{
get { return _email; }
set { _email = value; }
}
private String _hoten;
public String Hoten
{
get { return _hoten; }
set { _hoten = value; }
}
private String _cmnd;
public String Cmnd
{
get { return _cmnd; }
set { _cmnd = value; }
}
private int _gioitinh;
public int Gioitinh
{
get { return _gioitinh; }
set { _gioitinh = value; }
}
private DateTime _ngaydangky;
public DateTime Ngaydangky
{
get { return _ngaydangky; }
set { _ngaydangky = value; }
}
private double _diemThuong;
public double DiemThuong
{
get { return _diemThuong; }
set { _diemThuong = value; }
}
private double _no;
public double No
{
get { return _no; }
set { _no = value; }
}
public static IEnumerable<SelectListItem> GetListGioiTinh()
{
List<SelectListItem> lsGioiTinh = new List<SelectListItem>();
SelectListItem item1 = new SelectListItem();
item1.Value = "0";
item1.Text = "Nữ";
lsGioiTinh.Add(item1);
SelectListItem item2 = new SelectListItem();
item2.Value = "1";
item2.Text = "Nam";
lsGioiTinh.Add(item2);
IEnumerable<SelectListItem> IEnumerableGioiTinh = lsGioiTinh;
return IEnumerableGioiTinh;
}
}
}
| 1142008-1142076-1142085-ptexpress | trunk/PTExpress/DTO/KhachHangDTO.cs | C# | asf20 | 2,593 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
namespace DTO
{
public class TuyenDuongDTO
{
private int _id;
public int Id
{
get { return _id; }
set { _id = value; }
}
private string _noiDen;
public string NoiDen
{
get { return _noiDen; }
set { _noiDen = value; }
}
private string _noiDi;
public string NoiDi
{
get { return _noiDi; }
set { _noiDi = value; }
}
private int _khoangCach;
public int KhoangCach
{
get { return _khoangCach; }
set { _khoangCach = value; }
}
private int _soLuongXe;
public int SoLuongXe
{
get { return _soLuongXe; }
set { _soLuongXe = value; }
}
private string _gioBatDauChay;
public string GioBatDauChay
{
get { return _gioBatDauChay; }
set { _gioBatDauChay = value; }
}
private string _gioNghi;
public string GioNghi
{
get { return _gioNghi; }
set { _gioNghi = value; }
}
private int _loai;
public int Loai
{
get { return _loai; }
set { _loai = value; }
}
public static IEnumerable<SelectListItem> GetListLoaiTuyenDuong()
{
List<SelectListItem> ls = new List<SelectListItem>();
SelectListItem item1 = new SelectListItem();
item1.Value = "1";
item1.Text = "Đường dài";
ls.Add(item1);
SelectListItem item2 = new SelectListItem();
item2.Value = "2";
item2.Text = "Trung chuyển";
ls.Add(item2);
IEnumerable<SelectListItem> IEnumerableTinhTrang = ls;
return IEnumerableTinhTrang;
}
}
}
| 1142008-1142076-1142085-ptexpress | trunk/PTExpress/DTO/TuyenDuongDTO.cs | C# | asf20 | 2,093 |
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ID="aboutTitle" ContentPlaceHolderID="TitleContent" runat="server">
Quản lý đặt vé
</asp:Content>
<asp:Content ID="aboutContent" ContentPlaceHolderID="MainContent" runat="server">
<h2>Quản lý đạt vé</h2>
<% using (Html.BeginForm()) { %>
<% Html.RenderPartial("QLDatVeButton"); %>
<div>
<fieldset>
<legend>Danh đặt vé</legend>
<table>
<tbody>
<tr>
<th><input type="checkbox" name="checkAll" /></th>
<th>Khách hàng</th>
<th>Chuyến xe</th>
<th>Nhân viên</th>
<th>Ghế</th>
<th>Ngày đặt</th>
<th>Đã thanh toán</th>
<th>Hủy đặt vé</th>
<th colspan="2" align="center">Lựa chọn</th>
</tr>
<%
foreach (DTO.DatVeDTO datVe in (List<DTO.DatVeDTO>)ViewData["dsDatVe"]) { %>
<tr>
<td><input type="checkbox" name="check[<% Response.Write(datVe.Id); %>]" /></td>
<td><% Response.Write(datVe.HoTen); %></td>
<td><% Response.Write(datVe.Chuyen); %></td>
<td><% Response.Write(datVe.NhanVien); %></td>
<td><% Response.Write(datVe.Ghe); %></td>
<td><% Response.Write(datVe.NgayDatVe); %></td>
<td><% if (datVe.DaThanhToan) { Response.Write(datVe.NgayThanhToan);} %></td>
<td><% if (datVe.HuyDatVe) { Response.Write(datVe.NgayHuy);} %></td>
<td align="center">
<% if (!datVe.DaThanhToan && !datVe.HuyDatVe)
{ %>
<%: Html.ActionLink("Hủy", "Huy", "QLDatVe", new { id = datVe.Id }, null)%></td>
<% } %>
<td align="center">
<% if (!datVe.DaThanhToan && !datVe.HuyDatVe) { %>
<%: Html.ActionLink("Thanh toán", "ThanhToan", "QLDatVe", new { id = datVe.Id }, null)%></td>
<% } %>
</tr>
<%
} %>
</tbody>
</table>
</fieldset>
</div>
<% } %>
</asp:Content> | 1142008-1142076-1142085-ptexpress | trunk/PTExpress/PTExpress/Views/QLDatVe/Index.aspx | ASP.NET | asf20 | 2,631 |
<%@ Page
Title=""
Language="C#"
MasterPageFile="~/Views/Shared/Site.Master"
Inherits="System.Web.Mvc.ViewPage<PTExpress.Models.DatVe>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Thanh toán
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%
IEnumerable<SelectListItem> lsEXe = (IEnumerable<SelectListItem>)ViewData["lsEXe"];
IEnumerable<SelectListItem> lsEChuyenXe = (IEnumerable<SelectListItem>)ViewData["lsEChuyenXe"];
IEnumerable<SelectListItem> lsETuyenDuong = (IEnumerable<SelectListItem>)ViewData["lsETuyenDuong"];
IEnumerable<SelectListItem> lsEKhachHang = (IEnumerable<SelectListItem>)ViewData["lsEKhachHang"];
%>
<h2>Hủy đặt vé</h2>
<% using (Html.BeginForm()) { %>
<%: Html.ValidationSummary(true, "Dữ liệu chưa được lưu trữ. Vui lòng sửa các lỗi bên dưới và nhấn Lưu.") %>
<div>
<fieldset>
<legend>Thông tin vé</legend>
<div class="editor-label">
<%: Html.LabelFor(m => m.KhachHang) %>
</div>
<div class="editor-field">
<%: Html.DropDownListFor(m => m.KhachHang, lsEKhachHang, new { DISABLED = "DISABLED" })%>
<%: Html.ValidationMessageFor(m => m.KhachHang)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.ChuyenXe) %>
</div>
<div class="editor-field">
<%: Html.DropDownListFor(m => m.ChuyenXe, lsEChuyenXe, new { DISABLED = "DISABLED" })%>
<%: Html.ValidationMessageFor(m => m.ChuyenXe)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.SoGhe) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.SoGhe, new { DISABLED = "DISABLED" })%>
<%: Html.ValidationMessageFor(m => m.SoGhe)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.GiaVe) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.GiaVe, new { DISABLED = "DISABLED" })%>
<%: Html.ValidationMessageFor(m => m.GiaVe)%>
</div>
<p>
<input type="submit" value="Xác nhận hủy đặt vé" />
</p>
</fieldset>
</div>
<% } %>
</asp:Content>
| 1142008-1142076-1142085-ptexpress | trunk/PTExpress/PTExpress/Views/QLDatVe/Huy.aspx | ASP.NET | asf20 | 2,785 |
<%@ Page
Title=""
Language="C#"
MasterPageFile="~/Views/Shared/Site.Master"
Inherits="System.Web.Mvc.ViewPage<PTExpress.Models.DatVe>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Thanh toán
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%
IEnumerable<SelectListItem> lsEXe = (IEnumerable<SelectListItem>)ViewData["lsEXe"];
IEnumerable<SelectListItem> lsEChuyenXe = (IEnumerable<SelectListItem>)ViewData["lsEChuyenXe"];
IEnumerable<SelectListItem> lsETuyenDuong = (IEnumerable<SelectListItem>)ViewData["lsETuyenDuong"];
IEnumerable<SelectListItem> lsEKhachHang = (IEnumerable<SelectListItem>)ViewData["lsEKhachHang"];
%>
<h2>Thanh toán</h2>
<% using (Html.BeginForm()) { %>
<%: Html.ValidationSummary(true, "Dữ liệu chưa được lưu trữ. Vui lòng sửa các lỗi bên dưới và nhấn Lưu.") %>
<div>
<fieldset>
<legend>Thông tin vé</legend>
<div class="editor-label">
<%: Html.LabelFor(m => m.KhachHang) %>
</div>
<div class="editor-field">
<%: Html.DropDownListFor(m => m.KhachHang, lsEKhachHang, new { DISABLED = "DISABLED" })%>
<%: Html.ValidationMessageFor(m => m.KhachHang)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.ChuyenXe) %>
</div>
<div class="editor-field">
<%: Html.DropDownListFor(m => m.ChuyenXe, lsEChuyenXe, new { DISABLED = "DISABLED" })%>
<%: Html.ValidationMessageFor(m => m.ChuyenXe)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.SoGhe) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.SoGhe, new { DISABLED = "DISABLED" })%>
<%: Html.ValidationMessageFor(m => m.SoGhe)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.GiaVe) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.GiaVe, new { DISABLED = "DISABLED" })%>
<%: Html.ValidationMessageFor(m => m.GiaVe)%>
</div>
<p>
<input type="submit" value="Ghi nhận đã thanh toán" />
</p>
</fieldset>
</div>
<% } %>
</asp:Content>
| 1142008-1142076-1142085-ptexpress | trunk/PTExpress/PTExpress/Views/QLDatVe/ThanhToan.aspx | ASP.NET | asf20 | 2,779 |
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ID="aboutTitle" ContentPlaceHolderID="TitleContent" runat="server">
Quản lý đặt vé
</asp:Content>
<asp:Content ID="aboutContent" ContentPlaceHolderID="MainContent" runat="server">
<h2>Thông báo</h2>
<p style="font-weight:bold;"><% Response.Write(ViewData["mess"]); %></p>
</asp:Content> | 1142008-1142076-1142085-ptexpress | trunk/PTExpress/PTExpress/Views/QLDatVe/Error.aspx | ASP.NET | asf20 | 439 |
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<PTExpress.Models.DatVe>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Đặt vé
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%
IEnumerable<SelectListItem> lsEXe = (IEnumerable<SelectListItem>)ViewData["lsEXe"];
IEnumerable<SelectListItem> lsEChuyenXe = (IEnumerable<SelectListItem>)ViewData["lsEChuyenXe"];
IEnumerable<SelectListItem> lsETuyenDuong = (IEnumerable<SelectListItem>)ViewData["lsETuyenDuong"];
IEnumerable<SelectListItem> lsEKhachHang = (IEnumerable<SelectListItem>)ViewData["lsEKhachHang"];
List<DTO.GheDTO> ls = (List<DTO.GheDTO>)ViewData["ds_ghe"];
%>
<h2>
Đặt vé</h2>
<% using (Html.BeginForm())
{ %>
<%: Html.ValidationSummary(true, "Dữ liệu chưa được lưu trữ. Vui lòng sửa các lỗi bên dưới và nhấn Lưu.") %>
<div>
<fieldset>
<legend>Thông tin vé</legend>
<div class="editor-label">
<%: Html.LabelFor(m => m.KhachHang) %>
</div>
<div class="editor-field">
<%: Html.DropDownListFor(m => m.KhachHang, lsEKhachHang)%>
<%: Html.ValidationMessageFor(m => m.KhachHang)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.ChuyenXe) %>
</div>
<div class="editor-field">
<%: Html.DropDownListFor(m => m.ChuyenXe, lsEChuyenXe, new { onchange = "ChuyenXeSelected(this)" })%>
<%: Html.ValidationMessageFor(m => m.ChuyenXe)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.SoGhe) %>
</div>
<div class="editor-field" id="chuyenxe">
<%: Html.ValidationMessageFor(m => m.SoGhe)%>
</div>
<p>
<input type="submit" value="Lưu" />
</p>
</fieldset>
</div>
<% } %>
<script>
var chuyenXeSelected = null;
function GenerationDIV(t) {
var chuyenxe = document.getElementById("chuyenxe");
var div = document.getElementById("chuyenXe_" + t.chuyenXe);
if (div == null ) {
div = document.createElement("div");
div.id = "chuyenXe_" + t.chuyenXe;
div.style.width = "240px";
div.style.display = "none";
chuyenxe.appendChild(div);
}
var ghe = document.createElement("div");
ghe.style.cssFloat = "left";
ghe.style.width = "60px";
ghe.innerHTML = "<label>  <input id='"+t.chuyenXe+"_"+ t.masSoghe +"' name='SoGhe' type='radio' value='"+ t.masSoghe+"' />" + t.masSoghe + "  </label>";
div.appendChild(ghe);
if (t.khachHang!=0) {
var r = document.getElementById(t.chuyenXe+"_"+ t.masSoghe);
r.disabled = "disabled";
}
}
function GenerationHTML(a) {
for(i=0; i<a.length;i++) {
GenerationDIV(a[i]);
}
var chuyenxe = document.getElementById("chuyenxe");
var clear = document.createElement("div");
clear.className = "clear";
chuyenxe.appendChild(clear);
}
function ChuyenXeSelected(ghe) {
if (chuyenXeSelected != null) {
chuyenXeSelected.style.display = "none";
$("#" + chuyenXeSelected.id + " input").attr('checked', false);
}
if (ghe.value) {
var n = document.getElementById("chuyenXe_"+ghe.value);
n.style.display = "block";
chuyenXeSelected = n;
} else {
chuyenXeSelected = null;
}
}
var viTriGhe = [
<% for (int i = 0; i < ls.Count; i++){ %>
{ chuyenXe: <%= ls[i].ChuyenXeId %> , masSoghe:<%= ls[i].MaSoGhe %>, khachHang: <%=ls[i].KhachHangId%>}
<% if ( i < ls.Count - 1) Response.Write(","); %>
<% } %>
];
GenerationHTML(viTriGhe);
</script>
</asp:Content>
| 1142008-1142076-1142085-ptexpress | trunk/PTExpress/PTExpress/Views/QLDatVe/DatVe.aspx | ASP.NET | asf20 | 4,481 |
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ID="aboutTitle" ContentPlaceHolderID="TitleContent" runat="server">
Quản lý tuyến đường
</asp:Content>
<asp:Content ID="aboutContent" ContentPlaceHolderID="MainContent" runat="server">
<h2>Quản lý tuyến đường</h2>
<% using (Html.BeginForm()) { %>
<% Html.RenderPartial("QLTuyenDuongButton"); %>
<div>
<fieldset>
<legend>Danh sách xe</legend>
<table>
<tbody>
<tr>
<th><input type="checkbox" name="checkAll" /></th>
<th>Nơi đi</th>
<th>Nới đến</th>
<th>Khoảng cách</th>
<th>Số lượng xe</th>
<th>Giờ chạy</th>
<th>Giờ nghỉ</th>
<th>Loại</th>
<th align="center">Lựa chọn</th>
</tr>
<%
Dictionary<int, string> loaiTuyenDuong = (Dictionary<int, string>) ViewData["LoaiTuyenDuong"];
foreach (DTO.TuyenDuongDTO tuyenDuong in (List<DTO.TuyenDuongDTO>)ViewData["dsTuyenDuong"])
{ %>
<tr>
<td><input type="checkbox" name="check[<% Response.Write(tuyenDuong.Id); %>]" /></td>
<td><% Response.Write(tuyenDuong.NoiDi); %></td>
<td><% Response.Write(tuyenDuong.NoiDen); %></td>
<td><% Response.Write(tuyenDuong.KhoangCach); %></td>
<td align="right"><% Response.Write(tuyenDuong.SoLuongXe); %></td>
<td><% Response.Write(tuyenDuong.GioBatDauChay); %></td>
<td><% Response.Write(tuyenDuong.GioNghi); %></td>
<td><% Response.Write(loaiTuyenDuong[tuyenDuong.Loai]); %></td>
<td align="center"> <%: Html.ActionLink("Sửa", "Sua", "QLTuyenDuong", new { id = tuyenDuong.Id }, null)%></td>
</tr>
<%
} %>
</tbody>
</table>
</fieldset>
</div>
<% } %>
</asp:Content> | 1142008-1142076-1142085-ptexpress | trunk/PTExpress/PTExpress/Views/QLTuyenDuong/Index.aspx | ASP.NET | asf20 | 2,370 |
<%@ Page
Title=""
Language="C#"
MasterPageFile="~/Views/Shared/Site.Master"
Inherits="System.Web.Mvc.ViewPage<PTExpress.Models.TuyenDuong>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Thêm tuyến đường
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%
IEnumerable<SelectListItem> lsEXe = (IEnumerable<SelectListItem>)ViewData["lsEXe"];
IEnumerable<SelectListItem> lsEChuyenXe = (IEnumerable<SelectListItem>)ViewData["lsEChuyenXe"];
IEnumerable<SelectListItem> lsETuyenDuong = (IEnumerable<SelectListItem>)ViewData["lsETuyenDuong"];
IEnumerable<SelectListItem> lsEKhachHang = (IEnumerable<SelectListItem>)ViewData["lsEKhachHang"];
IEnumerable<SelectListItem> lsELoaiTuyenDuong = (List<SelectListItem>)ViewData["lsELoaiTuyenDuong"];
%>
<h2>Thêm tuyến đường</h2>
<% using (Html.BeginForm()) { %>
<%: Html.ValidationSummary(true, "Dữ liệu chưa được lưu trữ. Vui lòng sửa các lỗi bên dưới và nhấn Lưu.") %>
<div>
<fieldset>
<legend>Thông tuyến đường</legend>
<div class="editor-label">
<%: Html.LabelFor(m => m.NoiDen) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.NoiDen)%>
<%: Html.ValidationMessageFor(m => m.NoiDen)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.NoiDi) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.NoiDi)%>
<%: Html.ValidationMessageFor(m => m.NoiDi)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.KhoangCach) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.KhoangCach)%>
<%: Html.ValidationMessageFor(m => m.KhoangCach)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.GioChay) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.GioChay)%>
<%: Html.ValidationMessageFor(m => m.GioChay)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.GioNghi) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.GioNghi)%>
<%: Html.ValidationMessageFor(m => m.GioNghi)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.LoaiTuyenDuong) %>
</div>
<div class="editor-field">
<%: Html.DropDownListFor(m => m.LoaiTuyenDuong, lsELoaiTuyenDuong)%>
<%: Html.ValidationMessageFor(m => m.LoaiTuyenDuong)%>
</div>
<p>
<input type="submit" value="Lưu" />
</p>
</fieldset>
</div>
<% } %>
</asp:Content>
| 1142008-1142076-1142085-ptexpress | trunk/PTExpress/PTExpress/Views/QLTuyenDuong/Them.aspx | ASP.NET | asf20 | 3,386 |
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<PTExpress.Models.TuyenDuong>" %>
<asp:Content ID="registerTitle" ContentPlaceHolderID="TitleContent" runat="server">
Cập nhật thông tin tuyến đường: <% Response.Write(ViewData["TenTuyenDuong"].ToString()); %>
</asp:Content>
<asp:Content ID="registerContent" ContentPlaceHolderID="MainContent" runat="server">
<%
IEnumerable<SelectListItem> lsELoaiTuyenDuong = (List<SelectListItem>)ViewData["lsELoaiTuyenDuong"];
%>
<h2>Cập nhật thông tin xe: <% Response.Write(ViewData["TenTuyenDuong"].ToString()); %></h2>
<% using (Html.BeginForm()) { %>
<%: Html.ValidationSummary(true, "Dữ liệu chưa được lưu trữ. Vui lòng sửa các lỗi bên dưới và nhấn Lưu.") %>
<% if (this.Request.HttpMethod == "POST" && (bool)ViewData["ModelState"]) { %>
<% if ((bool)ViewData["ThanhCong"])
{ %>
<span id="mess" class="success">Dữ liệu đã được lưu trữ thành công.</span>
<% }
else
{ %>
<span id="Span1"class="error">Dữ liệu chưa được lưu trữ, đã có lỗi trong quá trình truy cập cơ sở dữ liệu.</span>
<% } %>
<% } %>
<div>
<fieldset>
<legend>Thông tin tuyến đường</legend>
<div class="editor-label">
<%: Html.LabelFor(m => m.Id) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.Id, new { READONLY = "READONLY" })%>
<%: Html.ValidationMessageFor(m => m.Id) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.NoiDen) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.NoiDen)%>
<%: Html.ValidationMessageFor(m => m.NoiDen)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.NoiDi) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.NoiDi)%>
<%: Html.ValidationMessageFor(m => m.NoiDi)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.KhoangCach) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.KhoangCach)%>
<%: Html.ValidationMessageFor(m => m.KhoangCach)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.SoLuongXe) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.SoLuongXe, new { READONLY = "READONLY" })%>
<%: Html.ValidationMessageFor(m => m.SoLuongXe)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.GioChay) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.GioChay)%>
<%: Html.ValidationMessageFor(m => m.GioChay)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.GioNghi) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.GioNghi)%>
<%: Html.ValidationMessageFor(m => m.GioNghi)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.LoaiTuyenDuong) %>
</div>
<div class="editor-field">
<%: Html.DropDownListFor(m => m.LoaiTuyenDuong, lsELoaiTuyenDuong)%>
<%: Html.ValidationMessageFor(m => m.LoaiTuyenDuong)%>
</div>
<p>
<input type="submit" value="Lưu" />
</p>
</fieldset>
</div>
<% } %>
</asp:Content>
| 1142008-1142076-1142085-ptexpress | trunk/PTExpress/PTExpress/Views/QLTuyenDuong/Sua.aspx | ASP.NET | asf20 | 4,349 |
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<PTExpress.Models.ChangePasswordModel>" %>
<asp:Content ID="changePasswordTitle" ContentPlaceHolderID="TitleContent" runat="server">
Change Password
</asp:Content>
<asp:Content ID="changePasswordContent" ContentPlaceHolderID="MainContent" runat="server">
<h2>Change Password</h2>
<p>
Use the form below to change your password.
</p>
<p>
New passwords are required to be a minimum of <%: ViewData["PasswordLength"] %> characters in length.
</p>
<% using (Html.BeginForm()) { %>
<%: Html.ValidationSummary(true, "Password change was unsuccessful. Please correct the errors and try again.") %>
<div>
<fieldset>
<legend>Account Information</legend>
<div class="editor-label">
<%: Html.LabelFor(m => m.OldPassword) %>
</div>
<div class="editor-field">
<%: Html.PasswordFor(m => m.OldPassword) %>
<%: Html.ValidationMessageFor(m => m.OldPassword) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.NewPassword) %>
</div>
<div class="editor-field">
<%: Html.PasswordFor(m => m.NewPassword) %>
<%: Html.ValidationMessageFor(m => m.NewPassword) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.ConfirmPassword) %>
</div>
<div class="editor-field">
<%: Html.PasswordFor(m => m.ConfirmPassword) %>
<%: Html.ValidationMessageFor(m => m.ConfirmPassword) %>
</div>
<p>
<input type="submit" value="Change Password" />
</p>
</fieldset>
</div>
<% } %>
</asp:Content>
| 1142008-1142076-1142085-ptexpress | trunk/PTExpress/PTExpress/Views/Account/ChangePassword.aspx | ASP.NET | asf20 | 2,137 |
<%@Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ID="changePasswordTitle" ContentPlaceHolderID="TitleContent" runat="server">
Change Password
</asp:Content>
<asp:Content ID="changePasswordSuccessContent" ContentPlaceHolderID="MainContent" runat="server">
<h2>Change Password</h2>
<p>
Your password has been changed successfully.
</p>
</asp:Content>
| 1142008-1142076-1142085-ptexpress | trunk/PTExpress/PTExpress/Views/Account/ChangePasswordSuccess.aspx | ASP.NET | asf20 | 453 |
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<PTExpress.Models.RegisterModel>" %>
<asp:Content ID="registerTitle" ContentPlaceHolderID="TitleContent" runat="server">
Register
</asp:Content>
<asp:Content ID="registerContent" ContentPlaceHolderID="MainContent" runat="server">
<h2>Create a New Account</h2>
<p>
Use the form below to create a new account.
</p>
<p>
Passwords are required to be a minimum of <%: ViewData["PasswordLength"] %> characters in length.
</p>
<% using (Html.BeginForm()) { %>
<%: Html.ValidationSummary(true, "Account creation was unsuccessful. Please correct the errors and try again.") %>
<div>
<fieldset>
<legend>Account Information</legend>
<div class="editor-label">
<%: Html.LabelFor(m => m.UserName) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.UserName) %>
<%: Html.ValidationMessageFor(m => m.UserName) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.Email) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.Email) %>
<%: Html.ValidationMessageFor(m => m.Email) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.Password) %>
</div>
<div class="editor-field">
<%: Html.PasswordFor(m => m.Password) %>
<%: Html.ValidationMessageFor(m => m.Password) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.ConfirmPassword) %>
</div>
<div class="editor-field">
<%: Html.PasswordFor(m => m.ConfirmPassword) %>
<%: Html.ValidationMessageFor(m => m.ConfirmPassword) %>
</div>
<p>
<input type="submit" value="Register" />
</p>
</fieldset>
</div>
<% } %>
</asp:Content>
| 1142008-1142076-1142085-ptexpress | trunk/PTExpress/PTExpress/Views/Account/Register.aspx | ASP.NET | asf20 | 2,424 |
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<PTExpress.Models.Login>" %>
<asp:Content ID="loginTitle" ContentPlaceHolderID="TitleContent" runat="server">
Đăng nhập
</asp:Content>
<asp:Content ID="loginContent" ContentPlaceHolderID="MainContent" runat="server">
<h2>Đăng nhập</h2>
<p>
Please enter your username and password.
</p>
<% using (Html.BeginForm()) { %>
<%: Html.ValidationSummary(true, "Đăng nhập không thành công.") %>
<div>
<fieldset>
<legend>Thông tin đăng nhập</legend>
<div class="editor-label">
<%: Html.LabelFor(m => m.UserName) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.UserName) %>
<%: Html.ValidationMessageFor(m => m.UserName) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.Password) %>
</div>
<div class="editor-field">
<%: Html.PasswordFor(m => m.Password) %>
<%: Html.ValidationMessageFor(m => m.Password) %>
</div>
<p>
<input type="submit" value="Đăng nhập" />
</p>
</fieldset>
</div>
<% } %>
</asp:Content>
| 1142008-1142076-1142085-ptexpress | trunk/PTExpress/PTExpress/Views/Login/Index.aspx | ASP.NET | asf20 | 1,394 |
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<asp:Content ID="aboutTitle" ContentPlaceHolderID="TitleContent" runat="server">
Quản lý nhân viên
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Quản lý nhân viên</h2>
<% using (Html.BeginForm())
{
Html.RenderPartial("QLNhanVienButton"); %>
<div>
<fieldset>
<legend>Danh sách nhân viên</legend>
<table>
<tbody>
<tr>
<th><input type="checkbox" name="checkAll" /></th>
<th>ID</th>
<th>Tên đăng nhập</th>
<th>Email</th>
<th>Loại</th>
<th colspan="2" align="center">Lựa chọn</th>
</tr>
<%
Dictionary<int, string> Loai = (Dictionary<int, string>)ViewData["Loai"];
foreach (DTO.NhanVienDTO nhanvien in (List<DTO.NhanVienDTO>)ViewData["dsNhanVien"])
{ %>
<tr>
<td><input type="checkbox" name="check[<% Response.Write(nhanvien.Id); %>]" /></td>
<td><% Response.Write(nhanvien.Id); %></td>
<td><% Response.Write(nhanvien.TenDangNhap); %></td>
<td><% Response.Write(nhanvien.Email); %></td>
<td><% Response.Write(Loai[nhanvien.Loai]); %></td>
<td align="center"> <%: Html.ActionLink("Sửa", "Sua", "QLNhanVien", new { id = nhanvien.Id }, null)%></td>
</tr>
<%
} %>
</tbody>
</table>
</fieldset>
</div>
<% } %>
</asp:Content>
| 1142008-1142076-1142085-ptexpress | trunk/PTExpress/PTExpress/Views/QLNhanVien/Index.aspx | ASP.NET | asf20 | 1,939 |
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<PTExpress.Models.NhanVien>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Thêm nhân viên
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<% IEnumerable<SelectListItem> lsELoai = (List<SelectListItem>)ViewData["lsELoai"]; %>
<h2>Thêm nhân viên</h2>
<% using (Html.BeginForm()) { %>
<%: Html.ValidationSummary(true, "Dữ liệu chưa được lưu trữ. Vui lòng sửa các lỗi bên dưới và nhấn Lưu.") %>
<% if (this.Request.HttpMethod == "POST" && (bool)ViewData["ModelState"])
{
if( (bool)ViewData["ThanhCong"])
{ %>
<span id="mess" class="success">Dữ liệu đã được lưu trữ thành công.</span>
<% } else{ %>
<span id="mess"class="error">Dữ liệu chưa được lưu trữ, đã có lỗi trong quá trình truy cập cơ sở dữ liệu.</span>
<% } %>
<% } %>
<div>
<fieldset>
<legend>Thông tin nhân viên</legend>
<div class="editor-label">
<%: Html.LabelFor(m => m.Tendangnhap) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.Tendangnhap)%>
<%: Html.ValidationMessageFor(m => m.Tendangnhap)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.Matkhau) %>
</div>
<div class="editor-field">
<%: Html.PasswordFor(m => m.Matkhau) %>
<%: Html.ValidationMessageFor(m => m.Matkhau) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.Email) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.Email)%>
<%: Html.ValidationMessageFor(m => m.Email)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.Loai) %>
</div>
<div class="editor-field">
<%: Html.DropDownListFor(m => m.Loai, lsELoai)%>
<%: Html.ValidationMessageFor(m => m.Loai)%>
</div>
<p>
<input type="submit" value="Lưu" />
</p>
</fieldset>
</div>
<% } %>
</asp:Content>
| 1142008-1142076-1142085-ptexpress | trunk/PTExpress/PTExpress/Views/QLNhanVien/Them.aspx | ASP.NET | asf20 | 2,780 |
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<PTExpress.Models.NhanVien>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Cập nhật thông tin nhân viên: <% Response.Write(ViewData["TenDangNhap"].ToString()); %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Cập nhật thông tin nhân viên: <% Response.Write(ViewData["TenDangNhap"].ToString()); %></h2>
<% IEnumerable<SelectListItem> lsELoai = (List<SelectListItem>)ViewData["lsELoai"]; %>
<h2>Thêm nhân viên</h2>
<% using (Html.BeginForm()) { %>
<%: Html.ValidationSummary(true, "Dữ liệu chưa được lưu trữ. Vui lòng sửa các lỗi bên dưới và nhấn Lưu.") %>
<% if (this.Request.HttpMethod == "POST" && (bool)ViewData["ModelState"])
{
if( (bool)ViewData["ThanhCong"])
{ %>
<span id="mess" class="success">Dữ liệu đã được lưu trữ thành công.</span>
<% } else{ %>
<span id="mess"class="error">Dữ liệu chưa được lưu trữ, đã có lỗi trong quá trình truy cập cơ sở dữ liệu.</span>
<% } %>
<% } %>
<div>
<fieldset>
<legend>Thông tin nhân viên</legend>
<div class="editor-label">
<%: Html.LabelFor(m => m.Tendangnhap) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.Tendangnhap)%>
<%: Html.ValidationMessageFor(m => m.Tendangnhap)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.Matkhau) %>
</div>
<div class="editor-field">
<%: Html.PasswordFor(m => m.Matkhau) %>
<%: Html.ValidationMessageFor(m => m.Matkhau) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.Email) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.Email)%>
<%: Html.ValidationMessageFor(m => m.Email)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.Loai) %>
</div>
<div class="editor-field">
<%: Html.DropDownListFor(m => m.Loai, lsELoai)%>
<%: Html.ValidationMessageFor(m => m.Loai)%>
</div>
<p>
<input type="submit" value="Lưu" />
</p>
</fieldset>
</div>
<% } %>
</asp:Content>
| 1142008-1142076-1142085-ptexpress | trunk/PTExpress/PTExpress/Views/QLNhanVien/Sua.aspx | ASP.NET | asf20 | 2,972 |
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<asp:Content ID="aboutTitle" ContentPlaceHolderID="TitleContent" runat="server">
Quản lý khuyến mãi
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Quản lý khuyến mãi</h2>
<% using (Html.BeginForm())
{
Html.RenderPartial("QLKhuyenMaiButton"); %>
<div>
<fieldset>
<legend>Danh sách khuyến mãi</legend>
<table>
<tbody>
<tr>
<th><input type="checkbox" name="checkAll" /></th>
<th>Chuyến xe ID</th>
<th>Phần trăm</th>
<th>Ngày bắt đầu</th>
<th>Ngày kết thúc</th>
<th colspan="2" align="center">Lựa chọn</th>
</tr>
<%
Dictionary<int, string> LoaiXe = (Dictionary<int, string>)ViewData["LoaiXe"];
Dictionary<int, string> TinhTrangXe = (Dictionary<int, string>)ViewData["TinhTrangXe"];
foreach (DTO.KhuyenMaiDTO khuyenmai in (List<DTO.KhuyenMaiDTO>)ViewData["dsKhuyenmai"])
{ %>
<tr>
<td><input type="checkbox" name="check[<% Response.Write(khuyenmai.Id); %>]" /></td>
<td><% Response.Write(khuyenmai.Id); %></td>
<td><% Response.Write(khuyenmai.Phantram); %></td>
<td><% Response.Write(khuyenmai.Batdau); %></td>
<td><% Response.Write(khuyenmai.Ketthuc); %></td>
<td align="center"> <%: Html.ActionLink("Sửa", "Sua", "QLKhuyenMai", new { id = khuyenmai.Id }, null)%></td>
</tr>
<%
} %>
</tbody>
</table>
</fieldset>
</div>
<% } %>
</asp:Content>
| 1142008-1142076-1142085-ptexpress | trunk/PTExpress/PTExpress/Views/QLKhuyenMai/Index.aspx | ASP.NET | asf20 | 2,086 |
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<PTExpress.Models.KhuyenMai>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Thêm khuyến mãi
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Thêm khuyến mãi</h2>
<% using (Html.BeginForm()) { %>
<%: Html.ValidationSummary(true, "Dữ liệu chưa được lưu trữ. Vui lòng sửa các lỗi bên dưới và nhấn Lưu.") %>
<% if (this.Request.HttpMethod == "POST" && (bool)ViewData["ModelState"])
{
if( (bool)ViewData["ThanhCong"])
{ %>
<span id="mess" class="success">Dữ liệu đã được lưu trữ thành công.</span>
<% } else{ %>
<span id="mess"class="error">Dữ liệu chưa được lưu trữ, đã có lỗi trong quá trình truy cập cơ sở dữ liệu.</span>
<% } %>
<% } %>
<div>
<fieldset>
<legend>Thông tin xe</legend>
<div class="editor-label">
<%: Html.LabelFor(m => m.Id) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.Id)%>
<%: Html.ValidationMessageFor(m => m.Id) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.Phantram) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.Phantram)%>
<%: Html.ValidationMessageFor(m => m.Phantram)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.Batdau) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.Batdau) %>
<%: Html.ValidationMessageFor(m => m.Batdau) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.Ketthuc) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.Ketthuc)%>
<%: Html.ValidationMessageFor(m => m.Ketthuc)%>
</div>
<p>
<input type="submit" value="Lưu" />
</p>
</fieldset>
</div>
<% } %>
</asp:Content>
| 1142008-1142076-1142085-ptexpress | trunk/PTExpress/PTExpress/Views/QLKhuyenMai/Them.aspx | ASP.NET | asf20 | 2,630 |
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<PTExpress.Models.KhuyenMai>" %>
<asp:Content ID="registerTitle" ContentPlaceHolderID="TitleContent" runat="server">
Cập nhật chi tiết khuyến mãi: <% Response.Write(ViewData["Id"].ToString()); %>
</asp:Content>
<asp:Content ID="registerContent" ContentPlaceHolderID="MainContent" runat="server">
<h2>Cập nhật chi tiết khuyến mãi: <% Response.Write(ViewData["Id"].ToString()); %></h2>
<% using (Html.BeginForm()) { %>
<%: Html.ValidationSummary(true, "Dữ liệu chưa được lưu trữ. Vui lòng sửa các lỗi bên dưới và nhấn Lưu.") %>
<% if (this.Request.HttpMethod == "POST" && (bool)ViewData["ModelState"])
{
if( (bool)ViewData["ThanhCong"])
{ %>
<span id="mess" class="success">Dữ liệu đã được lưu trữ thành công.</span>
<% } else{ %>
<span id="mess"class="error">Dữ liệu chưa được lưu trữ, đã có lỗi trong quá trình truy cập cơ sở dữ liệu.</span>
<% } %>
<% } %>
<div>
<fieldset>
<legend>Thông tin xe</legend>
<div class="editor-label">
<%: Html.LabelFor(m => m.Id) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.Id, new { READONLY = "READONLY" })%>
<%: Html.ValidationMessageFor(m => m.Id) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.Phantram) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.Phantram)%>
<%: Html.ValidationMessageFor(m => m.Phantram)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.Batdau) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.Batdau) %>
<%: Html.ValidationMessageFor(m => m.Batdau) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.Ketthuc) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.Ketthuc)%>
<%: Html.ValidationMessageFor(m => m.Ketthuc)%>
</div>
<p>
<input type="submit" value="Lưu" />
</p>
</fieldset>
</div>
<% } %>
</asp:Content>
| 1142008-1142076-1142085-ptexpress | trunk/PTExpress/PTExpress/Views/QLKhuyenMai/Sua.aspx | ASP.NET | asf20 | 2,843 |
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ID="aboutTitle" ContentPlaceHolderID="TitleContent" runat="server">
Quản lý chuyến xe
</asp:Content>
<asp:Content ID="aboutContent" ContentPlaceHolderID="MainContent" runat="server">
<h2>Quản lý chuyến xe</h2>
<% using (Html.BeginForm()) { %>
<% Html.RenderPartial("QLChuyenXeButton"); %>
<div>
<fieldset>
<legend>Danh sách chuyến xe</legend>
<table>
<tbody>
<tr>
<th><input type="checkbox" name="checkAll" /></th>
<th>ID</th>
<th>Xe</th>
<th>Tuyến đường</th>
<th>Xuất phát</th>
<th>Đến nơi lúc</th>
<th>Số ghế trống</th>
<th>Giá vé</th>
<th>Ngày lên lịch</th>
<th align="center">Lựa chọn</th>
</tr>
<%
foreach (DTO.ChuyenXeDTO chuyenXe in (List<DTO.ChuyenXeDTO>)ViewData["dsChuyenXe"])
{ %>
<tr>
<td><input type="checkbox" name="check[<% Response.Write(chuyenXe.Id); %>]" /></td>
<td><% Response.Write(chuyenXe.Id); %></td>
<td><% Response.Write(chuyenXe.TenXe); %></td>
<td><% Response.Write(chuyenXe.TenTuyenDuong); %></td>
<td><% Response.Write(chuyenXe.XuatPhat); %></td>
<td align="right"><% Response.Write(chuyenXe.DenNoi); %></td>
<td><% Response.Write(chuyenXe.SoGheTrong); %></td>
<td><% Response.Write(chuyenXe.GiaVe); %></td>
<td><% Response.Write(chuyenXe.NgayLenLich); %></td>
<td align="center"><%: Html.ActionLink("Sửa", "Sua", "QLChuyenXe", new { id = chuyenXe.Id }, null)%></td>
</tr>
<%
} %>
</tbody>
</table>
</fieldset>
</div>
<% } %>
</asp:Content> | 1142008-1142076-1142085-ptexpress | trunk/PTExpress/PTExpress/Views/QLChuyenXe/Index.aspx | ASP.NET | asf20 | 2,333 |
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<PTExpress.Models.ChuyenXe>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Thêm mới chuyến xe
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%
IEnumerable<SelectListItem> lsEXe = (IEnumerable<SelectListItem>)ViewData["lsEXe"];
IEnumerable<SelectListItem> lsETuyenDuong = (IEnumerable<SelectListItem>)ViewData["lsETuyenDuong"];
%>
<h2>Thêm mới chuyến xe</h2>
<% using (Html.BeginForm()) { %>
<%: Html.ValidationSummary(true, "Dữ liệu chưa được lưu trữ. Vui lòng sửa các lỗi bên dưới và nhấn Lưu.") %>
<% if (this.Request.HttpMethod == "POST" && (bool)ViewData["IsValid"])
{ %>
<span class="error"><%
if (!((bool)ViewData["ThanhCong"]))
{
Response.Write("Lỗi khi thêm chuyến xe.");
}
%></span>
<% } %>
<div>
<fieldset>
<legend>Thông tin chuyến xe</legend>
<div class="editor-label">
<%: Html.LabelFor(m => m.Xe) %>
</div>
<div class="editor-field">
<%: Html.DropDownListFor(m => m.Xe, lsEXe)%>
<%: Html.ValidationMessageFor(m => m.Xe)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.TuyenDuong) %>
</div>
<div class="editor-field">
<%: Html.DropDownListFor(m => m.TuyenDuong, lsETuyenDuong) %>
<%: Html.ValidationMessageFor(m => m.TuyenDuong)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.XuatPhat) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.XuatPhat)%>
<%: Html.ValidationMessageFor(m => m.XuatPhat)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.DenNoi) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.DenNoi)%>
<%: Html.ValidationMessageFor(m => m.DenNoi)%>
</div>
<div class="editor-label">
<%: Html.LabelFor(m => m.giaVe) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(m => m.giaVe)%>
<%: Html.ValidationMessageFor(m => m.giaVe)%>
</div>
<p>
<input type="submit" value="Lưu" />
</p>
</fieldset>
</div>
<% } %>
</asp:Content>
| 1142008-1142076-1142085-ptexpress | trunk/PTExpress/PTExpress/Views/QLChuyenXe/Them.aspx | ASP.NET | asf20 | 3,129 |