/** * String/array printer for debugging * * @var mixed $v * @return void */ function pa($v = null) { if (count(func_get_args()) > 1) { foreach (func_get_args() as $arg) { pa($arg); } return; } echo is_scalar($v) || $v === null ? $v . (PHP_SAPI === 'cli' ? PHP_EOL : '<br />') : (PHP_SAPI === 'cli' ? print_r($v, true) : '<pre>' . print_r($v, true) . '</pre>'); }
include_once __DIR__ . '/class_ec_payment_method_cod.php'; if ($_POST) { $payment_method_id = $_POST['ec_payment_method_id'][0]; $_SESSION['confirm_order']['sp_ec_payment_method_id'] = $payment_method_id; $_SESSION['confirm_order']['ship_to_id'] = $_POST['ship_to_id'][0]; $_SESSION['confirm_order']['bill_to_id'] = $_POST['bill_to_id'][0]; $pm_details = ec_payment_method::find_by_id($payment_method_id); $total_amount = $_POST['total_amount'][0]; $_SESSION['confirm_order']['sp_total_amount'] = $total_amount; $codCurrencyCode = $_POST['doc_currency'][0]; $_SESSION['confirm_order']['sp_currency_code'] = $codCurrencyCode; $paid_order = new ec_paid_order(); $paid_order->payment_method_id = $_SESSION['confirm_order']['sp_ec_payment_method_id']; $paid_order->doc_currency = $_SESSION['confirm_order']['sp_currency_code']; $paid_order->total_amount = $_SESSION['confirm_order']['sp_total_amount']; $paid_order->service_provider = 'cod'; $paid_order->sp_transaction_id = $_SESSION['user_id'] . '-' . current_time(); $paid_order->user_id = $_SESSION['user_id']; $paid_order->email = $ino_user->email; $paid_order->status = 'ENTERED'; $paid_order->confirm_order_details = json_encode($_SESSION['confirm_order']); $paid_order->save(); $_SESSION['ec_paid_order_id'] = $paid_order->ec_paid_order_id; $dbc->confirm(); if (!empty($paid_order->ec_paid_order_id)) { redirect_to(HOME_URL . "?dtype=product&class_name=ec_order_success"); } else { echo "Error in creating order"; pa($paid_order); } }
print "Data Base Connection Error!: " . "<br><span class='error'>" . $e->getMessage() . "</span><h2> Enter the correct database information</h2> "; } if (!update_htaccessFile()) { echo '<h2>Failed to update the .htaccess file. </h2>'; echo 'You can either proceed with the installtion and manually copy the .htaccess from egnine/install folder after installtion, or <br>'; echo 'Re-start the installation after giving write access to .htaccess file'; } else { $write_file_link = HOME_DIR . DS . '.htaccess'; if (!chmod($write_file_link, 0644)) { echo "<br>Failed to change the access level of the .htacess file. Change the .htaccess file to 06444 mode after installation"; } } if ($proceed) { //erify db version $db_version = $dbc->connection->getAttribute(PDO::ATTR_CLIENT_VERSION); pa($db_version); //verify if any existing data exists $existing_tables = view::count_all_tables(); if (empty($existing_tables->table_count)) { $db_setting_file_path = HOME_DIR . DS . 'includes' . DS . 'basics' . DS . 'settings' . DS . 'dbsettings.inc'; $db_setting_file = fopen($db_setting_file_path, "w"); $result = fwrite($db_setting_file, $dbsetting_file); if ($result > 0) { if (!chmod($db_setting_file_path, 0644)) { echo "<br>Failed to change the access level of .dbsettings file. Change the .dbsettings file to 06444 mode after installtion"; } echo "<br>Make sure that the write access from inlcudes directory, basics directory, .htaccess file and dbsettings are removed<br><br>"; } else { echo "<br>Database settings file creation failed!. Verify the wrtite access to inlcudes directory, basics directory and dbsettings file<br><br>"; $proceed = false; }
<h1 class="text-center">Supply Analysis Report</h1> <table class ="supply_analysis table table-bordered simple_table"> <thead> <tr> <th>Elements</th> <th></th> <th></th> </tr> </thead> <tbody> <tr> <td><?php pa($result); ?> </td> </tr> </tbody> </table>
} if ($error != '') { ?> <script language="javascript"> create_alert('<?php echo $error; ?> '); </script> <?php } else { # insert the user in the database and send the code e-mail. ---------------- # check if the user already exist in the DB. $ob_user = new user($_POST['mail']); if ($ob_user->user_id) { pa($ob_user); # if it exist but hasn't been activated yet, take it to the activation page that will allow to send a new message. # else, show alert and option to recover password. } else { # the user doesn't exist, insert it on to the database. $arr_data = array('first_name' => $_POST['first_name'], 'last_name' => $_POST['last_name'], 'pasapalabra' => $_POST['pass'], 'phone1' => $_POST['phone_1'], 'phone2' => $_POST['phone_2'], 'email' => $_POST['mail'], 'user_name' => $_POST['username'], 'address' => $_POST['address'], 'country' => $_POST['country'], 'id_num' => $_POST['id_num']); $user_id = user::create_user($arr_data); $ob_user = new user($user_id); $ob_user->add_default_modules(); # send control_code e-mail $user_details = $ob_user->get_all_details(); $enc_mail = encode($_POST['mail']); $arr_vars = array('check_code' => $user_details['control_code'], 'url' => $conf_main_url . $conf_main_page . '?mod=home&view=check_code&m=' . $enc_mail, 'url_link' => $conf_main_url . $conf_main_page . '?mod=home&view=check_code&m=' . $enc_mail . '&code=' . $user_details['control_code']); if ($_SERVER['SERVER_NAME'] != 'localhost') { mail_templates::send_mail($_POST['mail'], 'check_code', $arr_vars); }
<form method="POST"> <?php pa($_POST); $json_priv = '{"PUEDE_ATENDENDER_CHAT":"1","PUEDE_ADMINISTRAR":"0"}'; $user_privs = json_decode($json_priv, true); foreach ($GLOBALS['PRIVILEGIOS'] as $k => $v) { $checked = ''; if (isset($user_privs[$k])) { if ($user_privs[$k] == 1) { $checked = 'checked="checked"'; } } echo '<div><label><input type="checkbox" ' . $checked . ' value="1" name="' . $k . '" >' . $v . '</label></div>'; } ?> <input type="submit" value="Guardar privilegios"> </form> <br> hola {U} {A} {B}
$this->name = $name; } function __toString() { return $this->name; } } $compare = function ($a1, $a2) { if (strlen($a1->name) != strlen($a2->name)) { return strlen($a1->name) > strlen($a2->name) ? 1 : -1; } return strcmp($a1->name, $a2->name); }; $users = [new User("adda"), new User("dg"), new User("zz"), new User("dddddddf"), new User("jj"), new User("ydy")]; usort($users, $compare); pa($users); //*************************** function decor($tag) { $funcs = ['span' => function ($x) { return "<span style='color: #aa8888'>{$x}</span>"; }, 'div' => function ($x) { return "<div style='border: 1px solid gray'>{$x}</div>"; }, 'h1' => function ($x) { return "<h1>{$x}</h1>"; }, 'bold' => function ($x) { return "<span style='font-weight:bold'>{$x}</span>"; }]; if (isset($funcs[$tag])) { return $funcs[$tag]; }
$file->setSize($_FILES["file-file"]['size']); $file->setContentType(issetOrBlank($_FILES["file-file"]['type'])); $file->setExtension(pathinfo($_FILES["file-file"]['name'], PATHINFO_EXTENSION)); } } if ($uploaded == 1) { $file->setUploader($_SESSION['username'] != "" ? $_SESSION['username'] : '******'); //from session? if ($file->getExpiry() == "") { $file->setExpiry("0000-00-00 00:00:00"); } if ($file->save() > 0) { echo '<h1>File Uploaded OK!</h1>'; } else { echo '<h1>Failure Uploading File</h1>'; pa($file); } if (issetOrBlank($_POST['file-alias']) != "") { $alias = new Alias($conn); $fileAlias = issetOrBlank($_POST['file-alias']); if (!startsWith($fileAlias, "/")) { $fileAlias = "/" . $fileAlias; } $alias->setAlias($fileAlias); //must start with '/' //check if alias already exists first //pa( $alias->getObjectsLikeThis() ); //echo sizeof( $alias->getObjectsLikeThis() ); $numAliases = sizeof($alias->getObjectsLikeThis()); $alias->setPointer($file->getId()); $alias->setType("file");
pa($nums); sort($nums); pa($nums);*/ //fill /* $vals = array_fill(0, 16, "Shkura"); pa($vals);*/ //flip /* $users = [ 'user'=>'red', '123'=>'green', 'vp'=>'blue', 'admin'=>'black', 'jonny'=>'yellow' ]; pr(array_flip($users));*/ //pa(array_keys($users)) //pa(array_values($users)) /* if(in_array('green',array_values($users))) { p("we have"); }*/ $user = ['fname' => 'Alex', 'lname' => 'Dow', 'email' => '*****@*****.**', 'adress' => 'Undefiend street', 'phone' => '1241555', 'pet_name' => 'Shkura', 'someVal' => 'val']; $keys = ['fname', 'lname', 'email']; $data = array_intersect_key($user, array_flip($keys)); pa($data); $ddata = array_diff_key($user, array_flip($keys)); pa($ddata);
// drone()->log->setLogFile('_app/var/drone.log'); // set log file (optional) ////////////////////////////////////////////////////////////////////////// // Settings ////////////////////////////////////////////////////////////////////////// // framework settings // \Drone\Registry::set(\Drone\Core::KEY_DEBUG, false); // debug mode - off for production // \Drone\Registry::set(\Drone\Core::KEY_ERROR_BACKTRACE, false); // backtrace in log - off for production // \Drone\Registry::set(\Drone\Core::KEY_ERROR_LOG, true); // errors to server log - on for production ////////////////////////////////////////////////////////////////////////// // Error handlers ////////////////////////////////////////////////////////////////////////// drone()->error(function ($error) { pa('<div style="color:#f00;">' . $error, debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), '</div>'); }); drone()->error(404, function () { drone()->run('error->\\ErrorController->_404'); }); drone()->error(500, function () { drone()->run('error->\\ErrorController->_500'); }); ////////////////////////////////////////////////////////////////////////// // Hooks ////////////////////////////////////////////////////////////////////////// // after hook that displays log example: drone()->hook(\Drone\Core::HOOK_AFTER, function () { pa('', 'Log:', drone()->log->get()); }); ////////////////////////////////////////////////////////////////////////// // Mapped routes ////////////////////////////////////////////////////////////////////////// // example: drone()->route(['/user/:id' => 'user->view']);
} $noof_criteria++; } if (!empty($_GET[$value][1])) { array_push($existing_search, $value); if (substr($_GET[$value][1], 0, 1) == '>') { $whereFields[] = sprintf("%s > '%s' ", $value, trim(substr($_GET[$value][1], 1))); } else { if (substr($_GET[$value][1], 0, 1) == '<') { $whereFields[] = sprintf("%s < '%s' ", $value, trim(substr($_GET[$value][1], 1))); } } $noof_criteria++; } } pa($whereFields); if (count($whereFields) > 0) { $whereClause = " WHERE " . implode(" AND ", $whereFields); // And then create the SQL query itself. $sql = "SELECT * FROM " . $table_name . $whereClause; $count_sql = "SELECT COUNT(*) FROM " . $table_name . $whereClause; $all_download_sql = "SELECT * FROM " . $table_name . $whereClause; } else { $sql = "SELECT * FROM " . $table_name; $count_sql = "SELECT COUNT(*) FROM " . $table_name; $all_download_sql = "SELECT * FROM " . $table_name; $whereClause = null; } if (!empty($_GET['group_by'][0])) { $sum_element = ${$class}->search_groupBy_sum; $fetch_as = 'sum_' . $sum_element;
$ext = $filetype['ext']; // check if thumb already exists: $hash = md5($imgfile . $new_size[0] . 'x' . $new_size[1]); $thumbfile = $cachedir . '/' . $hash . '.' . $ext; if (is_file($thumbfile)) { //$src = get_bloginfo('home') . '/' . basename($thumbfile); header('Content-Type: ' . $filetype['type']); $imgcontent = file_get_contents($thumbfile); echo $imgcontent; exit; } // if no - need to generate the file // check directory exists if (!is_dir($cachedir)) { if (!mkdir($cachedir, 0777)) { pa('ay', 1); e404("can't create cache dir"); } @chmod($cachedir, 0777); } $imgcontent = file_get_contents($imgfile); if (!$imgcontent) { e404("can't read file"); } // copy image content into temp filename $tmpfname = tempnam($cachedir, "tmp."); $tmpfname = str_replace('\\', '/', $tmpfname); $tmpfname .= '.' . $ext; $fp = fopen($tmpfname, "w"); fwrite($fp, $imgcontent); fclose($fp);