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

PHP CFile类代码示例

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

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



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

示例1: saveFileAction

 function saveFileAction()
 {
     if (!($img = $_FILES['Filedata'])) {
         print json_encode(array('success' => false, 'text' => "Не получены данные", 'debug' => $_FILES['Filedata']));
         return false;
     }
     if (front::$_req["type"] == "img") {
         list($width, $height, $type, $attr) = getimagesize($img['tmp_name']);
         $ext = array('gif', 'jpeg', 'png');
         $ext_format = array('gif' => 1, 'jpeg' => 2, 'png' => 3);
         if ($type < 1 || $type > 3) {
             print json_encode(array('success' => false, 'text' => "Формат не поддерживается", 'debug' => $_FILES['Filedata']));
             return false;
         }
         if (front::$_req["width"] > 0 && $width > front::$_req["width"] || front::$_req["height"] > 0 && $height > front::$_req["height"]) {
             print json_encode(array('success' => false, 'text' => "Слишком большое разрешение", 'debug' => $_FILES['Filedata']));
             return false;
         }
     }
     $b_file = new CFile($_FILES['Filedata']);
     $b_file->max_size = 1048576;
     $b_file->server_root = 1;
     $f_name = $b_file->MoveUploadedFile("temp/");
     echo json_encode(array("success" => true, "id" => $f_name, "path" => WDCPREFIX . "/temp/" . $f_name));
 }
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:25,代码来源:page_admin_flash_upload.class.php


示例2: executeComponent

 function executeComponent()
 {
     $arFilter = array('IBLOCK_ID' => $this->arParams['IBLOCK_ID'], 'ACTIVE' => 'Y');
     if (true || $this->StartResultCache()) {
         $CIBlockElement = new CIBlockElement();
         $CFile = new \CFile();
         $aElts = array();
         $eltsSelectFields = array_merge(array('ID', 'NAME', 'CODE', 'PREVIEW_PICTURE', 'DETAIL_PICTURE', 'DETAIL_PAGE_URL'), $this->getIBlockProperties($this->arParams['IBLOCK_ID']));
         $rsElts = $CIBlockElement->GetList(array('SORT' => 'asc', 'date_active_from' => 'DESC'), $arFilter, false, false, array('ID', 'NAME'));
         if (intval($rsElts->SelectedRowsCount())) {
             while ($arElt = $rsElts->Fetch()) {
                 $aElts[] = array('ID' => $arElt['ID'], 'NAME' => $arElt['NAME']);
             }
             $arElt = $CIBlockElement->GetList(array('SORT' => 'asc', 'ID' => 'DESC'), array_merge($arFilter, array('ID' => $aElts[0]['ID'])), false, false, $eltsSelectFields)->GetNext();
             if ($arElt['DETAIL_PICTURE']) {
                 $arElt['DETAIL_PICTURE'] = $CFile->GetPath($arElt['DETAIL_PICTURE']);
             } elseif ($arElt['PREVIEW_PICTURE']) {
                 $arElt['DETAIL_PICTURE'] = $CFile->GetPath($arElt['PREVIEW_PICTURE']);
             }
             $arPrice = CPrice::GetList(array(), array("PRODUCT_ID" => $arElt['ID']))->Fetch();
             $arElt['PRICE'] = $arPrice['PRICE'];
             $this->arResult['ITEMS'] = $aElts;
             $this->arResult['ITEM'] = $arElt;
             $this->IncludeComponentTemplate();
         }
     }
 }
开发者ID:AlexPrya,项目名称:redvent.ru,代码行数:27,代码来源:class.php


示例3: process_event

 public function process_event(&$event)
 {
     if ($event->type == 'check' && $event->data['id']) {
         $file = new CFile($event->data['id']);
         $file->antivirus();
         if ($file->virus == 0) {
             $status = 'Clear.';
         } else {
             if ($file->virus == 1) {
                 $status = 'Infected. ' . $file->virusName . '.';
             } else {
                 if ($file->virus == 2) {
                     $status = 'Skipped by archive restrictions.';
                 } else {
                     if ($file->virus == 16) {
                         $status = 'No need check. Skipped.';
                     } else {
                         $status = 'Error.';
                     }
                 }
             }
         }
         $this->log->notice("File \"{$file->name}\" ({$file->table}) ({$file->id}). {$status}");
     }
     return PGQ_EVENT_OK;
 }
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:26,代码来源:antivirus.php


示例4: saveFileAction

 public function saveFileAction()
 {
     //die("1ssss");
     if (!($img = $_FILES['Filedata'])) {
         print json_encode(array('success' => false, 'text' => 'Не получены данные', 'debug' => $_FILES['Filedata']));
         return false;
     }
     if (front::$_req['type'] == 'img') {
         list($width, $height, $type, $attr) = getimagesize($img['tmp_name']);
         $ext = array('gif', 'jpeg', 'png');
         $ext_format = array('gif' => 1, 'jpeg' => 2, 'png' => 3);
         if ($type < 1 || $type > 3) {
             //   print(json_encode(array ('success' => false, 'text'=>"Формат не поддерживается", 'debug' => $_FILES['Filedata'])));
             //  return false;
         }
         if (front::$_req['width'] > 0 && $width > front::$_req['width'] || front::$_req['height'] > 0 && $height > front::$_req['height']) {
             print json_encode(array('success' => false, 'text' => 'Слишком большое разрешение', 'debug' => $_FILES['Filedata']));
             return false;
         }
     }
     $b_file = new CFile($_FILES['Filedata']);
     $b_file->max_size = 1048576;
     $b_file->server_root = 1;
     $f_name = $b_file->MoveUploadedFile('temp/');
     echo json_encode(array('success' => true, 'id' => $f_name, 'path' => WDCPREFIX . '/temp/' . $f_name, 'name' => $_FILES['Filedata']['name']));
 }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:26,代码来源:page_admin_flash_upload2.class.php


示例5: rotate

 /**
  *                                  
  */
 function rotate()
 {
     if (file_exists($this->_file) && filesize($this->_file) >= $this->_size * 1024 * 1024) {
         //                                                              ,
         //                       ,
         //
         $LockFileHandler = new CFile($this->_file . '.lock');
         $LockFileHandler->open('w');
         if (!$LockFileHandler->isError()) {
             $LockFileHandler->lock(LOCK_EX);
         }
         //                         ,                                  (               )
         //        $renames                          array(exists_files, new_file)
         //           new_file               ,      $renames
         //                     .
         //         ,        $renames                             :
         // array(
         //         array('/var/log/logfile', '/var/log/logfile.1'),
         //         array('/var/log/logfile.1', '/var/log/logfile.2'),
         //         array('/var/log/logfile.2', '/var/log/logfile.3'),
         // )
         //          :
         //    1.                ,                /var/log/logfile.3 -              ,              rename
         //    2.                                                     !
         $cnt = 1;
         $renames = array();
         $filename = $this->_file . '.' . $cnt;
         $cnt++;
         $renames[] = array($this->_file, $filename);
         while (file_exists($filename)) {
             $new_filename = $this->_file . '.' . $cnt;
             $cnt++;
             $renames[] = array($filename, $new_filename);
             $filename = $new_filename;
         }
         //           ,
         $removes = array();
         if (count($renames) > $this->_rotate) {
             $removes = array_slice($renames, $this->_rotate);
             $renames = array_slice($renames, 0, $this->_rotate);
         }
         //
         foreach ($removes as $f) {
             @unlink($f[0]);
         }
         //
         $renames = array_reverse($renames);
         foreach ($renames as $f) {
             rename($f[0], $f[1]);
         }
         //
         touch($this->_file);
         $LockFileHandler->unlock();
         $LockFileHandler->close();
     }
 }
开发者ID:KICHIRO20,项目名称:-Myproject_part1-,代码行数:59,代码来源:tracelogrotation.php


示例6: Del

 /**
  * Удалить отзыв
  *
  * @param  int $msg ID отзыва
  * @param  int $admin Является ли пользователь администратором 1 - да, 0 - нет (типа is_admin из stdf)
  * @return array сообщение об ошибке
  */
 function Del($msg, $admin = 0)
 {
     if (!$admin) {
         return 0;
     }
     if ($ret = $GLOBALS['DB']->val("DELETE FROM sopinions WHERE (id = ?) RETURNING logo", $msg)) {
         $file = new CFile();
         $file->Delete(0, "about/opinions/", $ret);
     }
     return $DB->error;
 }
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:18,代码来源:sopinions.php


示例7: index

 /**
  * parse file for indexing
  * @todo convert to using the FileSystem methods
  */
 public function index(CFile $file)
 {
     /* Workaround for indexing large files:
      ** Based on the value defined in config data,
      ** files with file_size greater than specified limit
      ** are not indexed for searching.
      ** Negative value :<=> no filesize limit
      */
     $index_max_file_size = w2PgetConfig('index_max_file_size', 0);
     if ($file->file_size > 0 && ($index_max_file_size < 0 || (int) $file->file_size <= $index_max_file_size * 1024)) {
         // get the parser application
         $parser = w2PgetConfig('parser_' . $file->file_type);
         if (!$parser) {
             $parser = w2PgetConfig('parser_default');
         }
         if (!$parser) {
             return false;
         }
         // buffer the file
         $file->_filepath = W2P_BASE_DIR . '/files/' . $file->file_project . '/' . $file->file_real_filename;
         if (file_exists($file->_filepath)) {
             $fp = fopen($file->_filepath, 'rb');
             $x = fread($fp, $file->file_size);
             fclose($fp);
             $ignore = w2PgetSysVal('FileIndexIgnoreWords');
             $ignore = $ignore['FileIndexIgnoreWords'];
             $ignore = explode(',', $ignore);
             $x = strtolower($x);
             $x = preg_replace("/[^A-Za-z0-9 ]/", "", $x);
             foreach ($ignore as $ignoreWord) {
                 $x = str_replace(" {$ignoreWord} ", ' ', $x);
             }
             $x = str_replace('  ', ' ', $x);
             $words = explode(' ', $x);
             foreach ($words as $index => $word) {
                 if ('' == trim($word)) {
                     continue;
                 }
                 $q = $this->query;
                 $q->addTable('files_index');
                 $q->addInsert('file_id', $file->file_id);
                 $q->addInsert('word', $word);
                 $q->addInsert('word_placement', $index);
                 $q->exec();
                 $q->clear();
             }
         } else {
             //TODO: if the file doesn't exist.. should we delete the db record?
         }
     }
     $file->file_indexed = 1;
     $file->store();
     return count($words);
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:58,代码来源:Indexer.class.php


示例8: delete

 public function delete(CFile $file)
 {
     $file->file_project = (int) $file->file_project;
     if ('' == $file->file_real_filename || !file_exists(W2P_BASE_DIR . '/files/' . $file->file_project . '/' . $file->file_real_filename)) {
         return true;
     }
     if ($file->canDelete()) {
         return @unlink(W2P_BASE_DIR . '/files/' . $file->file_project . '/' . $file->file_real_filename);
     }
     return false;
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:11,代码来源:Local.class.php


示例9: countUnsentDocItems

 /**
  * Count unsent document items
  *
  * @return void
  */
 function countUnsentDocItems()
 {
     $where["file_category_id"] = "= '{$this->_id}'";
     $where["etat_envoi"] = "!= 'oui'";
     $where["object_id"] = "IS NOT NULL";
     $file = new CFile();
     $this->_count_unsent_files = $file->countList($where);
     $document = new CCompteRendu();
     $this->_count_unsent_documents = $document->countList($where);
     $this->_count_unsent_doc_items = $this->_count_unsent_documents + $this->_count_unsent_files;
 }
开发者ID:fbone,项目名称:mediboard4,代码行数:16,代码来源:CFilesCategory.class.php


示例10: saveFile

 /**
  * Сохраняем документ на сайте.
  * 
  * @return \CFile
  */
 public function saveFile()
 {
     $login = 'admin';
     $content = $this->getOutput();
     $file = new CFile();
     $file->path = 'users/' . substr($login, 0, 2) . "/{$login}/upload/";
     $file->name = basename($file->secure_tmpname($file->path, '.odt'));
     $file->size = strlen($content);
     if ($file->putContent($file->path . $file->name, $content)) {
         return $file;
     }
 }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:17,代码来源:ODTDocument.php


示例11: viewattachExternal

 /**
  * Выводит икону и задданный внешний URL для определенного файла
  *
  * @param string  $ulogin   	Логин пользователя
  * @param string  $filename 	Имя файла 
  * @param string  $dir      	Папка файла
  * @param string  $url		 	Ссылка на файл
  * @param integer $bigtext  	Вместо иконкки будет большой текст расширения файла(TXT, PDF, etc...) если переменная принимает значение 1
  * @return string HTML-code
  */
 function viewattachExternal($ulogin, $filename, $dir, $url, $bigtext = 0)
 {
     $l_dir = substr($ulogin, 0, 2) . "/" . $ulogin;
     $cfile = new CFile("users/{$l_dir}/" . $dir . "/" . $filename);
     if (!$cfile->size) {
         return "";
     }
     $ext = $cfile->getext($filename);
     $ico = getICOFile($ext, true);
     echo $ico;
     $fsize = ConvertBtoMB($cfile->size);
     return '<p><img src="/pda/images/mime/' . $ico . '.png" alt="' . $ext . '" width="18" height="16"> <a href="' . $url . '" target="_blank">Скачать</a> | ' . ucfirst($ext) . ', ' . $fsize . ' </p>';
 }
开发者ID:amage,项目名称:fl-ru-damp,代码行数:23,代码来源:pda.php


示例12: deleteFiles

function deleteFiles($order_id, $types)
{
    $types = !is_array($types) ? array($types) : $types;
    $rows = CFile::selectFilesBySrc('file_reserves_order', $order_id);
    if (!$rows) {
        return 0;
    }
    foreach ($rows as $row) {
        if (!in_array($row['doc_type'], $types)) {
            continue;
        }
        $file = new CFile();
        $file->Delete($row['id']);
    }
}
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:15,代码来源:docs_update.php


示例13: editDoc

 /**
  * Редактировать документ.
  * 
  * @param array $doc     новые данные по документу.
  * @param array $old_doc старые данные по документу.
  *
  * @return bool успешно?
  */
 public function editDoc($doc, $old_doc)
 {
     $sql_data = $doc;
     $sql_data['name'] = pg_escape_string(change_q_x($sql_data['name']));
     $act_time = self::$docs_ss[$sql_data['status']][1];
     $file_set = $doc['file_id'] ? ", file_id = {$doc['file_id']}" : '';
     $sql_data['stage_id'] = $sql_data['stage_id'] ? (int) $sql_data['stage_id'] : 'NULL';
     $sql = "\n          UPDATE sbr_docs\n             SET name = '{$sql_data['name']}',\n                 status = {$sql_data['status']},\n                 access_role = {$sql_data['access_role']},\n                 stage_id = {$sql_data['stage_id']},\n                 {$act_time} = COALESCE({$act_time}, now()),\n                 type = {$sql_data['type']}\n                 {$file_set}\n           WHERE id = {$sql_data['id']}\n        ";
     $ok = $this->_eventQuery($sql);
     if ($ok && $file_set) {
         $cfile = new CFile();
         $cfile->Delete(0, $old_doc['file_path'], $old_doc['file_name']);
     }
     return $ok;
 }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:23,代码来源:sbr_adm.php


示例14: loadData

 private function loadData()
 {
     if (empty($this->arParams['PARAMS']['arUserField'])) {
         return array();
     }
     $userId = $this->getUser()->getId();
     $values = $this->arParams['PARAMS']['arUserField']['VALUE'];
     if (!is_array($this->arParams['PARAMS']['arUserField']['VALUE'])) {
         $values = array($values);
     }
     $urlManager = \Bitrix\Disk\Driver::getInstance()->getUrlManager();
     $versions = array();
     foreach ($values as $value) {
         $attachedObjectId = (int) $value;
         if ($attachedObjectId <= 0) {
             continue;
         }
         /** @var \Bitrix\Disk\AttachedObject $attachedModel */
         $attachedModel = \Bitrix\Disk\AttachedObject::loadById($attachedObjectId, array('VERSION.OBJECT'));
         if (!$attachedModel) {
             continue;
         }
         $version = $attachedModel->getVersion();
         if (!$version) {
             continue;
         }
         $extension = $version->getExtension();
         $versions[] = array('ID' => $attachedModel->getId(), 'NAME' => $version->getName(), 'CONVERT_EXTENSION' => DocumentHandler::isNeedConvertExtension($extension), 'EDITABLE' => DocumentHandler::isEditable($extension), 'CAN_UPDATE' => $attachedModel->canUpdate($userId), 'FROM_EXTERNAL_SYSTEM' => $version->getObject()->getContentProvider() && $version->getObject()->getCreatedBy() == $userId, 'EXTENSION' => $extension, 'SIZE' => \CFile::formatSize($version->getSize()), 'HISTORY_URL' => $urlManager->getUrlUfController('history', array('attachedId' => $attachedModel->getId())), 'DOWNLOAD_URL' => $urlManager->getUrlUfController('download', array('attachedId' => $attachedModel->getId())), 'COPY_TO_ME_URL' => $urlManager->getUrlUfController('copyTome', array('attachedId' => $attachedModel->getId())), 'VIEW_URL' => $urlManager->getUrlToShowAttachedFileByService($attachedModel->getId(), 'gvdrive'), 'EDIT_URL' => $urlManager->getUrlToStartEditUfFileByService($attachedModel->getId(), 'gdrive'), 'GLOBAL_CONTENT_VERSION' => $version->getGlobalContentVersion(), 'ATTRIBUTES_FOR_VIEWER' => Ui\Viewer::getAttributesByAttachedObject($attachedModel, array('version' => $version->getGlobalContentVersion(), 'canUpdate' => $attachedModel->canUpdate($userId), 'showStorage' => false, 'externalId' => false, 'relativePath' => false)));
     }
     unset($value);
     return $versions;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:32,代码来源:class.php


示例15: UnInstallDB

 function UnInstallDB($arParams = array())
 {
     global $DB, $APPLICATION;
     $errors = false;
     if (array_key_exists("savedata", $arParams) && $arParams["savedata"] != "Y") {
         $errors = $DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/support/install/db/' . strtolower($DB->type) . '/uninstall.sql');
         if (!is_array($errors)) {
             @set_time_limit(600);
             COption::RemoveOption('support');
             $db_res = $DB->Query("SELECT ID FROM b_file WHERE MODULE_ID = 'support'");
             while ($arRes = $db_res->Fetch()) {
                 CFile::Delete($arRes['ID']);
             }
             if ($arParams['admin'] == 'Y') {
                 $this->UnInstallEvents();
             }
         }
     }
     if (is_array($errors)) {
         $APPLICATION->ThrowException(implode(' ', $errors));
         return false;
     }
     CAgent::RemoveModuleAgents('support');
     UnRegisterModuleDependences('mail', 'OnGetFilterList', 'support', 'CSupportEMail', 'OnGetFilterList');
     UnRegisterModule('support');
     return true;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:27,代码来源:index.php


示例16: getInfo

 /**
  * Возвращаем данные столика
  * @param $arData
  * @return CDBResult|CIBlockResult|string
  */
 function getInfo($tableID, $arData = false, $GetNext = false)
 {
     $arFilterTable = array("IBLOCK_ID" => IB_TABLE_ID, "PROPERTY_CLUB" => $this->clubID, "ID" => intval($tableID));
     $arSelectTable = array("ID");
     $arOrderTable = array();
     $arOrder = is_array($arData["arSelect"]) ? array_merge($arData["arOrder"], $arOrderTable) : $arOrderTable;
     $arGroupBy = is_array($arData["arGroupBy"]) ? array_merge($arData["arGroupBy"], array()) : false;
     $arNavStartParams = is_array($arData["arGroupBy"]) ? array_merge($arData["arNavStartParams"], array()) : false;
     $arSelect = is_array($arData["arSelect"]) ? array_merge($arData["arSelect"], $arSelectTable) : $arSelectTable;
     $arFilter = is_array($arData["arFilter"]) ? array_merge($arData["arFilter"], $arFilterTable) : $arFilterTable;
     $res = CIBlockElement::GetList($arOrder, $arFilter, $arGroupBy, $arNavStartParams, $arSelect);
     if (!$res) {
         return Errors::run("404");
     }
     $ob = $GetNext ? $res->GetNext() : $res->Fetch();
     if (isset($ob["PREVIEW_PICTURE"])) {
         $arFile = CFile::GetFileArray($ob["PREVIEW_PICTURE"]);
         $ob["PREVIEW_PICTURE"] = $arFile["SRC"];
     }
     if (isset($ob["PROPERTY_PRICE_GROUP_VALUE"])) {
         $res = CIBlockElement::GetList(array(), array("ID" => intval($ob["PROPERTY_PRICE_GROUP_VALUE"]), "IBLOCK_ID" => IB_PRICE_GROUP), false, false, array("NAME", "ID", "PROPERTY_PRICE"));
         $ob["PROPERTY_PRICE_GROUP"] = $res->Fetch();
     }
     return $ob;
 }
开发者ID:nProfessor,项目名称:Mytb,代码行数:30,代码来源:Table.php


示例17: getCradoBaners

 /**
  * ’эндлер, отслеживающий изменени¤ в инфоблоках
  * @param $arFields
  * @return bool
  */
 static function getCradoBaners()
 {
     //$arResult = array();
     CModule::IncludeModule('iblock');
     global $DB;
     $result = $DB->Query('SELECT * FROM b_cradobaners');
     $arResult = array();
     $i = 0;
     while ($res = $result->fetch()) {
         $arResult[$i]['ID'] = $res['ID'];
         $arResult[$i]['COUNT_CLICK'] = $res['UF_COUNTCLICK'];
         $arResult[$i]['COUNT_VIEW'] = $res['UF_COUNTVIEW'];
         $arResult[$i]['DATE_LAST_CLICK'] = $res['UF_DATECLICK'];
         $obElement = CIBlockElement::GetByID($res['UF_IDBANERS']);
         if ($arEl = $obElement->GetNext()) {
             //$arResult[$i]['BANNER'] = $arEl;
             $arResult[$i]['BANNER']['ID'] = $arEl['ID'];
             $arResult[$i]['BANNER']['NAME'] = $arEl['NAME'];
             //Баннер в категории
             if ($arEl['PREVIEW_PICTURE'] != '') {
                 $arResult[$i]['BANNER']['BANNER_CATEGORY'] = CFile::ResizeImageGet($arEl['PREVIEW_PICTURE'], array('width' => 140, 'height' => 95), BX_RESIZE_IMAGE_PROPORTIONAL, true);
             }
             if ($arEl['DETAIL_PICTURE'] != '') {
                 $arResult[$i]['BANNER']['BANNER_ELEMENT'] = CFile::ResizeImageGet($arEl['DETAIL_PICTURE'], array('width' => 82, 'height' => 140), BX_RESIZE_IMAGE_PROPORTIONAL, true);
             }
         }
         $i++;
     }
     return $arResult;
 }
开发者ID:CheBurashka334,项目名称:crado,代码行数:35,代码来源:cCradoBaners.php


示例18: chooseFileIcoClass

	/**
	 * Choose picture dependence on type
	 */
	public function chooseFileIcoClass($id)
	{
		$fileInfo = \CFile::GetFileArray($id);
		if ($fileInfo["CONTENT_TYPE"] == PDF)
		{
			return "ico_pdf";
		}
		elseif ($fileInfo["CONTENT_TYPE"] == DOC)
		{
			return "ico_doc";
		}
		elseif ($fileInfo["CONTENT_TYPE"] == JPG)
		{
			return "ico_jpg";
		}
		elseif ($fileInfo["CONTENT_TYPE"] == ZIP)
		{
			return "ico_zip";
		}
		else
		{
			return "ico_cd";
		}
		throw new \Exception("An error wa occured in " . __CLASS__, 1);

	}
开发者ID:ASDAFF,项目名称:bitrix_tehnomir,代码行数:29,代码来源:Checker.php


示例19: Authorize

	public function Authorize()
	{
		$GLOBALS["APPLICATION"]->RestartBuffer();
		$bSuccess = false;

			if(isset($_REQUEST["code"]) && $_REQUEST["code"] <> '')
			{
				if(CSocServAuthManager::CheckUniqueKey())
				{
				$redirect_uri = CSocServUtil::GetCurUrl('auth_service_id='.self::ID, array("code"));

				$appID = self::GetOption("facebook_appid");
				$appSecret = self::GetOption("facebook_appsecret");

				$fb = new CFacebookInterface($appID, $appSecret, $_REQUEST["code"]);

				if($fb->GetAccessToken($redirect_uri) !== false)
				{
					$arFBUser = $fb->GetCurrentUser();
					if(isset($arFBUser["id"]))
					{
						$arFields = array(
							'EXTERNAL_AUTH_ID' => self::ID,
							'XML_ID' => $arFBUser["id"],
							'LOGIN' => "FB_".$arFBUser["email"],
							'EMAIL' => $arFBUser["email"],
							'NAME'=> $arFBUser["first_name"],
							'LAST_NAME'=> $arFBUser["last_name"],
						);

						if(isset($arFBUser['picture']['data']['url']) && self::CheckPhotoURI($arFBUser['picture']['data']['url']))
							if ($arPic = CFile::MakeFileArray($arFBUser['picture']['data']['url']))
								$arFields["PERSONAL_PHOTO"] = $arPic;
						if(isset($arFBUser['birthday']))
							if ($date = MakeTimeStamp($arFBUser['birthday'], "MM/DD/YYYY"))
								$arFields["PERSONAL_BIRTHDAY"] = ConvertTimeStamp($date);
						if(isset($arFBUser['gender']) && $arFBUser['gender'] != '')
						{
							if ($arFBUser['gender'] == 'male')
								$arFields["PERSONAL_GENDER"] = 'M';
							elseif ($arFBUser['gender'] == 'female')
								$arFields["PERSONAL_GENDER"] = 'F';
						}
						$arFields["PERSONAL_WWW"] = "http://www.facebook.com/".$arFBUser["id"];
						$bSuccess = $this->AuthorizeUser($arFields);
					}
				}
			}
		}
		$aRemove = array("logout", "auth_service_error", "auth_service_id", "code", "error_reason", "error", "error_description", "check_key");
		$url = $GLOBALS['APPLICATION']->GetCurPageParam(($bSuccess? '':'auth_service_id='.self::ID.'&auth_service_error=1'), $aRemove);
		echo '
<script type="text/javascript">
if(window.opener)
	window.opener.location = \''.CUtil::JSEscape($url).'\';
window.close();
</script>
';
		die();
	}
开发者ID:nProfessor,项目名称:Mytb,代码行数:60,代码来源:facebook.php


示例20: send

 /**
  * @param array $data
  * @return Main\Entity\AddResult
  */
 public static function send(array $data)
 {
     $manageCache = Application::getInstance()->getManagedCache();
     if (CACHED_b_event !== false && $manageCache->read(CACHED_b_event, "events")) {
         $manageCache->clean('events');
     }
     $arFiles = array();
     if (isset($data['FILE'])) {
         if (is_array($data['FILE'])) {
             $arFiles = $data['FILE'];
         }
         unset($data['FILE']);
     }
     $result = MailInternal\EventTable::add($data);
     if ($result->isSuccess()) {
         $id = $result->getId();
         foreach ($arFiles as $file) {
             $arFile = \CFile::MakeFileArray($file);
             $arFile["MODULE_ID"] = "main";
             $fid = \CFile::SaveFile($arFile, "main");
             $dataAttachment = array('EVENT_ID' => $id, 'FILE_ID' => $fid);
             MailInternal\EventAttachmentTable::add($dataAttachment);
         }
     }
     return $result;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:30,代码来源:event.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP CFileHelper类代码示例发布时间:2022-05-23
下一篇:
PHP CFactory类代码示例发布时间: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