|
END; public function __construct() { } // method declaration public function getHTMLText() { echo $this->html; } } class ViewHomepageAuthenticated { // property declaration public $blogs = array(); public $html = << ViewHomepageAuthenticated Welcome %session_hashid%" | %username%

%doc_id_error_container%
%table_rows%
Select Title Text Image Created Date
END; public $input_field_names = array('doc_id'); public function __construct( $session_hashid) { error_log('construct'.$session_hashid,4); $this->html = str_replace("%session_hashid%", htmlspecialchars($session_hashid, ENT_QUOTES), $this->html); $user_id = session_get_userid_given_session_hashid($session_hashid); //check if null error_log('user id'.$user_id,4); $this->blogs = blog_get_all($user_id); $table_rows=''; if ($this->blogs == null) { $table_rows=''; } else { foreach( $this->blogs as $blog) { //htmlspecialchars($session_hashid, ENT_QUOTES) $table_rows = $table_rows.''; $table_rows = $table_rows.""; $table_rows = $table_rows.''; $table_rows = $table_rows.''; if($blog['image_base64']== null) { $table_rows = $table_rows.''; }else { $table_rows = $table_rows.''; } $table_rows = $table_rows.''; $table_rows = $table_rows.''; } } $this->html = str_replace("%table_rows%", $table_rows , $this->html); } // errors public function setErrorsArray($errors) { $current_html = $this->html; foreach ($errors as $errs) { $this->html = str_replace("%".$errs->input_field_name."_error_container%", "Error:" . htmlspecialchars($errs->message, ENT_QUOTES) . "" , $this->html); } //delete valid item placeholders foreach ($errors as $errs) { $this->html = str_replace("%".$errs->input_field_name."_error_container%", "", $this->html); } } public function getHTMLText() { foreach ($this->input_field_names as $remove_error_field) { $this->html = str_replace("%".$remove_error_field."_error_container%", "", $this->html); } return $this->html; } } class ViewLoginUserForm { // property declaration public $html = << ViewLoginUserForm
%form_username_error_container% %form_userpassword_error_container% END; public $input_field_names = array('form_username','form_userpassword'); public function __construct() { //delete valid item placeholders /*foreach ($this->input_field_names as $remove_error_field) { $this->html = str_replace("%".$remove_error_field."_error_container%", "", $this->html); } */ } // method declaration public function getHTMLText() { foreach ($this->input_field_names as $remove_error_field) { $this->html = str_replace("%".$remove_error_field."_error_container%", "", $this->html); } return $this->html; } // errors public function setErrorsArray($errors) { $current_html = $this->html; foreach ($errors as $errs) { $this->html = str_replace("%".$errs->input_field_name."_error_container%", "Error:" . htmlspecialchars($errs->message, ENT_QUOTES) . "" , $this->html); } //delete valid item placeholders foreach ($errors as $errs) { $this->html = str_replace("%".$errs->input_field_name."_error_container%", "", $this->html); } } } class ViewCreateUserForm { // property declaration public $html = << ViewCreateUserForm
%form_username_error_container% %form_userpassword_error_container% END; public $input_field_names = array('form_username','form_userpassword'); public function __construct() { } // method declaration public function getHTMLText() { //delete valid item placeholders foreach ($this->input_field_names as $remove_error_field) { $this->html = str_replace("%".$remove_error_field."_error_container%", "", $this->html); } return $this->html; } // errors public function setErrorsArray($errors) { $current_html = $this->html; //set errors foreach ($errors as $errs) { $this->html = str_replace("%".$errs->input_field_name."_error_container%", "Error:" . htmlspecialchars($errs->message, ENT_QUOTES) . "" , $this->html); } //delete valid item placeholders foreach ($errors as $errs) { $this->html = str_replace("%".$errs->input_field_name."_error_container%", "", $this->html); } } } class ViewAddBlogForm { // property declaration public $html = << ViewAddBlogForm Welcome %user_id% | %session_hashid%" | %user_id%

%doc_title_error_container% %doc_text_error_container% END; public $input_field_names = array('doc_title','doc_text'); public function __construct($session_hashid) { $this->html = str_replace("%session_hashid%", htmlspecialchars($session_hashid, ENT_QUOTES), $this->html); } // method declaration public function getHTMLText() { //delete valid item placeholders foreach ($this->input_field_names as $remove_error_field) { $this->html = str_replace("%".$remove_error_field."_error_container%", "", $this->html); } return $this->html; } // errors public function setErrorsArray($errors) { $current_html = $this->html; //set errors foreach ($errors as $errs) { $this->html = str_replace("%".$errs->input_field_name."_error_container%", "Error:" . htmlspecialchars($errs->message, ENT_QUOTES) . "" , $this->html); } //delete valid item placeholders foreach ($errors as $errs) { $this->html = str_replace("%".$errs->input_field_name."_error_container%", "", $this->html); } } } class ViewEditBlogForm { // property declaration public $html = << ViewEditBlogForm Welcome %user_id% | %session_hashid%" | %user_id%

%doc_id_error_container% %doc_title_error_container% %doc_text_error_container% END; public $input_field_names = array('doc_id','doc_title','doc_text'); public function __construct($session_hashid) { $doc_id = filter_input(INPUT_POST, 'doc_id_choice'); error_log('doc_id'.$doc_id,4); $this->html = str_replace("%session_hashid%", htmlspecialchars($session_hashid, ENT_QUOTES), $this->html); $this->html = str_replace("%doc_id_bind_container%", htmlspecialchars($doc_id, ENT_QUOTES), $this->html); $blog_entry = model_blog_get_by_doc_id($doc_id); if ($blog_entry != null) { $this->html = str_replace("%doc_title_bind_container%", htmlspecialchars($blog_entry["doc_title"], ENT_QUOTES), $this->html); $this->html = str_replace("%doc_text_bind_container%", htmlspecialchars($blog_entry["doc_text"], ENT_QUOTES), $this->html); } else {error_log('null folkds',4);} } // method declaration public function getHTMLText() { //delete valid item placeholders foreach ($this->input_field_names as $remove_error_field) { $this->html = str_replace("%".$remove_error_field."_error_container%", "", $this->html); } return $this->html; } // errors public function setErrorsArray($errors) { $current_html = $this->html; //set errors foreach ($errors as $errs) { $this->html = str_replace("%".$errs->input_field_name."_error_container%", "Error:" . htmlspecialchars($errs->message, ENT_QUOTES) . "" , $this->html); } //delete valid item placeholders foreach ($errors as $errs) { $this->html = str_replace("%".$errs->input_field_name."_error_container%", "", $this->html); } } } ?>
NO DATA
'.htmlspecialchars($blog['doc_title'], ENT_QUOTES).''.htmlspecialchars($blog['doc_text'], ENT_QUOTES).'null'.htmlspecialchars($blog['datetime'], ENT_QUOTES).'