<?php /** * OpenSource-SocialNetwork * * @package (Informatikon.com).ossn * @author OSSN Core Team <*****@*****.**> * @copyright 2014 iNFORMATIKON TECHNOLOGIES * @license General Public Licence http://opensource-socialnetwork.com/licence * @link http://www.opensource-socialnetwork.com/licence */ $OssnWall = new OssnWall(); $OssnWall->poster_guid = ossn_loggedin_user()->guid; $owner = input('wallowner'); if (isset($owner) && !empty($owner)) { $OssnWall->owner_guid = $owner; } $OssnWall->type = 'group'; $post = input('post'); $friends = false; $location = input('location'); if ($OssnWall->Post($post, $friends, $location, OSSN_PRIVATE)) { //no need to show message on success // ossn_trigger_message(ossn_print('post:created'), 'success'); redirect(REF); } else { ossn_trigger_message(ossn_print('post:create:error'), 'error'); redirect(REF); }
} //walltype is user $OssnWall->name = 'user'; //getting some inputs that are required for wall post $post = input('post'); $friends = input('friends'); $location = input('location'); $privacy = input('privacy'); //validate wall privacy $privacy = ossn_access_id_str($privacy); if (!empty($privacy)) { $access = input('privacy'); } else { $access = OSSN_FRIENDS; } if ($OssnWall->Post($post, $friends, $location, $access)) { if (ossn_is_xhr()) { $guid = $OssnWall->getObjectId(); $get = $OssnWall->GetPost($guid); if ($get) { $get = ossn_wallpost_to_item($get); ossn_set_ajax_data(array('post' => ossn_wall_view_template($get))); } } //no need to show message on success. //3.x why not? $arsalanshah ossn_trigger_message(ossn_print('post:created')); redirect(REF); } else { ossn_trigger_message(ossn_print('post:create:error'), 'error'); redirect(REF);
/** * Insereix un viatge a la base de dades * * * @return bool */ public function setTripDay($idTrip, $values) { $user = ossn_loggedin_user()->guid; //No usuari iniciat sessió sortim if (empty($user)) { return false; } //Agafem paràmetres passats $this->id_trip = $idTrip; // $this->from = $from; // $this->to = $to; $this->from = $values['from']; $this->to = $values['to']; // $this->description = $values['description']; //Preparem SQL into(taula) - names(columnes) - values(valors insertar) $params['into'] = 'ossn_trips_days'; $params['names'] = array('id_trip', 'from', 'to'); $params['values'] = array($this->id_trip, $this->from, $this->to); if ($this->insert($params)) { //Mostra viatge a les notícies i mur $wall = new OssnWall(); $wall->owner_guid = ossn_loggedin_user()->guid; $wall->poster_guid = ossn_loggedin_user()->guid; $url = "http://localhost/social1/social/trip/view/{$idTrip}"; // $post = '<b>' . $this->place . '</b>: '. $this->title; // $post = "<p><a href='http://localhost/social1/social/trip/view/26'>Leer más...</a>"; $post = "He añadido un nuevo viaje, échale un vistazo!<br>{$url}"; $friends = ''; $location = ''; $privacy = ''; $wall->Post($post, $friends, $location, $access); return true; } return false; }