function mwidget_content($id) { $content = MObject::get('content', $id); $title_addon = $content->get_meta('title-addon'); if ($content) { ?> <h2 class="featurette-heading"><?php MPut::_html($content->get_title()); ?> <?php if ($title_addon) { ?> <br /> <span class="text-muted"><?php ' ' . MPut::_html($title_addon->get_value()); ?> </span> <?php } ?> </h2> <p class="lead"><?php MPut::_text($content->get_text()); ?> </p> <?php } }
public function category() { $this->category = MObject::get('category', $this->get_object()); if ($this->category && $this->category->get_id()) { $this->set_page_title($this->category->get_title()); $contents = $this->category->get_contents(); //getting language $language = new M_Language(); $lang = $language->getLanguage(); $filtered_contents = array(); foreach ($contents as $content) { if ($lang == $content->get_language()) { $mod = $content->modified(); $time = strtotime($mod['when']); $filtered_contents[$time] = $content; } } ksort($filtered_contents); $descending = array_reverse($filtered_contents); $this->view('default', array($descending, $this->category->get_title())); } else { header('Location: index.php?module=page404'); exit(0); } }
public function home() { $title = MObject::get('preference', 'website_title'); if (strlen($title->get_value()) > 0) { $this->set_page_title($title->get_value()); } }
static function facebook_login_link() { $appid = MObject::get('preference', 'facebook_app_id'); $secret = MObject::get('preference', 'facebook_secret'); $scope = array('scope' => 'user_events'); $facebook = new Facebook(array('appId' => $appid->get_value(), 'secret' => $secret->get_value(), 'allowSignedRequest' => false)); return $facebook->getLoginUrl($scope); }
static function get_menu($id) { $menu = MObject::get('menu', $id); if ($menu && $menu->get_id()) { return $menu; } return null; }
static function get_user($id) { $user = MObject::get('user', $id); if ($user->get_id()) { return $user; } return null; }
static function get_category($id) { $category = MObject::get('category', $id); if ($category->get_id()) { return $category; } return null; }
static function get_profile() { $profile = MObject::get('user', MAuth::user_id()); if ($profile->get_id()) { return $profile; } return null; }
static function remove_menu($page_id) { $id = MGet::int('menu_id'); $menu = MObject::get('menu', $id); if ($menu) { $menu->remove_page($page_id); $menu->update(false); } }
function mwidget_dropdownmenu($menu_item) { $menu_item = strtolower($menu_item); switch ($menu_item) { case "associarsi": $menu_id = 5; break; case "chi siamo": $menu_id = 6; break; case "eventi": $menu_id = 7; break; case "attivita'": $menu_id = 8; break; default: $menu_id = null; break; } $menu = MObject::get('menu', $menu_id); if ($menu) { $pages = $menu->get_pages(); ?> <ul style="margin:0;"> <?php if (sizeof($pages) > 0) { foreach ($pages as $page) { ?> <div style="position: relative; margin:6px; text-align:left;"> <li style="white-space:nowrap;"> <a href="<?php MPut::_link($page->get_url()); ?> " title="<?php MPut::_html_attr($page->get_title()); ?> " style="margin: 6px 0; font-size: 13px;"> <?php //MPut::_html( $page->get_title() ); ?> <?php __($page->get_title()); ?> </a> </li> </div> <?php } } ?> </ul> <?php } }
public function modified() { $modified = array('when' => $this->modified, 'by' => $this->modifiedby); $user = MObject::get('user', $this->modifiedby); if ($user && $user->get_username()) { $modified['by_user'] = $user->get_username(); } else { $modified['by_user'] = '******'; } return $modified; }
function mwidget_dividedmenu($menu_id, $class = null, $id = null) { $menu = MObject::get('menu', $menu_id); if ($class) { $class = ' class="' . MPut::html_attr($class) . '"'; } else { $class = ''; } if ($id) { $id = ' id="' . MPut::html_attr($id) . '"'; } else { $id = ''; } if ($menu) { $pages = $menu->get_pages(); if (sizeof($pages) > 0) { foreach ($pages as $page) { ?> <div<?php echo $class . $id; ?> style="position: relative;"> <a href="<?php MPut::_link($page->get_url()); ?> " title="<?php MPut::_html_attr($page->get_title()); ?> "> <?php //MPut::_html( $page->get_title() ); ?> <?php __($page->get_title()); ?> </a> <div style="display:none;background-color:#000;min-width:100%;position:absolute; left: 0px; top: 20px;text-align: center;z-index: 9999;" > <?php M_Template::widget('dropdownmenu', $page->get_title()); ?> </div> </div> <div class="visible-xs col-xs-3"></div> <div class="visible-xs col-xs-6"> <?php M_Template::widget('dropdownmenu', $page->get_title()); ?> </div> <div class="visible-xs col-xs-3"></div> <?php } } } }
private function route($env) { $request = mapi_request(); switch ($env) { case 'manager': if (isset($request['module'])) { $this->set_module(MGet::string('module')); } if (isset($request['task'])) { $this->set_task(MGet::string('task')); } if (isset($request['object'])) { $this->set_num_object_id(MGet::string('object')); } break; case 'frontend': $routing = 'default'; $pref = MObject::get('preference', 'routing'); if ($pref && is_object($pref) && 'sef' == $pref->get_value()) { $routing = 'sef'; } // sef routing here if (isset($request['module'])) { $this->set_module(MGet::string('module')); } if (isset($request['task'])) { $this->set_task(MGet::string('task')); } if (isset($request['object'])) { $this->set_num_object_id(MGet::string('object')); } break; } MAuth::init(); if ('manager' == $env) { if ('register' != $this->module) { if ('login' != $this->module && !MAuth::is_auth()) { $this->reset_to('login'); } elseif ('login' == $this->module && MAuth::is_auth() && !isset($_POST['do-logout'])) { $this->reset_to('dashboard'); } } else { if (MAuth::is_auth()) { $this->reset_to('dashboard'); } } if ('login' != $this->module && 'register' != $this->module) { //if ( ! MAuth::check_perm( self::$this->module, $this->task ) ) $this->reset_to( 'denied' ); } } }
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 register() { $reg_allowed = MObject::get('preference', 'registration'); if ('yes' == $reg_allowed->get_value()) { if (isset($_POST['do-register']) && mapi_csrf_check(MGet::string('mapi_csrf'))) { $this->model('register'); } if (isset($_GET['activate']) && 1 == $_GET['activate']) { $this->model('activate'); } $this->view(); } else { header('Location: ../index.php'); exit(0); } }
function mwidget_bottommenu($menu_id, $class = null, $id = null) { $menu = MObject::get('menu', $menu_id); if ($class) { $class = ' class="' . MPut::html_attr($class) . '"'; } else { $class = ''; } if ($id) { $id = ' id="' . MPut::html_attr($id) . '"'; } else { $id = ''; } if ($menu) { $pages = $menu->get_pages(); $size = sizeof($pages); if ($size > 0) { $i = 0; foreach ($pages as $page) { $i++; ?> <a href="<?php MPut::_link($page->get_url()); ?> " title="<?php MPut::_html_attr($page->get_title()); ?> "> <?php //MPut::_html( $page->get_title() ); ?> <?php __($page->get_title()); ?> </a> <?php if ($i != $size) { echo ' | '; } ?> <?php } } } }
function mwidget_content_market($id) { $content = MObject::get('content', $id); if ($content) { $img = mapi_get_default_media($content->get_id(), 'failover'); ?> <?php if (isset($img['url'])) { ?> <img class="img-circle" src="<?php MPut::_link($img['url']); ?> " alt="<?php MPut::_html_attr($img['title']); ?> " style="width: 140px; height: 140px;"> <?php } else { ?> <img class="img-circle" data-src="holder.js/140x140" alt="Generic placeholder image"> <?php } ?> <a href="index.php?module=content&object=<?php MPut::_id($content->get_id()); ?> " title="<?php MPut::_html_attr($content->get_title()); ?> "> <h2><?php MPut::_html($content->get_title()); ?> </h2> </a> <p><?php echo mapi_short_description($content->get_text(), 5); ?> </p> <?php } }
static function add_category($id) { $contents = array(); $category = MObject::get('category', $id); if ($category && sizeof($category->get_contents()) > 0) { $i = 0; foreach ($category->get_contents() as $content) { $title = ''; $title .= '<a href="index.php?module=content&object=' . MPut::id($content->get_id()) . '">' . MPut::html($content->get_title()) . '</a>'; $title .= '<br />'; $title .= '<small>(' . MPut::text($content->get_address()) . ')</small>'; $contents[$i] = array('title' => $title, 'text' => substr(strip_tags($content->get_text()), 0, 100) . ' ... <br /><br /><a href="index.php?module=content&object=' . intval($content->get_id()) . '"><small>read more >></small></a>', 'lat' => $content->get_lat(), 'lng' => $content->get_lng(), 'category' => $category->get_name()); if ('event' == $content->get_type()) { $contents[$i]['start'] = $content->get_start(); $contents[$i]['end'] = $content->get_end(); } $i++; } } return $contents; }
private static function send_notification($user) { $body = ""; $body .= "New registration at " . MSettings::$domain . "\n\n"; $body .= "User details:\n"; $body .= "-username: "******"\n"; $body .= "-name: " . $user->get_name() . "\n"; $body .= "-email: " . $user->get_email() . "\n"; $body .= ".\n\n"; $body .= "Sincerely\n"; $body .= MSettings::$domain; if (MValidate::email(MSettings::$reg_email)) { $from = MSettings::$reg_email; } else { return null; } if (MValidate::email(MObject::get('preference', 'website_email')->get_value())) { $to = MObject::get('preference', 'website_email')->get_value(); } else { return null; } $message = Swift_Message::newInstance(); $message->setSubject('New registration at ' . MSettings::$sitename); $message->setFrom(array($from)); $message->setTo(array($to)); $message->setBody($body); $transport = Swift_SmtpTransport::newInstance(MSettings::$reg_email_host, 25)->setUsername(MSettings::$reg_email_user)->setPassword(MSettings::$reg_email_pass); $mailer = Swift_Mailer::newInstance($transport); $mailer->send($message); }
<?php // no direct access to this file defined('DACCESS') or die; ?> <div class="m-content-header"> <h3 class="hidden-xs hidden-sm"><span class="glyphicon glyphicon-import"></span> Import content</h3> </div> <?php $crumbs = array('contents' => array('title' => 'Contents', 'link' => 'index.php?module=mcontent&task=content_list'), 'content_add' => array('title' => 'Import content')); $facebook_instance = $this->model('facebook_init', null, 'mcontent_import'); $facebook_login_link = $this->model('facebook_login_link', null, 'mcontent_import'); $appid = MObject::get('preference', 'facebook_app_id')->get_value(); $secret = MObject::get('preference', 'facebook_secret')->get_value(); ?> <?php MHTML::breadcrumb($crumbs); ?> <?php MMessaging::show(); ?> <ul class="list-group"> <li class="list-group-item"> <h4 class="list-group-item-heading">Facebook events</h4> <p class="list-group-item-text"> <form id="import_facebook_form" method="post">
public function get($property, $default = null) { // If $model is null we use the default model if (is_null($default)) { $model = $this->_defaultModel; } else { $model = strtolower($default); } // First check to make sure the model requested exists if (isset($this->_models[$model])) { // Model exists, let's build the method name $method = 'get' . ucfirst($property); // Does the method exist? if (method_exists($this->_models[$model], $method)) { // The method exists, let's call it and return what we get $result = $this->_models[$model]->{$method}(); return $result; } } // Degrade to MObject::get $result = parent::get($property, $default); return $result; }
function mwidget_menu($menu_id, $class = null, $id = null) { $menu = MObject::get('menu', $menu_id); if ($class) { $class = ' class="' . MPut::html_attr($class) . '"'; } else { $class = ''; } if ($id) { $id = ' id="' . MPut::html_attr($id) . '"'; } else { $id = ''; } if ($menu) { $pages = $menu->get_pages(); if (sizeof($pages) > 0) { $ContentEnabled = NULL; ?> <ul<?php echo $class; echo $id; ?> > <?php foreach ($pages as $page) { ?> <?php $TheLink = $page->get_url(); $ContentID = substr(strrchr($TheLink, '='), 1); if ($ContentID > 0) { $content = MObject::get('content', intval($ContentID)); if (is_object($content)) { $ContentEnabled = $content->is_enabled(); } else { $content = MObject::get('category', intval($ContentID)); $ContentEnabled = $content->is_enabled(); } } else { $ContentEnabled = 1; } if (strrpos($TheLink, '/', 8)) { $TheLinkRoot = substr($TheLink, 0, strrpos($TheLink, '/', 8)); } else { $TheLinkRoot = $TheLink; } $TheServerRoot = str_replace("/manager", "", rtrim(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']), '/\\')); $TheRealLink = str_replace($TheLinkRoot, $TheServerRoot, $TheLink); ?> <?php if ($page->is_enabled() == 1 && $ContentEnabled == 1) { ?> <?php if ($page->page_on_blank() == TRUE) { $TargetString = '_blank'; } else { $TargetString = '_self'; } ?> <li> <a href="<?php echo $TheRealLink; //MPut::_link( $page->get_url() ); ?> " target="<?php echo $TargetString; ?> " title="<?php MPut::_html_attr($page->get_title()); ?> "> <?php MPut::_html($page->get_title()); ?> </a> </li> <?php } ?> <?php } ?> </ul> <?php } } }
if (is_file($includes) && is_readable($includes)) { include $includes; } if (!class_exists('MINC')) { die('M_ERROR (00120): Includes loader is not reachable: File missing or not readable!'); } new MINC(); if (is_file($libraries) && is_readable($libraries)) { include $libraries; } if (!class_exists('MLIB')) { die('M_ERROR (00130): Library loader is not reachable: File missing or not readable!'); } new MLIB(); if (is_file($binaries) && is_readable($binaries)) { include $binaries; } if (!class_exists('MBIN')) { die('M_ERROR (00140): Binary loader is not reachable: File missing or not readable!'); } unset($settings); unset($includes); unset($libraries); unset($binaries); new MBIN(); $error_reporting = MObject::get('preference', 'force_php_errors_and_warnings'); if ('yes' == $error_reporting->get_value()) { error_reporting(E_ALL); ini_set('display_errors', 1); } include 'mappiamo.php';
public function add_page($value) { if (!($page_id = intval($value))) { return null; } if ($this->has_page($page_id)) { return null; } $page = MObject::get('page', $page_id); if ($page && is_object($page)) { $this->pages[] = $page; } }
public function add_content($value) { if (!($content_id = intval($value))) { return null; } if ($this->has_content($content_id)) { return null; } $content = MObject::get('content', $content_id); if ($content && is_object($content)) { $this->contents[] = $content; } }
function mwidget_slider($slider_id) { $sid = intval($slider_id); if ($sid) { $contents = array(); $category = MObject::get('category', $sid); if ($category && $category->get_id()) { $contents = $category->get_contents(); } $filtered_contents = array(); $language = new M_Language(); $lang = $language->getLanguage(); //var_dump($contents);die(); if (sizeof($contents) > 0) { foreach ($contents as $content) { if ($lang == $content->get_language()) { $filtered_contents[] = $content; } } $filtered = false; if (sizeof($filtered_contents) > 0) { $contents = $filtered_contents; $filtered = true; } ?> <div id="carousel-captions" class="carousel slide" data-ride="carousel"> <ol class="carousel-indicators"> <?php $k = 0; foreach ($contents as $content) { ?> <li data-target="#carousel-captions" data-slide-to="<?php echo $k; ?> " class="<?php if (0 == $k) { echo "active"; } ?> "></li> <?php $k++; } ?> </ol> <div class="carousel-inner"> <?php $i = 0; foreach ($contents as $content) { if ($filtered && 3 == $i) { break; } $slide = $content->get_media(true); if (!is_object($slide)) { $slide = $content->get_media(); } if (is_array($slide)) { reset($slide); $slide = current($slide); } if (!is_object($slide)) { $slide = new stdClass(); $slide->url = mapi_install_url() . 'media/default_slider.jpg'; } ?> <div class="item<?php if (0 == $i) { echo ' active'; } ?> " style="cursor: pointer;" onclick="location.href='index.php?module=content&object=<?php echo intval($content->get_id()); ?> '"> <img class="carousel-image" src="<?php MPut::_link($slide->url); ?> " style="width: 100%;"> <div class="carousel-caption"> <h3 class="hidden-xs hidden-sm"><?php MPut::_html($content->get_title()); ?> </h3> <h4 class="hidden-md hidden-lg"><?php MPut::_html($content->get_title()); ?> </h4> <p class="hidden-xs hidden-sm"><?php echo mapi_short_description($content->get_text(), 1); ?> </p> </div> <?php $hashtag = $content->get_meta('slide-hashtag'); if ($hashtag->get_value()) { ?> <a class="carousel-red-label"> #<?php MPut::_html($hashtag->get_value()); ?> </a> <?php } ?> </div> <?php $i++; } ?> </div> <a class="left carousel-control" href="#carousel-captions" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left"></span> </a> <a class="right carousel-control" href="#carousel-captions" data-slide="next"> <span class="glyphicon glyphicon-chevron-right"></span> </a> <?php } } }
<div class="message-signin"> <?php MMessaging::show(); ?> </div> <h2 class="form-signin-heading">#mappiamo</h2> <input type="text" name="user" class="form-control" placeholder="Username" autofocus> <input type="password" name="pass" class="form-control" placeholder="Password"> <label class="checkbox"> <input type="checkbox" name="remember" value="remember-me"> Remember me </label> <input type="hidden" name="mapi_csrf" id="mapi_csrf" value="<?php MPut::_html_attr(mapi_csrf_value()); ?> " /> <button class="btn btn-primary btn-block" name="do-login" type="submit">Sign in</button> <?php if ('yes' == MObject::get('preference', 'registration')->get_value()) { ?> <br /> <p> No account? Please register <a href="index.php?module=register">here</a>. </p> <?php } ?> </form> </div>
static function remove_category($content_id) { $id = MGet::int('category_id'); $category = MObject::get('category', $id); if ($category) { $category->remove_content($content_id); $category->update(false); } }
static function content($options) { if (sizeof($options) < 1) { return false; } $content = MObject::get('content', $options['object']); $metas = $content->get_meta(); $meta = array(); if (sizeof($metas) > 0) { foreach ($metas as $m) { $meta[] = array("name" => $m->name, "value" => $m->value); } } $medias = $content->get_media(); $media = array(); if (sizeof($medias) > 0) { foreach ($medias as $med) { $media[] = array("title" => $med->title, "url" => $med->url, "default" => $med->default); } } $contents = array("id" => $content->get_id(), "type" => $content->get_type(), "name" => $content->get_name(), "title" => $content->get_title(), "text" => $content->get_text(), "address" => $content->get_address(), "lat" => $content->get_lat(), "lng" => $content->get_lng(), "license" => $content->get_license(), "created" => $content->created(), "modified" => $content->modified(), "hits" => $content->get_hits(), "translation" => $content->is_translation(), "enabled" => $content->is_enabled(), "meta" => $meta, "media" => $media); return $contents; }
function mwidget_breadcrumbs() { ?> <ol class="breadcrumb"> <li><a href="index.php">Home</a></li> <?php if ('category' == $_GET['module']) { //category oldal if (!empty($_GET['object']) || !is_numeric($_GET['object'])) { $category = new M_Category(intval($_GET['object'])); ?> <li><a href="index.php?module=category&object=<?php MPut::_html($category->get_id()); ?> "><?php MPut::_html($category->get_title()); ?> </a></li> <?php } } else { if ('content' == $_GET['module']) { //content oldal if (!empty($_GET['object']) || !is_numeric($_GET['object'])) { $content = MObject::get('content', intval($_GET['object'])); if ($content && $content->get_id()) { $categories = ORM::for_table('categories')->where_like('contents', '%{' . intval($_GET['object']) . '}%')->find_many(); ?> <li> <?php $i = 1; foreach ($categories as $cat) { ?> <a href="index.php?module=category&object=<?php MPut::_html($cat->id); ?> "><?php MPut::_html($cat->title); ?> </a> <?php if ($i < sizeof($categories)) { echo ", "; } $i++; } ?> </li> <li><a href="index.php?module=content&object=<?php MPut::_html($content->get_id()); ?> "><?php MPut::_html($content->get_title()); ?> </a></li> <?php } } } } ?> </ol> <?php }