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


PHP TextCleaner::decrypt方法代码示例

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


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

示例1: resize_images

function resize_images()
{
    global $xoopsUser, $xoopsLogger, $xoopsSecurity;
    set_time_limit(0);
    error_reporting(0);
    $xoopsLogger->activated = false;
    $params = rmc_server_var($_GET, 'data', '');
    $id = rmc_server_var($_GET, 'img', 0);
    if ($params == '') {
        send_error(__('Unauthorized!', 'rmcommon'));
    }
    if ($id <= 0) {
        send_error(__('Invalid image!', 'rmcommon'));
    }
    $params = TextCleaner::decrypt($params);
    $data = explode('|', $params);
    if ($data[0] != $xoopsUser->uid()) {
        send_error(__('Unauthorized!', 'rmcommon'));
    }
    if ($data[1] != RMCURL . '/images.php') {
        send_error(__('Unauthorized!', 'rmcommon'));
    }
    if (!$xoopsSecurity->check(false, $data[2])) {
        send_error(__('Unauthorized!', 'rmcommon'));
    }
    $image = new RMImage($id);
    if ($image->isNew()) {
        send_error(__('Image not found!', 'rmcommon'));
    }
    // Resize image
    $cat = new RMImageCategory($image->getVar('cat'));
    if (!$cat->user_allowed_toupload($xoopsUser)) {
        send_error(__('Unauthorized', 'rmcommon'));
    }
    $sizes = $cat->getVar('sizes');
    $updir = XOOPS_UPLOAD_PATH . '/' . date('Y', $image->getVar('date')) . '/' . date('m', time());
    $upurl = XOOPS_UPLOAD_URL . '/' . date('Y', $image->getVar('date')) . '/' . date('m', time());
    $width = 0;
    $tfile = '';
    foreach ($sizes as $size) {
        if ($size['width'] <= 0 && $size['height'] <= 0) {
            continue;
        }
        $fd = pathinfo($updir . '/' . $image->getVar('file'));
        $name = $updir . '/sizes/' . $fd['filename'] . '_' . $size['width'] . 'x' . $size['height'] . '.' . $fd['extension'];
        $sizer = new RMImageResizer($updir . '/' . $image->getVar('file'), $name);
        switch ($size['type']) {
            case 'crop':
                $sizer->resizeAndCrop($size['width'], $size['height']);
                break;
            default:
                if ($size['width'] <= 0 || $size['height'] <= 0) {
                    $sizer->resizeWidth($size['width']);
                } else {
                    $sizer->resizeWidthOrHeight($size['width'], $size['height']);
                }
                break;
        }
        if ($size['width'] <= $width || $width == 0) {
            $width = $size['width'];
            $tfile = str_replace(XOOPS_UPLOAD_PATH, XOOPS_UPLOAD_URL, $name);
        }
    }
    $ret['message'] = sprintf(__('%s done!', 'rmcommon'), $image->getVar('file'));
    $ret['done'] = 1;
    $ret['file'] = $tfile;
    $ret['title'] = $image->getVar('title');
    echo json_encode($ret);
    die;
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:70,代码来源:images.php

示例2: gs_resize_images

/**
* Resize images
*/
function gs_resize_images()
{
    global $xoopsUser, $xoopsLogger, $xoopsSecurity;
    set_time_limit(0);
    $mc = RMUtilities::module_config('galleries');
    $params = rmc_server_var($_GET, 'data', '');
    $id = rmc_server_var($_GET, 'img', 0);
    if ($params == '') {
        send_error(__('Unauthorized!', 'galleries'));
    }
    if ($id <= 0) {
        send_error(__('Invalid image!', 'galleries'));
    }
    $params = TextCleaner::decrypt($params);
    $data = explode('|', $params);
    if ($data[0] != $xoopsUser->uid()) {
        send_error(__('Unauthorized!', 'galleries'));
    }
    if ($data[1] != GS_URL . '/admin/images.php') {
        send_error(__('Unauthorized!', 'galleries'));
    }
    if (!$xoopsSecurity->check(false, $data[2])) {
        send_error(__('Unauthorized!', 'galleries'));
    }
    $image = new GSImage($id);
    if ($image->isNew()) {
        send_error(__('Image not found!', 'galleries'));
    }
    $thSize = $mc['image_ths'];
    $imgSize = $mc['image'];
    if ($thSize[0] <= 0) {
        $thSize[0] = 100;
    }
    if (!isset($thSize[1]) || $thSize[1] <= 0) {
        $thSize[1] = $thSize[0];
    }
    if ($imgSize[0] <= 0) {
        $imgSize[0] = 500;
    }
    if (!isset($imgSize[1]) || $imgSize[1] <= 0) {
        $imgSize[1] = $imgSize[0];
    }
    $xu = new GSUser($image->owner(), 1);
    $updir = rtrim($mc['storedir'], '/') . "/" . $xu->uname();
    $upurl = str_replace(XOOPS_ROOT_PATH, XOOPS_URL, $updir);
    $upths = rtrim($mc['storedir'], '/') . "/" . $xu->uname() . "/ths";
    $width = 0;
    $tfile = '';
    // Almacenamos la imágen original
    if ($mc['saveoriginal']) {
        copy($updir . '/' . $image->image(), $mc['storedir'] . '/originals/' . $image->image());
    }
    $fd = pathinfo($updir . '/' . $image->image());
    $filename = $image->image();
    $redim = new RMImageResizer($updir . '/' . $image->image(), $updir . '/' . $image->image());
    switch ($mc['redim_image']) {
        case 0:
            //Recortar miniatura
            $redim->resizeWidth($imgSize[0]);
            $redim->setTargetFile($upths . "/{$filename}");
            $redim->resizeAndCrop($thSize[0], $thSize[1]);
            break;
        case 1:
            //Recortar imagen grande
            $redim->resizeWidthOrHeight($imgSize[0], $imgSize[1]);
            $redim->setTargetFile($upths . "/" . $image->image());
            $redim->resizeWidth($thSize[0]);
            break;
        case 2:
            //Recortar ambas
            $redim->resizeWidthOrHeight($imgSize[0], $imgSize[1]);
            $redim->setTargetFile($upths . "/{$filename}");
            $redim->resizeAndCrop($thSize[0], $thSize[1]);
            break;
        case 3:
            //Redimensionar
            $redim->resizeWidth($imgSize[0]);
            $redim->setTargetFile($upths . "/{$filename}");
            $redim->resizeWidth($thSize[0]);
            break;
    }
    $tfile = $upurl . '/ths/' . $image->image();
    $ret['message'] = sprintf(__('%s done!', 'galleries'), $image->image());
    $ret['done'] = 1;
    $ret['file'] = $tfile;
    $ret['title'] = $image->image();
    echo json_encode($ret);
    die;
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:92,代码来源:upload.php


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