function debug($to_debug, $debug = false) { if ($debug) { var_dump(debug_backtrace()); echo '<hr />'; } vardump($to_debug); exit; }
/** * Commit will handle both inserts and updates * @param the class will commit itself, no params needed * @return true or false on query result */ public function commit() { /* *TODO: try to pass the query $this to remove need for an array */ $fields = array('id' => $this->id, 'startTime' => $this->startTime, 'endTime' => $this->endTime, 'sessionDurationInMinutes' => $this->sessionDurationInMinutes, 'contentImageUri' => $this->contentImageUri, 'bingId' => $this->bingId, 'contentTitle' => $this->contentTitle, 'vuiDisplayName' => $this->vuiDisplayName, 'platform' => $this->platform, 'titleId' => $this->titleId, 'description' => $this->description, 'date' => $this->date, 'hasUgc' => $this->hasUgc, 'activityItemType' => $this->activityItemType, 'contentType' => $this->contentType, 'shortDescription' => $this->shortDescription, 'itemText' => $this->itemText, 'itemImage' => $this->itemImage, 'shareRoot' => $this->shareRoot, 'feedItemId' => $this->feedItemId, 'itemRoot' => $this->itemRoot, 'hasLiked' => $this->hasLiked, 'gamertag' => $this->gamertag, 'realName' => $this->realName, 'displayName' => $this->displayName, 'userImageUri' => $this->userImageUri, 'userXuid' => $this->userXuid); /* *If the model has an xuid, then it already exists in the database *Else the model doesn't have an xuid and needs to be inserted */ if (isset($this->id)) { /* * Generates UPDATE validGamertags SET {$fields} WHERE xuid={$ID} */ if ($this->db->update("recentActivity", $fields, array("id" => $this->id))) { return true; } else { /* *There was an error with the update retrieve and show error *TODO: handle error properly */ vardump($this->db->error()); die; } } else { if ($this->db->insert("recentActivity", $fields)) { return $this->db->insertid(); } else { /* *There was an error with the insert retrieve and show error *TODO: handle error properly */ vardump($this->db->error()); die; } } /* *If the function is this far it has failed */ return false; }
<?php require __DIR__ . '/../src/Vardump.php'; require __DIR__ . '/../autoload.php'; $fixtures = (require __DIR__ . '/_fixtures.php'); vardump($fixtures); vardump_html($fixtures);
function error_handler($errno, $errmsg, $filename, $linenum, $vars) { // Custom error-handling function. // Sends an email to BUGSLIST. global $PAGE; // define an assoc array of error string // in reality the only entries we should // consider are E_WARNING, E_NOTICE, E_USER_ERROR, // E_USER_WARNING and E_USER_NOTICE $errortype = array(E_ERROR => "Error", E_WARNING => "Warning", E_PARSE => "Parsing Error", E_NOTICE => "Notice", E_CORE_ERROR => "Core Error", E_CORE_WARNING => "Core Warning", E_COMPILE_ERROR => "Compile Error", E_COMPILE_WARNING => "Compile Warning", E_USER_ERROR => "User Error", E_USER_WARNING => "User Warning", E_USER_NOTICE => "User Notice", 2048 => "Runtime Notice"); $err = ''; if (isset($_SERVER['REQUEST_URI'])) { $err .= "URL:\t\thttp://" . DOMAIN . $_SERVER['REQUEST_URI'] . "\n"; } else { $err .= "URL:\t\tNone - running from command line?\n"; } if (isset($_SERVER['HTTP_REFERER'])) { $err .= "Referer:\t" . $_SERVER['HTTP_REFERER'] . "\n"; } else { $err .= "Referer:\tNone\n"; } if (isset($_SERVER['HTTP_USER_AGENT'])) { $err .= "User-Agent:\t" . $_SERVER['HTTP_USER_AGENT'] . "\n"; } else { $err .= "User-Agent:\tNone\n"; } $err .= "Number:\t\t{$errno}\n"; $err .= "Type:\t\t" . $errortype[$errno] . "\n"; $err .= "Message:\t{$errmsg}\n"; $err .= "File:\t\t{$filename}\n"; $err .= "Line:\t\t{$linenum}\n"; if (count($_POST)) { $err .= "_POST:"; foreach ($_POST as $k => $v) { $err .= "\t\t{$k} => {$v}\n"; } } // I'm not sure this bit is actually any use! // set of errors for which a var trace will be saved. // $user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE); // if (in_array($errno, $user_errors)) { // $err .= "Variables:\t" . serialize($vars) . "\n"; // } // Add the problematic line if possible. if (is_readable($filename)) { $source = file($filename); $err .= "\nSource:\n\n"; // Show the line, plus prev and next, with line numbers. $err .= $linenum - 2 . " " . $source[$linenum - 3]; $err .= $linenum - 1 . " " . $source[$linenum - 2]; $err .= $linenum . " " . $source[$linenum - 1]; $err .= $linenum + 1 . " " . $source[$linenum]; $err .= $linenum + 2 . " " . $source[$linenum + 1]; } // Will we need to exit after this error? $fatal_errors = array(E_ERROR, E_USER_ERROR); if (in_array($errno, $fatal_errors)) { $fatal = true; } else { $fatal = false; } // Finally, display errors and stuff... if (DEVSITE) { // On a devsite we just display the problem. $message = array('title' => "Error", 'text' => "{$err}\n"); if (is_object($PAGE)) { $PAGE->error_message($message, $fatal); vardump(adodb_backtrace()); } else { vardump($message); vardump(adodb_backtrace()); } } else { // On live sites we display a nice message and email the problem. $message = array('title' => "Sorry, an error has occurred", 'text' => "We've been notified by email and will try to fix the problem soon!"); if (is_object($PAGE)) { $PAGE->error_message($message, $fatal); } else { header('HTTP/1.0 500 Internal Server Error'); print "<p>Oops, sorry, an error has occurred!</p>\n"; } if (!($errno & E_USER_NOTICE)) { mail(BUGSLIST, "[TWFYBUG]: {$errmsg}", $err, "From: Bug <" . CONTACTEMAIL . ">\n" . "X-Mailer: PHP/" . phpversion()); } } // Do we need to exit? if ($fatal) { exit(1); } }
public function getErrorInfo() { $err = $this->db->errorInfo; vardump($err); $error = $err[2]; $errno = $err[1]; $err = array('errno' => $errno, 'error' => $error); return $err; }
$cliente = new nusoap_client('http://192.232.212.191/~promedic/remoto/server.php'); $res = $cliente->call('sql', array("sql" => "updateAdminte", "folios" => $notinWS)); if (!$res["err"]) { #meter a la base de datos de multi los registros de recepcion_id, folio_rastreo y fecha $info = $res["data"]; if (count($info) == 0) { echo "No hay elementos para actualizar"; exit; } foreach ($info as $d) { try { $bd = new formas($dsnWriter); $bd->beginTransaction(); $recepcion = $d["RECEPCION_ID"]; $folio = $d["FOLIO_RASTREO"]; $fecha = $d["FECHA"]; $sql = "INSERT INTO examenes_adminte (RECEPCION_ID, FOLIO_RASTREO, FECHA_ATENCION) VALUES ({$recepcion},{$folio},'{$fecha}');"; $res = $bd->exec($sql); $bd->commit(); echo "Actualización correcta"; } catch (PDOException $e) { $bd->rollBack(); $r["err"] = true; $r["msg"] = $e->getMessage(); vardump($r); } $bd = NULL; } } else { vardump($res); }
function checkPermission($module, $action = true, $owner = false) { # called by modules /* check if the current logged user have permission to perform $action in $module. * $owner = false to check any permission * $owner = array( true|false if for own items, true|false if for items on same group, true|false on same "other" table linked from users, id_group ) * id_group is used to check level, if not provided, will use current logged group (thus, will return true) */ ############################### $debug = false; //is_object($module) && $module->name == "bi_pme"; ############################### if ($owner !== false && (!is_array($owner) || count($owner) < 3)) { // allow missing group $this->parent->errorControl->raise(526, vardump($owner), is_object($module) ? $module->name : $module, "Action: " . $action); } if (isset($_SESSION[CONS_SESSION_ACCESS_LEVEL]) && $_SESSION[CONS_SESSION_ACCESS_LEVEL] == 100 || !$this->parent->safety) { if ($debug) { die("checkPermission: MASTER or safety off, can all"); } return true; # security is lax, consider it can } if (!is_object($module)) { $req = $module; $module = $this->parent->loaded($module, true); if (!is_object($module) || ($action != true && $action != CONS_ACTION_SELECT && $action != CONS_ACTION_UPDATE || $action != CONS_ACTION_DELETE) && isset($this->parent->loadedPlugins[$req])) { // it's a plugin (module does not exist OR exists but we are requesting an extended action from a plugin with the same name) $module = $req; if (isset($this->parent->loadedPlugins[$module])) { // yes, a plugin $pos = 9; foreach ($this->parent->loadedPlugins[$module]->customPermissions as $ptag => $pi18n) { if ($ptag == $action) { $p = isset($_SESSION[CONS_SESSION_ACCESS_PERMISSIONS]["plugin_" . $module][$pos]) && $_SESSION[CONS_SESSION_ACCESS_PERMISSIONS]["plugin_" . $module][$pos] == "1"; if ($debug) { die("checkPermission: PLUGIN permission, will return " . ($p ? "TRUE" : "FALSE") . " on basepos {$pos} (plugin permissions where " . $_SESSION[CONS_SESSION_ACCESS_PERMISSIONS]["plugin_" . $module][$pos] . ")"); } return $p; } $pos++; } // didn't find such permission if ($debug) { die("checkPermission: permission not found, error. Deny"); } return false; } else { // maybe not (neither plugin nor module exist with that name) if ($debug) { die("checkPermission: module/plugin not found, error. Deny"); } $this->parent->errorControl->raise(153, 'checkPermissions', $req); return false; } } } if (!isset($_SESSION[CONS_SESSION_ACCESS_PERMISSIONS][$module->name]) || strlen($_SESSION[CONS_SESSION_ACCESS_PERMISSIONS][$module->name]) < 9) { $this->lockPermissions(); # rebuild permissions } if ($owner === false) { # any match $p = true; // if everything fails, suppose we can see (usually it's a non-security tag) if ($action === true || $action === CONS_ACTION_SELECT) { // see $p = $_SESSION[CONS_SESSION_ACCESS_PERMISSIONS][$module->name][0] == "1" || !$module->freeModule && ($_SESSION[CONS_SESSION_ACCESS_PERMISSIONS][$module->name][3] == "1" || $_SESSION[CONS_SESSION_ACCESS_PERMISSIONS][$module->name][6] == "1"); } else { if ($action === CONS_ACTION_INCLUDE) { $p = $_SESSION[CONS_SESSION_ACCESS_PERMISSIONS][$module->name][1] == "1" || !$module->freeModule && ($_SESSION[CONS_SESSION_ACCESS_PERMISSIONS][$module->name][4] == "1" || $_SESSION[CONS_SESSION_ACCESS_PERMISSIONS][$module->name][7] == "1"); } else { if ($action === CONS_ACTION_UPDATE || $action === CONS_ACTION_DELETE) { $p = $_SESSION[CONS_SESSION_ACCESS_PERMISSIONS][$module->name][2] == "1" || !$module->freeModule && ($_SESSION[CONS_SESSION_ACCESS_PERMISSIONS][$module->name][5] == "1" || $_SESSION[CONS_SESSION_ACCESS_PERMISSIONS][$module->name][8] == "1"); } else { if ($action != '') { // plugin permissions? $pos = 9; foreach ($module->plugins as $pluginname) { foreach ($this->parent->loadedPlugins[$pluginname]->customPermissions as $ptag => $pi18n) { if ($ptag == $action) { return isset($_SESSION[CONS_SESSION_ACCESS_PERMISSIONS][$module->name][$pos]) && $_SESSION[CONS_SESSION_ACCESS_PERMISSIONS][$module->name][$pos] == "1"; } $pos++; } } } } } } return $p; } if ($owner !== false && $owner[0] && !$module->freeModule) { // Owner $basepos = 6; } else { if ($owner !== false && ($owner[1] || $owner[2]) && !$module->freeModule) { // same group or random table $basepos = 3; } else { // guest $basepos = 0; } } if ($action === true) { $p = $_SESSION[CONS_SESSION_ACCESS_PERMISSIONS][$module->name][$basepos] == "1"; } else { if ($action == CONS_ACTION_INCLUDE) { $p = $_SESSION[CONS_SESSION_ACCESS_PERMISSIONS][$module->name][$basepos + 1] == "1"; } else { $p = $_SESSION[CONS_SESSION_ACCESS_PERMISSIONS][$module->name][$basepos + 2] == "1"; } } if ($owner === false) { false; } if (!$p && !$module->freeModule && $owner[0] && ($owner[1] || $owner[2])) { # cannot handle OWN, can create GROUP? $basepos = 3; if ($action === true) { $p = $_SESSION[CONS_SESSION_ACCESS_PERMISSIONS][$module->name][$basepos] == "1"; } else { if ($action == CONS_ACTION_INCLUDE) { $p = $_SESSION[CONS_SESSION_ACCESS_PERMISSIONS][$module->name][$basepos + 1] == "1"; } else { $p = $_SESSION[CONS_SESSION_ACCESS_PERMISSIONS][$module->name][$basepos + 2] == "1"; } } } if ($action !== true && $p && !$module->freeModule && !$owner[0] && !$owner[2]) { // ok by GROUP if (!isset($owner[3]) || $owner[3] == $_SESSION[CONS_SESSION_ACCESS_USER]['id_group']) { # own group, so SAME level, can change! return true; } # checkPermission always returns the Owner on FALSE FALSE FALSE except on error, which means I can't determine here either $groupModule = $this->parent->loaded(CONS_AUTH_GROUPMODULE); if ($this->parent->dbo->fetch("SELECT level FROM " . $groupModule->dbname . " WHERE id=" . $owner[3], $this->parent->debugmode) > $_SESSION[CONS_SESSION_ACCESS_LEVEL]) { $p = false; # your level is BELOW the level of whoever owns you are trying to change $this->parent->errorControl->raise(154, 'checkPermissions', CONS_AUTH_GROUPMODULE); } # if check level } if ($debug) { die("checkPermission: Will return " . ($p ? "TRUE" : "FALSE") . " based on basepos {$basepos} (Permissions where " . $_SESSION[CONS_SESSION_ACCESS_PERMISSIONS][$module->name] . ")"); } return $p; }
} #switch $using = clone $objfield; $outdata = array('field' => $content, 'title' => $data['name']); if ($data['name'][0] == '_') { // at the end $tempOutput .= $using->techo($outdata); } else { $tempOutput = $using->techo($outdata) . $tempOutput; } // at the end } else { if ($data['name'] != '_forced' && strpos($data['name'], '_pluginStarter') === false) { # this are not even displayed on hidden if (is_array($data['value'])) { $data['value'] = vardump($data['value']); } $temp .= $objh->techo($data); } } } # loop --- $core->template->assign("_FORM_field", $tempOutput); if ($hasImages) { $core->addLink('shadowbox/shadowbox.css'); $core->addLink('shadowbox/shadowbox.js'); $core->template->constants['HEADUSERTAGS'] .= "\n<script type=\"text/javascript\"><!--\nShadowbox.init();\n//--></script>"; } if (strpos($endScript, 'CKEDITOR.') !== false) { # some field loaded CKEDITOR, so add it $core->addLink("ckfinder/ckfinder.js", true);
li, p { font: 12px/16px Arial, Helvetica, sans-serif; } #nav { overflow: hidden; padding-left: 0; } .responsive-table { width: 100%; } </style> </head> <body> <?php echo vardump($branch_name); ?> <header> <div class="navbar-fixed"> <nav class="grey lighten-4 main-nav ripple" id="meet-1" role="navigation"> <div class="nav-wrapper container"> <a href="#!" class="brand-logo black-text">Sinereserve Admin</a> <ul class="right hide-on-med-and-down"> <li><a href="sass.html" class="black-text">Log-out</a></li> </ul> </div> </nav> </div> </header> <div class="side_nav"> <ul id="slide-out" class="side-nav fixed">
<?php include "includes/nusoap/lib/nusoap.php"; include "includes/funciones.php"; $ws = new nusoap_client('http://www2.soriana.com/integracion/recibecfd/wseDocRecibo.asmx', 'http://www2.soriana.com/integracion/recibecfd/wseDocRecibo.asmx?WSDL'); $ws = new SoapClient('http://www2.soriana.com/integracion/recibecfd/wseDocRecibo.asmx?WSDL'); class XMLCFD { function XMLCFD($t) { $this->XMLCFD = $t; } } #$file='soriana.xml'; $file = 'factura_prueba.xml'; $xmlstr = str_replace('<?xml version="1.0" encoding="UTF-8"?>', "", file_get_contents($file)); $xmls = simplexml_load_string($xmlstr); vardump($xmlstr); $xml = new XMLCFD($xmlstr); $resp = $ws->__soapCall("RecibeCFD", array($xml)); $xmls = simplexml_load_string($resp->RecibeCFDResult); $json = json_encode($xmls); $array = json_decode($json, TRUE); vardump($array);
function get_character_id_by_filename($stash_file) { //Parse name out of file name $character_name = preg_replace("/.*\\/(.*) - StashLog.*/", "\$1", $stash_file); //Parse class out of file name $class_name = preg_replace("/.*- (.*).log\$/", "\$1", $stash_file); //See if character name exists in database $query = $this->db->get_where("db_characters", array("name" => $character_name, "class" => $class_name)); $row = $query->row(); //If empty, insert character into database if (empty($row)) { $character = array('name' => $character_name, 'class' => $class_name); $this->db->insert('db_characters', $character); vardump($character, true); $character_id = $this->db->insert_id(); } else { $character_id = $row->id; } return $character_id; }
function dt_listApps() { $appList = get_option('dt_int_Apps'); ob_start(); vardump($appList); $out['html'] = ob_get_clean(); $Return = '<div style="float:left; width: 25%;">'; $Return .= '<h3>Application</h3>'; $Return .= '<select id="dbtoolkit_AppList">'; $Return .= '<option value=""></option>'; foreach ($appList as $app => $state) { $Sel = ''; if ($default == $app) { $Sel = 'selected="selected"'; } if ($state['state'] == 'open') { $Return .= '<option value="' . $app . '" ' . $Sel . '>' . ucwords($state['name']) . '</option>'; } } $Return .= '</select>'; $Return .= '</div>'; $Return .= '<div style="float:left; width: 60%; padding-left:10px;" id="dbtoolkit_InterfaceList"></div>'; //$Return .= '<div style="float:left; width: 30%;" id="dbtoolkit_ClusterList"></div>'; $Out['html'] = $Return; if (!empty($default)) { $Out['app'] = $default; } return $Out; }
function vardump($content) { // better output then var_dump (does not work with objects tough) if (!is_array($content)) { return $content === true ? "true" : ($content === false ? "false" : $content); } else { $out = "("; foreach ($content as $c) { $out .= vardump($c) . ", "; } $out = substr($out, 0, strlen($out) - 2) . ")"; // removes last ', ' return $out; } }
?> </a></p> <p>Tick here if it worked <input type="checkbox" name="wikiguess"$checked></p> <p><input type="submit" name="previewterm" value="Preview" class="submit"> <input type="submit" name="submitterm" value="Post" class="submit"></p></label> </div> <?php // Off it goes... print "<p>This is what it was going to look like:</p>"; print "<h3>{$title}</h3>"; $PAGE->glossary_display_term($GLOSSARY); } else { // add a modification to the database if (get_http_var('submitterm') && get_http_var('modify')) { $data = array('user_id' => get_http_var('userid'), 'title' => get_http_var('g'), 'body' => get_http_var('definition')); vardump($data); // $success = $EDITQUEUE->modify($data); } if ($EDITQUEUE->pending_count) { print "<h3>" . $EDITQUEUE->pending_count . " Pending Glossary terms</h3>"; $EDITQUEUE->display("pending"); } else { print "<h3>Nothing pending, tap your fingers awhile.</h3>"; } } // Now that's easy :) // Even easier when you copy it :p $menu = $PAGE->admin_menu(); $PAGE->stripe_end(array(array('type' => 'html', 'content' => $menu))); $PAGE->page_end();
function console($core, $command) { if (defined('CONS_AUTH_USERMODULE') && $_SESSION[CONS_SESSION_ACCESS_LEVEL] < 100) { echo 'access denied'; $core->close(); } $words = explode(" ", trim($command)); if ($words[0] == "help" || $words[0] == "?") { echo "clear - clears the console screen<br/>"; // implemented on the HTML/js echo "delete [key] - deletes a key off dimconfig<br/>"; echo "dev [on|off] - enable/disable developer assistent plugin (affbi_dev)<br/>"; echo "test - returns a bi_dev fulltest<br/>"; echo "dump [dimconfig|session|constants|config] - displays the contents of the dimconfig, session or constant variables<br/>"; //echo "compileaff - compiles aff distribution into new/ folder<br/>"; echo "dbfill - adds up to 10 random items on EVERY database of the site<br/>"; echo "set [variable] [value] - sets a dimconfig variable<br/>"; echo "cache - displays the full cacheThrottle log, as well current values<br/>"; echo "purge [log|cache|bans|all] - purches all server-side log, cache, ip bans or all these options<br/>"; echo "ip - Shows local/server IP's"; $core->close(); } if ($words[0] == "set" && isset($words[1]) && isset($words[2])) { $core->dimconfig[$words[1]] = $words[2]; echo $words[1] . " set to '" . $words[2] . "'"; $core->saveConfig(true); $core->close(); } if ($words[0] == "ip") { echo "SERVER IP: " . GetIP(false) . "<br/>"; echo "ON SERVER: " . (CONS_ONSERVER ? "true" : "false") . "<br/>"; echo "REMOTE IP: " . CONS_IP; $core->close(); } if ($words[0] == "delete") { if (isset($core->dimconfig[$words[1]])) { unset($core->dimconfig[$words[1]]); $core->saveConfig(true); echo "dimconfig keyword deleted"; } else { echo "dimconfig keyword not found"; } $core->close(); } if ($words[0] == "dev") { if ($words[1] == "on" || $words[1] == '1') { if (isset($core->loadedPlugins['bi_dev'])) { echo "dev already on"; $core->close(); } else { $filenm = CONS_PATH_PAGES . $_SESSION['CODE'] . "/_config/config.php"; $file = cReadFile($filenm); cWriteFile($filenm . ".bak", $file); $file .= "\n\$dev = \$this->addPlugin('bi_dev');\n\$dev->administrativePage = \"/adm/\";"; cWriteFile($filenm, $file); echo "dev added to config.php"; $core->close(); } } else { if (!isset($core->loadedPlugins['bi_dev'])) { echo "dev already off"; $core->close(); } else { $filenm = CONS_PATH_PAGES . $_SESSION['CODE'] . "/_config/config.php"; $file = cReadFile($filenm); cWriteFile($filenm . ".bak", $file); $file = str_replace("\$dev = \$this->addPlugin('bi_dev');", "", $file); $file = str_replace("\$dev->administrativePage = \"/adm/\";", "", $file); cWriteFile($filenm, $file); echo "dev removed from config.php"; $core->close(); } } } if ($words[0] == "test") { if (isset($core->loadedPlugins['bi_dev'])) { $ok = $core->loadedPlugins['bi_dev']->fulltest(true); echo "DEV-Fulltest: " . ($ok ? "ERRORS!" : "OK!"); } else { echo "dev is off"; } $core->close(); } if ($words[0] == "dump") { $out = ""; if ($words[1] == "dimconfig") { foreach ($core->dimconfig as $name => $content) { $out .= $name . " : " . vardump($content) . "<br/>"; } echo $out; $core->close(); } else { if ($words[1] == "session") { foreach ($_SESSION as $name => $content) { $out .= $name . " : " . (is_array($content) ? implode(", ", $content) : $content) . "<br/>"; } echo $out; $core->close(); } else { if ($words[1] == "constants") { foreach ($core->template->constants as $name => $content) { $out .= $name . " : " . (is_array($content) ? implode(", ", $content) : $content) . "<br/>"; } echo $out; $core->close(); } else { if ($words[1] == "config") { echo "CONS_AFF_DATABASECONNECTOR: " . CONS_AFF_DATABASECONNECTOR . "<br/>"; echo "CONS_AFF_ERRORHANDLER: " . (CONS_AFF_ERRORHANDLER ? "true" : "false") . "<br/>"; echo "CONS_AFF_ERRORHANDLER_NOWARNING: " . (CONS_AFF_ERRORHANDLER_NOWARNING ? "true" : "false") . "<br/>"; echo "CONS_AJAXRUNSSCRIPTS: " . (CONS_AJAXRUNSSCRIPTS ? "true" : "false") . "<br/>"; echo "CONS_SINGLEDOMAIN: " . CONS_SINGLEDOMAIN . "<br/>"; echo "CONS_DEFAULT_IPP: " . CONS_DEFAULT_IPP . "<br/>"; echo "CONS_FLATTENURL: " . CONS_FLATTENURL . "<br/>"; echo "CONS_AUTOREMOVEWWW: " . CONS_AUTOREMOVEWWW . "<br/>"; echo "CONS_DEFAULT_MIN_OBJECTCACHETIME: " . CONS_DEFAULT_MIN_OBJECTCACHETIME . "<br/>"; echo "CONS_DEFAULT_MAX_OBJECTCACHETIME: " . CONS_DEFAULT_MAX_OBJECTCACHETIME . "<br/>"; echo "CONS_DEFAULT_MIN_BROWSERCACHETIME: " . CONS_DEFAULT_MIN_BROWSERCACHETIME . "<br/>"; echo "CONS_DEFAULT_MAX_BROWSERCACHETIME: " . CONS_DEFAULT_MAX_BROWSERCACHETIME . "<br/>"; echo "CONS_PM_MINTIME: " . CONS_PM_MINTIME . "<br/>"; echo "CONS_PM_TIME: " . CONS_PM_TIME . "<br/>"; echo "CONS_FREECPU: " . (CONS_FREECPU ? "true" : "false") . "<br/>"; echo "CONS_MONITORMAILSOURCE: " . CONS_MONITORMAILSOURCE . "<br/>"; echo "CONS_MONITORMAIL: " . CONS_MONITORMAIL . "<br/>"; echo "CONS_HTTPD_ERRDIR: " . CONS_HTTPD_ERRDIR . "<br/>"; echo "CONS_HTTPD_ERRFILE: " . CONS_HTTPD_ERRFILE . "<br/>"; echo "CONS_MASTERMAIL: " . CONS_MASTERMAIL . "<br/>"; echo "CONS_ECONOMICMODE: " . (CONS_ECONOMICMODE ? 'true' : 'false') . "<br/>"; echo "CONS_ACCEPT_DIRECTLINK: " . (CONS_ACCEPT_DIRECTLINK ? "true" : "false") . "<br/>"; echo "CONS_SITESELECTOR: " . (CONS_SITESELECTOR ? "true" : "false") . "<br/>"; echo "CONS_NOROBOTDOMAINS: " . CONS_NOROBOTDOMAINS . "<br/>"; echo "CONS_FILESEARCH_EXTENSIONS: " . CONS_FILESEARCH_EXTENSIONS . "<br/>"; echo "CONS_TOOLS_DEFAULTPERM: " . CONS_TOOLS_DEFAULTPERM . "<br/>"; echo "CONS_GZIP_MINSIZE: " . CONS_GZIP_MINSIZE . "<br/>"; echo "CONS_CRAWLER_WHITELIST_ENABLE: " . (CONS_CRAWLER_WHITELIST_ENABLE ? "true" : "false") . "<br/>"; echo "CONS_CRAWLER_WHITELIST: " . CONS_GZIP_MINSIZE . "<br/>"; echo "CONS_HONEYPOT: " . (CONS_HONEYPOT ? "true" : "false") . "<br/>"; echo "CONS_HONEYPOTURL: " . CONS_GZIP_MINSIZE . "<br/>"; echo "------ site config (" . $_SESSION['CODE'] . ") ------<br/>"; echo "CONS_USE_I18N: " . (CONS_USE_I18N ? "true" : "false") . "<br/>"; echo "CONS_DEFAULT_LANG: " . CONS_DEFAULT_LANG . "<br/>"; echo "CONS_DEFAULT_FAVICON: " . (CONS_DEFAULT_FAVICON ? "true" : "false") . "<br/>"; echo "CONS_INSTALL_ROOT: " . CONS_INSTALL_ROOT . "<br/>"; echo "CONS_DB_HOST: " . CONS_DB_HOST . "<br/>"; echo "CONS_DB_BASE: " . CONS_DB_BASE . "<br/>"; echo "CONS_SITE_ENTRYPOINT: " . CONS_SITE_ENTRYPOINT . "<br/>"; echo "languagetl: " . vardump($core->languageTL) . "<br/>"; echo "forceLang: " . $core->forceLang . "<br/>"; echo "------ modules loaded ----------<br/>"; foreach ($core->modules as $mname => &$m) { echo "{$mname}<br/>"; } $core->close(); } } } } echo "add 'dimconfig', 'session', 'constants', 'config'<br/>"; } if ($words[0] == "dbfill") { if (isset($core->loadedPlugins['bi_dev'])) { $ok = $core->loadedPlugins['bi_dev']->fill(); echo "DEV-Fill: " . ($ok == false ? "ERROR!" : "Ok, {$ok} items included"); } else { echo "dev is off, turn dev on to use dbfill"; } $core->close(); } if ($words[0] == 'cache') { if (CONS_ECONOMICMODE) { echo "Economic mode on, cache control disabled"; } else { if (is_file(CONS_PATH_LOGS . "cachecontrol.dat")) { $cc = unserialize(cReadFile(CONS_PATH_LOGS . "cachecontrol.dat")); if ($cc !== false) { echo "Date, Page average loadtime, Cache throttle %\n<br/>"; foreach ($cc as $ccitem) { echo $ccitem[0] . ", " . number_format($ccitem[1]) . "ms, " . floor(100 * $ccitem[2]) . "%\n<br/>"; } $cc = unserialize(cReadFile(CONS_PATH_CACHE . "cachecontrol.dat")); if ($cc !== false) { echo "CURRENT: " . number_format($cc[0]) . "ms, " . floor(100 * $cc[1]) . "%"; } else { echo "CURRENT: unable to load cachecontrol.dat in cache"; } } else { echo "cachecontrol.dat corrupt"; } } else { echo "cachecontrol.dat not found in logs"; } } $core->close(); } if ($words[0] == "purge") { $purgeThis = array(!isset($words[1]) || $words[1] == "log" || $words[1] == "all", !isset($words[1]) || $words[1] == "cache" || $words[1] == "all", !isset($words[1]) || $words[1] == "bans" || $words[1] == "all"); if ($purgeThis[1]) { $core->cacheControl->dumpTemplateCaches($purgeThis[0], true); $core->dimconfig['_404cache'] = array(); $core->saveConfig(true); } if ($purgeThis[0]) { $listFiles = listFiles(CONS_PATH_LOGS, "/^([^a]).*(\\.log)\$/i", false, false, true); foreach ($listFiles as $file) { @unlink(CONS_PATH_LOGS . $file); } } if ($purgeThis[2]) { foreach (glob(CONS_PATH_TEMP . "*.dat") as $file) { if (!is_dir($file)) { @unlink($file); } } } echo "Ok! (flags=" . ($purgeThis[0] ? "L" : "l") . ($purgeThis[1] ? "C" : "c") . ($purgeThis[2] ? "B" : "b") . ")"; $core->close(); } if ($words[0] == "phpinfo") { phpinfo(); $core->close(); } if (is_file(CONS_PATH_PAGES . $_SESSION['CODE'] . "/_config/_console.php")) { include CONS_PATH_PAGES . $_SESSION['CODE'] . "/_config/_console.php"; } echo "command not understood"; $core->close(); }
function dbt_sendError($Interface, $ErrorData) { global $current_user; get_currentuserinfo(); $InterfaceData = get_option($Interface); $InterfaceDataraw = base64_encode(serialize($InterfaceData)); $InterfaceData['Content'] = unserialize(base64_decode($InterfaceData['Content'])); unset($_SESSION['errorReport'][$Interface]); $_SESSION['errorReport'][$Interface][md5($InterfaceDataraw)] = true; vardump($InterfaceData); // exit; $to = 'DB-Toolkit Support <*****@*****.**>'; $subject = 'DB-Toolkit Error Report'; ob_start(); echo "<h4>Wordpress Details</h4>"; vardump('Site Name:' . get_bloginfo('name')); vardump('Site URL:' . get_bloginfo('siteurl')); vardump('Admin Email:' . get_bloginfo('admin_email')); vardump('Wordpress Version:' . get_bloginfo('version')); echo "<h4>Query Error</h4>"; vardump(base64_decode($ErrorData)); echo "<h4>Config</h4>"; vardump($InterfaceData); echo '<h4>Raw Config</h4>'; echo $InterfaceDataraw; $message = ob_get_clean(); $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: ' . $current_user->display_name . ' <' . $current_user->user_email . '>' . "\r\n"; return mail($to, $subject, $message, $headers); }
/* * test_smtp.php * * @(#) $Header: /home/mlemos/cvsroot/smtp/test_smtp.php,v 1.18 2009/04/11 22:23:24 mlemos Exp $ * */ require "smtp.php"; require "sasl.php"; $sender = "*****@*****.**"; /* Change this to your address like "*****@*****.**"; */ $sender_line = __LINE__; if (strlen($sender) == 0) { die("Please set the messages sender address in line " . $sender_line . " of the script " . basename(__FILE__) . "\n"); } if (strlen($to) == 0) { die("Please set the messages recipient address in line " . $recipient_line . " of the script " . basename(__FILE__) . "\n " . vardump($recipient)); } $smtp = new smtp_class(); $smtp->host_name = "smtp-relay.gmail.com"; //IP address /* Change this variable to the address of the SMTP server to relay, like "smtp.myisp.com" */ $smtp->host_port = 587; /* Change this variable to the port of the SMTP server to use, like 465 */ $smtp->ssl = 0; /* Change this variable if the SMTP server requires an secure connection using SSL */ $smtp->start_tls = 1; /* Change this variable if the SMTP server requires security by starting TLS during the connection */ $smtp->localhost = "www"; /* Your computer address */ $smtp->direct_delivery = 0; /* Set to 1 to deliver directly to the recepient SMTP server */ $smtp->timeout = 10;
function showHeaders() { if (!$this->headerControl->softHeaderSent) { // we know headers already sent and can't be resent # Header / cache if ($this->action != "404" && $this->action != "403") { $this->headerControl->addHeader(CONS_HC_HEADER, 200); } # Let's face it, we want IE to render on edge if (CONS_BROWSER == "IE") { $this->headerControl->addHeader(CONS_X_UA_Compatible, "X-UA-Compatible: IE=edge"); } // dont add chrome=1 here please ... PLEASE ... IE is IE, Chrome is Chrome, no point on forcing IE to run Chrome plugin if ($this->doctype == "xhtml" && (CONS_BROWSER != "IE" || CONS_BROWSER_VERSION > 8)) { $this->headerControl->addHeader(CONS_HC_CONTENTTYPE, "Content-Type: application/xhtml+xml; charset=" . $this->charset); } else { $this->headerControl->addHeader(CONS_HC_CONTENTTYPE, "Content-Type: text/html; charset=" . $this->charset); } $this->headerControl->addHeader(CONS_HC_PRAGMA, 'Pragma: ' . ($this->layout != 2 && CONS_DEFAULT_CACHETIME > 2 && !$this->cacheControl->noCache ? 'public' : 'no-cache')); if (CONS_CACHE && $this->layout != 2 && !$this->cacheControl->noCache) { $this->headerControl->addHeader(CONS_HC_CACHE, 'Cache-Control: public,max-age=' . CONS_DEFAULT_CACHETIME . ',s-maxage=' . CONS_DEFAULT_CACHETIME); } else { $this->headerControl->addHeader(CONS_HC_CACHE, 'Cache-Control: no-cache, no-store'); } } # logs 404/403 in separate error code if ($this->action == '404' || $this->action == '403') { $this->errorControl->raise(103, $this->context_str . $this->action, "404x403", vardump($this->warning)); } }
/** * This method parses a query formatted for SC::{@link query_ex}() into * proper SQL. */ function parseQuery_ex($query,$values,$atom_meta=false) { // TODO: {f:date_add({u.creation_date},:lala:)} // Warning! the format must always be "{f:<function_name>([paramterer]*)}" // i.e. the function name MUST be always followed by brackets // TODO: SELECT {u.}, UNIX_TIMESTAMP(DATE_ADD({u.date_created!}, INTERVAL 1 DAY)) AS lala FROM {LFX_User|u} // Populates u.date_created, which it shouldn't! //echo("<pre>$query</pre>"); // Variable initialisation if (!$atom_meta) { $atom_meta=array( 'table_aliases_defined'=>array(), 'table_aliases_used'=>array() ); } $tables_started=false; $new_query=''; $old_query=$query; // Let's first identify the atoms (curly brackets) and the parameters (columns) if (!preg_match_all("/\{[^\}]+\}/",$query,$all_matches) && !preg_match_all("/\:[^\:\{\}\(\)\"']+\:/",$query,$parameters)) // No atoms? Simply return the string. return $query; $all_matches=$all_matches[0]; // Now, let's get all regexps out of the way. We have three main types of // atoms: // (1) Table atoms which define (table) aliases; // (2) Field atoms which define (field) aliases; // (3) Table atoms which don't define aliases (these can't use aliases anyway, they can only define them). // (4) Field atoms which don't define aliases (we don't care much whether they use any aliases or not). // Let's identify all three types of atoms: // Type (1) -- atoms which define table aliases: // (an alias definition NOT preceded by any period) preg_match_all("/\{[^\}\.]+\|[^\}]+\}/",$query,$table_alias_def_matches); $table_alias_def_matches=$table_alias_def_matches[0]; //echo("<h2>Table -- aliases</h2>".vardump($table_alias_def_matches)); // Type (2) -- atoms which define field aliases: // (an alias definition which IS preceded by a period somewhere) preg_match_all("/\{[^\|\}]+\.[^\|\}]+\|[^\|\}]+\}/",$query,$field_alias_def_matches); $field_alias_def_matches=$field_alias_def_matches[0]; //echo("<h2>Field -- aliases</h2>".vardump($field_alias_def_matches)); // Type (3) -- table atoms which don't define any aliases // (no periods, no vertical bars) preg_match_all("/\{[^\|\}\.]+\}/",$query,$table_non_alias_def_matches); $table_non_alias_def_matches=$table_non_alias_def_matches[0]; //echo("<h2>Table -- no aliases</h2>".vardump($table_non_alias_def_matches)); // Type (4) -- field atoms which don't define any aliases // (at least one period, no vertical bars) preg_match_all("/\{[^\|\}]*\.[^\|\}]*\}/",$query,$field_non_alias_def_matches); $field_non_alias_def_matches=$field_non_alias_def_matches[0]; //echo("<h2>Field -- no aliases</h2>".vardump($field_non_alias_def_matches)); // Ok, and now parameters... // preg_match_all("/\:[^\:\{\}\(\)\"']+\:/",$query,$parameters); $parameters=$parameters[0]; // Ok, now we have all atoms broken down into categories. // Let's first check if we didn't mess up with the regexps, by any chance: if ( count($all_matches) != count($table_alias_def_matches) + count($field_alias_def_matches) + count($table_non_alias_def_matches)+ count($field_non_alias_def_matches) ) throw new LogicException("Unexpected condition: ". "regular expressions count mismatch! This is a problem in the ". "code, please notify the developers! ". "The query section was '$query', please send the query along with ". "the bug report."); // Right, now that we know everything adds up, let's start by identifying // the table aliases. Please note we're not DOING anything yet, we're // simply pre-parsing these, as to populate the meta array. for($i=0;$i<count($table_alias_def_matches);$i++) { // Trimming the curly brackets... $match=substr($table_alias_def_matches[$i],1,-1); $Xmatch=explode('|',$match); //decho("Xmatch: ".vardump($Xmatch)); $atom_meta['table_aliases'][$Xmatch[1]]=$Xmatch[0]; } // Ok, let's parse each atom now... $objects_cache=array(); for($i=0;$i<count($all_matches);$i++) { $is_result=true; unset($class_trim); $alias=$alias_def=$skip_atom=false; $meta=array(); $new_query.=substr($old_query,0,strpos($old_query,$all_matches[$i])); $old_query=substr($old_query,strpos($old_query,$all_matches[$i])+strlen($all_matches[$i])); //decho("\$i=$i"); //decho("\$all_matches: ".vardump($all_matches)); //echo("<pre>$new_query<b>{$all_matches[$i]}</b>$old_query</pre>\n"); // Trimming the curly brackets... $match=substr($all_matches[$i],1,-1); // Now let's first look for the class definition $class_regexp="/^[^\.\/\|\!]+/"; if (!preg_match($class_regexp,$match,$class)) { $ok=false; if (substr($match,0,1)==='.') { $class_trim=''; if (count($table_alias_def_matches) + count($table_non_alias_def_matches)==1) { if ($table_alias_def_matches) { $ok=(bool) preg_match($class_regexp,substr($table_alias_def_matches[0],1,-1),$class); } else { $ok=(bool) preg_match($class_regexp,substr($table_non_alias_def_matches[0],1,-1),$class); } } if (!$ok) { throw new InvalidArgumentException("When using multiple classes to retrieve data from, all attributes must be prepended with the proper class name -- atom '$match' in query section '$query'"); } } else { throw new InvalidArgumentException("Atom '$match' badly formatted in query section '$query'"); } } $class=$class[0]; if (!isset($class_trim)) { $class_trim=$class; } if (substr($class,0,1)==='|') { // Trying to use an alias for the class; let's see if we know about it... $alias=$meta['alias']=substr($class,1); if (!$class=$atom_meta['table_aliases'][substr($class,1)]) { throw new InvalidArgumentException("Table alias '".substr($class,1)."' unknown, in atom '$match', in query section '$query'"); } } // Now that we know the class, we'll try to include it if (!class_exists($class)) { if (!$aliased_class=$atom_meta['table_aliases'][$class]) { throw new DomainException("Neither class nor alias \"$class\" exists, in atom \"$match\", in query section \"$query\""); } if (!class_exists($aliased_class)) { throw new DomainException("Class doesn't exist -- \"$aliased_class\" used in atom \"$match\" in query \"$query\"."); } $alias=$meta['alias']=$class; $class=$aliased_class; } if (!isset($objects_cache[$class])) { $object=new $class; $objects_cache[$class]=$object; } else { $object=$objects_cache[$class]; } // Great! We know what the class is, and it also exists! // We'll now parse the rest of this atom into the $meta array $meta['atom']=$match; $meta['class']=$class; $rest=substr($match,strlen($class_trim)); while($rest) { $rest_before=$rest; //decho("REST:$rest"); switch(substr($rest,0,1)) { case '.': // Plain attribute, id, or special key $rest=substr($rest,1); if (preg_match("/^[^\.\/\|\(\!\~]+/",$rest,$attr)) { // plain attr $attr=$attr[0]; $rest=substr($rest,strlen($attr)); if ($attr=='*') { // First, clean up the remaining string decho("Keys: $keys[0]"); $rest=substr($rest,strlen($keys[0])); // Now insert "matches" as if the user had typed all fields if ($alias) { $prefix=$alias; } else { $prefix=$class; } $insert_matches=array("\{$prefix.}"); $insert_query="\{$prefix.}, "; foreach($object->dataStructure['fields'] as $field=>$field_data) { $insert_matches[]="\{$prefix.$field}"; $insert_query.="\{$prefix.$field}, "; } array_splice($all_matches,$i+1,0,$insert_matches); $insert_query=substr($insert_query,0,-2); $old_query=$insert_query.$old_query; $skip_atom=true; decho("New matches: ".vardump($new_matches)); } } elseif (preg_match("/^\(([^\)]+)\)$/",$rest,$keys)) { // special key $key=$keys[1]; if ($key=='zazazozo') { // for future use } else { throw new DomainException("Special key \"$key\" unknown, in atom \"$match\", in query section \"$query\"."); } } else { // ID $attr=false; } $meta['attribute']=$attr; break; case '!': // We need to provide raw data from the database $meta['raw']=true; $rest=substr($rest,1); break; case '~': $is_result=false; $rest=substr($rest,1); break; case '|': // Alias, or alias definition (we don't know here whether it's a table or field alias) $rest=substr($rest,1); if (true) { // Alias definition $alias_def=true; //$rest=substr($rest,1); } else { // Alias being used $alias_def=false; } if (preg_match("/^[^\.\/\|\!]+/",$rest,$alias)) { $alias=$alias[0]; $rest=substr($rest,strlen($alias)); } else { throw new DomainException("Invalid alias, in atom \"$match\", in query section \"$query\"."); } if ($alias_def) { $meta['alias_def']=$alias; } else { $meta['alias']=$alias; } break; } if ($rest==$rest_before) { throw new DomainException ("Unrecognized atom leftover \"$rest\", in atom \"$match\", in query section \"$query\"."); } } if ($skip_atom) { continue; } $meta['table']=$table=$object->getTableName(true); //echo("<font color='green'>Meta: ".vardump($meta)."</font><br />\n"); if (!empty($meta['alias'])) { $table=$meta['alias']; $atom_meta['table_aliases_used']=array_unique(array_merge($atom_meta['table_aliases_used'],array($meta['alias']))); } else { $table=$meta['table']; } if (isset($meta['attribute'])) { // Please note that SC::getFieldName() returns the ID field if passed FALSE as the first parameter $field=$meta['field']=$object->getFieldName($meta['attribute'],true); } if (!empty($meta['alias_def'])) { // Ok, this is where we find out whether a defined alias if a table or a field alias. if (isset($meta['attribute'])) { // Field alias; this is the ONLY case in which a field alias is in any way recognized // by the SuperClass; therefore, when the two if() blocks opened above end, we simply // "rename" 'alias' to 'table_alias', and 'alias_def' to 'table_alias_def'. if (!$meta['raw'] && $object->dataStructure['fields'][$meta['attribute']]['flags']['sqlDate']) { $new_query.="UNIX_TIMESTAMP(".$table.".".$field.") AS ".$meta['alias_def']; } else { $new_query.=$table.".".$field." AS ".$meta['alias_def']; } $meta['field_alias_def']=$meta['alias_def']; $atom_meta['field_aliases_defined'][]=$meta['field_alias_def']; unset($meta['alias_def']); } else { // Table alias if (in_array($meta['alias_def'],$atom_meta['table_aliases_defined'])) { throw new DomainException("Alias \"{$mets['alias_def']}\" defined multiple times in query section \"$query\"."); } $atom_meta['table_aliases_defined'][]=$meta['alias_def']; $new_query.=$meta['table'].' AS '.$meta['alias_def']; } } elseif (isset($meta['attribute'])) { if (!empty($meta['attribute']) && empty($meta['raw']) && $object->dataStructure['fields'][$meta['attribute']]['flags']['sqlDate']) { $new_query.="UNIX_TIMESTAMP(".$table.".".$field.")"; } else { $new_query.=$table.".".$field; } } else { $new_query.=$table; } if (!empty($meta['alias_def'])) { $meta['table_alias_def']=$meta['alias_def']; unset($meta['alias_def']); } if (!empty($meta['alias'])) { $meta['table_alias']=$meta['alias']; unset($meta['alias']); } if (!empty($meta['field'])) { $meta['result']=$is_result && !$tables_started; $atom_meta['fields'][]=$meta; } else { $tables_started=true; $atom_meta['tables'][]=$meta; } } $new_query.=$old_query; //echo("After atom parsing: <pre>$new_query</pre>"); // Great! Now let's parse those parameters as well. $old_query=$new_query; $new_query=''; // oci8 uses parameter binding via associative arrays, with key format; everybody else // that we know of doesn't -- the rest use "select foo from bar where foobar=?". if (!$object) { $object=&$this; } $atom_meta['parameters_associative']=($object->db->databaseType=='oci8'); $param_array=array(); foreach($parameters as $param) { $new_query.=substr($old_query,0,strpos($old_query,$param)); $old_query=substr($old_query,strpos($old_query,$param)+strlen($param)); $param=substr($param,1,-1); if (substr($param,0,1)=='!') { if (is_array($values[$param])) { $myValues=array(); foreach($values[$param] as $myValue) $myValues[]=$object->db->qstr($myValue); $myValue=implode(",",$myValues); } else $myValue=$object->db->qstr($values[$param]); $new_query.=$myValue; } else { if ($atom_meta['parameters_associative']) { $new_query.=":$param"; } else { $new_query.="?"; } $atom_meta['parameters'][]=$param; } } $new_query.=$old_query; //echo("After parameter parsing: <pre>$new_query</pre>"); for($i=0;$i<count($atom_meta['table_aliases_used']);$i++) { if (!in_array($atom_meta['table_aliases_used'][$i],$atom_meta['table_aliases_defined'])) { throw new DomainException("Alias \"{$atom_meta['table_aliases_used'][$i]}\" used but not defined, in query section \"$query\"."); } } for($i=0;$i<count($atom_meta['table_aliases_defined']);$i++) { if (!in_array($atom_meta['table_aliases_defined'][$i],$atom_meta['table_aliases_used'])) { // **TODO** -- restore this warning, one way or another //$this->addError("SC::parseQuery_ex warning: alias '{$atom_meta['table_aliases_defined'][$i]}' defined but not used, in query section '$query'"); } } // TODO: also check for non-alias tables used/defined return array('query'=>$new_query,'original_query'=>$query,'meta'=>$atom_meta); }
<?php vardump($this);
<?php $file = fopen('http://www.sciencetap.us/assets/App/assets/Images/Observation/Image_43.jpg', 'rb'); $newfile = 'example.jpg'; if (file_exists($file)) { header('Content-Description: File Transfer'); header('Content-Type: image/jpeg'); header('Content-Disposition: attachment; filename=' . basename($file)); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . filesize($file)); readfile($file); // $im =@imagecreatefromjpeg($file); // imagejpeg($im); exit; } else { vardump(headers_list()); } if (!copy($file, $newfile)) { echo "failed to copy {$file}...\n"; } echo basename($file);
function linked_showFilter($Field, $Type, $Default, $Config, $EID) { $FieldTitle = ''; $Return = ''; if (!empty($Config['_FieldTitle'][$Field])) { $FieldTitle = $Config['_FieldTitle'][$Field]; } if ($Type == 'linked') { $outList = array(); foreach ($Config['_Linkedfields'][$Field]['Value'] as $outValue) { $outList[] = $outValue; } if (count($outList) >= 2) { $outString = 'CONCAT(' . implode(',\' \',', $outList) . ')'; } else { $outString = '`' . $outList[0] . '`'; } $outString = $outString . ' AS out_value'; $Multiple = ''; //dump($Config['_Linkedfields']); if (empty($Config['_Linkedfields'][$Field]['SingleSelect'])) { $Multiple = 'multiple="multiple" size="1" class="filterBoxes"'; } $SelectID = $EID . '-' . $Field; $queryWhere = ''; if (!empty($Config['_Linkedfields'][$Field]['_Filter']) && !empty($Config['_Linkedfields'][$Field]['_FilterBy'])) { $queryWhere = " WHERE `" . $Config['_Linkedfields'][$Field]['_Filter'] . "` = '" . mysql_real_escape_string($Config['_Linkedfields'][$Field]['_FilterBy']) . "'"; } $Res = mysql_query("SELECT `" . $Config['_Linkedfields'][$Field]['ID'] . "`, " . $outString . " FROM `" . $Config['_Linkedfields'][$Field]['Table'] . "` " . $queryWhere . " ORDER BY `out_value` ASC;"); if ($Res == false) { vardump("SELECT `" . $Config['_Linkedfields'][$Field]['ID'] . "`, " . $outString . " FROM `" . $Config['_Linkedfields'][$Field]['Table'] . "` " . $queryWhere . " ORDER BY `out_value` ASC;"); die; return; } $Return .= '<div class="filterField"><h2>' . $FieldTitle . '</h2><select id="' . $SelectID . '" name="reportFilter[' . $EID . '][' . $Field . '][]" ' . $Multiple . '>'; if (empty($Config['_Linkedfields'][$Field]['SingleSelect'])) { // $Return .= '<option>Select All</option>'; } else { $Return .= '<option></option>'; } while ($row = mysql_fetch_assoc($Res)) { $Sel = ''; if (!empty($Default[$Field])) { if (in_array($row[$Config['_Linkedfields'][$Field]['ID']], $Default[$Field])) { $Sel = 'selected="selected"'; } } $Return .= '<option value="' . $row[$Config['_Linkedfields'][$Field]['ID']] . '" ' . $Sel . '>' . $row['out_value'] . '</option>'; } $Return .= '</select></div>'; $firstItem = 'false'; if (!empty($Config['_Linkedfields'][$Field]['SingleSelect'])) { $firstItem = 'false'; } if (empty($Config['_Linkedfields'][$Field]['SingleSelect'])) { $_SESSION['dataform']['OutScripts'] .= "\n jQuery(\"#" . $SelectID . "\").multiselect();\n "; } } if ($Type == 'linkedfiltered') { $Multiple = ''; if (empty($Config['_Linkedfilterfields'][$Field]['SingleSelect'])) { //$Multiple = 'multiple="multiple" size="1" class="filterBoxes"'; } $Return .= '<div style="float:left;padding:2px;" ' . $Class . '><h2>' . $FieldTitle . '</h2><span id="status_' . $Field . '">'; if (!empty($filterSet[$Config['_Linkedfilterfields'][$Field]['ID']][0])) { $Return .= linked_makeFilterdLinkedFilter($EID, $Config['_Linkedfilterfields'][$Field]['Ref'], $Config['_Linkedfilterfields'][$Field]['Value'], $Config['_Linkedfilterfields'][$Field]['Filter'], $filterSet[$Config['_Linkedfilterfields'][$Field]['ID']][0], $Config['_Linkedfilterfields'][$Field]['Table'], $Field, $FieldTitle, $filterSet[$Field]); } else { $Return .= '<select disabled="disabled" id="filter_' . $Field . '" name="reportFilter[' . $EID . '][' . $Field . '][]" ' . $Multiple . '>'; $Return .= '<option>Select ' . $Config['_FieldTitle'][$Config['_Linkedfilterfields'][$Field]['Filter']] . '</option>'; // while($row = mysql_fetch_assoc($Res)){ // $Sel = ''; // if(!empty($Default)){ // if(in_array($row[$Config['_Linkedfilterfields'][$Field]['ID']], $Default[$Field])){ // $Sel = 'selected="selected"'; // } // } // $Return .= '<option value="'.$row[$Config['_Linkedfilterfields'][$Field]['ID']].'" '.$Sel.'>'.$row[$Config['_Linkedfilterfields'][$Field]['Value']].'</option>'; // } $Return .= '</select>'; } $Return .= '</span> </div>'; $_SESSION['dataform']['OutScripts'] .= "\n\t\t\tjQuery('#filter_" . $Config['_Linkedfilterfields'][$Field]['Filter'] . "').unbind();\n\t\t\tjQuery('#filter_" . $Config['_Linkedfilterfields'][$Field]['Filter'] . "').bind('change', function(o){\n\t\t\t\tjQuery('#status_" . $Field . "').html('<img src=\"" . WP_PLUGIN_URL . "/db-toolkit/data_report/loading.gif\" width=\"16\" height=\"16\" align=\"absmiddle\"> <strong>loading...</strong>');\n\t\t\t\tajaxCall('linked_makeFilterdLinkedFilter', '" . $EID . "', '" . $Config['_Linkedfilterfields'][$Field]['ID'] . "' , '" . $Config['_Linkedfilterfields'][$Field]['Value'] . "', '" . $Config['_Linkedfilterfields'][$Field]['Filter'] . "', ''+this.value+'', '" . $Config['_Linkedfilterfields'][$Field]['Table'] . "', '" . $Field . "', '" . $FieldTitle . "', function(f){\n\t\t\t\t\t//jQuery('#status_" . $Field . "').html(f);\n\t\t\t\t\t//jQuery('.filterBoxes').multiSelect({ oneOrMoreSelected: '*' });\n jQuery(\"#filter_" . $Field . "\").dropdownchecklist({ firstItemChecksAll: true});\n\t\t\t\t});\n\t\t\t});\n\t\t\n\t\t"; } return $Return; }
<?php require '../vendor/autoload.php'; $vars = (require '_vars.php'); foreach ($vars as $var) { vardump($var); }