Beispiel #1
1
 /**
  * @param string $to - path where the archive should be extracted to
  * @return bool
  */
 public function extract($to)
 {
     $r = false;
     $ext = SPFs::getExt($this->_filename);
     switch ($ext) {
         case 'zip':
             $zip = new ZipArchive();
             if ($zip->open($this->_filename) === true) {
                 SPException::catchErrors(SPC::WARNING);
                 try {
                     $zip->extractTo($to);
                     $zip->close();
                     $r = true;
                 } catch (SPException $x) {
                     $t = Sobi::FixPath(Sobi::Cfg('fs.temp') . DS . md5(microtime()));
                     SPFs::mkdir($t, 0777);
                     $dir = SPFactory::Instance('base.fs.directory', $t);
                     if ($zip->extractTo($t)) {
                         $zip->close();
                         $dir->moveFiles($to);
                         $r = true;
                     }
                     SPFs::delete($dir->getPathname());
                 }
                 SPException::catchErrors(0);
             }
             break;
     }
     return $r;
 }
Beispiel #2
0
    public static function getGroupsField()
    {
        $db =& JFactory::getDbo();
        $db->setQuery('
				 SELECT a.id AS value, a.title AS text, COUNT(DISTINCT b.id) AS level
				 FROM #__usergroups AS a
				 LEFT JOIN `#__usergroups` AS b ON a.lft > b.lft AND a.rgt < b.rgt
				 GROUP BY a.id
				 ORDER BY a.lft ASC');
        $options = $db->loadObjectList();
        // Check for a database error.
        if ($db->getErrorNum()) {
            JError::raiseNotice(500, $db->getErrorMsg());
            return null;
        }
        for ($i = 0, $n = count($options); $i < $n; $i++) {
            $options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->text;
        }
        $gids = array();
        foreach ($options as $k => $v) {
            $gids[] = get_object_vars($v);
        }
        $gids[0] = array('value' => 0, 'text' => Sobi::Txt('ACL.REG_VISITOR'), 'level' => 0);
        return $gids;
    }
Beispiel #3
0
 public function save(&$attr)
 {
     parent::save($attr);
     if ($attr['method'] == 'fixed') {
         if (!$attr['fixedCid']) {
             throw new SPException(SPLang::e('FIELD_FIXED_CID_MISSING'));
         } else {
             $cids = explode(',', $attr['fixedCid']);
             if (count($cids)) {
                 foreach ($cids as $cid) {
                     $catId = (int) $cid;
                     if (!$catId) {
                         throw new SPException(SPLang::e('FIELD_FIXED_CID_INVALID', $cid));
                     }
                     if ($catId == Sobi::Section()) {
                         throw new SPException(SPLang::e('FIELD_FIXED_CID_INVALID', $cid));
                     } else {
                         $parents = SPFactory::config()->getParentPath($catId);
                         if (!isset($parents[0]) || $parents[0] != Sobi::Section()) {
                             throw new SPException(SPLang::e('FIELD_FIXED_CID_INVALID_SECTION', $catId));
                         }
                     }
                 }
             } else {
                 throw new SPException(SPLang::e('FIELD_FIXED_CID_MISSING'));
             }
         }
     }
 }
Beispiel #4
0
 protected function upload()
 {
     $ident = SPRequest::cmd('ident', null, 'post');
     $data = SPRequest::file($ident, 'tmp_name');
     $secret = md5(Sobi::Cfg('secret'));
     if ($data) {
         $properties = SPRequest::file($ident);
         $fileName = md5(SPRequest::file($ident, 'name') . time() . $secret);
         $path = SPLoader::dirPath("tmp.files.{$secret}", 'front', false) . '/' . $fileName;
         /** @var $file SPFile */
         $file = SPFactory::Instance('base.fs.file');
         if (!$file->upload($data, $path)) {
             $this->message(array('type' => 'error', 'text' => SPLang::e('CANNOT_UPLOAD_FILE'), 'id' => ''));
         }
         $path = $file->getPathname();
         $type = $this->check($path);
         $properties['tmp_name'] = $path;
         SPFs::write($path . '.var', SPConfig::serialize($properties));
         $response = array('type' => 'success', 'text' => Sobi::Txt('FILE_UPLOADED', $properties['name'], $type), 'id' => 'file://' . $fileName, 'data' => array('name' => $properties['name'], 'type' => $properties['type'], 'size' => $properties['size']));
     } else {
         $response = array('type' => 'error', 'text' => SPLang::e('CANNOT_UPLOAD_FILE_NO_DATA'), 'id' => '');
     }
     //		$field = SPRequest::cmd( 'field', null );
     $this->message($response);
 }
Beispiel #5
0
 /**
  *
  */
 public function display()
 {
     $sections =& $this->get('sections');
     $_sections = array();
     if (count($sections)) {
         foreach ($sections as $section) {
             $name = $section->get('name');
             $id = $section->get('id');
             $url = Sobi::Url(array('sid' => $id));
             $_section = array();
             $_section['id'] = $id;
             $_section['nid'] = $section->get('nid');
             $_section['name'] = "<a href=\"{$url}\">{$name}</a>";
             //				$_section[ 'entries_counter' ] 		= $section->countChilds( 'entry' );
             //				$_section[ 'categories_counter' ] 	= $section->countChilds( 'category' );
             //				$_section[ 'state' ] = SPLists::state( $section );
             //				$_section[ 'checkbox' ] = SPLists::checkedOut( $section, 'sid' );
             $_section['createdTime'] = $section->get('createdTime');
             $_section['metaDesc'] = $section->get('metaDesc');
             $_section['metaKey'] = $section->get('metaKey');
             $_section['description'] = $section->get('description');
             $_section['url'] = $url;
             $_sections[] = $_section;
         }
     }
     $this->set($_sections, 'sections');
     parent::display();
 }
Beispiel #6
0
 protected function translate()
 {
     $term = Sobi::Txt(SPRequest::cmd('term'));
     Sobi::Trigger('Translate', 'Text', array(&$term));
     SPFactory::mainframe()->cleanBuffer()->customHeader();
     echo json_encode(array('translation' => $term));
     exit;
 }
Beispiel #7
0
 /**
  * @param string $definition
  * @param string $type
  * @return SPInstaller
  */
 public function __construct($definition, $type = null)
 {
     $this->type = $type;
     $this->xmlFile = $definition;
     $this->definition = new DOMDocument(Sobi::Cfg('xml.version', '1.0'), Sobi::Cfg('xml.encoding', 'UTF-8'));
     $this->definition->load($this->xmlFile);
     $this->xdef = new DOMXPath($this->definition);
     $this->root = dirname($this->xmlFile);
 }
Beispiel #8
0
 public function __call($method, $params)
 {
     if (function_exists($method)) {
         $this->string = $method($this->string);
     } else {
         Sobi::Error('String', "Function {$method} does not exist!", SPC::WARNING);
     }
     return $this;
 }
 /**
  * @param string $dir - path
  * @return SPDirectoryIterator
  */
 public function __construct($dir)
 {
     $Dir = scandir($dir);
     $this->_dir = new ArrayObject();
     foreach ($Dir as $file) {
         $this->append(new SPFile(Sobi::FixPath($dir . '/' . $file)));
     }
     $this->uasort(array($this, '_spSort'));
 }
Beispiel #10
0
 /**
  */
 private function edit()
 {
     $id = $this->get('entry.id');
     if ($id) {
         $this->addHidden($id, 'entry.id');
     }
     $sid = SPRequest::int('pid') ? SPRequest::int('pid') : SPRequest::sid();
     $this->assign(Sobi::Url(array('task' => 'category.chooser', 'sid' => $sid, 'out' => 'html', 'multiple' => 1), true), 'cat_chooser_url');
 }
 private function screen()
 {
     $bankData = SPLang::getValue('bankdata', 'application', Sobi::Section());
     if (!strlen($bankData)) {
         SPLang::getValue('bankdata', 'application');
     }
     $tile = Sobi::Txt('APP.BANK_TRANSFER_NAME');
     $this->getView('bank_transfer')->assign($tile, 'title')->assign($bankData, 'bankdata')->determineTemplate('extensions', 'bank-transfer')->display();
 }
Beispiel #12
0
 public function execute()
 {
     $method = explode('.', $this->_task);
     $this->nid = 'field_' . $method[0];
     $method = 'Proxy' . ucfirst($method[1]);
     $this->fid = SPFactory::db()->select('fid', 'spdb_field', array('nid' => $this->nid, 'section' => Sobi::Section()))->loadResult();
     $this->field = SPFactory::Model('field');
     $this->field->init($this->fid);
     $this->field->{$method}();
     return true;
 }
Beispiel #13
0
 public function save(&$attr)
 {
     $data = array('key' => $this->nid . '-viewInfo', 'value' => $attr['viewInfo'], 'type' => 'field_information', 'fid' => $this->fid, 'id' => Sobi::Section(), 'section' => Sobi::Section());
     SPLang::saveValues($data);
     $data = array('key' => $this->nid . '-entryInfo', 'value' => $attr['entryInfo'], 'type' => 'field_information', 'fid' => $this->fid, 'id' => Sobi::Section(), 'section' => Sobi::Section());
     SPLang::saveValues($data);
     $attr['required'] = 0;
     $attr['fee'] = 0;
     $attr['isFree'] = 1;
     parent::save($attr);
 }
Beispiel #14
0
 public static function getGroupsField()
 {
     $acl =& JFactory::getACL();
     $g = $acl->get_group_children_tree(null, 'USERS', false);
     $gids = array();
     foreach ($g as $k => $v) {
         $gids[] = get_object_vars($v);
     }
     array_unshift($gids, array('value' => '0', 'text' => Sobi::Txt('ACL.REG_VISITOR'), 'disable' => null));
     return $gids;
 }
Beispiel #15
0
 protected function search()
 {
     if (!SPFactory::mainframe()->checkToken()) {
         Sobi::Error('Token', SPLang::e('UNAUTHORIZED_ACCESS_TASK', SPRequest::task()), SPC::ERROR, 403, __LINE__, __FILE__);
     }
     //		$selected = SPRequest::int( 'selected', 0 );
     $ssid = SPRequest::base64('ssid');
     $query = SPRequest::string('q', null);
     $session = SPFactory::user()->getUserState('userSelector', null, array());
     $setting = $session[$ssid];
     /* get the site to display */
     $site = SPRequest::int('site', 1);
     $eLim = Sobi::Cfg('user_selector.entries_limit', 18);
     $eLimStart = ($site - 1) * $eLim;
     $params = array();
     if ($query) {
         $q = '%' . $query . '%';
         $params = SPFactory::db()->where(array('name' => $q, 'username' => $q, 'email' => $q), 'OR');
     }
     try {
         $count = SPFactory::db()->select('COUNT(*)', '#__users', $params, $setting['ordering'])->loadResult();
         $data = SPFactory::db()->select(array('id', 'name', 'username', 'email', 'registerDate', 'lastvisitDate'), '#__users', $params, $setting['ordering'], $eLim, $eLimStart)->loadAssocList();
     } catch (SPException $x) {
         echo $x->getMessage();
         exit;
     }
     $response = array('sites' => ceil($count / $eLim), 'site' => $site);
     if (count($data)) {
         $replacements = array();
         preg_match_all('/\\%[a-z]*/', $setting['format'], $replacements);
         $placeholders = array();
         if (isset($replacements[0]) && count($replacements[0])) {
             foreach ($replacements[0] as $placeholder) {
                 $placeholders[] = str_replace('%', null, $placeholder);
             }
         }
         if (count($replacements)) {
             foreach ($data as $index => $user) {
                 $txt = $setting['format'];
                 foreach ($placeholders as $attribute) {
                     if (isset($user[$attribute])) {
                         $txt = str_replace('%' . $attribute, $user[$attribute], $txt);
                     }
                 }
                 $data[$index]['text'] = $txt;
             }
         }
         $response['users'] = $data;
     }
     SPFactory::mainframe()->cleanBuffer();
     echo json_encode($response);
     exit;
 }
Beispiel #16
0
 private function view()
 {
     $type = $this->key('template_type', 'xslt');
     if ($type != 'php' && Sobi::Cfg('global.disable_xslt', false)) {
         $type = 'php';
     }
     if ($type == 'xslt') {
         $visitor = $this->get('visitor');
         $current = $this->get('section');
         $categories = $this->get('categories');
         $entries = $this->get('entries');
         $data = array();
         $data['id'] = $current->get('id');
         $data['section'] = array('_complex' => 1, '_data' => Sobi::Section(true), '_attributes' => array('id' => Sobi::Section(), 'lang' => Sobi::Lang(false)));
         $data['name'] = array('_complex' => 1, '_data' => $this->get('listing_name'), '_attributes' => array('lang' => Sobi::Lang(false)));
         if (Sobi::Cfg('category.show_desc')) {
             $desc = $current->get('description');
             if (Sobi::Cfg('category.parse_desc')) {
                 Sobi::Trigger('prepare', 'Content', array(&$desc, $current));
             }
             $data['description'] = array('_complex' => 1, '_cdata' => 1, '_data' => $desc, '_attributes' => array('lang' => Sobi::Lang(false)));
         }
         $data['meta'] = array('description' => $current->get('metaDesc'), 'keys' => $this->metaKeys($current), 'author' => $current->get('metaAuthor'), 'robots' => $current->get('metaRobots'));
         $data['entries_in_line'] = $this->get('$eInLine');
         $data['categories_in_line'] = $this->get('$cInLine');
         $this->menu($data);
         $this->alphaMenu($data);
         $data['visitor'] = $this->visitorArray($visitor);
         if (count($categories)) {
             foreach ($categories as $category) {
                 if (is_numeric($category)) {
                     $category = SPFactory::Category($category);
                 }
                 $data['categories'][] = array('_complex' => 1, '_attributes' => array('id' => $category->get('id'), 'nid' => $category->get('nid')), '_data' => $this->category($category));
                 unset($category);
             }
         }
         if (count($entries)) {
             $this->loadNonStaticData($entries);
             $manager = Sobi::Can('entry', 'edit', '*', Sobi::Section()) ? true : false;
             foreach ($entries as $eid) {
                 $en = $this->entry($eid, $manager);
                 $data['entries'][] = array('_complex' => 1, '_attributes' => array('id' => $en['id']), '_data' => $en);
             }
             $this->navigation($data);
         }
         $this->_attr = $data;
     }
     // general listing trigger
     Sobi::Trigger('Listing', ucfirst(__FUNCTION__), array(&$this->_attr));
     // specific lisitng trigger
     Sobi::Trigger($this->_type, ucfirst(__FUNCTION__), array(&$this->_attr));
 }
Beispiel #17
0
 public function __construct($id = 0)
 {
     parent::__construct($id);
     if (is_numeric($this->gid)) {
         $this->gid = array($this->gid);
     }
     $this->spGroups();
     /* include default visitor permissions */
     $this->gid[] = 0;
     $this->parentGids();
     Sobi::Trigger('UserGroup', 'Appoint', array($id, &$this->gid));
 }
Beispiel #18
0
 /**
  * Move files from directory to given path
  * @param string $target - target path
  * @return array
  */
 public function moveFiles($target)
 {
     $this->iterator();
     $log = array();
     foreach ($this->_dirIterator as $child) {
         if (!$child->isDot() && !SPFs::exists(Sobi::FixPath($target . DS . $child->getFileName()))) {
             if (SPFs::move($child->getPathname(), Sobi::FixPath($target . DS . $child->getFileName()))) {
                 $log[] = Sobi::FixPath($target . DS . $child->getFileName());
             }
         }
     }
     return $log;
 }
Beispiel #19
0
 private function screen()
 {
     $data = SPFactory::registry()->loadDBSection('paypal_' . Sobi::Section())->get('paypal_' . Sobi::Section());
     if (!count($data)) {
         $data = SPFactory::registry()->loadDBSection('paypal')->get('paypal');
     }
     $ppexpl = SPLang::getValue('ppexpl', 'application', Sobi::Section());
     $ppsubj = SPLang::getValue('ppsubject', 'application', Sobi::Section());
     if (!strlen($ppsubj)) {
         $ppsubj = SPLang::getValue('ppsubject', 'application');
     }
     $this->getView('paypal')->assign($tile, 'title')->assign($data['ppurl']['value'], 'ppurl')->assign($data['ppemail']['value'], 'ppemail')->assign($data['pprurl']['value'], 'pprurl')->assign($data['ppcc']['value'], 'ppcc')->assign($ppexpl, 'ppexpl')->assign($ppsubj, 'ppsubject')->determineTemplate('extensions', 'paypal')->display();
 }
Beispiel #20
0
 public function remove($def)
 {
     $eid = $def->getElementsByTagName('id')->item(0)->nodeValue;
     $name = $def->getElementsByTagName('name')->item(0)->nodeValue;
     $type = $def->getElementsByTagName('type')->item(0)->nodeValue;
     $id = SPFactory::db()->select('extension_id', '#__extensions', array('type' => $type, 'element' => $eid))->loadResult();
     jimport('joomla.installer.installer');
     if (JInstaller::getInstance()->uninstall($type, $id)) {
         SPFactory::db()->delete('spdb_plugins', array('pid' => $eid, 'type' => $type), 1);
         return Sobi::Txt('CMS_EXT_REMOVED', $name);
     }
     return array('msg' => Sobi::Txt('CMS_EXT_NOT_REMOVED', $name), 'msgtype' => 'error');
 }
Beispiel #21
0
 /**
  * @param string $title
  * @return void
  */
 public function setTitle($title)
 {
     $name = $this->get('template_name');
     if (!strlen($name)) {
         $name = $this->get('file_name');
         $title = Sobi::Txt($title, array('path' => $name));
     } else {
         $title = Sobi::Txt($title, array('template' => $name));
     }
     Sobi::Trigger('setTitle', $this->name(), array(&$title));
     SPFactory::header()->setTitle($title);
     $this->set($title, 'site_title');
 }
Beispiel #22
0
 /**
  * @return array
  * Ausgabe des Feldes in DV and vCard
  */
 public function struct()
 {
     $data = SPLang::getValue($this->nid . '-viewInfo', 'field_information', Sobi::Section());
     $attributes = array();
     if (strlen($data)) {
         $this->cssClass = strlen($this->cssClass) ? $this->cssClass : 'spFieldsData';
         $this->cssClass = $this->cssClass . ' ' . $this->nid;
         $this->cleanCss();
         $attributes = array('lang' => Sobi::Lang(), 'class' => $this->cssClass);
     } else {
         $this->cssClass = strlen($this->cssClass) ? $this->cssClass : 'spField';
     }
     return array('_complex' => 1, '_data' => $data, '_attributes' => $attributes);
 }
Beispiel #23
0
 /**
  * @param array $config
  * @param array $values
  * @return string
  */
 private function raw($config, $values)
 {
     $out = "\n";
     $out .= $values['expl'];
     $out .= Sobi::Txt('APP.PPP.PAY_TITLE') . ': ';
     $out .= $config['message']['url'];
     array_shift($config['message']);
     $v = array();
     foreach ($config['message'] as $field => $value) {
         $v[] = $field . '=' . urlencode(SPLang::replacePlaceHolders($value, $values));
     }
     $out .= implode('&', $v);
     return SPLang::clean($out);
 }
Beispiel #24
0
 private function errors()
 {
     $errors = $this->get('errors');
     $levels = $this->get('levels');
     $icons = array('error' => Sobi::Cfg('list_icons.err_err'), 'warning' => Sobi::Cfg('list_icons.err_warn'), 'notice' => Sobi::Cfg('list_icons.err_notice'), 'details' => Sobi::Cfg('list_icons.err_details'));
     /* create the header */
     if (count($errors)) {
         foreach ($errors as $i => $error) {
             $error['errFile'] = str_replace(SOBI_ADM_PATH, null, $error['errFile']);
             $error['errFile'] = str_replace(SOBI_PATH, null, $error['errFile']);
             $error['errFile'] = str_replace(SOBI_ROOT, null, $error['errFile']);
             $error['errFile'] = $error['errFile'] . ': ' . $error['errLine'];
             if ($error['errReq']) {
                 $error['errReq'] = "<a href=\"{$error['errReq']}\" target=\"_blank\">{$error['errReq']}</a>";
             }
             $level = $levels[$error['errNum']];
             switch ($error['errNum']) {
                 case E_ERROR:
                 case E_CORE_ERROR:
                 case E_COMPILE_ERROR:
                 case E_USER_ERROR:
                 case E_RECOVERABLE_ERROR:
                     $error['errNum'] = "<img src=\"{$icons['error']}\" alt=\"{$level}\" title=\"{$level}\"/><br/>{$level}";
                     break;
                 case E_WARNING:
                 case E_CORE_WARNING:
                 case E_COMPILE_WARNING:
                 case E_USER_WARNING:
                     $error['errNum'] = "<img src=\"{$icons['warning']}\" alt=\"{$level}\" title=\"{$level}\"/><br/>{$level}";
                     break;
                 case E_NOTICE:
                 case E_USER_NOTICE:
                 case E_STRICT:
                 case E_USER_WARNING:
                 case E_DEPRECATED:
                 case E_USER_DEPRECATED:
                     $error['errNum'] = "<img src=\"{$icons['notice']}\" alt=\"{$level}\" title=\"{$level}\"/><br/>{$level}";
                     break;
             }
             $error['errMsg'] = str_replace(SOBI_ROOT, null, $error['errMsg']);
             $error['errMsg'] = str_replace('href=\'function.', 'target="_blank" href=\'http://php.net/manual/en/function.', $error['errMsg']);
             $dh = Sobi::Url(array('task' => 'error.details', 'eid' => $error['eid']));
             $error['details'] = "<a href=\"{$dh}\"><img src=\"{$icons['details']}\"/></a>";
             $errors[$i] = $error;
         }
     }
     //		Sobi::Error( 'H', date( DATE_RFC1123 ), SPC::ERROR );
     $this->assign($errors, 'errors');
 }
Beispiel #25
0
 private function browse()
 {
     /* create the header */
     $list =& $this->get('applications');
     $plugins = array();
     if (count($list)) {
         $c = 0;
         foreach ($list as $plugin) {
             $plugin['id'] = $plugin['type'] . '.' . $plugin['pid'];
             $plugins[$c++] = $plugin;
         }
     }
     $this->assign($plugins, 'applications');
     $this->assign(Sobi::Section(true), 'section');
 }
Beispiel #26
0
 private function status($message, $progress = 0, $interval = 0, $type = SPC::INFO_MSG)
 {
     if (!strlen($message)) {
         $message = Sobi::Txt('PROGRESS_WORKING');
     }
     $progress = $progress ? $progress : $this->progress;
     $interval = $interval ? $interval : $this->interval;
     $type = $type ? $type : $this->type;
     $this->progress = $progress;
     $this->message = $message;
     $this->interval = $interval;
     $this->type = $type;
     $typeText = Sobi::Txt('STATUS_' . $type);
     SPFs::write($this->file, json_encode(array('progress' => $progress, 'message' => $message, 'interval' => $interval, 'type' => $type, 'typeText' => $typeText)));
 }
Beispiel #27
0
 function getObjectInfo($id, $language = null)
 {
     $info = new JCommentsObjectInfo();
     $app = JFactory::getApplication();
     if (!$app->isAdmin()) {
         $db = JFactory::getDBO();
         $query = "SELECT o.id, o.name, o.owner, o.parent, fd.baseData" . " FROM #__sobipro_object as o" . " LEFT JOIN #__sobipro_field_data AS fd ON o.id = fd.sid" . " JOIN #__sobipro_field AS f ON fd.fid = f.fid AND f.nid = 'field_name'" . " WHERE o.id = " . $id . " AND o.oType = 'entry'";
         $db->setQuery($query);
         $row = $db->loadObject();
         if (!empty($row)) {
             $sobiCore = JPATH_SITE . '/components/com_sobipro/lib/base/fs/loader.php';
             if (is_file($sobiCore)) {
                 if (!defined('SOBIPRO')) {
                     $ver = new JVersion();
                     $ver = str_replace('.', null, $ver->RELEASE);
                     if ($ver > '15') {
                         $ver = '16';
                     }
                     define('SOBI_CMS', 'joomla' . $ver);
                     define('SOBIPRO', true);
                     define('SOBI_TASK', 'task');
                     define('SOBI_DEFLANG', JFactory::getLanguage()->getDefault());
                     define('SOBI_ACL', 'front');
                     define('SOBI_ROOT', JPATH_ROOT);
                     define('SOBI_MEDIA', implode(DS, array(JPATH_ROOT, 'media', 'sobipro')));
                     define('SOBI_MEDIA_LIVE', JURI::root() . '/media/sobipro');
                     define('SOBI_PATH', JPATH_ROOT . '/components/com_sobipro');
                     define('SOBI_LIVE_PATH', 'components/com_sobipro');
                     require_once JPATH_ROOT . '/components/com_sobipro/lib/base/fs/loader.php';
                 }
                 SPLoader::loadClass('sobi');
                 SPLoader::loadClass('base.request');
                 SPLoader::loadClass('base.object');
                 SPLoader::loadClass('base.factory');
                 SPLoader::loadClass('base.mainframe');
                 SPLoader::loadClass('base.const');
                 SPLoader::loadClass('cms.base.mainframe');
                 SPLoader::loadClass('cms.base.lang');
                 $info->title = empty($row->name) ? isset($row->baseData) ? $row->baseData : '' : $row->name;
                 $info->access = NULL;
                 $info->userid = $row->owner;
                 $info->link = Sobi::Url(array('title' => $row->name, 'pid' => $row->parent, 'sid' => $row->id));
             }
         }
     }
     return $info;
 }
Beispiel #28
0
 /**
  * @param $attr
  * @return mixed
  * @throws SPException
  */
 protected function saveAttr(&$attr)
 {
     if ($this->nid) {
         $this->nid = $attr['nid'];
     }
     if (!isset($attr['viewInfo'])) {
         $attr['viewInfo'] = $this->viewInfo;
         $attr['entryInfo'] = $this->entryInfo;
     }
     $data = array('key' => $this->nid . '-viewInfo', 'value' => $attr['viewInfo'], 'type' => 'field_information', 'fid' => $this->fid, 'id' => Sobi::Section(), 'section' => Sobi::Section());
     SPLang::saveValues($data);
     $data = array('key' => $this->nid . '-entryInfo', 'value' => $attr['entryInfo'], 'type' => 'field_information', 'fid' => $this->fid, 'id' => Sobi::Section(), 'section' => Sobi::Section());
     SPLang::saveValues($data);
     $attr['required'] = 0;
     $attr['fee'] = 0;
     $attr['isFree'] = 1;
     return $attr;
 }
Beispiel #29
0
 /**
  * @param array $recipient Recipient e-mail address
  * @param string $subject E-mail subject
  * @param string $body Message body
  * @param bool $html - HTML mail or plain text
  * @param array $replyto Reply to email address
  * @param array $cc CC e-mail address
  * @param array $bcc BCC e-mail address
  * @param string $attachment Attachment file name
  * @param array $cert - pem certificate
  * @param array $from - array( from, fromname )
  * @internal param array $replytoname Reply to name
  * @return boolean True on success
  */
 public static function SpSendMail($recipient, $subject, $body, $html = false, $replyto = null, $cc = null, $bcc = null, $attachment = null, $cert = null, $from = null)
 {
     $from = is_array($from) ? $from : array(Sobi::Cfg('mail.from'), Sobi::Cfg('mail.fromname'));
     $mail = new self();
     $mail->setSender($from);
     $mail->setSubject($subject);
     $mail->setBody($body);
     if ($html) {
         $mail->IsHTML(true);
     }
     if ($cert) {
         $mail->Sign($cert['certificate'], $cert['key'], $cert['password']);
     }
     $mail->addRecipient($recipient);
     $mail->addCC($cc);
     $mail->addBCC($bcc);
     $mail->addAttachment($attachment);
     $mail->addReplyTo($replyto);
     return $mail->Send();
 }
Beispiel #30
0
 public function chooser()
 {
     $pid = $this->get('category.parent');
     $path = null;
     if (!$pid) {
         $pid = SPRequest::sid();
     }
     $this->assign($pid, 'parent');
     $id = $this->get('category.id');
     $id = $id ? $id : $pid;
     if ($id) {
         $path = $this->parentPath($id);
     }
     $this->assign($path, 'parent_path');
     $this->assign(Sobi::Url(array('task' => 'category.parents', 'out' => 'json', 'format' => 'raw'), true), 'parent_ajax_url');
     /* @TODO  */
     $tpl = str_replace(implode('/', array('usr', 'templates', 'category')), 'views/tpl/', $this->_template . '.php');
     Sobi::Trigger('Display', $this->name(), array(&$this));
     include $tpl;
     Sobi::Trigger('AfterDisplay', $this->name());
 }