Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Tugas Vietgram 14
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Tugas Vietgram 14
4 changes: 2 additions & 2 deletions application/config/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
|
| $autoload['libraries'] = array('user_agent' => 'ua');
*/
$autoload['libraries'] = array();
$autoload['libraries'] = array('database','session','upload','form_validation');

/*
| -------------------------------------------------------------------
Expand Down Expand Up @@ -89,7 +89,7 @@
|
| $autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array();
$autoload['helper'] = array('url','file');

/*
| -------------------------------------------------------------------
Expand Down
74 changes: 63 additions & 11 deletions application/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
| a PHP script and you can easily do that on your own.
|
*/
$config['base_url'] = '';
$config['base_url'] = 'http://localhost/vietgrams/';

/*
|--------------------------------------------------------------------------
Expand All @@ -35,7 +35,7 @@
| variable so that it is blank.
|
*/
$config['index_page'] = 'index.php';
$config['index_page'] = '';

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -63,8 +63,6 @@
| For more information please see the user guide:
|
| https://codeigniter.com/user_guide/general/urls.html
|
| Note: This option is ignored for CLI requests.
*/
$config['url_suffix'] = '';

Expand All @@ -88,7 +86,7 @@
| This determines which character set is used by default in various methods
| that require a character set to be provided.
|
| See https://secure.php.net/htmlspecialchars for a list of supported charsets.
| See http://php.net/htmlspecialchars for a list of supported charsets.
|
*/
$config['charset'] = 'UTF-8';
Expand Down Expand Up @@ -133,7 +131,7 @@
|
| $config['composer_autoload'] = '/path/to/vendor/autoload.php';
|
| For more information about Composer, please visit https://getcomposer.org/
| For more information about Composer, please visit http://getcomposer.org/
|
| Note: This will NOT disable or override the CodeIgniter-specific
| autoloading (application/config/autoload.php)
Expand All @@ -159,8 +157,6 @@
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
| Note: This option is ignored for CLI requests.
|
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';

Expand Down Expand Up @@ -191,6 +187,20 @@
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';

/*
|--------------------------------------------------------------------------
| Allow $_GET array
|--------------------------------------------------------------------------
|
| By default CodeIgniter enables access to the $_GET array. If for some
| reason you would like to disable it, set 'allow_get_array' to FALSE.
|
| WARNING: This feature is DEPRECATED and currently available only
| for backwards compatibility purposes!
|
*/
$config['allow_get_array'] = TRUE;

/*
|--------------------------------------------------------------------------
| Error Logging Threshold
Expand Down Expand Up @@ -221,7 +231,7 @@
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/logs/ directory. Use a full server path.
| application/logs/ directory. Use a full server path with trailing slash.
|
*/
$config['log_path'] = '';
Expand Down Expand Up @@ -269,7 +279,7 @@
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/views/errors/ directory. Use a full server path.
| application/views/errors/ directory. Use a full server path with trailing slash.
|
*/
$config['error_views_path'] = '';
Expand All @@ -280,7 +290,7 @@
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/cache/ directory. Use a full server path.
| application/cache/ directory. Use a full server path with trailing slash.
|
*/
$config['cache_path'] = '';
Expand Down Expand Up @@ -396,6 +406,34 @@
$config['cookie_secure'] = FALSE;
$config['cookie_httponly'] = FALSE;

/*
|--------------------------------------------------------------------------
| Standardize newlines
|--------------------------------------------------------------------------
|
| Determines whether to standardize newline characters in input data,
| meaning to replace \r\n, \r, \n occurrences with the PHP_EOL value.
|
| WARNING: This feature is DEPRECATED and currently available only
| for backwards compatibility purposes!
|
*/
$config['standardize_newlines'] = FALSE;

/*
|--------------------------------------------------------------------------
| Global XSS Filtering
|--------------------------------------------------------------------------
|
| Determines whether the XSS filter is always active when GET, POST or
| COOKIE data is encountered
|
| WARNING: This feature is DEPRECATED and currently available only
| for backwards compatibility purposes!
|
*/
$config['global_xss_filtering'] = FALSE;

/*
|--------------------------------------------------------------------------
| Cross Site Request Forgery
Expand Down Expand Up @@ -452,6 +490,20 @@
*/
$config['time_reference'] = 'local';

/*
|--------------------------------------------------------------------------
| Rewrite PHP Short Tags
|--------------------------------------------------------------------------
|
| If your PHP installation does not have short tag support enabled CI
| can rewrite the tags on-the-fly, enabling you to utilize that syntax
| in your view files. Options are TRUE or FALSE (boolean)
|
| Note: You need to have eval() enabled for this to work.
|
*/
$config['rewrite_short_tags'] = FALSE;

/*
|--------------------------------------------------------------------------
| Reverse Proxy IPs
Expand Down
6 changes: 3 additions & 3 deletions application/config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
| ['dbdriver'] The database driver. e.g.: mysqli.
| Currently supported:
| cubrid, ibase, mssql, mysql, mysqli, oci8,
| odbc, pdo, postgre, sqlite3, sqlsrv
| odbc, pdo, postgre, sqlite, sqlite3, sqlsrv
| ['dbprefix'] You can add an optional prefix, which will be added
| to the table name when using the Query Builder class
| ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
Expand Down Expand Up @@ -76,9 +76,9 @@
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => '',
'username' => 'root',
'password' => '',
'database' => '',
'database' => 'vietgram',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
Expand Down
6 changes: 3 additions & 3 deletions application/config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@
| This is not exactly a route, but allows you to automatically route
| controller and method names that contain dashes. '-' isn't a valid
| class or method name character, so it requires translation.
| When you set this option to TRUE, it will replace ALL dashes with
| underscores in the controller and method URI segments.
| When you set this option to TRUE, it will replace ALL dashes in the
| controller and method URI segments.
|
| Examples: my-controller/index -> my_controller/index
| my-controller/my-method -> my_controller/my_method
*/
$route['default_controller'] = 'welcome';
$route['default_controller'] = 'login_c';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
20 changes: 20 additions & 0 deletions application/controllers/explore_c.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Explore_c extends CI_Controller {

function __construct(){
parent::__construct();
$this->load->model('vietgram_m');
}

public function index()
{
$data['title'] = 'Explore | Vietgram';
$user = $this->session->userdata('user');
$data['friends'] = $this->vietgram_m->getExplore($user['username']);
$this->load->view('header',$data);
$this->load->view('explore_v',$data);
$this->load->view('footer');
}
}
22 changes: 22 additions & 0 deletions application/controllers/feed_c.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Feed_c extends CI_Controller {

function __construct(){
parent::__construct();
$this->load->model('vietgram_m');
$this->load->model('vietgram_m');
}

public function index()
{
$data['title'] = 'Feed | Vietgram';
$data['feed'] = $this->vietgram_m->getAllFeed();
$data['comments'] = $this->vietgram_m->getAllComments();

$this->load->view('header',$data);
$this->load->view('feed_v',$data);
$this->load->view('footer');
}
}
37 changes: 37 additions & 0 deletions application/controllers/login_c.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Login_c extends CI_Controller {

function __construct(){
parent::__construct();
$this->load->model('vietgram_m');
$this->load->library('session');
}

public function index()
{
$this->load->view('login_v');
}

public function login()
{
$this->form_validation->set_rules('username', 'username', 'required');
$this->form_validation->set_rules('password', 'password', 'required');

if ($this->form_validation->run() == false) {
redirect('login_c');
} else {
$username = $this->input->post('username',true);
$pass = $this->input->post('password',true);
$data = $this->vietgram_m->cek_login($username,$password);
if (count($data) == 1) {
$this->session->set_userdata('user', $data[0]);
redirect('feed_c');
} else {
redirect('login_c');
}
}
}
}
?>
52 changes: 52 additions & 0 deletions application/controllers/profile_c.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Profile_c extends CI_Controller {

function __construct(){
parent::__construct();
$this->load->model('vietgram_m');
$this->load->model('vietgram_m');
}

public function index()
{
$data['title'] = 'Profile | Vietgram';
$user = $this->session->userdata('user');
$data['profile'] = $this->vietgram_m->getProfile($user['username']);
$data['photo'] = $this->vietgram_m->getPhoto($user['username']);

$this->load->view('header',$data);
$this->load->view('profile_v',$data);
$this->load->view('footer');
}
public function edit()
{
$user = $this->session->userdata('user');
$data['title'] = 'Edit Profile | Vietgram';
$data['profile'] = $this->vietgram_m->getProfile($user['username']);
$username = $data['profile']['username'];
$this->form_validation->set_rules('username', 'username','required');

if ($this->form_validation->run() == false) {
$this->load->view('header',$data);
$this->load->view('edit-profile_v',$data);
$this->load->view('footer');
} else {
$update = array(
'name' => $this->input->post('name'),
'username' => $this->input->post('username'),
'website' => $this->input->post('website'),
'bio' => $this->input->post('bio'),
'email' => $this->input->post('email'),
'phone' => $this->input->post('phone'),
'gender' => $this->input->post('gender'),
'ava' => $data['profile']['ava'],
'follower' => $data['profile']['follower'],
'following' => $data['profile']['following']
);
$this->vietgram_m->editProfile($username,$update);
redirect('profile');
}
}
}
Loading