function truncate_description($description, $route, $length = 500, $has_abstract = false)
{
    if ($has_abstract) {
        $description = extract_abstract($description);
    }
    $more = '... <span class="more_text">' . link_to('[' . __('Read more') . ']', $route) . '</span>';
    return parse_links(parse_bbcode_simple(truncate_text($description, $length, $more)));
}
 /**
  * Executes view action.
  */
 public function executeView()
 {
     parent::executeView();
     $mobile_version = c2cTools::mobileVersion();
     if (!$this->document->isArchive() && $this->document['redirects_to'] == NULL) {
         sfLoader::loadHelpers(array('Pagination'));
         $user = $this->getUser();
         $prefered_cultures = $user->getCulturesForDocuments();
         $document = $this->document;
         $id = $this->document->get('id');
         $topo_filter = $this->document->get('topo_filter');
         $url_params = array();
         $main_params = unpackUrlParameters($topo_filter, $main_url_params);
         // map filter
         $has_map = $this->document->get('has_map');
         $has_map = !$mobile_version && !empty($has_map);
         $this->has_map = $has_map;
         if ($has_map) {
             $map_filter_temp = $this->document->get('map_filter');
             $map_filter_temp = str_replace(' ', '', $map_filter_temp);
             $map_filter_temp = explode('|', $map_filter_temp);
             $map_filter = array();
             foreach ($map_filter_temp as $filter) {
                 $filter = explode(':', $filter);
                 if (isset($filter[1])) {
                     $map_filter[$filter[0]] = $filter[1];
                 }
             }
             if (empty($map_filter['objects'])) {
                 $map_filter['objects'] = null;
             }
             if (!empty($map_filter['lon']) || !empty($map_filter['lat']) || !empty($map_filter['zoom'])) {
                 if (empty($map_filter['lon'])) {
                     $lon = $this->document->get('lon');
                     if (is_null($lon)) {
                         $lon = 7;
                     }
                 } else {
                     $lon = $map_filter['lon'];
                 }
                 if (empty($map_filter['lat'])) {
                     $lat = $this->document->get('lat');
                     if (is_null($lat)) {
                         $lat = 45.5;
                     }
                 } else {
                     $lat = $map_filter['lat'];
                 }
                 if (empty($map_filter['zoom'])) {
                     $zoom = 6;
                 } else {
                     $zoom = $map_filter['zoom'];
                 }
                 $map_filter['center'] = array($lon, $lat, $zoom);
             } else {
                 $map_filter['center'] = null;
             }
             if (empty($map_filter['height'])) {
                 $map_filter['height'] = null;
             }
             $this->map_filter = $map_filter;
             $this->has_geom = false;
         }
         // user filters:
         $perso = c2cPersonalization::getInstance();
         $langs = $ranges = $activities = array();
         if ($perso->isMainFilterSwitchOn()) {
             $langs = $perso->getLanguagesFilter();
             $names = array_keys($main_params);
             if (!array_intersect($names, array('areas', 'summits', 'sites', 'huts', 'parkings', 'routes', 'books'))) {
                 $ranges = $perso->getPlacesFilter();
             }
             if (!in_array('act', $names)) {
                 $activities = $perso->getActivitiesFilter();
             }
         }
         // latest outings
         $nb_outings = $this->document->get('nb_outings');
         $has_outings = !empty($nb_outings);
         $this->has_outings = $has_outings;
         if ($has_outings) {
             $outing_url_params = array();
             $outing_params = $this->document->get('outing_filter');
             $outing_params = unpackUrlParameters($outing_params, $outing_url_params);
             $outing_langs = $langs;
             $outing_ranges = $ranges;
             $outing_activities = $activities;
             if (isset($outing_params['perso'])) {
                 $perso_params = explode('-', $outing_params['perso']);
                 if (array_intersect(array('areas', 'act', 'cult', 'no'), $perso_params)) {
                     if (!in_array('cult', $perso_params)) {
                         $outing_langs = array();
                     }
                     if (!in_array('areas', $perso_params)) {
                         $outing_ranges = array();
                     }
                     if (!in_array('act', $perso_params)) {
                         $outing_activities = array();
                     }
                 }
             }
             $latest_outings = Outing::listLatest($nb_outings, $outing_langs, $outing_ranges, $outing_activities, $outing_params);
             // choose best language for outings and regions names
             $latest_outings = Language::getTheBest($latest_outings, 'Outing');
             $this->latest_outings = Language::getTheBestForAssociatedAreas($latest_outings);
             $this->outing_url_params = $outing_url_params;
         }
         // latest articles
         $nb_articles = $this->document->get('nb_articles');
         $has_articles = !empty($nb_articles);
         $this->has_articles = $has_articles;
         if ($has_articles) {
             $article_url_params = array();
             $article_params = $this->document->get('article_filter');
             $article_params = unpackUrlParameters($article_params, $article_url_params);
             $this->latest_articles = Article::listLatest($nb_articles, $langs, $activities, $article_params);
             $this->article_url_params = $article_url_params;
         }
         // latest images
         if ($mobile_version) {
             $nb_images = sfConfig::get('app_recent_documents_images_mobile_limit');
         } else {
             $nb_images = $this->document->get('nb_images');
         }
         $has_images = !empty($nb_images);
         $this->has_images = $has_images;
         if ($has_images) {
             $image_url_params = array();
             $image_params = $this->document->get('image_filter');
             $image_params = unpackUrlParameters($image_params, $image_url_params);
             $latest_images = Image::listLatest($nb_images, $langs, $ranges, $activities, $image_params);
             $this->latest_images = Language::getTheBest($latest_images, 'Image');
             $this->image_url_params = $image_url_params;
         }
         // latest videos
         $nb_videos = $this->document->get('nb_videos');
         $has_videos = !$mobile_version && !empty($nb_videos);
         if ($has_videos) {
             $video_url_params = array();
             $video_params = $this->document->get('video_filter');
             $video_params = explode('|', $video_params, 3);
             if (count($video_params) == 3) {
                 $video_item = array('url' => trim($video_params[0]), 'thumbnail' => trim($video_params[1]), 'title' => trim($video_params[2]));
                 $latest_videos = array($video_item);
                 $this->latest_videos = $latest_videos;
             } else {
                 $has_videos = false;
             }
         }
         $this->has_videos = $has_videos;
         // forum 'mountain news' latest active threads
         $nb_news = $this->document->get('nb_news');
         $has_news = !empty($nb_news);
         $this->has_news = $has_news;
         $news_filter_ids = array();
         if ($has_news) {
             $news_filter_temp = $this->document->get('news_filter');
             $news_filter_temp = explode('|', $news_filter_temp);
             $news_filter = array();
             foreach ($news_filter_temp as $filter) {
                 $filter = explode(':', $filter);
                 if (isset($filter[1])) {
                     $news_filter[$filter[0]] = explode(',', $filter[1]);
                 }
             }
             $news_filter_ids = PunbbTopics::getForumIds('app_forum_mountain_news', $langs, $activities, $news_filter);
             $this->latest_mountain_news = PunbbTopics::listLatestById($nb_news, $news_filter_ids);
             $this->news_filter_ids = implode('-', $news_filter_ids);
         }
         // forum latest active threads
         $nb_topics = $this->document->get('nb_topics');
         $has_topics = !empty($nb_topics);
         $this->has_topics = $has_topics;
         if ($has_topics) {
             $forum_filter_temp = $this->document->get('forum_filter');
             $forum_filter_temp = explode('|', $forum_filter_temp);
             $forum_filter = array();
             foreach ($forum_filter_temp as $filter) {
                 $filter = explode(':', $filter);
                 if (isset($filter[1])) {
                     $forum_filter[$filter[0]] = explode(',', $filter[1]);
                 }
             }
             $forum_filter_ids = PunbbTopics::getForumIds('app_forum_public_ids', $langs, $activities, $forum_filter);
             $this->latest_threads = PunbbTopics::listLatestById($nb_topics, $forum_filter_ids);
             $this->forum_filter_ids = implode('-', array_merge($news_filter_ids, $forum_filter_ids));
         }
         $cda_config = sfConfig::get('app_portals_cda');
         if ($id == $cda_config['id']) {
             $description = $this->document->get('description');
             $has_description = !empty($description);
             $this->has_description = $has_description;
             $this->setTemplate('changerdapproche');
         }
         sfLoader::loadHelpers(array('sfBBCode', 'SmartFormat'));
         $abstract = strip_tags(parse_links(parse_bbcode_abstract($this->document->get('abstract'))));
         $this->getResponse()->addMeta('description', $abstract);
     }
 }
Exemple #3
0
        } 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 link_to($custom_footer_text, $custom_title_link) . ' - ' . link_to(__('Summary'), getMetaArticleRoute('home_articles'));
?>
</div>
</div>
Exemple #4
0
        $conditions_levels_string = conditions_levels_data($conditions_levels);
    }
    $avalanche_string = '';
    if ($has_avalanche_date) {
        $avalanche_desc_string = '';
        if ($has_avalanche_desc) {
            $avalanche_desc_string .= parse_links(parse_bbcode($avalanche_desc, $images, false));
        }
        $avalanche_title = content_tag('div', __('avalanche_infos'), array('class' => 'section_subtitle htext', 'id' => '_avalanche_infos', 'data-tooltip' => '')) . '<div class="field_value"' . $lang . '>';
        $avalanche_date_string = field_data_from_list_if_set($document, 'avalanche_date', 'mod_outings_avalanche_date_list', array('multiple' => true, 'raw' => true));
        $avalanche_date_string = '<p class="avalanche_date">' . c2cTools::multibyte_ucfirst(trim($avalanche_date_string)) . '.' . '</p>';
        $avalanche_string = $avalanche_title . $avalanche_date_string . $avalanche_desc_string . '</div>';
    }
    $conditions_string = '';
    if ($has_conditions) {
        $conditions_string = parse_links(parse_bbcode($conditions, $images, false));
    }
    if ($has_conditions_levels) {
        if ($has_conditions) {
            $conditions_string = '<div class="field_value"' . $lang . '>' . $conditions_string . '</div>';
        }
        $conditions_string = $outing_route_desc_string . $conditions_title . $conditions_levels_string . '</div>' . '<div class="col_left col_66">' . $conditions_string . $avalanche_string . '</div>' . $other_conditions;
    } else {
        $conditions_string = '<div class="col_left col_66 hfirst">' . $outing_route_desc_string . $conditions_title . $conditions_string . '</div>' . $avalanche_string . $other_conditions . '</div>';
    }
    echo $conditions_string;
} elseif (!empty($other_conditions)) {
    echo $other_conditions;
}
$col_weather_or_timing = $has_weather_or_timing && ($has_conditions || !$has_conditions_levels && !empty($other_conditions) && $has_access_or_hut || $has_access_or_hut);
if ($has_weather_or_timing) {
{
    $int = intval($int);
    for ($i = 0; $i < $cnt - strlen($int); $i++) {
        $nulls .= '0';
    }
    return $nulls . $int;
}
function gen_data_dir($id)
{
    $floor = $id - $id % 100;
    $zfilled = add_nulls($floor, 5);
    $xed = substr($zfilled, 0, 3) . "XX";
    return $xed;
}
$data['desc'] = cleanup_html($data['desc']);
$data['links'] = parse_links($data['links']);
$data['categories'] = parse_categories($data['categories']);
$data['copyright'] = cleanup_html($data['copyright']);
$data['path_to_lores_img'] = $path_to_data . "lores/" . gen_data_dir($id) . "/" . add_nulls($id, 5) . ".jpg";
$data['path_to_thumb_img'] = $path_to_data . "thumbs/" . gen_data_dir($id) . "/" . add_nulls($id, 5) . ".jpg";
$data['path_to_hires_img'] = $path_to_data . "hires/" . gen_data_dir($id) . "/" . add_nulls($id, 5) . ".tif";
/* deprecated: we gave up on sqlite
$db_filename = "sqlite:/home/pyrak/workspace/collect-phil-cdc/phil.cdc.sqlite";
$db_handle = sqlite_open($db_filename);
$db_selectall_query = "select * from phil";
$id = 1;
$db_select_by_id_query = "select * from phil where id = " + $id;
sqlite_unbuffered_query($db_handle, $db_select_by_id_query);
 */
?>
Exemple #6
0
echo "Fetching course curriculum....\n";
$course['options'] = $urls['course']['options'];
$course['options']['headers'] = array_merge($course['options']['headers'], ['X-Udemy-Bearer-Token: ' . $user['accesstoken']]);
$course['link'] = str_replace(':courseId', $courseId, $urls['course']['link']);
$course['response'] = common_curl($course['link'], $urls['course']['method'], $course['options']);
$course['extras'] = true;
if ($course['response']['status'] != 200) {
    $course['response'] = common_curl(str_replace('extras,', '', $course['link']), $urls['course']['method'], $course['options']);
    $course['extras'] = false;
}
if ($course['response']['status'] != 200) {
    die("Error fetching course details");
}
$course['decoded_response'] = json_decode($course['response']['body'], true);
echo "Parsing links....\n";
$course['download_links'] = parse_links($courseId, $course['decoded_response'], $course['extras']);
// ***********************************************
//                Download Course
// ***********************************************
echo "Downloading course....\n";
if (!file_exists($basedir)) {
    mkdir($basedir);
}
download_folder($basedir, $course['download_links'], $start, $end, $list, $downloader);
switch ($downloader) {
    case 'idm':
        exec("idman /s");
        echo "Course added to IDM and downloading started.\n";
        break;
    default:
        echo "Course download complete.\n";
Exemple #7
0
 function detect_links($s, $cached = 1)
 {
     // find urls in text and turn them into links
     return parse_links($s, $cached);
 }
function smart_format($string)
{
    return parse_links($string, 'translation', false);
}
Exemple #9
0
function show_file($file_id, $user, $success = null)
{
    global $LSP_URL, $DATA_DIR;
    $dbh =& get_db();
    $stmt = $dbh->prepare('SELECT licenses.name AS license, size, realname, filename, users.login, ' . 'categories.name AS category, subcategories.name AS subcategory,' . 'insert_date, update_date, description, downloads, files.id FROM files ' . 'INNER JOIN categories ON categories.id=files.category ' . 'INNER JOIN subcategories ON subcategories.id=files.subcategory ' . 'INNER JOIN users ON users.id=files.user_id ' . 'INNER JOIN licenses ON licenses.id=files.license_id ' . 'WHERE files.id=:file_id');
    $stmt->bindParam(':file_id', $file_id);
    $found = false;
    if ($stmt->execute()) {
        while ($object = $stmt->fetch(PDO::FETCH_ASSOC)) {
            $title = array($object['category'], $object['subcategory'], get_file_url($file_id));
            if ($success == null) {
                echo '<div class="col-md-9">';
                create_title($title);
            } else {
                if ($success === true) {
                    display_success("Updated successfully", $title);
                    echo '<div class="col-md-9">';
                } else {
                    if ($success === false) {
                        display_error("Update failed.", $title);
                        echo '<div class="col-md-9">';
                    } else {
                        display_success("{$success}", $title);
                    }
                }
            }
            echo '<table class="table table-striped">';
            show_basic_file_info($object, false);
            // Bump the download button under details block
            $url = htmlentities('download_file.php?file=' . $object['id'] . '&name=' . $object['filename']);
            echo '<tr><td><strong>Name:</strong>&nbsp;' . $object['filename'];
            if (is_image($url)) {
                echo '<br><br><a href="' . $url . '"><img class="thumbnail" src="' . scale_image($DATA_DIR . $file_id, 300, parse_extension($url)) . '" alt=""></a>';
            }
            echo '</td><td class="lsp-file-info">';
            echo '<a href="' . $url . '" id="downloadbtn" class="lsp-dl-btn btn btn-primary">';
            echo '<span class="fa fa-download lsp-download"></span>&nbsp;Download</a>';
            echo '</td></tr>';
            echo '<tr><td colspan="2"><div class="well"><strong>Description:</strong><p>';
            echo $object['description'] != '' ? parse_links(newline_to_br($object['description'], true)) : 'No description available.';
            echo '</p></div></td></tr>';
            echo '<tr><td colspan="2">';
            echo '<nav id="lspnav" class="navbar navbar-default"><ul class="nav navbar-nav">';
            $can_edit = $object['login'] == $user || is_admin(get_user_id($user));
            $can_rate = !SESSION_EMPTY();
            $rate_self = $object['login'] == $user;
            global $LSP_URL;
            create_toolbar_item('Comment', "{$LSP_URL}?comment=add&file={$file_id}", 'fa-comment', $can_rate);
            create_toolbar_item('Edit', "{$LSP_URL}?content=update&file={$file_id}", 'fa-pencil', $can_edit);
            create_toolbar_item('Delete', "{$LSP_URL}?content=delete&file={$file_id}", 'fa-trash', $can_edit);
            $star_url = $LSP_URL . '?' . file_show_query_string() . '&rate=';
            create_toolbar_item(get_stars($file_id, $star_url, $rate_self ? false : $can_rate), '', null, $can_rate, $rate_self);
            echo '</ul></nav>';
            echo '<strong>Comments:</strong>';
            echo '</td></tr>';
            get_comments($file_id);
            echo '</table></div>';
            $found = true;
            break;
        }
    }
    if (!$found) {
        display_error('Invalid file: "' . sanitize($file_id) . '"');
    }
    $stmt = null;
    $dbh = null;
}
 /**
  * Executes view action.
  */
 public function executeView()
 {
     sfLoader::loadHelpers(array('General'));
     parent::executeView();
     if (!$this->document->isArchive() && $this->document['redirects_to'] == NULL) {
         // Add the summit name to route
         $associated_routes = array_filter($this->associated_docs, array('c2cTools', 'is_route'));
         $associated_routes = Route::addBestSummitName($associated_routes, $this->__(' :') . ' ');
         // Include outings additional data
         $associated_outings = array_filter($this->associated_docs, array('c2cTools', 'is_outing'));
         $associated_outings = Outing::fetchAdditionalFields($associated_outings);
         // group all linked docs except images in a single list
         $associated_docs = array_filter($this->associated_docs, array('c2cTools', 'is_not_route'));
         $associated_docs = array_filter($associated_docs, array('c2cTools', 'is_not_outing'));
         $associated_docs = array_filter($associated_docs, array('c2cTools', 'is_not_image'));
         $associated_docs = array_merge($associated_docs, $associated_routes, $associated_outings);
         // sort by document type, name
         if (count($associated_docs)) {
             foreach ($associated_docs as $key => $row) {
                 $module[$key] = $row['module'];
                 $name[$key] = remove_accents($row['name']);
             }
             array_multisort($module, SORT_STRING, $name, SORT_STRING, $associated_docs);
         }
         $this->associated_users = array_filter($associated_docs, array('c2cTools', 'is_user'));
         $this->associated_documents = $associated_docs;
         // Retrieve linked docs areas (except users)
         $parent_ids = array();
         $associated_areas = array();
         foreach ($this->associated_docs as $doc) {
             if ($doc['module'] != 'users') {
                 $parent_ids[] = $doc['id'];
             }
         }
         if (count($parent_ids)) {
             $prefered_cultures = $this->getUser()->getCulturesForDocuments();
             $associated_areas = GeoAssociation::findAreasWithBestName($parent_ids, $prefered_cultures);
         }
         $this->associated_areas = $associated_areas;
         // retrieve related portals, depending on article category
         // Soft mobility articles => changedapproche
         // ice activity + gear, stories or expeditions => ice portal
         $related_portals = array();
         $activities = $this->document->get('activities');
         $categories = $this->document->get('categories');
         if (in_array(7, $categories)) {
             $related_portals[] = 'cda';
         }
         if (array_intersect(array(2, 3, 8), $categories) && in_array(5, $activities)) {
             $related_portals[] = 'ice';
         }
         Portal::getLocalPortals($related_portals, $associated_areas);
         $this->related_portals = $related_portals;
         sfLoader::loadHelpers(array('sfBBCode', 'SmartFormat'));
         $abstract = strip_tags(parse_links(parse_bbcode_abstract($this->document->get('abstract'))));
         $this->getResponse()->addMeta('description', $abstract);
         if (in_array(100, $categories)) {
             $this->getResponse()->addMeta('robots', 'noindex, follow');
         }
     }
 }
        } else {
            $remarks = null;
        }
        $gear = $item_i18n['gear'];
        if (check_not_empty($gear) && !$gear instanceof sfOutputEscaperObjectDecorator) {
            if ($text_html) {
                $gear = parse_links(parse_bbcode($gear, null, false, false));
            }
        } else {
            $gear = null;
        }
        $external_resources = $item_i18n['external_resources'];
        if (check_not_empty($external_resources) && !$external_resources instanceof sfOutputEscaperObjectDecorator) {
            if ($text_html) {
                $external_resources = parse_links(parse_bbcode($external_resources, null, false, false));
            }
        } else {
            $external_resources = null;
        }
        $route_history = $item_i18n['route_history'];
        if (check_not_empty($route_history) && !$route_history instanceof sfOutputEscaperObjectDecorator) {
            if ($text_html) {
                $route_history = parse_links(parse_bbcode($route_history, null, false, false));
            }
        } else {
            $route_history = null;
        }
        $properties = array_merge($properties, array('description' => $description, 'remarks' => $remarks, 'gear' => $gear, 'externalResources' => $external_resources, 'routeHistory' => $route_history));
    }
}
echo json_encode(array('type' => 'Feature', 'id' => $item['id'], 'properties' => $properties, 'geometry' => $add_gpx_track ? geojson_geometry($item) : null));
}
?>
    </ul>
<?php 
$activities = BaseDocument::convertStringToArray($item['activities']);
if (!array_intersect(array(1, 2, 5), $activities)) {
    $conditions_levels = NULL;
}
echo '<div class="col_left col_66">';
if (!empty($conditions) || !empty($conditions_levels)) {
    echo '<div class="section_subtitle htext" id="_conditions">' . __('conditions') . '</div><div class="field_value">';
    $conditions_levels = $item['conditions_levels'];
    if (!empty($conditions_levels) && count($conditions_levels)) {
        conditions_levels_data($conditions_levels);
    }
    echo parse_links(parse_bbcode($conditions, null, false));
    echo $other_conditions;
    echo '</div>';
    if ($needs_translation) {
        echo '</div>';
    }
}
echo '</div>';
echo '<div class="col_right col_33">';
echo _format_text_data('weather', $item['weather'], null, array('show_images' => false));
echo _format_text_data('timing', $item['timing'], null, array('show_images' => false));
echo '</div>';
echo '<div class="col_left col_66">';
echo _format_text_data('access_comments', $item['access_comments'], null, array('show_images' => false));
echo '</div>';
echo '<div class="col_left col_66">';
Exemple #13
0
         echo "<b>Τηλέφωνο:</b> " . $sub->get_field(228) . "<br/>";
     }
     if ($sub->get_field(229)) {
         echo "<b>Νομικό Πρόσωπο:</b> " . $sub->get_field(229) . "<br/>";
     }
     if ($sub->get_field(240)) {
         echo "<b>Μέσα Κοινωνικής Δικτύωσης:</b> " . parse_links($sub->get_field(240)) . "<br/>";
     }
     if ($sub->get_field(237)) {
         echo "<b>Ιστοσελίδα:</b> " . parse_links($sub->get_field(237)) . "<br/>";
     }
     if (strlen($sub->get_field(232)) > 2) {
         echo "<div class=\"more\"><b>Βιογραφικό Σημείωμα:</b> " . $sub->get_field(232) . "</div><br/>";
     }
     if (strlen($sub->get_field(233)) > 2) {
         echo "<div class=\"more\"><b>Περιγραφή προσφερόμενων υπηρεσιών:</b> " . htmlspecialchars_decode(parse_links($sub->get_field(233))) . "</div><br/>";
     }
     if ($sub->get_field(259)) {
         //str_replace(" ", "Άλλες δράσεις (Αν το επιλέξετε συμπληρώστε και το παρακάτω πεδίο)");
         $dr = implode(". ", $sub->get_field(259));
         $dr_ = str_replace("(Αν το επιλέξετε συμπληρώστε και το παρακάτω πεδίο)", "", $dr);
         if (strlen($dr_)) {
             echo "<div class=\"more\"><b>Εθελοντικές δράσεις:</b> " . htmlspecialchars_decode($dr_) . "</div><br/>";
         }
     }
     if (strlen($sub->get_field(293)) > 2) {
         echo "<div class=\"more\"><b>Άλλες εθελοντικές δράσεις:</b> " . htmlspecialchars_decode($sub->get_field(293)) . "</div><br/>";
     }
     echo "<hr><br/>";
 }
 ?>
Exemple #14
0
<?php

use_helper('sfBBCode', 'SmartFormat');
echo $needs_translation ? '<div class="translatable">' : '';
echo '<div class="field_value">';
echo '<p class="abstract">', parse_links(parse_bbcode_abstract($document->get('abstract'))), '</p>';
if ($document->get('description')) {
    echo parse_links(parse_bbcode($document->get('description'), $images, $filter_image_type));
}
echo '</div>';
echo $needs_translation ? '</div>' : '';
$design_files = explode(',', $design_files);
if (count($design_files)) {
    foreach ($design_files as $file) {
        $file = trim($file);
        if (!empty($file)) {
            use_stylesheet('/static/css/' . $file . '.css', 'custom');
        }
    }
}
echo init_js_var(true, 'home_nav', $connected);
echo '<div id="cda_context" class="home article portals_content">';
if (!$mobile_version) {
    echo '<div id="cda_background_left">';
    $lang = $document->getCulture();
    $abstract = $document->get('abstract');
    $abstract = parse_links(parse_bbcode_abstract($abstract));
    $title = __('changerdapproche');
    $know_more_link = getMetaArticleRoute('cda_know_more', false);
    include_partial('portals/welcome', array('sf_cache_key' => $id . '_' . $culture . '_' . $lang, 'title' => $title, 'description' => $abstract, 'know_more_link' => $know_more_link, 'default_open' => true));
    include_partial('portals/wizard_button', array('sf_cache_key' => ($connected ? 'connected' : 'not_connected') . '_' . $culture));
    if ($has_videos) {
        include_partial('portals/latest_videos', array('items' => $latest_videos, 'culture' => $culture, 'default_open' => true));
    }
    if ($has_images && $has_map) {
        echo '<div id="last_images">';
        $image_url_params = $sf_data->getRaw('image_url_params');
        $image_url_params = implode('&', $image_url_params);
        $custom_title_link = 'images/list';
        $custom_rss_link = 'images/rss';
        if (!empty($image_url_params)) {
            $custom_title_link .= '?' . $image_url_params;
function _format_text_data($name, $value, $label = NULL, $options = array())
{
    use_helper('sfBBCode', 'SmartFormat');
    if (empty($label)) {
        $label = $name;
    }
    $has_value = !empty($value);
    $needs_translation = _option($options, 'needs_translation', false);
    $inserted = _option($options, 'inserted_text', '');
    $images = _option($options, 'images', null);
    $filter_image_type = _option($options, 'filter_image_type', true);
    $show_label = _option($options, 'show_label', true);
    $show_images = _option($options, 'show_images', true);
    $class = _option($options, 'class', '');
    $label_id = _option($options, 'label_id', $name);
    if (!empty($class)) {
        $class = ' ' . $class;
    }
    if ($show_label) {
        $label = content_tag('div', __($label), array('class' => 'section_subtitle htext', 'id' => '_' . $label_id, 'data-tooltip' => '')) . "\n";
    } else {
        $label = '';
    }
    $out = $label . $inserted;
    if ($has_value) {
        $lang = $needs_translation ? ' lang="' . $needs_translation . '"' : '';
        $out .= '<div class="field_value"' . $lang . '>' . parse_links(parse_bbcode($value, $images, $filter_image_type, $show_images)) . '</div>';
    }
    return $out;
}
$date = field_semantic_date_data($document, 'date');
$is_not_archive = !$document->isArchive();
$is_not_merged = !$document->get('redirects_to');
$mobile_version = c2cTools::mobileVersion();
$show_link_to_delete = $is_not_archive && $is_not_merged && $is_moderator && !$mobile_version;
$show_link_tool = $is_not_archive && $is_not_merged && $is_connected && !$mobile_version;
$activities = $document->getRaw('activities');
$has_wkt = (bool) $document->get('geom_wkt');
$section_list = array('map' => $has_wkt, 'elevation_profile' => $has_wkt, 'images' => $is_connected || count($associated_images));
display_page_header('outings', $document, $id, $metadata, $current_version, array('prepend' => $date, 'separator' => ', ', 'nav_options' => $section_list, 'item_type' => 'http://schema.org/Article', 'nb_comments' => $nb_comments));
// lang-independent content starts here
echo start_section_tag('Information', 'data');
$participants = explode("\n", $document->get('participants'), 2);
$participants_str = trim($participants[0]);
if (!empty($participants_str)) {
    $participants_0 = parse_links(parse_bbcode_simple($participants_str));
} else {
    $participants_0 = '';
}
if (isset($participants[1])) {
    $participants_1 = _format_text_data('participants', $participants[1], null, array('needs_translation' => $needs_translation, 'show_label' => $document->isArchive(), 'show_images' => false));
} else {
    $participants_1 = '';
}
echo '<div class="all_associations col_left col_66">';
if ($is_not_archive && $is_not_merged) {
    include_partial('documents/association', array('associated_docs' => $associated_users, 'extra_docs' => array($participants_1), 'module' => 'users', 'document' => $document, 'inline' => true, 'merge_inline' => $participants_0, 'show_link_to_delete' => $show_link_to_delete, 'type' => 'uo', 'strict' => true));
    include_partial('routes/association', array('associated_docs' => $associated_routes, 'module' => 'routes', 'document' => $document, 'show_link_to_delete' => $show_link_to_delete, 'type' => 'ro', 'strict' => true, 'display_info' => true));
    include_partial('documents/association', array('associated_docs' => $associated_sites, 'module' => 'sites', 'document' => $document, 'show_link_to_delete' => $show_link_to_delete, 'type' => 'to', 'strict' => false));
    // no strict looking for main_id in column main of Association table
} else {
    $outing_with_public_transportation = empty($outing_with_public_transportation) ? false : true;
    $properties = array_merge($properties, array('minElevation' => doctrine_value($item['min_elevation']), 'heightDiffDown' => doctrine_value($item['height_diff_down']), 'outingLength' => doctrine_value($item['outing_length']), 'partialTrip' => $partial_trip, 'usePublicTransportation' => $outing_with_public_transportation, 'trackStatus' => $use_keys ? $track_status : @$track_statuses[$track_status], 'hutStatus' => $use_keys ? $hut_status : @$hut_statuses[$hut_status], 'liftStatus' => $use_keys ? $lift_status : @$lift_statuses[$lift_status]));
    if ($add_text) {
        $access_comments = $item_i18n['access_comments'];
        if (check_not_empty($access_comments) && !$access_comments instanceof sfOutputEscaperObjectDecorator) {
            if ($text_html) {
                $access_comments = parse_links(parse_bbcode($description, null, false, false));
            }
        } else {
            $access_comments = null;
        }
        $hut_comments = $item_i18n['hut_comments'];
        if (check_not_empty($hut_comments) && !$hut_comments instanceof sfOutputEscaperObjectDecorator) {
            if ($text_html) {
                $hut_comments = parse_links(parse_bbcode($hut_comments, null, false, false));
            }
        } else {
            $hut_comments = null;
        }
        $description = $item_i18n['description'];
        if (check_not_empty($description) && !$description instanceof sfOutputEscaperObjectDecorator) {
            if ($text_html) {
                $description = parse_links(parse_bbcode($description, null, false, false));
            }
        } else {
            $description = null;
        }
        $properties = array_merge($properties, array('accessComments' => $access_comments, 'hutComments' => $hut_comments, 'outingComments' => $description));
    }
}
echo json_encode(array('type' => 'Feature', 'id' => $item['id'], 'properties' => $properties, 'geometry' => $add_gpx_track ? geojson_geometry($item) : null));
Exemple #19
0
function parse_links(&$menu_items, &$menu_children, $links, $menu, &$smarty, $params)
{
    if (empty($links)) {
        return FALSE;
    }
    foreach ($links as $link) {
        $display_this_item = TRUE;
        if ($link['privileges']) {
            if (!$smarty->CI->user_model->in_group($link['privileges'])) {
                $display_this_item = FALSE;
            }
        }
        if ($display_this_item == TRUE) {
            if ($link['special_type'] == FALSE) {
                // calculate URL
                if ($link['external_url']) {
                    if (strstr($link['external_url'], ':')) {
                        // full http:// URL
                        $url = $link['external_url'];
                    } else {
                        $url = site_url($link['external_url']);
                    }
                } else {
                    // it's in the universal links database, and we have link_url_path
                    $url = site_url($link['link_url_path']);
                }
                // is it active?
                $active = FALSE;
                if ($link['external_url'] == TRUE and current_url() == $url) {
                    $active = TRUE;
                } elseif ($link['external_url'] == FALSE and trim($smarty->CI->uri->uri_string, '/') == trim($link['link_url_path'], '/')) {
                    $active = TRUE;
                }
                $menu_items[$link['id']] = array('text' => $link['text'], 'url' => $url, 'active' => $active, 'class' => $link['class'], 'is_child' => $link['parent_menu_link_id'] != '0' ? TRUE : FALSE);
            } else {
                // it's a special link
                if ($link['special_type'] == 'home') {
                    $menu_items[$link['id']] = array('text' => $link['text'], 'url' => site_url(), 'active' => $smarty->CI->uri->segment(1) == FALSE ? TRUE : FALSE, 'class' => $link['class'], 'is_child' => $link['parent_menu_link_id'] != '0' ? TRUE : FALSE);
                } elseif ($link['special_type'] == 'control_panel') {
                    $menu_items[$link['id']] = array('text' => $link['text'], 'url' => site_url('admincp'), 'active' => $smarty->CI->uri->segment(1) == 'admincp' ? TRUE : FALSE, 'class' => $link['class'], 'is_child' => $link['parent_menu_link_id'] != '0' ? TRUE : FALSE);
                } elseif ($link['special_type'] == 'my_account') {
                    $menu_items[$link['id']] = array('text' => $link['text'], 'url' => site_url('users'), 'active' => $smarty->CI->uri->segment(1) == 'users' ? TRUE : FALSE, 'class' => $link['class'], 'is_child' => $link['parent_menu_link_id'] != '0' ? TRUE : FALSE);
                    if ($smarty->CI->user_model->logged_in() and $link['parent_menu_link_id'] == '0' and ($params['show_sub_menus'] == 'yes' or $params['show_sub_menus'] == 'active' and $menu_items[$link['id']] == TRUE)) {
                        // add children
                        $menu_children[$link['id']][] = 'profile';
                        $menu_children[$link['id']][] = 'password';
                        if (module_installed('billing')) {
                            $menu_children[$link['id']][] = 'invoices';
                        }
                        $menu_children[$link['id']][] = 'logout';
                        $menu_items['profile'] = array('text' => 'Update Profile', 'url' => site_url('users/profile'), 'active' => ($smarty->CI->uri->segment(1) == 'users' and $smarty->CI->uri->segment(2) == 'profile') ? TRUE : FALSE, 'class' => 'account_profile', 'is_child' => TRUE);
                        $menu_items['password'] = array('text' => 'Change Password', 'url' => site_url('users/password'), 'active' => ($smarty->CI->uri->segment(1) == 'users' and $smarty->CI->uri->segment(2) == 'password') ? TRUE : FALSE, 'class' => 'account_password', 'is_child' => TRUE);
                        if (module_installed('billing')) {
                            $menu_items['invoices'] = array('text' => 'View Invoices', 'url' => site_url('users/invoices'), 'active' => ($smarty->CI->uri->segment(1) == 'users' and $smarty->CI->uri->segment(2) == 'invoices') ? TRUE : FALSE, 'class' => 'account_invoices', 'is_child' => TRUE);
                        }
                        $menu_items['logout'] = array('text' => 'Logout', 'url' => site_url('users/logout'), 'active' => ($smarty->CI->uri->segment(1) == 'users' and $smarty->CI->uri->segment(2) == 'logout') ? TRUE : FALSE, 'class' => 'account_logout', 'is_child' => TRUE);
                    }
                } elseif ($link['special_type'] == 'store' and module_installed('store')) {
                    $menu_items[$link['id']] = array('text' => $link['text'], 'url' => site_url('store'), 'active' => ($smarty->CI->uri->segment(1) == 'store' or $smarty->CI->uri->segment(1) == 'checkout') ? TRUE : FALSE, 'class' => $link['class'], 'is_child' => $link['parent_menu_link_id'] != '0' ? TRUE : FALSE);
                } elseif ($link['special_type'] == 'search') {
                    $menu_items[$link['id']] = array('text' => $link['text'], 'url' => site_url('search'), 'active' => $smarty->CI->uri->segment(1) == 'search' ? TRUE : FALSE, 'class' => $link['class'], 'is_child' => $link['parent_menu_link_id'] != '0' ? TRUE : FALSE);
                } elseif ($link['special_type'] == 'subscriptions' and module_installed('billing')) {
                    $menu_items[$link['id']] = array('text' => $link['text'], 'url' => site_url('subscriptions'), 'active' => $smarty->CI->uri->segment(1) == 'subscriptions' ? TRUE : FALSE, 'class' => $link['class'], 'is_child' => $link['parent_menu_link_id'] != '0' ? TRUE : FALSE);
                } elseif ($link['special_type'] == 'cart') {
                    $menu_items[$link['id']] = array('text' => $link['text'], 'url' => site_url('users'), 'active' => $smarty->CI->uri->segment(1) == 'cart' ? TRUE : FALSE, 'class' => $link['class'], 'is_child' => $link['parent_menu_link_id'] != '0' ? TRUE : FALSE);
                }
            }
            // should we load children?
            // only if show_sub_menus parameter says so, and this isn't already a child link
            if ($link['parent_menu_link_id'] == '0' and ($params['show_sub_menus'] == 'yes' or $params['show_sub_menus'] == 'active' and $menu_items[$link['id']] == TRUE)) {
                // load children
                $links_children = $smarty->CI->menu_model->get_links(array('menu' => $menu['id'], 'parent' => $link['id']));
                if (is_array($links_children)) {
                    // track children
                    foreach ($links_children as $link_child) {
                        $menu_children[$link['id']][] = $link_child['id'];
                    }
                    parse_links($menu_items, $menu_children, $links_children, $menu, $smarty, $params);
                }
            }
        }
    }
}
Exemple #20
0
 /**
  * Curl the page, returning data as an array
  */
 $page_data = curl_page($url_data['url']);
 /**
  * Calculate the directory of the current page, used to parse relative URLs
  */
 $dir = parse_dir($url_data['url']);
 /**
  * Parse the title of the current page
  */
 $title = parse_title($page_data['html']);
 /**
  * Parse the HTML for links, store in an array
  */
 $links = parse_links($page_data['html']);
 /**
  * Loop through the array of links
  */
 foreach ($links as $key => &$link) {
     /**
      * Uniformly clean the link so we don't have duplicates (absolute, no anchors, add www., etc.)
      */
     $link = clean_link($link, $dir);
     /**
      * If the link is to an image, do not add it
      */
     if (is_image($link)) {
         continue;
     }
     /**
                }
                if ($has_hut_comments) {
                    echo parse_links(parse_bbcode($hut_comments, null, false, false));
                }
                ?>
</li><?php 
            }
            $outing_comments = $i18n['description'];
            if (check_not_empty($outing_comments) && !$outing_comments instanceof sfOutputEscaperObjectDecorator) {
                //FIXME sfOutputEscaperObjectDecorator
                ?>
                    <li><div class="section_subtitle" id="_description" data-tooltip=""><?php 
                echo __('comments');
                ?>
</div><?php 
                echo parse_links(parse_bbcode($outing_comments, null, false, false));
                ?>
</li>
                <?php 
            }
        }
        ?>
        </ul>
    <?php 
        if ($show_images && isset($item['linked_docs'])) {
            include_partial('images/linked_images', array('images' => $item['linked_docs'], 'module_name' => 'outings', 'document_id' => $item_id, 'user_can_dissociate' => false));
        }
        ?>
    </li>
    <?php 
    }