Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/wzxjohn/moeSS
Browse files Browse the repository at this point in the history
Conflicts:
	application/controllers/Admin.php
	application/controllers/User.php
	application/models/Admin_model.php
  • Loading branch information
wzxjohn committed Feb 4, 2015
2 parents f8378d9 + 753ccb7 commit cb69ab1
Show file tree
Hide file tree
Showing 28 changed files with 1,139 additions and 91 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ Currently support php mail(), sendmail, SMTP and SendGrid Web API. (Send test E-
- Because I don't use any encrypt function when post the data, you are suggesting to secure your site by using SSL certs.
- Many notices and sentences are **written directly in the view files**, so you need to **edit the file** to change them. They may moved to database in the future.

# Config Guide
Please read [Wiki](https://github.com/wzxjohn/moeSS/wiki) to learn how to config your Nginx or Apache.

# Upgrade
If database structure has been changed after update, I will upload a sql file in update folder. Just use that sql file to update database structures.

Expand Down
144 changes: 136 additions & 8 deletions application/controllers/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ function sidebar()
$sidebar_data['log_u_active'] = (bool) FALSE;
$sidebar_data['log_m_active'] = (bool) FALSE;
$sidebar_data['log_a_active'] = (bool) FALSE;
$sidebar_data['log_p_active'] = (bool) FALSE;
$sidebar_data['log_o_active'] = (bool) FALSE;
$sidebar_data['goods_active'] = (bool) FALSE;
return $sidebar_data;
}

Expand Down Expand Up @@ -456,6 +459,18 @@ function user_update($uid = NULL)
$user_name = $this->input->post('user_name');
$email = $this->input->post('email');
$pass = $this->input->post('pass');
if ($mode == "update" && ($pass == "" || $pass == NULL))
{
$pass = "!MOESS_NO_CHANGE!";
}
elseif ($mode == "insert" && ($pass == "" || $pass == NULL))
{
echo "<script>alert(\"密碼不能為空!\");</script>";
}
else
{
$pass = md5($pass);
}
$passwd = $this->input->post('passwd');
$u = $this->input->post('u');
$d = $this->input->post('d');
Expand Down Expand Up @@ -842,25 +857,25 @@ function email_tpl_update($part = NULL)
{
$data = array(
array (
'option_name' => 'reset_subject',
'option_value' => htmlspecialchars_decode($this->input->post('reset_subject'))
'option_name' => 'reset_mail_subject',
'option_value' => htmlspecialchars_decode($this->input->post('reset_mail_subject'))
),
array (
'option_name' => 'reset_body',
'option_value' => htmlspecialchars_decode($this->input->post('reset_body'))
'option_name' => 'reset_mail_body',
'option_value' => htmlspecialchars_decode($this->input->post('reset_mail_body'))
)
);
}
elseif ($part == 'resend')
{
$data = array(
array (
'option_name' => 'resend_subject',
'option_value' => htmlspecialchars_decode($this->input->post('resend_subject'))
'option_name' => 'resend_mail_subject',
'option_value' => htmlspecialchars_decode($this->input->post('resend_mail_subject'))
),
array (
'option_name' => 'resend_body',
'option_value' => htmlspecialchars_decode($this->input->post('resend_body'))
'option_name' => 'resend_mail_body',
'option_value' => htmlspecialchars_decode($this->input->post('resend_mail_body'))
)
);
}
Expand Down Expand Up @@ -1108,4 +1123,117 @@ function admin_log()
}
return;
}

function pay_log()
{
if ($this->is_login())
{
//$this->load->view('welcome_message');
$this->load->helper('comm');
$data['user_name'] = $this->session->userdata('s_admin_username');
$data['gravatar'] = get_gravatar($this->session->userdata('s_admin_email'));
$this->load->view( 'admin/admin_header' );
$this->load->view( 'admin/admin_nav', $data );

$data = $this->sidebar();
$data['log_active'] = (bool) TRUE;
$data['log_p_active'] = (bool) TRUE;
$this->load->view( 'admin/admin_sidebar', $data );

$data['mode'] = "admin";
$data['logs'] = $this->admin_model->get_log('pay');
$this->load->view( 'admin/admin_log_pay', $data );
$this->load->view( 'admin/admin_footer' );

}
else
{
redirect(site_url('admin/login'));
}
return;
}

function order_log()
{
if ($this->is_login())
{
//$this->load->view('welcome_message');
$this->load->helper('comm');
$data['user_name'] = $this->session->userdata('s_admin_username');
$data['gravatar'] = get_gravatar($this->session->userdata('s_admin_email'));
$this->load->view( 'admin/admin_header' );
$this->load->view( 'admin/admin_nav', $data );

$data = $this->sidebar();
$data['log_active'] = (bool) TRUE;
$data['log_o_active'] = (bool) TRUE;
$this->load->view( 'admin/admin_sidebar', $data );

$data['mode'] = "admin";
$data['logs'] = $this->admin_model->get_log('order');
$this->load->view( 'admin/admin_log_order', $data );
$this->load->view( 'admin/admin_footer' );

}
else
{
redirect(site_url('admin/login'));
}
return;
}

function add_traffic($uid)
{
if ($this->is_login())
{
$user = $this->admin_model->get_users($uid)[0];
$data['user'] = $user;
$this->load->view('admin/admin_add_traffic', $data);
}
else
{
redirect(site_url('admin/login'));
}
return;
}

function do_add_traffic($uid)
{
if ($this->is_login())
{
$user_name = $this->input->post('user_name');
$traffic = (int) $this->input->post('traffic');
if ($traffic == 0)
{
echo "<script>alert('Success!'); window.location.href=\"".site_url('admin/users')."\";</script>";
return;
}
$traffic = (int) $traffic * 1024 * 1024;
$user = $this->admin_model->get_users($uid)[0];
if ($user->user_name == $user_name)
{
$new_traffic = $user->transfer_enable + $traffic;
if ($this->admin_model->set_traffic($user_name, $new_traffic))
{
echo "<script>alert('Success!'); window.location.href=\"".site_url('admin/users')."\";</script>";
return;
}
else
{
echo "<script>alert('Database Error!'); window.location.href=\"".site_url('admin/users')."\";</script>";
return;
}
}
else
{
echo "<script>alert('Error!'); window.location.href=\"".site_url('admin/users')."\";</script>";
return;
}
}
else
{
redirect(site_url('admin/login'));
}
return;
}
}
Loading

0 comments on commit cb69ab1

Please sign in to comment.