_get_obj($parent_oid); $obj = new $type($oid, $parent, $parts[3]); } else { //tstart('getObj - create'); $obj = new $type($oid); //tstop('getObj - create'); } $OBJECTPOOL[$oid] =& $obj; #tstop('getObj'); return $obj; } function ObjectFinder($types) { global $StorageNewIndex; if (!$types) $types = '*'; if (!is_array($types)) $types = array($types); $this->_index = new $StorageNewIndex($types); } function index() { return $this->_index; } function filter($param, $value) { $this->_index->filter($param, $value); return $this; } function order_by($field) { $this->_index->order_by($field); return $this; } function count() { return $this->_index->count(); } function all() { $oids = $this->all_oids(); $objs = array(); foreach($oids as $oid) { $objs[] = $this->_get_obj($oid); } return $objs; } function first() { $oid = $this->first_oid(); return $oid ? $this->_get_obj($oid) : null;; } function all_oids() { return $this->_index->get(); } function first_oid() { $oids = $this->_index->limit(1)->get(); return $oids ? $oids[0] : false; } function all_values() { return $this->_index->get_values(); } function first_values() { $vals = $this->_index->get_values(); return $vals ? $vals[0] : false; } function in_tree_of(/* varargs */) { $parents = func_get_args(); $q = new Q('or'); foreach ($parents as &$parent) { $flt = 'oid.='; for ($i = 0; $i < 5; ++$i) { $flt = 'referenced_by_folder(*).' . $flt; $q->filter($flt, $parent->oid); } } return $this->filter('q', $q); } function in_folder_of($obj) { return $this->referenced_by('folder', $obj); } /* function parent_of($obj) { return $this->filter('folder(*).oid.=', $obj->oid); } */ function visible() { return $this->filter('nolist.!=', 'on'); } function referenced_by($field, $obj, $type='*') { return $this->filter('referenced_by_' . $field . '(' . $type . ').oid.=', $obj->oid); } function id($id) { return $this->filter('id.=', $id); } } ... */ function anchor($id = '', $class = '') { return sprintf('%s', $id ? ('id="' . $id . '" ') : '', $class ? ('class="' . $class . '" ') : '', $this->url(), htmlspecialchars($this->title()), $this->title() ); } function get_folder_info() { return '

' . htmlspecialchars($this->teaser()) . '

'; } } class Strona extends MyBaseStrona { var $history_fields = array('body', 'title', 'desc'); var $allowed_types = array('Strona'); function Strona($oid) { $this->BaseStrona($oid, true); $this->add_attr('subtitle', 'Field', c('Podtytuł'), array(), 'redirect'); $this->add_attr('img', 'ImageBrowserField', c('Ilustracja artykułu')); $this->add_attr('pub_date', 'Field', c('Data publikacji'), array('default' => date('Y-m-d'), 'edittemplate' => 'field_edit_datepicker.tpl')); if ($gal = $this->get_component('Galeria')) { $this->add_attr('objs_images', 'ObjField', c('Dodawanie obrazków'), array( 'description' => 'Obrazki wyświetlane w stopce strony. Kadrowane adaptacyjnie do wymiarów 100px - 75px.', 'objtype' => 'Obrazek', 'parentobj' => $gal, 'kind' => 'images', )); } $this->add_attr('footer_gallery', 'CheckField', c('Pokaż obrazki w stopce'), array()); $this->add_attr('layout', 'DictionaryField', c('Layout strony'), array( 'dictionary' => array( '' => c('Domyślny'), 'contact' => c('Strona Kontakt'), 'offer' => c('Strona Oferta'), 'gallery' => c('Dział Galeria'), ), )); $page_type = $this->get_raw('layout'); if($page_type == 'offer' || $page_type == 'gallery'){ $this->allowed_types[] = 'StronaGaleria'; } $this->init_plugins(); } function get_foot_imgs(){ if(!($cmp = $this->get_component('Galeria'))) return false; $imgs = $cmp->get_content_objects(); if(count($imgs) == 0) return false; return $imgs; } } class StronaSimple extends MyBaseStrona { var $view = 'edit'; var $allowed_types = array(); function StronaSimple($oid) { $this->BaseStrona($oid, true); $this->hide_attr('body', 'desc', 'redirect', 'nolist'); if ($this->view != 'view') unset($this->views['view']); if (!$this->allowed_types) unset($this->views['folder']); $this->init_plugins(); } } class RotatorZdjec extends ComponentPlugin { function RotatorZdjec($oid, $noinit=false) { $this->ComponentPlugin($oid, $noinit); $this->allowed_types = array('Obrazek'); $this->add_view('sort', 'ajax_echo.tpl', 'view'); } function parse_request() { parent::parse_request(); global $systempath, $s, $smarty; $smarty->caching = false; $r =& $_REQUEST; if ($this->view == 'sort') { $this->maintemplate = 'ajax.tpl'; $old_oids = $this->folder->getRaw(); $new_oids = $r['oids']; foreach($old_oids as $k => $v){ if(!in_array($v, $new_oids))array_push($new_oids, $v); } $this->folder->set($new_oids); return; } } } class Glowna extends MyBaseStrona { var $allowed_types = array('Strona'); function Glowna($oid) { $this->BaseStrona($oid); $this->hide_attr('redirect', 'nolist'); $this->add_view('settings', 'baseedit.tpl', 'edit', true); // $this->add_attr('keywords', 'Field', c('Słowa kluczowe (widoczne dla wyszukiwarek)'), array('description' => c('Podaj słowa kluczowe')), 'desc'); $this->add_attr('sg_img', 'ImageBrowserField', c('Ilustracja nagłówka strony'), array('description' => 'Pożądany rozmiar zdjęcia 735px / 295px. Zdjęcie kadrowane adaptacyjne, justowane do prawej')); $this->add_attr('top_text', 'Field', c('Treść nagłówka 1')); $this->add_attr('top_text2', 'Field', c('Treść nagłówka 2')); $this->add_attr('top_text3', 'Field', c('Treść nagłówka 3')); $this->add_attr('top_text4', 'Field', c('Treść nagłówka 4')); // $this->add_attr('contact_email', 'Field', c('Adres email'), array('description' => 'Adres email na który będzie wysyłany formularz kontaktowy')); if ($gal = $this->get_component('RotatorZdjec')) { $this->add_attr('objs_images_rotate', 'ObjField', c('Dodawanie obrazków'), array( 'description' => 'Obrazki rotowane w nagłówku strony. Wymiary proporcjonalnie do 260px - 295px', 'objtype' => 'Obrazek', 'parentobj' => $gal, 'kind' => 'images', )); } if ($gal = $this->get_component('Galeria')) { $this->add_attr('objs_images', 'ObjField', c('Dodawanie obrazków'), array( 'description' => 'Obrazki wyświetlane w stopce strony. Kadrowane adaptacyjnie do wymiarów 100px - 75px.', 'objtype' => 'Obrazek', 'parentobj' => $gal, 'kind' => 'images', )); } $this->add_attr('footer_gallery', 'CheckField', c('Pokaż obrazki w stopce'), array()); $this->actionProviders[] = new TransAction($this); // Settings tab fields $this->add_attr('keywords', 'Field', c('Słowa kluczowe (widoczne dla wyszukiwarek - meta keywords)'), array( 'group' => array('settings') )); $this->add_attr('meta_desc', 'BBField', c('Opis serwisu (widoczny dla wyszukiwarek - meta description)'), array( 'group' => array('settings') )); $this->add_attr('ga_code', 'BBField', c('Kod Google Analytics'), array('group' => array('settings'), 'description' => 'Kod bez znacznikow script')); // $this->add_attr('admessage_api', 'Field', c('Klucz Admessage'), array('group' => array('settings'))); $this->add_attr('contact_email', 'EmailField', c('Adres Email'), array('required' => true, 'description' => 'Adres email na który zostanie wysłany formularz kontaktowy', 'group' => array('settings'))); // $this->add_attr('c_subject', 'Field', c('Temat Wiadomści'), array('required' => true, 'description' => 'Temat wiadomości, wysyłanych za pośrednictwem formularza kontaktowego', 'group' => array('settings'))); // End Settings tab fields } function get_foot_imgs(){ if(!($cmp = $this->get_component('Galeria'))) return false; $imgs = $cmp->get_content_objects(); if(count($imgs) == 0) return false; return $imgs; } } ?> 'Formularz', SHORTNAME => 'form', CLASSNAME => 'Formularz', INSTALL_IMPLICIT_ROOT => true, INSTALL_EXPLICIT_ROOT => false, INSTALL_IMPLICIT_LEAF => false, INSTALL_EXPLICIT_LEAF => false, ); class Formularz extends StatelessPlugin { var $type = 'Formularz'; function Formularz($oid, &$obj, $name=false) { $this->StatelessPlugin($oid, $obj, $name); $this->allowed_types = array(); $this->edit_permission = 'rights'; $this->views = array( 'view' => 'stronaview.tpl', 'subskrybcje' => 'ajax.tpl', ); } function send_mail($to, $subject, $body = '', $name, $email) { $header = "MIME-Version: 1.0\n"; $header .= "Content-type: text/plain; charset=UTF-8\n"; $header .= "From: $name <$email>\n"; $subject = '=?UTF-8?B?'.base64_encode($subject).'?='; /* echo "------------------"; echo $header; echo '\n'; echo $to; echo '\n'; echo $subject; echo '\n'; echo $body; echo '\n'; echo "------------------"; */ try { return mail($to, $subject, $body, $header); } catch (Exception $e) { return false; } } function parse_request() { parent::parse_request(); global $portal, $smarty, $systempath; $p =& $_POST; $email = $this->get_root()->get('contact_email'); if (!in_array($p['action'], array('contact')) || !$email) { echo 'err'; die(); }; if ($p['action'] == 'contact') { $body = "Witaj,\n\n"; $body .= "Otrzymałeś wiadomość za pośrednictwem formularza kontaktowego\n\n"; $body .= $p['name']." ".$p['surname']." zadał pytanie:\n"; $body .= $p['content']."\n\n"; $body .= "Dane kontaktowe: \n"; $body .= "E-mail: ".$p['useremail']."\n"; $body .= "Firma: ".$p['company']."\n\n"; $body .= "--\n"; $body .= "Dianthus"; $ret = $this->send_mail($email,'Wiadomość wysłana z serwisu Dianthus', $body, $p['useremail'], $p['useremail']); } print $ret ? 'ok' : 'err'.$email; die(); } } 'Paginate', SHORTNAME => 'plugin_paginate', CLASSNAME => 'PaginatePlugin', INSTALL_IMPLICIT_ROOT => true, INSTALL_EXPLICIT_ROOT => false, INSTALL_IMPLICIT_LEAF => false, INSTALL_EXPLICIT_LEAF => false, ); class PaginatePlugin extends StatelessPlugin { var $type = 'PaginatePlugin'; function paginate($params, &$smarty) { $pagelen = intval($params['pagelen']); $pageitems = $params['pageitems']; $pagesel = $params['pagesel']; $pageurl = $params['pageurl']; $items = $params['items']; $page = intval($_GET['page']); $sep = $params['pageselsep']; $sep2 = $params['pageselsep2']; $pagecount = ceil(count($items) / (float)$pagelen); $itemcount = count($items); $join = (strpos($pageurl, '?') === FALSE) ? '?' : '&'; $retitems = array(); for($i=$page*$pagelen;$i<($page+1)*$pagelen && $i<$itemcount;++$i) { $retitems[] = $items[$i]; } $retsel = ''; if ($page == 0) { $class = 'prev-inactive'; $url = ''; } else { $class = ''; $url = 'href="' . $pageurl . $join . "page=" . ($page - 1) . '"'; } $retsel .= '' . $sep2; for($i=0;$i<$pagecount;++$i) { $class = ''; if ($i == 0) $class = 'first '; if ($i == $pagecount-1) $class .= 'last '; if ($i == $page) $class .= 'current '; $url = $pageurl . $join . "page=" . $i; $retsel .= '' . ($i+1) . ''; if ($i != $pagecount-1) $retsel .= $sep; } if ($page == ($pagecount - 1)) { $class = 'next-inactive'; $url = ''; } else { $class = ''; $url = 'href="' . $pageurl . $join . "page=" . ($page + 1) . '"'; } $retsel .= $sep2 . ''; if ($pagecount <= 1) $retsel = ''; $smarty->assign($pageitems, $retitems); $smarty->assign($pagesel, $retsel); } function PaginatePlugin($oid, &$obj, $name=false) { $this->Plugin($oid, $obj, $name); $this->allowed_types = array(); $this->views = array(); $this->pads = array(); $this->edit_permission = 'edit'; global $smarty; try { $smarty->registerPlugin('function', 'paginate', array(&$this, 'paginate')); } catch (Exception $e) { }; // $smarty->register_function('paginate', array(&$this, 'paginate')); } } ComponentPlugin($oid, $noinit); $this->allowed_types = array('Obrazek'); $this->add_view('galeria', 'cms_folder.tpl', 'edit', false); $this->add_view('upload', 'ajax_echo.tpl', 'view'); $this->add_view('sort', 'ajax_echo.tpl', 'view'); } function parse_request() { parent::parse_request(); global $systempath, $s, $smarty; $smarty->caching = false; $r =& $_REQUEST; /* if ($this->view == 'upload') { $this->maintemplate = 'ajax.tpl'; $parentobj = $this->getObj($r['parentoid']); $obr = $parentobj->create_object($r['objtype'], strtolower($r['objtype'])); $img = $obr->attr['img']; $obr->set('img', $_FILES['Filedata']); $s['echo'] = 'ok'; return; } */ if ($this->view == 'sort') { $this->maintemplate = 'ajax.tpl'; $old_oids = $this->folder->getRaw(); $new_oids = $r['oids']; foreach($old_oids as $k => $v){ if(!in_array($v, $new_oids))array_push($new_oids, $v); } $this->folder->set($new_oids); return; } } } $TYPENAME['StronaGaleria'] = 'Galeria'; class StronaGaleria extends Strona { var $allowed_types = array(); function StronaGaleria($oid) { $this->Strona($oid); $this->views['view'] = 'gallery.tpl'; $this->add_attr('subtitle', 'Field', c('Podtytuł'), array(), 'redirect'); $this->hide_attr('body', 'redirect', 'nolist','pub_date','img','layout'); if(isset($this->attr['objs_images'])) $this->attr['objs_images']->description = 'Obrazy galerii'; } function get_foot_imgs(){ if(!($cmp = $this->get_parent()->get_component('Galeria'))) return false; $imgs = $cmp->get_content_objects(); if(count($imgs) == 0) return false; return $imgs; } } class Obrazek extends StronaSimple { function objfield_info() { if (!$this->attr['img']->is_set()) return parent::objfield_info(); $img = $this->attr['img']->get('100', '100', 'adaptive'); $html = ""; return $html; } function Obrazek($oid) { $this->StronaSimple($oid); $this->add_attr('img', 'ImageBrowserField', c('Obrazek'), array( 'group' => array('default', 'create', 'required') )); $this->attr['title']->group = array('default'); $this->attr['title']->default = 'Obrazek'; $this->add_attr('name', 'Field', c('Nazwa'), array( 'group' => array('default', 'create') )); } } ?>
Warning: Cannot modify header information - headers already sent by (output started at /www-data/pelargonia.pl/cms-core/finder.php:131) in /www-data/pelargonia.pl/cms-core/types.php on line 1623