function render_html() { if (!__Config::get('MULTILANGUAGE_ENABLED')) { return false; } $iterator = org_glizy_ObjectFactory::createModelIterator('org.glizycms.core.models.Language', 'all', array('order' => 'language_order')); if ($iterator->count() > 1) { $output = '<ul class="' . $this->getAttribute('cssClass') . '" id="' . $this->getId() . '">'; if ($this->getAttribute('separator') == 'start') { $output .= '<li class="separator">|</li>'; } foreach ($iterator as $ar) { $url = __Link::addParams(array('language' => $ar->language_code)); if ($ar->language_id == $this->_application->getLanguageId()) { $output .= '<li class="' . $ar->language_code . '">' . org_glizy_helpers_Link::makeSimpleLink(glz_encodeOutput($ar->language_name), $url, '', 'active') . '</li>'; } else { $output .= '<li class="' . $ar->language_code . '">' . org_glizy_helpers_Link::makeSimpleLink(glz_encodeOutput($ar->language_name), $url) . '</li>'; } } if ($this->getAttribute('separator') == 'end') { $output .= '<li>|</li>'; } $output .= '</ul>'; $this->addOutputCode($output); } }
function process() { $this->_content = new org_glizy_components_BreadcrumbsVO(); $this->_content->label = $this->getAttribute('label'); $this->_content->separator = $this->getAttribute('separator'); $this->_content->cssClass = $this->getAttribute('cssClass'); $menuId = $this->getAttribute('menuId'); $siteMap =& $this->_application->getSiteMap(); $currentMenu = is_null($menuId) ? $this->_application->getCurrentMenu() : $siteMap->getNodeById($menuId); if ($this->extraItem) { array_unshift($this->_content->records, '<span class="' . $this->getAttribute('cssCurrent') . '">' . $this->extraItem . '</span>'); } while (true) { if ($currentMenu->type != 'SYSTEM') { $nodeTitle = empty($currentMenu->titleLink) ? $currentMenu->title : $currentMenu->titleLink; $nodeDescription = empty($currentMenu->linkDescription) ? $nodeTitle : $currentMenu->linkDescription; if (count($this->_content->records)) { if (empty($currentMenu->url)) { array_unshift($this->_content->records, org_glizy_helpers_Link::makeLink('link', array('pageId' => $currentMenu->id, 'title' => $nodeDescription, 'label' => $nodeTitle))); } else { array_unshift($this->_content->records, org_glizy_helpers_Link::makeSimpleLink($nodeTitle, $currentMenu->url, $nodeDescription)); } } else { array_unshift($this->_content->records, '<span class="' . $this->getAttribute('cssCurrent') . '">' . $nodeTitle . '</span>'); } } if ($currentMenu->parentId === 0 || !$currentMenu->parentId) { break; } $tempNode =& $currentMenu->parentNode(); $currentMenu =& $tempNode; } }
function getContent() { $tagContent = trim($this->getText()); if ($this->getAttribute('makeLink') && !empty($tagContent)) { return org_glizy_helpers_Link::makeSimpleLink($tagContent, $tagContent); } else { return $tagContent; } }
function getItem() { $acl = $this->getAttribute('acl'); if (!empty($acl)) { list($service, $action) = explode(',', $acl); if (!$this->_user->acl($service, $action)) { return false; } } $value = strtolower($this->getAttribute('value')); $label = $this->getAttribute('label'); $url = $this->getAttribute('url'); $routeUrl = $this->getAttribute('routeUrl'); $cssClass = $this->getAttribute('cssClass'); if ($routeUrl) { $title = $label; if ($cssClass) { $label = '<i class="' . $cssClass . '"></i>' . $label; } $label = $this->addWrap($label); $url = org_glizy_helpers_Link::makeLink($routeUrl, array('pageId' => $value, 'title' => $title, 'label' => $label), array(), '', false); $condition = $this->getAttribute('selected'); if (!$condition) { $condition = $value; } $condition = explode(',', $condition); if (count($condition) > 1) { $selected = false; for ($i = 0; $i < count($condition); $i++) { if (__Request::get($condition[$i]) == $condition[$i + 1]) { $selected = true; break; } $i++; } } else { $selected = $value == $this->_application->getPageId(); } return array('url' => $url, 'selected' => $selected); } else { if ($url) { return array('url' => org_glizy_helpers_Link::makeSimpleLink($this->addWrap($label), $url, $label, $cssClass), 'selected' => $value == __Request::get('__url__')); } else { if ($value) { $url = org_glizy_helpers_Link::makeLink($value, array('label' => $this->addWrap($label), 'title' => $label, 'cssClass' => $cssClass), array(), '', false); return array('url' => $url, 'selected' => $value == __Request::get('__url__')); } else { return array('url' => '<span class="' . $cssClass . '">' . $label . '</span>', 'selected' => false); } } } }
function _render_html() { if ($this->_content['mediaId'] > 0) { $linkTitle = $this->getAttribute('linkTitle'); $linkTitle = str_replace('#title#', $this->_content['title'], $linkTitle); $linkTitle = str_replace('#size#', org_glizy_helpers_String::formatFileSize($this->media->size), $linkTitle); $originalFileName = $this->media->originalFileName; $part = explode('.', $originalFileName); $type = ''; if (count($part) > 1) { $type = strtoupper($part[count($part) - 1]); } $linkTitle = str_replace('#format#', $type, $linkTitle); $this->_content['linkTitle'] = $linkTitle; $this->_content['__url__'] = org_glizy_helpers_Media::getFileUrlById($this->media->id, $this->getAttribute('directUrl')); $this->_content['__html__'] = org_glizy_helpers_Link::makeSimpleLink($this->_content['title'], $this->_content['__url__'], $linkTitle, $this->getAttribute('cssClass'), $this->getAttribute('rel')); } }
function process() { $this->_content = array(); $this->_content['label'] = $this->getAttribute('label'); $this->_content['cssClass'] = $this->getAttribute('cssClass'); $this->_content['current'] = ''; $this->_content['records'] = array(); $iterator = org_glizy_ObjectFactory::createModelIterator('org.glizycms.core.models.Language'); $iterator->orderBy('language_order'); if ($iterator->count()) { $editLanguageId = $this->_application->getEditingLanguageId(); foreach ($iterator as $ar) { if ($ar->language_id == $editLanguageId) { $this->_content['current'] = $ar->language_name; continue; } $url = org_glizy_helpers_Link::addParams(array('switchLanguage' => $ar->language_id)); $this->_content['records'][] = org_glizy_helpers_Link::makeSimpleLink(glz_encodeOutput($ar->language_name), $url, $ar->language_name); } } }
public function executeLater($email) { if ($this->submit && $this->controller->validate()) { $ar = org_glizy_ObjectFactory::createModel('org.glizy.models.User'); if (!$ar->find(array('user_email' => $email))) { // utente non trovato $this->view->validateAddError(__T('MW_LOSTPASSWORD_ERROR')); return false; } // utente trovato // genera una nuova password e la invia per email glz_import('org.glizy.helpers.Mail'); // invia la notifica all'utente $subject = org_glizy_locale_Locale::get('MW_LOSTPASSWORD_EMAIL_SUBJECT'); $body = org_glizy_locale_Locale::get('MW_LOSTPASSWORD_EMAIL_BODY'); $body = str_replace('##USER##', $email, $body); $body = str_replace('##HOST##', org_glizy_helpers_Link::makeSimpleLink(GLZ_HOST, GLZ_HOST), $body); $body = str_replace('##PASSWORD##', $ar->user_password, $body); org_glizy_helpers_Mail::sendEmail(array('email' => org_glizy_Request::get('email', ''), 'name' => $ar->user_firstName . ' ' . $ar->user_lastName), array('email' => org_glizy_Config::get('SMTP_EMAIL'), 'name' => org_glizy_Config::get('SMTP_SENDER')), $subject, $body); $this->changeAction('lostPasswordConfirm'); } }
/** * Render * * @return void * @access public */ function render_html() { $url = $this->getAttribute('url'); $cssClass = $this->getAttribute('cssClass'); $wrapStart = ''; $wrapEnd = ''; if (!is_null($this->getAttribute('wrapTag'))) { if (!is_null($cssClass)) { $wrapperCssClass = ' class="' . $cssClass . '"'; } else { $wrapperCssClass = ''; } $wrapStart = '<' . $this->getAttribute('wrapTag') . $wrapperCssClass . '>'; $wrapEnd = '</' . $this->getAttribute('wrapTag') . '>'; } if (is_null($url)) { $output = org_glizy_helpers_Link::makeLink2($this->getAttribute('routeUrl'), $this->_content, array('class' => $cssClass, 'id' => $this->getId())); } else { $output = org_glizy_helpers_Link::makeSimpleLink($this->_content['label'], $url, '', $cssClass, '', array('target' => $this->getAttribute('target'), 'icon' => $this->getAttribute('icon'), 'id' => $this->getId())); } $this->addOutputCode($wrapStart . $output . $wrapEnd); }
function _makeNavigationMenu(&$node, $endDepth, &$menu, $skip = false) { $skip = !$skip ? $node->depth < $this->_startDepth : $skip; if ($node->type == 'BLOCK') { return true; } if ($node->depth > $endDepth) { return true; } if ($node->isVisible == 0) { return true; } if (is_string($node->isVisible) && preg_match("/\\{php\\:.*\\}/i", $node->isVisible)) { $phpcode = org_glizy_helpers_PhpScript::parse($node->isVisible); if (!eval($phpcode)) { return true; } } if ($node->type == 'SYSTEM' && !$skip) { return true; } if (!$this->_application->canViewPage($node->id)) { return true; } $nodeTitle = empty($node->titleLink) ? $node->title : $node->titleLink; $nodeDescription = empty($node->linkDescription) ? $nodeTitle : $node->linkDescription; $menuNode = array(); if (!$skip) { $menuNode['id'] = $node->id; $menuNode['title'] = $nodeTitle; $menuNode['label'] = $nodeDescription; $menuNode['depth'] = $node->depth; $menuNode['type'] = $node->pageType; $menuNode['cssClass'] = $node->cssClass; $menuNode['haveChild'] = $node->hasChildNodes(); if ($this->_currentMenuId == $node->id && !$this->getAttribute('forceLink')) { $menuNode['node'] = $nodeTitle; } else { $cssClass = $this->getAttribute('selectLink') && $this->_currentMenuId == $node->id ? $this->getAttribute('cssCurrent') : ''; if (empty($node->url)) { $linkParams = array('pageId' => $node->id, 'title' => $nodeDescription, 'label' => $nodeTitle, 'cssClass' => $cssClass, 'icon' => $node->icon); $menuNode['node'] = org_glizy_helpers_Link::makeLink('link', $linkParams); } else { $url = $node->url; if (strpos($url, 'route:') !== false) { $url = substr($url, 6); $url = __Routing::makeUrl($url, __Request::getAllAsArray()); } $menuNode['node'] = org_glizy_helpers_Link::makeSimpleLink($nodeTitle, $url, $nodeDescription, $cssClass); } } if (!$this->getAttribute('selectLink')) { if (!$this->getAttribute('selectParent')) { $menuNode['selected'] = $this->_currentMenuId == $node->id ? ' ' . $this->getAttribute('attributeToSelect') . '="' . $this->getAttribute('cssCurrent') . '"' : ''; } else { $parentNode =& $this->_currentMenu->parentNodeByDepth($node->depth); if (is_object($parentNode) && $node->depth > 1) { $menuNode['selected'] = $parentNode->id == $node->id || $this->_currentMenuId == $node->id ? ' ' . $this->getAttribute('attributeToSelect') . '="' . $this->getAttribute('cssCurrent') . '"' : ''; } } } } if (count($menuNode)) { $menu[] = $menuNode; } if ($node->hasChildNodes()) { $childNodes =& $node->childNodes(); $tempMenu = array(); for ($i = 0; $i < count($childNodes); $i++) { $newEndDepth = max($this->_endDepth + (in_array($node->id, $this->_menuToOpen) ? 1 : 0), $node->depth + (in_array($node->id, $this->_menuToOpen) ? 1 : 0)); if ($this->getAttribute('showOnlyChilds')) { if (in_array($node->id, $this->_menuToOpen) || $this->_startMenu->depth == $node->depth || $this->_currentMenuId == $node->id || $this->getAttribute('drawAllChilds')) { $this->_makeNavigationMenu($childNodes[$i], $newEndDepth, $tempMenu); } } else { $this->_makeNavigationMenu($childNodes[$i], $newEndDepth, $tempMenu); } } if (count($tempMenu)) { $menuNode['node'] = $tempMenu; $menuNode['selected'] = ''; if ($this->getAttribute('flat') && count($menu)) { $menu = array_merge($menu, $menuNode['node']); } else { $menu[] = $menuNode; } } } if ($skip && count($menu)) { $menu = $menu[0]['node']; } }
function process_ajax() { $onlyFolder = __Request::get('onlyFolder'); $command = __Request::get('command'); $path = ltrim(__Request::get('path'), '/'); $customPath = __Request::get('customPath'); $enableDownload = __Request::get('enableDownload'); $result = array(); if ($command == "read") { $path = utf8_decode($path); if (!$customPath) { $mappingService = $this->_application->retrieveProxy('org.glizycms.mediaArchive.services.MediaMappingService'); if ($path == '') { $mappings = $mappingService->getAllMappings(); foreach ($mappings as $mappingName => $mappingTarget) { $result[] = array('type' => 'dir', 'name' => $mappingName, 'path' => $mappingName, 'icon' => 'folder'); } return $result; } $slashPos = strpos($path, '/'); if ($slashPos == false) { $dir = $mappingService->getMapping($path); } else { $name = substr($path, 0, $slashPos); $dir = $mappingService->getMapping($name) . substr($path, $slashPos); } } else { $dir = $customPath . $path; } $result[] = array('type' => 'dir', 'name' => 'root/', 'path' => '', 'icon' => 'folder'); $files = glob($dir . '/*'); if (!empty($files)) { $filter = $this->getAttribute('filter'); foreach ($files as $file_name) { $file_name = str_replace($dir . '/', '', $file_name); if ($file_name == ".") { continue; } if ($file_name == ".." && $path == '') { continue; } if ($file_name[0] == "." && $file_name[1] != ".") { continue; } // nasconde i file che iniziano col punto // se è settato un filtro sull'estensione dei file, allora non mostra i file che non hanno come estensione quella specificata nel filtro if (!is_dir($dir . '/' . $file_name) && $filter != '' && pathinfo($file_name, PATHINFO_EXTENSION) != $filter) { continue; } $fullPath = $dir . '/' . $file_name; $fullPath2 = $path . '/' . $file_name; if (is_dir($fullPath)) { if ($file_name == "..") { $fullPath2 = dirname(dirname($fullPath2)); } if ($fullPath2 == '/' || $fullPath2 == '.') { $fullPath2 = ''; } $result[] = array('type' => 'dir', 'name' => utf8_encode($file_name), 'path' => ltrim(utf8_encode($fullPath2), '/'), 'icon' => 'folder'); } else { if (!$onlyFolder) { $sizeInBytes = filesize($fullPath); $extension = strtolower(pathinfo($fullPath, PATHINFO_EXTENSION)); $iconType = array('jpg' => 'image', 'jpeg' => 'image', 'gif' => 'image', 'png' => 'image', 'pdf' => 'pdf', 'flv' => 'video', 'mp4' => 'video', 'm4v' => 'video', 'mp3' => 'audio'); $icon = isset($iconType[$extension]) ? $iconType[$extension] : 'other'; if ($enableDownload) { $name = org_glizy_helpers_Link::makeSimpleLink($file_name, $fullPath, '', '', '', array('download' => $file_name)); } else { $name = utf8_encode($file_name); } $result[] = array('type' => 'file', 'name' => $name, 'path' => utf8_encode($fullPath2), 'size' => $this->formatSize($sizeInBytes), 'icon' => $icon, 'date' => date('H:i:s d/m/Y', filemtime($fullPath))); } } } } } return $result; }
/** * @return array */ static function getEmailInfoStructure() { $info = array(); $info['EMAIL'] = ''; $info['FIRST_NAME'] = ''; $info['LAST_NAME'] = ''; $info['USER'] = ''; $info['PASSWORD'] = ''; $info['URL_SITE'] = org_glizy_helpers_Link::makeSimpleLink(GLZ_HOST, GLZ_HOST); $info['HOST'] = GLZ_HOST; $info['ATTACHS'] = array(); $info['BCC'] = array(); $info['CC'] = array(); return $info; }