Beispiel #1
0
 public function getRevision($rev)
 {
     if (Sobi::Cfg('entry.versioning', true)) {
         $log = (array) SPFactory::db()->select('*', 'spdb_history', array('revision' => $rev))->loadObject('revision');
         if (count($log)) {
             $log['changes'] = SPConfig::unserialize($log['changes']);
         }
         return $log;
     } else {
         return array();
     }
 }
Beispiel #2
0
 public function cleanData()
 {
     $this->_selectedCats = $this->getRaw();
     if (!(is_numeric($this->_selectedCats) || is_array($this->_selectedCats))) {
         if (is_string($this->_selectedCats) && strstr($this->_selectedCats, '://')) {
             $this->_selectedCats = SPFactory::config()->structuralData($this->_selectedCats);
         } elseif (is_string($this->_selectedCats) && strstr($this->_selectedCats, ',')) {
             $this->_selectedCats = explode(',', $this->_selectedCats);
         } else {
             $this->_selectedCats = SPConfig::unserialize($this->_selectedCats);
         }
     }
     if (!$this->_selectedCats) {
         if (SPRequest::task() == 'entry.add') {
             $this->_selectedCats = array(SPRequest::sid());
         }
     }
     return $this->_selectedCats;
 }
Beispiel #3
0
 private function pb()
 {
     /** WARNING!!!
      * This part is "encoded" not to complicate or hide anything.
      * The "Powered By" footer can be easily disabled in the SobiPro configuration.
      * We are not forcing anyone to display it nor violate anyone's freedom!!
      * But for some reason it happens from time to time that some very clever people instead of disable it the right way
      * prefer to tinker in the core code which of course lead to the famous situation "no I cannot update because I modified the code"
      *
      * So this actually encoded here just to protect some people from their own, well, "intelligence" ....
      * */
     $p = "YToxOntpOjA7czoxODI6IjxkaXYgaWQ9InNvYmlQcm9Gb290ZXIiPlBvd2VyZWQgYnkgPGEgdGl0bGU9IlNvYmlQcm8gLSBKb29tbGEgRGlyZWN0b3J5IENvbXBvbmVudCB3aXRoIGNvbnRlbnQgY29uc3RydWN0aW9uIHN1cHBvcnQiIGhyZWY9Imh0dHA6Ly93d3cuc2lnc2l1Lm5ldCIgdGFyZ2V0PSJfYmxhbmsiPlNpZ3NpdS5ORVQ8L2E+PC9kaXY+Ijt9";
     if (!Sobi::Cfg('show_pb', true) || SPRequest::cmd('method', null, 'post') == 'xhr') {
         return;
     }
     try {
         $p = SPConfig::unserialize($p);
     } catch (SPException $x) {
         return;
     }
     return $p[0];
 }
 private function download()
 {
     //		$file = SPLoader::path( 'tmp.info', 'front', false, 'txt' );
     $cont = null;
     $settings = array();
     $settings['SobiPro'] = array('Version' => SPFactory::CmsHelper()->myVersion(true), 'Version_Num' => implode('.', SPFactory::CmsHelper()->myVersion()));
     $file = SPLoader::path('tmp.info', 'front', false, 'txt');
     //		if ( SPFs::exists( $file ) ) {
     //			$cont = SPFs::read( $file );
     //		}
     //		$cont = explode( "\n", $cont );
     //		if ( count( $cont ) ) {
     //			foreach ( $cont as $line ) {
     //				if ( strstr( $line, '=' ) ) {
     //					$line = explode( "=", $line );
     //					$line[ 1 ] = explode( ';', $line[ 1 ] );
     //					$settings[ $line[ 0 ] ] = array( 'key' => $line[ 0 ], 'response' => $line[ 1 ][ 0 ], 'status' => $line[ 1 ][ 1 ] );
     //				}
     //			}
     //		}
     $this->prepareStoredData($settings);
     $settings['env'] = array('PHP_OS' => PHP_OS, 'php_uname' => php_uname(), 'PHP_VERSION_ID' => PHP_VERSION_ID);
     $settings['ftp'] = $this->ftp();
     $settings['curl'] = $this->curlFull();
     $settings['exec']['response'] = $this->execResp();
     $settings['SOBI_SETTINGS'] = SPFactory::config()->getSettings();
     $c = SPFactory::db()->select('*', 'spdb_config')->loadObjectList();
     $sections = SPFactory::db()->select(array('nid', 'id'), 'spdb_object', array('oType' => 'section'))->loadAssocList('id');
     $as = array();
     foreach ($c as $key) {
         if ($key->section == 0 || !isset($sections[$key->section])) {
             continue;
         }
         $key->section = $sections[$key->section]['nid'];
         if (!isset($as[$key->section])) {
             $as[$key->section] = array();
         }
         if (!isset($as[$key->section][$key->cSection])) {
             $as[$key->section][$key->cSection] = array();
         }
         $_c = explode('_', $key->sKey);
         if ($_c[count($_c) - 1] == 'array') {
             $key->sValue = SPConfig::unserialize($key->sValue);
         }
         $as[$key->section][$key->cSection][$key->sKey] = $key->sValue;
     }
     $settings['SOBI_SETTINGS']['sections'] = $as;
     $apps = SPFactory::db()->select('*', 'spdb_plugins')->loadObjectList();
     foreach ($apps as $app) {
         $settings['Apps'][$app->pid] = get_object_vars($app);
     }
     $settings['SOBI_SETTINGS']['mail']['smtphost'] = $settings['SOBI_SETTINGS']['mail']['smtphost'] ? 'SET' : 0;
     $settings['SOBI_SETTINGS']['mail']['smtpuser'] = $settings['SOBI_SETTINGS']['mail']['smtpuser'] ? 'SET' : 0;
     $settings['SOBI_SETTINGS']['mail']['smtppass'] = $settings['SOBI_SETTINGS']['mail']['smtppass'] ? 'SET' : 0;
     $php = ini_get_all();
     unset($php['extension_dir']);
     unset($php['include_path']);
     unset($php['mysql.default_user']);
     unset($php['mysql.default_password']);
     unset($php['mysqli.default_pw']);
     unset($php['mysqli.default_user']);
     unset($php['open_basedir']);
     unset($php['pdo_mysql.default_socket']);
     unset($php['sendmail_path']);
     unset($php['session.name']);
     unset($php['session.save_path']);
     unset($php['soap.wsdl_cache_dir']);
     unset($php['upload_tmp_dir']);
     unset($php['doc_root']);
     unset($php['docref_ext']);
     unset($php['docref_root']);
     unset($php['mysql.default_socket']);
     $settings['PHP_SETTINGS'] = $php;
     $php = get_loaded_extensions();
     $settings['PHP_EXT'] = $php;
     $out = SPFactory::Instance('types.array');
     $data = $out->toXML($settings, 'settings');
     $data = str_replace(array(SOBI_ROOT, '></'), array('REMOVED', '>0</'), $data);
     $f = SPLang::nid($settings['SOBI_SETTINGS']['general']['site_name'] . '-' . date(DATE_RFC822));
     SPFactory::mainframe()->cleanBuffer();
     header('Cache-Control: no-cache, must-revalidate');
     header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
     header("Content-type: application/xml");
     header("Content-Disposition: attachment; filename=\"sobipro_system_{$f}.xml\"");
     header('Content-Length: ' . strlen($data));
     ob_clean();
     flush();
     echo $data;
     exit;
 }
Beispiel #5
0
 /**
  * @return array
  */
 public function struct()
 {
     if (!$this->dependency) {
         return parent::struct(true);
     }
     $selected = $this->getRaw();
     if (isset($this->_fData->options)) {
         $path = SPConfig::unserialize($this->_fData->options);
     } else {
         return null;
     }
     $selectedPath = array();
     $options = json_decode(SPFs::read(SOBI_PATH . '/etc/fields/select-list/definitions/' . str_replace('.xml', '.json', $this->dependencyDefinition)), true);
     if (isset($options['translation'])) {
         SPLang::load($options['translation']);
         $selected = Sobi::Txt(strtoupper($options['prefix']) . '.' . strtoupper($selected));
     }
     if (count($path) && isset($options['translation'])) {
         foreach ($path as $step) {
             $selectedPath[$step] = $selected = Sobi::Txt(strtoupper($options['prefix']) . '.' . strtoupper($step));
         }
     }
     $this->cleanCss();
     return array('_complex' => 1, '_data' => $selected, '_attributes' => array('class' => $this->cssClass), '_options' => array('path' => count($selectedPath) ? $selectedPath : $path));
 }
Beispiel #6
0
 protected function getRejectionsTemplates()
 {
     $templates = SPFactory::registry()->loadDBSection('rejections-templates_' . Sobi::Section())->get('rejections-templates_' . Sobi::Section());
     if (!$templates) {
         $templates = SPFactory::registry()->loadDBSection('rejections-templates')->get('rejections-templates');
     }
     $f = array();
     foreach ($templates as $tid => $template) {
         $desc = SPLang::getValue($tid, 'rejections-templates', Sobi::Section());
         if (!$desc) {
             $desc = SPLang::getValue($tid, 'rejections-templates', 0);
         }
         $f[$tid] = array('params' => SPConfig::unserialize($template['params']), 'key' => $tid, 'value' => $template['value'], 'description' => $desc, 'options' => $template['options']);
     }
     ksort($f);
     return $f;
 }
Beispiel #7
0
 /**
  * @param string $name variable name
  * @param string $property
  * @param string $request request method
  * @return string
  */
 public static function file($name, $property = null, $request = 'files')
 {
     if ($request == 'files') {
         /** check for Ajax uploaded files */
         $check = self::string($name);
         if ($check) {
             $secret = md5(Sobi::Cfg('secret'));
             $fileName = str_replace('file://', null, $check);
             $path = SPLoader::dirPath("tmp.files.{$secret}", 'front', false) . '/' . $fileName;
             if (file_exists("{$path}.var")) {
                 $cfg = SPFs::read("{$path}.var");
                 $data = SPConfig::unserialize($cfg);
                 $_FILES[$name] = $data;
             }
         }
     }
     self::init($name, $request);
     self::$val = isset(self::$request[self::$name]) ? self::$request[self::$name] : null;
     return $property && isset(self::$val[$property]) ? self::$val[$property] : self::$val;
 }
Beispiel #8
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();
    }
Beispiel #9
0
 /**
  * @param string $var
  * @param mixed $val
  * @return \SPObject|void
  */
 public function set($var, $val)
 {
     static $types = array();
     if (!count($types)) {
         $types = array_merge($this->types(), self::$types);
     }
     if ($this->has($var) && isset($types[$var])) {
         if (is_array($this->{$var}) && is_string($val) && strlen($val) > 2) {
             try {
                 $val = SPConfig::unserialize($val, $var);
             } catch (SPException $x) {
                 Sobi::Error($this->name(), SPLang::e('%s.', $x->getMessage()), SPC::NOTICE, 0, __LINE__, __FILE__);
             }
         }
         $this->{$var} = $val;
     }
 }
Beispiel #10
0
 /**
  * @param string $var
  * @param mixed $val
  * @return $this
  */
 public function &set($var, $val)
 {
     if (isset($this->{$var}) || property_exists($this, $var)) {
         if (is_array($this->{$var}) && is_string($val) && strlen($val) > 2) {
             try {
                 $val = SPConfig::unserialize($val, $var);
             } catch (SPException $x) {
                 Sobi::Error($this->name(), SPLang::e('%s.', $x->getMessage()), SPC::NOTICE, 0, __LINE__, __FILE__);
             }
         }
         $this->{$var} = $val;
     }
     return $this;
 }
Beispiel #11
0
 public function cleanData($html)
 {
     $data = SPConfig::unserialize($this->getRaw());
     $url = null;
     if (isset($data['url']) && strlen($data['url'])) {
         if ($data['protocol'] == 'relative') {
             $url = Sobi::Cfg('live_site') . $data['url'];
         } else {
             $url = $data['protocol'] . '://' . $data['url'];
         }
     }
     return $url;
 }
Beispiel #12
0
 private function payment()
 {
     $sid = SPRequest::sid();
     $data = SPFactory::cache()->getObj('payment', $sid, Sobi::Section(), true);
     if (!$data) {
         $tsId = SPRequest::string('tsid');
         $tfile = SPLoader::path('tmp.edit.' . $tsId . '.payment', 'front', false, 'var');
         if (SPFs::exists($tfile)) {
             $data = SPConfig::unserialize(SPFs::read($tfile));
         }
     }
     if (!$data) {
         Sobi::Error('payment', SPLang::e('Session expired'), SPC::ERROR, 500, __LINE__, __FILE__);
     }
     /*
      * It doesn't make sense because this has been already checked for the edit function. Right?
      * Or do I miss something?
      */
     //		if( Sobi::My( 'id' ) && Sobi::My( 'id' ) == $this->_model->get( 'owner' ) ) {
     //			$this->authorise( 'edit', 'own' );
     //		}
     //		else {
     //			$this->authorise( 'edit', '*' );
     //		}
     if ($data['ident'] != SPRequest::string('payment_' . $sid, null, false, 'cookie')) {
         Sobi::Error('payment', SPLang::e('UNAUTHORIZED_ACCESS'), SPC::ERROR, 403, __LINE__, __FILE__);
     }
     $this->paymentView(null, $data['data']);
 }
Beispiel #13
0
 protected function getResults($ssid, $template)
 {
     $results = array();
     /* case some plugin overwrites this method */
     Sobi::Trigger('GetResults', 'Search', array(&$results, &$ssid, &$template));
     if (count($results)) {
         return $results;
     }
     /* get limits - if defined in template config - otherwise from the section config */
     $eLimit = $this->tKey($template, 'entries_limit', Sobi::Cfg('search.entries_limit', Sobi::Cfg('list.entries_limit', 2)));
     $eInLine = $this->tKey($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;
     try {
         $this->_db->select(array('entriesResults', 'requestData'), 'spdb_search', array('ssid' => $ssid));
         $r = $this->_db->loadAssocList();
         if (strlen($r[0]['entriesResults'])) {
             $store = SPConfig::unserialize($r[0]['entriesResults']);
             if ($store['results']) {
                 $this->_results = array_unique(explode(',', $store['results']));
                 $this->_resultsByPriority = $store['resultsByPriority'];
             }
             $this->_resultsCount = count($this->_results);
         }
         $this->_request = SPConfig::unserialize($r[0]['requestData']);
         SPFactory::registry()->set('requestcache', $this->_request);
         if (count($this->_results)) {
             $r = array_slice($this->_results, $eLimStart, $eLimit);
             /* so we have a results */
             foreach ($r as $i => $sid) {
                 $results[$i] = (int) $sid;
                 //$results[ $i ] = new $eClass();
                 //$results[ $i ]->init( $sid );
             }
         }
     } catch (SPException $x) {
         Sobi::Error($this->name(), SPLang::e('CANNOT_GET_SESSION_DB_ERR', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
     }
     Sobi::SetUserData('currently-displayed-entries', $results);
     return $results;
 }
Beispiel #14
0
 /**
  * @param $type
  * @param $id
  * @param int $sid
  * @param bool $force
  * @return bool
  */
 public function getObj($type, $id, $sid = 0, $force = false)
 {
     if ($this->enabled(!$force)) {
         $sid = $sid ? $sid : $this->_section;
         $id = (int) $id;
         $sid = (int) $sid;
         $lang = Sobi::Lang(false);
         $apc = false;
         if ($this->_apc) {
             $var = apc_fetch("com_sobipro_{$sid}_{$id}_{$type}_{$lang}", $apc);
             if (isset($var['classes'])) {
                 SPLoader::wakeUp(unserialize($var['classes']));
             }
         }
         if (!$apc) {
             $result = $this->Query("SELECT * FROM objects WHERE( type = '{$type}' AND id = '{$id}' AND lang = '{$lang}' AND sid = '{$sid}' )");
             if (!is_array($result) || !count($result)) {
                 return false;
             }
             if ($result['classes']) {
                 SPLoader::wakeUp(unserialize($result['classes']));
             }
             if ($result['schecksum'] != md5($result['data'])) {
                 Sobi::Error('cache', SPLang::e('Checksum of the encoded data does not match'), SPC::WARNING, 0, __LINE__, __FILE__);
                 return false;
             }
             $var = SPConfig::unserialize($result['data']);
         } else {
             $var = $var['obj'];
         }
         $this->_check[$type][$id] = false;
         return $var;
     } else {
         return false;
     }
 }
Beispiel #15
0
 /**
  * @return mixed|null
  */
 protected function getExistingFiles()
 {
     $files = $this->getRaw();
     if (is_string($files)) {
         try {
             $files = SPConfig::unserialize($files);
             return $files;
         } catch (SPException $x) {
             return null;
         }
     }
     return $files;
 }
Beispiel #16
0
 /**
  * @param string $var
  * @param mixed $val
  */
 protected function _set($var, $val)
 {
     if ($this->has($var)) {
         if (is_array($this->{$var}) && is_string($val)) {
             try {
                 $val = SPConfig::unserialize($val, $var);
             } catch (SPException $x) {
                 Sobi::Error($this->name(), sprintf('Cannot unserialize: %s.', $x->getMessage()), SPC::NOTICE, 0, __LINE__, __FILE__);
             }
         }
         if (is_string($val)) {
             $val = $this->cgf($val);
         }
         $this->{$var} = $val;
     }
 }
Beispiel #17
0
 public function cleanData($html)
 {
     $data = SPConfig::unserialize($this->getRaw());
     return $data['url'];
 }
Beispiel #18
0
 /**
  * @return array
  */
 public function struct()
 {
     $files = $this->getRaw();
     if (is_string($files)) {
         try {
             $files = SPConfig::unserialize($files);
         } catch (SPException $x) {
             $files = null;
         }
     }
     $exifToPass = array();
     if (isset($files['original'])) {
         $files['orginal'] = $files['original'];
     }
     if (isset($files['data']['exif']) && Sobi::Cfg('image_field.pass_exif', true)) {
         $exif = json_encode($files['data']['exif']);
         $exif = str_replace('UndefinedTag:', null, $exif);
         $exif = preg_replace('/\\p{Cc}+/u', null, $exif);
         $exif = json_decode(preg_replace('/[^a-zA-Z0-9\\{\\}\\:\\.\\,\\(\\)\\"\'\\/\\\\!\\?\\[\\]\\@\\#\\$\\%\\^\\&\\*\\+\\-\\_]/', '', $exif), true);
         if (isset($exif['EXIF'])) {
             $tags = Sobi::Cfg('image_field.exif_data', array());
             if (count($tags)) {
                 foreach ($tags as $tag) {
                     $exifToPass['BASE'][$tag] = isset($exif['EXIF'][$tag]) ? $exif['EXIF'][$tag] : 'unknown';
                 }
             }
         }
         if (isset($exif['FILE'])) {
             $exifToPass['FILE'] = $exif['FILE'];
         }
         if (isset($exif['FILE'])) {
             $exifToPass['FILE'] = $exif['FILE'];
         }
         if (isset($exif['IFD0'])) {
             $tags = Sobi::Cfg('image_field.exif_id_data', array());
             if (count($tags)) {
                 foreach ($tags as $tag) {
                     $exifToPass['IFD0'][$tag] = isset($exif['IFD0'][$tag]) ? $exif['IFD0'][$tag] : 'unknown';
                 }
             }
         }
         if (isset($files['data']['exif']['GPS'])) {
             $exifToPass['GPS']['coordinates']['latitude'] = $this->convertGPS($files['data']['exif']['GPS']['GPSLatitude'][0], $files['data']['exif']['GPS']['GPSLatitude'][1], $files['data']['exif']['GPS']['GPSLatitude'][2], $files['data']['exif']['GPS']['GPSLatitudeRef']);
             $exifToPass['GPS']['coordinates']['longitude'] = $this->convertGPS($files['data']['exif']['GPS']['GPSLongitude'][0], $files['data']['exif']['GPS']['GPSLongitude'][1], $files['data']['exif']['GPS']['GPSLongitude'][2], $files['data']['exif']['GPS']['GPSLongitudeRef']);
             $exifToPass['GPS']['coordinates']['latitude-ref'] = isset($files['data']['exif']['GPS']['GPSLatitudeRef']) ? $files['data']['exif']['GPS']['GPSLatitudeRef'] : 'unknown';
             $exifToPass['GPS']['coordinates']['longitude-ref'] = isset($files['data']['exif']['GPS']['GPSLongitudeRef']) ? $files['data']['exif']['GPS']['GPSLongitudeRef'] : 'unknown';
             $tags = Sobi::Cfg('image_field.exif_gps_data', array());
             if (count($tags)) {
                 foreach ($tags as $tag) {
                     $exifToPass['GPS'][$tag] = isset($files['data']['exif']['GPS']['GPS' . $tag]) ? $files['data']['exif']['GPS']['GPS' . $tag] : 'unknown';
                 }
             }
         }
     }
     $float = null;
     if (is_array($files) && count($files)) {
         $this->cssClass = strlen($this->cssClass) ? $this->cssClass : 'spFieldsData';
         $this->cssClass = $this->cssClass . ' ' . $this->nid;
         $this->cleanCss();
         switch ($this->currentView) {
             default:
             case 'vcard':
                 $img = $this->inVcard;
                 break;
             case 'details':
                 $img = $this->inDetails;
                 break;
         }
         if (isset($files[$img])) {
             $show = $files[$img];
         } elseif (isset($files['thumb'])) {
             $show = $files['thumb'];
         } elseif (isset($files['ico'])) {
             $show = $files['ico'];
         }
         if (isset($show)) {
             switch ($img) {
                 case 'thumb':
                     $float = $this->thumbFloat;
                     break;
                 case 'image':
                     $float = $this->imageFloat;
                     break;
             }
             $data = array('_complex' => 1, '_data' => null, '_attributes' => array('class' => $this->cssClass, 'src' => Sobi::Cfg('live_site') . $show, 'alt' => ''));
             if ($float) {
                 $data['_attributes']['style'] = "float:{$float};";
             }
             return array('_complex' => 1, '_data' => array('img' => $data), '_attributes' => array('icon' => isset($files['ico']) ? $files['ico'] : null, 'image' => isset($files['image']) ? $files['image'] : null, 'thumbnail' => isset($files['thumb']) ? $files['thumb'] : null, 'original' => isset($files['original']) ? $files['original'] : null, 'class' => $this->cssClass), '_options' => array('exif' => $exifToPass));
         }
     }
 }