function createLake($title, $description, $fields, $related, $media, $fb_share) { $relate =& JModel::getInstance('relate', 'RelateModel'); // com_content: $article =& JTable::getInstance('content'); $filter = new JFilterInput(array(), array(), 1, 1); $article->title = trim($title); $article->alias = JFilterOutput::stringURLSafe($article->title); $article->introtext = $filter->clean($description); $article->fulltext = ''; $article->state = 1; // published $article->sectionid = 1; // section 1 -> Fiskeplasser $article->catid = 1; // category 1 -> Vann $article->created = gmdate('Y-m-d H:i:s'); $article->created_by = 103; // userid 103 = HOOKED $article->publish_up = $article->created; if (!$article->store()) { $this->setError($this->_db->getErrorMsg()); return false; } $article_id = $article->_db->insertId(); $article->id = $article_id; // jreviews_content: // contentid, email, jr_{...} $fields['contentid'] = $article_id; $fields['email'] = '*****@*****.**'; // run geocoder on lat/lng, get jr_state & jr_zip $geodata = reverse_geocode($fields['jr_lat'], $fields['jr_long']); if ($geodata && $geodata != -1) { if ($geodata['state'] != '') { $geodata['state'] = '*' . str_replace(' ', '-', strtolower($geodata['state'])) . '*'; } $fields['jr_state'] = $geodata['state']; $fields['jr_zip'] = $geodata['zip']; } $columns = implode(",", array_keys($fields)); $values = implode("','", array_values($fields)); $sql = "INSERT INTO `#__jreviews_content` ({$columns}) VALUES ('{$values}')"; $this->_db->setQuery($sql); if (!$this->_db->query()) { $this->setError($this->_db->getErrorMsg()); return false; } $relate->add_listings($article_id, $related, false); $this->_streamAddLake($article); if (isset($media['photos'])) { $thumbs = str_replace(JURI::base(), '', $media['photos']); $sql = "SELECT id FROM #__community_photos WHERE thumbnail IN ('" . implode("','", $thumbs) . "')"; $this->_db->setQuery($sql); $photo_ids = $this->_db->loadResultArray(); $relate->add_photos($article_id, $photo_ids, false); if (isset($media['descriptions'])) { foreach ($media['descriptions'] as $thumb => $desc) { $thumb = str_replace(JURI::base(), '', $thumb); $sql = "UPDATE #__community_photos SET caption = '{$desc}' WHERE thumbnail = '{$thumb}'"; $this->_db->setQuery($sql); $this->_db->query(); } } } $article_link = ContentHelperRoute::getArticleRoute($article_id, $article->catid, $article->sectionid); $article->link = $article_link; $thumb = ''; if (isset($media['photos']) && count($media['photos'])) { $thumb = $media['photos'][0]; $article->thumbnail = $thumb; } $response = array(); $response[] = array('id' => $article_id, 'title' => $article->title, 'link' => $article_link, 'thumbnail' => $thumb); if ($fb_share) { facebook_share($article, JText::sprintf('FACEBOOK LAKE MESSAGE', $title)); } return $response; }
?> <?php echo $row['username']; ?> <br> <?php } ?> </div> <aside id="event"> <section id="social_media"> <?php facebook_share($event_info[0]['id_event']); twitter_share(); ?> </section> <section> <br> <?php if ($valid_user) { $stmt = $dbh->prepare("SELECT COUNT(*) as count from registers\r\n\t\t\t\t\t\tWHERE event_id=? AND user_id=?"); $stmt->execute(array($id, $_SESSION['login_user'])); $registered = $stmt->fetch(); if ($registered['count'] == 0) { echo '<form method="post" action="register.php"> <input type="hidden" name="event_id" value="' . $event_info[0]['id_event'] . '">