本文整理汇总了PHP中TLS函数的典型用法代码示例。如果您正苦于以下问题:PHP TLS函数的具体用法?PHP TLS怎么用?PHP TLS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TLS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addIssue
function addIssue($dbHandler, $argsObj, $itsObj)
{
$opOK = false;
$msg = '';
$resultsCfg = config_get('results');
$tcaseMgr = new testcase($dbHandler);
$dummy = $tcaseMgr->tree_manager->get_node_hierarchy_info($argsObj->tcversion_id);
$auditSign = $tcaseMgr->getAuditSignature((object) array('id' => $dummy['parent_id']));
$exec = current($tcaseMgr->getExecution($argsObj->exec_id, $argsObj->tcversion_id));
$dummy = $exec['status'];
if (isset($resultsCfg['code_status'][$exec['status']])) {
$dummy = $resultsCfg['code_status'][$exec['status']];
}
$exec['statusVerbose'] = sprintf(lang_get('issue_exec_result'), $dummy);
unset($tcaseMgr);
$signature = sprintf(lang_get('issue_generated_description'), $argsObj->exec_id, $exec['tester_login'], $exec['testplan_name']);
if ($exec['platform_id'] > 0) {
$signature .= sprintf(lang_get('issue_platform'), $exec['platform_name']);
}
$signature .= sprintf(lang_get('issue_build') . lang_get('execution_ts_iso'), $exec['build_name'], $exec['execution_ts']) . "\n" . $exec['statusVerbose'] . "\n\n" . $exec['execution_notes'];
$rs = $itsObj->addIssue($auditSign . ' - ' . sprintf(lang_get('execution_ts_iso'), $exec['execution_ts']), $signature);
if ($rs['status_ok']) {
$msg = $rs['msg'];
$opOK = true;
if (write_execution_bug($dbHandler, $argsObj->exec_id, $rs['id'])) {
logAuditEvent(TLS("audit_executionbug_added", $rs['id']), "CREATE", $argsObj->exec_id, "executions");
}
} else {
$msg = $rs['msg'];
}
return array($opOK, $msg);
}
示例2: doAuthorize
/**
* authorization function verifies login & password and set user session data
* return map
*
*/
function doAuthorize(&$db, $login, $pwd)
{
$result = array('status' => tl::ERROR, 'msg' => null);
$_SESSION['locale'] = TL_DEFAULT_LOCALE;
if (!is_null($pwd) && !is_null($login)) {
$user = new tlUser();
$user->login = $login;
$login_exists = $user->readFromDB($db, tlUser::USER_O_SEARCH_BYLOGIN) >= tl::OK;
if ($login_exists) {
$password_check = auth_does_password_match($user, $pwd);
if ($password_check->status_ok && $user->isActive) {
// 20051007 MHT Solved 0000024 Session confusion
// Disallow two sessions within one browser
if (isset($_SESSION['currentUser']) && !is_null($_SESSION['currentUser'])) {
$result['msg'] = lang_get('login_msg_session_exists1') . ' <a style="color:white;" href="logout.php">' . lang_get('logout_link') . '</a>' . lang_get('login_msg_session_exists2');
} else {
//Setting user's session information
$_SESSION['currentUser'] = $user;
$_SESSION['lastActivity'] = time();
global $g_tlLogger;
$g_tlLogger->endTransaction();
$g_tlLogger->startTransaction();
setUserSession($db, $user->login, $user->dbID, $user->globalRoleID, $user->emailAddress, $user->locale, null);
$result['status'] = tl::OK;
}
} else {
logAuditEvent(TLS("audit_login_failed", $login, $_SERVER['REMOTE_ADDR']), "LOGIN_FAILED", $user->dbID, "users");
}
}
}
return $result;
}
示例3: doOperation
function doOperation(&$dbHandler, $argsObj, $operation)
{
$rights = implode("','", array_keys($argsObj->grant));
$op = new stdClass();
$op->role = new tlRole();
$op->role->rights = tlRight::getAll($dbHandler, "WHERE description IN ('{$rights}')");
$op->role->name = $argsObj->rolename;
$op->role->description = $argsObj->notes;
$op->role->dbID = $argsObj->roleid;
$op->userFeedback = null;
$op->template = 'rolesEdit.tpl';
$result = $op->role->writeToDB($dbHandler);
if ($result >= tl::OK) {
$auditCfg = null;
switch ($operation) {
case 'doCreate':
$auditCfg['msg'] = "audit_role_created";
$auditCfg['activity'] = "CREATE";
break;
case 'doUpdate':
$auditCfg['msg'] = "audit_role_saved";
$auditCfg['activity'] = "SAVE";
break;
}
logAuditEvent(TLS($auditCfg['msg'], $argsObj->rolename), $auditCfg['activity'], $op->role->dbID, "roles");
$op->template = null;
} else {
$op->userFeedback = getRoleErrorMessage($result);
}
return $op;
}
示例4: doAuthorize
/**
* authorization function verifies login & password and set user session data
* return map
*
*/
function doAuthorize(&$db, $login, $pwd)
{
$result = array('status' => tl::ERROR, 'msg' => null);
$_SESSION['locale'] = TL_DEFAULT_LOCALE;
if (!is_null($pwd) && !is_null($login)) {
$user = new tlUser();
$user->login = $login;
$login_exists = $user->readFromDB($db, tlUser::USER_O_SEARCH_BYLOGIN) >= tl::OK;
if ($login_exists) {
$check = auth_does_password_match($user, $pwd);
if (!$check->status_ok) {
$result = array('status' => tl::ERROR, 'msg' => $check->msg);
}
if ($check->status_ok && $user->isActive) {
// Need to do set COOKIE following Mantis model
$auth_cookie_name = config_get('auth_cookie');
$expireOnBrowserClose = false;
setcookie($auth_cookie_name, $user->getSecurityCookie(), $expireOnBrowserClose, '/');
// Disallow two sessions within one browser
if (isset($_SESSION['currentUser']) && !is_null($_SESSION['currentUser'])) {
$result['msg'] = lang_get('login_msg_session_exists1') . ' <a style="color:white;" href="logout.php">' . lang_get('logout_link') . '</a>' . lang_get('login_msg_session_exists2');
} else {
// Setting user's session information
$_SESSION['currentUser'] = $user;
$_SESSION['lastActivity'] = time();
$user->setUserSession($db);
global $g_tlLogger;
$g_tlLogger->endTransaction();
$g_tlLogger->startTransaction();
// setUserSession($db,$user->login, $user->dbID,$user->globalRoleID,$user->emailAddress, $user->locale,null);
$result['status'] = tl::OK;
}
} else {
logAuditEvent(TLS("audit_login_failed", $login, $_SERVER['REMOTE_ADDR']), "LOGIN_FAILED", $user->dbID, "users");
}
}
}
return $result;
}
示例5: doUpdate
function doUpdate($argsObj, &$tprojectMgr, $sessionTprojectID)
{
$key2get = array('status_ok', 'msg');
$op = new stdClass();
$op->ui = new stdClass();
$op->status_ok = 0;
$op->msg = '';
$op->template = null;
$op->reloadType = 'none';
$oldObjData = $tprojectMgr->get_by_id($argsObj->tprojectID);
$op->oldName = $oldObjData['name'];
$check_op = crossChecks($argsObj, $tprojectMgr);
foreach ($key2get as $key) {
$op->{$key} = $check_op[$key];
}
if ($op->status_ok) {
$options = prepareOptions($argsObj);
if ($tprojectMgr->update($argsObj->tprojectID, trim($argsObj->tprojectName), $argsObj->color, $argsObj->notes, $options, $argsObj->active, $argsObj->tcasePrefix, $argsObj->is_public)) {
$op->msg = '';
$tprojectMgr->activate($argsObj->tprojectID, $argsObj->active);
$tprojectMgr->setIssueTrackerEnabled($argsObj->tprojectID, $argsObj->issue_tracker_enabled);
$itMgr = new tlIssueTracker($tprojectMgr->db);
if ($doLink = $argsObj->issue_tracker_id > 0) {
$itMgr->link($argsObj->issue_tracker_id, $argsObj->tprojectID);
} else {
$issueT = $itMgr->getLinkedTo($argsObj->tprojectID);
if (!is_null($issueT)) {
$itMgr->unlink($issueT['issuetracker_id'], $issueT['testproject_id']);
}
}
$tprojectMgr->setReqMgrIntegrationEnabled($argsObj->tprojectID, $argsObj->reqmgr_integration_enabled);
$mgr = new tlReqMgrSystem($tprojectMgr->db);
if ($doLink = $argsObj->reqmgrsystem_id > 0) {
$mgr->link($argsObj->reqmgrsystem_id, $argsObj->tprojectID);
} else {
$et = $mgr->getLinkedTo($argsObj->tprojectID);
if (!is_null($et)) {
$mgr->unlink($et['reqmgrsystem_id'], $et['testproject_id']);
}
}
if (!$argsObj->is_public) {
// does user have an SPECIFIC role on Test Project ?
// if answer is yes => do nothing
if (!tlUser::hasRoleOnTestProject($tprojectMgr->db, $argsObj->userID, $argsObj->tprojectID)) {
$tprojectMgr->addUserRole($argsObj->userID, $argsObj->tprojectID, $argsObj->user->globalRole->dbID);
}
}
$event = new stdClass();
$event->message = TLS("audit_testproject_saved", $argsObj->tprojectName);
$event->logLevel = "AUDIT";
$event->source = "GUI";
$event->objectID = $argsObj->tprojectID;
$event->objectType = "testprojects";
$event->code = "UPDATE";
logEvent($event);
} else {
$op->status_ok = 0;
}
}
if ($op->status_ok) {
if ($sessionTprojectID == $argsObj->tprojectID) {
$op->reloadType = 'reloadNavBar';
}
} else {
$op->ui->doActionValue = 'doUpdate';
$op->ui->buttonValue = lang_get('btn_save');
$op->ui->caption = sprintf(lang_get('caption_edit_tproject'), $op->oldName);
}
return $op;
}
示例6: doSessionStart
case 'doLogin':
case 'ajaxlogin':
doSessionStart();
unset($_SESSION['basehref']);
setPaths();
$op = doAuthorize($db, $args->login, $args->pwd);
if ($op['status'] < tl::OK) {
$gui->note = is_null($op['msg']) ? lang_get('bad_user_passwd') : $op['msg'];
if ($args->action == 'ajaxlogin') {
echo json_encode(array('success' => false, 'reason' => $gui->note));
} else {
$doRender = true;
}
} else {
$args->currentUser = $_SESSION['currentUser'];
logAuditEvent(TLS("audit_login_succeeded", $args->login, $_SERVER['REMOTE_ADDR']), "LOGIN", $args->currentUser->dbID, "users");
if ($args->action == 'ajaxlogin') {
echo json_encode(array('success' => true));
} else {
redirect($_SESSION['basehref'] . "index.php" . ($args->preqURI ? "?reqURI=" . urlencode($args->preqURI) : ""));
}
}
break;
case 'ajaxcheck':
doSessionStart();
unset($_SESSION['basehref']);
setPaths();
$validSession = checkSessionValid($db, false);
// Send a json reply, include localized strings for use in js to display a login form.
echo json_encode(array('validSession' => $validSession, 'username_label' => lang_get('login_name'), 'password_label' => lang_get('password'), 'login_label' => lang_get('btn_login')));
break;
示例7: tlUser
} else {
$user = new tlUser();
$rx = $user->checkPasswordQuality($args->password);
if ($rx['status_ok'] >= tl::OK) {
$result = $user->setPassword($args->password);
if ($result >= tl::OK) {
$user->login = $args->login;
$user->emailAddress = $args->email;
$user->firstName = $args->firstName;
$user->lastName = $args->lastName;
$result = $user->writeToDB($db);
$cfg = config_get('notifications');
if ($cfg->userSignUp->enabled) {
notifyGlobalAdmins($db, $user);
}
logAuditEvent(TLS("audit_users_self_signup", $args->login), "CREATE", $user->dbID, "users");
redirect(TL_BASE_HREF . "login.php?note=first");
exit;
} else {
$message = getUserErrorMessage($result);
}
} else {
$message = $rx['msg'];
}
}
}
$smarty = new TLSmarty();
$gui = $args;
// we get info about THE DEFAULT AUTHENTICATION METHOD
$gui->external_password_mgmt = tlUser::isPasswordMgtExternal();
$gui->message = $message;
示例8: doDelete
function doDelete(&$argsObj, &$cfieldMgr)
{
$op = new stdClass();
$op->user_feedback = '';
$op->cf = null;
$op->template = null;
$op->operation_descr = '';
$cf = $cfieldMgr->get_by_id($argsObj->cfield_id);
if ($cf) {
$cf = $cf[$argsObj->cfield_id];
if ($cfieldMgr->delete($argsObj->cfield_id)) {
logAuditEvent(TLS("audit_cfield_deleted", $cf['name']), "DELETE", $argsObj->cfield_id, "custom_fields");
}
}
return $op;
}
示例9: tlUser
$user = new tlUser(intval($userID));
$user->readFromDB($db);
if (tlUser::isPasswordMgtExternal($user->authentication, $user->authentication)) {
$gui->external_password_mgmt = 1;
$gui->password_mgmt_feedback = sprintf(lang_get('password_mgmt_feedback'), trim($args->login));
}
}
}
if (!$gui->external_password_mgmt && $userID) {
echo __LINE__;
$result = resetPassword($db, $userID);
$gui->note = $result['msg'];
if ($result['status'] >= tl::OK) {
$user = new tlUser($userID);
if ($user->readFromDB($db) >= tl::OK) {
logAuditEvent(TLS("audit_pwd_reset_requested", $user->login), "PWD_RESET", $userID, "users");
}
redirect(TL_BASE_HREF . "login.php?note=lost");
exit;
} else {
if ($result['status'] == tlUser::E_EMAILLENGTH) {
$gui->note = lang_get('mail_empty_address');
} else {
if ($note != "") {
$gui->note = getUserErrorMessage($result['status']);
}
}
}
}
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
示例10: deleteUserRoles
/**
* Deletes all testplan related role assignments for a given testplan
*
* @param int $id the testplan id
* @return tl::OK on success, tl::FALSE else
**/
function deleteUserRoles($id)
{
$debugMsg = 'Class:' . __CLASS__ . ' - Method: ' . __FUNCTION__;
$status = tl::ERROR;
$sql = " /* {$debugMsg} */ DELETE FROM {$this->tables['user_testplan_roles']} " . " WHERE testplan_id = {$id}";
if ($this->db->exec_query($sql)) {
$testPlan = $this->get_by_id($id);
if ($testPlan) {
logAuditEvent(TLS("audit_all_user_roles_removed_testplan", $testPlan['name']), "ASSIGN", $id, "testplans");
}
$status = tl::OK;
}
return $status;
}
示例11: deleteUserRoles
/**
* Deletes all testplan related role assignments for a given testplan
*
* @param int $id the testplan id
* @return tl::OK on success, tl::FALSE else
**/
function deleteUserRoles($id, $users = null, $opt = null)
{
$my['opt'] = array('auditlog' => true);
$my['opt'] = array_merge($my['opt'], (array) $opt);
$debugMsg = 'Class:' . __CLASS__ . ' - Method: ' . __FUNCTION__;
$status = tl::ERROR;
$sql = " /* {$debugMsg} */ DELETE FROM {$this->tables['user_testplan_roles']} " . " WHERE testplan_id = " . intval($id);
if (!is_null($users)) {
$sql .= " AND user_id IN(" . implode(',', $users) . ")";
}
if ($this->db->exec_query($sql) && $my['opt']['auditlog']) {
$testPlan = $this->get_by_id($id);
if ($testPlan) {
if (is_null($users)) {
logAuditEvent(TLS("audit_all_user_roles_removed_testplan", $testPlan['name']), "ASSIGN", $id, "testplans");
} else {
// TBD
}
}
$status = tl::OK;
}
return $status;
}
示例12: addUserRole
/**
* Inserts a testproject related role for a given user
*
* @param integer $userID the id of the user
* @param integer $tproject_id
* @param integer $roleID the role id
*
* @return integer tl::OK on success, tl::ERROR else
**/
function addUserRole($userID, $tproject_id, $roleID)
{
$query = "INSERT INTO {$this->tables['user_testproject_roles']} " . "(user_id,testproject_id,role_id) VALUES ({$userID},{$tproject_id},{$roleID})";
if ($this->db->exec_query($query)) {
$testProject = $this->get_by_id($tproject_id);
$role = tlRole::getByID($this->db, $roleID, tlRole::TLOBJ_O_GET_DETAIL_MINIMUM);
$user = tlUser::getByID($this->db, $userID, tlUser::TLOBJ_O_GET_DETAIL_MINIMUM);
if ($user && $testProject && $role) {
logAuditEvent(TLS("audit_users_roles_added_testproject", $user->getDisplayName(), $testProject['name'], $role->name), "ASSIGN", $tproject_id, "testprojects");
}
return tl::OK;
}
return tl::ERROR;
}
示例13: setDisplayLocation
/**
* set value of location attribute for one or multiple custom fields.
*
*
*/
function setDisplayLocation($tproject_id, $field_id_location)
{
$tproject_info = $this->tree_manager->get_node_hierarchy_info($tproject_id);
foreach ($field_id_location as $field_id => $location) {
$sql = "UPDATE {$this->tables['cfield_testprojects']} " . " SET location=" . intval($location) . " WHERE testproject_id={$tproject_id} AND field_id={$field_id} ";
$this->db->exec_query($sql);
}
if ($tproject_info) {
logAuditEvent(TLS("audit_cfield_location_changed", $tproject_info['name']), "SAVE", $tproject_id, "testprojects");
}
}
示例14: testlinkInitPage
* @filesource attachmentdelete.php
* Deletes an attachment by a given id
*/
require_once '../../config.inc.php';
require_once '../functions/common.php';
require_once '../functions/attachments.inc.php';
testlinkInitPage($db, false, false, "checkRights");
$args = init_args();
$deleteDone = false;
if ($args->id) {
$attachmentRepository = tlAttachmentRepository::create($db);
$attachmentInfo = $attachmentRepository->getAttachmentInfo($args->id);
if ($attachmentInfo && checkAttachmentID($db, $args->id, $attachmentInfo)) {
$deleteDone = $attachmentRepository->deleteAttachment($args->id, $attachmentInfo);
if ($deleteDone) {
logAuditEvent(TLS("audit_attachment_deleted", $attachmentInfo['title']), "DELETE", $args->id, "attachments");
}
}
}
$smarty = new TLSmarty();
$smarty->assign('bDeleted', $deleteDone);
$smarty->display('attachmentdelete.tpl');
/**
* @return object returns the arguments for the page
*/
function init_args()
{
//the id (attachments.id) of the attachment to be deleted
$iParams = array("id" => array(tlInputParameter::INT_N));
$args = new stdClass();
G_PARAMS($iParams, $args);
示例15: deleteInventory
/**
* Deletes item from inventory on db
*
* @param int $itemID
* @return integer returns tl::OK on success, tl:ERROR else
*/
public function deleteInventory($itemID)
{
$auditData = $this->getAuditData();
$auditData = current($auditData);
$this->inventoryId = $itemID;
// check existence / get name of the record
$recordset = $this->readDB($this->inventoryId);
if (!is_null($recordset)) {
$this->name = $recordset[0]['name'];
$result = $this->deleteFromDB();
if ($result == tl::OK) {
logAuditEvent(TLS("audit_inventory_deleted", $this->name, $auditData['tproject_name']), "DELETE", $this->name, "inventory");
$this->userFeedback = langGetFormated('inventory_delete_success', $this->name);
} else {
$this->userFeedback = langGetFormated('inventory_delete_fails', $this->name);
tLog('Internal error: The device "' . $this->name . '" was not deleted.', 'ERROR');
}
} else {
$this->userFeedback = lang_get('inventory_no_device') . ' ID=' . $this->inventoryId;
tLog('Internal error: The device "' . $this->name . '" was not deleted.', 'ERROR');
}
return $result;
}