当前位置: 首页>>代码示例>>PHP>>正文


PHP payed::freezeProCancel方法代码示例

本文整理汇总了PHP中payed::freezeProCancel方法的典型用法代码示例。如果您正苦于以下问题:PHP payed::freezeProCancel方法的具体用法?PHP payed::freezeProCancel怎么用?PHP payed::freezeProCancel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在payed的用法示例。


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

示例1: freezePro

function freezePro($action, $from_date, $to_date)
{
    global $uid;
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/payed.php';
    $objResponse = new xajaxResponse();
    $last_freeze = payed::getLastFreeze($uid);
    $last_freeze_id = null;
    $freeze_allow = false;
    $freeze_set = false;
    $freezed_now = false;
    $freezed_alert = false;
    $freeze_act = 'freeze';
    $from_time = $to_time = time();
    $location = substr($_SESSION['role'], 0, 1) == 1 ? '/payed-emp/' : '/payed/';
    if ($last_freeze) {
        $last_freeze_id = $last_freeze['id'];
        $from_time = strtotime($last_freeze['from_time_date']);
        $to_time = strtotime($last_freeze['to_time_date']);
        if (ceil($last_freeze['freezed_days'] / 7) < 4 && $last_freeze['freezed_cnt'] < 4) {
            $freeze_allow = true;
        } else {
            $freezed_alert = true;
        }
        if ($from_time > time()) {
            $freeze_set = true;
            $freezed_alert = false;
            $freeze_act = 'freeze_cancel';
        }
        if ($from_time <= time() && strtotime($last_freeze['to_time']) > time()) {
            $freezed_now = true;
            $freezed_alert = false;
            $freeze_act = 'freeze_stop';
        }
    } elseif (is_pro()) {
        $freeze_allow = true;
        $from_time += 24 * 3600;
        $to_time += 24 * 3600;
    }
    $from_time = date('Y-m-d', $from_time);
    $to_time = date('Y-m-d', $to_time);
    //if (date('Ymd', strtotime($_SESSION['pro_last'])) == date('Ymd'))
    //@todo: выключаем возможность заморозки
    //https://beta.free-lance.ru/mantis/view.php?id=29292
    $freeze_allow = false;
    if ($action == 'freeze' && $freeze_allow) {
        $fstart = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y'));
        if ($from_date && $to_date && strtotime($from_date) >= $fstart) {
            if ($to_date != 1 && $to_date != 2 && $to_date != 3 && $to_date != 4) {
                $to_date = 1;
            }
            //if ($to_date == 2 && ceil($last_freeze['freezed_days'] / 7) == 1) {
            //    $to_date = 1;
            //}
            $ft = strtotime($from_date);
            $freeze_days = (int) $to_date * 7;
            $to_date = date('Y-m-d', mktime(0, 0, 0, date('m', $ft), date('d', $ft) + intval($to_date) * 7, date('Y', $ft)));
            payed::freezePro($uid, $from_date, $to_date);
            $from_time = $from_date;
            $to_time = $to_date;
            $freeze_set = true;
            $freeze_act = 'freeze_cancel';
            $pro_last = payed::ProLast($_SESSION['login']);
            if ($pro_last['freeze_to']) {
                $_SESSION['freeze_from'] = $pro_last['freeze_from'];
                $_SESSION['freeze_to'] = $pro_last['freeze_to'];
                $_SESSION['is_freezed'] = $pro_last['is_freezed'];
                $_SESSION['payed_to'] = $pro_last['cnt'];
            }
            $_SESSION['pro_last'] = $pro_last['is_freezed'] ? false : $pro_last['cnt'];
            $text = 'Ваш аккаунт будет заморожен с <b>' . date('d.m.Y', strtotime($from_date)) . "</b> на <b>{$freeze_days} дней</b>";
            $objResponse->call('freezeDisabled', $freeze_act);
            $objResponse->assign('freeze_info', 'innerHTML', $text);
        } elseif (strtotime($from_date) > strtotime($_SESSION['pro_last']) || strtotime($from_date) < $fstart) {
            $freeze_error = 'Неверная дата начала заморозки.';
        } else {
            $freeze_error = 'Ошибка, не указана одна из дат.';
        }
    }
    if ($action == 'freeze_cancel' && $freeze_set) {
        if (!payed::freezeProCancel($uid, $last_freeze_id)) {
            $freeze_error = 'Невозможно отменить заморозку.';
        } else {
            $freeze_set = false;
            $freeze_allow = true;
            $from_time = $to_time = date('Y-m-d', time() + 24 * 3600);
            $_SESSION['pro_last'] = payed::ProLast($_SESSION['login']);
            if (isset($_SESSION['freeze_from'])) {
                unset($_SESSION['freeze_from']);
            }
            if (isset($_SESSION['freeze_to'])) {
                unset($_SESSION['freeze_to']);
            }
            if (isset($_SESSION['is_freezed'])) {
                unset($_SESSION['is_freezed']);
            }
            $_SESSION['pro_last'] = $_SESSION['pro_last']['is_freezed'] ? false : $_SESSION['pro_last']['cnt'];
            $objResponse->call('freezeEnabled', strtotime('+1 day') * 1000);
        }
    }
    if ($action == 'freeze_stop' && $freezed_now) {
//.........这里部分代码省略.........
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:101,代码来源:professions.server.php

示例2: header_location_exit

        if ($pro_last['freeze_to']) {
            $_SESSION['freeze_from'] = $pro_last['freeze_from'];
            $_SESSION['freeze_to'] = $pro_last['freeze_to'];
            $_SESSION['is_freezed'] = $pro_last['is_freezed'];
            $_SESSION['payed_to'] = $pro_last['cnt'];
        }
        $_SESSION['pro_last'] = $pro_last['is_freezed'] ? false : $pro_last['cnt'];
        header_location_exit($location);
    } elseif (strtotime($from_date) > strtotime($_SESSION['pro_last']) || strtotime($from_date) < $fstart) {
        $freeze_error = 'Неверная дата начала заморозки.';
    } else {
        $freeze_error = 'Ошибка, не указана одна из дат.';
    }
}
if ($action == 'freeze_cancel' && $freeze_set) {
    if (!payed::freezeProCancel($uid, $last_freeze_id)) {
        $freeze_error = 'Невозможно отменить заморозку.';
    } else {
        $freeze_set = false;
        $freeze_allow = true;
        $from_time = $to_time = date('Y-m-d', time() + 24 * 3600);
        $_SESSION['pro_last'] = payed::ProLast($_SESSION['login']);
        if (isset($_SESSION['freeze_from'])) {
            unset($_SESSION['freeze_from']);
        }
        if (isset($_SESSION['freeze_to'])) {
            unset($_SESSION['freeze_to']);
        }
        if (isset($_SESSION['is_freezed'])) {
            unset($_SESSION['is_freezed']);
        }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:31,代码来源:freeze.php


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