This commit is contained in:
2026-05-15 18:33:51 +02:00
parent 3601be572f
commit c980004309
8442 changed files with 783630 additions and 1 deletions

View File

@@ -0,0 +1,13 @@
<?php
/**
* @author krku
*/
function smarty_block_bbcode($params, $content, &$smarty, &$repeat) {
$bbcodeParser = new LightBBCodeParser();
return $bbcodeParser->bbc2html($content);
// return $content;
}
?>

View File

@@ -0,0 +1,23 @@
<?php
/**
* @author mabi
*/
function smarty_block_ca($params, $content, &$smarty, &$repeat) {
$user = $smarty->get_template_vars(Admin::SMARTY_NAME);
if(isset($params['role'])) {
$role = $params['role'];
} else {
$role = Admin::SMARTY_DEFAULT_ACCESS;
}
$access = $user->CheckAccess($role);
if($access) {
return $content;
} else {
return '';
}
}
?>

View File

@@ -0,0 +1,85 @@
<?php
/**
* @author krku
*/
function smarty_block_dropDownContainer($params, $content, &$smarty, &$repeat) {
//Utils::ArrayDisplay($params);
if (!$repeat) {
if (isset($params['isClose']) && $params['isClose']) {
$isClose = true;
} else {
$isClose = false;
}
if (isset($params['isHidden']) && $params['isHidden']) {
$isHidden = true;
} else {
$isHidden = false;
}
if (isset($params['icon']) && $params['icon']) {
$icon = $params['icon'];
} else {
$icon = false;
}
if (isset($params['publish']) && $params['publish']) {
$publish = $params['publish'];
} else {
$publish = 0;
}
if (isset($params['setupBox']) && $params['setupBox']) {
$setupBox = $params['setupBox'];
} else {
$setupBox = 'setupBox';
}
if (isset($params['id']) && $params['id']) {
$id = $params['id'];
} else {
$id = md5(uniqid(rand(), true));
}
//Utils::ArrayDisplay($icon);
$link = $params['title'];
$ret = '<div class="mainOptions" ' . ($isHidden ? 'style="display: none;"' : '') . ' ' . (isset($params['idMain']) ? 'id="' . $params['idMain'] . '"' : '') . ' >';
$ret .= '<h2 class="slidingTab"><a href="#" class="' . ($isClose ? 'expand' : 'colapse') . '" onclick="dropDownChange(this, \'#' . $id . '\'); return false;">' . $link . '</a>' . (isset($params['additionalTitle']) ? ' ' . $params['additionalTitle'] : '') . '</h2>';
//$ret .= '</div>';
if ($icon) {
$ret .= '<div class="optionIconBox">';
if (is_array($icon)) {
foreach ($icon as $iconConfig) {
switch ($iconConfig) {
case 'delete':
$ret .= '<a class="optionIcon iconDelete" title="Usuń" href="#" onclick="if (DeleteModuleAction(\'Czy napewno usunęć ten moduł? Po zapisaniu moduł wraz z elementami zostanie usunięty trwale!\', \''.$params['moduleBoxId'].' \')) { } else {return false;}">&nbsp;</a>';
break;
case 'publication':
$ret .= '<a id="publicationIcon_'.$params['moduleBoxId'].'" class="optionIcon iconPublish'. ($publish == 1 ? 'On"' : 'Off"') .'" title="'. ($publish == 1 ? 'Niepublikuj"' : 'Publikuj"') .'" href="#" onclick="PublishModule(\''.$params['moduleBoxId'].' \'); return false;">&nbsp;</a>';
break;
case 'setup':
$ret .= '<a class="optionIcon iconEdit" title="Ustawienia" onclick="showHide('. "'#" . $setupBox . "'" . ');">&nbsp;</a> ';
break;
case 'sort':
$ret .= '<a class="optionIcon iconUp" id=' . "'up_" . $params['moduleBoxId'] . "'" . ' title="Przenieś wyżej" onclick="SortModule(' . "'" . $params['moduleBoxId'] . "'" . ', \'up\');">&nbsp;</a> ';
$ret .= '<a class="optionIcon iconDown" id=' . "'down_" . $params['moduleBoxId'] . "'" . ' title="Przenieś niżej" onclick="SortModule(' . "'" . $params['moduleBoxId'] . "'" . ', \'down\');">&nbsp;</a> ';
break;
default:
break;
}
}
}
$ret .= '</div>';
}
$ret .= '<div class="optionContent" id="' . $id . '" ' . ($isClose ? 'style="display: none;"' : '') . '>';
$ret .= $content;
$ret .= '</div>';
$ret .= '</div>';
//$ret .= '<div class="panelContentBottom"></div>';
return $ret;
}
}
?>

View File

@@ -0,0 +1,407 @@
<?php
/**
* @author krku, mija
*
* Smarty plugin
* -------------------------------------------------------------
* File: block.innerFrame.php
* Type: block
* Name: innerFrame
* Purpose: Wewnêtrzna ramka
* -------------------------------------------------------------
*/
function __temp_function_make_image_url($headerTitle, $imageType, $zak = null) {
$url = Utils::makeImageUrlFromHeader($headerTitle);
if ($zak !== null) {
$imageUrl = "/image/Strona/zakladki/" . $imageType . $url . ($zak === 1 ? '_' : '-') . '.gif';
} else {
$imageUrl = "/image/Strona/" . ($imageType == 'header' ? "naglowki/" : "") . $imageType . $url . '.gif';
}
return $imageUrl;
}
function smarty_block_innerFrame($params, $content, &$smarty, &$repeat)
{
if (!$repeat) // Coby siê dwa razy nie wykonywa³o
{
$los = uniqid();
$mainObjPreserve = $smarty->get_template_vars("MainObjPreserve");
$bookmarks = $smarty->get_template_vars('bookmarks');
if (isset($bookmarks) && isset($bookmarks['count']) && $bookmarks['count'] > 0) {
$zakladki = true;
} else {
$bookmarks = array('data' => array());
$zakladki = false;
}
// if ($smarty->get_template_vars('MainObjPreserve')->GetId() != 0) {
$login_f = true;
// } else {
// $login_f = false;
// }
$firstBookmark = $params;
$firstBookmark['content'] = $content;
$useUrl = false;
if ($zakladki) {
if ($bookmarks['useUrl']) {
$useUrl = true;
$bcont = $firstBookmark['content'];
}
if (isset($firstBookmark['headerTitle'])) {
$headerTitleAll = $firstBookmark['headerTitle'];
}
$display = 'none';
} else {
$bookmarks['data'][] = $firstBookmark;
$display = 'block';
}
//Usuwamy tre¶æ zak³adek, ¿eby siê wiêcej razy nie pojawia³a
//Utils::ArrayDisplay($bookmarks);
$smarty->clear_assign('bookmarks');
$headerShown ='';
if(isset($params['hidden']) && $params['hidden'] == true ){
$headerShown = 'style="display:none"';
}
$className='';
if(isset($params['className'])){
$className = ' '.$params['className'].' menuTab';
}
$content = '';
$header = '<div class="innerFrameHeader'.$className.'" '.$headerShown.'>';
if (isset($headerTitleAll)) {
$headerImg = __temp_function_make_image_url($headerTitleAll, 'header');
if (file_exists(PATH_STATIC_CONTENT . $headerImg)) {
$header .= '<img class="innerFrameHeaderTitleMain' . ($bookmarks['small'] ? "Small" : "") . '" src="' . URL_STATIC_CONTENT . $headerImg . '" alt="' . $headerTitleAll . '" title="' . $headerTitleAll . '" />';
} else {
$header .= '<h1 class="innerFrameHeaderTitleMain' . ($bookmarks['small'] ? "Small" : "") . '">' . $headerTitleAll . '</h1>';
}
}
if ($zakladki) {
$header .= '<div class="innerFrameHeaderBookmarkMenu">';
}
foreach ($bookmarks['data'] as $k => $bookmark) {
if (!$useUrl) {
$bcont = $bookmark['content'];
}
if ($zakladki && $k == $bookmarks['active']) {
$displayIn = 'block';
$img = '_';
} else {
$displayIn = $display;
$img = '-';
}
if (((isset($cookmark['moreButton']) && $cookmark['moreButton']) || !isset($bookmark['moreButton'])) && isset($bookmark['moreUrl']) && $bookmark['moreUrl']) {
$moreUrl = $bookmark['moreUrl'];
} else if (((isset($firstBookmark['moreButton']) && $firstBookmark['moreButton']) || !isset($firstBookmark['moreButton'])) && isset($firstBookmark['moreUrl']) && $firstBookmark['moreUrl']) {
$moreUrl = $firstBookmark['moreUrl'];
}
if ((isset($bookmark['addButton']) && $bookmark['addButton']) || !isset($bookmark['addButton'])) {
if (isset($bookmark['addUrl']) && $bookmark['addUrl']) {
$addUrl = $bookmark['addUrl'];
}
else if (isset($bookmark['addUrlScript']) && $bookmark['addUrlScript']) {
$addUrl = $bookmark['addUrlScript'];
$addScript = true;
}
else if ((isset($firstBookmark['addButton']) && $firstBookmark['addButton']) || !isset($firstBookmark['addButton'])) {
if (isset($firstBookmark['addUrl']) && $firstBookmark['addUrl']) {
$addUrl = $firstBookmark['addUrl'];
}
else if (isset($firstBookmark['addUrlScript']) && $firstBookmark['addUrlScript']) {
$addUrl = $firstBookmark['addUrlScript'];
$addScript = true;
}
}
}
if (((isset($bookmark['editBlocked']) && !$bookmark['editBlocked']) || !isset($bookmark['editBlocked'])) && isset($bookmark['editUrl'])) {
$editUrl = $bookmark['editUrl'];
} else if (((isset($firstBookmark['editBlocked']) && !$firstBookmark['editBlocked']) || !isset($firstBookmark['editBlocked'])) && isset($firstBookmark['editUrl'])) {
$editUrl = $firstBookmark['edit'];
}
if (((isset($bookmark['abuseButton']) && $bookmark['abuseButton']) || !isset($bookmark['abuseButton'])) && isset($bookmark['abuseUrl'])) {
$abuseUrl = $bookmark['abuseUrl'];
} else if (((isset($firstBookmark['abuseButton']) && $firstBookmark['abuseButton']) || !isset($firstBookmark['abuseButton'])) && isset($firstBookmark['abuseUrl'])) {
$abuseUrl = $firstBookmark['abuseUrl'];
}
if (!$zakladki) {
if (isset($moreUrl)) {
$header .= '<div>';
} else {
$header .= '<div>';
}
}
if ($zakladki) {
$headerImg = __temp_function_make_image_url($bookmark['headerTitle'], 'zak', ($k == $bookmarks['active'] ? 1 : 0));
} else {
$headerImg = __temp_function_make_image_url($bookmark['headerTitle'], 'header');
}
if (file_exists(PATH_STATIC_CONTENT . $headerImg)) {
$hT = '<img id="innerFrameContentBookmark' . $k . 'Button' . $los . 'Img" src="' . URL_STATIC_CONTENT . $headerImg . '" alt="' . $bookmark['headerTitle'] . '" title="' . $bookmark['headerTitle'] . '"';
if ($zakladki) {
if ($useUrl) {
$header .= '<a href="' . $bookmark['url'] . '">' . $hT . ' /></a>';
} else {
$header .= $hT . ' onclick="switchBookmark(\'' . $los . '\', ' . $k . ');" />';
}
} else {
$hT .= " />";
if (isset($moreUrl) && $moreUrl) {
$header .= '<a href="' . $moreUrl . '">' . $hT . '</a>';
} else {
$header .= $hT;
}
}
} else {
$hT = $bookmark['headerTitle'];
if ($zakladki) {
if ($useUrl) {
$header .= '<h1><a href="' . $bookmark['url'] . '">' . $hT . '</a></h1>';
} else {
$header .= '<h1>' . $hT . '</h1>';
}
} else if (isset($moreUrl) && $moreUrl) {
$header .= '<h1><a href="' . $moreUrl . '">' . $hT . '</a></h1>';
} else {
$header .= '<h1>' . $hT . '</h1>';
}
}
unset($hT);
if (!$zakladki) {
$header .= '</div>';
}
if(isset($params['hidden']) && $params['hidden'] == true ){
$displayIn = 'none';
}
$content .= '<div class="innerFrame'.$className.'" id="inner' . $k . 'Frame' . $los . '" style="display: ' . $displayIn . ';">'.
'<div class="innerFrameContent"' . (isset($bookmark['contentId']) ? ' id="' . $bookmark['contentId'] . '"' : '') . '>' .
(isset($bookmarks['begin_content']) ? $bookmarks['begin_content'] : '') . $bcont . (isset($bookmarks['end_content']) ? $bookmarks['end_content'] : '').
'</div>'.
'<div class="cornerInnerTopLeft"><img src="'.URL_STATIC_CONTENT.'/image/Strona/cornerFrameTopLeft.gif" alt="" border="0" /></div>'.
'<div class="cornerInnerTopRight"><img src="'.URL_STATIC_CONTENT.'/image/Strona/cornerFrameTopRight.gif" alt="" border="0" /></div>'.
'<div class="cornerInnerBottomLeft"><img src="'.URL_STATIC_CONTENT.'/image/Strona/cornerFrameBottomLeft.gif" alt="" border="0" /></div>'.
'<div class="cornerInnerBottomRight"><img src="'.URL_STATIC_CONTENT.'/image/Strona/cornerFrameBottomRight.gif" alt="" border="0" /></div>';
if (!$zakladki || $zakladki && ((isset($bookmark['frameIcon']) && $bookmark['frameIcon']) || (isset($firstBookmark['frameIcon']) && $firstBookmark['frameIcon']))) {
if (isset($bookmark['frameIcon'])) {
$frameIcon = '/image/Strona/icon' . $bookmark['frameIcon'] . '.gif';
} else if (isset($firstBookmark['frameIcon'])) {
$frameIcon = '/image/Strona/icon' . $firstBookmark['frameIcon'] . '.gif';
} else {
$frameIcon = __temp_function_make_image_url($bookmark['headerTitle'], 'icon');
}
if (isset($bookmark['iconTop'])) {
$iconTop = $bookmark['iconTop'];
} else {
if($frameIcon == "/image/Strona/iconDeformator.gif")
$iconTop = -60;
else
$iconTop = -45;
}
if (isset($bookmark['iconRight'])) {
$iconRight = $bookmark['iconRight'];
} else {
$iconRight = 10;
}
if (isset($bookmark))
$frameIcon = $frameIcon;
if (file_exists(PATH_STATIC_CONTENT . $frameIcon)) {
$content .= '<div class="innerFrameIcon" style="top: ' . $iconTop .'px; right: ' . $iconRight . 'px;">'.
'<img src="' . URL_STATIC_CONTENT . $frameIcon . '" border="0" title="' . $bookmark['headerTitle'] . '" alt="' . $bookmark['headerTitle'] . '" />'.
'</div>';
}
}
if (isset($moreUrl)) {
$moreId = "buttonFrameMore" . ($zakladki ? $k : '') . $los;
if (isset($bookmark['moreTitle'])) {
$moreTitle = $bookmark['moreTitle'];
} else {
$moreTitle = "wiêcej";
}
$content .= '
<div class="innerFrameMore">'.
'<a onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'' . $moreId . '\');" href="' . $moreUrl . '" title="' . $moreTitle . '">'.
'<img id="' . $moreId . '" src="' . URL_STATIC_CONTENT . '/image/Strona/buttony/ramka/buttonFrameMore-.gif" alt="' . $moreTitle . '" title="' . $moreTitle . '" border="0" />'.
'</a></div>';
}
if (isset($addUrl)) {
$addImg = 'buttonFrame';
if (isset($bookmark['addImg'])) {
$addImg .= $bookmark['addImg'];
} else if (isset($bookmark['addComment'])) {
$addImg .= 'AddComment';
} else if (isset($firstBookmark['addImg'])) {
$addImg .= $firstBookmark['addImg'];
} else if (isset($firstBookmark['addComment'])) {
$addImg .= 'AddComment';
} else {
$addImg .= 'Add';
}
if (isset($bookmark['addComment']) || isset($firstBookmark['addComment'])) {
$addId = "buttonFrameAddComment";
} else {
$addId = "buttonFrameAdd" . ($zakladki ? $k : '') . $los;
}
$addClass = "innerFrameAdd";
if (isset($bookmark['addOnTop']) || isset($bookmark['addComment']) || isset($firstBookmark['addOnTop']) || isset($firstBookmark['addComment'])) {
$addClass .= "Top";
if (!isset($firstBookmark['addComment']) && !isset($bookmark['addComment'])) {
$addImg .= "Top";
}
} else if (isset($editUrl)) {
$addClass .= "WithEdit";
}
if (isset($bookmark['addTitle'])) {
$addTitle = $bookmark['addTitle'];
} else if (isset($firstBookmark['addTitle'])) {
$addTitle = $firstBookmark['addTitle'];
} else {
$addTitle = "dodaj";
}
$content .= '<div class="' . $addClass .'" ';
// if ($mainObjPreserve->GetId() == 0) {
// $addTitle = 'Zaloguj siê aby co¶ dodaæ';
// $addImgW = $addImg;
// $content .= '><a rev="width: 405px; height: 370px; scrolling: no;" title="' . $addTitle . '" rel="lyteframe" href="#" onclick="myLytebox.start(this, false, true,false,\'logowanie.html\'); return false;">';
// $addInactive = true;
// } else {
$addImgW = $addImg;
$addImg .= '-';
$addInactive = false;
$content .= 'onmouseover="MM_swapImage(\'' . $addId . '\');" onmouseout="MM_swapImgRestore()"';
if (!isset($addScript)) {
$content .= '><a href="' . $addUrl . '" title="' .$addTitle . '">';
} else {
$content .= ' onclick="' . $addUrl . '">';
}
// }
$content .= '<img style="display: none;" src="' . URL_STATIC_CONTENT . '/image/Strona/buttony/ramka/' . $addImgW . '-.gif" alt="" /><img style="display: none;" src="' . URL_STATIC_CONTENT . '/image/Strona/buttony/ramka/' . $addImgW . '_.gif" alt="" />';
$content .= '<img id="' . $addId . '" src="' . URL_STATIC_CONTENT . '/image/Strona/buttony/ramka/' . $addImg . '.gif" alt="' . $addTitle . '" title="' . $addTitle . '" border="0" />';
if (!isset($addScript)) {
$content .= '</a>';
}
$content .= '</div>';
if (isset($bookmark['addComment'])) {
$content .= '<div id="buttonFrameCancelComment" class="innerFrameAddTop" onmouseover="MM_swapImage(\'commentCancel\')" onmouseout="MM_swapImgRestore()" onclick="HideAddForm();" style="display: none;">'.
'<img id="commentCancel" border="0" title="Anuluj komentowanie" alt="Anuluj komentowanie" src="' . URL_STATIC_CONTENT . '/image/Strona/buttony/ramka/buttonFrameAnulujKomentowanie-.gif" />'.
'</div>';
}
}
if (isset($editUrl) && $login_f) {
$editId = "buttonFrameEdit" . ($zakladki ? $k : '') . $los;
if (isset($bookmark['editTitle'])) {
$editTitle = $bookmark['editTitle'];
} else {
$editTitle = "edytuj";
}
$content .= '
<div class="innerFrameEdit"' . (isset($addUrl) && $addUrl ? '' : 'WithoutAdd') . '>'.
'<a onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'' . $editId . '\');" href="' . $editUrl . '" title="' . $editTitle . '">'.
'<img id="' . $editId . '" src="' . URL_STATIC_CONTENT . '/image/Strona/buttony/ramka/buttonFrameEdit-.gif" alt="' . $editTitle . '" title="' . $editTitle . '" border="0" />'.
'</a></div>';
}
if (isset($abuseUrl)) {
$abuseImg = 'buttonFrame';
if (isset($bookmark['abuseImg'])) {
$abuseImg .= $bookmark['abuseImg'];
} else {
$abuseImg .= 'Abuse';
}
if (isset($bookmark['abuseTitle'])) {
$abuseTitle = $bookmark['abuseTitle'];
} else {
$abuseTitle = "Zg³o¶ nadu¿ycie";
}
$abuseId = "buttonFrameAbuse" . ($zakladki ? $k : '') . $los;
$abuseClass = "innerFrameAbuse";
$content .= '<div class="' . $abuseClass . '"><a title="' . $abuseTitle . '" rev="width: 540px; height: 425px; scrolling: no;" rel="lyteframe" onclick="myLytebox.start(this, false, true,true,\'' . $abuseUrl. '\'); return false;">'.
'<img id="' . $abuseId . '" src="' . URL_STATIC_CONTENT . '/image/Strona/buttony/ramka/' . $abuseImg . '.gif" alt="' . $abuseTitle . '" title="' . $abuseTitle . '" border="0" /></a></div>';
}
$content .= '</div>';
}
$header .= '</div>';
if ($zakladki) {
$header .= '</div>';
}
$smarty->clear_assign('bookmarks');
//Utils::ArrayDisplay($content);
return $header . $content;
}
}
?>

View File

@@ -0,0 +1,105 @@
<?php
/**
* @author krku
*/
function smarty_block_insertPhotoCropper($params, $content, &$smarty, &$repeat) {
if (!$repeat) {
if (isset($params['preview'])) {
if (!is_string($params['preview'])) {
$preview = $params['prefix'] . "CropPreview";
} else {
$preview = $params['preview'];
}
}
$width = $smarty->get_template_vars('photoWidth');
$height = $smarty->get_template_vars('photoHeight');
$minWidth = $smarty->get_template_vars('minPhotoWidth');
$minHeight = $smarty->get_template_vars('minPhotoHeight');
$uploadUrl = Router::GenerateUrl($smarty->get_template_vars('uploadUrl'));
$cutUrl = Router::GenerateUrl($smarty->get_template_vars('cutUrl'));
if (isset($params['loadOnFly']) && $params['loadOnFly']) {
$onFly = true;
$uploadForm = '
<div class="photoUploadForm" id="' . $params['prefix'] . 'PhotoUploadForm">
<form onsubmit="return false;" action="' . $uploadUrl . '" method="post" name="' . $params['prefix'] . 'PhotoUpload" target="' . $params['prefix'] . 'PhotoUploadIFrame" enctype="multipart/form-data">
<input type="file" name="photo" onchange="startUpload(\'' . $params['prefix'] . 'PhotoUploadIFrame\', this.form);" title="" />
<input name="onFly" value="1" type="hidden" />
<input name="cropPrefix" value="' . $params['prefix'] . '" type="hidden" />
</form>
<iframe src="puste" id="' . $params['prefix'] . 'PhotoUploadIFrame" name="' . $params['prefix'] . 'PhotoUploadIFrame" class="photoUpload" frameborder="0" width="1" height="1"></iframe>
</div>';
} else {
$obFly = false;
}
$photoCropper = '
<div class="cropperMainPhotoFrame">
<img src="' . ($onFly ? $smarty->get_template_vars('noPhotoImgBig') : '') . '" id="' . $params['prefix'] . 'CropArea" class="PhotoBig" ';
if ($height != false && $width != false) {
$photoCropper .= 'style="height: ' . $height . 'px; width: ' . $width . 'px;"';
}
$photoCropper .= ' />
</div>
<div class="cropperInfoFrame">';
if (isset($preview)) {
$photoCropper .= '
<h4>Podgląd</h4>
<div id="' . $preview . '" class="' . $params['prefix'] . 'PhotoSmall">
<img id="' . $params['prefix'] . 'PreviewArea" src="' . ($onFly ? $smarty->get_template_vars('noPhotoImgSmall') : '') . '" />
</div>
Wybierz odpowiedni kadr przesuwając i regulując krawędzie kwadratowego obszaru.';
}
if (isset($params['viewForm']) && $params['viewForm']) {
$type = "text";
} else {
$type = "hidden";
}
$desc = '';
if(isset($params['description']) && $params['description'] == true) {
$desc = '<textarea name="' . $params['prefix'] . 'Description" id="' . $params['prefix'] . 'Description" class="cropper"></textarea>';
} else {
$desc = '<input type="hidden" name="' . $params['prefix'] . 'Description" id="' . $params['prefix'] . 'Description" value="0" />';
}
$photoCropper .= '
<input type="' . $type . '" name="' . $params['prefix'] . 'ImageCropX1" id="' . $params['prefix'] . 'ImageCropX1" />
<input type="' . $type . '" name="' . $params['prefix'] . 'ImageCropX2" id="' . $params['prefix'] . 'ImageCropX2" />
<input type="' . $type . '" name="' . $params['prefix'] . 'ImageCropY1" id="' . $params['prefix'] . 'ImageCropY1" />
<input type="' . $type . '" name="' . $params['prefix'] . 'ImageCropY2" id="' . $params['prefix'] . 'ImageCropY2" />
<input type="' . $type . '" name="' . $params['prefix'] . 'ImageCropWidth" id="' . $params['prefix'] . 'ImageCropWidth" />
<input type="' . $type . '" name="' . $params['prefix'] . 'ImageCropHeight" id="' . $params['prefix'] . 'ImageCropHeight" />
<input type="hidden" name="' . $params['prefix'] . 'ImageFileName" id="' . $params['prefix'] . 'ImageFileName" value="' . $params['photoSrc'] . '"/>
</div>
' . $desc . '
<div class="clearBoth"></div>
';
$formBegin = '<form name="photoCropper" action="' . $cutUrl . '" method="post" onsubmit="doCropPhoto(this, \'photoCropper\'); return false;">';
$content = str_replace('%formBegin%', $formBegin, $content);
$content = str_replace('%formEnd%', '</form>', $content);
$content = str_replace('%photoCropper%', $photoCropper, $content);
$content = str_replace('%uploadForm%', $uploadForm, $content);
$content = str_replace('%errorAreaId%', $params['prefix'] . 'ErrorArea', $content);
$content .= '<script type="text/javascript" language="javascript">'."
initializeCropper('$preview', '$params[prefix]', $minWidth, $minHeight, $params[onInit], " . ($params['loadOnFly'] ? 'true' : 'false') . ");
</script>";
return $content;
}
}
?>

View File

@@ -0,0 +1,30 @@
<?php
/*
* Smarty plugin
* -------------------------------------------------------------
* File: function.breadCrumbs.php
* Type: function
* Name: link
* Purpose: zwraca breadcrumbs w htmlu
* -------------------------------------------------------------
*/
function smarty_function_breadCrumbs($params, &$smarty){
$input = $smarty->getTemplateVars('breadCrumbs');
//Utils::ArrayDisplay($input);
$return = array();
if(is_array($input)) {
foreach($smarty->getTemplateVars('breadCrumbs') as $row) {
if($row['url']!='') {
$return[] = " <a href=\"".$row['url']."\" title=\"".$row['title']."\">".$row['title']."</a> ";
}else {
$return[] = " ".$row['title']." ";
}
}
return implode( ' > ', $return);
}
}
?>

View File

@@ -0,0 +1,119 @@
<?php
/*
* Smarty plugin
* -------------------------------------------------------------
* File: function.datePopup.php
* Type: function
* Name: datePopup
* Purpose: Umieszcza pole tekstowe z mo¿lwio¶ci± wybrania daty.
* -------------------------------------------------------------
*/
function smarty_function_datePopup($params, &$smarty)
{
$options = "
closebutton: \"<img src=\\\"" . URL_STATIC_CONTENT . "/image/x.gif\\\" alt=\\\"Zamknij\\\" />\",
" . /* closebutton: '<img src=\"" . URL_STATIC_CONTENT . "/image/Strona/x.gif\" alt=\"Zamknij\" \/> */ "
url_static_content: '" . URL_STATIC_CONTENT . "'";
if (isset($params['year']))
{
$options .= ",
yearnext: '&gt;',
yearprev: '&lt;',
nextbutton: '&raquo;',
prevbutton: '&laquo;'";
}
$ret = '
<div id="' . $params['div_id'] . '" class="kalendarzyk" style="display:block;"></div>
<script type="text/javascript" language="javascript">
var calendar = false;
var cal = $(\'' . $params['div_id'] . '\');
var toogle_calendar = function()
{
if(calendar)
{
calendar.toggleCalendar();
}
else
{
var options = Object.extend({'.$options.'
})
cal.show();
calendar = new scal(\''. $params['div_id'] . '\', \'' . $params['field_id'] . '\', options);';
if (isset($params['start_date']) && $params['start_date'])
{
$ret .= '
calendar.start_date = \'' . $params['start_date'] . '\';';
}
if (isset($params['year']))
{
$ret .= '
calendar.showYearChanger();';
if (is_numeric($params['year']) && !isset($params['value'])) {
$ret .= '
calendar.setCurrentDate(new Date(' . ((int)date('Y') + $params['year']) . ', ' . ((int)date("n") - 1) . ', ' . date("j") . '));';
}
}
if (isset($params['value']))
{
$val = explode(' ', $params['value']);
$val = $val[0];
$val = explode('-', $val);
if ($val[1] <= 0 && $val[1] > 11)
$val[1] = 0;
else
(int)$val[1]--;
$value = implode(',', $val);
$ret .= '
calendar.setCurrentDate(new Date(' . $value . '));';
}
$ret .= '
}
}
var open_calendar = function()
{
if(calendar)
calendar.openCalendar();
else
toogle_calendar();
}
cal.style.display = \'none\';
';
if (isset($params['left']))
$ret .= 'cal.style.left = \'' . $params['left'] . 'px\';';
if (isset($params['right']))
$ret .= 'cal.style.right = \'' . $params['right'] . 'px\';';
if (isset($params['top']))
$ret .= 'cal.style.top = \'' . $params['top'] . 'px\';';
if (isset($params['bottom']))
$ret .= 'cal.style.bottom = \'' . $params['bottom'] . 'px\';';
$ret .= '
</script>
<input '.(isset($params['class']) ? 'class="'.$params['class'] . '" ': '') . 'type="text" name="' . $params['field_name'] . '" value="' . (isset($params['value']) ? $params['value'] : '') .'" id="' . $params['field_id'] . '" />
<img style="cursor: pointer;" src="' . URL_STATIC_CONTENT . '/image/calendar_small.gif" alt="Wybierz datê" onclick="toogle_calendar()" />';
return $ret;
}
?>

View File

@@ -0,0 +1,18 @@
<?php
/**
* formatuje tak date posta, żeby zamiast konkretnej daty wyświetlało : wczoraj , przed wczoraj, x dni temu, x tygodni temu, x miesięcy temu, x lat temu
*
* @param $str
* @return unknown_type
*/
function smarty_function_dictionary($param, &$smarty){
$dictionaryArray = Registry::Get("dictionary");
$keyword = $param["keyword"];
unset($param["keyword"]);
return vsprintf($dictionaryArray[$keyword], $param);
}
?>

View File

@@ -0,0 +1,50 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {explode} function plugin
*
* Type: function<br>
* Name: explode<br>
* Purpose: split a string into an array and assign it to the template<br>
* @link http://smarty.php.net/manual/en/language.function.explode.php {explode}
* (Smarty online manual)
* @author Will Mason <will at dontblinkdesign dot com>
* @param array
* @param Smarty
*/
function smarty_function_explode($params, &$smarty)
{
//Utils::ArrayDisplay($params);
if (!isset($params['subject'])) {
$smarty->trigger_error("explode: missing 'subject' parameter");
return;
}
if (!isset($params['search'])) {
$smarty->trigger_error("explode: missing 'search' parameter");
return;
}
if (!isset($params['assign'])) {
$smarty->trigger_error("explode: missing 'assign' parameter");
return;
}
if (isset($params['limit']))
$array = explode($params['search'], $params['subject'], $params['limit']);
else
$array = explode($params['search'], $params['subject']);
$smarty->assign($params['assign'], $array);
// Utils::ArrayDisplay($params['subject']);
// Utils::ArrayDisplay($array);
}
/* vim: set expandtab: */
?>

View File

@@ -0,0 +1,72 @@
<?php
/**
* @author krku
*/
function smarty_function_formField($params, &$smarty) {
$errorList = $smarty->get_template_vars('errorList');
if (isset($params['value'])) {
$value = $params['value'];
} else if (isset($params['obj']) && $smarty->get_template_vars($params['obj']) && is_object($smarty->get_template_vars($params['obj'])) && isset($params['func'])) {
$func = $params['func'];
$value = $smarty->getTemplateVars($params['obj'])->$func();
} else {
$value = Request::GetPost($params['name']);
}
if (isset($params['obj'])) {
unset($params['obj']);
}
if (isset($params['func'])) {
unset($params['func']);
}
if (!$value) {
$value = '';
}
if (!isset($params['type'])) {
trigger_error('Parametr `type` jest wymagany.');
}
if (!isset($params['name'])) {
trigger_error('Parametr `name` jest wymagany.');
}
$tagParameters = '';
foreach ($params as $tag => $val) {
if ($val != 'textarea') {
$tagParameters .= $tag . '="' . $val . '" ';
}
}
if ($params['type'] == 'textarea') {
$ret = '<textarea ' . $tagParameters . '>' . $value . '</textarea>';
} else if ($params['type'] == 'radio' || $params['type'] == 'checkbox') {
$ret = '<input ' . $tagParameters . '" ' . ($value ? 'checked="checked"' : '') . ' />';
} else {
$ret = '<input ' . $tagParameters . ' value="' . $value . '" />';
}
//$ret .= '<br />';
$ret .= '<div ' . (isset($params['errorClass']) ? 'class="' . $params['errorClass'] . '" ' : '') . 'id="' . $params['name'] . 'Error"> ';
if(is_countable($errorList)) {
if (sizeof($errorList)) {
foreach ($errorList as $k => $v) {
if ($v['field'] == $params['name']) {
$ret .= $v['msg'].' ';
}
}
}
}
$ret .= ' </div>';
return $ret;
}
?>

View File

@@ -0,0 +1,78 @@
<?php
/*
* Smarty plugin
* -------------------------------------------------------------
* File: function.formatText.php
* Type: function
* Name: formatText
* Purpose: Formatuje tekst - wstawia <br /> za znaki koñca linii, przycina, prawdopodobnie bêdzie wstawiaæ
* -------------------------------------------------------------
*/
function smarty_function_formatText($params, &$smarty)
{
require_once $smarty->_get_plugin_filepath('modifier', 'truncate');
if (!isset($params['lenght'])) {
$lenght = CONTENT_MAX_DISP_LEN;
} else {
$lenght = $params['lenght'];
unset($params['lenght']);
}
if (!isset($params['etc'])) {
$etc = '...';
} else {
$etc = $params['etc'];
unset($params['etc']);
}
$string = $params['text'];
unset($params['text']);
if (!isset($params['moreTitle'])) {
$wiecejT = "Zobacz wiêcej";
} else {
$wiecejT = $params['moreTitle'];
unset($params['moreTitle']);
}
if (!isset($params['moreName'])) {
$wiecejN = "&nbsp;";
} else {
$wiecejN = $params['moreName'];
unset($params['moreName']);
}
$string = nl2br($string);
if(isset($params['urlWiecej']))
$params['moreUrl'] = $params['urlWiecej'];
if (is_integer($lenght)) {
if (!isset($params['moreUrl']) && !isset($params['noMoreUrl'])) {
$moreArr = array();
foreach ($params as $key => $val) {
if($key != "limit")
$moreArr[] = "$key,$val";
}
$params['moreUrl'] = implode(',', $moreArr);
$params['moreUrl'] .= ".html";
}
$string = smarty_modifier_truncate($string, $lenght, $etc);
}
if (isset($params['moreUrl']) && $params['moreUrl']) {
$more = ' <a class="more" href="' . $params['moreUrl'] . '" title="' . $wiecejT . '" rel="nofollow">'.$wiecejN.'</a>';
} else {
$more = '';
}
return $string . $more;
}
?>

View File

@@ -0,0 +1,37 @@
<?php
/*
* Smarty plugin
* -------------------------------------------------------------
* File: function.generateHeaders.php
* Type: function
* Name: link
* Purpose: zwraca naglowki
* -------------------------------------------------------------
*/
function smarty_function_generateHeaders($params, &$smarty){
$headers = $smarty->get_template_vars('pageHeaders');
$return = null;
foreach($headers as $type=>$header) {
if($header!=null) {
foreach($header as $headerItem) {
$return .= "<".$type." ";
foreach($headerItem as $var=>$val) {
$return .=$var."=\"".$val."\" ";
}
$return .="/>
";
}
}
}
//print_r($headers);
return $return;
}
?>

View File

@@ -0,0 +1,15 @@
<?php
/**
* @author krku
*/
function smarty_function_gv($params, &$smarty) {
$obj = $smarty->get_template_vars($params['o']);
if ($obj && is_object($obj) && method_exists($obj, $params['f'])) {
return $obj->$params['f']();
} else {
return '';
}
}
?>

View File

@@ -0,0 +1,34 @@
<?
/*
* Smarty plugin
* -------------------------------------------------------------
* File: function.imgformat.php
* Type: function
* Name:
* Purpose:
* -------------------------------------------------------------
*/
function smarty_function_imgformat($param, &$smarty)
{
$out = '';
if(isset($param['name'])) {
if(Mailer::$attachImages) {
$imgContainer = Registry::Get(Mailer::$c_name);
if(empty($imgContainer)) {
$imgContainer = array();
}
$nn = md5($param['name']);
$imgContainer[] = array('img' => $param['name'], 'name' => $nn);
$out = 'cid:'.$nn;
Registry::Set(Mailer::$c_name, $imgContainer);
} else {
$out = URL_STATIC_CONTENT . '/image/' . $param['name'];
}
}
return $out;
}
?>

View File

@@ -0,0 +1,90 @@
<?php
/**
* @author makl
*/
include_once(dirname(__FILE__) . '/function.formField.php');
//Via PHP
function smarty_function_insertCkEditor($params, &$smarty) {
$value = "";
if (isset($params['width'])) {
$width = $params['width'];
}
if (isset($params['height'])) {
$height = $params['height'];
}
if (isset($params['value']) && is_string($params['value'])) {
$value = $params['value'];
}
if (isset($params['name']) && is_string($params['name'])) {
$name = $params['name'];
}
if (isset($params['toolbar']) && is_string($params['toolbar'])) {
$toolbar = $params['toolbar'];
} else {
$toolbar = 'default';
}
$pathStatic = URL_STATIC_CONTENT;
//$string[strlen(PATH_STATIC_CONTENT)-1] = NULL;
//$var = substr(PATH_STATIC_CONTENT,0,strlen(PATH_STATIC_CONTENT)-1);
//Utils::ArrayDisplay($var);
$configPatch = $pathStatic."/../Admin/plugins/ckeditor/config.js";
if ($toolbar == 'basic') {
$configPatch = $pathStatic."/../Admin/plugins/ckeditor/config_panel_makl.js";
}
$_SESSION['freekam_path'] = PATH_STATIC_CONTENT;
$ckEditor = "
<textarea name=\"".$name."\" id=\"".$name."\" width=\"".$width."\" height=\"".$height."\">
".$value."
</textarea>
<script>
var roxyFileman = '".$pathStatic."/../Admin/plugins/ckeditor/plugins/fileman/dev.html';
CKEDITOR.replace( '".$name."',{
filebrowserBrowseUrl:roxyFileman,
filebrowserImageBrowseUrl:roxyFileman+'?type=image',
removeDialogTabs: 'link:upload;image:upload',
height: ".$height.",
width: ".$width.",
contentsCss: '".$pathStatic."/css/Strona/CKStyle.css',
allowedContent: true,
customConfig: '".$configPatch."',
forcePasteAsPlainText: true,
pasteFilter: 'plain-text'
});
CKEDITOR.on('instanceReady', function(event) {
event.editor.on('beforeCommandExec', function(event) {
// Show the paste dialog for the paste buttons and right-click paste
if (event.data.name === 'paste') {
event.editor._.forcePasteDialog = true;
}
// Don't show the paste dialog for Ctrl+Shift+V
if (event.data.name === 'pastetext' && event.data.commandData.from === 'keystrokeHandler') {
event.cancel();
}
})
});
</script>
";
return $ckEditor;
}
?>

View File

@@ -0,0 +1,70 @@
<?php
/**
* @author krku
*/
include_once(dirname(__FILE__) . '/function.formField.php');
//Via PHP
function smarty_function_insertFckEditor($params, &$smarty) {
include_once("plugins/fckeditor/fckeditor_php5.php");
$oFCKeditor = new FCKeditor($params['name']);
$oFCKeditor->BasePath = URL_MAIN.'/plugins/fckeditor/';
$oFCKeditor->ToolbarSet = (isset($params['toolbar']) ? $params['toolbar'] : 'Basic');
$oFCKeditor->InstanceName = $params['name'];
if (isset($params['width'])) {
$oFCKeditor->Width = $params['width'];
}
if (isset($params['height'])) {
$oFCKeditor->Height = $params['height'];
}
if (isset($params['value']) && is_string($params['value'])) {
$oFCKeditor->Value = $params['value'];
}
else if (Request::Check($params['name'])) {
$oFCKeditor->Value = Request::Get($params['name']);
}
$smarty->assign('fck' . ucfirst($params['name']), $oFCKeditor);
$ffParams = array('type' => 'hidden', 'name' => $params['name'] . 'FromFCK', 'id' => $params['name'] . 'FromFCK', 'style' => 'display: none;');
return $oFCKeditor->Create() . "\n" . smarty_function_formField($ffParams, $smarty);
}
////Via Javascript
//function smarty_function_insertFckEditor($params, &$smarty) {
// $name = 'oFCKeditor' . ucfirst($params['name']);
//
// $ret = '<script language="javascript" type="text/javascript">' .
// "var $name = new FCKeditor('$params[name]') ;
//
// $name.Config['ToolbarStartExpanded'] = false ;
// $name.BasePath = 'plugins/fckeditor/';
// $name.ToolbarSet = '$params[toolbar]' ;";
// if (isset($params['width'])) {
// $ret .= "$name.Width = $params[width];";
// }
//
// if (isset($params['height'])) {
// $ret .= "$name.Height = $params[height];";
// }
//
// if (isset($params['value']) && is_string($params['value'])) {
// $ret .= "$name.Value = $params[value];";
// }
// else if (Request::Check($params['name'])) {
// $ret .= "$name.Value = $params[value];";
// }
//
// $ret .= "$name.Create() ;";
//
// $ret .= "</script>";
// return $ret;
//}
?>

View File

@@ -0,0 +1,103 @@
<?php
/**
* @author krku
*/
include_once(PATH_SMARTY_PLUGINS . '/' . 'function.url.php');
function smarty_function_insertPagination($params, &$smarty) {
//Utils::ArrayDisplay($params);
$max = $smarty->get_template_vars('iloscStron');
if ($max <= 1) {
return '';
}
$cur = $smarty->get_template_vars('strona');
$display = (isset($params['_display']) ? $params['_display'] : 6);
$params['_current'] = true;
//echo $params['_class'];
$ret = '<div class="' . (isset($params['_class']) ? $params['_class'] : 'pagination') . '">';
$start = max(1, min($max - 2, $cur));
$to = min($max + 1, $start + $display);
//Utils::ArrayDisplay($params);
$ajax = $smarty->get_template_vars('ajax');
if ($ajax) {
if ($cur > 0) {
$params['strona'] = ($cur != 1 ? $cur : false);
$ret .= ' <a href="' . smarty_function_url($params, $smarty) . '" onClick="'.$ajax.'; return false;" title="Przejdź na poprzednią stronę">Poprzednia Strona</a> ';
}
$params['strona'] = false;
if ($cur >= $display - 1) {
$ret .= ' <a href="' . smarty_function_url($params, $smarty) . '" onClick="'.$ajax.'; return false;" title="Przejdź na pierwszą stronę">1</a> ... ';
}
for ($i = $start; $i < $to ; $i++) {
$params['strona'] = ( $i == 1 ? false : $i );
if ($cur == $i - 1) {
$ret .= ' <a class="active" href="#">' . $i . '</a> ';
} else {
$ret .= ' <a href="' . smarty_function_url($params, $smarty) . '" onClick="'.$ajax.'; return false;" title="Przejdź na stronę ' . $i . '">' . $i . '</a> ';
}
}
$params['strona'] = $max;
if ($cur < $max) {
$ret .= ' z <a href="' . smarty_function_url($params, $smarty) . '" onClick="'.$ajax.'; return false;" title="Przejdź na ostatnią stronę">' . $max . '</a>';
}
if ($cur + 1 != $max) {
$params['strona'] = $cur + 2;
$ret .= ' <a href="' . smarty_function_url($params, $smarty) . '" onClick="'.$ajax.'; return false;" title="Przejdź na następną stronę">Następna Strona</a> ';
}
} else {
if ($cur > 0) {
$params['strona'] = ($cur != 1 ? $cur : false);
$ret .= ' <a href="' . smarty_function_url($params, $smarty) . '" title="Przejdź na poprzednią stronę">Poprzednia Strona</a> ';
}
$params['strona'] = false;
if ($cur >= $display - 1) {
$ret .= ' <a href="' . smarty_function_url($params, $smarty) . '" title="Przejdź na pierwszą stronę">1</a> ... ';
}
for ($i = $start; $i < $to ; $i++) {
$params['strona'] = ( $i == 1 ? false : $i );
if ($cur == $i - 1) {
$ret .= ' <a class="active" href="#">' . $i . '</a> ';
} else {
$ret .= ' <a href="' . smarty_function_url($params, $smarty) . '" title="Przejdź na stronę ' . $i . '">' . $i . '</a> ';
}
}
$params['strona'] = $max;
if ($cur < $max) {
$ret .= ' z <a href="' . smarty_function_url($params, $smarty) . '" title="Przejdź na ostatnią stronę">' . $max . '</a>';
}
if ($cur + 1 != $max) {
$params['strona'] = $cur + 2;
$ret .= ' <a href="' . smarty_function_url($params, $smarty) . '" title="Przejdź na następną stronę">Następna Strona</a> ';
}
}
$ret .= "</div>";
return $ret;
}
?>

View File

@@ -0,0 +1,101 @@
<?php
/**
* @author krku
*/
function smarty_function_insertPhotoCropper($params, &$smarty) {
$ret = "";
$width = $smarty->get_template_vars('photoWidth');
$height = $smarty->get_template_vars('photoHeight');
$minWidth = $smarty->get_template_vars('minPhotoWidth');
$minHeight = $smarty->get_template_vars('minPhotoHeight');
$uploadUrl = Router::GenerateUrl('uploadUrl', $smarty->get_template_vars('uploadUrl'));
$cutUrl = Router::GenerateUrl('cutUrl',$smarty->get_template_vars('cutUrl'));
if (isset($params['loadOnFly']) && $params['loadOnFly']) {
$onFly = true;
$ret = '
<iframe src="puste" id="' . $params['prefix'] . 'PhotoUploadIFrame" name="' . $params['prefix'] . 'PhotoUploadIFrame" class="photoUpload" frameborder="0" width="1" height="1"></iframe>
<div class="photoUploadForm" id="' . $params['prefix'] . 'PhotoUploadForm">
<form onsubmit="return false;" action="' . $uploadUrl . '" method="post" name="' . $params['prefix'] . 'PhotoUpload" target="' . $params['prefix'] . 'PhotoUploadIFrame" enctype="multipart/form-data" />
<input type="file" name="photo" onchange="startUpload(\'' . $params['prefix'] . 'PhotoUploadIFrame\', this.form); this.form.submit();" title="" />
<input name="onFly" value="1" type="hidden" />
<input name="cropPrefix" value="' . $params['prefix'] . '" type="hidden" />
</form>
</div>';
} else {
$obFly = false;
}
$ret .= '
<form name="photoCropper" action="' . $cutUrl . '" method="post" onsubmit="doCropPhoto(this, \'photoCropper\'); return false;">
<div class="cropperMainPhotoFrame">
<img src="' . ($onFly ? $smarty->get_template_vars('noPhotoImgBig') : '') . '" id="' . $params['prefix'] . 'CropArea" class="PhotoBig" ';
if ($height != false && $width != false) {
$ret .= 'style="height: ' . $height . 'px; width: ' . $width . 'px;"';
}
if (isset($params['preview'])) {
if (!is_string($params['preview'])) {
$preview = $params['prefix'] . "CropPreview";
} else {
$preview = $params['preview'];
}
}
$ret .= ' />
</div>
<div class="cropperInfoFrame">';
if (isset($preview)) {
$ret .= '
<h4>Podgląd</h4>
<div id="' . $preview . '" class="' . $params['prefix'] . 'PhotoSmall">
<img id="' . $params['prefix'] . 'PreviewArea" src="' . ($onFly ? $smarty->get_template_vars('noPhotoImgSmall') : '') . '"></img>
</div>
Wybierz odpowiedni kadr przesuwając i regulując krawędzie kwadratowego obszaru.';
}
if (isset($params['viewForm']) && $params['viewForm']) {
$type = "text";
} else {
$type = "hidden";
}
$desc = '';
if(isset($params['description']) && $params['description'] == true) {
$desc = '<textarea name="' . $params['prefix'] . 'Description" id="' . $params['prefix'] . 'Description" class="cropper"></textarea>';
} else {
$desc = '<input type="hidden" name="' . $params['prefix'] . 'Description" id="' . $params['prefix'] . 'Description" value="0" />';
}
$ret .= '
<input type="' . $type . '" name="' . $params['prefix'] . 'ImageCropX1" id="' . $params['prefix'] . 'ImageCropX1" />
<input type="' . $type . '" name="' . $params['prefix'] . 'ImageCropX2" id="' . $params['prefix'] . 'ImageCropX2" />
<input type="' . $type . '" name="' . $params['prefix'] . 'ImageCropY1" id="' . $params['prefix'] . 'ImageCropY1" />
<input type="' . $type . '" name="' . $params['prefix'] . 'ImageCropY2" id="' . $params['prefix'] . 'ImageCropY2" />
<input type="' . $type . '" name="' . $params['prefix'] . 'ImageCropWidth" id="' . $params['prefix'] . 'ImageCropWidth" />
<input type="' . $type . '" name="' . $params['prefix'] . 'ImageCropHeight" id="' . $params['prefix'] . 'ImageCropHeight" />
<input type="hidden" name="' . $params['prefix'] . 'ImageFileName" id="' . $params['prefix'] . 'ImageFileName" value="' . $params['photoSrc'] . '"/>
</div>
' . $desc . '
<div class="clearBoth"></div>
<div class="popoverCancel">
<input alt="deactivate" class="lbAction button buttonAnuluj" type="button" value="" />
</div>
<div class="popoverInfo" id="cropInfo"></div>
<div class="popoverOk" id="cropButton"></div>
<div class="clearBoth"></div>
<script type="text/javascript" language="javascript">'."
initializeCropper('$preview', '$params[prefix]', $minWidth, $minHeight, $params[onInit], " . ($params['loadOnFly'] ? 'true' : 'false') . ");
</script>
</form>";
return $ret;
}
?>

View File

@@ -0,0 +1,20 @@
<?php
/*
* Smarty plugin
* -------------------------------------------------------------
* File: function.jsemail.php
* Type: function
* Name: link
* Purpose: zwaraca javascript wypisujacy email
* -------------------------------------------------------------
*/
function smarty_function_jsemail($param, &$smarty){
if(isset($param['cssClass']))
return Utils::jsEmail($param['email'], $param['cssClass']);
else
return Utils::jsEmail($param['email']);
}
?>

View File

@@ -0,0 +1,15 @@
<?php
/**
* @author krku
*/
function smarty_function_makeArray($params, &$smarty) {
$varName = $params['assign'];
unset($params['assign']);
$smarty->assign($varName, $params);
}
?>

View File

@@ -0,0 +1,46 @@
<?php
/*
* Smarty plugin
* -------------------------------------------------------------
* File: function.messageOptions.php
* Type: function
* Name: link
* Purpose: przyciski wiadomosci specjalnej w htmlu
* -------------------------------------------------------------
*/
function smarty_function_messageOptions($params, &$smarty){
if(isset($params['value'])) {
$buttons = unserialize($params['value']);
if(is_a($buttons, 'PhysicianMessageOptions')) {
$array = $buttons->GetButtons();
$reply = null;
foreach($array as $button) {
if($button['type']=='image') {
$reply .= " <a href=\"".$button['url']."\" class=\"lbOn\"><img src=\"".URL_STATIC_CONTENT."/image/".$button['file']."\" alt=\"\" title=\"\" border=\"0\" /></a> ";
}
}
return "<div>".$reply."</div>";
}
}
// $input = $smarty->get_template_vars('breadCrumbs');
// $return = array();
// if(is_array($input)) {
// foreach($smarty->get_template_vars('breadCrumbs') as $row) {
// if($row['url']!='') {
// $return[] = " <a href=\"".$row['url']."\">".$row['title']."</a> ";
// }else {
// $return[] = " ".$row['title']." ";
// }
// }
//return implode(BREAD_CRUMB_DELIMITER, $return);
// }
}
?>

View File

@@ -0,0 +1,17 @@
<?php
/*
* Smarty plugin
* -------------------------------------------------------------
* File: function.url.php
* Type: function
* Name: link
* Purpose: zwraca datę o podanym formacie dla zadanego microtime
* -------------------------------------------------------------
*/
function smarty_function_mt2date($params, &$smarty){
$format = (isset($params['format'])?$params['format']:'d.m.Y G:i:s');
return (isset($params['time'])?date($format,$params['time']):null);
}
?>

View File

@@ -0,0 +1,141 @@
<?php
/*
* Smarty plugin
* -------------------------------------------------------------
* File: function.pagination.php
* Type: function
* Name: link
* Purpose: zwraca linki do pozostalych stron z danego zakresu
* Dependencies: function.url.php
* -------------------------------------------------------------
*/
include_once(PATH_SMARTY_PLUGINS . '/' . 'function.url.php');
function smarty_function_pagination($params, &$smarty) {
/**
* do funkcji nalezy podac parametry: currPage, pageCount i _value
* _value tak jak do smarty_function_url bez uwzgledniania strony
*/
//Utils::ArrayDisplay($params);
$class = 'pagination';
if(isset($params['class'])){
$class=$params['class'];
unset($params['class']);
}
$currPage = $params['currPage'];
$pageCount = $params['pageCount'];
$name = 'strona';
if(isset($params['name'])) {
$name = $params['name'];
unset($params['name']);
}
if( isset($params['ajax']) )
{
$ajax = $params['ajax'];
}
unset($params['ajax']);
unset($params['currPage']);
unset($params['pageCount']);
if($pageCount <= 1)return '';
if($currPage > $pageCount) {
$currPage = $pageCount;
}
$ret = '';
$url = smarty_function_url(array( $currPage-1 => $params['_current']), $smarty);
$ret = '<a href="' . $url . '" rel="nofollow"' . ($currPage > 1 ? '' : ' class="disabled" onclick="return false;"') . '>' . (isset($params['prev']) ? Dictionary::Translate($params['prev']) : '<<') . ($currPage > 1 ? '</a>' : '') . '&nbsp;';
for($i = 1; $i <= $pageCount; $i++) {
if ($i == $currPage) {
$selected = 'class="selected"';
} else {
$selected = '';
}
if($i == $currPage) {
$url = smarty_function_url(array( $i => $params['_current']), $smarty);
$ret .= '<a href="'.$url.'" '.$selected.' >'.$i.'</a> ';
} else {
$url = smarty_function_url(array( $i => $params['_current']), $smarty);
$ret .= '<a href="'.$url.' " >'.$i.'</a> '.($i < $pageCount?' ':'');
}
}
$url = smarty_function_url(array( $currPage+1 => $params['_current']), $smarty);
$ret .= '<a href="' . $url . '" rel="nofollow"' . ($currPage+1 <= $pageCount ? '' : ' class="disabled" onclick="return false;"') . ">" . (isset($params['next']) ? Dictionary::Translate($params['next']) : '>>') . '</a>';
// Utils::ArrayDisplay($currPage);
// Utils::ArrayDisplay($pageCount);
return $ret;
// $params['strona'] = 1;
// $ret = '<a href="'.smarty_function_url($params,$smarty).'"><<</a> ';
// $params[$name] = ($currPage < $pageCount?$currPage+1:$pageCount);
// Utils::ArrayDisplay($params);
// $href = (isset($ajax) ? 'onclick=Dosia.Request("' .smarty_function_url($params,$smarty).'") href="#"' :'href="'.smarty_function_url($params,$smarty).'"');
//
// $ret .= '<div class="floatRight"><a ' . $href . '>';
// $ret .= '<img src="'.URL_STATIC_CONTENT.'/image/buttonProfilZnajomiNastepna.gif" alt="" title="" border="0" /></a></div>';
//
//
//
// $ret .= '<div class="floatRight numbers">';
// if($pageCount < 6)for($i = 1; $i <= $pageCount; $i++){
// $params[$name] = $i;
// if($i != $currPage){
// Utils::ArrayDisplay($params);
// $href = (isset($ajax) ? 'onclick=Dosia.Request("' .smarty_function_url($params,$smarty).'") href="#"' :'href="'.smarty_function_url($params,$smarty).'"');
// Utils::ArrayDisplay($href);
// $ret .= '<a ' . $href . '>'.$i.'</a>&nbsp;'.($i<$pageCount?'| ':'');
// }else{
// $ret .= $i.($i < $pageCount?' | ':'');
// }
// }else{
// $arr = array();
// if($currPage > 2)$arr[] = $currPage - 2;
// if($currPage > 1)$arr[] = $currPage - 1;
//
// $arr[] = $currPage;
//
// if($currPage < $pageCount)$arr[] = $currPage + 1;
// if($currPage < $pageCount - 1)$arr[] = $currPage + 2;
//
// if($arr[0] > 1)$ret .= '... ';
// foreach($arr AS $k=>$strona){
//
// $params[$name] = $strona;
// if($strona != $currPage){
// $href = (isset($ajax) ? 'onclick=Dosia.Request("' .smarty_function_url($params,$smarty).'") href="#"' :'href="'.smarty_function_url($params,$smarty).'"');
//
// $ret .= '<a ' . $href . '>'.$strona.'</a> &nbsp;'.($k<count($arr) - 1?'| ':'');
// }else{
// $ret .= $strona.' '.($k<count($arr) - 1?'| ':'');
// }
// }
// if($arr[count($arr)-1] < $pageCount)$ret .= '... ';
//
// }
// $ret .= '</div>';
//
// $params[$name] = ($currPage > 1?$currPage-1:1);
// $href = (isset($ajax) ? 'onclick=Dosia.Request("' .smarty_function_url($params,$smarty).'") href="#"' :'href="'.smarty_function_url($params,$smarty).'"');
// $ret .= '<div class="floatRight"><a ' . $href . '><img src="'.URL_STATIC_CONTENT.'/image/buttonProfilZnajomiPoprzednia.gif" alt="" title="" border="0" /></a></div>';
//
//
// return '<div class="'.$class.'">'.$ret.'</div> <div class="clearBoth"></div>';
}
?>

View File

@@ -0,0 +1,145 @@
<?php
/*
* Smarty plugin
* -------------------------------------------------------------
* File: function.pagination.php
* Type: function
* Name: link
* Purpose: zwraca linki do pozostalych stron z danego zakresu
* Dependencies: function.url.php
* -------------------------------------------------------------
*/
/**
*
* @param <type> $params
* @param TemplateMaster $smarty
* @return <type>
*/
function smarty_function_pagination($params, &$smarty) {
$globalParams = $smarty->_tpl_vars['param'];
if( isset($globalParams[ROUTER_SORT_LABEL]) )
{
$params[ROUTER_SORT_LABEL] = $globalParams[ROUTER_SORT_LABEL];
}
if( isset($globalParams[ROUTER_DIR_LABEL]) )
{
$params[ROUTER_DIR_LABEL] = $globalParams[ROUTER_DIR_LABEL];
}
if( !isset($params['next']) ) {
$params['next'] = PAGE_NEXT_LABEL;
}
if( !isset($params['prev']) ) {
$params['prev'] = PAGE_PREV_LABEL;
}
// Jeżeli nie jest podany label to wstawiam current
if( !isset($params['label']) ) {
$params['label'] = 'current';
}
if( isset($params['count']) ) {
$count = $params['count'];
} else {
throw new Exception( 'Sortowanie: Wymagana ilość elementów - count!');
}
if( isset($params['ajax']) ){
$ajax = $params['ajax'];
} else {
$ajax = null;
}
if( isset($params['max']) ){
$max = $params['max'];
} else {
$max = 2;
}
if( isset($params['number']) ){
$number = $params['number'];
} else {
$number = 0;
}
$pageArray = $smarty->_tpl_vars['_page'];
if(is_array($pageArray)){
for ($i = 0; $i < $number+1; $i++) {
$pageArray[$i] = isset($pageArray[$i])? $pageArray[$i] : 1;
}
} else {
$pageArray = array();
for ($i = 0; $i < $number+1; $i++) {
$pageArray[$i] = 1;
}
}
// Wybór strony w tabeli o bierzącym numerku.
$page = $pageArray[$number];
$page = max(1, $page);
if ($count <= 1)
return '';
$pageArray[$number] = max(1, $page - 1);
$params[ROUTER_PAGE_LABEL] = $pageArray; ;
$ret = '<a href="' . pagination_generate_url($params, $smarty) . '" rel="nofollow"' . ($page > 1 ? '' : ' class="disabled" onclick="return false;"') . '>' . (isset($params['prev']) ? $params['prev'] : '<<') . ($page > 1 ? '</a>' : '') . '&nbsp;';
if ($page - $max > 1) {
$pageArray[$number] = 1;
$params[ROUTER_PAGE_LABEL] = $pageArray; ;
$ret .= '<a href="' . pagination_generate_url($params, $smarty) . '" rel="nofollow">1</a> ... ';
}
for ($i = max(1, $page - $max) ; $i < $page; $i++) {
$pageArray[$number] = $i;
$params[ROUTER_PAGE_LABEL] = $pageArray; ;
$ret .= '<a href="' . pagination_generate_url($params, $smarty) . '">' . $i . '</a>';
}
$pageArray[$number] = $page;
$params[ROUTER_PAGE_LABEL] = $pageArray; ;
$ret .= '<a href="' . pagination_generate_url($params, $smarty) . '" class="selected" onclick="return false;">' . $page . '</a>';
for ($i = min($page + 1, $count) ; $i < $page + $max + 1 && $i <= $count && $page != $count; $i++) {
$pageArray[$number] = $i;
$params[ROUTER_PAGE_LABEL] = $pageArray; ;
$ret .= '<a href="' . pagination_generate_url($params, $smarty) . '">' . $i . '</a>';
}
if ($page + $max < $count) {
$pageArray[$number] = $count;
$params[ROUTER_PAGE_LABEL] = $pageArray; ;
$ret .= ' ... <a href="' . pagination_generate_url($params, $smarty) . '">' . $count . '</a>';
}
$pageArray[$number] = min($page + 1, $count);
$params[ROUTER_PAGE_LABEL] = $pageArray; ;
$ret .= '<a href="' . pagination_generate_url($params, $smarty) . '" rel="nofollow"' . ($page < $count ? '' : ' class="disabled" onclick="return false;"') . ">" . (isset($params['next']) ? $params['next'] : '>>') . '</a>';
return $ret;
}
function pagination_generate_url($params, &$smarty) {
include_once(dirname(__FILE__) . '/function.url.php');
$pageArray = $params[ROUTER_PAGE_LABEL];
if( array_sum($pageArray) <= count($pageArray))
$params[ROUTER_PAGE_LABEL] = null;
else
$params[ROUTER_PAGE_LABEL] = implode('-', $pageArray);
return smarty_function_url($params, $smarty);
}
?>

View File

@@ -0,0 +1,44 @@
<?
/*
* Smarty plugin
* -------------------------------------------------------------
* File: function.url2.php
* Type: function
* Name: link
* Purpose: zwraca sformatowany url na potrzeby naszamedycyna.pl
* -------------------------------------------------------------
*/
function smarty_function_source($params, &$smarty)
{
$sourceObj = $params['obj'];
$ret = null;
if(is_object($sourceObj))
{
if($sourceObj->GetName())
{
$ret .= '';
}
if($sourceObj->GetLink())
{
$ret .= '<a href="' . $sourceObj->GetLink() . '" title="' . $sourceObj->GetName() . '">';
}
if($sourceObj->getLogo())
{
$ret .= '<img border="0" alt="' . $sourceObj->GetName() . '" src="' . $sourceObj->GetFullUrl() . '" />';
}
else
$ret .= $sourceObj->getName();
if($sourceObj->GetLink())
{
$ret .= '</a>';
}
if($sourceObj->GetName())
{
$ret .= '';
}
}
return $ret;
}
?>

View File

@@ -0,0 +1,78 @@
<?php
/*
* Smarty plugin
* -------------------------------------------------------------
* File: function.tableSort.php
* Type: function
* Name: link
* Purpose: zwraca link do sortowania
* -------------------------------------------------------------
*/
function smarty_function_tableSort($params, &$smarty){
if(is_array($params)) {
if(isset($params['title'])) {
$title = $params['title'];
} else {
throw new Exception('Wymagany tytuł!');
}
if(isset($params['url'])) {
$url = $params['url'];
} else {
$url = "_current";
//throw new Exception('Wymagany url!');
}
if(isset($params['field'])) {
$field = $params['field'];
} else {
throw new Exception('Wymagane pole!');
}
if(isset($params['sufix']))
$sufix = $params['sufix'];
else
$sufix = null;
if($smarty->get_template_vars($field. $sufix) == "desc")
$direction = "asc";
else
$direction = "desc";
$return = "<a href=\"";
if($url == "_current")
$return .= Router::GenerateUrl( "sort$sufix" ,array('_current'=>true, "sort$sufix" => $field, "direction$sufix" => $direction));
else
$return .= Router::GenerateUrl( "sort" ,array('_value'=>$url));
$return .= "\">";
if($smarty->get_template_vars($field. $sufix) == "desc") {
$return .= '<img alt="" border="0" height="8" src="' . URL_STATIC_CONTENT . '/image/Admin/arrowsdownsel.gif" width="14" /> ';
} else if($smarty->get_template_vars($field. $sufix) == "asc") {
$return .= '<img alt="" border="0" height="8" src="' . URL_STATIC_CONTENT . '/image/Admin/arrowsupsel.gif" width="14" /> ';
}
else if($smarty->get_template_vars($field. $sufix) == "")
$return .= '<img alt="" border="0" height="8" src="' . URL_STATIC_CONTENT . '/image/Admin/arrowsdesel.gif" width="14" /> ';
$return .= "</a>";
// if($smarty->get_template_vars($field . $sufix)) {
// $return .= " ";
// }
$return .= $title;
// if($smarty->get_template_vars($field. $sufix)) {
// $return .= " ";
// }
} else {
throw new Exception('Podaj parametry!');
}
return $return;
}
?>

View File

@@ -0,0 +1,60 @@
<?php
/*
* Smarty plugin "thumb"
* Purpose: creates cached thumbnails
*
* This wrapper or pseudo function "thumb"
* is only for compatibility reasons.
* Use the functionality in an easy way
* of the original and new "thumb_imp" plugin.
*
* Author: Marcus Gueldenmeister (MG)
* Internet: http://www.gueldenmeister.de/marcus/
*
* -----------------------------------------------------------------------------
* The original Smarty plugin "thumb"
* comes from Christoph Erdmann (CE).
* Home: http://www.cerdmann.com/thumb/
* Copyright (C) 2005 Christoph Erdmann
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at
* your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
* General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
* -----------------------------------------------------------------------------
* Changelog:
* 2012-12-08 Smarty 3.1 corrections (MG)
* 2007-10-27 Initial version (MG)
* -----------------------------------------------------------------------------
*/
function smarty_function_thumb($params, &$smarty) {
//Utils::ArrayDisplay($params);
//call the new improved thumb plugin
if (method_exists($smarty, '_get_plugin_filepath')) {
//handle with Smarty version 2
require_once $smarty->_get_plugin_filepath('function','thumb_imp');
} else {
//handle with Smarty version 3.1
foreach ($smarty->getpluginsdir($smarty) as $value) {
$filepath = $value ."/function.thumb_imp.php";
if (file_exists($filepath)) {
require_once $filepath;
}
}
}
return smarty_function_thumb_imp($params, $smarty);
}
?>

View File

@@ -0,0 +1,715 @@
<?php
//
// Smarty plugin "thumb_imp"
// Purpose: creates cached thumbnails
//
// Author: Marcus Gueldenmeister (MG)
// Internet: http://www.gueldenmeister.de/marcus/
//
// -----------------------------------------------------------------------------
// The original Smarty plugin "thumb"
// comes from Christoph Erdmann.
// Home: http://www.cerdmann.com/thumb/
// Copyright (C) 2005 Christoph Erdmann
// -----------------------------------------------------------------------------
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2.1 of the License, or (at
// your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
// General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this library; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
// -----------------------------------------------------------------------------
//
// Author: Christoph Erdmann (CE)
//
// Author: Benjamin Fleckenstein (BF)
//
// Author: Marcus Gueldenmeister (MG)
//
// Author: Andreas Boesch (AB)
//
// Author: Wolfgang Krane (WK)
//
// -----------------------------------------------------------------------------
//
// Changelog:/*{{{*/
//
// 2012-12-08 Bugfixes, getcachefilename parameter, Smarty 3.1 corrections (MG)
// 2007-11-15 Bugfix transparent index (WK)
// 2007-10-27 thumb_imp + thumb wrapper (MG)
// 2007-10-24 new cached filename format (MG)
// 2007-09-20 Bugfix link/hint parameter (MG)
// 2007-05-06 Bugfix for transparent GIFs (WK)
// 2007-04-19 Added transparent GIF support (MG & WK)
// 2007-04-12 Added legend text (MG)
// 2006-09-24 Added overlay support (CE)
// 2006-09-24 Added support for showing the hint without autolinking the image (CE)
// 2006-09-24 Added frame support.(CE)
// 2005-10-31 Fixed some small bugs (CE)
// 2005-10-09 Rewrote crop-function (CE)
// 2005-10-08 Decreased processing time by prescaling linear and cleaned code (CE)
// 2005-07-13 Set crop=true as standard (CE)
// 2005-07-12 Added crop parameter. Original code by "djneoform at gmail dot com" (AB)
// 2005-07-02 Found a stupid mistake. Should be faster now (CE)
// 2005-06-02 Added file_exists(SOURCE)-trigger (CE)
// 2005-06-02 Added extrapolate parameter (CE)
// 2005-06-12 Bugfix alt/title (MG)
// 2005-06-10 Bugfix (MG)
// 2005-06-02 Added window parameter (MG)
// 2005-06-02 Made grey banner configurable, added possibility to keep format in thumbs
// made cache path changeable (BF & MG)
// 2004-12-01 New link, hint, quality and type parameter (CE)
// 2004-12-02 Intergrated UnsharpMask (CE)
///*}}}*/
// -----------------------------------------------------------------------------
//
//
// Preparations
// ------------
// You will have to create the following directory in your Smarty root directory:
// images/cache/
// A public directory (available for browser) the plugin uses for its cached
// images. Feel free to change the path in the plugin.
// Additionally the GD library is required.
//
// Sample usage
// ------------
// {thumb file="images/visuals/rallyewm02/Rallye142.jpg"
// width="150" link="false" html='class="img float"'}
//
//
// Parameters/*{{{*/
// ----------
// file [string] (required)
// The path to your original big-sized image.
//
// addgreytohint [bool] (default: true)
// Set to <20>false<73> to get no lightgrey bottombar.
//
// cache [string] (default: images/cache/)
// Set to your favorite cache directory.
//
// cacheUrl [string] (default: images/cache/)
// Set to your favorite cache url.
//
// crop [bool] (default: true)
// If set to <20>true<75>, image will be cropped in the center to destination width and
// height params, while keeping aspect ratio. Otherwise the image will get resized.
//
// dev="dev" - string : default=""
// for development to ignore caching of the image
// and generate each time a new image
//
// extrapolate [bool] (default: true)
// Set to <20>false<73> if your source image is smaller than the calculated thumb and
// you do not want the image to get extraploated.
//
// frame [string]
// A PNG image which is used to create a frame around the thumbnail. This image
// will be sliced into 3x3 blocks therefore the image dimensions have to be a
// multiplier of 3. An example image (33px x 33px) is 'thumb_border.png'
//
// Please note: For performance reasons the frame image will not be checked for
// modification.
//
// getcachefilename [boolean] (default=false)
// Returns only the filename of the cached thumbnail. No image will be returned.
//
// height [int] (default: 100)
// The height of your thumbnail. The width (if not set) will be automatically
// calculated.
//
// hint [bool] (default: true)
// If set to <20>false<73> the image will get linked but will not have a lens-icon.
//
// html [string]
// Will be inserted in the image-tag. Useful, to align text around the thumbnail
// or to insert the alt-paramter or to...
//
// legend="your text" - string : default=""
// Text which should be printed as a legend at the bottom of the image
//
// link [bool] (default: true)
// If set to <20>false<73> the image will not get linked and not have a lens-icon.
//
// linkurl [string] (default: set to <20>original image<67> )
// Set to your target URL (a href="linkurl").
//
// longside [int] (default: not set)
// Set the longest side of the image if width, height and shortside is not set.
//
// overlay [string]
// A PNG image which is used to create an overlay image. The position will be
// determined by <20>overlay_position<6F>.
// Please note: For performance reasons the overlay image will not be checked
// for modification.
//
// overlay_position [int] (default: 9)
// The position of the overlay image. Can be an integer from 1 to 9.
// Here the positions:
// 1 2 3
// 4 5 6
// 7 8 9
//
// sharpen [bool] (default: true)
// Set to <20>false<73> if you don't want to use the Unsharp-Mask. Thumbnail creation
// will be faster, but quality is reduced.
//
// shortside [int] (default: not set)
// Set the shortest side of the image if width, height and longside is not set.
//
// type [int]
// The output file format. Set to 1 for GIF, 2 for JPEG and 3 for PNG. If not
// set, the source file format will be used.
//
// quality="80" - int : default="80"
// quality of the generated jpg image
//
// width [int] (default: 100)
// The width of your thumbnail. The height (if not set) will be automatically
// calculated.
//
// window [bool] (default: true)
// Set to <20>false<73> if you don<6F>t want to open original image in a new window.
// /*}}}*/
// -----------------------------------------------------------------------------
function smarty_function_thumb_imp($params, &$smarty) {/* {{{ */
//Utils::ArrayDisplay($params);
// Start time measurement/*{{{*/
if (isset($params['dev']) && $params['dev']) {
if (!function_exists('getmicrotime')) {
function getmicrotime() {
list($usec, $sec) = explode(" ", microtime());
return ((float) $usec + (float) $sec);
}
}
$time['start'] = getmicrotime();
}/* }}} */
if (!function_exists('UnsharpMask')) {
function UnsharpMask($img, $amount, $radius, $threshold) {/* {{{ */
// Unsharp mask algorithm by Torstein H<>nsi 2003 (thoensi_at_netcom_dot_no)
// Christoph Erdmann: changed it a little,
// cause i could not reproduce the darker blurred image,
// now it is up to 15% faster with same results
// Attempt to calibrate the parameters to Photoshop:
if ($amount > 500)
$amount = 500;
$amount = $amount * 0.016;
if ($radius > 50)
$radius = 50;
$radius = $radius * 2;
if ($threshold > 255)
$threshold = 255;
$radius = abs(round($radius)); // Only integers make sense.
if ($radius == 0) {
return $img;
imagedestroy($img);
//break;
}
$w = imagesx($img);
$h = imagesy($img);
$imgCanvas = $img;
$imgCanvas2 = $img;
$imgBlur = imagecreatetruecolor($w, $h);
// Gaussian blur matrix:
// 1 2 1
// 2 4 2
// 1 2 1
// Move copies of the image around one pixel at the time and merge them with weight
// according to the matrix. The same matrix is simply repeated for higher radii.
for ($i = 0; $i < $radius; $i++) {
imagecopy($imgBlur, $imgCanvas, 0, 0, 1, 1, $w - 1, $h - 1); // up left
imagecopymerge($imgBlur, $imgCanvas, 1, 1, 0, 0, $w, $h, 50); // down right
imagecopymerge($imgBlur, $imgCanvas, 0, 1, 1, 0, $w - 1, $h, 33.33333); // down left
imagecopymerge($imgBlur, $imgCanvas, 1, 0, 0, 1, $w, $h - 1, 25); // up right
imagecopymerge($imgBlur, $imgCanvas, 0, 0, 1, 0, $w - 1, $h, 33.33333); // left
imagecopymerge($imgBlur, $imgCanvas, 1, 0, 0, 0, $w, $h, 25); // right
imagecopymerge($imgBlur, $imgCanvas, 0, 0, 0, 1, $w, $h - 1, 20); // up
imagecopymerge($imgBlur, $imgCanvas, 0, 1, 0, 0, $w, $h, 16.666667); // down
imagecopymerge($imgBlur, $imgCanvas, 0, 0, 0, 0, $w, $h, 50); // center
}
$imgCanvas = $imgBlur;
// Calculate the difference between the blurred pixels and the original
// and set the pixels
for ($x = 0; $x < $w; $x++) { // each row
for ($y = 0; $y < $h; $y++) { // each pixel
$rgbOrig = ImageColorAt($imgCanvas2, $x, $y);
$rOrig = (($rgbOrig >> 16) & 0xFF);
$gOrig = (($rgbOrig >> 8) & 0xFF);
$bOrig = ($rgbOrig & 0xFF);
$rgbBlur = ImageColorAt($imgCanvas, $x, $y);
$rBlur = (($rgbBlur >> 16) & 0xFF);
$gBlur = (($rgbBlur >> 8) & 0xFF);
$bBlur = ($rgbBlur & 0xFF);
// When the masked pixels differ less from the original
// than the threshold specifies, they are set to their original value.
$rNew = (abs($rOrig - $rBlur) >= $threshold) ? max(0, min(255, ($amount * ($rOrig - $rBlur)) + $rOrig)) : $rOrig;
$gNew = (abs($gOrig - $gBlur) >= $threshold) ? max(0, min(255, ($amount * ($gOrig - $gBlur)) + $gOrig)) : $gOrig;
$bNew = (abs($bOrig - $bBlur) >= $threshold) ? max(0, min(255, ($amount * ($bOrig - $bBlur)) + $bOrig)) : $bOrig;
if (($rOrig != $rNew) || ($gOrig != $gNew) || ($bOrig != $bNew)) {
$pixCol = ImageColorAllocate($img, $rNew, $gNew, $bNew);
ImageSetPixel($img, $x, $y, $pixCol);
}
}
}
return $img;
}
/* }}} */
}
$_CONFIG['types'] = array('', '.gif', '.jpg', '.png');
### check parameters/*{{{*/
if (empty($params['cache'])) {
$_CONFIG['cache'] = Config::Get('PATH_STATIC_CONTENT').'thumbs';
} else {
$_CONFIG['cache'] = $params['cache'];
}
if ((substr($_CONFIG['cache'], -1)) != '/')
$_CONFIG['cache'] .= "/";
if (empty($params['cacheUrl'])) {
$_CONFIG['cacheUrl'] = Config::Get('URL_STATIC_CONTENT').'/thumbs';
} else {
$_CONFIG['cacheUrl'] = $params['cacheUrl'];
}
if (empty($params['file'])) {
//$smarty->("thumb: parameter 'file' cannot be empty");
return;
}
if (!file_exists($params['file'])) {
//$smarty->_trigger_fatal_error("thumb: image file does not exist");
return;
}
if (empty($params['getcachefilename']))
$params['getcachefilename'] = false;
if (empty($params['link']))
$params['link'] = true;
if (empty($params['window']))
$params['window'] = true;
if (empty($params['hint']))
$params['hint'] = true;
if (empty($params['extrapolate']))
$params['extrapolate'] = true;
if (empty($params['dev']))
$params['crop'] = false;
if (empty($params['crop']))
$params['crop'] = true;
if (empty($params['title']))
$params['title'] = '';
if (empty($params['alt']))
$params['alt'] = '';
if (empty($params['width']) AND empty($params['height'])
AND empty($params['longside']) AND empty($params['shortside']))
$params['width'] = 100;
if (empty($params['overlay_position']))
$params['overlay_position'] = 9;
/* }}} */
### get info about the source image (SRC)
$temp = getimagesize($params['file']);
$_SRC['file'] = $params['file'];
$_SRC['width'] = $temp[0];
$_SRC['height'] = $temp[1];
$_SRC['type'] = $temp[2]; // 1=GIF, 2=JPG, 3=PNG, SWF=4
$_SRC['string'] = $temp[3];
$_SRC['filename'] = basename($params['file']);
$_SRC['modified'] = filemtime($params['file']);
// generate hash value
$_SRC['hash'] = md5($_SRC['file'] . $_SRC['modified'] . implode('', $params));
### calculate informations for destination (DST)/*{{{*/
if (isset($params['width']) && is_numeric($params['width']))
$_DST['width'] = $params['width'];
else {
if (empty($params['height']))
$params['height'] = 100;
$_DST['width'] = round($params['height'] / ($_SRC['height'] / $_SRC['width']));
}
if (isset($params['height']) && is_numeric($params['height']))
$_DST['height'] = $params['height'];
else {
if (empty($params['width']))
$params['width'] = 100;
$_DST['height'] = round($params['width'] / ($_SRC['width'] / $_SRC['height']));
}
// Das Gr<47><72>enverh<72>ltnis soll erhalten bleiben egal ob das Bild hoch oder querformatig ist.
if (is_numeric($params['longside'])) {
if ($_SRC['width'] < $_SRC['height']) {
$_DST['height'] = $params['longside'];
$_DST['width'] = round($params['longside'] / ($_SRC['height'] / $_SRC['width']));
} else {
$_DST['width'] = $params['longside'];
$_DST['height'] = round($params['longside'] / ($_SRC['width'] / $_SRC['height']));
}
} elseif (is_numeric($params['shortside'])) {
if ($_SRC['width'] < $_SRC['height']) {
$_DST['width'] = $params['shortside'];
$_DST['height'] = round($params['shortside'] / ($_SRC['width'] / $_SRC['height']));
} else {
$_DST['height'] = $params['shortside'];
$_DST['width'] = round($params['shortside'] / ($_SRC['height'] / $_SRC['width']));
}
}/* }}} */
// check for crop option (default)/*{{{*/
if ($params['crop']) {
$width_ratio = $_SRC['width'] / $_DST['width'];
$height_ratio = $_SRC['height'] / $_DST['height'];
// crop at width
if ($width_ratio > $height_ratio) {
$_DST['offset_w'] = round(($_SRC['width'] - $_DST['width'] * $height_ratio) / 2);
$_SRC['width'] = round($_DST['width'] * $height_ratio);
}
// crop at height
elseif ($width_ratio < $height_ratio) {
$_DST['offset_h'] = round(($_SRC['height'] - $_DST['height'] * $width_ratio) / 2);
$_SRC['height'] = round($_DST['height'] * $width_ratio);
}
}/* }}} */
// Wenn das Ursprungsbild kleiner als das Ziel-Bild ist,
// soll nicht hochskaliert werden und die neu berechneten Werte werden wieder <20>berschrieben
if ($params['extrapolate'] == 'false' && $_DST['height'] > $_SRC['height'] && $_DST['width'] > $_SRC['width']) {
$_DST['width'] = $_SRC['width'];
$_DST['height'] = $_SRC['height'];
}
if (!empty($params['type']))
$_DST['type'] = $params['type'];
else
$_DST['type'] = $_SRC['type'];
// Output filename for caching
// eliminate the dots in the original filename
$tmp_filename = str_replace(".", "_", $_SRC['filename']);
$_DST['file'] = $_CONFIG['cache'] . $tmp_filename . "_" . $_SRC['hash'] . $_CONFIG['types'][$_DST['type']];
$_DST['fileUrl'] = $_CONFIG['cacheUrl'] .'/'. $tmp_filename . "_" . $_SRC['hash'] . $_CONFIG['types'][$_DST['type']];
$_DST['string'] = 'width="' . $_DST['width'] . '" height="' . $_DST['height'] . '"';
// is a legend available?/*{{{*/
if (!empty($params['legend'])) {
//text_legend_height depends on the later used font!
$text_legend_height = 15;
$_DST['string'] = 'width="' . ($_DST['width']) . '" height="' . ($_DST['height'] + $text_legend_height) . '"';
} else {
//this must be set to 0, so that the frame size can be set correct
$text_legend_height = 0;
}/* }}} */
// is a frame available?/*{{{*/
if (!empty($params['frame'])) {
// check if valid
$imagesize = getimagesize($params['frame']);
if ($imagesize[0] != $imagesize[1] OR $imagesize[0] % 3 OR ! file_exists($params['frame'])) {
//$smarty->_trigger_fatal_error("thumb: wrong dimensions of 'frame'-image or width and height is not a multiplier of 3");
return;
}
// Blockgr<67><72>e brauche ich schon hier, falls ein gecachtes Bild wiedergegeben werden soll
$frame_blocksize = $imagesize[0] / 3;
$_DST['string'] = 'width="' . ($_DST['width'] + 2 * $frame_blocksize) . '" height="' . ($_DST['height'] + 2 * $frame_blocksize + $text_legend_height) . '"';
}/* }}} */
### generate return string/*{{{*/
if (empty($params['html']))
$_RETURN['img'] = '<img src="' . $_DST['fileUrl'] . '" alt="'.$params['title'].'" title="'.$params['title'].'" />';
// $_RETURN['img'] = '<img src="' . $_DST['fileUrl'] . '" ' . $_DST['string'] . ' alt="" title="" />';
else
$_RETURN['img'] = '<img src="' . $_DST['fileUrl'] . '" ' . $params['html'] . ' ' . $_DST['string'] . ' />';
if ($params['link'] == "true") {
if (empty($params['linkurl']))
$params['linkurl'] = $_SRC['file'];
if ($params['window'] == "true")
$returner = '<a href="' . $params['linkurl'] . '" target="_blank">' . $_RETURN['img'] . '</a>';
else
$returner = '<a href="' . $params['linkurl'] . '">' . $_RETURN['img'] . '</a>';
} else {
$returner = $_RETURN['img'];
}/* }}} */
############################
### check for cache file ###
############################
if (file_exists($_DST['file']) OR ( isset($params['dev']) && !$params['dev'])) {
if (!$params['getcachefilename']) {
//return normal html image string
return $returner;
} else {
//return cachefilename only
return $_DST['file'];
}
}
############################
### otherwise proceed ###
############################
// read SRC/*{{{*/
if ($_SRC['type'] == 1) {
$_SRC['image'] = @imagecreatefromgif($_SRC['file']);
$_SRC['gif_colorstotal'] = @imagecolorstotal($_SRC['image']);
$_SRC['gif_transparent_index'] = @imagecolortransparent($_SRC['image']);
//we have a transparent color
if (($_SRC['gif_transparent_index'] >= 0) && ($_SRC['gif_transparent_index'] < $_SRC['gif_colorstotal'])) {
//get the actual transparent color
$gif_rgb = imagecolorsforindex($_SRC['image'], $_SRC['gif_transparent_index']);
$_SRC['gif_original_transparency_rgb'] = ($gif_rgb['red'] << 16) | ($gif_rgb['green'] << 8) | $gif_rgb['blue'];
//change the transparent color to black, since transparent goes to black anyways (no way to remove transparency in GIF)
imagecolortransparent($_SRC['image'], imagecolorallocate($_SRC['image'], 0, 0, 0));
}
}
if ($_SRC['type'] == 2)
$_SRC['image'] = imagecreatefromjpeg($_SRC['file']);
if ($_SRC['type'] == 3)
$_SRC['image'] = imagecreatefrompng($_SRC['file']);
/* }}} */
// if the image is very) large, scale linear to 4x $_DST size and overwrite the source $_SRC/*{{{*/
if ($_DST['width'] * 4 < $_SRC['width'] AND $_DST['height'] * 4 < $_SRC['height']) {
// Multiplikator der Zielgr<67><72>e
$_TMP['width'] = round($_DST['width'] * 4);
$_TMP['height'] = round($_DST['height'] * 4);
$_TMP['image'] = imagecreatetruecolor($_TMP['width'], $_TMP['height']);
if (!isset($_DST['offset_w'])) {
$_DST['offset_w'] = 0;
}
if (!isset($_DST['offset_h'])) {
$_DST['offset_h'] = 0;
}
imagecopyresized($_TMP['image'], $_SRC['image'], 0, 0, $_DST['offset_w'], $_DST['offset_h'], $_TMP['width'], $_TMP['height'], $_SRC['width'], $_SRC['height']);
$_SRC['image'] = $_TMP['image'];
$_SRC['width'] = $_TMP['width'];
$_SRC['height'] = $_TMP['height'];
// Wenn vorskaliert wird, darf ja nicht nochmal ein bestimmter Bereich ausgeschnitten werden
$_DST['offset_w'] = 0;
$_DST['offset_h'] = 0;
unset($_TMP['image']);
}/* }}} */
// DST erstellen
$_DST['image'] = imagecreatetruecolor($_DST['width'], $_DST['height']);
if (!isset($_DST['offset_w'])) {
$_DST['offset_w'] = 0;
}
if (!isset($_DST['offset_h'])) {
$_DST['offset_h'] = 0;
}
if ($_SRC['image']) {
if (($_SRC['type'] == 1) && ($_SRC['gif_transparent_index'] >= 0)) {
//only for transparent gif:
imagealphablending($_SRC['image'], false);
imagesavealpha($_SRC['image'], true);
imagecopyresized($_DST['image'], $_SRC['image'], 0, 0, $_DST['offset_w'], $_DST['offset_h'], $_DST['width'], $_DST['height'], $_SRC['width'], $_SRC['height']);
} else {
imagecopyresampled($_DST['image'], $_SRC['image'], 0, 0, $_DST['offset_w'], $_DST['offset_h'], $_DST['width'], $_DST['height'], $_SRC['width'], $_SRC['height']);
}
if (isset($params['sharpen']) && ($params['sharpen'] != "false"))
$_DST['image'] = UnsharpMask($_DST['image'], 80, .5, 3);
}
// add a magnifier/*{{{*/
if (($params['link'] == "true") && ($params['hint'] == "true")) {
// sure to add a white bar?
if ($params['addgreytohint'] != 'false') {
$trans = imagecolorallocatealpha($_DST['image'], 255, 255, 255, 25);
imagefilledrectangle($_DST['image'], 0, $_DST['height'] - 9, $_DST['width'], $_DST['height'], $trans);
}
$magnifier = imagecreatefromstring(gzuncompress(base64_decode("eJzrDPBz5+WS4mJgYOD19HAJAtLcIMzBBiRXrilXA1IsxU6eIRxAUMOR0gHkcxZ4RBYD1QiBMOOlu3V/gIISJa4RJc5FqYklmfl5CiGZuakMBoZ6hkZ6RgYGJs77ex2BalRBaoLz00rKE4tSGXwTk4vyc1NTMhMV3DKLUsvzi7KLFXwjFEAa2svWnGdgYPTydHEMqZhTOsE++1CAyNHzm2NZjgau+dAmXlAwoatQmOld3t/NPxlLMvY7sovPzXHf7re05BPzjpQTMkZTPjm1HlHkv6clYWK43Zt16rcDjdZ/3j2cd7qD4/HHH3GaprFrw0QZDHicORXl2JsPsveVTDz//L3N+WpxJ5Hff+10Tjdd2/Vi17vea79Om5w9zzyne9GLnWGrN8atby/ayXPOsu2w4quvVtxNCVVz5nAf3nDpZckBCedpqSc28WTOWnT7rZNXZSlPvFybie9EFc6y3bIMCn3JAoJ+kyyfn9qWq+LZ9Las26Jv482cDRE6Ci0B6gVbo2oj9KabzD8vyMK4ZMqMs2kSvW4chz88SXNzmeGjtj1QZK9M3HHL8L7HITX3t19//VVY8CYDg9Kvy2vDXu+6mGGxNOiltMPsjn/t9eJr0ja/FOdi5TyQ9Lz3fOqstOr99/dnro2vZ1jy76D/vYivPsBoYPB09XNZ55TQBAAJjs5s</body>")));
imagealphablending($_DST['image'], true);
imagecopy($_DST['image'], $magnifier, $_DST['width'] - 15, $_DST['height'] - 14, 0, 0, 11, 11);
imagedestroy($magnifier);
}/* }}} */
// add an overlay image/*{{{*/
if (!empty($params['overlay'])) {
// load the "overlay"-image
$overlay = imagecreatefrompng($params['overlay']);
$overlay_size = getimagesize($params['overlay']);
// copy overlay-image to the correct position of the original
if ($params['overlay_position'] == '1')
imagecopy($_DST['image'], $overlay, 0, 0, 0, 0, $overlay_size[0], $overlay_size[1]); // ecke links oben
if ($params['overlay_position'] == '2')
imagecopy($_DST['image'], $overlay, $_DST['width'] / 2 - $overlay_size[0] / 2, 0, 0, 0, $overlay_size[0], $overlay_size[1]); // ecke links oben
if ($params['overlay_position'] == '3')
imagecopy($_DST['image'], $overlay, $_DST['width'] - $overlay_size[0], 0, 0, 0, $overlay_size[0], $overlay_size[1]); // ecke links oben
if ($params['overlay_position'] == '4')
imagecopy($_DST['image'], $overlay, 0, $_DST['height'] / 2 - $overlay_size[1] / 2, 0, 0, $overlay_size[0], $overlay_size[1]); // ecke links oben
if ($params['overlay_position'] == '5')
imagecopy($_DST['image'], $overlay, $_DST['width'] / 2 - $overlay_size[0] / 2, $_DST['height'] / 2 - $overlay_size[1] / 2, 0, 0, $overlay_size[0], $overlay_size[1]); // ecke links oben
if ($params['overlay_position'] == '6')
imagecopy($_DST['image'], $overlay, $_DST['width'] - $overlay_size[0], $_DST['height'] / 2 - $overlay_size[1] / 2, 0, 0, $overlay_size[0], $overlay_size[1]); // ecke links oben
if ($params['overlay_position'] == '7')
imagecopy($_DST['image'], $overlay, 0, $_DST['height'] - $overlay_size[1], 0, 0, $overlay_size[0], $overlay_size[1]); // ecke links oben
if ($params['overlay_position'] == '8')
imagecopy($_DST['image'], $overlay, $_DST['width'] / 2 - $overlay_size[0] / 2, $_DST['height'] - $overlay_size[1], 0, 0, $overlay_size[0], $overlay_size[1]); // ecke links oben
if ($params['overlay_position'] == '9')
imagecopy($_DST['image'], $overlay, $_DST['width'] - $overlay_size[0], $_DST['height'] - $overlay_size[1], 0, 0, $overlay_size[0], $overlay_size[1]); // ecke links oben
}/* }}} */
// Berechnungszeit hinzuf<75>gen/*{{{*/
if (isset($params['dev']) && $params['dev']) {
// Zeit anhalten
$time['end'] = getmicrotime();
$time = round($time['end'] - $time['start'], 2);
// Farben definieren
$white_trans = imagecolorallocatealpha($_DST['image'], 255, 255, 255, 25);
$black = ImageColorAllocate($_DST['image'], 0, 0, 0);
// Wei<65>er Balken oben
imagefilledrectangle($_DST['image'], 0, 0, $_DST['width'], 10, $white_trans);
// Schrift mit Zeitangabe
imagestring($_DST['image'], 1, 5, 2, 'time: ' . $time . 's', $black);
}/* }}} */
// add a legend text to the image/*{{{*/
if (!empty($params['legend'])) {
//text_legend_height depends on the later used font and is defined at above cache relevant section!
// Neues Bild erstellen und bisher erzeugtes Bild hereinkopieren
$_LEGEND['image'] = imagecreatetruecolor($_DST['width'], $_DST['height'] + $text_legend_height);
imagecopy($_LEGEND['image'], $_DST['image'], 0, 0, 0, 0, $_DST['width'], $_DST['height']);
//RBG 230 = lightgrey 90%
$color = imagecolorallocate($_LEGEND['image'], 230, 230, 230);
imagefilledrectangle($_LEGEND['image'], 0, $_DST['height'], $_DST['width'], $_DST['height'] + $text_legend_height, $color);
$font = 3; //valid values are 1..5
$text = $params['legend'];
//RGB 26 = a little brighter than black, 10%
$color = imagecolorallocate($_LEGEND['image'], 26, 26, 26);
imagestring($_LEGEND['image'], $font, 3, $_DST[height], $text, $color);
$_DST['image'] = $_LEGEND['image'];
$_DST['height'] = $_DST['height'] + $text_legend_height;
$_DST['string2'] = 'width="' . $_DST['width'] . '" height="' . $_DST['height'] . '"';
$returner = str_replace($_DST['string'], $_DST['string2'], $returner);
$_DST['string'] = 'width="' . ($_DST['width']) . '" height="' . ($_DST['height']) . '"';
}/* }}} */
// add a frame to the image/*{{{*/
if (!empty($params['frame'])) {
// load "frame"-image and initialize
$frame = imagecreatefrompng($params['frame']);
$frame_blocksize = $imagesize[0] / 3;
// craete new image and copy the current image into the new one
$_FRAME['image'] = imagecreatetruecolor($_DST['width'] + 2 * $frame_blocksize, $_DST['height'] + 2 * $frame_blocksize);
imagecopy($_FRAME['image'], $_DST['image'], $frame_blocksize, $frame_blocksize, 0, 0, $_DST['width'], $_DST['height']);
// now draw the frame
// edge
imagecopy($_FRAME['image'], $frame, 0, 0, 0, 0, $frame_blocksize, $frame_blocksize); // ecke links oben
imagecopy($_FRAME['image'], $frame, $_DST['width'] + $frame_blocksize, 0, 2 * $frame_blocksize, 0, $frame_blocksize, $frame_blocksize); // ecke rechts oben
imagecopy($_FRAME['image'], $frame, $_DST['width'] + $frame_blocksize, $_DST['height'] + $frame_blocksize, 2 * $frame_blocksize, 2 * $frame_blocksize, $frame_blocksize, $frame_blocksize); // ecke rechts unten
imagecopy($_FRAME['image'], $frame, 0, $_DST['height'] + $frame_blocksize, 0, 2 * $frame_blocksize, $frame_blocksize, $frame_blocksize); // ecke links unten
// side
imagecopyresized($_FRAME['image'], $frame, $frame_blocksize, 0, $frame_blocksize, 0, $_DST['width'], $frame_blocksize, $frame_blocksize, $frame_blocksize); // oben
imagecopyresized($_FRAME['image'], $frame, $_DST['width'] + $frame_blocksize, $frame_blocksize, 2 * $frame_blocksize, $frame_blocksize, $frame_blocksize, $_DST['height'], $frame_blocksize, $frame_blocksize); // rechts
imagecopyresized($_FRAME['image'], $frame, $frame_blocksize, $_DST['height'] + $frame_blocksize, $frame_blocksize, 2 * $frame_blocksize, $_DST['width'], $frame_blocksize, $frame_blocksize, $frame_blocksize); // unten
imagecopyresized($_FRAME['image'], $frame, 0, $frame_blocksize, 0, $frame_blocksize, $frame_blocksize, $_DST['height'], $frame_blocksize, $frame_blocksize); // links
$_DST['image'] = $_FRAME['image'];
$_DST['width'] = $_DST['width'] + 2 * $frame_blocksize;
$_DST['height'] = $_DST['height'] + 2 * $frame_blocksize;
$_DST['string2'] = 'width="' . $_DST['width'] . '" height="' . $_DST['height'] . '"';
$returner = str_replace($_DST['string'], $_DST['string2'], $returner);
$color = imagecolorallocate($_FRAME['image'], 26, 26, 26);
}/* }}} */
// store thumbnail/*{{{*/
if ($_DST['type'] == 1) {
//remake transparency (if there was transparency)
if ($_SRC['gif_transparent_index'] >= 0) {
imagealphablending($_DST['image'], false);
imagesavealpha($_DST['image'], true);
for ($x = 0; $x < $_DST['width']; $x++) {
for ($y = 0; $y < $_DST['height']; $y++) {
if (isset($_SRC['gif_original_transparency_rgb']) && (imagecolorat($_DST['image'], $x, $y) == $_SRC['gif_original_transparency_rgb'])) {
$merkx = $x;
$merky = $y;
$x = $_DST['width'];
$y = $_DST['height'];
} else {
$merkx = 0;
$merky = 0;
}
}
}
}
if ($_SRC['gif_colorstotal'] > 0) {
imagetruecolortopalette($_DST['image'], false, $_SRC['gif_colorstotal']);
}
if ($_SRC['gif_transparent_index'] >= 0) {
$id = imagecolorat($_DST['image'], $merkx, $merky);
if ($id >= 0) {
imagecolortransparent($_DST['image'], $id);
}
}
imagegif($_DST['image'], $_DST['file']);
}
if ($_DST['type'] == 2) {
Imageinterlace($_DST['image'], 1);
if (empty($params['quality']))
$params['quality'] = 80;
imagejpeg($_DST['image'], $_DST['file'], $params['quality']);
}
if ($_DST['type'] == 3) {
imagepng($_DST['image'], $_DST['file']);
}/* }}} */
imagedestroy($_DST['image']);
@imagedestroy($_SRC['image']);
// return the final image
if (!$params['getcachefilename']) {
//return normal html image string
return $returner;
} else {
//return cachefilename only
return $_DST['file'];
}
}
/* }}} */
?>

View File

@@ -0,0 +1,16 @@
<?
/*
* Smarty plugin
* -------------------------------------------------------------
* File: function.translate.php
* Type: function
* Name: link
* Purpose: zwraca przetlumaczony tekst
* -------------------------------------------------------------
*/
function smarty_function_translate($param, &$smarty)
{
return nl2br(Dictionary::Translate($param['word']));
}
?>

View File

@@ -0,0 +1,24 @@
<?
/*
* Smarty plugin
* -------------------------------------------------------------
* File: function.translate.php
* Type: function
* Name: link
* Purpose: zwraca przetlumaczony tekst
* -------------------------------------------------------------
*/
function smarty_function_translate_to_title($param, &$smarty)
{
$string = Dictionary::Translate($param['word']);
$arrayTitle = Utils::TextToUpperArray($string, $param['lang']);
$ret = "<span style=\"font-family:'Times New Roman'; font-size:28px; color: red; margin-right: -2px; pading: 0px;\">{$arrayTitle[0]}</span>";
$ret .= "<span style=\"font-family:'Times New Roman'; font-size:21px; margin-left: 0px; pading: 0px; letter-spacing: 1px;\">{$arrayTitle[1]}</span>";
return $ret;
}

View File

@@ -0,0 +1,30 @@
<?
/*
* Smarty plugin
* -------------------------------------------------------------
* File: function.url.php
* Type: function
* Name: link
* Purpose: zwraca sformatowany url
* -------------------------------------------------------------
*/
function smarty_function_url($param, &$smarty)
{
if(isset($param['label'])) {
$label = $param['label'];
} else {
$label = null;
}
if(isset($param['_BASE_URL_'])){
$baseUrl = $param['_BASE_URL_'];
unset($param['_BASE_URL_']);
return Router::GenerateUrl($label, $param, $baseUrl);
}
return Router::GenerateUrl($label, $param);
}
?>

View File

@@ -0,0 +1,42 @@
<?
/*
* Smarty plugin
* -------------------------------------------------------------
* File: function.url2.php
* Type: function
* Name: link
* Purpose: zwraca sformatowany url na potrzeby naszamedycyna.pl
* -------------------------------------------------------------
*/
function smarty_function_url2($params, &$smarty)
{
if(!isset($params['action'])) {
return URL_MAIN;
}
$url = URL_MAIN;
if($url[strlen($url) - 1] == '/' && $params['action'][0] == '/') {
$url = substr($url, 0, -1);
} else {
if($url[strlen($url) - 1] != '/' && $params['action'][0] != '/') {
$url .= '/';
}
}
if($params['action'][strlen($params['action']) - 1] == '/') {
$params['action'] = substr($params['action'], 0, -1);
}
$url .= $params['action'];
unset($params['action']);
if(!empty ($params)) {
foreach($params as $k => $v) {
$url .= '/' . $k . '/' . $v;
}
}
return $url;
}
?>

View File

@@ -0,0 +1,114 @@
<?
/*
* Smarty plugin
* -------------------------------------------------------------
* File: function.url.php
* Type: function
* Name: link
* Purpose: zwraca sformatowany url
* -------------------------------------------------------------
*/
function smarty_function_urlO($param, &$smarty)
{
// if (isset($params['_value'])) {//Stara wersja
//
// $return = explode(',', $params['_value']);
//
// $controller = array_shift($return);
// $model = array_shift($return);
//
// if (!empty($model)) {
// $return[] = $model;
// }
// $return[] = $controller;
//
// $return = implode(URL_DELIMITER, $return);
//
// return URL_MAIN . '/' .$return.APPLICATION_FILE_TYPE;
// }
//
// if (isset($params['_current']) && $params['_current']) {
//
// $fileName = pathinfo($_SERVER['REQUEST_URI']);
//
// $exp = explode(URL_DELIMITER, $fileName['filename']);
//
// if (!isset($fileName['extension']) || $fileName['extension'] != 'html') {
// $return = array('index' => 'index');
// } else {
// $size = sizeof($exp);
//
// if ($size == 1) {
// $return[$exp[0]] = 'index';
// } else {
// $return[$exp[$size - 2]] = $exp[$size - 1];
// }
// }
//
// $rout = Router::GetParam();
//
// if ($rout['param']) {
// $return = array_merge($return, array_reverse($rout['param']));
// }
//
// $current = array_merge($return, $params);
//
// $first_flag = false;
//
// unset($params['_current']);
// }
//
//
// $return = $params;
//
//
// $first_flag = true;
//
//
// $addr = array();
//
// if(isset($return[0]) && count(array_values($return))==1) {
// $addr = $return;
//
// } else {
//
// foreach ($return as $k => $v) {
// if (substr($k, 0, 1) == '_') {
// continue;
// }
//
// if ($first_flag && Router::$controllerMethodSeek==true) {
// $addr = array_merge(array($v . URL_DELIMITER . $k), $addr);
// $first_flag = false;
// } else {
// $addr = array_merge(array($k . URL_DELIMITER . $v), $addr);
// }
// }
// }
//
// //reakcja na ustawienia routera
// if(Router::$reverseRoute==true) {
// $addr=array_reverse($addr);
// }
//
// return URL_MAIN . '/' . implode(URL_DELIMITER, $addr) . APPLICATION_FILE_TYPE;
if(isset($param['label'])) {
$label = $param['label'];
} else {
$label = null;
}
if(isset($param['_BASE_URL_'])){
$baseUrl = $param['_BASE_URL_'];
unset($param['_BASE_URL_']);
return Router::GenerateUrl($label, $param,$baseUrl);
}
return Router::GenerateUrl($label, $param);
}
?>

View File

@@ -0,0 +1,35 @@
<?php
/*
* Url plugin
* -------------------------------------------------------------
* File: function.urlOutside.php
* Type: function
* Name: url
* Purpose: outputs a complete href element
* Examples:
* {url url="hello.php" name="Hello" status="Text for the status bar"} for normal text links
* {url src="images/hello.png" alt="hello" status="Text for the status bar"} for image links
* -------------------------------------------------------------
*/
function smarty_function_urlOutside($params, &$smarty)
{
$url = $params["url"];
if (substr($url, 0, 4) != 'http') {
$url = "http://".$url;
}
$title = isset($params["title"]) ? $params["title"] : "";
$target = "";
if (isset($params["target"])) {
$target = ' target="'.$params["target"].'" ';
}
if($url) {
$html = "<a href=\"{$url}\" ".$target." title=\"{$title}\">";
} else {
$html = $url;
}
return $html;
}
?>

View File

@@ -0,0 +1,70 @@
<?php
/**
* formatuje tak date posta, żeby zamiast konkretnej daty wyświetlało : wczoraj , przed wczoraj, x dni temu, x tygodni temu, x miesięcy temu, x lat temu
*
* @param $str
* @return unknown_type
*/
function smarty_modifier_addAdv($str){
$page = explode("<br /><br />",$str);
$newPage ="";
$i=0;
$adv = false;
foreach($page as $key => $value)
{
$newPage.=$value ."<br /><br />";
if($i == 2)
{
$adv = true;
$newPage.='
<div class="advertiseHr" id="advFar">
<div class="advertiseName">REKLAMA</div>
<div class="advertiseFar"><a href="#dalej">czytaj dalej</a></div>
</div>
<div class="advertise">
<div id="adv05"><script language="javascript" type="text/javascript">NPB("005");</script></div>
<br />
</div>
<div><a name="dalej"></a></div>
<script type="text/javascript">
set = false;
function addFarAway()
{
if(set == false)
{
var adv=document.getElementById("adv05");
if(adv.offsetHeight > 50)
{
var advFar=document.getElementById("advFar");
advFar.style.display="block";
set =true;
//alert(adv.offsetHeight + advFar.style.display);
}
}
}
setInterval("addFarAway()",500);
</script>
';
}
$i++;
}
if($adv == false)
{
$newPage.='
<div class="advertise">
<div id="adv05"><script language="javascript" type="text/javascript">NPB("005");</script></div>
<br />
</div>
';
}
return $newPage;
}
?>

View File

@@ -0,0 +1,125 @@
<?php
/*
* Smarty plugin
* ------------------------------------------------------------
* Type: modifier
* Name: bbcode2html
* Purpose: Converts BBCode style tags to HTML
* Author: Andre Rabold
* Version: 1.4
* Remarks: Notice that this function does not check for
* correct syntax. Try not to use it with invalid
* BBCode because this could lead to unexpected
* results ;-)
* It seems that this function ignores manual
* line breaks. IMO this can be fixed by adding
* '/\n/' => "<br>" to $preg
*
* What's new: - Rewrote some preg expressions for more
* stability.
* - renamed CSS classes to be more generic. (Example
* CSS file attached.)
* - Support for escaped tags. Add a backslash
* infront of a tag if you don't want to transform
* it. For example: \[b]
*
* Version 1.3c
* - Fixed a bug with <li>...</li> tags (thanks
* to Rob Schultz for pointing this out)
*
* Version 1.3b
* - Added more support for phpBB2:
* [list]...[/list:u] unordered lists
* [list]...[/list:o] ordered lists
*
* Version 1.3
* - added support for phpBB2 like tag identifier
* like [b:b6a0cef7ea]This is bold[/b:b6a0cef7ea]
* (thanks to Rob Schultz)
* - added support for quotes within the quote tag
* so [quote="foo"]bar[/quote] does work now
* correctly
* - removed str_replace functions
*
* Version 1.2
* - now supports CSS classes:
* ng_email (mailto links)
* ng_url (www links)
* ng_quote (quotes)
* ng_quote_body (quotes)
* ng_code (source code)
* ng_list (html lists)
* ng_list_item (list items)
* - replaced slow ereg_replace() functions
* - Alterned [quote] and [code] to use CSS classes
* instead of HTML <blockquote />, <hr />, ... tags.
* - Additional BBCode tags [list] and [*] to display
* nice HTML lists. Example:
* [list]
* [*]first item
* [*]second item
* [*]third item
* [/list]
* The [list] tag can have an additional parameter:
* [list] unorderer list with bullets
* [list=1] ordered list 1,2,3,4,...
* [list=i] ordered list i,ii,iii,iv,...
* [list=I] ordered list I,II,III,IV,...
* [list=a] ordered list a,b,c,d,...
* [list=A] ordered list A,B,C,D,...
* - produces well-formed output
* - cleaned up the code
* ------------------------------------------------------------
*/
function smarty_modifier_bbcode2html($message) {
$message = nl2br($message);
$preg = array(
'/(?<!\\\\)\[color(?::\w+)?=(.*?)\](.*?)\[\/color(?::\w+)?\]/si' => "<span style=\"color:\\1\">\\2</span>",
'/(?<!\\\\)\[size(?::\w+)?=(.*?)\](.*?)\[\/size(?::\w+)?\]/si' => "<span style=\"font-size:\\1\">\\2</span>",
'/(?<!\\\\)\[font(?::\w+)?=(.*?)\](.*?)\[\/font(?::\w+)?\]/si' => "<span style=\"font-family:\\1\">\\2</span>",
'/(?<!\\\\)\[align(?::\w+)?=(.*?)\](.*?)\[\/align(?::\w+)?\]/si' => "<div style=\"text-align:\\1\">\\2</div>",
'/(?<!\\\\)\[b(?::\w+)?\](.*?)\[\/b(?::\w+)?\]/si' => "<span style=\"font-weight:bold\">\\1</span>",
'/(?<!\\\\)\[i(?::\w+)?\](.*?)\[\/i(?::\w+)?\]/si' => "<span style=\"font-style:italic\">\\1</span>",
'/(?<!\\\\)\[u(?::\w+)?\](.*?)\[\/u(?::\w+)?\]/si' => "<span style=\"text-decoration:underline\">\\1</span>",
'/(?<!\\\\)\[center(?::\w+)?\](.*?)\[\/center(?::\w+)?\]/si' => "<div style=\"text-align:center\">\\1</div>",
// [code] & [php]
'/(?<!\\\\)\[code(?::\w+)?\](.*?)\[\/code(?::\w+)?\]/si' => "<div class=\"bb-code\">\\1</div>",
'/(?<!\\\\)\[php(?::\w+)?\](.*?)\[\/php(?::\w+)?\]/si' => "<div class=\"bb-php\">\\1</div>",
// [email]
'/(?<!\\\\)\[email(?::\w+)?\](.*?)\[\/email(?::\w+)?\]/si' => "<a href=\"mailto:\\1\" class=\"bb-email\">\\1</a>",
'/(?<!\\\\)\[email(?::\w+)?=(.*?)\](.*?)\[\/email(?::\w+)?\]/si' => "<a href=\"mailto:\\1\" class=\"bb-email\">\\2</a>",
// [url]
'/(?<!\\\\)\[url(?::\w+)?\]www\.(.*?)\[\/url(?::\w+)?\]/si' => "<a href=\"http://www.\\1\" target=\"_blank\" class=\"bb-url\">\\1</a>",
'/(?<!\\\\)\[url(?::\w+)?\](.*?)\[\/url(?::\w+)?\]/si' => "<a href=\"\\1\" target=\"_blank\" class=\"bb-url\">\\1</a>",
'/(?<!\\\\)\[url(?::\w+)?=(.*?)?\](.*?)\[\/url(?::\w+)?\]/si' => "<a href=\"\\1\" target=\"_blank\" class=\"bb-url\">\\2</a>",
// [img]
'/(?<!\\\\)\[img(?::\w+)?\](.*?)\[\/img(?::\w+)?\]/si' => "<img src=\"\\1\" alt=\"\\1\" class=\"bb-image\" />",
'/(?<!\\\\)\[img(?::\w+)?=(.*?)x(.*?)\](.*?)\[\/img(?::\w+)?\]/si' => "<img width=\"\\1\" height=\"\\2\" src=\"\\3\" alt=\"\\3\" class=\"bb-image\" />",
// [quote]
'/(?<!\\\\)\[quote(?::\w+)?\](.*?)\[\/quote(?::\w+)?\]/si' => "<div class=\"bb-quote\">Cytat:<div class=\"bb-quote\">\\1</div></div>",
'/(?<!\\\\)\[quote(?::\w+)?=(?:&quot;|"|\')?(.*?)["\']?(?:&quot;|"|\')?\](.*?)\[\/quote\]/si' => "<div>Quote \\1:<div class=\"bb-quote\">\\2</div></div>",
// [list]
'/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[\*(?::\w+)?\](.*?)(?=(?:\s*<br\s*\/?>\s*)?\[\*|(?:\s*<br\s*\/?>\s*)?\[\/?list)/si' => "\n<li class=\"bb-listitem\">\\1</li>",
'/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[\/list(:(?!u|o)\w+)?\](?:<br\s*\/?>)?/si' => "\n</ul>",
'/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[\/list:u(:\w+)?\](?:<br\s*\/?>)?/si' => "\n</ul>",
'/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[\/list:o(:\w+)?\](?:<br\s*\/?>)?/si' => "\n</ol>",
'/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[list(:(?!u|o)\w+)?\]\s*(?:<br\s*\/?>)?/si' => "\n<ul class=\"bb-list-unordered\">",
'/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[list:u(:\w+)?\]\s*(?:<br\s*\/?>)?/si' => "\n<ul class=\"bb-list-unordered\">",
'/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[list:o(:\w+)?\]\s*(?:<br\s*\/?>)?/si' => "\n<ol class=\"bb-list-ordered\">",
'/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[list(?::o)?(:\w+)?=1\]\s*(?:<br\s*\/?>)?/si' => "\n<ol class=\"bb-list-ordered,bb-list-ordered-d\">",
'/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[list(?::o)?(:\w+)?=i\]\s*(?:<br\s*\/?>)?/s' => "\n<ol class=\"bb-list-ordered,bb-list-ordered-lr\">",
'/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[list(?::o)?(:\w+)?=I\]\s*(?:<br\s*\/?>)?/s' => "\n<ol class=\"bb-list-ordered,bb-list-ordered-ur\">",
'/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[list(?::o)?(:\w+)?=a\]\s*(?:<br\s*\/?>)?/s' => "\n<ol class=\"bb-list-ordered,bb-list-ordered-la\">",
'/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[list(?::o)?(:\w+)?=A\]\s*(?:<br\s*\/?>)?/s' => "\n<ol class=\"bb-list-ordered,bb-list-ordered-ua\">",
// escaped tags like \[b], \[color], \[url], ...
'/\\\\(\[\/?\w+(?::\w+)*\])/' => "\\1"
);
$message = preg_replace(array_keys($preg), array_values($preg), $message);
return $message;
}
?>

View File

@@ -0,0 +1,11 @@
<?php
/**
* @author krku
*/
function smarty_modifier_compareTime($string, $sec = null) {
return (strtotime($string) > (is_int($sec) ? $sec : time()));
}
?>

View File

@@ -0,0 +1,9 @@
<?php
/**
* @author krku
*/
function smarty_modifier_config($string) {
return Config::Get($string);
}
?>

View File

@@ -0,0 +1,13 @@
<?php
/**
* @author mago
*/
function smarty_modifier_dateMod($string, $format='d.m.Y') {
$i = strtotime($string);
if($i == 0) {
return;
}
return date($format,$i);
}
?>

View File

@@ -0,0 +1,15 @@
<?php
/**
*
* @param $str
* @return unknown_type
*/
function smarty_modifier_htmlentities($str){
$str = str_replace('"', "&quot;", $str);
$str = str_replace("'", "&#039;", $str);
return $str;
}
?>

View File

@@ -0,0 +1,21 @@
<?php
/**
* funkcja która z parametru $param['urlParam'] robi odpowiednią wartość do funckcji pagination -> _value
* @param string $string
* @return string
*/
function smarty_modifier_invertUrl($string){
$delimiter = ",";
$string = ereg_replace('(([0-9]+)(,strona,))','',$string);
$array = explode($delimiter, trim($string,$delimiter));
if(count($array)>1){
$temp = $array[count($array)-1];
$array[count($array)-1] = $array[count($array)-2];
$array[count($array)-2] = $temp;
}
return implode($delimiter,$array);
}
?>

View File

@@ -0,0 +1,13 @@
<?php
/**
* renderuje wartość
*
* @param $str
* @return unknown_type
*/
function smarty_modifier_isFlat($array){
return (is_array($array) && count($array) == 1 && strlen($array[0][0][0]->GetLabelY()) == 0);
}
?>

View File

@@ -0,0 +1,7 @@
<?php
function smarty_modifier_nicedate($string = null, $format = null) {
return Utils::NiceDate($string, false, $format);
}
?>

View File

@@ -0,0 +1,16 @@
<?php
/**
* Zamienia znaki polskie na odpowiedniki angielskie (bez ogonków).
*
* @param $str
* @return unknown_type
*/
function smarty_modifier_pl2en($str) {
return str_replace(
array('ą', 'ż', 'ś', 'ź', 'ę', 'ć', 'ń', 'ó', 'ł', 'Ą', 'Ż', 'Ś', 'Ź', 'Ę', 'Ć', 'Ń', 'Ó', 'Ł'),
array('a', 'z', 's', 'z', 'e', 'c', 'n', 'o', 'l', 'A', 'Z', 'S', 'Z', 'E', 'C', 'N', 'O', 'L'),
$str);
}
?>

View File

@@ -0,0 +1,33 @@
<?php
/*
* Smarty plugin
* ------------------------------------------------------------
* Type: modifier
* Name: quantifier
* Purpose: Zwraca liczby z poprawnymi polskimi liczebnikami
* ------------------------------------------------------------
*/
function smarty_modifier_quantifier($number, $type = 'wynik') {
$out = array(
'wynik' => array(
1 => 'wynik',
2 => 'wyniki',
3 => 'wyników'
)
);
$i = 3;
if($number == 1) {
$i = 1;
} else {
$n1 = $number%100;
$n2 = $number%10;
if (($n1 != 12 && $n1 != 13 && $n1 != 14) && ($n2 == 2 || $n2 == 3 || $n2 == 4)) {
$i = 2;
} else {
$i = 3;
}
}
return $number . ' ' . $out[$type][$i];
}
?>

View File

@@ -0,0 +1,11 @@
<?php
/**
* @author krku
*/
function smarty_modifier_registry($string) {
return Registry::Get($string);
}
?>

View File

@@ -0,0 +1,7 @@
<?php
function smarty_modifier_registryGet($string = null) {
return Registry::Get($string);
}
?>

View File

@@ -0,0 +1,14 @@
<?php
/**
* @author mago
*/
function smarty_modifier_removePolish($string) {
/* nie wywali<6C>em tego na zewn<77>trz bo to w sumie tylko w jednym miejscu jest potrzebne
* nie podejrzewam <20>eby kto<74> jeszcze tego u<>ywa<77>
* */
return str_replace(" ","",Utils::RemovePolishNoToLower(ucwords($string)));
}
?>

View File

@@ -0,0 +1,21 @@
<?php
/**
* renderuje wartość
*
* @param $str
* @return unknown_type
*/
function smarty_modifier_renderAdditional($array){
$str = array();
if(is_array($array))foreach($array AS $item) {
$str[] = $item->GetLabelY() . ': ' . smarty_modifier_renderValue($item);
}
return implode(',',$str);
}
?>

View File

@@ -0,0 +1,32 @@
<?php
/**
* renderuje wartość
*
* @param $str
* @return unknown_type
*/
function smarty_modifier_renderValue(Stat $value){
if(!is_a($value,'Stat'))return '-';
$valObj = $value -> GetValue();
if($valObj->GetValue() == '-0')return '-';
$val = $valObj->GetValue();
if(empty($val))return '-';
switch($value->GetDisplayType()) {
case Stat::STAT_DISPLAY_PERCENT:
return sprintf('%s%%',$valObj->GetValue());
break;
case Stat::STAT_DISPLAY_REAL:
return sprintf('%0.2f',$valObj->GetValue());
break;
default:
return $valObj->GetValue();
}
}
?>

View File

@@ -0,0 +1,6 @@
<?php
function smarty_modifier_saveinput($string, $type = 'input') {
return Utils::SaveInput($string, $type);
}
?>

View File

@@ -0,0 +1,27 @@
<?php
/**
* @author mago
*/
function smarty_modifier_shortThreadTitle($string) {
/* nie wywali<6C>em tego na zewn<77>trz bo to w sumie tylko w jednym miejscu jest potrzebne
* nie podejrzewam <20>eby kto<74> jeszcze tego u<>ywa<77>
* */
$letterLimit = 25;
$arr = explode(' ',$string);
$ret = '';
foreach($arr AS $k => $v){
$spacer = ($k>0?' ':'');
if(strlen($ret.$spacer.$v) <= $letterLimit)$ret .= $spacer.$v;
}
if(strlen($string) > strlen($ret))$ret .= '...';
return $ret;
}
?>

View File

@@ -0,0 +1,34 @@
<?php
/**
* Funkcja ktora zamienia ocene na obrazki
* @param $str string
* @return string
*/
function smarty_modifier_showgrade($str){
$zerostar = 'star0.gif';
$halfstar = 'star05.gif';
$fullstar = 'star1.gif';
$grade = floatval($str);
$gradeGround = floor($grade);
$gradeAddon = false;
if($gradeGround < $grade)$gradeAddon = true;
$gradeArray = array();
for($i = 1; $i <=5; $i++){
if($i <= $gradeGround){
$gradeArray[] = $fullstar;
}elseif($gradeAddon){
$gradeArray[] = $halfstar;
$gradeAddon = false;
}else{
$gradeArray[] = $zerostar;
}
}
$ret = '';
foreach($gradeArray AS $item){
$ret .= '<img src="'.URL_STATIC_CONTENT.'/image/'.$item.'" alt="" />';
}
return $ret;
}
?>

View File

@@ -0,0 +1,17 @@
<?php
/**
* @author mago
*/
function smarty_modifier_strReplace($string, $search, $replace) {
$r = str_replace($search, $replace, $string);
$r = str_replace("\n", "", $r);
$r = str_replace("\r", "", $r);
$r = str_replace("\r\n", "", $r);
$r = str_replace("\r\m", "", $r);
return $r;
}
?>

View File

@@ -0,0 +1,14 @@
<?php
/**
* formatuje tak date posta, żeby zamiast konkretnej daty wyświetlało : wczoraj , przed wczoraj, x dni temu, x tygodni temu, x miesięcy temu, x lat temu
*
* @param $str
* @return unknown_type
*/
function smarty_modifier_stripslashes($str){
return stripslashes($str);
}
?>

View File

@@ -0,0 +1,11 @@
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
function smarty_modifier_text2title($string) {
return Utils::TextToTitle($string);
}
?>

View File

@@ -0,0 +1,11 @@
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
function smarty_modifier_text2url($string) {
return Utils::TextToUrl($string);
}
?>

View File

@@ -0,0 +1,11 @@
<?php
/**
* @author kopi
*/
function smarty_modifier_texttotitle($string) {
return htmlspecialchars(strip_tags($string) , ENT_QUOTES);
}
?>

View File

@@ -0,0 +1,9 @@
<?php
/**
* @author mago
*/
function smarty_modifier_timeMod($string) {
return date('H:i',strtotime($string));
}
?>

View File

@@ -0,0 +1,56 @@
<?php
/**
* formatuje tak date posta, żeby zamiast konkretnej daty wyÅwietlaÅo : wczoraj , przed wczoraj, x dni temu, x tygodni temu, x miesiÄ™cy temu, x lat temu
*
* @param $str
* @return unknown_type
*/
function smarty_modifier_toForumDate($str){
$minute = 60;
$hour = $minute * 60;
$day = $hour * 24;
$week = $day * 7;
$now = time();
$todayStart = $now - ($now % $day) - $hour;
$return = '';
if($str > $todayStart){
$return = 'dzisiaj '.date('G:i', $str);
}elseif($str > $todayStart - $day){
$return = 'wczoraj '.date('G:i', $str);
}elseif($str > $todayStart - $week + $day){
$strStart = $str - $str % $day - $hour;
$dayCount = ($todayStart - $strStart) / $day;
$return = intval($dayCount).' dni temu '.date('G:i',$str);
}elseif($str > $todayStart - $week*9){
$strStart = $str - $str % $day - $hour;
$dayCount = ($todayStart - $strStart) / $day;
$weekCount = $dayCount / 7 + ($dayCount % 7 == 0?0:1);
switch($weekCount){
case 1:
$return = 'tydzieñ temu';
break;
case 2:
case 3:
case 4:
$return = intval($weekCount).' tygodnie temu';
default:
$return = intval($weekCount).' tygodni temu';
}
}else{
$return = date('Y-m-s G:i',$str);
}
return $return;
}
?>

View File

@@ -0,0 +1,8 @@
<?php
/**
* Modifier do obsługi MfDictionary
* @author MAGO
*/
function smarty_modifier_translate($label) {
return Dictionary::Translate($label);
}

View File

@@ -0,0 +1,8 @@
<?php
/**
* Modifier do obsługi MfDictionary
* @author MAGO
*/
function smarty_modifier_translateAdmin($label) {
return Dictionary::Translate($label, 1);
}

View File

@@ -0,0 +1,14 @@
<?php
/**
* formatuje tak date posta, żeby zamiast konkretnej daty wyświetlało : wczoraj , przed wczoraj, x dni temu, x tygodni temu, x miesięcy temu, x lat temu
*
* @param $str
* @return unknown_type
*/
function smarty_modifier_url2pl($str){
return Utils::url2pl(urldecode($str));
}
?>

View File

@@ -0,0 +1,14 @@
<?php
/**
* formatuje tak date posta, żeby zamiast konkretnej daty wyświetlało : wczoraj , przed wczoraj, x dni temu, x tygodni temu, x miesięcy temu, x lat temu
*
* @param $str
* @return unknown_type
*/
function smarty_modifier_urldecode($str){
return urldecode($str);
}
?>