Пример #1
1
function edit_note($id)
{
    if ((string) (int) $id != $id) {
        _die("Invalid ID");
    }
    include "lib/tags.php";
    $post_data =& $_POST;
    foreach (array('ID', 'title', 'contents', 'tags', 'time', 'slug') as $key) {
        $post_data[$key] = pg_escape_string(@$post_data[$key]);
    }
    $post_data['tags'] = clean_tags($post_data['tags']);
    if (trim($post_data['slug']) == '') {
        $post_data['slug'] = make_slug($post_data['title']);
    }
    if (!($time = strtotime(@$post_data['time']))) {
        $time = date("Y-m-d H:i:s O", time());
    } else {
        $time = date("Y-m-d H:i:s O", $time);
    }
    $result = db("UPDATE public.\"notes\" SET \"title\" = '{$post_data['title']}',\n\t\t\t\"contents\" ='{$post_data['contents']}', \"tags\" = '{$post_data['tags']}',\n\t\t\t\"slug\" ='{$post_data['slug']}'\n\t\t\tWHERE \"ID\" = " . pg_escape_string($id));
    if ($result) {
        if (!rebuild_tags()) {
            _die("There was an error rebuilding the tag cloud data.\n\t\t\t\t<a href=\"" . _l("/edit/{$id}") . "\">Go back &rarr;");
        }
        _die("Edit successfull. <a href=\"" . _l("/edit/{$id}") . "\">continue editing &rarr;");
    } else {
        _die("There was an unexpected error.");
    }
}
Пример #2
0
function jsonlist_url($item, $module, $prefix = null)
{
    return absolute_link(url_for("@document_by_id_lang_slug?module={$module}&id=" . $item['id'] . '&lang=' . $item['culture'] . '&slug=' . make_slug(isset($prefix) ? $prefix . '-' . $item['name'] : $item['name'])));
}
Пример #3
0
        ?>
<div class="one_kind_association">
<div class="association_content">
<?php 
        $area_type_list = array_keys(sfConfig::get('app_areas_area_types'));
        array_shift($area_type_list);
        echo '<div class="assoc_img picto_' . $module . '" title="' . ucfirst(__($module)) . '"><span>' . ucfirst(__($module)) . __('&nbsp;:') . '</span></div>';
        foreach ($area_type_list as $area_type) {
            $element = array();
            foreach ($associated_docs as $doc) {
                if ($doc['area_type'] != $area_type) {
                    continue;
                }
                $doc_id = $doc['id'];
                $name = ucfirst($doc['name']);
                $url = "@document_by_id_lang_slug?module={$module}&id={$doc_id}" . '&lang=' . $doc['culture'] . '&slug=' . make_slug($doc['name']);
                $element[] = link_to($name, $url);
            }
            if (!empty($element)) {
                echo '<div class="linked_elt">' . implode(', ', $element) . '</div>';
            }
        }
        ?>
</div>
</div>
<?php 
    }
    $has_box = isset($box) && $box;
    $has_weather = isset($weather) && $weather;
    $has_avalanche_bulletin = isset($avalanche_bulletin) && count($avalanche_bulletin);
    $has_date = isset($date) && $date;
Пример #4
0
 /**
  * overrides function from parent in order to correctly display slug
  * with summit name
  */
 protected function redirectToView()
 {
     sfLoader::loadHelpers(array('General'));
     $prefered_cultures = $this->getUser()->getCulturesForDocuments();
     $summits = Association::findAllWithBestName($this->document->get('id'), $prefered_cultures, 'sr');
     $summit_name = c2cTools::extractHighestName($summits);
     $this->redirect('@document_by_id_lang_slug?module=' . $this->getModuleName() . '&id=' . $this->document->get('id') . '&lang=' . $this->document->getCulture() . '&slug=' . make_slug($summit_name) . '-' . get_slug($this->document));
 }
Пример #5
0
 public function setSlugAttribute($title)
 {
     if (!isset($this->attributes['slug']) || $this->attributes['slug'] != str_slug($title)) {
         $this->attributes['slug'] = make_slug('contents', $title);
     }
 }
Пример #6
0
 /**
  * Executes Feed action
  * NB: cannot be cached ...
  */
 public function executeFeed()
 {
     $feed = new sfGeoRssFeed();
     $lang = $this->getRequestParameter('lang');
     $model = $this->model_class;
     $module = $this->getModuleName();
     $id = $this->getRequestParameter('id');
     $mode = $this->getRequestParameter('mode');
     if ($lang) {
         $languages = sfConfig::get('app_languages_c2c');
     }
     switch ($mode) {
         case 'editions':
             $description = $this->__($lang ? "Latest %1% editions in %2%" : "Latest %1% editions", array('%1%' => $this->__($module), '%2%' => $lang ? $this->__($languages[$lang]) : null));
             $title = $description;
             // TODO Provide better description, different from title
             $link = "@module_whatsnew?module={$module}";
             // TODO maybe we should propose lang filters for whatsnew url?
             $self_link = $lang ? "@feed_lang?module={$module}&lang={$lang}" : "@feed?module={$module}";
             break;
         case 'creations':
             $description = $this->__($lang ? "Latest %1% creations in %2%" : "Latest %1% creations", array('%1%' => $this->__($module), '%2%' => $lang ? $this->__($languages[$lang]) : null));
             $title = $description;
             // TODO Provide better description, different from title
             $link = "@default_index?module={$module}";
             // TODO can we redirect to list with lang filter once it is done?
             $self_link = $lang ? "@creations_feed_lang?module={$module}&lang={$lang}" : "@creations_feed?module={$module}";
             break;
         default:
             // editions of a specific document
             // check that document $id exists in lang $lang, and retrieve its name.
             if (!($document = DocumentI18n::findName($id, $lang, $this->model_class))) {
                 $this->setNotFoundAndRedirect();
             }
             $name = $document->get('name');
             $description = $this->__("Latest editions for \"%1%\" - %2%", array('%1%' => $name, '%2%' => $this->__($languages[$lang])));
             $title = $description;
             // TODO Provide better description, different from title
             $link = "@document_history?module={$module}&id={$id}&lang={$lang}";
             $self_link = "@document_feed?module={$module}&id={$id}&lang={$lang}";
             break;
     }
     $feed->setTitle($title);
     $feed->setLink($link);
     $feed->setFeedUrl($self_link);
     $feed->setDescription($description);
     $feed->setLanguage($lang);
     $feed->setAuthorName('Camptocamp.org');
     $max_number = sfConfig::get('app_feeds_items_limit');
     if ($module != 'documents' || !empty($id)) {
         //usage: listRecent($model, $limit, $user_id = null, $lang = null, $doc_id = null, $mode = 'editions')
         $items = Document::listRecent($this->model_class, $max_number, null, $lang, $id, $mode);
         sfLoader::loadHelpers(array('General', 'SmartFormat'));
         $model_i18n = $model . 'I18n';
         // Add best summit name for routes
         foreach ($items as $key => $item) {
             $items[$key]['module'] = $item[$model]['module'];
             $items[$key]['id'] = $item['document_id'];
             $items[$key]['name'] = $item[$model_i18n]['name'];
             $items[$key]['search_name'] = $item[$model_i18n]['search_name'];
         }
         $routes = Route::addBestSummitName(array_filter($items, array('c2cTools', 'is_route')), $this->__(' :') . ' ');
         foreach ($routes as $key => $route) {
             $items[$key] = $route;
         }
         foreach ($items as $item) {
             $item_id = $item['document_id'];
             $new = $item['version'];
             $module_name = $item[$model]['module'];
             $name = $item['name'];
             $doc_lang = $item['culture'];
             $feedItemTitle = $name . ($mode != 'creations' ? " - r{$new}" . ($lang ? '' : "/{$doc_lang}") : '');
             $feedItem = new sfGeoFeedItem();
             $feedItem->setTitle($feedItemTitle);
             if ($mode == 'creations') {
                 if ($module_name == 'users') {
                     $feedItem->setLink("@document_by_id_lang?module={$module_name}&id={$item_id}&lang={$doc_lang}");
                 } else {
                     $feedItem->setLink("@document_by_id_lang_slug?module={$module_name}&id={$item_id}&lang={$doc_lang}&slug=" . make_slug($item['name']));
                 }
             } else {
                 $feedItem->setLink("@document_by_id_lang_version?module={$module_name}&id={$item_id}&lang={$doc_lang}&version={$new}");
             }
             $feedItem->setAuthorName($item['history_metadata']['user_private_data']['topo_name']);
             //$feedItem->setAuthorEmail($item['history_metadata']['user_private_data']['email']);
             $feedItem->setPubdate(strtotime($item['created_at']));
             $feedItem->setUniqueId("{$item_id}-{$doc_lang}-{$new}");
             $feedItem->setLongitude($item[$model]['lon']);
             $feedItem->setLatitude($item[$model]['lat']);
             $comment = smart_format($item['history_metadata']['comment']);
             $feedItem->setDescription($comment);
             if ($mode != 'creations') {
                 $link = $new > 1 ? ' - ' . link_to(__('View difference between version %1% and %2%', array('%1%' => $new - 1, '%2%' => $new)), "@document_diff?module={$module_name}&id={$item_id}&lang={$doc_lang}&new={$new}&old=" . ($new - 1), array('absolute' => true)) : '';
                 $feedItem->setContent($comment . $link);
             }
             $feed->addItem($feedItem);
         }
     }
     $this->feed = $feed;
     $this->setTemplate('../../documents/templates/feed');
 }
Пример #7
0
$use_camo = (bool) sfConfig::get('app_camo_use');
$camo_url = sfConfig::get('app_camo_url');
$camo_key = sfConfig::get('app_camo_key');
// load needed strings from PunBB
@(include PUN_ROOT . 'lang/' . __('meta_language_forum') . '/common.php');
$module = $sf_context->getModuleName();
$lang = $sf_params->get('lang');
$id = $sf_params->get('id');
$mobile_version = c2cTools::mobileVersion();
require_once PUN_ROOT . 'include/parser.php';
$nb_comments = $comments->count();
$document_name = isset($title_prefix) ? $title_prefix . __('&nbsp;:') . ' ' . $document_name : $document_name;
echo display_title($document_name, $module);
if (!$mobile_version) {
    echo '<div id="nav_space">&nbsp;</div>';
    echo tabs_list_tag($id, $lang, $exists_in_lang, 'comments', NULL, $module != 'users' ? make_slug($document_name) : '', $nb_comments);
}
echo display_content_top('doc_content');
echo start_content_tag($module . '_content');
if ($nb_comments > 0) {
    $topic_id = $comments->getFirst()->topic_id;
    $uri_anchor = explode('#', $_SERVER['REQUEST_URI'], 2);
    $post_id = 0;
    if (count($uri_anchor) > 1) {
        $post_anchor = $uri_anchor[1];
        if (strpos($post_anchor, 'p') === 0) {
            if (preg_match('#p([0-9]+)#si', $post_anchor, $post_id_match)) {
                $post_id = intval($post_id_match[1]);
            }
        }
    }
        </tr>
    </thead>
    <tbody>
    <?php 
$table_list_even_odd = 0;
foreach ($items as $item) {
    $table_class = $table_list_even_odd++ % 2 == 0 ? 'table_list_even' : 'table_list_odd';
    $user_link = '@document_by_id?module=users&id=' . $item['user_private_data']['id'];
    $models = c2cTools::Type2Models($item['type']);
    $main_module = c2cTools::model2module($models['main']);
    $linked_module = c2cTools::model2module($models['linked']);
    $main_item = count($item['mainI18n']) ? $item['mainI18n'][0] : null;
    $linked_item = count($item['linkedI18n']) ? $item['linkedI18n'][0] : null;
    // FIXME: routes slugs
    $main_link = '@document_by_id_lang_slug?module=' . $main_module . '&id=' . $item['main_id'] . '&lang=' . $main_item['culture'] . '&slug=' . make_slug($main_item['name']);
    $linked_link = '@document_by_id_lang_slug?module=' . $linked_module . '&id=' . $item['linked_id'] . '&lang=' . $linked_item['culture'] . '&slug=' . make_slug($linked_item['name']);
    ?>
        <tr class="<?php 
    echo $table_class;
    if ($item['is_creation']) {
        echo ' creation';
    } else {
        echo ' deletion';
    }
    ?>
">
            <td> <?php 
    echo $item['is_creation'] ? $added_pic : $deleted_pic;
    ?>
 </td>
            <td> <?php 
Пример #9
0
<?php

use_helper('General');
$feed = new sfGeoRssFeed();
$feed->setTitle('Camptocamp.org ');
$feed->setLink('http://www.camptocamp.org');
$feed->setAuthorName('Camptocamp.org');
//$feed->setLanguage($lang);
foreach ($documents as $doc) {
    $feedItem = new sfGeoFeedItem();
    $feedItem->setTitle($doc['name']);
    $id = $doc['id'];
    $module = $doc['module'];
    $lang = $doc['culture'];
    $slug = make_slug($doc['name']);
    $feedItem->setLink("@document_by_id_lang_slug?module={$module}&id={$id}&lang={$lang}&slug={$slug}");
    $feedItem->setDescription($module);
    $feed->addItem($feedItem);
}
echo $feed->asXml(ESC_RAW);
Пример #10
0
<?php

/* Adds a post to the database */
if (!(isset($_POST) && @$_POST['title'] != '')) {
    _die("tpl/post_form.html");
}
include "lib/post.php";
include "lib/tags.php";
$post_data =& $_POST;
foreach (array('title', 'contents', 'tags', 'time', 'slug') as $key) {
    $post_data[$key] = pg_escape_string(@$post_data[$key]);
}
$post_data['tags'] = clean_tags($post_data['tags']);
if (trim($post_data['slug']) == '') {
    $post_data['slug'] = make_slug($post_data['title']);
}
if (!($time = strtotime(@$post_data['time']))) {
    $time = date("Y-m-d H:i:s O", time());
} else {
    $time = date("Y-m-d H:i:s O", $time);
}
if (db('INSERT INTO "public"."notes" ("title", "contents", "slug", "tags", "time") VALUES (' . "\n\t'{$post_data['title']}','{$post_data['contents']}','{$post_data['slug']}','{$post_data['tags']}','{$time}' )")) {
    add_tags($post_data['tags']);
    header('Location: ' . _l("/archive/{$_POST['slug']}"));
} else {
    _die("Some error occoured. Try again.");
}
Пример #11
0
function list_link($item, $module, $prefix = null)
{
    return link_to(isset($prefix) ? $prefix . __('&nbsp;:') . ' ' . $item['name'] : $item['name'], "@document_by_id_lang_slug?module={$module}&id=" . $item['id'] . '&lang=' . $item['culture'] . '&slug=' . make_slug(isset($prefix) ? $prefix . '-' . $item['name'] : $item['name']), array('hreflang' => $item['culture']));
}
Пример #12
0
 } else {
     ?>
         <li class="even">
     <?php 
 }
 $list_item++;
 $timedate = $item['date'];
 if ($timedate != $date) {
     echo '<span class="date">' . format_date($timedate, $item_date_format) . '</span>';
     $date = $timedate;
 }
 echo get_paginated_activities($item['activities']) . ' ';
 $i18n = $item['OutingI18n'][0];
 $id = $item['id'];
 $lang = $i18n['culture'];
 echo link_to($i18n['name'], "@document_by_id_lang_slug?module=outings&id={$id}&lang={$lang}&slug=" . make_slug($i18n['name']), array('hreflang' => $lang));
 $outing_data = array();
 $max_elevation = displayWithSuffix($item['max_elevation'], 'meters');
 if (!empty($max_elevation)) {
     $outing_data[] = $max_elevation;
 }
 $area_name = Area::getBestRegionDescription($item['geoassociations'], true);
 if (!empty($area_name)) {
     $outing_data[] = $area_name;
 }
 if (count($outing_data) > 0) {
     echo ' <span class="meta">(' . implode(' - ', $outing_data) . ')</span>';
 }
 if (isset($item['nb_images'])) {
     $images = picto_tag('picto_images_light', format_number_choice('[1]1 image|(1,+Inf]%1% images', array('%1%' => $item['nb_images']), $item['nb_images'])) . ' ';
     echo $images;
Пример #13
0
        $price = $child->find($price_xpath, 0)->innertext;
        $sku = $child->find($sku_xpath, 0)->innertext;
        echo $sku . '<br>';
        $img = $child->find($img_xpath, 0)->src;
        $content = '';
        $content = $child->find($content_xpath, 0)->innertext;
        //
        $title = trim($title);
        $price = str_replace(',', '', trim($price));
        $price = str_replace(' VND', '', $price);
        $sku = trim($sku);
        $img = 'http://haicaubeo.com' . str_replace(' ', '%20', trim($img));
        $content = trim($content);
        $store_url = '/img/uploads/2015/06/' . strtolower(str_replace('%20', '-', basename($img)));
        //
        $sql = "INSERT INTO `products`(\n        `sku`, `provider_id`,\n        `name`, `slug`, `price`,\n        `retail_price`, `source_price`, `excert`,\n        `descriptions`,\n        `category_id`, `type`)\n        VALUES (\n        " . $sku . ",1,\n        '" . $title . "', '" . make_slug($title) . "'," . ($price + 20000) . ",\n        " . $price . "," . $price . ",'',\n        '" . $content . "',\n        " . $l['cat'] . ",1)";
        $sql2 = "INSERT INTO `medias`(`ref`, `ref_id`, `file`, `position`) VALUES ('Product','[p_id]','{$store_url}',0)";
        $sql3 = "UPDATE `products` SET `media_id` = [media_id] WHERE `id` = [p_id] ";
        $buildQuery[$sku] = array('product' => $sql, 'media' => $sql2, 'update' => $sql3);
        $imgSavePath = getcwd() . '\\img\\uploads\\2015\\06\\' . strtolower(str_replace('%20', '-', basename($img)));
        file_put_contents($imgSavePath, file_get_contents($img));
    }
}
krsort($buildQuery);
foreach ($buildQuery as $query) {
    if (mysqli_query($conn, $query['product'])) {
        $product_id = $conn->insert_id;
        $query['media'] = str_replace('[p_id]', $product_id, $query['media']);
        if (mysqli_query($conn, $query['media'])) {
            $media_id = $conn->insert_id;
            $query['update'] = str_replace('[p_id]', $product_id, $query['update']);
Пример #14
0
<?php

if (!isset($use_keys)) {
    $use_keys = false;
}
foreach ($parkings as $parking) {
    $i18n = $parking['ParkingI18n'][0];
    $url = $use_keys ? array() : array('url' => absolute_link(url_for('@document_by_id_lang_slug?module=parkings&id=' . $parking['id'] . '&lang=' . $i18n['culture'] . '&slug=' . make_slug($i18n['name']))));
    $a[] = array_merge(array('id' => $parking['id'], 'name' => $i18n->getRaw('name')), $url);
}
if (isset($a)) {
    krsort($a);
    echo json_encode(array_values($a));
} else {
    echo '[]';
}
Пример #15
0
<?php

use_helper('Date', 'History', 'MyForm', 'Language', 'Viewer', 'WikiTabs', 'SmartFormat', 'sfBBCode');
use_javascript('/static/js/diff.js', 'last');
use_javascript('/static/js/history_tools.js', 'last');
$is_moderator = $sf_user->hasCredential(sfConfig::get('app_credentials_moderator'));
$module = $sf_context->getModuleName();
$model = c2cTools::module2model($module);
$i18n_archive = $model . 'I18nArchive';
$lang = $sf_params->get('lang');
$id = $sf_params->get('id');
$table_list_even_odd = 0;
$slug = make_slug($document[$i18n_archive]['name']);
echo display_title(isset($title_prefix) ? $title_prefix . __('&nbsp;:') . ' ' . $document_name : $document_name, $module);
echo '<div id="nav_space">&nbsp;</div>';
echo tabs_list_tag($id, $lang, $exists_in_lang, 'history', null, $slug, $nb_comments);
echo display_content_top('doc_content');
echo start_content_tag($module . '_content');
?>
<p><?php 
echo __('Viewing history from %1% in %2%', array('%1%' => $document_name, '%2%' => format_language_c2c($lang)));
?>
</p>

<p><?php 
echo __('Legend:') . ' * = ' . __('current version') . ', <strong>' . __('minor_tag') . '</strong> = ' . __('minor modification');
?>
</p>

<?php 
echo form_tag("@document_diff_post?module={$module}&id={$id}&lang={$lang}", array('method' => 'post'));
Пример #16
0
function show_single()
{
    global $s, $m, $x, $mtitle, $site_url, $comments, $page_display_name, $site_name, $comment_ok, $date_format, $lang, $error, $scream, $sname, $semail, $scomment, $sweb, $timezone;
    $rs = safe_row('*', 'pixie_dynamic_posts', "post_slug = '{$x}' and public = 'yes' limit 0,1");
    if ($rs) {
        extract($rs);
        safe_update('pixie_dynamic_posts', "post_views  = {$post_views} + 1", "post_id = '{$post_id}'");
        $logunix = returnUnixtimestamp($posted);
        $date = safe_strftime($date_format, $logunix);
        $timeunix = returnUnixtimestamp($last_modified);
        $xdate = safe_strftime($date_format, $timeunix);
        $microformat = safe_strftime('%Y-%m-%dT%T%z', $logunix);
        $slug = $post_slug;
        $fullname = safe_field('realname', 'pixie_users', "user_name='{$author}'");
        if (public_page_exists('profiles')) {
            $mauthor = "<a href=\"" . createURL("profiles", $author) . "\" class=\"url fn\" title=\"" . $lang['view'] . " {$fullname}'s " . $lang['profile'] . "\">{$fullname}</a>";
        } else {
            $mauthor = "<a href=\"{$site_url}\" class=\"url fn\" title=\"{$site_url}\">{$fullname}</a>";
        }
        if (isset($tags) && $tags) {
            $all_tags = strip_tags($tags);
            $all_tags = str_replace('&quot;', "", $tags);
            $tags_array_temp = explode(" ", $all_tags);
            for ($count = 0; $count < count($tags_array_temp); $count++) {
                $current = $tags_array_temp[$count];
                $first = $current[strlen($current) - strlen($current)];
                if ($first == " ") {
                    $current = substr($current, 1, strlen($current) - 1);
                }
                $ncurrent = make_slug($current);
                if (isset($s) && isset($ncurrent)) {
                    if (isset($tag_list)) {
                    } else {
                        $tag_list = NULL;
                    }
                    $tag_list .= "<a href=\"" . createURL($s, 'tag', $ncurrent) . "\" title=\"" . $lang['view'] . " " . $lang['all_posts_tagged'] . ": " . $current . "\"  rel=\"tag\" >" . $current . "</a>, ";
                }
                if ($ncurrent != "") {
                    if (isset($class_list)) {
                    } else {
                        $class_list = NULL;
                    }
                    $class_list .= "tag_{$ncurrent} ";
                }
            }
            $tag_list = substr($tag_list, 0, strlen($tag_list) - 2) . "";
        }
        if (isset($s)) {
            $permalink = createURL($s, 'permalink', $slug);
        }
        $authorclass = strtolower($author);
        $timeclass = safe_strftime('y%Y m%m d%d h%H', $logunix);
        echo "\n\t\t\t\t\t<div class=\"section hentry author_{$authorclass} {$class_list}{$timeclass} single\" id=\"post_{$post_id}\">\n\t\t\t\t\t\t<h4 class=\"entry-title\"><a href=\"{$permalink}\" rel=\"bookmark\">{$title}</a></h4>\n\t\t\t\t\t\t<ul class=\"post_links\">\n\t\t\t\t\t\t\t<li class=\"post_date\"><abbr class=\"published\" title=\"{$microformat}\">{$date}</abbr></li>";
        if (isset($_COOKIE['pixie_login'])) {
            list($username, $cookie_hash) = explode(',', $_COOKIE['pixie_login']);
            $nonce = safe_field('nonce', 'pixie_users', "user_name='{$username}'");
            if (md5($username . $nonce) == $cookie_hash) {
                $privs = safe_field('privs', 'pixie_users', "user_name='{$username}'");
                if ($privs >= 1) {
                    echo "\n\t\t\t\t\t\t\t<li class=\"post_edit\"><a href=\"" . $site_url . "admin/?s=publish&amp;m=dynamic";
                    if (isset($s)) {
                        echo '&amp;x=' . $s;
                    }
                    echo "&amp;edit={$post_id}\" title=\"" . $lang['edit_post'] . "\">" . $lang['edit_post'] . "</a></li>";
                }
            }
        }
        echo "\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t<div class=\"post entry-content\">\n";
        //<!--more-->
        $post = get_extended($content);
        echo "\t\t\t\t\t\t\t" . $post['main'];
        if ($post['extended']) {
            echo $post['extended'];
        }
        echo "\n\t\t\t\t\t\t</div>\t\t\n\t\t\t\t\t\t<div class=\"post_credits\">\n\t\t\t\t\t\t \t<span class=\"vcard author\">" . $lang['by'] . " {$mauthor}</span>\n\t\t\t\t\t\t \t<span class=\"post_tags\">" . $lang['tagged'] . ": {$tag_list}</span>\n\t\t\t\t\t\t \t<span class=\"post_updated\">" . $lang['last_updated'] . ": {$xdate} </span>\n\t\t\t\t\t\t</div>\t\t\t\n\t\t\t\t\t</div>\n\t\t\t\t\t\n\t\t\t\t\t<div id=\"nav_posts\" class=\"dynamic_bottom_nav\">\n";
        // previous and next posts
        if (isset($s)) {
            $thisid = get_page_id($s);
        }
        // what post is next?
        $searchnext = safe_field('post_id', 'pixie_dynamic_posts', "page_id = '{$thisid}' and public = 'yes' and posted > '{$posted}' limit 0,1");
        if ($searchnext) {
            $ntitle = safe_field('title', 'pixie_dynamic_posts', "post_id ='{$searchnext}'");
            $nslug = safe_field('post_slug', 'pixie_dynamic_posts', "post_id ='{$searchnext}'");
            echo "\t\t\t\t\t\t<div id=\"post_next\" class=\"link_next\"><a class=\"link_next_a\" href=\"";
            if (isset($s)) {
                echo createURL($s, 'permalink', $nslug);
            }
            echo "\" title=\"" . $lang['next_post'] . ": {$ntitle}\">" . $lang['next_post'] . " &raquo;</a></div>\n";
        }
        // what post is previous?
        $searchprev = safe_field('post_id', 'pixie_dynamic_posts', "page_id = '{$thisid}' and public = 'yes' and posted < '{$posted}' order by posted desc limit 0,1");
        if ($searchprev) {
            $ptitle = safe_field('title', 'pixie_dynamic_posts', "post_id ='{$searchprev}'");
            $pslug = safe_field('post_slug', 'pixie_dynamic_posts', "post_id ='{$searchprev}'");
            echo "\t\t\t\t\t\t<div id=\"post_previous\" class=\"link_previous\"><a class=\"link_prev_a\" href=\"";
            if (isset($s)) {
                echo createURL($s, 'permalink', $pslug);
            }
            echo "\" title=\"" . $lang['previous_post'] . ": ";
            if (isset($ptitle)) {
                echo $ptitle;
            }
            echo "\">&laquo; " . $lang['previous_post'] . "</a></div>\n";
        }
        echo "\t\t\t\t\t</div>\n";
        $comms = safe_rows('*', 'pixie_module_comments', "post_id = '{$post_id}'");
        $no_comms = count($comms);
        // fix to remove commenting when plug in is removed
        if (public_page_exists('comments')) {
            if ($comments == 'yes' or $comms) {
                echo "\n\t\t\t\t\t<div id=\"comments\">\n\t\t\t\t\t\t<h4 id=\"comments_title\">" . $lang['comments'] . "</h4>";
                if (isset($_COOKIE['pixie_login'])) {
                    list($username, $cookie_hash) = explode(',', $_COOKIE['pixie_login']);
                    $nonce = safe_field('nonce', 'pixie_users', "user_name='{$username}'");
                    if (md5($username . $nonce) == $cookie_hash) {
                        $realname = safe_field('realname', 'pixie_users', "user_name='{$username}'");
                        $umail = safe_field('email', 'pixie_users', "user_name='{$username}'");
                    }
                }
                $r2 = safe_rows('*', 'pixie_module_comments', "post_id = '{$post_id}' order by posted asc");
                if ($r2) {
                    $i = 0;
                    while ($i < $no_comms) {
                        extract($r2[$i]);
                        $default = "{$site_url}files/images/no_grav.jpg";
                        if (isset($email)) {
                            $grav_url = 'http://www.gravatar.com/avatar.php?gravatar_id=' . md5($email) . '&amp;default=' . urlencode($default) . '&amp;size=40';
                        }
                        $hash = $i + 1;
                        if ($url) {
                            $namepr = "<span class=\"message_name author\"><a href=\"{$permalink}#comment_{$hash}\" rel=\"bookmark\" class=\"comment_permalink\">#{$hash}</a> <a href=\"" . htmlentities($url) . "\" rel=\"external nofollow\" class=\"url fn\">{$name}</a></span>";
                        } else {
                            $namepr = "<span class=\"message_name author\"><a href=\"{$permalink}#comment_{$hash}\" rel=\"bookmark\" class=\"comment_permalink\">#{$hash}</a> <span class=\"fn\">{$name}</span></span>";
                        }
                        if (is_even($i + 1)) {
                            $type = 'comment_even';
                        } else {
                            $type = 'comment_odd';
                        }
                        if ($admin_user == 'yes') {
                            $atype = ' comment_admin';
                        } else {
                            $atype = "";
                        }
                        $logunix = returnUnixtimestamp($posted);
                        $days_ago = safe_strftime('since', $logunix);
                        $microformatcomment = safe_strftime('%Y-%m-%dT%T%z', $logunix);
                        $commenttimeclass = safe_strftime('c_y%Y c_m%m c_d%d c_h%H', $logunix);
                        echo "\n\t\t\t\t\t\t<div class=\"{$type} hentry comment comment_author_" . str_replace('-', '_', make_slug($name)) . " {$commenttimeclass}" . $atype . "\" id=\"comment_{$hash}\">\n\t\t\t\t\t\t\t<div class=\"comment_message\">\n\t\t\t\t\t\t\t\t<div class=\"message_details vcard\">\n\t\t\t\t\t\t\t\t\t<img src=\"{$grav_url}\" alt=\"Gravatar Image\" class=\"gr photo\" />\n\t\t\t\t\t\t\t\t\t{$namepr}\n\t\t\t\t\t\t\t\t\t<span class=\"message_time\"><abbr class=\"published\" title=\"{$microformatcomment}\">{$days_ago}</abbr></span>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class=\"message_body entry-title entry-content\"><p>{$comment}</p></div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>";
                        $i++;
                    }
                } else {
                    echo "\n\t\t\t\t\t\t<span class=\"comments_none\">" . $lang['no_comments'] . "</span>";
                }
                echo "\n\t\t\t\t\t</div>\n";
                echo "\n\t\t\t\t\t<div class=\"comment_form\" id=\"commentform\">";
                if ($comment_ok) {
                    echo "\n\t\t\t\t\t\t\t<p class=\"success\">" . $lang['comment_thanks'] . '</p>';
                } else {
                    if ($comments == 'yes') {
                        if (isset($s)) {
                            $posty = createURL($s, $m, $x);
                        }
                        echo "\n\t\t\t\t\t\t<form accept-charset=\"UTF-8\" action=\"{$posty}#commentform\" method=\"post\" class=\"form\">\n\t\t\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\t\t  var blogTool              = \"pixie\";\n\t\t\t\t\t\t  var blogURL               = \"{$site_url}\";\n\t\t\t\t\t\t  var blogTitle             = \"{$site_name} - {$page_display_name}\";\n\t\t\t\t\t\t  var postURL               = \"{$posty}\";\n\t\t\t\t\t\t  var postTitle             = \"{$title}\";\n\t\t\t\t\t\t  var commentTextFieldName  = \"comment\";\n\t\t\t\t\t\t  var commentButtonName     = \"comment_submit\";";
                        if (isset($realname) && $realname) {
                            echo "\n\t\t\t\t\t\t  var commentAuthorLoggedIn = true;";
                        } else {
                            echo "\n\t\t\t\t\t\t  var commentAuthorLoggedIn = false;";
                        }
                        echo "\n\t\t\t\t\t\t  var commentAuthorFieldName = \"name\";\n\t\t\t\t\t\t  var commentFormID       = \"commentform\";\n\t\t\t\t\t\t</script>\n\t\t\t\t\t\t\t<fieldset>\n\t\t\t\t\t\t\t\t<legend>" . $lang['comment_leave'] . "</legend>";
                        if (isset($error)) {
                            echo "\n\t\t\t\t\t\t\t\t<p class=\"error\">{$error}</p>";
                            if (in_array('name', $scream)) {
                                $name_style = 'form_highlight';
                            }
                            if (in_array('comment', $scream)) {
                                $comment_style = 'form_highlight';
                            }
                            if (in_array('email', $scream)) {
                                $email_style = 'form_highlight';
                            }
                            if (in_array('web', $scream)) {
                                $web_style = 'form_highlight';
                            }
                        } else {
                            echo "<p class=\"notice\">" . $lang['comment_form_info'] . "</p>";
                        }
                        echo "\n\t\t\t\t\t\t\t\t<div class=\"form_row ";
                        if (isset($name_style)) {
                            echo $name_style;
                        }
                        echo "\">\n\t\t\t\t\t\t\t\t\t<div class=\"form_label\"><label for=\"comment_name\">" . $lang['comment_name'] . " <span class=\"form_required\">" . $lang['form_required'] . "</span></label></div>";
                        if (isset($realname) && $realname) {
                            echo "\n\t\t\t\t\t\t\t\t\t<div class=\"form_item\"><input type=\"text\" disabled=\"disabled\" tabindex=\"1\" name=\"name\" class=\"form_text\" id=\"comment_name\"";
                            if (isset($realname)) {
                                echo " value=\"{$realname}\"";
                            }
                            echo " /></div>";
                        } else {
                            echo "\n\t\t\t\t\t\t\t\t<div class=\"form_item\"><input type=\"text\" tabindex=\"1\" name=\"name\" class=\"form_text\" id=\"comment_name\" value=\"{$sname}\"/></div>";
                        }
                        if ($sweb == "") {
                            $sweb = 'http://';
                        }
                        if (isset($realname) && $realname) {
                            $sweb = $site_url;
                            $semail = $umail;
                        }
                        echo "\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class=\"form_row ";
                        if (isset($email_style)) {
                            echo $email_style;
                        }
                        echo "\">\n\t\t\t\t\t\t\t\t\t<div class=\"form_label\"><label for=\"comment_email\">" . $lang['comment_email'] . " <span class=\"form_required\">" . $lang['form_required'] . "</span></label></div>\n\t\t\t\t\t\t\t\t\t<div class=\"form_item\"><input type=\"text\" tabindex=\"2\" name=\"email\" class=\"form_text\" id=\"comment_email\" value=\"{$semail}\" /></div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class=\"form_row ";
                        if (isset($web_style)) {
                            echo $web_style;
                        }
                        echo "\">\n\t\t\t\t\t\t\t\t\t<div class=\"form_label\"><label for=\"comment_web\">" . $lang['comment_web'] . " <span class=\"form_optional\">" . $lang['form_optional'] . "</span></label></div>\n\t\t\t\t\t\t\t\t\t<div class=\"form_item\"><input type=\"text\" tabindex=\"2\" name=\"web\" class=\"form_text\" id=\"comment_web\" value=\"{$sweb}\" /></div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class=\"form_row ";
                        if (isset($comment_style)) {
                            echo $comment_style;
                        }
                        echo "\">\n\t\t\t\t\t\t\t\t\t<div class=\"form_label\"><label for=\"comment\">" . $lang['comment'] . " <span class=\"form_required\">" . $lang['form_required'] . "</span></label></div>\n\t\t\t\t\t\t\t\t\t<div class=\"form_item\"><textarea name=\"comment\" tabindex=\"3\" id=\"comment\" class=\"form_text_area\" cols=\"25\" rows=\"5\">{$scomment}</textarea></div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class=\"form_row_submit\">\n\t\t\t\t\t\t\t\t\t<input type=\"submit\" name=\"comment_submit\" tabindex=\"4\" value=\"" . $lang['comment_button_leave'] . "\" class=\"form_submit\" />\n\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"post\" value=\"{$post_id}\" />";
                        if (isset($realname) && $realname) {
                            echo "\n\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"admin_user\" value=\"" . md5($nonce) . "\" />\n\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"name\"";
                            if (isset($realname)) {
                                echo " value=\"{$realname}\"";
                            }
                            echo " />";
                        }
                        echo "\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</fieldset>\n\t\t\t\t\t\t</form>";
                    } else {
                        echo "\n\t\t\t\t\t\t<span class=\"comments_closed\">" . $lang['comment_closed'] . "</span>";
                    }
                }
                echo "\n\t\t\t\t\t</div>";
            }
            // end if comments plugin enabled
        }
    } else {
        extract(safe_row('*', 'pixie_core', "page_name='404'"));
        extract(safe_row('*', 'pixie_static_posts', "page_id='{$page_id}'"));
        if (isset($s)) {
            echo "<div id=\"{$s}\">\n\t\t\t\t\t\t<h3>{$page_display_name}</h3>\n";
            eval('?>' . $page_content . '<?php ');
            echo "\n\t\t\t\t\t</div>\n";
        }
    }
}
Пример #17
0
        if ($list_item % 2 == 1) {
            ?>
                <li class="odd">
            <?php 
        } else {
            ?>
                <li class="even">
            <?php 
        }
        $list_item++;
        $id = $item['id'];
        $lang = $item['ArticleI18n'][0]['culture'];
        ?>
            <span class="home_article_title">
            <?php 
        echo link_to($item['ArticleI18n'][0]['name'], "@document_by_id_lang_slug?module=articles&id={$id}&lang={$lang}&slug=" . make_slug($item['ArticleI18n'][0]['name']), array('hreflang' => $lang));
        ?>
            </span>
            <?php 
        echo truncate_article_abstract(parse_links(parse_bbcode_abstract($item['ArticleI18n'][0]['abstract'])), sfConfig::get('app_recent_documents_articles_abstract_characters_limit'));
        ?>
            </li>
    <?php 
    }
    ?>
    </ul>
<?php 
}
?>
<div class="home_link_list">
<?php 
    echo '</p>';
    $pager_navigation = pager_navigation($pager);
    echo $pager_navigation;
    echo '<div class="clearer"></div>';
    $items = Language::parseListItems($items, 'Image');
    echo form_tag("@user_manage_images?module=users", array('onsubmit' => 'C2C.submitonce(this)', 'id' => 'editform'));
    foreach ($items as $item) {
        ?>
    <div class="thumb_data manageimages_list">
    <?php 
        $i18n_item = $item['ImageI18n'][0];
        $title = $i18n_item['name'];
        $image_type = $item['image_type'];
        $filename = $item['filename'];
        $thumb_url = image_url($filename, 'small');
        $slug = make_slug($i18n_item['name']);
        $image_id = $item['id'];
        $image_route = '@document_by_id_lang_slug?module=images&id=' . $image_id . '&lang=' . $i18n_item['culture'] . '&slug=' . $slug;
        echo link_to(image_tag($thumb_url, array('class' => 'img', 'alt' => $title)), absolute_link(image_url($filename, 'big', true), true), array('title' => $title, 'data-lightbox' => 'document_images', 'class' => 'view_big', 'id' => 'lightbox_' . $image_id . '_' . $image_type));
        ?>
    <div class="manageimages_info">
        <?php 
        echo input_tag('switch[]', null, array('type' => 'checkbox', 'value' => "{$image_id}", 'id' => 'switch_' . $image_id)) . link_to(__('Details'), $image_route, array('class' => 'toto'));
        ?>
        </div>
    </div>
<?php 
    }
    ?>
<div style="clear:both"><?php 
    echo input_hidden_tag('page', $page);
Пример #19
0
    echo '</p>';
    $pager_navigation = pager_navigation($pager);
    echo $pager_navigation;
    echo pager_nb_results($pager);
    echo '<div class="clearer"></div>';
    foreach ($items as $item) {
        ?>
    <div class="thumb_data">
    <div class="thumb_data_img">
    <?php 
        $i18n_item = $item['ImageI18n'][0];
        $title = $i18n_item['name'];
        $filename = $item['filename'];
        $image_type = $item['image_type'];
        $thumb_url = image_url($filename, 'small');
        $image_route = '@document_by_id_lang_slug?module=images&id=' . $item['id'] . '&lang=' . $i18n_item['culture'] . '&slug=' . make_slug($i18n_item['name']);
        echo link_to(image_tag($thumb_url, array('class' => 'img', 'alt' => $title)), $mobile_version ? $image_route : absolute_link(image_url($filename, 'big', true), true), array('title' => $title, 'data-lightbox' => 'document_images', 'class' => 'view_big', 'id' => 'lightbox_' . $item['id'] . '_' . $image_type));
        ?>
    <div class="image_license <?php 
        echo 'license_' . $image_type;
        ?>
"></div>
    </div>
    <?php 
        echo $title . '<br />';
        echo link_to(__('Details'), $image_route);
        if (!empty($item['nb_comments'])) {
            echo ' - ' . picto_tag('action_comment', __('nb_comments'), array('style' => 'margin-bottom:-4px')) . ' (' . link_to($item['nb_comments'], '@document_comment?module=images&id=' . $item['id'] . '&lang=' . $i18n_item['culture']) . ')';
        }
        ?>
    </div>
Пример #20
0
<?php

use_helper('Field');
$html = array();
foreach ($parkings as $parking) {
    $name = ucfirst($parking['ParkingI18n'][0]['name']);
    $culture = $parking['ParkingI18n'][0]['culture'];
    $url = '@document_by_id_lang_slug?module=parkings&id=' . $parking['id'] . '&lang=' . $culture . '&slug=' . make_slug($parking['ParkingI18n'][0]['name']);
    $link = link_to($name, $url, array('hreflang' => $culture));
    if (isset($parking['lowest_elevation']) && is_scalar($parking['lowest_elevation']) && $parking['lowest_elevation'] != $parking['elevation']) {
        $link .= '&nbsp; ' . $parking['lowest_elevation'] . __('meters') . __('range separator') . $parking['elevation'] . __('meters');
    } else {
        if (isset($parking['elevation']) && is_scalar($parking['elevation'])) {
            $link .= '&nbsp; ' . $parking['elevation'] . __('meters');
        }
    }
    if (isset($parking['public_transportation_types'])) {
        $link .= field_pt_picto_if_set($parking, true, ' - ');
    }
    $html[] = $link;
}
echo implode('<br />', $html);
Пример #21
0
function format_book_data($books, $type, $main_id, $is_moderator = false)
{
    $type_list = $type . '_list';
    $module = 'books';
    $main_module = c2cTools::Letter2Module(substr($type, 1, 1));
    $strict = 1;
    $html = '<div class="association_content_inside_field">';
    foreach ($books as $book) {
        $doc_id = $book['id'];
        $idstring = $type . '_' . $doc_id;
        $class = 'linked_elt';
        $html .= '<div class="' . $class . '" id="' . $idstring . '">' . '<div class="assoc_img picto_' . $module . '" title="' . ucfirst(__($module)) . '"></div>';
        $name = ucfirst($book['name']);
        $url = "@document_by_id_lang_slug?module={$module}&id={$doc_id}" . '&lang=' . $book['culture'] . '&slug=' . make_slug($book['name']);
        $html .= link_to($name, $url);
        if (isset($book['author']) && trim($book['author']) != '') {
            $html .= ' - ' . $book['author'];
        }
        if (isset($book['publication_date']) && trim($book['publication_date']) != '') {
            $html .= ' - ' . $book['publication_date'];
        }
        if ($is_moderator && $main_id && !c2cTools::mobileVersion()) {
            $html .= c2c_link_to_delete_element($type, $doc_id, $main_id, false, $strict);
        }
        $html .= '</div>';
    }
    $html .= '</div>';
    return $html;
}
Пример #22
0
 public function setSlugAttribute($name)
 {
     $this->attributes['slug'] = make_slug('templates', $name);
 }
Пример #23
0
function admin_block_tag_cloud($table, $condition)
{
    global $s, $m, $x, $type, $lang;
    $tags_array = all_tags($table, $condition);
    if (count($tags_array) != 0) {
        echo "\n\t\t\t\t\t<div id=\"admin_block_tags\" class=\"admin_block\">\r\n\t\t\t\t\t\t<h3 class=\"{$type}\">" . $lang['tags'] . "</h3>\n";
        $max = 0;
        $min = 1;
        for ($findmax = 1; $findmax < count($tags_array); $findmax++) {
            $current = $tags_array[$findmax];
            $rz = safe_rows('*', $table, $condition . " AND tags REGEXP '[[:<:]]" . $current . "[[:>:]]'");
            $total = count($rz);
            if ($total > $max) {
                $max = $total;
            }
            if ($total < $max) {
                $min = $total;
            }
        }
        sort($tags_array);
        for ($final = 1; $final < count($tags_array); $final++) {
            $current = $tags_array[$final];
            $rz = safe_rows('*', $table, $condition . " AND tags REGEXP '[[:<:]]" . $current . "[[:>:]]'");
            $total = count($rz);
            if ($total == 0) {
                $total = 1;
            }
            if ($total >= $max) {
                $tag_class = 'tag_max';
            } else {
                if ($total == $min) {
                    $tag_class = 'tag_min';
                } else {
                    $inc = floor($total * 10 / $max);
                    $tag_class = 'tag_' . $inc;
                }
            }
            if (isset($s) && isset($current)) {
                if (isset($cloud)) {
                } else {
                    $cloud = NULL;
                }
                $cloud .= "\t\t\t\t\t\t<a href=\"?s={$s}&amp;m={$m}&amp;x={$x}&amp;tag=" . make_slug($current) . "\" title=\"" . $lang['view'] . " " . $lang['all_posts_tagged'] . ": " . $current . "\" class=\"{$tag_class}\" rel=\"tag\">" . $current . "({$total})</a>\n";
            }
        }
        $cloud = substr($cloud, 0, strlen($cloud) - 1) . "";
        echo "{$cloud}\n";
        echo "\n\t\t\t\t\t</div>\n";
    }
}
Пример #24
0
function get_slug($document)
{
    return make_slug($document->get('name'));
}
Пример #25
0
<?php

$feedItem = new sfGeoFeedItem();
$i18n = $item['ArticleI18n'][0];
$feedItem->setTitle($i18n['name']);
$id = $item['id'];
$lang = $i18n['culture'];
$feedItem->setLink("@document_by_id_lang_slug?module=articles&id={$id}&lang={$lang}&slug=" . make_slug($i18n['name']));
$feedItem->setUniqueId(sfRouting::getInstance()->getCurrentInternalUri() . '_' . $id);
$feedItem->setAuthorName($item['creator']);
$feedItem->setPubdate(strtotime($item['creation_date']));
$data = array();
$data[] = get_paginated_value_from_list($item['categories'], 'mod_articles_categories_list');
if (isset($item['activities']) && is_string($item['activities'])) {
    $data[] = get_paginated_activities($item['activities'], true);
}
$data[] = get_paginated_value($item['article_type'], 'mod_articles_article_types_list');
$feedItem->setDescription(implode(' - ', $data));
$feed->addItem($feedItem);
Пример #26
0
function make_clean_slug($string, $prefix, $table, $slug_field, $id_field = '', $id = null)
{
    $slug = make_slug($string);
    $used_string = array();
    $Register =& Register::getInstance();
    $DBHandler =& $Register->get(VAR_DBHANDLER);
    /* @var DBHandler DataBase*/
    $query = "SELECT DISTINCT`{$slug_field}` as slug FROM {$table} WHERE `{$slug_field}` LIKE ?" . ($id ? " AND NOT(`{$id_field}` LIKE ?)" : '');
    $DBHandler->ph_query($query, $prefix . $slug . '%', $id);
    while ($row = $DBHandler->fetch_assoc()) {
        $used_slug[] = $row['slug'];
    }
    $DBHandler->freeResult();
    $max_i = 100;
    $_slug = $slug;
    while ($max_i-- > 0 && in_array($prefix . $_slug, $used_slug)) {
        $_slug = $slug . '_' . rand_name(3);
    }
    return $_slug;
}
Пример #27
0
{
    //	$accents_regex = '~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i';
    //	$special_cases = array( '&' => 'and', "'" => '');
    $string = mb_strtolower(trim($string), 'UTF-8');
    //	$string = str_replace( array_keys($special_cases), array_values( $special_cases), $string );
    //	$string = preg_replace( $accents_regex, '$1', htmlentities( $string, ENT_QUOTES, 'UTF-8' ) );
    $string = preg_replace("/%[a-f0-9]{2}/u", "{$separator}", $string);
    $string = preg_replace("/[^a-z0-9]/u", "{$separator}", $string);
    $string = preg_replace("/[{$separator}]+/u", "{$separator}", $string);
    $string = trim($string, "{$separator}");
    return $string;
}
$URL = strtok(isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : $_SERVER['REQUEST_URI'], '?');
$URL_PARTS = explode('/', ltrim($URL, '/'));
foreach ($URL_PARTS as &$PART) {
    $PART = make_slug($PART);
}
// TODO: Figure out if this is the live server or not //
define('USE_MINIFIED', isset($_GET['debug']) ? '' : '.min');
define('VERSION_STRING', defined('GIT_VERSION') ? 'v=' . GIT_VERSION : '');
const STATIC_DOMAINS = ['jammer.work' => 'static.jammer.work', 'jammer.dev' => 'static.jam.dev'];
define('STATIC_DOMAIN', array_key_exists($_SERVER['SERVER_NAME'], STATIC_DOMAINS) ? STATIC_DOMAINS[$_SERVER['SERVER_NAME']] : 'static.jam.vg');
define('LINK_SUFFIX', isset($_GET['nopush']) ? '; nopush' : '');
define('JS_FILE', "/-/all" . USE_MINIFIED . ".js?" . VERSION_STRING);
define('CSS_FILE', "/-/all" . USE_MINIFIED . ".css?" . VERSION_STRING);
define('SVG_FILE', "/-/all" . USE_MINIFIED . ".svg?" . VERSION_STRING);
define('FONT_FILE', "//fonts.googleapis.com/css?family=Raleway:500,500italic,800,800italic|Lato:300,300italic,400,400italic,700,700italic");
if (!isset($_GET['nopreload'])) {
    header("Link: <" . JS_FILE . ">; rel=preload; as=script" . LINK_SUFFIX, false);
    header("Link: <" . CSS_FILE . ">; rel=preload; as=style" . LINK_SUFFIX, false);
    header("Link: <" . SVG_FILE . ">; rel=preload" . LINK_SUFFIX, false);
Пример #28
0
        }
        if ($max_ele > 0) {
            $item->addChild('geom', "{$lon},{$lat}");
            $item->addChild('elevation', $max_ele);
        }
    }
    $item->addChild('date', $object->get('date'));
    $item->addChild('lang', $lang);
    $activities = $object->get('activities');
    foreach ($activities as $activity) {
        if (array_key_exists($activity, $meta_activities)) {
            $item->addChild('activity', $meta_activities[$activity]);
        }
    }
    $item->addChild('original_outing_id', $id);
    $item->addChild('url', "http://www.camptocamp.org/outings/{$id}/{$lang}/" . make_slug(htmlspecialchars($object->get('name'))));
}
if (!$n) {
    exit;
    // it's better to keep the script mute if not necessary, thus avoiding cron to send useless mails
}
// debug info :
//echo "XML created : \n" . $xml->asXML() . " \n";
$b = new sfWebBrowser();
try {
    if (!$b->get($meta_url)->responseIsError()) {
        // Successful response (eg. 200, 201, etc)
        //echo "Pushing $n outing(s) ... \n";
        $b->post($meta_url . 'outings/push', array('metaengine_user_id' => $user_id, 'metaengine_user_key' => $user_key, 'metaengine_xml' => urlencode($xml->asXML())));
        $response = $b->getResponseXml();
        if ($response->status == 1) {
Пример #29
0
    echo '</div>';
    if (isset($title)) {
        $print = count($associated_docs) ? '' : ' no_print';
        echo '<div id="_' . $title . '" class="section_subtitle' . $print . '">' . __($title) . '</div>';
    }
    foreach ($associated_docs as $doc) {
        $doc_id = $doc['id'];
        $idstring = isset($type) ? $type . '_' . ($revert_ids ? $id : $doc_id) : '';
        ?>

    <div class="linked_elt" id="<?php 
        echo $idstring;
        ?>
">
        <?php 
        echo link_to($doc['name'], "@document_by_id_lang_slug?module={$module}&id=" . $doc_id . '&lang=' . $doc['culture'] . '&slug=' . make_slug($doc['name']));
        if (isset($display_info) && $display_info) {
            echo '<div class="short_data">';
            echo summarize_route($doc, true, true);
        }
        if (!isset($doc['parent_id']) and $show_link_to_delete) {
            echo c2c_link_to_delete_element($type, $revert_ids ? $id : $doc_id, $revert_ids ? $doc_id : $id, false, (int) $strict);
        }
        if (isset($display_info) && $display_info) {
            echo '</div>';
        }
        ?>
    </div>
<?php 
    }
    ?>
Пример #30
0
<?php

use_helper('Language', 'Viewer', 'sfBBCode', 'SmartFormat', 'Field', 'SmartDate');
// lang-independent content starts here
$i18n = $item['OutingI18n'][0];
echo '<span class="item_title">' . format_date($item['date'], 'dd/MM/yyyy') . ' - ' . get_paginated_activities($item['activities']) . ' - ' . link_to($i18n['name'], '@document_by_id_lang_slug?module=outings&id=' . $i18n['id'] . '&lang=' . $i18n['culture'] . '&slug=' . make_slug($i18n['name'])) . ' - ' . displayWithSuffix($item['max_elevation'], 'meters') . ' - ' . field_route_ratings_data($item, false, true);
if (isset($item['nb_images'])) {
    echo ' - ' . picto_tag('picto_images', __('nb_linked_images')) . '&nbsp;' . $item['nb_images'];
}
if (isset($item['nb_comments'])) {
    echo ' - ' . picto_tag('action_comment', __('nb_comments')) . '&nbsp;' . link_to($item['nb_comments'], '@document_comment?module=outings&id=' . $item['OutingI18n'][0]['id'] . '&lang=' . $item['OutingI18n'][0]['culture']);
}
echo '</span>';
$participants = _format_text_data('participants', $i18n['participants'], null, array('needs_translation' => false, 'show_label' => false, 'show_images' => false));
$documents_versions_id = null;
foreach ($item['versions'] as $version) {
    if (!$documents_versions_id || $version['documents_versions_id'] < $documents_versions_id) {
        $documents_versions_id = $version['documents_versions_id'];
        $author_info_name = $version['history_metadata']['user_private_data']['topo_name'];
        $author_info_id = $version['history_metadata']['user_private_data']['id'];
    }
}
$author = _format_data('author', link_to($author_info_name, '@document_by_id?module=users&id=' . $author_info_id));
echo '<div class="all_associations col_left col_66">';
include_partial('documents/association', array('associated_docs' => array(), 'extra_docs' => array($author, $participants), 'module' => 'users', 'inline' => true));
echo '</div>';
$geoassociations = $item['geoassociations'];
echo '<div class="all_associations col_right col_33">';
include_partial('areas/association', array('associated_docs' => $geoassociations, 'module' => 'areas'));
echo '</div>';
?>