Example #1
0
 /**
  */
 protected function view()
 {
     /* determine template package */
     $tplPackage = Sobi::Cfg('section.template', SPC::DEFAULT_TEMPLATE);
     Sobi::ReturnPoint();
     /* load template config */
     $this->template();
     $this->tplCfg($tplPackage);
     /* get limits - if defined in template config - otherwise from the section config */
     $eLimit = $this->tKey($this->template, 'entries_limit', Sobi::Cfg('list.entries_limit', 2));
     $eInLine = $this->tKey($this->template, 'entries_in_line', Sobi::Cfg('list.entries_in_line', 2));
     $cInLine = $this->tKey($this->template, 'categories_in_line', Sobi::Cfg('list.categories_in_line', 2));
     $cLim = $this->tKey($this->template, 'categories_limit', -1);
     $entriesRecursive = $this->tKey($this->template, 'entries_recursive', Sobi::Cfg('list.entries_recursive', false));
     /* get the site to display */
     $site = SPRequest::int('site', 1);
     $eLimStart = ($site - 1) * $eLimit;
     /* get the right ordering */
     $eOrder = $this->parseOrdering('entries', 'eorder', $this->tKey($this->template, 'entries_ordering', Sobi::Cfg('list.entries_ordering', 'name.asc')));
     $cOrder = $this->parseOrdering('categories', 'corder', $this->tKey($this->template, 'categories_ordering', Sobi::Cfg('list.categories_ordering', 'name.asc')));
     $orderings = array('entries' => $eOrder, 'categories' => $cOrder);
     /* get entries */
     $eCount = count($this->getEntries($eOrder, 0, 0, true, null, $entriesRecursive));
     $entries = $this->getEntries($eOrder, $eLimit, $eLimStart, false, null, $entriesRecursive);
     $categories = array();
     if ($cLim) {
         $categories = $this->getCats($cOrder, $cLim);
     }
     /* create page navigation */
     $url = array('sid' => SPRequest::sid(), 'title' => Sobi::Cfg('sef.alias', true) ? $this->_model->get('nid') : $this->_model->get('name'));
     if (SPRequest::cmd('sptpl')) {
         $url['sptpl'] = SPRequest::cmd('sptpl');
     }
     $pnc = SPLoader::loadClass('helpers.pagenav_' . $this->tKey($this->template, 'template_type', 'xslt'));
     /* @var SPPageNavXSLT $pn */
     $pn = new $pnc($eLimit, $eCount, $site, array('sid' => SPRequest::sid(), 'title' => Sobi::Cfg('sef.alias', true) ? $this->_model->get('nid') : $this->_model->get('name')));
     /* handle meta data */
     SPFactory::header()->objMeta($this->_model);
     /* add pathway */
     SPFactory::mainframe()->addObjToPathway($this->_model, array(ceil($eCount / $eLimit), $site));
     $this->_model->countVisit();
     /* get view class */
     //		$class = SPLoader::loadView( $this->_type );
     $view = SPFactory::View($this->_type);
     //		$view = new $class( $this->template );
     $view->assign($eLimit, '$eLimit')->assign($eLimStart, '$eLimStart')->assign($eCount, '$eCount')->assign($cInLine, '$cInLine')->assign($eInLine, '$eInLine')->assign($this->_task, 'task')->assign($this->_model, $this->_type)->setConfig($this->_tCfg, $this->template)->setTemplate($tplPackage . '.' . $this->templateType . '.' . $this->template)->assign($categories, 'categories')->assign($pn->get(), 'navigation')->assign(SPFactory::user()->getCurrent(), 'visitor')->assign($entries, 'entries')->assign($orderings, 'orderings');
     Sobi::Trigger($this->name(), 'View', array(&$view));
     $view->display($this->_type);
 }
Example #2
0
 private function screen()
 {
     $view =& SPFactory::View('view', true);
     $view->setTemplate('config.help');
     if (SPLoader::path('etc.repos.sobipro_core.repository', 'front', true, 'xml')) {
         $repository = SPFactory::Instance('services.installers.repository');
         $repository->loadDefinition(SPLoader::path("etc.repos.sobipro_core.repository", 'front', true, 'xml'));
         try {
             $repository->connect();
         } catch (SPException $x) {
             $view->assign(SPLang::e('REPO_ERR', $x->getMessage()), 'message');
         }
         try {
             $response = $repository->help($repository->get('token'), SPRequest::cmd('mid'));
             $view->assign($response, 'message');
         } catch (SPException $x) {
             $view->assign(SPLang::e('REPO_ERR', $x->getMessage()), 'message');
         }
     } else {
         $view->assign(Sobi::Txt('MSG.HELP_ADD_CORE_REPO'), 'message');
     }
     $view->display();
 }
Example #3
0
 /**
  */
 public function execute()
 {
     /* parent class executes the plugins */
     SPRequest::set('task', $this->_type . '.' . $this->_task);
     switch ($this->_task) {
         case 'front':
             $this->getSections();
             /** @var $view SPAdmPanelView */
             $view = SPFactory::View('front');
             /* load template config */
             //				$this->tplCfg( 'front' );
             //				$view->setConfig( $this->_tCfg, 'general' );
             $view->determineTemplate('front', SPC::DEFAULT_TEMPLATE);
             $view->assign($this->_sections, 'sections');
             $view->display();
             break;
         default:
             /* case parents or plugin didn't registered this task, it was an error */
             if (!parent::execute()) {
                 Sobi::Error($this->name(), SPLang::e('SUCH_TASK_NOT_FOUND', SPRequest::task()), SPC::NOTICE, 404, __LINE__, __FILE__);
             }
             break;
     }
 }
 protected function view()
 {
     $msg = null;
     $store = array();
     Sobi::SetUserData('requirements', $store);
     $home = SPRequest::int('init') ? Sobi::Url(null, true) : Sobi::Url('config', true);
     /** @var $view SPAdmView */
     //		header( 'Cache-Control: no-cache, must-revalidate' );
     //		header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' );
     SPFactory::View('view', true)->assign(SPRequest::int('init'), 'init')->addHidden($home, 'redirect')->determineTemplate('config', 'requirements')->display();
 }
Example #5
0
 protected function view()
 {
     /* determine template package */
     $tplPckg = Sobi::Cfg('section.template', SPC::DEFAULT_TEMPLATE);
     Sobi::ReturnPoint();
     $this->_task = 'alpha';
     if (!$this->_model) {
         $this->setModel('section');
         $this->_model->init(Sobi::Section());
     }
     $this->visible();
     /* load template config */
     $this->template();
     $this->tplCfg($tplPckg);
     /* get limits - if defined in template config - otherwise from the section config */
     $eLimit = $this->tKey($this->template, 'entries_limit', Sobi::Cfg('list.entries_limit', 2));
     $eInLine = $this->tKey($this->template, 'entries_in_line', Sobi::Cfg('list.entries_in_line', 2));
     /* get the site to display */
     $site = SPRequest::int('site', 1);
     $eLimStart = ($site - 1) * $eLimit;
     $eCount = count($this->getEntries(0, 0, true));
     $entries = $this->getEntries($eLimit, $site);
     $compare = $this->_field ? $this->_field : $this->_nid;
     if (strlen($compare) && $compare != Sobi::Cfg('alphamenu.primary_field')) {
         $t = 'list.alpha.' . strtolower($this->_letter) . '.' . $this->_nid;
     } else {
         $t = 'list.alpha.' . strtolower($this->_letter);
     }
     $pn = SPFactory::Instance('helpers.pagenav_' . $this->tKey($this->template, 'template_type', 'xslt'), $eLimit, $eCount, $site, array('sid' => SPRequest::sid(), 'task' => $t));
     $cUrl = array('sid' => SPRequest::sid(), 'task' => $t);
     if (SPRequest::int('site', 0)) {
         $cUrl['site'] = SPRequest::int('site', 0);
     }
     SPFactory::header()->addCanonical(Sobi::Url($cUrl, true, true, true));
     /* handle meta data */
     SPFactory::header()->objMeta($this->_model);
     $letter = urldecode(SPRequest::cmd('letter'));
     /* add pathway */
     if (!$this->_fieldType) {
         SPFactory::mainframe()->addToPathway(Sobi::Txt('AL.PATH_TITLE', array('letter' => $letter)), Sobi::Url('current'));
         SPFactory::header()->addTitle(Sobi::Txt('AL.TITLE', array('letter' => $letter, 'section' => $this->_model->get('name'))), array(ceil($eCount / $eLimit), $site));
     } else {
         $field = SPFactory::Model('field');
         $field->init($this->_field);
         SPFactory::mainframe()->addToPathway(Sobi::Txt('AL.PATH_TITLE_FIELD', array('letter' => $letter, 'field' => $field->get('name'))), Sobi::Url('current'));
         SPFactory::header()->addTitle(Sobi::Txt('AL.TITLE_FIELD', array('letter' => $letter, 'section' => $this->_model->get('name'), 'field' => $field->get('name'))), array(ceil($eCount / $eLimit), $site));
     }
     /* get view class */
     $view = SPFactory::View('listing');
     $view->assign($eLimit, '$eLimit');
     $view->assign($eLimStart, '$eLimStart');
     $view->assign($eCount, '$eCount');
     $view->assign($eInLine, '$eInLine');
     $view->assign($this->_task, 'task');
     $view->assign($this->_model, 'section');
     $view->assign(Sobi::Txt('AL.PATH_TITLE', array('letter' => $this->_letter)), 'listing_name');
     $view->setConfig($this->_tCfg, $this->template);
     $view->setTemplate($tplPckg . '.' . $this->templateType . '.' . $this->template);
     $view->assign($pn->get(), 'navigation');
     $view->assign(SPFactory::user()->getCurrent(), 'visitor');
     $view->assign($entries, 'entries');
     Sobi::Trigger('AlphaListing', 'View', array(&$view));
     $view->display();
 }
Example #6
0
 /**
  */
 public function execute()
 {
     switch ($this->_task) {
         case 'panel':
             $this->getSections();
             /** @var $view SPAdmPanelView */
             $view = SPFactory::View('front', true)->assign($acl, 'acl')->assign($this->_sections, 'sections')->assign($this->getNews(), 'news')->assign(Sobi::GetUserState('sections.order', 'order', 'name.asc'), 'order')->assign(SPFactory::CmsHelper()->myVersion(true), 'version')->assign(Sobi::Cfg('cpanel.show_entries', false), 'show-entries')->assign($this->getState(), 'system-state');
             if (Sobi::Cfg('cpanel.show_entries', false)) {
                 $view->assign($this->getEntries(), 'entries');
             }
             SPLang::load('com_sobipro.about');
             $view->determineTemplate('front', 'cpanel');
             Sobi::Trigger('Panel', 'View', array(&$view));
             $view->display();
             break;
         default:
             /* case plugin didn't registered this task, it was an error */
             if (!parent::execute()) {
                 Sobi::Error($this->name(), SPLang::e('SUCH_TASK_NOT_FOUND', SPRequest::task()), SPC::NOTICE, 404, __LINE__, __FILE__);
             }
             break;
     }
 }
Example #7
0
 protected function listFunctions()
 {
     /** @var SPDirectory $directory */
     $directory = SPFactory::Instance('base.fs.directory', SPLoader::dirPath('menu', 'adm.templates'));
     $files = $directory->searchFile('.xml', false);
     $functions = array();
     if (count($files)) {
         foreach ($files as $file) {
             $path = $file->getPathInfo();
             $functions[$path['filename']] = $this->functionDetails($file);
         }
     }
     /** Mon, Aug 24, 2015 10:24:24 - put the section ink on the top */
     $section = $functions['section'];
     unset($functions['section']);
     $functions = array_merge(array('section' => $section), $functions);
     $functions = array_merge(array('null' => Sobi::Txt('SOBI_SELECT_FUNCTIONALITY')), $functions);
     SPFactory::View('joomla-menu', true)->assign($functions, 'functions')->functions();
 }
Example #8
0
 /**
  * @param string
  * @return SPConfigAdmView
  */
 protected function getView($task)
 {
     SPLoader::loadClass('html.input');
     $sid = Sobi::Reg('current_section');
     /* create menu */
     $class = SPLoader::loadClass('views.adm.menu');
     $menu = new $class($task, $sid);
     /* load the menu definition */
     if ($sid) {
         $cfg = SPLoader::loadIniFile('etc.adm.section_menu');
     } else {
         $cfg = SPLoader::loadIniFile('etc.adm.config_menu');
     }
     Sobi::Trigger('Create', 'AdmMenu', array(&$cfg));
     if (count($cfg)) {
         foreach ($cfg as $section => $keys) {
             $menu->addSection($section, $keys);
         }
     }
     Sobi::Trigger('AfterCreate', 'AdmMenu', array(&$menu));
     if ($sid) {
         if (Sobi::Cfg('section.template') == SPC::DEFAULT_TEMPLATE && strstr(SPRequest::task(), 'config')) {
             SPFactory::message()->warning(Sobi::Txt('TP.DEFAULT_WARN', 'https://www.sigsiu.net/help_screen/template.info'), false)->setSystemMessage();
         }
         /* create new SigsiuTree */
         $tree = SPLoader::loadClass('mlo.tree');
         $tree = new $tree(Sobi::GetUserState('categories.order', 'corder', 'position.asc'));
         /* set link */
         $tree->setHref(Sobi::Url(array('sid' => '{sid}')));
         $tree->setId('menuTree');
         /* set the task to expand the tree */
         $tree->setTask('category.expand');
         $tree->init($sid);
         /* add the tree into the menu */
         $menu->addCustom('AMN.ENT_CAT', $tree->getTree());
         $seClass = SPLoader::loadModel('section');
         $cSec = new $seClass();
         $cSec->init($sid);
     } else {
         $cSec = array('name' => Sobi::Txt('GB.CFG.GLOBAL_CONFIGURATION'));
         $menu->addCustom('GB.CFG.GLOBAL_TEMPLATES', $this->listTemplates());
     }
     $view = SPFactory::View('config', true);
     $view->assign($task, 'task');
     $view->assign($cSec, 'section');
     $view->assign($menu, 'menu');
     $view->addHidden(SPFactory::registry()->get('current_section'), 'sid');
     return $view;
 }
Example #9
0
 /**
  */
 private function listRules()
 {
     Sobi::ReturnPoint();
     $order = SPFactory::user()->getUserState('acl.order', 'position', 'rid.asc');
     try {
         $rules = SPFactory::db()->select('*', 'spdb_permissions_rules', null, $order)->loadObjectList();
     } catch (SPException $x) {
         Sobi::Error('ACL', SPLang::e('Db reports %s.', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
     }
     $menu = $this->createMenu('acl');
     /** @var $view SPAclView */
     SPFactory::View('acl', true)->assign($this->_task, 'task')->assign($rules, 'rules')->assign($menu, 'menu')->determineTemplate('acl', 'list')->display();
 }
Example #10
0
    /**
     */
    private function editForm()
    {
        $sid = SPRequest::int('pid');
        $sid = $sid ? $sid : SPRequest::sid();
        $view = SPFactory::View('entry', true);
        $this->checkTranslation();
        /* if adding new */
        if (!$this->_model) {
            $this->setModel(SPLoader::loadModel('entry'));
        }
        $this->_model->formatDatesToEdit();
        $id = $this->_model->get('id');
        if (!$id) {
            $this->_model->set('state', 1);
            $this->_model->set('approved', 1);
        } else {
            $view->assign($view->languages(), 'languages-list');
        }
        $this->_model->loadFields(Sobi::Reg('current_section'), true);
        $this->_model->formatDatesToEdit();
        if ($this->_model->isCheckedOut()) {
            SPFactory::message()->error(Sobi::Txt('EN.IS_CHECKED_OUT', $this->_model->get('name')), false);
        } else {
            /* check out the model */
            $this->_model->checkOut();
        }
        /* get fields for this section */
        /* @var SPEntry $this ->_model */
        $fields = $this->_model->get('fields');
        if (!count($fields)) {
            throw new SPException(SPLang::e('CANNOT_GET_FIELDS_IN_SECTION', Sobi::Reg('current_section')));
        }
        $revisionChange = false;
        $rev = SPRequest::cmd('revision');
        $revisionsDelta = array();
        if ($rev) {
            $revision = SPFactory::message()->getRevision(SPRequest::cmd('revision'));
            if (isset($revision['changes']) && count($revision['changes'])) {
                SPFactory::message()->warning(Sobi::Txt('HISTORY_REVISION_WARNING', $revision['changedAt']), false);
                foreach ($fields as $i => $field) {
                    if ($field->get('enabled') && $field->enabled('form')) {
                        if (isset($revision['changes']['fields'][$field->get('nid')])) {
                            $revisionData = $revision['changes']['fields'][$field->get('nid')];
                        } else {
                            $revisionData = null;
                        }
                        $currentData = $field->getRaw();
                        if (is_array($revisionData) && !is_array($currentData)) {
                            try {
                                $currentData = SPConfig::unserialize($currentData);
                            } catch (SPException $x) {
                            }
                        }
                        if ($revisionData || $currentData) {
                            if (md5(serialize($currentData)) != md5(serialize($revisionData))) {
                                $field->revisionChanged()->setRawData($revisionData);
                            }
                        }
                        $fields[$i] = $field;
                    }
                }
                unset($revision['changes']['fields']);
                foreach ($revision['changes'] as $attr => $value) {
                    if ($value != $this->_model->get($attr)) {
                        $revisionsDelta[$attr] = $value;
                        $this->_model->setRevData($attr, $value);
                    }
                }
                $revisionChange = true;
            } else {
                SPFactory::message()->error(Sobi::Txt('HISTORY_REVISION_NOT_FOUND'), false)->setSystemMessage();
            }
        }
        $f = array();
        foreach ($fields as $field) {
            if ($field->get('enabled') && $field->enabled('form')) {
                $f[] = $field;
            }
        }
        /* create the validation script to check if required fields are filled in and the filters, if any, match */
        $this->createValidationScript($fields);
        $view->assign($this->_model, 'entry');
        /* get the categories */
        $cats = $this->_model->getCategories(true);
        if (count($cats)) {
            $tCats = array();
            foreach ($cats as $cid) {
                /* ROTFL ... damn I like arrays ;-) */
                $tCats2 = SPFactory::config()->getParentPath($cid, true);
                if (is_array($tCats2) && count($tCats2)) {
                    $tCats[] = implode(Sobi::Cfg('string.path_separator'), $tCats2);
                }
            }
            if (count($tCats)) {
                $view->assign(implode("\n", $tCats), 'parent_path');
            }
            $view->assign(implode(", ", $cats), 'parents');
        } elseif ($this->_model->get('valid')) {
            $parent = $sid == Sobi::Reg('current_section') ? 0 : $sid;
            if ($parent) {
                $view->assign(implode(Sobi::Cfg('string.path_separator', ' > '), SPFactory::config()->getParentPath($parent, true)), 'parent_path');
            }
            $view->assign($parent, 'parents');
        } else {
            $n = null;
            $view->assign($n, 'parents');
            $view->assign($n, 'parent_path');
        }
        $history = array();
        $messages = SPFactory::message()->getHistory($id);
        if (count($messages)) {
            foreach ($messages as $message) {
                $message['change'] = Sobi::Txt('HISTORY_CHANGE_TYPE_' . str_replace('-', '_', strtoupper($message['change'])));
                $message['site'] = Sobi::Txt('HISTORY_CHANGE_AREA_' . strtoupper($message['site']));
                if (strlen($message['reason'])) {
                    $message['status'] = 1;
                } else {
                    $message['status'] = 0;
                }
                $history[] = $message;
            }
        }
        $versioningAdminBehaviour = Sobi::Cfg('entry.versioningAdminBehaviour', 1);
        if ($versioningAdminBehaviour || !Sobi::Cfg('entry.versioning', true)) {
            SPFactory::header()->addJsCode('
				SobiPro.jQuery( document ).ready( function () { SobiPro.jQuery( "[rel=\'entry.saveWithRevision\']" ).parent().css( "display", "none" ); } );
			');
        }
        $view->assign($this->_task, 'task')->assign($f, 'fields')->assign($id, 'id')->assign($history, 'history')->assign($revisionChange, 'revision-change')->assign($revisionsDelta, 'revision')->assign($versioningAdminBehaviour, 'history-behaviour')->assign(SPFactory::CmsHelper()->userSelect('entry.owner', $this->_model->get('owner') ? $this->_model->get('owner') : ($this->_model->get('id') ? 0 : Sobi::My('id')), true), 'owner')->assign(Sobi::Reg('current_section'), 'sid')->determineTemplate('entry', 'edit')->addHidden($rev, 'revision')->addHidden($sid, 'pid');
        $view->display();
    }
Example #11
0
 protected function view()
 {
     /* determine template package */
     $tplPackage = Sobi::Cfg('section.template', SPC::DEFAULT_TEMPLATE);
     Sobi::ReturnPoint();
     $this->_task = 'user';
     if (!$this->_model) {
         $this->setModel('section');
         $this->_model->init(Sobi::Section());
     }
     $this->visible();
     /* load template config */
     $this->template();
     $this->tplCfg($tplPackage);
     /* get limits - if defined in template config - otherwise from the section config */
     $eLimit = $this->tKey($this->template, 'entries_limit', Sobi::Cfg('list.entries_limit', 2));
     $eInLine = $this->tKey($this->template, 'entries_in_line', Sobi::Cfg('list.entries_in_line', 2));
     $url = array('sid' => SPRequest::sid(), 'task' => 'list.user');
     if (SPRequest::int('uid')) {
         $url['uid'] = SPRequest::int('uid');
         $this->uid = (int) SPRequest::int('uid');
     } else {
         $this->uid = (int) Sobi::My('id');
     }
     $this->user = SPJoomlaUser::getBaseData((int) $this->uid);
     if (!$this->user) {
         throw new SPException(SPLang::e('UNAUTHORIZED_ACCESS'));
     }
     /* get the site to display */
     $site = SPRequest::int('site', 1);
     $eLimStart = ($site - 1) * $eLimit;
     $eOrder = $this->parseOrdering('entries', 'eorder', $this->tKey($this->template, 'entries_ordering', Sobi::Cfg('list.entries_ordering', 'name.asc')));
     $eCount = count($this->getEntries($eOrder, 0, 0, true, array('spo.owner' => $this->uid), true, Sobi::Section()));
     $entries = $this->getEntries($eOrder, $eLimit, $eLimStart, true, array('spo.owner' => $this->uid), true, Sobi::Section());
     //		$eCount = count( $this->_getEntries( 0, 0, true ) );
     //		$entries = $this->_getEntries( $eLimit, $site );
     $pn = SPFactory::Instance('helpers.pagenav_' . $this->tKey($this->template, 'template_type', 'xslt'), $eLimit, $eCount, $site, $url);
     if (SPRequest::int('site', 0)) {
         $url['site'] = SPRequest::int('site', 0);
     }
     SPFactory::header()->addCanonical(Sobi::Url($url, true, true, true));
     /* handle meta data */
     SPFactory::header()->objMeta($this->_model);
     SPFactory::mainframe()->addToPathway(Sobi::Txt('UL.PATH_TITLE', array('username' => $this->user->username, 'user' => $this->user->name)), Sobi::Url('current'));
     SPFactory::header()->addTitle(Sobi::Txt('UL.TITLE', array('username' => $this->user->username, 'user' => $this->user->name, 'section' => $this->_model->get('name'))), array(ceil($eCount / $eLimit), $site));
     /* add pathway */
     /* get view class */
     $view = SPFactory::View('listing');
     $view->assign($eLimit, '$eLimit');
     $view->assign($eLimStart, '$eLimStart');
     $view->assign($eCount, '$eCount');
     $view->assign($eInLine, '$eInLine');
     $view->assign($this->_task, 'task');
     $view->assign($this->_model, 'section');
     $view->setConfig($this->_tCfg, $this->template);
     $view->setTemplate($tplPackage . '.' . $this->templateType . '.' . $this->template);
     $view->assign($pn->get(), 'navigation');
     $view->assign(SPFactory::user()->getCurrent(), 'visitor');
     $view->assign($entries, 'entries');
     Sobi::Trigger('UserListing', 'View', array(&$view));
     $view->display();
 }
Example #12
0
 protected function iconChooser()
 {
     if (!Sobi::Can('category.edit')) {
         Sobi::Error('category', 'You have no permission to access this site', SPC::ERROR, 403, __LINE__, __FILE__);
     }
     $folder = SPRequest::cmd('iconFolder', null);
     $callback = SPRequest::cmd('callback', 'SPSelectIcon');
     $dir = $folder ? Sobi::Cfg('images.category_icons') . str_replace('.', '/', $folder) . '/' : Sobi::Cfg('images.category_icons');
     $files = array();
     $dirs = array();
     if ($folder) {
         $up = explode('.', $folder);
         unset($up[count($up) - 1]);
         $dirs[] = array('name' => Sobi::Txt('FOLEDR_UP'), 'count' => count(scandir($dir . '..')) - 2, 'url' => Sobi::Url(array('task' => 'category.icon', 'out' => 'html', 'iconFolder' => count($up) ? implode('.', $up) : null)));
     }
     $ext = array('png', 'jpg', 'jpeg', 'gif');
     if (is_dir($dir) && ($dh = opendir($dir))) {
         while (($file = readdir($dh)) !== false) {
             if (filetype($dir . $file) == 'file' && in_array(strtolower(SPFs::getExt($file)), $ext)) {
                 $files[] = array('name' => $folder ? str_replace('.', '/', $folder) . '/' . $file : $file, 'path' => str_replace('\\', '/', str_replace(SOBI_ROOT, Sobi::Cfg('live_site'), str_replace('//', '/', $dir . $file))));
             } elseif (filetype($dir . $file) == 'dir' && !($file == '.' || $file == '..')) {
                 $dirs[] = array('name' => $file, 'count' => count(scandir($dir . $file)) - 2, 'path' => str_replace('\\', '/', str_replace(SOBI_ROOT, Sobi::Cfg('live_site'), str_replace('//', '/', $dir . $file))), 'url' => Sobi::Url(array('task' => 'category.icon', 'out' => 'html', 'iconFolder' => $folder ? $folder . '.' . $file : $file)));
             }
         }
         closedir($dh);
     }
     sort($files);
     sort($dirs);
     $view = SPFactory::View('category');
     $view->setTemplate('category.icon');
     $view->assign($this->_task, 'task');
     $view->assign($callback, 'callback');
     $view->assign($files, 'files');
     $view->assign(Sobi::Cfg('images.folder_ico'), 'folder');
     $view->assign($dirs, 'directories');
     $view->icon();
 }
Example #13
0
 private function screen()
 {
     $eLimit = Sobi::GetUserState('adm.errors.limit', 'elimit', Sobi::Cfg('adm_list.entries_limit', 25));
     $eLimStart = SPRequest::int('errSite', 1);
     $LimStart = $eLimStart ? ($eLimStart - 1) * $eLimit : $eLimStart;
     $eCount = 0;
     try {
         $eCount = SPFactory::db()->select('COUNT(eid)', 'spdb_errors')->loadResult();
     } catch (SPException $x) {
     }
     if ($eLimit == -1) {
         $eLimit = $eCount;
     }
     try {
         $errors = SPFactory::db()->select(array('eid', 'date', 'errNum', 'errCode', 'errFile', 'errLine', 'errMsg', 'errUid', 'errSect', 'errReq'), 'spdb_errors', null, 'eid.desc', $eLimit, $LimStart)->loadAssocList();
     } catch (SPException $x) {
     }
     $l = $this->levels();
     $menu = $this->createMenu('error');
     /** @var $view SPAdmView */
     SPFactory::View('error', true)->assign($this->_task, 'task')->assign($menu, 'menu')->assign($errors, 'errors')->assign($l, 'levels')->assign($eLimit, 'errors-limit')->assign($eCount, 'errors-count')->assign($eLimStart, 'errors-site')->display();
 }
Example #14
0
 private function screen()
 {
     $filters = $this->getFilters();
     $Filters = array();
     if (count($filters)) {
         foreach ($filters as $name => $filter) {
             $Filters[] = array('id' => $name, 'regex' => str_replace('\\"' . "\\'", '[:apostrophes:]', base64_decode($filter['params'])), 'name' => $filter['value'], 'message' => $filter['description'], 'editable' => strlen($filter['options']));
         }
     }
     $menu = $this->createMenu('filter');
     /** @var $view  SPAdmView */
     $view = SPFactory::View('view', true);
     $view->assign($this->_task, 'task')->assign($this->createMenu(), 'menu')->assign(Sobi::Url(array('task' => 'filter.edit', 'out' => 'html'), true), 'edit_url')->assign($Filters, 'filters')->assign($menu, 'menu')->determineTemplate('field', 'filters');
     $view->display();
 }
Example #15
0
 /**
  */
 private function editForm()
 {
     /* if adding new */
     if (!$this->_model || $this->_task == 'add') {
         $this->setModel(SPLoader::loadModel('category'));
     }
     $this->checkTranslation();
     $this->_model->formatDatesToEdit();
     $id = $this->_model->get('id');
     if (!$id) {
         $this->_model->set('state', 1);
         $this->_model->set('parent', SPRequest::sid());
     }
     if ($this->_model->isCheckedOut()) {
         SPFactory::message()->error(Sobi::Txt('CAT.IS_CHECKED_OUT'), false);
     } else {
         $this->_model->checkOut();
     }
     $view = SPFactory::View('category', true);
     $view->assign($this->_model, 'category')->assign($this->_task, 'task')->assign(SPFactory::CmsHelper()->userSelect('category.owner', $this->_model->get('owner') ? $this->_model->get('owner') : ($this->_model->get('id') ? 0 : Sobi::My('id')), true), 'owner')->assign($id, 'cid')->addHidden(Sobi::Section(), 'pid');
     Sobi::Trigger('Category', 'EditView', array(&$view));
     $view->display();
 }
Example #16
0
 protected function view()
 {
     /* determine template package */
     $tplPackage = Sobi::Cfg('section.template', SPC::DEFAULT_TEMPLATE);
     Sobi::ReturnPoint();
     $this->_task = 'date';
     if (!$this->_model) {
         $this->setModel('section');
         $this->_model->init(Sobi::Section());
     }
     $this->visible();
     /* load template config */
     $this->template();
     $this->tplCfg($tplPackage);
     /* get limits - if defined in template config - otherwise from the section config */
     $eLimit = $this->tKey($this->template, 'entries_limit', Sobi::Cfg('list.entries_limit', 2));
     $eInLine = $this->tKey($this->template, 'entries_in_line', Sobi::Cfg('list.entries_in_line', 2));
     $date = explode('.', SPRequest::cmd('date'));
     $this->date['year'] = isset($date[0]) && $date[0] ? $date[0] : null;
     $this->date['month'] = isset($date[1]) && $date[1] ? $date[1] : null;
     $this->date['day'] = isset($date[2]) && $date[2] ? $date[2] : null;
     if (!$this->date['year'] || !(int) $this->date['year']) {
         throw new SPException(SPLang::e('INVALID_DATE_GIVEN'));
     }
     /* get the site to display */
     $site = SPRequest::int('site', 1);
     $eLimStart = ($site - 1) * $eLimit;
     $conditions = array('spo.oType' => 'entry', 'year(createdTime)' => $this->date['year']);
     $listing = 'year';
     if ($this->date['month'] && $this->date['month'] < 13 && $this->date['month'] > 0) {
         $conditions['month(createdTime)'] = $this->date['month'];
         $listing = 'month';
     }
     if ($this->date['day'] && $this->date['day'] < 13 && $this->date['day'] > 0) {
         $conditions['day(createdTime)'] = $this->date['day'];
         $listing = 'date';
     }
     $eOrder = 'createdTime';
     $eCount = count($this->getEntries($eOrder, 0, 0, true, $conditions, true, Sobi::Section()));
     $entries = $this->getEntries($eOrder, $eLimit, $eLimStart, true, $conditions, true, Sobi::Section());
     $url = array('sid' => SPRequest::sid(), 'task' => 'list.date', 'date' => SPRequest::cmd('date'));
     $pn = SPFactory::Instance('helpers.pagenav_' . $this->tKey($this->template, 'template_type', 'xslt'), $eLimit, $eCount, $site, $url);
     if (SPRequest::int('site', 0)) {
         $url['site'] = SPRequest::int('site', 0);
     }
     SPFactory::header()->addCanonical(Sobi::Url($url, true, true, true));
     /* handle meta data */
     SPFactory::header()->objMeta($this->_model);
     $date = $this->date;
     $monthsNames = explode(',', Sobi::Txt('JS_CALENDAR_MONTHS'));
     $date['month'] = isset($monthsNames[$date['month'] - 1]) ? trim($monthsNames[$date['month'] - 1]) : null;
     SPFactory::mainframe()->addToPathway(Sobi::Txt('DL.PATH_TITLE_' . strtoupper($listing), $date), Sobi::Url('current'));
     SPFactory::header()->addTitle(Sobi::Txt('DL.TITLE_' . strtoupper($listing), $date), array(ceil($eCount / $eLimit), $site));
     /* get view class */
     $view = SPFactory::View('listing');
     $view->assign($eLimit, '$eLimit');
     $view->assign($eLimStart, '$eLimStart');
     $view->assign($eCount, '$eCount');
     $view->assign($eInLine, '$eInLine');
     $view->assign($this->_task, 'task');
     $view->assign($this->_model, 'section');
     $view->setConfig($this->_tCfg, $this->template);
     $view->setTemplate($tplPackage . '.' . $this->templateType . '.' . $this->template);
     $view->assign($pn->get(), 'navigation');
     $view->assign(SPFactory::user()->getCurrent(), 'visitor');
     $view->assign($entries, 'entries');
     Sobi::Trigger('UserListing', 'View', array(&$view));
     $view->display();
 }
Example #17
0
 private function paymentView($tsId = null, $data = null)
 {
     /* determine template package */
     $tplPackage = Sobi::Cfg('section.template', SPC::DEFAULT_TEMPLATE);
     /* load template config */
     $this->tplCfg($tplPackage);
     if (isset($this->_tCfg['general']['functions']) && $this->_tCfg['general']['functions']) {
         $customClass = SPLoader::loadClass('/' . str_replace('.php', null, $this->_tCfg['general']['functions']), false, 'templates');
         if (method_exists($customClass, 'BeforePaymentView')) {
             $customClass::BeforePaymentView($data);
         }
     }
     SPFactory::mainframe()->addObjToPathway($this->_model);
     $view = SPFactory::View('payment', $this->template);
     $view->assign($this->_model, 'entry');
     $view->assign($data, 'pdata');
     $view->assign(SPFactory::user()->getCurrent(), 'visitor');
     $view->assign($this->_task, 'task');
     $view->addHidden($tsId, 'speditentry');
     $view->addHidden($tsId, 'ssid');
     $view->setConfig($this->_tCfg, $this->_task);
     $view->setTemplate($tplPackage . '.payment.' . $this->_task);
     Sobi::Trigger(ucfirst($this->_task), $this->name(), array(&$view, &$this->_model));
     if (SPRequest::cmd('method', null, 'post') == 'xhr') {
         $view->display();
         $response = ob_get_contents();
         $this->response(Sobi::Back(), $response, false, SPC::INFO_MSG);
     } else {
         $view->display();
     }
     if ($customClass && method_exists($customClass, 'AfterPaymentView')) {
         $customClass::AfterPaymentView();
     }
 }
Example #18
0
 protected function form()
 {
     $ssid = 0;
     /* determine template package */
     $tplPackage = Sobi::Cfg('section.template', SPC::DEFAULT_TEMPLATE);
     /* load template config */
     $this->template();
     $this->tplCfg($tplPackage, 'search');
     if ($this->template == 'results') {
         $this->template = 'view';
     }
     if (!$this->_model) {
         $this->setModel('section');
         $this->_model->init(Sobi::Section());
     }
     /* handle meta data */
     SPFactory::header()->objMeta($this->_model);
     $section = SPFactory::Section(Sobi::Section());
     SPFactory::header()->addKeyword($section->get('sfMetaKeys'))->addDescription($section->get('sfMetaDesc'));
     /* add pathway */
     SPFactory::mainframe()->addToPathway(Sobi::Txt('SH.PATH_TITLE'), Sobi::Url('current'));
     SPFactory::mainframe()->setTitle(Sobi::Txt('SH.TITLE', array('section' => $this->_model->get('name'))));
     Sobi::Trigger('OnFormStart', 'Search');
     SPLoader::loadClass('mlo.input');
     $view = SPFactory::View('search');
     /* if we cannot transfer the search id in cookie */
     if (!$this->session($ssid)) {
         $view->addHidden($ssid, 'ssid');
     }
     if ($this->_task == 'results' && $ssid) {
         /* get limits - if defined in template config - otherwise from the section config */
         $eLimit = $this->tKey($this->template, 'entries_limit', Sobi::Cfg('search.entries_limit', Sobi::Cfg('list.entries_limit', 2)));
         $eInLine = $this->tKey($this->template, 'entries_in_line', Sobi::Cfg('search.entries_in_line', Sobi::Cfg('list.entries_in_line', 2)));
         /* get the site to display */
         $site = SPRequest::int('site', 1);
         $eLimStart = ($site - 1) * $eLimit;
         $view->assign($eLimit, '$eLimit');
         $view->assign($eLimStart, '$eLimStart');
         $view->assign($eInLine, '$eInLine');
         $entries = $this->getResults($ssid, $this->template);
         $view->assign(count($this->_results), '$eCount');
         $view->assign($this->_resultsByPriority, 'priorities');
         $view->assign($entries, 'entries');
         /* create page navigation */
         $pnc = SPLoader::loadClass('helpers.pagenav_' . $this->tKey($this->template, 'template_type', 'xslt'));
         $url = array('task' => 'search.results', 'sid' => SPRequest::sid());
         if (!SPRequest::cmd('ssid', null, 'cookie')) {
             $url['ssid'] = $ssid;
         }
         /* @var SPPageNavXSLT $pn */
         $pn = new $pnc($eLimit, $this->_resultsCount, $site, $url);
         $view->assign($pn->get(), 'navigation');
         /**
          * this is te special case:
          * no matter what task we currently have - if someone called this we need the data for the V-Card
          * Soe we have to trigger all these plugins we need and therefore also fake the task
          */
         $task = 'list.custom';
         SPFactory::registry()->set('task', $task);
     } else {
         $eLimit = -1;
         $view->assign($eLimit, '$eCount');
     }
     /* load all fields */
     $fields = $this->loadFields();
     if (isset($this->_request['search_for'])) {
         $view->assign($this->_request['search_for'], 'search_for');
         $view->assign($this->_request['phrase'], 'search_phrase');
     }
     $view->assign($fields, 'fields');
     $view->assign(SPFactory::user()->getCurrent(), 'visitor');
     $view->assign($this->_task, 'task');
     $view->addHidden(Sobi::Section(), 'sid');
     $view->addHidden('search.search', 'task');
     $view->setConfig($this->_tCfg, $this->template);
     $view->setTemplate($tplPackage . '.' . $this->templateType . '.' . $this->template);
     Sobi::Trigger('OnCreateView', 'Search', array(&$view));
     $view->display();
 }
Example #19
0
 /**
  * List all fields in this section
  */
 private function listFields()
 {
     /* @var SPdb $db */
     $ord = $this->parseOrdering('forder', 'position.asc');
     SPLoader::loadClass('html.input');
     Sobi::ReturnPoint();
     /* create menu */
     $sid = Sobi::Reg('current_section');
     $menu = SPFactory::Instance('views.adm.menu', 'field.list', $sid);
     $cfg = SPLoader::loadIniFile('etc.adm.section_menu');
     Sobi::Trigger('Create', 'AdmMenu', array(&$cfg));
     if (count($cfg)) {
         foreach ($cfg as $section => $keys) {
             $menu->addSection($section, $keys);
         }
     }
     Sobi::Trigger('AfterCreate', 'AdmMenu', array(&$menu));
     /* create new SigsiuTree */
     $tree = SPLoader::loadClass('mlo.tree');
     $tree = new $tree(Sobi::GetUserState('categories.order', 'corder', 'position.asc'));
     /* set link */
     $tree->setHref(Sobi::Url(array('sid' => '{sid}')));
     $tree->setId('menuTree');
     /* set the task to expand the tree */
     $tree->setTask('category.expand');
     $tree->init($sid);
     /* add the tree into the menu */
     $menu->addCustom('AMN.ENT_CAT', $tree->getTree());
     try {
         $results = SPFactory::db()->select('*', 'spdb_field', array('section' => $sid), $ord)->loadObjectList();
     } catch (SPException $x) {
         //			SPConfig::debOut(SPFactory::db()->getQuery());
         Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
     }
     $fields = array();
     if (count($results)) {
         foreach ($results as $result) {
             $field = SPFactory::Model('field', true);
             $field->extend($result);
             $fields[] = $field;
         }
     }
     $fieldTypes = $this->getFieldTypes();
     $subMenu = array();
     foreach ($fieldTypes as $type => $group) {
         asort($group);
         $subMenu[] = array('label' => $type, 'element' => 'nav-header');
         foreach ($group as $t => $l) {
             $subMenu[] = array('type' => null, 'task' => 'field.add.' . $t, 'label' => $l, 'icon' => 'tasks', 'element' => 'button');
         }
     }
     SPFactory::View('field', true)->addHidden($sid, 'sid')->assign($fields, 'fields')->assign($subMenu, 'fieldTypes')->assign(Sobi::Section(true), 'section')->assign($menu, 'menu')->assign(Sobi::GetUserState('fields.order', 'forder', 'position.asc'), 'ordering')->assign($this->_task, 'task')->determineTemplate('field', 'list')->display();
 }
Example #20
0
 private function editFile()
 {
     if (Sobi::Section() && Sobi::Cfg('section.template') == SPC::DEFAULT_TEMPLATE) {
         SPFactory::message()->warning(Sobi::Txt('TP.DEFAULT_WARN', 'https://www.sigsiu.net/help_screen/template.info'), false)->setSystemMessage();
     }
     $file = SPRequest::cmd('file');
     $file = $this->file($file);
     $ext = SPFs::getExt($file);
     $fileContent = SPFs::read($file);
     $path = str_replace('\\', '/', SOBI_PATH);
     if (strstr($file, $path)) {
         $filename = str_replace($path . '/usr/templates/', null, $file);
     } else {
         $filename = str_replace(SOBI_ROOT, null, $file);
     }
     $menu = $this->createMenu();
     if (Sobi::Section()) {
         $menu->setOpen('AMN.APPS_SECTION_TPL');
     } else {
         $menu->setOpen('GB.CFG.GLOBAL_TEMPLATES');
     }
     /** @var $view SPAdmTemplateView */
     $view = SPFactory::View('template', true)->assign($fileContent, 'file_content')->assign($filename, 'file_name')->assign($ext, 'file_ext')->assign($menu, 'menu')->assign($this->_task, 'task')->assign(Sobi::Section(), 'sid')->addHidden(SPRequest::cmd('file'), 'fileName')->addHidden($filename, 'filePath')->determineTemplate('template', 'edit');
     Sobi::Trigger('Edit', $this->name(), array(&$file, &$view));
     $view->display();
 }
Example #21
0
 private function installed()
 {
     $list = array();
     try {
         SPFactory::db()->select('*', 'spdb_plugins');
         $list = SPFactory::db()->loadAssocList();
     } catch (SPException $x) {
     }
     $cl = count($list);
     for ($i = 0; $i < $cl; $i++) {
         $list[$i]['locked'] = SPLoader::path("etc.installed.{$list[$i]['type']}s.{$list[$i]['pid']}", 'front', true, 'xml') ? false : true;
         $list[$i]['eid'] = $list[$i]['type'] . '.' . $list[$i]['pid'];
         if ($list[$i]['pid'] == 'router' || in_array($list[$i]['type'], array('field', 'language', 'module', 'plugin'))) {
             $list[$i]['enabled'] = -1;
         }
     }
     /** @var $view SPExtensionsView */
     $view = SPFactory::View('extensions', true);
     $view->assign($this->_task, 'task')->assign($this->menu(), 'menu')->assign($list, 'applications')->determineTemplate('extensions', $this->_task);
     Sobi::Trigger($this->_task, $this->name(), array(&$view));
     $view->display();
     Sobi::Trigger('After' . ucfirst($this->_task), $this->name(), array(&$view));
 }
Example #22
0
 /**
  */
 private function editForm()
 {
     $this->_model->formatDatesToEdit();
     /** @var $view SPSectionAdmView */
     $view = SPFactory::View('section', true);
     $view->assign($this->_task, 'task')->assign($this->_model, 'section')->determineTemplate('section', 'edit')->display();
 }
Example #23
0
 /**
  * Executes the controller task
  * @return void
  */
 public function execute()
 {
     if (!$this->_cache) {
         try {
             if (is_array($this->_ctrl)) {
                 foreach ($this->_ctrl as &$c) {
                     $c->execute();
                 }
             } else {
                 if ($this->_ctrl instanceof SPControl) {
                     $this->_ctrl->execute();
                 } else {
                     Sobi::Error('CoreCtrl', SPLang::e('No controller to execute'), SPC::ERROR, 500, __LINE__, __FILE__);
                 }
             }
         } catch (SPException $x) {
             Sobi::Error('CoreCtrl', SPLang::e('%s', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
         }
     } else {
         /** @var $view SPFrontView */
         $view = SPFactory::View('cache');
         $view->cachedView($this->_cache['xml'], $this->_cache['template'], $this->_cache['cid'], $this->_cache['config']);
         $view->display();
     }
     /* send header data etc ...*/
     if (SPRequest::cmd('format') == 'raw' && SPRequest::bool('xmlc')) {
         SPFactory::cache()->storeView(array());
     }
     SPFactory::mainframe()->endOut();
     Sobi::Trigger('End');
     /* redirect if any redirect has been set */
     SPFactory::mainframe()->redirect();
     ini_set('display_errors', $this->_err);
     error_reporting($this->_deb);
     restore_error_handler();
 }