/** Saves the local playlist */
 function makeLocalPlaylist()
 {
     global $config, $user;
     if (count($this->audioFiles) == 0) {
         raiseError("playlist_empty");
     }
     // clear old playlists
     $userid = $user->id;
     if (!$userid) {
         $userid = 'guest';
     }
     $dir = dir($config['tmpDir']);
     while ($entry = $dir->read()) {
         if (preg_match("/^pl_{$userid}/", $entry)) {
             if (!unlink($config['tmpDir'] . "/" . $entry)) {
                 logError("Could not delete playlist: {$entry}");
             }
         }
     }
     // write new playlist
     $tmpfile = $config['tmpDir'] . '/pl_' . $this->getTmpId() . '.m3u';
     $fp = fopen($tmpfile, 'wb');
     if (!$fp) {
         raiseError("Could not write to playlist file: {$tmpfile}");
     }
     reset($this->audioFiles);
     while (list(, $audioFile) = each($this->audioFiles)) {
         fwrite($fp, $audioFile['path'] . "\n");
     }
     fclose($fp);
     $this->localPlaylist = $tmpfile;
     return $tmpfile;
 }
Ejemplo n.º 2
0
function handleUpload($FILE, $params)
{
    global $auth, $locale, $dataDir, $db, $defaults, $passHasher;
    // fix file size overflow (when possible) in php 5.4-5.5
    if ($FILE['size'] < 0) {
        $FILE['size'] = filesize($FILE["tmp_name"]);
        if ($FILE['size'] < 0) {
            logError($FILE["tmp_name"] . ": uncorrectable PHP file size overflow");
            return false;
        }
    }
    // generate new unique id/file name
    list($id, $tmpFile) = genTicketId();
    $tmpFile = preg_replace('/(\\/.*\\/)/', "\\1{$FILE['name']}_", $tmpFile);
    if (!move_uploaded_file($FILE["tmp_name"], $tmpFile)) {
        logError("cannot move file " . $FILE["tmp_name"] . " into {$tmpFile}");
        return handleUploadFailure($tmpFile);
    }
    // check DB connection after upload
    reconnectDB();
    // prepare data
    $sql = "INSERT INTO ticket (id, user_id, name, path, size, cmt, pass_ph" . ", time, expire, last_time, expire_dln, notify_email, sent_email, locale) VALUES (";
    $sql .= $db->quote($id);
    $sql .= ", " . $auth['id'];
    $sql .= ", " . $db->quote(mb_sane_base($FILE["name"]));
    $sql .= ", " . $db->quote($tmpFile);
    $sql .= ", " . $FILE["size"];
    $sql .= ", " . (empty($params["comment"]) ? 'NULL' : $db->quote($params["comment"]));
    $sql .= ", " . (empty($params["pass"]) ? 'NULL' : $db->quote($passHasher->HashPassword($params["pass"])));
    $sql .= ", " . time();
    if (@$params["permanent"]) {
        $sql .= ", NULL";
        $sql .= ", NULL";
        $sql .= ", NULL";
    } else {
        if (!isset($params["ticket_total"]) && !isset($params["ticket_lastdl"]) && !isset($params["ticket_maxdl"])) {
            $params["ticket_total"] = $defaults['ticket']['total'];
            $params["ticket_lastdl"] = $defaults['ticket']['lastdl'];
            $params["ticket_maxdl"] = $defaults['ticket']['maxdl'];
        }
        $sql .= ", " . (empty($params["ticket_total"]) ? 'NULL' : time() + $params["ticket_total"]);
        $sql .= ", " . (empty($params["ticket_lastdl"]) ? 'NULL' : $params["ticket_lastdl"]);
        $sql .= ", " . (empty($params["ticket_maxdl"]) ? 'NULL' : (int) $params["ticket_maxdl"]);
    }
    $sql .= ", " . (empty($params["notify"]) ? 'NULL' : $db->quote(fixEMailAddrs($params["notify"])));
    $sql .= ", " . (empty($params["send_to"]) ? 'NULL' : $db->quote(fixEMailAddrs($params["send_to"])));
    $sql .= ", " . $db->quote($locale);
    $sql .= ")";
    if ($db->exec($sql) != 1) {
        logDBError($db, "cannot commit new ticket to database");
        return handleUploadFailure($tmpFile);
    }
    // fetch defaults
    $sql = "SELECT * FROM ticket WHERE id = " . $db->quote($id);
    $DATA = $db->query($sql)->fetch();
    $DATA['pass'] = empty($params["pass"]) ? NULL : $params["pass"];
    // trigger creation hooks
    onTicketCreate($DATA);
    return $DATA;
}
Ejemplo n.º 3
0
/**
 * Functions registered with the worker
 *
 * @param object $job 
 * @return void
 */
function analytics($job)
{
    //Get the info of the job
    list($domain, $id, $data) = unserialize($job->workload());
    //Ensure the minimum info
    if (empty($id) || empty($data) || empty($domain)) {
        echo sprintf("%s: To register an event we need the data and the id\n", date('r'));
        $job->sendFail();
        return FALSE;
    }
    echo sprintf("%s: Received a task to store an analytics event\n", date('r'));
    echo sprintf("%s: Sending the event #%s to %s domain\n", date('r'), $id, $domain);
    $document = new Zend_Cloud_DocumentService_Document($data, $id);
    try {
        $amazonSDB = getAmazonSDB();
        try {
            $amazonSDB->insertDocument($domain, $document);
        } catch (Zend_Cloud_DocumentService_Exception $e) {
            echo sprintf("%s: Connectivity issues, sleeping 0.5s\n", date('r'));
            usleep(500000);
            $amazonSDB->insertDocument($domain, $document);
        }
        echo sprintf("%s: Event #%s stored\n\n", date('r'), $id);
        $job->sendComplete(TRUE);
        return TRUE;
    } catch (Zend_Cloud_DocumentService_Exception $e) {
        logError(sprintf("%s: Error while storing the event #%s - %s\n\n", date('r'), $id, $e->getMessage()));
        $job->sendFail();
        return FALSE;
    }
}
 function __construct($orientation, $metric, $size, $startdate, $enddate, $userid)
 {
     $dynamicY = 0;
     parent::__construct($orientation, $metric, $size);
     $this->SetAutoPageBreak(true, 30);
     $this->AddPage();
     try {
         $and = "";
         if ($startdate != "") {
             $and .= " AND A.metacreateddate >= '{$startdate}'  ";
         }
         if ($enddate != "") {
             $and .= " AND A.metacreateddate <= '{$enddate}'  ";
         }
         if ($userid != "0") {
             $and .= " AND A.takenbyid = {$userid}   ";
         }
         $sql = "SELECT A.*, \n\t\t\t\t\t    B.name AS customername, B.accountnumber, \n\t\t\t\t\t    C.fullname,\n\t\t\t\t\t\tDATE_FORMAT(A.metacreateddate, '%d/%m/%Y %H:%I') AS metacreateddate\n\t\t\t\t\t\tFROM {$_SESSION['DB_PREFIX']}quotation A \n\t\t\t\t\t\tLEFT OUTER JOIN {$_SESSION['DB_PREFIX']}customer B \n\t\t\t\t\t\tON B.id = A.customerid \n\t\t\t\t\t\tLEFT OUTER JOIN {$_SESSION['DB_PREFIX']}members C \n\t\t\t\t\t\tON C.member_id = A.takenbyid \n\t\t\t\t\t\tWHERE 1 = 1 {$and}  \n\t\t\t\t\t\tORDER BY B.name, A.metacreateddate";
         $result = mysql_query($sql);
         if ($result) {
             while ($member = mysql_fetch_assoc($result)) {
                 $line = array("Customer" => $member['customername'], "Customer Code" => $member['accountnumber'], "Quotation Number" => getSiteConfigData()->bookingprefix . "-" . sprintf("%06d", $member['id']), "User" => $member['fullname'], "Quotation Date" => $member['metacreateddate'], "Value" => number_format($member['total'], 2));
                 $this->addLine($this->GetY(), $line);
             }
         } else {
             logError($sql . " - " . mysql_error());
         }
     } catch (Exception $e) {
         logError($e->getMessage());
     }
 }
Ejemplo n.º 5
0
function newticket($msg, $params = null)
{
    global $ticketRestParams;
    // handle the upload itself
    $DATA = $validated = false;
    if (isset($_FILES["file"]) && is_uploaded_file($_FILES["file"]["tmp_name"]) && $_FILES["file"]["error"] == UPLOAD_ERR_OK && ($validated = validateParams($ticketRestParams, $msg))) {
        $DATA = handleUpload($_FILES["file"], $msg);
    }
    if ($DATA === false) {
        // ticket creation unsucessfull
        if ($validated && !empty($_FILES["file"]) && !empty($_FILES["file"]["name"])) {
            $err = uploadErrorStr($_FILES["file"]);
            logError("ticket upload failure: {$err}");
            return array('httpInternalError', $err);
        } elseif (!$validated) {
            logError('invalid ticket parameters');
            return array('httpBadRequest', 'bad parameters');
        } else {
            // errors already generated in handleUpload
            return array('httpInternalError', 'internal error');
        }
    }
    // return ticket instance
    return array(false, array("id" => $DATA['id'], "url" => ticketUrl($DATA)));
}
Ejemplo n.º 6
0
 function __construct($orientation, $metric, $size, $startdate, $enddate, $userid)
 {
     $dynamicY = 0;
     parent::__construct($orientation, $metric, $size);
     $this->SetAutoPageBreak(true, 30);
     $this->AddPage();
     try {
         $and = "";
         if ($startdate != "") {
             $and .= " AND A.matchdate >= '{$startdate}'  ";
         }
         if ($enddate != "") {
             $and .= " AND A.matchdate <= '{$enddate}'  ";
         }
         if ($userid != "0") {
             $and .= " AND A.refereeid = {$userid}   ";
         }
         $sql = "SELECT COUNT(*) AS matches, SUM(refereescore) AS score, \n\t\t\t\t\t    B.name AS refereeename\n\t\t\t\t\t\tFROM {$_SESSION['DB_PREFIX']}matchdetails A \n\t\t\t\t\t\tLEFT OUTER JOIN {$_SESSION['DB_PREFIX']}referee B \n\t\t\t\t\t\tON B.id = A.refereeid \n\t\t\t\t\t\tWHERE refereescore >= 0 {$and}\n\t\t\t\t\t\tGROUP BY B.name  \n\t\t\t\t\t\tORDER BY B.name";
         $result = mysql_query($sql);
         if ($result) {
             while ($member = mysql_fetch_assoc($result)) {
                 $line = array("Referee" => $member['refereeename'], "Games" => $member['matches'], "Average Score" => number_format($member['score'] / $member['matches'], 1));
                 if ($this->GetY() > 265) {
                     $this->AddPage();
                 }
                 $this->addLine($this->GetY(), $line);
             }
         } else {
             logError($sql . " - " . mysql_error());
         }
     } catch (Exception $e) {
         logError($e->getMessage());
     }
 }
Ejemplo n.º 7
0
/**
 * Functions registered with the worker
 *
 * @param object $job 
 * @return void
 */
function internal_upload($job)
{
    //Get the info of the job
    list($localFilename, $remoteFilename, $removeFile) = unserialize($job->workload());
    //Default value if empty
    if (is_null($removeFile)) {
        $removeFile = FALSE;
    }
    //Do some checks
    if (empty($localFilename) || empty($remoteFilename)) {
        logError(sprintf("%s: The workload do not contain the required info to do the upload\n\n", date('r')));
        $job->sendFail();
        return FALSE;
    }
    echo sprintf("%s: Received job to internal upload %s\n", date('r'), $localFilename);
    //Do the upload
    $uploaded = upload($localFilename, $remoteFilename);
    if ($uploaded !== TRUE) {
        logError(sprintf("%s: Error while uploading the file to Amazon S3 - %s\n\n", date('r'), $uploaded->getMessage()));
        $job->sendFail();
        return FALSE;
    }
    //Check if we have to remove the file
    if ($removeFile) {
        //Remove the original file
        if (!unlink(ROOT_PATH . '/public/frontend/tmp/' . $localFilename)) {
            logError(sprintf("%s: Error removing the file\n\n", date('r')));
            $job->sendFail();
            return FALSE;
        }
    }
    $job->sendComplete(TRUE);
    echo sprintf("%s: Job finished successfully\n\n", date('r'));
    return TRUE;
}
 function __construct($orientation, $metric, $size, $datefrom)
 {
     $dynamicY = 0;
     $this->dateFrom = $datefrom;
     start_db();
     parent::__construct($orientation, $metric, $size);
     $this->SetAutoPageBreak(true, 30);
     $this->AddPage();
     try {
         $startdate = convertStringToDate($this->dateFrom);
         $sql = "SELECT A.name, C.amount,\n\t\t\t\t\t    (\n\t\t\t\t\t   \t\tSELECT SUM(B.amount) * D.retailprice\n\t\t\t\t\t   \t\tFROM {$_SESSION['DB_PREFIX']}eventtransaction B \n\t\t\t\t\t   \t\tINNER JOIN {$_SESSION['DB_PREFIX']}product D\n\t\t\t\t\t   \t\tON D.id = B.productid \n\t\t\t\t\t   \t\tWHERE B.eventid = A.id \n\t\t\t\t\t   \t\tAND B.eventdate = '{$startdate}' \n\t\t\t\t\t   \t\tAND B.type = 'S'\n\t\t\t\t\t    ) AS sold\n\t\t\t\t\t    FROM {$_SESSION['DB_PREFIX']}event A \n\t\t\t\t\t    LEFT OUTER JOIN {$_SESSION['DB_PREFIX']}eventforecast C\n\t\t\t\t\t    ON C.eventid = A.id\n\t\t\t\t\t    AND C.forecastdate = '{$startdate}' \n\t\t\t\t\t\tORDER BY A.name";
         $result = mysql_query($sql);
         if ($result) {
             while ($member = mysql_fetch_assoc($result)) {
                 $sold = $member['sold'] != "" ? $member['sold'] : 0;
                 $line = array("Event" => $member['name'], "Takings" => "£ " . number_format($sold, 2), "Expected" => "£ " . number_format($member['amount'], 2));
                 $this->addLine($this->GetY(), $line, 6.2);
             }
         } else {
             logError($sql . " - " . mysql_error());
         }
     } catch (Exception $e) {
         logError($e->getMessage());
     }
 }
Ejemplo n.º 9
0
 function __construct($orientation, $metric, $size, $startdate, $enddate, $userid)
 {
     $dynamicY = 0;
     parent::__construct($orientation, $metric, $size);
     $this->SetAutoPageBreak(true, 30);
     $this->AddPage();
     try {
         $sql = "SELECT A.*, \n\t\t\t\t\t    B.name AS customername, B.accountnumber, \n\t\t\t\t\t\tDATE_FORMAT(A.metacreateddate, '%d/%m/%Y %H:%I') AS metacreateddate, \n\t\t\t\t\t\tDATE_FORMAT(A.converteddatetime, '%d/%m/%Y %H:%I') AS converteddatetime,\n\t\t\t\t\t\tTIMEDIFF(A.converteddatetime, A.metacreateddate) as diff\n\t\t\t\t\t\tFROM {$_SESSION['DB_PREFIX']}quotation A \n\t\t\t\t\t\tLEFT OUTER JOIN {$_SESSION['DB_PREFIX']}customer B \n\t\t\t\t\t\tON B.id = A.customerid \n\t\t\t\t\t\tLEFT OUTER JOIN {$_SESSION['DB_PREFIX']}members C \n\t\t\t\t\t\tON C.member_id = A.takenbyid \n\t\t\t\t\t\tWHERE A.takenbyid = {$userid} \n\t\t\t\t\t\tAND A.metacreateddate >= '{$startdate}' \n\t\t\t\t\t\tAND A.metacreateddate <= '{$enddate}'  \n\t\t\t\t\t\tORDER BY A.metacreateddate DESC";
         $result = mysql_query($sql);
         if ($result) {
             while ($member = mysql_fetch_assoc($result)) {
                 $diff = $member['diff'];
                 $conversiondate = $member['converteddatetime'];
                 if (substr($diff, 0, 1) == "-") {
                     $diff = " ";
                 }
                 if (substr($conversiondate, 0, 2) == "00") {
                     $conversiondate = " ";
                 }
                 $line = array("Customer" => $member['customername'], "Customer Code" => $member['accountnumber'], "Quotation Number" => getSiteConfigData()->bookingprefix . "-" . sprintf("%06d", $member['id']), "Quotation Date" => $member['metacreateddate'], "Conversion Date" => $conversiondate, "Time Taken" => $diff, "Total" => number_format($member['total'], 2));
                 $this->addLine($this->GetY(), $line);
             }
         } else {
             logError($sql . " - " . mysql_error());
         }
     } catch (Exception $e) {
         logError($e->getMessage());
     }
 }
Ejemplo n.º 10
0
 function __construct($orientation, $metric, $size, $year, $month)
 {
     $dynamicY = 0;
     parent::__construct($orientation, $metric, $size);
     $this->SetAutoPageBreak(true, 30);
     $this->AddPage();
     try {
         $sql = "SELECT SUM(TIMESTAMPDIFF(MINUTE, starttime, endtime)) AS hours,  B.name AS customername\n\t\t\t\t\t\tFROM {$_SESSION['DB_PREFIX']}diary A \n\t\t\t\t\t\tINNER JOIN {$_SESSION['DB_PREFIX']}client B \n\t\t\t\t\t\tON B.id = A.clientid \n\t\t\t\t\t\tWHERE A.status IN ('I', 'C')\n\t\t\t\t\t\tAND YEAR(A.starttime) = {$year}\n\t\t\t\t\t\tAND MONTH(A.starttime) = {$month}\n\t\t\t\t\t\tAND A.deleted != 'Y'\n\t\t\t\t\t\tGROUP BY B.name\n\t\t\t\t\t\tORDER BY B.name";
         $result = mysql_query($sql);
         if ($result) {
             while ($member = mysql_fetch_assoc($result)) {
                 $line = array("Customer" => $member['customername'], "Hours Worked" => number_format($member['hours'] / 60, 2));
                 if ($this->GetY() > 260) {
                     $this->AddPage();
                 }
                 $this->addLine($this->GetY(), $line, 5.5);
                 $this->Line(10, $this->GetY() - 0.5, 200, $this->GetY() - 0.5);
             }
         } else {
             logError($sql . " - " . mysql_error());
         }
     } catch (Exception $e) {
         logError($e->getMessage());
     }
 }
Ejemplo n.º 11
0
 function __construct($orientation, $metric, $size, $startdate, $enddate)
 {
     $dynamicY = 0;
     parent::__construct($orientation, $metric, $size);
     $this->SetAutoPageBreak(true, 30);
     $this->AddPage();
     try {
         $and = "";
         if ($startdate != "") {
             $and .= " AND A.matchdate >= '{$startdate}'  ";
         }
         if ($enddate != "") {
             $and .= " AND A.matchdate <= '{$enddate}'  ";
         }
         $sql = "SELECT A.*, DATE_FORMAT(A.matchdate, '%d/%m/%Y') AS matchdate,\n\t\t\t\t\t    B.name AS refereeename,\n\t\t\t\t\t    C.age, C.name AS teamname\n\t\t\t\t\t\tFROM {$_SESSION['DB_PREFIX']}matchdetails A \n\t\t\t\t\t\tLEFT OUTER JOIN {$_SESSION['DB_PREFIX']}referee B \n\t\t\t\t\t\tON B.id = A.refereeid \n\t\t\t\t\t\tLEFT OUTER JOIN {$_SESSION['DB_PREFIX']}teamagegroup C \n\t\t\t\t\t\tON C.id = A.teamid \n\t\t\t\t\t\tWHERE (A.ratereferee = 'P' OR A.rateplayers = 'P' OR A.ratemanagement = 'P' OR A.ratespectators = 'P' OR A.ratepitchsize = 'P' OR A.ratepitchcondition = 'P' OR A.rategoalsize = 'P' OR A.ratechangingrooms = 'P') {$and}\n\t\t\t\t\t\tORDER BY A.matchdate";
         $result = mysql_query($sql);
         if ($result) {
             while ($member = mysql_fetch_assoc($result)) {
                 $line = array("Date of Match" => $member['matchdate'], "Age Group" => "Under " . $member['age'], "Division" => $member['division'], "Reported By" => $member['teamname'], "Match ID" => $member['id'], "Comments" => $member['remarks']);
                 if ($this->GetY() > 175) {
                     $this->AddPage();
                 }
                 $this->addLine($this->GetY(), $line);
             }
         } else {
             logError($sql . " - " . mysql_error());
         }
     } catch (Exception $e) {
         logError($e->getMessage());
     }
 }
function shutdown()
{
	$error=error_get_last();
	if(is_array($error))
	{
	   if($error['type']==E_ERROR || $error['type']==E_CORE_ERROR || $error['type']==E_COMPILE_ERROR) // Håndterer fatal errors
	   {
			$feilmelding=now();
			foreach($error as $value)
			{
				$feilmelding.=" - $value";
			}
			logFatal($feilmelding);
			header("Location: error.php");
		}
		if($error['type']==E_WARNING || $error['type']==E_PARSE) // Håndterer warning og parse
	   {
			$feilmelding=now();
			foreach($error as $value)
			{
				$feilmelding.=" - $value";
			}
			logError($feilmelding);
		}
	}
}
Ejemplo n.º 13
0
 /**
  * @param $result
  * @param array $cache array( //二维数组
  *                              array($key,$prefix,$time), //需要缓存微信返回的键 , 系统标识前缀 ,缓存时间(可为空)
  *                              array($key2,$prefix2,$time2)
  *                          )
  * @return bool
  */
 public function resultHandle($result, $cache = array())
 {
     $body = $result->body;
     if (is_object($body)) {
         if (!property_exists($body, 'errcode') || 0 == $body->errcode) {
             foreach ($body as $key => $val) {
                 $this->{$key} = $val;
                 foreach ($cache as $v) {
                     if ($v[0] == $key) {
                         if (isset($v[2]) && is_numeric($v[2])) {
                             $this->setCacheToWechat($v[1], $v[0], $val, $v[2]);
                         } elseif (isset($v[2]) && property_exists($body, $v[2]) && is_numeric($body->{$v}[2])) {
                             $this->setCacheToWechat($v[1], $v[0], $val, $body->{$v}[2]);
                         } else {
                             $this->setCacheToWechat($v[1], $v[0], $val);
                         }
                     }
                 }
             }
             return true;
         } else {
             logError('[errcode:' . $body->errcode . '][errmsg:' . $body->errmsg . ']');
             return false;
         }
     }
     logError('[Result Body not Object On Time' . date('Y-m-d H:i:s') . ']');
     return false;
 }
Ejemplo n.º 14
0
 public function errorAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->viewRenderer->setViewSuffix('phtml');
     $errors = $this->_getParam('error_handler');
     if ($errors) {
         switch ($errors->type) {
             case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
             case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
                 //case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_OTHER:
                 // 404 error -- controller or action not found
                 $this->_helper->viewRenderer('404');
                 $this->getResponse()->setHttpResponseCode(404);
                 $this->getResponse()->setRawHeader('HTTP/1.1 404 Not Found');
                 echo $this->view->message = 'Page not found';
                 //$this->view->errorMessage = $this->_defaultMessages['ERROR_404'];
                 break;
             default:
                 // application error; display error page, but don't change
                 // status code
                 // Log the exception:
                 $exception = $errors->exception;
                 logError('ERROR HANDLER', $exception->getMessage() . "\n" . $exception->getTraceAsString());
                 break;
         }
     } else {
         $this->_helper->viewRenderer('404');
         $this->getResponse()->setHttpResponseCode(404);
         $this->view->message = 'Page not found';
     }
 }
Ejemplo n.º 15
0
function reject()
{
    global $message;
    $id = $_POST['pk1'];
    $messageid = $_POST['pk2'];
    $sql = "SELECT A.weeknumber, A.memberid, A.swapmemberid  " . "FROM {$_SESSION['DB_PREFIX']}oncallswap A " . "WHERE A.id = {$id}";
    $result = mysql_query($sql);
    if ($result) {
        /* Show children. */
        while ($member = mysql_fetch_assoc($result)) {
            $qry = "UPDATE {$_SESSION['DB_PREFIX']}oncallswap " . "SET agreed = 'X', metamodifieddate = NOW(), metamodifieduserid = " . getLoggedOnMemberID() . " " . "WHERE id = {$id}";
            $itemresult = mysql_query($qry);
            if (!$itemresult) {
                logError($qry . " = " . mysql_error());
            }
            $qry = "UPDATE {$_SESSION['DB_PREFIX']}messages " . "SET status = 'R', metamodifieddate = NOW(), metamodifieduserid = " . getLoggedOnMemberID() . " " . "WHERE id = {$messageid}";
            $itemresult = mysql_query($qry);
            if (!$itemresult) {
                logError($qry . " = " . mysql_error());
            }
            sendInternalUserMessage($member['memberid'], "On Call Swap Request", "Your request for on call cover for week " . $member['weeknumber'] . " has been rejected by " . GetUserName($member['swapmemberid']));
            $message = "Request has been rejected";
        }
    }
}
 protected function processDELETE($parsed)
 {
     if (count($parsed['TABLES']) > 1) {
         logError("cannot translate delete statement into Oracle dialect, multiple tables are not allowed.");
     }
     return "DELETE";
 }
Ejemplo n.º 17
0
function alter($sql)
{
    $result = mysql_query($sql);
    if (!$result) {
        logError($sql . " - " . mysql_error());
    }
    echo "<div>{$sql}</div>";
}
Ejemplo n.º 18
0
function getShardsByKey($key)
{
    $shards = doGetShardsByKey($key);
    if (!$shards) {
        logError('cannot get shards for "' . $key . '""');
    }
    return $shards;
}
Ejemplo n.º 19
0
function startSessionIfNecessary()
{
    if (session_status() == PHP_SESSION_NONE && !session_start()) {
        logError('cannot start session');
        return false;
    }
    return true;
}
Ejemplo n.º 20
0
 public function postUpdateEvent($id)
 {
     /* Event. */
     $qry = "UPDATE {$_SESSION['DB_PREFIX']}members SET \n\t\t\t\t\tfullname = CONCAT(firstname, CONCAT(' ', lastname)) \n\t\t\t\t\tWHERE member_id = {$id}";
     $result = mysql_query($qry);
     if (!$result) {
         logError($qry . " = " . mysql_error());
     }
 }
Ejemplo n.º 21
0
function reject()
{
    $qry = "UPDATE {$_SESSION['DB_PREFIX']}members " . "SET accepted = 'X' " . "WHERE member_id = " . $_POST['pk1'];
    $result = mysql_query($qry);
    if (!$result) {
        logError($qry . " = " . mysql_error());
    }
    sendUserMessage($_POST['pk1'], "User Registration", "Welcome to Oracle logs.<br>Unfortunately, your user registration has been rejected.");
}
Ejemplo n.º 22
0
function showColumn()
{
    $id = $_POST['gridid'];
    $qry = "UPDATE {$_SESSION['DB_PREFIX']}applicationtablecolumns SET hidecolumn = 0, metamodifieddate = NOW(), metamodifieduserid = " . getLoggedOnMemberID() . " WHERE id = {$id}";
    $result = mysql_query($qry);
    if (!$result) {
        logError($qry . " - " . mysql_error());
    }
}
Ejemplo n.º 23
0
 /**
  * rollBack.
  * @return bool
  */
 public function rollBack()
 {
     // If $this->_adapter is empty we throw exception.
     if (empty($this->_adapter)) {
         logError('rollBack function failed', 'Adapter is Null');
         throw new Zend_Db_Exception('rollBack function failed: Adapter is Null');
     }
     return $this->_adapter->rollBack();
 }
Ejemplo n.º 24
0
function getCommonConstant($key)
{
    $value = getIfExists(COMMON_CONSTANTS, $key);
    if (is_null($value)) {
        logError('cannot find constant "' . $key . '"');
        exit;
    }
    return $value;
}
function manejadorErrores($numerr, $menserr = NULL, $nombrearchivo = NULL, $numlinea = NULL, $vars = array())
{
    $tipoerror = 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', E_STRICT => 'Runtime Notice', E_RECOVERABLE_ERROR => 'Catchable Fatal Error');
    $errores_usuario = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);
    if (in_array($numerr, $errores_usuario)) {
        header('HTTP/1.0 500 Internal Server Error');
        echo $menserr;
    }
    logError($menserr, $nombrearchivo, $numlinea);
}
Ejemplo n.º 26
0
function exceptionHandle($e)
{
    if (DEBUG_MODE) {
        require LIBRARY . '/error/exception.phtml';
    } else {
        require VIEW . '/error.phtml';
        logError($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
    }
    exit;
}
Ejemplo n.º 27
0
 public function postInsertEvent()
 {
     $id = mysql_insert_id();
     $fullname = $_POST['firstname'] . " " . $_POST['lastname'];
     $qry = "UPDATE {$_SESSION['DB_PREFIX']}referee SET\n\t\t\t\t\tname = '{$fullname}'\n\t\t\t\t\tWHERE id = {$id}";
     $result = mysql_query($qry);
     if (!$result) {
         logError($qry . " - " . mysql_error());
     }
 }
Ejemplo n.º 28
0
function logMessage($logLevel)
{
    if ($logLevel == 'info') {
        return logInfo();
    } elseif ($logLevel == 'error') {
        return logError();
    } else {
        return "[UNK], '{$logLevel}' is unknown.";
    }
}
Ejemplo n.º 29
0
function debug($arr)
{
    $bColor = isset($arr['Error']) ? 'red' : 'gray';
    $bSize = isset($arr['Error']) ? 3 : 1;
    echo "<pre style='border:" . $bSize . "px dashed " . $bColor . ";border-radius:10px;padding:10px;text-transform:none;'>";
    ob_start();
    var_export($arr);
    $out = ob_get_contents();
    ob_end_flush();
    echo "</pre>\n\n";
    logError($out);
}
Ejemplo n.º 30
0
 public function getPsttitle($id)
 {
     try {
         $select = $this->select();
         $select->where('id = ?', $id);
         $posting_title = $this->fetchRow($select);
         return $posting_title->title;
     } catch (Exception $e) {
         logError('Pst_title failed!', $e);
         throw $e;
     }
 }