Example #1
0
 public function get_board_list_allowed_for_current_user()
 {
     if (empty(array_key_exists(\k1lib\session\session_plain::get_user_level(), array_flip($this->board_list_allowed_levels)))) {
         return FALSE;
     } else {
         return TRUE;
     }
 }
Example #2
0
 public function load_logged_session_db($redirect = FALSE, $where_redirect_to = "")
 {
     if (!parent::load_logged_session($redirect, $where_redirect_to)) {
         $cookie_data = $this->load_data_from_coockie();
         return $cookie_data;
     } else {
         return TRUE;
     }
 }
Example #3
0
 /**
  * @return \k1lib\html\div|boolean
  */
 public function exec_board()
 {
     if (!$this->is_enabled) {
         return FALSE;
     }
     if ($this->update_object->get_state() && !empty($this->row_keys_text)) {
         if ($this->data_loaded) {
             if ($this->update_object->get_post_data_catched()) {
                 $this->update_object->put_post_data_on_table_data();
                 if (!$this->skip_form_action) {
                     if ($this->update_object->do_post_data_validation()) {
                         $this->sql_action_result = $this->update_object->do_update();
                     } else {
                         DOM_notification::queue_mesasage(board_update_strings::$error_form, "alert", $this->notifications_div_id);
                         DOM_notification::queue_title(board_base_strings::$alert_board);
                     }
                 }
             }
             if ($this->apply_label_filter) {
                 $this->update_object->apply_label_filter();
             }
             $this->update_object->insert_inputs_on_data_row();
             /**
              * DELETE BUTTON
              */
             if ($this->controller_object->get_board_delete_enabled()) {
                 $delete_url = $this->controller_object->get_controller_root_dir() . "{$this->controller_object->get_board_delete_url_name()}/{$this->row_keys_text}/";
                 if (\k1lib\urlrewrite\get_back_url(TRUE)) {
                     $get_vars = ["auth-code" => md5(session_plain::get_user_hash() . $this->row_keys_text), "back-url" => \k1lib\urlrewrite\get_back_url(TRUE)];
                 } else {
                     $get_vars = ["auth-code" => md5(session_plain::get_user_hash() . $this->row_keys_text)];
                 }
                 $delete_link = \k1lib\html\get_link_button(url::do_url($delete_url, $get_vars), board_read_strings::$button_delete, "small");
                 $delete_link->append_to($this->button_div_tag);
             }
             $update_content_div = $this->update_object->do_html_object();
             $update_content_div->append_to($this->board_content_div);
             return $this->board_content_div;
         } else {
             DOM_notification::queue_mesasage(board_base_strings::$error_mysql_table_no_data, "alert", $this->notifications_div_id, board_base_strings::$error_mysql);
             $this->update_object->make_invalid();
             $this->is_enabled = FALSE;
             return FALSE;
         }
     }
 }
Example #4
0
 function check_user_level_access()
 {
     if (empty($this->user_levels_allowed)) {
         return TRUE;
     } else {
         if (empty(array_key_exists(\k1lib\session\session_plain::get_user_level(), array_flip($this->user_levels_allowed)))) {
             return FALSE;
         } else {
             return TRUE;
         }
     }
 }
Example #5
0
 public function set_auth_code_personal($row_keys_text)
 {
     $this->auth_code_personal = md5(session_plain::get_user_hash() . $row_keys_text);
 }
Example #6
0
/**
 * Check a incomming MAGIC VALUE 
 * @param String $name The name with it was stored
 * @param String $value_to_check Received var
 * @return boolean
 */
function check_magic_value($name, $value_to_check)
{
    if (\k1lib\session\session_plain::on_session()) {
        if ($value_to_check == "") {
            die("The magic value never can be empty!");
        } else {
            if (isset($_SESSION[\k1lib\common\get_magic_name($name)])) {
                $secret = $_SESSION[\k1lib\common\get_magic_name($name)];
                $client_magic = md5(\k1lib\K1MAGIC::get_value() . $secret);
                if ($client_magic == $value_to_check) {
                    return $client_magic;
                } else {
                    return FALSE;
                }
            } else {
                return FALSE;
            }
        }
    } else {
        trigger_error("Magic system REQUIRES the session system to be enabled and a session started", E_USER_ERROR);
    }
}