Esempio n. 1
0
	function mfi_format_line($arValue, $uid, $controlNameFull)
	{
		$result = '';

		if (is_array($arValue) && sizeof($arValue) > 0)
		{
			ob_start();
			foreach ($arValue as $arElement)
			{
				$elementID = intval($arElement['ID']);
?>
				<tr class="file-inline-file" id="wd-doc<?php 
echo $elementID;
?>
">
					<td class="files-name">
						<span class="files-text">
							<span class="f-wrap"><?php 
echo htmlspecialcharsEx($arElement['ORIGINAL_NAME']);
?>
</span>
						</span>
					</td>
					<td class="files-size"><?php 
echo CFile::FormatSize($arElement["FILE_SIZE"]);
?>
</td>
					<td class="files-storage">
						<div class="files-storage-block">&nbsp;
							<span class='del-but' onclick="BfileFD<?php 
echo $uid;
?>
.agent.StopUpload(BX('wd-doc<?php 
echo $elementID;
?>
'));"></span>
							<span class="files-placement"><?/*=htmlspecialcharsEx($title)*/?></span>
							<input id="file-doc<?php 
echo $elementID;
?>
" type="hidden" name="<?php 
echo htmlspecialcharsbx($controlNameFull);
?>
" value="<?php 
echo $elementID;
?>
" />
						</div>
					</td>
				</tr>
<?
			}
			$result = ob_get_clean();
		}

		return $result;
	}
Esempio n. 2
0
 function GetInfoHTML($params = array())
 {
     $html = '';
     if (is_array($this->_file)) {
         $intWidth = $this->_width;
         $intHeight = $this->_height;
         $img_src = '';
         $divId = '';
         if (isset($params['url_template']) && $intWidth > 0 && $intHeight > 0) {
             $img_src = $this->GetImgSrc(array('url_template' => $params['url_template']));
             if ($img_src) {
                 CUtil::InitJSCore(array("viewer"));
                 self::$_counter++;
                 $divId = 'lists-image-info-' . self::$_counter;
             }
         }
         if ($divId) {
             $html .= '<div id="' . $divId . '">';
         } else {
             $html .= '<div>';
         }
         if (isset($params['view']) && $params['view'] == 'short') {
             $info = $this->_file["FILE_NAME"] . ' (';
             if ($intWidth > 0 && $intHeight > 0) {
                 $info .= $intWidth . 'x' . $intHeight . ', ';
             }
             $info .= CFile::FormatSize($this->_file['FILE_SIZE']) . ')';
             if ($divId) {
                 $html .= GetMessage('FILE_TEXT') . ': <span style="cursor:pointer" data-bx-viewer="image" data-bx-src="' . htmlspecialcharsbx($img_src) . '">' . htmlspecialcharsex($info) . '</span>';
             } else {
                 $html .= GetMessage('FILE_TEXT') . ': ' . htmlspecialcharsex($info);
             }
         } else {
             if ($divId) {
                 $html .= GetMessage('FILE_TEXT') . ': <span style="cursor:pointer" data-bx-viewer="image" data-bx-src="' . htmlspecialcharsbx($img_src) . '">' . htmlspecialcharsex($this->_file["FILE_NAME"]) . '</span>';
             } else {
                 $html .= GetMessage('FILE_TEXT') . ': ' . htmlspecialcharsex($this->_file["FILE_NAME"]);
             }
             /*if($intWidth > 0 && $intHeight > 0)
             		{
             			$html .= '<br>'.GetMessage('FILE_WIDTH').': '.$intWidth;
             			$html .= '<br>'.GetMessage('FILE_HEIGHT').': '.$intHeight;
             		}*/
             $html .= '<br>' . GetMessage('FILE_SIZE') . ': ' . CFile::FormatSize($this->_file['FILE_SIZE']);
         }
         if ($divId) {
             $html .= '</div><script>BX.ready(function(){BX.viewElementBind("' . $divId . '");});</script>';
         } else {
             $html .= '</div>';
         }
     }
     return $html;
 }
Esempio n. 3
0
 function GetInfoHTML()
 {
     $html = '';
     if (is_array($this->_file)) {
         $html .= GetMessage('FILE_TEXT') . ': ' . htmlspecialcharsex($this->_file["FILE_NAME"]);
         $intWidth = $this->_width;
         $intHeight = $this->_height;
         if ($intWidth > 0 && $intHeight > 0) {
             $html .= '<br>' . GetMessage('FILE_WIDTH') . ': ' . $intWidth;
             $html .= '<br>' . GetMessage('FILE_HEIGHT') . ': ' . $intHeight;
         }
         $html .= '<br>' . GetMessage('FILE_SIZE') . ': ' . CFile::FormatSize($this->_file['FILE_SIZE']);
     }
     return $html;
 }
Esempio n. 4
0
    function __blogUFfileShowMobile($arResult, $arParams)
    {
        $result = false;
        if ($arParams['arUserField']['FIELD_NAME'] == 'UF_BLOG_POST_DOC' || strpos($arParams['arUserField']['FIELD_NAME'], 'UF_BLOG_COMMENT_DOC') === 0) {
            if (sizeof($arResult['VALUE']) > 0) {
                ?>
<div class="post-item-attached-file-wrap"><?php 
                foreach ($arResult['VALUE'] as $fileID) {
                    $arFile = CFile::GetFileArray($fileID);
                    if ($arFile) {
                        $name = $arFile['ORIGINAL_NAME'];
                        $ext = '';
                        $dotpos = strrpos($name, ".");
                        if ($dotpos !== false && $dotpos + 1 < strlen($name)) {
                            $ext = substr($name, $dotpos + 1);
                        }
                        if (strlen($ext) < 3 || strlen($ext) > 5) {
                            $ext = '';
                        }
                        $arFile['EXTENSION'] = $ext;
                        $arFile['LINK'] = SITE_DIR . "mobile/ajax.php?mobile_action=blog_image&bp_fid=" . $fileID;
                        $arFile["FILE_SIZE"] = CFile::FormatSize($arFile["FILE_SIZE"]);
                        ?>
<div class="post-item-attached-file"><?php 
                        ?>
<a onclick="app.openDocument({'url' : '<?php 
                        echo $arFile['LINK'];
                        ?>
'});" href="javascript:void()" class="post-item-attached-file-link"><span><?php 
                        echo htmlspecialcharsbx($arFile['ORIGINAL_NAME']);
                        ?>
</span><span>(<?php 
                        echo $arFile['FILE_SIZE'];
                        ?>
)</span></a><?php 
                        ?>
</div><?php 
                    }
                }
                ?>
</div><?php 
            }
            $result = true;
        }
        return $result;
    }
Esempio n. 5
0
 public static function getFileInfo($fileID, $checkPermissions = true)
 {
     if (!Loader::includeModule('disk')) {
         return null;
     }
     $fileID = (int) $fileID;
     if ($fileID <= 0) {
         return null;
     }
     /** @var File $file */
     $file = File::loadById($fileID);
     if (!$file) {
         return null;
     }
     $canRead = true;
     if ($checkPermissions) {
         $canRead = $file->canRead($file->getStorage()->getSecurityContext(\CCrmSecurityHelper::getCurrentUserID()));
     }
     return array('ID' => $fileID, 'NAME' => $file->getName(), 'SIZE' => \CFile::FormatSize($file->getSize()), 'CAN_READ' => $canRead, 'VIEW_URL' => $canRead ? Driver::getInstance()->getUrlManager()->getUrlForDownloadFile($file) : '');
 }
Esempio n. 6
0
 /**
  * @param array $fileData
  * @param string $siteID
  * @return array|null
  */
 public static function getFileInfo($fileID, $storageTypeID = 0, $checkPermissions = true, $options = null)
 {
     if (!is_integer($storageTypeID)) {
         $storageTypeID = (int) $storageTypeID;
     }
     if (!StorageType::isDefined($storageTypeID)) {
         $storageTypeID = StorageType::getDefaultTypeID();
     }
     if ($storageTypeID === StorageType::Disk) {
         return DiskManager::getFileInfo($fileID, $checkPermissions, $options);
     } elseif ($storageTypeID === StorageType::WebDav) {
         return \CCrmWebDavHelper::getElementInfo($fileID, $checkPermissions);
     } elseif ($storageTypeID === StorageType::File) {
         $fileInfo = \CFile::GetFileArray($fileID);
         if (!is_array($fileInfo)) {
             return null;
         }
         return array('ID' => $fileID, 'NAME' => isset($fileInfo['ORIGINAL_NAME']) ? $fileInfo['ORIGINAL_NAME'] : $fileID, 'SIZE' => \CFile::FormatSize($fileInfo['FILE_SIZE'] ? $fileInfo['FILE_SIZE'] : 0), 'VIEW_URL' => isset($fileInfo['SRC']) ? $fileInfo['SRC'] : '');
     }
     throw new Main\NotSupportedException("Storage type: '{$storageTypeID}' is not supported in current context");
 }
Esempio n. 7
0
    function OnCommentFormDisplay()
    {
        $arResult =& $this->component->arResult;
        $arParams =& $this->component->arParams;
        ob_start();
        ?>
		<div class="comments-reply-field comments-reply-field-upload">
<?php 
        if (!empty($arResult["REVIEW_FILES"])) {
            foreach ($arResult["REVIEW_FILES"] as $key => $val) {
                $iCount++;
                $sFileSize = CFile::FormatSize(intval($val["FILE_SIZE"]));
                ?>
					<div class="comments-uploaded-file">
						<input type="hidden" name="FILES[<?php 
                echo $key;
                ?>
]" value="<?php 
                echo $key;
                ?>
" />
						<input type="checkbox" name="FILES_TO_UPLOAD[<?php 
                echo $key;
                ?>
]" id="FILES_TO_UPLOAD_<?php 
                echo $key;
                ?>
" value="<?php 
                echo $key;
                ?>
" checked="checked" />
						<label for="FILES_TO_UPLOAD_<?php 
                echo $key;
                ?>
"><?php 
                echo $val["ORIGINAL_NAME"];
                ?>
 (<?php 
                echo $val["CONTENT_TYPE"];
                ?>
) <?php 
                echo $sFileSize;
                ?>
							( <a href="/bitrix/components/bitrix/forum.interface/show_file.php?action=download&amp;fid=<?php 
                echo $key;
                ?>
"><?php 
                echo GetMessage("F_DOWNLOAD");
                ?>
</a> )
						</label>
					</div>
<?php 
            }
        }
        $iFileSize = intval(COption::GetOptionString("forum", "file_max_size", 50000));
        $sFileSize = CFile::FormatSize($iFileSize);
        ?>
			<div class="comments-upload-info" id="upload_files_info_<?php 
        echo $arParams["form_index"];
        ?>
">
<?php 
        if ($arParams["FORUM"]["ALLOW_UPLOAD"] == "F") {
            ?>
				<span><?php 
            echo str_replace("#EXTENSION#", $arParams["FORUM"]["ALLOW_UPLOAD_EXT"], GetMessage("F_FILE_EXTENSION"));
            ?>
</span>
<?php 
        }
        ?>
				<span><?php 
        echo str_replace("#SIZE#", $sFileSize, GetMessage("F_FILE_SIZE"));
        ?>
</span>
			</div>
<?php 
        $componentParams = array('INPUT_NAME' => 'FILE_NEW', 'INPUT_NAME_UNSAVED' => 'FILE_NEW_TMP', 'INPUT_VALUE' => array(), 'MAX_FILE_SIZE' => $iFileSize, 'MODULE_ID' => 'forum');
        if ($arResult['FORUM']['ALLOW_UPLOAD'] == 'Y') {
            $componentParams['ALLOW_UPLOAD'] = 'I';
        } elseif ($arResult['FORUM']['ALLOW_UPLOAD'] == 'F') {
            $componentParams['ALLOW_UPLOAD'] = 'F';
            $componentParams['ALLOW_UPLOAD_EXT'] = $arResult['FORUM']['ALLOW_UPLOAD_EXT'];
        } elseif ($arResult['FORUM']['ALLOW_UPLOAD'] == 'A') {
            $componentParams['ALLOW_UPLOAD'] = 'A';
        }
        $GLOBALS['APPLICATION']->IncludeComponent('bitrix:main.file.input', '', $componentParams, $this->component);
        ?>
		</div>
<?php 
        return array(array('DISPLAY' => 'AFTER', 'SORT' => '50', 'TEXT' => ob_get_clean()));
    }
Esempio n. 8
0
    /**
     * Shows information about CDN free space in Admin's informer popup
     *
     * @return void
     */
    public function OnAdminInformerInsertItems()
    {
        $CDNAIParams = array("TITLE" => GetMessage("BCL_BACKUP_AI_TITLE"), "COLOR" => "peach");
        $backup = self::getInstance();
        $backup->loadFromOptions();
        $last_request_time_option = CBitrixCloudOption::getOption("backup_last_backup_time");
        try {
            if ($backup->getQuota() <= 0 && $last_request_time_option->getIntegerValue() <= 0) {
                $backup->_getInformation(true);
                $backup->saveToOptions();
                $last_request_time_option->setStringValue((string) time());
            }
        } catch (CBitrixCloudException $e) {
            ///TODO show error to user
            return;
        }
        if ($backup->getQuota() <= 0) {
            return;
        }
        $arFiles = $backup->listFiles();
        if (empty($arFiles)) {
            $PROGRESS_FREE = 100;
            $AVAIL = $backup->getQuota();
            $ALLOWED = CFile::FormatSize($backup->getQuota(), 0);
            $CDNAIParams["ALERT"] = true;
            $MESS = '<span class="adm-informer-strong-text">' . GetMessage("BCL_BACKUP_AI_NO_FILES") . '</span>';
            $CDNAIParams["FOOTER"] = '<a href="/bitrix/admin/dump.php?lang=' . LANGUAGE_ID . '">' . GetMessage("BCL_BACKUP_AI_DO_BACKUP_STRONGLY") . '</a>';
        } elseif ($backup->getLastTimeBackup() < time() - 7 * 24 * 3600) {
            $AVAIL = $backup->getQuota() - $backup->getUsage();
            if ($AVAIL < 0.0) {
                $AVAIL = 0.0;
            }
            $PROGRESS_FREE = round($AVAIL / $backup->getQuota() * 100);
            $ALLOWED = CFile::FormatSize($backup->getQuota(), 0);
            $CDNAIParams["ALERT"] = true;
            $MESS = '<span class="adm-informer-strong-text">' . GetMessage("BCL_BACKUP_AI_LAST_TIME") . ': ' . FormatDate(array("today" => "today", "yesterday" => "yesterday", "" => "dago"), $backup->getLastTimeBackup()) . '.</span>';
            $CDNAIParams["FOOTER"] = '<a href="/bitrix/admin/dump.php?lang=' . LANGUAGE_ID . '">' . GetMessage("BCL_BACKUP_AI_DO_BACKUP_STRONGLY") . '</a>';
        } else {
            $AVAIL = $backup->getQuota() - $backup->getUsage();
            if ($AVAIL < 0.0) {
                $AVAIL = 0.0;
            }
            $PROGRESS_FREE = round($AVAIL / $backup->getQuota() * 100);
            $ALLOWED = CFile::FormatSize($backup->getQuota(), 0);
            $CDNAIParams["ALERT"] = false;
            $MESS = GetMessage("BCL_BACKUP_AI_LAST_TIME") . ': ' . FormatDate(array("today" => "today", "yesterday" => "yesterday", "" => "dago"), $backup->getLastTimeBackup());
            $CDNAIParams["FOOTER"] = '<a href="/bitrix/admin/dump.php?lang=' . LANGUAGE_ID . '">' . GetMessage("BCL_BACKUP_AI_DO_BACKUP") . '</a>';
        }
        if (isset($CDNAIParams["ALERT"])) {
            $PROGRESS_FREE_BAR = $PROGRESS_FREE < 0 ? 0 : $PROGRESS_FREE;
            $CDNAIParams["HTML"] = '
				<div class="adm-informer-item-section">
					<span class="adm-informer-item-l">
						<span class="adm-informer-strong-text">' . GetMessage("BCL_BACKUP_AI_USAGE_TOTAL") . '</span> ' . $ALLOWED . '
					</span>
					<span class="adm-informer-item-r">
							<span class="adm-informer-strong-text">' . GetMessage("BCL_BACKUP_AI_USAGE_AVAIL") . '</span> ' . CFile::FormatSize($AVAIL, 0) . '
					</span>
				</div>
				<div class="adm-informer-status-bar-block" >
					<div class="adm-informer-status-bar-indicator" style="width:' . (100 - $PROGRESS_FREE_BAR) . '%; "></div>
					<div class="adm-informer-status-bar-text">' . (100 - $PROGRESS_FREE) . '%</div>
				</div>
			' . $MESS;
            CAdminInformer::AddItem($CDNAIParams);
        }
    }
Esempio n. 9
0
	public static function InsertMainItems()
	{
		if(defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1)
			return false;

		global $USER;

		if(!$USER->IsAuthorized())
			return false;

		//Updates
		if($USER->IsAdmin() || $USER->CanDoOperation('install_updates'))
		{
			$update_res = UpdateTools::GetUpdateResult();

			$updAIParams = array(
				"TITLE" => GetMessage("top_panel_ai_updates"),
				"COLOR" => 'gray',
				"SORT" => 12
			);

			//update_autocheck == true and we have something to show
			if ($update_res['result'] === true && $update_res['tooltip'])
			{
				$updAIParams["HTML"] = $update_res['tooltip'];
				$updAIParams["FOOTER"] = '<a href="/bitrix/admin/update_system.php?lang='.LANGUAGE_ID.'">'.GetMessage("top_panel_ai_upd_instl").'</a>';
				$updAIParams["ALERT"] = true;
			}
			else if ($update_res['error'] <> '') // update error
			{
				$updAIParams["TITLE"] .= " - ".GetMessage("top_panel_ai_title_err");
				$updAIParams["HTML"] = trim(self::CutErrorId($update_res['error']));
				$updAIParams["FOOTER"] = '<a href="/bitrix/admin/update_system.php?refresh=Y&lang='.LANGUAGE_ID.'">'.GetMessage("top_panel_ai_upd_chk").'</a>';
				$updAIParams["ALERT"] = true;
			}
			else // update_autocheck == false
			{
				//last update date time
				$updateDate = COption::GetOptionString("main", "update_system_update", false);
				// remove seconds
				$updateDate = $updateDate ? CDatabase::FormatDate($updateDate, "DD.MM.YYYY HH:MI:SS", "DD.MM.YYYY HH:MI") : false;

				$updAIParams["HTML"] = '<span class="adm-informer-strong-text">'.GetMessage("top_panel_ai_sys_ver").' '.SM_VERSION."</span><br>";
				$updAIParams["HTML"] .= $updateDate ? GetMessage("top_panel_ai_upd_last").'<br>'.$updateDate : GetMessage("top_panel_ai_upd_never");
				$updAIParams["FOOTER"] = '<a href="/bitrix/admin/update_system.php?refresh=Y&lang='.LANGUAGE_ID.'">'.GetMessage("top_panel_ai_upd_chk").'</a>';
				$updAIParams["ALERT"] = false;
			}

			self::AddItem($updAIParams);
		}

		//Disk space (quota)
		$maxQuota = COption::GetOptionInt("main", "disk_space", 0)*1048576;
		if ($maxQuota > 0)
		{
			$quota = new CDiskQuota();
			$free = $quota->GetDiskQuota();
			$freeMB = CFile::FormatSize($free,1);
			$free = round($free/($maxQuota)*100);

			$qAIParams = array(
				"TITLE" => GetMessage("top_panel_ai_used_space"),
				"COLOR" => "green",
				"ALERT" => ($free < 10 ? true : false)
				);

			$qAIParams["HTML"] = '
	<div class="adm-informer-item-section">
		<span class="adm-informer-item-l"><span class="adm-informer-strong-text">'.GetMessage("top_panel_ai_in_all").'</span> '.CFile::FormatSize($maxQuota,1).'</span>
		<span class="adm-informer-item-r"><span class="adm-informer-strong-text">'.GetMessage("top_panel_ai_in_aviable").'</span> '.$freeMB.'</span>
	</div>
	<div class="adm-informer-status-bar-block" >
		<div class="adm-informer-status-bar-indicator" style="width:'.(100-$free).'%; "></div>
		<div class="adm-informer-status-bar-text">'.(100-$free).'%</div>
	</div>
	<div class="adm-informer-item-section"><span class="adm-informer-strong-text">'.GetMessage("top_panel_ai_in_recomend").'</span> '.GetMessage("top_panel_ai_in_no").'</div>';

			self::AddItem($qAIParams);
		}

		if($USER->IsAdmin() && in_array(LANGUAGE_ID, array("ru", "ua")))
		{
			$cModules = COption::GetOptionString("main", "mp_modules_date", "");
			$arModules = array();
			if(strlen($cModules) > 0)
				$arModules = unserialize($cModules);

			$mCnt = count($arModules);
			if($mCnt > 0)
			{
				foreach($arModules as $id => $module)
				{
					if(isModuleInstalled($module["ID"]))
					{
						if($module["TMS"]+3600*24*14 < time())
						{
							$script = "
							<script type=\"text/javascript\">
							function hideMpAnswer(el, module)
							{
								if(el.parentNode.parentNode.parentNode)
									BX.hide(el.parentNode.parentNode.parentNode);
									BX.ajax({
										'method': 'POST',
										'dataType': 'html',
										'url': '/bitrix/admin/partner_modules.php',
										'data': 'module='+module+'&".bitrix_sessid_get()."&act=unnotify',
										'async': true,
										'processData': false

									});
							}
							</script>";
							
							$arParams = array(
									'TITLE' => GetMessage("top_panel_ai_marketplace"),
									'COLOR' => 'green',
									'FOOTER' => "<a href=\"javascript:void(0)\" onclick=\"hideMpAnswer(this, '".CUtil::JSEscape($module["ID"])."')\" style=\"float: right !important; font-size: 0.8em !important;\">".GetMessage("top_panel_ai_marketplace_hide")."</a><a href=\"http://marketplace.1c-bitrix.".LANGUAGE_ID."/solutions/#ID#/#comments\" target=\"_blank\" onclick=\"hideMpAnswer(this, '".CUtil::JSEscape($module["ID"])."')\">".GetMessage("top_panel_ai_marketplace_add")."</a>",
									GetMessage("top_panel_ai_marketplace_link", array("#ID#" => $module["ID"], "#ADIT#" => "")),
									'ALERT' => true,
									'HTML' => GetMessage("top_panel_ai_marketplace_descr", array("#NAME#" => $module["NAME"], "#ID#" => $module["ID"])).$script,
								);
							self::AddItem($arParams);
						}
					}
					else
						unset($arModules[$id]);
				}
				if($mCnt != count($arModules))
				{
					COption::SetOptionString("main", "mp_modules_date", serialize($arModules));
				}
			}

		}

		foreach(GetModuleEvents("main", "OnAdminInformerInsertItems", true) as $arHandler)
			ExecuteModuleEventEx($arHandler);

		return count(self::$items);
	}
Esempio n. 10
0
		<td><textarea name="FORUM_SIGNATURE" rows="3" cols="35"><?php 
echo $arResult["str_FORUM_SIGNATURE"];
?>
</textarea></td>
	</tr>
	<tr>
		<th><?php 
echo GetMessage("F_AVATAR");
?>
</th>
		<td>
			<?php 
foreach (array('AVATAR_SIZE', 'AVATAR_H', 'AVATAR_V') as $prop) {
    $arResult[$prop] = intval($arResult[$prop]);
}
$arResult['AVATAR_SIZE'] = CFile::FormatSize($arResult['AVATAR_SIZE']);
if (!empty($arResult['AVATAR_H']) && !empty($arResult['AVATAR_V']) && !empty($arResult['AVATAR_SIZE'])) {
    ?>
			<?php 
    echo str_replace(array("#SIZE#", "#SIZE_BITE#"), array($arResult["AVATAR_H"] . "x" . $arResult["AVATAR_V"], $arResult["AVATAR_SIZE"]), GetMessage("F_SIZE_AVATAR"));
    ?>
<br/>
			<?php 
}
?>
			<input name="FORUM_AVATAR" size="30" type="file" />
			<?php 
if ($arResult["SHOW_DELETE_FORUM_AVATAR"] == "Y") {
    ?>
			<br/><input type="checkbox" name="FORUM_AVATAR_del" value="Y" id="FORUM_AVATAR_del" /> 
				<label for="FORUM_AVATAR_del"><?php 
Esempio n. 11
0
$lAdmin->NavText($rsDirContent->GetNavPrint(GetMessage("MAIN_DUMP_FILE_PAGES")));
$lAdmin->AddHeaders(array(array("id" => "NAME", "content" => GetMessage("MAIN_DUMP_FILE_NAME"), "sort" => "name", "default" => true), array("id" => "SIZE", "content" => GetMessage("MAIN_DUMP_FILE_SIZE1"), "sort" => "size", "default" => true), array("id" => "PLACE", "content" => GetMessage("MAIN_DUMP_LOCATION"), "sort" => "location", "default" => true), array("id" => "DATE", "content" => GetMessage('MAIN_DUMP_FILE_TIMESTAMP'), "sort" => "timestamp", "default" => true)));
$arWriteBucket = CBackup::GetBucketList($arFilter = array('READ_ONLY' => 'N'));
while ($f = $rsDirContent->NavNext(true, "f_")) {
    $BUCKET_ID = intval($f['BUCKET_ID']);
    $row =& $lAdmin->AddRow($BUCKET_ID . '_' . $f['NAME'], $f);
    $c = $arParts[$BUCKET_ID . $f['NAME']];
    if ($c > 1) {
        $parts = ' (' . GetMessage("MAIN_DUMP_PARTS") . $c . ')';
        $size = $arSize[$BUCKET_ID . $f['NAME']];
    } else {
        $parts = '';
        $size = $f['SIZE'];
    }
    $row->AddField("NAME", $f['NAME'] . $parts);
    $row->AddField("SIZE", CFile::FormatSize($size));
    $row->AddField("PLACE", $f['PLACE']);
    if ($f['DATE']) {
        $row->AddField("DATE", ($t = time() - $f['DATE']) < 86400 && $t > 0 ? HumanTime($t) . ' ' . GetMessage('DUMP_BACK') : ConvertTimeStamp($f['DATE'], 'FULL'));
    }
    $arActions = array();
    if (defined('DUMP_DEBUG_MODE')) {
        $arActions[] = array("ICON" => "clouds", "TEXT" => 'DEBUG - ' . GetMessage("MAIN_DUMP_SEND_CLOUD") . ' Bitrix', "ACTION" => "if(k=prompt('" . CUtil::JSEscape(GetMessage("MAIN_DUMP_SEND_FILE_CLOUD")) . "?')) document.location=\"/bitrix/admin/dump.php?f_id=" . urlencode($f['NAME']) . "&action=cloud_send&dump_bucket_id=-1&" . bitrix_sessid_get() . '&dump_encrypt_key="+k;');
        $arActions[] = array("ICON" => "archive", "TEXT" => 'DEBUG - ' . GetMessage("INTEGRITY_CHECK"), "ACTION" => strpos($f['NAME'], '.enc.') ? "if(k=prompt('" . CUtil::JSEscape(GetMessage("INTEGRITY_CHECK")) . "?')) document.location=\"/bitrix/admin/dump.php?f_id=" . urlencode($f['NAME']) . "&action=check_archive&" . bitrix_sessid_get() . '&dump_encrypt_key="+k;' : "if(confirm('" . CUtil::JSEscape(GetMessage("INTEGRITY_CHECK")) . "?')) document.location=\"/bitrix/admin/dump.php?f_id=" . urlencode($f['NAME']) . "&action=check_archive&" . bitrix_sessid_get() . '";');
    }
    if (!preg_match('#\\.sql$#i', $f['NAME'])) {
        if ($BUCKET_ID != -1) {
            $arActions[] = array("ICON" => "download", "DEFAULT" => true, "TEXT" => GetMessage("MAIN_DUMP_ACTION_DOWNLOAD"), "ACTION" => "AjaxSend('/bitrix/admin/dump_list.php?action=download&f_id=" . $f['NAME'] . "&BUCKET_ID=" . $BUCKET_ID . "&" . bitrix_sessid_get() . "')");
            $arActions[] = array("ICON" => "link", "TEXT" => GetMessage("MAIN_DUMP_GET_LINK"), "ACTION" => "AjaxSend('/bitrix/admin/dump_list.php?action=link&f_id=" . $f['NAME'] . "&BUCKET_ID=" . $BUCKET_ID . "&" . bitrix_sessid_get() . "')");
        }
        $arActions[] = array("ICON" => "restore", "TEXT" => GetMessage("MAIN_DUMP_RESTORE"), "ACTION" => "if(confirm('" . CUtil::JSEscape(GetMessage("MAIN_RIGHT_CONFIRM_EXECUTE")) . "')) AjaxSend('/bitrix/admin/dump_list.php?action=restore&f_id=" . $f['NAME'] . "&BUCKET_ID=" . $BUCKET_ID . "&" . bitrix_sessid_get() . "')");
Esempio n. 12
0
 /**
  * <p>Вставка полей ответа на вопрос в шаблон. Параметры поля ввода задаются в настройках вопроса.</p>
  *
  *
  * @param string $FIELD_SID  Строковой идентификатор поля вопроса. Обязательный параметр.
  *
  * @param  $string  CSS-класс для подписи к полю ввода. Необязательный параметр.
  *
  * @param mixed $CSSClass = ""] 
  *
  * @return string <p>Возвращается HTML-код для вставки полей формы</p> <a
  * name="examples"></a><h4>Использование</h4> <pre class="syntax"> &lt;?=$FORM-&gt;ShowInput('MYFIELD_5')?&gt;
  * </pre>
  *
  * <h4>See Also</h4> 
  * <menu> <li><a href="http://dev.1c-bitrix.ru/api_help/form/classes/cformoutput/index.php">Класс CFormOutput</a></li>
  * <li><a
  * href="http://dev.1c-bitrix.ru/api_help/form/classes/cformoutput/showinputcaption.php">CFormOutput::ShowInputCaption</a></li>
  * <li><a
  * href="http://dev.1c-bitrix.ru/api_help/form/classes/cformoutput/showinputcaptionimage.php">CFormOutput::ShowInputCaptionImage</a></li>
  * </menu></b<br><br>
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/form/classes/cformoutput/showinput.php
  * @author Bitrix
  */
 public function ShowInput($FIELD_SID, $caption_css_class = '')
 {
     $arrVALUES = $this->arrVALUES;
     if (is_array($this->arAnswers[$FIELD_SID])) {
         $res = "";
         reset($this->arAnswers[$FIELD_SID]);
         if (is_array($this->arDropDown[$FIELD_SID])) {
             reset($this->arDropDown[$FIELD_SID]);
         }
         if (is_array($this->arMutiselect[$FIELD_SID])) {
             reset($this->arMutiselect[$FIELD_SID]);
         }
         while (list($key, $arAnswer) = each($this->arAnswers[$FIELD_SID])) {
             if ($arAnswer["FIELD_TYPE"] == "dropdown" && $show_dropdown == "Y") {
                 continue;
             }
             if ($arAnswer["FIELD_TYPE"] == "multiselect" && $show_multiselect == "Y") {
                 continue;
             }
             if ($key > 0) {
                 $res .= "<br />";
             }
             switch ($arAnswer["FIELD_TYPE"]) {
                 case "radio":
                     $ans_id = "form_checkbox_" . $FIELD_SID . "_" . $arAnswer['ID'];
                     $arAnswer['FIELD_PARAM'] .= ' id="' . $ans_id . '"';
                     $value = CForm::GetRadioValue($FIELD_SID, $arAnswer, $arrVALUES);
                     $input = CForm::GetRadioField($FIELD_SID, $arAnswer["ID"], $value, $arAnswer["FIELD_PARAM"]);
                     if (strlen($ans_id) > 0) {
                         $res .= $input;
                         $res .= "<label for=\"" . $ans_id . "\">";
                         $res .= "<span class=\"" . $caption_css_class . "\">&nbsp;" . $arAnswer["MESSAGE"] . "</span></label>";
                     } else {
                         $res .= "<label>";
                         $res .= $input;
                         $res .= "<span class=\"" . $caption_css_class . "\">&nbsp;" . $arAnswer["MESSAGE"] . "</span></label>";
                     }
                     break;
                 case "checkbox":
                     $ans_id = "form_checkbox_" . $FIELD_SID . "_" . $arAnswer['ID'];
                     $arAnswer['FIELD_PARAM'] .= ' id="' . $ans_id . '"';
                     $value = CForm::GetCheckBoxValue($FIELD_SID, $arAnswer, $arrVALUES);
                     $input = CForm::GetCheckBoxField($FIELD_SID, $arAnswer["ID"], $value, $arAnswer["FIELD_PARAM"]);
                     if (strlen($ans_id) > 0) {
                         $res .= $input;
                         $res .= "<label for=\"" . $ans_id . "\">";
                         $res .= "<span class=\"" . $caption_css_class . "\">&nbsp;" . $arAnswer["MESSAGE"] . "</span></label>";
                     } else {
                         $res .= "<label>";
                         $res .= $input;
                         $res .= "<span class=\"" . $caption_css_class . "\">&nbsp;" . $arAnswer["MESSAGE"] . "</span></label>";
                     }
                     break;
                 case "dropdown":
                     if ($show_dropdown != "Y") {
                         $value = CForm::GetDropDownValue($FIELD_SID, $this->arDropDown, $arrVALUES);
                         $res .= CForm::GetDropDownField($FIELD_SID, $this->arDropDown[$FIELD_SID], $value, $arAnswer["FIELD_PARAM"]);
                         $show_dropdown = "Y";
                     }
                     break;
                 case "multiselect":
                     if ($show_multiselect != "Y") {
                         $value = CForm::GetMultiSelectValue($FIELD_SID, $this->arMultiSelect, $arrVALUES);
                         $res .= CForm::GetMultiSelectField($FIELD_SID, $this->arMultiSelect[$FIELD_SID], $value, $arAnswer["FIELD_HEIGHT"], $arAnswer["FIELD_PARAM"]);
                         $show_multiselect = "Y";
                     }
                     break;
                 case "text":
                     if (strlen(trim($arAnswer["MESSAGE"])) > 0) {
                         $res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . "</span><br />";
                     }
                     $value = CForm::GetTextValue($arAnswer["ID"], $arAnswer, $arrVALUES);
                     $res .= CForm::GetTextField($arAnswer["ID"], $value, $arAnswer["FIELD_WIDTH"], $arAnswer["FIELD_PARAM"]);
                     break;
                 case "hidden":
                     /*
                     if (strlen(trim($arAnswer["MESSAGE"]))>0)
                     {
                     	$res .= "<span class=\"".$caption_css_class."\">".$arAnswer["MESSAGE"]."</span><br />";
                     }
                     */
                     $value = CForm::GetHiddenValue($arAnswer["ID"], $arAnswer, $arrVALUES);
                     $res .= CForm::GetHiddenField($arAnswer["ID"], $value, $arAnswer["FIELD_PARAM"]);
                     break;
                 case "password":
                     if (strlen(trim($arAnswer["MESSAGE"])) > 0) {
                         $res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . "</span><br />";
                     }
                     $value = CForm::GetPasswordValue($arAnswer["ID"], $arAnswer, $arrVALUES);
                     $res .= CForm::GetPasswordField($arAnswer["ID"], $value, $arAnswer["FIELD_WIDTH"], $arAnswer["FIELD_PARAM"]);
                     break;
                 case "email":
                     if (strlen(trim($arAnswer["MESSAGE"])) > 0) {
                         $res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . "</span><br />";
                     }
                     $value = CForm::GetEmailValue($arAnswer["ID"], $arAnswer, $arrVALUES);
                     $res .= CForm::GetEmailField($arAnswer["ID"], $value, $arAnswer["FIELD_WIDTH"], $arAnswer["FIELD_PARAM"]);
                     break;
                 case "url":
                     if (strlen(trim($arAnswer["MESSAGE"])) > 0) {
                         $res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . "</span><br />";
                     }
                     $value = CForm::GetUrlValue($arAnswer["ID"], $arAnswer, $arrVALUES);
                     $res .= CForm::GetUrlField($arAnswer["ID"], $value, $arAnswer["FIELD_WIDTH"], $arAnswer["FIELD_PARAM"]);
                     break;
                 case "textarea":
                     if (strlen(trim($arAnswer["MESSAGE"])) > 0) {
                         $res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . "</span><br />";
                     }
                     $value = CForm::GetTextAreaValue($arAnswer["ID"], $arAnswer, $arrVALUES);
                     $res .= CForm::GetTextAreaField($arAnswer["ID"], $arAnswer["FIELD_WIDTH"], $arAnswer["FIELD_HEIGHT"], $arAnswer["FIELD_PARAM"], $value);
                     break;
                 case "date":
                     if (strlen(trim($arAnswer["MESSAGE"])) > 0) {
                         $res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . " (" . CSite::GetDateFormat("SHORT") . ")</span><br />";
                     }
                     $value = CForm::GetDateValue($arAnswer["ID"], $arAnswer, $arrVALUES);
                     $res .= CForm::GetDateField($arAnswer["ID"], $this->arForm["SID"], $value, $arAnswer["FIELD_WIDTH"], $arAnswer["FIELD_PARAM"]);
                     break;
                 case "image":
                     if (strlen(trim($arAnswer["MESSAGE"])) > 0) {
                         $res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . "</span><br />";
                     }
                     if ($this->RESULT_ID) {
                         if ($arFile = CFormResult::GetFileByAnswerID($this->RESULT_ID, $arAnswer["ID"])) {
                             if (intval($arFile["USER_FILE_ID"]) > 0) {
                                 if ($arFile["USER_FILE_IS_IMAGE"] == "Y") {
                                     $res .= CFile::ShowImage($arFile["USER_FILE_ID"], 0, 0, "border=0", "", true);
                                     $res .= "<br />";
                                 }
                                 //endif;
                             }
                             //endif;
                         }
                         // endif
                     }
                     // endif
                     $res .= CForm::GetFileField($arAnswer["ID"], $arAnswer["FIELD_WIDTH"], "IMAGE", 0, "", $arAnswer["FIELD_PARAM"]);
                     break;
                 case "file":
                     if (strlen(trim($arAnswer["MESSAGE"])) > 0) {
                         $res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . "</span><br />";
                     }
                     if ($this->RESULT_ID) {
                         if ($arFile = CFormResult::GetFileByAnswerID($this->RESULT_ID, $arAnswer["ID"])) {
                             if (intval($arFile["USER_FILE_ID"]) > 0) {
                                 $res .= "<a title=\"" . GetMessage("FORM_VIEW_FILE") . "\" target=\"_blank\" class=\"tablebodylink\" href=\"/bitrix/tools/form_show_file.php?rid=" . $this->RESULT_ID . "&hash=" . $arFile["USER_FILE_HASH"] . "&lang=" . LANGUAGE_ID . "\">" . htmlspecialcharsbx($arFile["USER_FILE_NAME"]) . "</a>&nbsp;(";
                                 $res .= CFile::FormatSize($arFile["USER_FILE_SIZE"]);
                                 $res .= ")&nbsp;&nbsp;[&nbsp;<a title=\"" . str_replace("#FILE_NAME#", $arFile["USER_FILE_NAME"], GetMessage("FORM_DOWNLOAD_FILE")) . "\" class=\"tablebodylink\" href=\"/bitrix/tools/form_show_file.php?rid=" . $this->RESULT_ID . "&hash=" . $arFile["USER_FILE_HASH"] . "&lang=" . LANGUAGE_ID . "&action=download\">" . GetMessage("FORM_DOWNLOAD") . "</a>&nbsp;]";
                                 $res .= "<br /><br />";
                             }
                             //endif;
                         }
                         //endif;
                     }
                     $res .= CForm::GetFileField($arAnswer["ID"], $arAnswer["FIELD_WIDTH"], "FILE", 0, "", $arAnswer["FIELD_PARAM"]);
                     break;
             }
             //endswitch;
         }
         //endwhile;
         return $res;
     } elseif (is_array($this->arQuestions[$FIELD_SID]) && $this->arQuestions[$FIELD_SID]["ADDITIONAL"] == "Y") {
         $res = "";
         switch ($this->arQuestions[$FIELD_SID]["FIELD_TYPE"]) {
             case "text":
                 $value = CForm::GetTextAreaValue("ADDITIONAL_" . $this->arQuestions[$FIELD_SID]["ID"], array(), $this->arrVALUES);
                 $res .= CForm::GetTextAreaField("ADDITIONAL_" . $this->arQuestions[$FIELD_SID]["ID"], "60", "5", "", $value);
                 break;
             case "integer":
                 $value = CForm::GetTextValue("ADDITIONAL_" . $this->arQuestions[$FIELD_SID]["ID"], array(), $this->arrVALUES);
                 $res .= CForm::GetTextField("ADDITIONAL_" . $this->arQuestions[$FIELD_SID]["ID"], $value);
                 break;
             case "date":
                 $value = CForm::GetDateValue("ADDITIONAL_" . $this->arQuestions[$FIELD_SID]["ID"], array(), $this->arrVALUES);
                 $res .= CForm::GetDateField("ADDITIONAL_" . $this->arQuestions[$FIELD_SID]["ID"], $arForm["SID"], $value);
                 break;
         }
         //endswitch;
         return $res;
     } else {
         return "";
     }
 }
Esempio n. 13
0
    function ShowStep()
    {
        $wizard =& $this->GetWizard();
        $import_type = $wizard->GetVar('import_type');
        if ($import_type !== 'city') {
            $import_type = 'country';
            $this->content = GetMessage('STATWIZ_STEP2_COUNTRY_CHOOSEN');
        } else {
            $this->content = GetMessage('STATWIZ_STEP2_CITY_CHOOSEN');
        }
        $this->content .= "<br><br>";
        $this->content .= GetMessage('STATWIZ_STEP2_CONTENT');
        $this->content .= "<br><br>";
        $file_name = $wizard->GetVar('file_name');
        $arFiles = CCity::FindFiles($import_type);
        if (count($arFiles) <= 0) {
            $this->content .= GetMessage('STATWIZ_FILES_NOT_FOUND');
        } else {
            $this->content .= "<style>\n\t\t\ttable.statwiz_table  { border-collapse:collapse; }\n\t\t\ttable.statwiz_table td { font-family:Verdana,Arial,sans-serif; border: 1px solid #BDC6E0; padding:3px; background-color: white; }\n\t\t\ttable.statwiz_table td.head { background-color:#E6E9F4; }\n\t\t\ttable.statwiz_table td.tail { background-color:#EAEDF7; }\n\t\t\t</style>\n\t\t\t";
            $this->content .= '<table class="statwiz_table">
			<tr>
				<td class="head">&nbsp;</td>
				<td class="head">' . GetMessage('STATWIZ_STEP2_FILE_NAME') . '</td>
				<td class="head">' . GetMessage('STATWIZ_STEP2_FILE_SIZE') . '</td>
				<td class="head">' . GetMessage('STATWIZ_STEP2_DESCRIPTION') . '</td>
			</tr>';
            foreach ($arFiles as $arFile) {
                $this->content .= '<tr>';
                $arInputAttr = array();
                if ($arFile["FILE"] === $file_name) {
                    $arInputAttr['checked'] = 'checked';
                }
                $arInputAttr["id"] = htmlspecialcharsbx($arFile["FILE"]);
                $this->content .= '<td>' . $this->ShowRadioField("file_name", $arFile["FILE"], $arInputAttr) . '</td>';
                $this->content .= '<td nowrap><label for="' . $arInputAttr["id"] . '">' . $arFile["FILE"] . '</label></td>';
                $pos = 0;
                $this->content .= '<td nowrap>' . CFile::FormatSize($arFile["SIZE"]) . '</td>';
                switch ($arFile["SOURCE"]) {
                    case "MAXMIND-IP-COUNTRY":
                        $this->content .= '<td>' . GetMessage('STATWIZ_STEP2_FILE_TYPE_MAXMIND_IP_COUNTRY') . '</td>';
                        break;
                    case "IP-TO-COUNTRY":
                        $this->content .= '<td>' . GetMessage('STATWIZ_STEP2_FILE_TYPE_IP_TO_COUNTRY') . '</td>';
                        break;
                    case "MAXMIND-IP-LOCATION":
                        $this->content .= '<td>' . GetMessage('STATWIZ_STEP2_FILE_TYPE_MAXMIND_IP_LOCATION') . '</td>';
                        break;
                    case "MAXMIND-CITY-LOCATION":
                        $this->content .= '<td>' . GetMessage('STATWIZ_STEP2_FILE_TYPE_MAXMIND_CITY_LOCATION') . '</td>';
                        break;
                    case "IPGEOBASE":
                        $this->content .= '<td>' . GetMessage('STATWIZ_STEP2_FILE_TYPE_IPGEOBASE') . '</td>';
                        break;
                    case "IPGEOBASE2":
                        $this->content .= '<td>' . GetMessage('STATWIZ_STEP2_FILE_TYPE_IPGEOBASE2') . '</td>';
                        break;
                    case "IPGEOBASE2-CITY":
                        $this->content .= '<td>' . GetMessage('STATWIZ_STEP2_FILE_TYPE_IPGEOBASE2_CITY') . '</td>';
                        break;
                    default:
                        $this->content .= '<td>' . GetMessage('STATWIZ_STEP2_FILE_TYPE_UNKNOWN') . '</td>';
                }
                $this->content .= '</tr>';
            }
            $this->content .= '</table>';
        }
    }
Esempio n. 14
0
	public static function GetFormatFilesMessageOut($files)
	{
		if (!is_array($files) || count($files) <= 0)
			return false;

		$messageFiles = '';
		$serverName = (CMain::IsHTTPS() ? "https" : "http")."://".((defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0) ? SITE_SERVER_NAME : COption::GetOptionString("main", "server_name", ""));
		foreach ($files as $fileId => $fileData)
		{
			if ($fileData['status'] == 'done')
			{
				$fileElement = $fileData['name'].' ('.CFile::FormatSize($fileData['size']).")\n".
								GetMessage('IM_MESSAGE_FILE_DOWN').' '.$serverName.$fileData['urlDownload']['default']."\n";
				$messageFiles = strlen($messageFiles)>0? $messageFiles."\n".$fileElement: $fileElement;
			}
		}

		return $messageFiles;
	}
            } elseif ($key == 'bytes') {
                $key = 'using_bytes';
            }
            if ($key == 'uptime') {
            } elseif ($key == 'limit_maxbytes') {
                $html .= '
				<tr>
					<td width="50%" align=right>' . $key . ':</td>
					<td align=left>' . CFile::FormatSize($value) . '</td>
				</tr>
				';
            } elseif ($key == 'using_bytes') {
                $html .= '
				<tr>
					<td width="50%" align=right>' . $key . ':</td>
					<td align=left>' . CFile::FormatSize($value) . ($limit_maxbytes > 0 ? ' (' . round($value / $limit_maxbytes * 100, 2) . '%)' : '') . '</td>
				</tr>
				';
            } elseif ($key == 'listen_disabled_num') {
                $html .= '
				<tr>
					<td width="50%" align=right>' . $key . ':</td>
					<td align=left>' . ($value > 0 ? "<span style=\"color:red\">" . $value . "</span>" : "<span style=\"color:green\">" . $value . "</span>") . '</td>
				</tr>
				';
            } elseif ($key == 'get_hits') {
                $html .= '
				<tr>
					<td width="50%" align=right>' . $key . ':</td>
					<td align=left>' . $value . ' ' . ($value > 0 ? '(' . round($value / ($value + $get_misses) * 100, 2) . '%)' : '') . '</td>
				</tr>
Esempio n. 16
0
                    switch ($arIncludeDebug["CACHE_TYPE"]) {
                        case "N":
                            echo GetMessage("debug_info_cache_off");
                            break;
                        case "Y":
                            echo GetMessage("debug_info_cache_on");
                            break;
                        default:
                            echo GetMessage("debug_info_cache_auto");
                            break;
                    }
                    ?>
</td>
						<td class="number" nowrap>&nbsp;<?php 
                    if ($arIncludeDebug["CACHE_SIZE"]) {
                        echo CFile::FormatSize($arIncludeDebug["CACHE_SIZE"], 0);
                    }
                    ?>
</td>
						<td class="number" nowrap><?php 
                    if ($arArea["TIME"] > 0) {
                        echo number_format($arIncludeDebug["TIME"] / $arArea["TIME"] * 100, 2);
                        ?>
%<?php 
                    }
                    ?>
</td>
						<td class="number" nowrap><?php 
                    echo number_format($arIncludeDebug["TIME"], 4);
                    ?>
 <?php 
Esempio n. 17
0
								$arAnswer["FIELD_PARAM"]);

							$arResult["QUESTIONS"][$FIELD_SID]["HTML_CODE"][] = $res;

							break;
						case "file":
							if (strlen(trim($arAnswer["MESSAGE"]))>0)
							{
								$res .= $arAnswer["MESSAGE"];
							}
							if ($arFile = CFormResult::GetFileByAnswerID($arParams["RESULT_ID"], $arAnswer["ID"]))
							{
								if (intval($arFile["USER_FILE_ID"])>0)
								{
									$res .= "<a title=\"".GetMessage("FORM_VIEW_FILE")."\" target=\"_blank\" class=\"tablebodylink\" href=\"/freetrix/tools/form_show_file.php?rid=".$arParams["RESULT_ID"]."&hash=".$arFile["USER_FILE_HASH"]."&lang=".LANGUAGE_ID."\">".htmlspecialcharsbx($arFile["USER_FILE_NAME"])."</a>&nbsp;(";
									$res .= CFile::FormatSize($arFile["USER_FILE_SIZE"]);
									$res .= ")&nbsp;&nbsp;[&nbsp;<a title=\"".str_replace("#FILE_NAME#", $arFile["USER_FILE_NAME"], GetMessage("FORM_DOWNLOAD_FILE"))."\" class=\"tablebodylink\" href=\"/freetrix/tools/form_show_file.php?rid=".$arParams["RESULT_ID"]."&hash=".$arFile["USER_FILE_HASH"]."&lang=".LANGUAGE_ID."&action=download\">".GetMessage("FORM_DOWNLOAD")."</a>&nbsp;]<br />";
									$res .= '<input type="checkbox" value="Y" name="form_file_'.$arAnswer['ID'].'_del" id="form_file_'.$arAnswer['ID'].'_del" /><label for="form_file_'.$arAnswer['ID'].'_del">'.GetMessage('FORM_DELETE_FILE').'</label><br />';

									$res .= "<br />";
								} //endif;
							} //endif;


							$res .= CForm::GetFileField(
								$arAnswer["ID"],
								$arAnswer["FIELD_WIDTH"],
								"FILE",
								0,
								"",
								$arAnswer["FIELD_PARAM"]);
Esempio n. 18
0
    }
    if (is_string($file)) {
        $currentPath = substr($file, strlen($_SERVER["DOCUMENT_ROOT"]));
        _CFileTree::ExtractFileFromPath($currentPath);
        CAdminMessage::ShowMessage(array("MESSAGE" => GetMessage("main_cache_in_progress"), "DETAILS" => "" . GetMessage("main_cache_files_scanned_count", array("#value#" => "<b>" . intval($_SESSION["CACHE_STAT"]["scanned"]) . "</b>")) . "<br>" . GetMessage("main_cache_files_scanned_size", array("#value#" => "<b>" . CFile::FormatSize($_SESSION["CACHE_STAT"]["space_total"]) . "</b>")) . "<br>" . GetMessage("main_cache_files_deleted_count", array("#value#" => "<b>" . intval($_SESSION["CACHE_STAT"]["deleted"]) . "</b>")) . "<br>" . GetMessage("main_cache_files_deleted_size", array("#value#" => "<b>" . CFile::FormatSize($_SESSION["CACHE_STAT"]["space_freed"]) . "</b>")) . "<br>" . GetMessage("main_cache_files_delete_errors", array("#value#" => "<b>" . intval($_SESSION["CACHE_STAT"]["errors"]) . "</b>")) . "<br>" . GetMessage("main_cache_files_last_path", array("#value#" => "<b>" . htmlspecialcharsbx($currentPath) . "</b>")) . "<br>", "HTML" => true, "TYPE" => "OK"));
        ?>
		<script>
			CloseWaitWindow();
			DoNext(<?php 
        echo CUtil::PhpToJSObject(substr($file, strlen($_SERVER["DOCUMENT_ROOT"])));
        ?>
);
		</script>
		<?php 
    } else {
        CAdminMessage::ShowMessage(array("MESSAGE" => GetMessage("main_cache_finished"), "DETAILS" => "" . GetMessage("main_cache_files_scanned_count", array("#value#" => "<b>" . intval($_SESSION["CACHE_STAT"]["scanned"]) . "</b>")) . "<br>" . GetMessage("main_cache_files_scanned_size", array("#value#" => "<b>" . CFile::FormatSize($_SESSION["CACHE_STAT"]["space_total"]) . "</b>")) . "<br>" . GetMessage("main_cache_files_deleted_count", array("#value#" => "<b>" . intval($_SESSION["CACHE_STAT"]["deleted"]) . "</b>")) . "<br>" . GetMessage("main_cache_files_deleted_size", array("#value#" => "<b>" . CFile::FormatSize($_SESSION["CACHE_STAT"]["space_freed"]) . "</b>")) . "<br>" . GetMessage("main_cache_files_delete_errors", array("#value#" => "<b>" . intval($_SESSION["CACHE_STAT"]["errors"]) . "</b>")) . "<br>", "HTML" => true, "TYPE" => "OK"));
        ?>
		<script>
			CloseWaitWindow();
			EndClearCache();
		</script>
		<?php 
    }
    require $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/epilog_admin_js.php";
} else {
    if (!$USER->CanDoOperation('cache_control') && !$USER->CanDoOperation('view_other_settings')) {
        $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
    }
    $errorMessage = "";
    $okMessage = "";
    if ($REQUEST_METHOD == "POST" && $clearcache == "Y" && strlen($cachetype) > 0 && check_bitrix_sessid() && $isAdmin) {
Esempio n. 19
0
foreach (GetModuleEvents("main", "system.field.view.file", true) as $arEvent) {
    if (ExecuteModuleEventEx($arEvent, array($arResult, $arParams))) {
        return;
    }
}
$first = true;
foreach ($arResult["VALUE"] as $res) {
    if (!$first) {
        ?>
<span class="bx-br-separator"><br /></span><?php 
    } else {
        $first = false;
    }
    ?>
<span class="fields files"><?php 
    $arFile = CFile::GetFileArray($res);
    if ($arFile) {
        if (substr($arFile["CONTENT_TYPE"], 0, 6) == "image/") {
            echo CFile::ShowImage($arFile, $arParams["FILE_MAX_WIDTH"], $arParams["FILE_MAX_HEIGHT"], "", "", $arParams["FILE_SHOW_POPUP"] == "Y", false, 0, 0, $arParams["~URL_TEMPLATE"]);
        } else {
            if ($arParams["~URL_TEMPLATE"] != '') {
                $src = CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATE"], array('file_id' => $arFile["ID"]));
            } else {
                $src = $arFile["SRC"];
            }
            echo '<a href="' . htmlspecialcharsbx($src) . '">' . htmlspecialcharsbx($arFile["FILE_NAME"]) . '</a> (' . CFile::FormatSize($arFile["FILE_SIZE"]) . ')';
        }
    }
    ?>
</span><?php 
}
        // Aborted connections
        if ($stat['Connections'] > 0) {
            $calc['pct_aborted_connections'] = round($stat['Aborted_connects'] / $stat['Connections'] * 100, 2);
            $data[0]["ITEMS"][] = array("KPI_NAME" => GetMessage("PERFMON_KPI_NAME_CONN_ABORTS"), "IS_OK" => $calc['pct_aborted_connections'] <= 5, "KPI_VALUE" => $calc['pct_aborted_connections'] . "%", "KPI_RECOMMENDATION" => GetMessage("PERFMON_KPI_REC_CONN_ABORTS"));
        }
        // InnoDB
        if ($vars['have_innodb'] == "YES") {
            if ($stat['Innodb_buffer_pool_reads'] > 0 && $stat['Innodb_buffer_pool_read_requests'] > 0) {
                $calc['innodb_buffer_hit_rate'] = round((1 - $stat['Innodb_buffer_pool_reads'] / $stat['Innodb_buffer_pool_read_requests']) * 100, 2);
                $data[0]["ITEMS"][] = array("KPI_NAME" => GetMessage("PERFMON_KPI_NAME_INNODB_BUFFER"), "IS_OK" => $calc['innodb_buffer_hit_rate'] > 95, "KPI_VALUE" => $calc['innodb_buffer_hit_rate'] . "%", "KPI_RECOMMENDATION" => GetMessage("PERFMON_KPI_REC_INNODB_BUFFER", array("#STAT_NAME#" => "<span class=\"perfmon_code\">1 - Innodb_buffer_pool_reads / Innodb_buffer_pool_read_requests</span>", "#GOOD_VALUE#" => 95, "#PARAM_NAME#" => "<span class=\"perfmon_code\">innodb_buffer_pool_size</span>", "#PARAM_VALUE#" => CFile::FormatSize($vars['innodb_buffer_pool_size']))));
            }
            $data[0]["ITEMS"][] = array("KPI_NAME" => "innodb_flush_log_at_trx_commit", "IS_OK" => $vars['innodb_flush_log_at_trx_commit'] == 2 || $vars['innodb_flush_log_at_trx_commit'] == 0, "KPI_VALUE" => strlen($vars['innodb_flush_log_at_trx_commit']) ? $vars['innodb_flush_log_at_trx_commit'] : GetMessage("PERFMON_KPI_EMPTY"), "KPI_RECOMMENDATION" => GetMessage("PERFMON_KPI_REC_INNODB_FLUSH_LOG", array("#GOOD_VALUE#" => 2, "#PARAM_NAME#" => "<span class=\"perfmon_code\">innodb_flush_log_at_trx_commit</span>")));
            $data[0]["ITEMS"][] = array("KPI_NAME" => "innodb_flush_method", "IS_OK" => $vars['innodb_flush_method'] == "O_DIRECT", "KPI_VALUE" => strlen($vars['innodb_flush_method']) ? $vars['innodb_flush_method'] : GetMessage("PERFMON_KPI_EMPTY"), "KPI_RECOMMENDATION" => GetMessage("PERFMON_KPI_REC_INNODB_FLUSH_METHOD", array("#GOOD_VALUE#" => "O_DIRECT", "#PARAM_NAME#" => "<span class=\"perfmon_code\">innodb_flush_method</span>")));
            $data[0]["ITEMS"][] = array("KPI_NAME" => "transaction-isolation", "IS_OK" => $vars['tx_isolation'] == "READ-COMMITTED", "KPI_VALUE" => strlen($vars['tx_isolation']) ? $vars['tx_isolation'] : GetMessage("PERFMON_KPI_EMPTY"), "KPI_RECOMMENDATION" => GetMessage("PERFMON_KPI_REC_TX_ISOLATION", array("#GOOD_VALUE#" => "READ-COMMITTED", "#PARAM_NAME#" => "<span class=\"perfmon_code\">transaction-isolation</span>")));
            $data[0]["ITEMS"][] = array("KPI_NAME" => GetMessage("PERFMON_KPI_NAME_INNODB_LOG_WAITS"), "KPI_VALUE" => $stat["Innodb_log_waits"], "KPI_RECOMMENDATION" => GetMessage("PERFMON_KPI_REC_INNODB_LOG_WAITS", array("#VALUE#" => CFile::FormatSize($vars["innodb_log_file_size"]))));
            $data[0]["ITEMS"][] = array("KPI_NAME" => GetMessage("PERFMON_KPI_NAME_BINLOG"), "KPI_VALUE" => $stat["Binlog_cache_disk_use"], "KPI_RECOMMENDATION" => GetMessage("PERFMON_KPI_REC_BINLOG", array("#VALUE#" => CFile::FormatSize($vars["binlog_cache_size"]))));
        }
    }
} elseif ($DB->type == "ORACLE") {
    $module_name = "";
    $rs = $DB->Query("\n\t\tselect\n\t\t\tevent as WAIT_EVENT\n\t\t\t,round(RATIO_TO_REPORT(sum(time_waited)) OVER ()*100,2) AS PCTTOT\n\t\t\t,round(avg(average_wait)*10,2) as AVERAGE_WAIT_MS\n\t\tfrom\n\t\t\tv\$session_event\n\t\twhere sid in (\n\t\t\tselect sid\n\t\t\tfrom v\$session\n\t\t\twhere UPPER(program) like '%'||UPPER('{$module_name}')||'%'\n\t\t\tand LOGON_TIME > sysdate-1/24\n\t\t\tand SERIAL# not in (1)\n\t\t\tand PROGRAM not like '%QMNC%'\n\t\t\tand UPPER(PROGRAM) not like '%Q0%'\n\t\t\tand UPPER(PROGRAM) not like '%J0%'\n\t\t)\n\t\tand event not in (\n\t\t\t'AQ Proxy Cleanup Wait',\n\t\t\t'ASM background timer',\n\t\t\t'DIAG idle wait',\n\t\t\t'EMON idle wait',\n\t\t\t'KSV master wait',\n\t\t\t'LNS ASYNC archive log',\n\t\t\t'LNS ASYNC dest activation',\n\t\t\t'LNS ASYNC end of log',\n\t\t\t'LogMiner: client waiting for transaction',\n\t\t\t'LogMiner: slave waiting for activate message',\n\t\t\t'LogMiner: wakeup event for builder',\n\t\t\t'LogMiner: wakeup event for preparer',\n\t\t\t'LogMiner: wakeup event for reader',\n\t\t\t'Null event',\n\t\t\t'PX Deq Credit: need buffer',\n\t\t\t'PX Deq Credit: send blkd',\n\t\t\t'PX Deq: Execute Reply',\n\t\t\t'PX Deq: Execution Msg',\n\t\t\t'PX Deq: Par Recov Execute',\n\t\t\t'PX Deq: Signal ACK',\n\t\t\t'PX Deq: Table Q Normal',\n\t\t\t'PX Deq: Table Q Sample',\n\t\t\t'PX Deque wait',\n\t\t\t'PX Idle Wait',\n\t\t\t'Queue Monitor Shutdown Wait',\n\t\t\t'Queue Monitor Slave Wait',\n\t\t\t'Queue Monitor Wait',\n\t\t\t'SQL*Net message from client',\n\t\t\t'SQL*Net message to client',\n\t\t\t'SQL*Net more data from client',\n\t\t\t'STREAMS apply coord waiting for slave message',\n\t\t\t'STREAMS apply slave idle wait',\n\t\t\t'STREAMS apply slave waiting for coord message',\n\t\t\t'STREAMS capture process filter callback wait for ruleset',\n\t\t\t'STREAMS fetch slave waiting for txns',\n\t\t\t'STREAMS waiting for subscribers to catch up',\n\t\t\t'Streams AQ: RAC qmn coordinator idle wait',\n\t\t\t'Streams AQ: deallocate messages from Streams Pool',\n\t\t\t'Streams AQ: delete acknowledged messages',\n\t\t\t'Streams AQ: qmn coordinator idle wait',\n\t\t\t'Streams AQ: qmn slave idle wait',\n\t\t\t'Streams AQ: waiting for messages in the queue',\n\t\t\t'Streams AQ: waiting for time management or cleanup tasks',\n\t\t\t'Streams fetch slave: waiting for txns',\n\t\t\t'class slave wait',\n\t\t\t'client message',\n\t\t\t'dispatcher timer',\n\t\t\t'gcs for action',\n\t\t\t'gcs remote message',\n\t\t\t'ges remote message',\n\t\t\t'i/o slave wait',\n\t\t\t'jobq slave wait',\n\t\t\t'knlqdeq',\n\t\t\t'lock manager wait for remote message',\n\t\t\t'master wait',\n\t\t\t'null event',\n\t\t\t'parallel query dequeue',\n\t\t\t'pipe get',\n\t\t\t'pmon timer',\n\t\t\t'queue messages',\n\t\t\t'rdbms ipc message',\n\t\t\t'slave wait',\n\t\t\t'smon timer',\n\t\t\t'virtual circuit status',\n\t\t\t'wait for activate message',\n\t\t\t'wait for unread message on broadcast channel',\n\t\t\t'wakeup event for builder',\n\t\t\t'wakeup event for preparer',\n\t\t\t'wakeup event for reader',\n\t\t\t'wakeup time manager'\n\t\t)\n\tand average_wait > 1/100\n\tgroup by event\n\torder by PCTTOT desc\n\t", true);
    if (!$rs) {
        $message = new CAdminMessage(array("MESSAGE" => GetMessage("PERFMON_KPI_ORA_PERMISSIONS"), "HTML" => true));
    } else {
        $data[0] = array("TITLE" => GetMessage("PERFMON_WAITS_TITLE"), "HEADERS" => array(array("id" => "WAIT_EVENT", "content" => GetMessage("PERFMON_WAIT_EVENT"), "default" => true), array("id" => "WAIT_PCT", "content" => GetMessage("PERFMON_WAIT_PCT"), "align" => "right", "default" => true), array("id" => "WAIT_AVERAGE_WAIT_MS", "content" => GetMessage("PERFMON_WAIT_AVERAGE_WAIT_MS"), "align" => "right", "default" => true), array("id" => "KPI_RECOMMENDATION", "content" => GetMessage("PERFMON_KPI_RECOMENDATION"), "default" => true)), "ITEMS" => array());
        while ($ar = $rs->Fetch()) {
            $data[0]["ITEMS"][] = array("WAIT_EVENT" => $ar["WAIT_EVENT"], "WAIT_PCT" => $ar["PCTTOT"] . "%", "WAIT_AVERAGE_WAIT_MS" => $ar["AVERAGE_WAIT_MS"], "KPI_RECOMMENDATION" => GetMessage("PERFMON_KPI_ORA_REC_" . strtoupper(str_replace(array(" ", ":", "*"), "_", $ar["WAIT_EVENT"]))));
        }
        $param = array();
        $rs = $DB->Query("SELECT NAME,VALUE from v\$parameter");
        while ($ar = $rs->Fetch()) {
Esempio n. 21
0
    function OnCommentFormDisplay()
    {
        $arResult =& $this->component->arResult;
        $arParams =& $this->component->arParams;
        ob_start();
        ?>
		<div class="comments-reply-field comments-reply-field-upload">
<?php 
        $iCount = 0;
        if (!empty($arResult["REVIEW_FILES"])) {
            foreach ($arResult["REVIEW_FILES"] as $key => $val) {
                $iCount++;
                $sFileSize = CFile::FormatSize(intval($val["FILE_SIZE"]));
                ?>
					<div class="comments-uploaded-file">
						<input type="hidden" name="FILES[<?php 
                echo $key;
                ?>
]" value="<?php 
                echo $key;
                ?>
" />
						<input type="checkbox" name="FILES_TO_UPLOAD[<?php 
                echo $key;
                ?>
]" id="FILES_TO_UPLOAD_<?php 
                echo $key;
                ?>
" value="<?php 
                echo $key;
                ?>
" checked="checked" />
						<label for="FILES_TO_UPLOAD_<?php 
                echo $key;
                ?>
"><?php 
                echo $val["ORIGINAL_NAME"];
                ?>
 (<?php 
                echo $val["CONTENT_TYPE"];
                ?>
) <?php 
                echo $sFileSize;
                ?>
							( <a href="/bitrix/components/bitrix/forum.interface/show_file.php?action=download&amp;fid=<?php 
                echo $key;
                ?>
"><?php 
                echo GetMessage("F_DOWNLOAD");
                ?>
</a> )
						</label>
					</div>
<?php 
            }
        }
        if ($iCount < $this->filesCount) {
            $sFileSize = CFile::FormatSize(intval(COption::GetOptionString("forum", "file_max_size", 5242880)));
            ?>
				<div class="comments-upload-info" style="display:none;" id="upload_files_info_<?php 
            echo $arParams["form_index"];
            ?>
">
<?php 
            if ($arParams["FORUM"]["ALLOW_UPLOAD"] == "F") {
                ?>
						<span><?php 
                echo str_replace("#EXTENSION#", $arParams["FORUM"]["ALLOW_UPLOAD_EXT"], GetMessage("F_FILE_EXTENSION"));
                ?>
</span>
<?php 
            }
            ?>
					<span><?php 
            echo str_replace("#SIZE#", $sFileSize, GetMessage("F_FILE_SIZE"));
            ?>
</span>
				</div>
<?php 
            for ($ii = $iCount; $ii < $this->filesCount; $ii++) {
                ?>
					<div class="comments-upload-file" style="display:none;" id="upload_files_<?php 
                echo $ii;
                ?>
_<?php 
                echo $arParams["form_index"];
                ?>
">
						<input name="FILE_NEW_<?php 
                echo $ii;
                ?>
" type="file" value="" size="30" />
					</div>
<?php 
            }
            ?>
				<a href="javascript:void(0);" onclick="AttachFile('<?php 
            echo $iCount;
            ?>
', '<?php 
            echo $ii - $iCount;
            ?>
', '<?php 
            echo $arParams["form_index"];
            ?>
', this); return false;">
					<span><?php 
            echo $arResult["FORUM"]["ALLOW_UPLOAD"] == "Y" ? GetMessage("F_LOAD_IMAGE") : GetMessage("F_LOAD_FILE");
            ?>
</span>
				</a>
<?php 
        }
        ?>
		</div>
<?php 
        return array(array('DISPLAY' => 'AFTER', 'SORT' => '50', 'TEXT' => ob_get_clean()));
    }
Esempio n. 22
0
$arParams['MULTIPLE'] = $arParams['MULTIPLE'] == 'N' ? 'N' : 'Y';

if (!$arParams['INPUT_NAME'])
{
	showError(GetMessage('MFI_ERR_NO_INPUT_NAME'));
	return false;
}

$arResult['CONTROL_UID'] = md5(randString(15));

$_SESSION["MFI_UPLOADED_FILES_".$arResult['CONTROL_UID']] = array();
$arResult['FILES'] = array();

if (is_array($arParams['INPUT_VALUE']) && strlen(implode(",", $arParams["INPUT_VALUE"])) > 0)
{
	$dbRes = CFile::GetList(array(), array("@ID" => implode(",", $arParams["INPUT_VALUE"])));
	while ($arFile = $dbRes->GetNext())
	{
		$arFile['URL'] = CHTTP::URN2URI($APPLICATION->GetCurPageParam("mfi_mode=down&fileID=".$arFile['ID']."&cid=".$arResult['CONTROL_UID']."&".bitrix_sessid_get(), array("mfi_mode", "fileID", "cid")));
		$arFile['FILE_SIZE_FORMATTED'] = CFile::FormatSize($arFile['FILE_SIZE']);
		$arResult['FILES'][$arFile['ID']] = $arFile;
		$_SESSION["MFI_UPLOADED_FILES_".$arResult['CONTROL_UID']][] = $arFile['ID'];
	}
}

CUtil::InitJSCore(array('ajax'));

$this->IncludeComponentTemplate();

return $arParams['CONTROL_ID'];
Esempio n. 23
0
    ?>
</td>
		</tr>
		<?php 
}
if ($bBitrixCloud) {
    ?>
	<tr>
		<td class="adm-detail-valign-top" width="40%"><?php 
    echo GetMessage('DUMP_MAIN_BITRIX_CLOUD_DESC');
    ?>
<span class="required"><sup>1</sup></span>:</td>
		<td width="60%">
		<?php 
    $backup = CBitrixCloudBackup::getInstance();
    CAdminMessage::ShowMessage(array("TYPE" => "PROGRESS", "DETAILS" => GetMessage("BCL_BACKUP_USAGE", array("#QUOTA#" => CFile::FormatSize($quota = $backup->getQuota()), "#USAGE#" => CFile::FormatSize($usage = $backup->getUsage()))) . '#PROGRESS_BAR#', "HTML" => false, "PROGRESS_TOTAL" => $quota, "PROGRESS_VALUE" => $usage));
    ?>
		</td>
	</tr>
	<?php 
}
?>
	<tr>
		<td class="adm-detail-valign-top" width=40%><?php 
echo GetMessage('MAIN_DUMP_ARC_LOCATION');
?>
</td>
		<td>
			<div><input type=radio name=dump_bucket_id value="-1" <?php 
echo $bBitrixCloud ? "checked" : "";
?>
Esempio n. 24
0
 function CheckFile($arFile, $intMaxSize = 0, $strMimeType = false, $strExt = false)
 {
     if ($arFile["name"] == "") {
         return "";
     }
     if (($error = self::validateFile($dummy, $arFile)) != '') {
         return $error;
     }
     if ($intMaxSize > 0 && intval($arFile["size"]) > $intMaxSize) {
         return GetMessage("FILE_BAD_SIZE") . " (" . CFile::FormatSize($intMaxSize) . ").";
     }
     $strFileExt = '';
     if ($strExt) {
         $strFileExt = GetFileExtension($arFile["name"]);
         if ($strFileExt == '') {
             return GetMessage("FILE_BAD_TYPE");
         }
     }
     //Check mime_type and ext
     if ($strMimeType !== false && substr($arFile["type"], 0, strlen($strMimeType)) != $strMimeType) {
         return GetMessage("FILE_BAD_TYPE");
     }
     if ($strExt === false) {
         return "";
     }
     $IsExtCorrect = true;
     if ($strExt) {
         $IsExtCorrect = false;
         $tok = strtok($strExt, ",");
         while ($tok) {
             if (strtolower(trim($tok)) == strtolower($strFileExt)) {
                 $IsExtCorrect = true;
                 break;
             }
             $tok = strtok(",");
         }
     }
     if ($IsExtCorrect) {
         return "";
     }
     return GetMessage("FILE_BAD_TYPE") . " (" . strip_tags($strFileExt) . ")";
 }
Esempio n. 25
0
	}
	?>
	<tr>
		<td colspan="2" style="background:white; padding: 15px;"><?=preg_replace("'(^|\r\n)[\s]*([A-Za-z]*(&gt;)+)([^\r\n]+)'e", "_ConvReplies('\\2', '\\4')", TxtToHTML($dbr_arr["BODY"]))?></td>
	</tr>
	<?
	if($dbr_arr["ATTACHMENTS"]>0):

		$dbr_attach = CMailAttachment::GetList(Array("NAME"=>"ASC", "ID"=>"ASC"), Array("MESSAGE_ID"=>$dbr_arr["ID"]));
	?>
	<tr>
		<td><?echo GetMessage("MAIL_MSG_VIEW_ATTACHMENTS")?></td>
		<td>
		<?while($dbr_attach_arr = $dbr_attach->GetNext()):?>
			<a target="_blank" href="mail_attachment_view.php?lang=<?=LANG?>&amp;ID=<?=$dbr_attach_arr["ID"]?>"><?=(strlen($dbr_attach_arr["FILE_NAME"])>0?$dbr_attach_arr["FILE_NAME"]:GetMessage("MAIL_MSG_VIEW_NNM"))?></a> (<?
				echo CFile::FormatSize($dbr_attach_arr["FILE_SIZE"]);
			?>)<br>
		<?endwhile?>
		</td>
	</tr>
	<?endif?>
	<tr>
		<td><?echo GetMessage("MAIL_MSG_VIEW_STATUS")?></td>
		<td>

			<?if($dbr_arr["SPAM"]=="Y"):?>
				<?if($dbr_arr["NEW_MESSAGE"]!="Y"):?>
				<div class="mail-message-spam" title="<?echo GetMessage("MAIL_MSG_VIEW_READ_SPAM")?>"></div> <?echo GetMessage("MAIL_MSG_VIEW_READ_SPAM")?>
				<?else:?>
				<div class="mail-message-unread-spam" title="<?echo GetMessage("MAIL_MSG_VIEW_NOTREAD_SPAM")?>"></div> <?echo GetMessage("MAIL_MSG_VIEW_NOTREAD_SPAM")?>
				<?endif?>
Esempio n. 26
0
    }
}
$arResult["RETURN_DATA"] = "";
$arResult["RETURN_DATA_ARRAY"] = array();
// *************************/Default params*************************************************************
if (is_array($arResult["FILE"]) && !empty($arResult["FILE"]["SRC"])) {
    $arResult["FILE"]["FULL_SRC"] = CHTTP::URN2URI($arResult["FILE"]["SRC"], $arParams["SERVER_NAME"]);
    $ct = strToLower($arResult["FILE"]["CONTENT_TYPE"]);
    if ($arParams["SHOW_MODE"] == "LINK") {
        // do nothing
    } elseif ($arParams["MAX_FILE_SIZE"] >= $arResult["FILE"]["FILE_SIZE"] && substr($ct, 0, 6) == "image/") {
        $arResult["RETURN_DATA"] = $GLOBALS["APPLICATION"]->IncludeComponent("bitrix:forum.interface", "popup_image", array("URL" => $arParams["SHOW_MODE"] == "RSS" ? $arResult["FILE"]["FULL_SRC"] : $arResult["FILE"]["SRC"], "SIZE" => $arParams["SIZE"], "MAX_SIZE" => $arParams["MAX_SIZE"], "HTML_SIZE" => $arParams["HTML_SIZE"], "MODE" => $arParams["SHOW_MODE"] == "RSS" ? "RSS" : "SHOW2IMAGES", "IMG_WIDTH" => $arResult["FILE"]["WIDTH"], "IMG_HEIGHT" => $arResult["FILE"]["HEIGHT"], "IMG_NAME" => $arResult["FILE"]["ORIGINAL_NAME"], "IMG_SIZE" => $arResult["FILE"]["FILE_SIZE"], "CONVERT" => $arParams["CONVERT"], "FAMILY" => $arParams["FAMILY"], "RETURN" => "Y"), $this->__component->__parent !== null ? $this->__component->__parent : $this->__component, array("HIDE_ICONS" => "Y"));
    }
    $arResult["RETURN_DATA_ARRAY"]["DATA"] = $arResult["RETURN_DATA"];
    $arData = array();
    $size = intVal($arResult["FILE"]["FILE_SIZE"]) > 0 ? CFile::FormatSize(intval($arResult['FILE']['FILE_SIZE'])) : '';
    $sTitle = !empty($arResult["FILE"]["ORIGINAL_NAME"]) ? $arResult["FILE"]["ORIGINAL_NAME"] : GetMessage("FRM_DOWNLOAD");
    $file_ext = GetFileExtension($arResult["FILE"]["ORIGINAL_NAME"]);
    $arData["TITLE"] = "<a href=\"" . $arResult["FILE"]["SRC"] . "&action=download" . "\" class=\"forum-file forum-file-" . $file_ext . "\" " . (!empty($arResult["RETURN_DATA"]) ?: (substr($ct, 0, 6) == "image/" ? " data-bx-viewer=\"image\" data-bx-src=\"" . $arResult["FILE"]["SRC"] . "\" " . " data-bx-title=\"" . htmlspecialcharsbx($arResult["FILE"]["ORIGINAL_NAME"]) . "\" " . " data-bx-owner=\"" . htmlspecialcharsbx($arResult["FILE"]["OWNER"]) . "\" " . " data-bx-dateModify=\"" . htmlspecialcharsbx($arResult["FILE"]["TIMESTAMP_X"]) . "\" " . " data-bx-size=\"" . htmlspecialcharsbx($arResult["FILE"]["FILE_SIZE"]) . "\" " . " data-bx-download=\"" . $arResult["FILE"]["SRC"] . "&action=download\" " . " data-bx-width=\"" . htmlspecialcharsbx($arResult["FILE"]["WIDTH"]) . "\" " . " data-bx-height=\"" . htmlspecialcharsbx($arResult["FILE"]["HEIGHT"]) . "\" " : " data-bx-viewer=\"unknown\" data-bx-src=\"" . $arResult["FILE"]["SRC"] . "\" " . " data-bx-title=\"" . htmlspecialcharsbx($arResult["FILE"]["ORIGINAL_NAME"]) . "\" " . " data-bx-owner=\"" . htmlspecialcharsbx($arResult["FILE"]["OWNER"]) . "\" " . " data-bx-dateModify=\"" . htmlspecialcharsbx($arResult["FILE"]["TIMESTAMP_X"]) . "\" data-bx-tooBigSizeMsg=\"\" " . " data-bx-size=\"" . $size . "\" " . " data-bx-download=\"" . $arResult["FILE"]["SRC"] . "&action=download\" ")) . "title=\"" . str_replace("#FILE_NAME#", $arResult["FILE"]["ORIGINAL_NAME"], GetMessage("FRM_DOWNLOAD_TITLE")) . '" target="_blank">' . '<span>' . $arResult["FILE"]["ORIGINAL_NAME"] . '</span></a>';
    if ($size != '') {
        $arData["SIZE"] = "<span class=\"forum-file-size\">(" . $size . ")</span>";
    }
    $arResult["RETURN_DATA_ARRAY"] += $arData;
    if ($arParams["SHOW_MODE"] == "RSS") {
        $arResult["RETURN_DATA"] = !empty($arResult["RETURN_DATA"]) ? $arResult["RETURN_DATA"] : '<a href="' . $arResult["FILE"]["FULL_SRC"] . '">' . $arResult["FILE"]["ORIGINAL_NAME"] . '</a>';
    } elseif ($arParams["SHOW_MODE"] == "THUMB" && !empty($arResult["RETURN_DATA"])) {
        $arResult["RETURN_DATA"] = "<span class=\"forum-attach\" title=\"" . htmlspecialcharsbx($arResult["FILE"]["ORIGINAL_NAME"]) . " (" . $size . ")\">" . $arResult["RETURN_DATA"] . "</span>";
    } elseif ($arParams["SHOW_MODE"] != "FULL" || empty($arResult["RETURN_DATA"])) {
        $arResult["RETURN_DATA"] = "<span class=\"forum-attach\">" . implode(" ", $arData) . "</span>";
    } else {
        $arResult["RETURN_DATA"] = "<div class=\"forum-attach\">" . $arResult["RETURN_DATA"] . "<div>" . implode(" ", $arData) . "</div></div>";
Esempio n. 27
0
	protected static function _getAllFormFields($WEB_FORM_ID, $RESULT_ID, $arAnswers)
	{
		global $APPLICATION;

		$strResult = "";

		$w = CFormField::GetList($WEB_FORM_ID, "ALL", $by, $order, array("ACTIVE" => "Y"), $is_filtered);
		while ($wr=$w->Fetch())
		{
			$answer = "";
			$answer_raw = '';
			if (is_array($arAnswers[$wr["SID"]]))
			{
				$bHasDiffTypes = false;
				$lastType = '';
				foreach ($arAnswers[$wr['SID']] as $arrA)
				{
					if ($lastType == '') $lastType = $arrA['FIELD_TYPE'];
					elseif ($arrA['FIELD_TYPE'] != $lastType)
					{
						$bHasDiffTypes = true;
						break;
					}
				}

				foreach($arAnswers[$wr["SID"]] as $arrA)
				{
					if ($wr['ADDITIONAL'] == 'Y')
					{
						$arrA['FIELD_TYPE'] = $wr['FIELD_TYPE'];
					}

					$USER_TEXT_EXIST = (strlen(trim($arrA["USER_TEXT"]))>0);
					$ANSWER_TEXT_EXIST = (strlen(trim($arrA["ANSWER_TEXT"]))>0);
					$ANSWER_VALUE_EXIST = (strlen(trim($arrA["ANSWER_VALUE"]))>0);
					$USER_FILE_EXIST = (intval($arrA["USER_FILE_ID"])>0);

					if (
						$bHasDiffTypes
						&& !$USER_TEXT_EXIST
						&& (
							$arrA['FIELD_TYPE'] == 'text'
							||
							$arrA['FIELD_TYPE'] == 'textarea'
						)
					)
					{
						continue;
					}

					if (strlen(trim($answer)) > 0)
						$answer .= "\n";
					if (strlen(trim($answer_raw)) > 0)
						$answer_raw .= ",";

					if ($ANSWER_TEXT_EXIST)
						$answer .= $arrA["ANSWER_TEXT"].': ';

					switch ($arrA['FIELD_TYPE'])
					{
						case 'text':
						case 'textarea':
						case 'email':
						case 'url':
						case 'hidden':
						case 'date':
						case 'password':

							if ($USER_TEXT_EXIST)
							{
								$answer .= trim($arrA["USER_TEXT"]);
								$answer_raw .= trim($arrA["USER_TEXT"]);
							}

						break;

						case 'checkbox':
						case 'multiselect':
						case 'radio':
						case 'dropdown':

							if ($ANSWER_TEXT_EXIST)
							{
								$answer = substr($answer, 0, -2).' ';
								$answer_raw .= $arrA['ANSWER_TEXT'];
							}

							if ($ANSWER_VALUE_EXIST)
							{
								$answer .= '('.$arrA['ANSWER_VALUE'].') ';
								if (!$ANSWER_TEXT_EXIST)
								{
									$answer_raw .= $arrA['ANSWER_VALUE'];
								}
							}

							if (!$ANSWER_VALUE_EXIST && !$ANSWER_TEXT_EXIST)
							{
								$answer_raw .= $arrA['ANSWER_ID'];
							}

							$answer .= '['.$arrA['ANSWER_ID'].']';

						break;

						case 'file':
						case 'image':

							if ($USER_FILE_EXIST)
							{
								$f = CFile::GetByID($arrA["USER_FILE_ID"]);
								if ($fr = $f->Fetch())
								{
									$file_size = CFile::FormatSize($fr["FILE_SIZE"]);
									$url = ($APPLICATION->IsHTTPS() ? "https://" : "http://").$_SERVER["HTTP_HOST"]. "/freetrix/tools/form_show_file.php?rid=".$RESULT_ID. "&hash=".$arrA["USER_FILE_HASH"]."&action=download&lang=".LANGUAGE_ID;

									if ($arrA["USER_FILE_IS_IMAGE"]=="Y")
									{
										$answer .= $arrA["USER_FILE_NAME"]." [".$fr["WIDTH"]." x ".$fr["HEIGHT"]."] (".$file_size.")\n".$url;
									}
									else
									{
										$answer .= $arrA["USER_FILE_NAME"]." (".$file_size.")\n".$url."&action=download";
									}
								}

								$answer_raw .= $arrA['USER_FILE_NAME'];
							}

						break;
					}
				}
			}

			$strResult .= $wr["TITLE"].":\r\n".(strlen($answer)<=0 ? " " : $answer)."\r\n\r\n";
		}

		return $strResult;
	}
Esempio n. 28
0
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>
<?if($arParams["DISPLAY_TOP_PAGER"]):?>
	<?php 
echo $arResult["NAV_STRING"];
?>
<br />
<?endif;?>
<?foreach($arResult["ITEMS"] as $arItem):?>
	<?
	$this->AddEditAction($arItem['ID'], $arItem['EDIT_LINK'], CIBlock::GetArrayByID($arItem["IBLOCK_ID"], "ELEMENT_EDIT"));
	$this->AddDeleteAction($arItem['ID'], $arItem['DELETE_LINK'], CIBlock::GetArrayByID($arItem["IBLOCK_ID"], "ELEMENT_DELETE"), array("CONFIRM" => GetMessage('CT_BNL_ELEMENT_DELETE_CONFIRM')));
	$arUploadFileInf = CFile::GetFileArray($arItem["PROPERTIES"]["UPLOAD_FILE"]["VALUE"]);
	$UploadFileSize = CFile::FormatSize($arUploadFileInf["FILE_SIZE"], 2);
	$UploadFileExt = substr($arUploadFileInf["FILE_NAME"], strrpos($arUploadFileInf["FILE_NAME"], '.') + 1);

	/*if ($UploadFileExt!='zip' && $UploadFileExt!='rar') {
		$UploadFileExt = 'Нет';
	}*/

	$resizeImg = CFile::ResizeImageGet($arItem["DETAIL_PICTURE"], array('width'=>263, 'height'=>159), BX_RESIZE_IMAGE_EXACT, true);
	?>
	<div class="gallery-block-element">
<!--<?print_r($arItem["DETAIL_PICTURE"])?>-->
<!--<?print_r($resizeImg)?>-->
	<p class="news-item" id="<?php 
echo $this->GetEditAreaId($arItem['ID']);
?>
"></p>
		<?if (!($arItem["DETAIL_PICTURE"])):?>
			<a class="fancybox" rel="group" href="/images/no_preview_img.png"><img
					class="preview_picture"
Esempio n. 29
0
 /**
  * Copies file from really tmp dir to repo
  * @param $file
  * @param $canvas
  * @param $res
  * @return Status|Error
  */
 protected function copyFile($file, $canvas, &$res)
 {
     if (is_array($res) && array_key_exists("url", $res)) {
         return new Status("uploaded");
     }
     $hash = $this->getHash($file);
     $io = \CBXVirtualIo::GetInstance();
     $directory = $io->getDirectory($this->path . $hash);
     $path = $this->path . $hash . "/" . $canvas;
     $status = new Error("BXU347.2");
     if (!$directory->create()) {
         $status = new Error("BXU347.1");
     } elseif (array_key_exists('tmp_url', $res)) {
         if ((!file_exists($path) || @unlink($path)) && $this->http->download($res["tmp_url"], $path) !== false) {
             $status = new Status("uploaded");
         }
     } elseif (array_key_exists('chunks', $res)) {
         $status = $this->copyChunks($path, $res['chunks'], $res['chunksInfo']);
     } elseif (!file_exists($res['tmp_name'])) {
         if ($canvas != "default" && !empty($file["files"]["default"]) && $res["width"] <= $file["files"]["default"]["width"] && $res["height"] <= $file["files"]["default"]["height"] && @copy($file["files"]["default"]["tmp_path"], $path) && is_file($path)) {
             @chmod($path, BX_FILE_PERMISSIONS);
             $res["tmp_name"] = $path;
             $status = new Status("uploaded");
         } else {
             $status = new Error("BXU347.2");
         }
     } elseif ((!file_exists($path) || @unlink($path)) && move_uploaded_file($res['tmp_name'], $path)) {
         $status = new Status("uploaded");
     }
     $res["name"] = $file["name"];
     if ($status->getStatus() == "uploaded") {
         $res["tmp_name"] = $path;
         $res["size"] = filesize($path);
         unset($res['chunks']);
         unset($res['chunksInfo']);
         if (empty($res["type"]) || $canvas != "default") {
             $res["type"] = array_key_exists("type", $file) ? $file["type"] : \CFile::GetContentType($path);
         }
         $res["url"] = $this->getUrl($file["hash"] . "_" . $canvas);
         $res["sizeFormatted"] = \CFile::FormatSize($res["size"]);
     }
     return $status;
 }
Esempio n. 30
0
    $showFieldIcon = "";
    $showFieldText = "";
    if ($arRes["TYPE"] === "dir") {
        $showFieldIcon = '<a href="' . htmlspecialcharsbx($link) . '"><span id="fileman_menu_icon_sections" class="adm-submenu-item-link-icon"></span></a>';
        $showFieldText = '<a href="' . htmlspecialcharsbx($link) . '">' . htmlspecialcharsex($arRes["NAME"]) . '</a>';
    } else {
        $showFieldIcon = "";
        $showFieldText = '<a href="' . htmlspecialcharsbx($link) . '">' . htmlspecialcharsex($arRes["NAME"]) . '</a>';
    }
    $showField = '<table cellpadding="0" cellspacing="0" border="0"><tr><td align="left">' . $showFieldIcon . '</td><td align="left">&nbsp;' . $showFieldText . '</td></tr></table>';
    if ($arRes["TYPE"] === "dir") {
        $row->AddViewField("FILE_NAME", $showField);
        $row->AddViewField("FILE_SIZE", '&nbsp;');
    } else {
        $row->AddViewField("FILE_NAME", $showField);
        $row->AddViewField("FILE_SIZE", CFile::FormatSize((double) $arRes["SIZE"]));
    }
}
$lAdmin->BeginPrologContent();
if (is_object($message)) {
    echo $message->Show();
}
if ($obBucket->Init() && $_GET["file"] === "y") {
    echo "<script>SelFile('" . CUtil::JSEscape(urldecode($obBucket->GetFileSRC(rtrim($path, "/")))) . "');</script>";
}
$lAdmin->EndPrologContent();
$lAdmin->CheckListMode();
$APPLICATION->SetTitle(GetMessage("CLO_STORAGE_SEARCH_TITLE"));
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_popup_admin.php";
?>
<form name="form1" method="GET" action="<?php