forked from mappiamo/mapi-geoCMS
/
content.php
82 lines (62 loc) · 2.17 KB
/
content.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
// no direct access to this file
defined( 'DACCESS' ) or die;
class MModule_Content extends M_Module {
private $content;
private $content_id;
public function content() {
$task = $this->get_task();
if ( ! $task ) {
//getting language
$language = new M_Language;
$lang = $language->getLanguage();
$this->content = MObject::get( 'content', $this->get_object() );
//print_r($this->content); die();
if( $lang == $this->content->get_language() ) {
//var_dump($lang); die();//megfelel a nyelv, kiolvassuk.
$this->content = MObject::get( 'content', $this->get_object() );
}
else {
//nem felel meg, megnezzuk van-e olyan nyelvu forditasa
$this->content_id = $this->model( 'get_translation', array( "content" => $this->get_object(), "lang" => strval( $lang ) ) );
$this->content = MObject::get( 'content', intval( $this->content_id ) );
}
if ( $this->content ) {
global $content;
$content = $this->content;
if ($this->content->is_enabled() == FALSE) {
header( 'Location: index.php?module=page404' );
exit( 0 );
}
global $coords;
$coords['lat'] = $this->content->get_lat();
$coords['lng'] = $this->content->get_lng();
$this->set_page_title( $this->content->get_title() );
$content_meta = $content->get_meta();
if ( sizeof( $content_meta ) > 0 ) {
foreach ( $content_meta as $meta ) {
switch ( $meta->name ) {
case 'description':
case 'keywords':
case 'author':
case 'robots':
$this->add_page_meta( $meta->name, $meta->value );
break;
}
}
}
$this->model( 'add_hit', $content->get_id() );
$this->view( 'default', $content );
} else {
header( 'Location: index.php?module=page404' );
exit( 0 );
}
}
}
public function get_category() {
$this->set_as_ajax();
$contents = $this->model( 'add_category', $this->get_object(), 'content_map' );
echo json_encode( $contents );
}
}
?>