Exemple #1
1
function d($arg)
{
    $declared = 'variable';
    ChromePhp::log('xdebug_get_declared_vars', xdebug_get_declared_vars());
    ChromePhp::groupCollapsed('backtrace');
    ChromePhp::log(debug_backtrace());
    ChromePhp::groupEnd();
    ChromePhp::info('Triggered notice.');
    trigger_error('Custom notice', E_USER_NOTICE);
    ChromePhp::warn('Triggered warning.');
    trigger_error('Custom warning', E_USER_WARNING);
    ChromePhp::error('Triggered error.');
    trigger_error('Custom error', E_USER_ERROR);
}
 function deleteRoom($name)
 {
     $idusuario = $this->usuario->getUsuarioId();
     $sql = "DELETE FROM `habitaciones` WHERE descripcion=\"" . $name . " \"and id_usuario=" . $idusuario;
     ChromePhp::log($sql);
     $consulta = $this->db->prepare($sql);
     $consulta->execute();
 }
 public function followers(Request $request, User $user)
 {
     if (!($followers = $user->followers) or $followers->isEmpty()) {
         throw new HttpException('404', $user->name . " does not have any followers yet.");
     }
     \ChromePhp::log($followers);
     $this->authorize("viewFollowedUsers", $user);
     return $followers;
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, Setting $setting)
 {
     $this->validate($request, ['who_can_see_my_skills' => 'required|in:' . join(",", Setting::$options), 'who_can_see_who_i_am_following' => 'required|in:' . join(",", Setting::$options)]);
     \ChromePhp::log($setting->getTable());
     $this->authorize('owns', $setting);
     $setting->who_can_see_my_skills = $request->who_can_see_my_skills;
     $setting->who_can_see_who_i_am_following = $request->who_can_see_who_i_am_following;
     $setting->save();
     return "Settings updated.";
 }
Exemple #5
0
 /**
  * Renvoie un fournisseur
  * 
  * @param type $id
  * @return type
  * @throws Exception
  */
 public function getMarque($id)
 {
     $sql = "select ID_marque as id, libelle_court_marque as nom, libelle_long_marque, ad_1, ad_2, ad_num, ad_rue, ad_cp, ad_ville,\n        \t\t ad_pays, ad_website, contact1, contact2, phone1, phone2, ad_mail1, ad_mail2\n                from marques where ID_marque=?";
     $marque = $this->executerRequete($sql, array($id));
     ChromePhp::log('$id : ', $id);
     if ($marque->rowCount() == 1) {
         return $marque->fetch();
         // Accès à la première ligne de résultat
     } else {
         throw new Exception("Aucune marque ne correspond à l'identifiant '{$id}'");
     }
 }
 function connect()
 {
     try {
         //$connection = new PDO( "sqlsrv:Server=". self::SERVER . " ; Database =". self::DATABASE , self::USER, self::PASSWORD);
         $connection = new PDO("mysql:host=localhost;dbname=harvpren_magicCards;charset=utf8", self::USER, self::PASSWORD);
         $connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
         return $connection;
     } catch (Exception $e) {
         ChromePhp::log($e);
         return $e->getMessage();
     }
 }
 public function canFollow(User $user, Connection $connection)
 {
     if ($user->id == $connection->follows) {
         throw new HttpException('403', "You can not follow yourself");
     }
     $alreadyFollowing = Connection::where("follower", $user->id)->where("follows", $connection->follows)->first();
     \ChromePhp::log($alreadyFollowing);
     if ($alreadyFollowing) {
         throw new HttpException('403', "You are already following this user.");
     }
     return true;
 }
Exemple #8
0
 /**
  * Renvoie un type machine
  * 
  * @param type $id
  * @return type
  * @throws Exception
  */
 public function getTypemachine($id)
 {
     $sql = "select ID_type_machine as id, code_type_machine as nom, libelle_type_machine\n                from type_machines where ID_type_machine=?";
     $typemachine = $this->executerRequete($sql, array($id));
     ChromePhp::log('$id : ', $id);
     if ($typemachine->rowCount() == 1) {
         return $typemachine->fetch();
         // Accès à la première ligne de résultat
     } else {
         throw new Exception("Aucun type machine ne correspond à l'identifiant '{$id}'");
     }
 }
Exemple #9
0
 public static function init()
 {
     // \Template::instance()->extend('img',function($node){
     //     var_dump($node);
     //      array(1) {
     //       ["@attrib"]=>
     //       array(1) {
     //         ["src"]=>
     //         string(25) "{{'ui/images/'.@article.image}}"
     //       }
     //     }
     // });
     \ChromePhp::log('INIT');
 }
Exemple #10
0
 /**
  * Renvoie les infos sur un menu
  * 
  * @param type $id
  * @return type
  * @throws Exception
  */
 public function getMenu($id)
 {
     //  $sql = "select ID_menu as id, libelle_menu from menus where ID_menu=?";
     $sql = "select code_menu, libelle_menu from menus where code_menu=?";
     $menu = $this->executerRequete($sql, array($id));
     //  $menu = $this->executerRequete($sql, array($codeMenu));
     ChromePhp::log('$menu : ', $menu);
     ChromePhp::log('$id : ', $id);
     if ($menu->rowCount() == 1) {
         return $menu->fetch();
         // Accés à la première ligne de résultat
     } else {
         throw new Exception("La page '{$id}' est introuvable !");
     }
 }
 public function mergeClientes($clientes)
 {
     global $cnx;
     $idClientesAdd = array();
     $idClientes = array();
     $ind = 0;
     foreach ($clientes as $cliente) {
         $idCliente = $cliente[0];
         $cveCliente = $cliente[1];
         $nomCliente = utf8_decode($cliente[2]);
         $apCliente = utf8_decode($cliente[3]);
         $amCliente = utf8_decode($cliente[4]);
         $direccion = utf8_decode($cliente[5]);
         $fechaNacimiento = $cliente[6];
         $telefono = $cliente[7];
         $correo = $cliente[8];
         $idTipCliente = $cliente[9];
         $ind = $cliente[13];
         if ($idCliente == "") {
             // NUEVO REGRISTRO
             $query = "INSERT INTO cliente(cveCliente,nombreCliente,apCliente,amCliente,direccionCliente,telefonoCliente,mailCliente,fechaNCliente,idTipoCliente) VALUES('{$cveCliente}','{$nomCliente}','{$apCliente}','{$amCliente}','{$direccion}',{$telefono},'{$correo}','{$fechaNacimiento}',{$idTipCliente})";
             //                ChromePhp::log($query);
             try {
                 $rs = $cnx->Execute($query);
                 array_push($idClientes, array($cnx->Insert_ID(), $ind));
                 $idClientesAdd['mesaje'] = "ok";
             } catch (Exception $exc) {
                 $idClientesAdd['mesaje'] = $exc->getTraceAsString();
                 return $idClientesAdd;
             }
         } else {
             //ACTUALIZACION DE PRODUCTO
             $query = "UPDATE cliente set cveCliente ='{$cveCliente}', nombreCliente = '{$nomCliente}', apCliente='{$apCliente}',amCliente = '{$amCliente}',direccionCliente='{$direccion}',telefonoCliente={$telefono},mailCliente='{$correo}',fechaNCliente='{$fechaNacimiento}' ,idTipoCliente={$idTipCliente} WHERE idCliente = {$idCliente}";
             ChromePhp::log($query);
             try {
                 $rs = $cnx->Execute($query);
                 $idClientesAdd['mesaje'] = "ok";
             } catch (Exception $exc) {
                 $idClientesAdd['mesaje'] = $exc->getTraceAsString();
                 return $idClientesAdd;
             }
         }
     }
     $idClientesAdd['nuevosIds'] = $idClientes;
     //        print_r($idProductosAdd);
     //
     return $idClientesAdd;
 }
Exemple #12
0
    public function ajouterReservation()
    {
        // on crée une nouvelle machine
        ChromePhp::log('$machineToAdd (Machines) : ', $machineToAdd);
        $error = false;
        $sql = 'insert into machines(code_machine,libelle_machine,image_machine, id_type_machine,id_sous_type_machine, id_marque,
		serial, date_entree, commentaire, lien_consigne
    	) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
        try {
            $this->executerRequete($sql, array($machineToAdd['code_machine'], $machineToAdd['libelle_machine'], $machineToAdd['image_machine'], $machineToAdd['id_type_machine'], $machineToAdd['id_sous_type_machine'], $machineToAdd['id_marque'], $machineToAdd['serial'], $machineToAdd['date_entree'], $machineToAdd['commentaire'], $machineToAdd['lien_consigne']));
        } catch (Exception $e) {
            $error = true;
            ChromePhp::log('$machineToAdd (erreur) : ', $e);
        }
        return $error;
    }
Exemple #13
0
 /**
  * log to console directly with this method passing only the first required parameter and to change
  * the log type the third parameter according to allowed log types. pass a lable for second parameter
  * to describe the message send to console.
  *
  * @error 10908
  * @param null|mixed $mixed expects the message of any type to send to console
  * @param null|string $label expects the optional label to describe the first parameter
  * @param string $type expects the log type - see log type array
  * @param array $options expects optional parameters
  * @return void
  * @throws Xapp_Error
  */
 public function log($mixed = null, $label = null, $type = 'info', array $options = array())
 {
     $type = strtolower((string) $type);
     if (array_key_exists($type, self::$_typeMap)) {
         if ($type === 'ini') {
             $this->ini($mixed, $label, $options);
         }
         if ($label !== null) {
             $label = trim(trim($label), ':') . ':';
         }
         switch ($this->_driver) {
             case 'chromephp':
                 switch ($type) {
                     case $type === 'ungroup' || $mixed === null:
                         $this->console->groupEnd();
                         break;
                     case 'group':
                         $this->console->group($mixed);
                         break;
                     case 'trace':
                         $this->console->log((string) $label, $mixed, 'info');
                         break;
                     default:
                         $this->console->log((string) $label, $mixed, self::$_typeMap[$type]);
                 }
                 break;
             case 'firephp':
                 switch ($type) {
                     case $type === 'ungroup' || $mixed === null:
                         $this->console->groupEnd();
                         break;
                     case 'group':
                         $this->console->group($mixed, $options);
                         break;
                     case 'trace':
                         $this->console->trace($label);
                         break;
                     default:
                         $this->console->{$type}($mixed, (string) $label, $options);
                 }
                 break;
         }
     } else {
         throw new Xapp_Error(xapp_sprintf(_("xapp console log type: %s not supported"), $type), 1090801);
     }
 }
Exemple #14
0
 /**
  * Using ChromePhp, log the message
  */
 public function handle(PteLogMessage $message)
 {
     switch ($message->getType()) {
         case PteLogMessage::$ERROR:
             ChromePhp::error($message->getMessage());
             break;
         case PteLogMessage::$WARN:
             ChromePhp::warn($message->getMessage());
             break;
         case PteLogMessage::$INFO:
             ChromePhp::info($message->getMessage());
             break;
         case PteLogMessage::$DEBUG:
         default:
             ChromePhp::log($message->getMessage());
             break;
     }
 }
Exemple #15
0
 public function Add()
 {
     \ChromePhp::log("Subscr CRUD Add");
     if ($subscriber = $this->getSubscriber()) {
         $this->user = \CUser::GetByID($subscriber)->Fetch();
         \CUser::Authorize($this->user["ID"]);
         if ($subscribe = \CSubscription::GetList(False, array("ACTIVE" => "Y", "USER_ID" => $this->user["ID"]))->Fetch()) {
             return $subscribe["ID"];
         } else {
             try {
                 return $this->addSubscribe();
             } catch (SubscribeException $e) {
                 prentExpection($e->getMessage());
             }
         }
     } else {
         throw new SubscribeUserException("No user for add to subscribers" . ". Line: " . __LINE__);
     }
 }
Exemple #16
0
 /**
  * @param null $obj
  * @param null $label
  * @param string $type
  */
 public static function log($obj = null, $label = null, $type = LoggerLevel::LEVEL_LOG)
 {
     if (!static::$_enabled) {
         return;
     }
     if ($type == LoggerLevel::LEVEL_TRACE) {
         $e = new \Exception();
         $obj = explode("\n", $e->getTraceAsString());
         $label = empty($label) ? 'TRACE' : $label . ' | TRACE';
         $type = null;
     }
     $type = strtoupper($type);
     $delay = static::getTimer();
     $label = $delay . ' :: ' . $label;
     \ChromePhp::log($type, $label);
     \ChromePhp::log($type, $obj);
     $instance = \FirePHP::getInstance(true);
     $instance->fb($obj, $label, $type);
 }
Exemple #17
0
 function registrarse($email, $nombre, $pass)
 {
     if (!empty($nombre)) {
         // comprobamos que el campo nombre no esté vacío
         if (!empty($pass)) {
             if (preg_match('/^[A-Za-z0-9-_.+%]+@[A-Za-z0-9-.]+\\.[A-Za-z]{2,4}$/', $email)) {
                 $email = $this->db->quote($email);
                 $pass = $this->db->quote($pass);
                 $nombre = $this->db->quote($nombre);
                 $consulta = 'SELECT usuario_email FROM usuarios WHERE usuario_email =' . $email . '';
                 $consulta = $this->db->prepare($consulta);
                 $consulta->execute();
                 if ($row = $consulta->fetch()) {
                     return "existe usuario";
                 } else {
                     $pass = md5($pass);
                     $consulta = "SELECT MAX(usuario_id) AS id FROM usuarios";
                     $consulta = $this->db->prepare($consulta);
                     $consulta->execute();
                     if ($row = $consulta->fetch()) {
                         $id = trim($row[0]);
                     } else {
                         $id = 0;
                     }
                     $id = $id + 1;
                     ChromePhp::log($id);
                     $consulta = 'INSERT INTO usuarios (usuario_id, usuario_nombre, usuario_clave, usuario_email, usuario_freg) VALUES (\'' . $id . '\', ' . $nombre . ', \'' . $pass . '\', ' . $email . ', NOW())';
                     ChromePhp::log($consulta);
                     $consulta = $this->db->prepare($consulta);
                     $consulta->execute();
                     return "Registrado";
                 }
             } else {
                 return "Email incorrecto";
             }
         } else {
             return "Password vacio";
         }
     } else {
         return "Nombre vacio";
     }
 }
 function _log($data, $label = null, $backtrace = false)
 {
     // Stop execution and log to ChromePhp if the class exists
     if (class_exists('ChromePhp')) {
         if ($label) {
             $r = array('label' => $label, 'data' => $data);
             return ChromePhp::log($r);
         }
         return ChromePhp::log($data);
     }
     $output = '';
     switch (gettype($data)) {
         case "array":
         case "object":
             $output .= print_r($data, TRUE);
             if ($label !== null) {
                 $output .= "\n\n---^^^^^^^ END {$label} ^^^^^^^---";
             }
             break;
         case "integer":
         case "float":
         case "string":
             $output .= $data;
             break;
         case "boolean":
             $converted_data = $data ? 'true' : 'false';
             $output .= $converted_data;
             break;
         default:
             $output .= "ERROR: tried to log bad type [" . gettype($data) . "]";
             break;
     }
     if ($backtrace) {
         _backtrace($label);
     }
     if (!empty($label)) {
         $output = "\t--- [ {$label} ] ---\n\n" . $output . "\n";
     }
     error_log($output);
 }
 public function mergePromociones($promociones)
 {
     global $cnx;
     $idProductosAdd = array();
     $idProductos = array();
     $ind = 0;
     $idPromocion = $promociones['idPromocion'];
     $idProducto = $promociones['idProducto'];
     $precioPromocion = $promociones['precioPromocion'];
     $fechaInicio = $promociones['fechaInicial'];
     $fechaFinal = $promociones['fechaFinal'];
     if ($idPromocion == "") {
         // NUEVO REGRISTRO
         $query = "INSERT INTO promocion(idProducto,precioPromocion,fechaInicio,fechaFinal) VALUES({$idProducto},{$precioPromocion},STR_TO_DATE('{$fechaInicio}','%d/%m/%Y'),STR_TO_DATE('{$fechaFinal}','%d/%m/%Y'))";
         ChromePhp::log($query);
         try {
             $rs = $cnx->Execute($query);
             //                array_push($idProductos, array($cnx->Insert_ID(), $ind));
             $idProductosAdd['mesaje'] = "ok";
         } catch (Exception $exc) {
             $idProductosAdd['mesaje'] = $exc->getTraceAsString();
             return $idProductosAdd;
         }
     } else {
         //ACTUALIZACION DE PRODUCTO
         $query = "UPDATE promocion set idProducto = {$idProducto}, precioPromocion={$precioPromocion},fechaInicio = STR_TO_DATE('{$fechaInicio}','%d/%m/%Y'),fechaFinal=STR_TO_DATE('{$fechaFinal}','%d/%m/%Y') WHERE idPromocion = {$idPromocion}";
         try {
             $rs = $cnx->Execute($query);
             $idProductosAdd['mesaje'] = "ok";
         } catch (Exception $exc) {
             $idProductosAdd['mesaje'] = $exc->getTraceAsString();
             return $idProductosAdd;
         }
     }
     //        print_r($idProductosAdd);
     //
     return $idProductosAdd;
 }
Exemple #20
0
 public static function init()
 {
     return function ($info) {
         switch ($info['level']) {
             case \Analog\Analog::DEBUG:
                 \ChromePhp::log($info['message']);
                 break;
             case \Analog\Analog::INFO:
             case \Analog\Analog::NOTICE:
                 \ChromePhp::info($info['message']);
                 break;
             case \Analog\Analog::WARNING:
                 \ChromePhp::warn($info['message']);
                 break;
             case \Analog\Analog::ERROR:
             case \Analog\Analog::CRITICAL:
             case \Analog\Analog::ALERT:
             case \Analog\Analog::URGENT:
                 \ChromePhp::error($info['message']);
                 break;
         }
     };
 }
 /**
  * Check the BotSmasher API 
  * 
  * @param \string $ip				IP address
  * @param \string $email			Email address
  * @param \string $name				Name
  * @param \boolean $debug			Debug cUrl communication
  * @param \int						BotSmasher status
  * @throws \Tollwerk\TwAntibot\Utility\BotSmasher\Exception		If an invalid IP address is provided
  */
 public function check($ip = null, $email = null, $name = null, $debug = false)
 {
     $status = self::STATUS_INVALID;
     $checks = array();
     $errors = new BotSmasher\Exception();
     // IP address check
     if (strlen(trim($ip))) {
         // If the IP address is invalid
         if (filter_var($ip, FILTER_VALIDATE_IP) === false) {
             $errors->addMessage(sprintf('Invalid IP address "%s"', $ip), self::IP_INVALID);
             // Else if the IP address is private
         } elseif (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) === false) {
             $errors->addMessage(sprintf('Private IP address "%s"', $ip), self::IP_PRIVATE);
             // Else
         } else {
             $checks['ip'] = trim($ip);
         }
     }
     // Email address check
     if (strlen(trim($email))) {
         if (filter_var($email, FILTER_VALIDATE_EMAIL) === false) {
             $errors->addMessage(sprintf('Invalid email address "%s"', $email), self::EMAIL_INVALID);
         } else {
             $checks['email'] = trim($email);
         }
     }
     // Name check
     if (strlen(trim($name))) {
         $checks['name'] = trim($name);
     }
     // If no checks are requested: Error
     if (!count($checks)) {
         if (count($errors)) {
             throw $errors;
         } else {
             return $status;
         }
     }
     $checks['key'] = $this->_apiKey;
     $checks['action'] = self::ACTION_CHECK;
     if ($debug) {
         \ChromePhp::log($checks);
     }
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $this->_apiUrl);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_POST, TRUE);
     curl_setopt($ch, CURLOPT_FAILONERROR, TRUE);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $checks);
     // Execute post and get results
     $result = curl_exec($ch);
     $info = curl_getinfo($ch);
     curl_close($ch);
     // 		$result = '{"response":{"summary":{"badguys":"false","requesttype":"check","code":"success","description":"Your request was successful - "},"request":{"email":{"submitted":"*****@*****.**","flaggedbyyou":"false","found":"false","count":"0"}}}}';
     // 		$info = array(
     // 			'url' => 'https://www.botsmasher.com/api/',
     // 			'content_type' => 'text/html; charset=utf-8',
     // 			'http_code' => 200,
     // 			'header_size' => 261,
     // 			'request_size' => 191,
     // 			'filetime' => -1,
     // 			'ssl_verify_result' => 10,
     // 			'redirect_count' => 0,
     // 			'total_time' => 1.4916369999999999,
     // 			'namelookup_time' => 0.0038340000000000002,
     // 			'connect_time' => 0.122919,
     // 			'pretransfer_time' => 0.37947500000000001,
     // 			'size_upload' => 414,
     // 			'size_download' => 236,
     // 			'speed_download' => 158,
     // 			'speed_upload' => 277,
     // 			'download_content_length' => 236,
     // 			'upload_content_length' => 414,
     // 			'starttransfer_time' => 0.49339500000000003,
     // 			'redirect_time' => 0,
     // 			'redirect_url' => '',
     // 			'primary_ip' => '65.181.127.31',
     // 			'certinfo' => array(),
     // 			'primary_port' => 443,
     // 			'local_ip' => '192.168.123.18',
     // 			'local_port' => 34043
     // 		);
     // 		$result = '{"response":{"summary":{"badguys":"true","requesttype":"check","code":"success","description":"Your request was successful - "},"request":{"email":{"submitted":"*****@*****.**","flaggedbyyou":"false","found":"true","count":"6","lastseen":"2015-08-08 10:10:04"}}}}';
     // 		$info = array(
     // 			'url' => 'https://www.botsmasher.com/api/',
     // 			'content_type' => 'text/html; charset=utf-8',
     // 			'http_code' => 200,
     // 			'header_size' => 261,
     // 			'request_size' => 191,
     // 			'filetime' => -1,
     // 			'ssl_verify_result' => 10,
     // 			'redirect_count' => 0,
     // 			'total_time' => 0.70769400000000005,
     // 			'namelookup_time' => 3.4999999999999997E-5,
     // 			'connect_time' => 0.113187,
     // 			'pretransfer_time' => 0.36741499999999999,
     // 			'size_upload' => 409,
     // 			'size_download' => 262,
     // 			'speed_download' => 370,
     // 			'speed_upload' => 577,
     // 			'download_content_length' => 262,
     // 			'upload_content_length' => 409,
     // 			'starttransfer_time' => 0.47937000000000002,
     // 			'redirect_time' => 0,
     // 			'redirect_url' => '',
     // 			'primary_ip' => '65.181.127.31',
     // 			'certinfo' => array(),
     // 			'primary_port' => 443,
     // 			'local_ip' => '192.168.123.18',
     // 			'local_port' => 39524
     // 		);
     if ($debug) {
         echo curl_error($ch) . PHP_EOL;
         var_export($info);
         print_r($result);
     }
     if ($info['http_code'] == 200 && strlen($result)) {
         $response = @json_decode($result);
         if (is_object($response) && isset($response->response) && is_object($response->response)) {
             $response = $response->response;
             $summary = isset($response->summary) && is_object($response->summary) ? $response->summary : null;
             $request = isset($response->request) && is_object($response->request) ? $response->request : null;
             if ($summary && $request) {
                 if (!empty($summary->code) && strtolower($summary->code) == 'success') {
                     if (!empty($summary->badguys) && strtolower($summary->badguys) == 'true') {
                         // Run through all check results
                         foreach ($request as $check => $checkResult) {
                             if (is_object($checkResult) && isset($checkResult->found) && strtolower($checkResult->found) == 'true') {
                                 $status |= self::$_checks[$check];
                             }
                         }
                     } else {
                         $status = self::STATUS_VALID;
                     }
                 }
             }
         }
     }
     return $status;
 }
Exemple #22
0
if (mysql_num_rows($dupquery) > 0) {
    ChromePhp::log('User already exists.');
    ?>
        <script type="text/javascript">
            alert("This username is already registered.");
        </script>
        <?php 
} else {
    if (!isset($username)) {
        echo "Please provide a username";
        ChromePhp::log('No username');
    } else {
        if (!isset($name)) {
            echo "Please provide a name";
            ChromePhp::log('No username');
        } else {
            if (strlen($password) < 6) {
                echo "Password must be 6 characters.";
                ChromePhp::log('password < 6');
            } else {
                if ($password != $confirm) {
                    echo "Password does not match confirmation.";
                    ChromePhp::log('password != confirm');
                } else {
                    ChromePhp::log('password > 6');
                    mysql_query("INSERT INTO users\n            (username, name, password) VALUES('{$username}', '{$name}', '{$password}')") or die(mysql_error());
                }
            }
        }
    }
}
Exemple #23
0
 public static function log($var = '', $force = 0)
 {
     $debugroot = DISCUSS_HELPERS . '/debug';
     $firephp = false;
     $chromephp = false;
     if (JFile::exists($debugroot . '/fb.php') && JFile::exists($debugroot . '/FirePHP.class.php')) {
         include_once $debugroot . '/fb.php';
         fb($var);
     }
     if (JFile::exists($debugroot . '/chromephp.php')) {
         include_once $debugroot . '/chromephp.php';
         ChromePhp::log($var);
     }
 }
Exemple #24
0
<?php

$app->group('/wb', function () use($app, $wb_oauth) {
    //callback
    $app->get('/callback/:code', function ($code) use($wb_oauth) {
        ChromePhp::log($code);
    });
    //go to auth
    $app->get('/go', function () use($app, $wb_oauth) {
        $url = $wb_oauth->getAuthorizeURL(WB_CALLBACK_URL);
        //$url = 'http://www.phpgao.com';
        $app->redirect($url, 301);
    });
});
Exemple #25
0
<?php

require_once '../../db.php';
require_once '../../ChromePhp.php';
$imageSet = $_POST['imageSet'];
$scientist = $_SESSION['user']['id'];
$stmt = $db->prepare("SELECT * FROM pictureset " . "WHERE id = :id AND person = :scientist");
$stmt->execute(array(':id' => $imageSet, ':scientist' => $scientist));
$res = $stmt->fetch();
ChromePhp::log($res);
echo json_encode($res);
?>


Exemple #26
0
 public static function log($id, $message)
 {
     if (!Logger::$test) {
         ChromePhp::log($id . ":" . $message);
     }
 }
Exemple #27
0
 public static function log($var, $force = 0)
 {
     if ($force == 1 || Komento::getKonfig()->get('komento_environment') == 'development') {
         $debugroot = KOMENTO_HELPERS . DIRECTORY_SEPARATOR . 'debug' . DIRECTORY_SEPARATOR;
         if (JFile::exists($debugroot . 'fb.php') && JFile::exists($debugroot . 'FirePHP.class.php')) {
             include_once $debugroot . 'fb.php';
             fb($var);
         }
         if (JFile::exists($debugroot . 'chromephp.php')) {
             include_once $debugroot . 'chromephp.php';
             ChromePhp::log($var);
         }
     }
 }
Exemple #28
0
 public function table($caption, $data)
 {
     ChromePhp::log($caption, $data);
 }
    try {
        $stmt = $db->exec("TRUNCATE TABLE experiment");
        ChromePhp::log($stmt);
        echo json_encode($stmt);
    } catch (Exception $ex) {
        ChromePhp::log($ex->getMessage());
    }
} else {
    //user is presumed not admin therefore a check on owner of experiment.
    if ($userCheck == 1) {
        //user check is required, checks if user is the owner of experiments
        try {
            $stmt = $db->exec("DELETE FROM experiment WHERE date < DATE_SUB(NOW(), INTERVAL '" . $interval . "' ) AND person = '" . $userId . "'");
            echo json_encode($stmt);
            ChromePhp::log("Update complete");
            //for logging purposes
        } catch (Exception $ex) {
            ChromePhp::log($ex->getMessage());
        }
    } elseif ($access == 1) {
        //user is admin, deletes all experiments from chosen interval.
        try {
            $stmt = $db->exec("DELETE FROM experiment WHERE date < DATE_SUB(NOW(), INTERVAL '" . $interval . "' )");
            echo json_encode($stmt);
            ChromePhp::log("Update complete");
            //for logging purposes
        } catch (Exception $ex) {
            ChromePhp::log($ex->getMessage());
        }
    }
}
 public function guardarMontoAsignadoAut($post)
 {
     global $cnx;
     extract($post);
     //        ChromePhp::log($post);
     try {
         $qobra = "UPDATE pobra SET MontoAsignado = {$montoInv}, MontoAutorizado = {$montoInv} WHERE idsol = {$idsol}";
         //            ChromePhp::log($qobra);
         $result = $cnx->Execute($qobra);
         $montoInversion = str_replace(",", "", $montoInversion);
         $municipal = str_replace(",", "", $municipal);
         $montoInversion = $montoInversion * 1 - ($montoTotalAAe * 1 + $municipal * 1);
         $hoy = date('Y-m-d');
         $montoTotal = $montoInversion;
         $montoMunicipal = $municipal * 1;
         $porcenfed = explode(",", $porfed);
         $qmfed = "SELECT monto FROM relsolfte WHERE tipoFte = 1 AND idsol =" . $idsol;
         //                ChromePhp::log($qmfed);
         $result = $cnx->GetRow($qmfed);
         for ($i = 0; $i < count($ffed); $i++) {
             if ($ffed[$i] != 0 && $ffed[$i] != "" && $federal[$i] != 0 && $federal[$i] != "") {
                 $monto[$i] = $result[$i] * 1 + str_replace(",", "", $federal[$i]) * 1;
                 $queryffed = "UPDATE relsolfte SET monto = " . $monto[$i] . ", MontoAutorizado = " . $monto[$i] . " " . "WHERE idSol = " . $idsol . " AND idFte = " . $ffed[$i] . " AND tipoFte = 1";
                 ChromePhp::log($queryffed);
                 $resffed = $cnx->GetRow($queryffed);
             }
         }
         $porcenest = explode(",", $porest);
         $qmest = "SELECT monto FROM relsolfte WHERE tipoFte = 2 AND idsol =" . $idsol;
         //                ChromePhp::log($qmest);
         $result2 = $cnx->GetRow($qmest);
         for ($j = 0; $j < count($fest); $j++) {
             if ($fest[$j] != 0 && $fest[$j] != "" && $estatal[$j] != 0 && $estatal[$j] != "") {
                 $monto[$j] = $result2[$j] * 1 + str_replace(",", "", $estatal[$j]) * 1;
                 $queryfest = "UPDATE relsolfte SET monto = " . $monto[$j] . ", MontoAutorizado = " . $monto[$j] . " " . "WHERE idSol = " . $idsol . " AND idFte = " . $fest[$j] . " AND tipoFte = 2";
                 ChromePhp::log($queryfest);
                 $resffest = $cnx->GetRow($queryfest);
             }
         }
         $respuesta = $idsol;
     } catch (Exception $ex) {
         $respuesta = $ex;
     }
     return $respuesta;
 }