function mwidget_intro() { global $content; if (!is_object($content)) { return null; } $img = $content->get_media(true); if (!is_object($img)) { $img = $content->get_media(); } if (is_array($img)) { reset($img); $img = current($img); } if (!is_object($img)) { $img = new stdClass(); $img->url = mapi_install_url() . 'media/default_content.jpg'; } ?> <div class="introimage" style="background-image: url( '<?php MPut::_link($img->url); ?> ' );"> </div> <?php }
private static function send_reg_email($user) { if (!is_object($user)) { return null; } if (MValidate::email(MSettings::$reg_email)) { $from = MSettings::$reg_email; } else { return null; } if (MValidate::email($user->get_email())) { $to = $user->get_email(); } else { return null; } if (empty(MSettings::$domain)) { return null; } if (empty(MSettings::$reg_email_user)) { return null; } if (empty(MSettings::$reg_email_pass)) { return null; } if (empty(MSettings::$reg_email_host)) { return null; } if (!strlen($user->get_activation()) > 0) { return null; } $url = mapi_install_url() . 'manager/?module=register&activate=1&c=' . $user->get_activation(); $body = ""; $body .= "Welcome to " . MSettings::$domain . "\n\n"; $body .= "To access the #mappiamo backend, please activate your account by clicking on the link below:\n"; $body .= $url . "\n\n"; $body .= "If the registration is not done by You, please send us an abuse letter by replying to this mail.\n\n"; $body .= "Sincerely\n"; $body .= MSettings::$domain; $message = Swift_Message::newInstance(); $message->setSubject('Welcome to ' . MSettings::$sitename); $message->setFrom(array($from)); $message->setTo(array($to => $user->get_name())); $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); if (!$mailer->send($message)) { $user->delete(); MMessaging::clear(); mapi_report('There was a problem. Please try again later.'); } else { self::send_notification($user); } }
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 } } }
?> "><?php MPut::_html($module->title); ?> </option> <?php } ?> <?php } ?> </select> <br /> <label>Task</label> <input type="text" name="module_task" class="form-control input-sm" /> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="page = new MPage(); page.base_url = '<?php echo mapi_install_url(); ?> '; page.add_module_url();">Add</button> </div> </div> </div> </div>