コード例 #1
0
ファイル: users.php プロジェクト: Bob-586/old_cx_home
 public function index()
 {
     $this->auth(array('user' => 'login_check'));
     $this->datatables_code();
     $page['q'] = \cx\app\main_functions::get_globals(array('route', 'm'));
     // Get pagination vars
     $this->load_view('app' . DS . 'users' . DS . 'index', $page);
 }
コード例 #2
0
ファイル: commands.php プロジェクト: Bob-586/cx_old
 /**
  * Purpose: To generate a group of checkboxes.
  * @param type $name - The name for the group of checkboxes.
  * @param $htmlOptions - <options> - Array of checkbox data.
  */
 private function frm_checkboxes($name, $htmlOptions)
 {
     $checkboxes = isset($htmlOptions['options']) ? $htmlOptions['options'] : array();
     $c = count($checkboxes);
     $input_name = $c > 1 ? $name . '[]' : $name;
     foreach ($checkboxes as $value => $label) {
         $selected = array('');
         if (isset($this->model[$name])) {
             if (is_array($this->model[$name])) {
                 $selected = $this->model[$name];
             } elseif (main_fn::is_serialized($this->model[$name]) === true) {
                 $selected = main_fn::safe_unserialize($this->model[$name]);
             } elseif (!empty($this->model[$name])) {
                 $selected = array($this->model[$name]);
             }
         }
         if ($c == 1) {
             $checkit = isset($htmlOptions['checked']) && main_fn::get_bool_value($htmlOptions['checked']) === true ? ' checked="checked"' : '';
         } else {
             $checkit = isset($htmlOptions['checked'][$value]) && main_fn::get_bool_value($htmlOptions['checked'][$value]) === true ? ' checked="checked"' : '';
         }
         $req = $this->get_request($name, $selected, $this->method);
         if (is_array($req)) {
             $select = in_array($value, $req) ? ' checked="checked"' : $checkit;
         } else {
             $select = $value == $req ? ' checked="checked"' : $checkit;
         }
         $this->input('checkbox', $input_name, $value, $label, $select, $htmlOptions);
     }
     // end foreach
     if ($c == '0') {
         $err = "Form Command - checkboxes - Named: {$name} - Missing Options!";
         $this->report_form_error($err);
     }
 }
コード例 #3
0
ファイル: request.php プロジェクト: Bob-586/cx_old
 public function cookie_var($var)
 {
     if (isset($_COOKIE[CX_SES . $var])) {
         $c = $_COOKIE[CX_SES . $var];
         if (main_fn::is_base64_encoded($c) === true) {
             $decoded = base64_decode($c, true);
             if (main_fn::is_serialized($decoded) === true) {
                 return main_fn::safe_unserialize($decoded);
                 // returns array
             }
             return $decoded;
             // return decoded cookie
         } else {
             return $c;
             // my cookie
         }
     } else {
         return false;
         // No cookie, found
     }
 }
コード例 #4
0
ファイル: db.php プロジェクト: Bob-586/cx_old
 public function run($sql, $bind = "", $fetch_mode = "all")
 {
     $this->sql = trim($sql);
     $this->bind = $this->cleanup($bind);
     $this->error = "";
     try {
         $pdostmt = $this->prepare($this->sql);
         if (is_array($this->ssp_bind)) {
             \ssp_do_bindings($pdostmt, $this->ssp_bind);
         }
         if (count($this->bind) > 0) {
             $exec = $pdostmt->execute($this->bind);
         } else {
             $exec = $pdostmt->execute();
         }
         if ($exec !== false) {
             if (preg_match("/^(" . implode("|", array("select", "describe", "pragma")) . ") /i", $this->sql)) {
                 if ($fetch_mode == 'all') {
                     if (\cx\app\main_functions::found($this->sql, "SQL_CALC_FOUND_ROWS")) {
                         $ret = $pdostmt->fetchAll(PDO::FETCH_ASSOC);
                         $fsql = "SELECT FOUND_ROWS() AS totalRows";
                         $totalRows = $this->query($fsql)->fetch();
                         $this->count = $totalRows[0];
                         return $ret;
                     } else {
                         $this->count = $pdostmt->rowCount();
                         return $pdostmt->fetchAll(PDO::FETCH_ASSOC);
                     }
                 } else {
                     return $pdostmt->fetch(PDO::FETCH_ASSOC);
                 }
             } elseif (preg_match("/^(" . implode("|", array("delete", "insert", "update")) . ") /i", $this->sql)) {
                 return $pdostmt->rowCount();
             }
         }
     } catch (PDOException $e) {
         $this->error = $e->getMessage();
         $this->debug();
         return false;
     }
 }
コード例 #5
0
ファイル: aliases.php プロジェクト: Bob-586/cx_old
 /**
  * Purpose: To group related elements in a form with a box.
  * @param type $name - to specify a form name.
  * @param type $options [legend] or [label] - to set the label for the legend.
  * @param type $options [form] - Specifies one or more forms the fieldset belongs to.
  */
 private function alias_frm_start_fieldset($name, $options)
 {
     $legend = isset($options['legend']) ? $options['legend'] : $name;
     $legend = isset($options['label']) ? $options['label'] : $legend;
     $fieldset_options = '';
     if (isset($options['disabled']) && main_fn::get_bool_value($options['disabled']) === true) {
         $fieldset_options .= " disabled";
     }
     $fieldset_options .= isset($options['class']) ? " class=\"{$options['class']}\"" : '';
     $fieldset_options .= isset($options['form']) ? " form=\"{$options['form']}\"" : '';
     $fieldset_options .= !empty($name) ? " name=\"{$name}\"" : '';
     $this->set_html("<fieldset{$fieldset_options}>");
     $this->set_html("<legend>{$legend}</legend>\r\n");
 }
コード例 #6
0
ファイル: model.php プロジェクト: Bob-586/cx_old
 public function get_dyn_local_time($input)
 {
     if (strpos($input, ':') !== false) {
         $settings = array('format' => 'normal', 'time' => $input);
         return main_fn::convert_time_zone($settings);
     } else {
         return false;
     }
 }
コード例 #7
0
function ssp_output($numrows, $obj_model, $columns)
{
    $draw = isset($_GET['draw']) ? $_GET['draw'] : 1;
    echo '{
      "draw": ' . intval($draw) . ',
      "recordsTotal": ' . $numrows . ',
      "recordsFiltered": ' . $numrows . ',			
      ';
    if ($numrows > 0) {
        echo '"data":[';
        $first = true;
        $Column = array();
        $allow_html = true;
        $rows = $obj_model->get_members($allow_html);
        foreach ($rows as $row) {
            if ($first) {
                $first = false;
            } else {
                echo ',';
            }
            foreach ($columns as $column) {
                $db_col = \cx\app\main_functions::get_db_column($column['db']);
                if (isset($column['fn_results']) && function_exists($column['fn_results'])) {
                    $funct = $column['fn_results'];
                    $out = $funct($row[$db_col]);
                } else {
                    $out = $row[$db_col];
                }
                if (isset($column['textsize']) && strlen($row[$db_col]) > $column['textsize']) {
                    $out = substr(strip_tags($out), 0, $column['textsize']);
                }
                if (isset($column['hyper'])) {
                    $hyper = $column['hyper'];
                    if (isset($column['id'])) {
                        $db_id_col = \cx\app\main_functions::get_db_column($column['id']);
                        $hlink = $hyper . $row[$db_id_col];
                    } else {
                        $hlink = $hyper;
                    }
                    $Column[] = "<a href='{$hlink}'>{$out}</a>";
                } else {
                    $Column[] = $out;
                }
            }
            echo json_encode($Column);
            $Column = '';
            $Column = array();
        }
        echo ']}';
    } else {
        echo '"data":[]}';
    }
}
コード例 #8
0
ファイル: form.php プロジェクト: Bob-586/cx_old
 /**
  * Purpose: To report errors to Chrome console...
  * @param type $err
  */
 private function report_form_error($err)
 {
     $this->set_html("<!-- {$err} -->");
     $this->set_html(main_fn::inline_js("log('{$err}');"));
 }
コード例 #9
0
ファイル: testing.php プロジェクト: Bob-586/old_cx_home
 public function hash()
 {
     echo \cx\app\main_functions::get_large_random_hash();
 }
コード例 #10
0
ファイル: generic.php プロジェクト: Bob-586/old_cx_home
<h1>Generic Pagination</h1>
<div class="wrapper"><div class="container"><div class="row">

<div class="panel panel-default top20">
<div class="panel-body">

<?php 
/**
 * @copyright (c) 2015
 * @author Chris Allen, Robert Strutts
 */
if ($no_results === true) {
    $fade = true;
    echo \cx\app\main_functions::do_alert('No results!', 'info', $fade);
} else {
    echo $paginator_items . "<br><br>";
    foreach ($rows as $row) {
        echo "ID#{$row['id']} : {$row['data']} <br>";
    }
    echo $paginator_links;
    echo $paginator_entries;
}
?>
    
</div></div></div>
</div>
</div>
コード例 #11
0
ファイル: app.php プロジェクト: Bob-586/cx_old
 public function get_settings($find, $save = false)
 {
     if (file_exists($this->settings_file)) {
         $settings = file_get_contents($this->settings_file);
         $settings_pos = stripos($settings, 'a:');
         // make sure we have serial data
         if ($settings_pos !== false) {
             $a_settings = main_fn::safe_unserialize($settings);
             if (is_array($find)) {
                 if (is_array($a_settings)) {
                     $ret = '';
                     foreach ($a_settings as $key => $value) {
                         if ($save === false && !in_array($key, $find)) {
                             continue;
                         }
                         if ($save === true && in_array($key, $find)) {
                             continue;
                         }
                         $ret[$key] = $value;
                     }
                     return $ret;
                 }
             }
         }
     }
     return array();
 }