本文整理汇总了PHP中set_notice函数的典型用法代码示例。如果您正苦于以下问题:PHP set_notice函数的具体用法?PHP set_notice怎么用?PHP set_notice使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_notice函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: edit_contact
public function edit_contact()
{
if (isset($_POST['edit_contact_btn'])) {
$data_post = $this->input->post();
$this->load->helper('HTMLPurifier');
$config = HTMLPurifier_Config::createDefault();
$purifier = new HTMLPurifier($config);
$data_update['content'] = $purifier->purify($data_post['content_contact']);
if ($this->Contact->update($data_update)) {
$content = 'Cập nhật thông tin liên lạc thành công.';
set_notice('status', SUCCESS_STATUS, $content);
header('location:' . base_url() . 'index.php/_admin/manage_site/contact/show_contact');
} else {
$content = 'Cập nhật thông tin liên lạc thất bại.';
set_notice('status', FAILED_STATUS, $content);
header('location:' . base_url() . 'index.php/_admin/manage_site/contact/show_contact');
}
} else {
$data['contact'] = $this->Contact->get_contact();
$data['subView'] = '/manage_site/contact/edit_contact_layout';
$data['title'] = "Cập nhật thông tin liên hệ";
$data['subData'] = $data;
$this->load->view('/main/main_layout', $data);
}
}
开发者ID:tuanvu5503,项目名称:thungrac.vn,代码行数:25,代码来源:Contact.php
示例2: do_order
public function do_order()
{
date_default_timezone_set("Asia/Ho_Chi_Minh");
$this->load->model('Order_model', 'Order');
if (isset($_POST['phone'])) {
$this->load->helper('validation');
$customer_name = trim_input($_POST['customer_name']);
$phone = trim_input($_POST['phone']);
$arr_product_id = (array) $_POST['product_id'];
$arr_order_qty = (array) $_POST['order_qty'];
$error = array();
//====================== VALIDATION: START ====================
if ($customer_name == '') {
$error[] = 'Tên khách hàng không được để trống.';
}
$regex = "/^[0-9]{9,11}\$/";
if ($phone == '') {
$error[] = "Số điện thoại không được rỗng.";
} elseif (!preg_match($regex, $phone, $maches)) {
$error[] = "Số điện thoại không đúng.";
}
if (empty($arr_product_id)) {
$error[] = "Không có có sản phẩm nào trong đơn hàng.";
} else {
foreach ($arr_product_id as $key => $value) {
if (!$this->Product->check_product_exist($value)) {
$error[] = 'Sản phẩm có mã <span style="color:red;">' . $value . '</span> không có trong hệ thống.';
} else {
if ($arr_order_qty[$key] <= 0) {
$product_name = $this->Product->get_product_name_by_id($arr_product_id[$key]);
$error[] = 'Số lượng sản phẩm <span style="color:red;">' . $product_name . '</span> không thể bằng ' . '<span style="color:red;">' . $arr_order_qty[$key] . '</span>';
}
}
}
}
//====================== VALIDATION: END ======================
if (count($error) > 0) {
set_notice('order', FAILED_STATUS, $error);
header("location:" . base_url() . "index.php/site/cart/view_order");
} else {
$now = new DateTime(date('Y-m-d H:i:s'));
$data_insert['order_datetime'] = $now->format('Y-m-d H:i:s');
$data_insert['product_id_and_qty'] = '';
for ($i = 0; $i < count($arr_product_id); $i++) {
$data_insert['product_id_and_qty'] .= $arr_product_id[$i] . '-' . $arr_order_qty[$i] . '|';
}
$data_insert['product_id_and_qty'] = trim($data_insert['product_id_and_qty'], '|');
$data_insert['customer_name'] = $customer_name;
$data_insert['phone'] = $phone;
if ($this->Order->insert($data_insert)) {
$this->cart->destroy();
//================ SEND MAIL TO ADMIN: START ================
$this->load->model('Account_model', 'Account');
$this->load->helper('mymail');
$arr_to_mail = $this->Account->get_list_email_admin();
if (!empty($arr_to_mail)) {
$date_time_order = date('d/m/Y') . ' - ' . date("h:i:sa");
$subject = 'ĐƠN ĐẶT HÀNG MỚI (' . $date_time_order . ')';
$message = 'Có đơn đặt hàng mới từ:' . '<br>Khách hàng: ' . $customer_name . '<br>Số điện thoại: ' . $phone . '<br><br>';
$message .= '<html><body>';
$message .= '<table rules="all" style="min-width:300px; border-color: #666;" cellpadding="10">';
$message .= "<tr style='background: #eee;'><td><strong>Tên sản phẩm:</strong> </td><td>Số lượng</td></tr>";
foreach ($arr_product_id as $key => $value) {
$message .= "<tr><td><strong>" . $this->Product->get_product_name_by_id($arr_product_id[$key]) . "</strong> </td><td>" . $arr_order_qty[$key] . "</td></tr>";
}
$message .= "</table>";
$message .= "</body></html>";
send_mail($arr_to_mail, $subject, $message);
}
//================ SEND MAIL TO ADMIN: START ================
$content = '<div style="color: rgb(129, 127, 123); font-size: 16px;">' . 'Khách hàng: <span style="color:rgb(0, 165, 255);">' . $customer_name . '</span>' . '<br> Số điện thoại: <span style="color:rgb(0, 165, 255);">' . $phone . '</span>' . '<br><span style="color:rgb(129, 127, 123);"> Chúng tôi sẽ liên lạc lại cho quý khách trong thời gian sớm nhất!</span>' . '</div>';
set_notice('order', SUCCESS_STATUS, $content);
header("location:" . base_url());
} else {
header("location:" . base_url() . "index.php/site/cart/view_order");
$content = 'Có lỗi trong quá trình đặt hàng. <br> Vui lòng làm lại thực hiện lại!';
set_notice('order', FAILED_STATUS, $content);
}
}
} else {
header("location:" . base_url());
}
}
开发者ID:tuanvu5503,项目名称:thungrac.vn,代码行数:83,代码来源:Cart.php
示例3: _check
function _check()
{
$prob = FALSE;
if (version_compare(phpversion(), '5.2.0') < 0) {
set_notice('error', _('You need at least PHP version 5.2.0 to run FoOlSlide. This means you have a many years old version. It is suggested to upgrade to a more recent version of PHP to avoid security issues with your server in general.'));
$prob = TRUE;
return FALSE;
}
if (!file_exists('assets/config.sample.php')) {
set_notice('error', sprintf(_('The file %s was removed. The installation can\'t continue without that file. You can find it in the FoOlSlide download.'), FCPATH . 'config.sample.php'));
$prob = TRUE;
return FALSE;
}
if (!is_writable('content')) {
set_notice('error', sprintf(_('The %s directory needs to be writable. Use this command in your shell if possible: %s or change its permissions recursively to 777 with your own FTP software. You won\'t be able to install or run FoOlSlide without this.'), FCPATH . 'content/', '<br/><b><code>chmod -R 777 ' . FCPATH . 'content/</code></b><br/>'));
$prob = TRUE;
return FALSE;
}
if (!is_writable('content/themes')) {
set_notice('error', sprintf(_('The %s directory needs to be writable as well. Use this command in your shell if possible: %s or change its permissions recursively to 777 with your own FTP software. You won\'t be able to install or run FoOlSlide without this.'), FCPATH . 'content/themes', '<br/><b><code>chmod -R 777 ' . FCPATH . 'content/</code></b><br/>'));
$prob = TRUE;
return FALSE;
}
// check if base folder is writable
if (!is_writable('.')) {
$whoami = FALSE;
// if exec is enable, just check with whoami function who's running php
if ($this->_exec_enabled()) {
$whoami = exec('whoami');
}
// if exec is not enabled, write a file and check who has the permissions on it
if (!$whoami && is_writable('content') && function_exists('posix_getpwid')) {
write_file('content/testing_123.txt', 'testing_123');
$whoami = posix_getpwuid(fileowner('content/testing_123.txt'));
$whoami = $whoami['name'];
unlink('content/testing_123.txt');
}
// if absolutely unable to tell who's the php user, just apologize
// else, give a precise command for shell to enter
if ($whoami != "") {
set_notice('warn', sprintf(_('The %s directory would be better if writable, in order to deliver automatic updates. Use this command in your shell if possible: %s'), FCPATH, '<br/><b><code>chown -R ' . $whoami . ' ' . FCPATH . '</code></b>'));
} else {
set_notice('warn', sprintf(_('The %s directory would be better if writable, in order to deliver automatic updates.<br/>It was impossible to determine the user running PHP. Use this command in your shell if possible: %s where www-data is an example (usually it\'s www-data or Apache)'), FCPATH, '<br/><b><code>chown -R www-data ' . FCPATH . '</code></b><br/>'));
}
set_notice('warn', sprintf(_('If you can\'t do the above, after the installation you will be given a textfile to paste in config.php. More info after submitting.')));
$prob = TRUE;
}
// there was an issue? suggest to refresh the page to check again
if ($prob) {
set_notice('notice', _('If you made any changes, just refresh this page to recheck the directory permissions.'));
}
// all good
return TRUE;
}
开发者ID:bonsoirval,项目名称:FoOlSlide,代码行数:54,代码来源:install.php
示例4: remove_comic_thumb
/**
* Removes the thumbnail and its original image both from database and directory.
*
* @author Woxxy
* @return string true on success, false on failure.
*/
public function remove_comic_thumb() {
// Get directory
$dir = "content/comics/" . $this->directory() . "/";
// Remove the full image
if (!unlink($dir . $this->thumbnail)) {
set_notice('error', _('Failed to remove the thumbnail\'s original image. Please, check file permissions.'));
log_message('error', 'Model: comic_model.php/remove_comic_thumb: failed to delete image');
return false;
}
// Remove the thumbnail
if (!unlink($dir . "thumb_" . $this->thumbnail)) {
set_notice('error', _('Failed to remove the thumbnail image. Please, check file permissions.'));
log_message('error', 'Model: comic_model.php/remove_comic_thumb: failed to delete thumbnail');
return false;
}
// Set the thumbnail variable to empty and save to database
$this->thumbnail = "";
if (!$this->save()) {
set_notice('error', _('Failed to remove the thumbnail image from the database.'));
log_message('error', 'Model: comic_model.php/remove_comic_thumb: failed to remove from database');
return false;
}
// All's good.
return true;
}
开发者ID:Nakei,项目名称:FoOlSlide,代码行数:36,代码来源:comic.php
示例5: check
/**
* Checks if the database entry reflects the files for the page
*
* @author Woxxy
* @return array with error codes (missing_page, missing_thumbnail)
*/
public function check($repair = FALSE)
{
// Let's make sure the chapter and comic is set
if ($this->get_chapter() === FALSE) {
$errors[] = 'page_chapter_entry_not_found';
set_notice('warning', _('Found a page entry without a chapter entry, ID: ' . $this->id));
log_message('debug', 'check: page entry without chapter entry');
if ($repair) {
$this->remove_page_db();
}
return FALSE;
}
$errors = array();
// check the files
$path = "content/comics/" . $this->chapter->comic->directory() . "/" . $this->chapter->directory() . "/" . $this->filename;
// get paths and remove the thumb
if (!file_exists($path)) {
$errors[] = 'missing_page';
set_notice('warning', _('Page file not found in:') . ' ' . $this->chapter->comic->name . ' > ' . $this->chapter->title());
log_message('debug', 'check_page: page not found in ' . $path);
}
if ($repair) {
if (in_array('missing_page', $errors)) {
// no better suggestion than removing
$this->remove_page_db();
return TRUE;
}
}
return $errors;
}
开发者ID:KasaiDot,项目名称:FoOlSlide,代码行数:36,代码来源:page.php
示例6: get_teams_id
public function get_teams_id($array, $create_joint = FALSE)
{
if (count($array) < 1) {
set_notice('error', _('There were no groups selected.'));
log_message('error', 'get_groups: input array empty');
return false;
}
if (count($array) == 1) {
$team = new Team();
$team->where("name", $array[0])->get();
if ($team->result_count() < 1) {
set_notice('error', _('There\'s no team under this ID.'));
log_message('error', 'get_groups: team not found');
return false;
}
$result = array("team_id" => $team->id, "joint_id" => 0);
return $result;
}
if (count($array) > 1) {
$id_array = array();
foreach ($array as $key => $arra) {
$team = new Team();
$team->where('name', $arra[$key])->get();
if ($team->result_count() < 1) {
set_notice('error', _('There\'s no teams under this ID.'));
log_message('error', 'get_groups: team not found');
return false;
}
$id_array[$key] = $team->id;
}
$joint = new Joint();
if (!$joint->check_joint($id_array) && $create_joint) {
if (!$joint->add_joint($id_array)) {
log_message('error', 'get_groups: could not create new joint');
return false;
}
}
return array("team_id" => 0, "joint_id" => $joint->joint_id);
}
set_notice('error', _('There\'s no group found with this ID.'));
log_message('error', 'get_groups: no case matched');
return false;
}
开发者ID:KasaiDot,项目名称:FoOlSlide,代码行数:43,代码来源:team.php
示例7: edit_super_category
public function edit_super_category()
{
if (null != $this->input->post('edit_super_category_btn')) {
$data_post = $this->input->post();
$this->load->helper('Validation');
$this->load->helper('HTMLPurifier');
$config = HTMLPurifier_Config::createDefault();
$purifier = new HTMLPurifier($config);
$id = $data_post['super_category_id'];
$data_update['super_categoryName'] = $purifier->purify($data_post['super_categoryName']);
//========================= VALIDATION: START =======================
$error = array();
if (trim_input($data_update['super_categoryName']) == '') {
$error = 'Tên loại danh mục không thể rỗng.';
}
if ($this->Category->has_duplicate_super_category_name($data_update['super_categoryName'], $id)) {
$error = 'Loại danh mục này đã tồn tại.';
}
//========================= VALIDATION: END =========================
if (count($error) > 0) {
// has error validate
set_notice('status', FAILED_STATUS, $error);
$data['re_super_category_name'] = $data_post['super_categoryName'];
$data['re_super_category_id'] = $data_post['super_category_id'];
$data['subView'] = '/category/edit_super_category_layout';
$data['title'] = "Cập nhật loại danh mục";
$data['subData'] = $data;
$this->load->view('/main/main_layout', $data);
} else {
// not error validate
$old_super_category_name = $this->Category->get_super_category_name_by_id($id);
$new_super_category_name = $data_post['super_categoryName'];
if ($this->Category->update_super_category($id, $data_update)) {
if ($old_super_category_name != $new_super_category_name) {
$content = 'Cập nhật loại danh mục <span style="color:blue;">' . $old_super_category_name . '</span> thành <span style="color:blue;">' . $new_super_category_name . '</span>';
} else {
$content = 'Cập nhật loại danh mục <span style="color:blue;">' . $old_super_category_name . '</span> thành công.';
}
set_notice('status', SUCCESS_STATUS, $content);
header('location:' . base_url() . 'index.php/_admin/category/show_super_category');
} else {
$content = 'Cập nhật loại danh mục <span style="color:blue;">' . $old_super_category_name . '</span> thất bại.';
set_notice('status', FAILED_STATUS, $content);
header('location:' . base_url() . 'index.php/_admin/category/show_super_category');
}
}
} else {
if (null !== $this->uri->segment(4) && is_numeric($this->uri->segment(4)) && $this->Category->has_super_category_exist_by_id($this->uri->segment(4))) {
$super_category_id = $this->uri->segment(4);
$data['super_category_info'] = $this->Category->get_super_category_info($super_category_id);
$data['subView'] = '/category/edit_super_category_layout';
$data['title'] = "Cập nhật loại danh mục";
$data['subData'] = $data;
$this->load->view('/main/main_layout', $data);
} else {
$data['pre_page'] = base_url() . 'index.php/_admin/category/show_super_category';
$this->load->view('/error/404_layout', $data);
}
}
}
开发者ID:tuanvu5503,项目名称:thungrac.vn,代码行数:60,代码来源:Category.php
示例8: balancers
function balancers()
{
if ($this->input->post()) {
$result = array();
if ($urls = $this->input->post('url')) {
$priorities = $this->input->post('priority');
if (is_array($urls)) {
foreach ($urls as $key => $item) {
if (!$item) {
unset($urls[$key]);
break;
}
if ($priorities[$key] >= 0 && $priorities[$key] <= 100) {
$result[] = array('url' => $item, 'priority' => $priorities[$key]);
}
}
}
$result = serialize($result);
$this->db->from('preferences');
$this->db->where(array('name' => 'fs_balancer_clients'));
if ($this->db->count_all_results() == 1) {
$this->db->update('preferences', array('value' => $result), array('name' => 'fs_balancer_clients'));
} else {
$this->db->insert('preferences', array('name' => 'fs_balancer_clients', 'value' => $result));
}
}
if ($value = $this->input->post('fs_balancer_ips')) {
if (is_array($value)) {
foreach ($value as $key => $val) {
if ($value[$key] == "") {
unset($value[$key]);
}
}
$value = serialize($value);
}
$this->db->from('preferences');
$this->db->where(array('name' => 'fs_balancer_ips'));
if ($this->db->count_all_results() == 1) {
$this->db->update('preferences', array('value' => $value), array('name' => 'fs_balancer_ips'));
} else {
$this->db->insert('preferences', array('name' => 'fs_balancer_ips', 'value' => $value));
}
}
load_settings();
set_notice('notice', _('Updated settings.'));
}
if (get_setting('fs_balancer_clients')) {
$data["balancers"] = unserialize(get_setting('fs_balancer_clients'));
} else {
$data["balancers"] = array();
}
if (get_setting('fs_balancer_ips')) {
$data["ips"] = unserialize(get_setting('fs_balancer_ips'));
} else {
$data["ips"] = array();
}
$this->viewdata['function_title'] = _('Balancers');
$this->viewdata["main_content_view"] = $this->load->view("admin/loadbalancer/balancers_list.php", $data, TRUE);
$this->load->view("admin/default.php", $this->viewdata);
}
开发者ID:KasaiDot,项目名称:FoOlSlide,代码行数:60,代码来源:balancer.php
示例9: teams
function teams($stub = "") {
if ($stub == "") {
$this->viewdata["function_title"] = "Team list";
$teams = new Team();
$teams->order_by('name', 'ASC')->get_iterated();
$rows = array();
foreach ($teams as $team) {
$rows[] = array('title' => '<a href="' . site_url('admin/members/teams/' . $team->stub) . '">' . $team->name . '</a>');
}
$data['list'] = lister($rows);
$this->viewdata["main_content_view"] = $this->load->view('admin/members/users', $data, TRUE);
$this->load->view("admin/default", $this->viewdata);
}
else {
$team = new Team();
$team->where('stub', $stub)->get();
if ($this->tank_auth->is_admin() || $this->tank_auth->is_group('mod'))
$can_edit = true;
else
$can_edit = false;
if ($this->tank_auth->is_team_leader($team->id) && !$can_edit)
$can_edit_limited = true;
else
$can_edit_limited = false;
if (($post = $this->input->post()) && ($can_edit || $can_edit_limited)) {
$team = new Team();
$team->where('stub', $stub)->get();
$post["id"] = $team->id;
if ($can_edit_limited) {
unset($post['name']);
}
$team->update_team($post, TRUE);
set_notice('notice', _('Saved.'));
}
$this->viewdata["function_title"] = "Team";
$this->viewdata["extra_title"][] = $team->name;
if ($can_edit_limited)
$team->validation['name']['disabled'] = 'true';
$result = ormer($team);
$result = tabler($result, TRUE, ($can_edit || $can_edit_limited));
$data['table'] = $result;
$data['team'] = $team;
$members = new Membership();
$users = $members->get_members($team->id);
$users_arr = array();
foreach ($users->all as $key => $item) {
$users_arr[$key][] = '<a href="' . site_url('/admin/members/member/' . $item->id) . '">' . $item->username . '</a>';
if ($can_edit)
$users_arr[$key][] = $item->email;
$users_arr[$key][] = $item->last_login;
$users_arr[$key][] = ($item->is_leader) ? _('Leader') : _('Member');
if ($this->tank_auth->is_team_leader($team->id) || $this->tank_auth->is_allowed()) {
$buttoner = array();
$buttoner = array(
'text' => _("Remove member"),
'href' => site_url('/admin/members/reject_application/' . $team->id . '/' . $item->id),
'plug' => _('Do you want to remove this team member?')
);
}
$users_arr[$key][] = (isset($buttoner) && !empty($buttoner)) ? buttoner($buttoner) : '';
if (!$item->is_leader && ($this->tank_auth->is_team_leader($team->id) || $this->tank_auth->is_allowed())) {
$buttoner = array();
$buttoner = array(
'text' => _("Make leader"),
'href' => site_url('/admin/members/make_team_leader/' . $team->id . '/' . $item->id),
'plug' => _('Do you want to make this user a team leader?')
);
}
if ($item->is_leader && ($this->tank_auth->is_team_leader($team->id) || $this->tank_auth->is_allowed())) {
$buttoner = array();
$buttoner = array(
'text' => _("Remove leader"),
'href' => site_url('/admin/members/remove_team_leader/' . $team->id . '/' . $item->id),
'plug' => _('Do you want to remove this user from the team leadership?')
);
}
$users_arr[$key][] = (isset($buttoner) && !empty($buttoner)) ? buttoner($buttoner) : '';
}
// Spawn the form for adding a team leader
$data["no_leader"] = FALSE;
if ($this->tank_auth->is_allowed())
$data["no_leader"] = TRUE;
$data['members'] = tabler($users_arr, TRUE, FALSE);
$this->viewdata["main_content_view"] = $this->load->view('admin/members/team', $data, TRUE);
$this->load->view("admin/default", $this->viewdata);
}
}
开发者ID:Nakei,项目名称:FoOlSlide,代码行数:100,代码来源:members.php
示例10: advertising
//.........这里部分代码省略.........
'placeholder' => '',
'preferences' => 'fs_ads'
)
);
$form[] = array(
_('Right banner'),
array(
'type' => 'textarea',
'name' => 'fs_ads_left_banner',
'help' => _('Insert the HTML provided by your advertiser'),
'preferences' => 'fs_ads'
)
);
$form[] = array(
_('Reload every pageview?'),
array(
'type' => 'checkbox',
'name' => 'fs_ads_left_banner_reload',
'placeholder' => '',
'preferences' => 'fs_ads',
'help' => _('Reload the advertising. Useful for ProjectWonderful.com. Use it without violating the TOS of your advertiser.')
)
);
$form[] = array(
_('Active'),
array(
'type' => 'checkbox',
'name' => 'fs_ads_left_banner_active',
'placeholder' => '',
'preferences' => 'fs_ads'
)
);
$form[] = array(
_('Bottom banner'),
array(
'type' => 'textarea',
'name' => 'fs_ads_bottom_banner',
'help' => _('Insert the HTML provided by your advertiser'),
'preferences' => 'fs_ads'
)
);
$form[] = array(
_('Reload every pageview?'),
array(
'type' => 'checkbox',
'name' => 'fs_ads_bottom_banner_reload',
'placeholder' => '',
'preferences' => 'fs_ads',
'help' => _('Reload the advertising. Useful for ProjectWonderful.com. Use it without violating the TOS of your advertiser.')
)
);
$form[] = array(
_('Active'),
array(
'type' => 'checkbox',
'name' => 'fs_ads_bottom_banner_active',
'placeholder' => '',
'preferences' => 'fs_ads'
)
);
if ($post = $this->input->post()) {
$this->_submit($post, $form);
$ad_before = '<!DOCTYPE html>
<html>
<head>
<title>FoOlSlide ads</title>
<style>body{margin:0; padding:0; overflow:hidden;}</style>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>';
$ad_after = '</body>
</html>';
$ads = array('fs_ads_top_banner' => 'ads_top.html', 'fs_ads_bottom_banner' => 'ads_bottom.html', 'fs_ads_left_banner' => 'ads_left.html');
foreach ($ads as $ad => $adfile) {
if (!write_file('./content/ads/' . $adfile, $ad_before . $this->input->post($ad) . $ad_after)) {
log_message('error', 'preferences.php/advertising: couldn\'t update HTML files');
set_notice('error', _('Couldn\'t save the advertising code in the HTML'));
}
}
}
$table = tabler($form, FALSE);
$data['table'] = $table;
$this->viewdata["main_content_view"] = $this->load->view("admin/preferences/general.php", $data, TRUE);
$this->load->view("admin/default.php", $this->viewdata);
}
开发者ID:Nakei,项目名称:FoOlSlide,代码行数:101,代码来源:preferences.php
示例11: teams
function teams($stub = "")
{
// no team selected
if ($stub == "") {
// set subtitle
$this->viewdata["function_title"] = _('Teams');
// we can use get_iterated on teams
$teams = new Team();
// support filtering via search
if ($this->input->post()) {
$teams->ilike('name', $this->input->post('search'));
$this->viewdata['extra_title'][] = _('Searching') . " : " . $this->input->post('search');
}
$teams->order_by('name', 'ASC')->get_iterated();
$rows = array();
// produce links for each team
foreach ($teams as $team) {
$rows[] = array('title' => '<a href="' . site_url('admin/members/teams/' . $team->stub) . '">' . $team->name . '</a>');
}
// put in a list the teams
$data['form_title'] = _('Teams');
$data['table'] = lister($rows);
// print out
$this->viewdata["main_content_view"] = $this->load->view('admin/members/users', $data, TRUE);
$this->load->view("admin/default", $this->viewdata);
} else {
// team was selected, let's grab it and create a form for it
$team = new Team();
$team->where('stub', $stub)->get();
// if the team was not found return 404
if ($team->result_count() != 1) {
show_404();
}
// if admin or mod allow full editing rights
if ($this->tank_auth->is_allowed()) {
$can_edit = true;
} else {
$can_edit = false;
}
// if it's a team leader, but not admin or mod, allow him to change data but not the team name
if ($this->tank_auth->is_team_leader($team->id) && !$can_edit) {
$can_edit_limited = true;
} else {
$can_edit_limited = false;
}
// if allowed in any way to edit,
if (($post = $this->input->post()) && ($can_edit || $can_edit_limited)) {
$post["id"] = $team->id;
// save the stub in case it's changed
$old_stub = $team->stub;
// don't allow editing of name for team leaders
if ($can_edit_limited) {
unset($post['name']);
}
// send the data to database
$team->update_team($post);
// green box to tell data is saved
set_notice('notice', _('Saved.'));
if ($team->stub != $old_stub) {
flash_notice('notice', _('Saved.'));
redirect('admin/members/teams/' . $team->stub);
}
}
// subtitle
$this->viewdata["function_title"] = '<a href="' . site_url("admin/members/teams") . '">' . _('Teams') . '</a>';
// subsubtitle!
$this->viewdata["extra_title"][] = $team->name;
// gray out the name field for team leaders by editing directly the validation array
if ($can_edit_limited) {
$team->validation['name']['disabled'] = 'true';
}
// convert the team information to an array
$result = ormer($team);
// convert the array to a form
$result = tabler($result, TRUE, $can_edit || $can_edit_limited);
$data['table'] = $result;
$data['team'] = $team;
// get the team's members
$members = new Membership();
$users = $members->get_members($team->id);
// the team members' array needs lots of buttons and links
$users_arr = array();
foreach ($users->all as $key => $item) {
$users_arr[$key][] = '<a href="' . site_url('/admin/members/member/' . $item->id) . '">' . $item->username . '</a>';
// show the email only to admins and mods
if ($can_edit) {
$users_arr[$key][] = $item->email;
}
$users_arr[$key][] = $item->last_login;
// leader of normal member?
$users_arr[$key][] = $item->is_leader ? _('Leader') : _('Member');
if ($this->tank_auth->is_team_leader($team->id) || $this->tank_auth->is_allowed()) {
$buttoner = array();
$buttoner = array('text' => _("Remove member"), 'href' => site_url('/admin/members/reject_application/' . $team->id . '/' . $item->id), 'plug' => _('Do you want to remove this team member?'));
}
// add button to array or stay silent if there's no button
$users_arr[$key]['action'] = isset($buttoner) && !empty($buttoner) ? buttoner($buttoner) : '';
if (!$item->is_leader && ($this->tank_auth->is_team_leader($team->id) || $this->tank_auth->is_allowed())) {
$buttoner = array();
$buttoner = array('text' => _("Make leader"), 'href' => site_url('/admin/members/make_team_leader/' . $team->id . '/' . $item->id), 'plug' => _('Do you want to make this user a team leader?'));
//.........这里部分代码省略.........
开发者ID:KasaiDot,项目名称:FoOlSlide,代码行数:101,代码来源:members.php
示例12: edit_acticle
public function edit_acticle()
{
if (null != $this->input->post('edit_acticle_btn')) {
$data_post = $this->input->post();
$this->load->helper('Validation');
$this->load->helper('HTMLPurifier');
$config = HTMLPurifier_Config::createDefault();
$purifier = new HTMLPurifier($config);
$id = $data_post['acticle_id'];
$data_update['acticle_name'] = $purifier->purify($data_post['acticle_name']);
$data_update['acticle_content'] = $purifier->purify($data_post['acticle_content']);
// $data_update['acticle_content'] = trim_input($data_update['acticle_content']);
if ($this->Acticle->update($id, $data_update)) {
$content = 'Cập nhật bài viết thành công.';
set_notice('status', SUCCESS_STATUS, $content);
header('location:' . base_url() . 'index.php/_admin/acticle/show_acticle');
} else {
$content = 'Cập nhật bài viết thất bại.';
set_notice('status', FAILED_STATUS, $content);
header('location:' . base_url() . 'index.php/_admin/acticle/show_acticle');
}
} else {
if (null !== $this->uri->segment(4) && is_numeric($this->uri->segment(4)) && $this->Acticle->has_acticle_exist_by_id($this->uri->segment(4))) {
$acticle_id = $this->uri->segment(4);
$data['acticle_info'] = $this->Acticle->get_acticle_info($acticle_id);
$data['subView'] = '/acticle/edit_acticle_layout';
$data['title'] = "Chỉnh sửa bài viết";
$data['subData'] = $data;
$this->load->view('/main/main_layout', $data);
} else {
$data['pre_page'] = base_url() . 'index.php/_admin/acticle/show_acticle';
$this->load->view('/error/404_layout', $data);
}
}
}
开发者ID:tuanvu5503,项目名称:thungrac.vn,代码行数:35,代码来源:Acticle.php
示例13: check
function check($repair = FALSE)
{
// make sure we got the comic
if ($this->get_comic() === FALSE) {
$errors[] = 'chapter_comic_entry_not_found';
set_notice('warning', _('Found a chapter entry without a comic entry, Chapter ID: ' . $this->id));
log_message('debug', 'check: chapter entry without comic entry');
if ($repair) {
$this->remove_chapter_db();
}
return FALSE;
}
$errors = array();
// check if the directory exists at all
$path = 'content/comics/' . $this->comic->directory() . '/' . $this->directory() . '/';
if (!is_dir($path)) {
$errors[] = 'chapter_directory_not_found';
set_notice('warning', _('No directory found for:') . ' ' . $this->comic->name . ' > ' . $this->title());
log_message('debug', 'check: chapter directory missing at ' . $path);
// the folder doesn't exist, so get rid of the entry from database
if ($repair) {
$this->remove_chapter_db();
}
// there's no recovery from this, return the error codes
return $errors;
}
// check if there are extraneous files in the folder
$files = get_dir_file_info($path);
foreach ($files as $key => $file) {
// check that the file is writable
if (!is_writable($file['relative_path'])) {
// non writable files are horrendous, send a notice and stop the machines
$errors[] = 'chapter_non_writable_file';
set_notice('warning', _('Found non writable files in the comics folder. Check your files permissions.'));
log_message('debug', 'check: non writable file: ' . $file['relative_path']);
return $errors;
}
// get the extension
$ext = strtolower(substr($file['name'], -4));
if (in_array($ext, array('.zip'))) {
// maybe it's just the zip created by the archive system
$archives = new Archive();
$archives->where('comic_id', $this->comic_id)->where('chapter_id', $this->id)->where('volume_id', 0)->get();
if ($archives->result_count()) {
foreach ($archives as $archive) {
// we actually have an archive, but is it the same file?
if ($file['name'] == $archive->filename) {
// same file, unset to confirm
unset($files[$key]);
continue;
}
}
}
}
if (in_array($ext, array('.png', '.jpg', 'jpeg', '.gif'))) {
$page = new Page();
$page->where('chapter_id', $this->id)->where('filename', $file['name'])->get();
if ($page->result_count() == 1) {
// it's a simple page, unset to confirm
unset($files[$key]);
continue;
}
}
}
// now we have an array with files that don't belong here
foreach ($files as $file) {
$errors[] = 'chapter_unidentified_file';
set_notice('warning', _('Unidentified file found in:') . ' ' . $this->comic->name . ' > ' . $this->title() . ': ' . $file['name']);
log_message('debug', 'check: unidentified file ' . $file['relative_path'] . $file['name']);
// repairing this means getting rid of extraneous files
if ($repair) {
// it's possible the file is not removeable
if (is_writable($file['relative_path'] . $file['name'])) {
// the files SHOULD be writable, we checked it earlier
if (is_dir($file['relative_path'] . $file['name'])) {
delete_files($file['relative_path'] . $file['name']);
rmdir($file['relative_path'] . $file['name']);
} else {
unlink($file['relative_path'] . $file['name']);
}
}
}
}
// everything's been checked. The errors are in the set_notice system
return $errors;
}
开发者ID:KasaiDot,项目名称:FoOlSlide,代码行数:86,代码来源:chapter.php
示例14: _check
function _check() {
$prob = FALSE;
if (!file_exists('assets/config.sample.php')) {
set_notice('error', sprintf(_('The file %s was removed. The installation can\'t continue without that file. You can find it in the FoOlSlide download.'), FCPATH . 'config.sample.php'));
$prob = TRUE;
return FALSE;
}
if (!is_writable('content')) {
set_notice('error', sprintf(_('The %s directory needs to be writable. Use this command in your shell if possible: %s or change its permissions recursively to 777 with your own FTP software. You won\'t be able to install or run FoOlSlide without this.'), FCPATH . 'content/', '<br/><b><code>chmod -R 777 ' . FCPATH . 'content/</code></b><br/>'));
$prob = TRUE;
return FALSE;
}
if (!is_writable('content/themes')) {
set_notice('error', sprintf(_('The %s directory needs to be writable as well. Use this command in your shell if possible: %s or change its permissions recursively to 777 with your own FTP software. You won\'t be able to install or run FoOlSlide without this.'), FCPATH . 'content/themes', '<br/><b><code>chmod -R 777 ' . FCPATH . 'content/</code></b><br/>'));
$prob = TRUE;
return FALSE;
}
if (!is_writable('.')) {
$whoami = FALSE;
if ($this->_exec_enabled())
$whoami = exec('whoami');
if (!$whoami && is_writable('content') && function_exists('posix_getpwid')) {
write_file('content/testing_123.txt', 'testing_123');
$whoami = posix_getpwuid(fileowner('content/testing_123.txt'));
$whoami = $whoami['name'];
unlink('content/testing_123.txt');
}
if ($whoami != "")
set_notice('warn', sprintf(_('The %s directory would be better if writable, in order to deliver automatic updates. Use this command in your shell if possible: %s'), FCPATH, '<br/><b><code>chown -R ' . $whoami . ' ' . FCPATH . '</code></b>'));
else
set_notice('warn', sprintf(_('The %s directory would be better if writable, in order to deliver automatic updates.<br/>It was impossible to determine the user running PHP. Use this command in your shell if possible: %s where www-data is an example (usually it\'s www-data or Apache)'), FCPATH, '<br/><b><code>chown -R www-data ' . FCPATH . '</code></b><br/>'));
set_notice('warn', sprintf(_('If you can\'t do the above, after the installation you will be given a textfile to paste in config.php. More info after submitting.')));
$prob = TRUE;
}
if ($prob) {
set_notice('notice', 'If you made any changes, just refresh this page to recheck the directory permissions.');
}
return TRUE;
}
开发者ID:Nakei,项目名称:FoOlSlide,代码行数:45,代码来源:install.php
示例15: defined
* @Since 1.0.0
* @copyright Copyright (C) 2011 5Twenty Studios
*
*/
defined('ABSPATH') or die("Cannot access pages directly.");
//initializing
$user = FiveTable::getInstance('user');
if (BRequest::getVar('verify', false)) {
// LOGIN USER
mysql_query("updat
|
请发表评论