Пример #1
0
function osm_end_index()
{
    global $page, $filter, $template;
    if (isset($page['chronology_field']) || $filter['enabled']) {
        return;
    }
    if ('categories' == @$page['section']) {
        // flat or no flat ; has subcats or not;  ?
        if (!@$page['osm_cat_thumbs_displayed'] and empty($page['items'])) {
            return;
        }
    } else {
        if (!in_array(@$page['section'], array('tags', 'search', 'recent_pics', 'list'))) {
            return;
        }
        if (empty($page['items'])) {
            return;
        }
    }
    include_once dirname(__FILE__) . '/include/functions.php';
    if (!empty($page['items'])) {
        if (!@$page['osm_items_have_latlon'] and !osm_items_have_latlon($page['items'])) {
            return;
        }
    }
    osm_load_language();
    global $conf;
    $layout = isset($conf['osm_conf']['left_menu']['layout']) ? $conf['osm_conf']['left_menu']['layout'] : '2';
    $map_url = osm_duplicate_map_index_url(array(), array('start')) . "&v=" . $layout;
    $link_title = sprintf(l10n('DISPLAY_ON_MAP'), strip_tags($page['title']));
    $template->concat('PLUGIN_INDEX_ACTIONS', "\n<li>" . sprintf(OSM_ACTION_MODEL, $map_url, $link_title, '', 'map', l10n('MAP')) . '</li>');
}
Пример #2
0
function osm_apply_menu($menu_ref_arr)
{
    global $template, $page, $conf;
    $menu =& $menu_ref_arr[0];
    if (($block = $menu->get_block('mbLinks')) != null) {
        include_once dirname(__FILE__) . '/include/functions.php';
        include_once dirname(__FILE__) . '/include/functions_map.php';
        osm_load_language();
        load_language('plugin.lang', OSM_PATH);
        // Comment are used only with this condition index.php l294
        if ($page['start'] == 0 and !isset($page['chronology_field'])) {
            $js_data = osm_get_items($page);
            if ($js_data != array()) {
                $local_conf = array();
                $local_conf['contextmenu'] = 'false';
                $local_conf['control'] = true;
                $local_conf['img_popup'] = false;
                $local_conf['popup'] = 2;
                $local_conf['center_lat'] = 0;
                $local_conf['center_lng'] = 0;
                $local_conf['zoom'] = 2;
                $local_conf['autocenter'] = 1;
                $local_conf['divname'] = 'mapmenu';
                $local_conf['paths'] = osm_get_gps($page);
                $height = isset($conf['osm_conf']['main_menu']['height']) ? $conf['osm_conf']['main_menu']['height'] : '200';
                $js = osm_get_js($conf, $local_conf, $js_data);
                $template->set_template_dir(dirname(__FILE__) . '/template/');
                $template->assign(array('OSM_PATH' => embellish_url(get_gallery_home_url() . OSM_PATH), 'OSMJS' => $js, 'HEIGHT' => $height));
                $block->template = 'osm-menu.tpl';
            }
        }
    }
}
function osm_render_category()
{
    global $template, $page, $conf, $filter;
    include_once dirname(__FILE__) . '/include/functions.php';
    include_once dirname(__FILE__) . '/include/functions_map.php';
    osm_load_language();
    load_language('plugin.lang', OSM_PATH);
    // TF, 20160102: pass config as parameter
    $js_data = osm_get_items($conf, $page);
    if ($js_data != array()) {
        $local_conf = array();
        $local_conf['contextmenu'] = 'false';
        $local_conf['control'] = true;
        $local_conf['img_popup'] = false;
        $local_conf['popup'] = 1;
        $local_conf['center_lat'] = 0;
        $local_conf['center_lng'] = 0;
        $local_conf['zoom'] = 2;
        $local_conf['auto_center'] = 1;
        // TF, 20160102: pass config as parameter
        $local_conf['paths'] = osm_get_gps($conf, $page);
        $height = isset($conf['osm_conf']['category_description']['height']) ? $conf['osm_conf']['category_description']['height'] : '200';
        $width = isset($conf['osm_conf']['category_description']['width']) ? $conf['osm_conf']['category_description']['width'] : 'auto';
        $js = osm_get_js($conf, $local_conf, $js_data);
        $template->set_filename('map', dirname(__FILE__) . '/template/osm-category.tpl');
        $template->assign(array('CONTENT_ENCODING' => get_pwg_charset(), 'OSM_PATH' => embellish_url(get_gallery_home_url() . OSM_PATH), 'HOME' => make_index_url(), 'HOME_PREV' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : get_absolute_root_url(), 'HOME_NAME' => l10n("Home"), 'HOME_PREV_NAME' => l10n("Previous"), 'OSMJS' => $js, 'HEIGHT' => $height, 'WIDTH' => $width));
        $osm_content = $template->parse('map', true);
        //$osm_content = '<div id="osmmap"><div class="map_title">'.l10n('EDIT_MAP').'</div>' . $osm_content . '</div>';
        $index = isset($conf['osm_conf']['category_description']['index']) ? $conf['osm_conf']['category_description']['index'] : 0;
        // 0 - PLUGIN_INDEX_CONTENT_BEGIN
        // 1 - PLUGIN_INDEX_CONTENT_COMMENT
        // 2 - PLUGIN_INDEX_CONTENT_END
        if ($index <= 1) {
            // From index category comment at L300
            if ($page['start'] == 0 and !isset($page['chronology_field'])) {
                if (empty($page['comment'])) {
                    $page['comment'] = $osm_content;
                } else {
                    if ($index == 0) {
                        $page['comment'] = '<div>' . $osm_content . $page['comment'] . '</div>';
                    } else {
                        $page['comment'] = '<div>' . $page['comment'] . $osm_content . '</div>';
                    }
                }
            }
        } else {
            $osm_content = '<div id="osmmap">' . $osm_content . '</div>';
            $template->concat('PLUGIN_INDEX_CONTENT_END', "\n" . $osm_content);
        }
    }
}
Пример #4
0
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*
************************************************/
if (!defined('PHPWG_ROOT_PATH')) {
    define('PHPWG_ROOT_PATH', '../../');
}
include_once PHPWG_ROOT_PATH . 'include/common.inc.php';
include_once PHPWG_ROOT_PATH . 'admin/include/functions.php';
include_once dirname(__FILE__) . '/include/functions.php';
include_once dirname(__FILE__) . '/include/functions_map.php';
check_status(ACCESS_GUEST);
osm_load_language();
load_language('plugin.lang', OSM_PATH);
$section = '';
if ($conf['question_mark_in_urls'] == false and isset($_SERVER["PATH_INFO"]) and !empty($_SERVER["PATH_INFO"])) {
    $section = $_SERVER["PATH_INFO"];
    $section = str_replace('//', '/', $section);
    $path_count = count(explode('/', $section));
    $page['root_path'] = PHPWG_ROOT_PATH . str_repeat('../', $path_count - 1);
    if (strncmp($page['root_path'], './', 2) == 0) {
        $page['root_path'] = substr($page['root_path'], 2);
    }
} else {
    foreach ($_GET as $key => $value) {
        if (!strlen($value)) {
            $section = $key;
        }