本文整理汇总了PHP中addHistory函数的典型用法代码示例。如果您正苦于以下问题:PHP addHistory函数的具体用法?PHP addHistory怎么用?PHP addHistory使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了addHistory函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
function store()
{
$msg = $this->check();
if ($msg) {
return get_class($this) . "::store-check failed";
}
$q = new DBQuery();
if ($this->user_id) {
// save the old password
$perm_func = "updateLogin";
$q->addTable('users');
$q->addQuery('user_password');
$q->addWhere("user_id = {$this->user_id}");
$pwd = $q->loadResult();
if ($pwd != $this->user_password) {
$this->user_password = md5($this->user_password);
addHistory($this->_tbl, $this->user_id, 'password changed', 'Password changed from IP ' . $_SERVER['REMOTE_ADDR']);
} else {
$this->user_password = null;
}
$ret = db_updateObject('users', $this, 'user_id', false);
} else {
$perm_func = "addLogin";
$this->user_password = md5($this->user_password);
$ret = db_insertObject('users', $this, 'user_id');
}
if (!$ret) {
return get_class($this) . "::store failed <br />" . db_error();
} else {
$acl =& $GLOBALS['AppUI']->acl();
$acl->{$perm_func}($this->user_id, $this->user_username);
return NULL;
}
}
示例2: delete
function delete()
{
$q = new DBQuery();
$q->setDelete('forum_visits');
$q->addWhere('visit_forum = ' . $this->forum_id);
$q->exec();
// No error if this fails, it is not important.
$q->clear();
$q->setDelete('forums');
$q->addWhere('forum_id = ' . $this->forum_id);
if (!$q->exec()) {
$q->clear();
return db_error();
}
// $sql = "DELETE FROM forum_messages WHERE message_forum = $this->forum_id";
$q->clear();
$q->setDelete('forum_messages');
$q->addWhere('message_forum = ' . $this->forum_id);
if (!$q->exec()) {
$result = db_error();
} else {
addHistory('forums', $this->forum_id, 'delete', $this->forum_name);
$result = NULL;
}
$q->clear();
return $result;
}
示例3: delete
function delete()
{
global $dPconfig;
$this->_message = "deleted";
addHistory('files', $this->file_id, 'delete', $this->file_name, $this->file_project);
// remove the file from the file system
@unlink("{$dPconfig['root_dir']}/files/{$this->file_project}/{$this->file_real_filename}");
// delete any index entries
$q = new DBQuery();
$q->setDelete('files_index');
$q->addQuery('*');
$q->addWhere("file_id = {$this->file_id}");
if (!$q->exec()) {
$q->clear();
return db_error();
}
// delete the main table reference
$q->clear();
$q->setDelete('files');
$q->addQuery('*');
$q->addWhere("file_id = {$this->file_id}");
if (!$q->exec()) {
$q->clear();
return db_error();
}
$q->clear();
return NULL;
}
示例4: prepareRequestAndAddHistory
function prepareRequestAndAddHistory($PRP)
{
$defaultPRP = array('doNotExecute' => false, 'exitOnComplete' => false, 'doNotShowUser' => false, 'directExecute' => false, 'signature' => false, 'timeout' => DEFAULT_MAX_CLIENT_REQUEST_TIMEOUT, 'runCondition' => false, 'status' => 'pending', 'isPluginResponse' => 1, 'sendAfterAllLoad' => false, 'callOpt' => array());
$PRP = array_merge($defaultPRP, $PRP);
@extract($PRP);
if (empty($historyAdditionalData)) {
echo 'noHistoryAdditionalData';
return false;
}
if ($siteData['connectURL'] == 'default' && defined('CONNECT_USING_SITE_URL') && CONNECT_USING_SITE_URL == 1 || $siteData['connectURL'] == 'siteURL') {
$URL = $siteData['URL'];
} else {
//if($siteData['connectURL'] == 'default' || $siteData['connectURL'] == 'adminURL')
$URL = $siteData['adminURL'];
}
$historyData = array('siteID' => $siteData['siteID'], 'actionID' => Reg::get('currentRequest.actionID'), 'userID' => $GLOBALS['userID'], 'type' => $type, 'action' => $action, 'events' => $events, 'URL' => $URL, 'timeout' => $timeout, 'isPluginResponse' => $isPluginResponse);
if ($doNotShowUser) {
$historyData['showUser'] = 'N';
}
if ($parentHistoryID) {
$historyData['parentHistoryID'] = $parentHistoryID;
}
if (!empty($siteData['callOpt'])) {
$callOpt = @unserialize($siteData['callOpt']);
}
if (!empty($siteData['httpAuth'])) {
$callOpt['httpAuth'] = @unserialize($siteData['httpAuth']);
}
if (!empty($runCondition)) {
$historyData['runCondition'] = $runCondition;
}
if (!empty($timeScheduled)) {
$historyData['timeScheduled'] = $timeScheduled;
}
$historyData['callOpt'] = serialize($callOpt);
$historyID = addHistory($historyData, $historyAdditionalData);
if ($signature === false) {
$signature = signData($requestAction . $historyID, $siteData['isOpenSSLActive'], $siteData['privateKey'], $siteData['randomSignature']);
}
$requestParams['username'] = $siteData['adminUsername'];
if (isset($requestParams['secure'])) {
$requestParams['secure'] = secureData($requestParams['secure'], $siteData['isOpenSSLActive'], $siteData['privateKey'], $siteData['randomSignature']);
}
if (!empty($requestParams['args'])) {
$requestParams['args']['parentHID'] = $historyID;
}
$requestData = array('iwp_action' => $requestAction, 'params' => $requestParams, 'id' => $historyID, 'signature' => $signature, 'iwp_admin_version' => APP_VERSION);
$updateHistoryData = array('status' => $status);
updateHistory($updateHistoryData, $historyID);
DB::insert("?:history_raw_details", array('historyID' => $historyID, 'request' => base64_encode(serialize($requestData)), 'panelRequest' => serialize($_REQUEST)));
if ($directExecute) {
set_time_limit(0);
echo 'direct_execute<br />';
executeRequest($historyID, $type, $action, $siteData['URL'], $requestData, $timeout, true, $callOpt);
} else {
echo 'async_call_it_should_be<br />';
if ($exitOnComplete) {
set_time_limit(0);
echo "async_call_it_should_be_working";
Reg::set('currentRequest.exitOnComplete', true);
} elseif ($sendAfterAllLoad) {
Reg::set('currentRequest.sendAfterAllLoad', true);
}
}
return $historyID;
}
示例5: foreach
// --- TBL: val
foreach ($_REQUEST as $val_name => $value) {
if (strpos($val_name, 'input_') !== false) {
$value = urldecode($value);
$rslt = updVal($db, $file_id, $val_name, $value);
if (!$rslt) {
\Sop\Log::error(__FILE__, __LINE__, 'Failed to update val.');
$msg012 = "The update failed.: val";
// 更新に失敗しました: val
\Sop\Api::exitWithError(array("{$msg012} {$value} (: {$val_name})"));
}
}
}
// --- TBL: history
$history_id = -1;
$rslt = addHistory($db, $history_id, $pj_id, $sop_id, $tpl_id, $schema_id, $file_id, $smpl_given_no, $HISTORY_ACTION_FILE_UPD, $date, $user_id, $user_id_2, null);
if (!$rslt) {
\Sop\Log::error(__FILE__, __LINE__, 'Failed to add history.');
$msg013 = "The update failed.: history";
// 更新に失敗しました: history
\Sop\Api::exitWithError(array($msg013));
}
}
// --- フォームの最終更新日時の更新。
$rslt = updValLastUpdateTime($db, $file_id, $target_val_name, $update_time);
if (!$rslt) {
\Sop\Log::error(__FILE__, __LINE__, 'Failed to update last update time.');
$msg014 = "Failed to update last update time.: val";
// フォーム最終更新時刻の更新に失敗しました: val
\Sop\Api::exitWithError(array($msg014));
exit;
示例6: addHistory
$r->addOrder('user_access_log_id');
//execute query and fetch results
$r->exec();
$boot_query_row = $r->fetchRow();
if ($boot_query_row) {
$boot_user_session = $boot_query_row['session_id'];
$boot_user_log_id = $boot_query_row['user_access_log_id'];
}
}
}
do {
if ($boot_user_id == $AppUI->user_id && $boot_user_session == $_COOKIE['PHPSESSID']) {
$AppUI->resetPlace();
$AppUI->redirect('logout=-1');
} else {
addHistory('login', $boot_user_id, 'logout', $details);
w2PsessionDestroy($boot_user_session, $boot_user_log_id);
}
if ($boot_query_row) {
$boot_query_row = $r->fetchRow();
if ($boot_query_row) {
$boot_user_session = $boot_query_row['session_id'];
$boot_user_log_id = $boot_query_row['user_access_log_id'];
} else {
$r->clear();
}
}
} while ($boot_query_row);
$msg = $boot_user_name . ' logged out by ' . $AppUI->user_first_name . ' ' . $AppUI->user_last_name;
$AppUI->setMsg($msg, UI_MSG_OK);
$AppUI->redirect('m=admin&tab=3');
示例7: delete
/**
* @todo Parent store could be partially used
* @todo Can't delete a task with children
*/
function delete()
{
if (!$this->task_id) {
return 'invalid task id';
}
$q = new DBQuery();
if (dPgetConfig('check_task_empty_dynamic') && $this->task_parent != $this->task_id) {
//Check that we are not deleting the only child of a dynamic parent task
$task_test = new CTask();
$task_test->load($this->task_parent);
$siblings = $task_test->getChildren();
if ($task_test->task_dynamic == 1 && count($siblings) <= 1) {
return 'BadDyn_NoChild';
}
}
//load task first because we need info on it to update the parent tasks later
$task = new CTask();
$task->load($this->task_id);
//get child tasks so we can delete them too (no orphans)
$childrenlist = $task->getDeepChildren();
//delete task (if we're actually allowed to delete this task)
$err_msg = parent::delete($task->task_id, $task->task_name, $task->task_project);
if ($err_msg) {
return $err_msg;
}
$this->_action = 'deleted';
if ($task->task_parent != $task->task_id) {
//Has parent, run the update sequence, this child will no longer be in the database
$this->updateDynamics();
}
$q->clear();
//delete children
if (!empty($childrenlist)) {
foreach ($childrenlist as $child_id) {
$ctask = new CTask();
$ctask->load($child_id);
//ignore permissions on child tasks by deleteing task directly from the database
$q->setDelete('tasks');
$q->addWhere('task_id=' . $ctask->task_id);
if (!$q->exec()) {
return db_error();
}
$q->clear();
addHistory('tasks', $ctask->task_id, 'delete', $ctask->task_name, $ctask->task_project);
$this->updateDynamics();
//to update after children are deleted (see above)
}
$this->_action = 'deleted with children';
}
//delete affiliated task_logs (overrides any task_log permissions)
$q->setDelete('task_log');
if (!empty($childrenlist)) {
$q->addWhere('task_log_task IN (' . implode(', ', $childrenlist) . ', ' . $this->task_id . ')');
} else {
$q->addWhere('task_log_task=' . $this->task_id);
}
if (!$q->exec()) {
return db_error();
}
$q->clear();
//delete affiliated task_dependencies
$q->setDelete('task_dependencies');
if (!empty($childrenlist)) {
$q->addWhere('dependencies_task_id IN (' . implode(', ', $childrenlist) . ', ' . $task->task_id . ')');
} else {
$q->addWhere('dependencies_task_id=' . $task->task_id);
}
if (!$q->exec()) {
return db_error();
}
$q->clear();
// delete linked user tasks
$q->setDelete('user_tasks');
if (!empty($childrenlist)) {
$q->addWhere('task_id IN (' . implode(', ', $childrenlist) . ', ' . $task->task_id . ')');
} else {
$q->addWhere('task_id=' . $task->task_id);
}
if (!$q->exec()) {
return db_error();
}
$q->clear();
return NULL;
}
示例8: store
function store()
{
$this->dPTrimAll();
$msg = $this->check();
if ($msg) {
return get_class($this) . '::store-check failed - ' . $msg;
}
if ($this->project_id) {
$ret = db_updateObject('projects', $this, 'project_id', false);
addHistory('projects', $this->project_id, 'update', $this->project_name, $this->project_id);
} else {
$ret = db_insertObject('projects', $this, 'project_id');
addHistory('projects', $this->project_id, 'add', $this->project_name, $this->project_id);
}
//split out related departments and store them seperatly.
$q = new DBQuery();
$q->setDelete('project_departments');
$q->addWhere('project_id=' . $this->project_id);
$q->exec();
$q->clear();
if ($this->project_departments) {
$departments = explode(',', $this->project_departments);
foreach ($departments as $department) {
$q->addTable('project_departments');
$q->addInsert('project_id', $this->project_id);
$q->addInsert('department_id', $department);
$q->exec();
$q->clear();
}
}
//split out related contacts and store them seperatly.
$q->setDelete('project_contacts');
$q->addWhere('project_id=' . $this->project_id);
$q->exec();
$q->clear();
if ($this->project_contacts) {
$contacts = explode(',', $this->project_contacts);
foreach ($contacts as $contact) {
if ($contact) {
$q->addTable('project_contacts');
$q->addInsert('project_id', $this->project_id);
$q->addInsert('contact_id', $contact);
$q->exec();
$q->clear();
}
}
}
return !$ret ? get_class($this) . '::store failed <br />' . db_error() : NULL;
}
示例9: w2PgetCleanParam
// and HTTP auth methods now supported.
if (isset($_POST['login'])) {
$username = w2PgetCleanParam($_POST, 'username', '');
$password = w2PgetCleanParam($_POST, 'password', '');
$redirect = w2PgetCleanParam($_POST, 'redirect', '');
$AppUI->setUserLocale();
@(include_once W2P_BASE_DIR . '/locales/' . $AppUI->user_locale . '/locales.php');
include_once W2P_BASE_DIR . '/locales/core.php';
$ok = $AppUI->login($username, $password);
if (!$ok) {
$AppUI->setMsg('Login Failed', UI_MSG_ERROR);
} else {
//Register login in user_acces_log
$AppUI->registerLogin();
}
addHistory('login', $AppUI->user_id, 'login', $AppUI->user_first_name . ' ' . $AppUI->user_last_name);
$AppUI->redirect('' . $redirect);
}
// set the default ui style
$uistyle = $AppUI->getPref('UISTYLE') ? $AppUI->getPref('UISTYLE') : w2PgetConfig('host_style');
// clear out main url parameters
$m = '';
$a = '';
$u = '';
// check if we are logged in
if ($AppUI->doLogin()) {
// load basic locale settings
$AppUI->setUserLocale();
@(include_once './locales/' . $AppUI->user_locale . '/locales.php');
include_once './locales/core.php';
setlocale(LC_TIME, $AppUI->user_lang);
示例10: store
public function store(CAppUI $AppUI)
{
$perms = $AppUI->acl();
$stored = false;
$errorMsgArray = $this->check();
if (count($errorMsgArray) > 0) {
return $errorMsgArray;
}
if ($this->link_id && $perms->checkModuleItem('links', 'edit', $this->link_id)) {
$q = new DBQuery();
$this->link_date = $q->dbfnNow();
if ($msg = parent::store()) {
return $msg;
}
addHistory('links', $this->link_id, 'update', $this->link_name, $this->link_id);
$stored = true;
}
if (0 == $this->link_id && $perms->checkModuleItem('links', 'add')) {
$q = new DBQuery();
$this->link_date = $q->dbfnNow();
if ($msg = parent::store()) {
return $msg;
}
addHistory('links', $this->link_id, 'add', $this->link_name, $this->link_id);
$stored = true;
}
return $stored;
}
示例11: store
public function store(CAppUI $AppUI)
{
$perms = $AppUI->acl();
$stored = false;
$errorMsgArray = $this->check();
if (count($errorMsgArray) > 0) {
return $errorMsgArray;
}
$this->company_id = (int) $this->company_id;
/*
* TODO: I don't like the duplication on each of these two branches, but I
* don't have a good idea on how to fix it at the moment...
*/
if ($this->company_id && $perms->checkModuleItem('companies', 'edit', $this->company_id)) {
if ($msg = parent::store()) {
return $msg;
}
addHistory('companies', $this->company_id, 'update', $this->company_name, $this->company_id);
$stored = true;
}
if (0 == $this->company_id && $perms->checkModuleItem('companies', 'add')) {
if ($msg = parent::store()) {
return $msg;
}
addHistory('companies', $this->company_id, 'add', $this->company_name, $this->company_id);
$stored = true;
}
if ($stored) {
$custom_fields = new CustomFields('companies', 'addedit', $this->company_id, 'edit');
$custom_fields->bind($_POST);
$sql = $custom_fields->store($this->company_id);
// Store Custom Fields
}
return $stored;
}
示例12: date
// ---------------------------
// データ登録
// ---------------------------
$db->beginTransaction();
$date = date("Y-m-d H:i:s");
// --- TBL: tpl
$rslt = updTplDetail($db, $tpl_id, $tpl_name, $upld_cmnt);
if (!$rslt) {
\Sop\Log::error(__FILE__, __LINE__, 'Failed to update tpl.');
$msg002 = "The update failed.: tpl";
// 更新に失敗しました: tpl
\Sop\Api::exitWithError(array($msg002));
}
// --- TBL: history
$history_id = -1;
$rslt = addHistory($db, $history_id, $pj_id, $sop_id, $tpl_id, $schema_id, null, null, $HISTORY_ACTION_TPL_DETAIL_EDIT, $date, $user_id, null, $upld_cmnt);
if (!$rslt) {
\Sop\Log::error(__FILE__, __LINE__, 'Failed to add history.');
$msg003 = "The registoration failed: history";
// 登録に失敗しました: history
\Sop\Api::exitWithError(array($msg003));
}
// ---------------------------
// 終了処理
// ---------------------------
$db->commit();
$db = null;
$msg004 = "The edit complted.";
// 編集が完了しました
echo json_encode(array('success' => true, 'msg' => \Sop\Api::htmlEncodeLines(array($msg004)), 'role_aprv' => (bool) $role_aprv, 'role_upld' => (bool) $role_upld));
exit;
示例13: delPjRow
\Sop\Log::error(__FILE__, __LINE__, 'Failed to delete clmn.');
$msg010 = "The delete failed.: clmn";
// 削除に失敗しました: clmn
\Sop\Api::exitWithError(array($msg010));
}
// --- TBL: row
$rslt = delPjRow($db, $pj_id);
if (!$rslt) {
\Sop\Log::error(__FILE__, __LINE__, 'Failed to delete row.');
$msg011 = "The delete failed.: row";
// 削除に失敗しました: row
\Sop\Api::exitWithError(array(_("削除に失敗しました: row")));
}
// --- TBL: history
$history_id = -1;
$rslt = addHistory($db, $history_id, $pj_id, null, null, null, null, null, $HISTORY_ACTION_PJ_DEL, date("Y-m-d H:i:s"), $user_id, null, null);
if (!$rslt) {
\Sop\Log::error(__FILE__, __LINE__, 'Failed to delete history.');
$msg012 = "The delete failed.: history";
// 削除に失敗しました: history
\Sop\Api::exitWithError(array($msg012));
}
// ---------------------------
// ファイル削除
// ---------------------------
foreach ($file_path_list as $file_path) {
if (file_exists($file_path)) {
unlink($file_path);
}
}
// ---------------------------
示例14: updSop
\Sop\Api::exitWithError(array($msg005));
}
}
if ($div == 'upd') {
// --- TBL: sop
$rslt = updSop($db, $sop_id, $sop_name, $checker_required_flag);
if (!$rslt) {
\Sop\Log::error(__FILE__, __LINE__, 'Failed to update sop.');
$msg006 = "The update failed.: sop";
// 更新に失敗しました: sop
\Sop\Api::exitWithError(array($msg006));
exit;
}
// --- TBL: history
$history_id = -1;
$rslt = addHistory($db, $history_id, $pj_id, $sop_id, null, null, null, null, $HISTORY_ACTION_SOP_UPD, date("Y-m-d H:i:s"), $user_id, null, null);
if (!$rslt) {
\Sop\Log::error(__FILE__, __LINE__, 'Failed to add history.');
$msg007 = "The update failed.: history";
// 更新に失敗しました: history
\Sop\Api::exitWithError(array($msg007));
}
}
// ---------------------------
// 終了処理
// ---------------------------
$db->commit();
$db = null;
if ($div == 'add') {
$msg008 = "The registration completed.";
// 登録が完了しました
示例15: add2Room
function add2Room($clientID, $user_id, $room)
{
global $Server;
$mes = 'Приглашен в комнату пользователем ' . $Server->wsClients[$clientID][13];
// sendMess($id, $data);
addHistory($user_id, $mes, '000', $room);
if (getRoom($room, $user_id)) {
updateRoom($room, false, $user_id);
} else {
updateRoom($room);
}
foreach ($Server->wsClients as $id => $data) {
if ($data[15] != $room) {
if ($data[12] == $user_id) {
sendMess($id, array('System', $Server->wsClients[$clientID][13] . ' пригласил Вас в чат <a href="index.php?module=kChat&room=' . $room . '">"' . getRoomName($room, $data[12]) . '"</a>', '000;font-weight:bolder'));
getRooms($id);
}
} else {
getUsers($id, $room);
}
}
}