Пример #1
0
 function onSubmit($vals)
 {
     if (intl_lang() == intl_default_lang()) {
         $ps1 = new PropertySet('sitegallery', 'album_title');
         $ps2 = new PropertySet('sitegallery', 'album_description');
         $ps3 = new PropertySet('sitegallery', 'album_date');
     } else {
         $ps1 = new PropertySet('sitegallery', 'album_title_' . intl_lang());
         $ps2 = new PropertySet('sitegallery', 'album_description_' . intl_lang());
         $ps3 = new PropertySet('sitegallery', 'album_date');
     }
     $ps1->set($vals['album'], $vals['title']);
     $ps2->set($vals['album'], $vals['description']);
     $ps3->set($vals['album'], $vals['date']);
     if (appconf('page_alias')) {
         header('Location: ' . site_prefix() . '/index/' . appconf('page_alias'));
         exit;
     }
     header('Location: ' . site_prefix() . '/index/sitegallery-app');
     exit;
 }
Пример #2
0
    $cookie->set('sitellite_lang_pref', $parameters['choice'], '', '/');
    if ($parameters['goHome']) {
        header('Location: ' . site_prefix() . '/index');
    } else {
        header('Location: ' . $_SERVER['HTTP_REFERER']);
    }
} elseif ($intl->negotiation == 'url') {
    if ($parameters['goHome']) {
        if (strpos(site_prefix(), '/' . intl_lang() . '/') !== false) {
            $prefix = str_replace('/' . intl_lang() . '/', '/' . $parameters['choice'] . '/', site_prefix());
        } else {
            $prefix = site_prefix() . '/' . $parameters['choice'];
        }
        header('Location: ' . $prefix . '/index');
    } else {
        if (strpos($_SERVER['HTTP_REFERER'], '/' . intl_lang() . '/') !== false) {
            $referrer = str_replace('/' . intl_lang() . '/', '/' . $parameters['choice'] . '/', $_SERVER['HTTP_REFERER']);
        } elseif (strpos($_SERVER['HTTP_REFERER'], '/index') !== false) {
            $referrer = str_replace('/index', '/' . $parameters['choice'] . '/index', $_SERVER['HTTP_REFERER']);
        } else {
            $info = parse_url($_SERVER['HTTP_REFERER']);
            if ($info['path'] == '/' || $info['path'] == '/' . intl_lang()) {
                $referrer = '/' . $parameters['choice'];
            } else {
                $referrer = str_replace($info['path'], '/' . $parameters['choice'] . $info['path'], $_SERVER['HTTP_REFERER']);
            }
        }
        header('Location: ' . $referrer);
    }
}
exit;
Пример #3
0
    $res = array($res);
}
if (session_admin()) {
    echo '<div class="scm-sidebar-top">';
    echo loader_box('cms/buttons/add', array('collection' => 'sitellite_sidebar', 'return' => site_current(), 'extra' => '&position=' . $position));
    echo '</div>';
}
if (!$res) {
    return;
}
if (intl_lang() != intl_default_lang()) {
    loader_import('multilingual.Translation');
    $tr = new Translation('sitellite_sidebar', intl_lang());
}
foreach ($res as $key => $row) {
    if (intl_lang() != intl_default_lang()) {
        if (session_admin()) {
            $translated = $tr->get($row->id);
        } else {
            $translated = $tr->get($row->id, true);
        }
        if ($translated) {
            foreach ($translated->data as $k => $v) {
                $row->{$k} = $v;
            }
        }
    }
    if (count($res) == 1) {
        $up = false;
        $down = false;
        $upkey = '';
Пример #4
0
 /**
  * Takes the string provided (which is usually the global $REQUEST_URI,
  * and returns a version of it without illegal characters so it can be used as a
  * file name to store a cached page.
  * 
  * @access	public
  * @param	string	$file
  * @return	string
  * 
  */
 function serialize($file = '')
 {
     if (intl_lang() != intl_default_lang()) {
         $file .= '_' . intl_lang();
     }
     return preg_replace("/[\\/\\\\?&%#~:]/", '', $file);
 }
Пример #5
0
<?php

$default = intl_lang();
if (!$default) {
    $default = intl_default_lang();
}
$langs = intl_get_langs();
echo template_simple('intl_select.spt', array('default' => $default, 'langs' => $langs));
Пример #6
0
if (empty($parameters['sidebar'])) {
    return;
}
if (session_admin()) {
    $function = 'session_allowed_sql';
} else {
    $function = 'session_approved_sql';
}
$row = db_single('select * from sitellite_sidebar where id = ?', $parameters['sidebar']);
if (!$row) {
    echo '<div class="scm-sidebar-error">' . db_error() . '</div>';
    return;
}
if (intl_lang() != intl_default_lang()) {
    loader_import('multilingual.Translation');
    $tr = new Translation('sitellite_sidebar', intl_lang());
    if (session_admin()) {
        $translated = $tr->get($row->id);
    } else {
        $translated = $tr->get($row->id, true);
    }
    if ($translated) {
        foreach ($translated->data as $k => $v) {
            $row->{$k} = $v;
        }
    }
}
echo '<div class="scm-sidebar" id="scm-sidebar-' . str_replace('_', '-', $row->id) . '">';
if (session_admin()) {
    $buttons = loader_box('cms/buttons', array('collection' => 'sitellite_sidebar', 'id' => $row->id, 'status' => $row->sitellite_status, 'access' => $row->sitellite_access, 'team' => $row->sitellite_team, 'add' => true, 'float' => true, 'up' => false, 'down' => false, 'upkey' => '', 'downkey' => '', 'return' => site_prefix() . '/index/' . $page->id));
} else {
Пример #7
0
 /**
  * Returns a single object with the specified $id.
  *
  * @access public
  * @param mixed
  * @return object
  */
 function &get($id)
 {
     if ($this->usePermissions) {
         if (session_admin()) {
             $and = ' and ' . session_allowed_sql();
         } else {
             $and = ' and ' . session_approved_sql();
         }
     } else {
         $and = '';
     }
     $res = db_fetch('SELECT * FROM ' . $this->table . ' WHERE ' . $this->pkey . ' = ?' . $and . $this->_end(), $id);
     if (!$res) {
         $this->error = db_error();
         return false;
     }
     if ($this->multilingual && intl_lang() != intl_default_lang()) {
         loader_import('multilingual.Translation');
         $tr = new Translation($this->table, intl_lang());
         if (session_admin()) {
             $translated = $tr->get($res->{$this->pkey});
         } else {
             $translated = $tr->get($res->{$this->pkey}, true);
         }
         if ($translated) {
             foreach ($translated->data as $key => $value) {
                 $res->{$key} = $value;
             }
         }
     }
     return $res;
 }
Пример #8
0
 /**
  * Builds the item tree from the database table specified.
  * 
  * @access	public
  * @return	boolean
  * 
  */
 function getTree()
 {
     if (!session_valid() && $this->cache > 0) {
         if (intl_lang() != intl_default_lang()) {
             $this->cacheLocation .= '_' . intl_lang();
         }
         if (@file_exists($this->cacheLocation) && filemtime($this->cacheLocation) > time() - $this->cache) {
             $this->loadConfig($this->cacheLocation);
             return true;
         }
     }
     $table = $this->table;
     $idcol = $this->idcolumn;
     $showcol = $this->showcolumn;
     $refcol = $this->refcolumn;
     $listcol = $this->listcolumn;
     $hidevalue = $this->hideValue;
     if (!empty($listcol)) {
         //			$list = "where $listcol != '$hidevalue' and $listcol is not null";
         $listcolumn = ', ' . $listcol;
     } else {
         $list = '';
         $listcolumn = '';
     }
     if (!empty($this->sectioncolumn)) {
         $sectioncolumn = ', ' . $this->sectioncolumn;
     } else {
         $sectioncolumn = '';
     }
     if (!empty($this->templatecolumn)) {
         $templatecolumn = ', ' . $this->templatecolumn;
     } else {
         $templatecolumn = '';
     }
     if ($this->sitelliteAllowed) {
         global $session;
         if (!empty($list)) {
             $allowed = 'and ' . $session->allowedSql();
         } else {
             $allowed = 'where ' . $session->allowedSql();
         }
     } else {
         $allowed = '';
     }
     if ($this->sortcolumn) {
         $sort = ', ' . $this->sortcolumn;
         if ($this->sortorder) {
             $sort .= ' ' . $this->sortorder;
         }
     } else {
         $sort = '';
     }
     $tree = db_fetch("select {$idcol}, {$showcol}, {$refcol} {$listcolumn} {$sectioncolumn} {$templatecolumn} from {$table} {$list} {$allowed} group by {$refcol} {$sort}, {$showcol} asc");
     if (!$tree) {
         $this->error = db_error();
         return false;
     } elseif (is_object($tree)) {
         $tree = array($tree);
     }
     $this->initTree($tree);
     if (intl_lang() != intl_default_lang()) {
         loader_import('multilingual.Translation');
         $tr = new Translation($table, intl_lang());
         $titles = $tr->getTitles();
         foreach ($titles as $key => $title) {
             $this->{'items_' . $key}->title = $title;
         }
     }
     if (!session_valid() && $this->cache > 0) {
         if (@is_writeable($this->cacheLocation) || !@file_exists($this->cacheLocation) && @is_writeable(dirname($this->cacheLocation))) {
             $fp = fopen($this->cacheLocation, 'w');
             if ($fp) {
                 fwrite($fp, $this->makeConfig($tree));
                 fclose($fp);
             }
         }
     }
     return true;
 }
Пример #9
0
loader_import('sitegallery.Functions');
loader_import('saf.Database.PropertySet');
$files = Dir::fetch($path, true);
$galleries = array();
if (!empty($parameters['path'])) {
    $prefix = $parameters['path'] . '/';
} else {
    $prefix = '';
}
if (intl_lang() == intl_default_lang()) {
    $ps1 = new PropertySet('sitegallery', 'album_title');
    $ps2 = new PropertySet('sitegallery', 'album_description');
    $ps3 = new PropertySet('sitegallery', 'album_date');
} else {
    $ps1 = new PropertySet('sitegallery', 'album_title_' . intl_lang());
    $ps2 = new PropertySet('sitegallery', 'album_description_' . intl_lang());
    $ps3 = new PropertySet('sitegallery', 'album_date');
}
foreach ($files as $k => $v) {
    if (!@is_dir($path . '/' . $v)) {
        continue;
    }
    $galleries[] = array('path' => $prefix . $v, 'name' => ucwords(preg_replace('/[^a-zA-Z\'-]+/', ' ', $v)), 'ts' => filemtime($path . '/' . $v), 'count' => sitegallery_count_images($path . '/' . $v), 'thumb' => sitegallery_get_thumbnail(sitegallery_first_image($path . '/' . $v)), 'desc' => '');
    $name = $ps1->get($prefix . $v);
    if (!empty($name)) {
        $galleries[count($galleries) - 1]['name'] = $name;
    }
    $desc = $ps2->get($prefix . $v);
    if (!empty($desc)) {
        $galleries[count($galleries) - 1]['desc'] = nl2br($desc);
    }