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


PHP waFiles::readFile方法代码示例

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


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

示例1: execute

 public function execute()
 {
     $name = basename(waRequest::get('file', 'export.csv'));
     $profile = waRequest::get('profile', 0, waRequest::TYPE_INT);
     $file = wa()->getTempPath('csv/download/' . $profile . '/' . $name);
     waFiles::readFile($file, $name);
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:7,代码来源:shopCsvProductdownload.controller.php

示例2: execute

 public function execute()
 {
     $path = null;
     $photo_rights_model = new photosPhotoRightsModel();
     $photo_id = waRequest::get('photo_id', null, waRequest::TYPE_INT);
     if ($photo_rights_model->checkRights($photo_id, true)) {
         $photo_model = new photosPhotoModel();
         if ($photo = $photo_model->getById($photo_id)) {
             if (waRequest::get('original')) {
                 $path = photosPhoto::getOriginalPhotoPath($photo);
             } else {
                 $path = photosPhoto::getPhotoPath($photo);
             }
         }
     }
     if ($path) {
         if ($attach = waRequest::get('attach') ? true : false) {
             $response = $this->getResponse();
             $response->addHeader('Expires', 'tomorrow');
             $response->addHeader('Cache-Control', ($photo['status'] == 1 ? 'public' : 'private') . ', max-age=' . 86400 * 30);
         }
         waFiles::readFile($path, $attach ? null : basename($photo['name'] . '.' . $photo['ext']), true, !$attach);
     } else {
         throw new waException(_w("Photo not found"), 404);
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:26,代码来源:photosPhotoDownload.controller.php

示例3: execute

 public function execute()
 {
     $filepath = wa()->getCachePath('plugins/discountcards/export-discountcards.csv', 'shop');
     if (!file_exists($filepath)) {
         throw new waException(_ws("Page not found"), 404);
     }
     waFiles::readFile($filepath, 'export-discountcards.csv');
 }
开发者ID:klxqz,项目名称:discountcards,代码行数:8,代码来源:shopDiscountcardsPluginDownload.controller.php

示例4: execute

 public function execute()
 {
     $app_id = $this->getRequest()->get('app');
     $path = $this->getRequest()->get('path');
     if ($this->getRequest()->get('temp')) {
         $file = waSystem::getInstance()->getTempPath($path, $app_id);
     } else {
         $file = waSystem::getInstance()->getDataPath($path, false, $app_id);
     }
     waFiles::readFile($file);
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:11,代码来源:webasystBackendData.controller.php

示例5: execute

 public function execute()
 {
     $path = rtrim(waRequest::get('path'), ' /');
     $path = wa()->getDataPath($path, true, null, false);
     $file = waRequest::get('file');
     $path .= '/' . $file;
     if (file_exists($path) && is_file($path) && !in_array(waFiles::extension($path, array('php', 'phtml')))) {
         waFiles::readFile($path, $file);
     } else {
         throw new waException("File not found", 404);
     }
 }
开发者ID:nowaym,项目名称:webasyst-framework,代码行数:12,代码来源:siteFilesDownload.controller.php

示例6: execute

 public function execute()
 {
     $path = waRequest::get('path');
     $full_path = logsHelper::getAbsolutePath($path);
     $available = logsHelper::checkPath($full_path, false);
     if ($available) {
         $file_name = basename($full_path);
         waFiles::readFile($full_path, $file_name);
     } else {
         $this->redirect(wa()->getAppUrl());
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:12,代码来源:logsBackendDownload.controller.php

示例7: photoAction

 /**
  * Userpic
  */
 public function photoAction()
 {
     $id = (int) waRequest::get('id');
     if (!$id) {
         $id = $this->getUser()->getId();
     }
     $contact = new waContact($id);
     $rand = $contact['photo'];
     $file = wa()->getDataPath("photo/{$id}/{$rand}.original.jpg", TRUE, 'contacts');
     $size = waRequest::get('size');
     if (!file_exists($file)) {
         $size = (int) $size;
         if (!in_array($size, array(20, 32, 50, 96))) {
             $size = 96;
         }
         waFiles::readFile($this->getConfig()->getRootPath() . '/wa-content/img/userpic' . $size . '.jpg');
     } else {
         // original file
         if ($size == 'original') {
             waFiles::readFile($file);
         } elseif ($size == 'full') {
             $file = str_replace('.original.jpg', '.jpg', $file);
             waFiles::readFile($file);
         } else {
             if (!$size) {
                 $size = '96x96';
             }
             $size_parts = explode('x', $size, 2);
             $size_parts[0] = (int) $size_parts[0];
             if (!isset($size_parts[1])) {
                 $size_parts[1] = $size_parts[0];
             } else {
                 $size_parts[1] = (int) $size_parts[1];
             }
             if (!$size_parts[0] || !$size_parts[1]) {
                 $size_parts = array(96, 96);
             }
             $size = $size_parts[0] . 'x' . $size_parts[1];
             $thumb_file = str_replace('.original.jpg', '.' . $size . '.jpg', $file);
             $file = str_replace('.original.jpg', '.jpg', $file);
             if (!file_exists($thumb_file) || filemtime($thumb_file) < filemtime($file)) {
                 waImage::factory($file)->resize($size_parts[0], $size_parts[1])->save($thumb_file);
                 clearstatcache();
             }
             waFiles::readFile($thumb_file);
         }
     }
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:51,代码来源:webasystBackend.actions.php

示例8: execute

 public function execute()
 {
     $id = waRequest::get('id', 0, waRequest::TYPE_INT);
     if (!$id) {
         throw new waException(_w("Image not found"), 404);
     }
     $product_images_model = new shopProductImagesModel();
     $image = $product_images_model->getById($id);
     if (!$image) {
         throw new waException(_w("Image not found"), 404);
     }
     if (waRequest::get('original')) {
         $path = shopImage::getOriginalPath($image);
     } else {
         $path = shopImage::getPath($image);
     }
     if (!$path || !file_exists($path)) {
         throw new waException(_w("Image not found"), 404);
     }
     waFiles::readFile($path, "Image_{$image['product_id']}_{$image['id']}.{$image['ext']}", true, true);
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:21,代码来源:shopProductImageDownload.controller.php

示例9: execute

 public function execute()
 {
     $encoded_order_id = waRequest::param('id');
     $order_id = shopHelper::decodeOrderId($encoded_order_id);
     if (!$order_id) {
         // fall back to non-encoded id
         $order_id = $encoded_order_id;
         $encoded_order_id = shopHelper::encodeOrderId($order_id);
     }
     $om = new shopOrderModel();
     $order = $om->getOrder($order_id);
     if (!$order) {
         throw new waException(_w('Order not found'), 404);
     }
     if (!$this->isAuth($order)) {
         throw new waException(_w('The file will be available for download after the order is paid and processed.'), 404);
     }
     // Check auth code
     $opm = new shopOrderParamsModel();
     $params = $opm->get($order_id);
     $code = waRequest::param('code');
     if (ifset($params['auth_code']) !== $code) {
         throw new waException(_w('Order not found'), 404);
     }
     if ($item = ifempty($order['items'][waRequest::param('item')])) {
         $skus_model = new shopProductSkusModel();
         $sku = $skus_model->getById(ifempty($item['sku_id']));
         if ($sku['file_name'] && $sku['file_size']) {
             $file_path = shopProductSkusModel::getPath($sku);
             waFiles::readFile($file_path, $sku['file_name']);
         } else {
             throw new waException(_w('File not found'), 404);
         }
     } else {
         throw new waException(_w('Order item not found'), 404);
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:37,代码来源:shopFrontendMyOrderDownload.action.php

示例10: unset

        }
        unset($s);
        $size = implode('x', $size);
    }
}
wa()->getStorage()->close();
if ($file && file_exists($protected_path . $file) && !file_exists($public_path . $request_file)) {
    $main_thumb_file_path = $public_path . $main_thumb_file;
    $target_dir_path = dirname($public_path . $request_file);
    if (!file_exists($target_dir_path)) {
        waFiles::create($target_dir_path . '/');
    }
    $max_size = $app_config->getOption('max_size');
    $image = photosPhoto::generateThumb(array('path' => $main_thumb_file_path, 'size' => $main_thumbnail_size), $protected_path . $file, $size, $app_config->getOption('sharpen'), $max_size ? $enable_2x ? 2 * $max_size : $max_size : false);
    if ($image) {
        $quality = $app_config->getSaveQuality($enable_2x);
        $image->save($public_path . $request_file, $quality);
        clearstatcache();
    }
}
if ($file && file_exists($public_path . $request_file)) {
    waFiles::readFile($public_path . $request_file);
} else {
    /*
    $url = wa()->getRootUrl();
    $url = substr($url, 0, -strlen('/wa-data/public/photo/'));
    header("Location: ".$url."wa-apps/photos/img/image-not-found.png");
    */
    header("HTTP/1.0 404 Not Found");
    exit;
}
开发者ID:Lazary,项目名称:webasyst,代码行数:31,代码来源:thumb.php

示例11: dtdAction

 public function dtdAction()
 {
     waFiles::readFile(shopYandexmarketPlugin::path('shops.dtd'));
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:4,代码来源:shopYandexmarketPluginFrontend.actions.php

示例12: themeDownloadAction

 public function themeDownloadAction()
 {
     $theme_id = waRequest::get('theme');
     $theme = new waTheme($theme_id, $this->getAppId());
     $this->logAction('theme_download', $theme_id);
     $target_file = $theme->compress(wa()->getTempPath("themes"));
     waFiles::readFile($target_file, basename($target_file), false);
     waFiles::delete($target_file);
     $this->displayJson(array());
 }
开发者ID:niva79,项目名称:webasyst-framework,代码行数:10,代码来源:waDesign.actions.php

示例13: execute

 public function execute()
 {
     $installer = new waInstaller();
     waFiles::readFile($installer->getLogPath(), 'update.txt');
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:5,代码来源:installerUpdateDownloadlog.controller.php

示例14: header

if (count($file) != 4) {
    header("Location: {$root_url}wa-content/img/userpic96.jpg");
    exit;
}
$request_file = $file[3];
$contact_id = (int) $file[2];
$file = explode(".", $file[3]);
if (!$contact_id || count($file) != 3) {
    header("Location: {$root_url}wa-content/img/userpic96.jpg");
    exit;
}
$size = explode("x", $file[1]);
if (count($size) != 2 || !$size[0] || !$size[1]) {
    header("Location: {$root_url}wa-content/img/userpic96.jpg");
    exit;
}
$file = $file[0] . ".jpg";
$path = wa()->getDataPath(waContact::getPhotoDir($contact_id), true, 'contacts', false);
$filepath = "{$path}{$file}";
if (!file_exists($filepath)) {
    header("Location: {$root_url}wa-content/img/userpic96.jpg");
    exit;
}
if ($size[0] == $size[1]) {
    waImage::factory($filepath)->resize($size[0], $size[1])->save($path . $request_file);
} else {
    waImage::factory($filepath)->resize($size[0], $size[1], waImage::INVERSE)->crop($size[0], $size[1])->save($path . $request_file);
}
clearstatcache();
waFiles::readFile($path . $request_file);
开发者ID:Favorskij,项目名称:webasyst-framework,代码行数:30,代码来源:thumb.php

示例15: foreach

        foreach ($size as &$s) {
            $s *= 2;
        }
        unset($s);
        $size = implode('x', $size);
    }
}
wa()->getStorage()->close();
$original_path = $protected_path . $file;
$thumb_path = $public_path . $request_file;
if ($file && file_exists($original_path) && !file_exists($thumb_path)) {
    $thumbs_dir = dirname($thumb_path);
    if (!file_exists($thumbs_dir)) {
        waFiles::create($thumbs_dir);
    }
    $max_size = $app_config->getOption('image_max_size');
    if ($max_size && $enable_2x) {
        $max_size *= 2;
    }
    $image = shopImage::generateThumb($original_path, $size, $max_size);
    if ($image) {
        $image->save($thumb_path, $app_config->getSaveQuality($enable_2x));
        clearstatcache();
    }
}
if ($file && file_exists($thumb_path)) {
    waFiles::readFile($thumb_path);
} else {
    header("HTTP/1.0 404 Not Found");
    exit;
}
开发者ID:Lazary,项目名称:webasyst,代码行数:31,代码来源:thumb.php


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