Esempio n. 1
0
 public static function render_views($view, $arr = array())
 {
     extract($arr);
     $temp = explode("/", $view);
     $plug_name = $temp[0];
     $view_name = $temp[1];
     $path1 = __DIR__ . "/views/" . Settings::get("theme") . "/plugins/{$plug_name}/{$view_name}";
     $path2 = __DIR__ . "/plugins/{$plug_name}/views/{$view_name}";
     if (file_exists($path1)) {
         $full_path_to_view = $path1;
     } else {
         $full_path_to_view = $path2;
     }
     include $full_path_to_view;
 }
Esempio n. 2
0
		<h1 >profile view</h1>
		<!-- start of profile edit pluging render-->
		<div style = "float:right">
			<?php 
echo Plugin::render("edit_profile");
?>
		</div>
		<!-- end of profile edit pluging render-->
		
		<p >User Name : <?php 
echo $user->name;
?>
</p>
		<img src="<?php 
if ($user != null) {
    echo Settings::get('base_url') . "uploads/profile_pic/" . $user->profile_pic;
}
?>
" width="200px" height="200px" /><br /><br />
	
		<div>
			<?php 
if (isset($post_status)) {
    Plugin::render("create_post", array("user" => $user, "post_status" => $post_status));
} else {
    Plugin::render("create_post", array("user" => $user));
}
?>
		</div>
	
		<div style= "width : 500px;" >
Esempio n. 3
0
            require $file;
        }
    }
    $file = $base_dir . '/models/' . $class . '.php';
    // if the file exists, require it
    if (!class_exists($klass)) {
        if (file_exists($file)) {
            require $file;
        }
    }
});
use Socio\Database;
use Socio\Settings;
use Socio\Event;
$config = (include 'config.php');
Socio\Settings::init($config);
Database::init();
/*$user = User::get(array('id' => '20'));
$user->name = "potter";
$user->gender = "f";
$user->save();*/
Plugin::register();
Socio\Event::fire("framework_ready");
$r = $_GET['r'];
if (isset($r)) {
    Route::post("register", "RegisterController");
    Route::get("register", "RegisterController");
    Route::get("login", "LoginController");
    Route::post("login", "LoginController");
    Route::get("home", "HomeController");
    Route::post("home", "HomeController");
Esempio n. 4
0
?>
				<label style = "color : white">what's on your mind</label><br/>
				<textarea rows = "5" cols = "100" name = "wallpost">
				</textarea>
				<button type = "submit">Post</button>
			</form>
		</div>
	
		<div>
			<?php 
if (isset($arr)) {
    foreach ($arr as $a) {
        echo '<p style = "color : white;">' . $a->text . '</p><br/>';
    }
}
?>
		</div>
		<div style = "float : right;">
			<h1 style = "color : white;">All users list</h1>
			<?php 
if (isset($users)) {
    foreach ($users as $u) {
        $url = Settings::get('base_url');
        echo '<a href = "' . $url . 'profile/' . $u->id . '" style = "color : white;"><img src = "' . $url . '/uploads/' . $u->profile_pic . '" width = "50" height = "50">' . $u->name . '</a><br/>';
    }
}
?>
		</div>
		
	</body>
</html>
Esempio n. 5
0
 public static function render($view, $arr = array())
 {
     extract($arr);
     include __DIR__ . '/views/' . Settings::get("theme") . "/{$view}.php";
 }
 public function post($id)
 {
     if (isset($_POST['wallpost'])) {
         //this code is for wall post
         $p_status = Post::create(array("text" => $_POST['wallpost'], "user1" => Session::get('id'), "user2" => $id, "activityid" => "1"));
         $objs = Post::where("(user1 = {$id}", "or", "user2 = {$id}) && activityid = 1 ORDER BY timestamp DESC");
         $posts = null;
         $count = 0;
         foreach ($objs as $obj) {
             $user1 = User::get(array("id" => $obj->user1));
             $user2 = User::get(array("id" => $obj->user2));
             $obx = new stdClass();
             $obx->timestamp = $obj->timestamp;
             $obx->postid = $obj->id;
             $obx->text = $obj->text;
             $obx->user1_pic = Settings::get("base_url") . 'uploads/profile_pic' . $user1->profile_pic;
             $obx->user1_coverpic = Settings::get("base_url") . 'uploads/cover_pic/' . $user1->cover_pic;
             $obx->user1_link = Settings::get("base_url") . 'profile/' . $user1->id;
             $obx->user1_name = $user1->name;
             $obx->user1_id = $user1->id;
             $obx->user2_link = Settings::get("base_url") . 'profile/' . $user2->id;
             $obx->user2_name = $user2->name;
             $obx->user2_id = $user2->id;
             $posts[$count++] = $obx;
         }
         $user = User::get(array("id" => $id));
         if ($user && $posts) {
             View::render("profile_view", array("post_status" => $p_status, "user" => $user, "posts" => $posts));
         }
     }
     if (isset($_POST['edit_profile'])) {
         $user = User::get(array("id" => Session::get("id")));
         $user->name = $_POST['name'];
         $user->email = $_POST['email'];
         $user->age = $_POST['age'];
         $user->password = $_POST['password'];
         $user->gender = $_POST['gender'];
         $user->save();
         $objs = Post::where("(user1 = {$id}", "or", "user2 = {$id}) && activityid = 1 ORDER BY timestamp DESC");
         $posts = null;
         $count = 0;
         foreach ($objs as $obj) {
             $user1 = User::get(array("id" => $obj->user1));
             $user2 = User::get(array("id" => $obj->user2));
             $obx = new stdClass();
             $obx->timestamp = $obj->timestamp;
             $obx->postid = $obj->id;
             $obx->text = $obj->text;
             $obx->user1_pic = Settings::get("base_url") . 'uploads/profile_pic' . $user1->profile_pic;
             $obx->user1_link = Settings::get("base_url") . 'profile/' . $user1->id;
             $obx->user1_name = $user1->name;
             $obx->user1_id = $user1->id;
             $obx->user2_link = Settings::get("base_url") . 'profile/' . $user2->id;
             $obx->user2_name = $user2->name;
             $obx->user2_id = $user2->id;
             $posts[$count++] = $obx;
         }
         $user = User::get(array("id" => $id));
         if ($user && $posts) {
             View::render("profile_view", array("user" => $user, "posts" => $posts));
         }
     }
     if (isset($_FILES['upload'])) {
         //this code for upload picture
         $ext = "";
         $flag = false;
         if (preg_match('/^image\\/p?jpeg$/i', $_FILES['upload']['type'])) {
             $ext = '.jpeg';
             $flag = true;
         } else {
             if (preg_match('/^image\\/gif$/i', $_FILES['upload']['type'])) {
                 $ext = '.gif';
                 $flag = true;
             } else {
                 if (preg_match('/^image\\/(x-)?png$/i', $_FILES['upload']['type'])) {
                     $ext = '.png';
                     $flag = true;
                 }
             }
         }
         if ($flag) {
             // The complete path/filename
             $file = Session::get("id");
             $dir = __DIR__;
             $dir = substr($dir, 0, count($dir) - 13);
             $filename = "{$dir}/uploads/cover_pic/{$file}" . $ext;
             //die(print_r($_FILES['upload']['tmp_name']));
             // Copy the file (if it is deemed safe)
             if (!is_uploaded_file($_FILES['upload']['tmp_name']) or !copy($_FILES['upload']['tmp_name'], $filename)) {
                 $error = "Could not save file as {$filename}!";
                 exit;
             } else {
                 if (User::updateCoverPicture("{$file}{$ext}")) {
                     $users = User::all();
                     $hre = Session::get('id');
                     header("Location: {$hre}");
                 }
             }
         }
         // if flag statement ends
     }
     // upload ends
     if (isset($_POST['friendbutton'])) {
     }
 }
Esempio n. 7
0
<?php

use Socio\Settings;
?>
<html>
	<head>
		<link rel="stylesheet" href="<?php 
echo Settings::asset("style.css");
?>
">
		<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
		<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
		<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
	</head>
	<body style = "background-color: black">
	<!-- -->
	<?php 
echo Plugin::render("menus");
?>
	<!-- End of navigation bar-->
	<h1 style="color : white;">register</h1>
	<?php 
if (isset($status)) {
    echo '<br/><h1 style="color:white;">';
    echo $status == 0 ? "success" : "no success";
    echo '</h1>';
}
?>
	<div style = "float:left;">
	<form method="post" action = "/Socio/register">
		<input type="text" placeholder = "name" name = "name"><br/><br/>
Esempio n. 8
0
 public static function init()
 {
     $dbhandle = mysql_connect(Settings::get("servername"), Settings::get("username"), Settings::get("pass")) or die("Unable to connect to MySQL");
     mysql_select_db(Settings::get("dbname"), $dbhandle) or die("Could not select examples");
 }