本文整理汇总了PHP中journal函数的典型用法代码示例。如果您正苦于以下问题:PHP journal函数的具体用法?PHP journal怎么用?PHP journal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了journal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete_signature
function delete_signature($sig_id)
{
global $dbEmailSig;
$sql = "DELETE FROM `{$dbEmailSig}` WHERE id = {$sig_id}";
mysql_query($sql);
if (mysql_error()) {
trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
}
journal(CFG_LOGGING_NORMAL, 'Global Signature deleted', "A global signature was deleted", CFG_JOURNAL_ADMIN, 0);
html_redirect("edit_global_signature.php");
exit;
}
示例2: mysql_query
}
// NOTE above is so we can insert null so browse_contacts etc can see the contract rather than inserting 0
$sql = "UPDATE `{$dbMaintenance}` SET reseller={$reseller}, expirydate='{$expirydate}', licence_quantity='{$licence_quantity}', ";
$sql .= "licence_type={$licence_type}, notes='{$notes}', admincontact={$admincontact}, term='{$terminated}', servicelevelid='{$servicelevelid}', ";
$sql .= "incident_quantity='{$incident_quantity}', ";
$sql .= "incidentpoolid='{$incidentpoolid}', productonly='{$productonly}', ";
$sql .= "supportedcontacts='{$amount}', allcontactssupported='{$allcontacts}'";
if (!empty($product) and user_permission($sit[2], 22)) {
$sql .= ", product='{$product}'";
}
$sql .= " WHERE id='{$maintid}'";
$result = mysql_query($sql);
if (mysql_error()) {
trigger_error(mysql_error(), E_USER_ERROR);
}
// show error message if addition failed
if (!$result) {
include APPLICATION_INCPATH . 'htmlheader.inc.php';
echo user_alert("Update failed", E_USER_WARNING);
include APPLICATION_INCPATH . 'htmlfooter.inc.php';
} else {
journal(CFG_LOGGING_NORMAL, 'Contract Edited', "contract {$maintid} modified", CFG_JOURNAL_MAINTENANCE, $maintid);
html_redirect("contract_details.php?id={$maintid}");
}
} else {
include APPLICATION_INCPATH . 'htmlheader.inc.php';
echo $errors_string;
include APPLICATION_INCPATH . 'htmlfooter.inc.php';
}
}
}
示例3: trigger_error
$destination_filepath = $CONFIG['ftp_path'] . $file_name;
// check the source file exists
if (!file_exists($filepath)) {
trigger_error("Source file cannot be found: {$filepath}", E_USER_WARNING);
}
// set passive mode if required
if (!ftp_pasv($conn_id, $CONFIG['ftp_pasv'])) {
trigger_error("Problem setting passive ftp mode", E_USER_WARNING);
}
// upload the file
$upload = ftp_put($conn_id, "{$destination_filepath}", "{$filepath}", FTP_BINARY);
// close the FTP stream
ftp_close($conn_id);
// check upload status
if (!$upload) {
trigger_error($strUploadFailed, E_USER_ERROR);
} else {
// store file details in database
// important: path must be blank for public files (all go in same dir)
$sql = "INSERT INTO `{$dbFiles}` (filename, size, userid, shortdescription, longdescription, path, filedate, expiry, fileversion) ";
$sql .= "VALUES ('{$file_name}', '{$filesize}', '" . $sit[2] . "', '{$shortdescription}', '{$longdescription}', '{$CONFIG['ftp_path']}', '{$now}', '{$expirydate}' ,'{$fileversion}')";
mysql_query($sql);
if (mysql_error()) {
trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
}
journal(CFG_LOGGING_NORMAL, 'FTP File Uploaded', sprintf($strFTPFileXUploaded, $filename), CFG_JOURNAL_OTHER, 0);
html_redirect('ftp_upload_file.php');
echo "<code>{$ftp_url}</code>";
}
}
}
示例4: sprintf
$errors = 0;
// check for blank name
if ($name == '') {
$errors++;
$_SESSION['formerrors']['add_product']['name'] = sprintf($strFieldMustNotBeBlank, $strProduct);
}
if ($vendor == '' or $vendor == "0") {
$errors++;
$_SESSION['formerrors']['add_product']['vendor'] = sprintf($strFieldMustNotBeBlank, $strVendor);
}
// add product if no errors
if ($errors == 0) {
$sql = "INSERT INTO `{$dbProducts}` (name, vendorid, description) VALUES ('{$name}', '{$vendor}', '{$description}')";
$result = mysql_query($sql);
if (mysql_error()) {
trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
}
if (!$result) {
echo "<p class='error'>" . sprintf($strAddXfailed, $strProduct) . "\n";
} else {
$id = mysql_insert_id();
journal(CFG_LOGGING_NORMAL, 'Product Added', "Product {$id} was added", CFG_JOURNAL_PRODUCTS, $id);
html_redirect("products.php");
}
clear_form_errors('add_product');
clear_form_data('add_product');
} else {
include APPLICATION_INCPATH . 'htmlheader.inc.php';
html_redirect("product_add.php", FALSE);
}
}
示例5: trigger_error
trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
}
}
if ($target != 'none') {
// Reset the slaemail sent column, so that email reminders can be sent if the new sla target goes out
$sql = "UPDATE `{$dbIncidents}` SET slaemail='0', slanotice='0' WHERE id='{$id}' LIMIT 1";
mysql_query($sql);
if (mysql_error()) {
trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
}
}
if (!$result) {
include APPLICATION_INCPATH . 'incident_html_top.inc.php';
echo "<p class='error'>{$strUpdateIncidentFailed}</p>\n";
include APPLICATION_INCPATH . 'incident_html_bottom.inc.php';
} else {
if ($draftid != -1 and !empty($draftid)) {
$sql = "DELETE FROM `{$dbDrafts}` WHERE id = {$draftid}";
$result = mysql_query($sql);
if (mysql_error()) {
trigger_error(mysql_error(), E_USER_ERROR);
}
}
journal(CFG_LOGGING_MAX, 'Incident Updated', "Incident {$id} Updated", CFG_JOURNAL_SUPPORT, $id);
html_redirect("incident_details.php?id={$id}");
}
}
}
}
}
include APPLICATION_INCPATH . 'incident_html_bottom.inc.php';
示例6: trigger_error
trigger_error(mysql_error(), E_USER_WARNING);
}
if (mysql_num_rows($result) >= 1) {
$errors++;
}
// Check there is no software linked to this product
$sql = "SELECT productid FROM `{$dbSoftwareProducts}` WHERE productid={$productid} LIMIT 1";
$result = mysql_query($sql);
if (mysql_error()) {
trigger_error(mysql_error(), E_USER_WARNING);
}
if (mysql_num_rows($result) >= 1) {
$errors++;
}
if ($errors == 0) {
$sql = "DELETE FROM `{$dbProducts}` WHERE id = {$productid} LIMIT 1";
$result = mysql_query($sql);
if (mysql_error()) {
trigger_error(mysql_error(), E_USER_ERROR);
}
journal(CFG_LOGGING_NORMAL, 'Product Removed', "Product {$productid} was removed", CFG_JOURNAL_PRODUCTS, $productid);
html_redirect("products.php");
} else {
include APPLICATION_INCPATH . 'htmlheader.inc.php';
echo "<p class='error'>{$strSorryProductCantBeDeteled}</p>";
echo "<p align='center'><a href='products.php#{$productid}'>{$strReturnToProductList}</a></p>";
include APPLICATION_INCPATH . 'htmlfooter.inc.php';
}
} else {
trigger_error($strInvalidParameter, E_USER_ERROR);
}
示例7: session_name
//
// SiT (Support Incident Tracker) - Support call tracking system
// Copyright (C) 2000-2009 Salford Software Ltd. and Contributors
//
// This software may be used and distributed according to the terms
// of the GNU General Public License, incorporated herein by reference.
//
// Author: Ivan Lucas <ivanlucas[at]users.sourceforge.net>
require 'core.php';
require APPLICATION_LIBPATH . 'functions.inc.php';
session_name($CONFIG['session_name']);
session_start();
if ($_SESSION['portalauth']) {
journal(CFG_LOGGING_NORMAL, 'Logout', "Portal user " . contact_realname($_SESSION['contactid']) . " logged out", CFG_JOURNAL_LOGIN, $_SESSION['contactid']);
} else {
journal(CFG_LOGGING_NORMAL, 'Logout', "User {$_SESSION['userid']} logged out", CFG_JOURNAL_LOGIN, '');
}
// End the session, remove the cookie and destroy all data registered with the session
$_SESSION['auth'] = FALSE;
$_SESSION['portalauth'] = FALSE;
$_SESSION = array();
session_unset();
session_destroy();
if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time() - 42000, '/');
}
// redirect
if (!empty($CONFIG['logout_url'])) {
$url = $CONFIG['logout_url'];
} else {
$url = $CONFIG['application_webpath'] . "index.php";
示例8: user_alert
if ($maintid == 0) {
$errors = 1;
$errors_string .= user_alert("{$strYouMustSelectAmaintenanceContract}", E_USER_ERROR);
}
// delete maintenance support contact if no errors
if ($errors == 0) {
$sql = "DELETE FROM `{$dbSupportContacts}` WHERE maintenanceid='{$maintid}' AND contactid='{$contactid}'";
$result = mysql_query($sql);
if (mysql_error()) {
trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
}
// show error message if deletion failed
if (!$result) {
include APPLICATION_INCPATH . 'htmlheader.inc.php';
trigger_error("Deletion of maintenance support conact failed: {$sql}", E_USER_WARNING);
include APPLICATION_INCPATH . 'htmlfooter.inc.php';
} else {
journal(CFG_LOGGING_NORMAL, 'Supported Contact Removed', "Contact {$contactid} removed from maintenance contract {$maintid}", CFG_JOURNAL_MAINTENANCED, $maintid);
if ($context == 'maintenance') {
html_redirect("contract_details.php?id={$maintid}");
} else {
html_redirect("contact_details.php?id={$contactid}");
}
}
} else {
// show error message if errors
include APPLICATION_INCPATH . 'htmlheader.inc.php';
echo $errors_string;
include APPLICATION_INCPATH . 'htmlfooter.inc.php';
}
}
示例9: trigger_error
if (!file_exists($source_file)) {
trigger_error(sprintf($strSourceFailCannotBeFoundX, $source_file), E_USER_WARNING);
}
// set passive mode
if (!ftp_pasv($conn_id, TRUE)) {
trigger_error($strProblemSettingPassiveFTPMode, E_USER_WARNING);
}
// upload the file
$upload = ftp_put($conn_id, "{$destination_filepath}", "{$source_file}", FTP_BINARY);
// check upload status
if (!$upload) {
echo "{$strUploadFailed}<br />";
} else {
echo sprintf($strUpdatedXToYAsZ, $source_file, $CONFIG['ftp_hostname'], $destination_filepath) . "<br />";
echo "<code>{$ftp_url}</code>";
journal(CFG_LOGGING_NORMAL, 'FTP File Published', "File {$destination_file_file} was published to {$CONFIG['ftp_hostname']}", CFG_JOURNAL_OTHER, 0);
switch ($expiry_none) {
case 'none':
$expirydate = 0;
break;
case 'time':
if ($expiry_days < 1 && $expiry_hours < 1 && $expiry_minutes < 1) {
$expirydate = 0;
} else {
// uses calculate_time_of_next_action() because the function suits our purpose
$expirydate = calculate_time_of_next_action($expiry_days, $expiry_hours, $expiry_minutes);
}
break;
case 'date':
// $now + ($days * 86400) + ($hours * 3600) + ($minutes * 60);
$unixdate = mktime(9, 0, 0, $month, $day, $year);
示例10: cleanvar
$value = cleanvar($value);
// Remove the software listed that we don't support
$sql = "DELETE FROM `{$dbUserSoftware}` WHERE userid='{$user}' AND softwareid='{$value}' LIMIT 1";
mysql_query($sql);
if (mysql_error()) {
trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
}
// If we are providing backup for a skill we don't have - reset that back to nobody providing backup
$sql = "UPDATE `{$dbUserSoftware}` SET backupid='0' WHERE backupid='{$user}' AND softwareid='{$value}' LIMIT 1";
mysql_query($sql);
if (mysql_error()) {
trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
}
}
}
journal(CFG_LOGGING_MAX, 'Skillset Updated', "Users Skillset was Changed", CFG_JOURNAL_USER, 0);
// Have a look to see if any of the software we support is lacking a backup/substitute engineer
$sql = "SELECT userid FROM `{$dbUserSoftware}` WHERE userid='{$user}' AND backupid='0' LIMIT 1";
$result = mysql_query($sql);
if (mysql_error()) {
trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING);
}
$lacking = mysql_num_rows($result);
if ($lacking >= 1) {
html_redirect("edit_backup_users.php?user={$user}", TRUE, $strYouShouldNowDefineSubstituteEngineers);
} else {
if ($_REQUEST['user'] == $sit[2]) {
html_redirect("edit_user_skills.php?user={$user}");
} else {
html_redirect("manage_users.php");
}
示例11: authenticateSQL
/**
* Authenticate a user with a username/password pair
* @author Ivan Lucas
* @param string $username. A username
* @param string $password. A password (non-md5)
* @return an integer to indicate whether the user authenticated against the database
* @retval int 0 the credentials were wrong or the user was not found.
* @retval int 1 to indicate user is authenticated and allowed to continue.
*/
function authenticateSQL($username, $password)
{
global $dbUsers;
$password = md5($password);
if ($_SESSION['auth'] == TRUE) {
// Already logged in
return 1;
}
// extract user
$sql = "SELECT id FROM `{$dbUsers}` ";
$sql .= "WHERE username = '{$username}' AND password = '{$password}' AND status != 0 ";
// a status of 0 means the user account is disabled
$result = mysql_query($sql);
if (mysql_error()) {
trigger_error(mysql_error(), E_USER_WARNING);
}
// return appropriate value
if (mysql_num_rows($result) == 0) {
mysql_free_result($result);
return 0;
} else {
journal(CFG_LOGGING_MAX, 'User Authenticated', "{$username} authenticated from " . getenv('REMOTE_ADDR'), CFG_JOURNAL_LOGIN, 0);
return 1;
}
}
示例12: mysql_query
$isql .= "VALUES ('{$rolerow->id}', '" . $x[1] . "', 'true')";
$iresult = mysql_query($isql);
if (mysql_error()) {
trigger_error(mysql_error(), E_USER_ERROR);
}
if (mysql_affected_rows() < 1) {
echo user_alert("{$strUpdateUserPermission} " . $x[1] . " {$strFailedOnPass2}", E_USER_WARNING);
}
}
}
}
}
html_redirect("manage_users.php");
exit;
}
journal(CFG_LOGGING_NORMAL, '{$strUserPermissionsEdited}', "{$strUserXPermissionsEdited}", CFG_JOURNAL_USERS, $user);
// Edit the users permissions
if (empty($role) and !empty($user)) {
// First pass, set all access to false
$sql = "UPDATE `{$dbUserPermissions}` SET granted='false' WHERE userid='{$user}'";
$result = mysql_query($sql);
if (mysql_error()) {
trigger_error(mysql_error(), E_USER_ERROR);
}
// Second pass, loop through checkbox array setting access to true where boxes are checked
if (is_array($permselection)) {
//reset ($permselection);
while ($x = each($permselection)) {
$sql = "UPDATE `{$dbUserPermissions}` SET granted='true' WHERE userid='{$user}' AND permissionid='" . $x[1] . "' ";
# echo "Updating permission ".$x[1]."<br />";
# flush();
示例13: authenticate
/**
* Authenticate a user
* @author Lea Anthony
* @param string $username. Username
* @param string $password. Password
* @return an integer to indicate whether the user authenticated against any authentication backends
* @retval bool false the credentials were wrong or the user was not found.
* @retval bool true to indicate user is authenticated and allowed to continue.
*/
function authenticate($username, $password)
{
global $CONFIG;
$toReturn = false;
$sql = "SELECT id, password, status, user_source FROM `{$GLOBALS['dbUsers']}` WHERE username = '{$username}'";
$result = mysql_query($sql);
if (mysql_error()) {
trigger_error(mysql_error(), E_USER_WARNING);
}
if (mysql_num_rows($result) == 1) {
// Exist in SiT DB
$obj = mysql_fetch_object($result);
if ($obj->user_source == 'sit') {
if (md5($password) == $obj->password and $obj->status != 0) {
$toReturn = true;
} else {
$toReturn = false;
}
} elseif ($obj->user_source == 'ldap') {
// Auth against LDAP and sync
$toReturn = authenticateLDAP($username, $password, $obj->id);
if ($toReturn === -1) {
// Communication with LDAP server failed
if ($CONFIG['ldap_allow_cached_password']) {
// Use cached password
if (md5($password) == $obj->password and $obj->status != 0) {
$toReturn = true;
} else {
$toReturn = false;
}
} else {
$toReturn = false;
}
} elseif ($toReturn) {
$toReturn = true;
} else {
$toReturn = false;
}
}
} elseif (mysql_num_rows($result) > 1) {
// Multiple this should NEVER happen
trigger_error("Username not unique", E_USER_ERROR);
$toReturn = false;
} else {
// Don't exist, check LDAP etc
if ($CONFIG['use_ldap']) {
$toReturn = authenticateLDAP($username, $password);
if ($toReturn === -1) {
$toReturn = false;
}
}
}
if ($toReturn) {
journal(CFG_LOGGING_MAX, 'User Authenticated', "{$username} authenticated from " . getenv('REMOTE_ADDR'), CFG_JOURNAL_LOGIN, 0);
debug_log("Authenticate: User authenticated", TRUE);
} else {
debug_log("authenticate: User NOT authenticated", TRUE);
}
return $toReturn;
}
示例14: cleanvar
// delete_product_software.php
//
// SiT (Support Incident Tracker) - Support call tracking system
// Copyright (C) 2000-2009 Salford Software Ltd. and Contributors
//
// This software may be used and distributed according to the terms
// of the GNU General Public License, incorporated herein by reference.
//
// Author: Ivan Lucas <ivanlucas[at]users.sourceforge.net>
// Removes link between a product and software
$permission = 24;
// Add Product
require 'core.php';
require APPLICATION_LIBPATH . 'functions.inc.php';
$title = "{$strDisassociateSkillWithProduct}";
// This page requires authentication
require APPLICATION_LIBPATH . 'auth.inc.php';
// External variables
$productid = cleanvar($_REQUEST['productid']);
$softwareid = cleanvar($_REQUEST['softwareid']);
if (!empty($productid) && !empty($softwareid)) {
$sql = "DELETE FROM `{$dbSoftwareProducts}` WHERE productid='{$productid}' AND softwareid='{$softwareid}' LIMIT 1";
mysql_query($sql);
if (mysql_error()) {
trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
}
journal(CFG_LOGGING_NORMAL, 'Skill Unlinked', "Skill {$softwareid} was unlinked from Product {$productid}", CFG_JOURNAL_PRODUCTS, $productid);
html_redirect("products.php");
} else {
html_redirect("products.php", FALSE, "{$strRequiredDataMissing}");
}
示例15: mysql_query
// save to db
if (!empty($newcontact)) {
$sql = "UPDATE `{$dbSupportContacts}` SET contactid='{$newcontact}' WHERE contactid='{$id}' ";
mysql_query($sql);
if (mysql_error()) {
trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
}
$sql = "UPDATE `{$dbIncidents}` SET contact='{$newcontact}' WHERE contact='{$id}' ";
mysql_query($sql);
if (mysql_error()) {
trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
}
$sql = "UPDATE `{$dbMaintenance}` SET admincontact='{$newcontact}' WHERE admincontact='{$id}' ";
mysql_query($sql);
if (mysql_error()) {
trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
}
}
// do the delete
$sql = "DELETE FROM `{$dbContacts}` WHERE id='{$id}' LIMIT 1";
mysql_query($sql);
if (mysql_error()) {
trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
}
journal(CFG_LOGGING_NORMAL, 'Contact Deleted', "Contact {$id} was deleted", CFG_JOURNAL_CONTACTS, $id);
if (!empty($newcontact)) {
html_redirect("contact_details.php?id={$newcontact}");
} else {
html_redirect("contacts.php");
}
}