diff --git a/www/application/controllers/Member.php b/www/application/controllers/Member.php index 0566329..b3c4e89 100644 --- a/www/application/controllers/Member.php +++ b/www/application/controllers/Member.php @@ -40,6 +40,7 @@ class Member extends Member_Controller { if ($_SERVER['REQUEST_METHOD'] == 'GET') { $page_key = $this->input->get('pgname'); + $data["page_key"] = $page_key; $member_id = $_SESSION["member_id"]; if ($member_id > 0 && $page_key != '') { //echo 'yes'; @@ -79,6 +80,7 @@ class Member extends Member_Controller { $action_name = $this->input->get('action_name'); $member_id = $_SESSION["member_id"]; $data["page_id"] = $this->input->get('page_id'); + $data["page_key"] = $this->input->get('page_key'); /* if ($member_id > 0 && $page_key != '') { //echo 'yes'; @@ -221,8 +223,26 @@ class Member extends Member_Controller { } public function upload() { - + $page_item_id = 0; + $data = []; + $page_key = ""; if (isset($_POST['uploadBtn']) && $_POST['uploadBtn'] == 'Upload') { + + $page_key = $data['page_key'] = trim($this->input->post('page_key')); + + $data['title'] = "This s the ttitle" . rand(100, 9999); + $data['detail'] = "This s the ttitle, This s the ttitle" . rand(100, 9999); + $data['member_id'] = $_SESSION["member_id"]; + $data['session'] = $_SESSION["sessionid"]; + $data['sessionid'] = $_SESSION["sessionid"]; + $data['item_type'] = 'VIDEOCARD'; + $data['page_id'] = trim($this->input->post('page_id')); + if ($data['detail'] != '' && $data['title'] != '') { + $out = []; + $this->coregrade_webapi(COREGRADE_ACCOUNT_ADDPAGECARD, $data, $out); + $page_item_id = $out["page_item_id"]; + } + // print_r($data); if (isset($_FILES['uploadedFile']) && $_FILES['uploadedFile']['error'] === UPLOAD_ERR_OK) { // get details of the uploaded file @@ -234,23 +254,54 @@ class Member extends Member_Controller { $fileExtension = strtolower(end($fileNameCmps)); $newFileName = md5(time() . $fileName) . '.' . $fileExtension; - $allowedfileExtensions = array('jpg', 'gif', 'png', 'zip', 'txt', 'xls', 'doc', 'mp4'); + $allowedfileExtensions = array('jpg', 'gif', 'png', 'mp4'); if (in_array($fileExtension, $allowedfileExtensions)) { // directory in which the uploaded file will be moved - $uploadFileDir = '/home/uploads/'; - $dest_path = $uploadFileDir . $newFileName; + $uploadFileDir = '/home/uploads/' . $_SESSION['myfolder']; // str_pad($_SESSION["member_id"], 10, "0", STR_PAD_LEFT); + + if (!is_dir($uploadFileDir)) { + mkdir($uploadFileDir, 0777); + } + + $uploadFileDir = '/home/uploads/' . $_SESSION['myfolder'] . "/page"; + if (!is_dir($uploadFileDir)) { + mkdir($uploadFileDir, 0777); + } + + + $mypath = "testdir/subdir/test"; + mkdir($mypath, 0777, TRUE); + + + + $dest_path = $uploadFileDir . "/" . $newFileName; if (move_uploaded_file($fileTmpPath, $dest_path)) { $message = 'File is successfully uploaded.'; + $x = []; + $x["filename"] = $fileName; + $x["filesize"] = $fileSize; + $x["filetype"] = $fileType; + $x["ext"] = $fileExtension; + $x["page_item_id"] = $page_item_id; + $x["page_id"] = $data['page_id']; + $x['member_id'] = $_SESSION["member_id"]; + $x['session'] = $_SESSION["sessionid"]; + $x['sessionid'] = $_SESSION["sessionid"]; + + } else { $message = 'There was some error moving the file to upload directory. Please make sure the upload directory is writable by web server.'; } } - print_r($_FILES); - echo $message; + // print_r($_FILES); + // echo $message; + // echo base_url("images/icons/edit.png"); } } + + redirect("/member/page?pgname=$page_key", 'refresh'); } public function mycalendar() { diff --git a/www/application/libraries/Start_Controller.php b/www/application/libraries/Start_Controller.php index 21327ec..25c55dc 100644 --- a/www/application/libraries/Start_Controller.php +++ b/www/application/libraries/Start_Controller.php @@ -33,6 +33,7 @@ class Start_Controller extends COR_Controller { $_SESSION['loc'] = $out["loc"]; $_SESSION['mypage'] = $out["mypage"]; $_SESSION["top_message"] = " Welcome ".$_SESSION['firstname']; + $_SESSION['myfolder'] = $out["folder"]; } if (!empty($_SERVER['HTTP_CLIENT_IP'])) { diff --git a/www/application/views/member/addpages/VIDEOCARD.php b/www/application/views/member/addpages/VIDEOCARD.php index d0e3c44..f938dd1 100644 --- a/www/application/views/member/addpages/VIDEOCARD.php +++ b/www/application/views/member/addpages/VIDEOCARD.php @@ -1,11 +1,51 @@ -
-
- Upload a File: - +
+
+
+

Add Video

+
+ + + + + + + " /> + + + +
+ + +
+ +
+ + +
+ + + + +
+
+ Choose files + +
+
+ +
+
+ +
+ + +
+ +
- - - +
+ + @@ -50,42 +90,3 @@
-
-
-
-

Add Video

-
-
- -
-
- - -
- -
- - - -
-
Drop Files Here To Upload
-
- - -
- -
- - -
- -
- -
- - -
- -
-
-
\ No newline at end of file diff --git a/www/application/views/member/pages/manage_contents.php b/www/application/views/member/pages/manage_contents.php index 7aadf46..a733043 100644 --- a/www/application/views/member/pages/manage_contents.php +++ b/www/application/views/member/pages/manage_contents.php @@ -18,7 +18,7 @@ ?>
  • 0 - +
  • + + " /> +
    @@ -27,16 +30,15 @@ if ($what_page == "DEFAULT") {

    - - - +
    diff --git a/www/application/views/member/view_securehead.php b/www/application/views/member/view_securehead.php index 8bd54ea..600df36 100644 --- a/www/application/views/member/view_securehead.php +++ b/www/application/views/member/view_securehead.php @@ -231,7 +231,7 @@ $menu_items = array(