本文整理汇总了PHP中Debug::p方法的典型用法代码示例。如果您正苦于以下问题:PHP Debug::p方法的具体用法?PHP Debug::p怎么用?PHP Debug::p使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Debug
的用法示例。
在下文中一共展示了Debug::p方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkToken
public function checkToken($data)
{
//Debug::p($data);
//exit;
//Run::$DEBUG_PRINT = 1;
if (isset($data['form_id'])) {
$token_session = Run::$session->get(array('tokens', $this->tokenId));
Debug::p("<br> CHECKANDO TOKEN / " . $this->settings['tables'] . ": " . $token_session . " / " . $this->DATA_INT['token']);
//exit;
if (!isset($data['token'])) {
//$this->ERRORS['Validação interna']['label'] = "Interno";
//$this->ERRORS['Validação interna'][1] = "".Language::get('token');
Action::logRun("token " . $this->tokenId, 0, 100, " Token não definido.", 1);
return false;
}
if ($token_session == "" || $data['token'] == "" || $token_session != $data['token']) {
//$this->ERRORS['Validação interna']['label'] = "Interno";
//$this->ERRORS['Validação interna'][1] = "".Language::get('token');
Action::logRun("token " . $this->tokenId, 0, 100, " Token incorreto :" . $data['token'], 1);
return false;
} else {
Run::$session->set(array('tokens', $this->tokenId), "");
return true;
}
}
//Run::$DEBUG_PRINT = 0;
}
示例2: renderAjax
protected final function renderAjax($errorCode, $errorMessage = '', $otherParams = array())
{
$otherParams['errorCode'] = $errorCode;
$otherParams['errorMessage'] = $errorMessage;
Response::output($otherParams, 'json', Router::$CALLBACK);
// debug
Debug::p('PHP End');
if (isset($_COOKIE['ajaxdebug']) && Router::$IS_AJAX) {
Debug::show();
}
exit;
}
示例3: query
/**
* 执行sql,执行失败会抛出异常
*
* @param string $sql
* @return mysqli_result
* @throws LibraryException
*/
public function query($sql)
{
if (empty($sql)) {
throw new LibraryException('SQL不能为空!');
}
$ret = $this->mysqli->query($sql);
if (false === $ret) {
$mysqlError = $this->mysqli->error;
Logger::error('mysql', $mysqlError);
throw new LibraryException($mysqlError);
}
Debug::p($sql);
return $ret;
}
示例4: getPKListSession
public function getPKListSession()
{
// método para pegar o dataForm na sessão
$dataForm = Run::$session->get(array("forms", $this->getFormSessionId(), "pkList"));
if (!(is_array($dataForm) && count($dataForm) > 1)) {
$dataForm = false;
}
Debug::p("getPKListSession", $dataForm);
return $dataForm;
}
示例5: convertStringToData
public function convertStringToData($str)
{
//Run::$DEBUG_PRINT = 1;
preg_match('/\\[[a-z(_)?]*(_)?\\]/', $str, $matches, PREG_OFFSET_CAPTURE);
if ($matches[0][0] == "[id]") {
$matches[0][0] = str_replace('[id]', '[' . $this->model->schema['from'][0]['pk'] . ']', $matches[0][0]);
$str = str_replace('[id]', '[' . $this->model->schema['from'][0]['pk'] . ']', $str);
}
if ($matches[0][0] == "[ref]") {
$matches[0][0] = str_replace('[ref]', '[' . $this->model->dataIntern['ref'] . ']', $matches[0][0]);
$str = str_replace('[ref]', $this->model->dataIntern['ref'], $str);
}
$changer = $matches[0][0];
$changer = str_replace('[', '', $changer);
$changer = str_replace(']', '', $changer);
if (is_array($matches) && count($matches) > 0) {
$str = str_replace($matches[0][0], $this->model->dataFormRecorded[$this->model->schema['from'][0]['table_nick']][$changer], $str);
}
preg_match('/\\[[a-z(_)?]*(_)?\\]/', $str, $matches, PREG_OFFSET_CAPTURE);
if (is_array($matches) && count($matches) > 0) {
$str = $this->convertStringToData($str);
}
preg_match('/\\[[a-z(-)?]*(-)?\\]/', $str, $matches, PREG_OFFSET_CAPTURE);
if ($matches[0][0] == "[id]") {
$matches[0][0] = str_replace('[id]', '[' . $this->model->schema['from'][0]['pk'] . ']', $matches[0][0]);
$str = str_replace('[id]', '[' . $this->model->schema['from'][0]['pk'] . ']', $str);
}
$changer = $matches[0][0];
$changer = str_replace('[', '', $changer);
$changer = str_replace(']', '', $changer);
if (is_array($matches) && count($matches) > 0) {
$str = str_replace($matches[0][0], $this->model->dataFormRecorded[$this->model->schema['from'][0]['table_nick']][$changer], $str);
}
Debug::p("convertStringToData matches ", $matches[0][0]);
Debug::p("convertStringToData str ", $str);
preg_match('/\\[[a-z(-)?]*(-)?\\]/', $str, $matches, PREG_OFFSET_CAPTURE);
if (is_array($matches) && count($matches) > 0) {
$str = $this->convertStringToData($str);
}
return $str;
}
示例6: send
public function send()
{
$resposta = false;
$mail = new PHPMailer();
flush();
ob_start();
//Debug::p("CONTEUDO", Run::$control->string->encodeFixUtf8($this->mailManager->content_html));
//exit;
//$mail->IsSendmail(); // telling the class to use SendMail transport
$mail->IsSMTP();
// usando função padrão de email php
//$mail->Debugoutput = 'html';
$mail->Subject = Run::$control->string->encodeFixUtf8($this->mailManager->send_subject);
$mail->AltBody = strip_tags($this->mailManager->send_message);
// optional, comment out and test
$mail->setFrom($this->mailManager->send_from['mail'], Run::$control->string->encodeFixUtf8($this->mailManager->send_from['name']));
$mail->AddAddress($this->mailManager->send_to['mail'], Run::$control->string->encodeFixUtf8($this->mailManager->send_to['name']));
if (isset($this->mailManager->send_reply['mail']) && $this->mailManager->send_reply['mail'] != "") {
$mail->AddReplyTo($this->mailManager->send_reply['mail'], Run::$control->string->encodeFixUtf8($this->mailManager->send_reply['name']));
}
$this->mailManager->content_html = str_replace("[id]", $this->mailManager->ref_pk, $this->mailManager->content_html);
if (count($this->mailManager->send_copy) > 0) {
foreach ($this->mailManager->send_copy as $k => $copy) {
$mail->AddCC($copy['mail'], $copy['name']);
}
}
if (count($this->mailManager->send_hidden) > 0) {
foreach ($this->mailManager->send_hidden as $k => $copy) {
$mail->AddBCC($copy['mail'], $copy['name']);
}
}
$mail->CharSet = 'UTF-8';
$mail->MsgHTML(Run::$control->string->encodeFixUtf8($this->mailManager->content_html));
$mail->IsHTML(true);
$mail->Host = $this->mailManager->properties[$this->mailManager->send_prefix . 'host'];
$mail->SMTPAuth = $this->mailManager->properties[$this->mailManager->send_prefix . 'smtp'];
$mail->Sender = $this->mailManager->properties[$this->mailManager->send_prefix . 'mail'];
$mail->Username = $this->mailManager->properties[$this->mailManager->send_prefix . 'login'];
$mail->Password = $this->mailManager->properties[$this->mailManager->send_prefix . 'pass'];
// enable SMTP authentication
$door = $this->mailManager->properties[$this->mailManager->send_prefix . 'door'];
$crypt = $this->mailManager->properties[$this->mailManager->send_prefix . 'crypt'];
if (isset($door) && $door != "") {
$mail->Port = $door;
} else {
$mail->Port = 25;
}
if (isset($crypt) && $crypt != "") {
$mail->SMTPSecure = $crypt;
}
$mail->SMTPDebug = 1;
// sets the prefix to the servier
$resposta = $mail->Send();
//echo ">>>> ".$mail->SMTPAuth;
$error = ob_get_contents();
ob_end_clean();
flush();
if (!$resposta) {
Error::writeLog("Erro MailInfo: " . $mail->ErrorInfo . "\n" . $error, __FILE__, __LINE__, '');
Debug::p("Erro: " . $mail->ErrorInfo, $error);
Error::show(0, "MailSender: Ocorreu um erro ao enviar e-mail: \n " . $mail->ErrorInfo . __FUNCTION__, __FILE__, __LINE__, '');
if (Config::MAIL_TRY_SEND_SERVER === true) {
$mail->IsMail();
$resposta = $mail->Send();
ob_flush();
flush();
if (!$resposta) {
return -2;
} else {
return 2;
}
}
return -1;
}
return 1;
}
示例7: modelForm
function modelForm()
{
Debug::log("Iniciando Core/Form.", __LINE__, __FUNCTION__, __CLASS__, __FILE__);
if (function_exists("get_called_class")) {
Debug::log("Iniciando form pela classe " . get_called_class(), __LINE__, __FUNCTION__, __CLASS__, __FILE__);
}
Run::$benchmark->mark("FormModel/Inicio");
// --------------------------------------------------------------------------
Debug::p("exeInitial");
$this->exeInitial();
// --------------------------------------------------------------------------
Debug::p("exeCheckSettings");
$this->exeCheckSettings();
// --------------------------------------------------------------------------
Debug::p("exeDataRequests");
$this->exeDataRequests();
// --------------------------------------------------------------------------
Debug::p("exeCleanData");
$this->exeCleanData();
// --------------------------------------------------------------------------
Debug::p("exeCheckTokenAndValidate");
$this->exeCheckTokenAndValidate();
// --------------------------------------------------------------------------
Debug::p("exeDatabaseConnect");
$this->exeDatabaseConnect();
// --------------------------------------------------------------------------
Debug::p("exeAutoDelete");
$this->exeAutoDelete();
// --------------------------------------------------------------------------
Debug::p("exeSave");
$this->exeSave();
// --------------------------------------------------------------------------
Debug::p("exeSelect");
$this->exeSelect();
// --------------------------------------------------------------------------
Debug::p("exeSetSession");
$this->exeSetSession();
// --------------------------------------------------------------------------
Debug::p("exeDelSession");
$this->exeDelSession();
// --------------------------------------------------------------------------
Debug::p("exeGetSession");
$this->exeGetSession();
// --------------------------------------------------------------------------
Debug::p("getDebugs");
$this->getDebugs();
// --------------------------------------------------------------------------
Debug::p("exeCheckErrors");
$this->exeCheckErrors();
// --------------------------------------------------------------------------
}
示例8: triggerPeriodicAutoSendMail
public function triggerPeriodicAutoSendMail()
{
ob_clean();
ob_flush();
flush();
if (!$this->database) {
$this->database = Model::connect($this->connectionID);
}
$query = Model::$query;
$result = $query->select(array('pk_mail', 'fk_user', 'fk_table', 'fk_table_ref', 'from_name', 'from_mail', 'to_name', 'to_mail', 'subject', 'content', 'date_insert', 'status_int'))->from("mail_manager")->where(" status_int = 1 AND sent_status <= 0")->order("pk_mail ASC")->limit(0, Run::MAIL_AUTO_SEND_LIMIT)->execute()->returnAssoc();
$warMsg = $this->database->getWarning();
if ($warMsg != "" && $this->database->getError() != "00000") {
Error::show(5200, "Model-> Erro ao selecionar mailManager:\n " . $warMsg . "\n " . $this->database->getError() . " \n{$sql_query} " . __FUNCTION__, __FILE__, __LINE__, '');
} else {
if (count($result) == 0) {
return false;
}
foreach ($result as $pk => $field) {
if ($field['content'] == "") {
$result = $query->update("mail_manager")->set(" sent_status = '-3', try_count = try_count+1, status_int = -2, date_update = '" . Run::$control->date->getDateUs() . "'")->where(" pk_mail = '" . $field['pk_mail'] . "'")->execute()->getResult();
continue;
}
if ($field['from_mail'] == "") {
$result = $query->update("mail_manager")->set(" sent_status = '-4', try_count = try_count+1, status_int = -2, date_update = '" . Run::$control->date->getDateUs() . "'")->where(" pk_mail = '" . $field['pk_mail'] . "'")->execute()->getResult();
continue;
}
if ($field['to_mail'] == "") {
$result = $query->update("mail_manager")->set(" sent_status = '-5', try_count = try_count+1, status_int = -2, date_update = '" . Run::$control->date->getDateUs() . "'")->where(" pk_mail = '" . $field['pk_mail'] . "'")->execute()->getResult();
continue;
}
$this->ref_pk = $field['pk_mail'];
$field['content'] = str_replace('[id]', $field['pk_mail'], $field['content']);
$this->setFrom($field['from_mail'], $field['from_name']);
$this->setTo($field['to_mail'], $field['to_name']);
$this->setMessage($field['content']);
$this->setSubject($field['subject']);
$resultSend = $this->send();
$result = $query->update("mail_manager")->set(" sent_status = '" . $resultSend . "', try_count = try_count+1, date_update = '" . Run::$control->date->getDateUs() . "'")->where(" pk_mail = '" . $field['pk_mail'] . "'")->execute()->getResult();
if ((is_integer($result) || $warMsg != "") && $this->database->getError() != "00000") {
Error::show(5200, "Model-> Erro ao atualizar mailManager:\n " . $warMsg . "\n " . $this->database->getError() . " \n{$sql_query} " . __FUNCTION__, __FILE__, __LINE__, '');
}
Debug::p("enviado {$resultSend}", $field);
flush();
sleep(1);
}
}
return true;
}
示例9: buildSQLTotal
public function buildSQLTotal($type, $dataIntern, $schema)
{
$sql = "";
$table_from = $schema['from'][0];
$table_name = $table_from['table_nick'] != "" ? $table_from['table_nick'] : $table_from['table'];
if ($type == "list" && $this->getHasMultiple() && $this->model->settings['list_mode'] == "multiple") {
$ws = $this->model->settings['select_use_status'] ? $this->addWhere($schema['where'], $table_name . "." . $table_from['status_name'] . " != '-1'") : "";
$sql = "\n\nSELECT count(DISTINCT(" . $table_from['pk'] . ")) as total FROM ";
$sql .= $this->buildSQLFrom("inner", $dataIntern, $this->model->schema, " ");
$sql .= $this->buildSQLJoins("inner", $dataIntern, $this->model->schema, "\t");
$sql .= "\n\t WHERE " . preg_replace('/\\s/', ' ', $ws);
} else {
$this->addOnWhere($table_name . "." . $table_from['status_name'] . " != '-1'");
Debug::p($this->model->schema['where']);
}
return $sql;
}
示例10: autoDeleteByPKData
private function autoDeleteByPKData($paramTable, $schema, $dataForm)
{
$pks_to_del = array();
$pkList = $this->model->session->getPKListSession();
$pksChecked = array();
$foundPkInFormData = false;
//Debug::p("autoDeleteByPKData", $this->model->dataForm);
//exit;
// VERIFICAR SE VALOR $VI ESTÁ DENTRO DO ARRAY DA TABELA NO SESSION PARA ADICIONAR NO PKS_TO_DEL
Debug::p("SQL_DELETE pkList:" . $paramTable['table_nick'], $pkList);
foreach ($dataForm as $k => $v) {
if ($schema['fields'][$k]['name'] == $paramTable['pk']) {
$foundPkInFormData = true;
if (is_array($v)) {
foreach ($v as $ki => $vi) {
if (is_array($vi)) {
foreach ($pkList[$paramTable['table_nick']] as $pkk => $pkv) {
if (in_array($pkv, $vi)) {
array_push($pksChecked, $pkv);
$pks_to_del = array_diff($pks_to_del, array($pkv));
// removendo ID(pkv) de pks_to_del
} else {
if (!in_array($pkv, $vi) && !in_array($pkv, $pksChecked) && !in_array($pkv, $pks_to_del)) {
//Debug::p("adicionado :".$paramTable['pk'] , $pkv);
array_push($pks_to_del, $pkv);
}
}
}
} else {
//Debug::p("CHECK:".$paramTable['table_nick']." / $k /".$schema['fields'][$k]['name'] , $v);
foreach ($pkList[$paramTable['table_nick']] as $pk_k => $pk_v) {
//Debug::p("in_array:".$pk_v."/".in_array($pk_v, $v) , $v);
if (in_array($pk_v, $v)) {
array_push($pksChecked, $pk_v);
$pks_to_del = array_diff($pks_to_del, array($pk_v));
// removendo ID(pkv) de pks_to_del
} else {
if (!in_array($pk_v, $v) && !in_array($pk_v, $pksChecked) && !in_array($pk_v, $pks_to_del)) {
array_push($pks_to_del, $pk_v);
}
}
}
}
}
} else {
}
}
}
if ($foundPkInFormData == false) {
$field = $this->model->selectData->findFieldByName($paramTable['pk'], $paramTable, $schema['fields']);
if (!isset($dataForm[$field])) {
$pks_to_del = implode(", ", $pkList[$paramTable['table_nick']]);
}
} else {
$pks_to_del = implode(", ", $pks_to_del);
}
//Debug::p("SQL_DELETE pks_to_del:".$paramTable['table_nick'], $_REQUEST);
//Debug::p("SQL_DELETE pksChecked:".$paramTable['table_nick'], $pksChecked);
//Debug::p("SQL_DELETE pks_to_del:".$paramTable['table_nick'], $pks_to_del);
if ($pks_to_del == "") {
return false;
}
//return false;
$updateTime = $this->getDateUpdateName($paramTable, $schema);
$sql_query = "UPDATE " . $paramTable['table'] . " SET {$updateTime} " . $paramTable['status_name'] . "='-1' WHERE " . $paramTable['pk'] . " IN (" . $pks_to_del . ")";
//Debug::p("SQL_DELETE sql_query:", $sql_query);
//return false;
$sql_obj = $this->database->query($sql_query, __LINE__, __FUNCTION__, __CLASS__, __FILE__, $this->settings['database_id']);
//Debug::p($this->database->getError());
$warMsg = $this->database->getWarning();
if (is_integer($sql_obj) || $warMsg != "") {
$this->query_errors++;
Error::show(5200, "Model-> Erro ao deletar multiplo registro não recebido do form:\n " . $warMsg . "\n " . $this->database->getError() . " \n{$sql_query}" . __FUNCTION__, __FILE__, __LINE__, '');
} else {
$log = "Model: SQL Executado com sucesso (returnID:" . $this->database->getID($this->settings['database_id']) . "): \n {$sql_query}";
// Debug::print_r($log);
// Debug::log($log, __LINE__, __FUNCTION__, __CLASS__, __FILE__);
}
}
示例11: run
public static function run()
{
header('Content-type: text/html; charset=utf-8');
// debug
Debug::p('PHP Begin');
$htmlDebug = Request::getGET('htmldebug');
$ajaxDebug = Request::getGET('ajaxdebug');
if ($htmlDebug == 'on') {
Cookie::set('htmldebug', 1);
}
if ($htmlDebug == 'off') {
Cookie::delete('htmldebug');
}
if ($ajaxDebug == 'on') {
Cookie::set('ajaxdebug', 1);
}
if ($ajaxDebug == 'off') {
Cookie::delete('ajaxdebug');
}
self::parseUrl();
$path = empty(self::$CLASS_DIR) ? PROJECT_PATH . '/controller/' . self::$CLASS_NAME . '.class.php' : PROJECT_PATH . '/controller/' . self::$CLASS_DIR . '/' . self::$CLASS_NAME . '.class.php';
if (!is_file($path)) {
$userAgent = Arr::get('HTTP_USER_AGENT', $_SERVER, '');
throw new FrameworkException("控制器:{$path} 不存在!User Agent: {$userAgent}");
}
require_once $path;
$obj = new self::$CLASS_NAME();
$actionName = self::$ACTION . 'Action';
$obj->{$actionName}();
// debug
Debug::p('PHP End');
if (isset($_COOKIE['htmldebug']) && !self::$IS_AJAX || isset($_COOKIE['ajaxdebug']) && self::$IS_AJAX) {
Debug::show();
}
}