• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP soft_error函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中soft_error函数的典型用法代码示例。如果您正苦于以下问题:PHP soft_error函数的具体用法?PHP soft_error怎么用?PHP soft_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了soft_error函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: password_submit

function password_submit()
{
    global $vars, $phpcdb, $phpc_user;
    if (!is_user()) {
        return tag('div', __('You must be logged in.'));
    }
    verify_token();
    if (!$phpc_user->is_password_editable()) {
        soft_error(__('You do not have permission to change your password.'));
    }
    if (!isset($vars['old_password'])) {
        return tag('div', __('You must specify your old password.'));
    } else {
        $old_password = $vars['old_password'];
    }
    if ($phpc_user->password != md5($old_password)) {
        return tag('div', __('The password you entered did not match your old password.'));
    }
    if (empty($vars['password1'])) {
        return tag('div', __('You must specify a password'));
    }
    if (empty($vars['password2']) || $vars['password1'] != $vars['password2']) {
        return tag('div', __('Your passwords did not match'));
    }
    $passwd = md5($vars['password1']);
    $phpcdb->set_password($phpc_user->get_uid(), $passwd);
    return tag('div', __('Password updated.'));
}
开发者ID:php-calendar,项目名称:php-calendar,代码行数:28,代码来源:password_submit.php


示例2: process_form

function process_form()
{
    global $vars, $phpcdb, $phpc_script;
    verify_token();
    $cid = $phpcdb->create_calendar();
    foreach (get_config_options() as $item) {
        $name = $item[0];
        $type = $item[2];
        if ($type == PHPC_CHECK) {
            if (isset($vars[$name])) {
                $value = "1";
            } else {
                $value = "0";
            }
        } else {
            if (isset($vars[$name])) {
                $value = $vars[$name];
            } else {
                soft_error(__("{$name} was not set."));
            }
        }
        $phpcdb->create_config($cid, $name, $value);
    }
    message(__('Calendar created.'));
}
开发者ID:php-calendar,项目名称:php-calendar,代码行数:25,代码来源:calendar_form.php


示例3: display_week

function display_week()
{
    global $vars;
    $heading_html = tag('tr');
    $heading_html->add(tag('th', __p('Week', 'W')));
    for ($i = 0; $i < 7; $i++) {
        $d = ($i + day_of_week_start()) % 7;
        $heading_html->add(tag('th', day_name($d)));
    }
    if (!isset($vars['week']) || !isset($vars['year'])) {
        soft_error(__('Invalid date.'));
    }
    $week_of_year = intval($vars['week']);
    $year = intval($vars['year']);
    $day_of_year = 1 + ($week_of_year - 1) * 7 - day_of_week(1, 1, $year);
    $from_stamp = mktime(0, 0, 0, 1, $day_of_year, $year);
    $start_month = date("n", $from_stamp);
    $start_year = date("Y", $from_stamp);
    $last_day = $day_of_year + 6;
    $to_stamp = mktime(23, 59, 59, 1, $last_day, $year);
    $end_month = date("n", $to_stamp);
    $end_year = date("Y", $to_stamp);
    $heading = month_name($start_month) . " {$start_year}";
    if ($end_month != $start_month) {
        $heading .= " - " . month_name($end_month) . " {$end_year}";
    }
    return tag('', tag("div", attributes('id="phpc-summary-view"'), tag("div", attributes('id="phpc-summary-head"'), tag("div", attributes('id="phpc-summary-title"'), ''), tag("div", attributes('id="phpc-summary-author"'), ''), tag("div", attributes('id="phpc-summary-category"'), ''), tag("div", attributes('id="phpc-summary-time"'), '')), tag("div", attributes('id="phpc-summary-body"'), '')), tag('table', attributes('class="phpc-main phpc-calendar"'), tag('caption', $heading), tag('colgroup', tag('col', attributes('class="phpc-week"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"'))), tag('thead', $heading_html), create_week($week_of_year, $from_stamp, $to_stamp, $year)));
}
开发者ID:php-calendar,项目名称:php-calendar,代码行数:28,代码来源:display_week.php


示例4: options_form

function options_form()
{
    global $config, $phpc_script, $config_form;
    $tbody = tag('tbody');
    foreach ($config_form as $element) {
        $name = $element[0];
        $text = $element[1];
        $type = $element[2];
        switch ($type) {
            case CHECK:
                $input = create_checkbox($name, '1', $config[$name]);
                break;
            case TEXT:
                $input = create_text($name, $config[$name]);
                break;
            case DROPDOWN:
                $sequence = create_sequence(0, count($element[3]) - 1);
                $input = create_select($name, $element[3], $config[$name], $sequence);
                break;
            default:
                soft_error(_('Unsupported config type') . ": {$type}");
        }
        $tbody->add(tag('tr', tag('th', $text . ':'), tag('td', $input)));
    }
    return tag('form', attributes("action=\"{$phpc_script}\"", 'method="post"'), tag('table', attributes('class="phpc-main"'), tag('caption', _('Options')), tag('tfoot', tag('tr', tag('td', attributes('colspan="2"'), create_hidden('action', 'options_submit'), create_submit(_('Submit'))))), $tbody));
}
开发者ID:noprom,项目名称:cryptdb,代码行数:26,代码来源:admin.php


示例5: user_settings_submit

function user_settings_submit()
{
    global $phpcid, $vars, $phpcdb, $phpc_user_tz, $phpc_user_lang, $phpc_prefix, $phpc_user, $phpc_script;
    verify_token();
    // If we have a timezone, make sure it's valid
    if (!empty($vars["timezone"]) && !in_array($vars['timezone'], timezone_identifiers_list())) {
        soft_error(__("Invalid timezone."));
    }
    // Expire 20 years in the future, give or take.
    $expiration_time = time() + 20 * 365 * 24 * 60 * 60;
    // One hour in the past
    $past_time = time() - 3600;
    if (!empty($vars["timezone"])) {
        setcookie("{$phpc_prefix}tz", $vars['timezone'], $expiration_time);
    } else {
        setcookie("{$phpc_prefix}tz", '', $past_time);
    }
    if (!empty($vars["language"])) {
        setcookie("{$phpc_prefix}lang", $vars['language'], $expiration_time);
    } else {
        setcookie("{$phpc_prefix}lang", '', $past_time);
    }
    if (is_user()) {
        $uid = $phpc_user->get_uid();
        $phpcdb->set_user_default_cid($uid, $vars['default_cid']);
        $phpcdb->set_timezone($uid, $vars['timezone']);
        $phpcdb->set_language($uid, $vars['language']);
        $phpc_user_tz = $vars["timezone"];
        $phpc_user_lang = $vars["language"];
    }
    return message_redirect(__('Settings updated.'), "{$phpc_script}?action=user_settings&phpcid={$phpcid}");
}
开发者ID:hubandbob,项目名称:php-calendar,代码行数:32,代码来源:user_settings_submit.php


示例6: calendar_delete

function calendar_delete()
{
    global $vars, $phpcdb, $phpc_script;
    $html = tag('div', attributes('class="phpc-container"'));
    if (empty($vars["cid"])) {
        $html->add(tag('p', __('No calendar selected.')));
        return $html;
    }
    $id = $vars["cid"];
    $calendar = $phpcdb->get_calendar($id);
    if (empty($calendar)) {
        soft_error(__("Invalid calendar ID."));
    }
    if (empty($vars["confirm"])) {
        $html->add(tag('p', __('Confirm you want to delete calendar:') . $calendar->get_title()));
        $html->add(" [ ", create_action_link(__('Confirm'), "calendar_delete", array("cid" => $id, "confirm" => "1")), " ] ");
        $html->add(" [ ", create_action_link(__('Deny'), "display_month"), " ] ");
        return $html;
    }
    if (!$calendar->can_admin()) {
        $html->add(tag('p', __("You do not have permission to remove calendar") . ": {$id}"));
        return $html;
    }
    if ($phpcdb->delete_calendar($id)) {
        $html->add(tag('p', __("Removed calendar") . ": {$id}"));
    } else {
        $html->add(tag('p', __("Could not remove calendar") . ": {$id}"));
    }
    return message_redirect($html, "{$phpc_script}?action=admin");
}
开发者ID:php-calendar,项目名称:php-calendar,代码行数:30,代码来源:calendar_delete.php


示例7: process_form

function process_form()
{
    global $phpcid, $vars, $phpcdb, $phpc_script, $phpc_cal;
    verify_token();
    $user = $phpcdb->get_user($vars["uid"]);
    // Remove existing groups for this calendar
    foreach ($user->get_groups() as $group) {
        if ($group["cid"] == $phpcid) {
            $phpcdb->user_remove_group($vars["uid"], $group["gid"]);
        }
    }
    $valid_groups = array();
    foreach ($phpc_cal->get_groups() as $group) {
        $valid_groups[] = $group["gid"];
    }
    if (!empty($vars["groups"])) {
        foreach ($vars["groups"] as $gid) {
            if (!in_array($gid, $valid_groups)) {
                soft_error("Invalid gid");
            }
            $phpcdb->user_add_group($vars["uid"], $gid);
        }
    }
    return message(__('Groups updated.'));
}
开发者ID:Godjqb,项目名称:Php-test,代码行数:25,代码来源:user_groups.php


示例8: event_delete

function event_delete()
{
    global $config;
    if (!is_user() && $config['anon_permission'] < 2) {
        soft_error(_('You do not have permission to delete events.'));
    }
    $del_array = explode('&', $_SERVER['QUERY_STRING']);
    $html = tag('div', attributes('class="box"', 'style="width: 50%"'));
    $ids = 0;
    foreach ($del_array as $del_value) {
        list($drop, $id) = explode("=", $del_value);
        if (preg_match('/^id$/', $drop) == 0) {
            continue;
        }
        $ids++;
        $event = get_event_by_id($id);
        if (!check_user($event['uid']) && $config['anon_permission'] < 2) {
            $html->add(tag('p', _('You do not have permission to remove item') . ": {$id}"));
            continue;
        }
        if (remove_event($id)) {
            $html->add(tag('p', _('Removed item') . ": {$id}"));
        } else {
            $html->add(tag('p', _('Could not remove item') . ": {$id}"));
        }
    }
    if ($ids == 0) {
        $html->add(tag('p', _('No items selected.')));
    }
    return $html;
}
开发者ID:noprom,项目名称:cryptdb,代码行数:31,代码来源:event_delete.php


示例9: translate

function translate()
{
    global $phpc_locale_path;
    if (!is_admin()) {
        permission_error(__('Need to be admin'));
        exit;
    }
    $handle = opendir($phpc_locale_path);
    if (!$handle) {
        return soft_error("Error reading locale directory.");
    }
    $output_tag = tag('div', tag('h2', __('Translate')));
    while (($filename = readdir($handle)) !== false) {
        $pathname = "{$phpc_locale_path}/{$filename}";
        if (strncmp($filename, ".", 1) == 0 || !is_dir($pathname)) {
            continue;
        }
        $msgs_path = "{$pathname}/LC_MESSAGES";
        $hash = parse_po_file("{$msgs_path}/messages.po");
        if ($hash === FALSE) {
            print nl2br("Error reading '{$msgs_path}/messages.po', aborted.\n");
        } else {
            $out = "{$msgs_path}/messages.mo";
            write_mo_file($hash, $out);
        }
        $output_tag->add(tag('div', sprintf(__('Translated "%s"'), $filename)));
    }
    closedir($handle);
    return $output_tag;
}
开发者ID:php-calendar,项目名称:php-calendar,代码行数:30,代码来源:translate.php


示例10: category_submit

function category_submit()
{
    global $vars, $phpcdb, $phpc_script, $phpc_cal;
    if (empty($vars["text-color"]) || empty($vars["bg-color"])) {
        $page = "{$phpc_script}?action=category_form";
        if (!empty($vars["cid"])) {
            $page .= "&cid={$vars["cid"]}";
        }
        if (!empty($vars["catid"])) {
            $page .= "&catid={$vars["catid"]}";
        }
        return message_redirect(__("Color not specified."), $page);
    }
    // The current widget produces hex values without the "#".
    //   We may in the future want to allow different input, so store the
    //   values with the "#"
    $text_color = '#' . $vars["text-color"];
    $bg_color = '#' . $vars["bg-color"];
    if (empty($vars['gid']) || strlen($vars['gid']) == 0) {
        $gid = 0;
    } else {
        $gid = $vars['gid'];
    }
    if (!check_color($text_color) || !check_color($bg_color)) {
        soft_error(__("Invalid color."));
    }
    if (!isset($vars['catid'])) {
        $modify = false;
        if (!isset($vars['cid'])) {
            $cid = null;
            if (!is_admin()) {
                permission_error(__('You do not have permission to add categories to all calendars.'));
            }
        } else {
            $cid = $vars['cid'];
            $calendar = $phpcdb->get_calendar($cid);
            if (!$calendar->can_admin()) {
                permission_error(__('You do not have permission to add categories to this calendar.'));
            }
        }
        $catid = $phpcdb->create_category($cid, $vars["name"], $text_color, $bg_color, $gid);
    } else {
        $modify = true;
        $catid = $vars['catid'];
        $category = $phpcdb->get_category($catid);
        if (!(empty($category['cid']) && is_admin() || $phpcdb->get_calendar($category["cid"])->can_admin())) {
            soft_error(__("You do not have permission to modify this category."));
        }
        $phpcdb->modify_category($catid, $vars['name'], $text_color, $bg_color, $gid);
    }
    $page = "{$phpc_script}?action=cadmin&phpcid=" . $vars['phpcid'];
    if ($modify) {
        return message_redirect(__("Modified category: ") . $catid, $page);
    }
    if ($catid > 0) {
        return message_redirect(__("Created category: ") . $catid, $page);
    }
    return tag('div', attributes('class="phpc-error"'), __('Error submitting category.'));
}
开发者ID:php-calendar,项目名称:php-calendar,代码行数:59,代码来源:category_submit.php


示例11: search_results

function search_results()
{
    global $vars, $phpcdb, $phpcid, $sort_options, $order_options;
    $searchstring = $vars['searchstring'];
    if (!empty($vars['search-from-date']) && strlen($vars['search-from-date']) > 0) {
        $start = get_timestamp('search-from');
    } else {
        $start = false;
    }
    if (!empty($vars['search-to-date']) && strlen($vars['search-to-date']) > 0) {
        $end = get_timestamp('search-to');
    } else {
        $end = false;
    }
    // make sure sort is valid
    $sort = htmlentities($vars['sort']);
    if (array_search($sort, array_keys($sort_options)) === false) {
        soft_error(__('Invalid sort option') . ": {$sort}");
    }
    // make sure order is valid
    $order = htmlentities($vars['order']);
    if (array_search($order, array_keys($order_options)) === false) {
        soft_error(__('Invalid order option') . ": {$order}");
    }
    $keywords = explode(" ", $searchstring);
    $results = $phpcdb->search($phpcid, $keywords, $start, $end, $sort, $order);
    $tags = array();
    foreach ($results as $event) {
        if (!$event->can_read()) {
            continue;
        }
        $name = $event->get_author();
        $subject = $event->get_subject();
        $desc = $event->get_desc();
        $date = $event->get_date_string();
        $time = $event->get_time_string();
        $eid = $event->get_eid();
        $tags[] = tag('tr', tag('td', tag('strong', create_event_link($subject, 'display_event', $eid))), tag('td', "{$date} {$time}"), tag('td', $desc));
    }
    if (sizeof($tags) == 0) {
        $html = tag('div', tag('strong', __('No events matched your search criteria.')));
    } else {
        $html = tag('table', attributes('class="phpc-main"'), tag('caption', __('Search Results')), tag('thead', tag('tr', tag('th', __('Subject')), tag('th', __('Date Time')), tag('th', __('Description')))));
        foreach ($tags as $tag) {
            $html->add($tag);
        }
    }
    return $html;
}
开发者ID:Godjqb,项目名称:Php-test,代码行数:49,代码来源:search.php


示例12: display_event

function display_event()
{
    global $vars;
    if (!empty($vars['contentType']) && $vars['contentType'] == 'json') {
        return display_event_json();
    }
    if (isset($vars['oid'])) {
        return display_event_by_oid($vars['oid']);
    }
    if (isset($vars['eid'])) {
        return display_event_by_eid($vars['eid']);
    }
    // If we get here, we did something wrong
    soft_error(__("Invalid arguments."));
}
开发者ID:bluewarest,项目名称:gameboard,代码行数:15,代码来源:display_event.php


示例13: display

function display()
{
    global $vars, $day, $month, $year;
    if (isset($vars['id'])) {
        return display_id($vars['id']);
    }
    if (isset($vars['day'])) {
        return display_day($day, $month, $year);
    }
    if (isset($vars['month'])) {
        return display_month($month, $year);
    }
    if (isset($vars['year'])) {
        soft_error('year view not yet implemented');
    }
    return display_month($month, $year);
}
开发者ID:noprom,项目名称:cryptdb,代码行数:17,代码来源:display.php


示例14: search_results

function search_results()
{
    global $vars, $db, $calendar_name, $sort_options, $order_options;
    $searchstring = $vars['searchstring'];
    $start = "{$vars['syear']}-{$vars['smonth']}-{$vars['sday']}";
    $end = "{$vars['eyear']}-{$vars['emonth']}-{$vars['eday']}";
    // make sure sort is valid
    $sort = $vars['sort'];
    if (array_search($sort, array_keys($sort_options)) === false) {
        soft_error(_('Invalid sort option') . ": {$sort}");
    }
    // make sure order is valid
    $order = $vars['order'];
    if (array_search($order, array_keys($order_options)) === false) {
        soft_error(_('Invalid order option') . ": {$order}");
    }
    $keywords = explode(" ", $searchstring);
    $words = array();
    foreach ($keywords as $keyword) {
        $words[] = "(subject LIKE '%{$keyword}%' " . "OR description LIKE '%{$keyword}%')\n";
    }
    $where = implode(' AND ', $words);
    $query = 'SELECT * FROM ' . SQL_PREFIX . "events " . "WHERE ({$where}) " . "AND calendar = '{$calendar_name}' " . "AND enddate >= DATE '{$start}' " . "AND startdate <= DATE '{$end}' " . "ORDER BY {$sort} {$order}";
    $result = $db->Execute($query) or db_error(_('Encountered an error while searching.'), $query);
    $tags = array();
    while ($row = $result->FetchRow()) {
        $name = stripslashes($row['uid']);
        $subject = stripslashes($row['subject']);
        $desc = nl2br(stripslashes($row['description']));
        $desc = parse_desc($desc);
        $tags[] = tag('tr', tag('td', attributes('class="phpc-list"'), tag('strong', create_id_link($subject, 'display', $row['id']))), tag('td', attributes('class="phpc-list"'), $row['startdate'] . ' ' . formatted_time_string($row['starttime'], $row['eventtype'])), tag('td', attributes('class="phpc-list"'), $desc));
    }
    if (sizeof($tags) == 0) {
        $html = tag('div', tag('strong', _('No events matched your search criteria.')));
    } else {
        $html = tag('table', attributes('class="phpc-main"'), tag('caption', _('Search Results')), tag('thead', tag('tr', tag('th', _('Subject')), tag('th', _('Date Time')), tag('th', _('Description')))));
        foreach ($tags as $tag) {
            $html->add($tag);
        }
    }
    return $html;
}
开发者ID:noprom,项目名称:cryptdb,代码行数:42,代码来源:search.php


示例15: __construct

 function __construct($event)
 {
     parent::__construct($event);
     $this->oid = $event['oid'];
     if (!empty($event['start_ts'])) {
         $start_ts = $event['start_ts'];
         $this->start_year = date('Y', $start_ts);
         $this->start_month = date('n', $start_ts);
         $this->start_day = date('j', $start_ts);
         $this->start_hour = date('H', $start_ts);
         $this->start_minute = date('i', $start_ts);
     }
     if (!empty($event['start_date'])) {
         if (preg_match('/^(\\d{4})(\\d{2})(\\d{2})$/', $event['start_date'], $start_matches) < 1) {
             soft_error(__('DB returned an invalid date.') . "({$event['start_date']})");
         }
         $this->start_year = $start_matches[1];
         $this->start_month = $start_matches[2];
         $this->start_day = $start_matches[3];
     }
     if (!empty($event['end_ts'])) {
         $end_ts = $event['end_ts'];
         $this->end_year = date('Y', $end_ts);
         $this->end_month = date('n', $end_ts);
         $this->end_day = date('j', $end_ts);
         $this->end_hour = date('H', $end_ts);
         $this->end_minute = date('i', $end_ts);
     }
     if (!empty($event['end_date'])) {
         if (preg_match('/^(\\d{4})(\\d{2})(\\d{2})$/', $event['end_date'], $end_matches) < 1) {
             soft_error(__('DB returned an invalid date.') . "({$event['start_date']})");
         }
         $this->end_year = $end_matches[1];
         $this->end_month = $end_matches[2];
         $this->end_day = $end_matches[3];
     }
     $this->time_type = $event['time_type'];
     if (!empty($event['end_ts'])) {
         $this->duration = $event['end_ts'] - $event['start_ts'];
     }
 }
开发者ID:php-calendar,项目名称:php-calendar,代码行数:41,代码来源:phpcoccurrence.class.php


示例16: display_week

function display_week()
{
    global $vars, $phpc_home_url, $phpcid, $phpc_year, $phpc_month, $phpc_day;
    if (!isset($vars['week'])) {
        $week_of_year = week_of_year($phpc_month, $phpc_day, $phpc_year);
    } else {
        if (!is_numeric($vars['week'])) {
            soft_error(__('Invalid date.'));
        }
        $week_of_year = $vars['week'];
    }
    $day_of_year = 1 + ($week_of_year - 1) * 7 - day_of_week(1, 1, $phpc_year);
    $from_stamp = mktime(0, 0, 0, 1, $day_of_year, $phpc_year);
    $start_day = date("j", $from_stamp);
    $start_month = date("n", $from_stamp);
    $start_year = date("Y", $from_stamp);
    $last_day = $day_of_year + 6;
    $to_stamp = mktime(23, 59, 59, 1, $last_day, $phpc_year);
    $end_day = date("j", $to_stamp);
    $end_month = date("n", $to_stamp);
    $end_year = date("Y", $to_stamp);
    $title = month_name($start_month) . " {$start_year}";
    if ($end_month != $start_month) {
        $title .= " - " . month_name($end_month) . " {$end_year}";
    }
    $prev_week = $week_of_year - 1;
    $prev_year = $phpc_year;
    if ($prev_week < 1) {
        $prev_year--;
        $prev_week = week_of_year($start_month, $start_day - 7, $start_year);
    }
    $next_week = $week_of_year + 1;
    $next_year = $phpc_year;
    if ($next_week > weeks_in_year($phpc_year)) {
        $next_week = week_of_year($end_month, $end_day + 1, $end_year);
        $next_year++;
    }
    $heading = tag('', tag('a', attrs('class="phpc-icon-link"', "href=\"{$phpc_home_url}?action=display_week&amp;phpcid={$phpcid}&amp;week={$prev_week}&amp;year={$prev_year}\""), tag('span', attrs('class="fa fa-chevron-left"'), '')), $title, tag('a', attrs('class="phpc-icon-link"', "href=\"{$phpc_home_url}?action=display_week&amp;phpcid={$phpcid}&amp;week={$next_week}&amp;year={$next_year}\""), tag('span', attrs('class="fa fa-chevron-right"'), '')));
    return create_display_table($heading, create_week($from_stamp, $phpc_year, get_events($from_stamp, $to_stamp)));
}
开发者ID:hubandbob,项目名称:php-calendar,代码行数:40,代码来源:display_week.php


示例17: calendar_delete

function calendar_delete()
{
    global $vars, $phpcdb, $phpc_script;
    $html = tag('div', attributes('class="phpc-container"'));
    if (empty($vars["cid"])) {
        $html->add(tag('p', __('No calendar selected.')));
        return $html;
    }
    $id = $vars["cid"];
    $calendar = $phpcdb->get_calendar($id);
    if (empty($calendar)) {
        soft_error(__("Calendar does not exist") . ": {$id}");
    }
    if (!$calendar->can_admin()) {
        soft_error(__("You do not have permission to remove calendar") . ": {$id}");
    }
    if ($phpcdb->delete_calendar($id)) {
        $html->add(tag('p', __("Removed calendar") . ": {$id}"));
    } else {
        $html->add(tag('p', __("Could not remove calendar") . ": {$id}"));
    }
    return message_redirect($html, "{$phpc_script}?action=admin");
}
开发者ID:hubandbob,项目名称:php-calendar,代码行数:23,代码来源:calendar_delete.php


示例18: cadmin_submit

function cadmin_submit()
{
    global $phpcid, $phpc_cal, $vars, $phpcdb, $phpc_script;
    if (!$phpc_cal->can_admin()) {
        return tag('div', __('Permission denied'));
    }
    foreach (get_config_options() as $item) {
        if ($item[2] == PHPC_CHECK) {
            if (isset($vars[$item[0]])) {
                $value = "1";
            } else {
                $value = "0";
            }
        } else {
            if (isset($vars[$item[0]])) {
                $value = $vars[$item[0]];
            } else {
                soft_error($item[0] . __(" was not set."));
            }
        }
        $phpcdb->update_config($phpcid, $item[0], $value);
    }
    return message_redirect(__('Updated options'), "{$phpc_script}?action=cadmin&phpcid={$phpcid}");
}
开发者ID:php-calendar,项目名称:php-calendar,代码行数:24,代码来源:cadmin_submit.php


示例19: group_submit

function group_submit()
{
    global $vars, $phpcdb, $phpc_script, $phpc_cal;
    if (!isset($vars['gid'])) {
        $modify = false;
        if (!isset($vars['cid'])) {
            $cid = null;
            if (!is_admin()) {
                permission_error(__('You do not have permission to add a global group.'));
            }
        } else {
            $cid = $vars['cid'];
            $calendar = $phpcdb->get_calendar($cid);
            if (!$calendar->can_admin()) {
                permission_error(__('You do not have permission to add a group to this calendar.'));
            }
        }
        $gid = $phpcdb->create_group($cid, $vars["name"]);
    } else {
        $modify = true;
        $gid = $vars['gid'];
        $group = $phpcdb->get_group($gid);
        if (!(empty($group['cid']) && is_admin() || $phpcdb->get_calendar($group["cid"])->can_admin())) {
            soft_error(__("You do not have permission to modify this group."));
        }
        $phpcdb->modify_group($gid, $vars['name']);
    }
    $page = "{$phpc_script}?action=cadmin&phpcid=" . $vars['cid'];
    if ($modify) {
        return message_redirect(__("Modified group: ") . $gid, $page);
    }
    if ($gid > 0) {
        return message_redirect(__("Created group: ") . $gid, $page);
    }
    return tag('div', attributes('class="phpc-error"'), __('Error submitting group.'));
}
开发者ID:php-calendar,项目名称:php-calendar,代码行数:36,代码来源:group_submit.php


示例20: soft_error

    soft_error('No password found in your config file');
}
if (defined('SQL_DATABASE')) {
    $sql_database = SQL_DATABASE;
    echo "<p>Your SQL database name is: {$sql_database}</p>";
} else {
    soft_error('No database found in your config file');
}
if (defined('SQL_PREFIX')) {
    $sql_prefix = SQL_PREFIX;
    echo "<p>Your SQL table prefix is: {$sql_prefix}</p>";
} else {
    soft_error('No table prefix found in your config file');
}
if (defined('SQL_TYPE')) {
    $sql_type = SQL_TYPE;
} elseif (isset($dbms)) {
    $sql_type = $dbms;
} else {
    soft_error('No database type found in your config file');
}
echo "<p>Your database type is: {$sql_type}</p>";
// connect to the database
$db = NewADOConnection($sql_type);
$ok = $db->Connect($sql_host, $sql_user, $sql_passwd, $sql_database);
if (!$ok) {
    soft_error('Could not connect to the database');
}
$query = "ALTER TABLE " . SQL_PREFIX . "users\n\tADD admin tinyint(1) AFTER password;";
$db->Execute($query) or db_error("Error in alter", $query);
echo "<p>Database updated</p>";
开发者ID:noprom,项目名称:cryptdb,代码行数:31,代码来源:update10.php



注:本文中的soft_error函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP softfooter函数代码示例发布时间:2022-05-23
下一篇:
PHP socket_write函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap